claude-code-best 1.3.7 → 1.4.1
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/README.md +1 -0
- package/dist/{chunk-cdgv0k77.js → chunk-00vfg42v.js} +61 -59
- package/dist/{chunk-6ex0f5ej.js → chunk-01ysfcs0.js} +6 -8
- package/dist/{chunk-1vzb650a.js → chunk-04ws37gv.js} +6 -8
- package/dist/{chunk-7etmzq13.js → chunk-0b0fq180.js} +27 -27
- package/dist/{chunk-drsh1vv8.js → chunk-0cs46nj6.js} +63 -62
- package/dist/chunk-0fzcyd0s.js +116 -0
- package/dist/{chunk-7nebst32.js → chunk-0knhp7v5.js} +2 -2
- package/dist/{chunk-n42nvr59.js → chunk-0xth516w.js} +14 -14
- package/dist/{chunk-egcx83tp.js → chunk-0y6h57c5.js} +6 -6
- package/dist/{chunk-d267stxj.js → chunk-0z0m6mm5.js} +1 -1
- package/dist/{chunk-y10byvag.js → chunk-196qs1ty.js} +30 -29
- package/dist/chunk-1d39h7zf.js +57 -0
- package/dist/{chunk-antr836n.js → chunk-1k3ahc24.js} +59 -57
- package/dist/{chunk-5scrgrwv.js → chunk-1nhx3qpn.js} +2 -2
- package/dist/{chunk-zv5yt0g4.js → chunk-1qbype3e.js} +9 -9
- package/dist/{chunk-bkzs71af.js → chunk-1r70yykn.js} +3 -3
- package/dist/{chunk-tvnrwrg3.js → chunk-1x1wb96n.js} +62 -60
- package/dist/{chunk-j44ngncb.js → chunk-1yscv3t1.js} +7 -9
- package/dist/{chunk-zhe3rws3.js → chunk-27ppq985.js} +7 -9
- package/dist/{chunk-kbshq7zc.js → chunk-28a1ffp7.js} +59 -56
- package/dist/{chunk-m95fj0wm.js → chunk-2ag1bjqx.js} +4 -4
- package/dist/{chunk-2fx2x8qp.js → chunk-2cz1rwf3.js} +22 -21
- package/dist/{chunk-v1chtgnf.js → chunk-2m6jk78c.js} +1 -1
- package/dist/{chunk-nzchm0f2.js → chunk-2mhgyhns.js} +1 -1
- package/dist/{chunk-n5pe3jtt.js → chunk-2pjptqfa.js} +2 -2
- package/dist/{chunk-5r3wgr44.js → chunk-2qfb22ax.js} +29 -1399
- package/dist/{chunk-n0rn505k.js → chunk-2rcaw0yh.js} +4 -4
- package/dist/{chunk-wp9nwczx.js → chunk-2rtngpm1.js} +8 -10
- package/dist/{chunk-s2cwz71x.js → chunk-2tzmvvew.js} +60 -57
- package/dist/{chunk-ydraa9ey.js → chunk-2xrp0wp0.js} +70 -68
- package/dist/{chunk-jty4xkhc.js → chunk-313nbvgt.js} +5 -5
- package/dist/chunk-3e2a6c4k.js +33 -0
- package/dist/{chunk-hbf3y5tw.js → chunk-3fnhdnj6.js} +22 -21
- package/dist/{chunk-qahkzpj6.js → chunk-3g6kvmg4.js} +6 -8
- package/dist/{chunk-kz13d2bs.js → chunk-3mapywg0.js} +2 -2
- package/dist/{chunk-tw4tjc73.js → chunk-3rk983b5.js} +1 -1
- package/dist/chunk-3vc6mx77.js +119 -0
- package/dist/{chunk-nsxw7en4.js → chunk-3yzyedet.js} +23 -22
- package/dist/{chunk-1q82ecz5.js → chunk-40w1c21c.js} +58 -55
- package/dist/{chunk-bnvd1jc1.js → chunk-4brmjvph.js} +4 -4
- package/dist/{chunk-zwrt0s3s.js → chunk-4er46edn.js} +69 -141
- package/dist/{chunk-fsex4yt2.js → chunk-4h9ek408.js} +7 -9
- package/dist/chunk-4mdqm8b7.js +115 -0
- package/dist/{chunk-9p95042q.js → chunk-4qjh89qr.js} +1 -1
- package/dist/chunk-506gq3zq.js +104 -0
- package/dist/{chunk-w6rh4zpx.js → chunk-5158j5ph.js} +8 -10
- package/dist/{chunk-d969b8ne.js → chunk-524xgs6r.js} +7 -7
- package/dist/{chunk-76hrbqgr.js → chunk-52rnpp5t.js} +16 -18
- package/dist/{chunk-0a2qnsbr.js → chunk-54bwa086.js} +61 -57
- package/dist/{chunk-qn4cbm38.js → chunk-5famfv4a.js} +23 -22
- package/dist/{chunk-kmgp6prw.js → chunk-5khwvj1z.js} +112 -5
- package/dist/{chunk-9byk2a4b.js → chunk-5m7095hq.js} +25 -25
- package/dist/{chunk-g14ex9z0.js → chunk-5mv51kkx.js} +59 -56
- package/dist/{chunk-p2sww3pd.js → chunk-5vqwq0f9.js} +59 -56
- package/dist/{chunk-s26mv9yh.js → chunk-5zbp0a48.js} +7 -8
- package/dist/{chunk-pvtzf6vs.js → chunk-60xm3v9r.js} +3 -3
- package/dist/chunk-6356tyx5.js +32 -0
- package/dist/{chunk-1vzaw5f6.js → chunk-66s9m31j.js} +23 -22
- package/dist/{chunk-c1cm8km0.js → chunk-6ebb5ym0.js} +58 -55
- package/dist/{chunk-yp2yx0qj.js → chunk-6f0296p8.js} +5 -7
- package/dist/{chunk-m2cskgz4.js → chunk-6gftrxn5.js} +86 -81
- package/dist/{chunk-y95se10r.js → chunk-6h1reb8m.js} +22 -21
- package/dist/{chunk-fy6tp8zj.js → chunk-6pb9n4m3.js} +2 -2
- package/dist/{chunk-ardzdtan.js → chunk-6y2wszkc.js} +1 -1
- package/dist/{chunk-4ydmya8m.js → chunk-6y8e5c85.js} +24 -22
- package/dist/{chunk-rshk7m9c.js → chunk-718k4vsj.js} +62 -60
- package/dist/{chunk-tm4w23dp.js → chunk-72091jsk.js} +1 -1
- package/dist/{chunk-xtaw765g.js → chunk-760hjt0a.js} +3 -3
- package/dist/chunk-77dnrj5q.js +119 -0
- package/dist/{chunk-gz4r3k7a.js → chunk-77w9ffyy.js} +5 -5
- package/dist/{chunk-xaw4scep.js → chunk-78009jh9.js} +2 -2
- package/dist/{chunk-6xr5mayh.js → chunk-79vh2q13.js} +58 -55
- package/dist/{chunk-p7d5ms03.js → chunk-7ba2qns8.js} +22 -21
- package/dist/{chunk-6wrs3ahh.js → chunk-7dy65axk.js} +22 -21
- package/dist/{chunk-n35gnb9g.js → chunk-7hmy36fh.js} +121 -2
- package/dist/{chunk-erxndz83.js → chunk-7kfps7yt.js} +7 -9
- package/dist/chunk-7r3d9nyj.js +113 -0
- package/dist/{chunk-dne2ghq6.js → chunk-7yfxza07.js} +16 -22
- package/dist/chunk-7zw138yt.js +32 -0
- package/dist/{chunk-6ye6d9gw.js → chunk-81dxa3fd.js} +1 -1
- package/dist/{chunk-540608wh.js → chunk-86jhenxk.js} +66 -57
- package/dist/chunk-88mfsn97.js +115 -0
- package/dist/{chunk-zy4fsy90.js → chunk-8gs07wbw.js} +18 -18
- package/dist/{chunk-4ayhftnk.js → chunk-8h4gpg9r.js} +83 -119
- package/dist/{chunk-brnc96x6.js → chunk-8h7bg6q9.js} +203 -24
- package/dist/chunk-8mspr5sg.js +47 -0
- package/dist/{chunk-62dx37pf.js → chunk-8pskaz4y.js} +9 -11
- package/dist/{chunk-sn3wbs2w.js → chunk-8xbwczap.js} +58 -55
- package/dist/{chunk-tw2wjsnb.js → chunk-8xsjtkh4.js} +4 -4
- package/dist/{chunk-ky85ntn8.js → chunk-8y0ghcs4.js} +69 -66
- package/dist/chunk-8zzqydag.js +101 -0
- package/dist/{chunk-cpvn0j86.js → chunk-924n94wb.js} +22 -21
- package/dist/{chunk-0asd58w2.js → chunk-92p2k7yk.js} +11 -11
- package/dist/{chunk-qvywetwr.js → chunk-93cd0z7w.js} +66 -64
- package/dist/{chunk-db82mfh9.js → chunk-97svwq59.js} +73 -71
- package/dist/{chunk-3j857x3k.js → chunk-99cjjht1.js} +60 -58
- package/dist/{chunk-pedmqmrf.js → chunk-9awawyvh.js} +6 -6
- package/dist/{chunk-22rs73mh.js → chunk-9b6wqcyk.js} +60 -57
- package/dist/{chunk-cxf74p1t.js → chunk-9datyj43.js} +2 -2
- package/dist/{chunk-n1pa72ns.js → chunk-9qh5f9r3.js} +7 -12
- package/dist/{chunk-vb6w46m9.js → chunk-9revwk5g.js} +59 -56
- package/dist/{chunk-g71q1n7x.js → chunk-a0m994d6.js} +58 -55
- package/dist/{chunk-ftajx4gw.js → chunk-a0qhdfct.js} +49 -160
- package/dist/{chunk-0xq2bfvv.js → chunk-a5w8nyhg.js} +2 -2
- package/dist/{chunk-ms9225af.js → chunk-a85wqwq4.js} +58 -55
- package/dist/{chunk-3c81vb6k.js → chunk-a92eevfn.js} +6 -8
- package/dist/{chunk-2katyzq9.js → chunk-ab6gc90x.js} +3 -5
- package/dist/{chunk-j50zvssc.js → chunk-ad6rg8vz.js} +5 -5
- package/dist/{chunk-z7svjppe.js → chunk-admwpsa6.js} +10 -14
- package/dist/{chunk-v081mpyx.js → chunk-ahexmj4s.js} +24 -26
- package/dist/{chunk-7z0078sp.js → chunk-att0rknb.js} +2 -2
- package/dist/{chunk-prgsmrmy.js → chunk-axenqvc8.js} +2 -2
- package/dist/{chunk-mfzgqp0c.js → chunk-azq1qstz.js} +10 -14
- package/dist/{chunk-zajs1j2b.js → chunk-b125aa22.js} +59 -57
- package/dist/{chunk-9f01qpne.js → chunk-b4wfv4fx.js} +73 -71
- package/dist/{chunk-ns3babbs.js → chunk-b5wxetbv.js} +224 -1
- package/dist/chunk-b62vj92a.js +94 -0
- package/dist/{chunk-9v5bwvbm.js → chunk-b6drr9se.js} +63 -61
- package/dist/chunk-b7kfr260.js +168 -0
- package/dist/chunk-b9pqgq8z.js +37 -0
- package/dist/{chunk-c8rgc3hw.js → chunk-bevwqet9.js} +66 -64
- package/dist/{chunk-m2rx2dtd.js → chunk-bgf5zvvv.js} +91 -89
- package/dist/{chunk-fye86v7m.js → chunk-bq8zdg7m.js} +58 -55
- package/dist/chunk-bww2h6d4.js +114 -0
- package/dist/{chunk-m83vaktc.js → chunk-bx165r58.js} +1 -1
- package/dist/{chunk-4q5a5mjb.js → chunk-c092k38b.js} +3532 -1684
- package/dist/{chunk-163379k5.js → chunk-c0avjkfn.js} +58 -55
- package/dist/{chunk-ermvk1xn.js → chunk-c3s22pgw.js} +61 -58
- package/dist/{chunk-zahg0adp.js → chunk-c4g5qaey.js} +5 -5
- package/dist/{chunk-f6wypwa6.js → chunk-c6nthjxa.js} +6 -4
- package/dist/{chunk-wmd0v561.js → chunk-c7d1acex.js} +5 -7
- package/dist/{chunk-wmbpegg3.js → chunk-c7t69jmn.js} +1 -1
- package/dist/{chunk-vm0b9vaz.js → chunk-cg3bb5pe.js} +9 -9
- package/dist/{chunk-m8v1x99r.js → chunk-chzfw06n.js} +3 -5
- package/dist/chunk-cm2xfg7q.js +1394 -0
- package/dist/{chunk-4yxd0e7k.js → chunk-crj9bjh5.js} +58 -55
- package/dist/{chunk-v4nrk2f9.js → chunk-cstkqpd5.js} +7 -8
- package/dist/{chunk-3nwsgn73.js → chunk-ctj2ehwz.js} +59 -56
- package/dist/{chunk-mcbqmbp2.js → chunk-cwwfyvbq.js} +6 -4
- package/dist/{chunk-9nddm5c7.js → chunk-cxf9amp4.js} +2 -3
- package/dist/chunk-cxmyg49v.js +104 -0
- package/dist/{chunk-5wb5ym2h.js → chunk-cy1z66c2.js} +3 -5
- package/dist/{chunk-nbzntnkz.js → chunk-d2q17m4k.js} +60 -58
- package/dist/{chunk-ymtkahxp.js → chunk-d2wzkwws.js} +69 -66
- package/dist/{chunk-x4t0n8t3.js → chunk-d4qdesrx.js} +3 -4
- package/dist/chunk-d4zyytan.js +3802 -0
- package/dist/{chunk-8q4yg5pk.js → chunk-d57t992t.js} +9 -96
- package/dist/{chunk-g2tmm7k7.js → chunk-dafnbqhh.js} +76 -74
- package/dist/{chunk-tjbjxrqz.js → chunk-dfcm57ek.js} +6 -6
- package/dist/{chunk-ynjbppdn.js → chunk-dgnwk906.js} +60 -58
- package/dist/{chunk-7gxyarah.js → chunk-dhwpmz98.js} +61 -58
- package/dist/{chunk-yevbmk5g.js → chunk-djzvjzdg.js} +3 -3
- package/dist/chunk-dm5e2sj0.js +187 -0
- package/dist/{chunk-145d3809.js → chunk-dnpy3zcs.js} +63 -60
- package/dist/{chunk-h7ffkxg4.js → chunk-drvfxfe5.js} +26 -25
- package/dist/{chunk-c14sp904.js → chunk-dv4dsh0t.js} +7 -7
- package/dist/{chunk-9ejadhq8.js → chunk-dyp88vca.js} +64 -62
- package/dist/{chunk-xfft38wf.js → chunk-dytg8n15.js} +12 -12
- package/dist/{chunk-j3ctqpsn.js → chunk-e1bt4m2g.js} +2 -2
- package/dist/{chunk-vvm5az9j.js → chunk-e23snepr.js} +3 -3
- package/dist/{chunk-hgfw7nx2.js → chunk-e6sqr0av.js} +58 -55
- package/dist/{chunk-v7xwthvg.js → chunk-e9eyqwk5.js} +405 -283
- package/dist/{chunk-2wvxqpfc.js → chunk-efkjha6m.js} +8 -9
- package/dist/{chunk-3s2gjp2n.js → chunk-ekpm458a.js} +67 -65
- package/dist/{chunk-vf3etxnx.js → chunk-emxnq07z.js} +1 -1
- package/dist/{chunk-c4x4fb6d.js → chunk-erkssp71.js} +58 -55
- package/dist/chunk-es08rrda.js +112 -0
- package/dist/{chunk-c209ascy.js → chunk-ewxpkqxt.js} +9 -9
- package/dist/{chunk-1wykga1n.js → chunk-f25pnrvx.js} +4 -6
- package/dist/chunk-f2y3t9hh.js +295 -0
- package/dist/{chunk-427mfnyx.js → chunk-f31b63fd.js} +1 -1
- package/dist/{chunk-2dsqf7sp.js → chunk-f57cvf1d.js} +1 -1
- package/dist/{chunk-ry1jb15g.js → chunk-f872fekv.js} +58 -55
- package/dist/{chunk-r7s0jwb1.js → chunk-faey4sqw.js} +59 -56
- package/dist/{chunk-40ax4h54.js → chunk-fbbjchdz.js} +60 -58
- package/dist/{chunk-fskf0b3x.js → chunk-fbedkst6.js} +6 -8
- package/dist/{chunk-9msn8xwq.js → chunk-fckykghd.js} +2 -3
- package/dist/{chunk-ztrgnar4.js → chunk-fdbvcs34.js} +7 -9
- package/dist/{chunk-667f3w39.js → chunk-ffpz33kr.js} +23 -22
- package/dist/{chunk-0fpkjw2j.js → chunk-ffvja87d.js} +8 -10
- package/dist/{chunk-r6gyed9y.js → chunk-fjpdtr6s.js} +9 -9
- package/dist/{chunk-8y1zs48n.js → chunk-fnpd8cnq.js} +1 -1
- package/dist/{chunk-eef1npre.js → chunk-fxpsa506.js} +4 -6
- package/dist/{chunk-2z6bv21c.js → chunk-fxrrsvnw.js} +23 -27
- package/dist/chunk-fz4wmnm6.js +157 -0
- package/dist/{chunk-2c4jgf3n.js → chunk-g3dbfhxa.js} +5 -7
- package/dist/{chunk-s13m8efn.js → chunk-g86dg6h5.js} +5 -5
- package/dist/{chunk-h7mpryyc.js → chunk-gc4x22mt.js} +59 -56
- package/dist/{chunk-5s1bctjb.js → chunk-gfxebcsw.js} +28 -28
- package/dist/chunk-ghbtnfr2.js +117 -0
- package/dist/{chunk-gpk30ekc.js → chunk-gqftywrx.js} +23 -22
- package/dist/{chunk-z2aps7d9.js → chunk-gwrngewt.js} +3 -3
- package/dist/{chunk-psp1n9vg.js → chunk-gxfbedta.js} +1 -1
- package/dist/{chunk-fq1j9zm0.js → chunk-gybj15eh.js} +2 -3
- package/dist/chunk-h0vzd5vg.js +1012 -0
- package/dist/{chunk-0ahxmrws.js → chunk-h14dkna4.js} +23 -22
- package/dist/{chunk-x42kc5wj.js → chunk-h26xfh6d.js} +22 -21
- package/dist/{chunk-nwgkkhk7.js → chunk-h2vfn30x.js} +4 -4
- package/dist/{chunk-mh8752jz.js → chunk-h37gar4j.js} +1 -1
- package/dist/{chunk-n612gr22.js → chunk-h4k9kgjw.js} +59 -56
- package/dist/{chunk-1av0kkwh.js → chunk-hc1tkwfn.js} +3 -5
- package/dist/{chunk-h5dk6k0g.js → chunk-hf086e2e.js} +58 -55
- package/dist/{chunk-66j7fn6z.js → chunk-hhwqk5as.js} +58 -55
- package/dist/{chunk-e8zmtbry.js → chunk-hjw03d0k.js} +60 -58
- package/dist/{chunk-e1t8jh0t.js → chunk-hkh1vbm6.js} +58 -55
- package/dist/{chunk-81dq52pk.js → chunk-hnxmafvc.js} +2 -2
- package/dist/{chunk-cj8m3h8r.js → chunk-hqpzpr71.js} +2 -2
- package/dist/{chunk-s3aygngf.js → chunk-hrz2d28r.js} +62 -60
- package/dist/chunk-hxb3js2g.js +91 -0
- package/dist/{chunk-j06y02aw.js → chunk-hxc8e6wd.js} +1 -1
- package/dist/chunk-hyy2fcba.js +351 -0
- package/dist/{chunk-dvf5921w.js → chunk-hyz9tx05.js} +15 -17
- package/dist/{chunk-ag3hbrat.js → chunk-j34h8cfj.js} +23 -22
- package/dist/{chunk-b31v41mz.js → chunk-j5w0b4d2.js} +23 -22
- package/dist/{chunk-2tcznfv0.js → chunk-j66ragf9.js} +1 -1
- package/dist/chunk-j7b884wk.js +397 -0
- package/dist/{chunk-35xyzbd2.js → chunk-ja21qbpj.js} +65 -62
- package/dist/{chunk-dchgtage.js → chunk-ja3eb4h9.js} +3 -3
- package/dist/{chunk-2crz81z3.js → chunk-jac470kz.js} +1 -1
- package/dist/{chunk-9nydmbm4.js → chunk-jaqtnpbt.js} +2 -2
- package/dist/{chunk-e03zrq9n.js → chunk-jc5dtv57.js} +60 -58
- package/dist/{chunk-jg7na104.js → chunk-jda4vjad.js} +58 -55
- package/dist/{chunk-drnxbc1w.js → chunk-jeqt4y47.js} +2 -2
- package/dist/{chunk-r7r3jm3y.js → chunk-jga4j8jp.js} +59 -57
- package/dist/{chunk-58rg6rn2.js → chunk-jge10dbd.js} +4 -6
- package/dist/{chunk-9k2c5sxb.js → chunk-jhbj5mnf.js} +58 -55
- package/dist/{chunk-zh6xf1fd.js → chunk-jje04m6z.js} +2 -2
- package/dist/{chunk-qkrenskm.js → chunk-jnfd01as.js} +9 -11
- package/dist/chunk-jpbkdg47.js +131 -0
- package/dist/{chunk-xcq3rdb0.js → chunk-jwb3bqa7.js} +27 -31
- package/dist/{chunk-s1p2w5a5.js → chunk-jy4dnnjk.js} +5 -5
- package/dist/{chunk-c9p5eyxf.js → chunk-k27dq4vd.js} +60 -57
- package/dist/{chunk-kmcaa88h.js → chunk-k81zec2p.js} +1 -1
- package/dist/{chunk-fxqp3yt4.js → chunk-kb2b4rkg.js} +4 -5
- package/dist/{chunk-h6dqpbac.js → chunk-kbsckx2r.js} +3 -3
- package/dist/{chunk-451hjtv9.js → chunk-kvezjrjy.js} +58 -55
- package/dist/{chunk-zc1s4swn.js → chunk-kw2ymvyv.js} +6 -8
- package/dist/{chunk-9jg130e9.js → chunk-kymh4vxw.js} +58 -55
- package/dist/{chunk-z66q1nam.js → chunk-kz3q1ce0.js} +58 -55
- package/dist/chunk-m089kb0s.js +312 -0
- package/dist/{chunk-86tz7yxt.js → chunk-m1efbjqe.js} +58 -55
- package/dist/chunk-m1xw79dd.js +1757 -0
- package/dist/{chunk-k303kw9v.js → chunk-m365zhp8.js} +59 -56
- package/dist/{chunk-0h4sw1v3.js → chunk-m97dyxn0.js} +61 -60
- package/dist/{chunk-e4jqbn4d.js → chunk-m9w972ny.js} +2 -4
- package/dist/{chunk-eserktyd.js → chunk-mb93ek5j.js} +4 -6
- package/dist/{chunk-c96k89rp.js → chunk-mgjc0yj9.js} +59 -57
- package/dist/{chunk-qmckdcc4.js → chunk-mh2pdxpc.js} +60 -58
- package/dist/{chunk-hnx0eg6x.js → chunk-mkae8zj9.js} +3 -3
- package/dist/{chunk-h0s737p0.js → chunk-mmq55gyp.js} +4 -4
- package/dist/{chunk-5k4kh5n9.js → chunk-ndrn50x0.js} +59 -57
- package/dist/{chunk-0pxmxyxv.js → chunk-ng2xq7ey.js} +3 -3
- package/dist/{chunk-gdb6dvba.js → chunk-nsbpzpmf.js} +61 -59
- package/dist/{chunk-18mm4jf8.js → chunk-nz7sgbbr.js} +5 -5
- package/dist/{chunk-t0b0bas5.js → chunk-nzfwsrd7.js} +3 -3
- package/dist/{chunk-rhxtttx1.js → chunk-p3zbzfbn.js} +3 -3
- package/dist/{chunk-9tc901nb.js → chunk-p5jssxha.js} +24 -24
- package/dist/{chunk-zmpygkz6.js → chunk-p7es39d1.js} +47 -122
- package/dist/{chunk-qwj4n799.js → chunk-p7pj6wf8.js} +1 -1
- package/dist/{chunk-855katq2.js → chunk-p9f12fp9.js} +60 -57
- package/dist/chunk-pb73zgyd.js +55 -0
- package/dist/chunk-prpjmapz.js +117 -0
- package/dist/{chunk-379rspd7.js → chunk-ps01q3n9.js} +64 -63
- package/dist/{chunk-ay9wm3tf.js → chunk-q19p9j0v.js} +5 -5
- package/dist/{chunk-536fmbtq.js → chunk-q7e12ymw.js} +4 -4
- package/dist/{chunk-w65283w4.js → chunk-qgajfxr7.js} +7 -7
- package/dist/{chunk-24qcj0k5.js → chunk-qgnsf30p.js} +24 -23
- package/dist/{chunk-xvjdbsfa.js → chunk-qs2atqgy.js} +60 -58
- package/dist/chunk-r469z4mx.js +183 -0
- package/dist/chunk-r5mqktt5.js +100 -0
- package/dist/chunk-r854e43q.js +25 -0
- package/dist/{chunk-fx6ghdvg.js → chunk-rbgr86hh.js} +59 -57
- package/dist/{chunk-qxv21mcq.js → chunk-rbvawtdz.js} +59 -56
- package/dist/chunk-rce8gj2b.js +93 -0
- package/dist/{chunk-t0twk3e5.js → chunk-rd2884ff.js} +1 -1
- package/dist/{chunk-c2ktjyc0.js → chunk-reqz49y3.js} +336 -1149
- package/dist/{chunk-b4twmt0s.js → chunk-rhjb0dgd.js} +24 -23
- package/dist/{chunk-bpmw0wp2.js → chunk-rq1nfp7x.js} +60 -58
- package/dist/{chunk-qhbchv06.js → chunk-rsr0mksm.js} +61 -59
- package/dist/{chunk-txeekahj.js → chunk-rz3rq0gt.js} +4 -6
- package/dist/{chunk-14mkqwft.js → chunk-rz69sqyh.js} +70 -68
- package/dist/{chunk-gfk81w5r.js → chunk-s2n5kxm0.js} +5 -5
- package/dist/{chunk-3b9ar57s.js → chunk-s39ksgef.js} +4 -6
- package/dist/{chunk-3er4wswe.js → chunk-s70z817q.js} +197 -196
- package/dist/{chunk-5h17d17z.js → chunk-se153zng.js} +1 -1
- package/dist/chunk-spqq5qf1.js +116 -0
- package/dist/{chunk-xjd32sva.js → chunk-srnstx2s.js} +23 -22
- package/dist/{chunk-s9nr589x.js → chunk-sv7afh51.js} +6 -8
- package/dist/{chunk-b6whrv9m.js → chunk-swzfr1f5.js} +24 -23
- package/dist/{chunk-2h06sph0.js → chunk-t2822cex.js} +63 -60
- package/dist/{chunk-h93tjx98.js → chunk-t2re5hhc.js} +125 -119
- package/dist/{chunk-r325sbz7.js → chunk-t7e9etws.js} +23 -25
- package/dist/{chunk-59mg8c5k.js → chunk-tnx1zk9t.js} +62 -59
- package/dist/{chunk-rgpxnjx4.js → chunk-tw24rz1x.js} +11 -13
- package/dist/{chunk-r8m19xnp.js → chunk-v038k0we.js} +4 -6
- package/dist/chunk-v2qqkqxp.js +116 -0
- package/dist/{chunk-fjne3x6c.js → chunk-v4qke3cz.js} +8 -8
- package/dist/{chunk-qwa5erw8.js → chunk-v6p3019x.js} +24 -23
- package/dist/{chunk-4stgesb0.js → chunk-vatz6gan.js} +25 -27
- package/dist/chunk-vfmx405p.js +14 -0
- package/dist/{chunk-x639j7py.js → chunk-vnn4x6jw.js} +62 -59
- package/dist/{chunk-b4btw5kv.js → chunk-vpe2s4eq.js} +7 -9
- package/dist/{chunk-2t5ve6ev.js → chunk-vsbyhpfy.js} +1 -1
- package/dist/{chunk-52evx0rm.js → chunk-w0pf4mvz.js} +12 -16
- package/dist/chunk-w5j0dhpp.js +14 -0
- package/dist/{chunk-vqawqpkx.js → chunk-w7zp9j8v.js} +72 -70
- package/dist/{chunk-d2vb6m9e.js → chunk-wd8mqz95.js} +3 -5
- package/dist/chunk-wj0c0zfa.js +36 -0
- package/dist/{chunk-ps5rsyxe.js → chunk-wqdr8v9x.js} +58 -55
- package/dist/{chunk-vpp13z80.js → chunk-wxa2hdfg.js} +2 -2
- package/dist/{chunk-kh04yrpx.js → chunk-wy3f5b81.js} +59 -56
- package/dist/{chunk-5dn1m1r7.js → chunk-x0ym1db4.js} +2 -4
- package/dist/{chunk-d73t8nhj.js → chunk-x1t80e36.js} +39 -39
- package/dist/{chunk-08a6n2pp.js → chunk-x63c39tp.js} +5 -7
- package/dist/{chunk-q890kpff.js → chunk-x6622cb2.js} +23 -22
- package/dist/{chunk-wcxc5m91.js → chunk-x95fhbwq.js} +1 -1
- package/dist/{chunk-px27vhxx.js → chunk-x9gbnheg.js} +8 -10
- package/dist/{chunk-9gypgvd7.js → chunk-xahpt5e2.js} +3 -5
- package/dist/{chunk-y3rg86fk.js → chunk-xct1m4sf.js} +23 -22
- package/dist/chunk-xee276gg.js +367 -0
- package/dist/{chunk-n8whv674.js → chunk-xfkf8q6w.js} +5 -6
- package/dist/chunk-xhesahm0.js +15 -0
- package/dist/{chunk-tbma29g4.js → chunk-xk1wdwxq.js} +60 -57
- package/dist/{chunk-gwah3f17.js → chunk-xpj4qca4.js} +58 -55
- package/dist/{chunk-h6wkvzrd.js → chunk-xqk8srdh.js} +6 -8
- package/dist/{chunk-39zy97qa.js → chunk-xsc3ccj0.js} +3 -3
- package/dist/{chunk-y82s03p7.js → chunk-xwc8e4yv.js} +2 -2
- package/dist/{chunk-8wv29424.js → chunk-xxmxv448.js} +8 -9
- package/dist/{chunk-symd8dvh.js → chunk-xz7cf7fa.js} +69 -66
- package/dist/{chunk-h7bkf3h2.js → chunk-y3qdyf8r.js} +28 -27
- package/dist/{chunk-j5eb93j4.js → chunk-y48wfwm4.js} +1 -517
- package/dist/{chunk-6qexrv9a.js → chunk-y7vzcjyn.js} +60 -58
- package/dist/chunk-yb03gvd8.js +271 -0
- package/dist/chunk-yem3ge7z.js +182 -0
- package/dist/{chunk-vmpcmvqq.js → chunk-yf5qwpnp.js} +3 -3
- package/dist/{chunk-awwfrm4f.js → chunk-yrnbgtk0.js} +26 -25
- package/dist/{chunk-64mwy58c.js → chunk-yrs92qya.js} +5 -7
- package/dist/{chunk-y29pdynp.js → chunk-ys6cza46.js} +7 -9
- package/dist/{chunk-kcp8svja.js → chunk-yvgmpc5z.js} +5 -5
- package/dist/{chunk-3avnvgnv.js → chunk-yxr0yf6h.js} +4 -4
- package/dist/{chunk-ar8awa36.js → chunk-yyc1yvnr.js} +59 -57
- package/dist/{chunk-kmzv85ze.js → chunk-z0vk43bt.js} +69 -66
- package/dist/chunk-z1seyvya.js +110 -0
- package/dist/{chunk-2pdcq92c.js → chunk-z6hqga26.js} +3 -4
- package/dist/{chunk-5ccpwbk7.js → chunk-z7hv619f.js} +58 -55
- package/dist/{chunk-1ez8vf1y.js → chunk-zb0mctxm.js} +6 -6
- package/dist/{chunk-49n22kr8.js → chunk-zhyc7npp.js} +58 -55
- package/dist/{chunk-9r28w6ye.js → chunk-zttmdag3.js} +1 -1
- package/dist/{chunk-p1af059d.js → chunk-zvegtrc4.js} +63 -60
- package/dist/{chunk-n2gc23dm.js → chunk-zwsrj2yy.js} +9 -11
- package/dist/cli.js +58 -22
- package/package.json +12 -4
- package/dist/chunk-0731m51q.js +0 -8
- package/dist/chunk-2fwze72g.js +0 -24
- package/dist/chunk-3ev51j3h.js +0 -117
- package/dist/chunk-5cc50ecq.js +0 -116
- package/dist/chunk-74v2mh4t.js +0 -40
- package/dist/chunk-9b0btjar.js +0 -114
- package/dist/chunk-bhvmpf9m.js +0 -113
- package/dist/chunk-bzps3qec.js +0 -113
- package/dist/chunk-e6nenv5n.js +0 -112
- package/dist/chunk-ez958w7j.js +0 -110
- package/dist/chunk-fve53rbk.js +0 -22
- package/dist/chunk-g5rf37hh.js +0 -116
- package/dist/chunk-ga2vcmhy.js +0 -111
- package/dist/chunk-k5c76pvm.js +0 -114
- package/dist/chunk-npf5eh3g.js +0 -8
- package/dist/chunk-ppwjyveh.js +0 -8
- package/dist/chunk-t38536jf.js +0 -254
- package/dist/chunk-tf8gr3bs.js +0 -112
- package/dist/chunk-vam5at9t.js +0 -175
- package/dist/chunk-vxnvzfnv.js +0 -233
- package/dist/chunk-wef34bk5.js +0 -107
- package/dist/chunk-wkjjv1jr.js +0 -1026
- package/dist/chunk-wkx2xsed.js +0 -113
- package/dist/chunk-x6r4v44b.js +0 -8
- package/dist/chunk-xwhmcc3g.js +0 -109
package/dist/chunk-wkjjv1jr.js
DELETED
|
@@ -1,1026 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
init_SSETransport,
|
|
4
|
-
parseSSEFrames
|
|
5
|
-
} from "./chunk-6ex0f5ej.js";
|
|
6
|
-
import {
|
|
7
|
-
createAssistantAPIErrorMessage,
|
|
8
|
-
init_api,
|
|
9
|
-
init_messages1 as init_messages,
|
|
10
|
-
normalizeContentFromAPI,
|
|
11
|
-
normalizeMessagesForAPI,
|
|
12
|
-
toolToAPISchema
|
|
13
|
-
} from "./chunk-4q5a5mjb.js";
|
|
14
|
-
import"./chunk-t38536jf.js";
|
|
15
|
-
import"./chunk-08a6n2pp.js";
|
|
16
|
-
import"./chunk-et824jj8.js";
|
|
17
|
-
import"./chunk-h6dqpbac.js";
|
|
18
|
-
import"./chunk-qe3qr56q.js";
|
|
19
|
-
import"./chunk-var1et7e.js";
|
|
20
|
-
import"./chunk-kmcaa88h.js";
|
|
21
|
-
import"./chunk-ehtwnxpg.js";
|
|
22
|
-
import"./chunk-0xq2bfvv.js";
|
|
23
|
-
import"./chunk-gfk81w5r.js";
|
|
24
|
-
import"./chunk-2f6hs25r.js";
|
|
25
|
-
import"./chunk-62dx37pf.js";
|
|
26
|
-
import"./chunk-2gzv8nrw.js";
|
|
27
|
-
import"./chunk-cxf74p1t.js";
|
|
28
|
-
import"./chunk-cgfdkzhb.js";
|
|
29
|
-
import"./chunk-s9nr589x.js";
|
|
30
|
-
import"./chunk-w65283w4.js";
|
|
31
|
-
import"./chunk-9r28w6ye.js";
|
|
32
|
-
import"./chunk-ftajx4gw.js";
|
|
33
|
-
import"./chunk-2crz81z3.js";
|
|
34
|
-
import"./chunk-m8v1x99r.js";
|
|
35
|
-
import"./chunk-t0twk3e5.js";
|
|
36
|
-
import"./chunk-ps49ymvj.js";
|
|
37
|
-
import"./chunk-t4kcvmes.js";
|
|
38
|
-
import"./chunk-mh8752jz.js";
|
|
39
|
-
import"./chunk-5wb5ym2h.js";
|
|
40
|
-
import"./chunk-8y1zs48n.js";
|
|
41
|
-
import"./chunk-vpp13z80.js";
|
|
42
|
-
import"./chunk-4jm600zv.js";
|
|
43
|
-
import"./chunk-2dsqf7sp.js";
|
|
44
|
-
import"./chunk-ztrgnar4.js";
|
|
45
|
-
import"./chunk-rkmwx1yz.js";
|
|
46
|
-
import"./chunk-9gypgvd7.js";
|
|
47
|
-
import"./chunk-ykr5qx9v.js";
|
|
48
|
-
import"./chunk-s13m8efn.js";
|
|
49
|
-
import"./chunk-nzchm0f2.js";
|
|
50
|
-
import"./chunk-5scrgrwv.js";
|
|
51
|
-
import"./chunk-erxndz83.js";
|
|
52
|
-
import"./chunk-j50zvssc.js";
|
|
53
|
-
import"./chunk-wcxc5m91.js";
|
|
54
|
-
import"./chunk-zmpygkz6.js";
|
|
55
|
-
import {
|
|
56
|
-
init_json,
|
|
57
|
-
safeParseJSON
|
|
58
|
-
} from "./chunk-hnx0eg6x.js";
|
|
59
|
-
import"./chunk-8q4yg5pk.js";
|
|
60
|
-
import {
|
|
61
|
-
getProxyFetchOptions,
|
|
62
|
-
init_proxy
|
|
63
|
-
} from "./chunk-j06y02aw.js";
|
|
64
|
-
import"./chunk-zwarn9h7.js";
|
|
65
|
-
import"./chunk-n35gnb9g.js";
|
|
66
|
-
import"./chunk-64c1avct.js";
|
|
67
|
-
import"./chunk-6kpbgc5w.js";
|
|
68
|
-
import"./chunk-8g5pe1gr.js";
|
|
69
|
-
import"./chunk-7nebst32.js";
|
|
70
|
-
import"./chunk-4cp6193g.js";
|
|
71
|
-
import"./chunk-8g747a8x.js";
|
|
72
|
-
import"./chunk-d7886r6a.js";
|
|
73
|
-
import"./chunk-90wp6wez.js";
|
|
74
|
-
import"./chunk-a8ejc632.js";
|
|
75
|
-
import"./chunk-f5ma3nh5.js";
|
|
76
|
-
import"./chunk-qz2x630m.js";
|
|
77
|
-
import"./chunk-wmbpegg3.js";
|
|
78
|
-
import"./chunk-ardzdtan.js";
|
|
79
|
-
import"./chunk-3c25bcsw.js";
|
|
80
|
-
import"./chunk-n1pa72ns.js";
|
|
81
|
-
import"./chunk-rh5a2rg9.js";
|
|
82
|
-
import"./chunk-p2816w9z.js";
|
|
83
|
-
import"./chunk-v9smspw2.js";
|
|
84
|
-
import"./chunk-v1kzp02e.js";
|
|
85
|
-
import"./chunk-prgsmrmy.js";
|
|
86
|
-
import"./chunk-crmjpsqe.js";
|
|
87
|
-
import"./chunk-e4jqbn4d.js";
|
|
88
|
-
import"./chunk-vxnvzfnv.js";
|
|
89
|
-
import"./chunk-ns3babbs.js";
|
|
90
|
-
import"./chunk-h0rbjg6x.js";
|
|
91
|
-
import"./chunk-0vkfrmqm.js";
|
|
92
|
-
import"./chunk-0xjaqda8.js";
|
|
93
|
-
import"./chunk-xaw4scep.js";
|
|
94
|
-
import"./chunk-pedmqmrf.js";
|
|
95
|
-
import"./chunk-cj8m3h8r.js";
|
|
96
|
-
import"./chunk-zs5b1dgr.js";
|
|
97
|
-
import"./chunk-81dq52pk.js";
|
|
98
|
-
import"./chunk-tv74hgw9.js";
|
|
99
|
-
import"./chunk-d2vb6m9e.js";
|
|
100
|
-
import"./chunk-8tnsngw2.js";
|
|
101
|
-
import"./chunk-2t5ve6ev.js";
|
|
102
|
-
import"./chunk-qwj4n799.js";
|
|
103
|
-
import"./chunk-5z28bqne.js";
|
|
104
|
-
import"./chunk-qajrkk97.js";
|
|
105
|
-
import {
|
|
106
|
-
init_debug,
|
|
107
|
-
logForDebugging
|
|
108
|
-
} from "./chunk-kmgp6prw.js";
|
|
109
|
-
import {
|
|
110
|
-
errorMessage,
|
|
111
|
-
init_errors
|
|
112
|
-
} from "./chunk-3ev51j3h.js";
|
|
113
|
-
import"./chunk-fbv4apne.js";
|
|
114
|
-
import"./chunk-gzp6rza1.js";
|
|
115
|
-
import"./chunk-50dgek10.js";
|
|
116
|
-
import"./chunk-7wm5s02e.js";
|
|
117
|
-
import"./chunk-z0csm2zq.js";
|
|
118
|
-
import"./chunk-hxhwzgnn.js";
|
|
119
|
-
import"./chunk-qx8z601m.js";
|
|
120
|
-
import"./chunk-cgm6758j.js";
|
|
121
|
-
import"./chunk-9m27g5s1.js";
|
|
122
|
-
import"./chunk-8pn8tvgg.js";
|
|
123
|
-
import"./chunk-netzwgv1.js";
|
|
124
|
-
import {
|
|
125
|
-
__esm
|
|
126
|
-
} from "./chunk-qp2qdcda.js";
|
|
127
|
-
|
|
128
|
-
// src/services/api/gemini/client.ts
|
|
129
|
-
function getGeminiBaseUrl() {
|
|
130
|
-
return (process.env.GEMINI_BASE_URL || DEFAULT_GEMINI_BASE_URL).replace(/\/+$/, "");
|
|
131
|
-
}
|
|
132
|
-
function getGeminiModelPath(model) {
|
|
133
|
-
const normalized = model.replace(/^\/+/, "");
|
|
134
|
-
return normalized.startsWith("models/") ? normalized : `models/${normalized}`;
|
|
135
|
-
}
|
|
136
|
-
async function* streamGeminiGenerateContent(params) {
|
|
137
|
-
const fetchImpl = params.fetchOverride ?? fetch;
|
|
138
|
-
const url = `${getGeminiBaseUrl()}/${getGeminiModelPath(params.model)}:streamGenerateContent?alt=sse`;
|
|
139
|
-
const response = await fetchImpl(url, {
|
|
140
|
-
method: "POST",
|
|
141
|
-
headers: {
|
|
142
|
-
"Content-Type": "application/json",
|
|
143
|
-
"x-goog-api-key": process.env.GEMINI_API_KEY || ""
|
|
144
|
-
},
|
|
145
|
-
body: JSON.stringify(params.body),
|
|
146
|
-
signal: params.signal,
|
|
147
|
-
...getProxyFetchOptions({ forAnthropicAPI: false })
|
|
148
|
-
});
|
|
149
|
-
if (!response.ok) {
|
|
150
|
-
const body = await response.text();
|
|
151
|
-
throw new Error(`Gemini API request failed (${response.status} ${response.statusText}): ${body || "empty response body"}`);
|
|
152
|
-
}
|
|
153
|
-
if (!response.body) {
|
|
154
|
-
throw new Error("Gemini API returned no response body");
|
|
155
|
-
}
|
|
156
|
-
const reader = response.body.getReader();
|
|
157
|
-
const decoder = new TextDecoder;
|
|
158
|
-
let buffer = "";
|
|
159
|
-
try {
|
|
160
|
-
while (true) {
|
|
161
|
-
const { done, value } = await reader.read();
|
|
162
|
-
if (done)
|
|
163
|
-
break;
|
|
164
|
-
buffer += decoder.decode(value, STREAM_DECODE_OPTS);
|
|
165
|
-
const { frames: frames2, remaining } = parseSSEFrames(buffer);
|
|
166
|
-
buffer = remaining;
|
|
167
|
-
for (const frame of frames2) {
|
|
168
|
-
if (!frame.data || frame.data === "[DONE]")
|
|
169
|
-
continue;
|
|
170
|
-
try {
|
|
171
|
-
yield JSON.parse(frame.data);
|
|
172
|
-
} catch (error) {
|
|
173
|
-
throw new Error(`Failed to parse Gemini SSE payload: ${errorMessage(error)}`);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
buffer += decoder.decode();
|
|
178
|
-
const { frames } = parseSSEFrames(buffer);
|
|
179
|
-
for (const frame of frames) {
|
|
180
|
-
if (!frame.data || frame.data === "[DONE]")
|
|
181
|
-
continue;
|
|
182
|
-
try {
|
|
183
|
-
yield JSON.parse(frame.data);
|
|
184
|
-
} catch (error) {
|
|
185
|
-
throw new Error(`Failed to parse trailing Gemini SSE payload: ${errorMessage(error)}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
} finally {
|
|
189
|
-
reader.releaseLock();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
var DEFAULT_GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta", STREAM_DECODE_OPTS;
|
|
193
|
-
var init_client = __esm(() => {
|
|
194
|
-
init_SSETransport();
|
|
195
|
-
init_errors();
|
|
196
|
-
init_proxy();
|
|
197
|
-
STREAM_DECODE_OPTS = { stream: true };
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// src/services/api/gemini/types.ts
|
|
201
|
-
var GEMINI_THOUGHT_SIGNATURE_FIELD = "_geminiThoughtSignature";
|
|
202
|
-
var init_types = () => {};
|
|
203
|
-
|
|
204
|
-
// src/services/api/gemini/convertMessages.ts
|
|
205
|
-
function anthropicMessagesToGemini(messages, systemPrompt) {
|
|
206
|
-
const contents = [];
|
|
207
|
-
const toolNamesById = new Map;
|
|
208
|
-
for (const msg of messages) {
|
|
209
|
-
if (msg.type === "assistant") {
|
|
210
|
-
const content = convertInternalAssistantMessage(msg);
|
|
211
|
-
if (content.parts.length > 0) {
|
|
212
|
-
contents.push(content);
|
|
213
|
-
}
|
|
214
|
-
const assistantContent = msg.message.content;
|
|
215
|
-
if (Array.isArray(assistantContent)) {
|
|
216
|
-
for (const block of assistantContent) {
|
|
217
|
-
if (typeof block !== "string" && block.type === "tool_use") {
|
|
218
|
-
toolNamesById.set(block.id, block.name);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
if (msg.type === "user") {
|
|
225
|
-
const content = convertInternalUserMessage(msg, toolNamesById);
|
|
226
|
-
if (content.parts.length > 0) {
|
|
227
|
-
contents.push(content);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
const systemText = systemPromptToText(systemPrompt);
|
|
232
|
-
return {
|
|
233
|
-
contents,
|
|
234
|
-
...systemText ? {
|
|
235
|
-
systemInstruction: {
|
|
236
|
-
parts: [{ text: systemText }]
|
|
237
|
-
}
|
|
238
|
-
} : {}
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function systemPromptToText(systemPrompt) {
|
|
242
|
-
if (!systemPrompt || systemPrompt.length === 0)
|
|
243
|
-
return "";
|
|
244
|
-
return systemPrompt.filter(Boolean).join(`
|
|
245
|
-
|
|
246
|
-
`);
|
|
247
|
-
}
|
|
248
|
-
function convertInternalUserMessage(msg, toolNamesById) {
|
|
249
|
-
const content = msg.message.content;
|
|
250
|
-
if (typeof content === "string") {
|
|
251
|
-
return {
|
|
252
|
-
role: "user",
|
|
253
|
-
parts: createTextGeminiParts(content)
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
if (!Array.isArray(content)) {
|
|
257
|
-
return { role: "user", parts: [] };
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
role: "user",
|
|
261
|
-
parts: content.flatMap((block) => convertUserContentBlockToGeminiParts(block, toolNamesById))
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
function convertUserContentBlockToGeminiParts(block, toolNamesById) {
|
|
265
|
-
if (typeof block === "string") {
|
|
266
|
-
return createTextGeminiParts(block);
|
|
267
|
-
}
|
|
268
|
-
if (block.type === "text") {
|
|
269
|
-
return createTextGeminiParts(block.text);
|
|
270
|
-
}
|
|
271
|
-
if (block.type === "tool_result") {
|
|
272
|
-
const toolResult = block;
|
|
273
|
-
return [
|
|
274
|
-
{
|
|
275
|
-
functionResponse: {
|
|
276
|
-
name: toolNamesById.get(toolResult.tool_use_id) ?? toolResult.tool_use_id,
|
|
277
|
-
response: toolResultToResponseObject(toolResult)
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
];
|
|
281
|
-
}
|
|
282
|
-
if (block.type === "image") {
|
|
283
|
-
const source = block.source;
|
|
284
|
-
if (source?.type === "base64" && typeof source.data === "string") {
|
|
285
|
-
const mediaType = source.media_type || "image/png";
|
|
286
|
-
return [
|
|
287
|
-
{
|
|
288
|
-
inlineData: {
|
|
289
|
-
mimeType: mediaType,
|
|
290
|
-
data: source.data
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
];
|
|
294
|
-
}
|
|
295
|
-
if (source?.type === "url" && typeof source.url === "string") {
|
|
296
|
-
return createTextGeminiParts(`[image: ${source.url}]`);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return [];
|
|
300
|
-
}
|
|
301
|
-
function convertInternalAssistantMessage(msg) {
|
|
302
|
-
const content = msg.message.content;
|
|
303
|
-
if (typeof content === "string") {
|
|
304
|
-
return {
|
|
305
|
-
role: "model",
|
|
306
|
-
parts: createTextGeminiParts(content)
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
if (!Array.isArray(content)) {
|
|
310
|
-
return { role: "model", parts: [] };
|
|
311
|
-
}
|
|
312
|
-
const parts = [];
|
|
313
|
-
for (const block of content) {
|
|
314
|
-
if (typeof block === "string") {
|
|
315
|
-
parts.push(...createTextGeminiParts(block));
|
|
316
|
-
continue;
|
|
317
|
-
}
|
|
318
|
-
if (block.type === "text") {
|
|
319
|
-
parts.push(...createTextGeminiParts(block.text, getGeminiThoughtSignature(block)));
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
if (block.type === "thinking") {
|
|
323
|
-
const thinkingPart = createThinkingGeminiPart(block.thinking, block.signature);
|
|
324
|
-
if (thinkingPart) {
|
|
325
|
-
parts.push(thinkingPart);
|
|
326
|
-
}
|
|
327
|
-
continue;
|
|
328
|
-
}
|
|
329
|
-
if (block.type === "tool_use") {
|
|
330
|
-
const toolUse = block;
|
|
331
|
-
parts.push({
|
|
332
|
-
functionCall: {
|
|
333
|
-
name: toolUse.name,
|
|
334
|
-
args: normalizeToolUseInput(toolUse.input)
|
|
335
|
-
},
|
|
336
|
-
...getGeminiThoughtSignature(block) && {
|
|
337
|
-
thoughtSignature: getGeminiThoughtSignature(block)
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
return { role: "model", parts };
|
|
343
|
-
}
|
|
344
|
-
function createTextGeminiParts(value, thoughtSignature) {
|
|
345
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
346
|
-
return [];
|
|
347
|
-
}
|
|
348
|
-
return [
|
|
349
|
-
{
|
|
350
|
-
text: value,
|
|
351
|
-
...thoughtSignature && { thoughtSignature }
|
|
352
|
-
}
|
|
353
|
-
];
|
|
354
|
-
}
|
|
355
|
-
function createThinkingGeminiPart(value, thoughtSignature) {
|
|
356
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
return {
|
|
360
|
-
text: value,
|
|
361
|
-
thought: true,
|
|
362
|
-
...thoughtSignature && { thoughtSignature }
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
function normalizeToolUseInput(input) {
|
|
366
|
-
if (typeof input === "string") {
|
|
367
|
-
const parsed = safeParseJSON(input);
|
|
368
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
369
|
-
return parsed;
|
|
370
|
-
}
|
|
371
|
-
return parsed === null ? {} : { value: parsed };
|
|
372
|
-
}
|
|
373
|
-
if (input && typeof input === "object" && !Array.isArray(input)) {
|
|
374
|
-
return input;
|
|
375
|
-
}
|
|
376
|
-
return input === undefined ? {} : { value: input };
|
|
377
|
-
}
|
|
378
|
-
function toolResultToResponseObject(block) {
|
|
379
|
-
const result = normalizeToolResultContent(block.content);
|
|
380
|
-
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
381
|
-
return block.is_error ? { ...result, is_error: true } : result;
|
|
382
|
-
}
|
|
383
|
-
return {
|
|
384
|
-
result,
|
|
385
|
-
...block.is_error ? { is_error: true } : {}
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
function normalizeToolResultContent(content) {
|
|
389
|
-
if (typeof content === "string") {
|
|
390
|
-
const parsed = safeParseJSON(content);
|
|
391
|
-
return parsed ?? content;
|
|
392
|
-
}
|
|
393
|
-
if (Array.isArray(content)) {
|
|
394
|
-
const text = content.map((part) => {
|
|
395
|
-
if (typeof part === "string")
|
|
396
|
-
return part;
|
|
397
|
-
if (part && typeof part === "object" && "text" in part && typeof part.text === "string") {
|
|
398
|
-
return part.text;
|
|
399
|
-
}
|
|
400
|
-
return "";
|
|
401
|
-
}).filter(Boolean).join(`
|
|
402
|
-
`);
|
|
403
|
-
const parsed = safeParseJSON(text);
|
|
404
|
-
return parsed ?? text;
|
|
405
|
-
}
|
|
406
|
-
return content ?? "";
|
|
407
|
-
}
|
|
408
|
-
function getGeminiThoughtSignature(block) {
|
|
409
|
-
const signature = block[GEMINI_THOUGHT_SIGNATURE_FIELD];
|
|
410
|
-
return typeof signature === "string" && signature.length > 0 ? signature : undefined;
|
|
411
|
-
}
|
|
412
|
-
var init_convertMessages = __esm(() => {
|
|
413
|
-
init_json();
|
|
414
|
-
init_types();
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
// src/services/api/gemini/convertTools.ts
|
|
418
|
-
function normalizeGeminiJsonSchemaType(value) {
|
|
419
|
-
if (typeof value === "string") {
|
|
420
|
-
return GEMINI_JSON_SCHEMA_TYPES.has(value) ? value : undefined;
|
|
421
|
-
}
|
|
422
|
-
if (Array.isArray(value)) {
|
|
423
|
-
const normalized = value.filter((item) => typeof item === "string" && GEMINI_JSON_SCHEMA_TYPES.has(item));
|
|
424
|
-
const unique = Array.from(new Set(normalized));
|
|
425
|
-
if (unique.length === 0)
|
|
426
|
-
return;
|
|
427
|
-
return unique.length === 1 ? unique[0] : unique;
|
|
428
|
-
}
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
function inferGeminiJsonSchemaTypeFromValue(value) {
|
|
432
|
-
if (value === null)
|
|
433
|
-
return "null";
|
|
434
|
-
if (Array.isArray(value))
|
|
435
|
-
return "array";
|
|
436
|
-
if (typeof value === "string")
|
|
437
|
-
return "string";
|
|
438
|
-
if (typeof value === "boolean")
|
|
439
|
-
return "boolean";
|
|
440
|
-
if (typeof value === "number") {
|
|
441
|
-
return Number.isInteger(value) ? "integer" : "number";
|
|
442
|
-
}
|
|
443
|
-
if (typeof value === "object")
|
|
444
|
-
return "object";
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
function inferGeminiJsonSchemaTypeFromEnum(values) {
|
|
448
|
-
const inferred = values.map(inferGeminiJsonSchemaTypeFromValue).filter((value) => value !== undefined);
|
|
449
|
-
const unique = Array.from(new Set(inferred));
|
|
450
|
-
if (unique.length === 0)
|
|
451
|
-
return;
|
|
452
|
-
return unique.length === 1 ? unique[0] : unique;
|
|
453
|
-
}
|
|
454
|
-
function addNullToGeminiJsonSchemaType(value) {
|
|
455
|
-
if (value === undefined)
|
|
456
|
-
return ["null"];
|
|
457
|
-
if (Array.isArray(value)) {
|
|
458
|
-
return value.includes("null") ? value : [...value, "null"];
|
|
459
|
-
}
|
|
460
|
-
return value === "null" ? value : [value, "null"];
|
|
461
|
-
}
|
|
462
|
-
function sanitizeGeminiJsonSchemaProperties(value) {
|
|
463
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
const sanitizedEntries = Object.entries(value).map(([key, schema]) => [key, sanitizeGeminiJsonSchema(schema)]).filter(([, schema]) => Object.keys(schema).length > 0);
|
|
467
|
-
if (sanitizedEntries.length === 0) {
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
return Object.fromEntries(sanitizedEntries);
|
|
471
|
-
}
|
|
472
|
-
function sanitizeGeminiJsonSchemaArray(value) {
|
|
473
|
-
if (!Array.isArray(value))
|
|
474
|
-
return;
|
|
475
|
-
const sanitized = value.map((item) => sanitizeGeminiJsonSchema(item)).filter((item) => Object.keys(item).length > 0);
|
|
476
|
-
return sanitized.length > 0 ? sanitized : undefined;
|
|
477
|
-
}
|
|
478
|
-
function sanitizeGeminiJsonSchema(schema) {
|
|
479
|
-
if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
|
|
480
|
-
return {};
|
|
481
|
-
}
|
|
482
|
-
const source = schema;
|
|
483
|
-
const result = {};
|
|
484
|
-
let type = normalizeGeminiJsonSchemaType(source.type);
|
|
485
|
-
if (source.const !== undefined) {
|
|
486
|
-
result.enum = [source.const];
|
|
487
|
-
type = type ?? inferGeminiJsonSchemaTypeFromValue(source.const);
|
|
488
|
-
} else if (Array.isArray(source.enum) && source.enum.length > 0) {
|
|
489
|
-
result.enum = source.enum;
|
|
490
|
-
type = type ?? inferGeminiJsonSchemaTypeFromEnum(source.enum);
|
|
491
|
-
}
|
|
492
|
-
if (!type) {
|
|
493
|
-
if (source.properties && typeof source.properties === "object") {
|
|
494
|
-
type = "object";
|
|
495
|
-
} else if (source.items !== undefined || source.prefixItems !== undefined) {
|
|
496
|
-
type = "array";
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
if (source.nullable === true) {
|
|
500
|
-
type = addNullToGeminiJsonSchemaType(type);
|
|
501
|
-
}
|
|
502
|
-
if (type) {
|
|
503
|
-
result.type = type;
|
|
504
|
-
}
|
|
505
|
-
if (typeof source.title === "string") {
|
|
506
|
-
result.title = source.title;
|
|
507
|
-
}
|
|
508
|
-
if (typeof source.description === "string") {
|
|
509
|
-
result.description = source.description;
|
|
510
|
-
}
|
|
511
|
-
if (typeof source.format === "string") {
|
|
512
|
-
result.format = source.format;
|
|
513
|
-
}
|
|
514
|
-
if (typeof source.pattern === "string") {
|
|
515
|
-
result.pattern = source.pattern;
|
|
516
|
-
}
|
|
517
|
-
if (typeof source.minimum === "number") {
|
|
518
|
-
result.minimum = source.minimum;
|
|
519
|
-
} else if (typeof source.exclusiveMinimum === "number") {
|
|
520
|
-
result.minimum = source.exclusiveMinimum;
|
|
521
|
-
}
|
|
522
|
-
if (typeof source.maximum === "number") {
|
|
523
|
-
result.maximum = source.maximum;
|
|
524
|
-
} else if (typeof source.exclusiveMaximum === "number") {
|
|
525
|
-
result.maximum = source.exclusiveMaximum;
|
|
526
|
-
}
|
|
527
|
-
if (typeof source.minItems === "number") {
|
|
528
|
-
result.minItems = source.minItems;
|
|
529
|
-
}
|
|
530
|
-
if (typeof source.maxItems === "number") {
|
|
531
|
-
result.maxItems = source.maxItems;
|
|
532
|
-
}
|
|
533
|
-
if (typeof source.minLength === "number") {
|
|
534
|
-
result.minLength = source.minLength;
|
|
535
|
-
}
|
|
536
|
-
if (typeof source.maxLength === "number") {
|
|
537
|
-
result.maxLength = source.maxLength;
|
|
538
|
-
}
|
|
539
|
-
if (typeof source.minProperties === "number") {
|
|
540
|
-
result.minProperties = source.minProperties;
|
|
541
|
-
}
|
|
542
|
-
if (typeof source.maxProperties === "number") {
|
|
543
|
-
result.maxProperties = source.maxProperties;
|
|
544
|
-
}
|
|
545
|
-
const properties = sanitizeGeminiJsonSchemaProperties(source.properties);
|
|
546
|
-
if (properties) {
|
|
547
|
-
result.properties = properties;
|
|
548
|
-
result.propertyOrdering = Object.keys(properties);
|
|
549
|
-
}
|
|
550
|
-
if (Array.isArray(source.required)) {
|
|
551
|
-
const required = source.required.filter((item) => typeof item === "string");
|
|
552
|
-
if (required.length > 0) {
|
|
553
|
-
result.required = required;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
if (typeof source.additionalProperties === "boolean") {
|
|
557
|
-
result.additionalProperties = source.additionalProperties;
|
|
558
|
-
} else {
|
|
559
|
-
const additionalProperties = sanitizeGeminiJsonSchema(source.additionalProperties);
|
|
560
|
-
if (Object.keys(additionalProperties).length > 0) {
|
|
561
|
-
result.additionalProperties = additionalProperties;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
const items = sanitizeGeminiJsonSchema(source.items);
|
|
565
|
-
if (Object.keys(items).length > 0) {
|
|
566
|
-
result.items = items;
|
|
567
|
-
}
|
|
568
|
-
const prefixItems = sanitizeGeminiJsonSchemaArray(source.prefixItems);
|
|
569
|
-
if (prefixItems) {
|
|
570
|
-
result.prefixItems = prefixItems;
|
|
571
|
-
}
|
|
572
|
-
const anyOf = sanitizeGeminiJsonSchemaArray(source.anyOf ?? source.oneOf);
|
|
573
|
-
if (anyOf) {
|
|
574
|
-
result.anyOf = anyOf;
|
|
575
|
-
}
|
|
576
|
-
return result;
|
|
577
|
-
}
|
|
578
|
-
function sanitizeGeminiFunctionParameters(schema) {
|
|
579
|
-
const sanitized = sanitizeGeminiJsonSchema(schema);
|
|
580
|
-
if (Object.keys(sanitized).length > 0) {
|
|
581
|
-
return sanitized;
|
|
582
|
-
}
|
|
583
|
-
return {
|
|
584
|
-
type: "object",
|
|
585
|
-
properties: {}
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
function anthropicToolsToGemini(tools) {
|
|
589
|
-
const functionDeclarations = tools.filter((tool) => {
|
|
590
|
-
const toolType = tool.type;
|
|
591
|
-
return tool.type === "custom" || !("type" in tool) || toolType !== "server";
|
|
592
|
-
}).map((tool) => {
|
|
593
|
-
const anyTool = tool;
|
|
594
|
-
const name = anyTool.name || "";
|
|
595
|
-
const description = anyTool.description || "";
|
|
596
|
-
const inputSchema = anyTool.input_schema ?? {
|
|
597
|
-
type: "object",
|
|
598
|
-
properties: {}
|
|
599
|
-
};
|
|
600
|
-
return {
|
|
601
|
-
name,
|
|
602
|
-
description,
|
|
603
|
-
parametersJsonSchema: sanitizeGeminiFunctionParameters(inputSchema)
|
|
604
|
-
};
|
|
605
|
-
});
|
|
606
|
-
return functionDeclarations.length > 0 ? [{ functionDeclarations }] : [];
|
|
607
|
-
}
|
|
608
|
-
function anthropicToolChoiceToGemini(toolChoice) {
|
|
609
|
-
if (!toolChoice || typeof toolChoice !== "object")
|
|
610
|
-
return;
|
|
611
|
-
const tc = toolChoice;
|
|
612
|
-
const type = tc.type;
|
|
613
|
-
switch (type) {
|
|
614
|
-
case "auto":
|
|
615
|
-
return { mode: "AUTO" };
|
|
616
|
-
case "any":
|
|
617
|
-
return { mode: "ANY" };
|
|
618
|
-
case "tool":
|
|
619
|
-
return {
|
|
620
|
-
mode: "ANY",
|
|
621
|
-
allowedFunctionNames: typeof tc.name === "string" ? [tc.name] : undefined
|
|
622
|
-
};
|
|
623
|
-
default:
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
var GEMINI_JSON_SCHEMA_TYPES;
|
|
628
|
-
var init_convertTools = __esm(() => {
|
|
629
|
-
GEMINI_JSON_SCHEMA_TYPES = new Set([
|
|
630
|
-
"string",
|
|
631
|
-
"number",
|
|
632
|
-
"integer",
|
|
633
|
-
"boolean",
|
|
634
|
-
"object",
|
|
635
|
-
"array",
|
|
636
|
-
"null"
|
|
637
|
-
]);
|
|
638
|
-
});
|
|
639
|
-
|
|
640
|
-
// src/services/api/gemini/modelMapping.ts
|
|
641
|
-
function getModelFamily(model) {
|
|
642
|
-
if (/haiku/i.test(model))
|
|
643
|
-
return "haiku";
|
|
644
|
-
if (/opus/i.test(model))
|
|
645
|
-
return "opus";
|
|
646
|
-
if (/sonnet/i.test(model))
|
|
647
|
-
return "sonnet";
|
|
648
|
-
return null;
|
|
649
|
-
}
|
|
650
|
-
function resolveGeminiModel(anthropicModel) {
|
|
651
|
-
if (process.env.GEMINI_MODEL) {
|
|
652
|
-
return process.env.GEMINI_MODEL;
|
|
653
|
-
}
|
|
654
|
-
const cleanModel = anthropicModel.replace(/\[1m\]$/i, "");
|
|
655
|
-
const family = getModelFamily(cleanModel);
|
|
656
|
-
if (!family) {
|
|
657
|
-
return cleanModel;
|
|
658
|
-
}
|
|
659
|
-
const geminiEnvVar = `GEMINI_DEFAULT_${family.toUpperCase()}_MODEL`;
|
|
660
|
-
const geminiModel = process.env[geminiEnvVar];
|
|
661
|
-
if (geminiModel) {
|
|
662
|
-
return geminiModel;
|
|
663
|
-
}
|
|
664
|
-
const sharedEnvVar = `ANTHROPIC_DEFAULT_${family.toUpperCase()}_MODEL`;
|
|
665
|
-
const resolvedModel = process.env[sharedEnvVar];
|
|
666
|
-
if (resolvedModel) {
|
|
667
|
-
return resolvedModel;
|
|
668
|
-
}
|
|
669
|
-
throw new Error(`Gemini provider requires GEMINI_MODEL or ${geminiEnvVar} (or ${sharedEnvVar} for backward compatibility) to be configured.`);
|
|
670
|
-
}
|
|
671
|
-
var init_modelMapping = () => {};
|
|
672
|
-
|
|
673
|
-
// src/services/api/gemini/streamAdapter.ts
|
|
674
|
-
import { randomUUID } from "crypto";
|
|
675
|
-
async function* adaptGeminiStreamToAnthropic(stream, model) {
|
|
676
|
-
const messageId = `msg_${randomUUID().replace(/-/g, "").slice(0, 24)}`;
|
|
677
|
-
let started = false;
|
|
678
|
-
let stopped = false;
|
|
679
|
-
let nextContentIndex = 0;
|
|
680
|
-
let openTextLikeBlock = null;
|
|
681
|
-
let sawToolUse = false;
|
|
682
|
-
let finishReason;
|
|
683
|
-
let inputTokens = 0;
|
|
684
|
-
let outputTokens = 0;
|
|
685
|
-
for await (const chunk of stream) {
|
|
686
|
-
const usage = chunk.usageMetadata;
|
|
687
|
-
if (usage) {
|
|
688
|
-
inputTokens = usage.promptTokenCount ?? inputTokens;
|
|
689
|
-
outputTokens = (usage.candidatesTokenCount ?? 0) + (usage.thoughtsTokenCount ?? 0);
|
|
690
|
-
}
|
|
691
|
-
if (!started) {
|
|
692
|
-
started = true;
|
|
693
|
-
yield {
|
|
694
|
-
type: "message_start",
|
|
695
|
-
message: {
|
|
696
|
-
id: messageId,
|
|
697
|
-
type: "message",
|
|
698
|
-
role: "assistant",
|
|
699
|
-
content: [],
|
|
700
|
-
model,
|
|
701
|
-
stop_reason: null,
|
|
702
|
-
stop_sequence: null,
|
|
703
|
-
usage: {
|
|
704
|
-
input_tokens: inputTokens,
|
|
705
|
-
output_tokens: 0,
|
|
706
|
-
cache_creation_input_tokens: 0,
|
|
707
|
-
cache_read_input_tokens: 0
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
const candidate = chunk.candidates?.[0];
|
|
713
|
-
const parts = candidate?.content?.parts ?? [];
|
|
714
|
-
for (const part of parts) {
|
|
715
|
-
if (part.functionCall) {
|
|
716
|
-
if (openTextLikeBlock) {
|
|
717
|
-
yield {
|
|
718
|
-
type: "content_block_stop",
|
|
719
|
-
index: openTextLikeBlock.index
|
|
720
|
-
};
|
|
721
|
-
openTextLikeBlock = null;
|
|
722
|
-
}
|
|
723
|
-
sawToolUse = true;
|
|
724
|
-
const toolIndex = nextContentIndex++;
|
|
725
|
-
const toolId = `toolu_${randomUUID().replace(/-/g, "").slice(0, 24)}`;
|
|
726
|
-
yield {
|
|
727
|
-
type: "content_block_start",
|
|
728
|
-
index: toolIndex,
|
|
729
|
-
content_block: {
|
|
730
|
-
type: "tool_use",
|
|
731
|
-
id: toolId,
|
|
732
|
-
name: part.functionCall.name || "",
|
|
733
|
-
input: {}
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
if (part.thoughtSignature) {
|
|
737
|
-
yield {
|
|
738
|
-
type: "content_block_delta",
|
|
739
|
-
index: toolIndex,
|
|
740
|
-
delta: {
|
|
741
|
-
type: "signature_delta",
|
|
742
|
-
signature: part.thoughtSignature
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
if (part.functionCall.args && Object.keys(part.functionCall.args).length > 0) {
|
|
747
|
-
yield {
|
|
748
|
-
type: "content_block_delta",
|
|
749
|
-
index: toolIndex,
|
|
750
|
-
delta: {
|
|
751
|
-
type: "input_json_delta",
|
|
752
|
-
partial_json: JSON.stringify(part.functionCall.args)
|
|
753
|
-
}
|
|
754
|
-
};
|
|
755
|
-
}
|
|
756
|
-
yield {
|
|
757
|
-
type: "content_block_stop",
|
|
758
|
-
index: toolIndex
|
|
759
|
-
};
|
|
760
|
-
continue;
|
|
761
|
-
}
|
|
762
|
-
const textLikeType = getTextLikeBlockType(part);
|
|
763
|
-
if (textLikeType) {
|
|
764
|
-
if (!openTextLikeBlock || openTextLikeBlock.type !== textLikeType) {
|
|
765
|
-
if (openTextLikeBlock) {
|
|
766
|
-
yield {
|
|
767
|
-
type: "content_block_stop",
|
|
768
|
-
index: openTextLikeBlock.index
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
openTextLikeBlock = {
|
|
772
|
-
index: nextContentIndex++,
|
|
773
|
-
type: textLikeType
|
|
774
|
-
};
|
|
775
|
-
yield {
|
|
776
|
-
type: "content_block_start",
|
|
777
|
-
index: openTextLikeBlock.index,
|
|
778
|
-
content_block: textLikeType === "thinking" ? {
|
|
779
|
-
type: "thinking",
|
|
780
|
-
thinking: "",
|
|
781
|
-
signature: ""
|
|
782
|
-
} : {
|
|
783
|
-
type: "text",
|
|
784
|
-
text: ""
|
|
785
|
-
}
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
if (part.text) {
|
|
789
|
-
yield {
|
|
790
|
-
type: "content_block_delta",
|
|
791
|
-
index: openTextLikeBlock.index,
|
|
792
|
-
delta: textLikeType === "thinking" ? {
|
|
793
|
-
type: "thinking_delta",
|
|
794
|
-
thinking: part.text
|
|
795
|
-
} : {
|
|
796
|
-
type: "text_delta",
|
|
797
|
-
text: part.text
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
}
|
|
801
|
-
if (part.thoughtSignature) {
|
|
802
|
-
yield {
|
|
803
|
-
type: "content_block_delta",
|
|
804
|
-
index: openTextLikeBlock.index,
|
|
805
|
-
delta: {
|
|
806
|
-
type: "signature_delta",
|
|
807
|
-
signature: part.thoughtSignature
|
|
808
|
-
}
|
|
809
|
-
};
|
|
810
|
-
}
|
|
811
|
-
continue;
|
|
812
|
-
}
|
|
813
|
-
if (part.thoughtSignature && openTextLikeBlock) {
|
|
814
|
-
yield {
|
|
815
|
-
type: "content_block_delta",
|
|
816
|
-
index: openTextLikeBlock.index,
|
|
817
|
-
delta: {
|
|
818
|
-
type: "signature_delta",
|
|
819
|
-
signature: part.thoughtSignature
|
|
820
|
-
}
|
|
821
|
-
};
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
if (candidate?.finishReason) {
|
|
825
|
-
finishReason = candidate.finishReason;
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
if (!started) {
|
|
829
|
-
return;
|
|
830
|
-
}
|
|
831
|
-
if (openTextLikeBlock) {
|
|
832
|
-
yield {
|
|
833
|
-
type: "content_block_stop",
|
|
834
|
-
index: openTextLikeBlock.index
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
if (!stopped) {
|
|
838
|
-
yield {
|
|
839
|
-
type: "message_delta",
|
|
840
|
-
delta: {
|
|
841
|
-
stop_reason: mapGeminiFinishReason(finishReason, sawToolUse),
|
|
842
|
-
stop_sequence: null
|
|
843
|
-
},
|
|
844
|
-
usage: {
|
|
845
|
-
output_tokens: outputTokens
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
|
-
yield {
|
|
849
|
-
type: "message_stop"
|
|
850
|
-
};
|
|
851
|
-
stopped = true;
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
function getTextLikeBlockType(part) {
|
|
855
|
-
if (typeof part.text !== "string") {
|
|
856
|
-
return null;
|
|
857
|
-
}
|
|
858
|
-
return part.thought ? "thinking" : "text";
|
|
859
|
-
}
|
|
860
|
-
function mapGeminiFinishReason(reason, sawToolUse) {
|
|
861
|
-
switch (reason) {
|
|
862
|
-
case "MAX_TOKENS":
|
|
863
|
-
return "max_tokens";
|
|
864
|
-
case "STOP":
|
|
865
|
-
case "FINISH_REASON_UNSPECIFIED":
|
|
866
|
-
case "SAFETY":
|
|
867
|
-
case "RECITATION":
|
|
868
|
-
case "BLOCKLIST":
|
|
869
|
-
case "PROHIBITED_CONTENT":
|
|
870
|
-
case "SPII":
|
|
871
|
-
case "MALFORMED_FUNCTION_CALL":
|
|
872
|
-
default:
|
|
873
|
-
return sawToolUse ? "tool_use" : "end_turn";
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
var init_streamAdapter = () => {};
|
|
877
|
-
|
|
878
|
-
// src/services/api/gemini/index.ts
|
|
879
|
-
import { randomUUID as randomUUID2 } from "crypto";
|
|
880
|
-
async function* queryModelGemini(messages, systemPrompt, tools, signal, options, thinkingConfig) {
|
|
881
|
-
try {
|
|
882
|
-
const geminiModel = resolveGeminiModel(options.model);
|
|
883
|
-
const messagesForAPI = normalizeMessagesForAPI(messages, tools);
|
|
884
|
-
const toolSchemas = await Promise.all(tools.map((tool) => toolToAPISchema(tool, {
|
|
885
|
-
getToolPermissionContext: options.getToolPermissionContext,
|
|
886
|
-
tools,
|
|
887
|
-
agents: options.agents,
|
|
888
|
-
allowedAgentTypes: options.allowedAgentTypes,
|
|
889
|
-
model: options.model
|
|
890
|
-
})));
|
|
891
|
-
const standardTools = toolSchemas.filter((t) => {
|
|
892
|
-
const anyTool = t;
|
|
893
|
-
return anyTool.type !== "advisor_20260301" && anyTool.type !== "computer_20250124";
|
|
894
|
-
});
|
|
895
|
-
const { contents, systemInstruction } = anthropicMessagesToGemini(messagesForAPI, systemPrompt);
|
|
896
|
-
const geminiTools = anthropicToolsToGemini(standardTools);
|
|
897
|
-
const toolChoice = anthropicToolChoiceToGemini(options.toolChoice);
|
|
898
|
-
const stream = streamGeminiGenerateContent({
|
|
899
|
-
model: geminiModel,
|
|
900
|
-
signal,
|
|
901
|
-
fetchOverride: options.fetchOverride,
|
|
902
|
-
body: {
|
|
903
|
-
contents,
|
|
904
|
-
...systemInstruction && { systemInstruction },
|
|
905
|
-
...geminiTools.length > 0 && { tools: geminiTools },
|
|
906
|
-
...toolChoice && {
|
|
907
|
-
toolConfig: {
|
|
908
|
-
functionCallingConfig: toolChoice
|
|
909
|
-
}
|
|
910
|
-
},
|
|
911
|
-
generationConfig: {
|
|
912
|
-
...options.temperatureOverride !== undefined && {
|
|
913
|
-
temperature: options.temperatureOverride
|
|
914
|
-
},
|
|
915
|
-
...thinkingConfig.type !== "disabled" && {
|
|
916
|
-
thinkingConfig: {
|
|
917
|
-
includeThoughts: true,
|
|
918
|
-
...thinkingConfig.type === "enabled" && {
|
|
919
|
-
thinkingBudget: thinkingConfig.budgetTokens
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
});
|
|
926
|
-
logForDebugging(`[Gemini] Calling model=${geminiModel}, messages=${contents.length}, tools=${geminiTools.length}`);
|
|
927
|
-
const adaptedStream = adaptGeminiStreamToAnthropic(stream, geminiModel);
|
|
928
|
-
const contentBlocks = {};
|
|
929
|
-
let partialMessage = undefined;
|
|
930
|
-
let ttftMs = 0;
|
|
931
|
-
const start = Date.now();
|
|
932
|
-
for await (const event of adaptedStream) {
|
|
933
|
-
switch (event.type) {
|
|
934
|
-
case "message_start":
|
|
935
|
-
partialMessage = event.message;
|
|
936
|
-
ttftMs = Date.now() - start;
|
|
937
|
-
break;
|
|
938
|
-
case "content_block_start": {
|
|
939
|
-
const idx = event.index;
|
|
940
|
-
const cb = event.content_block;
|
|
941
|
-
if (cb.type === "tool_use") {
|
|
942
|
-
contentBlocks[idx] = { ...cb, input: "" };
|
|
943
|
-
} else if (cb.type === "text") {
|
|
944
|
-
contentBlocks[idx] = { ...cb, text: "" };
|
|
945
|
-
} else if (cb.type === "thinking") {
|
|
946
|
-
contentBlocks[idx] = { ...cb, thinking: "", signature: "" };
|
|
947
|
-
} else {
|
|
948
|
-
contentBlocks[idx] = { ...cb };
|
|
949
|
-
}
|
|
950
|
-
break;
|
|
951
|
-
}
|
|
952
|
-
case "content_block_delta": {
|
|
953
|
-
const idx = event.index;
|
|
954
|
-
const delta = event.delta;
|
|
955
|
-
const block = contentBlocks[idx];
|
|
956
|
-
if (!block)
|
|
957
|
-
break;
|
|
958
|
-
if (delta.type === "text_delta") {
|
|
959
|
-
block.text = (block.text || "") + delta.text;
|
|
960
|
-
} else if (delta.type === "input_json_delta") {
|
|
961
|
-
block.input = (block.input || "") + delta.partial_json;
|
|
962
|
-
} else if (delta.type === "thinking_delta") {
|
|
963
|
-
block.thinking = (block.thinking || "") + delta.thinking;
|
|
964
|
-
} else if (delta.type === "signature_delta") {
|
|
965
|
-
if (block.type === "thinking") {
|
|
966
|
-
block.signature = delta.signature;
|
|
967
|
-
} else {
|
|
968
|
-
block[GEMINI_THOUGHT_SIGNATURE_FIELD] = delta.signature;
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
break;
|
|
972
|
-
}
|
|
973
|
-
case "content_block_stop": {
|
|
974
|
-
const idx = event.index;
|
|
975
|
-
const block = contentBlocks[idx];
|
|
976
|
-
if (!block || !partialMessage)
|
|
977
|
-
break;
|
|
978
|
-
const message = {
|
|
979
|
-
message: {
|
|
980
|
-
...partialMessage,
|
|
981
|
-
content: normalizeContentFromAPI([block], tools, options.agentId)
|
|
982
|
-
},
|
|
983
|
-
requestId: undefined,
|
|
984
|
-
type: "assistant",
|
|
985
|
-
uuid: randomUUID2(),
|
|
986
|
-
timestamp: new Date().toISOString()
|
|
987
|
-
};
|
|
988
|
-
yield message;
|
|
989
|
-
break;
|
|
990
|
-
}
|
|
991
|
-
case "message_delta":
|
|
992
|
-
case "message_stop":
|
|
993
|
-
break;
|
|
994
|
-
}
|
|
995
|
-
yield {
|
|
996
|
-
type: "stream_event",
|
|
997
|
-
event,
|
|
998
|
-
...event.type === "message_start" ? { ttftMs } : undefined
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
} catch (error) {
|
|
1002
|
-
const errorMessage2 = error instanceof Error ? error.message : String(error);
|
|
1003
|
-
logForDebugging(`[Gemini] Error: ${errorMessage2}`, { level: "error" });
|
|
1004
|
-
yield createAssistantAPIErrorMessage({
|
|
1005
|
-
content: `API Error: ${errorMessage2}`,
|
|
1006
|
-
apiError: "api_error",
|
|
1007
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
var init_gemini = __esm(() => {
|
|
1012
|
-
init_api();
|
|
1013
|
-
init_debug();
|
|
1014
|
-
init_messages();
|
|
1015
|
-
init_client();
|
|
1016
|
-
init_convertMessages();
|
|
1017
|
-
init_convertTools();
|
|
1018
|
-
init_modelMapping();
|
|
1019
|
-
init_streamAdapter();
|
|
1020
|
-
init_types();
|
|
1021
|
-
});
|
|
1022
|
-
init_gemini();
|
|
1023
|
-
|
|
1024
|
-
export {
|
|
1025
|
-
queryModelGemini
|
|
1026
|
-
};
|