@qitqode/qitqode-android-arm64 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-37n34pzd.js → chunk-01my2y0c.js} +1 -1
- package/bundle/chunk-04n2ycg5.js +800 -0
- package/bundle/{chunk-6qy1ghrx.js → chunk-05mce0j3.js} +1 -1
- package/bundle/{chunk-g1dwbvkg.js → chunk-0bbs01f0.js} +1 -1
- package/bundle/{chunk-j6emx6jn.js → chunk-0dt0bxz6.js} +2 -2
- package/bundle/{chunk-mskwkcgj.js → chunk-0mx2psfc.js} +1 -1
- package/bundle/chunk-0p27fvfr.js +2 -0
- package/bundle/chunk-0qs1vx97.js +2 -0
- package/bundle/{chunk-f45tp3e3.js → chunk-0v0vqbn5.js} +1 -1
- package/bundle/chunk-0w0ctb90.js +2 -0
- package/bundle/{chunk-8qkhddq3.js → chunk-0yt5njh7.js} +2 -2
- package/bundle/{chunk-be216spx.js → chunk-10bjs581.js} +2 -2
- package/bundle/{chunk-bpbptx89.js → chunk-11x3t2tt.js} +1 -1
- package/bundle/{chunk-bss414qz.js → chunk-12vef2pr.js} +1 -1
- package/bundle/{chunk-jm1ptn8n.js → chunk-15hw2z9t.js} +1 -1
- package/bundle/chunk-1f7ajq8s.js +2 -0
- package/bundle/chunk-1fswr17z.js +2 -0
- package/bundle/{chunk-srh4xvsj.js → chunk-1gx18dm5.js} +1 -1
- package/bundle/chunk-1rhhhm88.js +2 -0
- package/bundle/{chunk-b0syck9r.js → chunk-1sgahe1s.js} +1 -1
- package/bundle/{chunk-26nfphsg.js → chunk-1vb79bw1.js} +1 -1
- package/bundle/chunk-1wbjh23g.js +2 -0
- package/bundle/chunk-20f83ca0.js +2 -0
- package/bundle/{chunk-371r2111.js → chunk-24jg9d61.js} +1 -1
- package/bundle/{chunk-1sgby720.js → chunk-2hc5z7b5.js} +1 -1
- package/bundle/{chunk-yq3m8190.js → chunk-2maqde7w.js} +2 -2
- package/bundle/{chunk-b8tw709r.js → chunk-2vn41ecx.js} +1 -1
- package/bundle/{chunk-w87a3mzm.js → chunk-2zq4k837.js} +1 -1
- package/bundle/chunk-31mnd3ph.js +3 -0
- package/bundle/{chunk-1bhvt33f.js → chunk-31qrzrwy.js} +1 -1
- package/bundle/{chunk-d5bxan80.js → chunk-326p5b10.js} +2 -2
- package/bundle/{chunk-0df4kede.js → chunk-33e9y2aw.js} +1 -1
- package/bundle/{chunk-zcm2jdr5.js → chunk-35xk4g91.js} +1 -1
- package/bundle/{chunk-5fz8tph5.js → chunk-3632wgg1.js} +1 -1
- package/bundle/{chunk-1ngtxja9.js → chunk-3bxg5bta.js} +1 -1
- package/bundle/{chunk-mgk9sh16.js → chunk-3c6p8tm3.js} +1 -1
- package/bundle/chunk-3h9rq2wq.js +2 -0
- package/bundle/{chunk-fqw4y7x0.js → chunk-3ytjm3az.js} +2 -2
- package/bundle/{chunk-2jmxt3fb.js → chunk-40efytmk.js} +1 -1
- package/bundle/chunk-42p59wm4.js +2 -0
- package/bundle/{chunk-wfs4pcwa.js → chunk-44a82dg0.js} +4 -4
- package/bundle/chunk-4512pvca.js +2 -0
- package/bundle/chunk-456bmaww.js +2 -0
- package/bundle/{chunk-c5e6sk9c.js → chunk-48ge2ryx.js} +1 -1
- package/bundle/chunk-48pajrnt.js +2 -0
- package/bundle/{chunk-12bssxd4.js → chunk-4cnwn1rh.js} +2 -2
- package/bundle/chunk-4d87mhwn.js +3 -0
- package/bundle/chunk-4fy9c54h.js +2 -0
- package/bundle/{chunk-hwbyqezq.js → chunk-4gkk28xk.js} +2 -2
- package/bundle/{chunk-4tbwha3m.js → chunk-4jtxtkj7.js} +2 -2
- package/bundle/{chunk-b3rpzkcb.js → chunk-50sv6y2e.js} +1 -1
- package/bundle/chunk-50tb3g5x.js +2 -0
- package/bundle/chunk-52bam8g7.js +2 -0
- package/bundle/{chunk-6fp8a9ek.js → chunk-53bqcctj.js} +1 -1
- package/bundle/chunk-53w4zqps.js +2 -0
- package/bundle/chunk-59y8q9m5.js +2 -0
- package/bundle/chunk-5eq1fft9.js +3 -0
- package/bundle/{chunk-a1pw9r6f.js → chunk-5hw6xa49.js} +2 -2
- package/bundle/{chunk-qrey2gwb.js → chunk-5q4harvc.js} +2 -2
- package/bundle/chunk-5tray1fw.js +3 -0
- package/bundle/{chunk-svvgv1s0.js → chunk-5v0xjs3x.js} +1 -1
- package/bundle/{chunk-my6sz5d6.js → chunk-60v5jvgt.js} +1 -1
- package/bundle/chunk-64ezpbwt.js +2 -0
- package/bundle/{chunk-2y90ad1v.js → chunk-68yw2hk9.js} +1 -1
- package/bundle/{chunk-5fgx6fa4.js → chunk-69nzndk7.js} +1 -1
- package/bundle/chunk-6bpe215q.js +2 -0
- package/bundle/chunk-6bphjajd.js +2 -0
- package/bundle/{chunk-chmrvbbj.js → chunk-6d5rrre9.js} +1 -1
- package/bundle/{chunk-g3dhsmbt.js → chunk-6hpgb8h4.js} +3 -3
- package/bundle/{chunk-drs1gv2b.js → chunk-6kp07m7p.js} +1 -1
- package/bundle/{chunk-wy46mbwt.js → chunk-6phh70sp.js} +1 -1
- package/bundle/chunk-6t1ehq36.js +2 -0
- package/bundle/{chunk-v2zp22r3.js → chunk-70ck4v3t.js} +1 -1
- package/bundle/{chunk-2tnarng3.js → chunk-71sjjjr8.js} +1 -1
- package/bundle/{chunk-ds69qc8b.js → chunk-71xz70r9.js} +1 -1
- package/bundle/{chunk-2dzk5txw.js → chunk-73e409hd.js} +1 -1
- package/bundle/{chunk-g7rjtehn.js → chunk-78ymd20x.js} +1 -1
- package/bundle/{chunk-szr0f7k2.js → chunk-7avcnwv8.js} +1 -1
- package/bundle/{chunk-z8v2tsz2.js → chunk-7hm0c2yg.js} +1 -1
- package/bundle/chunk-7mke41x0.js +2 -0
- package/bundle/chunk-7pfj4x1a.js +2 -0
- package/bundle/chunk-7ry9cvby.js +2 -0
- package/bundle/chunk-7wczs9mx.js +2 -0
- package/bundle/{chunk-aztre27e.js → chunk-7xm75w1e.js} +1 -1
- package/bundle/{chunk-s3yna2wm.js → chunk-7z5jh4ra.js} +1 -1
- package/bundle/{chunk-vj62pc0h.js → chunk-81qwdg5s.js} +1 -1
- package/bundle/{chunk-mrw279k3.js → chunk-83gqkmth.js} +1 -1
- package/bundle/chunk-873skv7w.js +2 -0
- package/bundle/{chunk-6hv59ere.js → chunk-8hytwgwf.js} +1 -1
- package/bundle/{chunk-wz0zcddf.js → chunk-8n20thvd.js} +2 -2
- package/bundle/{chunk-s07j8hfy.js → chunk-8qswepp2.js} +1 -1
- package/bundle/chunk-8v96pmqn.js +2 -0
- package/bundle/chunk-8y2scz6z.js +2 -0
- package/bundle/{chunk-wpajh5s5.js → chunk-8ymffyep.js} +1 -1
- package/bundle/chunk-8zx7vnx6.js +2 -0
- package/bundle/{chunk-qhc90p4a.js → chunk-93p131d5.js} +1 -1
- package/bundle/chunk-94a76f8w.js +2 -0
- package/bundle/{chunk-ppfjf7qx.js → chunk-9emq67vc.js} +1 -1
- package/bundle/{chunk-bvkq0a5q.js → chunk-9f1z9xce.js} +1 -1
- package/bundle/chunk-9mjz6e27.js +2 -0
- package/bundle/chunk-9ng7jjp7.js +2 -0
- package/bundle/chunk-9tpgnjy8.js +2 -0
- package/bundle/{chunk-0fmbz83g.js → chunk-9x5232dw.js} +1 -1
- package/bundle/{chunk-mk6cddvd.js → chunk-a1wdeapb.js} +1 -1
- package/bundle/{chunk-qjn86fc0.js → chunk-a7amey9s.js} +1 -1
- package/bundle/chunk-a7ym9f0v.js +2 -0
- package/bundle/chunk-a8f2xvy3.js +2 -0
- package/bundle/chunk-a99cvwta.js +2 -0
- package/bundle/chunk-abd1cfpg.js +2 -0
- package/bundle/{chunk-89v6dgpp.js → chunk-ag8kz1e7.js} +2 -2
- package/bundle/chunk-anwnwfjf.js +2 -0
- package/bundle/chunk-avys5mnz.js +2 -0
- package/bundle/chunk-axvjd10y.js +2 -0
- package/bundle/{chunk-m612agnk.js → chunk-ay8emwym.js} +1 -1
- package/bundle/chunk-b4pphqab.js +2 -0
- package/bundle/chunk-b6087ak4.js +2 -0
- package/bundle/{chunk-msegx0t7.js → chunk-b8gjz6bk.js} +1 -1
- package/bundle/chunk-bgw4fvg2.js +2 -0
- package/bundle/{chunk-gf0pdgjs.js → chunk-bh53dz71.js} +1 -1
- package/bundle/chunk-bn0h9dny.js +10 -0
- package/bundle/chunk-brkqxbjy.js +2 -0
- package/bundle/{chunk-09kba1hg.js → chunk-c11d28qn.js} +2 -2
- package/bundle/{chunk-ejjea8hh.js → chunk-c14s0kxq.js} +1 -1
- package/bundle/{chunk-sn4nez18.js → chunk-c1bdzxbx.js} +2 -2
- package/bundle/{chunk-ezja6njs.js → chunk-c1vnp55z.js} +1 -1
- package/bundle/chunk-c26qxt5g.js +2 -0
- package/bundle/chunk-c6zscb38.js +2 -0
- package/bundle/{chunk-pekm54ce.js → chunk-cfgvm15x.js} +1 -1
- package/bundle/{chunk-v4xcysh0.js → chunk-chpr8ekb.js} +1 -1
- package/bundle/chunk-cjww2jmv.js +3 -0
- package/bundle/{chunk-m67tcnk4.js → chunk-ck2gfaba.js} +1 -1
- package/bundle/chunk-cmbh77cs.js +7 -0
- package/bundle/{chunk-k8ss3135.js → chunk-cnmq5xtq.js} +218 -218
- package/bundle/{chunk-9j1qqdr2.js → chunk-cphrgyp6.js} +1 -1
- package/bundle/chunk-csz0dgyp.js +2 -0
- package/bundle/{chunk-eb9mytjq.js → chunk-ctaze2hn.js} +1 -1
- package/bundle/{chunk-5qam3c8r.js → chunk-cxnfy6qk.js} +1 -1
- package/bundle/{chunk-cafzcmrg.js → chunk-d07p6fpk.js} +2 -2
- package/bundle/{chunk-whcg14sc.js → chunk-d65qs4d0.js} +1 -1
- package/bundle/{chunk-dcvatax2.js → chunk-d68fzyw7.js} +2 -2
- package/bundle/{chunk-4qqkqrn9.js → chunk-d6ry9418.js} +2 -2
- package/bundle/{chunk-ztc3gm8y.js → chunk-dactgryw.js} +1 -1
- package/bundle/chunk-dafmkrhn.js +2 -0
- package/bundle/{chunk-dfnv7vkn.js → chunk-db405hjg.js} +1 -1
- package/bundle/chunk-dgprdym0.js +2 -0
- package/bundle/{chunk-7yrhe3xq.js → chunk-dnwefyhv.js} +1 -1
- package/bundle/{chunk-n26yf3he.js → chunk-drvkj3xg.js} +1 -1
- package/bundle/chunk-dryzt12j.js +2 -0
- package/bundle/chunk-dsamees2.js +2 -0
- package/bundle/{chunk-xpc2zgj7.js → chunk-dxpj0cxh.js} +2 -2
- package/bundle/{chunk-yjtdgcq5.js → chunk-dynv30gm.js} +1 -1
- package/bundle/chunk-dyqpxx3b.js +2 -0
- package/bundle/{chunk-2rs39vj2.js → chunk-e01wnqvc.js} +1 -1
- package/bundle/{chunk-2vepzgek.js → chunk-e10py6yr.js} +1 -1
- package/bundle/{chunk-qv2s39dv.js → chunk-e7ny0b3x.js} +1 -1
- package/bundle/{chunk-fjgyrsbw.js → chunk-eh7e49k4.js} +1 -1
- package/bundle/{chunk-42f7p0hq.js → chunk-ehhas0ew.js} +2 -2
- package/bundle/{chunk-n8h6x2en.js → chunk-ejrhvy38.js} +1 -1
- package/bundle/{chunk-dq9kpj4a.js → chunk-enpzvmtc.js} +1 -1
- package/bundle/chunk-excnptfy.js +2 -0
- package/bundle/chunk-ez8vkgfz.js +2 -0
- package/bundle/chunk-f2btnww9.js +2 -0
- package/bundle/chunk-f8eter69.js +5 -0
- package/bundle/{chunk-2km50rd3.js → chunk-fgg9txzb.js} +1 -1
- package/bundle/chunk-fjq3a347.js +2 -0
- package/bundle/{chunk-b9za12y1.js → chunk-fn9h4ync.js} +1 -1
- package/bundle/{chunk-ddnpx1yx.js → chunk-fq0x3esz.js} +5 -5
- package/bundle/{chunk-ngchsw2g.js → chunk-fvzwbjh8.js} +1 -1
- package/bundle/chunk-fxdtq2ed.js +2 -0
- package/bundle/{chunk-07g7cybt.js → chunk-fyqjm5fv.js} +1 -1
- package/bundle/{chunk-nzehfpxp.js → chunk-g10d6x57.js} +1 -1
- package/bundle/{chunk-zyhdxggp.js → chunk-g5rabwre.js} +2 -2
- package/bundle/{chunk-kfsb2stm.js → chunk-g7ccdh7r.js} +1 -1
- package/bundle/{chunk-3g1yz39h.js → chunk-g9cjsfvg.js} +1 -1
- package/bundle/{chunk-phxrg7aw.js → chunk-gagtmjmp.js} +2 -2
- package/bundle/{chunk-yp0a8q29.js → chunk-gb00fh4z.js} +3 -3
- package/bundle/{chunk-hw1dmx28.js → chunk-gbpvs0fx.js} +1 -1
- package/bundle/{chunk-zv6pjtz1.js → chunk-gbrnn2dk.js} +1 -1
- package/bundle/chunk-gcw4rn10.js +2 -0
- package/bundle/{chunk-j8efst22.js → chunk-gj0wt0cy.js} +1 -1
- package/bundle/{chunk-2q96x1t5.js → chunk-gsar6xda.js} +1 -1
- package/bundle/{chunk-xs3xtz6x.js → chunk-gt31468k.js} +1 -1
- package/bundle/{chunk-ecn8gbtz.js → chunk-gwp17r03.js} +1 -1
- package/bundle/chunk-gwzw92jt.js +2 -0
- package/bundle/{chunk-2bn4b42t.js → chunk-h2afsbm1.js} +1 -1
- package/bundle/{chunk-tj78jsp9.js → chunk-h4j5xzc8.js} +1 -1
- package/bundle/{chunk-b3dqcbsc.js → chunk-hbbsbyyq.js} +1 -1
- package/bundle/chunk-hnctaq8s.js +3 -0
- package/bundle/{chunk-vn7nkrqb.js → chunk-hnzegjgv.js} +1 -1
- package/bundle/chunk-hp7tssgv.js +2 -0
- package/bundle/chunk-ht0hbdmx.js +2 -0
- package/bundle/{chunk-j9pcnkkq.js → chunk-ht5w06x7.js} +2 -2
- package/bundle/{chunk-a1p2f16h.js → chunk-htz93dsd.js} +2 -2
- package/bundle/{chunk-q6ztpfcs.js → chunk-jbx3s7nw.js} +2 -2
- package/bundle/chunk-jcjbr3q7.js +2 -0
- package/bundle/{chunk-h9pvnp5c.js → chunk-jef04wyf.js} +1 -1
- package/bundle/{chunk-ct48575c.js → chunk-jh0bw59r.js} +1 -1
- package/bundle/{chunk-knpt9n8f.js → chunk-jrqb0jwy.js} +1 -1
- package/bundle/{chunk-1dwcga8g.js → chunk-js1n8tgv.js} +1 -1
- package/bundle/chunk-jxswwvr3.js +2 -0
- package/bundle/{chunk-1rp1cvmc.js → chunk-kf167jw7.js} +1 -1
- package/bundle/{chunk-wsy0m70r.js → chunk-kfxv5rfg.js} +1 -1
- package/bundle/{chunk-btz9jvec.js → chunk-kj20f048.js} +1 -1
- package/bundle/{chunk-j5kb0y1m.js → chunk-kq6b222y.js} +1 -1
- package/bundle/{chunk-1t9jne14.js → chunk-ktzq4ha1.js} +1 -1
- package/bundle/chunk-m5m448mg.js +3 -0
- package/bundle/chunk-mcg24gkb.js +5 -0
- package/bundle/chunk-mh0j6dzy.js +2 -0
- package/bundle/{chunk-1qshjfzm.js → chunk-mk1bfzg5.js} +1 -1
- package/bundle/chunk-mxzceza9.js +2 -0
- package/bundle/{chunk-t12xrrfr.js → chunk-mzs2pjyc.js} +2 -2
- package/bundle/chunk-n0dy98h2.js +2 -0
- package/bundle/{chunk-m02zt1a3.js → chunk-n9xns8by.js} +2 -2
- package/bundle/chunk-ngm6pqyt.js +2 -0
- package/bundle/chunk-ngtavamt.js +2 -0
- package/bundle/chunk-nkhc32s3.js +2 -0
- package/bundle/chunk-npse2xrd.js +2 -0
- package/bundle/{chunk-4p5e5tsz.js → chunk-nsk8dkwp.js} +1 -1
- package/bundle/{chunk-k7gq9bra.js → chunk-nv3eyyaj.js} +1 -1
- package/bundle/{chunk-ab6cabxh.js → chunk-p18axz0m.js} +1 -1
- package/bundle/{chunk-jje0srjq.js → chunk-p62gb4wj.js} +1 -1
- package/bundle/chunk-p6e4vqy7.js +2 -0
- package/bundle/{chunk-m1h5a4vg.js → chunk-p9qfbr02.js} +1 -1
- package/bundle/{chunk-yn6sbycg.js → chunk-pctt1qv8.js} +2 -2
- package/bundle/{chunk-ggqst87g.js → chunk-pe29yy6s.js} +1 -1
- package/bundle/chunk-pf9g671w.js +2 -0
- package/bundle/chunk-phv9kdq6.js +3 -0
- package/bundle/{chunk-3n1324bt.js → chunk-pp2eqkse.js} +1 -1
- package/bundle/{chunk-x067eetw.js → chunk-pp6vhqrr.js} +1 -1
- package/bundle/chunk-ppjnqexm.js +2 -0
- package/bundle/chunk-pqkjhn8h.js +2 -0
- package/bundle/{chunk-hxz2rdjq.js → chunk-pxvk3syj.js} +1 -1
- package/bundle/{chunk-b8bytvka.js → chunk-qbc36nbb.js} +2 -2
- package/bundle/{chunk-89q1y7tc.js → chunk-qc8rsn4v.js} +1 -1
- package/bundle/chunk-qd8w2gkd.js +2 -0
- package/bundle/{chunk-q1v2pytx.js → chunk-qrsveve6.js} +1 -1
- package/bundle/chunk-qvnb3j71.js +3 -0
- package/bundle/{chunk-2gerf08b.js → chunk-r4ndwym0.js} +2 -2
- package/bundle/chunk-r78czx4d.js +8 -0
- package/bundle/{chunk-7ppd2phw.js → chunk-rbk8seme.js} +1 -1
- package/bundle/{chunk-gj3hzx3d.js → chunk-redjxn13.js} +2 -2
- package/bundle/chunk-rf12t4n5.js +2 -0
- package/bundle/{chunk-04tw0r4s.js → chunk-rg0mrprz.js} +1 -1
- package/bundle/{chunk-cdhmc0t0.js → chunk-rjd8gbs5.js} +1 -1
- package/bundle/chunk-rpgne7xh.js +2 -0
- package/bundle/chunk-rvgj1vky.js +2 -0
- package/bundle/{chunk-c01z3cvg.js → chunk-rvkrgkeq.js} +1 -1
- package/bundle/{chunk-2ahqhh4z.js → chunk-rzhdkkpz.js} +1 -1
- package/bundle/{chunk-5v4py9p2.js → chunk-s9ntkjz3.js} +1 -1
- package/bundle/{chunk-kqn9h2gk.js → chunk-skqbaadf.js} +1 -1
- package/bundle/chunk-ss2jvqrg.js +2 -0
- package/bundle/{chunk-ydp0q1hk.js → chunk-ss2ms1r3.js} +1 -1
- package/bundle/chunk-ssajqv72.js +2 -0
- package/bundle/{chunk-1fbeendk.js → chunk-t56r99hp.js} +1 -1
- package/bundle/{chunk-xc5044tm.js → chunk-t8m74g39.js} +1 -1
- package/bundle/{chunk-s6bar2f9.js → chunk-t9mz17gb.js} +2 -2
- package/bundle/chunk-takew94z.js +9 -0
- package/bundle/{chunk-cvdxgsq1.js → chunk-tq0239xp.js} +1 -1
- package/bundle/{chunk-whxjkz9a.js → chunk-tqj69nh6.js} +2 -2
- package/bundle/{chunk-hj5y7fvk.js → chunk-tt30dybd.js} +1 -1
- package/bundle/{chunk-5a5t01ka.js → chunk-tvdmnee6.js} +1 -1
- package/bundle/chunk-tvwwq4b3.js +2 -0
- package/bundle/{chunk-dhjp0zx2.js → chunk-v1xjc3s8.js} +1 -1
- package/bundle/chunk-v2n26eg4.js +2 -0
- package/bundle/chunk-vb286b31.js +2 -0
- package/bundle/chunk-vbeb74ny.js +11 -0
- package/bundle/chunk-vcw00k0n.js +3 -0
- package/bundle/{chunk-7jbz3dgt.js → chunk-vhe0tth1.js} +1 -1
- package/bundle/{chunk-yfkvjphe.js → chunk-vvxmwyrw.js} +1 -1
- package/bundle/{chunk-p68rwmhc.js → chunk-vxyy2dp3.js} +2 -2
- package/bundle/{chunk-y2v09y71.js → chunk-vywnd5sf.js} +1 -1
- package/bundle/{chunk-0jgsp4c2.js → chunk-w18xs2h5.js} +1 -1
- package/bundle/{chunk-d6r4xwtg.js → chunk-wfb608qf.js} +3 -3
- package/bundle/chunk-x24y7qyd.js +2 -0
- package/bundle/{chunk-tr8sf0dk.js → chunk-x3y2xzhn.js} +1 -1
- package/bundle/{chunk-27yxgy03.js → chunk-x4sp99g6.js} +1 -1
- package/bundle/{chunk-3nwve06r.js → chunk-x562b0xk.js} +1 -1
- package/bundle/{chunk-61c62e5s.js → chunk-x7k5yeey.js} +1 -1
- package/bundle/{chunk-fkgv2hqd.js → chunk-x9rbv6p6.js} +1 -1
- package/bundle/{chunk-wnqwb6fd.js → chunk-xcmgkc57.js} +1 -1
- package/bundle/{chunk-gm85xefs.js → chunk-xm7wascx.js} +1 -1
- package/bundle/{chunk-6nbzdb0r.js → chunk-xthkjax9.js} +1 -1
- package/bundle/{chunk-scnz207s.js → chunk-xvwvd4kq.js} +2 -2
- package/bundle/{chunk-zb0me4kk.js → chunk-xzrb857v.js} +1 -1
- package/bundle/chunk-y2d0w09y.js +2 -0
- package/bundle/{chunk-3nyqh1d6.js → chunk-y3b4k38p.js} +1 -1
- package/bundle/{chunk-vg2fmyje.js → chunk-y9q0hb7b.js} +2 -2
- package/bundle/chunk-yb79f79m.js +2 -0
- package/bundle/{chunk-fnbpap62.js → chunk-yek0sk2q.js} +1 -1
- package/bundle/{chunk-3bmzjznz.js → chunk-yhbcbjfk.js} +1 -1
- package/bundle/{chunk-sermjas1.js → chunk-yjf3kyej.js} +1 -1
- package/bundle/chunk-yjnyzpmt.js +2 -0
- package/bundle/{chunk-0a0vat1h.js → chunk-yp5bypsp.js} +2 -2
- package/bundle/{chunk-h0rpmne5.js → chunk-yp8wyzzm.js} +1 -1
- package/bundle/chunk-yqbcnsa1.js +2 -0
- package/bundle/{chunk-4xh1qm90.js → chunk-yv0xrnn9.js} +1 -1
- package/bundle/chunk-z3mra3nm.js +2 -0
- package/bundle/{chunk-yy526n9c.js → chunk-z6pwkwdr.js} +1 -1
- package/bundle/{chunk-snm5q21k.js → chunk-zs8kqdsf.js} +2 -2
- package/bundle/{chunk-y062spw2.js → chunk-zscer8rc.js} +1 -1
- package/bundle/{chunk-qjjch1zt.js → chunk-zw815d68.js} +2 -2
- package/bundle/chunk-zy9w1vkc.js +2 -0
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-07ws99b1.js +0 -2
- package/bundle/chunk-09c4ngag.js +0 -2
- package/bundle/chunk-0ch32p4c.js +0 -3
- package/bundle/chunk-0jgst767.js +0 -2
- package/bundle/chunk-0psrr9vp.js +0 -2
- package/bundle/chunk-1j73cnvz.js +0 -2
- package/bundle/chunk-1yddn03z.js +0 -2
- package/bundle/chunk-27dgtm8r.js +0 -2
- package/bundle/chunk-2ec6ps8r.js +0 -5
- package/bundle/chunk-38g8yzw0.js +0 -2
- package/bundle/chunk-3bkd0ar3.js +0 -2
- package/bundle/chunk-3f4zht9e.js +0 -2
- package/bundle/chunk-3pxnp6jb.js +0 -2
- package/bundle/chunk-3szwfy7w.js +0 -3
- package/bundle/chunk-426dt7be.js +0 -2
- package/bundle/chunk-4amgp4yd.js +0 -3
- package/bundle/chunk-4pjm21a5.js +0 -2
- package/bundle/chunk-4sz3jbc5.js +0 -2
- package/bundle/chunk-58x5seqn.js +0 -2
- package/bundle/chunk-5xe6x2rt.js +0 -2
- package/bundle/chunk-618tmyx9.js +0 -2
- package/bundle/chunk-6d9wsjxm.js +0 -2
- package/bundle/chunk-730a2d1k.js +0 -2
- package/bundle/chunk-76wrw0cs.js +0 -2
- package/bundle/chunk-7bd0x9vf.js +0 -2
- package/bundle/chunk-7czkntef.js +0 -2
- package/bundle/chunk-7ex57nyh.js +0 -2
- package/bundle/chunk-7gpczxbh.js +0 -2
- package/bundle/chunk-7j0bgeh2.js +0 -2
- package/bundle/chunk-7py443fe.js +0 -2
- package/bundle/chunk-90q5sae0.js +0 -2
- package/bundle/chunk-9amwe0ed.js +0 -2
- package/bundle/chunk-9grvepmd.js +0 -2
- package/bundle/chunk-9hrh15p2.js +0 -2
- package/bundle/chunk-a0v55ywn.js +0 -8
- package/bundle/chunk-a2qz9m10.js +0 -2
- package/bundle/chunk-av6ezvxm.js +0 -2
- package/bundle/chunk-beksar7w.js +0 -2
- package/bundle/chunk-bg66rqrx.js +0 -2
- package/bundle/chunk-bn15mzd7.js +0 -2
- package/bundle/chunk-bt6yw07v.js +0 -2
- package/bundle/chunk-cy9s1ma5.js +0 -2
- package/bundle/chunk-d0nkvp57.js +0 -2
- package/bundle/chunk-dvk2wwjj.js +0 -2
- package/bundle/chunk-dxe29jj6.js +0 -2
- package/bundle/chunk-e0jy9qxd.js +0 -2
- package/bundle/chunk-eercqt72.js +0 -2
- package/bundle/chunk-efxd6b2k.js +0 -2
- package/bundle/chunk-eneawsj8.js +0 -2
- package/bundle/chunk-f72pppr7.js +0 -2
- package/bundle/chunk-feyphhxd.js +0 -2
- package/bundle/chunk-fnnch1e9.js +0 -2
- package/bundle/chunk-ft93f33g.js +0 -3
- package/bundle/chunk-gk34kh8p.js +0 -2
- package/bundle/chunk-gn50xqbd.js +0 -2
- package/bundle/chunk-h6rv626m.js +0 -2
- package/bundle/chunk-h7s2w1e2.js +0 -2
- package/bundle/chunk-hmv2cdnz.js +0 -2
- package/bundle/chunk-ht81ensf.js +0 -2
- package/bundle/chunk-hxpgs78j.js +0 -5
- package/bundle/chunk-j59ktwny.js +0 -2
- package/bundle/chunk-jmz2mq3t.js +0 -2
- package/bundle/chunk-jvqbvgjy.js +0 -11
- package/bundle/chunk-k309zez0.js +0 -3
- package/bundle/chunk-k3fn3yed.js +0 -2
- package/bundle/chunk-kpw6nghv.js +0 -2
- package/bundle/chunk-m5ghbt5y.js +0 -2
- package/bundle/chunk-mj4bepvj.js +0 -2
- package/bundle/chunk-mn41f9qv.js +0 -2
- package/bundle/chunk-mqjf9sbm.js +0 -2
- package/bundle/chunk-n5gwrrbb.js +0 -2
- package/bundle/chunk-nfjhem1c.js +0 -2
- package/bundle/chunk-ngytjdg2.js +0 -3
- package/bundle/chunk-nj4d554m.js +0 -11
- package/bundle/chunk-nrc3bj9p.js +0 -2
- package/bundle/chunk-nt4e3em9.js +0 -3
- package/bundle/chunk-nxyyn2ra.js +0 -2
- package/bundle/chunk-p5tceb4k.js +0 -2
- package/bundle/chunk-pvpy9kq1.js +0 -800
- package/bundle/chunk-qjgm3e2p.js +0 -2
- package/bundle/chunk-qt80mhdn.js +0 -2
- package/bundle/chunk-qtw5nrr4.js +0 -2
- package/bundle/chunk-rc9ex3vt.js +0 -2
- package/bundle/chunk-s9672vvv.js +0 -2
- package/bundle/chunk-sbyey0qb.js +0 -2
- package/bundle/chunk-shpq6es1.js +0 -3
- package/bundle/chunk-sj5v361q.js +0 -2
- package/bundle/chunk-ta3k9syc.js +0 -2
- package/bundle/chunk-tk5afan4.js +0 -2
- package/bundle/chunk-tpndnprb.js +0 -2
- package/bundle/chunk-v965rsr8.js +0 -3
- package/bundle/chunk-vcmrrt8b.js +0 -3
- package/bundle/chunk-vcrn3v70.js +0 -2
- package/bundle/chunk-vwxfgea7.js +0 -2
- package/bundle/chunk-w0kgcz1t.js +0 -2
- package/bundle/chunk-wgpsmxqx.js +0 -7
- package/bundle/chunk-wksczmes.js +0 -2
- package/bundle/chunk-wsxta33r.js +0 -2
- package/bundle/chunk-xck0sq3k.js +0 -2
- package/bundle/chunk-xjyhtm8r.js +0 -2
- package/bundle/chunk-xm08fc2q.js +0 -3
- package/bundle/chunk-ygc5qegv.js +0 -2
- package/bundle/chunk-yjqmzm51.js +0 -2
- package/bundle/chunk-yzc53n88.js +0 -2
- package/bundle/chunk-yzjc15vp.js +0 -9
- package/bundle/chunk-z7y9pdj7.js +0 -2
- package/bundle/chunk-z8g819cz.js +0 -2
- package/bundle/chunk-z8r65yw3.js +0 -2
- package/bundle/chunk-zt1nbwmm.js +0 -2
- package/bundle/chunk-zz36xg2n.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Co as J}from"./chunk-2hc5z7b5.js";import{et as H,ft as I,gt as N,qt as Q}from"./chunk-tqj69nh6.js";import{FO as L}from"./chunk-7xm75w1e.js";import{platform as R,release as U}from"os";import{tmpdir as V}from"os";import X from"path";import Y from"fs/promises";var Z=J(async()=>{let{which:D}=await import("./chunk-50tb3g5x.js");return D}),T=J(async()=>{let{default:D}=await import("./chunk-yp8wyzzm.js");return D});function _(D){if(!process.stdout.isTTY)return;let A=`\x1B]52;c;${Buffer.from(D).toString("base64")}\x07`,E=process.env.TMUX||process.env.STY?`\x1BPtmux;\x1B${A}\x1B\\`:A;process.stdout.write(E)}async function $(){let D=R();if(D==="darwin"){let k=X.join(V(),"qitqode-clipboard.png");try{return await I(["osascript","-e",'set imageData to the clipboard as "PNGf"',"-e",`set fileRef to open for access POSIX file "${k}" with write permission`,"-e","set eof fileRef to 0","-e","write imageData to fileRef","-e","close access fileRef"],{nothrow:!0}),{data:(await Q(k)).toString("base64"),mime:"image/png"}}catch{}finally{await Y.rm(k,{force:!0}).catch(()=>{})}}if(D==="win32"||U().includes("WSL")){let E=await N(["powershell.exe","-NonInteractive","-NoProfile","-command","Add-Type -AssemblyName System.Windows.Forms; $img = [System.Windows.Forms.Clipboard]::GetImage(); if ($img) { $ms = New-Object System.IO.MemoryStream; $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png); [System.Convert]::ToBase64String($ms.ToArray()) }"],{nothrow:!0});if(E.text){let K=Buffer.from(E.text.trim(),"base64");if(K.length>0)return{data:K.toString("base64"),mime:"image/png"}}}if(D==="linux"){let k=await I(["wl-paste","-t","image/png"],{nothrow:!0});if(k.stdout.byteLength>0)return{data:Buffer.from(k.stdout).toString("base64"),mime:"image/png"};let E=await I(["xclip","-selection","clipboard","-t","image/png","-o"],{nothrow:!0});if(E.stdout.byteLength>0)return{data:Buffer.from(E.stdout).toString("base64"),mime:"image/png"}}let A=await(await T()).read().catch(()=>{});if(A)return{data:A,mime:"text/plain"}}var j=J(async()=>{let D=R(),G=await Z();if(D==="darwin"&&G("osascript"))return console.log("clipboard: using osascript"),async(A)=>{let k=A.replace(/\\/g,"\\\\").replace(/"/g,"\\\"");await I(["osascript","-e",`set the clipboard to "${k}"`],{nothrow:!0})};if(D==="linux"){if(process.env.WAYLAND_DISPLAY&&G("wl-copy"))return console.log("clipboard: using wl-copy"),async(A)=>{let k=H(["wl-copy"],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});if(!k.stdin)return;k.stdin.write(A),k.stdin.end(),await k.exited.catch(()=>{})};if(G("xclip"))return console.log("clipboard: using xclip"),async(A)=>{let k=H(["xclip","-selection","clipboard"],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});if(!k.stdin)return;k.stdin.write(A),k.stdin.end(),await k.exited.catch(()=>{})};if(G("xsel"))return console.log("clipboard: using xsel"),async(A)=>{let k=H(["xsel","--clipboard","--input"],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});if(!k.stdin)return;k.stdin.write(A),k.stdin.end(),await k.exited.catch(()=>{})}}if(D==="win32")return console.log("clipboard: using powershell"),async(A)=>{let k=H(["powershell.exe","-NonInteractive","-NoProfile","-Command","[Console]::InputEncoding = [System.Text.Encoding]::UTF8; Set-Clipboard -Value ([Console]::In.ReadToEnd())"],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});if(!k.stdin)return;k.stdin.write(A),k.stdin.end(),await k.exited.catch(()=>{})};return console.log("clipboard: no native support"),async(A)=>{await(await T()).write(A).catch(()=>{})}});async function v(D){_(D),await(await j())(D)}
|
|
3
3
|
export{$ as ud,v as vd};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{As as cJ,Ds as pJ,Es as iJ,Fs as nJ,Gs as aJ,Hs as rJ,Js as AQ,qs as mJ,rs as vJ,ss as dJ,ts as lJ,ws as d,xs as l,zs as uJ}from"./chunk-4qqkqrn9.js";import{Yt as FQ,pu as x,tt as CQ,ut as DQ,yu as GJ}from"./chunk-3szwfy7w.js";import{AH as VJ,BI as E,DH as hJ,DM as o,EG as DJ,FG as FJ,GG as AJ,GI as yJ,HI as bJ,IP as g,JF as BQ,JP as eJ,KF as wQ,MD as $Q,MH as jJ,MP as HQ,NC as wJ,NF as $J,NP as WQ,OF as UJ,OP as R,PI as I,QC as HJ,SG as t,SH as NJ,TC as WJ,TF as zJ,TG as OJ,UD as f,VG as y,_D as IJ,bE as PJ,bI as kJ,bK as gJ,cG as ZJ,eE as T,fI as LJ,gH as TJ,hC as tJ,hE as KJ,iI as SJ,mG as z,mI as xJ,mM as j,nF as qQ,nH as EJ,qI as fJ,rH as MJ,sG as b,uF as _J,uG as CJ,uH as oJ,wD as GQ,yH as RJ}from"./chunk-snm5q21k.js";import{$P as zQ,bQ as u,dQ as S}from"./chunk-aztre27e.js";var IX={};u(IX,{resource:()=>BJ,layer:()=>EQ,enabled:()=>OQ,Observability:()=>WX});var p={};u(p,{make:()=>IQ,layer:()=>ZX});var VQ=AJ.pipe(FJ,DJ((J)=>{if(lJ(J)&&J.reason._tag==="StatusCodeError"&&J.reason.response.status===429){let Q=HJ(J.reason.response.headers["retry-after"]).pipe(WJ(CJ),wJ(()=>5));return t(T(Q))}return t(T(1))})),sJ=E(function*(J){let Q=yield*jJ(),X=f(Q,b),Y=f(Q,UJ),$=fJ(Q),G=KJ(IJ(J.exportInterval),PJ),B=void 0,C=nJ(f(Q,pJ)).pipe(iJ(NJ(rJ,!1)),aJ({schedule:VQ,times:3})),V=vJ({"user-agent":`effect-opentelemetry-${J.label}/0.0.0`});if(J.headers)V=dJ(mJ(J.headers),V);let r=uJ(J.url,{headers:V}),O=[],s=OJ(()=>{if(B!==void 0&&X.currentTimeMillisUnsafe()<B)return y;else if(B!==void 0)B=void 0;let h=O;if(J.maxBatchSize!=="disabled"){if(O.length===0)return y;O=[]}return C.execute(cJ(r,J.body(h))).pipe(EJ,SJ(!1))}).pipe(MJ((h)=>{if(B!==void 0)return y;return B=X.currentTimeMillisUnsafe()+60000,O=[],yJ("Disabling exporter for 60 seconds",h)}),bJ({package:"@effect/opentelemetry",module:J.label}));return yield*zJ(Y,s.pipe(RJ,kJ,VJ(J.shutdownTimeout))),yield*hJ(G).pipe(TJ(s),LJ,xJ(Y)),{push(h){if(B!==void 0)return;if(O.push(h),J.maxBatchSize!=="disabled"&&O.length>=J.maxBatchSize)gJ($(s),Y)}}});var jQ=(J)=>{let Q=J.attributes?e(Object.entries(J.attributes)):[];if(Q.push({key:"service.name",value:{stringValue:J.serviceName}}),J.serviceVersion)Q.push({key:"service.version",value:{stringValue:J.serviceVersion}});return{attributes:Q,droppedAttributesCount:0}},JQ=E(function*(J){let Q={...yield*g(o(eJ(j,j)),"OTEL_RESOURCE_ATTRIBUTES"),...J?.attributes},X=J?.serviceName??Q["service.name"]??(yield*g(j,"OTEL_SERVICE_NAME"));delete Q["service.name"];let Y=J?.serviceVersion??Q["service.version"]??(yield*g(o(j),"OTEL_SERVICE_VERSION"));return delete Q["service.version"],jQ({serviceName:X,serviceVersion:Y,attributes:Q})},oJ),QQ=(J)=>{let Q=J.attributes.find((X)=>X.key==="service.name");if(!Q||!Q.value.stringValue)throw Error("Resource does not contain a service name");return Q.value.stringValue},e=(J)=>{let Q=[];for(let[X,Y]of J)Q.push({key:X,value:m(Y)});return Q},m=(J)=>{if(Array.isArray(J))return{arrayValue:{values:J.map(m)}};switch(typeof J){case"string":return{stringValue:J};case"bigint":return{intValue:Number(J)};case"number":return Number.isInteger(J)?{intValue:J}:{doubleValue:J};case"boolean":return{boolValue:J};default:return{stringValue:tJ(J)}}};var c={};u(c,{layerProtobuf:()=>YX,layerJson:()=>XX,OtlpSerialization:()=>M});var N={Varint:0,Fixed64:1,LengthDelimited:2,Fixed32:5},k=(J,Q)=>J<<3|Q,D=(J)=>{let Q=[],X=typeof J==="bigint"?J:BigInt(J);while(X>0x7fn)Q.push(Number(X&0x7fn)|128),X>>=7n;return Q.push(Number(X)),new Uint8Array(Q)};var kQ=(J)=>{let Q=new Uint8Array(8);return new DataView(Q.buffer).setBigUint64(0,J,!0),Q},LQ=(J)=>{let Q=new Uint8Array(4);return new DataView(Q.buffer).setUint32(0,J,!0),Q},SQ=(J)=>{let Q=new Uint8Array(8);return new DataView(Q.buffer).setFloat64(0,J,!0),Q},xQ=(J)=>new TextEncoder().encode(J),fQ=(J)=>{let Q=new Uint8Array(J.length/2);for(let X=0;X<J.length;X+=2)Q[X/2]=parseInt(J.slice(X,X+2),16);return Q},Z=(...J)=>{let Q=J.reduce(($,G)=>$+G.length,0),X=new Uint8Array(Q),Y=0;for(let $ of J)X.set($,Y),Y+=$.length;return X},q=(J,Q)=>Z(D(k(J,N.Varint)),D(Q));var JJ=(J,Q)=>q(J,Q?1:0),W=(J,Q)=>Z(D(k(J,N.Fixed64)),kQ(Q)),v=(J,Q)=>Z(D(k(J,N.Fixed32)),LQ(Q)),F=(J,Q)=>Z(D(k(J,N.Fixed64)),SQ(Q)),L=(J,Q)=>Z(D(k(J,N.LengthDelimited)),D(Q.length),Q),K=(J,Q)=>L(J,xQ(Q)),U=(J,Q)=>L(J,fQ(Q)),w=(J,Q)=>L(J,Q),_=(J,Q,X)=>Z(...Q.map((Y)=>w(J,X(Y))));var H=(J,Q)=>Q!==void 0&&Q!==""?K(J,Q):new Uint8Array(0);var QJ=(J)=>{if(J.stringValue!==void 0&&J.stringValue!==null)return K(1,J.stringValue);if(J.boolValue!==void 0&&J.boolValue!==null)return JJ(2,J.boolValue);if(J.intValue!==void 0&&J.intValue!==null)return q(3,BigInt(J.intValue));if(J.doubleValue!==void 0&&J.doubleValue!==null)return F(4,J.doubleValue);if(J.arrayValue!==void 0)return w(5,bQ(J.arrayValue));if(J.kvlistValue!==void 0)return w(6,gQ(J.kvlistValue));if(J.bytesValue!==void 0)return L(7,J.bytesValue);return new Uint8Array(0)},bQ=(J)=>_(1,J.values,QJ),gQ=(J)=>_(1,J.values,P),P=(J)=>Z(K(1,J.key),w(2,QJ(J.value))),XJ=(J)=>Z(K(1,J.name),H(2,J.version),J.attributes?_(3,J.attributes,P):new Uint8Array(0),J.droppedAttributesCount?q(4,J.droppedAttributesCount):new Uint8Array(0)),YJ=(J)=>Z(_(1,J.attributes,P),J.droppedAttributesCount>0?q(2,J.droppedAttributesCount):new Uint8Array(0));var mQ=(J)=>Z(H(2,J.message),q(3,J.code)),vQ=(J)=>Z(W(1,BigInt(J.timeUnixNano)),K(2,J.name),_(3,J.attributes,P),J.droppedAttributesCount>0?q(4,J.droppedAttributesCount):new Uint8Array(0)),dQ=(J)=>Z(U(1,J.traceId),U(2,J.spanId),H(3,J.traceState),_(4,J.attributes,P),J.droppedAttributesCount>0?q(5,J.droppedAttributesCount):new Uint8Array(0),J.flags!==void 0?v(6,J.flags):new Uint8Array(0)),lQ=(J)=>Z(U(1,J.traceId),U(2,J.spanId),H(3,J.traceState),J.parentSpanId!==void 0?U(4,J.parentSpanId):new Uint8Array(0),K(5,J.name),q(6,J.kind),W(7,BigInt(J.startTimeUnixNano)),W(8,BigInt(J.endTimeUnixNano)),_(9,J.attributes,P),J.droppedAttributesCount>0?q(10,J.droppedAttributesCount):new Uint8Array(0),_(11,J.events,vQ),J.droppedEventsCount>0?q(12,J.droppedEventsCount):new Uint8Array(0),_(13,J.links,dQ),J.droppedLinksCount>0?q(14,J.droppedLinksCount):new Uint8Array(0),w(15,mQ(J.status)),J.flags!==void 0?v(16,J.flags):new Uint8Array(0)),uQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.spans,lQ),H(3,J.schemaUrl)),cQ=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeSpans,uQ),H(3,J.schemaUrl)),XQ=(J)=>_(1,J.resourceSpans,cQ);var YQ=(J)=>Z(W(2,BigInt(J.startTimeUnixNano)),W(3,BigInt(J.timeUnixNano)),J.asDouble!==void 0?F(4,J.asDouble):new Uint8Array(0),J.asInt!==void 0?W(6,BigInt(J.asInt)):new Uint8Array(0),_(7,J.attributes,P),J.flags!==void 0?q(8,J.flags):new Uint8Array(0)),pQ=(J)=>{let Q=Z(...J.bucketCounts.map((Y)=>W(6,BigInt(Y)))),X=Z(...J.explicitBounds.map((Y)=>F(7,Y)));return Z(W(2,BigInt(J.startTimeUnixNano)),W(3,BigInt(J.timeUnixNano)),W(4,BigInt(J.count)),J.sum!==void 0?F(5,J.sum):new Uint8Array(0),Q,X,_(9,J.attributes,P),J.flags!==void 0?q(10,J.flags):new Uint8Array(0),J.min!==void 0?F(11,J.min):new Uint8Array(0),J.max!==void 0?F(12,J.max):new Uint8Array(0))},iQ=(J)=>_(1,J.dataPoints,YQ),nQ=(J)=>Z(_(1,J.dataPoints,YQ),q(2,J.aggregationTemporality),JJ(3,J.isMonotonic)),aQ=(J)=>Z(_(1,J.dataPoints,pQ),q(2,J.aggregationTemporality)),rQ=(J)=>Z(K(1,J.name),H(2,J.description),H(3,J.unit),J.gauge!==void 0?w(5,iQ(J.gauge)):new Uint8Array(0),J.sum!==void 0?w(7,nQ(J.sum)):new Uint8Array(0),J.histogram!==void 0?w(9,aQ(J.histogram)):new Uint8Array(0)),sQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.metrics,rQ),H(3,J.schemaUrl)),tQ=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeMetrics,sQ),H(3,J.schemaUrl)),ZQ=(J)=>_(1,J.resourceMetrics,tQ);var oQ=(J)=>Z(W(1,BigInt(J.timeUnixNano)),J.severityNumber!==void 0?q(2,J.severityNumber):new Uint8Array(0),H(3,J.severityText),J.body!==void 0?w(5,QJ(J.body)):new Uint8Array(0),_(6,J.attributes,P),J.droppedAttributesCount!==void 0&&J.droppedAttributesCount>0?q(7,J.droppedAttributesCount):new Uint8Array(0),J.flags!==void 0?v(8,J.flags):new Uint8Array(0),J.traceId!==void 0&&J.traceId!==""?U(9,J.traceId):new Uint8Array(0),J.spanId!==void 0&&J.spanId!==""?U(10,J.spanId):new Uint8Array(0),J.observedTimeUnixNano!==void 0?W(11,BigInt(J.observedTimeUnixNano)):new Uint8Array(0)),eQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.logRecords,oQ),H(3,J.schemaUrl)),JX=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeLogs,eQ),H(3,J.schemaUrl)),_Q=(J)=>_(1,J.resourceLogs,JX);class M extends $Q()("effect/observability/OtlpSerialization"){}var XX=ZJ(M,{traces:(J)=>l(J),metrics:(J)=>l(J),logs:(J)=>l(J)}),YX=ZJ(M,{traces:(J)=>d(XQ(J),"application/x-protobuf"),metrics:(J)=>d(ZQ(J),"application/x-protobuf"),logs:(J)=>d(_Q(J),"application/x-protobuf")});var IQ=E(function*(J){let Q=yield*M,X=yield*JQ(J.resource),Y={name:QQ(X)},$=yield*sJ({label:"OtlpLogger",url:J.url,headers:J.headers,maxBatchSize:J.maxBatchSize??1000,exportInterval:J.exportInterval??T(1),body:(B)=>Q.logs({resourceLogs:[{resource:X,scopeLogs:[{scope:Y,logRecords:B}]}]}),shutdownTimeout:J.shutdownTimeout??T(3)}),G={excludeLogSpans:J.excludeLogSpans??!1,clock:yield*b};return HQ((B)=>{$.push(_X(B,G))})}),ZX=(J)=>WQ([IQ(J)],{mergeWithExisting:J.mergeWithExisting??!0}),_X=(J,Q)=>{let Y=Q.clock.currentTimeNanosUnsafe().toString(),$=J.date.getTime(),G=e(Object.entries(J.fiber.getRef(BQ)));if(G.push({key:"fiberId",value:{intValue:J.fiber.id}}),!Q.excludeLogSpans)for(let[V,r]of J.fiber.getRef(wQ))G.push({key:`logSpan.${V}`,value:{stringValue:`${$-r}ms`}});if(J.cause.reasons.length>0)G.push({key:"log.error",value:{stringValue:qQ(J.cause)}});let B=GQ(J.message),C={severityNumber:$X(J.logLevel),severityText:J.logLevel,timeUnixNano:Y,observedTimeUnixNano:Y,attributes:G,body:m(B.length===1?B[0]:B),droppedAttributesCount:0};if(J.fiber.currentSpan)C.traceId=J.fiber.currentSpan.traceId,C.spanId=J.fiber.currentSpan.spanId;return C},$X=(J)=>{switch(J){case"Trace":return A.SEVERITY_NUMBER_TRACE;case"Debug":return A.SEVERITY_NUMBER_DEBUG;case"Info":return A.SEVERITY_NUMBER_INFO;case"Warn":return A.SEVERITY_NUMBER_WARN;case"Error":return A.SEVERITY_NUMBER_ERROR;case"Fatal":return A.SEVERITY_NUMBER_FATAL;default:return A.SEVERITY_NUMBER_UNSPECIFIED}},A={SEVERITY_NUMBER_UNSPECIFIED:0,SEVERITY_NUMBER_TRACE:1,SEVERITY_NUMBER_TRACE2:2,SEVERITY_NUMBER_TRACE3:3,SEVERITY_NUMBER_TRACE4:4,SEVERITY_NUMBER_DEBUG:5,SEVERITY_NUMBER_DEBUG2:6,SEVERITY_NUMBER_DEBUG3:7,SEVERITY_NUMBER_DEBUG4:8,SEVERITY_NUMBER_INFO:9,SEVERITY_NUMBER_INFO2:10,SEVERITY_NUMBER_INFO3:11,SEVERITY_NUMBER_INFO4:12,SEVERITY_NUMBER_WARN:13,SEVERITY_NUMBER_WARN2:14,SEVERITY_NUMBER_WARN3:15,SEVERITY_NUMBER_WARN4:16,SEVERITY_NUMBER_ERROR:17,SEVERITY_NUMBER_ERROR2:18,SEVERITY_NUMBER_ERROR3:19,SEVERITY_NUMBER_ERROR4:20,SEVERITY_NUMBER_FATAL:21,SEVERITY_NUMBER_FATAL2:22,SEVERITY_NUMBER_FATAL3:23,SEVERITY_NUMBER_FATAL4:24};var UQ={};u(UQ,{logger:()=>n,layer:()=>qJ,create:()=>KQ});var GX=(J)=>J==="sessionID"?"session.id":J,PQ=(J)=>Object.fromEntries(Object.entries(J??{}).filter((Q)=>Q[1]!==void 0&&Q[1]!==null).map(([Q,X])=>[GX(Q),X])),qX=(J)=>{if(Array.isArray(J))return J.map((Q)=>String(Q)).join(" ");return J===void 0?"":String(J)},i=(J,Q,X,Y)=>{let $=PQ({...Q,...Y}),G=J(X);return Object.keys($).length?I.annotateLogs(G,$):G},n=R.make((J)=>{let Q=PQ(J.fiber.getRef($J.CurrentLogAnnotations)),X=J.date.getTime();for(let[B,C]of J.fiber.getRef($J.CurrentLogSpans))Q[`logSpan.${B}`]=`${X-C}ms`;if(J.cause.reasons.length>0)Q.cause=_J.pretty(J.cause);let Y=typeof Q.service==="string"?Q.service:void 0;if(Y)delete Q.service;let $=Y?GJ.create({service:Y}):GJ.Default,G=qX(J.message);switch(J.logLevel){case"Trace":case"Debug":return $.debug(G,Q);case"Warn":return $.warn(G,Q);case"Error":case"Fatal":return $.error(G,Q);default:return $.info(G,Q)}}),qJ=R.layer([n],{mergeWithExisting:!1}),KQ=(J={})=>({debug:(Q,X)=>i((Y)=>I.logDebug(Y),J,Q,X),info:(Q,X)=>i((Y)=>I.logInfo(Y),J,Q,X),warn:(Q,X)=>i((Y)=>I.logWarning(Y),J,Q,X),error:(Q,X)=>i((Y)=>I.logError(Y),J,Q,X),with:(Q)=>KQ({...J,...Q})});var a=x.OTEL_EXPORTER_OTLP_ENDPOINT,OQ=!!a,BX=crypto.randomUUID(),TQ=x.OTEL_EXPORTER_OTLP_HEADERS?x.OTEL_EXPORTER_OTLP_HEADERS.split(",").reduce((J,Q)=>{let[X,...Y]=Q.split("=");return J[X]=Y.join("="),J},{}):void 0;function BJ(){let J=FQ("main"),Q=(()=>{let X=process.env.OTEL_RESOURCE_ATTRIBUTES;if(!X)return{};try{return Object.fromEntries(X.split(",").map((Y)=>{let $=Y.indexOf("=");if($<1)throw Error("Invalid OTEL_RESOURCE_ATTRIBUTES entry");return[decodeURIComponent(Y.slice(0,$)),decodeURIComponent(Y.slice($+1))]}))}catch{return{}}})();return{serviceName:"qitqode",serviceVersion:CQ,attributes:{...Q,"deployment.environment.name":DQ,"qitqode.client":x.QITQODE_CLIENT,"qitqode.process_role":J.processRole,"qitqode.run_id":J.runID,"service.instance.id":BX}}}function wX(){return R.layer([n,p.make({url:`${a}/v1/logs`,resource:BJ(),headers:TQ})],{mergeWithExisting:!1}).pipe(z.provide(c.layerJson),z.provide(AQ.layer))}var HX=async()=>{let J=await import("./chunk-pekm54ce.js"),Q=await import("./chunk-89q1y7tc.js"),X=await import("./chunk-g7rjtehn.js"),{AsyncLocalStorageContextManager:Y}=await import("./chunk-srh4xvsj.js").then((m)=>zQ(m.default,1)),{context:$}=await import("./chunk-730a2d1k.js").then((m)=>zQ(m.default,1)),G=new Y;return G.enable(),$.setGlobalContextManager(G),J.layer(()=>({resource:BJ(),spanProcessor:new X.BatchSpanProcessor(new Q.OTLPTraceExporter({url:`${a}/v1/traces`,headers:TQ}))}))},EQ=!a?qJ:z.unwrap(I.gen(function*(){let J=yield*I.promise(HX);return z.mergeAll(J,wX())})),WX={enabled:OQ,layer:EQ};var aX=z.makeMemoMapUnsafe();
|
|
3
|
-
export{qJ as
|
|
2
|
+
import{$q as uJ,Sq as mJ,Tq as vJ,Uq as dJ,Vq as lJ,Yq as d,Zq as l,ar as cJ,dr as pJ,er as iJ,fr as nJ,gr as aJ,hr as rJ,jr as AQ}from"./chunk-d6ry9418.js";import{Rs as x,Vr as CQ,Wr as DQ,_s as GJ,ys as FQ}from"./chunk-m5m448mg.js";import{AC as IJ,DC as PJ,DG as kJ,DI as gJ,EE as ZJ,GC as T,HG as LJ,IF as TJ,JA as tJ,JC as KJ,KG as SJ,OE as z,OG as xJ,OK as j,PD as qQ,PF as EJ,SG as fJ,TF as MJ,UE as b,WD as _J,WE as CJ,WF as oJ,YB as GQ,_F as RJ,aG as VJ,bH as E,dG as hJ,dL as o,eF as DJ,fF as FJ,gF as AJ,gH as yJ,hH as bJ,iO as g,jE as BQ,jO as eJ,kE as wQ,mC as $Q,mG as jJ,mO as HQ,nB as wJ,nE as $J,nO as WQ,oE as UJ,oO as R,pH as I,qB as HJ,sF as t,sG as NJ,tB as WJ,tE as zJ,tF as OJ,uC as f,vF as y}from"./chunk-zs8kqdsf.js";import{BO as zQ,DO as u,FO as S}from"./chunk-7xm75w1e.js";var IX={};u(IX,{resource:()=>BJ,layer:()=>EQ,enabled:()=>OQ,Observability:()=>WX});var p={};u(p,{make:()=>IQ,layer:()=>ZX});var VQ=AJ.pipe(FJ,DJ((J)=>{if(lJ(J)&&J.reason._tag==="StatusCodeError"&&J.reason.response.status===429){let Q=HJ(J.reason.response.headers["retry-after"]).pipe(WJ(CJ),wJ(()=>5));return t(T(Q))}return t(T(1))})),sJ=E(function*(J){let Q=yield*jJ(),X=f(Q,b),Y=f(Q,UJ),$=fJ(Q),G=KJ(IJ(J.exportInterval),PJ),B=void 0,C=nJ(f(Q,pJ)).pipe(iJ(NJ(rJ,!1)),aJ({schedule:VQ,times:3})),V=vJ({"user-agent":`effect-opentelemetry-${J.label}/0.0.0`});if(J.headers)V=dJ(mJ(J.headers),V);let r=uJ(J.url,{headers:V}),O=[],s=OJ(()=>{if(B!==void 0&&X.currentTimeMillisUnsafe()<B)return y;else if(B!==void 0)B=void 0;let h=O;if(J.maxBatchSize!=="disabled"){if(O.length===0)return y;O=[]}return C.execute(cJ(r,J.body(h))).pipe(EJ,SJ(!1))}).pipe(MJ((h)=>{if(B!==void 0)return y;return B=X.currentTimeMillisUnsafe()+60000,O=[],yJ("Disabling exporter for 60 seconds",h)}),bJ({package:"@effect/opentelemetry",module:J.label}));return yield*zJ(Y,s.pipe(RJ,kJ,VJ(J.shutdownTimeout))),yield*hJ(G).pipe(TJ(s),LJ,xJ(Y)),{push(h){if(B!==void 0)return;if(O.push(h),J.maxBatchSize!=="disabled"&&O.length>=J.maxBatchSize)gJ($(s),Y)}}});var jQ=(J)=>{let Q=J.attributes?e(Object.entries(J.attributes)):[];if(Q.push({key:"service.name",value:{stringValue:J.serviceName}}),J.serviceVersion)Q.push({key:"service.version",value:{stringValue:J.serviceVersion}});return{attributes:Q,droppedAttributesCount:0}},JQ=E(function*(J){let Q={...yield*g(o(eJ(j,j)),"OTEL_RESOURCE_ATTRIBUTES"),...J?.attributes},X=J?.serviceName??Q["service.name"]??(yield*g(j,"OTEL_SERVICE_NAME"));delete Q["service.name"];let Y=J?.serviceVersion??Q["service.version"]??(yield*g(o(j),"OTEL_SERVICE_VERSION"));return delete Q["service.version"],jQ({serviceName:X,serviceVersion:Y,attributes:Q})},oJ),QQ=(J)=>{let Q=J.attributes.find((X)=>X.key==="service.name");if(!Q||!Q.value.stringValue)throw Error("Resource does not contain a service name");return Q.value.stringValue},e=(J)=>{let Q=[];for(let[X,Y]of J)Q.push({key:X,value:m(Y)});return Q},m=(J)=>{if(Array.isArray(J))return{arrayValue:{values:J.map(m)}};switch(typeof J){case"string":return{stringValue:J};case"bigint":return{intValue:Number(J)};case"number":return Number.isInteger(J)?{intValue:J}:{doubleValue:J};case"boolean":return{boolValue:J};default:return{stringValue:tJ(J)}}};var c={};u(c,{layerProtobuf:()=>YX,layerJson:()=>XX,OtlpSerialization:()=>M});var N={Varint:0,Fixed64:1,LengthDelimited:2,Fixed32:5},k=(J,Q)=>J<<3|Q,D=(J)=>{let Q=[],X=typeof J==="bigint"?J:BigInt(J);while(X>0x7fn)Q.push(Number(X&0x7fn)|128),X>>=7n;return Q.push(Number(X)),new Uint8Array(Q)};var kQ=(J)=>{let Q=new Uint8Array(8);return new DataView(Q.buffer).setBigUint64(0,J,!0),Q},LQ=(J)=>{let Q=new Uint8Array(4);return new DataView(Q.buffer).setUint32(0,J,!0),Q},SQ=(J)=>{let Q=new Uint8Array(8);return new DataView(Q.buffer).setFloat64(0,J,!0),Q},xQ=(J)=>new TextEncoder().encode(J),fQ=(J)=>{let Q=new Uint8Array(J.length/2);for(let X=0;X<J.length;X+=2)Q[X/2]=parseInt(J.slice(X,X+2),16);return Q},Z=(...J)=>{let Q=J.reduce(($,G)=>$+G.length,0),X=new Uint8Array(Q),Y=0;for(let $ of J)X.set($,Y),Y+=$.length;return X},q=(J,Q)=>Z(D(k(J,N.Varint)),D(Q));var JJ=(J,Q)=>q(J,Q?1:0),W=(J,Q)=>Z(D(k(J,N.Fixed64)),kQ(Q)),v=(J,Q)=>Z(D(k(J,N.Fixed32)),LQ(Q)),F=(J,Q)=>Z(D(k(J,N.Fixed64)),SQ(Q)),L=(J,Q)=>Z(D(k(J,N.LengthDelimited)),D(Q.length),Q),K=(J,Q)=>L(J,xQ(Q)),U=(J,Q)=>L(J,fQ(Q)),w=(J,Q)=>L(J,Q),_=(J,Q,X)=>Z(...Q.map((Y)=>w(J,X(Y))));var H=(J,Q)=>Q!==void 0&&Q!==""?K(J,Q):new Uint8Array(0);var QJ=(J)=>{if(J.stringValue!==void 0&&J.stringValue!==null)return K(1,J.stringValue);if(J.boolValue!==void 0&&J.boolValue!==null)return JJ(2,J.boolValue);if(J.intValue!==void 0&&J.intValue!==null)return q(3,BigInt(J.intValue));if(J.doubleValue!==void 0&&J.doubleValue!==null)return F(4,J.doubleValue);if(J.arrayValue!==void 0)return w(5,bQ(J.arrayValue));if(J.kvlistValue!==void 0)return w(6,gQ(J.kvlistValue));if(J.bytesValue!==void 0)return L(7,J.bytesValue);return new Uint8Array(0)},bQ=(J)=>_(1,J.values,QJ),gQ=(J)=>_(1,J.values,P),P=(J)=>Z(K(1,J.key),w(2,QJ(J.value))),XJ=(J)=>Z(K(1,J.name),H(2,J.version),J.attributes?_(3,J.attributes,P):new Uint8Array(0),J.droppedAttributesCount?q(4,J.droppedAttributesCount):new Uint8Array(0)),YJ=(J)=>Z(_(1,J.attributes,P),J.droppedAttributesCount>0?q(2,J.droppedAttributesCount):new Uint8Array(0));var mQ=(J)=>Z(H(2,J.message),q(3,J.code)),vQ=(J)=>Z(W(1,BigInt(J.timeUnixNano)),K(2,J.name),_(3,J.attributes,P),J.droppedAttributesCount>0?q(4,J.droppedAttributesCount):new Uint8Array(0)),dQ=(J)=>Z(U(1,J.traceId),U(2,J.spanId),H(3,J.traceState),_(4,J.attributes,P),J.droppedAttributesCount>0?q(5,J.droppedAttributesCount):new Uint8Array(0),J.flags!==void 0?v(6,J.flags):new Uint8Array(0)),lQ=(J)=>Z(U(1,J.traceId),U(2,J.spanId),H(3,J.traceState),J.parentSpanId!==void 0?U(4,J.parentSpanId):new Uint8Array(0),K(5,J.name),q(6,J.kind),W(7,BigInt(J.startTimeUnixNano)),W(8,BigInt(J.endTimeUnixNano)),_(9,J.attributes,P),J.droppedAttributesCount>0?q(10,J.droppedAttributesCount):new Uint8Array(0),_(11,J.events,vQ),J.droppedEventsCount>0?q(12,J.droppedEventsCount):new Uint8Array(0),_(13,J.links,dQ),J.droppedLinksCount>0?q(14,J.droppedLinksCount):new Uint8Array(0),w(15,mQ(J.status)),J.flags!==void 0?v(16,J.flags):new Uint8Array(0)),uQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.spans,lQ),H(3,J.schemaUrl)),cQ=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeSpans,uQ),H(3,J.schemaUrl)),XQ=(J)=>_(1,J.resourceSpans,cQ);var YQ=(J)=>Z(W(2,BigInt(J.startTimeUnixNano)),W(3,BigInt(J.timeUnixNano)),J.asDouble!==void 0?F(4,J.asDouble):new Uint8Array(0),J.asInt!==void 0?W(6,BigInt(J.asInt)):new Uint8Array(0),_(7,J.attributes,P),J.flags!==void 0?q(8,J.flags):new Uint8Array(0)),pQ=(J)=>{let Q=Z(...J.bucketCounts.map((Y)=>W(6,BigInt(Y)))),X=Z(...J.explicitBounds.map((Y)=>F(7,Y)));return Z(W(2,BigInt(J.startTimeUnixNano)),W(3,BigInt(J.timeUnixNano)),W(4,BigInt(J.count)),J.sum!==void 0?F(5,J.sum):new Uint8Array(0),Q,X,_(9,J.attributes,P),J.flags!==void 0?q(10,J.flags):new Uint8Array(0),J.min!==void 0?F(11,J.min):new Uint8Array(0),J.max!==void 0?F(12,J.max):new Uint8Array(0))},iQ=(J)=>_(1,J.dataPoints,YQ),nQ=(J)=>Z(_(1,J.dataPoints,YQ),q(2,J.aggregationTemporality),JJ(3,J.isMonotonic)),aQ=(J)=>Z(_(1,J.dataPoints,pQ),q(2,J.aggregationTemporality)),rQ=(J)=>Z(K(1,J.name),H(2,J.description),H(3,J.unit),J.gauge!==void 0?w(5,iQ(J.gauge)):new Uint8Array(0),J.sum!==void 0?w(7,nQ(J.sum)):new Uint8Array(0),J.histogram!==void 0?w(9,aQ(J.histogram)):new Uint8Array(0)),sQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.metrics,rQ),H(3,J.schemaUrl)),tQ=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeMetrics,sQ),H(3,J.schemaUrl)),ZQ=(J)=>_(1,J.resourceMetrics,tQ);var oQ=(J)=>Z(W(1,BigInt(J.timeUnixNano)),J.severityNumber!==void 0?q(2,J.severityNumber):new Uint8Array(0),H(3,J.severityText),J.body!==void 0?w(5,QJ(J.body)):new Uint8Array(0),_(6,J.attributes,P),J.droppedAttributesCount!==void 0&&J.droppedAttributesCount>0?q(7,J.droppedAttributesCount):new Uint8Array(0),J.flags!==void 0?v(8,J.flags):new Uint8Array(0),J.traceId!==void 0&&J.traceId!==""?U(9,J.traceId):new Uint8Array(0),J.spanId!==void 0&&J.spanId!==""?U(10,J.spanId):new Uint8Array(0),J.observedTimeUnixNano!==void 0?W(11,BigInt(J.observedTimeUnixNano)):new Uint8Array(0)),eQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.logRecords,oQ),H(3,J.schemaUrl)),JX=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeLogs,eQ),H(3,J.schemaUrl)),_Q=(J)=>_(1,J.resourceLogs,JX);class M extends $Q()("effect/observability/OtlpSerialization"){}var XX=ZJ(M,{traces:(J)=>l(J),metrics:(J)=>l(J),logs:(J)=>l(J)}),YX=ZJ(M,{traces:(J)=>d(XQ(J),"application/x-protobuf"),metrics:(J)=>d(ZQ(J),"application/x-protobuf"),logs:(J)=>d(_Q(J),"application/x-protobuf")});var IQ=E(function*(J){let Q=yield*M,X=yield*JQ(J.resource),Y={name:QQ(X)},$=yield*sJ({label:"OtlpLogger",url:J.url,headers:J.headers,maxBatchSize:J.maxBatchSize??1000,exportInterval:J.exportInterval??T(1),body:(B)=>Q.logs({resourceLogs:[{resource:X,scopeLogs:[{scope:Y,logRecords:B}]}]}),shutdownTimeout:J.shutdownTimeout??T(3)}),G={excludeLogSpans:J.excludeLogSpans??!1,clock:yield*b};return HQ((B)=>{$.push(_X(B,G))})}),ZX=(J)=>WQ([IQ(J)],{mergeWithExisting:J.mergeWithExisting??!0}),_X=(J,Q)=>{let Y=Q.clock.currentTimeNanosUnsafe().toString(),$=J.date.getTime(),G=e(Object.entries(J.fiber.getRef(BQ)));if(G.push({key:"fiberId",value:{intValue:J.fiber.id}}),!Q.excludeLogSpans)for(let[V,r]of J.fiber.getRef(wQ))G.push({key:`logSpan.${V}`,value:{stringValue:`${$-r}ms`}});if(J.cause.reasons.length>0)G.push({key:"log.error",value:{stringValue:qQ(J.cause)}});let B=GQ(J.message),C={severityNumber:$X(J.logLevel),severityText:J.logLevel,timeUnixNano:Y,observedTimeUnixNano:Y,attributes:G,body:m(B.length===1?B[0]:B),droppedAttributesCount:0};if(J.fiber.currentSpan)C.traceId=J.fiber.currentSpan.traceId,C.spanId=J.fiber.currentSpan.spanId;return C},$X=(J)=>{switch(J){case"Trace":return A.SEVERITY_NUMBER_TRACE;case"Debug":return A.SEVERITY_NUMBER_DEBUG;case"Info":return A.SEVERITY_NUMBER_INFO;case"Warn":return A.SEVERITY_NUMBER_WARN;case"Error":return A.SEVERITY_NUMBER_ERROR;case"Fatal":return A.SEVERITY_NUMBER_FATAL;default:return A.SEVERITY_NUMBER_UNSPECIFIED}},A={SEVERITY_NUMBER_UNSPECIFIED:0,SEVERITY_NUMBER_TRACE:1,SEVERITY_NUMBER_TRACE2:2,SEVERITY_NUMBER_TRACE3:3,SEVERITY_NUMBER_TRACE4:4,SEVERITY_NUMBER_DEBUG:5,SEVERITY_NUMBER_DEBUG2:6,SEVERITY_NUMBER_DEBUG3:7,SEVERITY_NUMBER_DEBUG4:8,SEVERITY_NUMBER_INFO:9,SEVERITY_NUMBER_INFO2:10,SEVERITY_NUMBER_INFO3:11,SEVERITY_NUMBER_INFO4:12,SEVERITY_NUMBER_WARN:13,SEVERITY_NUMBER_WARN2:14,SEVERITY_NUMBER_WARN3:15,SEVERITY_NUMBER_WARN4:16,SEVERITY_NUMBER_ERROR:17,SEVERITY_NUMBER_ERROR2:18,SEVERITY_NUMBER_ERROR3:19,SEVERITY_NUMBER_ERROR4:20,SEVERITY_NUMBER_FATAL:21,SEVERITY_NUMBER_FATAL2:22,SEVERITY_NUMBER_FATAL3:23,SEVERITY_NUMBER_FATAL4:24};var UQ={};u(UQ,{logger:()=>n,layer:()=>qJ,create:()=>KQ});var GX=(J)=>J==="sessionID"?"session.id":J,PQ=(J)=>Object.fromEntries(Object.entries(J??{}).filter((Q)=>Q[1]!==void 0&&Q[1]!==null).map(([Q,X])=>[GX(Q),X])),qX=(J)=>{if(Array.isArray(J))return J.map((Q)=>String(Q)).join(" ");return J===void 0?"":String(J)},i=(J,Q,X,Y)=>{let $=PQ({...Q,...Y}),G=J(X);return Object.keys($).length?I.annotateLogs(G,$):G},n=R.make((J)=>{let Q=PQ(J.fiber.getRef($J.CurrentLogAnnotations)),X=J.date.getTime();for(let[B,C]of J.fiber.getRef($J.CurrentLogSpans))Q[`logSpan.${B}`]=`${X-C}ms`;if(J.cause.reasons.length>0)Q.cause=_J.pretty(J.cause);let Y=typeof Q.service==="string"?Q.service:void 0;if(Y)delete Q.service;let $=Y?GJ.create({service:Y}):GJ.Default,G=qX(J.message);switch(J.logLevel){case"Trace":case"Debug":return $.debug(G,Q);case"Warn":return $.warn(G,Q);case"Error":case"Fatal":return $.error(G,Q);default:return $.info(G,Q)}}),qJ=R.layer([n],{mergeWithExisting:!1}),KQ=(J={})=>({debug:(Q,X)=>i((Y)=>I.logDebug(Y),J,Q,X),info:(Q,X)=>i((Y)=>I.logInfo(Y),J,Q,X),warn:(Q,X)=>i((Y)=>I.logWarning(Y),J,Q,X),error:(Q,X)=>i((Y)=>I.logError(Y),J,Q,X),with:(Q)=>KQ({...J,...Q})});var a=x.OTEL_EXPORTER_OTLP_ENDPOINT,OQ=!!a,BX=crypto.randomUUID(),TQ=x.OTEL_EXPORTER_OTLP_HEADERS?x.OTEL_EXPORTER_OTLP_HEADERS.split(",").reduce((J,Q)=>{let[X,...Y]=Q.split("=");return J[X]=Y.join("="),J},{}):void 0;function BJ(){let J=FQ("main"),Q=(()=>{let X=process.env.OTEL_RESOURCE_ATTRIBUTES;if(!X)return{};try{return Object.fromEntries(X.split(",").map((Y)=>{let $=Y.indexOf("=");if($<1)throw Error("Invalid OTEL_RESOURCE_ATTRIBUTES entry");return[decodeURIComponent(Y.slice(0,$)),decodeURIComponent(Y.slice($+1))]}))}catch{return{}}})();return{serviceName:"qitqode",serviceVersion:CQ,attributes:{...Q,"deployment.environment.name":DQ,"qitqode.client":x.QITQODE_CLIENT,"qitqode.process_role":J.processRole,"qitqode.run_id":J.runID,"service.instance.id":BX}}}function wX(){return R.layer([n,p.make({url:`${a}/v1/logs`,resource:BJ(),headers:TQ})],{mergeWithExisting:!1}).pipe(z.provide(c.layerJson),z.provide(AQ.layer))}var HX=async()=>{let J=await import("./chunk-cfgvm15x.js"),Q=await import("./chunk-qc8rsn4v.js"),X=await import("./chunk-78ymd20x.js"),{AsyncLocalStorageContextManager:Y}=await import("./chunk-1gx18dm5.js").then((m)=>zQ(m.default,1)),{context:$}=await import("./chunk-1wbjh23g.js").then((m)=>zQ(m.default,1)),G=new Y;return G.enable(),$.setGlobalContextManager(G),J.layer(()=>({resource:BJ(),spanProcessor:new X.BatchSpanProcessor(new Q.OTLPTraceExporter({url:`${a}/v1/traces`,headers:TQ}))}))},EQ=!a?qJ:z.unwrap(I.gen(function*(){let J=yield*I.promise(HX);return z.mergeAll(J,wX())})),WX={enabled:OQ,layer:EQ};var aX=z.makeMemoMapUnsafe();
|
|
3
|
+
export{qJ as Mq,UQ as Nq,EQ as Oq,WX as Pq,IX as Qq,aX as Rq};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fq as CG,Mq as bG,Sq as D,Vq as J,Wq as GG,ar as LG,br as WG,fr as d,gr as i,hr as jG,ir as TG,jr as OG,kr as kG,pq as wG,qq as NG,uq as MG,wq as JG}from"./chunk-yq3m8190.js";import{Dr as HG,rr as BG}from"./chunk-btz9jvec.js";import{qv as G}from"./chunk-09kba1hg.js";var iG=D(()=>J(G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}))),EG=TG({errorSchema:iG,errorToMessage:(Q)=>Q.error.message}),lG=D(()=>J(G.object({type:G.literal("message"),id:G.string().nullish(),model:G.string().nullish(),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string(),citations:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])).optional()}),G.object({type:G.literal("thinking"),thinking:G.string(),signature:G.string()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])),stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish(),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}))),sG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("message_start"),message:G.object({id:G.string().nullish(),model:G.string().nullish(),role:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish()}),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()})])).nullish(),stop_reason:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string()}).nullish()})}),G.object({type:G.literal("content_block_start"),index:G.number(),content_block:G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string()}),G.object({type:G.literal("thinking"),thinking:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).optional(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string().nullish()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])}),G.object({type:G.literal("content_block_delta"),index:G.number(),delta:G.discriminatedUnion("type",[G.object({type:G.literal("input_json_delta"),partial_json:G.string()}),G.object({type:G.literal("text_delta"),text:G.string()}),G.object({type:G.literal("thinking_delta"),thinking:G.string()}),G.object({type:G.literal("signature_delta"),signature:G.string()}),G.object({type:G.literal("compaction_delta"),content:G.string().nullish()}),G.object({type:G.literal("citations_delta"),citation:G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])})])}),G.object({type:G.literal("content_block_stop"),index:G.number()}),G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}),G.object({type:G.literal("message_delta"),delta:G.object({stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish()}),usage:G.looseObject({input_tokens:G.number().nullish(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}),G.object({type:G.literal("message_stop")}),G.object({type:G.literal("ping")})]))),pG=D(()=>J(G.object({signature:G.string().optional(),redactedData:G.string().optional()}))),SG=G.object({citations:G.object({enabled:G.boolean()}).optional(),title:G.string().optional(),context:G.string().optional()}),yG=G.object({sendReasoning:G.boolean().optional(),structuredOutputMode:G.enum(["outputFormat","jsonTool","auto"]).optional(),thinking:G.discriminatedUnion("type",[G.object({type:G.literal("adaptive"),display:G.enum(["omitted","summarized"]).optional()}),G.object({type:G.literal("enabled"),budgetTokens:G.number().optional()}),G.object({type:G.literal("disabled")})]).optional(),disableParallelToolUse:G.boolean().optional(),cacheControl:G.object({type:G.literal("ephemeral"),ttl:G.union([G.literal("5m"),G.literal("1h")]).optional()}).optional(),metadata:G.object({userId:G.string().optional()}).optional(),mcpServers:G.array(G.object({type:G.literal("url"),name:G.string(),url:G.string(),authorizationToken:G.string().nullish(),toolConfiguration:G.object({enabled:G.boolean().nullish(),allowedTools:G.array(G.string()).nullish()}).nullish()})).optional(),container:G.object({id:G.string().optional(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skillId:G.string(),version:G.string().optional()})).optional()}).optional(),toolStreaming:G.boolean().optional(),effort:G.enum(["low","medium","high","xhigh","max"]).optional(),taskBudget:G.object({type:G.literal("tokens"),total:G.number().int().min(20000),remaining:G.number().int().min(0).optional()}).optional(),speed:G.enum(["fast","standard"]).optional(),inferenceGeo:G.enum(["us","global"]).optional(),anthropicBeta:G.array(G.string()).optional(),contextManagement:G.object({edits:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("clear_tool_uses_20250919"),trigger:G.discriminatedUnion("type",[G.object({type:G.literal("input_tokens"),value:G.number()}),G.object({type:G.literal("tool_uses"),value:G.number()})]).optional(),keep:G.object({type:G.literal("tool_uses"),value:G.number()}).optional(),clearAtLeast:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),clearToolInputs:G.boolean().optional(),excludeTools:G.array(G.string()).optional()}),G.object({type:G.literal("clear_thinking_20251015"),keep:G.union([G.literal("all"),G.object({type:G.literal("thinking_turns"),value:G.number()})]).optional()}),G.object({type:G.literal("compact_20260112"),trigger:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),pauseAfterCompaction:G.boolean().optional(),instructions:G.string().optional()})]))}).optional()}),FG=4;function nG(Q){var H;let Z=Q==null?void 0:Q.anthropic;return(H=Z==null?void 0:Z.cacheControl)!=null?H:Z==null?void 0:Z.cache_control}var VG=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(Q,H){let Z=nG(Q);if(!Z)return;if(!H.canCache){this.warnings.push({type:"unsupported",feature:"cache_control on non-cacheable context",details:`cache_control cannot be set on ${H.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>FG){this.warnings.push({type:"unsupported",feature:"cacheControl breakpoint limit",details:`Maximum ${FG} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return Z}getWarnings(){return this.warnings}},rG=D(()=>J(G.object({maxCharacters:G.number().optional()}))),aG=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),eG=d({id:"anthropic.text_editor_20250728",inputSchema:aG}),oG=(Q={})=>{return eG(Q)},tG=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),GQ=D(()=>J(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),QQ=D(()=>J(G.object({query:G.string()}))),XQ=i({id:"anthropic.web_search_20260209",inputSchema:QQ,outputSchema:GQ,supportsDeferredResults:!0}),YQ=(Q={})=>{return XQ(Q)},ZQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),vG=D(()=>J(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),$Q=D(()=>J(G.object({query:G.string()}))),zQ=i({id:"anthropic.web_search_20250305",inputSchema:$Q,outputSchema:vG,supportsDeferredResults:!0}),LQ=(Q={})=>{return zQ(Q)},HQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),AQ=D(()=>J(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),qQ=D(()=>J(G.object({url:G.string()}))),KQ=i({id:"anthropic.web_fetch_20260209",inputSchema:qQ,outputSchema:AQ,supportsDeferredResults:!0}),DQ=(Q={})=>{return KQ(Q)},JQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),_G=D(()=>J(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),WQ=D(()=>J(G.object({url:G.string()}))),jQ=i({id:"anthropic.web_fetch_20250910",inputSchema:WQ,outputSchema:_G,supportsDeferredResults:!0}),VQ=(Q={})=>{return jQ(Q)};async function UQ({tools:Q,toolChoice:H,disableParallelToolUse:Z,cacheControlValidator:W,supportsStructuredOutput:f,supportsStrictTools:h,defaultEagerInputStreaming:_=!1}){var b,l;Q=(Q==null?void 0:Q.length)?Q:void 0;let M=[],B=new Set,u=W||new VG;if(Q==null)return{tools:void 0,toolChoice:void 0,toolWarnings:M,betas:B};let R=[];for(let E of Q)switch(E.type){case"function":{let P=u.getCacheControl(E.providerOptions,{type:"tool definition",canCache:!0}),v=(b=E.providerOptions)==null?void 0:b.anthropic,g=(l=v==null?void 0:v.eagerInputStreaming)!=null?l:_,C=v==null?void 0:v.deferLoading,e=v==null?void 0:v.allowedCallers;if(!h&&E.strict!=null)M.push({type:"unsupported",feature:"strict",details:`Tool '${E.name}' has strict: ${E.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`});if(R.push({name:E.name,description:E.description,input_schema:E.inputSchema,cache_control:P,...g?{eager_input_streaming:!0}:{},...h===!0&&E.strict!=null?{strict:E.strict}:{},...C!=null?{defer_loading:C}:{},...e!=null?{allowed_callers:e}:{},...E.inputExamples!=null?{input_examples:E.inputExamples.map((N)=>N.input)}:{}}),f===!0)B.add("structured-outputs-2025-11-13");if(E.inputExamples!=null||e!=null)B.add("advanced-tool-use-2025-11-20");break}case"provider":{switch(E.id){case"anthropic.code_execution_20250522":{B.add("code-execution-2025-05-22"),R.push({type:"code_execution_20250522",name:"code_execution",cache_control:void 0});break}case"anthropic.code_execution_20250825":{B.add("code-execution-2025-08-25"),R.push({type:"code_execution_20250825",name:"code_execution"});break}case"anthropic.code_execution_20260120":{R.push({type:"code_execution_20260120",name:"code_execution"});break}case"anthropic.computer_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"computer",type:"computer_20250124",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,cache_control:void 0});break}case"anthropic.computer_20251124":{B.add("computer-use-2025-11-24"),R.push({name:"computer",type:"computer_20251124",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,enable_zoom:E.args.enableZoom,cache_control:void 0});break}case"anthropic.computer_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"computer",type:"computer_20241022",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,cache_control:void 0});break}case"anthropic.text_editor_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"str_replace_editor",type:"text_editor_20250124",cache_control:void 0});break}case"anthropic.text_editor_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"str_replace_editor",type:"text_editor_20241022",cache_control:void 0});break}case"anthropic.text_editor_20250429":{B.add("computer-use-2025-01-24"),R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250429",cache_control:void 0});break}case"anthropic.text_editor_20250728":{let P=await GG({value:E.args,schema:rG});R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:P.maxCharacters,cache_control:void 0});break}case"anthropic.bash_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"bash",type:"bash_20250124",cache_control:void 0});break}case"anthropic.bash_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"bash",type:"bash_20241022",cache_control:void 0});break}case"anthropic.memory_20250818":{B.add("context-management-2025-06-27"),R.push({name:"memory",type:"memory_20250818"});break}case"anthropic.web_fetch_20250910":{B.add("web-fetch-2025-09-10");let P=await GG({value:E.args,schema:JQ});R.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,citations:P.citations,max_content_tokens:P.maxContentTokens,cache_control:void 0});break}case"anthropic.web_fetch_20260209":{B.add("code-execution-web-tools-2026-02-09");let P=await GG({value:E.args,schema:HQ});R.push({type:"web_fetch_20260209",name:"web_fetch",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,citations:P.citations,max_content_tokens:P.maxContentTokens,cache_control:void 0});break}case"anthropic.web_search_20250305":{let P=await GG({value:E.args,schema:ZQ});R.push({type:"web_search_20250305",name:"web_search",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,user_location:P.userLocation,cache_control:void 0});break}case"anthropic.web_search_20260209":{B.add("code-execution-web-tools-2026-02-09");let P=await GG({value:E.args,schema:tG});R.push({type:"web_search_20260209",name:"web_search",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,user_location:P.userLocation,cache_control:void 0});break}case"anthropic.tool_search_regex_20251119":{R.push({type:"tool_search_tool_regex_20251119",name:"tool_search_tool_regex"});break}case"anthropic.tool_search_bm25_20251119":{R.push({type:"tool_search_tool_bm25_20251119",name:"tool_search_tool_bm25"});break}default:{M.push({type:"unsupported",feature:`provider-defined tool ${E.id}`});break}}break}default:{M.push({type:"unsupported",feature:`tool ${E}`});break}}if(H==null)return{tools:R,toolChoice:Z?{type:"auto",disable_parallel_tool_use:Z}:void 0,toolWarnings:M,betas:B};let a=H.type;switch(a){case"auto":return{tools:R,toolChoice:{type:"auto",disable_parallel_tool_use:Z},toolWarnings:M,betas:B};case"required":return{tools:R,toolChoice:{type:"any",disable_parallel_tool_use:Z},toolWarnings:M,betas:B};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:M,betas:B};case"tool":return{tools:R,toolChoice:{type:"tool",name:H.toolName,disable_parallel_tool_use:Z},toolWarnings:M,betas:B};default:throw new HG({functionality:`tool choice type: ${a}`})}}function IG({usage:Q,rawUsage:H}){var Z,W;let f=(Z=Q.cache_creation_input_tokens)!=null?Z:0,h=(W=Q.cache_read_input_tokens)!=null?W:0,_,b;if(Q.iterations&&Q.iterations.length>0){let l=Q.iterations.reduce((M,B)=>({input:M.input+B.input_tokens,output:M.output+B.output_tokens}),{input:0,output:0});_=l.input,b=l.output}else _=Q.input_tokens,b=Q.output_tokens;return{inputTokens:{total:_+f+h,noCache:_,cacheRead:h,cacheWrite:f},outputTokens:{total:b,text:void 0,reasoning:void 0},raw:H!=null?H:Q}}var hG=D(()=>J(G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}))),RQ=D(()=>J(G.object({code:G.string()}))),EQ=i({id:"anthropic.code_execution_20250522",inputSchema:RQ,outputSchema:hG}),SQ=(Q={})=>{return EQ(Q)},gG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),yQ=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),FQ=i({id:"anthropic.code_execution_20250825",inputSchema:yQ,outputSchema:gG,supportsDeferredResults:!0}),IQ=(Q={})=>{return FQ(Q)},mG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),fQ=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),PQ=i({id:"anthropic.code_execution_20260120",inputSchema:fQ,outputSchema:mG,supportsDeferredResults:!0}),xQ=(Q={})=>{return PQ(Q)},dG=D(()=>J(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),BQ=D(()=>J(G.object({pattern:G.string(),limit:G.number().optional()}))),wQ=i({id:"anthropic.tool_search_regex_20251119",inputSchema:BQ,outputSchema:dG,supportsDeferredResults:!0}),NQ=(Q={})=>{return wQ(Q)};function MQ(Q){if(typeof Q==="string")return new TextDecoder().decode(MG(Q));if(Q instanceof Uint8Array)return new TextDecoder().decode(Q);if(Q instanceof URL)throw new HG({functionality:"URL-based text documents are not supported for citations"});throw new HG({functionality:`unsupported data type for text documents: ${typeof Q}`})}function qG(Q){return Q instanceof URL||CQ(Q)}function CQ(Q){return typeof Q==="string"&&/^https?:\/\//i.test(Q)}function KG(Q){return Q instanceof URL?Q.toString():Q}async function bQ({prompt:Q,sendReasoning:H,warnings:Z,cacheControlValidator:W,toolNameMapping:f}){var h,_,b,l,M,B,u,R,a,E,P,v,g,C,e,N,s,QG,YG;let Y=new Set,j=TQ(Q),w=W||new VG,p=void 0,XG=[];async function zG(O){var T,V;let ZG=await LG({provider:"anthropic",providerOptions:O,schema:SG});return(V=(T=ZG==null?void 0:ZG.citations)==null?void 0:T.enabled)!=null?V:!1}async function L(O){let T=await LG({provider:"anthropic",providerOptions:O,schema:SG});return{title:T==null?void 0:T.title,context:T==null?void 0:T.context}}for(let O=0;O<j.length;O++){let T=j[O],V=O===j.length-1,ZG=T.type;switch(ZG){case"system":{if(p!=null)throw new HG({functionality:"Multiple system messages that are separated by user/assistant messages"});p=T.messages.map(({content:x,providerOptions:o})=>({type:"text",text:x,cache_control:w.getCacheControl(o,{type:"system message",canCache:!0})}));break}case"user":{let x=[];for(let o of T.messages){let{role:t,content:r}=o;switch(t){case"user":{for(let c=0;c<r.length;c++){let y=r[c],n=c===r.length-1,z=(h=w.getCacheControl(y.providerOptions,{type:"user message part",canCache:!0}))!=null?h:n?w.getCacheControl(o.providerOptions,{type:"user message",canCache:!0}):void 0;switch(y.type){case"text":{x.push({type:"text",text:y.text,cache_control:z});break}case"file":{if(y.mediaType.startsWith("image/"))x.push({type:"image",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"base64",media_type:y.mediaType==="image/*"?"image/jpeg":y.mediaType,data:JG(y.data)},cache_control:z});else if(y.mediaType==="application/pdf"){Y.add("pdfs-2024-09-25");let m=await zG(y.providerOptions),F=await L(y.providerOptions);x.push({type:"document",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"base64",media_type:"application/pdf",data:JG(y.data)},title:(_=F.title)!=null?_:y.filename,...F.context&&{context:F.context},...m&&{citations:{enabled:!0}},cache_control:z})}else if(y.mediaType==="text/plain"){let m=await zG(y.providerOptions),F=await L(y.providerOptions);x.push({type:"document",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"text",media_type:"text/plain",data:MQ(y.data)},title:(b=F.title)!=null?b:y.filename,...F.context&&{context:F.context},...m&&{citations:{enabled:!0}},cache_control:z})}else throw new HG({functionality:`media type: ${y.mediaType}`});break}}}break}case"tool":{for(let c=0;c<r.length;c++){let y=r[c];if(y.type==="tool-approval-response")continue;let n=c===r.length-1,z=(l=w.getCacheControl(y.providerOptions,{type:"tool result part",canCache:!0}))!=null?l:n?w.getCacheControl(o.providerOptions,{type:"tool result message",canCache:!0}):void 0,m=y.output,F;switch(m.type){case"content":F=m.value.map((U)=>{var K;switch(U.type){case"text":return{type:"text",text:U.text};case"image-data":return{type:"image",source:{type:"base64",media_type:U.mediaType,data:U.data}};case"image-url":return{type:"image",source:{type:"url",url:U.url}};case"file-url":return{type:"document",source:{type:"url",url:U.url}};case"file-data":{if(U.mediaType==="application/pdf")return Y.add("pdfs-2024-09-25"),{type:"document",source:{type:"base64",media_type:U.mediaType,data:U.data}};Z.push({type:"other",message:`unsupported tool content part type: ${U.type} with media type: ${U.mediaType}`});return}case"custom":{let A=(K=U.providerOptions)==null?void 0:K.anthropic;if((A==null?void 0:A.type)==="tool-reference")return{type:"tool_reference",tool_name:A.toolName};Z.push({type:"other",message:"unsupported custom tool content part"});return}default:{Z.push({type:"other",message:`unsupported tool content part type: ${U.type}`});return}}}).filter(bG);break;case"text":case"error-text":F=m.value;break;case"execution-denied":F=(M=m.reason)!=null?M:"Tool execution denied.";break;case"json":case"error-json":default:F=JSON.stringify(m.value);break}x.push({type:"tool_result",tool_use_id:y.toolCallId,content:F,is_error:m.type==="error-text"||m.type==="error-json"?!0:void 0,cache_control:z})}break}default:throw Error(`Unsupported role: ${t}`)}}XG.push({role:"user",content:x});break}case"assistant":{let x=[],o=new Set;for(let t=0;t<T.messages.length;t++){let r=T.messages[t],c=t===T.messages.length-1,{content:y}=r;for(let n=0;n<y.length;n++){let z=y[n],m=n===y.length-1,F=(B=w.getCacheControl(z.providerOptions,{type:"assistant message part",canCache:!0}))!=null?B:m?w.getCacheControl(r.providerOptions,{type:"assistant message",canCache:!0}):void 0;switch(z.type){case"text":{let U=(u=z.providerOptions)==null?void 0:u.anthropic;if((U==null?void 0:U.type)==="compaction")x.push({type:"compaction",content:z.text,cache_control:F});else x.push({type:"text",text:V&&c&&m?z.text.trim():z.text,cache_control:F});break}case"reasoning":{if(H){let U=await LG({provider:"anthropic",providerOptions:z.providerOptions,schema:pG});if(U!=null)if(U.signature!=null)w.getCacheControl(z.providerOptions,{type:"thinking block",canCache:!1}),x.push({type:"thinking",thinking:z.text,signature:U.signature});else if(U.redactedData!=null)w.getCacheControl(z.providerOptions,{type:"redacted thinking block",canCache:!1}),x.push({type:"redacted_thinking",data:U.redactedData});else Z.push({type:"other",message:"unsupported reasoning metadata"});else Z.push({type:"other",message:"unsupported reasoning metadata"})}else Z.push({type:"other",message:"sending reasoning content is disabled for this model"});break}case"tool-call":{if(z.providerExecuted){let A=f.toProviderToolName(z.toolName);if(((a=(R=z.providerOptions)==null?void 0:R.anthropic)==null?void 0:a.type)==="mcp-tool-use"){o.add(z.toolCallId);let X=(P=(E=z.providerOptions)==null?void 0:E.anthropic)==null?void 0:P.serverName;if(X==null||typeof X!=="string"){Z.push({type:"other",message:"mcp tool use server name is required and must be a string"});break}x.push({type:"mcp_tool_use",id:z.toolCallId,name:z.toolName,input:z.input,server_name:X,cache_control:F})}else if(A==="code_execution"&&z.input!=null&&typeof z.input==="object"&&"type"in z.input&&typeof z.input.type==="string"&&(z.input.type==="bash_code_execution"||z.input.type==="text_editor_code_execution"))x.push({type:"server_tool_use",id:z.toolCallId,name:z.input.type,input:z.input,cache_control:F});else if(A==="code_execution"&&z.input!=null&&typeof z.input==="object"&&"type"in z.input&&z.input.type==="programmatic-tool-call"){let{type:X,...I}=z.input;x.push({type:"server_tool_use",id:z.toolCallId,name:"code_execution",input:I,cache_control:F})}else if(A==="code_execution"||A==="web_fetch"||A==="web_search")x.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:F});else if(A==="tool_search_tool_regex"||A==="tool_search_tool_bm25")x.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:F});else Z.push({type:"other",message:`provider executed tool call for tool ${z.toolName} is not supported`});break}let U=(v=z.providerOptions)==null?void 0:v.anthropic,K=(U==null?void 0:U.caller)?(U.caller.type==="code_execution_20250825"||U.caller.type==="code_execution_20260120")&&U.caller.toolId?{type:U.caller.type,tool_id:U.caller.toolId}:U.caller.type==="direct"?{type:"direct"}:void 0:void 0;x.push({type:"tool_use",id:z.toolCallId,name:z.toolName,input:z.input,...K&&{caller:K},cache_control:F});break}case"tool-result":{let U=f.toProviderToolName(z.toolName);if(o.has(z.toolCallId)){let K=z.output;if(K.type!=="json"&&K.type!=="error-json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}x.push({type:"mcp_tool_result",tool_use_id:z.toolCallId,is_error:K.type==="error-json",content:K.value,cache_control:F})}else if(U==="code_execution"){let K=z.output;if(K.type==="error-text"||K.type==="error-json"){let A={};try{if(typeof K.value==="string")A=JSON.parse(K.value);else if(typeof K.value==="object"&&K.value!==null)A=K.value}catch($){}if(A.type==="code_execution_tool_result_error")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:"code_execution_tool_result_error",error_code:(g=A.errorCode)!=null?g:"unknown"},cache_control:F});else x.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:{type:"bash_code_execution_tool_result_error",error_code:(C=A.errorCode)!=null?C:"unknown"}});break}if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}if(K.value==null||typeof K.value!=="object"||!("type"in K.value)||typeof K.value.type!=="string"){Z.push({type:"other",message:`provider executed tool result output value is not a valid code execution result for tool ${z.toolName}`});break}if(K.value.type==="code_execution_result"){let A=await GG({value:K.value,schema:hG});x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,stdout:A.stdout,stderr:A.stderr,return_code:A.return_code,content:(e=A.content)!=null?e:[]},cache_control:F})}else if(K.value.type==="encrypted_code_execution_result"){let A=await GG({value:K.value,schema:mG});if(A.type==="encrypted_code_execution_result")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,encrypted_stdout:A.encrypted_stdout,stderr:A.stderr,return_code:A.return_code,content:(N=A.content)!=null?N:[]},cache_control:F})}else{let A=await GG({value:K.value,schema:gG});if(A.type==="code_execution_result")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,stdout:A.stdout,stderr:A.stderr,return_code:A.return_code,content:(s=A.content)!=null?s:[]},cache_control:F});else if(A.type==="bash_code_execution_result"||A.type==="bash_code_execution_tool_result_error")x.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:A});else x.push({type:"text_editor_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:A})}break}if(U==="web_fetch"){let K=z.output;if(K.type==="error-json"){let $={};try{if(typeof K.value==="string")$=JSON.parse(K.value);else if(typeof K.value==="object"&&K.value!==null)$=K.value}catch(X){let I=(QG=K.value)==null?void 0:QG.errorCode;$={errorCode:typeof I==="string"?I:"unavailable"}}x.push({type:"web_fetch_tool_result",tool_use_id:z.toolCallId,content:{type:"web_fetch_tool_result_error",error_code:(YG=$.errorCode)!=null?YG:"unavailable"},cache_control:F});break}if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:K.value,schema:_G});x.push({type:"web_fetch_tool_result",tool_use_id:z.toolCallId,content:{type:"web_fetch_result",url:A.url,retrieved_at:A.retrievedAt,content:{type:"document",title:A.content.title,citations:A.content.citations,source:{type:A.content.source.type,media_type:A.content.source.mediaType,data:A.content.source.data}}},cache_control:F});break}if(U==="web_search"){let K=z.output;if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:K.value,schema:vG});x.push({type:"web_search_tool_result",tool_use_id:z.toolCallId,content:A.map(($)=>({url:$.url,title:$.title,page_age:$.pageAge,encrypted_content:$.encryptedContent,type:$.type})),cache_control:F});break}if(U==="tool_search_tool_regex"||U==="tool_search_tool_bm25"){let K=z.output;if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let $=(await GG({value:K.value,schema:dG})).map((X)=>({type:"tool_reference",tool_name:X.toolName}));x.push({type:"tool_search_tool_result",tool_use_id:z.toolCallId,content:{type:"tool_search_tool_search_result",tool_references:$},cache_control:F});break}Z.push({type:"other",message:`provider executed tool result for tool ${z.toolName} is not supported`});break}}}}XG.push({role:"assistant",content:x});break}default:throw Error(`content type: ${ZG}`)}}return{prompt:{system:p,messages:XG},betas:Y}}function TQ(Q){let H=[],Z=void 0;for(let W of Q){let{role:f}=W;switch(f){case"system":{if((Z==null?void 0:Z.type)!=="system")Z={type:"system",messages:[]},H.push(Z);Z.messages.push(W);break}case"assistant":{if((Z==null?void 0:Z.type)!=="assistant")Z={type:"assistant",messages:[]},H.push(Z);Z.messages.push(W);break}case"user":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(W);break}case"tool":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(W);break}default:throw Error(`Unsupported role: ${f}`)}}return H}function DG({finishReason:Q,isJsonResponseFromTool:H}){switch(Q){case"pause_turn":case"end_turn":case"stop_sequence":return"stop";case"refusal":return"content-filter";case"tool_use":return H?"stop":"tool-calls";case"max_tokens":case"model_context_window_exceeded":return"length";case"compaction":return"other";default:return"other"}}function fG(Q,H,Z){var W;if(Q.type==="web_search_result_location")return{type:"source",sourceType:"url",id:Z(),url:Q.url,title:Q.title,providerMetadata:{anthropic:{citedText:Q.cited_text,encryptedIndex:Q.encrypted_index}}};if(Q.type!=="page_location"&&Q.type!=="char_location")return;let f=H[Q.document_index];if(!f)return;return{type:"source",sourceType:"document",id:Z(),mediaType:f.mediaType,title:(W=Q.document_title)!=null?W:f.title,filename:f.filename,providerMetadata:{anthropic:Q.type==="page_location"?{citedText:Q.cited_text,startPageNumber:Q.start_page_number,endPageNumber:Q.end_page_number}:{citedText:Q.cited_text,startCharIndex:Q.start_char_index,endCharIndex:Q.end_char_index}}}}var TX=class{constructor(Q,H){this.specificationVersion="v3";var Z;this.modelId=Q,this.config=H,this.generateId=(Z=H.generateId)!=null?Z:CG}supportsUrl(Q){return Q.protocol==="https:"}get provider(){return this.config.provider}get providerOptionsName(){let Q=this.config.provider,H=Q.indexOf(".");return H===-1?Q:Q.substring(0,H)}get supportedUrls(){var Q,H,Z;return(Z=(H=(Q=this.config).supportedUrls)==null?void 0:H.call(Q))!=null?Z:{}}async getArgs({userSuppliedBetas:Q,prompt:H,maxOutputTokens:Z,temperature:W,topP:f,topK:h,frequencyPenalty:_,presencePenalty:b,stopSequences:l,responseFormat:M,seed:B,tools:u,toolChoice:R,providerOptions:a,stream:E}){var P,v,g,C,e,N,s,QG,YG,Y;let j=[];if(_!=null)j.push({type:"unsupported",feature:"frequencyPenalty"});if(b!=null)j.push({type:"unsupported",feature:"presencePenalty"});if(B!=null)j.push({type:"unsupported",feature:"seed"});if(W!=null&&W>1)j.push({type:"unsupported",feature:"temperature",details:`${W} exceeds anthropic maximum of 1.0. clamped to 1.0`}),W=1;else if(W!=null&&W<0)j.push({type:"unsupported",feature:"temperature",details:`${W} is below anthropic minimum of 0. clamped to 0`}),W=0;if((M==null?void 0:M.type)==="json"){if(M.schema==null)j.push({type:"unsupported",feature:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."})}let w=this.providerOptionsName,p=await LG({provider:"anthropic",providerOptions:a,schema:yG}),XG=w!=="anthropic"?await LG({provider:w,providerOptions:a,schema:yG}):null,zG=XG!=null,L=Object.assign({},p!=null?p:{},XG!=null?XG:{}),{maxOutputTokens:O,supportsStructuredOutput:T,rejectsSamplingParameters:V,isKnownModel:ZG}=OQ(this.modelId);if(V){if(W!=null)j.push({type:"unsupported",feature:"temperature",details:`temperature is not supported by ${this.modelId} and will be ignored`}),W=void 0;if(h!=null)j.push({type:"unsupported",feature:"topK",details:`topK is not supported by ${this.modelId} and will be ignored`}),h=void 0;if(f!=null)j.push({type:"unsupported",feature:"topP",details:`topP is not supported by ${this.modelId} and will be ignored`}),f=void 0}let x=ZG||this.modelId.startsWith("claude-"),o=((P=this.config.supportsNativeStructuredOutput)!=null?P:!0)&&T,t=((v=this.config.supportsStrictTools)!=null?v:!0)&&T,r=(g=L==null?void 0:L.structuredOutputMode)!=null?g:"auto",c=r==="outputFormat"||r==="auto"&&o,y=(M==null?void 0:M.type)==="json"&&M.schema!=null&&!c?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:M.schema}:void 0,n=L==null?void 0:L.contextManagement,z=new VG,m=NG({tools:u,providerToolNames:{"anthropic.code_execution_20250522":"code_execution","anthropic.code_execution_20250825":"code_execution","anthropic.code_execution_20260120":"code_execution","anthropic.computer_20241022":"computer","anthropic.computer_20250124":"computer","anthropic.text_editor_20241022":"str_replace_editor","anthropic.text_editor_20250124":"str_replace_editor","anthropic.text_editor_20250429":"str_replace_based_edit_tool","anthropic.text_editor_20250728":"str_replace_based_edit_tool","anthropic.bash_20241022":"bash","anthropic.bash_20250124":"bash","anthropic.memory_20250818":"memory","anthropic.web_search_20250305":"web_search","anthropic.web_search_20260209":"web_search","anthropic.web_fetch_20250910":"web_fetch","anthropic.web_fetch_20260209":"web_fetch","anthropic.tool_search_regex_20251119":"tool_search_tool_regex","anthropic.tool_search_bm25_20251119":"tool_search_tool_bm25"}}),{prompt:F,betas:U}=await bQ({prompt:H,sendReasoning:(C=L==null?void 0:L.sendReasoning)!=null?C:!0,warnings:j,cacheControlValidator:z,toolNameMapping:m}),K=(e=L==null?void 0:L.thinking)==null?void 0:e.type,A=K==="enabled"||K==="adaptive",$=K==="enabled"?(N=L==null?void 0:L.thinking)==null?void 0:N.budgetTokens:void 0,X=K==="adaptive"?(s=L==null?void 0:L.thinking)==null?void 0:s.display:void 0,I=Z!=null?Z:O,q={model:this.modelId,max_tokens:I,temperature:W,top_k:h,top_p:f,stop_sequences:l,...A&&{thinking:{type:K,...$!=null&&{budget_tokens:$},...X!=null&&{display:X}}},...((L==null?void 0:L.effort)||(L==null?void 0:L.taskBudget)||c&&(M==null?void 0:M.type)==="json"&&M.schema!=null)&&{output_config:{...(L==null?void 0:L.effort)&&{effort:L.effort},...(L==null?void 0:L.taskBudget)&&{task_budget:{type:L.taskBudget.type,total:L.taskBudget.total,...L.taskBudget.remaining!=null&&{remaining:L.taskBudget.remaining}}},...c&&(M==null?void 0:M.type)==="json"&&M.schema!=null&&{format:{type:"json_schema",schema:M.schema}}}},...(L==null?void 0:L.speed)&&{speed:L.speed},...(L==null?void 0:L.inferenceGeo)&&{inference_geo:L.inferenceGeo},...(L==null?void 0:L.cacheControl)&&{cache_control:L.cacheControl},...((QG=L==null?void 0:L.metadata)==null?void 0:QG.userId)!=null&&{metadata:{user_id:L.metadata.userId}},...(L==null?void 0:L.mcpServers)&&L.mcpServers.length>0&&{mcp_servers:L.mcpServers.map((S)=>({type:S.type,name:S.name,url:S.url,authorization_token:S.authorizationToken,tool_configuration:S.toolConfiguration?{allowed_tools:S.toolConfiguration.allowedTools,enabled:S.toolConfiguration.enabled}:void 0}))},...(L==null?void 0:L.container)&&{container:L.container.skills&&L.container.skills.length>0?{id:L.container.id,skills:L.container.skills.map((S)=>({type:S.type,skill_id:S.skillId,version:S.version}))}:L.container.id},system:F.system,messages:F.messages,...n&&{context_management:{edits:n.edits.map((S)=>{let RG=S.type;switch(RG){case"clear_tool_uses_20250919":return{type:S.type,...S.trigger!==void 0&&{trigger:S.trigger},...S.keep!==void 0&&{keep:S.keep},...S.clearAtLeast!==void 0&&{clear_at_least:S.clearAtLeast},...S.clearToolInputs!==void 0&&{clear_tool_inputs:S.clearToolInputs},...S.excludeTools!==void 0&&{exclude_tools:S.excludeTools}};case"clear_thinking_20251015":return{type:S.type,...S.keep!==void 0&&{keep:S.keep}};case"compact_20260112":return{type:S.type,...S.trigger!==void 0&&{trigger:S.trigger},...S.pauseAfterCompaction!==void 0&&{pause_after_compaction:S.pauseAfterCompaction},...S.instructions!==void 0&&{instructions:S.instructions}};default:j.push({type:"other",message:`Unknown context management strategy: ${RG}`});return}}).filter((S)=>S!==void 0)}}};if(A){if(K==="enabled"&&$==null)j.push({type:"compatibility",feature:"extended thinking",details:"thinking budget is required when thinking is enabled. using default budget of 1024 tokens."}),q.thinking={type:"enabled",budget_tokens:1024},$=1024;if(q.temperature!=null)q.temperature=void 0,j.push({type:"unsupported",feature:"temperature",details:"temperature is not supported when thinking is enabled"});if(h!=null)q.top_k=void 0,j.push({type:"unsupported",feature:"topK",details:"topK is not supported when thinking is enabled"});if(f!=null)q.top_p=void 0,j.push({type:"unsupported",feature:"topP",details:"topP is not supported when thinking is enabled"});q.max_tokens=I+($!=null?$:0)}else if(x&&f!=null&&W!=null)j.push({type:"unsupported",feature:"topP",details:"topP is not supported when temperature is set. topP is ignored."}),q.top_p=void 0;if(ZG&&q.max_tokens>O){if(Z!=null)j.push({type:"unsupported",feature:"maxOutputTokens",details:`${q.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${O} max output tokens. The max output tokens have been limited to ${O}.`});q.max_tokens=O}if((L==null?void 0:L.mcpServers)&&L.mcpServers.length>0)U.add("mcp-client-2025-04-04");if(n){if(U.add("context-management-2025-06-27"),n.edits.some((S)=>S.type==="compact_20260112"))U.add("compact-2026-01-12")}if((L==null?void 0:L.container)&&L.container.skills&&L.container.skills.length>0){if(U.add("code-execution-2025-08-25"),U.add("skills-2025-10-02"),U.add("files-api-2025-04-14"),!(u==null?void 0:u.some((S)=>S.type==="provider"&&(S.id==="anthropic.code_execution_20250825"||S.id==="anthropic.code_execution_20260120"))))j.push({type:"other",message:"code execution tool is required when using skills"})}if(L==null?void 0:L.effort)U.add("effort-2025-11-24");if(L==null?void 0:L.taskBudget)U.add("task-budgets-2026-03-13");if((L==null?void 0:L.speed)==="fast")U.add("fast-mode-2026-02-01");let k=E&&((YG=L==null?void 0:L.toolStreaming)!=null?YG:!0),{tools:$G,toolChoice:UG,toolWarnings:AG,betas:uG}=await UQ(y!=null?{tools:[...u!=null?u:[],y],toolChoice:{type:"required"},disableParallelToolUse:!0,cacheControlValidator:z,supportsStructuredOutput:!1,supportsStrictTools:t,defaultEagerInputStreaming:k}:{tools:u!=null?u:[],toolChoice:R,disableParallelToolUse:L==null?void 0:L.disableParallelToolUse,cacheControlValidator:z,supportsStructuredOutput:o,supportsStrictTools:t,defaultEagerInputStreaming:k}),cG=z.getWarnings();return{args:{...q,tools:$G,tool_choice:UG,stream:E===!0?!0:void 0},warnings:[...j,...AG,...cG],betas:new Set([...U,...uG,...Q,...(Y=L==null?void 0:L.anthropicBeta)!=null?Y:[]]),usesJsonResponseTool:y!=null,toolNameMapping:m,providerOptionsName:w,usedCustomProviderKey:zG}}async getHeaders({betas:Q,headers:H}){return wG(await jG(this.config.headers),H,Q.size>0?{"anthropic-beta":Array.from(Q).join(",")}:{})}async getBetasFromHeaders(Q){var H,Z;let f=(H=(await jG(this.config.headers))["anthropic-beta"])!=null?H:"",h=(Z=Q==null?void 0:Q["anthropic-beta"])!=null?Z:"";return new Set([...f.toLowerCase().split(","),...h.toLowerCase().split(",")].map((_)=>_.trim()).filter((_)=>_!==""))}buildRequestUrl(Q){var H,Z,W;return(W=(Z=(H=this.config).buildRequestUrl)==null?void 0:Z.call(H,this.config.baseURL,Q))!=null?W:`${this.config.baseURL}/messages`}transformRequestBody(Q,H){var Z,W,f;return(f=(W=(Z=this.config).transformRequestBody)==null?void 0:W.call(Z,Q,H))!=null?f:Q}extractCitationDocuments(Q){let H=(Z)=>{var W,f;if(Z.type!=="file")return!1;if(Z.mediaType!=="application/pdf"&&Z.mediaType!=="text/plain")return!1;let h=(W=Z.providerOptions)==null?void 0:W.anthropic,_=h==null?void 0:h.citations;return(f=_==null?void 0:_.enabled)!=null?f:!1};return Q.filter((Z)=>Z.role==="user").flatMap((Z)=>Z.content).filter(H).map((Z)=>{var W;let f=Z;return{title:(W=f.filename)!=null?W:"Untitled Document",filename:f.filename,mediaType:f.mediaType}})}async doGenerate(Q){var H,Z,W,f,h,_,b;let{args:l,warnings:M,betas:B,usesJsonResponseTool:u,toolNameMapping:R,providerOptionsName:a,usedCustomProviderKey:E}=await this.getArgs({...Q,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),P=[...this.extractCitationDocuments(Q.prompt)],v=PG(l.tools),{responseHeaders:g,value:C,rawValue:e}=await WG({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:B,headers:Q.headers}),body:this.transformRequestBody(l,B),failedResponseHandler:EG,successfulResponseHandler:kG(lG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),N=[],s={},QG={},YG=!1;for(let Y of C.content)switch(Y.type){case"text":{if(!u){if(N.push({type:"text",text:Y.text}),Y.citations)for(let j of Y.citations){let w=fG(j,P,this.generateId);if(w)N.push(w)}}break}case"thinking":{N.push({type:"reasoning",text:Y.thinking,providerMetadata:{anthropic:{signature:Y.signature}}});break}case"redacted_thinking":{N.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:Y.data}}});break}case"compaction":{N.push({type:"text",text:Y.content,providerMetadata:{anthropic:{type:"compaction"}}});break}case"tool_use":{if(u&&Y.name==="json")YG=!0,N.push({type:"text",text:JSON.stringify(Y.input)});else{let w=Y.caller,p=w?{type:w.type,toolId:"tool_id"in w?w.tool_id:void 0}:void 0;N.push({type:"tool-call",toolCallId:Y.id,toolName:Y.name,input:JSON.stringify(Y.input),...p&&{providerMetadata:{anthropic:{caller:p}}}})}break}case"server_tool_use":{if(Y.name==="text_editor_code_execution"||Y.name==="bash_code_execution")N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName("code_execution"),input:JSON.stringify({type:Y.name,...Y.input}),providerExecuted:!0});else if(Y.name==="web_search"||Y.name==="code_execution"||Y.name==="web_fetch"){let j=Y.name==="code_execution"&&Y.input!=null&&typeof Y.input==="object"&&"code"in Y.input&&!("type"in Y.input)?{type:"programmatic-tool-call",...Y.input}:Y.input;N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(j),providerExecuted:!0,...v&&Y.name==="code_execution"?{dynamic:!0}:{}})}else if(Y.name==="tool_search_tool_regex"||Y.name==="tool_search_tool_bm25")QG[Y.id]=Y.name,N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(Y.input),providerExecuted:!0});break}case"mcp_tool_use":{s[Y.id]={type:"tool-call",toolCallId:Y.id,toolName:Y.name,input:JSON.stringify(Y.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:Y.server_name}}},N.push(s[Y.id]);break}case"mcp_tool_result":{N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:s[Y.tool_use_id].toolName,isError:Y.is_error,result:Y.content,dynamic:!0,providerMetadata:s[Y.tool_use_id].providerMetadata});break}case"web_fetch_tool_result":{if(Y.content.type==="web_fetch_result")P.push({title:(H=Y.content.content.title)!=null?H:Y.content.url,mediaType:Y.content.content.source.media_type}),N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:Y.content.url,retrievedAt:Y.content.retrieved_at,content:{type:Y.content.content.type,title:Y.content.content.title,citations:Y.content.content.citations,source:{type:Y.content.content.source.type,mediaType:Y.content.content.source.media_type,data:Y.content.content.source.data}}}});else if(Y.content.type==="web_fetch_tool_result_error")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:Y.content.error_code}});break}case"web_search_tool_result":{if(Array.isArray(Y.content)){N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),result:Y.content.map((j)=>{var w;return{url:j.url,title:j.title,pageAge:(w=j.page_age)!=null?w:null,encryptedContent:j.encrypted_content,type:j.type}})});for(let j of Y.content)N.push({type:"source",sourceType:"url",id:this.generateId(),url:j.url,title:j.title,providerMetadata:{anthropic:{pageAge:(Z=j.page_age)!=null?Z:null}}})}else N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:Y.content.error_code}});break}case"code_execution_tool_result":{if(Y.content.type==="code_execution_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:{type:Y.content.type,stdout:Y.content.stdout,stderr:Y.content.stderr,return_code:Y.content.return_code,content:(W=Y.content.content)!=null?W:[]}});else if(Y.content.type==="encrypted_code_execution_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:{type:Y.content.type,encrypted_stdout:Y.content.encrypted_stdout,stderr:Y.content.stderr,return_code:Y.content.return_code,content:(f=Y.content.content)!=null?f:[]}});else if(Y.content.type==="code_execution_tool_result_error")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:Y.content.error_code}});break}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:Y.content});break}case"tool_search_tool_result":{let j=QG[Y.tool_use_id];if(j==null){let w=R.toCustomToolName("tool_search_tool_bm25"),p=R.toCustomToolName("tool_search_tool_regex");if(w!=="tool_search_tool_bm25")j="tool_search_tool_bm25";else if(p!=="tool_search_tool_regex")j="tool_search_tool_regex";else j="tool_search_tool_regex"}if(Y.content.type==="tool_search_tool_search_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),result:Y.content.tool_references.map((w)=>({type:w.type,toolName:w.tool_name}))});else N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:Y.content.error_code}});break}}return{content:N,finishReason:{unified:DG({finishReason:C.stop_reason,isJsonResponseFromTool:YG}),raw:(h=C.stop_reason)!=null?h:void 0},usage:IG({usage:C.usage}),request:{body:l},response:{id:(_=C.id)!=null?_:void 0,modelId:(b=C.model)!=null?b:void 0,headers:g,body:e},warnings:M,providerMetadata:(()=>{var Y,j,w,p,XG;let zG={usage:C.usage,cacheCreationInputTokens:(Y=C.usage.cache_creation_input_tokens)!=null?Y:null,stopSequence:(j=C.stop_sequence)!=null?j:null,iterations:C.usage.iterations?C.usage.iterations.map((O)=>({type:O.type,inputTokens:O.input_tokens,outputTokens:O.output_tokens})):null,container:C.container?{expiresAt:C.container.expires_at,id:C.container.id,skills:(p=(w=C.container.skills)==null?void 0:w.map((O)=>({type:O.type,skillId:O.skill_id,version:O.version})))!=null?p:null}:null,contextManagement:(XG=xG(C.context_management))!=null?XG:null},L={anthropic:zG};if(E&&a!=="anthropic")L[a]=zG;return L})()}}async doStream(Q){var H,Z;let{args:W,warnings:f,betas:h,usesJsonResponseTool:_,toolNameMapping:b,providerOptionsName:l,usedCustomProviderKey:M}=await this.getArgs({...Q,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),B=[...this.extractCitationDocuments(Q.prompt)],u=PG(W.tools),R=this.buildRequestUrl(!0),{responseHeaders:a,value:E}=await WG({url:R,headers:await this.getHeaders({betas:h,headers:Q.headers}),body:this.transformRequestBody(W,h),failedResponseHandler:EG,successfulResponseHandler:OG(sG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),P={unified:"other",raw:void 0},v={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},g={},C={},e={},N=null,s=void 0,QG=null,YG=null,Y=null,j=!1,w=void 0,p=this.generateId,XG=E.pipeThrough(new TransformStream({start(T){T.enqueue({type:"stream-start",warnings:f})},transform(T,V){var ZG,x,o,t,r,c,y,n,z,m,F,U,K,A;if(Q.includeRawChunks)V.enqueue({type:"raw",rawValue:T.rawValue});if(!T.success){V.enqueue({type:"error",error:T.error});return}let $=T.value;switch($.type){case"ping":return;case"content_block_start":{let X=$.content_block,I=X.type;switch(w=I,I){case"text":{if(_)return;g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});return}case"thinking":{g[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index)});return}case"redacted_thinking":{g[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index),providerMetadata:{anthropic:{redactedData:X.data}}});return}case"compaction":{g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index),providerMetadata:{anthropic:{type:"compaction"}}});return}case"tool_use":{if(_&&X.name==="json")j=!0,g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});else{let k=X.caller,$G=k?{type:k.type,toolId:"tool_id"in k?k.tool_id:void 0}:void 0,AG=X.input&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";g[$.index]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:AG,firstDelta:AG.length===0,...$G&&{caller:$G}},V.enqueue({type:"tool-input-start",id:X.id,toolName:X.name})}return}case"server_tool_use":{if(["web_fetch","web_search","code_execution","text_editor_code_execution","bash_code_execution"].includes(X.name)){let q=X.name==="text_editor_code_execution"||X.name==="bash_code_execution"?"code_execution":X.name,k=b.toCustomToolName(q),$G=X.input!=null&&typeof X.input==="object"&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";g[$.index]={type:"tool-call",toolCallId:X.id,toolName:k,input:$G,providerExecuted:!0,...u&&q==="code_execution"?{dynamic:!0}:{},firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:k,providerExecuted:!0,...u&&q==="code_execution"?{dynamic:!0}:{}})}else if(X.name==="tool_search_tool_regex"||X.name==="tool_search_tool_bm25"){e[X.id]=X.name;let q=b.toCustomToolName(X.name);g[$.index]={type:"tool-call",toolCallId:X.id,toolName:q,input:"",providerExecuted:!0,firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:q,providerExecuted:!0})}return}case"web_fetch_tool_result":{if(X.content.type==="web_fetch_result")B.push({title:(ZG=X.content.content.title)!=null?ZG:X.content.url,mediaType:X.content.content.source.media_type}),V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:X.content.url,retrievedAt:X.content.retrieved_at,content:{type:X.content.content.type,title:X.content.content.title,citations:X.content.content.citations,source:{type:X.content.content.source.type,mediaType:X.content.content.source.media_type,data:X.content.content.source.data}}}});else if(X.content.type==="web_fetch_tool_result_error")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:X.content.error_code}});return}case"web_search_tool_result":{if(Array.isArray(X.content)){V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_search"),result:X.content.map((q)=>{var k;return{url:q.url,title:q.title,pageAge:(k=q.page_age)!=null?k:null,encryptedContent:q.encrypted_content,type:q.type}})});for(let q of X.content)V.enqueue({type:"source",sourceType:"url",id:p(),url:q.url,title:q.title,providerMetadata:{anthropic:{pageAge:(x=q.page_age)!=null?x:null}}})}else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:X.content.error_code}});return}case"code_execution_tool_result":{if(X.content.type==="code_execution_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:{type:X.content.type,stdout:X.content.stdout,stderr:X.content.stderr,return_code:X.content.return_code,content:(o=X.content.content)!=null?o:[]}});else if(X.content.type==="encrypted_code_execution_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:{type:X.content.type,encrypted_stdout:X.content.encrypted_stdout,stderr:X.content.stderr,return_code:X.content.return_code,content:(t=X.content.content)!=null?t:[]}});else if(X.content.type==="code_execution_tool_result_error")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:X.content.error_code}});return}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:X.content});return}case"tool_search_tool_result":{let q=e[X.tool_use_id];if(q==null){let k=b.toCustomToolName("tool_search_tool_bm25"),$G=b.toCustomToolName("tool_search_tool_regex");if(k!=="tool_search_tool_bm25")q="tool_search_tool_bm25";else if($G!=="tool_search_tool_regex")q="tool_search_tool_regex";else q="tool_search_tool_regex"}if(X.content.type==="tool_search_tool_search_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName(q),result:X.content.tool_references.map((k)=>({type:k.type,toolName:k.tool_name}))});else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName(q),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:X.content.error_code}});return}case"mcp_tool_use":{C[X.id]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:JSON.stringify(X.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:X.server_name}}},V.enqueue(C[X.id]);return}case"mcp_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:C[X.tool_use_id].toolName,isError:X.is_error,result:X.content,dynamic:!0,providerMetadata:C[X.tool_use_id].providerMetadata});return}default:throw Error(`Unsupported content block type: ${I}`)}}case"content_block_stop":{if(g[$.index]!=null){let X=g[$.index];switch(X.type){case"text":{V.enqueue({type:"text-end",id:String($.index)});break}case"reasoning":{V.enqueue({type:"reasoning-end",id:String($.index)});break}case"tool-call":if(!(_&&X.toolName==="json")){V.enqueue({type:"tool-input-end",id:X.toolCallId});let q=X.input===""?"{}":X.input;if(X.providerToolName==="code_execution")try{let k=JSON.parse(q);if(k!=null&&typeof k==="object"&&"code"in k&&!("type"in k))q=JSON.stringify({type:"programmatic-tool-call",...k})}catch(k){}V.enqueue({type:"tool-call",toolCallId:X.toolCallId,toolName:X.toolName,input:q,providerExecuted:X.providerExecuted,...u&&X.providerToolName==="code_execution"?{dynamic:!0}:{},...X.caller&&{providerMetadata:{anthropic:{caller:X.caller}}}})}break}delete g[$.index]}w=void 0;return}case"content_block_delta":{let X=$.delta.type;switch(X){case"text_delta":{if(_)return;V.enqueue({type:"text-delta",id:String($.index),delta:$.delta.text});return}case"thinking_delta":{V.enqueue({type:"reasoning-delta",id:String($.index),delta:$.delta.thinking});return}case"signature_delta":{if(w==="thinking")V.enqueue({type:"reasoning-delta",id:String($.index),delta:"",providerMetadata:{anthropic:{signature:$.delta.signature}}});return}case"compaction_delta":{if($.delta.content!=null)V.enqueue({type:"text-delta",id:String($.index),delta:$.delta.content});return}case"input_json_delta":{let I=g[$.index],q=$.delta.partial_json;if(q.length===0)return;if(j){if((I==null?void 0:I.type)!=="text")return;V.enqueue({type:"text-delta",id:String($.index),delta:q})}else{if((I==null?void 0:I.type)!=="tool-call")return;if(I.firstDelta&&(I.providerToolName==="bash_code_execution"||I.providerToolName==="text_editor_code_execution"))q=`{"type": "${I.providerToolName}",${q.substring(1)}`;V.enqueue({type:"tool-input-delta",id:I.toolCallId,delta:q}),I.input+=q,I.firstDelta=!1}return}case"citations_delta":{let I=$.delta.citation,q=fG(I,B,p);if(q)V.enqueue(q);return}default:throw Error(`Unsupported delta type: ${X}`)}}case"message_start":{if(v.input_tokens=$.message.usage.input_tokens,v.cache_read_input_tokens=(r=$.message.usage.cache_read_input_tokens)!=null?r:0,v.cache_creation_input_tokens=(c=$.message.usage.cache_creation_input_tokens)!=null?c:0,s={...$.message.usage},QG=(y=$.message.usage.cache_creation_input_tokens)!=null?y:null,$.message.container!=null)Y={expiresAt:$.message.container.expires_at,id:$.message.container.id,skills:null};if($.message.stop_reason!=null)P={unified:DG({finishReason:$.message.stop_reason,isJsonResponseFromTool:j}),raw:$.message.stop_reason};if(V.enqueue({type:"response-metadata",id:(n=$.message.id)!=null?n:void 0,modelId:(z=$.message.model)!=null?z:void 0}),$.message.content!=null)for(let X=0;X<$.message.content.length;X++){let I=$.message.content[X];if(I.type==="tool_use"){let q=I.caller,k=q?{type:q.type,toolId:"tool_id"in q?q.tool_id:void 0}:void 0;V.enqueue({type:"tool-input-start",id:I.id,toolName:I.name});let $G=JSON.stringify((m=I.input)!=null?m:{});V.enqueue({type:"tool-input-delta",id:I.id,delta:$G}),V.enqueue({type:"tool-input-end",id:I.id}),V.enqueue({type:"tool-call",toolCallId:I.id,toolName:I.name,input:$G,...k&&{providerMetadata:{anthropic:{caller:k}}}})}}return}case"message_delta":{if($.usage.input_tokens!=null&&v.input_tokens!==$.usage.input_tokens)v.input_tokens=$.usage.input_tokens;if(v.output_tokens=$.usage.output_tokens,$.usage.cache_read_input_tokens!=null)v.cache_read_input_tokens=$.usage.cache_read_input_tokens;if($.usage.cache_creation_input_tokens!=null)v.cache_creation_input_tokens=$.usage.cache_creation_input_tokens,QG=$.usage.cache_creation_input_tokens;if($.usage.iterations!=null)v.iterations=$.usage.iterations;if(P={unified:DG({finishReason:$.delta.stop_reason,isJsonResponseFromTool:j}),raw:(F=$.delta.stop_reason)!=null?F:void 0},YG=(U=$.delta.stop_sequence)!=null?U:null,Y=$.delta.container!=null?{expiresAt:$.delta.container.expires_at,id:$.delta.container.id,skills:(A=(K=$.delta.container.skills)==null?void 0:K.map((X)=>({type:X.type,skillId:X.skill_id,version:X.version})))!=null?A:null}:null,$.context_management)N=xG($.context_management);s={...s,...$.usage};return}case"message_stop":{let X={usage:s!=null?s:null,cacheCreationInputTokens:QG,stopSequence:YG,iterations:v.iterations?v.iterations.map((q)=>({type:q.type,inputTokens:q.input_tokens,outputTokens:q.output_tokens})):null,container:Y,contextManagement:N},I={anthropic:X};if(M&&l!=="anthropic")I[l]=X;V.enqueue({type:"finish",finishReason:P,usage:IG({usage:v,rawUsage:s}),providerMetadata:I});return}case"error":{V.enqueue({type:"error",error:$.error});return}default:throw Error(`Unsupported chunk type: ${$}`)}}})),[zG,L]=XG.tee(),O=zG.getReader();try{await O.read();let T=await O.read();if(((H=T.value)==null?void 0:H.type)==="raw")T=await O.read();if(((Z=T.value)==null?void 0:Z.type)==="error"){let V=T.value.error;throw new BG({message:V.message,url:R,requestBodyValues:W,statusCode:V.type==="overloaded_error"?529:500,responseHeaders:a,responseBody:JSON.stringify(V),isRetryable:V.type==="overloaded_error"})}}finally{O.cancel().catch(()=>{}),O.releaseLock()}return{stream:L,request:{body:W},response:{headers:a}}}};function OQ(Q){if(Q.includes("claude-opus-4-7"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!0,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-6")||Q.includes("claude-opus-4-6"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-5")||Q.includes("claude-opus-4-5")||Q.includes("claude-haiku-4-5"))return{maxOutputTokens:64000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-opus-4-1"))return{maxOutputTokens:32000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-"))return{maxOutputTokens:64000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-opus-4-"))return{maxOutputTokens:32000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-3-haiku"))return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!1}}function PG(Q){if(!Q)return!1;let H=!1,Z=!1;for(let W of Q){if("type"in W&&(W.type==="web_fetch_20260209"||W.type==="web_search_20260209")){H=!0;continue}if(W.name==="code_execution"){Z=!0;break}}return H&&!Z}function xG(Q){return Q?{appliedEdits:Q.applied_edits.map((H)=>{switch(H.type){case"clear_tool_uses_20250919":return{type:H.type,clearedToolUses:H.cleared_tool_uses,clearedInputTokens:H.cleared_input_tokens};case"clear_thinking_20251015":return{type:H.type,clearedThinkingTurns:H.cleared_thinking_turns,clearedInputTokens:H.cleared_input_tokens};case"compact_20260112":return{type:H.type}}}).filter((H)=>H!==void 0)}:null}var kQ=D(()=>J(G.object({command:G.string(),restart:G.boolean().optional()}))),vQ=d({id:"anthropic.bash_20241022",inputSchema:kQ}),_Q=D(()=>J(G.object({command:G.string(),restart:G.boolean().optional()}))),hQ=d({id:"anthropic.bash_20250124",inputSchema:_Q}),gQ=D(()=>J(G.object({action:G.enum(["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","screenshot","cursor_position"]),coordinate:G.array(G.number().int()).optional(),text:G.string().optional()}))),mQ=d({id:"anthropic.computer_20241022",inputSchema:gQ}),dQ=D(()=>J(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),uQ=d({id:"anthropic.computer_20250124",inputSchema:dQ}),cQ=D(()=>J(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot","zoom"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),region:G.tuple([G.number().int(),G.number().int(),G.number().int(),G.number().int()]).optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),iQ=d({id:"anthropic.computer_20251124",inputSchema:cQ}),lQ=D(()=>J(G.discriminatedUnion("command",[G.object({command:G.literal("view"),path:G.string(),view_range:G.tuple([G.number(),G.number()]).optional()}),G.object({command:G.literal("create"),path:G.string(),file_text:G.string()}),G.object({command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()}),G.object({command:G.literal("insert"),path:G.string(),insert_line:G.number(),insert_text:G.string()}),G.object({command:G.literal("delete"),path:G.string()}),G.object({command:G.literal("rename"),old_path:G.string(),new_path:G.string()})]))),sQ=d({id:"anthropic.memory_20250818",inputSchema:lQ}),pQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),nQ=d({id:"anthropic.text_editor_20241022",inputSchema:pQ}),rQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),aQ=d({id:"anthropic.text_editor_20250124",inputSchema:rQ}),eQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),oQ=d({id:"anthropic.text_editor_20250429",inputSchema:eQ}),tQ=D(()=>J(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),GX=D(()=>J(G.object({query:G.string(),limit:G.number().optional()}))),QX=i({id:"anthropic.tool_search_bm25_20251119",inputSchema:GX,outputSchema:tQ,supportsDeferredResults:!0}),XX=(Q={})=>{return QX(Q)},GY={bash_20241022:vQ,bash_20250124:hQ,codeExecution_20250522:SQ,codeExecution_20250825:IQ,codeExecution_20260120:xQ,computer_20241022:mQ,computer_20250124:uQ,computer_20251124:iQ,memory_20250818:sQ,textEditor_20241022:nQ,textEditor_20250124:aQ,textEditor_20250429:oQ,textEditor_20250728:oG,webFetch_20250910:VQ,webFetch_20260209:DQ,webSearch_20250305:LQ,webSearch_20260209:YQ,toolSearchRegex_20251119:NQ,toolSearchBm25_20251119:XX};
|
|
2
|
+
import{Cp as LG,Dp as WG,Hp as d,Ip as i,Jp as jG,Kp as TG,Lp as OG,Mp as kG,Ro as wG,So as NG,Wo as MG,Yo as JG,fp as CG,mp as bG,sp as D,vp as J,wp as GG}from"./chunk-2maqde7w.js";import{Tp as BG,dq as HG}from"./chunk-kj20f048.js";import{St as G}from"./chunk-c11d28qn.js";var iG=D(()=>J(G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}))),EG=TG({errorSchema:iG,errorToMessage:(Q)=>Q.error.message}),lG=D(()=>J(G.object({type:G.literal("message"),id:G.string().nullish(),model:G.string().nullish(),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string(),citations:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])).optional()}),G.object({type:G.literal("thinking"),thinking:G.string(),signature:G.string()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])),stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish(),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}))),sG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("message_start"),message:G.object({id:G.string().nullish(),model:G.string().nullish(),role:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish()}),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()})])).nullish(),stop_reason:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string()}).nullish()})}),G.object({type:G.literal("content_block_start"),index:G.number(),content_block:G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string()}),G.object({type:G.literal("thinking"),thinking:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).optional(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string().nullish()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])}),G.object({type:G.literal("content_block_delta"),index:G.number(),delta:G.discriminatedUnion("type",[G.object({type:G.literal("input_json_delta"),partial_json:G.string()}),G.object({type:G.literal("text_delta"),text:G.string()}),G.object({type:G.literal("thinking_delta"),thinking:G.string()}),G.object({type:G.literal("signature_delta"),signature:G.string()}),G.object({type:G.literal("compaction_delta"),content:G.string().nullish()}),G.object({type:G.literal("citations_delta"),citation:G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])})])}),G.object({type:G.literal("content_block_stop"),index:G.number()}),G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}),G.object({type:G.literal("message_delta"),delta:G.object({stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish()}),usage:G.looseObject({input_tokens:G.number().nullish(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}),G.object({type:G.literal("message_stop")}),G.object({type:G.literal("ping")})]))),pG=D(()=>J(G.object({signature:G.string().optional(),redactedData:G.string().optional()}))),SG=G.object({citations:G.object({enabled:G.boolean()}).optional(),title:G.string().optional(),context:G.string().optional()}),yG=G.object({sendReasoning:G.boolean().optional(),structuredOutputMode:G.enum(["outputFormat","jsonTool","auto"]).optional(),thinking:G.discriminatedUnion("type",[G.object({type:G.literal("adaptive"),display:G.enum(["omitted","summarized"]).optional()}),G.object({type:G.literal("enabled"),budgetTokens:G.number().optional()}),G.object({type:G.literal("disabled")})]).optional(),disableParallelToolUse:G.boolean().optional(),cacheControl:G.object({type:G.literal("ephemeral"),ttl:G.union([G.literal("5m"),G.literal("1h")]).optional()}).optional(),metadata:G.object({userId:G.string().optional()}).optional(),mcpServers:G.array(G.object({type:G.literal("url"),name:G.string(),url:G.string(),authorizationToken:G.string().nullish(),toolConfiguration:G.object({enabled:G.boolean().nullish(),allowedTools:G.array(G.string()).nullish()}).nullish()})).optional(),container:G.object({id:G.string().optional(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skillId:G.string(),version:G.string().optional()})).optional()}).optional(),toolStreaming:G.boolean().optional(),effort:G.enum(["low","medium","high","xhigh","max"]).optional(),taskBudget:G.object({type:G.literal("tokens"),total:G.number().int().min(20000),remaining:G.number().int().min(0).optional()}).optional(),speed:G.enum(["fast","standard"]).optional(),inferenceGeo:G.enum(["us","global"]).optional(),anthropicBeta:G.array(G.string()).optional(),contextManagement:G.object({edits:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("clear_tool_uses_20250919"),trigger:G.discriminatedUnion("type",[G.object({type:G.literal("input_tokens"),value:G.number()}),G.object({type:G.literal("tool_uses"),value:G.number()})]).optional(),keep:G.object({type:G.literal("tool_uses"),value:G.number()}).optional(),clearAtLeast:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),clearToolInputs:G.boolean().optional(),excludeTools:G.array(G.string()).optional()}),G.object({type:G.literal("clear_thinking_20251015"),keep:G.union([G.literal("all"),G.object({type:G.literal("thinking_turns"),value:G.number()})]).optional()}),G.object({type:G.literal("compact_20260112"),trigger:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),pauseAfterCompaction:G.boolean().optional(),instructions:G.string().optional()})]))}).optional()}),FG=4;function nG(Q){var H;let Z=Q==null?void 0:Q.anthropic;return(H=Z==null?void 0:Z.cacheControl)!=null?H:Z==null?void 0:Z.cache_control}var VG=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(Q,H){let Z=nG(Q);if(!Z)return;if(!H.canCache){this.warnings.push({type:"unsupported",feature:"cache_control on non-cacheable context",details:`cache_control cannot be set on ${H.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>FG){this.warnings.push({type:"unsupported",feature:"cacheControl breakpoint limit",details:`Maximum ${FG} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return Z}getWarnings(){return this.warnings}},rG=D(()=>J(G.object({maxCharacters:G.number().optional()}))),aG=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),eG=d({id:"anthropic.text_editor_20250728",inputSchema:aG}),oG=(Q={})=>{return eG(Q)},tG=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),GQ=D(()=>J(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),QQ=D(()=>J(G.object({query:G.string()}))),XQ=i({id:"anthropic.web_search_20260209",inputSchema:QQ,outputSchema:GQ,supportsDeferredResults:!0}),YQ=(Q={})=>{return XQ(Q)},ZQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),vG=D(()=>J(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),$Q=D(()=>J(G.object({query:G.string()}))),zQ=i({id:"anthropic.web_search_20250305",inputSchema:$Q,outputSchema:vG,supportsDeferredResults:!0}),LQ=(Q={})=>{return zQ(Q)},HQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),AQ=D(()=>J(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),qQ=D(()=>J(G.object({url:G.string()}))),KQ=i({id:"anthropic.web_fetch_20260209",inputSchema:qQ,outputSchema:AQ,supportsDeferredResults:!0}),DQ=(Q={})=>{return KQ(Q)},JQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),_G=D(()=>J(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),WQ=D(()=>J(G.object({url:G.string()}))),jQ=i({id:"anthropic.web_fetch_20250910",inputSchema:WQ,outputSchema:_G,supportsDeferredResults:!0}),VQ=(Q={})=>{return jQ(Q)};async function UQ({tools:Q,toolChoice:H,disableParallelToolUse:Z,cacheControlValidator:W,supportsStructuredOutput:f,supportsStrictTools:h,defaultEagerInputStreaming:_=!1}){var b,l;Q=(Q==null?void 0:Q.length)?Q:void 0;let M=[],B=new Set,u=W||new VG;if(Q==null)return{tools:void 0,toolChoice:void 0,toolWarnings:M,betas:B};let R=[];for(let E of Q)switch(E.type){case"function":{let P=u.getCacheControl(E.providerOptions,{type:"tool definition",canCache:!0}),v=(b=E.providerOptions)==null?void 0:b.anthropic,g=(l=v==null?void 0:v.eagerInputStreaming)!=null?l:_,C=v==null?void 0:v.deferLoading,e=v==null?void 0:v.allowedCallers;if(!h&&E.strict!=null)M.push({type:"unsupported",feature:"strict",details:`Tool '${E.name}' has strict: ${E.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`});if(R.push({name:E.name,description:E.description,input_schema:E.inputSchema,cache_control:P,...g?{eager_input_streaming:!0}:{},...h===!0&&E.strict!=null?{strict:E.strict}:{},...C!=null?{defer_loading:C}:{},...e!=null?{allowed_callers:e}:{},...E.inputExamples!=null?{input_examples:E.inputExamples.map((N)=>N.input)}:{}}),f===!0)B.add("structured-outputs-2025-11-13");if(E.inputExamples!=null||e!=null)B.add("advanced-tool-use-2025-11-20");break}case"provider":{switch(E.id){case"anthropic.code_execution_20250522":{B.add("code-execution-2025-05-22"),R.push({type:"code_execution_20250522",name:"code_execution",cache_control:void 0});break}case"anthropic.code_execution_20250825":{B.add("code-execution-2025-08-25"),R.push({type:"code_execution_20250825",name:"code_execution"});break}case"anthropic.code_execution_20260120":{R.push({type:"code_execution_20260120",name:"code_execution"});break}case"anthropic.computer_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"computer",type:"computer_20250124",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,cache_control:void 0});break}case"anthropic.computer_20251124":{B.add("computer-use-2025-11-24"),R.push({name:"computer",type:"computer_20251124",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,enable_zoom:E.args.enableZoom,cache_control:void 0});break}case"anthropic.computer_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"computer",type:"computer_20241022",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,cache_control:void 0});break}case"anthropic.text_editor_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"str_replace_editor",type:"text_editor_20250124",cache_control:void 0});break}case"anthropic.text_editor_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"str_replace_editor",type:"text_editor_20241022",cache_control:void 0});break}case"anthropic.text_editor_20250429":{B.add("computer-use-2025-01-24"),R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250429",cache_control:void 0});break}case"anthropic.text_editor_20250728":{let P=await GG({value:E.args,schema:rG});R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:P.maxCharacters,cache_control:void 0});break}case"anthropic.bash_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"bash",type:"bash_20250124",cache_control:void 0});break}case"anthropic.bash_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"bash",type:"bash_20241022",cache_control:void 0});break}case"anthropic.memory_20250818":{B.add("context-management-2025-06-27"),R.push({name:"memory",type:"memory_20250818"});break}case"anthropic.web_fetch_20250910":{B.add("web-fetch-2025-09-10");let P=await GG({value:E.args,schema:JQ});R.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,citations:P.citations,max_content_tokens:P.maxContentTokens,cache_control:void 0});break}case"anthropic.web_fetch_20260209":{B.add("code-execution-web-tools-2026-02-09");let P=await GG({value:E.args,schema:HQ});R.push({type:"web_fetch_20260209",name:"web_fetch",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,citations:P.citations,max_content_tokens:P.maxContentTokens,cache_control:void 0});break}case"anthropic.web_search_20250305":{let P=await GG({value:E.args,schema:ZQ});R.push({type:"web_search_20250305",name:"web_search",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,user_location:P.userLocation,cache_control:void 0});break}case"anthropic.web_search_20260209":{B.add("code-execution-web-tools-2026-02-09");let P=await GG({value:E.args,schema:tG});R.push({type:"web_search_20260209",name:"web_search",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,user_location:P.userLocation,cache_control:void 0});break}case"anthropic.tool_search_regex_20251119":{R.push({type:"tool_search_tool_regex_20251119",name:"tool_search_tool_regex"});break}case"anthropic.tool_search_bm25_20251119":{R.push({type:"tool_search_tool_bm25_20251119",name:"tool_search_tool_bm25"});break}default:{M.push({type:"unsupported",feature:`provider-defined tool ${E.id}`});break}}break}default:{M.push({type:"unsupported",feature:`tool ${E}`});break}}if(H==null)return{tools:R,toolChoice:Z?{type:"auto",disable_parallel_tool_use:Z}:void 0,toolWarnings:M,betas:B};let a=H.type;switch(a){case"auto":return{tools:R,toolChoice:{type:"auto",disable_parallel_tool_use:Z},toolWarnings:M,betas:B};case"required":return{tools:R,toolChoice:{type:"any",disable_parallel_tool_use:Z},toolWarnings:M,betas:B};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:M,betas:B};case"tool":return{tools:R,toolChoice:{type:"tool",name:H.toolName,disable_parallel_tool_use:Z},toolWarnings:M,betas:B};default:throw new HG({functionality:`tool choice type: ${a}`})}}function IG({usage:Q,rawUsage:H}){var Z,W;let f=(Z=Q.cache_creation_input_tokens)!=null?Z:0,h=(W=Q.cache_read_input_tokens)!=null?W:0,_,b;if(Q.iterations&&Q.iterations.length>0){let l=Q.iterations.reduce((M,B)=>({input:M.input+B.input_tokens,output:M.output+B.output_tokens}),{input:0,output:0});_=l.input,b=l.output}else _=Q.input_tokens,b=Q.output_tokens;return{inputTokens:{total:_+f+h,noCache:_,cacheRead:h,cacheWrite:f},outputTokens:{total:b,text:void 0,reasoning:void 0},raw:H!=null?H:Q}}var hG=D(()=>J(G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}))),RQ=D(()=>J(G.object({code:G.string()}))),EQ=i({id:"anthropic.code_execution_20250522",inputSchema:RQ,outputSchema:hG}),SQ=(Q={})=>{return EQ(Q)},gG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),yQ=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),FQ=i({id:"anthropic.code_execution_20250825",inputSchema:yQ,outputSchema:gG,supportsDeferredResults:!0}),IQ=(Q={})=>{return FQ(Q)},mG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),fQ=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),PQ=i({id:"anthropic.code_execution_20260120",inputSchema:fQ,outputSchema:mG,supportsDeferredResults:!0}),xQ=(Q={})=>{return PQ(Q)},dG=D(()=>J(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),BQ=D(()=>J(G.object({pattern:G.string(),limit:G.number().optional()}))),wQ=i({id:"anthropic.tool_search_regex_20251119",inputSchema:BQ,outputSchema:dG,supportsDeferredResults:!0}),NQ=(Q={})=>{return wQ(Q)};function MQ(Q){if(typeof Q==="string")return new TextDecoder().decode(MG(Q));if(Q instanceof Uint8Array)return new TextDecoder().decode(Q);if(Q instanceof URL)throw new HG({functionality:"URL-based text documents are not supported for citations"});throw new HG({functionality:`unsupported data type for text documents: ${typeof Q}`})}function qG(Q){return Q instanceof URL||CQ(Q)}function CQ(Q){return typeof Q==="string"&&/^https?:\/\//i.test(Q)}function KG(Q){return Q instanceof URL?Q.toString():Q}async function bQ({prompt:Q,sendReasoning:H,warnings:Z,cacheControlValidator:W,toolNameMapping:f}){var h,_,b,l,M,B,u,R,a,E,P,v,g,C,e,N,s,QG,YG;let Y=new Set,j=TQ(Q),w=W||new VG,p=void 0,XG=[];async function zG(O){var T,V;let ZG=await LG({provider:"anthropic",providerOptions:O,schema:SG});return(V=(T=ZG==null?void 0:ZG.citations)==null?void 0:T.enabled)!=null?V:!1}async function L(O){let T=await LG({provider:"anthropic",providerOptions:O,schema:SG});return{title:T==null?void 0:T.title,context:T==null?void 0:T.context}}for(let O=0;O<j.length;O++){let T=j[O],V=O===j.length-1,ZG=T.type;switch(ZG){case"system":{if(p!=null)throw new HG({functionality:"Multiple system messages that are separated by user/assistant messages"});p=T.messages.map(({content:x,providerOptions:o})=>({type:"text",text:x,cache_control:w.getCacheControl(o,{type:"system message",canCache:!0})}));break}case"user":{let x=[];for(let o of T.messages){let{role:t,content:r}=o;switch(t){case"user":{for(let c=0;c<r.length;c++){let y=r[c],n=c===r.length-1,z=(h=w.getCacheControl(y.providerOptions,{type:"user message part",canCache:!0}))!=null?h:n?w.getCacheControl(o.providerOptions,{type:"user message",canCache:!0}):void 0;switch(y.type){case"text":{x.push({type:"text",text:y.text,cache_control:z});break}case"file":{if(y.mediaType.startsWith("image/"))x.push({type:"image",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"base64",media_type:y.mediaType==="image/*"?"image/jpeg":y.mediaType,data:JG(y.data)},cache_control:z});else if(y.mediaType==="application/pdf"){Y.add("pdfs-2024-09-25");let m=await zG(y.providerOptions),F=await L(y.providerOptions);x.push({type:"document",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"base64",media_type:"application/pdf",data:JG(y.data)},title:(_=F.title)!=null?_:y.filename,...F.context&&{context:F.context},...m&&{citations:{enabled:!0}},cache_control:z})}else if(y.mediaType==="text/plain"){let m=await zG(y.providerOptions),F=await L(y.providerOptions);x.push({type:"document",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"text",media_type:"text/plain",data:MQ(y.data)},title:(b=F.title)!=null?b:y.filename,...F.context&&{context:F.context},...m&&{citations:{enabled:!0}},cache_control:z})}else throw new HG({functionality:`media type: ${y.mediaType}`});break}}}break}case"tool":{for(let c=0;c<r.length;c++){let y=r[c];if(y.type==="tool-approval-response")continue;let n=c===r.length-1,z=(l=w.getCacheControl(y.providerOptions,{type:"tool result part",canCache:!0}))!=null?l:n?w.getCacheControl(o.providerOptions,{type:"tool result message",canCache:!0}):void 0,m=y.output,F;switch(m.type){case"content":F=m.value.map((U)=>{var K;switch(U.type){case"text":return{type:"text",text:U.text};case"image-data":return{type:"image",source:{type:"base64",media_type:U.mediaType,data:U.data}};case"image-url":return{type:"image",source:{type:"url",url:U.url}};case"file-url":return{type:"document",source:{type:"url",url:U.url}};case"file-data":{if(U.mediaType==="application/pdf")return Y.add("pdfs-2024-09-25"),{type:"document",source:{type:"base64",media_type:U.mediaType,data:U.data}};Z.push({type:"other",message:`unsupported tool content part type: ${U.type} with media type: ${U.mediaType}`});return}case"custom":{let A=(K=U.providerOptions)==null?void 0:K.anthropic;if((A==null?void 0:A.type)==="tool-reference")return{type:"tool_reference",tool_name:A.toolName};Z.push({type:"other",message:"unsupported custom tool content part"});return}default:{Z.push({type:"other",message:`unsupported tool content part type: ${U.type}`});return}}}).filter(bG);break;case"text":case"error-text":F=m.value;break;case"execution-denied":F=(M=m.reason)!=null?M:"Tool execution denied.";break;case"json":case"error-json":default:F=JSON.stringify(m.value);break}x.push({type:"tool_result",tool_use_id:y.toolCallId,content:F,is_error:m.type==="error-text"||m.type==="error-json"?!0:void 0,cache_control:z})}break}default:throw Error(`Unsupported role: ${t}`)}}XG.push({role:"user",content:x});break}case"assistant":{let x=[],o=new Set;for(let t=0;t<T.messages.length;t++){let r=T.messages[t],c=t===T.messages.length-1,{content:y}=r;for(let n=0;n<y.length;n++){let z=y[n],m=n===y.length-1,F=(B=w.getCacheControl(z.providerOptions,{type:"assistant message part",canCache:!0}))!=null?B:m?w.getCacheControl(r.providerOptions,{type:"assistant message",canCache:!0}):void 0;switch(z.type){case"text":{let U=(u=z.providerOptions)==null?void 0:u.anthropic;if((U==null?void 0:U.type)==="compaction")x.push({type:"compaction",content:z.text,cache_control:F});else x.push({type:"text",text:V&&c&&m?z.text.trim():z.text,cache_control:F});break}case"reasoning":{if(H){let U=await LG({provider:"anthropic",providerOptions:z.providerOptions,schema:pG});if(U!=null)if(U.signature!=null)w.getCacheControl(z.providerOptions,{type:"thinking block",canCache:!1}),x.push({type:"thinking",thinking:z.text,signature:U.signature});else if(U.redactedData!=null)w.getCacheControl(z.providerOptions,{type:"redacted thinking block",canCache:!1}),x.push({type:"redacted_thinking",data:U.redactedData});else Z.push({type:"other",message:"unsupported reasoning metadata"});else Z.push({type:"other",message:"unsupported reasoning metadata"})}else Z.push({type:"other",message:"sending reasoning content is disabled for this model"});break}case"tool-call":{if(z.providerExecuted){let A=f.toProviderToolName(z.toolName);if(((a=(R=z.providerOptions)==null?void 0:R.anthropic)==null?void 0:a.type)==="mcp-tool-use"){o.add(z.toolCallId);let X=(P=(E=z.providerOptions)==null?void 0:E.anthropic)==null?void 0:P.serverName;if(X==null||typeof X!=="string"){Z.push({type:"other",message:"mcp tool use server name is required and must be a string"});break}x.push({type:"mcp_tool_use",id:z.toolCallId,name:z.toolName,input:z.input,server_name:X,cache_control:F})}else if(A==="code_execution"&&z.input!=null&&typeof z.input==="object"&&"type"in z.input&&typeof z.input.type==="string"&&(z.input.type==="bash_code_execution"||z.input.type==="text_editor_code_execution"))x.push({type:"server_tool_use",id:z.toolCallId,name:z.input.type,input:z.input,cache_control:F});else if(A==="code_execution"&&z.input!=null&&typeof z.input==="object"&&"type"in z.input&&z.input.type==="programmatic-tool-call"){let{type:X,...I}=z.input;x.push({type:"server_tool_use",id:z.toolCallId,name:"code_execution",input:I,cache_control:F})}else if(A==="code_execution"||A==="web_fetch"||A==="web_search")x.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:F});else if(A==="tool_search_tool_regex"||A==="tool_search_tool_bm25")x.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:F});else Z.push({type:"other",message:`provider executed tool call for tool ${z.toolName} is not supported`});break}let U=(v=z.providerOptions)==null?void 0:v.anthropic,K=(U==null?void 0:U.caller)?(U.caller.type==="code_execution_20250825"||U.caller.type==="code_execution_20260120")&&U.caller.toolId?{type:U.caller.type,tool_id:U.caller.toolId}:U.caller.type==="direct"?{type:"direct"}:void 0:void 0;x.push({type:"tool_use",id:z.toolCallId,name:z.toolName,input:z.input,...K&&{caller:K},cache_control:F});break}case"tool-result":{let U=f.toProviderToolName(z.toolName);if(o.has(z.toolCallId)){let K=z.output;if(K.type!=="json"&&K.type!=="error-json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}x.push({type:"mcp_tool_result",tool_use_id:z.toolCallId,is_error:K.type==="error-json",content:K.value,cache_control:F})}else if(U==="code_execution"){let K=z.output;if(K.type==="error-text"||K.type==="error-json"){let A={};try{if(typeof K.value==="string")A=JSON.parse(K.value);else if(typeof K.value==="object"&&K.value!==null)A=K.value}catch($){}if(A.type==="code_execution_tool_result_error")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:"code_execution_tool_result_error",error_code:(g=A.errorCode)!=null?g:"unknown"},cache_control:F});else x.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:{type:"bash_code_execution_tool_result_error",error_code:(C=A.errorCode)!=null?C:"unknown"}});break}if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}if(K.value==null||typeof K.value!=="object"||!("type"in K.value)||typeof K.value.type!=="string"){Z.push({type:"other",message:`provider executed tool result output value is not a valid code execution result for tool ${z.toolName}`});break}if(K.value.type==="code_execution_result"){let A=await GG({value:K.value,schema:hG});x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,stdout:A.stdout,stderr:A.stderr,return_code:A.return_code,content:(e=A.content)!=null?e:[]},cache_control:F})}else if(K.value.type==="encrypted_code_execution_result"){let A=await GG({value:K.value,schema:mG});if(A.type==="encrypted_code_execution_result")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,encrypted_stdout:A.encrypted_stdout,stderr:A.stderr,return_code:A.return_code,content:(N=A.content)!=null?N:[]},cache_control:F})}else{let A=await GG({value:K.value,schema:gG});if(A.type==="code_execution_result")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,stdout:A.stdout,stderr:A.stderr,return_code:A.return_code,content:(s=A.content)!=null?s:[]},cache_control:F});else if(A.type==="bash_code_execution_result"||A.type==="bash_code_execution_tool_result_error")x.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:A});else x.push({type:"text_editor_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:A})}break}if(U==="web_fetch"){let K=z.output;if(K.type==="error-json"){let $={};try{if(typeof K.value==="string")$=JSON.parse(K.value);else if(typeof K.value==="object"&&K.value!==null)$=K.value}catch(X){let I=(QG=K.value)==null?void 0:QG.errorCode;$={errorCode:typeof I==="string"?I:"unavailable"}}x.push({type:"web_fetch_tool_result",tool_use_id:z.toolCallId,content:{type:"web_fetch_tool_result_error",error_code:(YG=$.errorCode)!=null?YG:"unavailable"},cache_control:F});break}if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:K.value,schema:_G});x.push({type:"web_fetch_tool_result",tool_use_id:z.toolCallId,content:{type:"web_fetch_result",url:A.url,retrieved_at:A.retrievedAt,content:{type:"document",title:A.content.title,citations:A.content.citations,source:{type:A.content.source.type,media_type:A.content.source.mediaType,data:A.content.source.data}}},cache_control:F});break}if(U==="web_search"){let K=z.output;if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:K.value,schema:vG});x.push({type:"web_search_tool_result",tool_use_id:z.toolCallId,content:A.map(($)=>({url:$.url,title:$.title,page_age:$.pageAge,encrypted_content:$.encryptedContent,type:$.type})),cache_control:F});break}if(U==="tool_search_tool_regex"||U==="tool_search_tool_bm25"){let K=z.output;if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let $=(await GG({value:K.value,schema:dG})).map((X)=>({type:"tool_reference",tool_name:X.toolName}));x.push({type:"tool_search_tool_result",tool_use_id:z.toolCallId,content:{type:"tool_search_tool_search_result",tool_references:$},cache_control:F});break}Z.push({type:"other",message:`provider executed tool result for tool ${z.toolName} is not supported`});break}}}}XG.push({role:"assistant",content:x});break}default:throw Error(`content type: ${ZG}`)}}return{prompt:{system:p,messages:XG},betas:Y}}function TQ(Q){let H=[],Z=void 0;for(let W of Q){let{role:f}=W;switch(f){case"system":{if((Z==null?void 0:Z.type)!=="system")Z={type:"system",messages:[]},H.push(Z);Z.messages.push(W);break}case"assistant":{if((Z==null?void 0:Z.type)!=="assistant")Z={type:"assistant",messages:[]},H.push(Z);Z.messages.push(W);break}case"user":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(W);break}case"tool":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(W);break}default:throw Error(`Unsupported role: ${f}`)}}return H}function DG({finishReason:Q,isJsonResponseFromTool:H}){switch(Q){case"pause_turn":case"end_turn":case"stop_sequence":return"stop";case"refusal":return"content-filter";case"tool_use":return H?"stop":"tool-calls";case"max_tokens":case"model_context_window_exceeded":return"length";case"compaction":return"other";default:return"other"}}function fG(Q,H,Z){var W;if(Q.type==="web_search_result_location")return{type:"source",sourceType:"url",id:Z(),url:Q.url,title:Q.title,providerMetadata:{anthropic:{citedText:Q.cited_text,encryptedIndex:Q.encrypted_index}}};if(Q.type!=="page_location"&&Q.type!=="char_location")return;let f=H[Q.document_index];if(!f)return;return{type:"source",sourceType:"document",id:Z(),mediaType:f.mediaType,title:(W=Q.document_title)!=null?W:f.title,filename:f.filename,providerMetadata:{anthropic:Q.type==="page_location"?{citedText:Q.cited_text,startPageNumber:Q.start_page_number,endPageNumber:Q.end_page_number}:{citedText:Q.cited_text,startCharIndex:Q.start_char_index,endCharIndex:Q.end_char_index}}}}var TX=class{constructor(Q,H){this.specificationVersion="v3";var Z;this.modelId=Q,this.config=H,this.generateId=(Z=H.generateId)!=null?Z:CG}supportsUrl(Q){return Q.protocol==="https:"}get provider(){return this.config.provider}get providerOptionsName(){let Q=this.config.provider,H=Q.indexOf(".");return H===-1?Q:Q.substring(0,H)}get supportedUrls(){var Q,H,Z;return(Z=(H=(Q=this.config).supportedUrls)==null?void 0:H.call(Q))!=null?Z:{}}async getArgs({userSuppliedBetas:Q,prompt:H,maxOutputTokens:Z,temperature:W,topP:f,topK:h,frequencyPenalty:_,presencePenalty:b,stopSequences:l,responseFormat:M,seed:B,tools:u,toolChoice:R,providerOptions:a,stream:E}){var P,v,g,C,e,N,s,QG,YG,Y;let j=[];if(_!=null)j.push({type:"unsupported",feature:"frequencyPenalty"});if(b!=null)j.push({type:"unsupported",feature:"presencePenalty"});if(B!=null)j.push({type:"unsupported",feature:"seed"});if(W!=null&&W>1)j.push({type:"unsupported",feature:"temperature",details:`${W} exceeds anthropic maximum of 1.0. clamped to 1.0`}),W=1;else if(W!=null&&W<0)j.push({type:"unsupported",feature:"temperature",details:`${W} is below anthropic minimum of 0. clamped to 0`}),W=0;if((M==null?void 0:M.type)==="json"){if(M.schema==null)j.push({type:"unsupported",feature:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."})}let w=this.providerOptionsName,p=await LG({provider:"anthropic",providerOptions:a,schema:yG}),XG=w!=="anthropic"?await LG({provider:w,providerOptions:a,schema:yG}):null,zG=XG!=null,L=Object.assign({},p!=null?p:{},XG!=null?XG:{}),{maxOutputTokens:O,supportsStructuredOutput:T,rejectsSamplingParameters:V,isKnownModel:ZG}=OQ(this.modelId);if(V){if(W!=null)j.push({type:"unsupported",feature:"temperature",details:`temperature is not supported by ${this.modelId} and will be ignored`}),W=void 0;if(h!=null)j.push({type:"unsupported",feature:"topK",details:`topK is not supported by ${this.modelId} and will be ignored`}),h=void 0;if(f!=null)j.push({type:"unsupported",feature:"topP",details:`topP is not supported by ${this.modelId} and will be ignored`}),f=void 0}let x=ZG||this.modelId.startsWith("claude-"),o=((P=this.config.supportsNativeStructuredOutput)!=null?P:!0)&&T,t=((v=this.config.supportsStrictTools)!=null?v:!0)&&T,r=(g=L==null?void 0:L.structuredOutputMode)!=null?g:"auto",c=r==="outputFormat"||r==="auto"&&o,y=(M==null?void 0:M.type)==="json"&&M.schema!=null&&!c?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:M.schema}:void 0,n=L==null?void 0:L.contextManagement,z=new VG,m=NG({tools:u,providerToolNames:{"anthropic.code_execution_20250522":"code_execution","anthropic.code_execution_20250825":"code_execution","anthropic.code_execution_20260120":"code_execution","anthropic.computer_20241022":"computer","anthropic.computer_20250124":"computer","anthropic.text_editor_20241022":"str_replace_editor","anthropic.text_editor_20250124":"str_replace_editor","anthropic.text_editor_20250429":"str_replace_based_edit_tool","anthropic.text_editor_20250728":"str_replace_based_edit_tool","anthropic.bash_20241022":"bash","anthropic.bash_20250124":"bash","anthropic.memory_20250818":"memory","anthropic.web_search_20250305":"web_search","anthropic.web_search_20260209":"web_search","anthropic.web_fetch_20250910":"web_fetch","anthropic.web_fetch_20260209":"web_fetch","anthropic.tool_search_regex_20251119":"tool_search_tool_regex","anthropic.tool_search_bm25_20251119":"tool_search_tool_bm25"}}),{prompt:F,betas:U}=await bQ({prompt:H,sendReasoning:(C=L==null?void 0:L.sendReasoning)!=null?C:!0,warnings:j,cacheControlValidator:z,toolNameMapping:m}),K=(e=L==null?void 0:L.thinking)==null?void 0:e.type,A=K==="enabled"||K==="adaptive",$=K==="enabled"?(N=L==null?void 0:L.thinking)==null?void 0:N.budgetTokens:void 0,X=K==="adaptive"?(s=L==null?void 0:L.thinking)==null?void 0:s.display:void 0,I=Z!=null?Z:O,q={model:this.modelId,max_tokens:I,temperature:W,top_k:h,top_p:f,stop_sequences:l,...A&&{thinking:{type:K,...$!=null&&{budget_tokens:$},...X!=null&&{display:X}}},...((L==null?void 0:L.effort)||(L==null?void 0:L.taskBudget)||c&&(M==null?void 0:M.type)==="json"&&M.schema!=null)&&{output_config:{...(L==null?void 0:L.effort)&&{effort:L.effort},...(L==null?void 0:L.taskBudget)&&{task_budget:{type:L.taskBudget.type,total:L.taskBudget.total,...L.taskBudget.remaining!=null&&{remaining:L.taskBudget.remaining}}},...c&&(M==null?void 0:M.type)==="json"&&M.schema!=null&&{format:{type:"json_schema",schema:M.schema}}}},...(L==null?void 0:L.speed)&&{speed:L.speed},...(L==null?void 0:L.inferenceGeo)&&{inference_geo:L.inferenceGeo},...(L==null?void 0:L.cacheControl)&&{cache_control:L.cacheControl},...((QG=L==null?void 0:L.metadata)==null?void 0:QG.userId)!=null&&{metadata:{user_id:L.metadata.userId}},...(L==null?void 0:L.mcpServers)&&L.mcpServers.length>0&&{mcp_servers:L.mcpServers.map((S)=>({type:S.type,name:S.name,url:S.url,authorization_token:S.authorizationToken,tool_configuration:S.toolConfiguration?{allowed_tools:S.toolConfiguration.allowedTools,enabled:S.toolConfiguration.enabled}:void 0}))},...(L==null?void 0:L.container)&&{container:L.container.skills&&L.container.skills.length>0?{id:L.container.id,skills:L.container.skills.map((S)=>({type:S.type,skill_id:S.skillId,version:S.version}))}:L.container.id},system:F.system,messages:F.messages,...n&&{context_management:{edits:n.edits.map((S)=>{let RG=S.type;switch(RG){case"clear_tool_uses_20250919":return{type:S.type,...S.trigger!==void 0&&{trigger:S.trigger},...S.keep!==void 0&&{keep:S.keep},...S.clearAtLeast!==void 0&&{clear_at_least:S.clearAtLeast},...S.clearToolInputs!==void 0&&{clear_tool_inputs:S.clearToolInputs},...S.excludeTools!==void 0&&{exclude_tools:S.excludeTools}};case"clear_thinking_20251015":return{type:S.type,...S.keep!==void 0&&{keep:S.keep}};case"compact_20260112":return{type:S.type,...S.trigger!==void 0&&{trigger:S.trigger},...S.pauseAfterCompaction!==void 0&&{pause_after_compaction:S.pauseAfterCompaction},...S.instructions!==void 0&&{instructions:S.instructions}};default:j.push({type:"other",message:`Unknown context management strategy: ${RG}`});return}}).filter((S)=>S!==void 0)}}};if(A){if(K==="enabled"&&$==null)j.push({type:"compatibility",feature:"extended thinking",details:"thinking budget is required when thinking is enabled. using default budget of 1024 tokens."}),q.thinking={type:"enabled",budget_tokens:1024},$=1024;if(q.temperature!=null)q.temperature=void 0,j.push({type:"unsupported",feature:"temperature",details:"temperature is not supported when thinking is enabled"});if(h!=null)q.top_k=void 0,j.push({type:"unsupported",feature:"topK",details:"topK is not supported when thinking is enabled"});if(f!=null)q.top_p=void 0,j.push({type:"unsupported",feature:"topP",details:"topP is not supported when thinking is enabled"});q.max_tokens=I+($!=null?$:0)}else if(x&&f!=null&&W!=null)j.push({type:"unsupported",feature:"topP",details:"topP is not supported when temperature is set. topP is ignored."}),q.top_p=void 0;if(ZG&&q.max_tokens>O){if(Z!=null)j.push({type:"unsupported",feature:"maxOutputTokens",details:`${q.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${O} max output tokens. The max output tokens have been limited to ${O}.`});q.max_tokens=O}if((L==null?void 0:L.mcpServers)&&L.mcpServers.length>0)U.add("mcp-client-2025-04-04");if(n){if(U.add("context-management-2025-06-27"),n.edits.some((S)=>S.type==="compact_20260112"))U.add("compact-2026-01-12")}if((L==null?void 0:L.container)&&L.container.skills&&L.container.skills.length>0){if(U.add("code-execution-2025-08-25"),U.add("skills-2025-10-02"),U.add("files-api-2025-04-14"),!(u==null?void 0:u.some((S)=>S.type==="provider"&&(S.id==="anthropic.code_execution_20250825"||S.id==="anthropic.code_execution_20260120"))))j.push({type:"other",message:"code execution tool is required when using skills"})}if(L==null?void 0:L.effort)U.add("effort-2025-11-24");if(L==null?void 0:L.taskBudget)U.add("task-budgets-2026-03-13");if((L==null?void 0:L.speed)==="fast")U.add("fast-mode-2026-02-01");let k=E&&((YG=L==null?void 0:L.toolStreaming)!=null?YG:!0),{tools:$G,toolChoice:UG,toolWarnings:AG,betas:uG}=await UQ(y!=null?{tools:[...u!=null?u:[],y],toolChoice:{type:"required"},disableParallelToolUse:!0,cacheControlValidator:z,supportsStructuredOutput:!1,supportsStrictTools:t,defaultEagerInputStreaming:k}:{tools:u!=null?u:[],toolChoice:R,disableParallelToolUse:L==null?void 0:L.disableParallelToolUse,cacheControlValidator:z,supportsStructuredOutput:o,supportsStrictTools:t,defaultEagerInputStreaming:k}),cG=z.getWarnings();return{args:{...q,tools:$G,tool_choice:UG,stream:E===!0?!0:void 0},warnings:[...j,...AG,...cG],betas:new Set([...U,...uG,...Q,...(Y=L==null?void 0:L.anthropicBeta)!=null?Y:[]]),usesJsonResponseTool:y!=null,toolNameMapping:m,providerOptionsName:w,usedCustomProviderKey:zG}}async getHeaders({betas:Q,headers:H}){return wG(await jG(this.config.headers),H,Q.size>0?{"anthropic-beta":Array.from(Q).join(",")}:{})}async getBetasFromHeaders(Q){var H,Z;let f=(H=(await jG(this.config.headers))["anthropic-beta"])!=null?H:"",h=(Z=Q==null?void 0:Q["anthropic-beta"])!=null?Z:"";return new Set([...f.toLowerCase().split(","),...h.toLowerCase().split(",")].map((_)=>_.trim()).filter((_)=>_!==""))}buildRequestUrl(Q){var H,Z,W;return(W=(Z=(H=this.config).buildRequestUrl)==null?void 0:Z.call(H,this.config.baseURL,Q))!=null?W:`${this.config.baseURL}/messages`}transformRequestBody(Q,H){var Z,W,f;return(f=(W=(Z=this.config).transformRequestBody)==null?void 0:W.call(Z,Q,H))!=null?f:Q}extractCitationDocuments(Q){let H=(Z)=>{var W,f;if(Z.type!=="file")return!1;if(Z.mediaType!=="application/pdf"&&Z.mediaType!=="text/plain")return!1;let h=(W=Z.providerOptions)==null?void 0:W.anthropic,_=h==null?void 0:h.citations;return(f=_==null?void 0:_.enabled)!=null?f:!1};return Q.filter((Z)=>Z.role==="user").flatMap((Z)=>Z.content).filter(H).map((Z)=>{var W;let f=Z;return{title:(W=f.filename)!=null?W:"Untitled Document",filename:f.filename,mediaType:f.mediaType}})}async doGenerate(Q){var H,Z,W,f,h,_,b;let{args:l,warnings:M,betas:B,usesJsonResponseTool:u,toolNameMapping:R,providerOptionsName:a,usedCustomProviderKey:E}=await this.getArgs({...Q,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),P=[...this.extractCitationDocuments(Q.prompt)],v=PG(l.tools),{responseHeaders:g,value:C,rawValue:e}=await WG({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:B,headers:Q.headers}),body:this.transformRequestBody(l,B),failedResponseHandler:EG,successfulResponseHandler:kG(lG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),N=[],s={},QG={},YG=!1;for(let Y of C.content)switch(Y.type){case"text":{if(!u){if(N.push({type:"text",text:Y.text}),Y.citations)for(let j of Y.citations){let w=fG(j,P,this.generateId);if(w)N.push(w)}}break}case"thinking":{N.push({type:"reasoning",text:Y.thinking,providerMetadata:{anthropic:{signature:Y.signature}}});break}case"redacted_thinking":{N.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:Y.data}}});break}case"compaction":{N.push({type:"text",text:Y.content,providerMetadata:{anthropic:{type:"compaction"}}});break}case"tool_use":{if(u&&Y.name==="json")YG=!0,N.push({type:"text",text:JSON.stringify(Y.input)});else{let w=Y.caller,p=w?{type:w.type,toolId:"tool_id"in w?w.tool_id:void 0}:void 0;N.push({type:"tool-call",toolCallId:Y.id,toolName:Y.name,input:JSON.stringify(Y.input),...p&&{providerMetadata:{anthropic:{caller:p}}}})}break}case"server_tool_use":{if(Y.name==="text_editor_code_execution"||Y.name==="bash_code_execution")N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName("code_execution"),input:JSON.stringify({type:Y.name,...Y.input}),providerExecuted:!0});else if(Y.name==="web_search"||Y.name==="code_execution"||Y.name==="web_fetch"){let j=Y.name==="code_execution"&&Y.input!=null&&typeof Y.input==="object"&&"code"in Y.input&&!("type"in Y.input)?{type:"programmatic-tool-call",...Y.input}:Y.input;N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(j),providerExecuted:!0,...v&&Y.name==="code_execution"?{dynamic:!0}:{}})}else if(Y.name==="tool_search_tool_regex"||Y.name==="tool_search_tool_bm25")QG[Y.id]=Y.name,N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(Y.input),providerExecuted:!0});break}case"mcp_tool_use":{s[Y.id]={type:"tool-call",toolCallId:Y.id,toolName:Y.name,input:JSON.stringify(Y.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:Y.server_name}}},N.push(s[Y.id]);break}case"mcp_tool_result":{N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:s[Y.tool_use_id].toolName,isError:Y.is_error,result:Y.content,dynamic:!0,providerMetadata:s[Y.tool_use_id].providerMetadata});break}case"web_fetch_tool_result":{if(Y.content.type==="web_fetch_result")P.push({title:(H=Y.content.content.title)!=null?H:Y.content.url,mediaType:Y.content.content.source.media_type}),N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:Y.content.url,retrievedAt:Y.content.retrieved_at,content:{type:Y.content.content.type,title:Y.content.content.title,citations:Y.content.content.citations,source:{type:Y.content.content.source.type,mediaType:Y.content.content.source.media_type,data:Y.content.content.source.data}}}});else if(Y.content.type==="web_fetch_tool_result_error")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:Y.content.error_code}});break}case"web_search_tool_result":{if(Array.isArray(Y.content)){N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),result:Y.content.map((j)=>{var w;return{url:j.url,title:j.title,pageAge:(w=j.page_age)!=null?w:null,encryptedContent:j.encrypted_content,type:j.type}})});for(let j of Y.content)N.push({type:"source",sourceType:"url",id:this.generateId(),url:j.url,title:j.title,providerMetadata:{anthropic:{pageAge:(Z=j.page_age)!=null?Z:null}}})}else N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:Y.content.error_code}});break}case"code_execution_tool_result":{if(Y.content.type==="code_execution_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:{type:Y.content.type,stdout:Y.content.stdout,stderr:Y.content.stderr,return_code:Y.content.return_code,content:(W=Y.content.content)!=null?W:[]}});else if(Y.content.type==="encrypted_code_execution_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:{type:Y.content.type,encrypted_stdout:Y.content.encrypted_stdout,stderr:Y.content.stderr,return_code:Y.content.return_code,content:(f=Y.content.content)!=null?f:[]}});else if(Y.content.type==="code_execution_tool_result_error")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:Y.content.error_code}});break}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:Y.content});break}case"tool_search_tool_result":{let j=QG[Y.tool_use_id];if(j==null){let w=R.toCustomToolName("tool_search_tool_bm25"),p=R.toCustomToolName("tool_search_tool_regex");if(w!=="tool_search_tool_bm25")j="tool_search_tool_bm25";else if(p!=="tool_search_tool_regex")j="tool_search_tool_regex";else j="tool_search_tool_regex"}if(Y.content.type==="tool_search_tool_search_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),result:Y.content.tool_references.map((w)=>({type:w.type,toolName:w.tool_name}))});else N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:Y.content.error_code}});break}}return{content:N,finishReason:{unified:DG({finishReason:C.stop_reason,isJsonResponseFromTool:YG}),raw:(h=C.stop_reason)!=null?h:void 0},usage:IG({usage:C.usage}),request:{body:l},response:{id:(_=C.id)!=null?_:void 0,modelId:(b=C.model)!=null?b:void 0,headers:g,body:e},warnings:M,providerMetadata:(()=>{var Y,j,w,p,XG;let zG={usage:C.usage,cacheCreationInputTokens:(Y=C.usage.cache_creation_input_tokens)!=null?Y:null,stopSequence:(j=C.stop_sequence)!=null?j:null,iterations:C.usage.iterations?C.usage.iterations.map((O)=>({type:O.type,inputTokens:O.input_tokens,outputTokens:O.output_tokens})):null,container:C.container?{expiresAt:C.container.expires_at,id:C.container.id,skills:(p=(w=C.container.skills)==null?void 0:w.map((O)=>({type:O.type,skillId:O.skill_id,version:O.version})))!=null?p:null}:null,contextManagement:(XG=xG(C.context_management))!=null?XG:null},L={anthropic:zG};if(E&&a!=="anthropic")L[a]=zG;return L})()}}async doStream(Q){var H,Z;let{args:W,warnings:f,betas:h,usesJsonResponseTool:_,toolNameMapping:b,providerOptionsName:l,usedCustomProviderKey:M}=await this.getArgs({...Q,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),B=[...this.extractCitationDocuments(Q.prompt)],u=PG(W.tools),R=this.buildRequestUrl(!0),{responseHeaders:a,value:E}=await WG({url:R,headers:await this.getHeaders({betas:h,headers:Q.headers}),body:this.transformRequestBody(W,h),failedResponseHandler:EG,successfulResponseHandler:OG(sG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),P={unified:"other",raw:void 0},v={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},g={},C={},e={},N=null,s=void 0,QG=null,YG=null,Y=null,j=!1,w=void 0,p=this.generateId,XG=E.pipeThrough(new TransformStream({start(T){T.enqueue({type:"stream-start",warnings:f})},transform(T,V){var ZG,x,o,t,r,c,y,n,z,m,F,U,K,A;if(Q.includeRawChunks)V.enqueue({type:"raw",rawValue:T.rawValue});if(!T.success){V.enqueue({type:"error",error:T.error});return}let $=T.value;switch($.type){case"ping":return;case"content_block_start":{let X=$.content_block,I=X.type;switch(w=I,I){case"text":{if(_)return;g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});return}case"thinking":{g[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index)});return}case"redacted_thinking":{g[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index),providerMetadata:{anthropic:{redactedData:X.data}}});return}case"compaction":{g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index),providerMetadata:{anthropic:{type:"compaction"}}});return}case"tool_use":{if(_&&X.name==="json")j=!0,g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});else{let k=X.caller,$G=k?{type:k.type,toolId:"tool_id"in k?k.tool_id:void 0}:void 0,AG=X.input&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";g[$.index]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:AG,firstDelta:AG.length===0,...$G&&{caller:$G}},V.enqueue({type:"tool-input-start",id:X.id,toolName:X.name})}return}case"server_tool_use":{if(["web_fetch","web_search","code_execution","text_editor_code_execution","bash_code_execution"].includes(X.name)){let q=X.name==="text_editor_code_execution"||X.name==="bash_code_execution"?"code_execution":X.name,k=b.toCustomToolName(q),$G=X.input!=null&&typeof X.input==="object"&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";g[$.index]={type:"tool-call",toolCallId:X.id,toolName:k,input:$G,providerExecuted:!0,...u&&q==="code_execution"?{dynamic:!0}:{},firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:k,providerExecuted:!0,...u&&q==="code_execution"?{dynamic:!0}:{}})}else if(X.name==="tool_search_tool_regex"||X.name==="tool_search_tool_bm25"){e[X.id]=X.name;let q=b.toCustomToolName(X.name);g[$.index]={type:"tool-call",toolCallId:X.id,toolName:q,input:"",providerExecuted:!0,firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:q,providerExecuted:!0})}return}case"web_fetch_tool_result":{if(X.content.type==="web_fetch_result")B.push({title:(ZG=X.content.content.title)!=null?ZG:X.content.url,mediaType:X.content.content.source.media_type}),V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:X.content.url,retrievedAt:X.content.retrieved_at,content:{type:X.content.content.type,title:X.content.content.title,citations:X.content.content.citations,source:{type:X.content.content.source.type,mediaType:X.content.content.source.media_type,data:X.content.content.source.data}}}});else if(X.content.type==="web_fetch_tool_result_error")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:X.content.error_code}});return}case"web_search_tool_result":{if(Array.isArray(X.content)){V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_search"),result:X.content.map((q)=>{var k;return{url:q.url,title:q.title,pageAge:(k=q.page_age)!=null?k:null,encryptedContent:q.encrypted_content,type:q.type}})});for(let q of X.content)V.enqueue({type:"source",sourceType:"url",id:p(),url:q.url,title:q.title,providerMetadata:{anthropic:{pageAge:(x=q.page_age)!=null?x:null}}})}else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:X.content.error_code}});return}case"code_execution_tool_result":{if(X.content.type==="code_execution_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:{type:X.content.type,stdout:X.content.stdout,stderr:X.content.stderr,return_code:X.content.return_code,content:(o=X.content.content)!=null?o:[]}});else if(X.content.type==="encrypted_code_execution_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:{type:X.content.type,encrypted_stdout:X.content.encrypted_stdout,stderr:X.content.stderr,return_code:X.content.return_code,content:(t=X.content.content)!=null?t:[]}});else if(X.content.type==="code_execution_tool_result_error")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:X.content.error_code}});return}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:X.content});return}case"tool_search_tool_result":{let q=e[X.tool_use_id];if(q==null){let k=b.toCustomToolName("tool_search_tool_bm25"),$G=b.toCustomToolName("tool_search_tool_regex");if(k!=="tool_search_tool_bm25")q="tool_search_tool_bm25";else if($G!=="tool_search_tool_regex")q="tool_search_tool_regex";else q="tool_search_tool_regex"}if(X.content.type==="tool_search_tool_search_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName(q),result:X.content.tool_references.map((k)=>({type:k.type,toolName:k.tool_name}))});else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName(q),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:X.content.error_code}});return}case"mcp_tool_use":{C[X.id]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:JSON.stringify(X.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:X.server_name}}},V.enqueue(C[X.id]);return}case"mcp_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:C[X.tool_use_id].toolName,isError:X.is_error,result:X.content,dynamic:!0,providerMetadata:C[X.tool_use_id].providerMetadata});return}default:throw Error(`Unsupported content block type: ${I}`)}}case"content_block_stop":{if(g[$.index]!=null){let X=g[$.index];switch(X.type){case"text":{V.enqueue({type:"text-end",id:String($.index)});break}case"reasoning":{V.enqueue({type:"reasoning-end",id:String($.index)});break}case"tool-call":if(!(_&&X.toolName==="json")){V.enqueue({type:"tool-input-end",id:X.toolCallId});let q=X.input===""?"{}":X.input;if(X.providerToolName==="code_execution")try{let k=JSON.parse(q);if(k!=null&&typeof k==="object"&&"code"in k&&!("type"in k))q=JSON.stringify({type:"programmatic-tool-call",...k})}catch(k){}V.enqueue({type:"tool-call",toolCallId:X.toolCallId,toolName:X.toolName,input:q,providerExecuted:X.providerExecuted,...u&&X.providerToolName==="code_execution"?{dynamic:!0}:{},...X.caller&&{providerMetadata:{anthropic:{caller:X.caller}}}})}break}delete g[$.index]}w=void 0;return}case"content_block_delta":{let X=$.delta.type;switch(X){case"text_delta":{if(_)return;V.enqueue({type:"text-delta",id:String($.index),delta:$.delta.text});return}case"thinking_delta":{V.enqueue({type:"reasoning-delta",id:String($.index),delta:$.delta.thinking});return}case"signature_delta":{if(w==="thinking")V.enqueue({type:"reasoning-delta",id:String($.index),delta:"",providerMetadata:{anthropic:{signature:$.delta.signature}}});return}case"compaction_delta":{if($.delta.content!=null)V.enqueue({type:"text-delta",id:String($.index),delta:$.delta.content});return}case"input_json_delta":{let I=g[$.index],q=$.delta.partial_json;if(q.length===0)return;if(j){if((I==null?void 0:I.type)!=="text")return;V.enqueue({type:"text-delta",id:String($.index),delta:q})}else{if((I==null?void 0:I.type)!=="tool-call")return;if(I.firstDelta&&(I.providerToolName==="bash_code_execution"||I.providerToolName==="text_editor_code_execution"))q=`{"type": "${I.providerToolName}",${q.substring(1)}`;V.enqueue({type:"tool-input-delta",id:I.toolCallId,delta:q}),I.input+=q,I.firstDelta=!1}return}case"citations_delta":{let I=$.delta.citation,q=fG(I,B,p);if(q)V.enqueue(q);return}default:throw Error(`Unsupported delta type: ${X}`)}}case"message_start":{if(v.input_tokens=$.message.usage.input_tokens,v.cache_read_input_tokens=(r=$.message.usage.cache_read_input_tokens)!=null?r:0,v.cache_creation_input_tokens=(c=$.message.usage.cache_creation_input_tokens)!=null?c:0,s={...$.message.usage},QG=(y=$.message.usage.cache_creation_input_tokens)!=null?y:null,$.message.container!=null)Y={expiresAt:$.message.container.expires_at,id:$.message.container.id,skills:null};if($.message.stop_reason!=null)P={unified:DG({finishReason:$.message.stop_reason,isJsonResponseFromTool:j}),raw:$.message.stop_reason};if(V.enqueue({type:"response-metadata",id:(n=$.message.id)!=null?n:void 0,modelId:(z=$.message.model)!=null?z:void 0}),$.message.content!=null)for(let X=0;X<$.message.content.length;X++){let I=$.message.content[X];if(I.type==="tool_use"){let q=I.caller,k=q?{type:q.type,toolId:"tool_id"in q?q.tool_id:void 0}:void 0;V.enqueue({type:"tool-input-start",id:I.id,toolName:I.name});let $G=JSON.stringify((m=I.input)!=null?m:{});V.enqueue({type:"tool-input-delta",id:I.id,delta:$G}),V.enqueue({type:"tool-input-end",id:I.id}),V.enqueue({type:"tool-call",toolCallId:I.id,toolName:I.name,input:$G,...k&&{providerMetadata:{anthropic:{caller:k}}}})}}return}case"message_delta":{if($.usage.input_tokens!=null&&v.input_tokens!==$.usage.input_tokens)v.input_tokens=$.usage.input_tokens;if(v.output_tokens=$.usage.output_tokens,$.usage.cache_read_input_tokens!=null)v.cache_read_input_tokens=$.usage.cache_read_input_tokens;if($.usage.cache_creation_input_tokens!=null)v.cache_creation_input_tokens=$.usage.cache_creation_input_tokens,QG=$.usage.cache_creation_input_tokens;if($.usage.iterations!=null)v.iterations=$.usage.iterations;if(P={unified:DG({finishReason:$.delta.stop_reason,isJsonResponseFromTool:j}),raw:(F=$.delta.stop_reason)!=null?F:void 0},YG=(U=$.delta.stop_sequence)!=null?U:null,Y=$.delta.container!=null?{expiresAt:$.delta.container.expires_at,id:$.delta.container.id,skills:(A=(K=$.delta.container.skills)==null?void 0:K.map((X)=>({type:X.type,skillId:X.skill_id,version:X.version})))!=null?A:null}:null,$.context_management)N=xG($.context_management);s={...s,...$.usage};return}case"message_stop":{let X={usage:s!=null?s:null,cacheCreationInputTokens:QG,stopSequence:YG,iterations:v.iterations?v.iterations.map((q)=>({type:q.type,inputTokens:q.input_tokens,outputTokens:q.output_tokens})):null,container:Y,contextManagement:N},I={anthropic:X};if(M&&l!=="anthropic")I[l]=X;V.enqueue({type:"finish",finishReason:P,usage:IG({usage:v,rawUsage:s}),providerMetadata:I});return}case"error":{V.enqueue({type:"error",error:$.error});return}default:throw Error(`Unsupported chunk type: ${$}`)}}})),[zG,L]=XG.tee(),O=zG.getReader();try{await O.read();let T=await O.read();if(((H=T.value)==null?void 0:H.type)==="raw")T=await O.read();if(((Z=T.value)==null?void 0:Z.type)==="error"){let V=T.value.error;throw new BG({message:V.message,url:R,requestBodyValues:W,statusCode:V.type==="overloaded_error"?529:500,responseHeaders:a,responseBody:JSON.stringify(V),isRetryable:V.type==="overloaded_error"})}}finally{O.cancel().catch(()=>{}),O.releaseLock()}return{stream:L,request:{body:W},response:{headers:a}}}};function OQ(Q){if(Q.includes("claude-opus-4-7"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!0,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-6")||Q.includes("claude-opus-4-6"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-5")||Q.includes("claude-opus-4-5")||Q.includes("claude-haiku-4-5"))return{maxOutputTokens:64000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-opus-4-1"))return{maxOutputTokens:32000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-"))return{maxOutputTokens:64000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-opus-4-"))return{maxOutputTokens:32000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-3-haiku"))return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!1}}function PG(Q){if(!Q)return!1;let H=!1,Z=!1;for(let W of Q){if("type"in W&&(W.type==="web_fetch_20260209"||W.type==="web_search_20260209")){H=!0;continue}if(W.name==="code_execution"){Z=!0;break}}return H&&!Z}function xG(Q){return Q?{appliedEdits:Q.applied_edits.map((H)=>{switch(H.type){case"clear_tool_uses_20250919":return{type:H.type,clearedToolUses:H.cleared_tool_uses,clearedInputTokens:H.cleared_input_tokens};case"clear_thinking_20251015":return{type:H.type,clearedThinkingTurns:H.cleared_thinking_turns,clearedInputTokens:H.cleared_input_tokens};case"compact_20260112":return{type:H.type}}}).filter((H)=>H!==void 0)}:null}var kQ=D(()=>J(G.object({command:G.string(),restart:G.boolean().optional()}))),vQ=d({id:"anthropic.bash_20241022",inputSchema:kQ}),_Q=D(()=>J(G.object({command:G.string(),restart:G.boolean().optional()}))),hQ=d({id:"anthropic.bash_20250124",inputSchema:_Q}),gQ=D(()=>J(G.object({action:G.enum(["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","screenshot","cursor_position"]),coordinate:G.array(G.number().int()).optional(),text:G.string().optional()}))),mQ=d({id:"anthropic.computer_20241022",inputSchema:gQ}),dQ=D(()=>J(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),uQ=d({id:"anthropic.computer_20250124",inputSchema:dQ}),cQ=D(()=>J(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot","zoom"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),region:G.tuple([G.number().int(),G.number().int(),G.number().int(),G.number().int()]).optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),iQ=d({id:"anthropic.computer_20251124",inputSchema:cQ}),lQ=D(()=>J(G.discriminatedUnion("command",[G.object({command:G.literal("view"),path:G.string(),view_range:G.tuple([G.number(),G.number()]).optional()}),G.object({command:G.literal("create"),path:G.string(),file_text:G.string()}),G.object({command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()}),G.object({command:G.literal("insert"),path:G.string(),insert_line:G.number(),insert_text:G.string()}),G.object({command:G.literal("delete"),path:G.string()}),G.object({command:G.literal("rename"),old_path:G.string(),new_path:G.string()})]))),sQ=d({id:"anthropic.memory_20250818",inputSchema:lQ}),pQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),nQ=d({id:"anthropic.text_editor_20241022",inputSchema:pQ}),rQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),aQ=d({id:"anthropic.text_editor_20250124",inputSchema:rQ}),eQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),oQ=d({id:"anthropic.text_editor_20250429",inputSchema:eQ}),tQ=D(()=>J(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),GX=D(()=>J(G.object({query:G.string(),limit:G.number().optional()}))),QX=i({id:"anthropic.tool_search_bm25_20251119",inputSchema:GX,outputSchema:tQ,supportsDeferredResults:!0}),XX=(Q={})=>{return QX(Q)},GY={bash_20241022:vQ,bash_20250124:hQ,codeExecution_20250522:SQ,codeExecution_20250825:IQ,codeExecution_20260120:xQ,computer_20241022:mQ,computer_20250124:uQ,computer_20251124:iQ,memory_20250818:sQ,textEditor_20241022:nQ,textEditor_20250124:aQ,textEditor_20250429:oQ,textEditor_20250728:oG,webFetch_20250910:VQ,webFetch_20260209:DQ,webSearch_20250305:LQ,webSearch_20260209:YQ,toolSearchRegex_20251119:NQ,toolSearchBm25_20251119:XX};
|
|
3
3
|
export{UQ as zf,TX as Af,GY as Bf};
|