claude-code-best 1.4.0 → 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/dist/{chunk-4gpt5ay1.js → chunk-00vfg42v.js} +57 -55
- package/dist/{chunk-0w8eb8gt.js → chunk-01ysfcs0.js} +6 -8
- package/dist/{chunk-q223vmcc.js → chunk-04ws37gv.js} +6 -8
- package/dist/{chunk-cnggqnzm.js → chunk-0b0fq180.js} +26 -26
- package/dist/{chunk-53sfy7n4.js → chunk-0cs46nj6.js} +59 -58
- package/dist/chunk-0fzcyd0s.js +116 -0
- package/dist/{chunk-7nebst32.js → chunk-0knhp7v5.js} +2 -2
- package/dist/{chunk-ebzv9705.js → chunk-0xth516w.js} +14 -14
- package/dist/{chunk-r4hf85nn.js → chunk-0y6h57c5.js} +6 -6
- package/dist/{chunk-mdk5vcer.js → chunk-196qs1ty.js} +29 -28
- package/dist/chunk-1d39h7zf.js +57 -0
- package/dist/{chunk-k8vb990d.js → chunk-1k3ahc24.js} +55 -53
- package/dist/{chunk-yatby2yh.js → chunk-1nhx3qpn.js} +2 -2
- package/dist/{chunk-qga7he5v.js → chunk-1qbype3e.js} +9 -9
- package/dist/{chunk-txz05nf1.js → chunk-1r70yykn.js} +3 -3
- package/dist/{chunk-21pvq2fw.js → chunk-1x1wb96n.js} +58 -56
- package/dist/{chunk-nnbp6hww.js → chunk-1yscv3t1.js} +7 -9
- package/dist/{chunk-3wjy1cpr.js → chunk-27ppq985.js} +7 -9
- package/dist/{chunk-rck3g0jk.js → chunk-28a1ffp7.js} +55 -52
- package/dist/{chunk-kyvg0zcc.js → chunk-2ag1bjqx.js} +4 -4
- package/dist/{chunk-fsrg55vw.js → chunk-2cz1rwf3.js} +21 -20
- package/dist/{chunk-v1chtgnf.js → chunk-2m6jk78c.js} +1 -1
- package/dist/{chunk-nt5vedsr.js → chunk-2mhgyhns.js} +1 -1
- package/dist/{chunk-n5pe3jtt.js → chunk-2pjptqfa.js} +2 -2
- package/dist/{chunk-ptxwtjpj.js → chunk-2qfb22ax.js} +15 -15
- package/dist/{chunk-j5pcp6j1.js → chunk-2rcaw0yh.js} +4 -4
- package/dist/{chunk-ewb2cm8z.js → chunk-2rtngpm1.js} +8 -10
- package/dist/{chunk-6k1w8x4k.js → chunk-2tzmvvew.js} +56 -53
- package/dist/{chunk-fezbtqkp.js → chunk-2xrp0wp0.js} +66 -64
- package/dist/{chunk-mqqg7cf6.js → chunk-313nbvgt.js} +5 -5
- package/dist/chunk-3e2a6c4k.js +33 -0
- package/dist/{chunk-bx6g17ek.js → chunk-3fnhdnj6.js} +21 -20
- package/dist/{chunk-4nf1ec4f.js → chunk-3g6kvmg4.js} +6 -8
- package/dist/{chunk-vqrph16d.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-w64rnehj.js → chunk-3yzyedet.js} +22 -21
- package/dist/{chunk-xqf27kff.js → chunk-40w1c21c.js} +54 -51
- package/dist/{chunk-y0fvv8rp.js → chunk-4brmjvph.js} +4 -4
- package/dist/{chunk-hz4cc1fy.js → chunk-4er46edn.js} +65 -137
- package/dist/{chunk-cyxsqapw.js → chunk-4h9ek408.js} +7 -9
- package/dist/chunk-4mdqm8b7.js +115 -0
- package/dist/{chunk-cqndxy46.js → chunk-4qjh89qr.js} +1 -1
- package/dist/chunk-506gq3zq.js +104 -0
- package/dist/{chunk-enzrrdn4.js → chunk-5158j5ph.js} +8 -10
- package/dist/{chunk-nrgyjw8e.js → chunk-524xgs6r.js} +7 -7
- package/dist/{chunk-34vnwd0v.js → chunk-52rnpp5t.js} +16 -18
- package/dist/{chunk-y81y5v3d.js → chunk-54bwa086.js} +57 -53
- package/dist/{chunk-7w2h14a6.js → chunk-5famfv4a.js} +22 -21
- package/dist/{chunk-kmgp6prw.js → chunk-5khwvj1z.js} +112 -5
- package/dist/{chunk-zhq7vk2g.js → chunk-5m7095hq.js} +24 -24
- package/dist/{chunk-nskrydpn.js → chunk-5mv51kkx.js} +55 -52
- package/dist/{chunk-9gpr8jae.js → chunk-5vqwq0f9.js} +55 -52
- package/dist/{chunk-s26mv9yh.js → chunk-5zbp0a48.js} +7 -8
- package/dist/{chunk-a27gcyws.js → chunk-60xm3v9r.js} +3 -3
- package/dist/chunk-6356tyx5.js +32 -0
- package/dist/{chunk-mcwdvkc5.js → chunk-66s9m31j.js} +22 -21
- package/dist/{chunk-mg88phh5.js → chunk-6ebb5ym0.js} +54 -51
- package/dist/{chunk-29p0hjfs.js → chunk-6f0296p8.js} +5 -7
- package/dist/{chunk-d6ecf8f1.js → chunk-6gftrxn5.js} +83 -78
- package/dist/{chunk-erjs2wr4.js → chunk-6h1reb8m.js} +21 -20
- package/dist/{chunk-fy6tp8zj.js → chunk-6pb9n4m3.js} +2 -2
- package/dist/{chunk-ardzdtan.js → chunk-6y2wszkc.js} +1 -1
- package/dist/{chunk-g3t3tpmr.js → chunk-6y8e5c85.js} +23 -21
- package/dist/{chunk-crvsdcfv.js → chunk-718k4vsj.js} +58 -56
- package/dist/{chunk-5hjsrynt.js → chunk-72091jsk.js} +1 -1
- package/dist/{chunk-00b2znqm.js → chunk-760hjt0a.js} +3 -3
- package/dist/chunk-77dnrj5q.js +119 -0
- package/dist/{chunk-gfc6zk7q.js → chunk-77w9ffyy.js} +5 -5
- package/dist/{chunk-xaw4scep.js → chunk-78009jh9.js} +2 -2
- package/dist/{chunk-qbmbmhef.js → chunk-79vh2q13.js} +54 -51
- package/dist/{chunk-swjmy1ec.js → chunk-7ba2qns8.js} +21 -20
- package/dist/{chunk-p88crc0s.js → chunk-7dy65axk.js} +21 -20
- package/dist/{chunk-erxndz83.js → chunk-7kfps7yt.js} +7 -9
- package/dist/{chunk-g9t81ym4.js → chunk-7r3d9nyj.js} +55 -52
- package/dist/{chunk-9je35yst.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-cyjjqcs3.js → chunk-86jhenxk.js} +62 -53
- package/dist/{chunk-s7gt9pbp.js → chunk-88mfsn97.js} +55 -52
- package/dist/{chunk-beq5rrj7.js → chunk-8gs07wbw.js} +18 -18
- package/dist/{chunk-3gww1j1y.js → chunk-8h4gpg9r.js} +73 -113
- package/dist/{chunk-brnc96x6.js → chunk-8h7bg6q9.js} +203 -24
- package/dist/chunk-8mspr5sg.js +47 -0
- package/dist/{chunk-8833n19q.js → chunk-8pskaz4y.js} +9 -11
- package/dist/{chunk-akkp39da.js → chunk-8xbwczap.js} +54 -51
- package/dist/{chunk-4krsdy3p.js → chunk-8xsjtkh4.js} +4 -4
- package/dist/{chunk-90vttb3v.js → chunk-8y0ghcs4.js} +65 -62
- package/dist/chunk-8zzqydag.js +101 -0
- package/dist/{chunk-ccb92crb.js → chunk-924n94wb.js} +21 -20
- package/dist/{chunk-0asd58w2.js → chunk-92p2k7yk.js} +11 -11
- package/dist/{chunk-3gtk4mh3.js → chunk-93cd0z7w.js} +62 -60
- package/dist/{chunk-0kp39at8.js → chunk-97svwq59.js} +69 -67
- package/dist/{chunk-adjan1zm.js → chunk-99cjjht1.js} +56 -54
- package/dist/{chunk-pedmqmrf.js → chunk-9awawyvh.js} +6 -6
- package/dist/{chunk-ns11b23b.js → chunk-9b6wqcyk.js} +56 -53
- package/dist/{chunk-vjvstd86.js → chunk-9datyj43.js} +2 -2
- package/dist/{chunk-n1pa72ns.js → chunk-9qh5f9r3.js} +7 -12
- package/dist/{chunk-v7vav1dg.js → chunk-9revwk5g.js} +55 -52
- package/dist/{chunk-5yd55bg7.js → chunk-a0m994d6.js} +54 -51
- package/dist/{chunk-5526qw2k.js → chunk-a0qhdfct.js} +49 -160
- package/dist/{chunk-z6gvvfmf.js → chunk-a5w8nyhg.js} +2 -2
- package/dist/{chunk-etg0he8j.js → chunk-a85wqwq4.js} +54 -51
- package/dist/{chunk-6ad36q0w.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-smskbnfh.js → chunk-admwpsa6.js} +10 -14
- package/dist/{chunk-djp9rrcq.js → chunk-ahexmj4s.js} +24 -26
- package/dist/{chunk-g5w87dmr.js → chunk-att0rknb.js} +2 -2
- package/dist/{chunk-prgsmrmy.js → chunk-axenqvc8.js} +2 -2
- package/dist/{chunk-157v5wtn.js → chunk-azq1qstz.js} +10 -14
- package/dist/{chunk-q6d7rjw1.js → chunk-b125aa22.js} +55 -53
- package/dist/{chunk-hhx05ny2.js → chunk-b4wfv4fx.js} +69 -67
- package/dist/{chunk-ns3babbs.js → chunk-b5wxetbv.js} +224 -1
- package/dist/chunk-b62vj92a.js +94 -0
- package/dist/{chunk-vcv8kqah.js → chunk-b6drr9se.js} +59 -57
- package/dist/chunk-b7kfr260.js +168 -0
- package/dist/chunk-b9pqgq8z.js +37 -0
- package/dist/{chunk-3c0rxf7q.js → chunk-bevwqet9.js} +62 -60
- package/dist/{chunk-jz86pz25.js → chunk-bgf5zvvv.js} +88 -86
- package/dist/{chunk-607fe07t.js → chunk-bq8zdg7m.js} +54 -51
- package/dist/{chunk-386z9vh4.js → chunk-bww2h6d4.js} +56 -53
- package/dist/{chunk-8j0cag62.js → chunk-bx165r58.js} +1 -1
- package/dist/{chunk-mmc59v16.js → chunk-c092k38b.js} +3335 -1687
- package/dist/{chunk-t76a178c.js → chunk-c0avjkfn.js} +54 -51
- package/dist/{chunk-d92pjy0h.js → chunk-c3s22pgw.js} +57 -54
- package/dist/{chunk-8favkbxx.js → chunk-c4g5qaey.js} +5 -5
- package/dist/{chunk-ap1ykep6.js → chunk-c6nthjxa.js} +6 -4
- package/dist/{chunk-m77e1esy.js → chunk-c7d1acex.js} +5 -7
- package/dist/{chunk-wmbpegg3.js → chunk-c7t69jmn.js} +1 -1
- package/dist/{chunk-c1jzx2gv.js → chunk-cg3bb5pe.js} +9 -9
- package/dist/{chunk-m8v1x99r.js → chunk-chzfw06n.js} +3 -5
- package/dist/{chunk-cr6s4vp6.js → chunk-cm2xfg7q.js} +13 -15
- package/dist/{chunk-sfs23jb0.js → chunk-crj9bjh5.js} +54 -51
- package/dist/{chunk-v4nrk2f9.js → chunk-cstkqpd5.js} +7 -8
- package/dist/{chunk-cd6mvmte.js → chunk-ctj2ehwz.js} +55 -52
- package/dist/{chunk-29yjrfeq.js → chunk-cwwfyvbq.js} +6 -4
- package/dist/{chunk-jver0cay.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-ndgnv15y.js → chunk-d2q17m4k.js} +56 -54
- package/dist/{chunk-r8cbwyz2.js → chunk-d2wzkwws.js} +65 -62
- package/dist/{chunk-x4t0n8t3.js → chunk-d4qdesrx.js} +3 -4
- package/dist/{chunk-v47r6dev.js → chunk-d4zyytan.js} +57 -54
- package/dist/{chunk-2j4wdmkt.js → chunk-d57t992t.js} +9 -96
- package/dist/{chunk-688ah6p4.js → chunk-dafnbqhh.js} +72 -70
- package/dist/{chunk-tjbjxrqz.js → chunk-dfcm57ek.js} +6 -6
- package/dist/{chunk-p78dmmrg.js → chunk-dgnwk906.js} +56 -54
- package/dist/{chunk-agabmbjf.js → chunk-dhwpmz98.js} +57 -54
- package/dist/{chunk-w5f4g9ty.js → chunk-djzvjzdg.js} +3 -3
- package/dist/chunk-dm5e2sj0.js +187 -0
- package/dist/{chunk-7cfbwd7q.js → chunk-dnpy3zcs.js} +59 -56
- package/dist/{chunk-2eb66dha.js → chunk-drvfxfe5.js} +25 -24
- package/dist/{chunk-s95y1wsx.js → chunk-dv4dsh0t.js} +7 -7
- package/dist/{chunk-mfmqxvy3.js → chunk-dyp88vca.js} +60 -58
- package/dist/{chunk-4drmj637.js → chunk-dytg8n15.js} +12 -12
- package/dist/{chunk-zda436nm.js → chunk-e1bt4m2g.js} +2 -2
- package/dist/{chunk-mh9bbz4s.js → chunk-e23snepr.js} +3 -3
- package/dist/{chunk-xe4dvfz2.js → chunk-e6sqr0av.js} +54 -51
- package/dist/{chunk-79wycw4g.js → chunk-e9eyqwk5.js} +399 -279
- package/dist/{chunk-2wvxqpfc.js → chunk-efkjha6m.js} +8 -9
- package/dist/{chunk-vvsc8651.js → chunk-ekpm458a.js} +63 -61
- package/dist/{chunk-vf3etxnx.js → chunk-emxnq07z.js} +1 -1
- package/dist/{chunk-a5b9swcd.js → chunk-erkssp71.js} +54 -51
- package/dist/{chunk-ajs8dza3.js → chunk-es08rrda.js} +54 -51
- package/dist/{chunk-zh7z8zmq.js → chunk-ewxpkqxt.js} +8 -8
- package/dist/{chunk-e5mw3cyw.js → chunk-f25pnrvx.js} +4 -6
- package/dist/chunk-f2y3t9hh.js +295 -0
- package/dist/{chunk-0n0r9fwa.js → chunk-f31b63fd.js} +1 -1
- package/dist/{chunk-2dsqf7sp.js → chunk-f57cvf1d.js} +1 -1
- package/dist/{chunk-w8hh0w92.js → chunk-f872fekv.js} +54 -51
- package/dist/{chunk-s0c72pgz.js → chunk-faey4sqw.js} +55 -52
- package/dist/{chunk-p9rdn455.js → chunk-fbbjchdz.js} +56 -54
- package/dist/{chunk-7hftfbxa.js → chunk-fbedkst6.js} +6 -8
- package/dist/{chunk-9msn8xwq.js → chunk-fckykghd.js} +2 -3
- package/dist/{chunk-v3kfrhgg.js → chunk-fdbvcs34.js} +7 -9
- package/dist/{chunk-ypgs2acw.js → chunk-ffpz33kr.js} +22 -21
- package/dist/{chunk-xsevshsa.js → chunk-ffvja87d.js} +8 -10
- package/dist/{chunk-2mbctja8.js → chunk-fjpdtr6s.js} +9 -9
- package/dist/{chunk-9tgts6mc.js → chunk-fnpd8cnq.js} +1 -1
- package/dist/{chunk-x7jtxq14.js → chunk-fxpsa506.js} +3 -5
- package/dist/{chunk-86epd45z.js → chunk-fxrrsvnw.js} +23 -27
- package/dist/chunk-fz4wmnm6.js +157 -0
- package/dist/{chunk-9qbwahdr.js → chunk-g3dbfhxa.js} +4 -6
- package/dist/{chunk-77dn0tk8.js → chunk-g86dg6h5.js} +5 -5
- package/dist/{chunk-v9bnkmpp.js → chunk-gc4x22mt.js} +55 -52
- package/dist/{chunk-hcwq2bw3.js → chunk-gfxebcsw.js} +27 -27
- package/dist/chunk-ghbtnfr2.js +117 -0
- package/dist/{chunk-8cn35yvf.js → chunk-gqftywrx.js} +22 -21
- package/dist/{chunk-c4y7537k.js → chunk-gwrngewt.js} +3 -3
- package/dist/{chunk-ns09xpt7.js → chunk-gxfbedta.js} +1 -1
- package/dist/{chunk-fq1j9zm0.js → chunk-gybj15eh.js} +2 -3
- package/dist/{chunk-tr91zear.js → chunk-h0vzd5vg.js} +15 -15
- package/dist/{chunk-rfnh6gdw.js → chunk-h14dkna4.js} +22 -21
- package/dist/{chunk-jhbtp60e.js → chunk-h26xfh6d.js} +21 -20
- package/dist/{chunk-amyrs3hm.js → chunk-h2vfn30x.js} +4 -4
- package/dist/{chunk-3fjgkntc.js → chunk-h37gar4j.js} +1 -1
- package/dist/{chunk-n4by7yk8.js → chunk-h4k9kgjw.js} +55 -52
- package/dist/{chunk-hy2yy9dj.js → chunk-hc1tkwfn.js} +3 -5
- package/dist/{chunk-cj8t81dc.js → chunk-hf086e2e.js} +54 -51
- package/dist/{chunk-gyzh9997.js → chunk-hhwqk5as.js} +54 -51
- package/dist/{chunk-3ef0cpf6.js → chunk-hjw03d0k.js} +56 -54
- package/dist/{chunk-dtv3phgm.js → chunk-hkh1vbm6.js} +54 -51
- package/dist/{chunk-81dq52pk.js → chunk-hnxmafvc.js} +2 -2
- package/dist/{chunk-cj8m3h8r.js → chunk-hqpzpr71.js} +2 -2
- package/dist/{chunk-qkwmefpm.js → chunk-hrz2d28r.js} +58 -56
- 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-deatxv64.js → chunk-hyz9tx05.js} +15 -17
- package/dist/{chunk-b2vzxkee.js → chunk-j34h8cfj.js} +22 -21
- package/dist/{chunk-w74twxev.js → chunk-j5w0b4d2.js} +22 -21
- package/dist/{chunk-z6q66vf8.js → chunk-j66ragf9.js} +1 -1
- package/dist/chunk-j7b884wk.js +397 -0
- package/dist/{chunk-z9f8mvd1.js → chunk-ja21qbpj.js} +61 -58
- package/dist/{chunk-fsqp1hdd.js → chunk-ja3eb4h9.js} +2 -2
- package/dist/{chunk-4f4jqsza.js → chunk-jac470kz.js} +1 -1
- package/dist/{chunk-x3p67k4j.js → chunk-jaqtnpbt.js} +2 -2
- package/dist/{chunk-yg0h97bm.js → chunk-jc5dtv57.js} +56 -54
- package/dist/{chunk-pzxksam8.js → chunk-jda4vjad.js} +54 -51
- package/dist/{chunk-drnxbc1w.js → chunk-jeqt4y47.js} +2 -2
- package/dist/{chunk-vq51wj3f.js → chunk-jga4j8jp.js} +55 -53
- package/dist/{chunk-q7e35wkk.js → chunk-jge10dbd.js} +4 -6
- package/dist/{chunk-2c4003f8.js → chunk-jhbj5mnf.js} +54 -51
- package/dist/{chunk-6b45etp0.js → chunk-jje04m6z.js} +2 -2
- package/dist/{chunk-5wzcv9gh.js → chunk-jnfd01as.js} +9 -11
- package/dist/chunk-jpbkdg47.js +131 -0
- package/dist/{chunk-1j332jvg.js → chunk-jwb3bqa7.js} +26 -30
- package/dist/{chunk-fjh0vhqw.js → chunk-jy4dnnjk.js} +5 -5
- package/dist/{chunk-zjhz0qyc.js → chunk-k27dq4vd.js} +56 -53
- package/dist/{chunk-jjcks6sw.js → chunk-k81zec2p.js} +1 -1
- package/dist/{chunk-fxqp3yt4.js → chunk-kb2b4rkg.js} +4 -5
- package/dist/{chunk-43b84za2.js → chunk-kbsckx2r.js} +3 -3
- package/dist/{chunk-6wpr3tjc.js → chunk-kvezjrjy.js} +54 -51
- package/dist/{chunk-2smwf3e9.js → chunk-kw2ymvyv.js} +6 -8
- package/dist/{chunk-1neq14g8.js → chunk-kymh4vxw.js} +54 -51
- package/dist/{chunk-0rbezx7s.js → chunk-kz3q1ce0.js} +54 -51
- package/dist/chunk-m089kb0s.js +312 -0
- package/dist/{chunk-0qe6jzfm.js → chunk-m1efbjqe.js} +54 -51
- package/dist/chunk-m1xw79dd.js +1757 -0
- package/dist/{chunk-2x5az5dc.js → chunk-m365zhp8.js} +55 -52
- package/dist/{chunk-ytwnb2km.js → chunk-m97dyxn0.js} +57 -56
- package/dist/{chunk-e4jqbn4d.js → chunk-m9w972ny.js} +2 -4
- package/dist/{chunk-eserktyd.js → chunk-mb93ek5j.js} +4 -6
- package/dist/{chunk-t5vfbd78.js → chunk-mgjc0yj9.js} +55 -53
- package/dist/{chunk-50xwa16q.js → chunk-mh2pdxpc.js} +56 -54
- package/dist/{chunk-hnx0eg6x.js → chunk-mkae8zj9.js} +3 -3
- package/dist/{chunk-7750n93j.js → chunk-mmq55gyp.js} +4 -4
- package/dist/{chunk-cdqf4qst.js → chunk-ndrn50x0.js} +55 -53
- package/dist/{chunk-mt10f1tp.js → chunk-ng2xq7ey.js} +3 -3
- package/dist/{chunk-vdv5g7q5.js → chunk-nsbpzpmf.js} +57 -55
- package/dist/{chunk-5xjn56aq.js → chunk-nz7sgbbr.js} +5 -5
- package/dist/{chunk-5840qkdv.js → chunk-nzfwsrd7.js} +3 -3
- package/dist/{chunk-nzrgdzqp.js → chunk-p3zbzfbn.js} +3 -3
- package/dist/{chunk-25yy8wx5.js → chunk-p5jssxha.js} +23 -23
- package/dist/{chunk-4581z0wr.js → chunk-p7es39d1.js} +46 -121
- package/dist/{chunk-qwj4n799.js → chunk-p7pj6wf8.js} +1 -1
- package/dist/{chunk-qqfr3g23.js → chunk-p9f12fp9.js} +56 -53
- package/dist/chunk-pb73zgyd.js +55 -0
- package/dist/chunk-prpjmapz.js +117 -0
- package/dist/{chunk-gc91es60.js → chunk-ps01q3n9.js} +60 -59
- package/dist/{chunk-k5kw9hyy.js → chunk-q19p9j0v.js} +5 -5
- package/dist/{chunk-wm9c1620.js → chunk-q7e12ymw.js} +4 -4
- package/dist/{chunk-4169yf5x.js → chunk-qgajfxr7.js} +7 -7
- package/dist/{chunk-53vj9v9s.js → chunk-qgnsf30p.js} +23 -22
- package/dist/{chunk-b0x349dj.js → chunk-qs2atqgy.js} +56 -54
- package/dist/chunk-r469z4mx.js +183 -0
- package/dist/chunk-r5mqktt5.js +100 -0
- package/dist/chunk-r854e43q.js +25 -0
- package/dist/{chunk-4f5xrg8h.js → chunk-rbgr86hh.js} +55 -53
- package/dist/{chunk-m08081ys.js → chunk-rbvawtdz.js} +55 -52
- package/dist/chunk-rce8gj2b.js +93 -0
- package/dist/{chunk-t0twk3e5.js → chunk-rd2884ff.js} +1 -1
- package/dist/{chunk-qxy16bqn.js → chunk-reqz49y3.js} +310 -186
- package/dist/{chunk-xayw54gs.js → chunk-rhjb0dgd.js} +23 -22
- package/dist/{chunk-ptpynwv2.js → chunk-rq1nfp7x.js} +56 -54
- package/dist/{chunk-4m47hfh0.js → chunk-rsr0mksm.js} +57 -55
- package/dist/{chunk-txeekahj.js → chunk-rz3rq0gt.js} +4 -6
- package/dist/{chunk-3ah2pq1f.js → chunk-rz69sqyh.js} +66 -64
- package/dist/{chunk-5km8j211.js → chunk-s2n5kxm0.js} +5 -5
- package/dist/{chunk-3b9ar57s.js → chunk-s39ksgef.js} +4 -6
- package/dist/{chunk-vmb323h1.js → chunk-s70z817q.js} +199 -198
- package/dist/{chunk-6yahjmr9.js → chunk-se153zng.js} +1 -1
- package/dist/chunk-spqq5qf1.js +116 -0
- package/dist/{chunk-pc4szfak.js → chunk-srnstx2s.js} +22 -21
- package/dist/{chunk-s9nr589x.js → chunk-sv7afh51.js} +6 -8
- package/dist/{chunk-ts2892h4.js → chunk-swzfr1f5.js} +23 -22
- package/dist/{chunk-2apay7a3.js → chunk-t2822cex.js} +59 -56
- package/dist/{chunk-tgav5bz9.js → chunk-t2re5hhc.js} +121 -116
- package/dist/{chunk-m007chff.js → chunk-t7e9etws.js} +23 -25
- package/dist/{chunk-xmretc2b.js → chunk-tnx1zk9t.js} +58 -55
- package/dist/{chunk-ne7y2xb5.js → chunk-tw24rz1x.js} +11 -13
- package/dist/{chunk-r8m19xnp.js → chunk-v038k0we.js} +4 -6
- package/dist/{chunk-8n7czf03.js → chunk-v2qqkqxp.js} +55 -52
- package/dist/{chunk-fjne3x6c.js → chunk-v4qke3cz.js} +8 -8
- package/dist/{chunk-1zjrec16.js → chunk-v6p3019x.js} +23 -22
- package/dist/{chunk-egwqdd9k.js → chunk-vatz6gan.js} +25 -27
- package/dist/chunk-vfmx405p.js +14 -0
- package/dist/{chunk-xjcmfp13.js → chunk-vnn4x6jw.js} +58 -55
- package/dist/{chunk-fbs21kq9.js → chunk-vpe2s4eq.js} +7 -9
- package/dist/{chunk-2t5ve6ev.js → chunk-vsbyhpfy.js} +1 -1
- package/dist/{chunk-rywnz223.js → chunk-w0pf4mvz.js} +12 -16
- package/dist/chunk-w5j0dhpp.js +14 -0
- package/dist/{chunk-zkv7atzf.js → chunk-w7zp9j8v.js} +69 -67
- package/dist/{chunk-d2vb6m9e.js → chunk-wd8mqz95.js} +3 -5
- package/dist/chunk-wj0c0zfa.js +36 -0
- package/dist/{chunk-1e8f0nx0.js → chunk-wqdr8v9x.js} +54 -51
- package/dist/{chunk-vpp13z80.js → chunk-wxa2hdfg.js} +2 -2
- package/dist/{chunk-wh42d494.js → chunk-wy3f5b81.js} +55 -52
- package/dist/{chunk-5dn1m1r7.js → chunk-x0ym1db4.js} +2 -4
- package/dist/{chunk-y315v6st.js → chunk-x1t80e36.js} +38 -38
- package/dist/{chunk-x0qzkte0.js → chunk-x63c39tp.js} +5 -7
- package/dist/{chunk-8fwh1vg6.js → chunk-x6622cb2.js} +22 -21
- package/dist/{chunk-wcxc5m91.js → chunk-x95fhbwq.js} +1 -1
- package/dist/{chunk-4vjvqns0.js → chunk-x9gbnheg.js} +8 -10
- package/dist/{chunk-mhd4n6av.js → chunk-xahpt5e2.js} +3 -5
- package/dist/{chunk-6sqsx9jy.js → chunk-xct1m4sf.js} +22 -21
- 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-s4erjnky.js → chunk-xk1wdwxq.js} +56 -53
- package/dist/{chunk-bv1k9d6v.js → chunk-xpj4qca4.js} +54 -51
- package/dist/{chunk-h6wkvzrd.js → chunk-xqk8srdh.js} +6 -8
- package/dist/{chunk-39zy97qa.js → chunk-xsc3ccj0.js} +3 -3
- package/dist/{chunk-qpprdv6x.js → chunk-xwc8e4yv.js} +2 -2
- package/dist/{chunk-vchfbqh0.js → chunk-xxmxv448.js} +8 -9
- package/dist/{chunk-gra7rch0.js → chunk-xz7cf7fa.js} +65 -62
- package/dist/{chunk-h65cdcmj.js → chunk-y3qdyf8r.js} +27 -26
- package/dist/{chunk-j5eb93j4.js → chunk-y48wfwm4.js} +1 -517
- package/dist/{chunk-p2pgnk1y.js → chunk-y7vzcjyn.js} +56 -54
- package/dist/chunk-yb03gvd8.js +271 -0
- package/dist/chunk-yem3ge7z.js +182 -0
- package/dist/{chunk-7p1esgzf.js → chunk-yf5qwpnp.js} +3 -3
- package/dist/{chunk-vjbm6e89.js → chunk-yrnbgtk0.js} +25 -24
- package/dist/{chunk-pp11ggs7.js → chunk-yrs92qya.js} +5 -7
- package/dist/{chunk-sjr9vygr.js → chunk-ys6cza46.js} +7 -9
- package/dist/{chunk-45bbgebk.js → chunk-yvgmpc5z.js} +5 -5
- package/dist/{chunk-v88g6btg.js → chunk-yxr0yf6h.js} +4 -4
- package/dist/{chunk-e6rrn2tj.js → chunk-yyc1yvnr.js} +55 -53
- package/dist/{chunk-edz2xqmx.js → chunk-z0vk43bt.js} +65 -62
- package/dist/{chunk-zrrd9egx.js → chunk-z1seyvya.js} +55 -52
- package/dist/{chunk-rejx7z4t.js → chunk-z6hqga26.js} +3 -4
- package/dist/{chunk-d3paf9v2.js → chunk-z7hv619f.js} +54 -51
- package/dist/{chunk-ew9re4pd.js → chunk-zb0mctxm.js} +6 -6
- package/dist/{chunk-zddcrj90.js → chunk-zhyc7npp.js} +54 -51
- package/dist/{chunk-ysdxmhpv.js → chunk-zvegtrc4.js} +59 -56
- package/dist/{chunk-evww0yyb.js → chunk-zwsrj2yy.js} +9 -11
- package/dist/cli.js +53 -23
- package/package.json +4 -2
- package/dist/chunk-0731m51q.js +0 -8
- package/dist/chunk-0ctfznp2.js +0 -176
- package/dist/chunk-2fwze72g.js +0 -24
- package/dist/chunk-3ev51j3h.js +0 -117
- package/dist/chunk-4vj2d7dz.js +0 -116
- package/dist/chunk-6cqap182.js +0 -113
- package/dist/chunk-74v2mh4t.js +0 -40
- package/dist/chunk-75fdprgp.js +0 -254
- package/dist/chunk-9fsvmcz5.js +0 -112
- package/dist/chunk-azksrewr.js +0 -113
- package/dist/chunk-fve53rbk.js +0 -22
- package/dist/chunk-mz2rbmwe.js +0 -114
- package/dist/chunk-npf5eh3g.js +0 -8
- package/dist/chunk-ppwjyveh.js +0 -8
- package/dist/chunk-r1gkg1zh.js +0 -114
- package/dist/chunk-vxnvzfnv.js +0 -233
- package/dist/chunk-w5b8wpff.js +0 -1026
- package/dist/chunk-x6r4v44b.js +0 -8
- package/dist/chunk-y2x0t2gb.js +0 -116
package/dist/chunk-w5b8wpff.js
DELETED
|
@@ -1,1026 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
init_SSETransport,
|
|
4
|
-
parseSSEFrames
|
|
5
|
-
} from "./chunk-0w8eb8gt.js";
|
|
6
|
-
import {
|
|
7
|
-
createAssistantAPIErrorMessage,
|
|
8
|
-
init_api,
|
|
9
|
-
init_messages1 as init_messages,
|
|
10
|
-
normalizeContentFromAPI,
|
|
11
|
-
normalizeMessagesForAPI,
|
|
12
|
-
toolToAPISchema
|
|
13
|
-
} from "./chunk-mmc59v16.js";
|
|
14
|
-
import"./chunk-qe3qr56q.js";
|
|
15
|
-
import"./chunk-75fdprgp.js";
|
|
16
|
-
import"./chunk-x0qzkte0.js";
|
|
17
|
-
import"./chunk-et824jj8.js";
|
|
18
|
-
import"./chunk-43b84za2.js";
|
|
19
|
-
import"./chunk-var1et7e.js";
|
|
20
|
-
import"./chunk-jjcks6sw.js";
|
|
21
|
-
import"./chunk-2gzv8nrw.js";
|
|
22
|
-
import"./chunk-ehtwnxpg.js";
|
|
23
|
-
import"./chunk-z6gvvfmf.js";
|
|
24
|
-
import"./chunk-5km8j211.js";
|
|
25
|
-
import"./chunk-2f6hs25r.js";
|
|
26
|
-
import"./chunk-8833n19q.js";
|
|
27
|
-
import"./chunk-vjvstd86.js";
|
|
28
|
-
import"./chunk-cgfdkzhb.js";
|
|
29
|
-
import"./chunk-s9nr589x.js";
|
|
30
|
-
import"./chunk-4169yf5x.js";
|
|
31
|
-
import"./chunk-zttmdag3.js";
|
|
32
|
-
import"./chunk-5526qw2k.js";
|
|
33
|
-
import"./chunk-4f4jqsza.js";
|
|
34
|
-
import"./chunk-m8v1x99r.js";
|
|
35
|
-
import"./chunk-t0twk3e5.js";
|
|
36
|
-
import"./chunk-ps49ymvj.js";
|
|
37
|
-
import"./chunk-t4kcvmes.js";
|
|
38
|
-
import"./chunk-3fjgkntc.js";
|
|
39
|
-
import"./chunk-5wb5ym2h.js";
|
|
40
|
-
import"./chunk-9tgts6mc.js";
|
|
41
|
-
import"./chunk-vpp13z80.js";
|
|
42
|
-
import"./chunk-4jm600zv.js";
|
|
43
|
-
import"./chunk-2dsqf7sp.js";
|
|
44
|
-
import"./chunk-v3kfrhgg.js";
|
|
45
|
-
import"./chunk-rkmwx1yz.js";
|
|
46
|
-
import"./chunk-mhd4n6av.js";
|
|
47
|
-
import"./chunk-ykr5qx9v.js";
|
|
48
|
-
import"./chunk-77dn0tk8.js";
|
|
49
|
-
import"./chunk-nt5vedsr.js";
|
|
50
|
-
import"./chunk-yatby2yh.js";
|
|
51
|
-
import"./chunk-erxndz83.js";
|
|
52
|
-
import"./chunk-j50zvssc.js";
|
|
53
|
-
import"./chunk-wcxc5m91.js";
|
|
54
|
-
import"./chunk-4581z0wr.js";
|
|
55
|
-
import {
|
|
56
|
-
init_json,
|
|
57
|
-
safeParseJSON
|
|
58
|
-
} from "./chunk-hnx0eg6x.js";
|
|
59
|
-
import"./chunk-2j4wdmkt.js";
|
|
60
|
-
import {
|
|
61
|
-
getProxyFetchOptions,
|
|
62
|
-
init_proxy
|
|
63
|
-
} from "./chunk-j06y02aw.js";
|
|
64
|
-
import"./chunk-zwarn9h7.js";
|
|
65
|
-
import"./chunk-6kpbgc5w.js";
|
|
66
|
-
import"./chunk-7hmy36fh.js";
|
|
67
|
-
import"./chunk-64c1avct.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
|
-
};
|