@bkm016/basalt 0.1.20 → 0.1.21
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/{chunk-1tbv5t08.js → chunk-03b5jh31.js} +1 -1
- package/{chunk-3sg32v3n.js → chunk-0x0459qp.js} +1 -1
- package/{chunk-nszq2z0w.js → chunk-16yz5ebn.js} +1 -1
- package/chunk-1kdd7xry.js +2 -0
- package/{chunk-cks36jdh.js → chunk-225dyk1y.js} +2 -2
- package/{chunk-v7da0aqn.js → chunk-2fymxwe7.js} +2 -2
- package/{chunk-mde2dd79.js → chunk-2m2sa0bp.js} +1 -1
- package/{chunk-fgjw0r6g.js → chunk-35y6nf6k.js} +4 -4
- package/chunk-3qxq264t.js +2 -0
- package/{chunk-cwrf78vs.js → chunk-3s8rpc1w.js} +2 -2
- package/{chunk-wj09qkyw.js → chunk-3t8wz9w8.js} +2 -2
- package/{chunk-gg3kfa12.js → chunk-43qf44t8.js} +2 -2
- package/chunk-49hsqsht.js +2 -0
- package/chunk-4fj91gt1.js +4 -0
- package/{chunk-tb3zsqe8.js → chunk-51a0843g.js} +1 -1
- package/{chunk-51pfvmhh.js → chunk-5h59tby8.js} +69 -69
- package/{chunk-bkhsva5n.js → chunk-5m51j40e.js} +3 -3
- package/{chunk-2fts9k52.js → chunk-5mt8xxex.js} +2 -2
- package/{chunk-5e7yegea.js → chunk-85sjfyjd.js} +1 -1
- package/chunk-97ntcrm7.js +2 -0
- package/{chunk-0bgg0hdd.js → chunk-9t3v8c3m.js} +1 -1
- package/{chunk-7kz9435k.js → chunk-9w1m9av8.js} +3 -3
- package/{chunk-d2f0hq8z.js → chunk-9x28stv0.js} +1 -1
- package/{chunk-c5pg2875.js → chunk-ak95r8mq.js} +254 -250
- package/{chunk-a1vdrgsh.js → chunk-bn1aaewd.js} +4 -4
- package/{chunk-agb771ak.js → chunk-c5ydt3vq.js} +2 -2
- package/{chunk-y83tnkr3.js → chunk-cjh5h31t.js} +2 -2
- package/{chunk-p0e82mee.js → chunk-cr0tqn6j.js} +2 -2
- package/{chunk-np2xnt1g.js → chunk-e8xywvv4.js} +2 -2
- package/{chunk-w6nc3jn7.js → chunk-ewaskman.js} +1 -1
- package/{chunk-w045zk55.js → chunk-feyt85gg.js} +1 -1
- package/{chunk-s8m4svhf.js → chunk-ftg4b5pa.js} +1 -1
- package/{chunk-s819vmwh.js → chunk-g6cc7ac1.js} +2 -2
- package/{chunk-5ja0vsam.js → chunk-gdx1j9c5.js} +3 -3
- package/{chunk-h2pp8mnh.js → chunk-h00wjps7.js} +1 -1
- package/{chunk-4dgqcp6q.js → chunk-h1fwdz4h.js} +1 -1
- package/{chunk-6en06hkk.js → chunk-hhxtc9jn.js} +1 -1
- package/chunk-hrn2ss1a.js +2 -0
- package/chunk-jhwb962k.js +15 -0
- package/{chunk-11xxfc0x.js → chunk-jpwr1sd2.js} +1 -1
- package/chunk-jy07y4pv.js +7 -0
- package/{chunk-0g8rtf05.js → chunk-k9x1r69s.js} +8 -8
- package/chunk-kb5h9rmb.js +2 -0
- package/{chunk-eps1epfr.js → chunk-kgnd32hn.js} +2 -2
- package/{chunk-w9fdcchk.js → chunk-kka12j10.js} +1 -1
- package/{chunk-1gaj43fx.js → chunk-kypdthjg.js} +1 -1
- package/{chunk-30bbdzma.js → chunk-m9386732.js} +12 -12
- package/{chunk-qxpx8dn6.js → chunk-np123myw.js} +3 -3
- package/chunk-ntntwtxn.js +5 -0
- package/{chunk-29g01nrz.js → chunk-qn70tm91.js} +5 -5
- package/{chunk-yk29stq0.js → chunk-qtgc74er.js} +2 -2
- package/{chunk-tp885r8h.js → chunk-qz6ybxjg.js} +9 -9
- package/chunk-r36b12zb.js +2 -0
- package/{chunk-as2mwf79.js → chunk-re8n2te5.js} +1 -1
- package/{chunk-y3vap4a1.js → chunk-rpbxbb92.js} +1 -1
- package/chunk-rqrjzz73.js +2 -0
- package/{chunk-tpetsqzt.js → chunk-scy1p7x2.js} +3 -3
- package/{chunk-svx7mz0w.js → chunk-sq5ppnr3.js} +3 -3
- package/{chunk-e3bgzeb3.js → chunk-syhhzr1j.js} +2 -2
- package/chunk-tmq8ktys.js +3 -0
- package/{chunk-sm9fpy18.js → chunk-ttv805sb.js} +8 -8
- package/{chunk-eyyxqb6y.js → chunk-v878x8zr.js} +2 -2
- package/{chunk-a2z1cy84.js → chunk-ve1b6vg6.js} +1 -1
- package/chunk-w3n8wm44.js +2 -0
- package/{chunk-z9p2ry9w.js → chunk-w3skxmvx.js} +2 -2
- package/chunk-wxzk086k.js +2 -0
- package/chunk-y8mf9tcj.js +25 -0
- package/{chunk-ewr51fwc.js → chunk-z4g2q36h.js} +1 -1
- package/compiled.js +8 -8
- package/package.json +1 -1
- package/ui-test-worker.js +16 -16
- package/web/{chunk-mbpv2w5h.js → chunk-07dd0jed.js} +2 -2
- package/web/chunk-07dd0jed.js.br +0 -0
- package/web/chunk-07dd0jed.js.gz +0 -0
- package/web/{chunk-d7f85w1y.js → chunk-0hvyq55w.js} +1 -1
- package/web/chunk-0hvyq55w.js.br +0 -0
- package/web/chunk-0hvyq55w.js.gz +0 -0
- package/web/{chunk-ahdca62g.js → chunk-0q5drhbk.js} +1 -1
- package/web/chunk-0q5drhbk.js.br +0 -0
- package/web/chunk-0q5drhbk.js.gz +0 -0
- package/web/{chunk-zthww0ws.js → chunk-0w6ta3ps.js} +1 -1
- package/web/chunk-0w6ta3ps.js.br +0 -0
- package/web/chunk-0w6ta3ps.js.gz +0 -0
- package/web/{chunk-aw9bwd4w.js → chunk-16b5anw4.js} +2 -2
- package/web/chunk-16b5anw4.js.br +0 -0
- package/web/chunk-16b5anw4.js.gz +0 -0
- package/web/{chunk-53cg6pxm.js → chunk-21d8pzcm.js} +2 -2
- package/web/chunk-21d8pzcm.js.br +0 -0
- package/web/{chunk-53cg6pxm.js.gz → chunk-21d8pzcm.js.gz} +0 -0
- package/web/{chunk-72st75n7.js → chunk-2c4affp1.js} +3 -3
- package/web/chunk-2c4affp1.js.br +0 -0
- package/web/chunk-2c4affp1.js.gz +0 -0
- package/web/{chunk-1ghnag5v.js → chunk-2dykyq1n.js} +1 -1
- package/web/chunk-2dykyq1n.js.br +0 -0
- package/web/chunk-2dykyq1n.js.gz +0 -0
- package/web/{chunk-znrsm604.js → chunk-2h2w244w.js} +17 -17
- package/web/chunk-2h2w244w.js.br +0 -0
- package/web/chunk-2h2w244w.js.gz +0 -0
- package/web/{chunk-kdegb6pd.js → chunk-2hd51wb6.js} +5 -5
- package/web/chunk-2hd51wb6.js.br +0 -0
- package/web/chunk-2hd51wb6.js.gz +0 -0
- package/web/{chunk-2rnnvxa5.js → chunk-2tc6krye.js} +3 -3
- package/web/chunk-2tc6krye.js.br +0 -0
- package/web/chunk-2tc6krye.js.gz +0 -0
- package/web/{chunk-7h59ac2b.js → chunk-2w27acew.js} +1 -1
- package/web/chunk-2w27acew.js.br +0 -0
- package/web/chunk-2w27acew.js.gz +0 -0
- package/web/{chunk-gbcf0rdk.js → chunk-2w4rdnhj.js} +1 -1
- package/web/chunk-2w4rdnhj.js.br +0 -0
- package/web/chunk-2w4rdnhj.js.gz +0 -0
- package/web/{chunk-gj6bdv1y.js → chunk-31vxes2p.js} +9 -9
- package/web/chunk-31vxes2p.js.br +0 -0
- package/web/chunk-31vxes2p.js.gz +0 -0
- package/web/chunk-32qd2y5h.js +1 -0
- package/web/chunk-32qd2y5h.js.br +0 -0
- package/web/chunk-32qd2y5h.js.gz +0 -0
- package/web/{chunk-qx5ab39c.js → chunk-39kaz6fa.js} +2 -2
- package/web/chunk-39kaz6fa.js.br +0 -0
- package/web/chunk-39kaz6fa.js.gz +0 -0
- package/web/{chunk-mj8dzc8q.js → chunk-3d3y4tep.js} +5 -5
- package/web/chunk-3d3y4tep.js.br +0 -0
- package/web/chunk-3d3y4tep.js.gz +0 -0
- package/web/chunk-4makcmpw.js +1 -0
- package/web/chunk-4makcmpw.js.br +0 -0
- package/web/chunk-4makcmpw.js.gz +0 -0
- package/web/{chunk-1ps9fj5n.js → chunk-4zftsyq2.js} +2 -2
- package/web/chunk-4zftsyq2.js.br +0 -0
- package/web/chunk-4zftsyq2.js.gz +0 -0
- package/web/{chunk-bks2k04k.js → chunk-50wrjr22.js} +1 -1
- package/web/chunk-50wrjr22.js.br +0 -0
- package/web/chunk-50wrjr22.js.gz +0 -0
- package/web/{chunk-mhzqgzh0.js → chunk-55kw8p9r.js} +1 -1
- package/web/chunk-55kw8p9r.js.br +0 -0
- package/web/chunk-55kw8p9r.js.gz +0 -0
- package/web/{chunk-gpjytpyw.js → chunk-56tqa12m.js} +2 -2
- package/web/chunk-56tqa12m.js.br +0 -0
- package/web/chunk-56tqa12m.js.gz +0 -0
- package/web/{chunk-wbxz2bjb.js → chunk-595tqsv5.js} +1 -1
- package/web/chunk-595tqsv5.js.br +0 -0
- package/web/chunk-595tqsv5.js.gz +0 -0
- package/web/chunk-5h193k2c.js +1 -0
- package/web/chunk-5h193k2c.js.br +0 -0
- package/web/chunk-5h193k2c.js.gz +0 -0
- package/web/{chunk-k4pknkvp.js → chunk-5nbmnchg.js} +1 -1
- package/web/chunk-5nbmnchg.js.br +0 -0
- package/web/chunk-5nbmnchg.js.gz +0 -0
- package/web/{chunk-gk1bc3c3.js → chunk-5vc1wkwb.js} +1 -1
- package/web/chunk-5vc1wkwb.js.br +0 -0
- package/web/chunk-5vc1wkwb.js.gz +0 -0
- package/web/{chunk-tgeeggkh.js → chunk-5wgdprjp.js} +1 -1
- package/web/chunk-5wgdprjp.js.br +0 -0
- package/web/chunk-5wgdprjp.js.gz +0 -0
- package/web/{chunk-esckazz2.js → chunk-60fbfw70.js} +1 -1
- package/web/chunk-60fbfw70.js.br +0 -0
- package/web/chunk-60fbfw70.js.gz +0 -0
- package/web/{chunk-v5p2fds9.js → chunk-62z94rt2.js} +4 -4
- package/web/chunk-62z94rt2.js.br +0 -0
- package/web/chunk-62z94rt2.js.gz +0 -0
- package/web/chunk-67khfy00.css +1 -0
- package/web/chunk-67khfy00.css.br +0 -0
- package/web/chunk-67khfy00.css.gz +0 -0
- package/web/chunk-6bt2t0xt.js +8 -0
- package/web/chunk-6bt2t0xt.js.br +0 -0
- package/web/chunk-6bt2t0xt.js.gz +0 -0
- package/web/{chunk-h1c0m3g4.js → chunk-780qvh05.js} +3 -3
- package/web/chunk-780qvh05.js.br +0 -0
- package/web/chunk-780qvh05.js.gz +0 -0
- package/web/{chunk-k6fwzn0z.js → chunk-78t5dqea.js} +1 -1
- package/web/chunk-78t5dqea.js.br +0 -0
- package/web/chunk-78t5dqea.js.gz +0 -0
- package/web/chunk-7edmyret.js +1 -0
- package/web/chunk-7edmyret.js.br +0 -0
- package/web/chunk-7edmyret.js.gz +0 -0
- package/web/{chunk-cmhxtckb.js → chunk-7remkcff.js} +1 -1
- package/web/chunk-7remkcff.js.br +0 -0
- package/web/chunk-7remkcff.js.gz +0 -0
- package/web/chunk-7s062q01.js +1 -0
- package/web/chunk-7s062q01.js.br +0 -0
- package/web/chunk-7s062q01.js.gz +0 -0
- package/web/chunk-82zwwy0b.js +1 -0
- package/web/chunk-82zwwy0b.js.br +0 -0
- package/web/chunk-82zwwy0b.js.gz +0 -0
- package/web/{chunk-wa8wr2y9.js → chunk-8c6h952g.js} +9 -9
- package/web/chunk-8c6h952g.js.br +0 -0
- package/web/chunk-8c6h952g.js.gz +0 -0
- package/web/chunk-8wgev3hd.js +1 -0
- package/web/chunk-8wgev3hd.js.br +0 -0
- package/web/chunk-8wgev3hd.js.gz +0 -0
- package/web/chunk-9vcbnf1m.js +1 -0
- package/web/chunk-9vcbnf1m.js.br +0 -0
- package/web/chunk-9vcbnf1m.js.gz +0 -0
- package/web/{chunk-kedjfh66.js → chunk-abahqsws.js} +1 -1
- package/web/chunk-abahqsws.js.br +0 -0
- package/web/chunk-abahqsws.js.gz +0 -0
- package/web/{chunk-vhpzp7zd.js → chunk-acv6gk2b.js} +1 -1
- package/web/chunk-acv6gk2b.js.br +0 -0
- package/web/chunk-acv6gk2b.js.gz +0 -0
- package/web/{chunk-bg0qgabv.js → chunk-ajpzsx51.js} +1 -1
- package/web/chunk-ajpzsx51.js.br +0 -0
- package/web/chunk-ajpzsx51.js.gz +0 -0
- package/web/chunk-b1b9txvk.js +1 -0
- package/web/chunk-b1b9txvk.js.br +0 -0
- package/web/chunk-b1b9txvk.js.gz +0 -0
- package/web/{chunk-qjg6dw46.js → chunk-b83bzjcx.js} +73 -73
- package/web/chunk-b83bzjcx.js.br +0 -0
- package/web/chunk-b83bzjcx.js.gz +0 -0
- package/web/{chunk-v6snw1sw.js → chunk-c1zhat04.js} +1 -1
- package/web/chunk-c1zhat04.js.br +0 -0
- package/web/chunk-c1zhat04.js.gz +0 -0
- package/web/{chunk-186rp10x.js → chunk-c37hhmtd.js} +1 -1
- package/web/chunk-c37hhmtd.js.br +0 -0
- package/web/chunk-c37hhmtd.js.gz +0 -0
- package/web/{chunk-wvqcbp4a.js → chunk-c69t0ysj.js} +1 -1
- package/web/chunk-c69t0ysj.js.br +0 -0
- package/web/chunk-c69t0ysj.js.gz +0 -0
- package/web/chunk-caz85hz4.js +1 -0
- package/web/chunk-caz85hz4.js.br +0 -0
- package/web/chunk-caz85hz4.js.gz +0 -0
- package/web/{chunk-6n1ha6ta.js → chunk-cbtpaf3e.js} +1 -1
- package/web/chunk-cbtpaf3e.js.br +0 -0
- package/web/chunk-cbtpaf3e.js.gz +0 -0
- package/web/{chunk-dmhezjv3.js → chunk-d1gga18f.js} +4 -4
- package/web/chunk-d1gga18f.js.br +0 -0
- package/web/chunk-d1gga18f.js.gz +0 -0
- package/web/{chunk-q0srq8g5.js → chunk-d4kjy2qn.js} +1 -1
- package/web/chunk-d4kjy2qn.js.br +0 -0
- package/web/chunk-d4kjy2qn.js.gz +0 -0
- package/web/{chunk-v2bkkhb8.js → chunk-dbv8qpen.js} +41 -41
- package/web/chunk-dbv8qpen.js.br +0 -0
- package/web/chunk-dbv8qpen.js.gz +0 -0
- package/web/{chunk-37hmswdk.js → chunk-e6r1sb5r.js} +5 -5
- package/web/chunk-e6r1sb5r.js.br +0 -0
- package/web/chunk-e6r1sb5r.js.gz +0 -0
- package/web/chunk-ep5qff8m.js +1 -0
- package/web/chunk-ep5qff8m.js.br +0 -0
- package/web/chunk-ep5qff8m.js.gz +0 -0
- package/web/{chunk-c28crzwk.js → chunk-ex66t805.js} +1 -1
- package/web/chunk-ex66t805.js.br +0 -0
- package/web/chunk-ex66t805.js.gz +0 -0
- package/web/chunk-fb8qtyqg.js +1 -0
- package/web/chunk-fb8qtyqg.js.br +0 -0
- package/web/chunk-fb8qtyqg.js.gz +0 -0
- package/web/{chunk-vpbnyz43.js → chunk-fbzhgaak.js} +1 -1
- package/web/chunk-fbzhgaak.js.br +0 -0
- package/web/chunk-fbzhgaak.js.gz +0 -0
- package/web/{chunk-9n1nsdqs.js → chunk-ffwyfdg4.js} +1 -1
- package/web/chunk-ffwyfdg4.js.br +0 -0
- package/web/chunk-ffwyfdg4.js.gz +0 -0
- package/web/{chunk-0tcmnvab.js → chunk-fsz1msjr.js} +1 -1
- package/web/chunk-fsz1msjr.js.br +0 -0
- package/web/chunk-fsz1msjr.js.gz +0 -0
- package/web/{chunk-nb58m79v.js → chunk-fztzcy7c.js} +1 -1
- package/web/chunk-fztzcy7c.js.br +0 -0
- package/web/chunk-fztzcy7c.js.gz +0 -0
- package/web/chunk-g4st8a4e.js +1 -0
- package/web/chunk-g4st8a4e.js.br +0 -0
- package/web/chunk-g4st8a4e.js.gz +0 -0
- package/web/{chunk-82q4e8ff.js → chunk-gs41j1vb.js} +1 -1
- package/web/chunk-gs41j1vb.js.br +0 -0
- package/web/chunk-gs41j1vb.js.gz +0 -0
- package/web/{chunk-dmzvhbpn.js → chunk-gt4dzb4b.js} +3 -3
- package/web/chunk-gt4dzb4b.js.br +0 -0
- package/web/chunk-gt4dzb4b.js.gz +0 -0
- package/web/{chunk-1yvcxpp2.js → chunk-h4g8j133.js} +4 -4
- package/web/chunk-h4g8j133.js.br +0 -0
- package/web/chunk-h4g8j133.js.gz +0 -0
- package/web/chunk-ht3cek8b.js +1 -0
- package/web/chunk-ht3cek8b.js.br +2 -0
- package/web/chunk-ht3cek8b.js.gz +0 -0
- package/web/{chunk-3fd6mgf0.js → chunk-hw4f79k8.js} +1 -1
- package/web/chunk-hw4f79k8.js.br +0 -0
- package/web/chunk-hw4f79k8.js.gz +0 -0
- package/web/{chunk-js940jjj.js → chunk-j2y3wkxc.js} +4 -4
- package/web/chunk-j2y3wkxc.js.br +0 -0
- package/web/chunk-j2y3wkxc.js.gz +0 -0
- package/web/{chunk-vh2prc6k.js → chunk-j7sfcfxr.js} +1 -1
- package/web/chunk-j7sfcfxr.js.br +0 -0
- package/web/chunk-j7sfcfxr.js.gz +0 -0
- package/web/{chunk-ye7vge7s.js → chunk-jge5e8c4.js} +1 -1
- package/web/chunk-jge5e8c4.js.br +0 -0
- package/web/chunk-jge5e8c4.js.gz +0 -0
- package/web/chunk-jyjgvcac.js +2 -0
- package/web/chunk-jyjgvcac.js.br +0 -0
- package/web/chunk-jyjgvcac.js.gz +0 -0
- package/web/chunk-k9bzz441.js +1 -0
- package/web/chunk-k9bzz441.js.br +0 -0
- package/web/chunk-k9bzz441.js.gz +0 -0
- package/web/{chunk-e2z3kdhw.js → chunk-keway722.js} +3 -3
- package/web/chunk-keway722.js.br +0 -0
- package/web/chunk-keway722.js.gz +0 -0
- package/web/{chunk-ezj5rjqr.js → chunk-kr7shpnb.js} +1 -1
- package/web/chunk-kr7shpnb.js.br +0 -0
- package/web/chunk-kr7shpnb.js.gz +0 -0
- package/web/chunk-kv5swske.js +1 -0
- package/web/chunk-kv5swske.js.br +0 -0
- package/web/chunk-kv5swske.js.gz +0 -0
- package/web/{chunk-a8qe7kvz.js → chunk-kx2k462h.js} +1 -1
- package/web/chunk-kx2k462h.js.br +0 -0
- package/web/chunk-kx2k462h.js.gz +0 -0
- package/web/{chunk-recfg8af.js → chunk-m5b7hny2.js} +1 -1
- package/web/chunk-m5b7hny2.js.br +0 -0
- package/web/chunk-m5b7hny2.js.gz +0 -0
- package/web/{chunk-vxadngbp.js → chunk-m7kypzvp.js} +1 -1
- package/web/chunk-m7kypzvp.js.br +0 -0
- package/web/chunk-m7kypzvp.js.gz +0 -0
- package/web/{chunk-mwfrxgbs.js → chunk-n00se8nk.js} +1 -1
- package/web/chunk-n00se8nk.js.br +0 -0
- package/web/chunk-n00se8nk.js.gz +0 -0
- package/web/{chunk-hqt1f3fm.js → chunk-ngdj0r7w.js} +1 -1
- package/web/chunk-ngdj0r7w.js.br +0 -0
- package/web/chunk-ngdj0r7w.js.gz +0 -0
- package/web/{chunk-zbzgd8kn.js → chunk-p6ma361e.js} +1 -1
- package/web/chunk-p6ma361e.js.br +0 -0
- package/web/chunk-p6ma361e.js.gz +0 -0
- package/web/{chunk-1ratg1jd.js → chunk-pvhz0gqy.js} +1 -1
- package/web/chunk-pvhz0gqy.js.br +0 -0
- package/web/chunk-pvhz0gqy.js.gz +0 -0
- package/web/chunk-q96eky9v.js +1 -0
- package/web/chunk-q96eky9v.js.br +0 -0
- package/web/chunk-q96eky9v.js.gz +0 -0
- package/web/{chunk-1cwyy3gh.js → chunk-qcgs1mft.js} +1 -1
- package/web/chunk-qcgs1mft.js.br +0 -0
- package/web/chunk-qcgs1mft.js.gz +0 -0
- package/web/{chunk-hwxj58j5.js → chunk-qh24q7c0.js} +1 -1
- package/web/chunk-qh24q7c0.js.br +0 -0
- package/web/chunk-qh24q7c0.js.gz +0 -0
- package/web/chunk-r1xksxab.js +1 -0
- package/web/chunk-r1xksxab.js.br +0 -0
- package/web/chunk-r1xksxab.js.gz +0 -0
- package/web/{chunk-fjrgg82c.js → chunk-rsc5k5he.js} +4 -4
- package/web/chunk-rsc5k5he.js.br +0 -0
- package/web/chunk-rsc5k5he.js.gz +0 -0
- package/web/{chunk-apr33amc.js → chunk-s7a2f62f.js} +1 -1
- package/web/chunk-s7a2f62f.js.br +0 -0
- package/web/chunk-s7a2f62f.js.gz +0 -0
- package/web/{chunk-0h0whn75.js → chunk-sac6fn9n.js} +1 -1
- package/web/chunk-sac6fn9n.js.br +0 -0
- package/web/chunk-sac6fn9n.js.gz +0 -0
- package/web/{chunk-6a3wt5c5.js → chunk-t0xjx21h.js} +3 -3
- package/web/chunk-t0xjx21h.js.br +0 -0
- package/web/chunk-t0xjx21h.js.gz +0 -0
- package/web/{chunk-tg3f9xmp.js → chunk-v7ck87jf.js} +1 -1
- package/web/chunk-v7ck87jf.js.br +0 -0
- package/web/chunk-v7ck87jf.js.gz +0 -0
- package/web/{chunk-jmnzcm1f.js → chunk-vvk9nche.js} +4 -4
- package/web/chunk-vvk9nche.js.br +0 -0
- package/web/chunk-vvk9nche.js.gz +0 -0
- package/web/chunk-vxtfen72.js +1 -0
- package/web/chunk-vxtfen72.js.br +0 -0
- package/web/chunk-vxtfen72.js.gz +0 -0
- package/web/{chunk-81xbfpbq.js → chunk-w5c2r59n.js} +1 -1
- package/web/chunk-w5c2r59n.js.br +0 -0
- package/web/chunk-w5c2r59n.js.gz +0 -0
- package/web/{chunk-08w40agf.js → chunk-wh0vt2vd.js} +7 -7
- package/web/chunk-wh0vt2vd.js.br +0 -0
- package/web/chunk-wh0vt2vd.js.gz +0 -0
- package/web/chunk-xe7fj72r.js +1 -0
- package/web/chunk-xe7fj72r.js.br +0 -0
- package/web/chunk-xe7fj72r.js.gz +0 -0
- package/web/{chunk-59h87pvn.js → chunk-yarsp7h7.js} +1 -1
- package/web/chunk-yarsp7h7.js.br +0 -0
- package/web/chunk-yarsp7h7.js.gz +0 -0
- package/web/{chunk-x2hxq5yr.js → chunk-yw5wyz1q.js} +1 -1
- package/web/chunk-yw5wyz1q.js.br +0 -0
- package/web/chunk-yw5wyz1q.js.gz +0 -0
- package/web/chunk-z3ea4vhk.js +1 -0
- package/web/chunk-z3ea4vhk.js.br +0 -0
- package/web/chunk-z3ea4vhk.js.gz +0 -0
- package/web/{chunk-6pbhqbv0.js → chunk-z7adzvfz.js} +1 -1
- package/web/chunk-z7adzvfz.js.br +0 -0
- package/web/chunk-z7adzvfz.js.gz +0 -0
- package/web/{chunk-mh3nkkpx.js → chunk-zb01zmms.js} +6 -6
- package/web/chunk-zb01zmms.js.br +0 -0
- package/web/chunk-zb01zmms.js.gz +0 -0
- package/web/index.html +1 -1
- package/web/index.html.br +0 -0
- package/web/index.html.gz +0 -0
- package/worker.js +1 -1
- package/chunk-0wwd4q6h.js +0 -5
- package/chunk-204c01mz.js +0 -25
- package/chunk-4wc2gbhe.js +0 -2
- package/chunk-5tsfqsmf.js +0 -2
- package/chunk-6hatfwsq.js +0 -2
- package/chunk-78ky455y.js +0 -4
- package/chunk-8mqaq042.js +0 -2
- package/chunk-g9hsrrj5.js +0 -2
- package/chunk-gpceyezp.js +0 -2
- package/chunk-h4n0gg11.js +0 -2
- package/chunk-jzya0e5n.js +0 -7
- package/chunk-ncb0tyaw.js +0 -2
- package/chunk-tpeg9fkd.js +0 -2
- package/chunk-v0mw006s.js +0 -15
- package/chunk-ys2fds2x.js +0 -3
- package/chunk-yshdvnsp.js +0 -2
- package/web/chunk-08w40agf.js.br +0 -0
- package/web/chunk-08w40agf.js.gz +0 -0
- package/web/chunk-0bfypmyv.js +0 -1
- package/web/chunk-0bfypmyv.js.br +0 -2
- package/web/chunk-0bfypmyv.js.gz +0 -0
- package/web/chunk-0h0whn75.js.br +0 -0
- package/web/chunk-0h0whn75.js.gz +0 -0
- package/web/chunk-0pzs9k06.js +0 -1
- package/web/chunk-0pzs9k06.js.br +0 -0
- package/web/chunk-0pzs9k06.js.gz +0 -0
- package/web/chunk-0tcmnvab.js.br +0 -0
- package/web/chunk-0tcmnvab.js.gz +0 -0
- package/web/chunk-186rp10x.js.br +0 -0
- package/web/chunk-186rp10x.js.gz +0 -0
- package/web/chunk-1cwyy3gh.js.br +0 -0
- package/web/chunk-1cwyy3gh.js.gz +0 -0
- package/web/chunk-1ecsxh85.js +0 -1
- package/web/chunk-1ecsxh85.js.br +0 -0
- package/web/chunk-1ecsxh85.js.gz +0 -0
- package/web/chunk-1ghnag5v.js.br +0 -0
- package/web/chunk-1ghnag5v.js.gz +0 -0
- package/web/chunk-1ps9fj5n.js.br +0 -0
- package/web/chunk-1ps9fj5n.js.gz +0 -0
- package/web/chunk-1ratg1jd.js.br +0 -0
- package/web/chunk-1ratg1jd.js.gz +0 -0
- package/web/chunk-1yvcxpp2.js.br +0 -0
- package/web/chunk-1yvcxpp2.js.gz +0 -0
- package/web/chunk-2r3w0pt0.js +0 -8
- package/web/chunk-2r3w0pt0.js.br +0 -0
- package/web/chunk-2r3w0pt0.js.gz +0 -0
- package/web/chunk-2rnnvxa5.js.br +0 -0
- package/web/chunk-2rnnvxa5.js.gz +0 -0
- package/web/chunk-2stffcvc.js +0 -1
- package/web/chunk-2stffcvc.js.br +0 -0
- package/web/chunk-2stffcvc.js.gz +0 -0
- package/web/chunk-2svqgkqw.js +0 -1
- package/web/chunk-2svqgkqw.js.br +0 -0
- package/web/chunk-2svqgkqw.js.gz +0 -0
- package/web/chunk-37hmswdk.js.br +0 -0
- package/web/chunk-37hmswdk.js.gz +0 -0
- package/web/chunk-3fd6mgf0.js.br +0 -0
- package/web/chunk-3fd6mgf0.js.gz +0 -0
- package/web/chunk-53cg6pxm.js.br +0 -0
- package/web/chunk-59h87pvn.js.br +0 -0
- package/web/chunk-59h87pvn.js.gz +0 -0
- package/web/chunk-6a3wt5c5.js.br +0 -0
- package/web/chunk-6a3wt5c5.js.gz +0 -0
- package/web/chunk-6n1ha6ta.js.br +0 -0
- package/web/chunk-6n1ha6ta.js.gz +0 -0
- package/web/chunk-6pbhqbv0.js.br +0 -0
- package/web/chunk-6pbhqbv0.js.gz +0 -0
- package/web/chunk-72st75n7.js.br +0 -0
- package/web/chunk-72st75n7.js.gz +0 -0
- package/web/chunk-7h59ac2b.js.br +0 -0
- package/web/chunk-7h59ac2b.js.gz +0 -0
- package/web/chunk-81xbfpbq.js.br +0 -0
- package/web/chunk-81xbfpbq.js.gz +0 -0
- package/web/chunk-82q4e8ff.js.br +0 -0
- package/web/chunk-82q4e8ff.js.gz +0 -0
- package/web/chunk-89e8629e.js +0 -1
- package/web/chunk-89e8629e.js.br +0 -0
- package/web/chunk-89e8629e.js.gz +0 -0
- package/web/chunk-9n1nsdqs.js.br +0 -0
- package/web/chunk-9n1nsdqs.js.gz +0 -0
- package/web/chunk-a8qe7kvz.js.br +0 -0
- package/web/chunk-a8qe7kvz.js.gz +0 -0
- package/web/chunk-ahdca62g.js.br +0 -0
- package/web/chunk-ahdca62g.js.gz +0 -0
- package/web/chunk-apr33amc.js.br +0 -0
- package/web/chunk-apr33amc.js.gz +0 -0
- package/web/chunk-aw9bwd4w.js.br +0 -0
- package/web/chunk-aw9bwd4w.js.gz +0 -0
- package/web/chunk-bg0qgabv.js.br +0 -0
- package/web/chunk-bg0qgabv.js.gz +0 -0
- package/web/chunk-bks2k04k.js.br +0 -0
- package/web/chunk-bks2k04k.js.gz +0 -0
- package/web/chunk-c28crzwk.js.br +0 -0
- package/web/chunk-c28crzwk.js.gz +0 -0
- package/web/chunk-cmhxtckb.js.br +0 -0
- package/web/chunk-cmhxtckb.js.gz +0 -0
- package/web/chunk-d7f85w1y.js.br +0 -0
- package/web/chunk-d7f85w1y.js.gz +0 -0
- package/web/chunk-dmhezjv3.js.br +0 -0
- package/web/chunk-dmhezjv3.js.gz +0 -0
- package/web/chunk-dmzvhbpn.js.br +0 -0
- package/web/chunk-dmzvhbpn.js.gz +0 -0
- package/web/chunk-e2z3kdhw.js.br +0 -0
- package/web/chunk-e2z3kdhw.js.gz +0 -0
- package/web/chunk-eqmghkwh.js +0 -1
- package/web/chunk-eqmghkwh.js.br +0 -0
- package/web/chunk-eqmghkwh.js.gz +0 -0
- package/web/chunk-esckazz2.js.br +0 -0
- package/web/chunk-esckazz2.js.gz +0 -0
- package/web/chunk-ezj5rjqr.js.br +0 -0
- package/web/chunk-ezj5rjqr.js.gz +0 -0
- package/web/chunk-fjrgg82c.js.br +0 -0
- package/web/chunk-fjrgg82c.js.gz +0 -0
- package/web/chunk-gbcf0rdk.js.br +0 -0
- package/web/chunk-gbcf0rdk.js.gz +0 -0
- package/web/chunk-gj6bdv1y.js.br +0 -0
- package/web/chunk-gj6bdv1y.js.gz +0 -0
- package/web/chunk-gk1bc3c3.js.br +0 -0
- package/web/chunk-gk1bc3c3.js.gz +0 -0
- package/web/chunk-gpjytpyw.js.br +0 -0
- package/web/chunk-gpjytpyw.js.gz +0 -0
- package/web/chunk-h1c0m3g4.js.br +0 -0
- package/web/chunk-h1c0m3g4.js.gz +0 -0
- package/web/chunk-h1qv0cpd.css +0 -1
- package/web/chunk-h1qv0cpd.css.br +0 -0
- package/web/chunk-h1qv0cpd.css.gz +0 -0
- package/web/chunk-hq7e5xgd.js +0 -1
- package/web/chunk-hq7e5xgd.js.br +0 -0
- package/web/chunk-hq7e5xgd.js.gz +0 -0
- package/web/chunk-hqt1f3fm.js.br +0 -0
- package/web/chunk-hqt1f3fm.js.gz +0 -0
- package/web/chunk-hwxj58j5.js.br +0 -0
- package/web/chunk-hwxj58j5.js.gz +0 -0
- package/web/chunk-hxzb25a8.js +0 -1
- package/web/chunk-hxzb25a8.js.br +0 -0
- package/web/chunk-hxzb25a8.js.gz +0 -0
- package/web/chunk-jmnzcm1f.js.br +0 -0
- package/web/chunk-jmnzcm1f.js.gz +0 -0
- package/web/chunk-js940jjj.js.br +0 -0
- package/web/chunk-js940jjj.js.gz +0 -0
- package/web/chunk-jy9vkfbf.js +0 -1
- package/web/chunk-jy9vkfbf.js.br +0 -0
- package/web/chunk-jy9vkfbf.js.gz +0 -0
- package/web/chunk-k4pknkvp.js.br +0 -0
- package/web/chunk-k4pknkvp.js.gz +0 -0
- package/web/chunk-k6fwzn0z.js.br +0 -0
- package/web/chunk-k6fwzn0z.js.gz +0 -0
- package/web/chunk-kdegb6pd.js.br +0 -0
- package/web/chunk-kdegb6pd.js.gz +0 -0
- package/web/chunk-kedjfh66.js.br +0 -0
- package/web/chunk-kedjfh66.js.gz +0 -0
- package/web/chunk-mbpv2w5h.js.br +0 -0
- package/web/chunk-mbpv2w5h.js.gz +0 -0
- package/web/chunk-mh3nkkpx.js.br +0 -0
- package/web/chunk-mh3nkkpx.js.gz +0 -0
- package/web/chunk-mhzqgzh0.js.br +0 -0
- package/web/chunk-mhzqgzh0.js.gz +0 -0
- package/web/chunk-mj8dzc8q.js.br +0 -0
- package/web/chunk-mj8dzc8q.js.gz +0 -0
- package/web/chunk-mwfrxgbs.js.br +0 -0
- package/web/chunk-mwfrxgbs.js.gz +0 -0
- package/web/chunk-nb58m79v.js.br +0 -0
- package/web/chunk-nb58m79v.js.gz +0 -0
- package/web/chunk-nsna2v2r.js +0 -1
- package/web/chunk-nsna2v2r.js.br +0 -0
- package/web/chunk-nsna2v2r.js.gz +0 -0
- package/web/chunk-nxdp58nf.js +0 -1
- package/web/chunk-nxdp58nf.js.br +0 -0
- package/web/chunk-nxdp58nf.js.gz +0 -0
- package/web/chunk-nytgs01h.js +0 -1
- package/web/chunk-nytgs01h.js.br +0 -0
- package/web/chunk-nytgs01h.js.gz +0 -0
- package/web/chunk-pkxn54jm.js +0 -1
- package/web/chunk-pkxn54jm.js.br +0 -0
- package/web/chunk-pkxn54jm.js.gz +0 -0
- package/web/chunk-q0srq8g5.js.br +0 -0
- package/web/chunk-q0srq8g5.js.gz +0 -0
- package/web/chunk-qjg6dw46.js.br +0 -0
- package/web/chunk-qjg6dw46.js.gz +0 -0
- package/web/chunk-qjjxevxe.js +0 -1
- package/web/chunk-qjjxevxe.js.br +0 -0
- package/web/chunk-qjjxevxe.js.gz +0 -0
- package/web/chunk-qx5ab39c.js.br +0 -0
- package/web/chunk-qx5ab39c.js.gz +0 -0
- package/web/chunk-recfg8af.js.br +0 -0
- package/web/chunk-recfg8af.js.gz +0 -0
- package/web/chunk-tg3f9xmp.js.br +0 -0
- package/web/chunk-tg3f9xmp.js.gz +0 -0
- package/web/chunk-tgeeggkh.js.br +0 -0
- package/web/chunk-tgeeggkh.js.gz +0 -0
- package/web/chunk-v2bkkhb8.js.br +0 -0
- package/web/chunk-v2bkkhb8.js.gz +0 -0
- package/web/chunk-v5p2fds9.js.br +0 -0
- package/web/chunk-v5p2fds9.js.gz +0 -0
- package/web/chunk-v6snw1sw.js.br +0 -0
- package/web/chunk-v6snw1sw.js.gz +0 -0
- package/web/chunk-veadbga2.js +0 -1
- package/web/chunk-veadbga2.js.br +0 -2
- package/web/chunk-veadbga2.js.gz +0 -0
- package/web/chunk-vh2prc6k.js.br +0 -0
- package/web/chunk-vh2prc6k.js.gz +0 -0
- package/web/chunk-vhpzp7zd.js.br +0 -0
- package/web/chunk-vhpzp7zd.js.gz +0 -0
- package/web/chunk-vpbnyz43.js.br +0 -0
- package/web/chunk-vpbnyz43.js.gz +0 -0
- package/web/chunk-vxadngbp.js.br +0 -3
- package/web/chunk-vxadngbp.js.gz +0 -0
- package/web/chunk-wa8wr2y9.js.br +0 -0
- package/web/chunk-wa8wr2y9.js.gz +0 -0
- package/web/chunk-wbxz2bjb.js.br +0 -0
- package/web/chunk-wbxz2bjb.js.gz +0 -0
- package/web/chunk-wgzatts8.js +0 -1
- package/web/chunk-wgzatts8.js.br +0 -0
- package/web/chunk-wgzatts8.js.gz +0 -0
- package/web/chunk-whczyxqw.js +0 -1
- package/web/chunk-whczyxqw.js.br +0 -0
- package/web/chunk-whczyxqw.js.gz +0 -0
- package/web/chunk-wmzz2crn.js +0 -1
- package/web/chunk-wmzz2crn.js.br +0 -0
- package/web/chunk-wmzz2crn.js.gz +0 -0
- package/web/chunk-wvqcbp4a.js.br +0 -0
- package/web/chunk-wvqcbp4a.js.gz +0 -0
- package/web/chunk-x2hxq5yr.js.br +0 -0
- package/web/chunk-x2hxq5yr.js.gz +0 -0
- package/web/chunk-x8bnp6vr.js +0 -1
- package/web/chunk-x8bnp6vr.js.br +0 -0
- package/web/chunk-x8bnp6vr.js.gz +0 -0
- package/web/chunk-xvmzsftt.js +0 -2
- package/web/chunk-xvmzsftt.js.br +0 -0
- package/web/chunk-xvmzsftt.js.gz +0 -0
- package/web/chunk-ye7vge7s.js.br +0 -0
- package/web/chunk-ye7vge7s.js.gz +0 -0
- package/web/chunk-zbzgd8kn.js.br +0 -0
- package/web/chunk-zbzgd8kn.js.gz +0 -0
- package/web/chunk-zhwqscat.js +0 -1
- package/web/chunk-zhwqscat.js.br +0 -0
- package/web/chunk-zhwqscat.js.gz +0 -0
- package/web/chunk-znrsm604.js.br +0 -0
- package/web/chunk-znrsm604.js.gz +0 -0
- package/web/chunk-zthww0ws.js.br +0 -0
- package/web/chunk-zthww0ws.js.gz +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{xt,yn,oo,Yt,io}from"./chunk-cjh5h31t.js";var a=600000;function c(o){let e={calls:[],problems:[]},s=o.split(`
|
|
3
3
|
`);for(let r=0;r<s.length;r++){let t=(s[r]??"").trim();if(!t.startsWith("!"))continue;let n=t.split(/\s+/,1)[0]??"",i=t.slice(n.length).trim();if(n==="!reply"){if(i){e.reply=i;continue}e.reply=s.slice(r+1).join(`
|
|
4
|
-
`);break}if(n==="!think")e.think=i;else if(n==="!then")e.afterTools=i;else if(n==="!fail")e.fail=i||"demo \u6A21\u578B\u6309\u6307\u4EE4\u5931\u8D25";else if(n==="!sleep"){let l=Number(i);if(i&&Number.isFinite(l)&&l>=0)e.sleep=Math.min(l,a);else e.problems.push(`\u300C${t}\u300D\u683C\u5F0F\u5E94\u4E3A !sleep <\u6BEB\u79D2>`)}else if(n==="!tool"){let l=/^!tool\s+(\S+)\s+(\{.*\})$/.exec(t);if(!l?.[1]||!l[2]){e.problems.push(`\u300C${t}\u300D\u683C\u5F0F\u5E94\u4E3A !tool <\u540D\u79F0> <JSON \u53C2\u6570>`);continue}try{e.calls.push({name:l[1],args:JSON.parse(l[2])})}catch{e.problems.push(`\u300C${l[1]}\u300D\u7684 JSON \u53C2\u6570\u65E0\u6CD5\u89E3\u6790`)}}}return e}function p(o){let e=o.content.map((t)=>t.type==="text"?t.text:"[\u56FE\u7247]").join(""),s=e.length>500?`${e.slice(0,500)}\u2026`:e;return`${o.isError?`\u5DE5\u5177 ${o.toolName} \u8C03\u7528\u5931\u8D25`:`\u5DE5\u5177 ${o.toolName} \u8FD4\u56DE`}\uFF1A${s||"\uFF08\u65E0\u6587\u672C\u8F93\u51FA\uFF09"}`}function u(o){let e=o.messages.findLast((s)=>s.role==="user");if(e?.role!=="user")return"";return typeof e.content==="string"?e.content:e.content.map((s)=>s.type==="text"?s.text:"").join("")}function f(o,e){return new Promise((s)=>{let r=setTimeout(s,o);e?.addEventListener("abort",()=>{clearTimeout(r),s()},{once:!0})})}var m=async(o,e)=>{let s=o.messages.at(-1),r=u(o),t=c(r);if(s?.role==="toolResult")return Yt([
|
|
4
|
+
`);break}if(n==="!think")e.think=i;else if(n==="!then")e.afterTools=i;else if(n==="!fail")e.fail=i||"demo \u6A21\u578B\u6309\u6307\u4EE4\u5931\u8D25";else if(n==="!sleep"){let l=Number(i);if(i&&Number.isFinite(l)&&l>=0)e.sleep=Math.min(l,a);else e.problems.push(`\u300C${t}\u300D\u683C\u5F0F\u5E94\u4E3A !sleep <\u6BEB\u79D2>`)}else if(n==="!tool"){let l=/^!tool\s+(\S+)\s+(\{.*\})$/.exec(t);if(!l?.[1]||!l[2]){e.problems.push(`\u300C${t}\u300D\u683C\u5F0F\u5E94\u4E3A !tool <\u540D\u79F0> <JSON \u53C2\u6570>`);continue}try{e.calls.push({name:l[1],args:JSON.parse(l[2])})}catch{e.problems.push(`\u300C${l[1]}\u300D\u7684 JSON \u53C2\u6570\u65E0\u6CD5\u89E3\u6790`)}}}return e}function p(o){let e=o.content.map((t)=>t.type==="text"?t.text:"[\u56FE\u7247]").join(""),s=e.length>500?`${e.slice(0,500)}\u2026`:e;return`${o.isError?`\u5DE5\u5177 ${o.toolName} \u8C03\u7528\u5931\u8D25`:`\u5DE5\u5177 ${o.toolName} \u8FD4\u56DE`}\uFF1A${s||"\uFF08\u65E0\u6587\u672C\u8F93\u51FA\uFF09"}`}function u(o){let e=o.messages.findLast((s)=>s.role==="user");if(e?.role!=="user")return"";return typeof e.content==="string"?e.content:e.content.map((s)=>s.type==="text"?s.text:"").join("")}function f(o,e){return new Promise((s)=>{let r=setTimeout(s,o);e?.addEventListener("abort",()=>{clearTimeout(r),s()},{once:!0})})}var m=async(o,e)=>{let s=o.messages.at(-1),r=u(o),t=c(r);if(s?.role==="toolResult")return Yt([xt(t.afterTools??p(s))]);if(t.sleep)await f(t.sleep,e?.signal);let n=[];if(t.think)n.push(yn(t.think));if(t.problems.length>0)n.push(xt(`\u6307\u4EE4\u65E0\u6548\uFF1A${t.problems.join("\uFF1B")}`));if(t.reply!==void 0)n.push(xt(t.reply));for(let i of t.calls)n.push(oo(i.name,i.args));if(t.fail!==void 0)return Yt(n.length?n:[xt("")],{stopReason:"error",errorMessage:t.fail});if(n.length>0)return Yt(n);return Yt([yn("Echoing the user."),xt(r?`\u4F60\u8BF4\u7684\u662F\uFF1A${r}`:"\u5B8C\u6210")])};function g(){return[{provider:"demo",tokensPerSecond:80},{provider:"demo-instant",tokensPerSecond:void 0}].map((o)=>{let e=io({...o,models:[{id:"echo"}]}),s=(r,t,n,i)=>(e.appendResponses([s]),m(r,t,n,i));return e.setResponses([s]),e.provider})}export{g as demoProviders};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{E}from"./chunk-c5ydt3vq.js";var a={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function p(e,r){let o=e.toLowerCase(),t=e.toUpperCase();return r?.[o]||r?.[t]||E(o)||E(t)||""}function f(e){if(e instanceof URL)return e;try{return new URL(e)}catch{return}}function u(e){return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}function l(e){let r=e.trim().toLowerCase();if(!r)return;if(r.startsWith("[")){let t=r.indexOf("]");if(t!==-1){let n=r.slice(1,t),c=r.slice(t+1);if(c.startsWith(":")){let s=Number.parseInt(c.slice(1),10);return{host:n,port:Number.isNaN(s)?0:s}}return{host:n,port:0}}}if(r.includes(":")&&r.split(":").length>2)return{host:r,port:0};let o=r.lastIndexOf(":");if(o!==-1&&o===r.indexOf(":")){let t=r.slice(0,o),n=Number.parseInt(r.slice(o+1),10);if(!Number.isNaN(n))return{host:t,port:n}}return{host:r,port:0}}function d(e,r,o){let t=p("no_proxy",o).toLowerCase();if(!t)return!0;if(t==="*")return!1;let n=u(e.toLowerCase());return t.split(/[,\s]/).every((c)=>{let s=l(c);if(!s)return!0;if(s.port&&s.port!==r)return!0;let i=u(s.host);if(i.startsWith("*."))i=i.slice(2);else if(i.startsWith(".")||i.startsWith("*"))i=i.slice(1);if(!i)return!0;if(n===i)return!1;if(n.endsWith(`.${i}`))return!1;return!0})}function h(e,r){let o=f(e);if(!o?.protocol||!o.host)return"";let t=o.protocol.split(":",1)[0],n=u(o.hostname||o.host.replace(/:\d*$/,"")),c=Number.parseInt(o.port,10)||a[t]||0;if(!d(n,c,r))return"";let s=p(`${t}_proxy`,r)||p("all_proxy",r);if(s&&!s.includes("://"))s=`${t}://${s}`;return s}var x="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function rn(e,r){let o=h(e,r);if(!o)return;let t;try{t=new URL(o)}catch(n){throw Error(`Invalid proxy URL ${JSON.stringify(o)}: ${n instanceof Error?n.message:String(n)}`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw Error(`${x} Got ${t.protocol}`);return t}
|
|
3
3
|
export{rn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{B}from"./chunk-
|
|
2
|
+
import{B}from"./chunk-9w1m9av8.js";import{_,j}from"./chunk-k9x1r69s.js";import{a}from"./chunk-zkjnt298.js";var N=a(B()),p=a(_());var f=a(_()),A=a(j());import{createHash as L,createPrivateKey as O,createPublicKey as H,sign as K}from"crypto";import{promises as E}from"fs";import{homedir as v}from"os";import{dirname as q,join as P}from"path";class d{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300000;constructor(e,t,s){this.profileData=e,this.init=t,this.callerClientConfig=s}async loadCredentials(){let e=await this.loadToken();if(!e)throw new f.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});let t=e.accessToken,s=Date.now();if(new Date(t.expiresAt).getTime()-s<=d.REFRESH_THRESHOLD)return this.refresh(e);return this.toCredentials(e.accessToken)}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}toCredentials(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken,accountId:e.accountId,expiration:new Date(e.expiresAt)}}async refresh(e){let t=await this.loadToken().catch(()=>e),s=Date.now(),r=new Date(t.accessToken.expiresAt).getTime(),n=new Date(e.accessToken.expiresAt).getTime(),o=r<=s&&n>s?e:t;if(new Date(o.accessToken.expiresAt).getTime()-Date.now()>d.REFRESH_THRESHOLD)return this.toCredentials(o.accessToken);let{SigninClient:h,CreateOAuth2TokenCommand:y}=await import("./chunk-0x0459qp.js"),{logger:m,userAgentAppId:T}=this.callerClientConfig??{},x=((i)=>i?.metadata?.handlerProtocol==="h2")(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,u=this.profileData.region??await this.callerClientConfig?.region?.()??process.env.AWS_REGION,k=new h({credentials:{accessKeyId:"",secretAccessKey:""},region:u,requestHandler:x,logger:m,userAgentAppId:T,...this.init?.clientConfig});this.createDPoPInterceptor(k.middlewareStack);let D={tokenInput:{clientId:o.clientId,refreshToken:o.refreshToken,grantType:"refresh_token"}};try{let i=await k.send(new y(D)),{accessKeyId:l,secretAccessKey:w,sessionToken:g}=i.tokenOutput?.accessToken??{},{refreshToken:C,expiresIn:R}=i.tokenOutput??{};if(!l||!w||!g||!C)throw new f.CredentialsProviderError("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});let b=(R??900)*1000,F=new Date(Date.now()+b),I={...o,accessToken:{...o.accessToken,accessKeyId:l,secretAccessKey:w,sessionToken:g,expiresAt:F.toISOString()},refreshToken:C};return await this.saveToken(I),this.toCredentials(I.accessToken)}catch(i){if(i.name==="AccessDeniedException"){let w=i.error,g;switch(w){case"TOKEN_EXPIRED":g="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":g="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":g="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:g=`Failed to refresh token: ${String(i)}. Please re-authenticate using \`aws login\``}throw new f.CredentialsProviderError(g,{logger:this.logger,tryNextLink:!1})}if(new Date(o.accessToken.expiresAt).getTime()>Date.now())return this.logger?.warn?.(`Failed to refresh token: ${String(i)}. Using existing token until expiry.`),this.toCredentials(o.accessToken);throw new f.CredentialsProviderError(`Failed to refresh token: ${String(i)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){let e=this.getTokenFilePath();try{let t=await E.readFile(e,"utf8"),s=JSON.parse(t),r=["accessToken","clientId","refreshToken","dpopKey"].filter((n)=>!s[n]);if(!s.accessToken?.accountId)r.push("accountId");if(r.length>0)throw new f.CredentialsProviderError(`Token validation failed, missing fields: ${r.join(", ")}`,{logger:this.logger,tryNextLink:!1});return s}catch(t){throw new f.CredentialsProviderError(`Failed to load token from ${e}: ${String(t)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){let t=this.getTokenFilePath(),s=q(t);try{await E.mkdir(s,{recursive:!0})}catch(r){}await E.writeFile(t,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){let e=process.env.AWS_LOGIN_CACHE_DIRECTORY??P(v(),".aws","login","cache"),t=Buffer.from(this.loginSession,"utf8"),s=L("sha256").update(t).digest("hex");return P(e,`${s}.json`)}derToRawSignature(e){let t=2;if(e[t]!==2)throw Error("Invalid DER signature");t++;let s=e[t++],r=e.subarray(t,t+s);if(t+=s,e[t]!==2)throw Error("Invalid DER signature");t++;let n=e[t++],o=e.subarray(t,t+n);r=r[0]===0?r.subarray(1):r,o=o[0]===0?o.subarray(1):o;let c=Buffer.concat([Buffer.alloc(32-r.length),r]),h=Buffer.concat([Buffer.alloc(32-o.length),o]);return Buffer.concat([c,h])}createDPoPInterceptor(e){e.add((t)=>async(s)=>{if(A.HttpRequest.isInstance(s.request)){let r=s.request,n=`${r.protocol}//${r.hostname}${r.port?`:${r.port}`:""}${r.path}`,o=await this.generateDpop(r.method,n);r.headers={...r.headers,DPoP:o}}return t(s)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",t){let s=await this.loadToken();try{let r=O({key:s.dpopKey,format:"pem",type:"sec1"}),o=H(r).export({format:"der",type:"spki"}),c=-1;for(let l=0;l<o.length;l++)if(o[l]===4){c=l;break}let h=o.slice(c+1,c+33),y=o.slice(c+33,c+65),m={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:h.toString("base64url"),y:y.toString("base64url")}},T={jti:crypto.randomUUID(),htm:e,htu:t,iat:Math.floor(Date.now()/1000)},S=Buffer.from(JSON.stringify(m)).toString("base64url"),x=Buffer.from(JSON.stringify(T)).toString("base64url"),u=`${S}.${x}`,k=K("sha256",Buffer.from(u),r),i=this.derToRawSignature(k).toString("base64url");return`${u}.${i}`}catch(r){throw new f.CredentialsProviderError(`Failed to generate Dpop proof: ${r instanceof Error?r.message:String(r)}`,{logger:this.logger,tryNextLink:!1})}}}var U=(e)=>async({callerClientConfig:t}={})=>{e?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");let s=await p.parseKnownFiles(e||{}),r=p.getProfileName({profile:e?.profile??t?.profile}),n=s[r];if(!n?.login_session)throw new p.CredentialsProviderError(`Profile ${r} does not contain login_session.`,{tryNextLink:!0,logger:e?.logger});let c=await new d(n,e,t).loadCredentials();return N.setCredentialFeature(c,"CREDENTIALS_LOGIN","AD")};export{U as fromLoginCredentials};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{o,e,u,cr,
|
|
3
|
-
`);if(r[r.length-1]==="")r.pop();return r}function bt(a,r){return/^[\x20-\x7E]+$/.test(r)&&!/[\\^#]/.test(r)&&!(a==="unzip"&&r.startsWith("-"))}function Ot(a,r,t){let i=xe(r),n=xe(t);if(i.length!==n.length)throw new u(Me);let s=[],c=[];return i.forEach((l,f)=>{if(Et[a].has(n[f].charAt(0))){s.push(l);return}if(!bt(a,l))throw new u(`refusing to extract archive: cannot safely exclude member ${JSON.stringify(l)}`);c.push(l)}),{plain:s,special:c}}async function De(a){for(let r of await
|
|
2
|
+
import{o,e,u,cr,qt,O,be,M,Fo,Fn,ur}from"./chunk-y8mf9tcj.js";import{Do,Rt,ft,k,Un,Uo}from"./chunk-rqrjzz73.js";import*as S from"fs/promises";import*as ne from"fs";import*as v from"path";import*as $e from"child_process";import*as at from"crypto";import*as ct from"readline";function C(a){if(a.inputSchema.type!=="object")throw Error(`JSON schema for tool "${a.name}" must be an object, but got ${a.inputSchema.type}`);return{type:"custom",name:a.name,input_schema:a.inputSchema,description:a.description,run:a.run,parse:(r)=>r,...a.close?{close:a.close}:{}}}var F=ft.promises,J=448,yt=384;function ae(a,r){let t=k.relative(a,r);return t===""||!t.startsWith(".."+k.sep)&&t!==".."&&!k.isAbsolute(t)}async function Se(a,r){for(let t of a)if(ae(await X(k.resolve(t)),r))return t;return}var wt=40;function Z(a){let r=a?.code;return typeof r==="string"?r:void 0}async function X(a){let r=[],t=a,i=0;for(;;){let n;try{n=await F.realpath(t)}catch(s){let c;try{c=(await F.lstat(t)).isSymbolicLink()}catch(l){let f=Z(l);if(f!=="ENOENT"&&f!=="ENOTDIR")throw l;let h=k.dirname(t);if(h===t)throw l;r.push(k.basename(t)),t=h;continue}if(!c)throw s;if(++i>wt)throw Object.assign(Error("too many levels of symbolic links"),{code:"ELOOP"});t=k.resolve(k.dirname(t),await F.readlink(t));continue}return r.length?k.join(n,...r.reverse()):n}}async function Ae(a,r,t){let i=t?.allowedRoots??[],n=await X(k.resolve(a)),s;try{s=await X(k.resolve(n,r))}catch(l){throw new M(q(l,`path ${JSON.stringify(r)}`))}if(ae(n,s)||await Se(i,s)!==void 0)return s;let c=i.length?"the session's working directory and its other permitted directories":"the session's working directory";throw new M(`path ${JSON.stringify(r)} is outside ${c}`)}async function Ee(a,r){let t=k.dirname(a),i=k.join(t,`.tmp-${process.pid}-${Rt.randomUUID()}`),n=await F.stat(a).then((c)=>c.mode&511,()=>{return}),s;try{if(s=await F.open(i,"wx",yt),n!==void 0)await s.chmod(n);await s.writeFile(r,"utf-8"),await s.sync(),await s.close(),s=void 0,await F.rename(i,a)}catch(c){if(s)await s.close().catch(()=>{});throw await F.unlink(i).catch(()=>{}),c}}function q(a,r){let t=Z(a);switch(t){case"ENOENT":return`${r}: no such file or directory`;case"EACCES":case"EPERM":return`${r}: permission denied`;case"ENOTDIR":return`${r}: not a directory`;case"EISDIR":return`${r}: is a directory`;case"ELOOP":return`${r}: too many levels of symbolic links`;case"ENAMETOOLONG":return`${r}: file name too long`;case"ENOSPC":return`${r}: no space left on device`;case"EMFILE":case"ENFILE":return`${r}: too many open files`;default:return`${r}: ${t!==void 0?`i/o error (${t})`:"i/o error"}`}}var N=ft.promises,_t=Uo.promisify(Do.execFile);async function gt(a){let{client:r,sessionId:t}=a;if(!r)return async()=>{};let i=O(r),n=a.session;if(!n){if(t===void 0)return async()=>{};i.warn("AgentToolContext.sessionId is deprecated and costs an extra session fetch; fetch the session once and set `session` instead",{component:"agent-tool-context"}),n=await r.beta.sessions.retrieve(t)}let s=k.resolve(a.workdir,"skills"),c=[];for(let l of n.agent.skills)try{let f=await r.beta.skills.versions.retrieve(l.version,{skill_id:l.skill_id}),h=k.basename(f.name.trim());if(h===""||h==="."||h==="..")h=l.skill_id;let d=k.resolve(s,h);if(d!==s&&!d.startsWith(s+k.sep)){i.warn("skill name escapes the skills dir; skipping",{component:"agent-tool-context",name:f.name});continue}let m=await r.beta.skills.versions.download(f.id,{skill_id:l.skill_id});await N.rm(d,{recursive:!0,force:!0}),await N.mkdir(d,{recursive:!0,mode:J}),c.push(d),await Ce(m,d),i.info("downloaded skill",{component:"agent-tool-context",skill_id:l.skill_id,version:f.id,dest:d})}catch(f){i.warn("failed to download skill",{component:"agent-tool-context",skill_id:l.skill_id,error:String(f)})}return async()=>{for(let l of c)await N.rm(l,{recursive:!0,force:!0}).catch((f)=>{i.warn("failed to clean up skill",{component:"agent-tool-context",dest:l,error:String(f)})})}}function St(a){for(let r of a){let t=r.trim();if(!t)continue;if(k.isAbsolute(t)||t.split(/[\\/]/).includes(".."))throw new u(`refusing to extract unsafe archive member: ${t}`)}}var Me="skill archive listing is inconsistent; refusing to extract",Et={unzip:new Set(["-","d","?"]),tar:new Set(["-","d","C"])};function xe(a){let r=a.split(`
|
|
3
|
+
`);if(r[r.length-1]==="")r.pop();return r}function bt(a,r){return/^[\x20-\x7E]+$/.test(r)&&!/[\\^#]/.test(r)&&!(a==="unzip"&&r.startsWith("-"))}function Ot(a,r,t){let i=xe(r),n=xe(t);if(i.length!==n.length)throw new u(Me);let s=[],c=[];return i.forEach((l,f)=>{if(Et[a].has(n[f].charAt(0))){s.push(l);return}if(!bt(a,l))throw new u(`refusing to extract archive: cannot safely exclude member ${JSON.stringify(l)}`);c.push(l)}),{plain:s,special:c}}async function De(a){for(let r of await N.readdir(a,{withFileTypes:!0}))if(r.isDirectory())await De(k.join(a,r.name));else if(!r.isFile())throw new u(Me)}async function Oe(a,r){try{let{stdout:t}=await _t(a,r);return t}catch(t){if(Z(t)==="ENOENT")throw new u(`skill extraction requires the \`${a}\` command, but it was not found on PATH`);throw t}}function Mt(a){let r,t=!1;for(let i of a){let n=i.trim().split("/").filter((c)=>c!==""&&c!==".");if(n.length===0)continue;let s=n[0];if(r===void 0)r=s;else if(s!==r)return"";if(n.length>1)t=!0}return r!==void 0&&t?r:""}async function Ce(a,r){let t=k.join(r,`.skill-archive-${process.pid}-${Date.now()}`);if(!a.body)throw new u("skill download response had no body");await Un.promises.pipeline(Un.Readable.fromWeb(a.body),ft.createWriteStream(t));let i=k.join(k.dirname(r),`.skill-stage-${process.pid}-${Date.now()}`),n=k.join(k.dirname(r),`.skill-exclude-${process.pid}-${Date.now()}`);try{let s=await kt(t,4),c=s.length>=4&&s[0]===80&&s[1]===75&&s[2]===3&&s[3]===4,l=c?"unzip":"tar",f=await Oe(l,c?["-Z1",t]:["-tf",t]),h=await Oe(l,c?["-Z","--h","--t",t]:["-tvf",t]),{plain:d,special:m}=Ot(l,f,h);St([...d,...m]);let _=Mt(d);if(await N.mkdir(i,{recursive:!0,mode:J}),d.length>0)await Oe(l,await vt(l,t,i,m,n));await De(i);let E=_?k.join(i,_):i,D=await N.readdir(E).catch((I)=>{throw Z(I)==="ENOENT"?new u(Me):I});for(let I of D)await N.rename(k.join(E,I),k.join(r,I))}finally{await N.rm(t,{force:!0}),await N.rm(n,{force:!0}),await N.rm(i,{recursive:!0,force:!0})}}async function vt(a,r,t,i,n){let s=i.map((c)=>c.replace(/[*?[\\]/g,"\\$&"));if(a==="unzip")return["-oq",r,"-d",t,...s.length>0?["-x",...s]:[]];if(s.length===0)return["-xf",r,"-C",t];return await N.writeFile(n,s.join(`
|
|
4
4
|
`)+`
|
|
5
|
-
`,{flag:"wx",mode:384}),["-xf",r,"-C",t,"-X",n]}async function
|
|
6
|
-
${a}`,"utf-8").digest("hex")}var jt=30000,Bt=100,Yt=20,
|
|
7
|
-
${t.memoryStoreId}`);for await(let[i,n]of e(this,w,"m",me).call(this,t.memoryStoreId,"full"))if(await e(this,w,"m",Te).call(this,t,i,n.content??""))t.baseline.set(i,n.content_sha256)},He=async function(t,i,n,s,c){let l=t.baseline.get(i);if(s!==void 0)t.pendingDeletes.delete(i);if(!n){if(s===void 0){t.pendingDeletes.delete(i);return}if(l!==void 0){if(s===l){let _=await e(this,w,"m",Ke).call(this,t,i,l);if(_===void 0)return;if(_===l)return l;s=_}if(t.readOnly)e(this,p,"f").warn("memory deleted remotely but edited locally; keeping the file, which a read-only store cannot push",{path:i,memory_store_id:t.memoryStoreId});else if(t.refusedShas.get(i)!==s)e(this,p,"f").info("memory deleted remotely but edited locally; re-creating it from the file",{path:i,memory_store_id:t.memoryStoreId})}if(t.readOnly)return;if(t.refusedShas.get(i)===s)return;return await e(this,w,"m",ue).call(this,t,i,s,void 0)}let f=n.content_sha256,h=f!==l,d=s!==void 0&&s!==l&&s!==f,m=!t.readOnly&&d;if(s===void 0&&l!==void 0){if(h)e(this,p,"f").warn("memory deleted locally but changed remotely; restoring the remote version",{path:i,memory_store_id:t.memoryStoreId}),t.pendingDeletes.delete(i),c.push([i,n]);return l}if(h){if(s===f)return f;if(d)e(this,p,"f").warn("memory changed both locally and remotely; keeping the remote version",{path:i,memory_store_id:t.memoryStoreId});return c.push([i,n]),l}if(m){if(t.refusedShas.get(i)===s)return f;return await e(this,w,"m",ue).call(this,t,i,s,n)??f}return f},Ke=async function(t,i,n){let s;try{s=await t.files.hashFile(i)}catch(c){if(!(c instanceof y)&&!H(c))throw c;return n}if(s===null)return;if(s!==n)return s;try{await t.files.remove(i)}catch(c){if(!(c instanceof y)&&!H(c))throw c;return e(this,p,"f").warn("failed to remove memory deleted remotely",{path:i,memory_store_id:t.memoryStoreId,error:String(c)}),n}return},Te=async function(t,i,n){try{await t.files.put(i,n)}catch(s){if(!(s instanceof y)&&!H(s))throw s;return e(this,p,"f").warn("failed to write memory",{path:i,memory_store_id:t.memoryStoreId,error:String(s)}),!1}return!0},Ve=async function(t,i){if(i.length===0)return;let n=async(l,f)=>{let h;try{h=await e(this,
|
|
8
|
-
`),ie=102400,Qt=2000,er=200;class
|
|
5
|
+
`,{flag:"wx",mode:384}),["-xf",r,"-C",t,"-X",n]}async function kt(a,r){let t=await N.open(a,"r");try{let i=Buffer.alloc(r),{bytesRead:n}=await t.read(i,0,r,0);return i.subarray(0,n)}finally{await t.close()}}var g=ft.promises,z=ft.constants,Ue=448,It=384,Nt=448,ke=z.O_NOFOLLOW??0,Tt=z.O_NONBLOCK??0,y=(()=>{class a extends Error{constructor(r,t){super(`path ${JSON.stringify(t)} ${r}`);this.name="FileStoreError",this.reason=r,this.relPath=t}}return a.ESCAPES_ROOT="escapes the store root",a.IS_A_SYMLINK="is a symlink",a.NOT_A_FILE="is not a regular file",a.NOT_A_DIRECTORY="is not a directory",a.NOT_UTF8="is not valid utf-8",a.MOVE_DESTINATION_EXISTS="already exists",a})();function Ie(a){return a.startsWith("/")&&!a.split("/").includes("..")}var ve=(()=>{class a{constructor(r,t,i=!1){this.hashes=new Map,this.rootPath=r,this.removedOnDispose=t,this.decoder=i?new TextDecoder("utf-8",{fatal:!0}):void 0}static async open(r,t){if(!Lt())throw Error("FileStore requires O_NOFOLLOW support on this platform");let i=!1;try{await g.lstat(r)}catch(n){if(n.code!=="ENOENT")throw n;i=!0}return new a(k.resolve(r),i,t?.utf8??!1)}async createRoot(){await $t(this.rootPath)}root(){return{path:this.rootPath,removedOnDispose:this.removedOnDispose}}async dispose(){if(!this.removedOnDispose)return;await g.rm(this.rootPath,{recursive:!0,force:!0})}async put(r,t,i){let n=r.replace(/\\/g,"/");if(n.endsWith("/")||n.endsWith("/.")||n===""||n===".")throw new y(y.NOT_A_FILE,r);let s=this.resolveUnderRoot(r),c=typeof t==="string"?cr(t):t;this.requireUtf8(r,c),await Fe(this.rootPath,k.dirname(s)),await At(s,c,i?.executable??!1)}async get(r){let t=this.resolveUnderRoot(r),i;try{i=await je(r,t)}catch(s){if(s.code==="ENOENT")return null;throw s}let n;try{let s=await i.readFile();n=new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}finally{await i.close()}return this.requireUtf8(r,n),n}async ls(r="/"){let t=this.resolveUnderRoot(r);return new Set((await Pe(this.rootPath,r,t)).map(([i])=>i))}async findSymlinks(r="/"){let t=this.resolveUnderRoot(r);return Dt(this.rootPath,r,t)}async hashtree(r="/"){let t=this.resolveUnderRoot(r),i=ce.nowNs(),n=Object.create(null);for(let[s,c]of await Pe(this.rootPath,r,t)){let l=await this.hashViaCache(s,c,i);if(l!==null)n[s]=l}return n}async hashFile(r){let t=this.resolveUnderRoot(r),i;try{i=await g.lstat(t,{bigint:!0})}catch(s){if(s.code==="ENOENT")return null;throw s}if(i.isSymbolicLink())throw new y(y.IS_A_SYMLINK,r);if(!i.isFile())throw new y(y.NOT_A_FILE,r);let n=k.relative(this.rootPath,t).split(k.sep).join("/");return this.hashViaCache(n,t,ce.nowNs())}async move(r,t){let i=this.resolveUnderRoot(r),n=this.resolveUnderRoot(t);if(i===this.rootPath||n===this.rootPath)return;if(await g.stat(n).then(()=>!0,()=>!1))throw new y(y.MOVE_DESTINATION_EXISTS,t);await Fe(this.rootPath,k.dirname(n)),await g.rename(i,n)}async remove(r){let t=this.resolveUnderRoot(r);if(t===this.rootPath)return;let i;try{i=await g.lstat(t,{bigint:!0})}catch(n){if(n.code==="ENOENT")return;throw n}if(i.isDirectory())await g.rm(t,{recursive:!0,force:!0});else try{await g.unlink(t)}catch(n){if(n.code!=="ENOENT")throw n}}resolveUnderRoot(r){let t=r.replace(/\\/g,"/").replace(/^\/+/,""),i=t.split("/").filter((n)=>n!==""&&n!==".");if(k.posix.isAbsolute(t)||i.includes(".."))throw new y(y.ESCAPES_ROOT,r);return i.length===0?this.rootPath:k.join(this.rootPath,...i)}requireUtf8(r,t){if(!this.decoder)return;try{this.decoder.decode(t)}catch{throw new y(y.NOT_UTF8,r)}}async hashViaCache(r,t,i){let n;try{n=await g.lstat(t,{bigint:!0})}catch(l){if(l.code==="ENOENT")return null;throw l}if(!n.isFile())return null;let s=this.hashes.get(r),c;if(s!==void 0&&Ft(s,n))c=s.sha;else try{c=await ce.hashFile(t)}catch(l){let f=l.code;if(f==="ENOENT"||l instanceof y)return null;if(f==="ELOOP"||f==="EMLINK")return null;throw l}if(Pt(n,i))this.hashes.set(r,{mtimeNs:n.mtimeNs,ctimeNs:n.ctimeNs,size:n.size,sha:c});return c}}return a.isPathLegal=Ie,a})();function Lt(){return ke!==0}async function $t(a){let r=[],t=a;for(;;){try{await g.stat(t);break}catch(n){let s=n.code;if(s!=="ENOENT"&&s!=="ENOTDIR"&&s!=="ELOOP")throw n}r.push(t);let i=k.dirname(t);if(i===t)break;t=i}for(let i of r.reverse())try{await g.mkdir(i,{mode:Ue})}catch(n){if(n.code!=="EEXIST")throw n}}async function Fe(a,r){let t=k.relative(a,r);if(t==="")return;let i=a;for(let n of t.split(k.sep)){i=k.join(i,n);try{await g.mkdir(i,{mode:Ue})}catch(s){if(s.code!=="EEXIST")throw s}}}async function At(a,r,t){let i=t?Nt:It,n=k.join(k.dirname(a),`.fs-${Rt.randomBytes(8).toString("hex")}.tmp`),s;try{s=await g.open(n,z.O_WRONLY|z.O_CREAT|z.O_EXCL|ke,i),await s.writeFile(r),await s.close(),s=void 0,await g.rename(n,a)}catch(c){if(s)await s.close().catch(()=>{});throw await g.unlink(n).catch(()=>{}),c}}async function je(a,r){let t;try{t=await g.open(r,z.O_RDONLY|ke|Tt)}catch(i){let n=i.code;if(n==="ELOOP"||n==="EMLINK")throw new y(y.IS_A_SYMLINK,a);throw i}try{if(!(await t.stat()).isFile())throw new y(y.NOT_A_FILE,a)}catch(i){throw await t.close().catch(()=>{}),i}return t}async function xt(a){let r=Rt.createHash("sha256"),t=await je(k.basename(a),a),i=new Uint8Array(1048576);try{for(;;){let{bytesRead:n}=await t.read(i,0,i.length);if(n===0)break;r.update(i.subarray(0,n))}}finally{await t.close()}return r.digest("hex")}async function Pe(a,r,t){if(!await Ct(r,t))return[];let i=[];return await Be(t,(n,s)=>{if(s.isFile())i.push([k.relative(a,n).split(k.sep).join("/"),n])}),i.sort(),i}async function Dt(a,r,t){let i=(c)=>k.relative(a,c).split(k.sep).join("/"),n;try{n=await g.lstat(t,{bigint:!0})}catch(c){let l=c.code;if(l==="ENOENT"||l==="ENOTDIR")return new Set;throw c}if(n.isSymbolicLink())return new Set([i(t)]);if(!n.isDirectory())throw new y(y.NOT_A_DIRECTORY,r);let s=new Set;return await Be(t,(c,l)=>{if(l.isSymbolicLink())s.add(i(c))}),s}async function Ct(a,r){let t;try{t=await g.lstat(r,{bigint:!0})}catch(i){let n=i.code;if(n==="ENOENT"||n==="ENOTDIR")return!1;throw i}if(!t.isDirectory())throw new y(y.NOT_A_DIRECTORY,a);return!0}async function Be(a,r){let t=[a];while(t.length){let i=t.pop(),n;try{n=await g.readdir(i,{withFileTypes:!0})}catch(s){if(s.code==="ENOENT")continue;throw s}for(let s of n){let c=k.join(i,s.name);if(r(c,s),s.isDirectory()&&!s.isSymbolicLink())t.push(c)}}}function Ft(a,r){return r.mtimeNs===a.mtimeNs&&r.ctimeNs===a.ctimeNs&&r.size===a.size}function Pt(a,r){return(a.mtimeNs>a.ctimeNs?a.mtimeNs:a.ctimeNs)<r-ce.timestampTrustMarginNs}var Wt=2000000000n,ce={hashFile:xt,timestampTrustMarginNs:Wt,nowNs:()=>BigInt(Date.now())*1000000n},Ye=ve,We=Symbol.asyncDispose;if(We)Object.defineProperty(ve.prototype,We,{value:ve.prototype.dispose,configurable:!0,writable:!0});var w,L,le,Q,fe,p,G,de,A,qe,he,ze,Ge,Re,Ne,He,Ke,Te,Ve,Xe,me,ue,Je,Ze,Ut=30000,K=".anthropic-memory-store",et=1;function Qe(a){return Rt.createHash("sha256").update(`version ${et}
|
|
6
|
+
${a}`,"utf-8").digest("hex")}var jt=30000,Bt=100,Yt=20,zt=16,Gt=32,Ht=8,Kt=50;class P extends u{constructor(a,r){super(a);if(this.name="SessionMemoryError",r!==void 0)this.cause=r}}class tt{constructor(a,r,t){this.mode=a,this.cap=r,this.waiveWindow=t,this.attempted=0,this.capped=0,this.suppressed=0}takeSlot(){if(this.attempted>=this.cap)return this.capped++,!1;return this.attempted++,!0}}var Vt=(()=>{class a{constructor(r,t){w.add(this),L.set(this,void 0),le.set(this,void 0),Q.set(this,void 0),fe.set(this,void 0),p.set(this,void 0),G.set(this,void 0),de.set(this,!1),A.set(this,[]),o(this,L,r,"f"),o(this,le,t.workdir,"f"),o(this,Q,t.syncIntervalMs??Fo,"f"),Fn(e(this,Q,"f"),"syncIntervalMs"),o(this,fe,t.syncDeletions??"enabled","f"),o(this,p,O(r),"f"),o(this,G,Date.now(),"f")}get roots(){return e(this,A,"f").map((r)=>r.files.root().path)}get readOnlyRoots(){return e(this,A,"f").filter((r)=>r.readOnly).map((r)=>r.files.root().path)}async download(r){for(let t of r.resources){if(t.type!=="memory_store")continue;let i=e(this,w,"m",qe).call(this,t),n;try{if(n={memoryStoreId:t.memory_store_id,files:await Ye.open(i,{utf8:!0}),readOnly:t.access==="read_only",baseline:new Map,refusedShas:new Map,pendingDeletes:new Map},!n.files.root().removedOnDispose)throw new P(`something already exists at the memory store's path: ${i} (memory_store_id=${t.memory_store_id}); it must not exist when the session starts`);try{await n.files.createRoot()}catch(s){if(!H(s))throw s;throw new P(`cannot create the memory store's folder: ${i} (memory_store_id=${t.memory_store_id}): ${s}; the worker host must make this mount path writable`,s)}await e(this,w,"m",Ne).call(this,n),e(this,p,"f").info("downloaded memories",{count:n.baseline.size,memory_store_id:n.memoryStoreId,dest:n.files.root().path}),e(this,A,"f").push(n)}catch(s){if(n)await n.files.dispose().catch(()=>{});if(s instanceof P)throw s;throw new P(`failed to download memory store memory_store_id=${t.memory_store_id}: ${s}`,s)}}o(this,G,Date.now(),"f")}async finish(){if(e(this,de,"f"))throw new u("finish() was already called: it is the session's last sync and runs once");o(this,de,!0,"f"),await this.syncAll(!0)}async syncAll(r){await Promise.all(e(this,A,"f").map((t)=>e(this,w,"m",ze).call(this,t,r))),o(this,G,Date.now(),"f")}async syncIfDue(){if(Date.now()-e(this,G,"f")<e(this,Q,"f"))return;await this.syncAll(!1)}async flushWrites(r){await Promise.all(e(this,A,"f").map((t)=>e(this,w,"m",Ge).call(this,t,r)))}async dispose(){for(let r of e(this,A,"f")){let t=r.files.root();try{let i=await e(this,w,"m",he).call(this,r);if(!i.markerOk&&Object.keys(i.files).length>0){e(this,p,"f").warn(`${i.distrustReason}; leaving the memory store folder on disk`,{root:t.path,memory_store_id:r.memoryStoreId});continue}await r.files.dispose()}catch(i){if(!(i instanceof y)&&!H(i))throw i;e(this,p,"f").warn("failed to remove the memory store folder",{root:r.files.root().path,memory_store_id:r.memoryStoreId,error:String(i)});continue}if(t.removedOnDispose)e(this,p,"f").info("removed memory store dir",{dest:t.path,memory_store_id:r.memoryStoreId})}}}return L=new WeakMap,le=new WeakMap,Q=new WeakMap,fe=new WeakMap,p=new WeakMap,G=new WeakMap,de=new WeakMap,A=new WeakMap,w=new WeakSet,qe=function(t){if(t.mount_path){if(!Ie(t.mount_path))throw new P(`memory store mount_path is not a clean absolute path: ${JSON.stringify(t.mount_path)} (memory_store_id=${t.memory_store_id})`);return t.mount_path}return k.join(e(this,le,"f"),"memory",t.name||t.memory_store_id)},he=async function(t){let i=await t.files.hashtree(),n=i[K];if(delete i[K],n===Qe(t.memoryStoreId))return{files:i,markerOk:!0,distrustReason:null};return{files:i,markerOk:!1,distrustReason:n!==void 0?"the marker file does not match this store":"the marker file is gone"}},ze=async function(t,i){try{let n=await e(this,w,"m",he).call(this,t),s=n.files;if(!n.markerOk){if(Object.keys(s).length>0){e(this,p,"f").warn(`${n.distrustReason}; leaving the memory store folder as found and not syncing`,{root:t.files.root().path,memory_store_id:t.memoryStoreId});return}await e(this,w,"m",Re).call(this,t,"the folder or its marker is gone");return}if(Object.keys(s).length===0&&t.baseline.size>1){await e(this,w,"m",Re).call(this,t,"every memory file is gone at once");return}let c=new Map;for await(let[m,_]of e(this,w,"m",me).call(this,t.memoryStoreId))c.set(m,_);let l=new tt(e(this,fe,"f"),Math.max(Ht,Math.min(Kt,Math.floor(t.baseline.size/4))),i),f=[],h=new Map,d=[...new Set([...c.keys(),...Object.keys(s),...t.baseline.keys()])].sort();for(let m of d){let _=c.get(m),E=s[m],D=t.baseline.get(m),I;if(E===void 0&&D!==void 0&&_!==void 0&&_.content_sha256===D&&!t.readOnly)I=await e(this,w,"m",Je).call(this,t,m,_,D,l);else I=await e(this,w,"m",He).call(this,t,m,_,E,f);if(I!==void 0)h.set(m,I)}if(t.baseline=h,await e(this,w,"m",Ve).call(this,t,f),l.suppressed>0)e(this,p,"f").debug("remote deletes are disabled; locally deleted memories stay on the server",{count:l.suppressed,memory_store_id:t.memoryStoreId});if(l.capped>0)e(this,p,"f").warn(`delete cap reached: ${l.mode==="log_only"?"would send":"sent"} ${l.attempted} deletes, held ${l.capped} for later syncs`,{memory_store_id:t.memoryStoreId})}catch(n){e(this,p,"f").warn("memory sync failed",{memory_store_id:t.memoryStoreId,error:String(n)})}},Ge=async function(t,i){let n=new Map,s=new Set,c=async()=>{if(t.readOnly)return;let l=await e(this,w,"m",he).call(this,t);if(!l.markerOk){e(this,p,"f").warn(`${l.distrustReason}; not uploading anything from the memory store folder`,{root:t.files.root().path,memory_store_id:t.memoryStoreId});return}for(let[d,m]of Object.entries(l.files))if(m!==t.baseline.get(d)&&t.refusedShas.get(d)!==m)n.set(d,m),s.add(d);if(n.size===0||i?.aborted)return;let f=new Map;for await(let[d,m]of e(this,w,"m",me).call(this,t.memoryStoreId)){if(i?.aborted)return;f.set(d,m)}let h=[];for(let d of[...n.keys()].sort()){let m=n.get(d),_=t.baseline.get(d),E=f.get(d);if(E!==void 0&&E.content_sha256===m){t.baseline.set(d,E.content_sha256),s.delete(d);continue}if(E!==void 0&&E.content_sha256!==_){e(this,p,"f").warn("memory changed both locally and remotely; the flush leaves the remote version",{path:d,memory_store_id:t.memoryStoreId}),s.delete(d);continue}h.push([d,m,E])}await e(this,w,"m",Xe).call(this,t,h,s,i)};try{if(await Xt(c(),i),i?.aborted&&s.size>0)e(this,p,"f").warn(`memory flush cut off part-way; ${s.size} of ${n.size} changed files had not finished uploading`,{memory_store_id:t.memoryStoreId})}catch(l){e(this,p,"f").warn("memory flush failed",{memory_store_id:t.memoryStoreId,error:String(l)})}},Re=async function(t,i){e(this,p,"f").warn(`${i}; re-downloading the memory store folder instead of syncing`,{root:t.files.root().path,memory_store_id:t.memoryStoreId}),await t.files.createRoot(),await e(this,w,"m",Ne).call(this,t)},Ne=async function(t){t.baseline=new Map,t.pendingDeletes.clear(),await t.files.put(K,`version ${et}
|
|
7
|
+
${t.memoryStoreId}`);for await(let[i,n]of e(this,w,"m",me).call(this,t.memoryStoreId,"full"))if(await e(this,w,"m",Te).call(this,t,i,n.content??""))t.baseline.set(i,n.content_sha256)},He=async function(t,i,n,s,c){let l=t.baseline.get(i);if(s!==void 0)t.pendingDeletes.delete(i);if(!n){if(s===void 0){t.pendingDeletes.delete(i);return}if(l!==void 0){if(s===l){let _=await e(this,w,"m",Ke).call(this,t,i,l);if(_===void 0)return;if(_===l)return l;s=_}if(t.readOnly)e(this,p,"f").warn("memory deleted remotely but edited locally; keeping the file, which a read-only store cannot push",{path:i,memory_store_id:t.memoryStoreId});else if(t.refusedShas.get(i)!==s)e(this,p,"f").info("memory deleted remotely but edited locally; re-creating it from the file",{path:i,memory_store_id:t.memoryStoreId})}if(t.readOnly)return;if(t.refusedShas.get(i)===s)return;return await e(this,w,"m",ue).call(this,t,i,s,void 0)}let f=n.content_sha256,h=f!==l,d=s!==void 0&&s!==l&&s!==f,m=!t.readOnly&&d;if(s===void 0&&l!==void 0){if(h)e(this,p,"f").warn("memory deleted locally but changed remotely; restoring the remote version",{path:i,memory_store_id:t.memoryStoreId}),t.pendingDeletes.delete(i),c.push([i,n]);return l}if(h){if(s===f)return f;if(d)e(this,p,"f").warn("memory changed both locally and remotely; keeping the remote version",{path:i,memory_store_id:t.memoryStoreId});return c.push([i,n]),l}if(m){if(t.refusedShas.get(i)===s)return f;return await e(this,w,"m",ue).call(this,t,i,s,n)??f}return f},Ke=async function(t,i,n){let s;try{s=await t.files.hashFile(i)}catch(c){if(!(c instanceof y)&&!H(c))throw c;return n}if(s===null)return;if(s!==n)return s;try{await t.files.remove(i)}catch(c){if(!(c instanceof y)&&!H(c))throw c;return e(this,p,"f").warn("failed to remove memory deleted remotely",{path:i,memory_store_id:t.memoryStoreId,error:String(c)}),n}return},Te=async function(t,i,n){try{await t.files.put(i,n)}catch(s){if(!(s instanceof y)&&!H(s))throw s;return e(this,p,"f").warn("failed to write memory",{path:i,memory_store_id:t.memoryStoreId,error:String(s)}),!1}return!0},Ve=async function(t,i){if(i.length===0)return;let n=async(l,f)=>{let h;try{h=await e(this,L,"f").beta.memoryStores.memories.retrieve(f.id,{memory_store_id:t.memoryStoreId,view:"full"})}catch(d){if(be(d,404))return;e(this,p,"f").warn("failed to fetch memory content",{path:l,memory_store_id:t.memoryStoreId,error:String(d)});return}if(await e(this,w,"m",Te).call(this,t,l,h.content??""))t.baseline.set(l,h.content_sha256)},s=i[Symbol.iterator](),c=async()=>{for(let[l,f]of s)await n(l,f)};await Promise.all(Array.from({length:Math.min(zt,i.length)},c))},Xe=async function(t,i,n,s){let c=i[Symbol.iterator](),l=async()=>{for(let[f,h,d]of c){if(s?.aborted)return;let m=await e(this,w,"m",ue).call(this,t,f,h,d);if(n.delete(f),m!==void 0)t.baseline.set(f,m)}};await Promise.all(Array.from({length:Math.min(Gt,i.length)},l))},me=async function*(t,i="basic"){let n=i==="basic"?Bt:Yt;for await(let s of e(this,L,"f").beta.memoryStores.memories.list(t,{view:i,limit:n})){if(s.type!=="memory")continue;let c=s.path.replace(/^\/+/,"");if(c===K){e(this,p,"f").warn("the server listed the reserved marker path; skipping",{path:s.path,memory_store_id:t});continue}yield[c,s]}},ue=async function r(t,i,n,s){try{let c=await t.files.get(i);if(c===null)return;let l=qt(c),f=s?await e(this,L,"f").beta.memoryStores.memories.update(s.id,{memory_store_id:t.memoryStoreId,content:l,precondition:{type:"content_sha256",content_sha256:s.content_sha256}}):await e(this,L,"f").beta.memoryStores.memories.create(t.memoryStoreId,{path:"/"+i,content:l});return t.refusedShas.delete(i),f.content_sha256}catch(c){if(s&&be(c,404))return await e(this,w,"m",r).call(this,t,i,n,void 0);let l=c instanceof y||be(c,400)||be(c,413);if(s&&be(c,409))e(this,p,"f").warn("memory changed both locally and remotely; the upload was refused and the local edit loses",{path:i,memory_store_id:t.memoryStoreId});else if(l&&n!==void 0)t.refusedShas.set(i,n),e(this,p,"f").warn("the server rejected this memory file, so it stays un-synced until its content changes",{path:i,memory_store_id:t.memoryStoreId,rejection:String(c)});else e(this,p,"f").warn("failed to upload memory",{path:i,memory_store_id:t.memoryStoreId,error:String(c)});return}},Je=async function(t,i,n,s,c){if(c.mode==="disabled")return c.suppressed++,s;let l=t.pendingDeletes.get(i);if(l===void 0)l=Date.now(),t.pendingDeletes.set(i,l);if(!c.waiveWindow&&Date.now()-l<jt)return s;let f,h;try{f=await t.files.hashFile(K)===Qe(t.memoryStoreId),h=await t.files.hashFile(i)===null}catch(m){if(!(m instanceof y)&&!H(m))throw m;f=h=!1}if(!f)return s;if(!h)return t.pendingDeletes.delete(i),s;if(!c.takeSlot())return s;if(c.mode==="log_only")return e(this,p,"f").info("log-only: sync would delete this memory on the server",{path:i,memory_store_id:t.memoryStoreId}),s;let d=await e(this,w,"m",Ze).call(this,t,i,n,s);if(d===void 0)t.pendingDeletes.delete(i);return d},Ze=async function(t,i,n,s){try{await e(this,L,"f").beta.memoryStores.memories.delete(n.id,{memory_store_id:t.memoryStoreId,expected_content_sha256:s})}catch(c){if(be(c,404))return;if(be(c,409)||be(c,412))e(this,p,"f").warn("memory deleted locally but changed remotely; keeping the remote version",{path:i,memory_store_id:t.memoryStoreId});else e(this,p,"f").warn("failed to delete memory",{path:i,memory_store_id:t.memoryStoreId,error:String(c)});return s}e(this,p,"f").info("propagated local deletion",{path:i,memory_store_id:t.memoryStoreId});return},a})();function H(a){return typeof a==="object"&&a!==null&&typeof a.code==="string"}async function Xt(a,r){if(!r){await a;return}let t,i=new Promise((n)=>{if(t=n,r.aborted)n()});r.addEventListener("abort",t,{once:!0});try{await Promise.race([a,i])}finally{r.removeEventListener("abort",t)}}var pe,b,R,ee,W,T,Le,ye,te,we,_e,U,j,V,B,re,x,rt,it,nt=102400,lt=120000,Jt=262144,Zt=65536,ot=Buffer.from(`
|
|
8
|
+
`),ie=102400,Qt=2000,er=200;class dt extends u{constructor(a){super(`bash command timed out after ${a}ms`);this.name="BashTimeoutError",this.timeoutMs=a}}var tr=/\x1b\[[0-9;?]*[ -/]*[@-~]/g,rr=S.glob;function ht(a){return a===void 0?Jt:a}function Y(a){if(a===void 0)return;throw new u("The `unrestrictedPaths` option you passed to the agent toolset (AgentToolContext) is no longer supported. The toolset's file tools (read, write, edit, glob, grep) are now always confined to the working directory plus the directories listed in `allowedRoots`. Remove `unrestrictedPaths` from your context; to let the file tools reach any other directory, add it to `allowedRoots`.")}function Vr(a){return[or(a),sr(a),fr(a),dr(a),mr(a),pr(a)]}async function oe(a,r){return Y(a.unrestrictedPaths),Ae(a.workdir,r,{allowedRoots:a.allowedRoots??[]})}function mt(a,r){return Se(a.readOnlyRoots??[],r)}function ir(){let a={};for(let[r,t]of Object.entries(process.env)){if(r.startsWith("ANTHROPIC_"))continue;a[r]=t}return a}var nr=(()=>{class a{constructor(r,t=ir()){pe.add(this),b.set(this,void 0),R.set(this,""),ee.set(this,!1),W.set(this,!1),T.set(this,null),o(this,b,$e.spawn("/bin/bash",["--noprofile","--norc"],{cwd:r,env:{...t,PS1:"",PS2:"",TERM:"dumb"},stdio:["pipe","pipe","pipe"],detached:!0}),"f"),e(this,b,"f").stdout.setEncoding("utf8"),e(this,b,"f").stderr.setEncoding("utf8"),e(this,b,"f").stdout.on("data",(i)=>e(this,pe,"m",Le).call(this,i)),e(this,b,"f").stderr.on("data",(i)=>e(this,pe,"m",Le).call(this,i)),e(this,b,"f").once("close",()=>{o(this,W,!0,"f");let i=e(this,T,"f");o(this,T,null,"f"),i?.resolve()})}get closed(){return e(this,W,"f")}async exec(r,t={}){if(e(this,W,"f"))throw new u("bash session terminated");let i=t.timeoutMs??lt,n=t.signal;n?.throwIfAborted(),o(this,R,"","f"),o(this,ee,!1,"f");let s=`__ANT_CMD_${at.randomUUID()}_DONE__`,c=`${s.slice(0,8)}''${s.slice(8)}`,l=`{ ${r}
|
|
9
9
|
} </dev/null 2>&1; printf '\\n${c}%d\\n' $?
|
|
10
|
-
`;if(e(this,b,"f").stdin.write(l),e(this,
|
|
11
|
-
${_}`;return{output:_,exitCode:m}}close(){if(e(this,W,"f"))return;o(this,W,!0,"f");let r=e(this,
|
|
10
|
+
`;if(e(this,b,"f").stdin.write(l),e(this,R,"f").indexOf(s)<0){let{promise:E,resolve:D}=ur();o(this,T,{sentinel:s,resolve:D},"f");let I,se;try{await Promise.race([E,new Promise((pt,ge)=>{I=setTimeout(()=>ge(new dt(i)),i)}),new Promise((pt,ge)=>{if(!n)return;se=()=>ge(n.reason),n.addEventListener("abort",se,{once:!0})})])}finally{if(I)clearTimeout(I);if(se&&n)n.removeEventListener("abort",se);o(this,T,null,"f")}}let f=e(this,R,"f").indexOf(s);if(f<0)throw new u("bash session terminated");let d=e(this,R,"f").slice(f+s.length).match(/^(-?\d+)/),m=d?parseInt(d[1],10):-1,_=e(this,R,"f").slice(0,f).replace(tr,"").replace(/\n+$/,"");if(e(this,ee,"f"))_=`[output truncated]
|
|
11
|
+
${_}`;return{output:_,exitCode:m}}close(){if(e(this,W,"f"))return;o(this,W,!0,"f");let r=e(this,T,"f");o(this,T,null,"f"),r?.resolve(),e(this,b,"f").stdout.destroy(),e(this,b,"f").stderr.destroy(),e(this,b,"f").stdin.destroy();try{process.kill(-e(this,b,"f").pid,"SIGKILL")}catch{e(this,b,"f").kill("SIGKILL")}e(this,b,"f").unref()}}return b=new WeakMap,R=new WeakMap,ee=new WeakMap,W=new WeakMap,T=new WeakMap,pe=new WeakSet,Le=function(t){if(o(this,R,e(this,R,"f")+t,"f"),e(this,R,"f").length>nt)o(this,R,e(this,R,"f").slice(e(this,R,"f").length-nt),"f"),o(this,ee,!0,"f");if(e(this,T,"f")&&e(this,R,"f").indexOf(e(this,T,"f").sentinel)>=0){let i=e(this,T,"f");o(this,T,null,"f"),i.resolve()}},a})();function or(a){Y(a.unrestrictedPaths);let r,t=Promise.resolve();return C({name:"bash",description:"Run a bash command in a persistent shell. State (cwd, env vars) persists across calls.",inputSchema:{type:"object",properties:{command:{type:"string",description:"The command to run"},restart:{type:"boolean",description:"Restart the persistent shell before running"},timeout_ms:{type:"integer",description:"Per-call timeout in milliseconds"}}},run:async({command:i,restart:n,timeout_ms:s},c)=>{let l=t,f=ur();t=f.promise;try{await l}catch{}try{if(n)r?.close(),r=void 0;if(!i){if(n)return"bash session restarted";throw new M("bash: command is required")}r??(r=new nr(a.workdir,a.env));try{let{output:h,exitCode:d}=await r.exec(i,{timeoutMs:s??lt,signal:c?.signal});if(d!==0)throw new M(h||`exit ${d}`);return h}catch(h){if(h instanceof M)throw h;throw r.close(),r=void 0,new M(`bash: ${h instanceof Error?h.message:String(h)}`)}}finally{f.resolve()}},close:()=>{r?.close(),r=void 0}})}function sr(a){return Y(a.unrestrictedPaths),C({name:"read",description:"Read a UTF-8 text file relative to the workdir.",inputSchema:{type:"object",properties:{file_path:{type:"string"},view_range:{type:"array",items:{type:"integer"},description:"[start_line, end_line] 1-indexed inclusive"}},required:["file_path"]},run:async({file_path:r,view_range:t})=>{if(!r)throw new M("read: file_path is required");let i=await oe(a,r);if(t?.length&&t.length!==2)throw new M("read: view_range must be [start_line, end_line]");let n;try{let d=await S.stat(i);if(!d.isFile())throw new M(`read: ${r} is not a regular file`);let m=ht(a.maxFileBytes);if(m!==null&&d.size>m){if(!t?.length)throw new M(`read: ${r} is ${d.size} bytes, exceeds ${m}-byte limit. Use the view_range parameter to read specific line ranges, e.g. view_range: [1, 500].`);let[_,E]=t;return await ar(i,r,_,E,m)}n=await S.readFile(i,"utf8")}catch(d){if(d instanceof M)throw d;throw new M(`read: ${q(d,r)}`)}if(!t?.length)return n;let[s,c]=t,l=n.split(`
|
|
12
12
|
`),f=Math.max(0,s-1),h=c>0?c:l.length;return l.slice(f,h).join(`
|
|
13
|
-
`)}})}async function ar(a,r,t,i,n){let s=new lr(r,t,i,n);if(s.rangeIsEmpty())return"";let c=ne.createReadStream(a,{highWaterMark:Zt});try{for await(let l of c)if(s.collectFrom(l),s.rangeIsCollected())break}finally{c.destroy()}return s.text()}var lr=(()=>{class a{constructor(r,t,i,n){ye.add(this),te.set(this,void 0),we.set(this,void 0),_e.set(this,void 0),U.set(this,void 0),j.set(this,void 0),V.set(this,void 0),B.set(this,0),re.set(this,[]),x.set(this,0),o(this,te,r,"f"),o(this,we,t,"f"),o(this,_e,i,"f"),o(this,U,Math.max(0,t-1),"f"),o(this,j,i>0?i:1/0,"f"),o(this,V,n,"f")}rangeIsEmpty(){return e(this,j,"f")<=e(this,U,"f")}rangeIsCollected(){return e(this,B,"f")>=e(this,j,"f")}collectFrom(r){var t;let i=0;while(i<r.length&&!this.rangeIsCollected()){let n=r.indexOf(10,i),s=n<0?r.length:n;if(e(this,B,"f")>=e(this,U,"f"))e(this,ye,"m",rt).call(this,r.subarray(i,s),n>=0);if(n<0)break;o(this,B,(t=e(this,B,"f"),t++,t),"f"),i=n+1}}text(){return Buffer.concat(e(this,re,"f"),e(this,x,"f")).toString("utf8")}}return te=new WeakMap,we=new WeakMap,_e=new WeakMap,U=new WeakMap,j=new WeakMap,V=new WeakMap,B=new WeakMap,re=new WeakMap,x=new WeakMap,ye=new WeakSet,rt=function(t,i){if(e(this,re,"f").push(t),o(this,x,e(this,x,"f")+t.length,"f"),i&&e(this,B,"f")+1<e(this,j,"f"))e(this,re,"f").push(ot),o(this,x,e(this,x,"f")+ot.length,"f");if(e(this,x,"f")>e(this,V,"f"))throw e(this,ye,"m",it).call(this)},it=function(){if(e(this,j,"f")-e(this,U,"f")===1)return new M(`read: line ${e(this,U,"f")+1} of ${e(this,te,"f")} alone exceeds ${e(this,V,"f")}-byte limit. The read tool cannot return part of a line, so view_range cannot narrow this further.`);return new M(`read: view_range [${e(this,we,"f")}, ${e(this,_e,"f")}] of ${e(this,te,"f")} exceeds ${e(this,V,"f")}-byte limit. Narrow the view_range to read a smaller portion.`)},a})();function fr(a){return Y(a.unrestrictedPaths),C({name:"write",description:"Write a UTF-8 text file relative to the workdir, creating parent directories as needed.",inputSchema:{type:"object",properties:{file_path:{type:"string"},content:{type:"string"}},required:["file_path","content"]},run:async({file_path:r,content:t})=>{if(!r)throw new M("write: file_path is required");let i=await oe(a,r),n=await mt(a,i);if(n!==void 0)throw new M(`write: ${r} is inside read-only directory ${n}`);try{await S.mkdir(
|
|
14
|
-
`)}})}function pr(a){return Y(a.unrestrictedPaths),C({name:"grep",description:"Search file contents for a regex. Uses ripgrep if available, otherwise a built-in walker.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string"}},required:["pattern"]},run:async({pattern:r,path:t},i)=>{if(!r)throw new M("grep: pattern is required");let n=
|
|
15
|
-
[output truncated at ${ie} bytes]`);if(d===0)return n(l);if(d===1)return n("no matches");s(new M(`grep: rg failed: ${f||`exit ${d}`}`))}),c.on("error",(d)=>{if(i?.aborted)return s(new M("grep: aborted"));s(new M(`grep: rg failed: ${d.message}`))})})}async function wr(a,r,t){let i;try{i=new RegExp(a)}catch(f){throw new M(`grep: invalid regex: ${f instanceof Error?f.message:String(f)}`)}let n=[],s=ie,c=(f)=>{if(s-=f.length+1,s<0)return n.push(`[output truncated at ${ie} bytes]`),!1;return n.push(f),!0};if((await S.stat(r).catch(()=>null))?.isFile())await st(r,i,c);else await gr(r,"",(f)=>st(
|
|
16
|
-
`)}async function st(a,r,t){let i=ne.createReadStream(a,{encoding:"utf8"}),n=ct.createInterface({input:i,crlfDelay:1/0}),s=0;try{for await(let c of n){if(s++,c.length>Qt)continue;if(r.test(c)&&!t(`${a}:${s}:${c}`))return!1}}catch{}finally{i.destroy()}return!0}var _r=40,ut=50000;async function gr(a,r,t,i){let n=ut;async function s(c,l){if(l>_r)return!0;if(i?.aborted)return!1;let f;try{f=await S.readdir(
|
|
13
|
+
`)}})}async function ar(a,r,t,i,n){let s=new lr(r,t,i,n);if(s.rangeIsEmpty())return"";let c=ne.createReadStream(a,{highWaterMark:Zt});try{for await(let l of c)if(s.collectFrom(l),s.rangeIsCollected())break}finally{c.destroy()}return s.text()}var lr=(()=>{class a{constructor(r,t,i,n){ye.add(this),te.set(this,void 0),we.set(this,void 0),_e.set(this,void 0),U.set(this,void 0),j.set(this,void 0),V.set(this,void 0),B.set(this,0),re.set(this,[]),x.set(this,0),o(this,te,r,"f"),o(this,we,t,"f"),o(this,_e,i,"f"),o(this,U,Math.max(0,t-1),"f"),o(this,j,i>0?i:1/0,"f"),o(this,V,n,"f")}rangeIsEmpty(){return e(this,j,"f")<=e(this,U,"f")}rangeIsCollected(){return e(this,B,"f")>=e(this,j,"f")}collectFrom(r){var t;let i=0;while(i<r.length&&!this.rangeIsCollected()){let n=r.indexOf(10,i),s=n<0?r.length:n;if(e(this,B,"f")>=e(this,U,"f"))e(this,ye,"m",rt).call(this,r.subarray(i,s),n>=0);if(n<0)break;o(this,B,(t=e(this,B,"f"),t++,t),"f"),i=n+1}}text(){return Buffer.concat(e(this,re,"f"),e(this,x,"f")).toString("utf8")}}return te=new WeakMap,we=new WeakMap,_e=new WeakMap,U=new WeakMap,j=new WeakMap,V=new WeakMap,B=new WeakMap,re=new WeakMap,x=new WeakMap,ye=new WeakSet,rt=function(t,i){if(e(this,re,"f").push(t),o(this,x,e(this,x,"f")+t.length,"f"),i&&e(this,B,"f")+1<e(this,j,"f"))e(this,re,"f").push(ot),o(this,x,e(this,x,"f")+ot.length,"f");if(e(this,x,"f")>e(this,V,"f"))throw e(this,ye,"m",it).call(this)},it=function(){if(e(this,j,"f")-e(this,U,"f")===1)return new M(`read: line ${e(this,U,"f")+1} of ${e(this,te,"f")} alone exceeds ${e(this,V,"f")}-byte limit. The read tool cannot return part of a line, so view_range cannot narrow this further.`);return new M(`read: view_range [${e(this,we,"f")}, ${e(this,_e,"f")}] of ${e(this,te,"f")} exceeds ${e(this,V,"f")}-byte limit. Narrow the view_range to read a smaller portion.`)},a})();function fr(a){return Y(a.unrestrictedPaths),C({name:"write",description:"Write a UTF-8 text file relative to the workdir, creating parent directories as needed.",inputSchema:{type:"object",properties:{file_path:{type:"string"},content:{type:"string"}},required:["file_path","content"]},run:async({file_path:r,content:t})=>{if(!r)throw new M("write: file_path is required");let i=await oe(a,r),n=await mt(a,i);if(n!==void 0)throw new M(`write: ${r} is inside read-only directory ${n}`);try{await S.mkdir(v.dirname(i),{recursive:!0,mode:J}),await Ee(i,t??"")}catch(s){throw new M(`write: ${q(s,r)}`)}return`wrote ${Buffer.byteLength(t??"")} bytes to ${r}`}})}function dr(a){return Y(a.unrestrictedPaths),C({name:"edit",description:"Replace old_string with new_string in a file. old_string must be unique unless replace_all.",inputSchema:{type:"object",properties:{file_path:{type:"string"},old_string:{type:"string"},new_string:{type:"string"},replace_all:{type:"boolean"}},required:["file_path","old_string","new_string"]},run:async({file_path:r,old_string:t,new_string:i,replace_all:n})=>{if(!r)throw new M("edit: file_path is required");if(!t)throw new M("edit: old_string is required");let s=await oe(a,r),c=await mt(a,s);if(c!==void 0)throw new M(`edit: ${r} is inside read-only directory ${c}`);let l;try{let d=await S.stat(s);if(!d.isFile())throw new M(`edit: ${r} is not a regular file`);let m=ht(a.maxFileBytes);if(m!==null&&d.size>m)throw new M(`edit: ${r} is ${d.size} bytes, exceeds ${m}-byte limit. The edit tool loads the whole file and cannot modify a file this large.`);l=await S.readFile(s,"utf8")}catch(d){if(d instanceof M)throw d;throw new M(`edit: ${q(d,r)}`)}let f=l.split(t).length-1;if(f===0)throw new M(`edit: old_string not found in ${r}`);let h;if(n)h=l.split(t).join(i);else{if(f>1)throw new M(`edit: old_string appears ${f} times in ${r} (must be unique)`);h=l.replace(t,()=>i)}try{await Ee(s,h)}catch(d){throw new M(`edit: write: ${q(d,r)}`)}return`edited ${r} (${n?f:1} replacement(s))`}})}function hr(a){return a.split(/[\\/{},]/).includes("..")}function mr(a){return Y(a.unrestrictedPaths),C({name:"glob",description:"Match files under the workdir against a glob pattern. Results are mtime-sorted, newest first.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string",description:"Directory to search in. Defaults to the workdir."}},required:["pattern"]},run:async({pattern:r,path:t})=>{if(!r)throw new M("glob: pattern is required");if(v.isAbsolute(r))throw new M("glob: absolute pattern not permitted; pass a relative pattern (and optionally path)");if(hr(r))throw new M('glob: ".." is not permitted in the pattern');let i=t?await oe(a,t):v.resolve(a.workdir),n=t?i:await X(i),s=[],c=ut;try{for await(let l of rr(r,{cwd:i,withFileTypes:!0,exclude:(f)=>f.name===".git"||f.name==="node_modules"})){if(c--<=0)break;if(!l.isFile())continue;let f=v.join(l.parentPath,l.name),h;try{h=await S.realpath(f)}catch{continue}if(!ae(n,h))continue;let d=0;try{d=(await S.stat(f)).mtimeMs}catch{}s.push({path:f,mtime:d})}}catch(l){throw new M(`glob: ${l instanceof Error?l.message:String(l)}`)}if(s.length===0)return"no matches";return s.sort((l,f)=>f.mtime-l.mtime),s.slice(0,er).map((l)=>l.path).join(`
|
|
14
|
+
`)}})}function pr(a){return Y(a.unrestrictedPaths),C({name:"grep",description:"Search file contents for a regex. Uses ripgrep if available, otherwise a built-in walker.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string"}},required:["pattern"]},run:async({pattern:r,path:t},i)=>{if(!r)throw new M("grep: pattern is required");let n=v.resolve(a.workdir);if(t)n=await oe(a,t);let s=await Sr();return s?yr(s,r,n,i?.signal):wr(r,n,i?.signal)}})}function yr(a,r,t,i){return new Promise((n,s)=>{let c=$e.spawn(a,["-n","--no-heading","-e",r,"--",t],{...i?{signal:i}:{}}),l="",f="",h=!1;c.stdout.on("data",(d)=>{if(h)return;if(l+=d,l.length>ie)h=!0,l=l.slice(0,ie),c.kill("SIGKILL")}),c.stderr.on("data",(d)=>f+=d),c.on("close",(d)=>{if(i?.aborted)return s(new M("grep: aborted"));if(h)return n(l+`
|
|
15
|
+
[output truncated at ${ie} bytes]`);if(d===0)return n(l);if(d===1)return n("no matches");s(new M(`grep: rg failed: ${f||`exit ${d}`}`))}),c.on("error",(d)=>{if(i?.aborted)return s(new M("grep: aborted"));s(new M(`grep: rg failed: ${d.message}`))})})}async function wr(a,r,t){let i;try{i=new RegExp(a)}catch(f){throw new M(`grep: invalid regex: ${f instanceof Error?f.message:String(f)}`)}let n=[],s=ie,c=(f)=>{if(s-=f.length+1,s<0)return n.push(`[output truncated at ${ie} bytes]`),!1;return n.push(f),!0};if((await S.stat(r).catch(()=>null))?.isFile())await st(r,i,c);else await gr(r,"",(f)=>st(v.join(r,f),i,c),t);if(t?.aborted)throw new M("grep: aborted");if(n.length===0)return"no matches";return n.join(`
|
|
16
|
+
`)}async function st(a,r,t){let i=ne.createReadStream(a,{encoding:"utf8"}),n=ct.createInterface({input:i,crlfDelay:1/0}),s=0;try{for await(let c of n){if(s++,c.length>Qt)continue;if(r.test(c)&&!t(`${a}:${s}:${c}`))return!1}}catch{}finally{i.destroy()}return!0}var _r=40,ut=50000;async function gr(a,r,t,i){let n=ut;async function s(c,l){if(l>_r)return!0;if(i?.aborted)return!1;let f;try{f=await S.readdir(v.join(a,c),{withFileTypes:!0})}catch{return!0}for(let h of f){if(h.name===".git"||h.name==="node_modules")continue;if(n--<=0)return!1;if(i?.aborted)return!1;let d=c?v.join(c,h.name):h.name;if(h.isDirectory()){if(!await s(d,l+1))return!1}else if(h.isFile()){if(await t(d)===!1)return!1}}return!0}await s(r,0)}async function Sr(){let a=(process.env.PATH??"").split(v.delimiter);for(let r of a){let t=v.join(r,"rg");try{return await S.access(t,ne.constants.X_OK),t}catch{}}return null}export{Ut as MEMORY_FLUSH_TIMEOUT_MS,P as SessionMemoryError,Vt as SessionMemoryStores,Vr as betaAgentToolset20260401,gt as setupSkills};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{z}from"./chunk-ak9rkrf3.js";import{
|
|
3
|
-
`),d=o.filter((c)=>c.type==="image"),u=l.length>0;if(d.length===0||!a.input.includes("image"))return w(u?l:d.length>0?"(see attached image)":"(no tool output)");let p=[];if(u)p.push({type:"input_text",text:w(l)});for(let c of d)p.push({type:"input_image",detail:"auto",image_url:`data:${c.mimeType};base64,${c.data}`});return p}function
|
|
2
|
+
import{z}from"./chunk-ak9rkrf3.js";import{lt}from"./chunk-w3skxmvx.js";import{Se,on,sn,he,hr,we}from"./chunk-43qf44t8.js";import{w}from"./chunk-b516bp7n.js";import{q,Be,ae,Ae,ee}from"./chunk-35y6nf6k.js";function E(a,o){let l={v:1,id:a};if(o)l.phase=o;return JSON.stringify(l)}function N(a){if(!a)return;if(a.startsWith("{"))try{let o=JSON.parse(a);if(o.v===1&&typeof o.id==="string"){if(o.phase==="commentary"||o.phase==="final_answer")return{id:o.id,phase:o.phase};return{id:o.id}}}catch{}return{id:a}}function W(a,o){let l=o.filter((c)=>c.type==="text").map((c)=>c.text).join(`
|
|
3
|
+
`),d=o.filter((c)=>c.type==="image"),u=l.length>0;if(d.length===0||!a.input.includes("image"))return w(u?l:d.length>0?"(see attached image)":"(no tool output)");let p=[];if(u)p.push({type:"input_text",text:w(l)});for(let c of d)p.push({type:"input_image",detail:"auto",image_url:`data:${c.mimeType};base64,${c.data}`});return p}function gt(a,o,l,d){let u=ae(o,d?.supportsMidConvoSystemMessages),p=[],c=(n)=>{let s=n.replace(/[^a-zA-Z0-9_-]/g,"_");return(s.length>64?s.slice(0,64):s).replace(/_+$/,"")},S=(n)=>{let s=`fc_${lt(n)}`;return s.length>64?s.slice(0,64):s},x=(n,s,i)=>{if(!l.has(a.provider))return c(n);if(!n.includes("|"))return c(n);let[r,g]=n.split("|"),h=c(r),y=i.provider!==a.provider||i.api!==a.api?S(g):c(g);if(!y.startsWith("fc_"))y=c(`fc_${y}`);return`${h}|${y}`},m=we(u.messages,a,x),k=Ae(u.messages,(d?.supportsAdditionalTools??!1)||(d?.supportsToolSearch??!1)),T=(n,s)=>{let i=k.anchorsAdditions?n.toolsAdded??[]:[];if(i.length===0)return;if(d?.supportsAdditionalTools){p.push({type:"additional_tools",role:"developer",tools:at(i,d.toolOptions)});return}if(!d?.supportsToolSearch)return;let r=i.map((h)=>h.name),g=`pi_tool_load_${lt(`${s}:${r.join(",")}`)}`;p.push({type:"tool_search_call",call_id:g,execution:"client",status:"completed",arguments:{query:r.join(" "),limit:r.length}}),p.push({type:"tool_search_output",call_id:g,execution:"client",status:"completed",tools:at(i,{...d.toolOptions,toolSearchResult:!0})})},R=d?.includeSystemPrompt??!0,C=a.compat,M=a.reasoning&&C?.supportsDeveloperRole!==!1?"developer":"system",t=0,e=0;for(let n of m){let s=e++===0&&n.role==="system";if(n.role==="system"){if(!s)T(n,`system:${t}`);if(!s||R){let i=s?q(n):Be(n);if(i.length>0)p.push({role:M,content:w(i)})}}else if(n.role==="user")if(typeof n.content==="string")p.push({role:"user",content:[{type:"input_text",text:w(n.content)}]});else{let i=n.content.map((r)=>{if(r.type==="text")return{type:"input_text",text:w(r.text)};return{type:"input_image",detail:"auto",image_url:`data:${r.mimeType};base64,${r.data}`}});if(i.length===0)continue;p.push({role:"user",content:i})}else if(n.role==="assistant"){let i=[],r=n,g=r.provider===a.provider&&r.api===a.api,h=g&&r.model===a.id,P=g&&r.model!==a.id,y=0;for(let I of n.content)if(I.type==="thinking"){if(I.thinkingSignature){let f=JSON.parse(I.thinkingSignature);i.push(f)}}else if(I.type==="text"){let f=I,b=N(f.textSignature),J=y===0?`msg_pi_${t}`:`msg_pi_${t}_${y}`;y++;let _=b?.id;if(!_)_=J;else if(_.length>64)_=`msg_${lt(_)}`;i.push({type:"message",role:"assistant",content:[{type:"output_text",text:w(f.text),annotations:[]}],status:"completed",id:_,phase:b?.phase})}else if(I.type==="toolCall"){let f=I,[b,J]=f.id.split("|"),_=d?.grammarToolInputProperties?.get(f.name),v=J,j=_===void 0?"fc_":"ctc_";if(P||!v?.startsWith(j))v=void 0;if(_!==void 0)i.push({type:"custom_tool_call",id:v,call_id:b,name:f.name,input:w(on(f.name,f.arguments,_)),...h&&f.namespace!==void 0?{namespace:f.namespace}:{}});else i.push({type:"function_call",id:v,call_id:b,name:f.name,arguments:JSON.stringify(f.arguments),...h&&f.namespace!==void 0?{namespace:f.namespace}:{}})}if(i.length===0)continue;p.push(...i)}else if(n.role==="toolResult"){let[i]=n.toolCallId.split("|"),r=W(a,n.content);if(d?.grammarToolInputProperties?.has(n.toolName))p.push({type:"custom_tool_call_output",call_id:i,output:r});else p.push({type:"function_call_output",call_id:i,output:r})}if(!s)t++}return p}function at(a,o){let l=o?.strict===void 0?!1:o.strict,d=o?.supportsStrictMode??!0,u=o?.supportsOpenAIGrammarTools??!1;return a.map((p)=>{let c=hr(p,u);if(c)return{type:"custom",name:p.name,description:p.description,format:{type:"grammar",syntax:c.format,definition:c.definition},...o?.toolSearchResult?{defer_loading:!0}:{}};let x=he(p,d)??l,m={type:"function",name:p.name,description:p.description,parameters:Se(p,x===!0),...o?.toolSearchResult?{defer_loading:!0}:{}};if(d)m.strict=x;return m})}function A(a){let o=a.customInput?.property;if(o===void 0)return"";let l=a.arguments[o];return typeof l==="string"?l:""}function O(a,o,l){let d=a.customInput;if(!d)return;let u=sn(d.jsonBuffer,d.property,o,l);return a.arguments={[d.property]:o},u}async function yt(a,o,l,d,u){let p=!1,c=new Map,S=new Map,x=(t)=>{if(t.type==="message"&&t.phase==="final_answer")o.stopReason="stop"},m=(t,e)=>{let n=c.get(t);return n?.type===e?n:void 0},k=(t,e)=>{if(e===void 0)return;l.push({type:"toolcall_delta",contentIndex:t.contentIndex,delta:e,partial:o})},T=(t,e)=>{if(e.type==="reasoning"){let n={type:"thinking",thinking:""};o.content.push(n);let s={type:"thinking",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"thinking_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="message"){x(e);let n={type:"text",text:""};o.content.push(n);let s={type:"text",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"text_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="function_call"){let n={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{},...e.namespace!==void 0?{namespace:e.namespace}:{},partialJson:e.arguments||""};o.content.push(n);let s={type:"toolCall",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"toolcall_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="custom_tool_call"){let n=u?.grammarToolInputProperties?.get(e.name)??"input",s=e.input||"",i={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{[n]:s},...e.namespace!==void 0?{namespace:e.namespace}:{},customInput:{property:n,jsonBuffer:{input:"",started:!1,closed:!1}}};o.content.push(i);let r={type:"toolCall",block:i,contentIndex:o.content.length-1};return c.set(t,r),l.push({type:"toolcall_start",contentIndex:r.contentIndex,partial:o}),r}return},R=(t,e)=>c.get(t)??T(t,e),C=(t)=>{for(let e of t){if(e.type!=="reasoning"||!e.encrypted_content)continue;let n=S.get(e.id);if(!n?.thinkingSignature)continue;let s=JSON.parse(n.thinkingSignature);if(s.encrypted_content)continue;n.thinkingSignature=JSON.stringify({...s,encrypted_content:e.encrypted_content})}},M=(t)=>{if(p=!0,C(t.output??[]),t?.id)o.responseId=t.id;if(t?.usage){let r=t.usage.input_tokens_details,g=r?.cached_tokens||0,h=r?.cache_write_tokens||0;o.usage={input:Math.max(0,(t.usage.input_tokens||0)-g-h),output:t.usage.output_tokens||0,cacheRead:g,cacheWrite:h,reasoning:t.usage.output_tokens_details?.reasoning_tokens||0,totalTokens:t.usage.total_tokens||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}if(ee(d,o.usage),u?.applyServiceTierPricing){let r=u.resolveServiceTier?u.resolveServiceTier(t?.service_tier,u.serviceTier):t?.service_tier??u.serviceTier;u.applyServiceTierPricing(o.usage,r)}let e=t?.status,n=t?.incomplete_details,s=typeof n?.reason==="string"?n.reason:void 0;o.rawStopReason=s?`${e}.${s}`:e;let i=B(e,s);if(o.stopReason=i.stopReason,i.errorMessage===void 0)delete o.errorMessage;else o.errorMessage=i.errorMessage;if(o.content.some((r)=>r.type==="toolCall")&&o.stopReason==="stop")o.stopReason="toolUse"};for await(let t of a)if(await u?.onProviderStreamEvent?.(t,d),t.type==="response.created")o.responseId=t.response.id;else if(t.type==="response.output_item.added")T(t.output_index,t.item);else if(t.type==="response.reasoning_summary_text.delta"){let e=m(t.output_index,"thinking");if(!e)continue;e.block.thinking+=t.delta,l.push({type:"thinking_delta",contentIndex:e.contentIndex,delta:t.delta,partial:o})}else if(t.type==="response.reasoning_summary_part.done"){let e=m(t.output_index,"thinking");if(!e)continue;e.block.thinking+=`
|
|
4
4
|
|
|
5
5
|
`,l.push({type:"thinking_delta",contentIndex:e.contentIndex,delta:`
|
|
6
6
|
|
|
@@ -9,4 +9,4 @@ import{z}from"./chunk-ak9rkrf3.js";import{at}from"./chunk-z9p2ry9w.js";import{Se
|
|
|
9
9
|
`)||"",i=e.content?.map((r)=>r.text).join(`
|
|
10
10
|
|
|
11
11
|
`)||"";n.block.thinking=s||i||n.block.thinking,n.block.thinkingSignature=JSON.stringify(e),S.set(e.id,n.block),l.push({type:"thinking_end",contentIndex:n.contentIndex,content:n.block.thinking,partial:o}),c.delete(t.output_index)}else if(e.type==="message"&&n?.type==="text")n.block.text=e.content?.map((s)=>s.type==="output_text"?s.text:s.refusal).join("")||"",n.block.textSignature=E(e.id,e.phase??void 0),l.push({type:"text_end",contentIndex:n.contentIndex,content:n.block.text,partial:o}),c.delete(t.output_index);else if(e.type==="function_call"&&n?.type==="toolCall"&&n.block.partialJson!==void 0){if(n.block.arguments=z(e.arguments||n.block.partialJson||"{}"),e.namespace!==void 0)n.block.namespace=e.namespace;delete n.block.partialJson,l.push({type:"toolcall_end",contentIndex:n.contentIndex,toolCall:n.block,partial:o}),c.delete(t.output_index)}else if(e.type==="custom_tool_call"&&n?.type==="toolCall"&&n.block.customInput){if(k(n,O(n.block,e.input??A(n.block),!0)),e.namespace!==void 0)n.block.namespace=e.namespace;delete n.block.customInput,l.push({type:"toolcall_end",contentIndex:n.contentIndex,toolCall:n.block,partial:o}),c.delete(t.output_index)}}else if(t.type==="response.completed"||t.type==="response.incomplete")M(t.response);else if(t.type==="error")throw Error(`Error Code ${t.code}: ${t.message}`||"Unknown error");else if(t.type==="response.failed"){p=!0,o.rawStopReason=t.response?.status;let e=t.response?.error,n=t.response?.incomplete_details,s=e?`${e.code||"unknown"}: ${e.message||"no message"}`:n?.reason?`incomplete: ${n.reason}`:"Unknown error (no error details in response)";throw Error(s)}if(!p)throw Error("OpenAI Responses stream ended before a terminal response event");if(o.stopReason==="toolUse")for(let t of o.content){if(t.type!=="toolCall")continue;let e=t;if(e.partialJson!==void 0||e.customInput!==void 0)throw Error(`OpenAI Responses stream completed with an unfinished tool call: ${e.name} (${e.id})`)}}function B(a,o){if(!a)return{stopReason:"stop"};switch(a){case"completed":return{stopReason:"stop"};case"incomplete":if(o==="max_output_tokens")return{stopReason:"length"};return{stopReason:"error",errorMessage:o?`Response incomplete: ${o}`:"Response incomplete without a provider reason"};case"failed":case"cancelled":return{stopReason:"error"};case"in_progress":case"queued":return{stopReason:"stop"};default:throw Error(`Unhandled stop reason: ${a}`)}}
|
|
12
|
-
export{
|
|
12
|
+
export{gt,at,yt};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{z}from"./chunk-ak9rkrf3.js";import{Wr}from"./chunk-9qzyn98b.js";import{lt}from"./chunk-w3skxmvx.js";import{se}from"./chunk-keq5kv9b.js";import{Se,he,Y,we}from"./chunk-43qf44t8.js";import{w}from"./chunk-b516bp7n.js";import{J}from"./chunk-0b2brwjc.js";import{W,q,Be,ce,ae,ee,K}from"./chunk-35y6nf6k.js";var R=9,j=4000,N=(t,e,n)=>{let r=new W,o=ae(e,t.compat?.supportsMidConvoSystemMessages);return(async()=>{let s=U(t);try{let l=n?.apiKey;if(!l)throw Error(`No API key for provider: ${t.provider}`);let f=D(),u=we(o.messages,t,(d)=>f(d)),a=ne(t,o,u,n),i=await n?.onPayload?.(a,t);if(i!==void 0)a=i;let c=await Z(t,a,l,n);if(r.push({type:"start",partial:s}),await oe(t,s,r,c,n?.onProviderStreamEvent),n?.signal?.aborted)throw Error("Request was aborted");if(s.stopReason==="pending")throw Error("Mistral stream ended without a finish reason");if(s.stopReason==="aborted"||s.stopReason==="error")throw Error(s.errorMessage||"An unknown error occurred");r.push({type:"done",reason:s.stopReason,message:s}),r.end()}catch(l){for(let f of s.content)delete f.partialArgs;s.stopReason=n?.signal?.aborted?"aborted":"error",s.errorMessage=B(l),r.push({type:"error",reason:s.stopReason,error:s}),r.end()}})(),r},Ie=(t,e,n)=>{let r=n?.apiKey;if(!r)throw Error(`No API key for provider: ${t.provider}`);let o={...Y(t,e,n,r),toolChoice:n?.toolChoice},s=n?.reasoning?K(t,n.reasoning):void 0,l=s==="off"?void 0:s,f=t.reasoning?t.thinkingLevelMap:void 0,u=f?l?f[l]??"high":f.off??void 0:void 0;return N(t,e,{...o,promptMode:t.reasoning&&!f&&l?"reasoning":void 0,reasoningEffort:u})};function U(t){return{role:"assistant",content:[],api:t.api,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()}}function D(){let t=new Map,e=new Map;return(n)=>{let r=t.get(n);if(r)return r;let o=0;while(!0){let s=v(n,o),l=e.get(s);if(!l||l===n)return t.set(n,s),e.set(s,n),s;o++}}}function v(t,e){let n=t.replace(/[^a-zA-Z0-9]/g,"");if(e===0&&n.length===R)return n;let r=n||t,o=e===0?r:`${r}:${e}`;return lt(o).replace(/[^a-zA-Z0-9]/g,"").slice(0,R)}function B(t){if(t instanceof Error){let e=t,n=typeof e.statusCode==="number"?e.statusCode:void 0,r=typeof e.body==="string"?e.body.trim():void 0;if(n!==void 0&&r)return`Mistral API error (${n}): ${H(r,j)}`;if(n!==void 0)return`Mistral API error (${n}): ${t.message}`;return t.message}return F(t)}function H(t,e){if(t.length<=e)return t;return`${t.slice(0,e)}... [truncated ${t.length-e} chars]`}function F(t){try{let e=JSON.stringify(t);return e===void 0?String(t):e}catch{return String(t)}}async function Z(t,e,n,r){let o=new URL(t.baseUrl);o.pathname=`${o.pathname.replace(/\/+$/u,"")}/`;let s=new URL("v1/chat/completions",o),l=G(t,n,r),f=r?.timeoutMs??60000,u=AbortSignal.timeout(f),a=Wr([r?.signal,u]),i;try{i=await(r?.fetch??globalThis.fetch)(s,{method:"POST",headers:l,body:JSON.stringify(X(e)),signal:a.signal})}catch(c){if(u.aborted&&!r?.signal?.aborted)throw Error(`Mistral response headers timed out after ${f}ms`);throw c}finally{a.cleanup()}if(await r?.onResponse?.({status:i.status,headers:J(i.headers)},t),!i.ok){let c=await i.text();throw new P(i.status,c,i.statusText)}if(!i.body)throw Error("Mistral response has no body");return te(i.body,r?.signal)}class P extends Error{statusCode;body;constructor(t,e,n){super(n||`Request failed with status ${t}`);this.name="MistralHttpError",this.statusCode=t,this.body=e}}function G(t,e,n){let r=new Headers({"User-Agent":se(),accept:"text/event-stream",authorization:`Bearer ${e}`,"content-type":"application/json"});S(r,t.headers),S(r,n?.headers);let o=A(t.headers,"x-affinity")||A(n?.headers,"x-affinity");if(O(n)&&!o)r.set("x-affinity",n.sessionId);return r}function S(t,e){if(!e)return;for(let[n,r]of Object.entries(e))if(r===null)t.delete(n);else t.set(n,r)}function A(t,e){return!!t&&Object.keys(t).some((n)=>n.toLowerCase()===e)}function X(t){let e={...t};for(let[r,o]of[["topP","top_p"],["maxTokens","max_tokens"],["randomSeed","random_seed"],["responseFormat","response_format"],["toolChoice","tool_choice"],["presencePenalty","presence_penalty"],["frequencyPenalty","frequency_penalty"],["parallelToolCalls","parallel_tool_calls"],["reasoningEffort","reasoning_effort"],["promptMode","prompt_mode"],["promptCacheKey","prompt_cache_key"],["safePrompt","safe_prompt"]])_(e,r,o);e.messages=t.messages.map((r)=>Q(r));let n=e.response_format;if(M(n)){let r={...n};_(r,"jsonSchema","json_schema");let o=r.json_schema;if(M(o)){let s={...o};_(s,"schemaDefinition","schema"),r.json_schema=s}e.response_format=r}return e}function Q(t){let e={...t};if(_(e,"toolCalls","tool_calls"),_(e,"toolCallId","tool_call_id"),Array.isArray(t.content))e.content=t.content.map((n)=>V(n));return e}function V(t){let e={...t};for(let[n,r]of[["imageUrl","image_url"],["documentUrl","document_url"],["documentName","document_name"],["fileId","file_id"],["referenceIds","reference_ids"],["inputAudio","input_audio"]])_(e,n,r);return e}function _(t,e,n){if(!(e in t))return;t[n]=t[e],delete t[e]}function M(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var k=Symbol("mistral-stream-done");async function*te(t,e){let n=t.getReader(),r=new TextDecoder,o="",s=()=>{n.cancel().catch(()=>{})};e?.addEventListener("abort",s,{once:!0});try{while(!0){if(e?.aborted)throw e.reason;let{done:l,value:f}=await n.read();if(e?.aborted)throw e.reason;o+=l?r.decode():r.decode(f,{stream:!0});let u=I(o);while(u){let a=E(o.slice(0,u.index));if(o=o.slice(u.index+u.length),a===k)return;if(a)yield a;u=I(o)}if(l)break}if(o.trim()){let l=E(o);if(l!==k&&l)yield l}}finally{e?.removeEventListener("abort",s);try{await n.cancel()}catch{}try{n.releaseLock()}catch{}}}function I(t){let e=/\r\n\r\n|\r\n\r|\r\n\n|\r\r\n|\n\r\n|\r\r|\n\r|\n\n/u.exec(t);return e?.index===void 0?void 0:{index:e.index,length:e[0].length}}function E(t){let e=t.split(/\r\n|\r|\n/u).filter((r)=>r.startsWith("data:")).map((r)=>r.slice(5).trimStart()).join(`
|
|
3
|
+
`).trim();if(!e)return;if(e==="[DONE]")return k;let n=JSON.parse(e);if(!M(n)||!Array.isArray(n.choices))throw Error("Invalid Mistral streaming event");return{data:n}}function ne(t,e,n,r){let o={model:t.id,stream:!0,messages:le(n,t.input.includes("image"))},s=ce(e.messages);if(s.length>0)o.tools=ie(s);if(r?.temperature!==void 0)o.temperature=r.temperature;if(r?.maxTokens!==void 0)o.maxTokens=r.maxTokens;if(r?.toolChoice)o.toolChoice=de(r.toolChoice);if(r?.promptMode)o.promptMode=r.promptMode;if(r?.reasoningEffort)o.reasoningEffort=r.reasoningEffort;if(O(r))o.promptCacheKey=r.sessionId;return o}function O(t){return t?.cacheRetention!=="none"&&!!t?.sessionId}function re(t,e){let n=t,r=n.promptTokensDetails?.cachedTokens??n.prompt_tokens_details?.cached_tokens??n.promptTokenDetails?.cachedTokens??n.prompt_token_details?.cached_tokens??n.numCachedTokens??n.num_cached_tokens??0,o=typeof r==="number"&&Number.isFinite(r)?r:0;return Math.min(e,Math.max(0,o))}async function oe(t,e,n,r,o){let s=null,l=e.content,f=()=>l.length-1,u=new Map,a=(i)=>{if(!i)return;if(i.type==="text"){n.push({type:"text_end",contentIndex:f(),content:i.text,partial:e});return}if(i.type==="thinking")n.push({type:"thinking_end",contentIndex:f(),content:i.thinking,partial:e})};for await(let i of r){let c=i.data;if(await o?.(c,t),e.responseId||=c.id,c.usage){let p=c.usage.prompt_tokens||0,h=re(c.usage,p);e.usage.input=Math.max(0,p-h),e.usage.output=c.usage.completion_tokens||0,e.usage.cacheRead=h,e.usage.cacheWrite=0,e.usage.totalTokens=c.usage.total_tokens||e.usage.input+e.usage.output+e.usage.cacheRead+e.usage.cacheWrite,ee(t,e.usage)}let d=c.choices[0];if(!d)continue;if(d.finish_reason){e.rawStopReason=d.finish_reason;let p=ue(d.finish_reason);if(e.stopReason=p.stopReason,p.errorMessage)e.errorMessage=p.errorMessage}let y=d.delta;if(y.content!==null&&y.content!==void 0){let p=typeof y.content==="string"?[y.content]:y.content;for(let h of p){if(typeof h==="string"){let m=w(h);if(!m)continue;if(!s||s.type!=="text")a(s),s={type:"text",text:""},e.content.push(s),n.push({type:"text_start",contentIndex:f(),partial:e});s.text+=m,n.push({type:"text_delta",contentIndex:f(),delta:m,partial:e});continue}if(h.type==="thinking"){let m=(h.thinking??[]).map((g)=>g.text??"").filter((g)=>g.length>0).join(""),x=w(m);if(!x)continue;if(!s||s.type!=="thinking")a(s),s={type:"thinking",thinking:""},e.content.push(s),n.push({type:"thinking_start",contentIndex:f(),partial:e});s.thinking+=x,n.push({type:"thinking_delta",contentIndex:f(),delta:x,partial:e});continue}if(h.type==="text"){let m=w(h.text??"");if(!m)continue;if(!s||s.type!=="text")a(s),s={type:"text",text:""},e.content.push(s),n.push({type:"text_start",contentIndex:f(),partial:e});s.text+=m,n.push({type:"text_delta",contentIndex:f(),delta:m,partial:e})}}}let L=y.tool_calls||[];for(let p of L){if(s)a(s),s=null;let h=p.id&&p.id!=="null"?p.id:v(`toolcall:${p.index??0}`,0),m=p.index??h,x=u.get(m),g;if(x!==void 0){let C=e.content[x];if(C?.type==="toolCall")g=C}if(!g)g={type:"toolCall",id:h,name:p.function.name,arguments:{},partialArgs:""},e.content.push(g),u.set(m,e.content.length-1),n.push({type:"toolcall_start",contentIndex:e.content.length-1,partial:e});let T=typeof p.function.arguments==="string"?p.function.arguments:JSON.stringify(p.function.arguments||{});g.partialArgs=(g.partialArgs||"")+T,g.arguments=z(g.partialArgs),n.push({type:"toolcall_delta",contentIndex:u.get(m),delta:T,partial:e})}}a(s);for(let i of u.values()){let c=e.content[i];if(c.type!=="toolCall")continue;let d=c;d.arguments=z(d.partialArgs),delete d.partialArgs,n.push({type:"toolcall_end",contentIndex:i,toolCall:d,partial:e})}}function ie(t){return t.map((e)=>{let n=he(e,!0);return{type:"function",function:{name:e.name,description:e.description,parameters:b(Se(e,n)),strict:n??!1}}})}function b(t){if(Array.isArray(t))return t.map((e)=>b(e));if(t&&typeof t==="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=b(r);return e}return t}function le(t,e){let n=[];for(let[r,o]of t.entries()){if(o.role==="system"){let a=r===0?q(o):Be(o);if(a.length>0)n.push({role:"system",content:w(a)});continue}if(o.role==="user"){if(typeof o.content==="string"){n.push({role:"user",content:w(o.content)});continue}let a=o.content.some((c)=>c.type==="image"),i=o.content.filter((c)=>c.type==="text"||e).map((c)=>{if(c.type==="text")return{type:"text",text:w(c.text)};return{type:"image_url",imageUrl:`data:${c.mimeType};base64,${c.data}`}});if(i.length>0){n.push({role:"user",content:i});continue}if(a&&!e)n.push({role:"user",content:"(image omitted: model does not support images)"});continue}if(o.role==="assistant"){let a=[],i=[];for(let d of o.content){if(d.type==="text"){if(d.text.trim().length>0)a.push({type:"text",text:w(d.text)});continue}if(d.type==="thinking"){if(d.thinking.trim().length>0)a.push({type:"thinking",thinking:[{type:"text",text:w(d.thinking)}]});continue}i.push({id:d.id,type:"function",function:{name:d.name,arguments:JSON.stringify(d.arguments||{})},index:0})}let c={role:"assistant",prefix:!1};if(a.length>0)c.content=a;if(i.length>0)c.toolCalls=i;if(a.length>0||i.length>0)n.push(c);continue}let s=[],l=o.content.filter((a)=>a.type==="text").map((a)=>a.type==="text"?w(a.text):"").join(`
|
|
4
|
+
`),f=o.content.some((a)=>a.type==="image"),u=fe(l,f,e,o.isError);s.push({type:"text",text:u});for(let a of o.content){if(!e)continue;if(a.type!=="image")continue;s.push({type:"image_url",imageUrl:`data:${a.mimeType};base64,${a.data}`})}n.push({role:"tool",toolCallId:o.toolCallId,name:o.toolName,content:s})}return n}function fe(t,e,n,r){let o=t.trim(),s=r?"[tool error] ":"";if(o.length>0)return`${s}${o}${e&&!n?`
|
|
5
|
+
[tool image omitted: model does not support images]`:""}`;if(e){if(n)return r?"[tool error] (see attached image)":"(see attached image)";return r?"[tool error] (image omitted: model does not support images)":"(image omitted: model does not support images)"}return r?"[tool error] (no tool output)":"(no tool output)"}function de(t){if(!t)return;if(t==="auto"||t==="none"||t==="any"||t==="required")return t;return{type:"function",function:{name:t.function.name}}}function ue(t){if(t===null)return{stopReason:"stop"};switch(t){case"stop":return{stopReason:"stop"};case"length":case"model_length":return{stopReason:"length"};case"tool_calls":return{stopReason:"toolUse"};case"error":return{stopReason:"error",errorMessage:"Provider stopped with: error (server error)"};default:return{stopReason:"error",errorMessage:`Provider stopped with: ${t}`}}}export{N as stream,Ie as streamSimple};
|