@qitqode/qitqode-android-arm64 0.2.9 → 0.2.10
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-062chtrq.js +2 -0
- package/bundle/chunk-062vs7bp.js +2 -0
- package/bundle/chunk-08g14hmz.js +2 -0
- package/bundle/{chunk-wgkcyqn1.js → chunk-0bhzhh7s.js} +2 -2
- package/bundle/{chunk-cfwz1hgr.js → chunk-0mwzxqt5.js} +3 -3
- package/bundle/{chunk-mr17tppa.js → chunk-0sfc21qe.js} +2 -2
- package/bundle/{chunk-7adsab4h.js → chunk-0tkznq75.js} +1 -1
- package/bundle/chunk-0w2v8dfy.js +2 -0
- package/bundle/chunk-10fr7a2y.js +2 -0
- package/bundle/chunk-141p12c4.js +4 -0
- package/bundle/chunk-15bjhfav.js +3 -0
- package/bundle/{chunk-92r1gw2j.js → chunk-1h96bk6p.js} +2 -2
- package/bundle/chunk-1hv61m11.js +2 -0
- package/bundle/{chunk-0z1keh2w.js → chunk-1m78yy4k.js} +1 -1
- package/bundle/chunk-1q10jyka.js +29 -0
- package/bundle/{chunk-g4tyaj0m.js → chunk-1r81q7m3.js} +1 -1
- package/bundle/{chunk-29q89bge.js → chunk-2cvwrabw.js} +2 -2
- package/bundle/{chunk-8p0t8qah.js → chunk-2dmcpqak.js} +1 -1
- package/bundle/{chunk-35fj1sfm.js → chunk-2fbkw84y.js} +2 -2
- package/bundle/chunk-2mkvx8b2.js +2 -0
- package/bundle/chunk-2rykfc3a.js +2 -0
- package/bundle/chunk-2w5hx4fs.js +2 -0
- package/bundle/{chunk-t3w43rft.js → chunk-2y5bthrp.js} +1 -1
- package/bundle/chunk-2yy63sxz.js +2 -0
- package/bundle/chunk-2z3fe4qw.js +2 -0
- package/bundle/{chunk-g7v6sp3c.js → chunk-2zjet9tx.js} +2 -2
- package/bundle/{chunk-qgkb6n8k.js → chunk-32xd626h.js} +2 -2
- package/bundle/chunk-361cmmrp.js +2 -0
- package/bundle/{chunk-eg1m81ax.js → chunk-3mtjxmw1.js} +1 -1
- package/bundle/chunk-3r6dq1h3.js +2 -0
- package/bundle/{chunk-wtt5wms9.js → chunk-3sj0jv91.js} +1 -1
- package/bundle/{chunk-hz02vrqs.js → chunk-3vae1s42.js} +1 -1
- package/bundle/{chunk-t18ka1e7.js → chunk-3yfjgks3.js} +1 -1
- package/bundle/{chunk-phf37x1c.js → chunk-3zzrdpsx.js} +1 -1
- package/bundle/chunk-4a12wv2m.js +2 -0
- package/bundle/{chunk-1rgt2vmt.js → chunk-4a9jqe5s.js} +1 -1
- package/bundle/{chunk-wqk1v8t0.js → chunk-4sa9t0vx.js} +2 -2
- package/bundle/{chunk-qbnt4ynd.js → chunk-532fnfmw.js} +2 -2
- package/bundle/chunk-547a55ba.js +2 -0
- package/bundle/{chunk-vr8nwzp0.js → chunk-56yp5v0w.js} +1 -1
- package/bundle/{chunk-ag8wxwwz.js → chunk-5fcyb122.js} +1 -1
- package/bundle/{chunk-4pmvxnkj.js → chunk-5nm5egq0.js} +2 -2
- package/bundle/{chunk-1v0khv7p.js → chunk-5p2r8bxx.js} +1 -1
- package/bundle/{chunk-5bv63rqj.js → chunk-5rqjze1g.js} +1 -1
- package/bundle/{chunk-sy9w1t2y.js → chunk-5w7ebtcd.js} +1 -1
- package/bundle/chunk-5ztmc770.js +2 -0
- package/bundle/{chunk-a1z8rnq7.js → chunk-61t4g8bh.js} +4 -4
- package/bundle/chunk-62x3r2q8.js +2 -0
- package/bundle/chunk-62y6zk9x.js +2 -0
- package/bundle/{chunk-c76cjhn0.js → chunk-6axm2qtj.js} +1 -1
- package/bundle/{chunk-zfrftgcy.js → chunk-6gbdvz6p.js} +1 -1
- package/bundle/{chunk-fa8pwdwv.js → chunk-6mnk5sg3.js} +1 -1
- package/bundle/chunk-6th7vpwm.js +2 -0
- package/bundle/{chunk-8yzghzjq.js → chunk-6wjdhvdf.js} +1 -1
- package/bundle/{chunk-a8bjcvda.js → chunk-6y58jzak.js} +1 -1
- package/bundle/chunk-6ybh5smv.js +2 -0
- package/bundle/chunk-73kprndw.js +2 -0
- package/bundle/chunk-79fr19xf.js +2 -0
- package/bundle/{chunk-3va85mbe.js → chunk-7a3txs9f.js} +2 -2
- package/bundle/chunk-7ezr478e.js +2 -0
- package/bundle/chunk-7gj1vqyj.js +2 -0
- package/bundle/{chunk-eacpc64g.js → chunk-7hdb1fhq.js} +2 -2
- package/bundle/{chunk-t8fjgkp8.js → chunk-7rbg6mg9.js} +2 -2
- package/bundle/{chunk-59csnjc3.js → chunk-7s0nq2aa.js} +2 -2
- package/bundle/chunk-7ywfkwb4.js +2 -0
- package/bundle/chunk-819qr675.js +2 -0
- package/bundle/{chunk-g6y2c5az.js → chunk-81dvy370.js} +1 -1
- package/bundle/chunk-85fnnwm2.js +2 -0
- package/bundle/chunk-89fwh84w.js +2 -0
- package/bundle/chunk-8e724g3k.js +2 -0
- package/bundle/{chunk-k6981ysw.js → chunk-8gpjmj42.js} +3 -3
- package/bundle/{chunk-wtxh5m6j.js → chunk-8nnajdwf.js} +3 -3
- package/bundle/chunk-8peby2d1.js +2 -0
- package/bundle/{chunk-702bt91p.js → chunk-8rkszwxq.js} +6 -6
- package/bundle/{chunk-w0nc0gcx.js → chunk-8v60bqm0.js} +1 -1
- package/bundle/chunk-9894a2yn.js +2 -0
- package/bundle/chunk-98ye2nwt.js +2 -0
- package/bundle/{chunk-48gap82w.js → chunk-9bbwxp5d.js} +1 -1
- package/bundle/{chunk-z0kbyr00.js → chunk-9d0exvey.js} +2 -2
- package/bundle/{chunk-8ysp6vf8.js → chunk-9fjcgdea.js} +1 -1
- package/bundle/{chunk-jpn9zfj5.js → chunk-9nf5650d.js} +1 -1
- package/bundle/{chunk-n6tqtk6h.js → chunk-9pj10pgd.js} +2 -2
- package/bundle/chunk-9s4excg8.js +2 -0
- package/bundle/{chunk-t6zz47zk.js → chunk-9s5h0f1y.js} +2 -2
- package/bundle/{chunk-p8ak162p.js → chunk-9tz18e54.js} +1 -1
- package/bundle/{chunk-fs1vb39f.js → chunk-9zy5tsry.js} +3 -3
- package/bundle/{chunk-bc2krtaf.js → chunk-a70m6kyn.js} +1 -1
- package/bundle/{chunk-cr5tknvb.js → chunk-acsqvgdw.js} +1 -1
- package/bundle/chunk-aetgcegz.js +2 -0
- package/bundle/chunk-agas0nay.js +2 -0
- package/bundle/{chunk-vs3s49jw.js → chunk-ajnzv5jt.js} +2 -2
- package/bundle/{chunk-9cf2ktyh.js → chunk-asxmkyz2.js} +1 -1
- package/bundle/{chunk-0ffmwhw7.js → chunk-at4dge22.js} +1 -1
- package/bundle/{chunk-sa0rrreh.js → chunk-atacnspd.js} +2 -2
- package/bundle/chunk-ayknzc4m.js +2 -0
- package/bundle/chunk-azss4acq.js +3 -0
- package/bundle/chunk-b2ybst88.js +2 -0
- package/bundle/{chunk-cghz0855.js → chunk-b8rzn48q.js} +1 -1
- package/bundle/{chunk-dhvx9p54.js → chunk-b9f78x5g.js} +1 -1
- package/bundle/chunk-bd5vtjd7.js +2 -0
- package/bundle/chunk-bjqqk6jt.js +2 -0
- package/bundle/{chunk-mv7q6ach.js → chunk-brk1jca3.js} +1 -1
- package/bundle/{chunk-5r7c6vvx.js → chunk-by1kwg4r.js} +2 -2
- package/bundle/{chunk-1acn5me8.js → chunk-c1c8ch3g.js} +327 -313
- package/bundle/{chunk-2nheahmq.js → chunk-c2ns2csn.js} +1 -1
- package/bundle/{chunk-qk5vy2pr.js → chunk-c3ey896z.js} +1 -1
- package/bundle/{chunk-b7sr9rn3.js → chunk-c8080519.js} +1 -1
- package/bundle/{chunk-vd8cmdpv.js → chunk-c8yc8qcd.js} +1 -1
- package/bundle/{chunk-nas631g2.js → chunk-c9cngded.js} +1 -1
- package/bundle/{chunk-ejhhrece.js → chunk-ccdjzn2m.js} +3 -3
- package/bundle/{chunk-rk0fnvp5.js → chunk-cdenq7jb.js} +1 -1
- package/bundle/chunk-cpkcdykz.js +2 -0
- package/bundle/{chunk-56wq8cqj.js → chunk-cs825mxr.js} +1 -1
- package/bundle/{chunk-1bxfzd6r.js → chunk-cxtwavyf.js} +4 -4
- package/bundle/chunk-cyafm8d6.js +2 -0
- package/bundle/{chunk-eewe7tx1.js → chunk-d0dsgxk4.js} +2 -2
- package/bundle/{chunk-g3n465ee.js → chunk-d1fv2c7s.js} +2 -2
- package/bundle/{chunk-1p9s5jj1.js → chunk-d1xfv4d3.js} +1 -1
- package/bundle/chunk-d4316r53.js +2 -0
- package/bundle/chunk-d8ym7mcg.js +2 -0
- package/bundle/{chunk-53jstmdp.js → chunk-d9w2bn2e.js} +1 -1
- package/bundle/{chunk-g26redah.js → chunk-dd461rg3.js} +1 -1
- package/bundle/{chunk-e0vrxetq.js → chunk-djfrkbd5.js} +1 -1
- package/bundle/{chunk-mrq35ftw.js → chunk-dm447tgc.js} +2 -2
- package/bundle/{chunk-7pckez5z.js → chunk-dnjyepb2.js} +2 -2
- package/bundle/chunk-dnpjxjkp.js +2 -0
- package/bundle/{chunk-0a4pmkc9.js → chunk-dp6ms01y.js} +2 -2
- package/bundle/{chunk-rdreeyv0.js → chunk-dx7rexx3.js} +3 -3
- package/bundle/{chunk-kre93a89.js → chunk-dz3kcsb6.js} +2 -2
- package/bundle/{chunk-dcv6wj9x.js → chunk-dzma8zvf.js} +2 -2
- package/bundle/{chunk-e2wfj86b.js → chunk-e10c0crf.js} +1 -1
- package/bundle/{chunk-wn63q3xp.js → chunk-e1x1mp9m.js} +1 -1
- package/bundle/{chunk-tk4z6r09.js → chunk-e3mrw0k7.js} +1 -1
- package/bundle/chunk-e5gjqtby.js +2 -0
- package/bundle/{chunk-3z2zn8rj.js → chunk-e72jwbfc.js} +1 -1
- package/bundle/{chunk-85wh85pk.js → chunk-eabbrt1p.js} +1 -1
- package/bundle/{chunk-jr80q31w.js → chunk-ecz4h0a2.js} +1 -1
- package/bundle/chunk-ee3mqzms.js +2 -0
- package/bundle/chunk-eme9xmh3.js +2 -0
- package/bundle/{chunk-cf9m9m9q.js → chunk-eqpep2m2.js} +1 -1
- package/bundle/chunk-er5f61s5.js +2 -0
- package/bundle/chunk-er716522.js +2 -0
- package/bundle/{chunk-qgek59e6.js → chunk-ev6jwt7q.js} +1 -1
- package/bundle/chunk-ez3gacqe.js +2 -0
- package/bundle/{chunk-ax64ngf2.js → chunk-f0ab2f28.js} +1 -1
- package/bundle/{chunk-ggncq8w8.js → chunk-f17se3hh.js} +1 -1
- package/bundle/chunk-f3y5kr76.js +14 -0
- package/bundle/{chunk-vsqvnxbz.js → chunk-f6btedtt.js} +1 -1
- package/bundle/{chunk-nsp1za8t.js → chunk-f6vy70p6.js} +2 -2
- package/bundle/{chunk-0s4cp6q2.js → chunk-ff8q10gk.js} +2 -2
- package/bundle/chunk-fkc7wf1p.js +2 -0
- package/bundle/chunk-fm6z8nqb.js +2 -0
- package/bundle/{chunk-fw1f47de.js → chunk-fsndgr9a.js} +1 -1
- package/bundle/{chunk-pqg1wjb5.js → chunk-fvv1cret.js} +1 -1
- package/bundle/{chunk-j10a984e.js → chunk-g08qj9z3.js} +2 -2
- package/bundle/chunk-g0qwm23d.js +2 -0
- package/bundle/chunk-g4yn8cj8.js +2 -0
- package/bundle/{chunk-rwwvy89t.js → chunk-g52wmt1v.js} +1 -1
- package/bundle/{chunk-trstb8ee.js → chunk-gb51fn3r.js} +1 -1
- package/bundle/{chunk-kgv68cpb.js → chunk-gbnf7zf9.js} +1 -1
- package/bundle/{chunk-0w19vmd7.js → chunk-ge7csm6m.js} +2 -2
- package/bundle/{chunk-bkfafcbw.js → chunk-gksbv613.js} +2 -2
- package/bundle/{chunk-afr8m0q1.js → chunk-gmq1kwn0.js} +1 -1
- package/bundle/{chunk-b5ym419d.js → chunk-gq3zb4wv.js} +2 -2
- package/bundle/{chunk-tbx741en.js → chunk-gqgjybjc.js} +1 -1
- package/bundle/{chunk-bhg69t69.js → chunk-gx4v8z64.js} +2 -2
- package/bundle/{chunk-sm1g81cv.js → chunk-h0pvxre5.js} +1 -1
- package/bundle/chunk-h1spsy3y.js +2 -0
- package/bundle/{chunk-sbjymf20.js → chunk-h2p984qb.js} +2 -2
- package/bundle/{chunk-gznt3dv8.js → chunk-h6z86aay.js} +1 -1
- package/bundle/chunk-h8gkv40j.js +2 -0
- package/bundle/{chunk-zsg29gba.js → chunk-h91zmzs5.js} +1 -1
- package/bundle/{chunk-zrhw1szj.js → chunk-hgm8yfcb.js} +1 -1
- package/bundle/chunk-j59kmb49.js +2 -0
- package/bundle/chunk-j5z95b6f.js +3 -0
- package/bundle/{chunk-52xvhxek.js → chunk-j7637cwg.js} +2 -2
- package/bundle/{chunk-rwnwjm82.js → chunk-jbcqhw3x.js} +2 -2
- package/bundle/{chunk-maa21rh9.js → chunk-je8fcsa9.js} +1 -1
- package/bundle/{chunk-y0h3jfkj.js → chunk-jt6bvxtr.js} +1 -1
- package/bundle/chunk-jv37ghev.js +2 -0
- package/bundle/chunk-k10rtgsk.js +5 -0
- package/bundle/chunk-k3hcb6qf.js +2 -0
- package/bundle/chunk-k5d822n2.js +3 -0
- package/bundle/{chunk-2vaphpz0.js → chunk-kc8n5cgb.js} +1 -1
- package/bundle/chunk-kcqeh1e5.js +2 -0
- package/bundle/{chunk-5xkp27b1.js → chunk-kds2g7r2.js} +1 -1
- package/bundle/{chunk-scnbt714.js → chunk-kec1xw1n.js} +1 -1
- package/bundle/{chunk-13jq2ygc.js → chunk-kk850sdw.js} +2 -2
- package/bundle/{chunk-3bb4aqh9.js → chunk-m01h6kk1.js} +1 -1
- package/bundle/{chunk-e0hha3be.js → chunk-m4j6t713.js} +1 -1
- package/bundle/chunk-m8ytbq04.js +2 -0
- package/bundle/chunk-mf9nc4xz.js +2 -0
- package/bundle/{chunk-7thhd7ds.js → chunk-mmqyter3.js} +1 -1
- package/bundle/{chunk-y31f8k5f.js → chunk-mn0pshpv.js} +1 -1
- package/bundle/{chunk-s2tc3qs0.js → chunk-mn5cacf6.js} +2 -2
- package/bundle/{chunk-0egrckx0.js → chunk-mp1x10t5.js} +2 -2
- package/bundle/chunk-mxby91bj.js +2 -0
- package/bundle/chunk-mzv1gh6f.js +2 -0
- package/bundle/chunk-n0hsvvw8.js +2 -0
- package/bundle/{chunk-az3nss5m.js → chunk-ngyv4fhn.js} +2 -2
- package/bundle/{chunk-g9nwqwqp.js → chunk-nh4zk07t.js} +1 -1
- package/bundle/{chunk-8jmb5bd4.js → chunk-nk5vrenn.js} +2 -2
- package/bundle/chunk-nm1v9z14.js +2 -0
- package/bundle/chunk-nnkfdhh9.js +2 -0
- package/bundle/{chunk-jqj1ay7x.js → chunk-npdgfqaw.js} +1 -1
- package/bundle/{chunk-p2fte9vz.js → chunk-nq4x6792.js} +2 -2
- package/bundle/{chunk-wr6rnxr5.js → chunk-nqk8d62j.js} +1 -1
- package/bundle/{chunk-7jy53zqy.js → chunk-p506eydh.js} +1 -1
- package/bundle/{chunk-phpxxd48.js → chunk-p6jf1fyt.js} +1 -1
- package/bundle/chunk-p7nstcxa.js +2 -0
- package/bundle/{chunk-6ps30qax.js → chunk-pbanj1gk.js} +2 -2
- package/bundle/{chunk-vph4w4yy.js → chunk-pchv413c.js} +2 -2
- package/bundle/{chunk-qsme16gk.js → chunk-pf2vq6t1.js} +2 -2
- package/bundle/chunk-pfwkvv7g.js +2 -0
- package/bundle/{chunk-ntr0ezf2.js → chunk-pky8h8rh.js} +1 -1
- package/bundle/chunk-pn1jz8qj.js +2 -0
- package/bundle/chunk-pqvmtfk7.js +2 -0
- package/bundle/chunk-prgw26g3.js +2 -0
- package/bundle/{chunk-kckr30tf.js → chunk-psqtptrs.js} +1 -1
- package/bundle/chunk-pv9ty6v7.js +2 -0
- package/bundle/{chunk-060wbpz4.js → chunk-pwsajn96.js} +1 -1
- package/bundle/{chunk-vgt3artc.js → chunk-pxm0x3e0.js} +1 -1
- package/bundle/chunk-pyf649pz.js +2 -0
- package/bundle/{chunk-wd8f9r4k.js → chunk-q0xgxygw.js} +1 -1
- package/bundle/{chunk-rye1yjnr.js → chunk-q26s0wb5.js} +1 -1
- package/bundle/{chunk-a48mx917.js → chunk-q4mtwv1w.js} +2 -2
- package/bundle/chunk-q4rstre7.js +2 -0
- package/bundle/chunk-q6jk2v6g.js +2 -0
- package/bundle/{chunk-5wx962mw.js → chunk-q7s6z0nz.js} +1 -1
- package/bundle/{chunk-jmmtcr2r.js → chunk-q8fjktv4.js} +1 -1
- package/bundle/{chunk-m7tmgvh6.js → chunk-qbewhcsz.js} +1 -1
- package/bundle/chunk-qd43npx3.js +2 -0
- package/bundle/{chunk-ydgst3h8.js → chunk-qdafm7qg.js} +2 -2
- package/bundle/chunk-qdb21y83.js +2 -0
- package/bundle/{chunk-72crs18f.js → chunk-qdbx1qkr.js} +1 -1
- package/bundle/{chunk-6vnqbejg.js → chunk-qdh2dm62.js} +1 -1
- package/bundle/chunk-qeksaefy.js +2 -0
- package/bundle/{chunk-qk1jkc0n.js → chunk-qjw2zcq5.js} +1 -1
- package/bundle/{chunk-dt3bsmfe.js → chunk-qm9fm5ja.js} +2 -2
- package/bundle/{chunk-h8mfbbjh.js → chunk-qq9yc2tp.js} +2 -2
- package/bundle/{chunk-0tcggtwv.js → chunk-qtyapmy7.js} +1 -1
- package/bundle/{chunk-c987bemn.js → chunk-qyan69nb.js} +1 -1
- package/bundle/chunk-r7t9yb9d.js +2 -0
- package/bundle/{chunk-6tqbnxar.js → chunk-r81w6skn.js} +1 -1
- package/bundle/{chunk-f4mnp6xd.js → chunk-rk21wv4k.js} +1 -1
- package/bundle/{chunk-ccf4pgkr.js → chunk-rpdgn9z3.js} +2 -2
- package/bundle/chunk-rxnd79h7.js +7 -0
- package/bundle/chunk-s05hqtx1.js +3 -0
- package/bundle/chunk-s27cz24e.js +808 -0
- package/bundle/chunk-sdv3a4w3.js +2 -0
- package/bundle/{chunk-zwhmg9dj.js → chunk-se8d5xg9.js} +1 -1
- package/bundle/chunk-sk89becn.js +2 -0
- package/bundle/{chunk-sz0favtz.js → chunk-snf6ahg7.js} +1 -1
- package/bundle/{chunk-dgcannw0.js → chunk-t2r51r6v.js} +1 -1
- package/bundle/{chunk-rva2ekrt.js → chunk-t5wdstzv.js} +1 -1
- package/bundle/{chunk-vkkz40je.js → chunk-t9pq363q.js} +2 -2
- package/bundle/chunk-tc0996xz.js +2 -0
- package/bundle/chunk-td9hm9be.js +2 -0
- package/bundle/{chunk-xy8arehp.js → chunk-tdevq564.js} +1 -1
- package/bundle/chunk-te91d271.js +2 -0
- package/bundle/chunk-tfs50mgj.js +2 -0
- package/bundle/{chunk-5cw8235e.js → chunk-tg1f56s3.js} +1 -1
- package/bundle/chunk-thecq33z.js +3 -0
- package/bundle/{chunk-f2v4g7t1.js → chunk-tjfer79w.js} +1 -1
- package/bundle/chunk-tjvtp9d9.js +2 -0
- package/bundle/chunk-tkm9m3n0.js +2 -0
- package/bundle/{chunk-ynf17943.js → chunk-tm79yrf3.js} +2 -2
- package/bundle/{chunk-fv5mrdyc.js → chunk-v03xq38e.js} +2 -2
- package/bundle/chunk-v0hnn7nb.js +2 -0
- package/bundle/{chunk-ftvvm4r5.js → chunk-v16n1fep.js} +2 -2
- package/bundle/chunk-v1s1rcqx.js +2 -0
- package/bundle/chunk-v4dt4062.js +2 -0
- package/bundle/{chunk-makegrxs.js → chunk-v8bxj01h.js} +1 -1
- package/bundle/{chunk-ryrxgn6d.js → chunk-v8rqgt7h.js} +1 -1
- package/bundle/{chunk-m4r8sepw.js → chunk-vbb1jg02.js} +1 -1
- package/bundle/{chunk-2kh0tg92.js → chunk-vbfc0wgv.js} +2 -2
- package/bundle/{chunk-d839fr0w.js → chunk-vjt6mh10.js} +2 -2
- package/bundle/{chunk-gsg6zn7e.js → chunk-vk35g121.js} +2 -2
- package/bundle/{chunk-dwkrqtbc.js → chunk-vsfj16v9.js} +2 -2
- package/bundle/{chunk-zqdjk4rf.js → chunk-vy93mn7d.js} +2 -2
- package/bundle/{chunk-1har4t9a.js → chunk-waa781eh.js} +1 -1
- package/bundle/{chunk-wb47k8ah.js → chunk-wbt31xap.js} +2 -2
- package/bundle/{chunk-0tm6589k.js → chunk-wd2xmkdp.js} +2 -2
- package/bundle/{chunk-fej5x648.js → chunk-wecs14rz.js} +1 -1
- package/bundle/chunk-wgrq86kd.js +2 -0
- package/bundle/{chunk-4y9wbfd2.js → chunk-wh2qqhep.js} +2 -2
- package/bundle/{chunk-g878zd6e.js → chunk-x0hhw46n.js} +1 -1
- package/bundle/{chunk-w7a33cwa.js → chunk-x308f9j4.js} +2 -2
- package/bundle/{chunk-y3gy62q5.js → chunk-x50adh71.js} +1 -1
- package/bundle/chunk-x8ks2bn7.js +2 -0
- package/bundle/{chunk-s5aefff0.js → chunk-xcmbxny8.js} +1 -1
- package/bundle/{chunk-rmsqb6r4.js → chunk-xgf4k9q7.js} +1 -1
- package/bundle/{chunk-2caaqmec.js → chunk-xj0zc9za.js} +1 -1
- package/bundle/{chunk-27saej0r.js → chunk-xnxw5zz9.js} +2 -2
- package/bundle/{chunk-fjftb2sz.js → chunk-xqwk2zsx.js} +2 -2
- package/bundle/{chunk-d30k7dpf.js → chunk-xstxdw7v.js} +1 -1
- package/bundle/{chunk-dwqvcdmf.js → chunk-xv03hbgj.js} +1 -1
- package/bundle/{chunk-bwadggys.js → chunk-xvvt886p.js} +2 -2
- package/bundle/{chunk-bnw744ej.js → chunk-xy2ty5h5.js} +2 -2
- package/bundle/{chunk-wm9nh9nb.js → chunk-yce8ph5b.js} +2 -2
- package/bundle/{chunk-fh3d0wce.js → chunk-yexzxx6f.js} +1 -1
- package/bundle/{chunk-eyr5ymt8.js → chunk-yh1t6jrj.js} +1 -1
- package/bundle/chunk-yspstxkq.js +2 -0
- package/bundle/{chunk-ykpj10nz.js → chunk-yydqavgh.js} +2 -2
- package/bundle/{chunk-k3m7jfdh.js → chunk-yzd6cyep.js} +1 -1
- package/bundle/chunk-z023h7t8.js +2 -0
- package/bundle/chunk-z0383stv.js +2 -0
- package/bundle/{chunk-vbfej8ds.js → chunk-z0m1qm7j.js} +2 -2
- package/bundle/{chunk-bpfq8fz4.js → chunk-z69tt390.js} +1 -1
- package/bundle/chunk-zewrmk8x.js +2 -0
- package/bundle/{chunk-29gwtcey.js → chunk-zfqgh9h7.js} +1 -1
- package/bundle/{chunk-h1bvqstw.js → chunk-zskdxbbh.js} +1 -1
- package/bundle/{chunk-kveztc6k.js → chunk-ztvkzex1.js} +1 -1
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-03zpnwk2.js +0 -2
- package/bundle/chunk-0aqdzyar.js +0 -2
- package/bundle/chunk-0eh3yc6e.js +0 -2
- package/bundle/chunk-0mh600tv.js +0 -2
- package/bundle/chunk-1a6q1f5n.js +0 -7
- package/bundle/chunk-2a5gjgvp.js +0 -2
- package/bundle/chunk-2phyc1c0.js +0 -2
- package/bundle/chunk-2pkfphgb.js +0 -2
- package/bundle/chunk-30wp95w1.js +0 -2
- package/bundle/chunk-32fpqd0n.js +0 -2
- package/bundle/chunk-3f2cjzb4.js +0 -2
- package/bundle/chunk-3qvap1kv.js +0 -2
- package/bundle/chunk-42hvspe7.js +0 -2
- package/bundle/chunk-452tk6v3.js +0 -2
- package/bundle/chunk-4gqb1hps.js +0 -2
- package/bundle/chunk-50qgz5ka.js +0 -2
- package/bundle/chunk-539cw9r0.js +0 -2
- package/bundle/chunk-5b0xyq5z.js +0 -2
- package/bundle/chunk-5j4nxpdy.js +0 -2
- package/bundle/chunk-5nxgk6hw.js +0 -2
- package/bundle/chunk-5qkvhr6y.js +0 -2
- package/bundle/chunk-6dpdkzrk.js +0 -2
- package/bundle/chunk-6p6m5956.js +0 -3
- package/bundle/chunk-705qkpra.js +0 -28
- package/bundle/chunk-76c400ze.js +0 -2
- package/bundle/chunk-7bxxc4a3.js +0 -2
- package/bundle/chunk-7g59hc61.js +0 -2
- package/bundle/chunk-7p88j56s.js +0 -2
- package/bundle/chunk-7r92d7v9.js +0 -14
- package/bundle/chunk-7trngc9g.js +0 -2
- package/bundle/chunk-8cebbmtf.js +0 -2
- package/bundle/chunk-8j1xcdmd.js +0 -2
- package/bundle/chunk-90r2z49k.js +0 -2
- package/bundle/chunk-94mjwy22.js +0 -2
- package/bundle/chunk-9bw6bx5c.js +0 -2
- package/bundle/chunk-aenrd7dk.js +0 -2
- package/bundle/chunk-ahmy80vb.js +0 -2
- package/bundle/chunk-avn12jkt.js +0 -2
- package/bundle/chunk-brk6bge4.js +0 -3
- package/bundle/chunk-ce5e7j62.js +0 -2
- package/bundle/chunk-cw1gwjx9.js +0 -2
- package/bundle/chunk-czw30fjs.js +0 -2
- package/bundle/chunk-dtcvqrmn.js +0 -2
- package/bundle/chunk-dwhsvpag.js +0 -2
- package/bundle/chunk-e0hfpdje.js +0 -2
- package/bundle/chunk-e5jk67xh.js +0 -2
- package/bundle/chunk-eg4pq4hv.js +0 -2
- package/bundle/chunk-ew3yz97p.js +0 -2
- package/bundle/chunk-f2yfyhh8.js +0 -2
- package/bundle/chunk-fd8x2nb4.js +0 -2
- package/bundle/chunk-fveaq0pb.js +0 -2
- package/bundle/chunk-gbvm6dpv.js +0 -2
- package/bundle/chunk-gkbx6edf.js +0 -2
- package/bundle/chunk-gq9hb2e8.js +0 -2
- package/bundle/chunk-gswhjd1h.js +0 -3
- package/bundle/chunk-h5w91zr4.js +0 -2
- package/bundle/chunk-hmpb3c21.js +0 -2
- package/bundle/chunk-hq7s4f75.js +0 -2
- package/bundle/chunk-j1h64m65.js +0 -2
- package/bundle/chunk-j32rr7rt.js +0 -2
- package/bundle/chunk-j871xzr7.js +0 -2
- package/bundle/chunk-k1qd8ecm.js +0 -808
- package/bundle/chunk-kx88qekb.js +0 -2
- package/bundle/chunk-m4g4djss.js +0 -2
- package/bundle/chunk-mt2by7rx.js +0 -3
- package/bundle/chunk-mwkms65j.js +0 -3
- package/bundle/chunk-n61e0znt.js +0 -2
- package/bundle/chunk-ndd4cn3z.js +0 -2
- package/bundle/chunk-nr2j8ytn.js +0 -3
- package/bundle/chunk-nsw5x43k.js +0 -2
- package/bundle/chunk-p5b5ekhh.js +0 -2
- package/bundle/chunk-pf23nw4z.js +0 -2
- package/bundle/chunk-pw3cv89g.js +0 -2
- package/bundle/chunk-qwmae3vk.js +0 -5
- package/bundle/chunk-rdk62809.js +0 -2
- package/bundle/chunk-rew6r516.js +0 -2
- package/bundle/chunk-rjcz4kbm.js +0 -2
- package/bundle/chunk-skgr9ypq.js +0 -2
- package/bundle/chunk-sv40pwe2.js +0 -2
- package/bundle/chunk-tax3ecy5.js +0 -2
- package/bundle/chunk-tfhpjmny.js +0 -2
- package/bundle/chunk-tnete6ye.js +0 -2
- package/bundle/chunk-tpyq7ycb.js +0 -2
- package/bundle/chunk-tr0rm1ka.js +0 -2
- package/bundle/chunk-ty14zznd.js +0 -2
- package/bundle/chunk-v5h5wxw5.js +0 -2
- package/bundle/chunk-v6141yq1.js +0 -2
- package/bundle/chunk-vjs69r6x.js +0 -2
- package/bundle/chunk-vmhar83s.js +0 -2
- package/bundle/chunk-vpjyk76v.js +0 -2
- package/bundle/chunk-vqvnw12p.js +0 -2
- package/bundle/chunk-w0sztk4y.js +0 -2
- package/bundle/chunk-w6bb320d.js +0 -2
- package/bundle/chunk-wqw6yjrg.js +0 -2
- package/bundle/chunk-ws08rxge.js +0 -2
- package/bundle/chunk-wwvek9zf.js +0 -3
- package/bundle/chunk-wz3dvc3g.js +0 -2
- package/bundle/chunk-x2pmqvdc.js +0 -2
- package/bundle/chunk-x4wfq39v.js +0 -2
- package/bundle/chunk-x7a3kqe5.js +0 -2
- package/bundle/chunk-xb22grz6.js +0 -2
- package/bundle/chunk-y3eeva80.js +0 -2
- package/bundle/chunk-yb6m08zj.js +0 -2
- package/bundle/chunk-ybcqkgs7.js +0 -2
- package/bundle/chunk-zj1jc1xt.js +0 -2
- package/bundle/chunk-zm0m0504.js +0 -2
- package/bundle/chunk-zq32jhj1.js +0 -2
- package/bundle/chunk-zxwjxszn.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{o as
|
|
2
|
+
import{Lt as n}from"./chunk-7s0nq2aa.js";function s(e){let r=e?.password??n.QITQODE_SERVER_PASSWORD;if(!r)return;let t=e?.username??n.QITQODE_SERVER_USERNAME??"qitqode";return`Basic ${Buffer.from(`${t}:${r}`).toString("base64")}`}function o(e){let r=s(e);if(!r)return;return{Authorization:r}}
|
|
3
|
+
export{o as aa};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{uP as U}from"./chunk-djfrkbd5.js";import{dlopen as S,FFIType as x,ptr as M}from"bun:ffi";import{Buffer as G}from"buffer";class O{listeners=[];event=(z)=>{return this.listeners.push(z),{dispose:()=>{let H=this.listeners.indexOf(z);if(H!==-1)this.listeners.splice(H,1)}}};fire(z){for(let H of this.listeners)H(z)}}import{join as Y,dirname as R,basename as L}from"path";import{existsSync as j}from"fs";var k=80,N=24,_="sh",B="xterm";function P(z){if(z.length===0)return"''";return`'${z.replace(/'/g,"'\\''")}'`}function v(){let z=process.env.BUN_PTY_LIB;if(z&&j(z))return z;try{let q=U(`../rust-pty/target/release/${process.platform==="win32"?"rust_pty.dll":process.platform==="darwin"?process.arch==="arm64"?"librust_pty_arm64.dylib":"librust_pty.dylib":process.arch==="arm64"?"librust_pty_arm64.so":"librust_pty.so"}`);if(q)return q}catch{}let{platform:H,arch:J}=process,X=H==="darwin"?J==="arm64"?["librust_pty_arm64.dylib","librust_pty.dylib"]:["librust_pty.dylib"]:H==="win32"?["rust_pty.dll"]:J==="arm64"?["librust_pty_arm64.so","librust_pty.so"]:["librust_pty.so"],V=Bun.fileURLToPath(import.meta.url),$=R(V),W=L($),K=W==="src"||W==="dist"?R($):$,w=[Y(K,"rust-pty","target","release"),Y(K,"..","bun-pty","rust-pty","target","release"),Y(process.cwd(),"node_modules","bun-pty","rust-pty","target","release")],C=[];for(let q of w)for(let A of X)C.push(Y(q,A));for(let q of C)if(j(q))return q;throw Error(`librust_pty shared library not found.
|
|
3
3
|
Checked:
|
|
4
4
|
- BUN_PTY_LIB=${z??"<unset>"}
|
|
5
5
|
- ${C.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ap as UG,Bp as hG,Cp as gG,Dp as mG,Hp as dG,Io as CG,Jo as bG,No as TG,Po as jG,Yo as AG,bp as OG,dp as kG,fp as vG,gp as _G,jp as J,mp as W,np as GG,tp as LG,up as VG,yp as u,zp as l}from"./chunk-wm9nh9nb.js";import{Kp as NG,Np as MG,Tp as WG,Wp as HG}from"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import{Kt as G}from"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-e0vrxetq.js";var aG="3.0.71",eG=J(()=>W(G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}))),yG=hG({errorSchema:eG,errorToMessage:(Q)=>Q.error.message}),oG=J(()=>W(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()}))),tG=J(()=>W(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")})]))),GQ=J(()=>W(G.object({signature:G.string().optional(),redactedData:G.string().optional()}))),FG=G.object({citations:G.object({enabled:G.boolean()}).optional(),title:G.string().optional(),context:G.string().optional()}),xG=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()}),PG=4;function QQ(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 RG=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(Q,H){let Z=QQ(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>PG){this.warnings.push({type:"unsupported",feature:"cacheControl breakpoint limit",details:`Maximum ${PG} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return Z}getWarnings(){return this.warnings}},XQ=J(()=>W(G.object({maxCharacters:G.number().optional()}))),YQ=J(()=>W(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()}))),ZQ=u({id:"anthropic.text_editor_20250728",inputSchema:YQ}),$Q=(Q={})=>{return ZQ(Q)},zQ=J(()=>W(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()}))),LQ=J(()=>W(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),HQ=J(()=>W(G.object({query:G.string()}))),qQ=l({id:"anthropic.web_search_20260209",inputSchema:HQ,outputSchema:LQ,supportsDeferredResults:!0}),AQ=(Q={})=>{return qQ(Q)},KQ=J(()=>W(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()}))),uG=J(()=>W(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),DQ=J(()=>W(G.object({query:G.string()}))),JQ=l({id:"anthropic.web_search_20250305",inputSchema:DQ,outputSchema:uG,supportsDeferredResults:!0}),WQ=(Q={})=>{return JQ(Q)},jQ=J(()=>W(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()}))),VQ=J(()=>W(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()}))),UQ=J(()=>W(G.object({url:G.string()}))),RQ=l({id:"anthropic.web_fetch_20260209",inputSchema:UQ,outputSchema:VQ,supportsDeferredResults:!0}),EQ=(Q={})=>{return RQ(Q)},SQ=J(()=>W(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()}))),cG=J(()=>W(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()}))),yQ=J(()=>W(G.object({url:G.string()}))),FQ=l({id:"anthropic.web_fetch_20250910",inputSchema:yQ,outputSchema:cG,supportsDeferredResults:!0}),xQ=(Q={})=>{return FQ(Q)};async function PQ({tools:Q,toolChoice:H,disableParallelToolUse:Z,cacheControlValidator:q,supportsStructuredOutput:E,supportsStrictTools:T,defaultEagerInputStreaming:b=!1}){var F,h;Q=(Q==null?void 0:Q.length)?Q:void 0;let w=[],N=new Set,c=q||new RG;if(Q==null)return{tools:void 0,toolChoice:void 0,toolWarnings:w,betas:N};let R=[];for(let S of Q)switch(S.type){case"function":{let B=c.getCacheControl(S.providerOptions,{type:"tool definition",canCache:!0}),g=(F=S.providerOptions)==null?void 0:F.anthropic,m=(h=g==null?void 0:g.eagerInputStreaming)!=null?h:b,O=g==null?void 0:g.deferLoading,e=g==null?void 0:g.allowedCallers;if(!T&&S.strict!=null)w.push({type:"unsupported",feature:"strict",details:`Tool '${S.name}' has strict: ${S.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`});if(R.push({name:S.name,description:S.description,input_schema:S.inputSchema,cache_control:B,...m?{eager_input_streaming:!0}:{},...T===!0&&S.strict!=null?{strict:S.strict}:{},...O!=null?{defer_loading:O}:{},...e!=null?{allowed_callers:e}:{},...S.inputExamples!=null?{input_examples:S.inputExamples.map((C)=>C.input)}:{}}),E===!0)N.add("structured-outputs-2025-11-13");if(S.inputExamples!=null||e!=null)N.add("advanced-tool-use-2025-11-20");break}case"provider":{switch(S.id){case"anthropic.code_execution_20250522":{N.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":{N.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":{N.add("computer-use-2025-01-24"),R.push({name:"computer",type:"computer_20250124",display_width_px:S.args.displayWidthPx,display_height_px:S.args.displayHeightPx,display_number:S.args.displayNumber,cache_control:void 0});break}case"anthropic.computer_20251124":{N.add("computer-use-2025-11-24"),R.push({name:"computer",type:"computer_20251124",display_width_px:S.args.displayWidthPx,display_height_px:S.args.displayHeightPx,display_number:S.args.displayNumber,enable_zoom:S.args.enableZoom,cache_control:void 0});break}case"anthropic.computer_20241022":{N.add("computer-use-2024-10-22"),R.push({name:"computer",type:"computer_20241022",display_width_px:S.args.displayWidthPx,display_height_px:S.args.displayHeightPx,display_number:S.args.displayNumber,cache_control:void 0});break}case"anthropic.text_editor_20250124":{N.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":{N.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":{N.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 B=await GG({value:S.args,schema:XQ});R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:B.maxCharacters,cache_control:void 0});break}case"anthropic.bash_20250124":{N.add("computer-use-2025-01-24"),R.push({name:"bash",type:"bash_20250124",cache_control:void 0});break}case"anthropic.bash_20241022":{N.add("computer-use-2024-10-22"),R.push({name:"bash",type:"bash_20241022",cache_control:void 0});break}case"anthropic.memory_20250818":{N.add("context-management-2025-06-27"),R.push({name:"memory",type:"memory_20250818"});break}case"anthropic.web_fetch_20250910":{N.add("web-fetch-2025-09-10");let B=await GG({value:S.args,schema:SQ});R.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:B.maxUses,allowed_domains:B.allowedDomains,blocked_domains:B.blockedDomains,citations:B.citations,max_content_tokens:B.maxContentTokens,cache_control:void 0});break}case"anthropic.web_fetch_20260209":{N.add("code-execution-web-tools-2026-02-09");let B=await GG({value:S.args,schema:jQ});R.push({type:"web_fetch_20260209",name:"web_fetch",max_uses:B.maxUses,allowed_domains:B.allowedDomains,blocked_domains:B.blockedDomains,citations:B.citations,max_content_tokens:B.maxContentTokens,cache_control:void 0});break}case"anthropic.web_search_20250305":{let B=await GG({value:S.args,schema:KQ});R.push({type:"web_search_20250305",name:"web_search",max_uses:B.maxUses,allowed_domains:B.allowedDomains,blocked_domains:B.blockedDomains,user_location:B.userLocation,cache_control:void 0});break}case"anthropic.web_search_20260209":{N.add("code-execution-web-tools-2026-02-09");let B=await GG({value:S.args,schema:zQ});R.push({type:"web_search_20260209",name:"web_search",max_uses:B.maxUses,allowed_domains:B.allowedDomains,blocked_domains:B.blockedDomains,user_location:B.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:{w.push({type:"unsupported",feature:`provider-defined tool ${S.id}`});break}}break}default:{w.push({type:"unsupported",feature:`tool ${S}`});break}}if(H==null)return{tools:R,toolChoice:Z?{type:"auto",disable_parallel_tool_use:Z}:void 0,toolWarnings:w,betas:N};let a=H.type;switch(a){case"auto":return{tools:R,toolChoice:{type:"auto",disable_parallel_tool_use:Z},toolWarnings:w,betas:N};case"required":return{tools:R,toolChoice:{type:"any",disable_parallel_tool_use:Z},toolWarnings:w,betas:N};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:w,betas:N};case"tool":return{tools:R,toolChoice:{type:"tool",name:H.toolName,disable_parallel_tool_use:Z},toolWarnings:w,betas:N};default:throw new HG({functionality:`tool choice type: ${a}`})}}function fG({usage:Q,rawUsage:H}){var Z,q;let E=(Z=Q.cache_creation_input_tokens)!=null?Z:0,T=(q=Q.cache_read_input_tokens)!=null?q:0,b,F;if(Q.iterations&&Q.iterations.length>0){let h=Q.iterations.reduce((w,N)=>({input:w.input+N.input_tokens,output:w.output+N.output_tokens}),{input:0,output:0});b=h.input,F=h.output}else b=Q.input_tokens,F=Q.output_tokens;return{inputTokens:{total:b+E+T,noCache:b,cacheRead:T,cacheWrite:E},outputTokens:{total:F,text:void 0,reasoning:void 0},raw:H!=null?H:Q}}var iG=J(()=>W(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([])}))),fQ=J(()=>W(G.object({code:G.string()}))),BQ=l({id:"anthropic.code_execution_20250522",inputSchema:fQ,outputSchema:iG}),IQ=(Q={})=>{return BQ(Q)},lG=J(()=>W(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()})]))),wQ=J(()=>W(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()})])]))),NQ=l({id:"anthropic.code_execution_20250825",inputSchema:wQ,outputSchema:lG,supportsDeferredResults:!0}),MQ=(Q={})=>{return NQ(Q)},sG=J(()=>W(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()})]))),CQ=J(()=>W(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()})])]))),bQ=l({id:"anthropic.code_execution_20260120",inputSchema:CQ,outputSchema:sG,supportsDeferredResults:!0}),TQ=(Q={})=>{return bQ(Q)},pG=J(()=>W(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),OQ=J(()=>W(G.object({pattern:G.string(),limit:G.number().optional()}))),kQ=l({id:"anthropic.tool_search_regex_20251119",inputSchema:OQ,outputSchema:pG,supportsDeferredResults:!0}),vQ=(Q={})=>{return kQ(Q)};function _Q(Q){if(typeof Q==="string")return new TextDecoder().decode(TG(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 KG(Q){return Q instanceof URL||hQ(Q)}function hQ(Q){return typeof Q==="string"&&/^https?:\/\//i.test(Q)}function DG(Q){return Q instanceof URL?Q.toString():Q}async function gQ({prompt:Q,sendReasoning:H,warnings:Z,cacheControlValidator:q,toolNameMapping:E}){var T,b,F,h,w,N,c,R,a,S,B,g,m,O,e,C,s,QG,YG;let Y=new Set,j=mQ(Q),M=q||new RG,p=void 0,XG=[];async function zG(v){var k,V;let ZG=await LG({provider:"anthropic",providerOptions:v,schema:FG});return(V=(k=ZG==null?void 0:ZG.citations)==null?void 0:k.enabled)!=null?V:!1}async function L(v){let k=await LG({provider:"anthropic",providerOptions:v,schema:FG});return{title:k==null?void 0:k.title,context:k==null?void 0:k.context}}for(let v=0;v<j.length;v++){let k=j[v],V=v===j.length-1,ZG=k.type;switch(ZG){case"system":{if(p!=null)throw new HG({functionality:"Multiple system messages that are separated by user/assistant messages"});p=k.messages.map(({content:I,providerOptions:o})=>({type:"text",text:I,cache_control:M.getCacheControl(o,{type:"system message",canCache:!0})}));break}case"user":{let I=[];for(let o of k.messages){let{role:t,content:r}=o;switch(t){case"user":{for(let i=0;i<r.length;i++){let x=r[i],n=i===r.length-1,z=(T=M.getCacheControl(x.providerOptions,{type:"user message part",canCache:!0}))!=null?T:n?M.getCacheControl(o.providerOptions,{type:"user message",canCache:!0}):void 0;switch(x.type){case"text":{I.push({type:"text",text:x.text,cache_control:z});break}case"file":{if(x.mediaType.startsWith("image/"))I.push({type:"image",source:KG(x.data)?{type:"url",url:DG(x.data)}:{type:"base64",media_type:x.mediaType==="image/*"?"image/jpeg":x.mediaType,data:jG(x.data)},cache_control:z});else if(x.mediaType==="application/pdf"){Y.add("pdfs-2024-09-25");let d=await zG(x.providerOptions),P=await L(x.providerOptions);I.push({type:"document",source:KG(x.data)?{type:"url",url:DG(x.data)}:{type:"base64",media_type:"application/pdf",data:jG(x.data)},title:(b=P.title)!=null?b:x.filename,...P.context&&{context:P.context},...d&&{citations:{enabled:!0}},cache_control:z})}else if(x.mediaType==="text/plain"){let d=await zG(x.providerOptions),P=await L(x.providerOptions);I.push({type:"document",source:KG(x.data)?{type:"url",url:DG(x.data)}:{type:"text",media_type:"text/plain",data:_Q(x.data)},title:(F=P.title)!=null?F:x.filename,...P.context&&{context:P.context},...d&&{citations:{enabled:!0}},cache_control:z})}else throw new HG({functionality:`media type: ${x.mediaType}`});break}}}break}case"tool":{for(let i=0;i<r.length;i++){let x=r[i];if(x.type==="tool-approval-response")continue;let n=i===r.length-1,z=(h=M.getCacheControl(x.providerOptions,{type:"tool result part",canCache:!0}))!=null?h:n?M.getCacheControl(o.providerOptions,{type:"tool result message",canCache:!0}):void 0,d=x.output,P;switch(d.type){case"content":P=d.value.map((U)=>{var D;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=(D=U.providerOptions)==null?void 0:D.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(kG);break;case"text":case"error-text":P=d.value;break;case"execution-denied":P=(w=d.reason)!=null?w:"Tool execution denied.";break;case"json":case"error-json":default:P=JSON.stringify(d.value);break}I.push({type:"tool_result",tool_use_id:x.toolCallId,content:P,is_error:d.type==="error-text"||d.type==="error-json"?!0:void 0,cache_control:z})}break}default:throw Error(`Unsupported role: ${t}`)}}XG.push({role:"user",content:I});break}case"assistant":{let I=[],o=new Set;for(let t=0;t<k.messages.length;t++){let r=k.messages[t],i=t===k.messages.length-1,{content:x}=r;for(let n=0;n<x.length;n++){let z=x[n],d=n===x.length-1,P=(N=M.getCacheControl(z.providerOptions,{type:"assistant message part",canCache:!0}))!=null?N:d?M.getCacheControl(r.providerOptions,{type:"assistant message",canCache:!0}):void 0;switch(z.type){case"text":{let U=(c=z.providerOptions)==null?void 0:c.anthropic;if((U==null?void 0:U.type)==="compaction")I.push({type:"compaction",content:z.text,cache_control:P});else I.push({type:"text",text:V&&i&&d?z.text.trim():z.text,cache_control:P});break}case"reasoning":{if(H){let U=await LG({provider:"anthropic",providerOptions:z.providerOptions,schema:GQ});if(U!=null)if(U.signature!=null)M.getCacheControl(z.providerOptions,{type:"thinking block",canCache:!1}),I.push({type:"thinking",thinking:z.text,signature:U.signature});else if(U.redactedData!=null)M.getCacheControl(z.providerOptions,{type:"redacted thinking block",canCache:!1}),I.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=E.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=(B=(S=z.providerOptions)==null?void 0:S.anthropic)==null?void 0:B.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}I.push({type:"mcp_tool_use",id:z.toolCallId,name:z.toolName,input:z.input,server_name:X,cache_control:P})}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"))I.push({type:"server_tool_use",id:z.toolCallId,name:z.input.type,input:z.input,cache_control:P});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,...f}=z.input;I.push({type:"server_tool_use",id:z.toolCallId,name:"code_execution",input:f,cache_control:P})}else if(A==="code_execution"||A==="web_fetch"||A==="web_search")I.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:P});else if(A==="tool_search_tool_regex"||A==="tool_search_tool_bm25")I.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:P});else Z.push({type:"other",message:`provider executed tool call for tool ${z.toolName} is not supported`});break}let U=(g=z.providerOptions)==null?void 0:g.anthropic,D=(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;I.push({type:"tool_use",id:z.toolCallId,name:z.toolName,input:z.input,...D&&{caller:D},cache_control:P});break}case"tool-result":{let U=E.toProviderToolName(z.toolName);if(o.has(z.toolCallId)){let D=z.output;if(D.type!=="json"&&D.type!=="error-json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}I.push({type:"mcp_tool_result",tool_use_id:z.toolCallId,is_error:D.type==="error-json",content:D.value,cache_control:P})}else if(U==="code_execution"){let D=z.output;if(D.type==="error-text"||D.type==="error-json"){let A={};try{if(typeof D.value==="string")A=JSON.parse(D.value);else if(typeof D.value==="object"&&D.value!==null)A=D.value}catch($){}if(A.type==="code_execution_tool_result_error")I.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:"code_execution_tool_result_error",error_code:(m=A.errorCode)!=null?m:"unknown"},cache_control:P});else I.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:P,content:{type:"bash_code_execution_tool_result_error",error_code:(O=A.errorCode)!=null?O:"unknown"}});break}if(D.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}if(D.value==null||typeof D.value!=="object"||!("type"in D.value)||typeof D.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(D.value.type==="code_execution_result"){let A=await GG({value:D.value,schema:iG});I.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:P})}else if(D.value.type==="encrypted_code_execution_result"){let A=await GG({value:D.value,schema:sG});if(A.type==="encrypted_code_execution_result")I.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:(C=A.content)!=null?C:[]},cache_control:P})}else{let A=await GG({value:D.value,schema:lG});if(A.type==="code_execution_result")I.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:P});else if(A.type==="bash_code_execution_result"||A.type==="bash_code_execution_tool_result_error")I.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:P,content:A});else I.push({type:"text_editor_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:P,content:A})}break}if(U==="web_fetch"){let D=z.output;if(D.type==="error-json"){let $={};try{if(typeof D.value==="string")$=JSON.parse(D.value);else if(typeof D.value==="object"&&D.value!==null)$=D.value}catch(X){let f=(QG=D.value)==null?void 0:QG.errorCode;$={errorCode:typeof f==="string"?f:"unavailable"}}I.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:P});break}if(D.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:D.value,schema:cG});I.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:P});break}if(U==="web_search"){let D=z.output;if(D.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:D.value,schema:uG});I.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:P});break}if(U==="tool_search_tool_regex"||U==="tool_search_tool_bm25"){let D=z.output;if(D.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}let $=(await GG({value:D.value,schema:pG})).map((X)=>({type:"tool_reference",tool_name:X.toolName}));I.push({type:"tool_search_tool_result",tool_use_id:z.toolCallId,content:{type:"tool_search_tool_search_result",tool_references:$},cache_control:P});break}Z.push({type:"other",message:`provider executed tool result for tool ${z.toolName} is not supported`});break}}}}XG.push({role:"assistant",content:I});break}default:throw Error(`content type: ${ZG}`)}}return{prompt:{system:p,messages:XG},betas:Y}}function mQ(Q){let H=[],Z=void 0;for(let q of Q){let{role:E}=q;switch(E){case"system":{if((Z==null?void 0:Z.type)!=="system")Z={type:"system",messages:[]},H.push(Z);Z.messages.push(q);break}case"assistant":{if((Z==null?void 0:Z.type)!=="assistant")Z={type:"assistant",messages:[]},H.push(Z);Z.messages.push(q);break}case"user":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(q);break}case"tool":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(q);break}default:throw Error(`Unsupported role: ${E}`)}}return H}function JG({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 BG(Q,H,Z){var q;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 E=H[Q.document_index];if(!E)return;return{type:"source",sourceType:"document",id:Z(),mediaType:E.mediaType,title:(q=Q.document_title)!=null?q:E.title,filename:E.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 dQ=class{constructor(Q,H){this.specificationVersion="v3";var Z;this.modelId=Q,this.config=H,this.generateId=(Z=H.generateId)!=null?Z:AG}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:q,topP:E,topK:T,frequencyPenalty:b,presencePenalty:F,stopSequences:h,responseFormat:w,seed:N,tools:c,toolChoice:R,providerOptions:a,stream:S}){var B,g,m,O,e,C,s,QG,YG,Y;let j=[];if(b!=null)j.push({type:"unsupported",feature:"frequencyPenalty"});if(F!=null)j.push({type:"unsupported",feature:"presencePenalty"});if(N!=null)j.push({type:"unsupported",feature:"seed"});if(q!=null&&q>1)j.push({type:"unsupported",feature:"temperature",details:`${q} exceeds anthropic maximum of 1.0. clamped to 1.0`}),q=1;else if(q!=null&&q<0)j.push({type:"unsupported",feature:"temperature",details:`${q} is below anthropic minimum of 0. clamped to 0`}),q=0;if((w==null?void 0:w.type)==="json"){if(w.schema==null)j.push({type:"unsupported",feature:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."})}let M=this.providerOptionsName,p=await LG({provider:"anthropic",providerOptions:a,schema:xG}),XG=M!=="anthropic"?await LG({provider:M,providerOptions:a,schema:xG}):null,zG=XG!=null,L=Object.assign({},p!=null?p:{},XG!=null?XG:{}),{maxOutputTokens:v,supportsStructuredOutput:k,rejectsSamplingParameters:V,isKnownModel:ZG}=uQ(this.modelId);if(V){if(q!=null)j.push({type:"unsupported",feature:"temperature",details:`temperature is not supported by ${this.modelId} and will be ignored`}),q=void 0;if(T!=null)j.push({type:"unsupported",feature:"topK",details:`topK is not supported by ${this.modelId} and will be ignored`}),T=void 0;if(E!=null)j.push({type:"unsupported",feature:"topP",details:`topP is not supported by ${this.modelId} and will be ignored`}),E=void 0}let I=ZG||this.modelId.startsWith("claude-"),o=((B=this.config.supportsNativeStructuredOutput)!=null?B:!0)&&k,t=((g=this.config.supportsStrictTools)!=null?g:!0)&&k,r=(m=L==null?void 0:L.structuredOutputMode)!=null?m:"auto",i=r==="outputFormat"||r==="auto"&&o,x=(w==null?void 0:w.type)==="json"&&w.schema!=null&&!i?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:w.schema}:void 0,n=L==null?void 0:L.contextManagement,z=new RG,d=bG({tools:c,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:P,betas:U}=await gQ({prompt:H,sendReasoning:(O=L==null?void 0:L.sendReasoning)!=null?O:!0,warnings:j,cacheControlValidator:z,toolNameMapping:d}),D=(e=L==null?void 0:L.thinking)==null?void 0:e.type,A=D==="enabled"||D==="adaptive",$=D==="enabled"?(C=L==null?void 0:L.thinking)==null?void 0:C.budgetTokens:void 0,X=D==="adaptive"?(s=L==null?void 0:L.thinking)==null?void 0:s.display:void 0,f=Z!=null?Z:v,K={model:this.modelId,max_tokens:f,temperature:q,top_k:T,top_p:E,stop_sequences:h,...A&&{thinking:{type:D,...$!=null&&{budget_tokens:$},...X!=null&&{display:X}}},...((L==null?void 0:L.effort)||(L==null?void 0:L.taskBudget)||i&&(w==null?void 0:w.type)==="json"&&w.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}}},...i&&(w==null?void 0:w.type)==="json"&&w.schema!=null&&{format:{type:"json_schema",schema:w.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((y)=>({type:y.type,name:y.name,url:y.url,authorization_token:y.authorizationToken,tool_configuration:y.toolConfiguration?{allowed_tools:y.toolConfiguration.allowedTools,enabled:y.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((y)=>({type:y.type,skill_id:y.skillId,version:y.version}))}:L.container.id},system:P.system,messages:P.messages,...n&&{context_management:{edits:n.edits.map((y)=>{let SG=y.type;switch(SG){case"clear_tool_uses_20250919":return{type:y.type,...y.trigger!==void 0&&{trigger:y.trigger},...y.keep!==void 0&&{keep:y.keep},...y.clearAtLeast!==void 0&&{clear_at_least:y.clearAtLeast},...y.clearToolInputs!==void 0&&{clear_tool_inputs:y.clearToolInputs},...y.excludeTools!==void 0&&{exclude_tools:y.excludeTools}};case"clear_thinking_20251015":return{type:y.type,...y.keep!==void 0&&{keep:y.keep}};case"compact_20260112":return{type:y.type,...y.trigger!==void 0&&{trigger:y.trigger},...y.pauseAfterCompaction!==void 0&&{pause_after_compaction:y.pauseAfterCompaction},...y.instructions!==void 0&&{instructions:y.instructions}};default:j.push({type:"other",message:`Unknown context management strategy: ${SG}`});return}}).filter((y)=>y!==void 0)}}};if(A){if(D==="enabled"&&$==null)j.push({type:"compatibility",feature:"extended thinking",details:"thinking budget is required when thinking is enabled. using default budget of 1024 tokens."}),K.thinking={type:"enabled",budget_tokens:1024},$=1024;if(K.temperature!=null)K.temperature=void 0,j.push({type:"unsupported",feature:"temperature",details:"temperature is not supported when thinking is enabled"});if(T!=null)K.top_k=void 0,j.push({type:"unsupported",feature:"topK",details:"topK is not supported when thinking is enabled"});if(E!=null)K.top_p=void 0,j.push({type:"unsupported",feature:"topP",details:"topP is not supported when thinking is enabled"});K.max_tokens=f+($!=null?$:0)}else if(I&&E!=null&&q!=null)j.push({type:"unsupported",feature:"topP",details:"topP is not supported when temperature is set. topP is ignored."}),K.top_p=void 0;if(ZG&&K.max_tokens>v){if(Z!=null)j.push({type:"unsupported",feature:"maxOutputTokens",details:`${K.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${v} max output tokens. The max output tokens have been limited to ${v}.`});K.max_tokens=v}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((y)=>y.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"),!(c==null?void 0:c.some((y)=>y.type==="provider"&&(y.id==="anthropic.code_execution_20250825"||y.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 _=S&&((YG=L==null?void 0:L.toolStreaming)!=null?YG:!0),{tools:$G,toolChoice:EG,toolWarnings:qG,betas:nG}=await PQ(x!=null?{tools:[...c!=null?c:[],x],toolChoice:{type:"required"},disableParallelToolUse:!0,cacheControlValidator:z,supportsStructuredOutput:!1,supportsStrictTools:t,defaultEagerInputStreaming:_}:{tools:c!=null?c:[],toolChoice:R,disableParallelToolUse:L==null?void 0:L.disableParallelToolUse,cacheControlValidator:z,supportsStructuredOutput:o,supportsStrictTools:t,defaultEagerInputStreaming:_}),rG=z.getWarnings();return{args:{...K,tools:$G,tool_choice:EG,stream:S===!0?!0:void 0},warnings:[...j,...qG,...rG],betas:new Set([...U,...nG,...Q,...(Y=L==null?void 0:L.anthropicBeta)!=null?Y:[]]),usesJsonResponseTool:x!=null,toolNameMapping:d,providerOptionsName:M,usedCustomProviderKey:zG}}async getHeaders({betas:Q,headers:H}){return CG(await UG(this.config.headers),H,Q.size>0?{"anthropic-beta":Array.from(Q).join(",")}:{})}async getBetasFromHeaders(Q){var H,Z;let E=(H=(await UG(this.config.headers))["anthropic-beta"])!=null?H:"",T=(Z=Q==null?void 0:Q["anthropic-beta"])!=null?Z:"";return new Set([...E.toLowerCase().split(","),...T.toLowerCase().split(",")].map((b)=>b.trim()).filter((b)=>b!==""))}buildRequestUrl(Q){var H,Z,q;return(q=(Z=(H=this.config).buildRequestUrl)==null?void 0:Z.call(H,this.config.baseURL,Q))!=null?q:`${this.config.baseURL}/messages`}transformRequestBody(Q,H){var Z,q,E;return(E=(q=(Z=this.config).transformRequestBody)==null?void 0:q.call(Z,Q,H))!=null?E:Q}extractCitationDocuments(Q){let H=(Z)=>{var q,E;if(Z.type!=="file")return!1;if(Z.mediaType!=="application/pdf"&&Z.mediaType!=="text/plain")return!1;let T=(q=Z.providerOptions)==null?void 0:q.anthropic,b=T==null?void 0:T.citations;return(E=b==null?void 0:b.enabled)!=null?E:!1};return Q.filter((Z)=>Z.role==="user").flatMap((Z)=>Z.content).filter(H).map((Z)=>{var q;let E=Z;return{title:(q=E.filename)!=null?q:"Untitled Document",filename:E.filename,mediaType:E.mediaType}})}async doGenerate(Q){var H,Z,q,E,T,b,F;let{args:h,warnings:w,betas:N,usesJsonResponseTool:c,toolNameMapping:R,providerOptionsName:a,usedCustomProviderKey:S}=await this.getArgs({...Q,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),B=[...this.extractCitationDocuments(Q.prompt)],g=IG(h.tools),{responseHeaders:m,value:O,rawValue:e}=await VG({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:N,headers:Q.headers}),body:this.transformRequestBody(h,N),failedResponseHandler:yG,successfulResponseHandler:mG(oG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),C=[],s={},QG={},YG=!1;for(let Y of O.content)switch(Y.type){case"text":{if(!c){if(C.push({type:"text",text:Y.text}),Y.citations)for(let j of Y.citations){let M=BG(j,B,this.generateId);if(M)C.push(M)}}break}case"thinking":{C.push({type:"reasoning",text:Y.thinking,providerMetadata:{anthropic:{signature:Y.signature}}});break}case"redacted_thinking":{C.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:Y.data}}});break}case"compaction":{C.push({type:"text",text:Y.content,providerMetadata:{anthropic:{type:"compaction"}}});break}case"tool_use":{if(c&&Y.name==="json")YG=!0,C.push({type:"text",text:JSON.stringify(Y.input)});else{let M=Y.caller,p=M?{type:M.type,toolId:"tool_id"in M?M.tool_id:void 0}:void 0;C.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")C.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;C.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(j),providerExecuted:!0,...g&&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,C.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}}},C.push(s[Y.id]);break}case"mcp_tool_result":{C.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")B.push({title:(H=Y.content.content.title)!=null?H:Y.content.url,mediaType:Y.content.content.source.media_type}),C.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")C.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)){C.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),result:Y.content.map((j)=>{var M;return{url:j.url,title:j.title,pageAge:(M=j.page_age)!=null?M:null,encryptedContent:j.encrypted_content,type:j.type}})});for(let j of Y.content)C.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 C.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")C.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:(q=Y.content.content)!=null?q:[]}});else if(Y.content.type==="encrypted_code_execution_result")C.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:(E=Y.content.content)!=null?E:[]}});else if(Y.content.type==="code_execution_tool_result_error")C.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":{C.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 M=R.toCustomToolName("tool_search_tool_bm25"),p=R.toCustomToolName("tool_search_tool_regex");if(M!=="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")C.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),result:Y.content.tool_references.map((M)=>({type:M.type,toolName:M.tool_name}))});else C.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:C,finishReason:{unified:JG({finishReason:O.stop_reason,isJsonResponseFromTool:YG}),raw:(T=O.stop_reason)!=null?T:void 0},usage:fG({usage:O.usage}),request:{body:h},response:{id:(b=O.id)!=null?b:void 0,modelId:(F=O.model)!=null?F:void 0,headers:m,body:e},warnings:w,providerMetadata:(()=>{var Y,j,M,p,XG;let zG={usage:O.usage,cacheCreationInputTokens:(Y=O.usage.cache_creation_input_tokens)!=null?Y:null,stopSequence:(j=O.stop_sequence)!=null?j:null,iterations:O.usage.iterations?O.usage.iterations.map((v)=>({type:v.type,inputTokens:v.input_tokens,outputTokens:v.output_tokens})):null,container:O.container?{expiresAt:O.container.expires_at,id:O.container.id,skills:(p=(M=O.container.skills)==null?void 0:M.map((v)=>({type:v.type,skillId:v.skill_id,version:v.version})))!=null?p:null}:null,contextManagement:(XG=wG(O.context_management))!=null?XG:null},L={anthropic:zG};if(S&&a!=="anthropic")L[a]=zG;return L})()}}async doStream(Q){var H,Z;let{args:q,warnings:E,betas:T,usesJsonResponseTool:b,toolNameMapping:F,providerOptionsName:h,usedCustomProviderKey:w}=await this.getArgs({...Q,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),N=[...this.extractCitationDocuments(Q.prompt)],c=IG(q.tools),R=this.buildRequestUrl(!0),{responseHeaders:a,value:S}=await VG({url:R,headers:await this.getHeaders({betas:T,headers:Q.headers}),body:this.transformRequestBody(q,T),failedResponseHandler:yG,successfulResponseHandler:gG(tG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),B={unified:"other",raw:void 0},g={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},m={},O={},e={},C=null,s=void 0,QG=null,YG=null,Y=null,j=!1,M=void 0,p=this.generateId,XG=S.pipeThrough(new TransformStream({start(k){k.enqueue({type:"stream-start",warnings:E})},transform(k,V){var ZG,I,o,t,r,i,x,n,z,d,P,U,D,A;if(Q.includeRawChunks)V.enqueue({type:"raw",rawValue:k.rawValue});if(!k.success){V.enqueue({type:"error",error:k.error});return}let $=k.value;switch($.type){case"ping":return;case"content_block_start":{let X=$.content_block,f=X.type;switch(M=f,f){case"text":{if(b)return;m[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});return}case"thinking":{m[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index)});return}case"redacted_thinking":{m[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index),providerMetadata:{anthropic:{redactedData:X.data}}});return}case"compaction":{m[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index),providerMetadata:{anthropic:{type:"compaction"}}});return}case"tool_use":{if(b&&X.name==="json")j=!0,m[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});else{let _=X.caller,$G=_?{type:_.type,toolId:"tool_id"in _?_.tool_id:void 0}:void 0,qG=X.input&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";m[$.index]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:qG,firstDelta:qG.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 K=X.name==="text_editor_code_execution"||X.name==="bash_code_execution"?"code_execution":X.name,_=F.toCustomToolName(K),$G=X.input!=null&&typeof X.input==="object"&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";m[$.index]={type:"tool-call",toolCallId:X.id,toolName:_,input:$G,providerExecuted:!0,...c&&K==="code_execution"?{dynamic:!0}:{},firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:_,providerExecuted:!0,...c&&K==="code_execution"?{dynamic:!0}:{}})}else if(X.name==="tool_search_tool_regex"||X.name==="tool_search_tool_bm25"){e[X.id]=X.name;let K=F.toCustomToolName(X.name);m[$.index]={type:"tool-call",toolCallId:X.id,toolName:K,input:"",providerExecuted:!0,firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:K,providerExecuted:!0})}return}case"web_fetch_tool_result":{if(X.content.type==="web_fetch_result")N.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:F.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:F.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:F.toCustomToolName("web_search"),result:X.content.map((K)=>{var _;return{url:K.url,title:K.title,pageAge:(_=K.page_age)!=null?_:null,encryptedContent:K.encrypted_content,type:K.type}})});for(let K of X.content)V.enqueue({type:"source",sourceType:"url",id:p(),url:K.url,title:K.title,providerMetadata:{anthropic:{pageAge:(I=K.page_age)!=null?I:null}}})}else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:F.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:F.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:F.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:F.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:F.toCustomToolName("code_execution"),result:X.content});return}case"tool_search_tool_result":{let K=e[X.tool_use_id];if(K==null){let _=F.toCustomToolName("tool_search_tool_bm25"),$G=F.toCustomToolName("tool_search_tool_regex");if(_!=="tool_search_tool_bm25")K="tool_search_tool_bm25";else if($G!=="tool_search_tool_regex")K="tool_search_tool_regex";else K="tool_search_tool_regex"}if(X.content.type==="tool_search_tool_search_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:F.toCustomToolName(K),result:X.content.tool_references.map((_)=>({type:_.type,toolName:_.tool_name}))});else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:F.toCustomToolName(K),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:X.content.error_code}});return}case"mcp_tool_use":{O[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(O[X.id]);return}case"mcp_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:O[X.tool_use_id].toolName,isError:X.is_error,result:X.content,dynamic:!0,providerMetadata:O[X.tool_use_id].providerMetadata});return}default:throw Error(`Unsupported content block type: ${f}`)}}case"content_block_stop":{if(m[$.index]!=null){let X=m[$.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(!(b&&X.toolName==="json")){V.enqueue({type:"tool-input-end",id:X.toolCallId});let K=X.input===""?"{}":X.input;if(X.providerToolName==="code_execution")try{let _=JSON.parse(K);if(_!=null&&typeof _==="object"&&"code"in _&&!("type"in _))K=JSON.stringify({type:"programmatic-tool-call",..._})}catch(_){}V.enqueue({type:"tool-call",toolCallId:X.toolCallId,toolName:X.toolName,input:K,providerExecuted:X.providerExecuted,...c&&X.providerToolName==="code_execution"?{dynamic:!0}:{},...X.caller&&{providerMetadata:{anthropic:{caller:X.caller}}}})}break}delete m[$.index]}M=void 0;return}case"content_block_delta":{let X=$.delta.type;switch(X){case"text_delta":{if(b)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(M==="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 f=m[$.index],K=$.delta.partial_json;if(K.length===0)return;if(j){if((f==null?void 0:f.type)!=="text")return;V.enqueue({type:"text-delta",id:String($.index),delta:K})}else{if((f==null?void 0:f.type)!=="tool-call")return;if(f.firstDelta&&(f.providerToolName==="bash_code_execution"||f.providerToolName==="text_editor_code_execution"))K=`{"type": "${f.providerToolName}",${K.substring(1)}`;V.enqueue({type:"tool-input-delta",id:f.toolCallId,delta:K}),f.input+=K,f.firstDelta=!1}return}case"citations_delta":{let f=$.delta.citation,K=BG(f,N,p);if(K)V.enqueue(K);return}default:throw Error(`Unsupported delta type: ${X}`)}}case"message_start":{if(g.input_tokens=$.message.usage.input_tokens,g.cache_read_input_tokens=(r=$.message.usage.cache_read_input_tokens)!=null?r:0,g.cache_creation_input_tokens=(i=$.message.usage.cache_creation_input_tokens)!=null?i:0,s={...$.message.usage},QG=(x=$.message.usage.cache_creation_input_tokens)!=null?x:null,$.message.container!=null)Y={expiresAt:$.message.container.expires_at,id:$.message.container.id,skills:null};if($.message.stop_reason!=null)B={unified:JG({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 f=$.message.content[X];if(f.type==="tool_use"){let K=f.caller,_=K?{type:K.type,toolId:"tool_id"in K?K.tool_id:void 0}:void 0;V.enqueue({type:"tool-input-start",id:f.id,toolName:f.name});let $G=JSON.stringify((d=f.input)!=null?d:{});V.enqueue({type:"tool-input-delta",id:f.id,delta:$G}),V.enqueue({type:"tool-input-end",id:f.id}),V.enqueue({type:"tool-call",toolCallId:f.id,toolName:f.name,input:$G,..._&&{providerMetadata:{anthropic:{caller:_}}}})}}return}case"message_delta":{if($.usage.input_tokens!=null&&g.input_tokens!==$.usage.input_tokens)g.input_tokens=$.usage.input_tokens;if(g.output_tokens=$.usage.output_tokens,$.usage.cache_read_input_tokens!=null)g.cache_read_input_tokens=$.usage.cache_read_input_tokens;if($.usage.cache_creation_input_tokens!=null)g.cache_creation_input_tokens=$.usage.cache_creation_input_tokens,QG=$.usage.cache_creation_input_tokens;if($.usage.iterations!=null)g.iterations=$.usage.iterations;if(B={unified:JG({finishReason:$.delta.stop_reason,isJsonResponseFromTool:j}),raw:(P=$.delta.stop_reason)!=null?P: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=(D=$.delta.container.skills)==null?void 0:D.map((X)=>({type:X.type,skillId:X.skill_id,version:X.version})))!=null?A:null}:null,$.context_management)C=wG($.context_management);s={...s,...$.usage};return}case"message_stop":{let X={usage:s!=null?s:null,cacheCreationInputTokens:QG,stopSequence:YG,iterations:g.iterations?g.iterations.map((K)=>({type:K.type,inputTokens:K.input_tokens,outputTokens:K.output_tokens})):null,container:Y,contextManagement:C},f={anthropic:X};if(w&&h!=="anthropic")f[h]=X;V.enqueue({type:"finish",finishReason:B,usage:fG({usage:g,rawUsage:s}),providerMetadata:f});return}case"error":{V.enqueue({type:"error",error:$.error});return}default:throw Error(`Unsupported chunk type: ${$}`)}}})),[zG,L]=XG.tee(),v=zG.getReader();try{await v.read();let k=await v.read();if(((H=k.value)==null?void 0:H.type)==="raw")k=await v.read();if(((Z=k.value)==null?void 0:Z.type)==="error"){let V=k.value.error;throw new NG({message:V.message,url:R,requestBodyValues:q,statusCode:V.type==="overloaded_error"?529:500,responseHeaders:a,responseBody:JSON.stringify(V),isRetryable:V.type==="overloaded_error"})}}finally{v.cancel().catch(()=>{}),v.releaseLock()}return{stream:L,request:{body:q},response:{headers:a}}}};function uQ(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 IG(Q){if(!Q)return!1;let H=!1,Z=!1;for(let q of Q){if("type"in q&&(q.type==="web_fetch_20260209"||q.type==="web_search_20260209")){H=!0;continue}if(q.name==="code_execution"){Z=!0;break}}return H&&!Z}function wG(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 cQ=J(()=>W(G.object({command:G.string(),restart:G.boolean().optional()}))),iQ=u({id:"anthropic.bash_20241022",inputSchema:cQ}),lQ=J(()=>W(G.object({command:G.string(),restart:G.boolean().optional()}))),sQ=u({id:"anthropic.bash_20250124",inputSchema:lQ}),pQ=J(()=>W(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()}))),nQ=u({id:"anthropic.computer_20241022",inputSchema:pQ}),rQ=J(()=>W(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()}))),aQ=u({id:"anthropic.computer_20250124",inputSchema:rQ}),eQ=J(()=>W(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()}))),oQ=u({id:"anthropic.computer_20251124",inputSchema:eQ}),tQ=J(()=>W(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()})]))),GX=u({id:"anthropic.memory_20250818",inputSchema:tQ}),QX=J(()=>W(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()}))),XX=u({id:"anthropic.text_editor_20241022",inputSchema:QX}),YX=J(()=>W(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()}))),ZX=u({id:"anthropic.text_editor_20250124",inputSchema:YX}),$X=J(()=>W(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()}))),zX=u({id:"anthropic.text_editor_20250429",inputSchema:$X}),LX=J(()=>W(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),HX=J(()=>W(G.object({query:G.string(),limit:G.number().optional()}))),qX=l({id:"anthropic.tool_search_bm25_20251119",inputSchema:HX,outputSchema:LX,supportsDeferredResults:!0}),AX=(Q={})=>{return qX(Q)},KX={bash_20241022:iQ,bash_20250124:sQ,codeExecution_20250522:IQ,codeExecution_20250825:MQ,codeExecution_20260120:TQ,computer_20241022:nQ,computer_20250124:aQ,computer_20251124:oQ,memory_20250818:GX,textEditor_20241022:XX,textEditor_20250124:ZX,textEditor_20250429:zX,textEditor_20250728:$Q,webFetch_20250910:xQ,webFetch_20260209:EQ,webSearch_20250305:WQ,webSearch_20260209:AQ,toolSearchRegex_20251119:vQ,toolSearchBm25_20251119:AX};function DX(Q={}){var H,Z;let q=(H=dG(_G({settingValue:Q.baseURL,environmentVariableName:"ANTHROPIC_BASE_URL"})))!=null?H:"https://api.anthropic.com/v1",E=(Z=Q.name)!=null?Z:"anthropic.messages";if(Q.apiKey&&Q.authToken)throw new MG({argument:"apiKey/authToken",message:"Both apiKey and authToken were provided. Please use only one authentication method."});let T=()=>{let h=Q.authToken?{Authorization:`Bearer ${Q.authToken}`}:{"x-api-key":vG({apiKey:Q.apiKey,environmentVariableName:"ANTHROPIC_API_KEY",description:"Anthropic"})};return OG({"anthropic-version":"2023-06-01",...h,...Q.headers},`ai-sdk/anthropic/${aG}`)},b=(h)=>{var w;return new dQ(h,{provider:E,baseURL:q,headers:T,fetch:Q.fetch,generateId:(w=Q.generateId)!=null?w:AG,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})})},F=function(h){if(new.target)throw Error("The Anthropic model function cannot be called with the new keyword.");return b(h)};return F.specificationVersion="v3",F.languageModel=b,F.chat=b,F.messages=b,F.embeddingModel=(h)=>{throw new WG({modelId:h,modelType:"embeddingModel"})},F.textEmbeddingModel=F.embeddingModel,F.imageModel=(h)=>{throw new WG({modelId:h,modelType:"imageModel"})},F.tools=KX,F}var KY=DX();function DY({steps:Q}){var H,Z,q;for(let E=Q.length-1;E>=0;E--){let T=(q=(Z=(H=Q[E].providerMetadata)==null?void 0:H.anthropic)==null?void 0:Z.container)==null?void 0:q.id;if(T)return{providerOptions:{anthropic:{container:{id:T}}}}}return}export{DY as forwardAnthropicContainerIdFromLastStep,DX as createAnthropic,KY as anthropic,aG as VERSION};
|
|
2
|
+
import{Aq as mG,Eq as dG,Fp as CG,Gp as bG,Kp as TG,Mp as jG,Vp as AG,_p as OG,aq as kG,cq as vG,dq as _G,gq as J,jq as W,kq as GG,qq as LG,rq as VG,vq as u,wq as l,xq as UG,yq as hG,zq as gG}from"./chunk-yce8ph5b.js";import{Hq as NG,Kq as MG,Qq as WG,Tq as HG}from"./chunk-kec1xw1n.js";import"./chunk-cqtkxwd8.js";import"./chunk-x50adh71.js";import{Hu as G}from"./chunk-q4mtwv1w.js";import"./chunk-7a3txs9f.js";import"./chunk-djfrkbd5.js";var aG="3.0.71",eG=J(()=>W(G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}))),yG=hG({errorSchema:eG,errorToMessage:(Q)=>Q.error.message}),oG=J(()=>W(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()}))),tG=J(()=>W(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")})]))),GQ=J(()=>W(G.object({signature:G.string().optional(),redactedData:G.string().optional()}))),FG=G.object({citations:G.object({enabled:G.boolean()}).optional(),title:G.string().optional(),context:G.string().optional()}),xG=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()}),PG=4;function QQ(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 RG=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(Q,H){let Z=QQ(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>PG){this.warnings.push({type:"unsupported",feature:"cacheControl breakpoint limit",details:`Maximum ${PG} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return Z}getWarnings(){return this.warnings}},XQ=J(()=>W(G.object({maxCharacters:G.number().optional()}))),YQ=J(()=>W(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()}))),ZQ=u({id:"anthropic.text_editor_20250728",inputSchema:YQ}),$Q=(Q={})=>{return ZQ(Q)},zQ=J(()=>W(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()}))),LQ=J(()=>W(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),HQ=J(()=>W(G.object({query:G.string()}))),qQ=l({id:"anthropic.web_search_20260209",inputSchema:HQ,outputSchema:LQ,supportsDeferredResults:!0}),AQ=(Q={})=>{return qQ(Q)},KQ=J(()=>W(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()}))),uG=J(()=>W(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),DQ=J(()=>W(G.object({query:G.string()}))),JQ=l({id:"anthropic.web_search_20250305",inputSchema:DQ,outputSchema:uG,supportsDeferredResults:!0}),WQ=(Q={})=>{return JQ(Q)},jQ=J(()=>W(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()}))),VQ=J(()=>W(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()}))),UQ=J(()=>W(G.object({url:G.string()}))),RQ=l({id:"anthropic.web_fetch_20260209",inputSchema:UQ,outputSchema:VQ,supportsDeferredResults:!0}),EQ=(Q={})=>{return RQ(Q)},SQ=J(()=>W(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()}))),cG=J(()=>W(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()}))),yQ=J(()=>W(G.object({url:G.string()}))),FQ=l({id:"anthropic.web_fetch_20250910",inputSchema:yQ,outputSchema:cG,supportsDeferredResults:!0}),xQ=(Q={})=>{return FQ(Q)};async function PQ({tools:Q,toolChoice:H,disableParallelToolUse:Z,cacheControlValidator:q,supportsStructuredOutput:E,supportsStrictTools:T,defaultEagerInputStreaming:b=!1}){var F,h;Q=(Q==null?void 0:Q.length)?Q:void 0;let w=[],N=new Set,c=q||new RG;if(Q==null)return{tools:void 0,toolChoice:void 0,toolWarnings:w,betas:N};let R=[];for(let S of Q)switch(S.type){case"function":{let B=c.getCacheControl(S.providerOptions,{type:"tool definition",canCache:!0}),g=(F=S.providerOptions)==null?void 0:F.anthropic,m=(h=g==null?void 0:g.eagerInputStreaming)!=null?h:b,O=g==null?void 0:g.deferLoading,e=g==null?void 0:g.allowedCallers;if(!T&&S.strict!=null)w.push({type:"unsupported",feature:"strict",details:`Tool '${S.name}' has strict: ${S.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`});if(R.push({name:S.name,description:S.description,input_schema:S.inputSchema,cache_control:B,...m?{eager_input_streaming:!0}:{},...T===!0&&S.strict!=null?{strict:S.strict}:{},...O!=null?{defer_loading:O}:{},...e!=null?{allowed_callers:e}:{},...S.inputExamples!=null?{input_examples:S.inputExamples.map((C)=>C.input)}:{}}),E===!0)N.add("structured-outputs-2025-11-13");if(S.inputExamples!=null||e!=null)N.add("advanced-tool-use-2025-11-20");break}case"provider":{switch(S.id){case"anthropic.code_execution_20250522":{N.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":{N.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":{N.add("computer-use-2025-01-24"),R.push({name:"computer",type:"computer_20250124",display_width_px:S.args.displayWidthPx,display_height_px:S.args.displayHeightPx,display_number:S.args.displayNumber,cache_control:void 0});break}case"anthropic.computer_20251124":{N.add("computer-use-2025-11-24"),R.push({name:"computer",type:"computer_20251124",display_width_px:S.args.displayWidthPx,display_height_px:S.args.displayHeightPx,display_number:S.args.displayNumber,enable_zoom:S.args.enableZoom,cache_control:void 0});break}case"anthropic.computer_20241022":{N.add("computer-use-2024-10-22"),R.push({name:"computer",type:"computer_20241022",display_width_px:S.args.displayWidthPx,display_height_px:S.args.displayHeightPx,display_number:S.args.displayNumber,cache_control:void 0});break}case"anthropic.text_editor_20250124":{N.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":{N.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":{N.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 B=await GG({value:S.args,schema:XQ});R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:B.maxCharacters,cache_control:void 0});break}case"anthropic.bash_20250124":{N.add("computer-use-2025-01-24"),R.push({name:"bash",type:"bash_20250124",cache_control:void 0});break}case"anthropic.bash_20241022":{N.add("computer-use-2024-10-22"),R.push({name:"bash",type:"bash_20241022",cache_control:void 0});break}case"anthropic.memory_20250818":{N.add("context-management-2025-06-27"),R.push({name:"memory",type:"memory_20250818"});break}case"anthropic.web_fetch_20250910":{N.add("web-fetch-2025-09-10");let B=await GG({value:S.args,schema:SQ});R.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:B.maxUses,allowed_domains:B.allowedDomains,blocked_domains:B.blockedDomains,citations:B.citations,max_content_tokens:B.maxContentTokens,cache_control:void 0});break}case"anthropic.web_fetch_20260209":{N.add("code-execution-web-tools-2026-02-09");let B=await GG({value:S.args,schema:jQ});R.push({type:"web_fetch_20260209",name:"web_fetch",max_uses:B.maxUses,allowed_domains:B.allowedDomains,blocked_domains:B.blockedDomains,citations:B.citations,max_content_tokens:B.maxContentTokens,cache_control:void 0});break}case"anthropic.web_search_20250305":{let B=await GG({value:S.args,schema:KQ});R.push({type:"web_search_20250305",name:"web_search",max_uses:B.maxUses,allowed_domains:B.allowedDomains,blocked_domains:B.blockedDomains,user_location:B.userLocation,cache_control:void 0});break}case"anthropic.web_search_20260209":{N.add("code-execution-web-tools-2026-02-09");let B=await GG({value:S.args,schema:zQ});R.push({type:"web_search_20260209",name:"web_search",max_uses:B.maxUses,allowed_domains:B.allowedDomains,blocked_domains:B.blockedDomains,user_location:B.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:{w.push({type:"unsupported",feature:`provider-defined tool ${S.id}`});break}}break}default:{w.push({type:"unsupported",feature:`tool ${S}`});break}}if(H==null)return{tools:R,toolChoice:Z?{type:"auto",disable_parallel_tool_use:Z}:void 0,toolWarnings:w,betas:N};let a=H.type;switch(a){case"auto":return{tools:R,toolChoice:{type:"auto",disable_parallel_tool_use:Z},toolWarnings:w,betas:N};case"required":return{tools:R,toolChoice:{type:"any",disable_parallel_tool_use:Z},toolWarnings:w,betas:N};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:w,betas:N};case"tool":return{tools:R,toolChoice:{type:"tool",name:H.toolName,disable_parallel_tool_use:Z},toolWarnings:w,betas:N};default:throw new HG({functionality:`tool choice type: ${a}`})}}function fG({usage:Q,rawUsage:H}){var Z,q;let E=(Z=Q.cache_creation_input_tokens)!=null?Z:0,T=(q=Q.cache_read_input_tokens)!=null?q:0,b,F;if(Q.iterations&&Q.iterations.length>0){let h=Q.iterations.reduce((w,N)=>({input:w.input+N.input_tokens,output:w.output+N.output_tokens}),{input:0,output:0});b=h.input,F=h.output}else b=Q.input_tokens,F=Q.output_tokens;return{inputTokens:{total:b+E+T,noCache:b,cacheRead:T,cacheWrite:E},outputTokens:{total:F,text:void 0,reasoning:void 0},raw:H!=null?H:Q}}var iG=J(()=>W(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([])}))),fQ=J(()=>W(G.object({code:G.string()}))),BQ=l({id:"anthropic.code_execution_20250522",inputSchema:fQ,outputSchema:iG}),IQ=(Q={})=>{return BQ(Q)},lG=J(()=>W(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()})]))),wQ=J(()=>W(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()})])]))),NQ=l({id:"anthropic.code_execution_20250825",inputSchema:wQ,outputSchema:lG,supportsDeferredResults:!0}),MQ=(Q={})=>{return NQ(Q)},sG=J(()=>W(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()})]))),CQ=J(()=>W(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()})])]))),bQ=l({id:"anthropic.code_execution_20260120",inputSchema:CQ,outputSchema:sG,supportsDeferredResults:!0}),TQ=(Q={})=>{return bQ(Q)},pG=J(()=>W(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),OQ=J(()=>W(G.object({pattern:G.string(),limit:G.number().optional()}))),kQ=l({id:"anthropic.tool_search_regex_20251119",inputSchema:OQ,outputSchema:pG,supportsDeferredResults:!0}),vQ=(Q={})=>{return kQ(Q)};function _Q(Q){if(typeof Q==="string")return new TextDecoder().decode(TG(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 KG(Q){return Q instanceof URL||hQ(Q)}function hQ(Q){return typeof Q==="string"&&/^https?:\/\//i.test(Q)}function DG(Q){return Q instanceof URL?Q.toString():Q}async function gQ({prompt:Q,sendReasoning:H,warnings:Z,cacheControlValidator:q,toolNameMapping:E}){var T,b,F,h,w,N,c,R,a,S,B,g,m,O,e,C,s,QG,YG;let Y=new Set,j=mQ(Q),M=q||new RG,p=void 0,XG=[];async function zG(v){var k,V;let ZG=await LG({provider:"anthropic",providerOptions:v,schema:FG});return(V=(k=ZG==null?void 0:ZG.citations)==null?void 0:k.enabled)!=null?V:!1}async function L(v){let k=await LG({provider:"anthropic",providerOptions:v,schema:FG});return{title:k==null?void 0:k.title,context:k==null?void 0:k.context}}for(let v=0;v<j.length;v++){let k=j[v],V=v===j.length-1,ZG=k.type;switch(ZG){case"system":{if(p!=null)throw new HG({functionality:"Multiple system messages that are separated by user/assistant messages"});p=k.messages.map(({content:I,providerOptions:o})=>({type:"text",text:I,cache_control:M.getCacheControl(o,{type:"system message",canCache:!0})}));break}case"user":{let I=[];for(let o of k.messages){let{role:t,content:r}=o;switch(t){case"user":{for(let i=0;i<r.length;i++){let x=r[i],n=i===r.length-1,z=(T=M.getCacheControl(x.providerOptions,{type:"user message part",canCache:!0}))!=null?T:n?M.getCacheControl(o.providerOptions,{type:"user message",canCache:!0}):void 0;switch(x.type){case"text":{I.push({type:"text",text:x.text,cache_control:z});break}case"file":{if(x.mediaType.startsWith("image/"))I.push({type:"image",source:KG(x.data)?{type:"url",url:DG(x.data)}:{type:"base64",media_type:x.mediaType==="image/*"?"image/jpeg":x.mediaType,data:jG(x.data)},cache_control:z});else if(x.mediaType==="application/pdf"){Y.add("pdfs-2024-09-25");let d=await zG(x.providerOptions),P=await L(x.providerOptions);I.push({type:"document",source:KG(x.data)?{type:"url",url:DG(x.data)}:{type:"base64",media_type:"application/pdf",data:jG(x.data)},title:(b=P.title)!=null?b:x.filename,...P.context&&{context:P.context},...d&&{citations:{enabled:!0}},cache_control:z})}else if(x.mediaType==="text/plain"){let d=await zG(x.providerOptions),P=await L(x.providerOptions);I.push({type:"document",source:KG(x.data)?{type:"url",url:DG(x.data)}:{type:"text",media_type:"text/plain",data:_Q(x.data)},title:(F=P.title)!=null?F:x.filename,...P.context&&{context:P.context},...d&&{citations:{enabled:!0}},cache_control:z})}else throw new HG({functionality:`media type: ${x.mediaType}`});break}}}break}case"tool":{for(let i=0;i<r.length;i++){let x=r[i];if(x.type==="tool-approval-response")continue;let n=i===r.length-1,z=(h=M.getCacheControl(x.providerOptions,{type:"tool result part",canCache:!0}))!=null?h:n?M.getCacheControl(o.providerOptions,{type:"tool result message",canCache:!0}):void 0,d=x.output,P;switch(d.type){case"content":P=d.value.map((U)=>{var D;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=(D=U.providerOptions)==null?void 0:D.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(kG);break;case"text":case"error-text":P=d.value;break;case"execution-denied":P=(w=d.reason)!=null?w:"Tool execution denied.";break;case"json":case"error-json":default:P=JSON.stringify(d.value);break}I.push({type:"tool_result",tool_use_id:x.toolCallId,content:P,is_error:d.type==="error-text"||d.type==="error-json"?!0:void 0,cache_control:z})}break}default:throw Error(`Unsupported role: ${t}`)}}XG.push({role:"user",content:I});break}case"assistant":{let I=[],o=new Set;for(let t=0;t<k.messages.length;t++){let r=k.messages[t],i=t===k.messages.length-1,{content:x}=r;for(let n=0;n<x.length;n++){let z=x[n],d=n===x.length-1,P=(N=M.getCacheControl(z.providerOptions,{type:"assistant message part",canCache:!0}))!=null?N:d?M.getCacheControl(r.providerOptions,{type:"assistant message",canCache:!0}):void 0;switch(z.type){case"text":{let U=(c=z.providerOptions)==null?void 0:c.anthropic;if((U==null?void 0:U.type)==="compaction")I.push({type:"compaction",content:z.text,cache_control:P});else I.push({type:"text",text:V&&i&&d?z.text.trim():z.text,cache_control:P});break}case"reasoning":{if(H){let U=await LG({provider:"anthropic",providerOptions:z.providerOptions,schema:GQ});if(U!=null)if(U.signature!=null)M.getCacheControl(z.providerOptions,{type:"thinking block",canCache:!1}),I.push({type:"thinking",thinking:z.text,signature:U.signature});else if(U.redactedData!=null)M.getCacheControl(z.providerOptions,{type:"redacted thinking block",canCache:!1}),I.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=E.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=(B=(S=z.providerOptions)==null?void 0:S.anthropic)==null?void 0:B.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}I.push({type:"mcp_tool_use",id:z.toolCallId,name:z.toolName,input:z.input,server_name:X,cache_control:P})}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"))I.push({type:"server_tool_use",id:z.toolCallId,name:z.input.type,input:z.input,cache_control:P});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,...f}=z.input;I.push({type:"server_tool_use",id:z.toolCallId,name:"code_execution",input:f,cache_control:P})}else if(A==="code_execution"||A==="web_fetch"||A==="web_search")I.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:P});else if(A==="tool_search_tool_regex"||A==="tool_search_tool_bm25")I.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:P});else Z.push({type:"other",message:`provider executed tool call for tool ${z.toolName} is not supported`});break}let U=(g=z.providerOptions)==null?void 0:g.anthropic,D=(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;I.push({type:"tool_use",id:z.toolCallId,name:z.toolName,input:z.input,...D&&{caller:D},cache_control:P});break}case"tool-result":{let U=E.toProviderToolName(z.toolName);if(o.has(z.toolCallId)){let D=z.output;if(D.type!=="json"&&D.type!=="error-json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}I.push({type:"mcp_tool_result",tool_use_id:z.toolCallId,is_error:D.type==="error-json",content:D.value,cache_control:P})}else if(U==="code_execution"){let D=z.output;if(D.type==="error-text"||D.type==="error-json"){let A={};try{if(typeof D.value==="string")A=JSON.parse(D.value);else if(typeof D.value==="object"&&D.value!==null)A=D.value}catch($){}if(A.type==="code_execution_tool_result_error")I.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:"code_execution_tool_result_error",error_code:(m=A.errorCode)!=null?m:"unknown"},cache_control:P});else I.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:P,content:{type:"bash_code_execution_tool_result_error",error_code:(O=A.errorCode)!=null?O:"unknown"}});break}if(D.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}if(D.value==null||typeof D.value!=="object"||!("type"in D.value)||typeof D.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(D.value.type==="code_execution_result"){let A=await GG({value:D.value,schema:iG});I.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:P})}else if(D.value.type==="encrypted_code_execution_result"){let A=await GG({value:D.value,schema:sG});if(A.type==="encrypted_code_execution_result")I.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:(C=A.content)!=null?C:[]},cache_control:P})}else{let A=await GG({value:D.value,schema:lG});if(A.type==="code_execution_result")I.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:P});else if(A.type==="bash_code_execution_result"||A.type==="bash_code_execution_tool_result_error")I.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:P,content:A});else I.push({type:"text_editor_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:P,content:A})}break}if(U==="web_fetch"){let D=z.output;if(D.type==="error-json"){let $={};try{if(typeof D.value==="string")$=JSON.parse(D.value);else if(typeof D.value==="object"&&D.value!==null)$=D.value}catch(X){let f=(QG=D.value)==null?void 0:QG.errorCode;$={errorCode:typeof f==="string"?f:"unavailable"}}I.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:P});break}if(D.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:D.value,schema:cG});I.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:P});break}if(U==="web_search"){let D=z.output;if(D.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:D.value,schema:uG});I.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:P});break}if(U==="tool_search_tool_regex"||U==="tool_search_tool_bm25"){let D=z.output;if(D.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${D.type} for tool ${z.toolName} is not supported`});break}let $=(await GG({value:D.value,schema:pG})).map((X)=>({type:"tool_reference",tool_name:X.toolName}));I.push({type:"tool_search_tool_result",tool_use_id:z.toolCallId,content:{type:"tool_search_tool_search_result",tool_references:$},cache_control:P});break}Z.push({type:"other",message:`provider executed tool result for tool ${z.toolName} is not supported`});break}}}}XG.push({role:"assistant",content:I});break}default:throw Error(`content type: ${ZG}`)}}return{prompt:{system:p,messages:XG},betas:Y}}function mQ(Q){let H=[],Z=void 0;for(let q of Q){let{role:E}=q;switch(E){case"system":{if((Z==null?void 0:Z.type)!=="system")Z={type:"system",messages:[]},H.push(Z);Z.messages.push(q);break}case"assistant":{if((Z==null?void 0:Z.type)!=="assistant")Z={type:"assistant",messages:[]},H.push(Z);Z.messages.push(q);break}case"user":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(q);break}case"tool":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(q);break}default:throw Error(`Unsupported role: ${E}`)}}return H}function JG({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 BG(Q,H,Z){var q;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 E=H[Q.document_index];if(!E)return;return{type:"source",sourceType:"document",id:Z(),mediaType:E.mediaType,title:(q=Q.document_title)!=null?q:E.title,filename:E.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 dQ=class{constructor(Q,H){this.specificationVersion="v3";var Z;this.modelId=Q,this.config=H,this.generateId=(Z=H.generateId)!=null?Z:AG}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:q,topP:E,topK:T,frequencyPenalty:b,presencePenalty:F,stopSequences:h,responseFormat:w,seed:N,tools:c,toolChoice:R,providerOptions:a,stream:S}){var B,g,m,O,e,C,s,QG,YG,Y;let j=[];if(b!=null)j.push({type:"unsupported",feature:"frequencyPenalty"});if(F!=null)j.push({type:"unsupported",feature:"presencePenalty"});if(N!=null)j.push({type:"unsupported",feature:"seed"});if(q!=null&&q>1)j.push({type:"unsupported",feature:"temperature",details:`${q} exceeds anthropic maximum of 1.0. clamped to 1.0`}),q=1;else if(q!=null&&q<0)j.push({type:"unsupported",feature:"temperature",details:`${q} is below anthropic minimum of 0. clamped to 0`}),q=0;if((w==null?void 0:w.type)==="json"){if(w.schema==null)j.push({type:"unsupported",feature:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."})}let M=this.providerOptionsName,p=await LG({provider:"anthropic",providerOptions:a,schema:xG}),XG=M!=="anthropic"?await LG({provider:M,providerOptions:a,schema:xG}):null,zG=XG!=null,L=Object.assign({},p!=null?p:{},XG!=null?XG:{}),{maxOutputTokens:v,supportsStructuredOutput:k,rejectsSamplingParameters:V,isKnownModel:ZG}=uQ(this.modelId);if(V){if(q!=null)j.push({type:"unsupported",feature:"temperature",details:`temperature is not supported by ${this.modelId} and will be ignored`}),q=void 0;if(T!=null)j.push({type:"unsupported",feature:"topK",details:`topK is not supported by ${this.modelId} and will be ignored`}),T=void 0;if(E!=null)j.push({type:"unsupported",feature:"topP",details:`topP is not supported by ${this.modelId} and will be ignored`}),E=void 0}let I=ZG||this.modelId.startsWith("claude-"),o=((B=this.config.supportsNativeStructuredOutput)!=null?B:!0)&&k,t=((g=this.config.supportsStrictTools)!=null?g:!0)&&k,r=(m=L==null?void 0:L.structuredOutputMode)!=null?m:"auto",i=r==="outputFormat"||r==="auto"&&o,x=(w==null?void 0:w.type)==="json"&&w.schema!=null&&!i?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:w.schema}:void 0,n=L==null?void 0:L.contextManagement,z=new RG,d=bG({tools:c,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:P,betas:U}=await gQ({prompt:H,sendReasoning:(O=L==null?void 0:L.sendReasoning)!=null?O:!0,warnings:j,cacheControlValidator:z,toolNameMapping:d}),D=(e=L==null?void 0:L.thinking)==null?void 0:e.type,A=D==="enabled"||D==="adaptive",$=D==="enabled"?(C=L==null?void 0:L.thinking)==null?void 0:C.budgetTokens:void 0,X=D==="adaptive"?(s=L==null?void 0:L.thinking)==null?void 0:s.display:void 0,f=Z!=null?Z:v,K={model:this.modelId,max_tokens:f,temperature:q,top_k:T,top_p:E,stop_sequences:h,...A&&{thinking:{type:D,...$!=null&&{budget_tokens:$},...X!=null&&{display:X}}},...((L==null?void 0:L.effort)||(L==null?void 0:L.taskBudget)||i&&(w==null?void 0:w.type)==="json"&&w.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}}},...i&&(w==null?void 0:w.type)==="json"&&w.schema!=null&&{format:{type:"json_schema",schema:w.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((y)=>({type:y.type,name:y.name,url:y.url,authorization_token:y.authorizationToken,tool_configuration:y.toolConfiguration?{allowed_tools:y.toolConfiguration.allowedTools,enabled:y.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((y)=>({type:y.type,skill_id:y.skillId,version:y.version}))}:L.container.id},system:P.system,messages:P.messages,...n&&{context_management:{edits:n.edits.map((y)=>{let SG=y.type;switch(SG){case"clear_tool_uses_20250919":return{type:y.type,...y.trigger!==void 0&&{trigger:y.trigger},...y.keep!==void 0&&{keep:y.keep},...y.clearAtLeast!==void 0&&{clear_at_least:y.clearAtLeast},...y.clearToolInputs!==void 0&&{clear_tool_inputs:y.clearToolInputs},...y.excludeTools!==void 0&&{exclude_tools:y.excludeTools}};case"clear_thinking_20251015":return{type:y.type,...y.keep!==void 0&&{keep:y.keep}};case"compact_20260112":return{type:y.type,...y.trigger!==void 0&&{trigger:y.trigger},...y.pauseAfterCompaction!==void 0&&{pause_after_compaction:y.pauseAfterCompaction},...y.instructions!==void 0&&{instructions:y.instructions}};default:j.push({type:"other",message:`Unknown context management strategy: ${SG}`});return}}).filter((y)=>y!==void 0)}}};if(A){if(D==="enabled"&&$==null)j.push({type:"compatibility",feature:"extended thinking",details:"thinking budget is required when thinking is enabled. using default budget of 1024 tokens."}),K.thinking={type:"enabled",budget_tokens:1024},$=1024;if(K.temperature!=null)K.temperature=void 0,j.push({type:"unsupported",feature:"temperature",details:"temperature is not supported when thinking is enabled"});if(T!=null)K.top_k=void 0,j.push({type:"unsupported",feature:"topK",details:"topK is not supported when thinking is enabled"});if(E!=null)K.top_p=void 0,j.push({type:"unsupported",feature:"topP",details:"topP is not supported when thinking is enabled"});K.max_tokens=f+($!=null?$:0)}else if(I&&E!=null&&q!=null)j.push({type:"unsupported",feature:"topP",details:"topP is not supported when temperature is set. topP is ignored."}),K.top_p=void 0;if(ZG&&K.max_tokens>v){if(Z!=null)j.push({type:"unsupported",feature:"maxOutputTokens",details:`${K.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${v} max output tokens. The max output tokens have been limited to ${v}.`});K.max_tokens=v}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((y)=>y.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"),!(c==null?void 0:c.some((y)=>y.type==="provider"&&(y.id==="anthropic.code_execution_20250825"||y.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 _=S&&((YG=L==null?void 0:L.toolStreaming)!=null?YG:!0),{tools:$G,toolChoice:EG,toolWarnings:qG,betas:nG}=await PQ(x!=null?{tools:[...c!=null?c:[],x],toolChoice:{type:"required"},disableParallelToolUse:!0,cacheControlValidator:z,supportsStructuredOutput:!1,supportsStrictTools:t,defaultEagerInputStreaming:_}:{tools:c!=null?c:[],toolChoice:R,disableParallelToolUse:L==null?void 0:L.disableParallelToolUse,cacheControlValidator:z,supportsStructuredOutput:o,supportsStrictTools:t,defaultEagerInputStreaming:_}),rG=z.getWarnings();return{args:{...K,tools:$G,tool_choice:EG,stream:S===!0?!0:void 0},warnings:[...j,...qG,...rG],betas:new Set([...U,...nG,...Q,...(Y=L==null?void 0:L.anthropicBeta)!=null?Y:[]]),usesJsonResponseTool:x!=null,toolNameMapping:d,providerOptionsName:M,usedCustomProviderKey:zG}}async getHeaders({betas:Q,headers:H}){return CG(await UG(this.config.headers),H,Q.size>0?{"anthropic-beta":Array.from(Q).join(",")}:{})}async getBetasFromHeaders(Q){var H,Z;let E=(H=(await UG(this.config.headers))["anthropic-beta"])!=null?H:"",T=(Z=Q==null?void 0:Q["anthropic-beta"])!=null?Z:"";return new Set([...E.toLowerCase().split(","),...T.toLowerCase().split(",")].map((b)=>b.trim()).filter((b)=>b!==""))}buildRequestUrl(Q){var H,Z,q;return(q=(Z=(H=this.config).buildRequestUrl)==null?void 0:Z.call(H,this.config.baseURL,Q))!=null?q:`${this.config.baseURL}/messages`}transformRequestBody(Q,H){var Z,q,E;return(E=(q=(Z=this.config).transformRequestBody)==null?void 0:q.call(Z,Q,H))!=null?E:Q}extractCitationDocuments(Q){let H=(Z)=>{var q,E;if(Z.type!=="file")return!1;if(Z.mediaType!=="application/pdf"&&Z.mediaType!=="text/plain")return!1;let T=(q=Z.providerOptions)==null?void 0:q.anthropic,b=T==null?void 0:T.citations;return(E=b==null?void 0:b.enabled)!=null?E:!1};return Q.filter((Z)=>Z.role==="user").flatMap((Z)=>Z.content).filter(H).map((Z)=>{var q;let E=Z;return{title:(q=E.filename)!=null?q:"Untitled Document",filename:E.filename,mediaType:E.mediaType}})}async doGenerate(Q){var H,Z,q,E,T,b,F;let{args:h,warnings:w,betas:N,usesJsonResponseTool:c,toolNameMapping:R,providerOptionsName:a,usedCustomProviderKey:S}=await this.getArgs({...Q,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),B=[...this.extractCitationDocuments(Q.prompt)],g=IG(h.tools),{responseHeaders:m,value:O,rawValue:e}=await VG({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:N,headers:Q.headers}),body:this.transformRequestBody(h,N),failedResponseHandler:yG,successfulResponseHandler:mG(oG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),C=[],s={},QG={},YG=!1;for(let Y of O.content)switch(Y.type){case"text":{if(!c){if(C.push({type:"text",text:Y.text}),Y.citations)for(let j of Y.citations){let M=BG(j,B,this.generateId);if(M)C.push(M)}}break}case"thinking":{C.push({type:"reasoning",text:Y.thinking,providerMetadata:{anthropic:{signature:Y.signature}}});break}case"redacted_thinking":{C.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:Y.data}}});break}case"compaction":{C.push({type:"text",text:Y.content,providerMetadata:{anthropic:{type:"compaction"}}});break}case"tool_use":{if(c&&Y.name==="json")YG=!0,C.push({type:"text",text:JSON.stringify(Y.input)});else{let M=Y.caller,p=M?{type:M.type,toolId:"tool_id"in M?M.tool_id:void 0}:void 0;C.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")C.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;C.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(j),providerExecuted:!0,...g&&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,C.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}}},C.push(s[Y.id]);break}case"mcp_tool_result":{C.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")B.push({title:(H=Y.content.content.title)!=null?H:Y.content.url,mediaType:Y.content.content.source.media_type}),C.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")C.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)){C.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),result:Y.content.map((j)=>{var M;return{url:j.url,title:j.title,pageAge:(M=j.page_age)!=null?M:null,encryptedContent:j.encrypted_content,type:j.type}})});for(let j of Y.content)C.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 C.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")C.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:(q=Y.content.content)!=null?q:[]}});else if(Y.content.type==="encrypted_code_execution_result")C.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:(E=Y.content.content)!=null?E:[]}});else if(Y.content.type==="code_execution_tool_result_error")C.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":{C.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 M=R.toCustomToolName("tool_search_tool_bm25"),p=R.toCustomToolName("tool_search_tool_regex");if(M!=="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")C.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),result:Y.content.tool_references.map((M)=>({type:M.type,toolName:M.tool_name}))});else C.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:C,finishReason:{unified:JG({finishReason:O.stop_reason,isJsonResponseFromTool:YG}),raw:(T=O.stop_reason)!=null?T:void 0},usage:fG({usage:O.usage}),request:{body:h},response:{id:(b=O.id)!=null?b:void 0,modelId:(F=O.model)!=null?F:void 0,headers:m,body:e},warnings:w,providerMetadata:(()=>{var Y,j,M,p,XG;let zG={usage:O.usage,cacheCreationInputTokens:(Y=O.usage.cache_creation_input_tokens)!=null?Y:null,stopSequence:(j=O.stop_sequence)!=null?j:null,iterations:O.usage.iterations?O.usage.iterations.map((v)=>({type:v.type,inputTokens:v.input_tokens,outputTokens:v.output_tokens})):null,container:O.container?{expiresAt:O.container.expires_at,id:O.container.id,skills:(p=(M=O.container.skills)==null?void 0:M.map((v)=>({type:v.type,skillId:v.skill_id,version:v.version})))!=null?p:null}:null,contextManagement:(XG=wG(O.context_management))!=null?XG:null},L={anthropic:zG};if(S&&a!=="anthropic")L[a]=zG;return L})()}}async doStream(Q){var H,Z;let{args:q,warnings:E,betas:T,usesJsonResponseTool:b,toolNameMapping:F,providerOptionsName:h,usedCustomProviderKey:w}=await this.getArgs({...Q,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),N=[...this.extractCitationDocuments(Q.prompt)],c=IG(q.tools),R=this.buildRequestUrl(!0),{responseHeaders:a,value:S}=await VG({url:R,headers:await this.getHeaders({betas:T,headers:Q.headers}),body:this.transformRequestBody(q,T),failedResponseHandler:yG,successfulResponseHandler:gG(tG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),B={unified:"other",raw:void 0},g={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},m={},O={},e={},C=null,s=void 0,QG=null,YG=null,Y=null,j=!1,M=void 0,p=this.generateId,XG=S.pipeThrough(new TransformStream({start(k){k.enqueue({type:"stream-start",warnings:E})},transform(k,V){var ZG,I,o,t,r,i,x,n,z,d,P,U,D,A;if(Q.includeRawChunks)V.enqueue({type:"raw",rawValue:k.rawValue});if(!k.success){V.enqueue({type:"error",error:k.error});return}let $=k.value;switch($.type){case"ping":return;case"content_block_start":{let X=$.content_block,f=X.type;switch(M=f,f){case"text":{if(b)return;m[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});return}case"thinking":{m[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index)});return}case"redacted_thinking":{m[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index),providerMetadata:{anthropic:{redactedData:X.data}}});return}case"compaction":{m[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index),providerMetadata:{anthropic:{type:"compaction"}}});return}case"tool_use":{if(b&&X.name==="json")j=!0,m[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});else{let _=X.caller,$G=_?{type:_.type,toolId:"tool_id"in _?_.tool_id:void 0}:void 0,qG=X.input&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";m[$.index]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:qG,firstDelta:qG.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 K=X.name==="text_editor_code_execution"||X.name==="bash_code_execution"?"code_execution":X.name,_=F.toCustomToolName(K),$G=X.input!=null&&typeof X.input==="object"&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";m[$.index]={type:"tool-call",toolCallId:X.id,toolName:_,input:$G,providerExecuted:!0,...c&&K==="code_execution"?{dynamic:!0}:{},firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:_,providerExecuted:!0,...c&&K==="code_execution"?{dynamic:!0}:{}})}else if(X.name==="tool_search_tool_regex"||X.name==="tool_search_tool_bm25"){e[X.id]=X.name;let K=F.toCustomToolName(X.name);m[$.index]={type:"tool-call",toolCallId:X.id,toolName:K,input:"",providerExecuted:!0,firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:K,providerExecuted:!0})}return}case"web_fetch_tool_result":{if(X.content.type==="web_fetch_result")N.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:F.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:F.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:F.toCustomToolName("web_search"),result:X.content.map((K)=>{var _;return{url:K.url,title:K.title,pageAge:(_=K.page_age)!=null?_:null,encryptedContent:K.encrypted_content,type:K.type}})});for(let K of X.content)V.enqueue({type:"source",sourceType:"url",id:p(),url:K.url,title:K.title,providerMetadata:{anthropic:{pageAge:(I=K.page_age)!=null?I:null}}})}else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:F.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:F.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:F.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:F.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:F.toCustomToolName("code_execution"),result:X.content});return}case"tool_search_tool_result":{let K=e[X.tool_use_id];if(K==null){let _=F.toCustomToolName("tool_search_tool_bm25"),$G=F.toCustomToolName("tool_search_tool_regex");if(_!=="tool_search_tool_bm25")K="tool_search_tool_bm25";else if($G!=="tool_search_tool_regex")K="tool_search_tool_regex";else K="tool_search_tool_regex"}if(X.content.type==="tool_search_tool_search_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:F.toCustomToolName(K),result:X.content.tool_references.map((_)=>({type:_.type,toolName:_.tool_name}))});else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:F.toCustomToolName(K),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:X.content.error_code}});return}case"mcp_tool_use":{O[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(O[X.id]);return}case"mcp_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:O[X.tool_use_id].toolName,isError:X.is_error,result:X.content,dynamic:!0,providerMetadata:O[X.tool_use_id].providerMetadata});return}default:throw Error(`Unsupported content block type: ${f}`)}}case"content_block_stop":{if(m[$.index]!=null){let X=m[$.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(!(b&&X.toolName==="json")){V.enqueue({type:"tool-input-end",id:X.toolCallId});let K=X.input===""?"{}":X.input;if(X.providerToolName==="code_execution")try{let _=JSON.parse(K);if(_!=null&&typeof _==="object"&&"code"in _&&!("type"in _))K=JSON.stringify({type:"programmatic-tool-call",..._})}catch(_){}V.enqueue({type:"tool-call",toolCallId:X.toolCallId,toolName:X.toolName,input:K,providerExecuted:X.providerExecuted,...c&&X.providerToolName==="code_execution"?{dynamic:!0}:{},...X.caller&&{providerMetadata:{anthropic:{caller:X.caller}}}})}break}delete m[$.index]}M=void 0;return}case"content_block_delta":{let X=$.delta.type;switch(X){case"text_delta":{if(b)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(M==="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 f=m[$.index],K=$.delta.partial_json;if(K.length===0)return;if(j){if((f==null?void 0:f.type)!=="text")return;V.enqueue({type:"text-delta",id:String($.index),delta:K})}else{if((f==null?void 0:f.type)!=="tool-call")return;if(f.firstDelta&&(f.providerToolName==="bash_code_execution"||f.providerToolName==="text_editor_code_execution"))K=`{"type": "${f.providerToolName}",${K.substring(1)}`;V.enqueue({type:"tool-input-delta",id:f.toolCallId,delta:K}),f.input+=K,f.firstDelta=!1}return}case"citations_delta":{let f=$.delta.citation,K=BG(f,N,p);if(K)V.enqueue(K);return}default:throw Error(`Unsupported delta type: ${X}`)}}case"message_start":{if(g.input_tokens=$.message.usage.input_tokens,g.cache_read_input_tokens=(r=$.message.usage.cache_read_input_tokens)!=null?r:0,g.cache_creation_input_tokens=(i=$.message.usage.cache_creation_input_tokens)!=null?i:0,s={...$.message.usage},QG=(x=$.message.usage.cache_creation_input_tokens)!=null?x:null,$.message.container!=null)Y={expiresAt:$.message.container.expires_at,id:$.message.container.id,skills:null};if($.message.stop_reason!=null)B={unified:JG({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 f=$.message.content[X];if(f.type==="tool_use"){let K=f.caller,_=K?{type:K.type,toolId:"tool_id"in K?K.tool_id:void 0}:void 0;V.enqueue({type:"tool-input-start",id:f.id,toolName:f.name});let $G=JSON.stringify((d=f.input)!=null?d:{});V.enqueue({type:"tool-input-delta",id:f.id,delta:$G}),V.enqueue({type:"tool-input-end",id:f.id}),V.enqueue({type:"tool-call",toolCallId:f.id,toolName:f.name,input:$G,..._&&{providerMetadata:{anthropic:{caller:_}}}})}}return}case"message_delta":{if($.usage.input_tokens!=null&&g.input_tokens!==$.usage.input_tokens)g.input_tokens=$.usage.input_tokens;if(g.output_tokens=$.usage.output_tokens,$.usage.cache_read_input_tokens!=null)g.cache_read_input_tokens=$.usage.cache_read_input_tokens;if($.usage.cache_creation_input_tokens!=null)g.cache_creation_input_tokens=$.usage.cache_creation_input_tokens,QG=$.usage.cache_creation_input_tokens;if($.usage.iterations!=null)g.iterations=$.usage.iterations;if(B={unified:JG({finishReason:$.delta.stop_reason,isJsonResponseFromTool:j}),raw:(P=$.delta.stop_reason)!=null?P: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=(D=$.delta.container.skills)==null?void 0:D.map((X)=>({type:X.type,skillId:X.skill_id,version:X.version})))!=null?A:null}:null,$.context_management)C=wG($.context_management);s={...s,...$.usage};return}case"message_stop":{let X={usage:s!=null?s:null,cacheCreationInputTokens:QG,stopSequence:YG,iterations:g.iterations?g.iterations.map((K)=>({type:K.type,inputTokens:K.input_tokens,outputTokens:K.output_tokens})):null,container:Y,contextManagement:C},f={anthropic:X};if(w&&h!=="anthropic")f[h]=X;V.enqueue({type:"finish",finishReason:B,usage:fG({usage:g,rawUsage:s}),providerMetadata:f});return}case"error":{V.enqueue({type:"error",error:$.error});return}default:throw Error(`Unsupported chunk type: ${$}`)}}})),[zG,L]=XG.tee(),v=zG.getReader();try{await v.read();let k=await v.read();if(((H=k.value)==null?void 0:H.type)==="raw")k=await v.read();if(((Z=k.value)==null?void 0:Z.type)==="error"){let V=k.value.error;throw new NG({message:V.message,url:R,requestBodyValues:q,statusCode:V.type==="overloaded_error"?529:500,responseHeaders:a,responseBody:JSON.stringify(V),isRetryable:V.type==="overloaded_error"})}}finally{v.cancel().catch(()=>{}),v.releaseLock()}return{stream:L,request:{body:q},response:{headers:a}}}};function uQ(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 IG(Q){if(!Q)return!1;let H=!1,Z=!1;for(let q of Q){if("type"in q&&(q.type==="web_fetch_20260209"||q.type==="web_search_20260209")){H=!0;continue}if(q.name==="code_execution"){Z=!0;break}}return H&&!Z}function wG(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 cQ=J(()=>W(G.object({command:G.string(),restart:G.boolean().optional()}))),iQ=u({id:"anthropic.bash_20241022",inputSchema:cQ}),lQ=J(()=>W(G.object({command:G.string(),restart:G.boolean().optional()}))),sQ=u({id:"anthropic.bash_20250124",inputSchema:lQ}),pQ=J(()=>W(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()}))),nQ=u({id:"anthropic.computer_20241022",inputSchema:pQ}),rQ=J(()=>W(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()}))),aQ=u({id:"anthropic.computer_20250124",inputSchema:rQ}),eQ=J(()=>W(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()}))),oQ=u({id:"anthropic.computer_20251124",inputSchema:eQ}),tQ=J(()=>W(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()})]))),GX=u({id:"anthropic.memory_20250818",inputSchema:tQ}),QX=J(()=>W(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()}))),XX=u({id:"anthropic.text_editor_20241022",inputSchema:QX}),YX=J(()=>W(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()}))),ZX=u({id:"anthropic.text_editor_20250124",inputSchema:YX}),$X=J(()=>W(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()}))),zX=u({id:"anthropic.text_editor_20250429",inputSchema:$X}),LX=J(()=>W(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),HX=J(()=>W(G.object({query:G.string(),limit:G.number().optional()}))),qX=l({id:"anthropic.tool_search_bm25_20251119",inputSchema:HX,outputSchema:LX,supportsDeferredResults:!0}),AX=(Q={})=>{return qX(Q)},KX={bash_20241022:iQ,bash_20250124:sQ,codeExecution_20250522:IQ,codeExecution_20250825:MQ,codeExecution_20260120:TQ,computer_20241022:nQ,computer_20250124:aQ,computer_20251124:oQ,memory_20250818:GX,textEditor_20241022:XX,textEditor_20250124:ZX,textEditor_20250429:zX,textEditor_20250728:$Q,webFetch_20250910:xQ,webFetch_20260209:EQ,webSearch_20250305:WQ,webSearch_20260209:AQ,toolSearchRegex_20251119:vQ,toolSearchBm25_20251119:AX};function DX(Q={}){var H,Z;let q=(H=dG(_G({settingValue:Q.baseURL,environmentVariableName:"ANTHROPIC_BASE_URL"})))!=null?H:"https://api.anthropic.com/v1",E=(Z=Q.name)!=null?Z:"anthropic.messages";if(Q.apiKey&&Q.authToken)throw new MG({argument:"apiKey/authToken",message:"Both apiKey and authToken were provided. Please use only one authentication method."});let T=()=>{let h=Q.authToken?{Authorization:`Bearer ${Q.authToken}`}:{"x-api-key":vG({apiKey:Q.apiKey,environmentVariableName:"ANTHROPIC_API_KEY",description:"Anthropic"})};return OG({"anthropic-version":"2023-06-01",...h,...Q.headers},`ai-sdk/anthropic/${aG}`)},b=(h)=>{var w;return new dQ(h,{provider:E,baseURL:q,headers:T,fetch:Q.fetch,generateId:(w=Q.generateId)!=null?w:AG,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})})},F=function(h){if(new.target)throw Error("The Anthropic model function cannot be called with the new keyword.");return b(h)};return F.specificationVersion="v3",F.languageModel=b,F.chat=b,F.messages=b,F.embeddingModel=(h)=>{throw new WG({modelId:h,modelType:"embeddingModel"})},F.textEmbeddingModel=F.embeddingModel,F.imageModel=(h)=>{throw new WG({modelId:h,modelType:"imageModel"})},F.tools=KX,F}var KY=DX();function DY({steps:Q}){var H,Z,q;for(let E=Q.length-1;E>=0;E--){let T=(q=(Z=(H=Q[E].providerMetadata)==null?void 0:H.anthropic)==null?void 0:Z.container)==null?void 0:q.id;if(T)return{providerOptions:{anthropic:{container:{id:T}}}}}return}export{DY as forwardAnthropicContainerIdFromLastStep,DX as createAnthropic,KY as anthropic,aG as VERSION};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$e as b,Se as E,_e as O,cf as k,ff as M,gf as W,kf as F,lf as S,pf as T,qf as _,rf as H,tf as C}from"./chunk-gsg6zn7e.js";import{Tp as I,Up as R,Wp as P}from"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import{Kt as j}from"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-e0vrxetq.js";var u=j.object({thinking:j.object({type:j.enum(["enabled","disabled"]).optional(),tokenBudget:j.number().optional()}).optional()}),d=j.object({message:j.string()}),w=T({errorSchema:d,errorToMessage:(z)=>z.message});function c({tools:z,toolChoice:X}){z=(z==null?void 0:z.length)?z:void 0;let Y=[];if(z==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Y};let $=[];for(let J of z)if(J.type==="provider")Y.push({type:"unsupported",feature:`provider-defined tool ${J.id}`});else $.push({type:"function",function:{name:J.name,description:J.description,parameters:J.inputSchema}});if(X==null)return{tools:$,toolChoice:void 0,toolWarnings:Y};let D=X.type;switch(D){case"auto":return{tools:$,toolChoice:void 0,toolWarnings:Y};case"none":return{tools:$,toolChoice:"NONE",toolWarnings:Y};case"required":return{tools:$,toolChoice:"REQUIRED",toolWarnings:Y};case"tool":return{tools:$.filter((J)=>J.function.name===X.toolName),toolChoice:"REQUIRED",toolWarnings:Y};default:throw new P({functionality:`tool choice type: ${D}`})}}function y(z){if(z==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let{input_tokens:X,output_tokens:Y}=z;return{inputTokens:{total:X,noCache:X,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:Y,text:Y,reasoning:void 0},raw:z}}function p(z){let X=[],Y=[],$=[];for(let{role:D,content:J}of z)switch(D){case"system":{X.push({role:"system",content:J});break}case"user":{X.push({role:"user",content:J.map((Q)=>{var B;switch(Q.type){case"text":return Q.text;case"file":{let G;if(typeof Q.data==="string")G=Q.data;else if(Q.data instanceof Uint8Array){if(!(((B=Q.mediaType)==null?void 0:B.startsWith("text/"))||Q.mediaType==="application/json"))throw new P({functionality:`document media type: ${Q.mediaType}`,message:`Media type '${Q.mediaType}' is not supported. Supported media types are: text/* and application/json.`});G=new TextDecoder().decode(Q.data)}else throw new P({functionality:"File URL data",message:"URLs should be downloaded by the AI SDK and not reach this point. This indicates a configuration issue."});return Y.push({data:{text:G,title:Q.filename}}),""}}}).join("")});break}case"assistant":{let Q="",B=[];for(let G of J)switch(G.type){case"text":{Q+=G.text;break}case"tool-call":{B.push({id:G.toolCallId,type:"function",function:{name:G.toolName,arguments:JSON.stringify(G.input)}});break}}X.push({role:"assistant",content:B.length>0?void 0:Q,tool_calls:B.length>0?B:void 0,tool_plan:void 0});break}case"tool":{X.push(...J.filter((Q)=>Q.type!=="tool-approval-response").map((Q)=>{var B;let G=Q.output,K;switch(G.type){case"text":case"error-text":K=G.value;break;case"execution-denied":K=(B=G.reason)!=null?B:"Tool execution denied.";break;case"content":case"json":case"error-json":K=JSON.stringify(G.value);break}return{role:"tool",content:K,tool_call_id:Q.toolCallId}}));break}default:throw Error(`Unsupported role: ${D}`)}return{messages:X,documents:Y,warnings:$}}function f(z){switch(z){case"COMPLETE":case"STOP_SEQUENCE":return"stop";case"MAX_TOKENS":return"length";case"ERROR":return"error";case"TOOL_CALL":return"tool-calls";default:return"other"}}var i=class{constructor(z,X){this.specificationVersion="v3",this.supportedUrls={},this.modelId=z,this.config=X}get provider(){return this.config.provider}async getArgs({prompt:z,maxOutputTokens:X,temperature:Y,topP:$,topK:D,frequencyPenalty:J,presencePenalty:Q,stopSequences:B,responseFormat:G,seed:K,tools:U,toolChoice:N,providerOptions:q}){var Z,L;let A=(Z=await F({provider:"cohere",providerOptions:q,schema:u}))!=null?Z:{},{messages:V,documents:x,warnings:h}=p(z),{tools:v,toolChoice:m,toolWarnings:g}=c({tools:U,toolChoice:N});return{args:{model:this.modelId,frequency_penalty:J,presence_penalty:Q,max_tokens:X,temperature:Y,p:$,k:D,seed:K,stop_sequences:B,response_format:(G==null?void 0:G.type)==="json"?{type:"json_object",json_schema:G.schema}:void 0,messages:V,tools:v,tool_choice:m,...x.length>0&&{documents:x},...A.thinking&&{thinking:{type:(L=A.thinking.type)!=null?L:"enabled",token_budget:A.thinking.tokenBudget}}},warnings:[...g,...h]}}async doGenerate(z){var X,Y,$,D,J,Q,B;let{args:G,warnings:K}=await this.getArgs(z),{responseHeaders:U,value:N,rawValue:q}=await S({url:`${this.config.baseURL}/chat`,headers:E(this.config.headers(),z.headers),body:G,failedResponseHandler:w,successfulResponseHandler:H(a),abortSignal:z.abortSignal,fetch:this.config.fetch}),Z=[];for(let L of(X=N.message.content)!=null?X:[]){if(L.type==="text"&&L.text.length>0){Z.push({type:"text",text:L.text});continue}if(L.type==="thinking"&&L.thinking.length>0){Z.push({type:"reasoning",text:L.thinking});continue}}for(let L of(Y=N.message.citations)!=null?Y:[])Z.push({type:"source",sourceType:"document",id:this.config.generateId(),mediaType:"text/plain",title:((D=($=L.sources[0])==null?void 0:$.document)==null?void 0:D.title)||"Document",providerMetadata:{cohere:{start:L.start,end:L.end,text:L.text,sources:L.sources,...L.type&&{citationType:L.type}}}});for(let L of(J=N.message.tool_calls)!=null?J:[])Z.push({type:"tool-call",toolCallId:L.id,toolName:L.function.name,input:L.function.arguments.replace(/^null$/,"{}")});return{content:Z,finishReason:{unified:f(N.finish_reason),raw:(Q=N.finish_reason)!=null?Q:void 0},usage:y(N.usage.tokens),request:{body:G},response:{id:(B=N.generation_id)!=null?B:void 0,headers:U,body:q},warnings:K}}async doStream(z){let{args:X,warnings:Y}=await this.getArgs(z),{responseHeaders:$,value:D}=await S({url:`${this.config.baseURL}/chat`,headers:E(this.config.headers(),z.headers),body:{...X,stream:!0},failedResponseHandler:w,successfulResponseHandler:_(s),abortSignal:z.abortSignal,fetch:this.config.fetch}),J={unified:"other",raw:void 0},Q=void 0,B=null,G=!1;return{stream:D.pipeThrough(new TransformStream({start(K){K.enqueue({type:"stream-start",warnings:Y})},transform(K,U){var N,q;if(z.includeRawChunks)U.enqueue({type:"raw",rawValue:K.rawValue});if(!K.success){J={unified:"error",raw:void 0},U.enqueue({type:"error",error:K.error});return}let Z=K.value;switch(Z.type){case"content-start":{if(Z.delta.message.content.type==="thinking"){U.enqueue({type:"reasoning-start",id:String(Z.index)}),G=!0;return}U.enqueue({type:"text-start",id:String(Z.index)});return}case"content-delta":{if("thinking"in Z.delta.message.content){U.enqueue({type:"reasoning-delta",id:String(Z.index),delta:Z.delta.message.content.thinking});return}U.enqueue({type:"text-delta",id:String(Z.index),delta:Z.delta.message.content.text});return}case"content-end":{if(G){U.enqueue({type:"reasoning-end",id:String(Z.index)}),G=!1;return}U.enqueue({type:"text-end",id:String(Z.index)});return}case"tool-call-start":{let A=Z.delta.message.tool_calls.id,V=Z.delta.message.tool_calls.function.name,x=Z.delta.message.tool_calls.function.arguments;if(B={id:A,name:V,arguments:x,hasFinished:!1},U.enqueue({type:"tool-input-start",id:A,toolName:V}),x.length>0)U.enqueue({type:"tool-input-delta",id:A,delta:x});return}case"tool-call-delta":{if(B&&!B.hasFinished){let A=Z.delta.message.tool_calls.function.arguments;B.arguments+=A,U.enqueue({type:"tool-input-delta",id:B.id,delta:A})}return}case"tool-call-end":{if(B&&!B.hasFinished)U.enqueue({type:"tool-input-end",id:B.id}),U.enqueue({type:"tool-call",toolCallId:B.id,toolName:B.name,input:JSON.stringify(JSON.parse(((N=B.arguments)==null?void 0:N.trim())||"{}"))}),B.hasFinished=!0,B=null;return}case"message-start":{U.enqueue({type:"response-metadata",id:(q=Z.id)!=null?q:void 0});return}case"message-end":{J={unified:f(Z.delta.finish_reason),raw:Z.delta.finish_reason},Q=Z.delta.usage.tokens;return}default:return}},flush(K){K.enqueue({type:"finish",finishReason:J,usage:y(Q)})}})),request:{body:{...X,stream:!0}},response:{headers:$}}}},a=j.object({generation_id:j.string().nullish(),message:j.object({role:j.string(),content:j.array(j.union([j.object({type:j.literal("text"),text:j.string()}),j.object({type:j.literal("thinking"),thinking:j.string()})])).nullish(),tool_plan:j.string().nullish(),tool_calls:j.array(j.object({id:j.string(),type:j.literal("function"),function:j.object({name:j.string(),arguments:j.string()})})).nullish(),citations:j.array(j.object({start:j.number(),end:j.number(),text:j.string(),sources:j.array(j.object({type:j.string().optional(),id:j.string().optional(),document:j.object({id:j.string().optional(),text:j.string(),title:j.string()})})),type:j.string().optional()})).nullish()}),finish_reason:j.string(),usage:j.object({billed_units:j.object({input_tokens:j.number(),output_tokens:j.number()}),tokens:j.object({input_tokens:j.number(),output_tokens:j.number()})})}),s=j.discriminatedUnion("type",[j.object({type:j.literal("citation-start")}),j.object({type:j.literal("citation-end")}),j.object({type:j.literal("content-start"),index:j.number(),delta:j.object({message:j.object({content:j.union([j.object({type:j.literal("text"),text:j.string()}),j.object({type:j.literal("thinking"),thinking:j.string()})])})})}),j.object({type:j.literal("content-delta"),index:j.number(),delta:j.object({message:j.object({content:j.union([j.object({text:j.string()}),j.object({thinking:j.string()})])})})}),j.object({type:j.literal("content-end"),index:j.number()}),j.object({type:j.literal("message-start"),id:j.string().nullish()}),j.object({type:j.literal("message-end"),delta:j.object({finish_reason:j.string(),usage:j.object({tokens:j.object({input_tokens:j.number(),output_tokens:j.number()})})})}),j.object({type:j.literal("tool-plan-delta"),delta:j.object({message:j.object({tool_plan:j.string()})})}),j.object({type:j.literal("tool-call-start"),delta:j.object({message:j.object({tool_calls:j.object({id:j.string(),type:j.literal("function"),function:j.object({name:j.string(),arguments:j.string()})})})})}),j.object({type:j.literal("tool-call-delta"),delta:j.object({message:j.object({tool_calls:j.object({function:j.object({arguments:j.string()})})})})}),j.object({type:j.literal("tool-call-end")})]),r=j.object({inputType:j.enum(["search_document","search_query","classification","clustering"]).optional(),truncate:j.enum(["NONE","START","END"]).optional(),outputDimension:j.union([j.literal(256),j.literal(512),j.literal(1024),j.literal(1536)]).optional()}),l=class{constructor(z,X){this.specificationVersion="v3",this.maxEmbeddingsPerCall=96,this.supportsParallelCalls=!0,this.modelId=z,this.config=X}get provider(){return this.config.provider}async doEmbed({values:z,headers:X,abortSignal:Y,providerOptions:$}){var D;let J=await F({provider:"cohere",providerOptions:$,schema:r});if(z.length>this.maxEmbeddingsPerCall)throw new R({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:z});let{responseHeaders:Q,value:B,rawValue:G}=await S({url:`${this.config.baseURL}/embed`,headers:E(this.config.headers(),X),body:{model:this.modelId,embedding_types:["float"],texts:z,input_type:(D=J==null?void 0:J.inputType)!=null?D:"search_query",truncate:J==null?void 0:J.truncate,output_dimension:J==null?void 0:J.outputDimension},failedResponseHandler:w,successfulResponseHandler:H(n),abortSignal:Y,fetch:this.config.fetch});return{warnings:[],embeddings:B.embeddings.float,usage:{tokens:B.meta.billed_units.input_tokens},response:{headers:Q,body:G}}}},n=j.object({embeddings:j.object({float:j.array(j.array(j.number()))}),meta:j.object({billed_units:j.object({input_tokens:j.number()})})}),t=M(()=>W(j.object({id:j.string().nullish(),results:j.array(j.object({index:j.number(),relevance_score:j.number()})),meta:j.any()}))),e=M(()=>W(j.object({maxTokensPerDoc:j.number().optional(),priority:j.number().optional()}))),o=class{constructor(z,X){this.specificationVersion="v3",this.modelId=z,this.config=X}get provider(){return this.config.provider}async doRerank({documents:z,headers:X,query:Y,topN:$,abortSignal:D,providerOptions:J}){var Q;let B=await F({provider:"cohere",providerOptions:J,schema:e}),G=[];if(z.type==="object")G.push({type:"compatibility",feature:"object documents",details:"Object documents are converted to strings."});let{responseHeaders:K,value:U,rawValue:N}=await S({url:`${this.config.baseURL}/rerank`,headers:E(this.config.headers(),X),body:{model:this.modelId,query:Y,documents:z.type==="text"?z.values:z.values.map((q)=>JSON.stringify(q)),top_n:$,max_tokens_per_doc:B==null?void 0:B.maxTokensPerDoc,priority:B==null?void 0:B.priority},failedResponseHandler:w,successfulResponseHandler:H(t),abortSignal:D,fetch:this.config.fetch});return{ranking:U.results.map((q)=>({index:q.index,relevanceScore:q.relevance_score})),warnings:G,response:{id:(Q=U.id)!=null?Q:void 0,headers:K,body:N}}}},jj="3.0.27";function zj(z={}){var X;let Y=(X=C(z.baseURL))!=null?X:"https://api.cohere.com/v2",$=()=>b({Authorization:`Bearer ${k({apiKey:z.apiKey,environmentVariableName:"COHERE_API_KEY",description:"Cohere"})}`,...z.headers},`ai-sdk/cohere/${jj}`),D=(G)=>{var K;return new i(G,{provider:"cohere.chat",baseURL:Y,headers:$,fetch:z.fetch,generateId:(K=z.generateId)!=null?K:O})},J=(G)=>new l(G,{provider:"cohere.textEmbedding",baseURL:Y,headers:$,fetch:z.fetch}),Q=(G)=>new o(G,{provider:"cohere.reranking",baseURL:Y,headers:$,fetch:z.fetch}),B=function(G){if(new.target)throw Error("The Cohere model function cannot be called with the new keyword.");return D(G)};return B.specificationVersion="v3",B.languageModel=D,B.embedding=J,B.embeddingModel=J,B.textEmbedding=J,B.textEmbeddingModel=J,B.reranking=Q,B.rerankingModel=Q,B.imageModel=(G)=>{throw new I({modelId:G,modelType:"imageModel"})},B}var Fj=zj();export{zj as createCohere,Fj as cohere,jj as VERSION};
|
|
2
|
+
import{$e as O,Te as E,af as b,df as k,gf as M,hf as W,lf as F,mf as S,qf as T,rf as _,sf as H,uf as C}from"./chunk-vk35g121.js";import{Qq as I,Rq as R,Tq as P}from"./chunk-kec1xw1n.js";import"./chunk-cqtkxwd8.js";import"./chunk-x50adh71.js";import{Hu as j}from"./chunk-q4mtwv1w.js";import"./chunk-7a3txs9f.js";import"./chunk-djfrkbd5.js";var u=j.object({thinking:j.object({type:j.enum(["enabled","disabled"]).optional(),tokenBudget:j.number().optional()}).optional()}),d=j.object({message:j.string()}),w=T({errorSchema:d,errorToMessage:(z)=>z.message});function c({tools:z,toolChoice:X}){z=(z==null?void 0:z.length)?z:void 0;let Y=[];if(z==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Y};let $=[];for(let J of z)if(J.type==="provider")Y.push({type:"unsupported",feature:`provider-defined tool ${J.id}`});else $.push({type:"function",function:{name:J.name,description:J.description,parameters:J.inputSchema}});if(X==null)return{tools:$,toolChoice:void 0,toolWarnings:Y};let D=X.type;switch(D){case"auto":return{tools:$,toolChoice:void 0,toolWarnings:Y};case"none":return{tools:$,toolChoice:"NONE",toolWarnings:Y};case"required":return{tools:$,toolChoice:"REQUIRED",toolWarnings:Y};case"tool":return{tools:$.filter((J)=>J.function.name===X.toolName),toolChoice:"REQUIRED",toolWarnings:Y};default:throw new P({functionality:`tool choice type: ${D}`})}}function y(z){if(z==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let{input_tokens:X,output_tokens:Y}=z;return{inputTokens:{total:X,noCache:X,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:Y,text:Y,reasoning:void 0},raw:z}}function p(z){let X=[],Y=[],$=[];for(let{role:D,content:J}of z)switch(D){case"system":{X.push({role:"system",content:J});break}case"user":{X.push({role:"user",content:J.map((Q)=>{var B;switch(Q.type){case"text":return Q.text;case"file":{let G;if(typeof Q.data==="string")G=Q.data;else if(Q.data instanceof Uint8Array){if(!(((B=Q.mediaType)==null?void 0:B.startsWith("text/"))||Q.mediaType==="application/json"))throw new P({functionality:`document media type: ${Q.mediaType}`,message:`Media type '${Q.mediaType}' is not supported. Supported media types are: text/* and application/json.`});G=new TextDecoder().decode(Q.data)}else throw new P({functionality:"File URL data",message:"URLs should be downloaded by the AI SDK and not reach this point. This indicates a configuration issue."});return Y.push({data:{text:G,title:Q.filename}}),""}}}).join("")});break}case"assistant":{let Q="",B=[];for(let G of J)switch(G.type){case"text":{Q+=G.text;break}case"tool-call":{B.push({id:G.toolCallId,type:"function",function:{name:G.toolName,arguments:JSON.stringify(G.input)}});break}}X.push({role:"assistant",content:B.length>0?void 0:Q,tool_calls:B.length>0?B:void 0,tool_plan:void 0});break}case"tool":{X.push(...J.filter((Q)=>Q.type!=="tool-approval-response").map((Q)=>{var B;let G=Q.output,K;switch(G.type){case"text":case"error-text":K=G.value;break;case"execution-denied":K=(B=G.reason)!=null?B:"Tool execution denied.";break;case"content":case"json":case"error-json":K=JSON.stringify(G.value);break}return{role:"tool",content:K,tool_call_id:Q.toolCallId}}));break}default:throw Error(`Unsupported role: ${D}`)}return{messages:X,documents:Y,warnings:$}}function f(z){switch(z){case"COMPLETE":case"STOP_SEQUENCE":return"stop";case"MAX_TOKENS":return"length";case"ERROR":return"error";case"TOOL_CALL":return"tool-calls";default:return"other"}}var i=class{constructor(z,X){this.specificationVersion="v3",this.supportedUrls={},this.modelId=z,this.config=X}get provider(){return this.config.provider}async getArgs({prompt:z,maxOutputTokens:X,temperature:Y,topP:$,topK:D,frequencyPenalty:J,presencePenalty:Q,stopSequences:B,responseFormat:G,seed:K,tools:U,toolChoice:N,providerOptions:q}){var Z,L;let A=(Z=await F({provider:"cohere",providerOptions:q,schema:u}))!=null?Z:{},{messages:V,documents:x,warnings:h}=p(z),{tools:v,toolChoice:m,toolWarnings:g}=c({tools:U,toolChoice:N});return{args:{model:this.modelId,frequency_penalty:J,presence_penalty:Q,max_tokens:X,temperature:Y,p:$,k:D,seed:K,stop_sequences:B,response_format:(G==null?void 0:G.type)==="json"?{type:"json_object",json_schema:G.schema}:void 0,messages:V,tools:v,tool_choice:m,...x.length>0&&{documents:x},...A.thinking&&{thinking:{type:(L=A.thinking.type)!=null?L:"enabled",token_budget:A.thinking.tokenBudget}}},warnings:[...g,...h]}}async doGenerate(z){var X,Y,$,D,J,Q,B;let{args:G,warnings:K}=await this.getArgs(z),{responseHeaders:U,value:N,rawValue:q}=await S({url:`${this.config.baseURL}/chat`,headers:E(this.config.headers(),z.headers),body:G,failedResponseHandler:w,successfulResponseHandler:H(a),abortSignal:z.abortSignal,fetch:this.config.fetch}),Z=[];for(let L of(X=N.message.content)!=null?X:[]){if(L.type==="text"&&L.text.length>0){Z.push({type:"text",text:L.text});continue}if(L.type==="thinking"&&L.thinking.length>0){Z.push({type:"reasoning",text:L.thinking});continue}}for(let L of(Y=N.message.citations)!=null?Y:[])Z.push({type:"source",sourceType:"document",id:this.config.generateId(),mediaType:"text/plain",title:((D=($=L.sources[0])==null?void 0:$.document)==null?void 0:D.title)||"Document",providerMetadata:{cohere:{start:L.start,end:L.end,text:L.text,sources:L.sources,...L.type&&{citationType:L.type}}}});for(let L of(J=N.message.tool_calls)!=null?J:[])Z.push({type:"tool-call",toolCallId:L.id,toolName:L.function.name,input:L.function.arguments.replace(/^null$/,"{}")});return{content:Z,finishReason:{unified:f(N.finish_reason),raw:(Q=N.finish_reason)!=null?Q:void 0},usage:y(N.usage.tokens),request:{body:G},response:{id:(B=N.generation_id)!=null?B:void 0,headers:U,body:q},warnings:K}}async doStream(z){let{args:X,warnings:Y}=await this.getArgs(z),{responseHeaders:$,value:D}=await S({url:`${this.config.baseURL}/chat`,headers:E(this.config.headers(),z.headers),body:{...X,stream:!0},failedResponseHandler:w,successfulResponseHandler:_(s),abortSignal:z.abortSignal,fetch:this.config.fetch}),J={unified:"other",raw:void 0},Q=void 0,B=null,G=!1;return{stream:D.pipeThrough(new TransformStream({start(K){K.enqueue({type:"stream-start",warnings:Y})},transform(K,U){var N,q;if(z.includeRawChunks)U.enqueue({type:"raw",rawValue:K.rawValue});if(!K.success){J={unified:"error",raw:void 0},U.enqueue({type:"error",error:K.error});return}let Z=K.value;switch(Z.type){case"content-start":{if(Z.delta.message.content.type==="thinking"){U.enqueue({type:"reasoning-start",id:String(Z.index)}),G=!0;return}U.enqueue({type:"text-start",id:String(Z.index)});return}case"content-delta":{if("thinking"in Z.delta.message.content){U.enqueue({type:"reasoning-delta",id:String(Z.index),delta:Z.delta.message.content.thinking});return}U.enqueue({type:"text-delta",id:String(Z.index),delta:Z.delta.message.content.text});return}case"content-end":{if(G){U.enqueue({type:"reasoning-end",id:String(Z.index)}),G=!1;return}U.enqueue({type:"text-end",id:String(Z.index)});return}case"tool-call-start":{let A=Z.delta.message.tool_calls.id,V=Z.delta.message.tool_calls.function.name,x=Z.delta.message.tool_calls.function.arguments;if(B={id:A,name:V,arguments:x,hasFinished:!1},U.enqueue({type:"tool-input-start",id:A,toolName:V}),x.length>0)U.enqueue({type:"tool-input-delta",id:A,delta:x});return}case"tool-call-delta":{if(B&&!B.hasFinished){let A=Z.delta.message.tool_calls.function.arguments;B.arguments+=A,U.enqueue({type:"tool-input-delta",id:B.id,delta:A})}return}case"tool-call-end":{if(B&&!B.hasFinished)U.enqueue({type:"tool-input-end",id:B.id}),U.enqueue({type:"tool-call",toolCallId:B.id,toolName:B.name,input:JSON.stringify(JSON.parse(((N=B.arguments)==null?void 0:N.trim())||"{}"))}),B.hasFinished=!0,B=null;return}case"message-start":{U.enqueue({type:"response-metadata",id:(q=Z.id)!=null?q:void 0});return}case"message-end":{J={unified:f(Z.delta.finish_reason),raw:Z.delta.finish_reason},Q=Z.delta.usage.tokens;return}default:return}},flush(K){K.enqueue({type:"finish",finishReason:J,usage:y(Q)})}})),request:{body:{...X,stream:!0}},response:{headers:$}}}},a=j.object({generation_id:j.string().nullish(),message:j.object({role:j.string(),content:j.array(j.union([j.object({type:j.literal("text"),text:j.string()}),j.object({type:j.literal("thinking"),thinking:j.string()})])).nullish(),tool_plan:j.string().nullish(),tool_calls:j.array(j.object({id:j.string(),type:j.literal("function"),function:j.object({name:j.string(),arguments:j.string()})})).nullish(),citations:j.array(j.object({start:j.number(),end:j.number(),text:j.string(),sources:j.array(j.object({type:j.string().optional(),id:j.string().optional(),document:j.object({id:j.string().optional(),text:j.string(),title:j.string()})})),type:j.string().optional()})).nullish()}),finish_reason:j.string(),usage:j.object({billed_units:j.object({input_tokens:j.number(),output_tokens:j.number()}),tokens:j.object({input_tokens:j.number(),output_tokens:j.number()})})}),s=j.discriminatedUnion("type",[j.object({type:j.literal("citation-start")}),j.object({type:j.literal("citation-end")}),j.object({type:j.literal("content-start"),index:j.number(),delta:j.object({message:j.object({content:j.union([j.object({type:j.literal("text"),text:j.string()}),j.object({type:j.literal("thinking"),thinking:j.string()})])})})}),j.object({type:j.literal("content-delta"),index:j.number(),delta:j.object({message:j.object({content:j.union([j.object({text:j.string()}),j.object({thinking:j.string()})])})})}),j.object({type:j.literal("content-end"),index:j.number()}),j.object({type:j.literal("message-start"),id:j.string().nullish()}),j.object({type:j.literal("message-end"),delta:j.object({finish_reason:j.string(),usage:j.object({tokens:j.object({input_tokens:j.number(),output_tokens:j.number()})})})}),j.object({type:j.literal("tool-plan-delta"),delta:j.object({message:j.object({tool_plan:j.string()})})}),j.object({type:j.literal("tool-call-start"),delta:j.object({message:j.object({tool_calls:j.object({id:j.string(),type:j.literal("function"),function:j.object({name:j.string(),arguments:j.string()})})})})}),j.object({type:j.literal("tool-call-delta"),delta:j.object({message:j.object({tool_calls:j.object({function:j.object({arguments:j.string()})})})})}),j.object({type:j.literal("tool-call-end")})]),r=j.object({inputType:j.enum(["search_document","search_query","classification","clustering"]).optional(),truncate:j.enum(["NONE","START","END"]).optional(),outputDimension:j.union([j.literal(256),j.literal(512),j.literal(1024),j.literal(1536)]).optional()}),l=class{constructor(z,X){this.specificationVersion="v3",this.maxEmbeddingsPerCall=96,this.supportsParallelCalls=!0,this.modelId=z,this.config=X}get provider(){return this.config.provider}async doEmbed({values:z,headers:X,abortSignal:Y,providerOptions:$}){var D;let J=await F({provider:"cohere",providerOptions:$,schema:r});if(z.length>this.maxEmbeddingsPerCall)throw new R({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:z});let{responseHeaders:Q,value:B,rawValue:G}=await S({url:`${this.config.baseURL}/embed`,headers:E(this.config.headers(),X),body:{model:this.modelId,embedding_types:["float"],texts:z,input_type:(D=J==null?void 0:J.inputType)!=null?D:"search_query",truncate:J==null?void 0:J.truncate,output_dimension:J==null?void 0:J.outputDimension},failedResponseHandler:w,successfulResponseHandler:H(n),abortSignal:Y,fetch:this.config.fetch});return{warnings:[],embeddings:B.embeddings.float,usage:{tokens:B.meta.billed_units.input_tokens},response:{headers:Q,body:G}}}},n=j.object({embeddings:j.object({float:j.array(j.array(j.number()))}),meta:j.object({billed_units:j.object({input_tokens:j.number()})})}),t=M(()=>W(j.object({id:j.string().nullish(),results:j.array(j.object({index:j.number(),relevance_score:j.number()})),meta:j.any()}))),e=M(()=>W(j.object({maxTokensPerDoc:j.number().optional(),priority:j.number().optional()}))),o=class{constructor(z,X){this.specificationVersion="v3",this.modelId=z,this.config=X}get provider(){return this.config.provider}async doRerank({documents:z,headers:X,query:Y,topN:$,abortSignal:D,providerOptions:J}){var Q;let B=await F({provider:"cohere",providerOptions:J,schema:e}),G=[];if(z.type==="object")G.push({type:"compatibility",feature:"object documents",details:"Object documents are converted to strings."});let{responseHeaders:K,value:U,rawValue:N}=await S({url:`${this.config.baseURL}/rerank`,headers:E(this.config.headers(),X),body:{model:this.modelId,query:Y,documents:z.type==="text"?z.values:z.values.map((q)=>JSON.stringify(q)),top_n:$,max_tokens_per_doc:B==null?void 0:B.maxTokensPerDoc,priority:B==null?void 0:B.priority},failedResponseHandler:w,successfulResponseHandler:H(t),abortSignal:D,fetch:this.config.fetch});return{ranking:U.results.map((q)=>({index:q.index,relevanceScore:q.relevance_score})),warnings:G,response:{id:(Q=U.id)!=null?Q:void 0,headers:K,body:N}}}},jj="3.0.27";function zj(z={}){var X;let Y=(X=C(z.baseURL))!=null?X:"https://api.cohere.com/v2",$=()=>b({Authorization:`Bearer ${k({apiKey:z.apiKey,environmentVariableName:"COHERE_API_KEY",description:"Cohere"})}`,...z.headers},`ai-sdk/cohere/${jj}`),D=(G)=>{var K;return new i(G,{provider:"cohere.chat",baseURL:Y,headers:$,fetch:z.fetch,generateId:(K=z.generateId)!=null?K:O})},J=(G)=>new l(G,{provider:"cohere.textEmbedding",baseURL:Y,headers:$,fetch:z.fetch}),Q=(G)=>new o(G,{provider:"cohere.reranking",baseURL:Y,headers:$,fetch:z.fetch}),B=function(G){if(new.target)throw Error("The Cohere model function cannot be called with the new keyword.");return D(G)};return B.specificationVersion="v3",B.languageModel=D,B.embedding=J,B.embeddingModel=J,B.textEmbedding=J,B.textEmbeddingModel=J,B.reranking=Q,B.rerankingModel=Q,B.imageModel=(G)=>{throw new I({modelId:G,modelType:"imageModel"})},B}var Fj=zj();export{zj as createCohere,Fj as cohere,jj as VERSION};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xr as a,yr as b,zr as c}from"./chunk-gq3zb4wv.js";import"./chunk-2cvwrabw.js";import"./chunk-4sa9t0vx.js";import"./chunk-g52wmt1v.js";import"./chunk-9d0exvey.js";import"./chunk-h2p984qb.js";import"./chunk-azss4acq.js";import"./chunk-0bhzhh7s.js";import"./chunk-7s0nq2aa.js";import"./chunk-cxtwavyf.js";import"./chunk-15bjhfav.js";import"./chunk-q4mtwv1w.js";import"./chunk-7a3txs9f.js";import"./chunk-x308f9j4.js";import"./chunk-2zjet9tx.js";import"./chunk-djfrkbd5.js";export{c as makeRuntime,a as attachWith,b as attach};
|