@qitqode/qitqode-android-arm64 0.1.35 → 0.2.0
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-7311jry1.js → chunk-00sr2gwz.js} +2 -2
- package/bundle/{chunk-azhw650z.js → chunk-02xcb52z.js} +2 -2
- package/bundle/{chunk-gws1rn1v.js → chunk-08q55ya0.js} +1 -1
- package/bundle/chunk-092bx2yw.js +2 -0
- package/bundle/{chunk-xgr6jnd6.js → chunk-0g25z230.js} +1 -1
- package/bundle/chunk-0jrgk6vk.js +2 -0
- package/bundle/chunk-0ne5m1n3.js +2 -0
- package/bundle/chunk-0qn52zsd.js +2 -0
- package/bundle/{chunk-7mxt5b0h.js → chunk-0z33en1a.js} +1 -1
- package/bundle/chunk-10accb7b.js +2 -0
- package/bundle/chunk-13kpdfr7.js +2 -0
- package/bundle/chunk-15s8zwgf.js +2 -0
- package/bundle/chunk-17pxm5d3.js +14 -0
- package/bundle/{chunk-nj4d554m.js → chunk-1bx2sjn6.js} +1 -1
- package/bundle/chunk-1kgyfja6.js +2 -0
- package/bundle/{chunk-bv29k2pf.js → chunk-1mcsf4yb.js} +2 -2
- package/bundle/{chunk-kwx9ewe0.js → chunk-1wpjmwnh.js} +1 -1
- package/bundle/{chunk-snr44en9.js → chunk-25bp7pcm.js} +2 -2
- package/bundle/{chunk-kmcsz8yv.js → chunk-2dkrfc1s.js} +1 -1
- package/bundle/chunk-2pzvcpv4.js +3 -0
- package/bundle/chunk-3bkdbqjj.js +2 -0
- package/bundle/{chunk-08m0hkdz.js → chunk-3dr4469n.js} +1 -1
- package/bundle/{chunk-n96tvjgj.js → chunk-3mepk08v.js} +2 -2
- package/bundle/chunk-3sz6gw10.js +3 -0
- package/bundle/{chunk-xqdrr7xg.js → chunk-45mjcxqk.js} +1 -1
- package/bundle/chunk-46ztrjw0.js +7 -0
- package/bundle/chunk-4dtkj9zg.js +2 -0
- package/bundle/chunk-4e9p3e0a.js +2 -0
- package/bundle/{chunk-qrtc3etn.js → chunk-4fa390yr.js} +2 -2
- package/bundle/chunk-4gs87ghj.js +3 -0
- package/bundle/{chunk-3k2b05fv.js → chunk-4sazy0nq.js} +1 -1
- package/bundle/chunk-4tbqsrsn.js +2 -0
- package/bundle/{chunk-ngccf7ga.js → chunk-52b1v7mn.js} +1 -1
- package/bundle/chunk-53kns5wy.js +2 -0
- package/bundle/{chunk-11v7vz3y.js → chunk-549ptbaj.js} +1 -1
- package/bundle/chunk-559ek1ym.js +2 -0
- package/bundle/chunk-55wxgsga.js +2 -0
- package/bundle/{chunk-34p46th6.js → chunk-5bate758.js} +1 -1
- package/bundle/chunk-5ke0yqqz.js +8 -0
- package/bundle/{chunk-kdcnder5.js → chunk-5kmfnkzv.js} +1 -1
- package/bundle/chunk-5myxjxae.js +3 -0
- package/bundle/chunk-5q1fz2az.js +2 -0
- package/bundle/{chunk-txbwmwxj.js → chunk-5sgpjgss.js} +1 -1
- package/bundle/{chunk-rsszcqxd.js → chunk-60qyqqxx.js} +1 -1
- package/bundle/{chunk-94pcpztx.js → chunk-64s7vfj7.js} +2 -2
- package/bundle/{chunk-6ged58yw.js → chunk-6r8pg6ma.js} +2 -2
- package/bundle/{chunk-8762ty72.js → chunk-70pb4kcm.js} +2 -2
- package/bundle/{chunk-04hvaaje.js → chunk-72zxassf.js} +1 -1
- package/bundle/{chunk-yz6898wy.js → chunk-73ckx171.js} +1 -1
- package/bundle/{chunk-gj0wt0cy.js → chunk-7fawtcnn.js} +1 -1
- package/bundle/{chunk-zfn0z4sh.js → chunk-7gbytqkn.js} +2 -2
- package/bundle/{chunk-x66ycpfs.js → chunk-7jhrxzjx.js} +2 -2
- package/bundle/{chunk-09pkckr1.js → chunk-7vftsy04.js} +1 -1
- package/bundle/chunk-871f8x99.js +4 -0
- package/bundle/chunk-88emsbaz.js +2 -0
- package/bundle/{chunk-zfd70p01.js → chunk-8dxdeksr.js} +1 -1
- package/bundle/{chunk-6styp5dn.js → chunk-8fgamz4y.js} +1 -1
- package/bundle/{chunk-9qdr9t8c.js → chunk-8q6z6emx.js} +1 -1
- package/bundle/{chunk-4ttf9rjd.js → chunk-8r3410c2.js} +1 -1
- package/bundle/{chunk-3mzcr3fw.js → chunk-8tp4whyw.js} +1 -1
- package/bundle/chunk-8yn64y27.js +2 -0
- package/bundle/{chunk-41v0x1jk.js → chunk-8yr682pv.js} +2 -2
- package/bundle/chunk-8ywa7az5.js +2 -0
- package/bundle/chunk-8ywdddts.js +2 -0
- package/bundle/{chunk-exmw8jfa.js → chunk-909fp6pm.js} +2 -2
- package/bundle/chunk-92zjark4.js +2 -0
- package/bundle/chunk-98effz12.js +2 -0
- package/bundle/{chunk-kjyw00jp.js → chunk-9cw4cnz0.js} +1 -1
- package/bundle/{chunk-2swch6mx.js → chunk-9dh9bc9d.js} +1 -1
- package/bundle/{chunk-y437vyza.js → chunk-9fkmhmh6.js} +1 -1
- package/bundle/{chunk-7vd91wsd.js → chunk-9nk0ts0s.js} +1 -1
- package/bundle/{chunk-p9cnzxb8.js → chunk-9s4whpg1.js} +2 -2
- package/bundle/{chunk-yajd975f.js → chunk-9xvctnjr.js} +1 -1
- package/bundle/{chunk-4wxxyrxn.js → chunk-9zre5e54.js} +1 -1
- package/bundle/chunk-a6z0fhta.js +2 -0
- package/bundle/{chunk-yt3f3j35.js → chunk-a9y27zd2.js} +1 -1
- package/bundle/{chunk-mex0fe9s.js → chunk-acyj91wq.js} +1 -1
- package/bundle/chunk-aj3y2e86.js +3 -0
- package/bundle/chunk-akpssv2d.js +2 -0
- package/bundle/chunk-aq28ejhv.js +2 -0
- package/bundle/{chunk-pkc4ddw1.js → chunk-atpzz901.js} +1 -1
- package/bundle/chunk-aw8af3ky.js +2 -0
- package/bundle/chunk-ax1y4699.js +2 -0
- package/bundle/{chunk-dctj3c22.js → chunk-b0jh0rby.js} +2 -2
- package/bundle/chunk-b10px5g4.js +2 -0
- package/bundle/chunk-bha3sbsj.js +2 -0
- package/bundle/{chunk-67d5d8mr.js → chunk-bnz0mxak.js} +1 -1
- package/bundle/chunk-bs020a3x.js +2 -0
- package/bundle/chunk-bs61sezq.js +2 -0
- package/bundle/{chunk-7eexey82.js → chunk-c72jajx9.js} +1 -1
- package/bundle/{chunk-81trveht.js → chunk-cagk1sjd.js} +1 -1
- package/bundle/{chunk-1byd3wma.js → chunk-cdh26622.js} +2 -2
- package/bundle/{chunk-t2vm08v6.js → chunk-ceefd2nj.js} +1 -1
- package/bundle/chunk-cmdjkx32.js +2 -0
- package/bundle/{chunk-zh3fny3z.js → chunk-cx7p4ezk.js} +2 -2
- package/bundle/chunk-cxtxvt43.js +2 -0
- package/bundle/{chunk-pxmhe36r.js → chunk-d1rn44wz.js} +1 -1
- package/bundle/{chunk-0c6ep9mc.js → chunk-d93z6hrn.js} +1 -1
- package/bundle/{chunk-zddknkw7.js → chunk-d9x9kqvy.js} +1 -1
- package/bundle/chunk-de2rfsaf.js +2 -0
- package/bundle/{chunk-seghf5fc.js → chunk-dgx4rq86.js} +1 -1
- package/bundle/{chunk-qzj6027k.js → chunk-dh1h513y.js} +1 -1
- package/bundle/chunk-dncnyzaa.js +2 -0
- package/bundle/chunk-dp6zktka.js +2 -0
- package/bundle/{chunk-ba3h1pzs.js → chunk-dshnn54c.js} +1 -1
- package/bundle/{chunk-73myw3bj.js → chunk-dt899wbf.js} +2 -2
- package/bundle/chunk-dvqdtdza.js +2 -0
- package/bundle/{chunk-6ynxf3q7.js → chunk-dvxk6mr6.js} +2 -2
- package/bundle/{chunk-bnss5dkk.js → chunk-dykqn0nj.js} +2 -2
- package/bundle/{chunk-hv6eccx1.js → chunk-dz3s882k.js} +220 -220
- package/bundle/{chunk-y9zstzed.js → chunk-eaqfnwdj.js} +1 -1
- package/bundle/{chunk-54wh8b12.js → chunk-eb8nsk7e.js} +2 -2
- package/bundle/chunk-ebabnv33.js +3 -0
- package/bundle/chunk-ebdpg3cn.js +2 -0
- package/bundle/{chunk-kfmz2p27.js → chunk-ev3a2sxv.js} +2 -2
- package/bundle/{chunk-d00c1k9w.js → chunk-ewpzqnj4.js} +1 -1
- package/bundle/chunk-eyc6tb5h.js +2 -0
- package/bundle/chunk-eze57bty.js +2 -0
- package/bundle/{chunk-qddt2gcs.js → chunk-ezrskm25.js} +1 -1
- package/bundle/chunk-fa47vzfc.js +2 -0
- package/bundle/chunk-fe397ph0.js +2 -0
- package/bundle/{chunk-bzgj60w4.js → chunk-fn8191ps.js} +2 -2
- package/bundle/chunk-fr75ytdr.js +2 -0
- package/bundle/chunk-fw2tnbt6.js +2 -0
- package/bundle/chunk-fwr2qgqb.js +2 -0
- package/bundle/chunk-fyz7fngd.js +2 -0
- package/bundle/chunk-g204pt98.js +2 -0
- package/bundle/{chunk-ggydr1ze.js → chunk-g794ey6w.js} +1 -1
- package/bundle/chunk-g8cfzzrs.js +2 -0
- package/bundle/chunk-gcgmwqhh.js +2 -0
- package/bundle/{chunk-rmve21dh.js → chunk-gg7bg3ek.js} +1 -1
- package/bundle/{chunk-9x25d115.js → chunk-gkj4a27z.js} +1 -1
- package/bundle/{chunk-sjw56r2n.js → chunk-gnt982jr.js} +3 -3
- package/bundle/chunk-grdfpd57.js +2 -0
- package/bundle/chunk-gt6tgm42.js +5 -0
- package/bundle/chunk-gw36mrg4.js +2 -0
- package/bundle/{chunk-z8gdmvgg.js → chunk-gwfx7tx7.js} +2 -2
- package/bundle/{chunk-q8hd01j7.js → chunk-gxmxx8jb.js} +1 -1
- package/bundle/{chunk-tge53d52.js → chunk-h1kg35mn.js} +1 -1
- package/bundle/chunk-h36qec67.js +2 -0
- package/bundle/{chunk-0msqaywp.js → chunk-h7w35n7w.js} +1 -1
- package/bundle/chunk-h9gtymfm.js +2 -0
- package/bundle/chunk-h9qn35pn.js +2 -0
- package/bundle/{chunk-mr8j7rc6.js → chunk-hb9mc5f9.js} +1 -1
- package/bundle/{chunk-df2aswz3.js → chunk-hcy77w6t.js} +1 -1
- package/bundle/chunk-hd8q4msp.js +2 -0
- package/bundle/{chunk-6a7c7wnf.js → chunk-hgsykghj.js} +2 -2
- package/bundle/chunk-hhjkezfz.js +2 -0
- package/bundle/chunk-hnz570f9.js +3 -0
- package/bundle/chunk-j5kyf7vt.js +5 -0
- package/bundle/{chunk-1yt5rsew.js → chunk-j63fkt6n.js} +1 -1
- package/bundle/{chunk-03xppy47.js → chunk-jcjaw7tk.js} +2 -2
- package/bundle/{chunk-jkh6eg7d.js → chunk-jf6ry79j.js} +4 -4
- package/bundle/chunk-jfz8wwk9.js +2 -0
- package/bundle/{chunk-ke7n9t5p.js → chunk-jgz1a29w.js} +3 -3
- package/bundle/{chunk-ebcdxmdd.js → chunk-jngchw38.js} +1 -1
- package/bundle/{chunk-j5ymkhry.js → chunk-jqn27885.js} +1 -1
- package/bundle/chunk-js6hqmq7.js +2 -0
- package/bundle/{chunk-hj3ddt53.js → chunk-jts0dma5.js} +2 -2
- package/bundle/chunk-k70x182t.js +2 -0
- package/bundle/chunk-k7n1csxv.js +3 -0
- package/bundle/{chunk-er38zew1.js → chunk-kb6v5hhm.js} +2 -2
- package/bundle/chunk-kmtfdky8.js +4 -0
- package/bundle/chunk-kp8nkm3m.js +2 -0
- package/bundle/{chunk-7hm0c2yg.js → chunk-kqhh2pm9.js} +1 -1
- package/bundle/{chunk-0h8wdch6.js → chunk-kt0ej3nq.js} +1 -1
- package/bundle/chunk-kwzawx7r.js +2 -0
- package/bundle/{chunk-n6msxne8.js → chunk-kx2dp8ch.js} +1 -1
- package/bundle/chunk-m0mek3es.js +2 -0
- package/bundle/{chunk-tbgczapt.js → chunk-m0xsvzyd.js} +2 -2
- package/bundle/chunk-m31d2n6h.js +2 -0
- package/bundle/{chunk-9ayxg9mq.js → chunk-m6zxr0j8.js} +2 -2
- package/bundle/{chunk-egn55fa2.js → chunk-mcc5ynma.js} +3 -3
- package/bundle/{chunk-md8161zd.js → chunk-mdzzcrf9.js} +2 -2
- package/bundle/{chunk-ynwkr3yh.js → chunk-mvnxwwe7.js} +2 -2
- package/bundle/{chunk-b4knxpqh.js → chunk-mw2hr4pd.js} +1 -1
- package/bundle/{chunk-vszbqv24.js → chunk-mzbr0m2v.js} +1 -1
- package/bundle/{chunk-bj00xk8k.js → chunk-n0trgp1c.js} +2 -2
- package/bundle/chunk-n14qktbg.js +2 -0
- package/bundle/{chunk-yjk6zv2z.js → chunk-n2ygpy76.js} +1 -1
- package/bundle/{chunk-yprmd5b7.js → chunk-n38h109k.js} +2 -2
- package/bundle/{chunk-8vg4fmg2.js → chunk-n7d9eemn.js} +180 -178
- package/bundle/{chunk-06k6egt2.js → chunk-neqy8j4n.js} +1 -1
- package/bundle/chunk-nhwhkx62.js +4 -0
- package/bundle/{chunk-nj61v4n7.js → chunk-njkserae.js} +1 -1
- package/bundle/{chunk-n6gtdx5h.js → chunk-nq495be3.js} +1 -1
- package/bundle/{chunk-p3qkexpk.js → chunk-nsjp44fp.js} +1 -1
- package/bundle/chunk-nzzsj54n.js +2 -0
- package/bundle/chunk-p19qfw59.js +2 -0
- package/bundle/chunk-p2yxj9s4.js +2 -0
- package/bundle/{chunk-1dtzxt2w.js → chunk-p3rp99na.js} +1 -1
- package/bundle/{chunk-79agp7v3.js → chunk-p8kpqyxb.js} +2 -2
- package/bundle/{chunk-9fxkh84w.js → chunk-p9zrk16q.js} +1 -1
- package/bundle/chunk-pnpre7ys.js +3 -0
- package/bundle/{chunk-ee23d2nz.js → chunk-pnq1h5az.js} +2 -2
- package/bundle/{chunk-wfd5h6ax.js → chunk-pqnbdygz.js} +2 -2
- package/bundle/chunk-pr1ysgr3.js +2 -0
- package/bundle/chunk-ps9p14y6.js +2 -0
- package/bundle/chunk-px8vtbmr.js +3 -0
- package/bundle/{chunk-zfcp509b.js → chunk-pxx2hz0g.js} +2 -2
- package/bundle/{chunk-rq4w0by4.js → chunk-q81m4m9z.js} +1 -1
- package/bundle/chunk-qagc6v17.js +2 -0
- package/bundle/{chunk-mq6jn47r.js → chunk-qb35hqm4.js} +1 -1
- package/bundle/chunk-qc0zhbhm.js +2 -0
- package/bundle/{chunk-keveg5gx.js → chunk-qdcf1ay5.js} +2 -2
- package/bundle/{chunk-t3eymzg1.js → chunk-qpzspr9z.js} +2 -2
- package/bundle/chunk-qq2rcxv2.js +9 -0
- package/bundle/{chunk-axdzm75h.js → chunk-qqne79vp.js} +2 -2
- package/bundle/{chunk-g4gjz7sq.js → chunk-qs4wef8c.js} +1 -1
- package/bundle/{chunk-nmehsm3w.js → chunk-qy1a2tpc.js} +1 -1
- package/bundle/chunk-qyjt0qnq.js +3 -0
- package/bundle/{chunk-6a77w77q.js → chunk-r0g5yyhf.js} +4 -4
- package/bundle/{chunk-by855es0.js → chunk-r58gzg6m.js} +1 -1
- package/bundle/{chunk-fmq0m4k5.js → chunk-r6ndvzd0.js} +1 -1
- package/bundle/chunk-r78kfhvz.js +2 -0
- package/bundle/{chunk-dyv2hqvc.js → chunk-rcyhqkv5.js} +1 -1
- package/bundle/{chunk-yp5bypsp.js → chunk-rexdr63q.js} +2 -2
- package/bundle/{chunk-1me21qdc.js → chunk-rgxy4ngt.js} +1 -1
- package/bundle/chunk-rnd5mnsm.js +2 -0
- package/bundle/{chunk-dcndy4sr.js → chunk-rph9zj24.js} +1 -1
- package/bundle/{chunk-ryfqwsft.js → chunk-rrd0jf5m.js} +1 -1
- package/bundle/{chunk-e74efvj2.js → chunk-rtdym35y.js} +172 -172
- package/bundle/chunk-s2xdf6qh.js +14 -0
- package/bundle/{chunk-mpygdb5a.js → chunk-s8mghr5a.js} +2 -2
- package/bundle/chunk-schtpyjs.js +2 -0
- package/bundle/{chunk-08f4khsw.js → chunk-snt1kefv.js} +3 -3
- package/bundle/{chunk-a1hzeejj.js → chunk-sp8ek94w.js} +2 -2
- package/bundle/{chunk-s8hq6trz.js → chunk-srxx88nb.js} +1 -1
- package/bundle/{chunk-gy0wm7e1.js → chunk-std2bgv7.js} +2 -2
- package/bundle/chunk-sv1s1qxd.js +619 -0
- package/bundle/{chunk-dffhkd30.js → chunk-swcgsrbj.js} +1 -1
- package/bundle/chunk-sxwqrvmy.js +28 -0
- package/bundle/chunk-sxy4hyyy.js +2 -0
- package/bundle/chunk-syc4b8rt.js +2 -0
- package/bundle/{chunk-wgk7ynt3.js → chunk-t01bhw5h.js} +3 -3
- package/bundle/chunk-tcs6wgna.js +3 -0
- package/bundle/{chunk-gmzrvxnv.js → chunk-tdmn21z0.js} +2 -2
- package/bundle/{chunk-71zw0qhf.js → chunk-tdxbm1nd.js} +1 -1
- package/bundle/{chunk-p825vsjy.js → chunk-te5tfq79.js} +1 -1
- package/bundle/chunk-tf4xwqz7.js +2 -0
- package/bundle/{chunk-fg35hwa0.js → chunk-tgd5ctnt.js} +2 -2
- package/bundle/chunk-twhavv1m.js +2 -0
- package/bundle/{chunk-qa2j0qmy.js → chunk-txqc7543.js} +2 -2
- package/bundle/chunk-tzg4z74d.js +2 -0
- package/bundle/chunk-tzrbb0e8.js +3 -0
- package/bundle/chunk-v0yxkq99.js +3 -0
- package/bundle/{chunk-a3a1trap.js → chunk-v3x5nrc4.js} +2 -2
- package/bundle/chunk-v7q3d3n6.js +3 -0
- package/bundle/chunk-v8vcwx23.js +2 -0
- package/bundle/chunk-vc4e6xc4.js +10 -0
- package/bundle/{chunk-6p7yg5sr.js → chunk-vftqwdpg.js} +1 -1
- package/bundle/{chunk-r0k21apr.js → chunk-vgaxv70x.js} +2 -2
- package/bundle/{chunk-nkk4fyqf.js → chunk-vgnddhdj.js} +1 -1
- package/bundle/{chunk-xd3xc1vv.js → chunk-vm58fkrv.js} +1 -1
- package/bundle/{chunk-qg2vk5fw.js → chunk-vsys768k.js} +1 -1
- package/bundle/{chunk-5a7fs1hg.js → chunk-vvzbfv2f.js} +1 -1
- package/bundle/{chunk-s4qtphwx.js → chunk-w03fdrxe.js} +1 -1
- package/bundle/{chunk-z1ay3qd0.js → chunk-w3bmf3zz.js} +1 -1
- package/bundle/{chunk-vsr8mnj6.js → chunk-w5940jxm.js} +1 -1
- package/bundle/chunk-w6rf2knb.js +2 -0
- package/bundle/{chunk-aa8hymcv.js → chunk-w8d9srv7.js} +2 -2
- package/bundle/chunk-w9pdvcf9.js +3 -0
- package/bundle/{chunk-yk97q51d.js → chunk-wev34grp.js} +2 -2
- package/bundle/chunk-wh7r96t3.js +2 -0
- package/bundle/{chunk-1pg6pv0m.js → chunk-wm77svwm.js} +1 -1
- package/bundle/chunk-wnjqaxze.js +2 -0
- package/bundle/{chunk-gckgaqqr.js → chunk-ws3p9cya.js} +2 -2
- package/bundle/chunk-x42w8ewc.js +2 -0
- package/bundle/{chunk-qkjdr337.js → chunk-x6rr6ss1.js} +1 -1
- package/bundle/chunk-xc9se3c8.js +2 -0
- package/bundle/{chunk-bbzztav6.js → chunk-xdacgfba.js} +1 -1
- package/bundle/{chunk-6p94fpbn.js → chunk-xdjwapwy.js} +2 -2
- package/bundle/chunk-xfz698bh.js +2 -0
- package/bundle/{chunk-zwnhf4z1.js → chunk-xhbb8b5g.js} +1 -1
- package/bundle/chunk-xjhezxft.js +8 -0
- package/bundle/chunk-xxj3sgd5.js +2 -0
- package/bundle/chunk-xxvqq7kc.js +2 -0
- package/bundle/{chunk-cs38g1bx.js → chunk-y0ydzdfc.js} +1 -1
- package/bundle/{chunk-wvf5q2hz.js → chunk-y1b2h15z.js} +1 -1
- package/bundle/{chunk-1gf116rg.js → chunk-yacccwf6.js} +1 -1
- package/bundle/chunk-ydc6ypjt.js +77 -0
- package/bundle/chunk-ye0mkqb4.js +2 -0
- package/bundle/{chunk-dhqaqeq6.js → chunk-yeq7b87a.js} +1 -1
- package/bundle/chunk-yfp9y71y.js +2 -0
- package/bundle/{chunk-e6xnynaz.js → chunk-yha554nm.js} +2 -2
- package/bundle/{chunk-rv1stdvb.js → chunk-yj6rbe9p.js} +2 -2
- package/bundle/chunk-yjjh339w.js +2 -0
- package/bundle/{chunk-c5pb87yf.js → chunk-ymtcm4xd.js} +1 -1
- package/bundle/chunk-ypk3t1eh.js +3 -0
- package/bundle/chunk-yt6vd7a5.js +2 -0
- package/bundle/{chunk-ssk8tkwd.js → chunk-yw9pfqxt.js} +1 -1
- package/bundle/{chunk-g6cyhxwg.js → chunk-yykjvt7f.js} +2 -2
- package/bundle/{chunk-sfes6pp1.js → chunk-yzh4rmrt.js} +1 -1
- package/bundle/chunk-yzn08nx1.js +2 -0
- package/bundle/chunk-yzq3c3dq.js +2 -0
- package/bundle/{chunk-prh3c44x.js → chunk-yzwgvjzd.js} +1 -1
- package/bundle/chunk-z0tfsdb9.js +3 -0
- package/bundle/chunk-z1j25911.js +2 -0
- package/bundle/{chunk-rkwrjphh.js → chunk-z1rshv6g.js} +1 -1
- package/bundle/chunk-z210dtw1.js +3 -0
- package/bundle/chunk-z29ahthm.js +2 -0
- package/bundle/{chunk-w1n4rf6n.js → chunk-z7vv0ngm.js} +2 -2
- package/bundle/{chunk-jgjnz82k.js → chunk-zaan8jk6.js} +1 -1
- package/bundle/{chunk-6gb65bv1.js → chunk-zbqzm65q.js} +1 -1
- package/bundle/{chunk-bk4phk66.js → chunk-zesbm9k1.js} +1 -1
- package/bundle/{chunk-c6vfwjg4.js → chunk-zfcfyagt.js} +1 -1
- package/bundle/{chunk-ywkvq7zb.js → chunk-zfnbk5gy.js} +1 -1
- package/bundle/chunk-zgre4gc2.js +2 -0
- package/bundle/{chunk-z7430qxg.js → chunk-zrmx397j.js} +1 -1
- package/bundle/chunk-zthkjx33.js +2 -0
- package/bundle/chunk-ztnepaqc.js +3 -0
- package/bundle/chunk-zwvwbrsc.js +2 -0
- package/bundle/chunk-zxddasg8.js +2 -0
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-0442cmw2.js +0 -2
- package/bundle/chunk-085pvqr4.js +0 -2
- package/bundle/chunk-0x5jn813.js +0 -2
- package/bundle/chunk-11g2rpv8.js +0 -3
- package/bundle/chunk-28t9akfn.js +0 -2
- package/bundle/chunk-2h1fcqvf.js +0 -2
- package/bundle/chunk-2kens6wh.js +0 -2
- package/bundle/chunk-2scyp9ns.js +0 -2
- package/bundle/chunk-2tw58kwb.js +0 -2
- package/bundle/chunk-2vxx0tax.js +0 -2
- package/bundle/chunk-2ybt3p5z.js +0 -2
- package/bundle/chunk-2zpkw3ge.js +0 -2
- package/bundle/chunk-31g86yn6.js +0 -2
- package/bundle/chunk-397be2x0.js +0 -2
- package/bundle/chunk-3c78nkgn.js +0 -2
- package/bundle/chunk-3d91q2qd.js +0 -2
- package/bundle/chunk-43yv7tz1.js +0 -2
- package/bundle/chunk-496ajawz.js +0 -2
- package/bundle/chunk-499gp5g5.js +0 -2
- package/bundle/chunk-4hzm14xt.js +0 -3
- package/bundle/chunk-4xw14sed.js +0 -2
- package/bundle/chunk-536naqqv.js +0 -2
- package/bundle/chunk-57nvmhjq.js +0 -2
- package/bundle/chunk-5e4fxy99.js +0 -616
- package/bundle/chunk-5he3d7cy.js +0 -2
- package/bundle/chunk-5qr286w8.js +0 -2
- package/bundle/chunk-606vpgc4.js +0 -4
- package/bundle/chunk-6a1skxcj.js +0 -3
- package/bundle/chunk-6cj7cn5x.js +0 -2
- package/bundle/chunk-6hybp2mt.js +0 -2
- package/bundle/chunk-6y423jax.js +0 -3
- package/bundle/chunk-72ghkgcn.js +0 -2
- package/bundle/chunk-741teh8k.js +0 -2
- package/bundle/chunk-7b3wx6kn.js +0 -2
- package/bundle/chunk-891yevv2.js +0 -2
- package/bundle/chunk-8c1ypgw5.js +0 -3
- package/bundle/chunk-8ktgy41r.js +0 -2
- package/bundle/chunk-8q73cjyj.js +0 -2
- package/bundle/chunk-8rt63jbm.js +0 -2
- package/bundle/chunk-8y623qdx.js +0 -2
- package/bundle/chunk-921vn745.js +0 -2
- package/bundle/chunk-945ebhte.js +0 -2
- package/bundle/chunk-9548cc0c.js +0 -2
- package/bundle/chunk-9yrypq1r.js +0 -14
- package/bundle/chunk-a0rp7gh4.js +0 -77
- package/bundle/chunk-a48t0g95.js +0 -3
- package/bundle/chunk-a949at1c.js +0 -3
- package/bundle/chunk-akk84fnc.js +0 -2
- package/bundle/chunk-aw7j7brm.js +0 -2
- package/bundle/chunk-b6cybdj3.js +0 -2
- package/bundle/chunk-c5fa8cb1.js +0 -2
- package/bundle/chunk-ca4r31we.js +0 -2
- package/bundle/chunk-ckbwdrm3.js +0 -2
- package/bundle/chunk-cqj21rfj.js +0 -3
- package/bundle/chunk-cz3h5n1v.js +0 -3
- package/bundle/chunk-dhc6e1t7.js +0 -2
- package/bundle/chunk-dk6rbqvp.js +0 -2
- package/bundle/chunk-dk975etf.js +0 -3
- package/bundle/chunk-dwajajaq.js +0 -2
- package/bundle/chunk-dxcrggvq.js +0 -2
- package/bundle/chunk-dyt3n3fe.js +0 -2
- package/bundle/chunk-e7ah0e61.js +0 -2
- package/bundle/chunk-e7v9trve.js +0 -11
- package/bundle/chunk-e8ws454m.js +0 -2
- package/bundle/chunk-efndtzby.js +0 -2
- package/bundle/chunk-eq2pepce.js +0 -2
- package/bundle/chunk-eva3nqqb.js +0 -14
- package/bundle/chunk-f3bnn9rf.js +0 -8
- package/bundle/chunk-f693s9vn.js +0 -2
- package/bundle/chunk-ftepqwyq.js +0 -2
- package/bundle/chunk-g18ax6yp.js +0 -2
- package/bundle/chunk-gadyp6mb.js +0 -2
- package/bundle/chunk-ge8315te.js +0 -5
- package/bundle/chunk-gk28ffhg.js +0 -2
- package/bundle/chunk-gpfc4z4v.js +0 -2
- package/bundle/chunk-gqvg02zp.js +0 -2
- package/bundle/chunk-gsyt2sv7.js +0 -2
- package/bundle/chunk-h3k1dk9m.js +0 -2
- package/bundle/chunk-h8c3dcqt.js +0 -2
- package/bundle/chunk-hfq11w4h.js +0 -2
- package/bundle/chunk-hw5qyht3.js +0 -3
- package/bundle/chunk-hwf58w1k.js +0 -2
- package/bundle/chunk-jyczz3yh.js +0 -8
- package/bundle/chunk-k8k8z6b7.js +0 -3
- package/bundle/chunk-kk3ve911.js +0 -2
- package/bundle/chunk-kv72hxkp.js +0 -3
- package/bundle/chunk-m4j7jyrd.js +0 -3
- package/bundle/chunk-mf3sm0pk.js +0 -2
- package/bundle/chunk-mkng9ykt.js +0 -2
- package/bundle/chunk-mxvypy3s.js +0 -2
- package/bundle/chunk-n5ypgxrn.js +0 -28
- package/bundle/chunk-n9xw9kqc.js +0 -2
- package/bundle/chunk-nc4wbc89.js +0 -2
- package/bundle/chunk-ngk67rt3.js +0 -3
- package/bundle/chunk-nj2bbtmx.js +0 -2
- package/bundle/chunk-nr1g57b2.js +0 -2
- package/bundle/chunk-p0ahbpxv.js +0 -2
- package/bundle/chunk-p7y8z5rd.js +0 -2
- package/bundle/chunk-pt26gerr.js +0 -2
- package/bundle/chunk-qkk1as5n.js +0 -2
- package/bundle/chunk-qsm9xw87.js +0 -2
- package/bundle/chunk-qw980y8h.js +0 -2
- package/bundle/chunk-r2w3gr8d.js +0 -2
- package/bundle/chunk-r5bqcpkz.js +0 -2
- package/bundle/chunk-r67c858b.js +0 -2
- package/bundle/chunk-r9fvfkee.js +0 -2
- package/bundle/chunk-rcn0dhbj.js +0 -2
- package/bundle/chunk-rq47pn3r.js +0 -2
- package/bundle/chunk-rvt1tdy8.js +0 -2
- package/bundle/chunk-ry7q8xn6.js +0 -2
- package/bundle/chunk-s27xvrft.js +0 -2
- package/bundle/chunk-s5nde2kd.js +0 -5
- package/bundle/chunk-scy39p6q.js +0 -2
- package/bundle/chunk-srpe3v8e.js +0 -9
- package/bundle/chunk-st5jaszz.js +0 -3
- package/bundle/chunk-t5qamf96.js +0 -2
- package/bundle/chunk-t9mz17gb.js +0 -3
- package/bundle/chunk-tns5x4w0.js +0 -3
- package/bundle/chunk-ttevj0pj.js +0 -2
- package/bundle/chunk-v7c54cyj.js +0 -2
- package/bundle/chunk-vgefaens.js +0 -2
- package/bundle/chunk-vv59b4re.js +0 -2
- package/bundle/chunk-vwqy7n3g.js +0 -2
- package/bundle/chunk-vysa9hp4.js +0 -7
- package/bundle/chunk-wn076jwj.js +0 -2
- package/bundle/chunk-x0m1qye9.js +0 -2
- package/bundle/chunk-xvntsbb1.js +0 -3
- package/bundle/chunk-y70aachh.js +0 -2
- package/bundle/chunk-yqk58hf6.js +0 -3
- package/bundle/chunk-ysgxt83y.js +0 -2
- package/bundle/chunk-ze9e6nt3.js +0 -3
- package/bundle/chunk-znzan00b.js +0 -3
- package/bundle/chunk-zrp55k47.js +0 -2
- package/bundle/chunk-zwdnh860.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$q as LG,Eq as CG,Lq as bG,Rq as D,Uq as J,Vq as GG,ar as WG,er as d,fr as i,gr as jG,hr as TG,ir as OG,jr as kG,oq as wG,pq as NG,tq as MG,vq as JG}from"./chunk-z8gdmvgg.js";import{Cr as HG,qr as BG}from"./chunk-kwx9ewe0.js";import{pv as G}from"./chunk-gmzrvxnv.js";var iG=D(()=>J(G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}))),EG=TG({errorSchema:iG,errorToMessage:(Q)=>Q.error.message}),lG=D(()=>J(G.object({type:G.literal("message"),id:G.string().nullish(),model:G.string().nullish(),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string(),citations:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])).optional()}),G.object({type:G.literal("thinking"),thinking:G.string(),signature:G.string()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])),stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish(),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}))),sG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("message_start"),message:G.object({id:G.string().nullish(),model:G.string().nullish(),role:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish()}),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()})])).nullish(),stop_reason:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string()}).nullish()})}),G.object({type:G.literal("content_block_start"),index:G.number(),content_block:G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string()}),G.object({type:G.literal("thinking"),thinking:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).optional(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string().nullish()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])}),G.object({type:G.literal("content_block_delta"),index:G.number(),delta:G.discriminatedUnion("type",[G.object({type:G.literal("input_json_delta"),partial_json:G.string()}),G.object({type:G.literal("text_delta"),text:G.string()}),G.object({type:G.literal("thinking_delta"),thinking:G.string()}),G.object({type:G.literal("signature_delta"),signature:G.string()}),G.object({type:G.literal("compaction_delta"),content:G.string().nullish()}),G.object({type:G.literal("citations_delta"),citation:G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])})])}),G.object({type:G.literal("content_block_stop"),index:G.number()}),G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}),G.object({type:G.literal("message_delta"),delta:G.object({stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish()}),usage:G.looseObject({input_tokens:G.number().nullish(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}),G.object({type:G.literal("message_stop")}),G.object({type:G.literal("ping")})]))),pG=D(()=>J(G.object({signature:G.string().optional(),redactedData:G.string().optional()}))),SG=G.object({citations:G.object({enabled:G.boolean()}).optional(),title:G.string().optional(),context:G.string().optional()}),yG=G.object({sendReasoning:G.boolean().optional(),structuredOutputMode:G.enum(["outputFormat","jsonTool","auto"]).optional(),thinking:G.discriminatedUnion("type",[G.object({type:G.literal("adaptive"),display:G.enum(["omitted","summarized"]).optional()}),G.object({type:G.literal("enabled"),budgetTokens:G.number().optional()}),G.object({type:G.literal("disabled")})]).optional(),disableParallelToolUse:G.boolean().optional(),cacheControl:G.object({type:G.literal("ephemeral"),ttl:G.union([G.literal("5m"),G.literal("1h")]).optional()}).optional(),metadata:G.object({userId:G.string().optional()}).optional(),mcpServers:G.array(G.object({type:G.literal("url"),name:G.string(),url:G.string(),authorizationToken:G.string().nullish(),toolConfiguration:G.object({enabled:G.boolean().nullish(),allowedTools:G.array(G.string()).nullish()}).nullish()})).optional(),container:G.object({id:G.string().optional(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skillId:G.string(),version:G.string().optional()})).optional()}).optional(),toolStreaming:G.boolean().optional(),effort:G.enum(["low","medium","high","xhigh","max"]).optional(),taskBudget:G.object({type:G.literal("tokens"),total:G.number().int().min(20000),remaining:G.number().int().min(0).optional()}).optional(),speed:G.enum(["fast","standard"]).optional(),inferenceGeo:G.enum(["us","global"]).optional(),anthropicBeta:G.array(G.string()).optional(),contextManagement:G.object({edits:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("clear_tool_uses_20250919"),trigger:G.discriminatedUnion("type",[G.object({type:G.literal("input_tokens"),value:G.number()}),G.object({type:G.literal("tool_uses"),value:G.number()})]).optional(),keep:G.object({type:G.literal("tool_uses"),value:G.number()}).optional(),clearAtLeast:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),clearToolInputs:G.boolean().optional(),excludeTools:G.array(G.string()).optional()}),G.object({type:G.literal("clear_thinking_20251015"),keep:G.union([G.literal("all"),G.object({type:G.literal("thinking_turns"),value:G.number()})]).optional()}),G.object({type:G.literal("compact_20260112"),trigger:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),pauseAfterCompaction:G.boolean().optional(),instructions:G.string().optional()})]))}).optional()}),FG=4;function nG(Q){var H;let Z=Q==null?void 0:Q.anthropic;return(H=Z==null?void 0:Z.cacheControl)!=null?H:Z==null?void 0:Z.cache_control}var VG=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(Q,H){let Z=nG(Q);if(!Z)return;if(!H.canCache){this.warnings.push({type:"unsupported",feature:"cache_control on non-cacheable context",details:`cache_control cannot be set on ${H.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>FG){this.warnings.push({type:"unsupported",feature:"cacheControl breakpoint limit",details:`Maximum ${FG} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return Z}getWarnings(){return this.warnings}},rG=D(()=>J(G.object({maxCharacters:G.number().optional()}))),aG=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),eG=d({id:"anthropic.text_editor_20250728",inputSchema:aG}),oG=(Q={})=>{return eG(Q)},tG=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),GQ=D(()=>J(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),QQ=D(()=>J(G.object({query:G.string()}))),XQ=i({id:"anthropic.web_search_20260209",inputSchema:QQ,outputSchema:GQ,supportsDeferredResults:!0}),YQ=(Q={})=>{return XQ(Q)},ZQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),vG=D(()=>J(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),$Q=D(()=>J(G.object({query:G.string()}))),zQ=i({id:"anthropic.web_search_20250305",inputSchema:$Q,outputSchema:vG,supportsDeferredResults:!0}),LQ=(Q={})=>{return zQ(Q)},HQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),AQ=D(()=>J(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),qQ=D(()=>J(G.object({url:G.string()}))),KQ=i({id:"anthropic.web_fetch_20260209",inputSchema:qQ,outputSchema:AQ,supportsDeferredResults:!0}),DQ=(Q={})=>{return KQ(Q)},JQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),_G=D(()=>J(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),WQ=D(()=>J(G.object({url:G.string()}))),jQ=i({id:"anthropic.web_fetch_20250910",inputSchema:WQ,outputSchema:_G,supportsDeferredResults:!0}),VQ=(Q={})=>{return jQ(Q)};async function UQ({tools:Q,toolChoice:H,disableParallelToolUse:Z,cacheControlValidator:W,supportsStructuredOutput:f,supportsStrictTools:h,defaultEagerInputStreaming:_=!1}){var b,l;Q=(Q==null?void 0:Q.length)?Q:void 0;let M=[],B=new Set,u=W||new VG;if(Q==null)return{tools:void 0,toolChoice:void 0,toolWarnings:M,betas:B};let R=[];for(let E of Q)switch(E.type){case"function":{let P=u.getCacheControl(E.providerOptions,{type:"tool definition",canCache:!0}),v=(b=E.providerOptions)==null?void 0:b.anthropic,g=(l=v==null?void 0:v.eagerInputStreaming)!=null?l:_,C=v==null?void 0:v.deferLoading,e=v==null?void 0:v.allowedCallers;if(!h&&E.strict!=null)M.push({type:"unsupported",feature:"strict",details:`Tool '${E.name}' has strict: ${E.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`});if(R.push({name:E.name,description:E.description,input_schema:E.inputSchema,cache_control:P,...g?{eager_input_streaming:!0}:{},...h===!0&&E.strict!=null?{strict:E.strict}:{},...C!=null?{defer_loading:C}:{},...e!=null?{allowed_callers:e}:{},...E.inputExamples!=null?{input_examples:E.inputExamples.map((N)=>N.input)}:{}}),f===!0)B.add("structured-outputs-2025-11-13");if(E.inputExamples!=null||e!=null)B.add("advanced-tool-use-2025-11-20");break}case"provider":{switch(E.id){case"anthropic.code_execution_20250522":{B.add("code-execution-2025-05-22"),R.push({type:"code_execution_20250522",name:"code_execution",cache_control:void 0});break}case"anthropic.code_execution_20250825":{B.add("code-execution-2025-08-25"),R.push({type:"code_execution_20250825",name:"code_execution"});break}case"anthropic.code_execution_20260120":{R.push({type:"code_execution_20260120",name:"code_execution"});break}case"anthropic.computer_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"computer",type:"computer_20250124",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,cache_control:void 0});break}case"anthropic.computer_20251124":{B.add("computer-use-2025-11-24"),R.push({name:"computer",type:"computer_20251124",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,enable_zoom:E.args.enableZoom,cache_control:void 0});break}case"anthropic.computer_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"computer",type:"computer_20241022",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,cache_control:void 0});break}case"anthropic.text_editor_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"str_replace_editor",type:"text_editor_20250124",cache_control:void 0});break}case"anthropic.text_editor_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"str_replace_editor",type:"text_editor_20241022",cache_control:void 0});break}case"anthropic.text_editor_20250429":{B.add("computer-use-2025-01-24"),R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250429",cache_control:void 0});break}case"anthropic.text_editor_20250728":{let P=await GG({value:E.args,schema:rG});R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:P.maxCharacters,cache_control:void 0});break}case"anthropic.bash_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"bash",type:"bash_20250124",cache_control:void 0});break}case"anthropic.bash_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"bash",type:"bash_20241022",cache_control:void 0});break}case"anthropic.memory_20250818":{B.add("context-management-2025-06-27"),R.push({name:"memory",type:"memory_20250818"});break}case"anthropic.web_fetch_20250910":{B.add("web-fetch-2025-09-10");let P=await GG({value:E.args,schema:JQ});R.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,citations:P.citations,max_content_tokens:P.maxContentTokens,cache_control:void 0});break}case"anthropic.web_fetch_20260209":{B.add("code-execution-web-tools-2026-02-09");let P=await GG({value:E.args,schema:HQ});R.push({type:"web_fetch_20260209",name:"web_fetch",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,citations:P.citations,max_content_tokens:P.maxContentTokens,cache_control:void 0});break}case"anthropic.web_search_20250305":{let P=await GG({value:E.args,schema:ZQ});R.push({type:"web_search_20250305",name:"web_search",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,user_location:P.userLocation,cache_control:void 0});break}case"anthropic.web_search_20260209":{B.add("code-execution-web-tools-2026-02-09");let P=await GG({value:E.args,schema:tG});R.push({type:"web_search_20260209",name:"web_search",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,user_location:P.userLocation,cache_control:void 0});break}case"anthropic.tool_search_regex_20251119":{R.push({type:"tool_search_tool_regex_20251119",name:"tool_search_tool_regex"});break}case"anthropic.tool_search_bm25_20251119":{R.push({type:"tool_search_tool_bm25_20251119",name:"tool_search_tool_bm25"});break}default:{M.push({type:"unsupported",feature:`provider-defined tool ${E.id}`});break}}break}default:{M.push({type:"unsupported",feature:`tool ${E}`});break}}if(H==null)return{tools:R,toolChoice:Z?{type:"auto",disable_parallel_tool_use:Z}:void 0,toolWarnings:M,betas:B};let a=H.type;switch(a){case"auto":return{tools:R,toolChoice:{type:"auto",disable_parallel_tool_use:Z},toolWarnings:M,betas:B};case"required":return{tools:R,toolChoice:{type:"any",disable_parallel_tool_use:Z},toolWarnings:M,betas:B};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:M,betas:B};case"tool":return{tools:R,toolChoice:{type:"tool",name:H.toolName,disable_parallel_tool_use:Z},toolWarnings:M,betas:B};default:throw new HG({functionality:`tool choice type: ${a}`})}}function IG({usage:Q,rawUsage:H}){var Z,W;let f=(Z=Q.cache_creation_input_tokens)!=null?Z:0,h=(W=Q.cache_read_input_tokens)!=null?W:0,_,b;if(Q.iterations&&Q.iterations.length>0){let l=Q.iterations.reduce((M,B)=>({input:M.input+B.input_tokens,output:M.output+B.output_tokens}),{input:0,output:0});_=l.input,b=l.output}else _=Q.input_tokens,b=Q.output_tokens;return{inputTokens:{total:_+f+h,noCache:_,cacheRead:h,cacheWrite:f},outputTokens:{total:b,text:void 0,reasoning:void 0},raw:H!=null?H:Q}}var hG=D(()=>J(G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}))),RQ=D(()=>J(G.object({code:G.string()}))),EQ=i({id:"anthropic.code_execution_20250522",inputSchema:RQ,outputSchema:hG}),SQ=(Q={})=>{return EQ(Q)},gG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),yQ=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),FQ=i({id:"anthropic.code_execution_20250825",inputSchema:yQ,outputSchema:gG,supportsDeferredResults:!0}),IQ=(Q={})=>{return FQ(Q)},mG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),fQ=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),PQ=i({id:"anthropic.code_execution_20260120",inputSchema:fQ,outputSchema:mG,supportsDeferredResults:!0}),xQ=(Q={})=>{return PQ(Q)},dG=D(()=>J(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),BQ=D(()=>J(G.object({pattern:G.string(),limit:G.number().optional()}))),wQ=i({id:"anthropic.tool_search_regex_20251119",inputSchema:BQ,outputSchema:dG,supportsDeferredResults:!0}),NQ=(Q={})=>{return wQ(Q)};function MQ(Q){if(typeof Q==="string")return new TextDecoder().decode(MG(Q));if(Q instanceof Uint8Array)return new TextDecoder().decode(Q);if(Q instanceof URL)throw new HG({functionality:"URL-based text documents are not supported for citations"});throw new HG({functionality:`unsupported data type for text documents: ${typeof Q}`})}function qG(Q){return Q instanceof URL||CQ(Q)}function CQ(Q){return typeof Q==="string"&&/^https?:\/\//i.test(Q)}function KG(Q){return Q instanceof URL?Q.toString():Q}async function bQ({prompt:Q,sendReasoning:H,warnings:Z,cacheControlValidator:W,toolNameMapping:f}){var h,_,b,l,M,B,u,R,a,E,P,v,g,C,e,N,s,QG,YG;let Y=new Set,j=TQ(Q),w=W||new VG,p=void 0,XG=[];async function zG(O){var T,V;let ZG=await LG({provider:"anthropic",providerOptions:O,schema:SG});return(V=(T=ZG==null?void 0:ZG.citations)==null?void 0:T.enabled)!=null?V:!1}async function L(O){let T=await LG({provider:"anthropic",providerOptions:O,schema:SG});return{title:T==null?void 0:T.title,context:T==null?void 0:T.context}}for(let O=0;O<j.length;O++){let T=j[O],V=O===j.length-1,ZG=T.type;switch(ZG){case"system":{if(p!=null)throw new HG({functionality:"Multiple system messages that are separated by user/assistant messages"});p=T.messages.map(({content:x,providerOptions:o})=>({type:"text",text:x,cache_control:w.getCacheControl(o,{type:"system message",canCache:!0})}));break}case"user":{let x=[];for(let o of T.messages){let{role:t,content:r}=o;switch(t){case"user":{for(let c=0;c<r.length;c++){let y=r[c],n=c===r.length-1,z=(h=w.getCacheControl(y.providerOptions,{type:"user message part",canCache:!0}))!=null?h:n?w.getCacheControl(o.providerOptions,{type:"user message",canCache:!0}):void 0;switch(y.type){case"text":{x.push({type:"text",text:y.text,cache_control:z});break}case"file":{if(y.mediaType.startsWith("image/"))x.push({type:"image",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"base64",media_type:y.mediaType==="image/*"?"image/jpeg":y.mediaType,data:JG(y.data)},cache_control:z});else if(y.mediaType==="application/pdf"){Y.add("pdfs-2024-09-25");let m=await zG(y.providerOptions),F=await L(y.providerOptions);x.push({type:"document",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"base64",media_type:"application/pdf",data:JG(y.data)},title:(_=F.title)!=null?_:y.filename,...F.context&&{context:F.context},...m&&{citations:{enabled:!0}},cache_control:z})}else if(y.mediaType==="text/plain"){let m=await zG(y.providerOptions),F=await L(y.providerOptions);x.push({type:"document",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"text",media_type:"text/plain",data:MQ(y.data)},title:(b=F.title)!=null?b:y.filename,...F.context&&{context:F.context},...m&&{citations:{enabled:!0}},cache_control:z})}else throw new HG({functionality:`media type: ${y.mediaType}`});break}}}break}case"tool":{for(let c=0;c<r.length;c++){let y=r[c];if(y.type==="tool-approval-response")continue;let n=c===r.length-1,z=(l=w.getCacheControl(y.providerOptions,{type:"tool result part",canCache:!0}))!=null?l:n?w.getCacheControl(o.providerOptions,{type:"tool result message",canCache:!0}):void 0,m=y.output,F;switch(m.type){case"content":F=m.value.map((U)=>{var K;switch(U.type){case"text":return{type:"text",text:U.text};case"image-data":return{type:"image",source:{type:"base64",media_type:U.mediaType,data:U.data}};case"image-url":return{type:"image",source:{type:"url",url:U.url}};case"file-url":return{type:"document",source:{type:"url",url:U.url}};case"file-data":{if(U.mediaType==="application/pdf")return Y.add("pdfs-2024-09-25"),{type:"document",source:{type:"base64",media_type:U.mediaType,data:U.data}};Z.push({type:"other",message:`unsupported tool content part type: ${U.type} with media type: ${U.mediaType}`});return}case"custom":{let A=(K=U.providerOptions)==null?void 0:K.anthropic;if((A==null?void 0:A.type)==="tool-reference")return{type:"tool_reference",tool_name:A.toolName};Z.push({type:"other",message:"unsupported custom tool content part"});return}default:{Z.push({type:"other",message:`unsupported tool content part type: ${U.type}`});return}}}).filter(bG);break;case"text":case"error-text":F=m.value;break;case"execution-denied":F=(M=m.reason)!=null?M:"Tool execution denied.";break;case"json":case"error-json":default:F=JSON.stringify(m.value);break}x.push({type:"tool_result",tool_use_id:y.toolCallId,content:F,is_error:m.type==="error-text"||m.type==="error-json"?!0:void 0,cache_control:z})}break}default:throw Error(`Unsupported role: ${t}`)}}XG.push({role:"user",content:x});break}case"assistant":{let x=[],o=new Set;for(let t=0;t<T.messages.length;t++){let r=T.messages[t],c=t===T.messages.length-1,{content:y}=r;for(let n=0;n<y.length;n++){let z=y[n],m=n===y.length-1,F=(B=w.getCacheControl(z.providerOptions,{type:"assistant message part",canCache:!0}))!=null?B:m?w.getCacheControl(r.providerOptions,{type:"assistant message",canCache:!0}):void 0;switch(z.type){case"text":{let U=(u=z.providerOptions)==null?void 0:u.anthropic;if((U==null?void 0:U.type)==="compaction")x.push({type:"compaction",content:z.text,cache_control:F});else x.push({type:"text",text:V&&c&&m?z.text.trim():z.text,cache_control:F});break}case"reasoning":{if(H){let U=await LG({provider:"anthropic",providerOptions:z.providerOptions,schema:pG});if(U!=null)if(U.signature!=null)w.getCacheControl(z.providerOptions,{type:"thinking block",canCache:!1}),x.push({type:"thinking",thinking:z.text,signature:U.signature});else if(U.redactedData!=null)w.getCacheControl(z.providerOptions,{type:"redacted thinking block",canCache:!1}),x.push({type:"redacted_thinking",data:U.redactedData});else Z.push({type:"other",message:"unsupported reasoning metadata"});else Z.push({type:"other",message:"unsupported reasoning metadata"})}else Z.push({type:"other",message:"sending reasoning content is disabled for this model"});break}case"tool-call":{if(z.providerExecuted){let A=f.toProviderToolName(z.toolName);if(((a=(R=z.providerOptions)==null?void 0:R.anthropic)==null?void 0:a.type)==="mcp-tool-use"){o.add(z.toolCallId);let X=(P=(E=z.providerOptions)==null?void 0:E.anthropic)==null?void 0:P.serverName;if(X==null||typeof X!=="string"){Z.push({type:"other",message:"mcp tool use server name is required and must be a string"});break}x.push({type:"mcp_tool_use",id:z.toolCallId,name:z.toolName,input:z.input,server_name:X,cache_control:F})}else if(A==="code_execution"&&z.input!=null&&typeof z.input==="object"&&"type"in z.input&&typeof z.input.type==="string"&&(z.input.type==="bash_code_execution"||z.input.type==="text_editor_code_execution"))x.push({type:"server_tool_use",id:z.toolCallId,name:z.input.type,input:z.input,cache_control:F});else if(A==="code_execution"&&z.input!=null&&typeof z.input==="object"&&"type"in z.input&&z.input.type==="programmatic-tool-call"){let{type:X,...I}=z.input;x.push({type:"server_tool_use",id:z.toolCallId,name:"code_execution",input:I,cache_control:F})}else if(A==="code_execution"||A==="web_fetch"||A==="web_search")x.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:F});else if(A==="tool_search_tool_regex"||A==="tool_search_tool_bm25")x.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:F});else Z.push({type:"other",message:`provider executed tool call for tool ${z.toolName} is not supported`});break}let U=(v=z.providerOptions)==null?void 0:v.anthropic,K=(U==null?void 0:U.caller)?(U.caller.type==="code_execution_20250825"||U.caller.type==="code_execution_20260120")&&U.caller.toolId?{type:U.caller.type,tool_id:U.caller.toolId}:U.caller.type==="direct"?{type:"direct"}:void 0:void 0;x.push({type:"tool_use",id:z.toolCallId,name:z.toolName,input:z.input,...K&&{caller:K},cache_control:F});break}case"tool-result":{let U=f.toProviderToolName(z.toolName);if(o.has(z.toolCallId)){let K=z.output;if(K.type!=="json"&&K.type!=="error-json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}x.push({type:"mcp_tool_result",tool_use_id:z.toolCallId,is_error:K.type==="error-json",content:K.value,cache_control:F})}else if(U==="code_execution"){let K=z.output;if(K.type==="error-text"||K.type==="error-json"){let A={};try{if(typeof K.value==="string")A=JSON.parse(K.value);else if(typeof K.value==="object"&&K.value!==null)A=K.value}catch($){}if(A.type==="code_execution_tool_result_error")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:"code_execution_tool_result_error",error_code:(g=A.errorCode)!=null?g:"unknown"},cache_control:F});else x.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:{type:"bash_code_execution_tool_result_error",error_code:(C=A.errorCode)!=null?C:"unknown"}});break}if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}if(K.value==null||typeof K.value!=="object"||!("type"in K.value)||typeof K.value.type!=="string"){Z.push({type:"other",message:`provider executed tool result output value is not a valid code execution result for tool ${z.toolName}`});break}if(K.value.type==="code_execution_result"){let A=await GG({value:K.value,schema:hG});x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,stdout:A.stdout,stderr:A.stderr,return_code:A.return_code,content:(e=A.content)!=null?e:[]},cache_control:F})}else if(K.value.type==="encrypted_code_execution_result"){let A=await GG({value:K.value,schema:mG});if(A.type==="encrypted_code_execution_result")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,encrypted_stdout:A.encrypted_stdout,stderr:A.stderr,return_code:A.return_code,content:(N=A.content)!=null?N:[]},cache_control:F})}else{let A=await GG({value:K.value,schema:gG});if(A.type==="code_execution_result")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,stdout:A.stdout,stderr:A.stderr,return_code:A.return_code,content:(s=A.content)!=null?s:[]},cache_control:F});else if(A.type==="bash_code_execution_result"||A.type==="bash_code_execution_tool_result_error")x.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:A});else x.push({type:"text_editor_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:A})}break}if(U==="web_fetch"){let K=z.output;if(K.type==="error-json"){let $={};try{if(typeof K.value==="string")$=JSON.parse(K.value);else if(typeof K.value==="object"&&K.value!==null)$=K.value}catch(X){let I=(QG=K.value)==null?void 0:QG.errorCode;$={errorCode:typeof I==="string"?I:"unavailable"}}x.push({type:"web_fetch_tool_result",tool_use_id:z.toolCallId,content:{type:"web_fetch_tool_result_error",error_code:(YG=$.errorCode)!=null?YG:"unavailable"},cache_control:F});break}if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:K.value,schema:_G});x.push({type:"web_fetch_tool_result",tool_use_id:z.toolCallId,content:{type:"web_fetch_result",url:A.url,retrieved_at:A.retrievedAt,content:{type:"document",title:A.content.title,citations:A.content.citations,source:{type:A.content.source.type,media_type:A.content.source.mediaType,data:A.content.source.data}}},cache_control:F});break}if(U==="web_search"){let K=z.output;if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:K.value,schema:vG});x.push({type:"web_search_tool_result",tool_use_id:z.toolCallId,content:A.map(($)=>({url:$.url,title:$.title,page_age:$.pageAge,encrypted_content:$.encryptedContent,type:$.type})),cache_control:F});break}if(U==="tool_search_tool_regex"||U==="tool_search_tool_bm25"){let K=z.output;if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let $=(await GG({value:K.value,schema:dG})).map((X)=>({type:"tool_reference",tool_name:X.toolName}));x.push({type:"tool_search_tool_result",tool_use_id:z.toolCallId,content:{type:"tool_search_tool_search_result",tool_references:$},cache_control:F});break}Z.push({type:"other",message:`provider executed tool result for tool ${z.toolName} is not supported`});break}}}}XG.push({role:"assistant",content:x});break}default:throw Error(`content type: ${ZG}`)}}return{prompt:{system:p,messages:XG},betas:Y}}function TQ(Q){let H=[],Z=void 0;for(let W of Q){let{role:f}=W;switch(f){case"system":{if((Z==null?void 0:Z.type)!=="system")Z={type:"system",messages:[]},H.push(Z);Z.messages.push(W);break}case"assistant":{if((Z==null?void 0:Z.type)!=="assistant")Z={type:"assistant",messages:[]},H.push(Z);Z.messages.push(W);break}case"user":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(W);break}case"tool":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(W);break}default:throw Error(`Unsupported role: ${f}`)}}return H}function DG({finishReason:Q,isJsonResponseFromTool:H}){switch(Q){case"pause_turn":case"end_turn":case"stop_sequence":return"stop";case"refusal":return"content-filter";case"tool_use":return H?"stop":"tool-calls";case"max_tokens":case"model_context_window_exceeded":return"length";case"compaction":return"other";default:return"other"}}function fG(Q,H,Z){var W;if(Q.type==="web_search_result_location")return{type:"source",sourceType:"url",id:Z(),url:Q.url,title:Q.title,providerMetadata:{anthropic:{citedText:Q.cited_text,encryptedIndex:Q.encrypted_index}}};if(Q.type!=="page_location"&&Q.type!=="char_location")return;let f=H[Q.document_index];if(!f)return;return{type:"source",sourceType:"document",id:Z(),mediaType:f.mediaType,title:(W=Q.document_title)!=null?W:f.title,filename:f.filename,providerMetadata:{anthropic:Q.type==="page_location"?{citedText:Q.cited_text,startPageNumber:Q.start_page_number,endPageNumber:Q.end_page_number}:{citedText:Q.cited_text,startCharIndex:Q.start_char_index,endCharIndex:Q.end_char_index}}}}var TX=class{constructor(Q,H){this.specificationVersion="v3";var Z;this.modelId=Q,this.config=H,this.generateId=(Z=H.generateId)!=null?Z:CG}supportsUrl(Q){return Q.protocol==="https:"}get provider(){return this.config.provider}get providerOptionsName(){let Q=this.config.provider,H=Q.indexOf(".");return H===-1?Q:Q.substring(0,H)}get supportedUrls(){var Q,H,Z;return(Z=(H=(Q=this.config).supportedUrls)==null?void 0:H.call(Q))!=null?Z:{}}async getArgs({userSuppliedBetas:Q,prompt:H,maxOutputTokens:Z,temperature:W,topP:f,topK:h,frequencyPenalty:_,presencePenalty:b,stopSequences:l,responseFormat:M,seed:B,tools:u,toolChoice:R,providerOptions:a,stream:E}){var P,v,g,C,e,N,s,QG,YG,Y;let j=[];if(_!=null)j.push({type:"unsupported",feature:"frequencyPenalty"});if(b!=null)j.push({type:"unsupported",feature:"presencePenalty"});if(B!=null)j.push({type:"unsupported",feature:"seed"});if(W!=null&&W>1)j.push({type:"unsupported",feature:"temperature",details:`${W} exceeds anthropic maximum of 1.0. clamped to 1.0`}),W=1;else if(W!=null&&W<0)j.push({type:"unsupported",feature:"temperature",details:`${W} is below anthropic minimum of 0. clamped to 0`}),W=0;if((M==null?void 0:M.type)==="json"){if(M.schema==null)j.push({type:"unsupported",feature:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."})}let w=this.providerOptionsName,p=await LG({provider:"anthropic",providerOptions:a,schema:yG}),XG=w!=="anthropic"?await LG({provider:w,providerOptions:a,schema:yG}):null,zG=XG!=null,L=Object.assign({},p!=null?p:{},XG!=null?XG:{}),{maxOutputTokens:O,supportsStructuredOutput:T,rejectsSamplingParameters:V,isKnownModel:ZG}=OQ(this.modelId);if(V){if(W!=null)j.push({type:"unsupported",feature:"temperature",details:`temperature is not supported by ${this.modelId} and will be ignored`}),W=void 0;if(h!=null)j.push({type:"unsupported",feature:"topK",details:`topK is not supported by ${this.modelId} and will be ignored`}),h=void 0;if(f!=null)j.push({type:"unsupported",feature:"topP",details:`topP is not supported by ${this.modelId} and will be ignored`}),f=void 0}let x=ZG||this.modelId.startsWith("claude-"),o=((P=this.config.supportsNativeStructuredOutput)!=null?P:!0)&&T,t=((v=this.config.supportsStrictTools)!=null?v:!0)&&T,r=(g=L==null?void 0:L.structuredOutputMode)!=null?g:"auto",c=r==="outputFormat"||r==="auto"&&o,y=(M==null?void 0:M.type)==="json"&&M.schema!=null&&!c?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:M.schema}:void 0,n=L==null?void 0:L.contextManagement,z=new VG,m=NG({tools:u,providerToolNames:{"anthropic.code_execution_20250522":"code_execution","anthropic.code_execution_20250825":"code_execution","anthropic.code_execution_20260120":"code_execution","anthropic.computer_20241022":"computer","anthropic.computer_20250124":"computer","anthropic.text_editor_20241022":"str_replace_editor","anthropic.text_editor_20250124":"str_replace_editor","anthropic.text_editor_20250429":"str_replace_based_edit_tool","anthropic.text_editor_20250728":"str_replace_based_edit_tool","anthropic.bash_20241022":"bash","anthropic.bash_20250124":"bash","anthropic.memory_20250818":"memory","anthropic.web_search_20250305":"web_search","anthropic.web_search_20260209":"web_search","anthropic.web_fetch_20250910":"web_fetch","anthropic.web_fetch_20260209":"web_fetch","anthropic.tool_search_regex_20251119":"tool_search_tool_regex","anthropic.tool_search_bm25_20251119":"tool_search_tool_bm25"}}),{prompt:F,betas:U}=await bQ({prompt:H,sendReasoning:(C=L==null?void 0:L.sendReasoning)!=null?C:!0,warnings:j,cacheControlValidator:z,toolNameMapping:m}),K=(e=L==null?void 0:L.thinking)==null?void 0:e.type,A=K==="enabled"||K==="adaptive",$=K==="enabled"?(N=L==null?void 0:L.thinking)==null?void 0:N.budgetTokens:void 0,X=K==="adaptive"?(s=L==null?void 0:L.thinking)==null?void 0:s.display:void 0,I=Z!=null?Z:O,q={model:this.modelId,max_tokens:I,temperature:W,top_k:h,top_p:f,stop_sequences:l,...A&&{thinking:{type:K,...$!=null&&{budget_tokens:$},...X!=null&&{display:X}}},...((L==null?void 0:L.effort)||(L==null?void 0:L.taskBudget)||c&&(M==null?void 0:M.type)==="json"&&M.schema!=null)&&{output_config:{...(L==null?void 0:L.effort)&&{effort:L.effort},...(L==null?void 0:L.taskBudget)&&{task_budget:{type:L.taskBudget.type,total:L.taskBudget.total,...L.taskBudget.remaining!=null&&{remaining:L.taskBudget.remaining}}},...c&&(M==null?void 0:M.type)==="json"&&M.schema!=null&&{format:{type:"json_schema",schema:M.schema}}}},...(L==null?void 0:L.speed)&&{speed:L.speed},...(L==null?void 0:L.inferenceGeo)&&{inference_geo:L.inferenceGeo},...(L==null?void 0:L.cacheControl)&&{cache_control:L.cacheControl},...((QG=L==null?void 0:L.metadata)==null?void 0:QG.userId)!=null&&{metadata:{user_id:L.metadata.userId}},...(L==null?void 0:L.mcpServers)&&L.mcpServers.length>0&&{mcp_servers:L.mcpServers.map((S)=>({type:S.type,name:S.name,url:S.url,authorization_token:S.authorizationToken,tool_configuration:S.toolConfiguration?{allowed_tools:S.toolConfiguration.allowedTools,enabled:S.toolConfiguration.enabled}:void 0}))},...(L==null?void 0:L.container)&&{container:L.container.skills&&L.container.skills.length>0?{id:L.container.id,skills:L.container.skills.map((S)=>({type:S.type,skill_id:S.skillId,version:S.version}))}:L.container.id},system:F.system,messages:F.messages,...n&&{context_management:{edits:n.edits.map((S)=>{let RG=S.type;switch(RG){case"clear_tool_uses_20250919":return{type:S.type,...S.trigger!==void 0&&{trigger:S.trigger},...S.keep!==void 0&&{keep:S.keep},...S.clearAtLeast!==void 0&&{clear_at_least:S.clearAtLeast},...S.clearToolInputs!==void 0&&{clear_tool_inputs:S.clearToolInputs},...S.excludeTools!==void 0&&{exclude_tools:S.excludeTools}};case"clear_thinking_20251015":return{type:S.type,...S.keep!==void 0&&{keep:S.keep}};case"compact_20260112":return{type:S.type,...S.trigger!==void 0&&{trigger:S.trigger},...S.pauseAfterCompaction!==void 0&&{pause_after_compaction:S.pauseAfterCompaction},...S.instructions!==void 0&&{instructions:S.instructions}};default:j.push({type:"other",message:`Unknown context management strategy: ${RG}`});return}}).filter((S)=>S!==void 0)}}};if(A){if(K==="enabled"&&$==null)j.push({type:"compatibility",feature:"extended thinking",details:"thinking budget is required when thinking is enabled. using default budget of 1024 tokens."}),q.thinking={type:"enabled",budget_tokens:1024},$=1024;if(q.temperature!=null)q.temperature=void 0,j.push({type:"unsupported",feature:"temperature",details:"temperature is not supported when thinking is enabled"});if(h!=null)q.top_k=void 0,j.push({type:"unsupported",feature:"topK",details:"topK is not supported when thinking is enabled"});if(f!=null)q.top_p=void 0,j.push({type:"unsupported",feature:"topP",details:"topP is not supported when thinking is enabled"});q.max_tokens=I+($!=null?$:0)}else if(x&&f!=null&&W!=null)j.push({type:"unsupported",feature:"topP",details:"topP is not supported when temperature is set. topP is ignored."}),q.top_p=void 0;if(ZG&&q.max_tokens>O){if(Z!=null)j.push({type:"unsupported",feature:"maxOutputTokens",details:`${q.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${O} max output tokens. The max output tokens have been limited to ${O}.`});q.max_tokens=O}if((L==null?void 0:L.mcpServers)&&L.mcpServers.length>0)U.add("mcp-client-2025-04-04");if(n){if(U.add("context-management-2025-06-27"),n.edits.some((S)=>S.type==="compact_20260112"))U.add("compact-2026-01-12")}if((L==null?void 0:L.container)&&L.container.skills&&L.container.skills.length>0){if(U.add("code-execution-2025-08-25"),U.add("skills-2025-10-02"),U.add("files-api-2025-04-14"),!(u==null?void 0:u.some((S)=>S.type==="provider"&&(S.id==="anthropic.code_execution_20250825"||S.id==="anthropic.code_execution_20260120"))))j.push({type:"other",message:"code execution tool is required when using skills"})}if(L==null?void 0:L.effort)U.add("effort-2025-11-24");if(L==null?void 0:L.taskBudget)U.add("task-budgets-2026-03-13");if((L==null?void 0:L.speed)==="fast")U.add("fast-mode-2026-02-01");let k=E&&((YG=L==null?void 0:L.toolStreaming)!=null?YG:!0),{tools:$G,toolChoice:UG,toolWarnings:AG,betas:uG}=await UQ(y!=null?{tools:[...u!=null?u:[],y],toolChoice:{type:"required"},disableParallelToolUse:!0,cacheControlValidator:z,supportsStructuredOutput:!1,supportsStrictTools:t,defaultEagerInputStreaming:k}:{tools:u!=null?u:[],toolChoice:R,disableParallelToolUse:L==null?void 0:L.disableParallelToolUse,cacheControlValidator:z,supportsStructuredOutput:o,supportsStrictTools:t,defaultEagerInputStreaming:k}),cG=z.getWarnings();return{args:{...q,tools:$G,tool_choice:UG,stream:E===!0?!0:void 0},warnings:[...j,...AG,...cG],betas:new Set([...U,...uG,...Q,...(Y=L==null?void 0:L.anthropicBeta)!=null?Y:[]]),usesJsonResponseTool:y!=null,toolNameMapping:m,providerOptionsName:w,usedCustomProviderKey:zG}}async getHeaders({betas:Q,headers:H}){return wG(await jG(this.config.headers),H,Q.size>0?{"anthropic-beta":Array.from(Q).join(",")}:{})}async getBetasFromHeaders(Q){var H,Z;let f=(H=(await jG(this.config.headers))["anthropic-beta"])!=null?H:"",h=(Z=Q==null?void 0:Q["anthropic-beta"])!=null?Z:"";return new Set([...f.toLowerCase().split(","),...h.toLowerCase().split(",")].map((_)=>_.trim()).filter((_)=>_!==""))}buildRequestUrl(Q){var H,Z,W;return(W=(Z=(H=this.config).buildRequestUrl)==null?void 0:Z.call(H,this.config.baseURL,Q))!=null?W:`${this.config.baseURL}/messages`}transformRequestBody(Q,H){var Z,W,f;return(f=(W=(Z=this.config).transformRequestBody)==null?void 0:W.call(Z,Q,H))!=null?f:Q}extractCitationDocuments(Q){let H=(Z)=>{var W,f;if(Z.type!=="file")return!1;if(Z.mediaType!=="application/pdf"&&Z.mediaType!=="text/plain")return!1;let h=(W=Z.providerOptions)==null?void 0:W.anthropic,_=h==null?void 0:h.citations;return(f=_==null?void 0:_.enabled)!=null?f:!1};return Q.filter((Z)=>Z.role==="user").flatMap((Z)=>Z.content).filter(H).map((Z)=>{var W;let f=Z;return{title:(W=f.filename)!=null?W:"Untitled Document",filename:f.filename,mediaType:f.mediaType}})}async doGenerate(Q){var H,Z,W,f,h,_,b;let{args:l,warnings:M,betas:B,usesJsonResponseTool:u,toolNameMapping:R,providerOptionsName:a,usedCustomProviderKey:E}=await this.getArgs({...Q,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),P=[...this.extractCitationDocuments(Q.prompt)],v=PG(l.tools),{responseHeaders:g,value:C,rawValue:e}=await WG({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:B,headers:Q.headers}),body:this.transformRequestBody(l,B),failedResponseHandler:EG,successfulResponseHandler:kG(lG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),N=[],s={},QG={},YG=!1;for(let Y of C.content)switch(Y.type){case"text":{if(!u){if(N.push({type:"text",text:Y.text}),Y.citations)for(let j of Y.citations){let w=fG(j,P,this.generateId);if(w)N.push(w)}}break}case"thinking":{N.push({type:"reasoning",text:Y.thinking,providerMetadata:{anthropic:{signature:Y.signature}}});break}case"redacted_thinking":{N.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:Y.data}}});break}case"compaction":{N.push({type:"text",text:Y.content,providerMetadata:{anthropic:{type:"compaction"}}});break}case"tool_use":{if(u&&Y.name==="json")YG=!0,N.push({type:"text",text:JSON.stringify(Y.input)});else{let w=Y.caller,p=w?{type:w.type,toolId:"tool_id"in w?w.tool_id:void 0}:void 0;N.push({type:"tool-call",toolCallId:Y.id,toolName:Y.name,input:JSON.stringify(Y.input),...p&&{providerMetadata:{anthropic:{caller:p}}}})}break}case"server_tool_use":{if(Y.name==="text_editor_code_execution"||Y.name==="bash_code_execution")N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName("code_execution"),input:JSON.stringify({type:Y.name,...Y.input}),providerExecuted:!0});else if(Y.name==="web_search"||Y.name==="code_execution"||Y.name==="web_fetch"){let j=Y.name==="code_execution"&&Y.input!=null&&typeof Y.input==="object"&&"code"in Y.input&&!("type"in Y.input)?{type:"programmatic-tool-call",...Y.input}:Y.input;N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(j),providerExecuted:!0,...v&&Y.name==="code_execution"?{dynamic:!0}:{}})}else if(Y.name==="tool_search_tool_regex"||Y.name==="tool_search_tool_bm25")QG[Y.id]=Y.name,N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(Y.input),providerExecuted:!0});break}case"mcp_tool_use":{s[Y.id]={type:"tool-call",toolCallId:Y.id,toolName:Y.name,input:JSON.stringify(Y.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:Y.server_name}}},N.push(s[Y.id]);break}case"mcp_tool_result":{N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:s[Y.tool_use_id].toolName,isError:Y.is_error,result:Y.content,dynamic:!0,providerMetadata:s[Y.tool_use_id].providerMetadata});break}case"web_fetch_tool_result":{if(Y.content.type==="web_fetch_result")P.push({title:(H=Y.content.content.title)!=null?H:Y.content.url,mediaType:Y.content.content.source.media_type}),N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:Y.content.url,retrievedAt:Y.content.retrieved_at,content:{type:Y.content.content.type,title:Y.content.content.title,citations:Y.content.content.citations,source:{type:Y.content.content.source.type,mediaType:Y.content.content.source.media_type,data:Y.content.content.source.data}}}});else if(Y.content.type==="web_fetch_tool_result_error")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:Y.content.error_code}});break}case"web_search_tool_result":{if(Array.isArray(Y.content)){N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),result:Y.content.map((j)=>{var w;return{url:j.url,title:j.title,pageAge:(w=j.page_age)!=null?w:null,encryptedContent:j.encrypted_content,type:j.type}})});for(let j of Y.content)N.push({type:"source",sourceType:"url",id:this.generateId(),url:j.url,title:j.title,providerMetadata:{anthropic:{pageAge:(Z=j.page_age)!=null?Z:null}}})}else N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:Y.content.error_code}});break}case"code_execution_tool_result":{if(Y.content.type==="code_execution_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:{type:Y.content.type,stdout:Y.content.stdout,stderr:Y.content.stderr,return_code:Y.content.return_code,content:(W=Y.content.content)!=null?W:[]}});else if(Y.content.type==="encrypted_code_execution_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:{type:Y.content.type,encrypted_stdout:Y.content.encrypted_stdout,stderr:Y.content.stderr,return_code:Y.content.return_code,content:(f=Y.content.content)!=null?f:[]}});else if(Y.content.type==="code_execution_tool_result_error")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:Y.content.error_code}});break}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:Y.content});break}case"tool_search_tool_result":{let j=QG[Y.tool_use_id];if(j==null){let w=R.toCustomToolName("tool_search_tool_bm25"),p=R.toCustomToolName("tool_search_tool_regex");if(w!=="tool_search_tool_bm25")j="tool_search_tool_bm25";else if(p!=="tool_search_tool_regex")j="tool_search_tool_regex";else j="tool_search_tool_regex"}if(Y.content.type==="tool_search_tool_search_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),result:Y.content.tool_references.map((w)=>({type:w.type,toolName:w.tool_name}))});else N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:Y.content.error_code}});break}}return{content:N,finishReason:{unified:DG({finishReason:C.stop_reason,isJsonResponseFromTool:YG}),raw:(h=C.stop_reason)!=null?h:void 0},usage:IG({usage:C.usage}),request:{body:l},response:{id:(_=C.id)!=null?_:void 0,modelId:(b=C.model)!=null?b:void 0,headers:g,body:e},warnings:M,providerMetadata:(()=>{var Y,j,w,p,XG;let zG={usage:C.usage,cacheCreationInputTokens:(Y=C.usage.cache_creation_input_tokens)!=null?Y:null,stopSequence:(j=C.stop_sequence)!=null?j:null,iterations:C.usage.iterations?C.usage.iterations.map((O)=>({type:O.type,inputTokens:O.input_tokens,outputTokens:O.output_tokens})):null,container:C.container?{expiresAt:C.container.expires_at,id:C.container.id,skills:(p=(w=C.container.skills)==null?void 0:w.map((O)=>({type:O.type,skillId:O.skill_id,version:O.version})))!=null?p:null}:null,contextManagement:(XG=xG(C.context_management))!=null?XG:null},L={anthropic:zG};if(E&&a!=="anthropic")L[a]=zG;return L})()}}async doStream(Q){var H,Z;let{args:W,warnings:f,betas:h,usesJsonResponseTool:_,toolNameMapping:b,providerOptionsName:l,usedCustomProviderKey:M}=await this.getArgs({...Q,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),B=[...this.extractCitationDocuments(Q.prompt)],u=PG(W.tools),R=this.buildRequestUrl(!0),{responseHeaders:a,value:E}=await WG({url:R,headers:await this.getHeaders({betas:h,headers:Q.headers}),body:this.transformRequestBody(W,h),failedResponseHandler:EG,successfulResponseHandler:OG(sG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),P={unified:"other",raw:void 0},v={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},g={},C={},e={},N=null,s=void 0,QG=null,YG=null,Y=null,j=!1,w=void 0,p=this.generateId,XG=E.pipeThrough(new TransformStream({start(T){T.enqueue({type:"stream-start",warnings:f})},transform(T,V){var ZG,x,o,t,r,c,y,n,z,m,F,U,K,A;if(Q.includeRawChunks)V.enqueue({type:"raw",rawValue:T.rawValue});if(!T.success){V.enqueue({type:"error",error:T.error});return}let $=T.value;switch($.type){case"ping":return;case"content_block_start":{let X=$.content_block,I=X.type;switch(w=I,I){case"text":{if(_)return;g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});return}case"thinking":{g[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index)});return}case"redacted_thinking":{g[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index),providerMetadata:{anthropic:{redactedData:X.data}}});return}case"compaction":{g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index),providerMetadata:{anthropic:{type:"compaction"}}});return}case"tool_use":{if(_&&X.name==="json")j=!0,g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});else{let k=X.caller,$G=k?{type:k.type,toolId:"tool_id"in k?k.tool_id:void 0}:void 0,AG=X.input&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";g[$.index]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:AG,firstDelta:AG.length===0,...$G&&{caller:$G}},V.enqueue({type:"tool-input-start",id:X.id,toolName:X.name})}return}case"server_tool_use":{if(["web_fetch","web_search","code_execution","text_editor_code_execution","bash_code_execution"].includes(X.name)){let q=X.name==="text_editor_code_execution"||X.name==="bash_code_execution"?"code_execution":X.name,k=b.toCustomToolName(q),$G=X.input!=null&&typeof X.input==="object"&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";g[$.index]={type:"tool-call",toolCallId:X.id,toolName:k,input:$G,providerExecuted:!0,...u&&q==="code_execution"?{dynamic:!0}:{},firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:k,providerExecuted:!0,...u&&q==="code_execution"?{dynamic:!0}:{}})}else if(X.name==="tool_search_tool_regex"||X.name==="tool_search_tool_bm25"){e[X.id]=X.name;let q=b.toCustomToolName(X.name);g[$.index]={type:"tool-call",toolCallId:X.id,toolName:q,input:"",providerExecuted:!0,firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:q,providerExecuted:!0})}return}case"web_fetch_tool_result":{if(X.content.type==="web_fetch_result")B.push({title:(ZG=X.content.content.title)!=null?ZG:X.content.url,mediaType:X.content.content.source.media_type}),V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:X.content.url,retrievedAt:X.content.retrieved_at,content:{type:X.content.content.type,title:X.content.content.title,citations:X.content.content.citations,source:{type:X.content.content.source.type,mediaType:X.content.content.source.media_type,data:X.content.content.source.data}}}});else if(X.content.type==="web_fetch_tool_result_error")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:X.content.error_code}});return}case"web_search_tool_result":{if(Array.isArray(X.content)){V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_search"),result:X.content.map((q)=>{var k;return{url:q.url,title:q.title,pageAge:(k=q.page_age)!=null?k:null,encryptedContent:q.encrypted_content,type:q.type}})});for(let q of X.content)V.enqueue({type:"source",sourceType:"url",id:p(),url:q.url,title:q.title,providerMetadata:{anthropic:{pageAge:(x=q.page_age)!=null?x:null}}})}else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:X.content.error_code}});return}case"code_execution_tool_result":{if(X.content.type==="code_execution_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:{type:X.content.type,stdout:X.content.stdout,stderr:X.content.stderr,return_code:X.content.return_code,content:(o=X.content.content)!=null?o:[]}});else if(X.content.type==="encrypted_code_execution_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:{type:X.content.type,encrypted_stdout:X.content.encrypted_stdout,stderr:X.content.stderr,return_code:X.content.return_code,content:(t=X.content.content)!=null?t:[]}});else if(X.content.type==="code_execution_tool_result_error")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:X.content.error_code}});return}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:X.content});return}case"tool_search_tool_result":{let q=e[X.tool_use_id];if(q==null){let k=b.toCustomToolName("tool_search_tool_bm25"),$G=b.toCustomToolName("tool_search_tool_regex");if(k!=="tool_search_tool_bm25")q="tool_search_tool_bm25";else if($G!=="tool_search_tool_regex")q="tool_search_tool_regex";else q="tool_search_tool_regex"}if(X.content.type==="tool_search_tool_search_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName(q),result:X.content.tool_references.map((k)=>({type:k.type,toolName:k.tool_name}))});else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName(q),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:X.content.error_code}});return}case"mcp_tool_use":{C[X.id]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:JSON.stringify(X.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:X.server_name}}},V.enqueue(C[X.id]);return}case"mcp_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:C[X.tool_use_id].toolName,isError:X.is_error,result:X.content,dynamic:!0,providerMetadata:C[X.tool_use_id].providerMetadata});return}default:throw Error(`Unsupported content block type: ${I}`)}}case"content_block_stop":{if(g[$.index]!=null){let X=g[$.index];switch(X.type){case"text":{V.enqueue({type:"text-end",id:String($.index)});break}case"reasoning":{V.enqueue({type:"reasoning-end",id:String($.index)});break}case"tool-call":if(!(_&&X.toolName==="json")){V.enqueue({type:"tool-input-end",id:X.toolCallId});let q=X.input===""?"{}":X.input;if(X.providerToolName==="code_execution")try{let k=JSON.parse(q);if(k!=null&&typeof k==="object"&&"code"in k&&!("type"in k))q=JSON.stringify({type:"programmatic-tool-call",...k})}catch(k){}V.enqueue({type:"tool-call",toolCallId:X.toolCallId,toolName:X.toolName,input:q,providerExecuted:X.providerExecuted,...u&&X.providerToolName==="code_execution"?{dynamic:!0}:{},...X.caller&&{providerMetadata:{anthropic:{caller:X.caller}}}})}break}delete g[$.index]}w=void 0;return}case"content_block_delta":{let X=$.delta.type;switch(X){case"text_delta":{if(_)return;V.enqueue({type:"text-delta",id:String($.index),delta:$.delta.text});return}case"thinking_delta":{V.enqueue({type:"reasoning-delta",id:String($.index),delta:$.delta.thinking});return}case"signature_delta":{if(w==="thinking")V.enqueue({type:"reasoning-delta",id:String($.index),delta:"",providerMetadata:{anthropic:{signature:$.delta.signature}}});return}case"compaction_delta":{if($.delta.content!=null)V.enqueue({type:"text-delta",id:String($.index),delta:$.delta.content});return}case"input_json_delta":{let I=g[$.index],q=$.delta.partial_json;if(q.length===0)return;if(j){if((I==null?void 0:I.type)!=="text")return;V.enqueue({type:"text-delta",id:String($.index),delta:q})}else{if((I==null?void 0:I.type)!=="tool-call")return;if(I.firstDelta&&(I.providerToolName==="bash_code_execution"||I.providerToolName==="text_editor_code_execution"))q=`{"type": "${I.providerToolName}",${q.substring(1)}`;V.enqueue({type:"tool-input-delta",id:I.toolCallId,delta:q}),I.input+=q,I.firstDelta=!1}return}case"citations_delta":{let I=$.delta.citation,q=fG(I,B,p);if(q)V.enqueue(q);return}default:throw Error(`Unsupported delta type: ${X}`)}}case"message_start":{if(v.input_tokens=$.message.usage.input_tokens,v.cache_read_input_tokens=(r=$.message.usage.cache_read_input_tokens)!=null?r:0,v.cache_creation_input_tokens=(c=$.message.usage.cache_creation_input_tokens)!=null?c:0,s={...$.message.usage},QG=(y=$.message.usage.cache_creation_input_tokens)!=null?y:null,$.message.container!=null)Y={expiresAt:$.message.container.expires_at,id:$.message.container.id,skills:null};if($.message.stop_reason!=null)P={unified:DG({finishReason:$.message.stop_reason,isJsonResponseFromTool:j}),raw:$.message.stop_reason};if(V.enqueue({type:"response-metadata",id:(n=$.message.id)!=null?n:void 0,modelId:(z=$.message.model)!=null?z:void 0}),$.message.content!=null)for(let X=0;X<$.message.content.length;X++){let I=$.message.content[X];if(I.type==="tool_use"){let q=I.caller,k=q?{type:q.type,toolId:"tool_id"in q?q.tool_id:void 0}:void 0;V.enqueue({type:"tool-input-start",id:I.id,toolName:I.name});let $G=JSON.stringify((m=I.input)!=null?m:{});V.enqueue({type:"tool-input-delta",id:I.id,delta:$G}),V.enqueue({type:"tool-input-end",id:I.id}),V.enqueue({type:"tool-call",toolCallId:I.id,toolName:I.name,input:$G,...k&&{providerMetadata:{anthropic:{caller:k}}}})}}return}case"message_delta":{if($.usage.input_tokens!=null&&v.input_tokens!==$.usage.input_tokens)v.input_tokens=$.usage.input_tokens;if(v.output_tokens=$.usage.output_tokens,$.usage.cache_read_input_tokens!=null)v.cache_read_input_tokens=$.usage.cache_read_input_tokens;if($.usage.cache_creation_input_tokens!=null)v.cache_creation_input_tokens=$.usage.cache_creation_input_tokens,QG=$.usage.cache_creation_input_tokens;if($.usage.iterations!=null)v.iterations=$.usage.iterations;if(P={unified:DG({finishReason:$.delta.stop_reason,isJsonResponseFromTool:j}),raw:(F=$.delta.stop_reason)!=null?F:void 0},YG=(U=$.delta.stop_sequence)!=null?U:null,Y=$.delta.container!=null?{expiresAt:$.delta.container.expires_at,id:$.delta.container.id,skills:(A=(K=$.delta.container.skills)==null?void 0:K.map((X)=>({type:X.type,skillId:X.skill_id,version:X.version})))!=null?A:null}:null,$.context_management)N=xG($.context_management);s={...s,...$.usage};return}case"message_stop":{let X={usage:s!=null?s:null,cacheCreationInputTokens:QG,stopSequence:YG,iterations:v.iterations?v.iterations.map((q)=>({type:q.type,inputTokens:q.input_tokens,outputTokens:q.output_tokens})):null,container:Y,contextManagement:N},I={anthropic:X};if(M&&l!=="anthropic")I[l]=X;V.enqueue({type:"finish",finishReason:P,usage:IG({usage:v,rawUsage:s}),providerMetadata:I});return}case"error":{V.enqueue({type:"error",error:$.error});return}default:throw Error(`Unsupported chunk type: ${$}`)}}})),[zG,L]=XG.tee(),O=zG.getReader();try{await O.read();let T=await O.read();if(((H=T.value)==null?void 0:H.type)==="raw")T=await O.read();if(((Z=T.value)==null?void 0:Z.type)==="error"){let V=T.value.error;throw new BG({message:V.message,url:R,requestBodyValues:W,statusCode:V.type==="overloaded_error"?529:500,responseHeaders:a,responseBody:JSON.stringify(V),isRetryable:V.type==="overloaded_error"})}}finally{O.cancel().catch(()=>{}),O.releaseLock()}return{stream:L,request:{body:W},response:{headers:a}}}};function OQ(Q){if(Q.includes("claude-opus-4-7"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!0,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-6")||Q.includes("claude-opus-4-6"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-5")||Q.includes("claude-opus-4-5")||Q.includes("claude-haiku-4-5"))return{maxOutputTokens:64000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-opus-4-1"))return{maxOutputTokens:32000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-"))return{maxOutputTokens:64000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-opus-4-"))return{maxOutputTokens:32000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-3-haiku"))return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!1}}function PG(Q){if(!Q)return!1;let H=!1,Z=!1;for(let W of Q){if("type"in W&&(W.type==="web_fetch_20260209"||W.type==="web_search_20260209")){H=!0;continue}if(W.name==="code_execution"){Z=!0;break}}return H&&!Z}function xG(Q){return Q?{appliedEdits:Q.applied_edits.map((H)=>{switch(H.type){case"clear_tool_uses_20250919":return{type:H.type,clearedToolUses:H.cleared_tool_uses,clearedInputTokens:H.cleared_input_tokens};case"clear_thinking_20251015":return{type:H.type,clearedThinkingTurns:H.cleared_thinking_turns,clearedInputTokens:H.cleared_input_tokens};case"compact_20260112":return{type:H.type}}}).filter((H)=>H!==void 0)}:null}var kQ=D(()=>J(G.object({command:G.string(),restart:G.boolean().optional()}))),vQ=d({id:"anthropic.bash_20241022",inputSchema:kQ}),_Q=D(()=>J(G.object({command:G.string(),restart:G.boolean().optional()}))),hQ=d({id:"anthropic.bash_20250124",inputSchema:_Q}),gQ=D(()=>J(G.object({action:G.enum(["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","screenshot","cursor_position"]),coordinate:G.array(G.number().int()).optional(),text:G.string().optional()}))),mQ=d({id:"anthropic.computer_20241022",inputSchema:gQ}),dQ=D(()=>J(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),uQ=d({id:"anthropic.computer_20250124",inputSchema:dQ}),cQ=D(()=>J(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot","zoom"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),region:G.tuple([G.number().int(),G.number().int(),G.number().int(),G.number().int()]).optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),iQ=d({id:"anthropic.computer_20251124",inputSchema:cQ}),lQ=D(()=>J(G.discriminatedUnion("command",[G.object({command:G.literal("view"),path:G.string(),view_range:G.tuple([G.number(),G.number()]).optional()}),G.object({command:G.literal("create"),path:G.string(),file_text:G.string()}),G.object({command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()}),G.object({command:G.literal("insert"),path:G.string(),insert_line:G.number(),insert_text:G.string()}),G.object({command:G.literal("delete"),path:G.string()}),G.object({command:G.literal("rename"),old_path:G.string(),new_path:G.string()})]))),sQ=d({id:"anthropic.memory_20250818",inputSchema:lQ}),pQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),nQ=d({id:"anthropic.text_editor_20241022",inputSchema:pQ}),rQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),aQ=d({id:"anthropic.text_editor_20250124",inputSchema:rQ}),eQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),oQ=d({id:"anthropic.text_editor_20250429",inputSchema:eQ}),tQ=D(()=>J(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),GX=D(()=>J(G.object({query:G.string(),limit:G.number().optional()}))),QX=i({id:"anthropic.tool_search_bm25_20251119",inputSchema:GX,outputSchema:tQ,supportsDeferredResults:!0}),XX=(Q={})=>{return QX(Q)},GY={bash_20241022:vQ,bash_20250124:hQ,codeExecution_20250522:SQ,codeExecution_20250825:IQ,codeExecution_20260120:xQ,computer_20241022:mQ,computer_20250124:uQ,computer_20251124:iQ,memory_20250818:sQ,textEditor_20241022:nQ,textEditor_20250124:aQ,textEditor_20250429:oQ,textEditor_20250728:oG,webFetch_20250910:VQ,webFetch_20260209:DQ,webSearch_20250305:LQ,webSearch_20260209:YQ,toolSearchRegex_20251119:NQ,toolSearchBm25_20251119:XX};
|
|
3
|
-
export{UQ as
|
|
2
|
+
import{Aq as JG,Jq as CG,Qq as bG,Wq as D,Zq as J,_q as GG,er as LG,fr as WG,jr as d,kr as i,lr as jG,mr as TG,nr as OG,or as kG,tq as wG,uq as NG,yq as MG}from"./chunk-gwfx7tx7.js";import{Hr as HG,vr as BG}from"./chunk-1wpjmwnh.js";import{xv as G}from"./chunk-tdmn21z0.js";var iG=D(()=>J(G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}))),EG=TG({errorSchema:iG,errorToMessage:(Q)=>Q.error.message}),lG=D(()=>J(G.object({type:G.literal("message"),id:G.string().nullish(),model:G.string().nullish(),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string(),citations:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])).optional()}),G.object({type:G.literal("thinking"),thinking:G.string(),signature:G.string()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])),stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish(),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}))),sG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("message_start"),message:G.object({id:G.string().nullish(),model:G.string().nullish(),role:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish()}),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()})])).nullish(),stop_reason:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string()}).nullish()})}),G.object({type:G.literal("content_block_start"),index:G.number(),content_block:G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string()}),G.object({type:G.literal("thinking"),thinking:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).optional(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string().nullish()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])}),G.object({type:G.literal("content_block_delta"),index:G.number(),delta:G.discriminatedUnion("type",[G.object({type:G.literal("input_json_delta"),partial_json:G.string()}),G.object({type:G.literal("text_delta"),text:G.string()}),G.object({type:G.literal("thinking_delta"),thinking:G.string()}),G.object({type:G.literal("signature_delta"),signature:G.string()}),G.object({type:G.literal("compaction_delta"),content:G.string().nullish()}),G.object({type:G.literal("citations_delta"),citation:G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])})])}),G.object({type:G.literal("content_block_stop"),index:G.number()}),G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}),G.object({type:G.literal("message_delta"),delta:G.object({stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish()}),usage:G.looseObject({input_tokens:G.number().nullish(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}),G.object({type:G.literal("message_stop")}),G.object({type:G.literal("ping")})]))),pG=D(()=>J(G.object({signature:G.string().optional(),redactedData:G.string().optional()}))),SG=G.object({citations:G.object({enabled:G.boolean()}).optional(),title:G.string().optional(),context:G.string().optional()}),yG=G.object({sendReasoning:G.boolean().optional(),structuredOutputMode:G.enum(["outputFormat","jsonTool","auto"]).optional(),thinking:G.discriminatedUnion("type",[G.object({type:G.literal("adaptive"),display:G.enum(["omitted","summarized"]).optional()}),G.object({type:G.literal("enabled"),budgetTokens:G.number().optional()}),G.object({type:G.literal("disabled")})]).optional(),disableParallelToolUse:G.boolean().optional(),cacheControl:G.object({type:G.literal("ephemeral"),ttl:G.union([G.literal("5m"),G.literal("1h")]).optional()}).optional(),metadata:G.object({userId:G.string().optional()}).optional(),mcpServers:G.array(G.object({type:G.literal("url"),name:G.string(),url:G.string(),authorizationToken:G.string().nullish(),toolConfiguration:G.object({enabled:G.boolean().nullish(),allowedTools:G.array(G.string()).nullish()}).nullish()})).optional(),container:G.object({id:G.string().optional(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skillId:G.string(),version:G.string().optional()})).optional()}).optional(),toolStreaming:G.boolean().optional(),effort:G.enum(["low","medium","high","xhigh","max"]).optional(),taskBudget:G.object({type:G.literal("tokens"),total:G.number().int().min(20000),remaining:G.number().int().min(0).optional()}).optional(),speed:G.enum(["fast","standard"]).optional(),inferenceGeo:G.enum(["us","global"]).optional(),anthropicBeta:G.array(G.string()).optional(),contextManagement:G.object({edits:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("clear_tool_uses_20250919"),trigger:G.discriminatedUnion("type",[G.object({type:G.literal("input_tokens"),value:G.number()}),G.object({type:G.literal("tool_uses"),value:G.number()})]).optional(),keep:G.object({type:G.literal("tool_uses"),value:G.number()}).optional(),clearAtLeast:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),clearToolInputs:G.boolean().optional(),excludeTools:G.array(G.string()).optional()}),G.object({type:G.literal("clear_thinking_20251015"),keep:G.union([G.literal("all"),G.object({type:G.literal("thinking_turns"),value:G.number()})]).optional()}),G.object({type:G.literal("compact_20260112"),trigger:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),pauseAfterCompaction:G.boolean().optional(),instructions:G.string().optional()})]))}).optional()}),FG=4;function nG(Q){var H;let Z=Q==null?void 0:Q.anthropic;return(H=Z==null?void 0:Z.cacheControl)!=null?H:Z==null?void 0:Z.cache_control}var VG=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(Q,H){let Z=nG(Q);if(!Z)return;if(!H.canCache){this.warnings.push({type:"unsupported",feature:"cache_control on non-cacheable context",details:`cache_control cannot be set on ${H.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>FG){this.warnings.push({type:"unsupported",feature:"cacheControl breakpoint limit",details:`Maximum ${FG} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return Z}getWarnings(){return this.warnings}},rG=D(()=>J(G.object({maxCharacters:G.number().optional()}))),aG=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),eG=d({id:"anthropic.text_editor_20250728",inputSchema:aG}),oG=(Q={})=>{return eG(Q)},tG=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),GQ=D(()=>J(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),QQ=D(()=>J(G.object({query:G.string()}))),XQ=i({id:"anthropic.web_search_20260209",inputSchema:QQ,outputSchema:GQ,supportsDeferredResults:!0}),YQ=(Q={})=>{return XQ(Q)},ZQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),vG=D(()=>J(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),$Q=D(()=>J(G.object({query:G.string()}))),zQ=i({id:"anthropic.web_search_20250305",inputSchema:$Q,outputSchema:vG,supportsDeferredResults:!0}),LQ=(Q={})=>{return zQ(Q)},HQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),AQ=D(()=>J(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),qQ=D(()=>J(G.object({url:G.string()}))),KQ=i({id:"anthropic.web_fetch_20260209",inputSchema:qQ,outputSchema:AQ,supportsDeferredResults:!0}),DQ=(Q={})=>{return KQ(Q)},JQ=D(()=>J(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),_G=D(()=>J(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),WQ=D(()=>J(G.object({url:G.string()}))),jQ=i({id:"anthropic.web_fetch_20250910",inputSchema:WQ,outputSchema:_G,supportsDeferredResults:!0}),VQ=(Q={})=>{return jQ(Q)};async function UQ({tools:Q,toolChoice:H,disableParallelToolUse:Z,cacheControlValidator:W,supportsStructuredOutput:f,supportsStrictTools:h,defaultEagerInputStreaming:_=!1}){var b,l;Q=(Q==null?void 0:Q.length)?Q:void 0;let M=[],B=new Set,u=W||new VG;if(Q==null)return{tools:void 0,toolChoice:void 0,toolWarnings:M,betas:B};let R=[];for(let E of Q)switch(E.type){case"function":{let P=u.getCacheControl(E.providerOptions,{type:"tool definition",canCache:!0}),v=(b=E.providerOptions)==null?void 0:b.anthropic,g=(l=v==null?void 0:v.eagerInputStreaming)!=null?l:_,C=v==null?void 0:v.deferLoading,e=v==null?void 0:v.allowedCallers;if(!h&&E.strict!=null)M.push({type:"unsupported",feature:"strict",details:`Tool '${E.name}' has strict: ${E.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`});if(R.push({name:E.name,description:E.description,input_schema:E.inputSchema,cache_control:P,...g?{eager_input_streaming:!0}:{},...h===!0&&E.strict!=null?{strict:E.strict}:{},...C!=null?{defer_loading:C}:{},...e!=null?{allowed_callers:e}:{},...E.inputExamples!=null?{input_examples:E.inputExamples.map((N)=>N.input)}:{}}),f===!0)B.add("structured-outputs-2025-11-13");if(E.inputExamples!=null||e!=null)B.add("advanced-tool-use-2025-11-20");break}case"provider":{switch(E.id){case"anthropic.code_execution_20250522":{B.add("code-execution-2025-05-22"),R.push({type:"code_execution_20250522",name:"code_execution",cache_control:void 0});break}case"anthropic.code_execution_20250825":{B.add("code-execution-2025-08-25"),R.push({type:"code_execution_20250825",name:"code_execution"});break}case"anthropic.code_execution_20260120":{R.push({type:"code_execution_20260120",name:"code_execution"});break}case"anthropic.computer_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"computer",type:"computer_20250124",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,cache_control:void 0});break}case"anthropic.computer_20251124":{B.add("computer-use-2025-11-24"),R.push({name:"computer",type:"computer_20251124",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,enable_zoom:E.args.enableZoom,cache_control:void 0});break}case"anthropic.computer_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"computer",type:"computer_20241022",display_width_px:E.args.displayWidthPx,display_height_px:E.args.displayHeightPx,display_number:E.args.displayNumber,cache_control:void 0});break}case"anthropic.text_editor_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"str_replace_editor",type:"text_editor_20250124",cache_control:void 0});break}case"anthropic.text_editor_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"str_replace_editor",type:"text_editor_20241022",cache_control:void 0});break}case"anthropic.text_editor_20250429":{B.add("computer-use-2025-01-24"),R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250429",cache_control:void 0});break}case"anthropic.text_editor_20250728":{let P=await GG({value:E.args,schema:rG});R.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:P.maxCharacters,cache_control:void 0});break}case"anthropic.bash_20250124":{B.add("computer-use-2025-01-24"),R.push({name:"bash",type:"bash_20250124",cache_control:void 0});break}case"anthropic.bash_20241022":{B.add("computer-use-2024-10-22"),R.push({name:"bash",type:"bash_20241022",cache_control:void 0});break}case"anthropic.memory_20250818":{B.add("context-management-2025-06-27"),R.push({name:"memory",type:"memory_20250818"});break}case"anthropic.web_fetch_20250910":{B.add("web-fetch-2025-09-10");let P=await GG({value:E.args,schema:JQ});R.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,citations:P.citations,max_content_tokens:P.maxContentTokens,cache_control:void 0});break}case"anthropic.web_fetch_20260209":{B.add("code-execution-web-tools-2026-02-09");let P=await GG({value:E.args,schema:HQ});R.push({type:"web_fetch_20260209",name:"web_fetch",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,citations:P.citations,max_content_tokens:P.maxContentTokens,cache_control:void 0});break}case"anthropic.web_search_20250305":{let P=await GG({value:E.args,schema:ZQ});R.push({type:"web_search_20250305",name:"web_search",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,user_location:P.userLocation,cache_control:void 0});break}case"anthropic.web_search_20260209":{B.add("code-execution-web-tools-2026-02-09");let P=await GG({value:E.args,schema:tG});R.push({type:"web_search_20260209",name:"web_search",max_uses:P.maxUses,allowed_domains:P.allowedDomains,blocked_domains:P.blockedDomains,user_location:P.userLocation,cache_control:void 0});break}case"anthropic.tool_search_regex_20251119":{R.push({type:"tool_search_tool_regex_20251119",name:"tool_search_tool_regex"});break}case"anthropic.tool_search_bm25_20251119":{R.push({type:"tool_search_tool_bm25_20251119",name:"tool_search_tool_bm25"});break}default:{M.push({type:"unsupported",feature:`provider-defined tool ${E.id}`});break}}break}default:{M.push({type:"unsupported",feature:`tool ${E}`});break}}if(H==null)return{tools:R,toolChoice:Z?{type:"auto",disable_parallel_tool_use:Z}:void 0,toolWarnings:M,betas:B};let a=H.type;switch(a){case"auto":return{tools:R,toolChoice:{type:"auto",disable_parallel_tool_use:Z},toolWarnings:M,betas:B};case"required":return{tools:R,toolChoice:{type:"any",disable_parallel_tool_use:Z},toolWarnings:M,betas:B};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:M,betas:B};case"tool":return{tools:R,toolChoice:{type:"tool",name:H.toolName,disable_parallel_tool_use:Z},toolWarnings:M,betas:B};default:throw new HG({functionality:`tool choice type: ${a}`})}}function IG({usage:Q,rawUsage:H}){var Z,W;let f=(Z=Q.cache_creation_input_tokens)!=null?Z:0,h=(W=Q.cache_read_input_tokens)!=null?W:0,_,b;if(Q.iterations&&Q.iterations.length>0){let l=Q.iterations.reduce((M,B)=>({input:M.input+B.input_tokens,output:M.output+B.output_tokens}),{input:0,output:0});_=l.input,b=l.output}else _=Q.input_tokens,b=Q.output_tokens;return{inputTokens:{total:_+f+h,noCache:_,cacheRead:h,cacheWrite:f},outputTokens:{total:b,text:void 0,reasoning:void 0},raw:H!=null?H:Q}}var hG=D(()=>J(G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}))),RQ=D(()=>J(G.object({code:G.string()}))),EQ=i({id:"anthropic.code_execution_20250522",inputSchema:RQ,outputSchema:hG}),SQ=(Q={})=>{return EQ(Q)},gG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),yQ=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),FQ=i({id:"anthropic.code_execution_20250825",inputSchema:yQ,outputSchema:gG,supportsDeferredResults:!0}),IQ=(Q={})=>{return FQ(Q)},mG=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),fQ=D(()=>J(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),PQ=i({id:"anthropic.code_execution_20260120",inputSchema:fQ,outputSchema:mG,supportsDeferredResults:!0}),xQ=(Q={})=>{return PQ(Q)},dG=D(()=>J(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),BQ=D(()=>J(G.object({pattern:G.string(),limit:G.number().optional()}))),wQ=i({id:"anthropic.tool_search_regex_20251119",inputSchema:BQ,outputSchema:dG,supportsDeferredResults:!0}),NQ=(Q={})=>{return wQ(Q)};function MQ(Q){if(typeof Q==="string")return new TextDecoder().decode(MG(Q));if(Q instanceof Uint8Array)return new TextDecoder().decode(Q);if(Q instanceof URL)throw new HG({functionality:"URL-based text documents are not supported for citations"});throw new HG({functionality:`unsupported data type for text documents: ${typeof Q}`})}function qG(Q){return Q instanceof URL||CQ(Q)}function CQ(Q){return typeof Q==="string"&&/^https?:\/\//i.test(Q)}function KG(Q){return Q instanceof URL?Q.toString():Q}async function bQ({prompt:Q,sendReasoning:H,warnings:Z,cacheControlValidator:W,toolNameMapping:f}){var h,_,b,l,M,B,u,R,a,E,P,v,g,C,e,N,s,QG,YG;let Y=new Set,j=TQ(Q),w=W||new VG,p=void 0,XG=[];async function zG(O){var T,V;let ZG=await LG({provider:"anthropic",providerOptions:O,schema:SG});return(V=(T=ZG==null?void 0:ZG.citations)==null?void 0:T.enabled)!=null?V:!1}async function L(O){let T=await LG({provider:"anthropic",providerOptions:O,schema:SG});return{title:T==null?void 0:T.title,context:T==null?void 0:T.context}}for(let O=0;O<j.length;O++){let T=j[O],V=O===j.length-1,ZG=T.type;switch(ZG){case"system":{if(p!=null)throw new HG({functionality:"Multiple system messages that are separated by user/assistant messages"});p=T.messages.map(({content:x,providerOptions:o})=>({type:"text",text:x,cache_control:w.getCacheControl(o,{type:"system message",canCache:!0})}));break}case"user":{let x=[];for(let o of T.messages){let{role:t,content:r}=o;switch(t){case"user":{for(let c=0;c<r.length;c++){let y=r[c],n=c===r.length-1,z=(h=w.getCacheControl(y.providerOptions,{type:"user message part",canCache:!0}))!=null?h:n?w.getCacheControl(o.providerOptions,{type:"user message",canCache:!0}):void 0;switch(y.type){case"text":{x.push({type:"text",text:y.text,cache_control:z});break}case"file":{if(y.mediaType.startsWith("image/"))x.push({type:"image",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"base64",media_type:y.mediaType==="image/*"?"image/jpeg":y.mediaType,data:JG(y.data)},cache_control:z});else if(y.mediaType==="application/pdf"){Y.add("pdfs-2024-09-25");let m=await zG(y.providerOptions),F=await L(y.providerOptions);x.push({type:"document",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"base64",media_type:"application/pdf",data:JG(y.data)},title:(_=F.title)!=null?_:y.filename,...F.context&&{context:F.context},...m&&{citations:{enabled:!0}},cache_control:z})}else if(y.mediaType==="text/plain"){let m=await zG(y.providerOptions),F=await L(y.providerOptions);x.push({type:"document",source:qG(y.data)?{type:"url",url:KG(y.data)}:{type:"text",media_type:"text/plain",data:MQ(y.data)},title:(b=F.title)!=null?b:y.filename,...F.context&&{context:F.context},...m&&{citations:{enabled:!0}},cache_control:z})}else throw new HG({functionality:`media type: ${y.mediaType}`});break}}}break}case"tool":{for(let c=0;c<r.length;c++){let y=r[c];if(y.type==="tool-approval-response")continue;let n=c===r.length-1,z=(l=w.getCacheControl(y.providerOptions,{type:"tool result part",canCache:!0}))!=null?l:n?w.getCacheControl(o.providerOptions,{type:"tool result message",canCache:!0}):void 0,m=y.output,F;switch(m.type){case"content":F=m.value.map((U)=>{var K;switch(U.type){case"text":return{type:"text",text:U.text};case"image-data":return{type:"image",source:{type:"base64",media_type:U.mediaType,data:U.data}};case"image-url":return{type:"image",source:{type:"url",url:U.url}};case"file-url":return{type:"document",source:{type:"url",url:U.url}};case"file-data":{if(U.mediaType==="application/pdf")return Y.add("pdfs-2024-09-25"),{type:"document",source:{type:"base64",media_type:U.mediaType,data:U.data}};Z.push({type:"other",message:`unsupported tool content part type: ${U.type} with media type: ${U.mediaType}`});return}case"custom":{let A=(K=U.providerOptions)==null?void 0:K.anthropic;if((A==null?void 0:A.type)==="tool-reference")return{type:"tool_reference",tool_name:A.toolName};Z.push({type:"other",message:"unsupported custom tool content part"});return}default:{Z.push({type:"other",message:`unsupported tool content part type: ${U.type}`});return}}}).filter(bG);break;case"text":case"error-text":F=m.value;break;case"execution-denied":F=(M=m.reason)!=null?M:"Tool execution denied.";break;case"json":case"error-json":default:F=JSON.stringify(m.value);break}x.push({type:"tool_result",tool_use_id:y.toolCallId,content:F,is_error:m.type==="error-text"||m.type==="error-json"?!0:void 0,cache_control:z})}break}default:throw Error(`Unsupported role: ${t}`)}}XG.push({role:"user",content:x});break}case"assistant":{let x=[],o=new Set;for(let t=0;t<T.messages.length;t++){let r=T.messages[t],c=t===T.messages.length-1,{content:y}=r;for(let n=0;n<y.length;n++){let z=y[n],m=n===y.length-1,F=(B=w.getCacheControl(z.providerOptions,{type:"assistant message part",canCache:!0}))!=null?B:m?w.getCacheControl(r.providerOptions,{type:"assistant message",canCache:!0}):void 0;switch(z.type){case"text":{let U=(u=z.providerOptions)==null?void 0:u.anthropic;if((U==null?void 0:U.type)==="compaction")x.push({type:"compaction",content:z.text,cache_control:F});else x.push({type:"text",text:V&&c&&m?z.text.trim():z.text,cache_control:F});break}case"reasoning":{if(H){let U=await LG({provider:"anthropic",providerOptions:z.providerOptions,schema:pG});if(U!=null)if(U.signature!=null)w.getCacheControl(z.providerOptions,{type:"thinking block",canCache:!1}),x.push({type:"thinking",thinking:z.text,signature:U.signature});else if(U.redactedData!=null)w.getCacheControl(z.providerOptions,{type:"redacted thinking block",canCache:!1}),x.push({type:"redacted_thinking",data:U.redactedData});else Z.push({type:"other",message:"unsupported reasoning metadata"});else Z.push({type:"other",message:"unsupported reasoning metadata"})}else Z.push({type:"other",message:"sending reasoning content is disabled for this model"});break}case"tool-call":{if(z.providerExecuted){let A=f.toProviderToolName(z.toolName);if(((a=(R=z.providerOptions)==null?void 0:R.anthropic)==null?void 0:a.type)==="mcp-tool-use"){o.add(z.toolCallId);let X=(P=(E=z.providerOptions)==null?void 0:E.anthropic)==null?void 0:P.serverName;if(X==null||typeof X!=="string"){Z.push({type:"other",message:"mcp tool use server name is required and must be a string"});break}x.push({type:"mcp_tool_use",id:z.toolCallId,name:z.toolName,input:z.input,server_name:X,cache_control:F})}else if(A==="code_execution"&&z.input!=null&&typeof z.input==="object"&&"type"in z.input&&typeof z.input.type==="string"&&(z.input.type==="bash_code_execution"||z.input.type==="text_editor_code_execution"))x.push({type:"server_tool_use",id:z.toolCallId,name:z.input.type,input:z.input,cache_control:F});else if(A==="code_execution"&&z.input!=null&&typeof z.input==="object"&&"type"in z.input&&z.input.type==="programmatic-tool-call"){let{type:X,...I}=z.input;x.push({type:"server_tool_use",id:z.toolCallId,name:"code_execution",input:I,cache_control:F})}else if(A==="code_execution"||A==="web_fetch"||A==="web_search")x.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:F});else if(A==="tool_search_tool_regex"||A==="tool_search_tool_bm25")x.push({type:"server_tool_use",id:z.toolCallId,name:A,input:z.input,cache_control:F});else Z.push({type:"other",message:`provider executed tool call for tool ${z.toolName} is not supported`});break}let U=(v=z.providerOptions)==null?void 0:v.anthropic,K=(U==null?void 0:U.caller)?(U.caller.type==="code_execution_20250825"||U.caller.type==="code_execution_20260120")&&U.caller.toolId?{type:U.caller.type,tool_id:U.caller.toolId}:U.caller.type==="direct"?{type:"direct"}:void 0:void 0;x.push({type:"tool_use",id:z.toolCallId,name:z.toolName,input:z.input,...K&&{caller:K},cache_control:F});break}case"tool-result":{let U=f.toProviderToolName(z.toolName);if(o.has(z.toolCallId)){let K=z.output;if(K.type!=="json"&&K.type!=="error-json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}x.push({type:"mcp_tool_result",tool_use_id:z.toolCallId,is_error:K.type==="error-json",content:K.value,cache_control:F})}else if(U==="code_execution"){let K=z.output;if(K.type==="error-text"||K.type==="error-json"){let A={};try{if(typeof K.value==="string")A=JSON.parse(K.value);else if(typeof K.value==="object"&&K.value!==null)A=K.value}catch($){}if(A.type==="code_execution_tool_result_error")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:"code_execution_tool_result_error",error_code:(g=A.errorCode)!=null?g:"unknown"},cache_control:F});else x.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:{type:"bash_code_execution_tool_result_error",error_code:(C=A.errorCode)!=null?C:"unknown"}});break}if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}if(K.value==null||typeof K.value!=="object"||!("type"in K.value)||typeof K.value.type!=="string"){Z.push({type:"other",message:`provider executed tool result output value is not a valid code execution result for tool ${z.toolName}`});break}if(K.value.type==="code_execution_result"){let A=await GG({value:K.value,schema:hG});x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,stdout:A.stdout,stderr:A.stderr,return_code:A.return_code,content:(e=A.content)!=null?e:[]},cache_control:F})}else if(K.value.type==="encrypted_code_execution_result"){let A=await GG({value:K.value,schema:mG});if(A.type==="encrypted_code_execution_result")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,encrypted_stdout:A.encrypted_stdout,stderr:A.stderr,return_code:A.return_code,content:(N=A.content)!=null?N:[]},cache_control:F})}else{let A=await GG({value:K.value,schema:gG});if(A.type==="code_execution_result")x.push({type:"code_execution_tool_result",tool_use_id:z.toolCallId,content:{type:A.type,stdout:A.stdout,stderr:A.stderr,return_code:A.return_code,content:(s=A.content)!=null?s:[]},cache_control:F});else if(A.type==="bash_code_execution_result"||A.type==="bash_code_execution_tool_result_error")x.push({type:"bash_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:A});else x.push({type:"text_editor_code_execution_tool_result",tool_use_id:z.toolCallId,cache_control:F,content:A})}break}if(U==="web_fetch"){let K=z.output;if(K.type==="error-json"){let $={};try{if(typeof K.value==="string")$=JSON.parse(K.value);else if(typeof K.value==="object"&&K.value!==null)$=K.value}catch(X){let I=(QG=K.value)==null?void 0:QG.errorCode;$={errorCode:typeof I==="string"?I:"unavailable"}}x.push({type:"web_fetch_tool_result",tool_use_id:z.toolCallId,content:{type:"web_fetch_tool_result_error",error_code:(YG=$.errorCode)!=null?YG:"unavailable"},cache_control:F});break}if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:K.value,schema:_G});x.push({type:"web_fetch_tool_result",tool_use_id:z.toolCallId,content:{type:"web_fetch_result",url:A.url,retrieved_at:A.retrievedAt,content:{type:"document",title:A.content.title,citations:A.content.citations,source:{type:A.content.source.type,media_type:A.content.source.mediaType,data:A.content.source.data}}},cache_control:F});break}if(U==="web_search"){let K=z.output;if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let A=await GG({value:K.value,schema:vG});x.push({type:"web_search_tool_result",tool_use_id:z.toolCallId,content:A.map(($)=>({url:$.url,title:$.title,page_age:$.pageAge,encrypted_content:$.encryptedContent,type:$.type})),cache_control:F});break}if(U==="tool_search_tool_regex"||U==="tool_search_tool_bm25"){let K=z.output;if(K.type!=="json"){Z.push({type:"other",message:`provider executed tool result output type ${K.type} for tool ${z.toolName} is not supported`});break}let $=(await GG({value:K.value,schema:dG})).map((X)=>({type:"tool_reference",tool_name:X.toolName}));x.push({type:"tool_search_tool_result",tool_use_id:z.toolCallId,content:{type:"tool_search_tool_search_result",tool_references:$},cache_control:F});break}Z.push({type:"other",message:`provider executed tool result for tool ${z.toolName} is not supported`});break}}}}XG.push({role:"assistant",content:x});break}default:throw Error(`content type: ${ZG}`)}}return{prompt:{system:p,messages:XG},betas:Y}}function TQ(Q){let H=[],Z=void 0;for(let W of Q){let{role:f}=W;switch(f){case"system":{if((Z==null?void 0:Z.type)!=="system")Z={type:"system",messages:[]},H.push(Z);Z.messages.push(W);break}case"assistant":{if((Z==null?void 0:Z.type)!=="assistant")Z={type:"assistant",messages:[]},H.push(Z);Z.messages.push(W);break}case"user":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(W);break}case"tool":{if((Z==null?void 0:Z.type)!=="user")Z={type:"user",messages:[]},H.push(Z);Z.messages.push(W);break}default:throw Error(`Unsupported role: ${f}`)}}return H}function DG({finishReason:Q,isJsonResponseFromTool:H}){switch(Q){case"pause_turn":case"end_turn":case"stop_sequence":return"stop";case"refusal":return"content-filter";case"tool_use":return H?"stop":"tool-calls";case"max_tokens":case"model_context_window_exceeded":return"length";case"compaction":return"other";default:return"other"}}function fG(Q,H,Z){var W;if(Q.type==="web_search_result_location")return{type:"source",sourceType:"url",id:Z(),url:Q.url,title:Q.title,providerMetadata:{anthropic:{citedText:Q.cited_text,encryptedIndex:Q.encrypted_index}}};if(Q.type!=="page_location"&&Q.type!=="char_location")return;let f=H[Q.document_index];if(!f)return;return{type:"source",sourceType:"document",id:Z(),mediaType:f.mediaType,title:(W=Q.document_title)!=null?W:f.title,filename:f.filename,providerMetadata:{anthropic:Q.type==="page_location"?{citedText:Q.cited_text,startPageNumber:Q.start_page_number,endPageNumber:Q.end_page_number}:{citedText:Q.cited_text,startCharIndex:Q.start_char_index,endCharIndex:Q.end_char_index}}}}var TX=class{constructor(Q,H){this.specificationVersion="v3";var Z;this.modelId=Q,this.config=H,this.generateId=(Z=H.generateId)!=null?Z:CG}supportsUrl(Q){return Q.protocol==="https:"}get provider(){return this.config.provider}get providerOptionsName(){let Q=this.config.provider,H=Q.indexOf(".");return H===-1?Q:Q.substring(0,H)}get supportedUrls(){var Q,H,Z;return(Z=(H=(Q=this.config).supportedUrls)==null?void 0:H.call(Q))!=null?Z:{}}async getArgs({userSuppliedBetas:Q,prompt:H,maxOutputTokens:Z,temperature:W,topP:f,topK:h,frequencyPenalty:_,presencePenalty:b,stopSequences:l,responseFormat:M,seed:B,tools:u,toolChoice:R,providerOptions:a,stream:E}){var P,v,g,C,e,N,s,QG,YG,Y;let j=[];if(_!=null)j.push({type:"unsupported",feature:"frequencyPenalty"});if(b!=null)j.push({type:"unsupported",feature:"presencePenalty"});if(B!=null)j.push({type:"unsupported",feature:"seed"});if(W!=null&&W>1)j.push({type:"unsupported",feature:"temperature",details:`${W} exceeds anthropic maximum of 1.0. clamped to 1.0`}),W=1;else if(W!=null&&W<0)j.push({type:"unsupported",feature:"temperature",details:`${W} is below anthropic minimum of 0. clamped to 0`}),W=0;if((M==null?void 0:M.type)==="json"){if(M.schema==null)j.push({type:"unsupported",feature:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."})}let w=this.providerOptionsName,p=await LG({provider:"anthropic",providerOptions:a,schema:yG}),XG=w!=="anthropic"?await LG({provider:w,providerOptions:a,schema:yG}):null,zG=XG!=null,L=Object.assign({},p!=null?p:{},XG!=null?XG:{}),{maxOutputTokens:O,supportsStructuredOutput:T,rejectsSamplingParameters:V,isKnownModel:ZG}=OQ(this.modelId);if(V){if(W!=null)j.push({type:"unsupported",feature:"temperature",details:`temperature is not supported by ${this.modelId} and will be ignored`}),W=void 0;if(h!=null)j.push({type:"unsupported",feature:"topK",details:`topK is not supported by ${this.modelId} and will be ignored`}),h=void 0;if(f!=null)j.push({type:"unsupported",feature:"topP",details:`topP is not supported by ${this.modelId} and will be ignored`}),f=void 0}let x=ZG||this.modelId.startsWith("claude-"),o=((P=this.config.supportsNativeStructuredOutput)!=null?P:!0)&&T,t=((v=this.config.supportsStrictTools)!=null?v:!0)&&T,r=(g=L==null?void 0:L.structuredOutputMode)!=null?g:"auto",c=r==="outputFormat"||r==="auto"&&o,y=(M==null?void 0:M.type)==="json"&&M.schema!=null&&!c?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:M.schema}:void 0,n=L==null?void 0:L.contextManagement,z=new VG,m=NG({tools:u,providerToolNames:{"anthropic.code_execution_20250522":"code_execution","anthropic.code_execution_20250825":"code_execution","anthropic.code_execution_20260120":"code_execution","anthropic.computer_20241022":"computer","anthropic.computer_20250124":"computer","anthropic.text_editor_20241022":"str_replace_editor","anthropic.text_editor_20250124":"str_replace_editor","anthropic.text_editor_20250429":"str_replace_based_edit_tool","anthropic.text_editor_20250728":"str_replace_based_edit_tool","anthropic.bash_20241022":"bash","anthropic.bash_20250124":"bash","anthropic.memory_20250818":"memory","anthropic.web_search_20250305":"web_search","anthropic.web_search_20260209":"web_search","anthropic.web_fetch_20250910":"web_fetch","anthropic.web_fetch_20260209":"web_fetch","anthropic.tool_search_regex_20251119":"tool_search_tool_regex","anthropic.tool_search_bm25_20251119":"tool_search_tool_bm25"}}),{prompt:F,betas:U}=await bQ({prompt:H,sendReasoning:(C=L==null?void 0:L.sendReasoning)!=null?C:!0,warnings:j,cacheControlValidator:z,toolNameMapping:m}),K=(e=L==null?void 0:L.thinking)==null?void 0:e.type,A=K==="enabled"||K==="adaptive",$=K==="enabled"?(N=L==null?void 0:L.thinking)==null?void 0:N.budgetTokens:void 0,X=K==="adaptive"?(s=L==null?void 0:L.thinking)==null?void 0:s.display:void 0,I=Z!=null?Z:O,q={model:this.modelId,max_tokens:I,temperature:W,top_k:h,top_p:f,stop_sequences:l,...A&&{thinking:{type:K,...$!=null&&{budget_tokens:$},...X!=null&&{display:X}}},...((L==null?void 0:L.effort)||(L==null?void 0:L.taskBudget)||c&&(M==null?void 0:M.type)==="json"&&M.schema!=null)&&{output_config:{...(L==null?void 0:L.effort)&&{effort:L.effort},...(L==null?void 0:L.taskBudget)&&{task_budget:{type:L.taskBudget.type,total:L.taskBudget.total,...L.taskBudget.remaining!=null&&{remaining:L.taskBudget.remaining}}},...c&&(M==null?void 0:M.type)==="json"&&M.schema!=null&&{format:{type:"json_schema",schema:M.schema}}}},...(L==null?void 0:L.speed)&&{speed:L.speed},...(L==null?void 0:L.inferenceGeo)&&{inference_geo:L.inferenceGeo},...(L==null?void 0:L.cacheControl)&&{cache_control:L.cacheControl},...((QG=L==null?void 0:L.metadata)==null?void 0:QG.userId)!=null&&{metadata:{user_id:L.metadata.userId}},...(L==null?void 0:L.mcpServers)&&L.mcpServers.length>0&&{mcp_servers:L.mcpServers.map((S)=>({type:S.type,name:S.name,url:S.url,authorization_token:S.authorizationToken,tool_configuration:S.toolConfiguration?{allowed_tools:S.toolConfiguration.allowedTools,enabled:S.toolConfiguration.enabled}:void 0}))},...(L==null?void 0:L.container)&&{container:L.container.skills&&L.container.skills.length>0?{id:L.container.id,skills:L.container.skills.map((S)=>({type:S.type,skill_id:S.skillId,version:S.version}))}:L.container.id},system:F.system,messages:F.messages,...n&&{context_management:{edits:n.edits.map((S)=>{let RG=S.type;switch(RG){case"clear_tool_uses_20250919":return{type:S.type,...S.trigger!==void 0&&{trigger:S.trigger},...S.keep!==void 0&&{keep:S.keep},...S.clearAtLeast!==void 0&&{clear_at_least:S.clearAtLeast},...S.clearToolInputs!==void 0&&{clear_tool_inputs:S.clearToolInputs},...S.excludeTools!==void 0&&{exclude_tools:S.excludeTools}};case"clear_thinking_20251015":return{type:S.type,...S.keep!==void 0&&{keep:S.keep}};case"compact_20260112":return{type:S.type,...S.trigger!==void 0&&{trigger:S.trigger},...S.pauseAfterCompaction!==void 0&&{pause_after_compaction:S.pauseAfterCompaction},...S.instructions!==void 0&&{instructions:S.instructions}};default:j.push({type:"other",message:`Unknown context management strategy: ${RG}`});return}}).filter((S)=>S!==void 0)}}};if(A){if(K==="enabled"&&$==null)j.push({type:"compatibility",feature:"extended thinking",details:"thinking budget is required when thinking is enabled. using default budget of 1024 tokens."}),q.thinking={type:"enabled",budget_tokens:1024},$=1024;if(q.temperature!=null)q.temperature=void 0,j.push({type:"unsupported",feature:"temperature",details:"temperature is not supported when thinking is enabled"});if(h!=null)q.top_k=void 0,j.push({type:"unsupported",feature:"topK",details:"topK is not supported when thinking is enabled"});if(f!=null)q.top_p=void 0,j.push({type:"unsupported",feature:"topP",details:"topP is not supported when thinking is enabled"});q.max_tokens=I+($!=null?$:0)}else if(x&&f!=null&&W!=null)j.push({type:"unsupported",feature:"topP",details:"topP is not supported when temperature is set. topP is ignored."}),q.top_p=void 0;if(ZG&&q.max_tokens>O){if(Z!=null)j.push({type:"unsupported",feature:"maxOutputTokens",details:`${q.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${O} max output tokens. The max output tokens have been limited to ${O}.`});q.max_tokens=O}if((L==null?void 0:L.mcpServers)&&L.mcpServers.length>0)U.add("mcp-client-2025-04-04");if(n){if(U.add("context-management-2025-06-27"),n.edits.some((S)=>S.type==="compact_20260112"))U.add("compact-2026-01-12")}if((L==null?void 0:L.container)&&L.container.skills&&L.container.skills.length>0){if(U.add("code-execution-2025-08-25"),U.add("skills-2025-10-02"),U.add("files-api-2025-04-14"),!(u==null?void 0:u.some((S)=>S.type==="provider"&&(S.id==="anthropic.code_execution_20250825"||S.id==="anthropic.code_execution_20260120"))))j.push({type:"other",message:"code execution tool is required when using skills"})}if(L==null?void 0:L.effort)U.add("effort-2025-11-24");if(L==null?void 0:L.taskBudget)U.add("task-budgets-2026-03-13");if((L==null?void 0:L.speed)==="fast")U.add("fast-mode-2026-02-01");let k=E&&((YG=L==null?void 0:L.toolStreaming)!=null?YG:!0),{tools:$G,toolChoice:UG,toolWarnings:AG,betas:uG}=await UQ(y!=null?{tools:[...u!=null?u:[],y],toolChoice:{type:"required"},disableParallelToolUse:!0,cacheControlValidator:z,supportsStructuredOutput:!1,supportsStrictTools:t,defaultEagerInputStreaming:k}:{tools:u!=null?u:[],toolChoice:R,disableParallelToolUse:L==null?void 0:L.disableParallelToolUse,cacheControlValidator:z,supportsStructuredOutput:o,supportsStrictTools:t,defaultEagerInputStreaming:k}),cG=z.getWarnings();return{args:{...q,tools:$G,tool_choice:UG,stream:E===!0?!0:void 0},warnings:[...j,...AG,...cG],betas:new Set([...U,...uG,...Q,...(Y=L==null?void 0:L.anthropicBeta)!=null?Y:[]]),usesJsonResponseTool:y!=null,toolNameMapping:m,providerOptionsName:w,usedCustomProviderKey:zG}}async getHeaders({betas:Q,headers:H}){return wG(await jG(this.config.headers),H,Q.size>0?{"anthropic-beta":Array.from(Q).join(",")}:{})}async getBetasFromHeaders(Q){var H,Z;let f=(H=(await jG(this.config.headers))["anthropic-beta"])!=null?H:"",h=(Z=Q==null?void 0:Q["anthropic-beta"])!=null?Z:"";return new Set([...f.toLowerCase().split(","),...h.toLowerCase().split(",")].map((_)=>_.trim()).filter((_)=>_!==""))}buildRequestUrl(Q){var H,Z,W;return(W=(Z=(H=this.config).buildRequestUrl)==null?void 0:Z.call(H,this.config.baseURL,Q))!=null?W:`${this.config.baseURL}/messages`}transformRequestBody(Q,H){var Z,W,f;return(f=(W=(Z=this.config).transformRequestBody)==null?void 0:W.call(Z,Q,H))!=null?f:Q}extractCitationDocuments(Q){let H=(Z)=>{var W,f;if(Z.type!=="file")return!1;if(Z.mediaType!=="application/pdf"&&Z.mediaType!=="text/plain")return!1;let h=(W=Z.providerOptions)==null?void 0:W.anthropic,_=h==null?void 0:h.citations;return(f=_==null?void 0:_.enabled)!=null?f:!1};return Q.filter((Z)=>Z.role==="user").flatMap((Z)=>Z.content).filter(H).map((Z)=>{var W;let f=Z;return{title:(W=f.filename)!=null?W:"Untitled Document",filename:f.filename,mediaType:f.mediaType}})}async doGenerate(Q){var H,Z,W,f,h,_,b;let{args:l,warnings:M,betas:B,usesJsonResponseTool:u,toolNameMapping:R,providerOptionsName:a,usedCustomProviderKey:E}=await this.getArgs({...Q,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),P=[...this.extractCitationDocuments(Q.prompt)],v=PG(l.tools),{responseHeaders:g,value:C,rawValue:e}=await WG({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:B,headers:Q.headers}),body:this.transformRequestBody(l,B),failedResponseHandler:EG,successfulResponseHandler:kG(lG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),N=[],s={},QG={},YG=!1;for(let Y of C.content)switch(Y.type){case"text":{if(!u){if(N.push({type:"text",text:Y.text}),Y.citations)for(let j of Y.citations){let w=fG(j,P,this.generateId);if(w)N.push(w)}}break}case"thinking":{N.push({type:"reasoning",text:Y.thinking,providerMetadata:{anthropic:{signature:Y.signature}}});break}case"redacted_thinking":{N.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:Y.data}}});break}case"compaction":{N.push({type:"text",text:Y.content,providerMetadata:{anthropic:{type:"compaction"}}});break}case"tool_use":{if(u&&Y.name==="json")YG=!0,N.push({type:"text",text:JSON.stringify(Y.input)});else{let w=Y.caller,p=w?{type:w.type,toolId:"tool_id"in w?w.tool_id:void 0}:void 0;N.push({type:"tool-call",toolCallId:Y.id,toolName:Y.name,input:JSON.stringify(Y.input),...p&&{providerMetadata:{anthropic:{caller:p}}}})}break}case"server_tool_use":{if(Y.name==="text_editor_code_execution"||Y.name==="bash_code_execution")N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName("code_execution"),input:JSON.stringify({type:Y.name,...Y.input}),providerExecuted:!0});else if(Y.name==="web_search"||Y.name==="code_execution"||Y.name==="web_fetch"){let j=Y.name==="code_execution"&&Y.input!=null&&typeof Y.input==="object"&&"code"in Y.input&&!("type"in Y.input)?{type:"programmatic-tool-call",...Y.input}:Y.input;N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(j),providerExecuted:!0,...v&&Y.name==="code_execution"?{dynamic:!0}:{}})}else if(Y.name==="tool_search_tool_regex"||Y.name==="tool_search_tool_bm25")QG[Y.id]=Y.name,N.push({type:"tool-call",toolCallId:Y.id,toolName:R.toCustomToolName(Y.name),input:JSON.stringify(Y.input),providerExecuted:!0});break}case"mcp_tool_use":{s[Y.id]={type:"tool-call",toolCallId:Y.id,toolName:Y.name,input:JSON.stringify(Y.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:Y.server_name}}},N.push(s[Y.id]);break}case"mcp_tool_result":{N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:s[Y.tool_use_id].toolName,isError:Y.is_error,result:Y.content,dynamic:!0,providerMetadata:s[Y.tool_use_id].providerMetadata});break}case"web_fetch_tool_result":{if(Y.content.type==="web_fetch_result")P.push({title:(H=Y.content.content.title)!=null?H:Y.content.url,mediaType:Y.content.content.source.media_type}),N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:Y.content.url,retrievedAt:Y.content.retrieved_at,content:{type:Y.content.content.type,title:Y.content.content.title,citations:Y.content.content.citations,source:{type:Y.content.content.source.type,mediaType:Y.content.content.source.media_type,data:Y.content.content.source.data}}}});else if(Y.content.type==="web_fetch_tool_result_error")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:Y.content.error_code}});break}case"web_search_tool_result":{if(Array.isArray(Y.content)){N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),result:Y.content.map((j)=>{var w;return{url:j.url,title:j.title,pageAge:(w=j.page_age)!=null?w:null,encryptedContent:j.encrypted_content,type:j.type}})});for(let j of Y.content)N.push({type:"source",sourceType:"url",id:this.generateId(),url:j.url,title:j.title,providerMetadata:{anthropic:{pageAge:(Z=j.page_age)!=null?Z:null}}})}else N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:Y.content.error_code}});break}case"code_execution_tool_result":{if(Y.content.type==="code_execution_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:{type:Y.content.type,stdout:Y.content.stdout,stderr:Y.content.stderr,return_code:Y.content.return_code,content:(W=Y.content.content)!=null?W:[]}});else if(Y.content.type==="encrypted_code_execution_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:{type:Y.content.type,encrypted_stdout:Y.content.encrypted_stdout,stderr:Y.content.stderr,return_code:Y.content.return_code,content:(f=Y.content.content)!=null?f:[]}});else if(Y.content.type==="code_execution_tool_result_error")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:Y.content.error_code}});break}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName("code_execution"),result:Y.content});break}case"tool_search_tool_result":{let j=QG[Y.tool_use_id];if(j==null){let w=R.toCustomToolName("tool_search_tool_bm25"),p=R.toCustomToolName("tool_search_tool_regex");if(w!=="tool_search_tool_bm25")j="tool_search_tool_bm25";else if(p!=="tool_search_tool_regex")j="tool_search_tool_regex";else j="tool_search_tool_regex"}if(Y.content.type==="tool_search_tool_search_result")N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),result:Y.content.tool_references.map((w)=>({type:w.type,toolName:w.tool_name}))});else N.push({type:"tool-result",toolCallId:Y.tool_use_id,toolName:R.toCustomToolName(j),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:Y.content.error_code}});break}}return{content:N,finishReason:{unified:DG({finishReason:C.stop_reason,isJsonResponseFromTool:YG}),raw:(h=C.stop_reason)!=null?h:void 0},usage:IG({usage:C.usage}),request:{body:l},response:{id:(_=C.id)!=null?_:void 0,modelId:(b=C.model)!=null?b:void 0,headers:g,body:e},warnings:M,providerMetadata:(()=>{var Y,j,w,p,XG;let zG={usage:C.usage,cacheCreationInputTokens:(Y=C.usage.cache_creation_input_tokens)!=null?Y:null,stopSequence:(j=C.stop_sequence)!=null?j:null,iterations:C.usage.iterations?C.usage.iterations.map((O)=>({type:O.type,inputTokens:O.input_tokens,outputTokens:O.output_tokens})):null,container:C.container?{expiresAt:C.container.expires_at,id:C.container.id,skills:(p=(w=C.container.skills)==null?void 0:w.map((O)=>({type:O.type,skillId:O.skill_id,version:O.version})))!=null?p:null}:null,contextManagement:(XG=xG(C.context_management))!=null?XG:null},L={anthropic:zG};if(E&&a!=="anthropic")L[a]=zG;return L})()}}async doStream(Q){var H,Z;let{args:W,warnings:f,betas:h,usesJsonResponseTool:_,toolNameMapping:b,providerOptionsName:l,usedCustomProviderKey:M}=await this.getArgs({...Q,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(Q.headers)}),B=[...this.extractCitationDocuments(Q.prompt)],u=PG(W.tools),R=this.buildRequestUrl(!0),{responseHeaders:a,value:E}=await WG({url:R,headers:await this.getHeaders({betas:h,headers:Q.headers}),body:this.transformRequestBody(W,h),failedResponseHandler:EG,successfulResponseHandler:OG(sG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),P={unified:"other",raw:void 0},v={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},g={},C={},e={},N=null,s=void 0,QG=null,YG=null,Y=null,j=!1,w=void 0,p=this.generateId,XG=E.pipeThrough(new TransformStream({start(T){T.enqueue({type:"stream-start",warnings:f})},transform(T,V){var ZG,x,o,t,r,c,y,n,z,m,F,U,K,A;if(Q.includeRawChunks)V.enqueue({type:"raw",rawValue:T.rawValue});if(!T.success){V.enqueue({type:"error",error:T.error});return}let $=T.value;switch($.type){case"ping":return;case"content_block_start":{let X=$.content_block,I=X.type;switch(w=I,I){case"text":{if(_)return;g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});return}case"thinking":{g[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index)});return}case"redacted_thinking":{g[$.index]={type:"reasoning"},V.enqueue({type:"reasoning-start",id:String($.index),providerMetadata:{anthropic:{redactedData:X.data}}});return}case"compaction":{g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index),providerMetadata:{anthropic:{type:"compaction"}}});return}case"tool_use":{if(_&&X.name==="json")j=!0,g[$.index]={type:"text"},V.enqueue({type:"text-start",id:String($.index)});else{let k=X.caller,$G=k?{type:k.type,toolId:"tool_id"in k?k.tool_id:void 0}:void 0,AG=X.input&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";g[$.index]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:AG,firstDelta:AG.length===0,...$G&&{caller:$G}},V.enqueue({type:"tool-input-start",id:X.id,toolName:X.name})}return}case"server_tool_use":{if(["web_fetch","web_search","code_execution","text_editor_code_execution","bash_code_execution"].includes(X.name)){let q=X.name==="text_editor_code_execution"||X.name==="bash_code_execution"?"code_execution":X.name,k=b.toCustomToolName(q),$G=X.input!=null&&typeof X.input==="object"&&Object.keys(X.input).length>0?JSON.stringify(X.input):"";g[$.index]={type:"tool-call",toolCallId:X.id,toolName:k,input:$G,providerExecuted:!0,...u&&q==="code_execution"?{dynamic:!0}:{},firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:k,providerExecuted:!0,...u&&q==="code_execution"?{dynamic:!0}:{}})}else if(X.name==="tool_search_tool_regex"||X.name==="tool_search_tool_bm25"){e[X.id]=X.name;let q=b.toCustomToolName(X.name);g[$.index]={type:"tool-call",toolCallId:X.id,toolName:q,input:"",providerExecuted:!0,firstDelta:!0,providerToolName:X.name},V.enqueue({type:"tool-input-start",id:X.id,toolName:q,providerExecuted:!0})}return}case"web_fetch_tool_result":{if(X.content.type==="web_fetch_result")B.push({title:(ZG=X.content.content.title)!=null?ZG:X.content.url,mediaType:X.content.content.source.media_type}),V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:X.content.url,retrievedAt:X.content.retrieved_at,content:{type:X.content.content.type,title:X.content.content.title,citations:X.content.content.citations,source:{type:X.content.content.source.type,mediaType:X.content.content.source.media_type,data:X.content.content.source.data}}}});else if(X.content.type==="web_fetch_tool_result_error")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:X.content.error_code}});return}case"web_search_tool_result":{if(Array.isArray(X.content)){V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_search"),result:X.content.map((q)=>{var k;return{url:q.url,title:q.title,pageAge:(k=q.page_age)!=null?k:null,encryptedContent:q.encrypted_content,type:q.type}})});for(let q of X.content)V.enqueue({type:"source",sourceType:"url",id:p(),url:q.url,title:q.title,providerMetadata:{anthropic:{pageAge:(x=q.page_age)!=null?x:null}}})}else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:X.content.error_code}});return}case"code_execution_tool_result":{if(X.content.type==="code_execution_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:{type:X.content.type,stdout:X.content.stdout,stderr:X.content.stderr,return_code:X.content.return_code,content:(o=X.content.content)!=null?o:[]}});else if(X.content.type==="encrypted_code_execution_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:{type:X.content.type,encrypted_stdout:X.content.encrypted_stdout,stderr:X.content.stderr,return_code:X.content.return_code,content:(t=X.content.content)!=null?t:[]}});else if(X.content.type==="code_execution_tool_result_error")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:X.content.error_code}});return}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName("code_execution"),result:X.content});return}case"tool_search_tool_result":{let q=e[X.tool_use_id];if(q==null){let k=b.toCustomToolName("tool_search_tool_bm25"),$G=b.toCustomToolName("tool_search_tool_regex");if(k!=="tool_search_tool_bm25")q="tool_search_tool_bm25";else if($G!=="tool_search_tool_regex")q="tool_search_tool_regex";else q="tool_search_tool_regex"}if(X.content.type==="tool_search_tool_search_result")V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName(q),result:X.content.tool_references.map((k)=>({type:k.type,toolName:k.tool_name}))});else V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:b.toCustomToolName(q),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:X.content.error_code}});return}case"mcp_tool_use":{C[X.id]={type:"tool-call",toolCallId:X.id,toolName:X.name,input:JSON.stringify(X.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:X.server_name}}},V.enqueue(C[X.id]);return}case"mcp_tool_result":{V.enqueue({type:"tool-result",toolCallId:X.tool_use_id,toolName:C[X.tool_use_id].toolName,isError:X.is_error,result:X.content,dynamic:!0,providerMetadata:C[X.tool_use_id].providerMetadata});return}default:throw Error(`Unsupported content block type: ${I}`)}}case"content_block_stop":{if(g[$.index]!=null){let X=g[$.index];switch(X.type){case"text":{V.enqueue({type:"text-end",id:String($.index)});break}case"reasoning":{V.enqueue({type:"reasoning-end",id:String($.index)});break}case"tool-call":if(!(_&&X.toolName==="json")){V.enqueue({type:"tool-input-end",id:X.toolCallId});let q=X.input===""?"{}":X.input;if(X.providerToolName==="code_execution")try{let k=JSON.parse(q);if(k!=null&&typeof k==="object"&&"code"in k&&!("type"in k))q=JSON.stringify({type:"programmatic-tool-call",...k})}catch(k){}V.enqueue({type:"tool-call",toolCallId:X.toolCallId,toolName:X.toolName,input:q,providerExecuted:X.providerExecuted,...u&&X.providerToolName==="code_execution"?{dynamic:!0}:{},...X.caller&&{providerMetadata:{anthropic:{caller:X.caller}}}})}break}delete g[$.index]}w=void 0;return}case"content_block_delta":{let X=$.delta.type;switch(X){case"text_delta":{if(_)return;V.enqueue({type:"text-delta",id:String($.index),delta:$.delta.text});return}case"thinking_delta":{V.enqueue({type:"reasoning-delta",id:String($.index),delta:$.delta.thinking});return}case"signature_delta":{if(w==="thinking")V.enqueue({type:"reasoning-delta",id:String($.index),delta:"",providerMetadata:{anthropic:{signature:$.delta.signature}}});return}case"compaction_delta":{if($.delta.content!=null)V.enqueue({type:"text-delta",id:String($.index),delta:$.delta.content});return}case"input_json_delta":{let I=g[$.index],q=$.delta.partial_json;if(q.length===0)return;if(j){if((I==null?void 0:I.type)!=="text")return;V.enqueue({type:"text-delta",id:String($.index),delta:q})}else{if((I==null?void 0:I.type)!=="tool-call")return;if(I.firstDelta&&(I.providerToolName==="bash_code_execution"||I.providerToolName==="text_editor_code_execution"))q=`{"type": "${I.providerToolName}",${q.substring(1)}`;V.enqueue({type:"tool-input-delta",id:I.toolCallId,delta:q}),I.input+=q,I.firstDelta=!1}return}case"citations_delta":{let I=$.delta.citation,q=fG(I,B,p);if(q)V.enqueue(q);return}default:throw Error(`Unsupported delta type: ${X}`)}}case"message_start":{if(v.input_tokens=$.message.usage.input_tokens,v.cache_read_input_tokens=(r=$.message.usage.cache_read_input_tokens)!=null?r:0,v.cache_creation_input_tokens=(c=$.message.usage.cache_creation_input_tokens)!=null?c:0,s={...$.message.usage},QG=(y=$.message.usage.cache_creation_input_tokens)!=null?y:null,$.message.container!=null)Y={expiresAt:$.message.container.expires_at,id:$.message.container.id,skills:null};if($.message.stop_reason!=null)P={unified:DG({finishReason:$.message.stop_reason,isJsonResponseFromTool:j}),raw:$.message.stop_reason};if(V.enqueue({type:"response-metadata",id:(n=$.message.id)!=null?n:void 0,modelId:(z=$.message.model)!=null?z:void 0}),$.message.content!=null)for(let X=0;X<$.message.content.length;X++){let I=$.message.content[X];if(I.type==="tool_use"){let q=I.caller,k=q?{type:q.type,toolId:"tool_id"in q?q.tool_id:void 0}:void 0;V.enqueue({type:"tool-input-start",id:I.id,toolName:I.name});let $G=JSON.stringify((m=I.input)!=null?m:{});V.enqueue({type:"tool-input-delta",id:I.id,delta:$G}),V.enqueue({type:"tool-input-end",id:I.id}),V.enqueue({type:"tool-call",toolCallId:I.id,toolName:I.name,input:$G,...k&&{providerMetadata:{anthropic:{caller:k}}}})}}return}case"message_delta":{if($.usage.input_tokens!=null&&v.input_tokens!==$.usage.input_tokens)v.input_tokens=$.usage.input_tokens;if(v.output_tokens=$.usage.output_tokens,$.usage.cache_read_input_tokens!=null)v.cache_read_input_tokens=$.usage.cache_read_input_tokens;if($.usage.cache_creation_input_tokens!=null)v.cache_creation_input_tokens=$.usage.cache_creation_input_tokens,QG=$.usage.cache_creation_input_tokens;if($.usage.iterations!=null)v.iterations=$.usage.iterations;if(P={unified:DG({finishReason:$.delta.stop_reason,isJsonResponseFromTool:j}),raw:(F=$.delta.stop_reason)!=null?F:void 0},YG=(U=$.delta.stop_sequence)!=null?U:null,Y=$.delta.container!=null?{expiresAt:$.delta.container.expires_at,id:$.delta.container.id,skills:(A=(K=$.delta.container.skills)==null?void 0:K.map((X)=>({type:X.type,skillId:X.skill_id,version:X.version})))!=null?A:null}:null,$.context_management)N=xG($.context_management);s={...s,...$.usage};return}case"message_stop":{let X={usage:s!=null?s:null,cacheCreationInputTokens:QG,stopSequence:YG,iterations:v.iterations?v.iterations.map((q)=>({type:q.type,inputTokens:q.input_tokens,outputTokens:q.output_tokens})):null,container:Y,contextManagement:N},I={anthropic:X};if(M&&l!=="anthropic")I[l]=X;V.enqueue({type:"finish",finishReason:P,usage:IG({usage:v,rawUsage:s}),providerMetadata:I});return}case"error":{V.enqueue({type:"error",error:$.error});return}default:throw Error(`Unsupported chunk type: ${$}`)}}})),[zG,L]=XG.tee(),O=zG.getReader();try{await O.read();let T=await O.read();if(((H=T.value)==null?void 0:H.type)==="raw")T=await O.read();if(((Z=T.value)==null?void 0:Z.type)==="error"){let V=T.value.error;throw new BG({message:V.message,url:R,requestBodyValues:W,statusCode:V.type==="overloaded_error"?529:500,responseHeaders:a,responseBody:JSON.stringify(V),isRetryable:V.type==="overloaded_error"})}}finally{O.cancel().catch(()=>{}),O.releaseLock()}return{stream:L,request:{body:W},response:{headers:a}}}};function OQ(Q){if(Q.includes("claude-opus-4-7"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!0,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-6")||Q.includes("claude-opus-4-6"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-5")||Q.includes("claude-opus-4-5")||Q.includes("claude-haiku-4-5"))return{maxOutputTokens:64000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-opus-4-1"))return{maxOutputTokens:32000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-sonnet-4-"))return{maxOutputTokens:64000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-opus-4-"))return{maxOutputTokens:32000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if(Q.includes("claude-3-haiku"))return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!1}}function PG(Q){if(!Q)return!1;let H=!1,Z=!1;for(let W of Q){if("type"in W&&(W.type==="web_fetch_20260209"||W.type==="web_search_20260209")){H=!0;continue}if(W.name==="code_execution"){Z=!0;break}}return H&&!Z}function xG(Q){return Q?{appliedEdits:Q.applied_edits.map((H)=>{switch(H.type){case"clear_tool_uses_20250919":return{type:H.type,clearedToolUses:H.cleared_tool_uses,clearedInputTokens:H.cleared_input_tokens};case"clear_thinking_20251015":return{type:H.type,clearedThinkingTurns:H.cleared_thinking_turns,clearedInputTokens:H.cleared_input_tokens};case"compact_20260112":return{type:H.type}}}).filter((H)=>H!==void 0)}:null}var kQ=D(()=>J(G.object({command:G.string(),restart:G.boolean().optional()}))),vQ=d({id:"anthropic.bash_20241022",inputSchema:kQ}),_Q=D(()=>J(G.object({command:G.string(),restart:G.boolean().optional()}))),hQ=d({id:"anthropic.bash_20250124",inputSchema:_Q}),gQ=D(()=>J(G.object({action:G.enum(["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","screenshot","cursor_position"]),coordinate:G.array(G.number().int()).optional(),text:G.string().optional()}))),mQ=d({id:"anthropic.computer_20241022",inputSchema:gQ}),dQ=D(()=>J(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),uQ=d({id:"anthropic.computer_20250124",inputSchema:dQ}),cQ=D(()=>J(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot","zoom"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),region:G.tuple([G.number().int(),G.number().int(),G.number().int(),G.number().int()]).optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),iQ=d({id:"anthropic.computer_20251124",inputSchema:cQ}),lQ=D(()=>J(G.discriminatedUnion("command",[G.object({command:G.literal("view"),path:G.string(),view_range:G.tuple([G.number(),G.number()]).optional()}),G.object({command:G.literal("create"),path:G.string(),file_text:G.string()}),G.object({command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()}),G.object({command:G.literal("insert"),path:G.string(),insert_line:G.number(),insert_text:G.string()}),G.object({command:G.literal("delete"),path:G.string()}),G.object({command:G.literal("rename"),old_path:G.string(),new_path:G.string()})]))),sQ=d({id:"anthropic.memory_20250818",inputSchema:lQ}),pQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),nQ=d({id:"anthropic.text_editor_20241022",inputSchema:pQ}),rQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),aQ=d({id:"anthropic.text_editor_20250124",inputSchema:rQ}),eQ=D(()=>J(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),oQ=d({id:"anthropic.text_editor_20250429",inputSchema:eQ}),tQ=D(()=>J(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),GX=D(()=>J(G.object({query:G.string(),limit:G.number().optional()}))),QX=i({id:"anthropic.tool_search_bm25_20251119",inputSchema:GX,outputSchema:tQ,supportsDeferredResults:!0}),XX=(Q={})=>{return QX(Q)},GY={bash_20241022:vQ,bash_20250124:hQ,codeExecution_20250522:SQ,codeExecution_20250825:IQ,codeExecution_20260120:xQ,computer_20241022:mQ,computer_20250124:uQ,computer_20251124:iQ,memory_20250818:sQ,textEditor_20241022:nQ,textEditor_20250124:aQ,textEditor_20250429:oQ,textEditor_20250728:oG,webFetch_20250910:VQ,webFetch_20260209:DQ,webSearch_20250305:LQ,webSearch_20260209:YQ,toolSearchRegex_20251119:NQ,toolSearchBm25_20251119:XX};
|
|
3
|
+
export{UQ as xf,TX as yf,GY as zf};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let N=c.originalExpiration??c.expiration;return{...c,...N?{originalExpiration:N}:{},expiration:T}};var k=(c,I={})=>{let x=I?.logger||console,T;return async()=>{let N;try{if(N=await c(),N.expiration&&N.expiration.getTime()<Date.now())N=L(N,x)}catch(O){if(T)x.warn("Credential renew failed: ",O),N=L(T,x);else throw O}return T=N,N}};var p="/latest/meta-data/iam/security-credentials/",Ic="/latest/api/token",B="AWS_EC2_METADATA_V1_DISABLED",R="ec2_metadata_v1_disabled",M="x-aws-ec2-metadata-token",pc=(c={})=>k(Tc(c),{logger:c.logger}),Tc=(c={})=>{let I=!1,{logger:x,profile:T}=c,{timeout:N,maxRetries:O}=Z(c),$=async(y,j)=>{if(I||j.headers?.[M]==null){let w=!1,h=!1,n=await G.loadConfig({environmentVariableSelector:(Y)=>{let u=Y[B];if(h=!!u&&u!=="false",u===void 0)throw new G.CredentialsProviderError(`${B} not set in env, checking config file next.`,{logger:c.logger});return h},configFileSelector:(Y)=>{let u=Y[R];return w=!!u&&u!=="false",w},default:!1},{profile:T})();if(c.ec2MetadataV1Disabled||n){let Y=[];if(c.ec2MetadataV1Disabled)Y.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(w)Y.push(`config file profile (${R})`);if(h)Y.push(`process environment variable (${B})`);throw new D(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${Y.join(", ")}].`)}}let C=(await m(async()=>{let w;try{w=await xc(j)}catch(h){if(h.statusCode===401)I=!1;throw h}return w},y)).trim();return m(async()=>{let w;try{w=await Oc(C,j,c)}catch(h){if(h.statusCode===401)I=!1;throw h}return w},y)};return async()=>{let y=await H();if(I)return x?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),$(O,{...y,timeout:N});else{let j;try{j=(await Nc({...y,timeout:N})).toString()}catch(E){if(E?.statusCode===400)throw Object.assign(E,{message:"EC2 Metadata token request returned error"});else if(E.message==="TimeoutError"||[403,404,405].includes(E.statusCode))I=!0;return x?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),$(O,{...y,timeout:N})}return $(O,{...y,headers:{[M]:j},timeout:N})}}},Nc=async(c)=>S({...c,path:Ic,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),xc=async(c)=>(await S({...c,path:p})).toString(),Oc=async(c,I,x)=>{let T=JSON.parse((await S({...I,path:p+c})).toString());if(!Q(T))throw new G.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:x.logger});return X(T)};export{wc as
|
|
2
|
+
import{Ae as e}from"./chunk-8yr682pv.js";import{uf as K}from"./chunk-v3x5nrc4.js";import{gQ as A}from"./chunk-4sazy0nq.js";var J=A(K(),1);var Q=(c)=>Boolean(c)&&typeof c==="object"&&typeof c.AccessKeyId==="string"&&typeof c.SecretAccessKey==="string"&&typeof c.Token==="string"&&typeof c.Expiration==="string",X=(c)=>({accessKeyId:c.AccessKeyId,secretAccessKey:c.SecretAccessKey,sessionToken:c.Token,expiration:new Date(c.Expiration),...c.AccountId&&{accountId:c.AccountId}});var wc=1000,hc=0,Z=({maxRetries:c=0,timeout:I=1000})=>({maxRetries:c,timeout:I});var _=A(K(),1);import q from"http";function S(c){return new Promise((I,x)=>{let T=q.request({method:"GET",...c,hostname:c.hostname?.replace(/^\[(.+)\]$/,"$1")});T.on("error",(N)=>{x(Object.assign(new _.ProviderError("Unable to connect to instance metadata service"),N)),T.destroy()}),T.on("timeout",()=>{x(new _.ProviderError("TimeoutError from instance metadata service")),T.destroy()}),T.on("response",(N)=>{let{statusCode:O=400}=N;if(O<200||300<=O)x(Object.assign(new _.ProviderError("Error response received from instance metadata service"),{statusCode:O})),T.destroy();let $=[];N.on("data",(y)=>{$.push(y)}),N.on("end",()=>{I(Buffer.concat($)),T.destroy()})}),T.end()})}var m=(c,I)=>{let x=c();for(let T=0;T<I;T++)x=x.catch(c);return x};var v="AWS_CONTAINER_CREDENTIALS_FULL_URI",W="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",t="AWS_CONTAINER_AUTHORIZATION_TOKEN",Kc=(c={})=>{let{timeout:I,maxRetries:x}=Z(c);return()=>m(async()=>{let T=await l({logger:c.logger}),N=JSON.parse(await a(I,T));if(!Q(N))throw new J.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:c.logger});return X(N)},x)},a=async(c,I)=>{if(process.env[t])I.headers={...I.headers,Authorization:process.env[t]};return(await S({...I,timeout:c})).toString()},o="169.254.170.2",s=new Set(["localhost","127.0.0.1"]),g=new Set(["http:","https:"]),l=async({logger:c})=>{if(process.env[W])return{hostname:o,path:process.env[W]};if(process.env[v]){let I;try{I=new URL(process.env[v])}catch{throw new J.CredentialsProviderError(`${process.env[v]} is not a valid container metadata service URL`,{tryNextLink:!1,logger:c})}if(!I.hostname||!s.has(I.hostname))throw new J.CredentialsProviderError(`${I.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:c});if(!I.protocol||!g.has(I.protocol))throw new J.CredentialsProviderError(`${I.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:c});return{protocol:I.protocol,hostname:I.hostname,path:I.pathname+I.search,port:I.port?parseInt(I.port,10):void 0}}throw new J.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${W} or ${v} environment variable is set`,{tryNextLink:!1,logger:c})};var G=A(K(),1);var U=A(K(),1);class D extends U.CredentialsProviderError{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(c,I=!0){super(c,I);this.tryNextLink=I,Object.setPrototypeOf(this,D.prototype)}}var b=A(K(),1),V=A(e(),1);var z;(function(c){c.IPv4="http://169.254.169.254",c.IPv6="http://[fd00:ec2::254]"})(z||(z={}));var F={environmentVariableSelector:(c)=>c.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:(c)=>c.ec2_metadata_service_endpoint,default:void 0};var f;(function(c){c.IPv4="IPv4",c.IPv6="IPv6"})(f||(f={}));var r="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",d="ec2_metadata_service_endpoint_mode",P={environmentVariableSelector:(c)=>c[r],configFileSelector:(c)=>c[d],default:f.IPv4};var H=async()=>V.parseUrl(await i()||await cc()),i=async()=>b.loadConfig(F)(),cc=async()=>{let c=await b.loadConfig(P)();switch(c){case f.IPv4:return z.IPv4;case f.IPv6:return z.IPv6;default:throw Error(`Unsupported endpoint mode: ${c}. Select from ${Object.values(f)}`)}};var L=(c,I)=>{let x=300+Math.floor(Math.random()*300),T=new Date(Date.now()+x*1000);I.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(T)}.
|
|
3
|
+
For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let N=c.originalExpiration??c.expiration;return{...c,...N?{originalExpiration:N}:{},expiration:T}};var k=(c,I={})=>{let x=I?.logger||console,T;return async()=>{let N;try{if(N=await c(),N.expiration&&N.expiration.getTime()<Date.now())N=L(N,x)}catch(O){if(T)x.warn("Credential renew failed: ",O),N=L(T,x);else throw O}return T=N,N}};var p="/latest/meta-data/iam/security-credentials/",Ic="/latest/api/token",B="AWS_EC2_METADATA_V1_DISABLED",R="ec2_metadata_v1_disabled",M="x-aws-ec2-metadata-token",pc=(c={})=>k(Tc(c),{logger:c.logger}),Tc=(c={})=>{let I=!1,{logger:x,profile:T}=c,{timeout:N,maxRetries:O}=Z(c),$=async(y,j)=>{if(I||j.headers?.[M]==null){let w=!1,h=!1,n=await G.loadConfig({environmentVariableSelector:(Y)=>{let u=Y[B];if(h=!!u&&u!=="false",u===void 0)throw new G.CredentialsProviderError(`${B} not set in env, checking config file next.`,{logger:c.logger});return h},configFileSelector:(Y)=>{let u=Y[R];return w=!!u&&u!=="false",w},default:!1},{profile:T})();if(c.ec2MetadataV1Disabled||n){let Y=[];if(c.ec2MetadataV1Disabled)Y.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(w)Y.push(`config file profile (${R})`);if(h)Y.push(`process environment variable (${B})`);throw new D(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${Y.join(", ")}].`)}}let C=(await m(async()=>{let w;try{w=await xc(j)}catch(h){if(h.statusCode===401)I=!1;throw h}return w},y)).trim();return m(async()=>{let w;try{w=await Oc(C,j,c)}catch(h){if(h.statusCode===401)I=!1;throw h}return w},y)};return async()=>{let y=await H();if(I)return x?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),$(O,{...y,timeout:N});else{let j;try{j=(await Nc({...y,timeout:N})).toString()}catch(E){if(E?.statusCode===400)throw Object.assign(E,{message:"EC2 Metadata token request returned error"});else if(E.message==="TimeoutError"||[403,404,405].includes(E.statusCode))I=!0;return x?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),$(O,{...y,timeout:N})}return $(O,{...y,headers:{[M]:j},timeout:N})}}},Nc=async(c)=>S({...c,path:Ic,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),xc=async(c)=>(await S({...c,path:p})).toString(),Oc=async(c,I,x)=>{let T=JSON.parse((await S({...I,path:p+c})).toString());if(!Q(T))throw new G.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:x.logger});return X(T)};export{wc as _d,hc as $d,Z as ae,S as be,v as ce,W as de,t as ee,Kc as fe,z as ge,H as he,pc as ie};
|