@caspian2026/agent-sdk 0.0.8 → 0.0.11

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.
Files changed (312) hide show
  1. package/dist/{chunk-dtgh4te6.js → chunk-0ac6r0fw.js} +46 -45
  2. package/dist/{chunk-cfgha78n.js → chunk-0dm971mw.js} +2 -2
  3. package/dist/{chunk-0mej3p7q.js → chunk-0f5anjkb.js} +14 -14
  4. package/dist/{chunk-6g5qbbxk.js → chunk-0k9sft0s.js} +47 -46
  5. package/dist/chunk-0kgwksm1.js +57 -0
  6. package/dist/chunk-0vp3wfab.js +12 -0
  7. package/dist/{chunk-d9yghsfg.js → chunk-1etzkkxs.js} +1 -1
  8. package/dist/{chunk-a4npwxvb.js → chunk-1gz2wrhq.js} +46 -45
  9. package/dist/{chunk-25bwa70y.js → chunk-1pr4hr5x.js} +49 -48
  10. package/dist/{chunk-2f21meep.js → chunk-1v01c96r.js} +1 -1
  11. package/dist/{chunk-jvmybb06.js → chunk-1vhjn1j9.js} +46 -45
  12. package/dist/{chunk-69r3hm9b.js → chunk-1wr6ag3j.js} +13 -19
  13. package/dist/{chunk-83e71kz6.js → chunk-2072dpbx.js} +2 -2
  14. package/dist/{chunk-8hpq2659.js → chunk-24t2wjab.js} +1 -1
  15. package/dist/{chunk-q7e0106d.js → chunk-2589k4k0.js} +51 -56
  16. package/dist/{chunk-d7886r6a.js → chunk-26wtxbdc.js} +7774 -7774
  17. package/dist/{chunk-ahrhwpm9.js → chunk-28k13wc7.js} +2 -2
  18. package/dist/{chunk-vvjgdzhn.js → chunk-2cr43hzw.js} +55 -51
  19. package/dist/{chunk-mw1kpeg9.js → chunk-2sqhjnpn.js} +1909 -1377
  20. package/dist/chunk-2tfe2zs1.js +87 -0
  21. package/dist/{chunk-c11swzas.js → chunk-2vteceqh.js} +5 -5
  22. package/dist/{chunk-zmra45az.js → chunk-2z9rak9s.js} +47 -46
  23. package/dist/chunk-31bwdrm5.js +93 -0
  24. package/dist/{chunk-2xbyb015.js → chunk-38rkx4cj.js} +47 -46
  25. package/dist/{chunk-am3qcgzp.js → chunk-394djs3v.js} +56 -55
  26. package/dist/{chunk-15m49c67.js → chunk-3e28fvn0.js} +2 -2
  27. package/dist/{chunk-4hv90qcz.js → chunk-3mgywd32.js} +1 -1
  28. package/dist/{chunk-234668cb.js → chunk-3we6j8b4.js} +5 -5
  29. package/dist/{chunk-7rnqsng2.js → chunk-400r5gmq.js} +19 -19
  30. package/dist/{chunk-yc23zxmj.js → chunk-4057dtxd.js} +1 -1
  31. package/dist/{chunk-70eey1nh.js → chunk-40s88wdg.js} +2 -2
  32. package/dist/{chunk-8nfn89nz.js → chunk-41en0cc6.js} +9 -9
  33. package/dist/{chunk-t5vbqd9d.js → chunk-488spx13.js} +55 -54
  34. package/dist/{chunk-9v13f3gm.js → chunk-49bs7x5p.js} +558 -196
  35. package/dist/{chunk-0awwmrwr.js → chunk-4ayjwyqj.js} +2 -2
  36. package/dist/chunk-4d0g9n3q.js +92 -0
  37. package/dist/{chunk-denyma1s.js → chunk-4fh25m1z.js} +14 -12
  38. package/dist/chunk-4hgxxzdw.js +94 -0
  39. package/dist/{chunk-8g747a8x.js → chunk-4pbx3g7s.js} +1 -1
  40. package/dist/{chunk-fkhs3myp.js → chunk-4pj88fnc.js} +5 -3
  41. package/dist/{chunk-st73prx0.js → chunk-4re879ja.js} +47 -46
  42. package/dist/{chunk-pb92bj1h.js → chunk-50art2hr.js} +6 -6
  43. package/dist/{chunk-1nk93fqz.js → chunk-5cxjxxx8.js} +2 -7
  44. package/dist/{chunk-kek5v6ef.js → chunk-5pqq0nym.js} +3 -3
  45. package/dist/{chunk-nk82j7r2.js → chunk-6696fngv.js} +7 -7
  46. package/dist/{chunk-ya40p6vj.js → chunk-66dk94r4.js} +46 -45
  47. package/dist/{chunk-xrpstt41.js → chunk-67808qek.js} +4 -4
  48. package/dist/{chunk-zhk465tg.js → chunk-69841w77.js} +46 -45
  49. package/dist/{chunk-jgzxmtpf.js → chunk-6ebvysef.js} +52 -52
  50. package/dist/{chunk-bmbq6nt1.js → chunk-6wzg2hpc.js} +2 -2
  51. package/dist/{chunk-12k745vf.js → chunk-6zsxtysq.js} +3 -3
  52. package/dist/{chunk-qcnhb4cd.js → chunk-75qqeec8.js} +3 -3
  53. package/dist/{chunk-nvwwtq1w.js → chunk-765zdaq8.js} +49 -48
  54. package/dist/{chunk-zq6ezxh2.js → chunk-7ce8wn1f.js} +49 -45
  55. package/dist/{chunk-e7h4qxgw.js → chunk-7etkb4pr.js} +4 -4
  56. package/dist/{chunk-wha6v7za.js → chunk-7krg0dkt.js} +2 -2
  57. package/dist/{chunk-nqrc7pc4.js → chunk-7p2vw8qe.js} +29 -27
  58. package/dist/{chunk-q1ah9nbq.js → chunk-7t5ymv2m.js} +1 -1
  59. package/dist/{chunk-xz655xxa.js → chunk-7tphrzjj.js} +2 -2
  60. package/dist/{chunk-hzknr99c.js → chunk-83b2frat.js} +4 -4
  61. package/dist/{chunk-bxcfz5gy.js → chunk-87xg6yb4.js} +1 -1
  62. package/dist/{chunk-nrtksr2p.js → chunk-8b2y3x7a.js} +1 -1
  63. package/dist/{chunk-1cq2vrzq.js → chunk-8c907cv9.js} +4 -4
  64. package/dist/{chunk-88cekjja.js → chunk-8dzg4nr5.js} +47 -46
  65. package/dist/{chunk-2fxpd35d.js → chunk-8hn2xqjz.js} +2 -2
  66. package/dist/{chunk-3g1vqhyx.js → chunk-8kmna3cc.js} +17 -21
  67. package/dist/{chunk-1zhy5cbc.js → chunk-8r5eevap.js} +13 -13
  68. package/dist/{chunk-7n51wk9k.js → chunk-8vkv63c5.js} +2 -2
  69. package/dist/{chunk-268jd0rc.js → chunk-8w21adpe.js} +6 -4
  70. package/dist/{chunk-21gmrwhs.js → chunk-8w8d1k7b.js} +17 -21
  71. package/dist/{chunk-yzcjz0gg.js → chunk-90bqyqfd.js} +46 -45
  72. package/dist/{chunk-2xvc97x4.js → chunk-942yq6xx.js} +3 -3
  73. package/dist/{chunk-88xc4d7f.js → chunk-99ck62v1.js} +49 -48
  74. package/dist/chunk-9ewnsd7f.js +31 -0
  75. package/dist/{chunk-xwg327ys.js → chunk-9g29z3dv.js} +6 -6
  76. package/dist/{chunk-5a5w0ygx.js → chunk-9nj016rn.js} +2 -2
  77. package/dist/chunk-9nk34wee.js +441 -0
  78. package/dist/{chunk-2v4x8kaq.js → chunk-9z45660r.js} +51 -50
  79. package/dist/{chunk-s1tg295x.js → chunk-a3gq2vv4.js} +10 -8
  80. package/dist/{chunk-6p4cyhb3.js → chunk-a6d2q415.js} +2 -2
  81. package/dist/{chunk-0jtbeesf.js → chunk-akqsq8bn.js} +16 -20
  82. package/dist/{chunk-tff58196.js → chunk-aqq5qh2y.js} +48 -47
  83. package/dist/{chunk-dvcwahst.js → chunk-awdftfcf.js} +51 -50
  84. package/dist/{chunk-3zxswxtg.js → chunk-b3nkagky.js} +2 -2
  85. package/dist/{chunk-jgjqa49s.js → chunk-b56smerd.js} +3 -3
  86. package/dist/{chunk-enkdxqas.js → chunk-b5asw4tj.js} +6 -6
  87. package/dist/{chunk-1x0y4426.js → chunk-b8f5dz5b.js} +4 -4
  88. package/dist/{chunk-30smv00b.js → chunk-bayvqjm6.js} +47 -46
  89. package/dist/chunk-bgyb0z0p.js +96 -0
  90. package/dist/{chunk-3skj4gfg.js → chunk-bhabqhx1.js} +47 -46
  91. package/dist/{chunk-4140c8xy.js → chunk-bj85dnsy.js} +20 -24
  92. package/dist/{chunk-vdcm8hz6.js → chunk-bp4s0gry.js} +47 -46
  93. package/dist/{chunk-d00mfc1e.js → chunk-brng9f4q.js} +46 -45
  94. package/dist/{chunk-a3ws4gae.js → chunk-bvdzmdw4.js} +47 -46
  95. package/dist/{chunk-m87bhhqv.js → chunk-bzatg35k.js} +1 -1
  96. package/dist/{chunk-hxzt3r84.js → chunk-ca72efeb.js} +51 -50
  97. package/dist/{chunk-vajwapkf.js → chunk-cdact4jj.js} +17 -23
  98. package/dist/{chunk-s3hsqf80.js → chunk-cexw1jmv.js} +30 -81
  99. package/dist/chunk-cfyvkbe5.js +197 -0
  100. package/dist/{chunk-jj5wj46b.js → chunk-cjca0q27.js} +7 -7
  101. package/dist/{chunk-3hwa20vg.js → chunk-cs9aqzag.js} +49 -46
  102. package/dist/{chunk-1ax1znzj.js → chunk-cttezxcb.js} +24 -14
  103. package/dist/chunk-d2g976qe.js +1457 -0
  104. package/dist/{chunk-d6rypdxt.js → chunk-d7ws01qk.js} +1 -1
  105. package/dist/{chunk-xxw9a0bq.js → chunk-dhwr4fz4.js} +2 -2
  106. package/dist/{chunk-x2pvw7xw.js → chunk-dmyedkpw.js} +8 -8
  107. package/dist/{chunk-af868wet.js → chunk-dsqfe05n.js} +46 -45
  108. package/dist/{chunk-4r50c14n.js → chunk-e82vbky2.js} +46 -45
  109. package/dist/{chunk-vawgyev5.js → chunk-eba0b85f.js} +3 -3
  110. package/dist/{chunk-87e209aj.js → chunk-eqnfk1g0.js} +46 -45
  111. package/dist/chunk-erj5nc8b.js +92 -0
  112. package/dist/{chunk-ky39hkg1.js → chunk-eseq7djh.js} +9 -7
  113. package/dist/{chunk-vvsbvz2b.js → chunk-esrkw9v4.js} +2 -2
  114. package/dist/{chunk-jgpmpgx6.js → chunk-etdt1xz3.js} +1 -1
  115. package/dist/{chunk-w05jpkkr.js → chunk-ewbvcf88.js} +5 -9
  116. package/dist/chunk-ewhxddsa.js +445 -0
  117. package/dist/{chunk-jjh7m5sg.js → chunk-ey1pg5v8.js} +66 -77
  118. package/dist/{chunk-h02gcdx5.js → chunk-f1v8h236.js} +8 -8
  119. package/dist/chunk-f70fwxds.js +211 -0
  120. package/dist/{chunk-1dwvgrfc.js → chunk-f73trmvk.js} +46 -45
  121. package/dist/{chunk-xnv6kb39.js → chunk-fcww10dt.js} +22 -23
  122. package/dist/{chunk-15edybe0.js → chunk-fhprmgf4.js} +1 -1
  123. package/dist/{chunk-5awgsvrw.js → chunk-fnf4av18.js} +14 -6
  124. package/dist/{chunk-j4m8fd76.js → chunk-fy543pwf.js} +7 -11
  125. package/dist/chunk-fybanr7d.js +988 -0
  126. package/dist/chunk-g5epkvz2.js +331 -0
  127. package/dist/chunk-g5pe8dew.js +25 -0
  128. package/dist/chunk-g8183rkv.js +517 -0
  129. package/dist/{chunk-4g0nj78p.js → chunk-gbztsm42.js} +46 -45
  130. package/dist/{chunk-ga86yjm1.js → chunk-gdwdqewd.js} +3 -3
  131. package/dist/{chunk-kva79cra.js → chunk-ge57c9hg.js} +7 -5
  132. package/dist/{chunk-f2hbn5rk.js → chunk-ggq2y3tn.js} +100420 -57118
  133. package/dist/{chunk-w0gmf6bv.js → chunk-gpzkzg7v.js} +47 -46
  134. package/dist/{chunk-v0bykh19.js → chunk-gw1a82j8.js} +108 -102
  135. package/dist/chunk-gw1g065z.js +20 -0
  136. package/dist/{chunk-21jsjcfa.js → chunk-h4dnamt5.js} +46 -45
  137. package/dist/{chunk-hh3k5s1s.js → chunk-h5mkzk0z.js} +3 -3
  138. package/dist/chunk-h7dm24cc.js +108 -0
  139. package/dist/{chunk-wr3pd88n.js → chunk-hadww3nd.js} +40 -9
  140. package/dist/{chunk-8ywngxqt.js → chunk-hapvn84d.js} +10 -10
  141. package/dist/{chunk-gbte7d7h.js → chunk-hekf5s9q.js} +4 -2
  142. package/dist/{chunk-veap97he.js → chunk-hkgb5y9f.js} +46 -45
  143. package/dist/{chunk-23fkapww.js → chunk-hzceftr4.js} +2 -2
  144. package/dist/chunk-j2x6fp25.js +29 -0
  145. package/dist/{chunk-vsqwd13w.js → chunk-j30g8fd1.js} +17 -19
  146. package/dist/{chunk-yyf72f78.js → chunk-j35mw64g.js} +4 -2
  147. package/dist/{chunk-qq5d2s0d.js → chunk-j3awswy3.js} +46 -45
  148. package/dist/{chunk-dmqeqxfz.js → chunk-j513wqe9.js} +46 -45
  149. package/dist/{chunk-hya4c599.js → chunk-jkens34n.js} +46 -45
  150. package/dist/{chunk-s4zb3f1b.js → chunk-jperb6n2.js} +46 -45
  151. package/dist/{chunk-psnsve7m.js → chunk-jqmr6ag1.js} +49 -48
  152. package/dist/{chunk-q7jnesv8.js → chunk-jsj3fx0g.js} +5 -5
  153. package/dist/{chunk-w1sv7j01.js → chunk-jx6k8msx.js} +46 -45
  154. package/dist/{chunk-xw8pjerk.js → chunk-jyz65rfv.js} +48 -47
  155. package/dist/{chunk-1avzakfd.js → chunk-k5mckm5f.js} +3 -3
  156. package/dist/{chunk-zctfbr1v.js → chunk-k7cw1a8a.js} +1 -1
  157. package/dist/{chunk-m46xyqr6.js → chunk-k9z36r5q.js} +48 -47
  158. package/dist/{chunk-th4y838y.js → chunk-kamesdff.js} +51 -50
  159. package/dist/{chunk-y7we499r.js → chunk-kj4m0j4n.js} +8 -8
  160. package/dist/{chunk-tdbz9gbm.js → chunk-kjqyhxz7.js} +6 -6
  161. package/dist/{chunk-k0v0cz71.js → chunk-m25yfqc3.js} +46 -45
  162. package/dist/{chunk-4nspekjp.js → chunk-mcws22k3.js} +1 -28
  163. package/dist/chunk-mgpj5f7h.js +150 -0
  164. package/dist/{chunk-1ybvj5df.js → chunk-mmn62bh2.js} +47 -46
  165. package/dist/{chunk-jpc9zwsk.js → chunk-mq94v5vn.js} +3 -3
  166. package/dist/{chunk-a1bf2kh4.js → chunk-msvv7dpt.js} +46 -45
  167. package/dist/chunk-mtv83pq4.js +123 -0
  168. package/dist/chunk-n36xjgtj.js +95 -0
  169. package/dist/{chunk-twqzmqsn.js → chunk-n9d0gg9z.js} +31 -27
  170. package/dist/{chunk-cvm2tmwg.js → chunk-na63s9wn.js} +20 -24
  171. package/dist/{chunk-jtztm8f5.js → chunk-nebntwvd.js} +44 -43
  172. package/dist/{chunk-0ym2z0c7.js → chunk-nj02kck4.js} +1 -1
  173. package/dist/{chunk-5rv9c8yd.js → chunk-nrjtxhyr.js} +1 -1
  174. package/dist/{chunk-nqn45znr.js → chunk-ns7x6xam.js} +9 -9
  175. package/dist/{chunk-jaaxk89e.js → chunk-nsc89h0n.js} +2 -22
  176. package/dist/{chunk-gnj7tyj6.js → chunk-nv7vcqme.js} +49 -48
  177. package/dist/{chunk-z19sd3bt.js → chunk-p4196wzm.js} +5 -5
  178. package/dist/{chunk-as5rvw4n.js → chunk-pbeee2kp.js} +17 -21
  179. package/dist/{chunk-va8drjmv.js → chunk-pcbm66ch.js} +48 -47
  180. package/dist/{chunk-phd1qfpc.js → chunk-pd2vy8hx.js} +5 -5
  181. package/dist/chunk-pe3n0w2t.js +91 -0
  182. package/dist/{chunk-bd5sqj86.js → chunk-peh3mj19.js} +11 -11
  183. package/dist/{chunk-mk1y74w7.js → chunk-pepgckn4.js} +17 -21
  184. package/dist/{chunk-wqvr37xp.js → chunk-pm67yj46.js} +15 -31
  185. package/dist/{chunk-qyqpb15f.js → chunk-pp8nrx40.js} +205 -261
  186. package/dist/{chunk-nx7c354z.js → chunk-pq5290db.js} +46 -45
  187. package/dist/{chunk-w4yn8cq7.js → chunk-psm26hv7.js} +8 -8
  188. package/dist/{chunk-hwn8vetn.js → chunk-pwpk3gm6.js} +10 -10
  189. package/dist/chunk-pzp8fj0a.js +123 -0
  190. package/dist/{chunk-x94btg29.js → chunk-q1j8ebyf.js} +17 -21
  191. package/dist/{chunk-87scz097.js → chunk-q2fn2p7y.js} +46 -45
  192. package/dist/chunk-q347821k.js +99 -0
  193. package/dist/{chunk-23jzrwsw.js → chunk-q6tdxy8v.js} +5 -5
  194. package/dist/{chunk-byb2mn1c.js → chunk-qb88vpgy.js} +118 -450
  195. package/dist/{chunk-eenq3avg.js → chunk-qcrpqjya.js} +1 -1
  196. package/dist/chunk-qehbwde1.js +90 -0
  197. package/dist/{chunk-ck0ap688.js → chunk-qkczt8cr.js} +4 -4
  198. package/dist/{chunk-c3d2cnz5.js → chunk-qmmxwh8x.js} +7 -7
  199. package/dist/{chunk-1a6ez1mg.js → chunk-qxmm3jbn.js} +51 -49
  200. package/dist/{chunk-njxgct8f.js → chunk-qywk2c7m.js} +46 -45
  201. package/dist/{chunk-rkg741k3.js → chunk-qz0xdht6.js} +14 -14
  202. package/dist/chunk-r0dpeqg0.js +468 -0
  203. package/dist/{chunk-6ksdp40n.js → chunk-r0m970pk.js} +1 -1
  204. package/dist/{chunk-fape0yfp.js → chunk-r5bf0h0t.js} +46 -45
  205. package/dist/{chunk-jcwkgtbp.js → chunk-r7xpsch7.js} +52 -90
  206. package/dist/{chunk-z9n0183s.js → chunk-rfq9kmsy.js} +9 -9
  207. package/dist/{chunk-xp61y5ba.js → chunk-rkv8bdtr.js} +2 -2
  208. package/dist/{chunk-5cem2v7n.js → chunk-rkvwts6v.js} +5 -5
  209. package/dist/{chunk-1vnd9s2j.js → chunk-rm4c8zd9.js} +57 -66
  210. package/dist/{chunk-e7efcp3k.js → chunk-rm9gb396.js} +257 -2857
  211. package/dist/{chunk-0m9w9esf.js → chunk-s213xmp8.js} +46 -45
  212. package/dist/{chunk-c42pqnxx.js → chunk-s3s0611n.js} +1 -1
  213. package/dist/{chunk-qdnxk7d7.js → chunk-scrk9jbt.js} +29 -30
  214. package/dist/{chunk-wayfjcwt.js → chunk-sdfvr9ps.js} +4 -4
  215. package/dist/{chunk-7mqab3z7.js → chunk-skp5w8bq.js} +1 -1
  216. package/dist/{chunk-76j2e9vy.js → chunk-snxp8mxj.js} +2 -2
  217. package/dist/{chunk-ad3v6mzw.js → chunk-tgmettzd.js} +12 -12
  218. package/dist/{chunk-cdj51xbj.js → chunk-tj6hejny.js} +46 -45
  219. package/dist/chunk-tn0xnp8a.js +124 -0
  220. package/dist/chunk-tpn6rh31.js +62 -0
  221. package/dist/{chunk-qsc98gbe.js → chunk-tq4vws6e.js} +2 -2
  222. package/dist/{chunk-ydcsbj4t.js → chunk-tzzzbb9d.js} +11 -9
  223. package/dist/chunk-v3s93bzd.js +34 -0
  224. package/dist/{chunk-4cp6193g.js → chunk-v4t6dyyh.js} +2 -2
  225. package/dist/{chunk-xfkfh5sd.js → chunk-v6fcbmqz.js} +1808 -1643
  226. package/dist/{chunk-k7g9gcr9.js → chunk-vc59jf3q.js} +64 -58
  227. package/dist/{chunk-gdhz1652.js → chunk-vdk9b74d.js} +27 -30
  228. package/dist/{chunk-tvzr9c8a.js → chunk-vf9c1649.js} +46 -45
  229. package/dist/{chunk-naybw0p0.js → chunk-vgk0nymz.js} +8 -8
  230. package/dist/{chunk-jh965sa0.js → chunk-vgzpbh28.js} +47 -46
  231. package/dist/{chunk-q87kegxh.js → chunk-vhxrn87v.js} +49 -48
  232. package/dist/chunk-vnzgpyrz.js +1534 -0
  233. package/dist/{chunk-r6kaak61.js → chunk-vqh6cjfx.js} +16 -20
  234. package/dist/{chunk-wbbykfdd.js → chunk-vz3pa5n6.js} +1 -1
  235. package/dist/{chunk-pwqm47kn.js → chunk-w1h5z2sy.js} +46 -45
  236. package/dist/{chunk-rm2vtv77.js → chunk-w2vvxj1f.js} +22 -25
  237. package/dist/{chunk-s7q42kp2.js → chunk-w5zezk61.js} +9 -9
  238. package/dist/{chunk-vrjbc8ap.js → chunk-wa8yn2p0.js} +1 -1
  239. package/dist/{chunk-a3wczqrp.js → chunk-wahqac7c.js} +37 -41
  240. package/dist/{chunk-qvd3hbqs.js → chunk-wc0np2zw.js} +5 -5
  241. package/dist/{chunk-2j3v2dgk.js → chunk-wcpmtszh.js} +47 -46
  242. package/dist/{chunk-jxfp3g9b.js → chunk-wdzjtdye.js} +4 -4
  243. package/dist/{chunk-0g5cy3wj.js → chunk-wgk9sxk7.js} +4 -4
  244. package/dist/{chunk-rc9x0raa.js → chunk-wmbpjx7v.js} +56 -55
  245. package/dist/chunk-wrsy4y58.js +93 -0
  246. package/dist/{chunk-rtmh0v4c.js → chunk-wskkym13.js} +6 -6
  247. package/dist/{chunk-bm5rc541.js → chunk-wt6v1zbe.js} +5 -5
  248. package/dist/{chunk-37p5p94r.js → chunk-wyj3wpjv.js} +55 -54
  249. package/dist/chunk-x7fdwq3d.js +33 -0
  250. package/dist/{chunk-6t5zvnrg.js → chunk-xdg2rpj3.js} +48 -46
  251. package/dist/{chunk-chsyvavm.js → chunk-xeb6075z.js} +1 -1
  252. package/dist/{chunk-23q4jpn2.js → chunk-xemw9d52.js} +3 -3
  253. package/dist/{chunk-n7pnyq43.js → chunk-xhfmdq1y.js} +16 -0
  254. package/dist/{chunk-jmkn11my.js → chunk-xmdny0m1.js} +20 -20
  255. package/dist/chunk-xswyz2es.js +118 -0
  256. package/dist/{chunk-67a4147x.js → chunk-xv5a2xbe.js} +1 -1
  257. package/dist/{chunk-1dgdjrm1.js → chunk-xx709m24.js} +4 -4
  258. package/dist/{chunk-qn8z4r79.js → chunk-y024419t.js} +50 -48
  259. package/dist/{chunk-dbwmzvfj.js → chunk-y1ps26mz.js} +46 -45
  260. package/dist/{chunk-4m9df5ef.js → chunk-y2r5e6kv.js} +17 -21
  261. package/dist/{chunk-k1crm94z.js → chunk-y41svpxw.js} +46 -45
  262. package/dist/{chunk-qjyg1dv7.js → chunk-ygwcq4vd.js} +6 -10
  263. package/dist/{chunk-fk8crdnk.js → chunk-ykv414dd.js} +48 -46
  264. package/dist/{chunk-g5pgham9.js → chunk-ynkzfhs1.js} +20 -14
  265. package/dist/{chunk-gvrjgq1n.js → chunk-yrqx3p9k.js} +16 -20
  266. package/dist/{chunk-c9dmpdss.js → chunk-ys17e80d.js} +46 -45
  267. package/dist/{chunk-97wgdsab.js → chunk-z16txqz0.js} +3 -3
  268. package/dist/{chunk-yvtzznds.js → chunk-z6wm96eh.js} +2 -2
  269. package/dist/{chunk-8ybw2s0h.js → chunk-zbb7qd0v.js} +4 -4
  270. package/dist/{chunk-030rqd3a.js → chunk-zjxv5g2n.js} +54 -53
  271. package/dist/{chunk-425w66ka.js → chunk-zmwgp2sh.js} +4 -4
  272. package/dist/cli.js +8 -8
  273. package/dist/gateway/index.js +430 -0
  274. package/dist/gateway/worker.js +482687 -0
  275. package/package.json +1 -1
  276. package/dist/chunk-11cz07kz.js +0 -93
  277. package/dist/chunk-1pbtp2z2.js +0 -92
  278. package/dist/chunk-25y2dtzf.js +0 -91
  279. package/dist/chunk-3hyj0zpy.js +0 -95
  280. package/dist/chunk-4kqjjakw.js +0 -73
  281. package/dist/chunk-4zwqbg7s.js +0 -87
  282. package/dist/chunk-5be33wja.js +0 -120
  283. package/dist/chunk-70mgxhkz.js +0 -369
  284. package/dist/chunk-7gmk09cq.js +0 -116
  285. package/dist/chunk-8dprcdra.js +0 -92
  286. package/dist/chunk-8xwx1xtg.js +0 -120
  287. package/dist/chunk-a579wjd2.js +0 -436
  288. package/dist/chunk-axqk3mxk.js +0 -116
  289. package/dist/chunk-c0ckmxr1.js +0 -86
  290. package/dist/chunk-c6t24y8q.js +0 -94
  291. package/dist/chunk-cfv996bs.js +0 -22
  292. package/dist/chunk-e5t5eefc.js +0 -62
  293. package/dist/chunk-eyph0250.js +0 -88
  294. package/dist/chunk-f825x57v.js +0 -91
  295. package/dist/chunk-h9xx5bj6.js +0 -91
  296. package/dist/chunk-j1dg659r.js +0 -89
  297. package/dist/chunk-jk8seqkk.js +0 -90
  298. package/dist/chunk-jzg4nddc.js +0 -92
  299. package/dist/chunk-k5vy0s3c.js +0 -93
  300. package/dist/chunk-ke820fjw.js +0 -91
  301. package/dist/chunk-kyzd4p8z.js +0 -111
  302. package/dist/chunk-njrt3tac.js +0 -640
  303. package/dist/chunk-pavb6a7w.js +0 -516
  304. package/dist/chunk-q268gpa0.js +0 -145
  305. package/dist/chunk-qvh1w3t7.js +0 -157
  306. package/dist/chunk-qy1es4jj.js +0 -95
  307. package/dist/chunk-qz2x630m.js +0 -49145
  308. package/dist/chunk-tw48evtr.js +0 -40
  309. package/dist/chunk-w0gfctyc.js +0 -117
  310. package/dist/chunk-y0fhjxef.js +0 -276
  311. package/dist/chunk-y275vgmw.js +0 -654
  312. package/dist/chunk-zq7pmdas.js +0 -1003
@@ -1,1003 +0,0 @@
1
- // @bun
2
- import {
3
- init_SSETransport,
4
- parseSSEFrames
5
- } from "./chunk-a579wjd2.js";
6
- import {
7
- createAssistantAPIErrorMessage,
8
- init_api,
9
- init_messages1 as init_messages,
10
- normalizeContentFromAPI,
11
- normalizeMessagesForAPI,
12
- toolToAPISchema
13
- } from "./chunk-f2hbn5rk.js";
14
- import"./chunk-jpc9zwsk.js";
15
- import"./chunk-hwfknpxv.js";
16
- import"./chunk-4nspekjp.js";
17
- import"./chunk-jzthz1bx.js";
18
- import"./chunk-1gx78081.js";
19
- import"./chunk-qcnhb4cd.js";
20
- import"./chunk-s7q42kp2.js";
21
- import"./chunk-2gzv8nrw.js";
22
- import"./chunk-ehtwnxpg.js";
23
- import"./chunk-wr3pd88n.js";
24
- import"./chunk-wayfjcwt.js";
25
- import"./chunk-cgfdkzhb.js";
26
- import"./chunk-bxcfz5gy.js";
27
- import"./chunk-y0fhjxef.js";
28
- import"./chunk-j5bth84e.js";
29
- import"./chunk-nk82j7r2.js";
30
- import"./chunk-68ffk5qa.js";
31
- import"./chunk-ps49ymvj.js";
32
- import"./chunk-p7vkh4wx.js";
33
- import"./chunk-bmbq6nt1.js";
34
- import"./chunk-yc23zxmj.js";
35
- import"./chunk-njrt3tac.js";
36
- import"./chunk-m87bhhqv.js";
37
- import"./chunk-xwg327ys.js";
38
- import"./chunk-xz655xxa.js";
39
- import"./chunk-c11swzas.js";
40
- import"./chunk-chsyvavm.js";
41
- import"./chunk-5rv9c8yd.js";
42
- import"./chunk-e7efcp3k.js";
43
- import {
44
- init_json,
45
- safeParseJSON
46
- } from "./chunk-z19sd3bt.js";
47
- import"./chunk-1ax1znzj.js";
48
- import"./chunk-6nsd9606.js";
49
- import"./chunk-xp61y5ba.js";
50
- import"./chunk-64c1avct.js";
51
- import {
52
- getProxyFetchOptions,
53
- init_proxy
54
- } from "./chunk-wha6v7za.js";
55
- import"./chunk-8g5pe1gr.js";
56
- import"./chunk-4cp6193g.js";
57
- import"./chunk-8g747a8x.js";
58
- import"./chunk-d7886r6a.js";
59
- import"./chunk-yvtzznds.js";
60
- import"./chunk-4jm600zv.js";
61
- import"./chunk-qz2x630m.js";
62
- import"./chunk-2f21meep.js";
63
- import"./chunk-nrtksr2p.js";
64
- import"./chunk-3c25bcsw.js";
65
- import"./chunk-s3hsqf80.js";
66
- import"./chunk-yyf72f78.js";
67
- import"./chunk-cdz5yb0r.js";
68
- import"./chunk-c7jwbe76.js";
69
- import"./chunk-0vkfrmqm.js";
70
- import"./chunk-7sgtxrsc.js";
71
- import"./chunk-0xjaqda8.js";
72
- import"./chunk-x8d2ehd7.js";
73
- import"./chunk-15m49c67.js";
74
- import"./chunk-tdbz9gbm.js";
75
- import"./chunk-0awwmrwr.js";
76
- import"./chunk-qnfx3qtx.js";
77
- import"./chunk-70eey1nh.js";
78
- import"./chunk-1nk93fqz.js";
79
- import"./chunk-s8kj6ajy.js";
80
- import"./chunk-eenq3avg.js";
81
- import"./chunk-7mqab3z7.js";
82
- import"./chunk-5z28bqne.js";
83
- import"./chunk-qajrkk97.js";
84
- import {
85
- errorMessage,
86
- init_debug,
87
- init_errors,
88
- logForDebugging
89
- } from "./chunk-phd1qfpc.js";
90
- import"./chunk-fbv4apne.js";
91
- import"./chunk-jaaxk89e.js";
92
- import"./chunk-k8vp0atq.js";
93
- import"./chunk-vf612n57.js";
94
- import"./chunk-07069jq1.js";
95
- import"./chunk-d4mdda98.js";
96
- import"./chunk-55raexh7.js";
97
- import"./chunk-v9smspw2.js";
98
- import"./chunk-v1kzp02e.js";
99
- import"./chunk-7wm5s02e.js";
100
- import"./chunk-b0kf00ff.js";
101
- import"./chunk-netzwgv1.js";
102
- import {
103
- __esm
104
- } from "./chunk-qp2qdcda.js";
105
-
106
- // src/services/api/gemini/client.ts
107
- function getGeminiBaseUrl() {
108
- return (process.env.GEMINI_BASE_URL || DEFAULT_GEMINI_BASE_URL).replace(/\/+$/, "");
109
- }
110
- function getGeminiModelPath(model) {
111
- const normalized = model.replace(/^\/+/, "");
112
- return normalized.startsWith("models/") ? normalized : `models/${normalized}`;
113
- }
114
- async function* streamGeminiGenerateContent(params) {
115
- const fetchImpl = params.fetchOverride ?? fetch;
116
- const url = `${getGeminiBaseUrl()}/${getGeminiModelPath(params.model)}:streamGenerateContent?alt=sse`;
117
- const response = await fetchImpl(url, {
118
- method: "POST",
119
- headers: {
120
- "Content-Type": "application/json",
121
- "x-goog-api-key": process.env.GEMINI_API_KEY || ""
122
- },
123
- body: JSON.stringify(params.body),
124
- signal: params.signal,
125
- ...getProxyFetchOptions({ forAnthropicAPI: false })
126
- });
127
- if (!response.ok) {
128
- const body = await response.text();
129
- throw new Error(`Gemini API request failed (${response.status} ${response.statusText}): ${body || "empty response body"}`);
130
- }
131
- if (!response.body) {
132
- throw new Error("Gemini API returned no response body");
133
- }
134
- const reader = response.body.getReader();
135
- const decoder = new TextDecoder;
136
- let buffer = "";
137
- try {
138
- while (true) {
139
- const { done, value } = await reader.read();
140
- if (done)
141
- break;
142
- buffer += decoder.decode(value, STREAM_DECODE_OPTS);
143
- const { frames: frames2, remaining } = parseSSEFrames(buffer);
144
- buffer = remaining;
145
- for (const frame of frames2) {
146
- if (!frame.data || frame.data === "[DONE]")
147
- continue;
148
- try {
149
- yield JSON.parse(frame.data);
150
- } catch (error) {
151
- throw new Error(`Failed to parse Gemini SSE payload: ${errorMessage(error)}`);
152
- }
153
- }
154
- }
155
- buffer += decoder.decode();
156
- const { frames } = parseSSEFrames(buffer);
157
- for (const frame of frames) {
158
- if (!frame.data || frame.data === "[DONE]")
159
- continue;
160
- try {
161
- yield JSON.parse(frame.data);
162
- } catch (error) {
163
- throw new Error(`Failed to parse trailing Gemini SSE payload: ${errorMessage(error)}`);
164
- }
165
- }
166
- } finally {
167
- reader.releaseLock();
168
- }
169
- }
170
- var DEFAULT_GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta", STREAM_DECODE_OPTS;
171
- var init_client = __esm(() => {
172
- init_SSETransport();
173
- init_errors();
174
- init_proxy();
175
- STREAM_DECODE_OPTS = { stream: true };
176
- });
177
-
178
- // src/services/api/gemini/types.ts
179
- var GEMINI_THOUGHT_SIGNATURE_FIELD = "_geminiThoughtSignature";
180
- var init_types = () => {};
181
-
182
- // src/services/api/gemini/convertMessages.ts
183
- function anthropicMessagesToGemini(messages, systemPrompt) {
184
- const contents = [];
185
- const toolNamesById = new Map;
186
- for (const msg of messages) {
187
- if (msg.type === "assistant") {
188
- const content = convertInternalAssistantMessage(msg);
189
- if (content.parts.length > 0) {
190
- contents.push(content);
191
- }
192
- const assistantContent = msg.message.content;
193
- if (Array.isArray(assistantContent)) {
194
- for (const block of assistantContent) {
195
- if (typeof block !== "string" && block.type === "tool_use") {
196
- toolNamesById.set(block.id, block.name);
197
- }
198
- }
199
- }
200
- continue;
201
- }
202
- if (msg.type === "user") {
203
- const content = convertInternalUserMessage(msg, toolNamesById);
204
- if (content.parts.length > 0) {
205
- contents.push(content);
206
- }
207
- }
208
- }
209
- const systemText = systemPromptToText(systemPrompt);
210
- return {
211
- contents,
212
- ...systemText ? {
213
- systemInstruction: {
214
- parts: [{ text: systemText }]
215
- }
216
- } : {}
217
- };
218
- }
219
- function systemPromptToText(systemPrompt) {
220
- if (!systemPrompt || systemPrompt.length === 0)
221
- return "";
222
- return systemPrompt.filter(Boolean).join(`
223
-
224
- `);
225
- }
226
- function convertInternalUserMessage(msg, toolNamesById) {
227
- const content = msg.message.content;
228
- if (typeof content === "string") {
229
- return {
230
- role: "user",
231
- parts: createTextGeminiParts(content)
232
- };
233
- }
234
- if (!Array.isArray(content)) {
235
- return { role: "user", parts: [] };
236
- }
237
- return {
238
- role: "user",
239
- parts: content.flatMap((block) => convertUserContentBlockToGeminiParts(block, toolNamesById))
240
- };
241
- }
242
- function convertUserContentBlockToGeminiParts(block, toolNamesById) {
243
- if (typeof block === "string") {
244
- return createTextGeminiParts(block);
245
- }
246
- if (block.type === "text") {
247
- return createTextGeminiParts(block.text);
248
- }
249
- if (block.type === "tool_result") {
250
- const toolResult = block;
251
- return [
252
- {
253
- functionResponse: {
254
- name: toolNamesById.get(toolResult.tool_use_id) ?? toolResult.tool_use_id,
255
- response: toolResultToResponseObject(toolResult)
256
- }
257
- }
258
- ];
259
- }
260
- if (block.type === "image") {
261
- const source = block.source;
262
- if (source?.type === "base64" && typeof source.data === "string") {
263
- const mediaType = source.media_type || "image/png";
264
- return [
265
- {
266
- inlineData: {
267
- mimeType: mediaType,
268
- data: source.data
269
- }
270
- }
271
- ];
272
- }
273
- if (source?.type === "url" && typeof source.url === "string") {
274
- return createTextGeminiParts(`[image: ${source.url}]`);
275
- }
276
- }
277
- return [];
278
- }
279
- function convertInternalAssistantMessage(msg) {
280
- const content = msg.message.content;
281
- if (typeof content === "string") {
282
- return {
283
- role: "model",
284
- parts: createTextGeminiParts(content)
285
- };
286
- }
287
- if (!Array.isArray(content)) {
288
- return { role: "model", parts: [] };
289
- }
290
- const parts = [];
291
- for (const block of content) {
292
- if (typeof block === "string") {
293
- parts.push(...createTextGeminiParts(block));
294
- continue;
295
- }
296
- if (block.type === "text") {
297
- parts.push(...createTextGeminiParts(block.text, getGeminiThoughtSignature(block)));
298
- continue;
299
- }
300
- if (block.type === "thinking") {
301
- const thinkingPart = createThinkingGeminiPart(block.thinking, block.signature);
302
- if (thinkingPart) {
303
- parts.push(thinkingPart);
304
- }
305
- continue;
306
- }
307
- if (block.type === "tool_use") {
308
- const toolUse = block;
309
- parts.push({
310
- functionCall: {
311
- name: toolUse.name,
312
- args: normalizeToolUseInput(toolUse.input)
313
- },
314
- ...getGeminiThoughtSignature(block) && {
315
- thoughtSignature: getGeminiThoughtSignature(block)
316
- }
317
- });
318
- }
319
- }
320
- return { role: "model", parts };
321
- }
322
- function createTextGeminiParts(value, thoughtSignature) {
323
- if (typeof value !== "string" || value.length === 0) {
324
- return [];
325
- }
326
- return [
327
- {
328
- text: value,
329
- ...thoughtSignature && { thoughtSignature }
330
- }
331
- ];
332
- }
333
- function createThinkingGeminiPart(value, thoughtSignature) {
334
- if (typeof value !== "string" || value.length === 0) {
335
- return;
336
- }
337
- return {
338
- text: value,
339
- thought: true,
340
- ...thoughtSignature && { thoughtSignature }
341
- };
342
- }
343
- function normalizeToolUseInput(input) {
344
- if (typeof input === "string") {
345
- const parsed = safeParseJSON(input);
346
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
347
- return parsed;
348
- }
349
- return parsed === null ? {} : { value: parsed };
350
- }
351
- if (input && typeof input === "object" && !Array.isArray(input)) {
352
- return input;
353
- }
354
- return input === undefined ? {} : { value: input };
355
- }
356
- function toolResultToResponseObject(block) {
357
- const result = normalizeToolResultContent(block.content);
358
- if (result && typeof result === "object" && !Array.isArray(result)) {
359
- return block.is_error ? { ...result, is_error: true } : result;
360
- }
361
- return {
362
- result,
363
- ...block.is_error ? { is_error: true } : {}
364
- };
365
- }
366
- function normalizeToolResultContent(content) {
367
- if (typeof content === "string") {
368
- const parsed = safeParseJSON(content);
369
- return parsed ?? content;
370
- }
371
- if (Array.isArray(content)) {
372
- const text = content.map((part) => {
373
- if (typeof part === "string")
374
- return part;
375
- if (part && typeof part === "object" && "text" in part && typeof part.text === "string") {
376
- return part.text;
377
- }
378
- return "";
379
- }).filter(Boolean).join(`
380
- `);
381
- const parsed = safeParseJSON(text);
382
- return parsed ?? text;
383
- }
384
- return content ?? "";
385
- }
386
- function getGeminiThoughtSignature(block) {
387
- const signature = block[GEMINI_THOUGHT_SIGNATURE_FIELD];
388
- return typeof signature === "string" && signature.length > 0 ? signature : undefined;
389
- }
390
- var init_convertMessages = __esm(() => {
391
- init_json();
392
- init_types();
393
- });
394
-
395
- // src/services/api/gemini/convertTools.ts
396
- function normalizeGeminiJsonSchemaType(value) {
397
- if (typeof value === "string") {
398
- return GEMINI_JSON_SCHEMA_TYPES.has(value) ? value : undefined;
399
- }
400
- if (Array.isArray(value)) {
401
- const normalized = value.filter((item) => typeof item === "string" && GEMINI_JSON_SCHEMA_TYPES.has(item));
402
- const unique = Array.from(new Set(normalized));
403
- if (unique.length === 0)
404
- return;
405
- return unique.length === 1 ? unique[0] : unique;
406
- }
407
- return;
408
- }
409
- function inferGeminiJsonSchemaTypeFromValue(value) {
410
- if (value === null)
411
- return "null";
412
- if (Array.isArray(value))
413
- return "array";
414
- if (typeof value === "string")
415
- return "string";
416
- if (typeof value === "boolean")
417
- return "boolean";
418
- if (typeof value === "number") {
419
- return Number.isInteger(value) ? "integer" : "number";
420
- }
421
- if (typeof value === "object")
422
- return "object";
423
- return;
424
- }
425
- function inferGeminiJsonSchemaTypeFromEnum(values) {
426
- const inferred = values.map(inferGeminiJsonSchemaTypeFromValue).filter((value) => value !== undefined);
427
- const unique = Array.from(new Set(inferred));
428
- if (unique.length === 0)
429
- return;
430
- return unique.length === 1 ? unique[0] : unique;
431
- }
432
- function addNullToGeminiJsonSchemaType(value) {
433
- if (value === undefined)
434
- return ["null"];
435
- if (Array.isArray(value)) {
436
- return value.includes("null") ? value : [...value, "null"];
437
- }
438
- return value === "null" ? value : [value, "null"];
439
- }
440
- function sanitizeGeminiJsonSchemaProperties(value) {
441
- if (!value || typeof value !== "object" || Array.isArray(value)) {
442
- return;
443
- }
444
- const sanitizedEntries = Object.entries(value).map(([key, schema]) => [key, sanitizeGeminiJsonSchema(schema)]).filter(([, schema]) => Object.keys(schema).length > 0);
445
- if (sanitizedEntries.length === 0) {
446
- return;
447
- }
448
- return Object.fromEntries(sanitizedEntries);
449
- }
450
- function sanitizeGeminiJsonSchemaArray(value) {
451
- if (!Array.isArray(value))
452
- return;
453
- const sanitized = value.map((item) => sanitizeGeminiJsonSchema(item)).filter((item) => Object.keys(item).length > 0);
454
- return sanitized.length > 0 ? sanitized : undefined;
455
- }
456
- function sanitizeGeminiJsonSchema(schema) {
457
- if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
458
- return {};
459
- }
460
- const source = schema;
461
- const result = {};
462
- let type = normalizeGeminiJsonSchemaType(source.type);
463
- if (source.const !== undefined) {
464
- result.enum = [source.const];
465
- type = type ?? inferGeminiJsonSchemaTypeFromValue(source.const);
466
- } else if (Array.isArray(source.enum) && source.enum.length > 0) {
467
- result.enum = source.enum;
468
- type = type ?? inferGeminiJsonSchemaTypeFromEnum(source.enum);
469
- }
470
- if (!type) {
471
- if (source.properties && typeof source.properties === "object") {
472
- type = "object";
473
- } else if (source.items !== undefined || source.prefixItems !== undefined) {
474
- type = "array";
475
- }
476
- }
477
- if (source.nullable === true) {
478
- type = addNullToGeminiJsonSchemaType(type);
479
- }
480
- if (type) {
481
- result.type = type;
482
- }
483
- if (typeof source.title === "string") {
484
- result.title = source.title;
485
- }
486
- if (typeof source.description === "string") {
487
- result.description = source.description;
488
- }
489
- if (typeof source.format === "string") {
490
- result.format = source.format;
491
- }
492
- if (typeof source.pattern === "string") {
493
- result.pattern = source.pattern;
494
- }
495
- if (typeof source.minimum === "number") {
496
- result.minimum = source.minimum;
497
- } else if (typeof source.exclusiveMinimum === "number") {
498
- result.minimum = source.exclusiveMinimum;
499
- }
500
- if (typeof source.maximum === "number") {
501
- result.maximum = source.maximum;
502
- } else if (typeof source.exclusiveMaximum === "number") {
503
- result.maximum = source.exclusiveMaximum;
504
- }
505
- if (typeof source.minItems === "number") {
506
- result.minItems = source.minItems;
507
- }
508
- if (typeof source.maxItems === "number") {
509
- result.maxItems = source.maxItems;
510
- }
511
- if (typeof source.minLength === "number") {
512
- result.minLength = source.minLength;
513
- }
514
- if (typeof source.maxLength === "number") {
515
- result.maxLength = source.maxLength;
516
- }
517
- if (typeof source.minProperties === "number") {
518
- result.minProperties = source.minProperties;
519
- }
520
- if (typeof source.maxProperties === "number") {
521
- result.maxProperties = source.maxProperties;
522
- }
523
- const properties = sanitizeGeminiJsonSchemaProperties(source.properties);
524
- if (properties) {
525
- result.properties = properties;
526
- result.propertyOrdering = Object.keys(properties);
527
- }
528
- if (Array.isArray(source.required)) {
529
- const required = source.required.filter((item) => typeof item === "string");
530
- if (required.length > 0) {
531
- result.required = required;
532
- }
533
- }
534
- if (typeof source.additionalProperties === "boolean") {
535
- result.additionalProperties = source.additionalProperties;
536
- } else {
537
- const additionalProperties = sanitizeGeminiJsonSchema(source.additionalProperties);
538
- if (Object.keys(additionalProperties).length > 0) {
539
- result.additionalProperties = additionalProperties;
540
- }
541
- }
542
- const items = sanitizeGeminiJsonSchema(source.items);
543
- if (Object.keys(items).length > 0) {
544
- result.items = items;
545
- }
546
- const prefixItems = sanitizeGeminiJsonSchemaArray(source.prefixItems);
547
- if (prefixItems) {
548
- result.prefixItems = prefixItems;
549
- }
550
- const anyOf = sanitizeGeminiJsonSchemaArray(source.anyOf ?? source.oneOf);
551
- if (anyOf) {
552
- result.anyOf = anyOf;
553
- }
554
- return result;
555
- }
556
- function sanitizeGeminiFunctionParameters(schema) {
557
- const sanitized = sanitizeGeminiJsonSchema(schema);
558
- if (Object.keys(sanitized).length > 0) {
559
- return sanitized;
560
- }
561
- return {
562
- type: "object",
563
- properties: {}
564
- };
565
- }
566
- function anthropicToolsToGemini(tools) {
567
- const functionDeclarations = tools.filter((tool) => {
568
- return tool.type === "custom" || !("type" in tool) || tool.type !== "server";
569
- }).map((tool) => {
570
- const anyTool = tool;
571
- const name = anyTool.name || "";
572
- const description = anyTool.description || "";
573
- const inputSchema = anyTool.input_schema ?? {
574
- type: "object",
575
- properties: {}
576
- };
577
- return {
578
- name,
579
- description,
580
- parametersJsonSchema: sanitizeGeminiFunctionParameters(inputSchema)
581
- };
582
- });
583
- return functionDeclarations.length > 0 ? [{ functionDeclarations }] : [];
584
- }
585
- function anthropicToolChoiceToGemini(toolChoice) {
586
- if (!toolChoice || typeof toolChoice !== "object")
587
- return;
588
- const tc = toolChoice;
589
- const type = tc.type;
590
- switch (type) {
591
- case "auto":
592
- return { mode: "AUTO" };
593
- case "any":
594
- return { mode: "ANY" };
595
- case "tool":
596
- return {
597
- mode: "ANY",
598
- allowedFunctionNames: typeof tc.name === "string" ? [tc.name] : undefined
599
- };
600
- default:
601
- return;
602
- }
603
- }
604
- var GEMINI_JSON_SCHEMA_TYPES;
605
- var init_convertTools = __esm(() => {
606
- GEMINI_JSON_SCHEMA_TYPES = new Set([
607
- "string",
608
- "number",
609
- "integer",
610
- "boolean",
611
- "object",
612
- "array",
613
- "null"
614
- ]);
615
- });
616
-
617
- // src/services/api/gemini/modelMapping.ts
618
- function getModelFamily(model) {
619
- if (/haiku/i.test(model))
620
- return "haiku";
621
- if (/opus/i.test(model))
622
- return "opus";
623
- if (/sonnet/i.test(model))
624
- return "sonnet";
625
- return null;
626
- }
627
- function resolveGeminiModel(anthropicModel) {
628
- if (process.env.GEMINI_MODEL) {
629
- return process.env.GEMINI_MODEL;
630
- }
631
- const cleanModel = anthropicModel.replace(/\[1m\]$/i, "");
632
- const family = getModelFamily(cleanModel);
633
- if (!family) {
634
- return cleanModel;
635
- }
636
- const geminiEnvVar = `GEMINI_DEFAULT_${family.toUpperCase()}_MODEL`;
637
- const geminiModel = process.env[geminiEnvVar];
638
- if (geminiModel) {
639
- return geminiModel;
640
- }
641
- const sharedEnvVar = `ANTHROPIC_DEFAULT_${family.toUpperCase()}_MODEL`;
642
- const resolvedModel = process.env[sharedEnvVar];
643
- if (resolvedModel) {
644
- return resolvedModel;
645
- }
646
- throw new Error(`Gemini provider requires GEMINI_MODEL or ${geminiEnvVar} (or ${sharedEnvVar} for backward compatibility) to be configured.`);
647
- }
648
- var init_modelMapping = () => {};
649
-
650
- // src/services/api/gemini/streamAdapter.ts
651
- import { randomUUID } from "crypto";
652
- async function* adaptGeminiStreamToAnthropic(stream, model) {
653
- const messageId = `msg_${randomUUID().replace(/-/g, "").slice(0, 24)}`;
654
- let started = false;
655
- let stopped = false;
656
- let nextContentIndex = 0;
657
- let openTextLikeBlock = null;
658
- let sawToolUse = false;
659
- let finishReason;
660
- let inputTokens = 0;
661
- let outputTokens = 0;
662
- for await (const chunk of stream) {
663
- const usage = chunk.usageMetadata;
664
- if (usage) {
665
- inputTokens = usage.promptTokenCount ?? inputTokens;
666
- outputTokens = (usage.candidatesTokenCount ?? 0) + (usage.thoughtsTokenCount ?? 0);
667
- }
668
- if (!started) {
669
- started = true;
670
- yield {
671
- type: "message_start",
672
- message: {
673
- id: messageId,
674
- type: "message",
675
- role: "assistant",
676
- content: [],
677
- model,
678
- stop_reason: null,
679
- stop_sequence: null,
680
- usage: {
681
- input_tokens: inputTokens,
682
- output_tokens: 0,
683
- cache_creation_input_tokens: 0,
684
- cache_read_input_tokens: 0
685
- }
686
- }
687
- };
688
- }
689
- const candidate = chunk.candidates?.[0];
690
- const parts = candidate?.content?.parts ?? [];
691
- for (const part of parts) {
692
- if (part.functionCall) {
693
- if (openTextLikeBlock) {
694
- yield {
695
- type: "content_block_stop",
696
- index: openTextLikeBlock.index
697
- };
698
- openTextLikeBlock = null;
699
- }
700
- sawToolUse = true;
701
- const toolIndex = nextContentIndex++;
702
- const toolId = `toolu_${randomUUID().replace(/-/g, "").slice(0, 24)}`;
703
- yield {
704
- type: "content_block_start",
705
- index: toolIndex,
706
- content_block: {
707
- type: "tool_use",
708
- id: toolId,
709
- name: part.functionCall.name || "",
710
- input: {}
711
- }
712
- };
713
- if (part.thoughtSignature) {
714
- yield {
715
- type: "content_block_delta",
716
- index: toolIndex,
717
- delta: {
718
- type: "signature_delta",
719
- signature: part.thoughtSignature
720
- }
721
- };
722
- }
723
- if (part.functionCall.args && Object.keys(part.functionCall.args).length > 0) {
724
- yield {
725
- type: "content_block_delta",
726
- index: toolIndex,
727
- delta: {
728
- type: "input_json_delta",
729
- partial_json: JSON.stringify(part.functionCall.args)
730
- }
731
- };
732
- }
733
- yield {
734
- type: "content_block_stop",
735
- index: toolIndex
736
- };
737
- continue;
738
- }
739
- const textLikeType = getTextLikeBlockType(part);
740
- if (textLikeType) {
741
- if (!openTextLikeBlock || openTextLikeBlock.type !== textLikeType) {
742
- if (openTextLikeBlock) {
743
- yield {
744
- type: "content_block_stop",
745
- index: openTextLikeBlock.index
746
- };
747
- }
748
- openTextLikeBlock = {
749
- index: nextContentIndex++,
750
- type: textLikeType
751
- };
752
- yield {
753
- type: "content_block_start",
754
- index: openTextLikeBlock.index,
755
- content_block: textLikeType === "thinking" ? {
756
- type: "thinking",
757
- thinking: "",
758
- signature: ""
759
- } : {
760
- type: "text",
761
- text: ""
762
- }
763
- };
764
- }
765
- if (part.text) {
766
- yield {
767
- type: "content_block_delta",
768
- index: openTextLikeBlock.index,
769
- delta: textLikeType === "thinking" ? {
770
- type: "thinking_delta",
771
- thinking: part.text
772
- } : {
773
- type: "text_delta",
774
- text: part.text
775
- }
776
- };
777
- }
778
- if (part.thoughtSignature) {
779
- yield {
780
- type: "content_block_delta",
781
- index: openTextLikeBlock.index,
782
- delta: {
783
- type: "signature_delta",
784
- signature: part.thoughtSignature
785
- }
786
- };
787
- }
788
- continue;
789
- }
790
- if (part.thoughtSignature && openTextLikeBlock) {
791
- yield {
792
- type: "content_block_delta",
793
- index: openTextLikeBlock.index,
794
- delta: {
795
- type: "signature_delta",
796
- signature: part.thoughtSignature
797
- }
798
- };
799
- }
800
- }
801
- if (candidate?.finishReason) {
802
- finishReason = candidate.finishReason;
803
- }
804
- }
805
- if (!started) {
806
- return;
807
- }
808
- if (openTextLikeBlock) {
809
- yield {
810
- type: "content_block_stop",
811
- index: openTextLikeBlock.index
812
- };
813
- }
814
- if (!stopped) {
815
- yield {
816
- type: "message_delta",
817
- delta: {
818
- stop_reason: mapGeminiFinishReason(finishReason, sawToolUse),
819
- stop_sequence: null
820
- },
821
- usage: {
822
- output_tokens: outputTokens
823
- }
824
- };
825
- yield {
826
- type: "message_stop"
827
- };
828
- stopped = true;
829
- }
830
- }
831
- function getTextLikeBlockType(part) {
832
- if (typeof part.text !== "string") {
833
- return null;
834
- }
835
- return part.thought ? "thinking" : "text";
836
- }
837
- function mapGeminiFinishReason(reason, sawToolUse) {
838
- switch (reason) {
839
- case "MAX_TOKENS":
840
- return "max_tokens";
841
- case "STOP":
842
- case "FINISH_REASON_UNSPECIFIED":
843
- case "SAFETY":
844
- case "RECITATION":
845
- case "BLOCKLIST":
846
- case "PROHIBITED_CONTENT":
847
- case "SPII":
848
- case "MALFORMED_FUNCTION_CALL":
849
- default:
850
- return sawToolUse ? "tool_use" : "end_turn";
851
- }
852
- }
853
- var init_streamAdapter = () => {};
854
-
855
- // src/services/api/gemini/index.ts
856
- import { randomUUID as randomUUID2 } from "crypto";
857
- async function* queryModelGemini(messages, systemPrompt, tools, signal, options, thinkingConfig) {
858
- try {
859
- const geminiModel = resolveGeminiModel(options.model);
860
- const messagesForAPI = normalizeMessagesForAPI(messages, tools);
861
- const toolSchemas = await Promise.all(tools.map((tool) => toolToAPISchema(tool, {
862
- getToolPermissionContext: options.getToolPermissionContext,
863
- tools,
864
- agents: options.agents,
865
- allowedAgentTypes: options.allowedAgentTypes,
866
- model: options.model
867
- })));
868
- const standardTools = toolSchemas.filter((t) => {
869
- const anyTool = t;
870
- return anyTool.type !== "advisor_20260301" && anyTool.type !== "computer_20250124";
871
- });
872
- const { contents, systemInstruction } = anthropicMessagesToGemini(messagesForAPI, systemPrompt);
873
- const geminiTools = anthropicToolsToGemini(standardTools);
874
- const toolChoice = anthropicToolChoiceToGemini(options.toolChoice);
875
- const stream = streamGeminiGenerateContent({
876
- model: geminiModel,
877
- signal,
878
- fetchOverride: options.fetchOverride,
879
- body: {
880
- contents,
881
- ...systemInstruction && { systemInstruction },
882
- ...geminiTools.length > 0 && { tools: geminiTools },
883
- ...toolChoice && {
884
- toolConfig: {
885
- functionCallingConfig: toolChoice
886
- }
887
- },
888
- generationConfig: {
889
- ...options.temperatureOverride !== undefined && {
890
- temperature: options.temperatureOverride
891
- },
892
- ...thinkingConfig.type !== "disabled" && {
893
- thinkingConfig: {
894
- includeThoughts: true,
895
- ...thinkingConfig.type === "enabled" && {
896
- thinkingBudget: thinkingConfig.budgetTokens
897
- }
898
- }
899
- }
900
- }
901
- }
902
- });
903
- logForDebugging(`[Gemini] Calling model=${geminiModel}, messages=${contents.length}, tools=${geminiTools.length}`);
904
- const adaptedStream = adaptGeminiStreamToAnthropic(stream, geminiModel);
905
- const contentBlocks = {};
906
- let partialMessage = undefined;
907
- let ttftMs = 0;
908
- const start = Date.now();
909
- for await (const event of adaptedStream) {
910
- switch (event.type) {
911
- case "message_start":
912
- partialMessage = event.message;
913
- ttftMs = Date.now() - start;
914
- break;
915
- case "content_block_start": {
916
- const idx = event.index;
917
- const cb = event.content_block;
918
- if (cb.type === "tool_use") {
919
- contentBlocks[idx] = { ...cb, input: "" };
920
- } else if (cb.type === "text") {
921
- contentBlocks[idx] = { ...cb, text: "" };
922
- } else if (cb.type === "thinking") {
923
- contentBlocks[idx] = { ...cb, thinking: "", signature: "" };
924
- } else {
925
- contentBlocks[idx] = { ...cb };
926
- }
927
- break;
928
- }
929
- case "content_block_delta": {
930
- const idx = event.index;
931
- const delta = event.delta;
932
- const block = contentBlocks[idx];
933
- if (!block)
934
- break;
935
- if (delta.type === "text_delta") {
936
- block.text = (block.text || "") + delta.text;
937
- } else if (delta.type === "input_json_delta") {
938
- block.input = (block.input || "") + delta.partial_json;
939
- } else if (delta.type === "thinking_delta") {
940
- block.thinking = (block.thinking || "") + delta.thinking;
941
- } else if (delta.type === "signature_delta") {
942
- if (block.type === "thinking") {
943
- block.signature = delta.signature;
944
- } else {
945
- block[GEMINI_THOUGHT_SIGNATURE_FIELD] = delta.signature;
946
- }
947
- }
948
- break;
949
- }
950
- case "content_block_stop": {
951
- const idx = event.index;
952
- const block = contentBlocks[idx];
953
- if (!block || !partialMessage)
954
- break;
955
- const message = {
956
- message: {
957
- ...partialMessage,
958
- content: normalizeContentFromAPI([block], tools, options.agentId)
959
- },
960
- requestId: undefined,
961
- type: "assistant",
962
- uuid: randomUUID2(),
963
- timestamp: new Date().toISOString()
964
- };
965
- yield message;
966
- break;
967
- }
968
- case "message_delta":
969
- case "message_stop":
970
- break;
971
- }
972
- yield {
973
- type: "stream_event",
974
- event,
975
- ...event.type === "message_start" ? { ttftMs } : undefined
976
- };
977
- }
978
- } catch (error) {
979
- const errorMessage2 = error instanceof Error ? error.message : String(error);
980
- logForDebugging(`[Gemini] Error: ${errorMessage2}`, { level: "error" });
981
- yield createAssistantAPIErrorMessage({
982
- content: `API Error: ${errorMessage2}`,
983
- apiError: "api_error",
984
- error: error instanceof Error ? error : new Error(String(error))
985
- });
986
- }
987
- }
988
- var init_gemini = __esm(() => {
989
- init_api();
990
- init_debug();
991
- init_messages();
992
- init_client();
993
- init_convertMessages();
994
- init_convertTools();
995
- init_modelMapping();
996
- init_streamAdapter();
997
- init_types();
998
- });
999
- init_gemini();
1000
-
1001
- export {
1002
- queryModelGemini
1003
- };