promptfoo 0.125.0 → 0.125.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.
Files changed (869) hide show
  1. package/README.md +3 -3
  2. package/dist/src/accounts-BOxNYxVN.js +229 -0
  3. package/dist/src/accounts-BezXLdAW.cjs +276 -0
  4. package/dist/src/accounts-CPISMNlh.js +227 -0
  5. package/dist/src/accounts-vJBPs89d.js +222 -0
  6. package/dist/src/agentWorkspace-Bom7SpF2.js +592 -0
  7. package/dist/src/agentWorkspace-CEomAcws.cjs +619 -0
  8. package/dist/src/agentWorkspace-DPtMLrlI.js +593 -0
  9. package/dist/src/agentWorkspace-DkAeEYLz.js +592 -0
  10. package/dist/src/agentic-utils-121v7mJo.js +197 -0
  11. package/dist/src/agentic-utils-CBWD_rcd.cjs +237 -0
  12. package/dist/src/agentic-utils-D8wyQwPG.js +198 -0
  13. package/dist/src/agentic-utils-EP1QkQCs.js +197 -0
  14. package/dist/src/agents-Br3ah8iA.js +778 -0
  15. package/dist/src/agents-C5wj_UTv.js +777 -0
  16. package/dist/src/agents-C9Efp4mC.js +266 -0
  17. package/dist/src/agents-CQYwaVCO.js +267 -0
  18. package/dist/src/agents-CjCd4Vo8.js +777 -0
  19. package/dist/src/agents-DRWiCHYz.js +266 -0
  20. package/dist/src/agents-F2rhx0iL.cjs +266 -0
  21. package/dist/src/agents-RTYyy69h.cjs +777 -0
  22. package/dist/src/agents-api-CY72O86e.js +711 -0
  23. package/dist/src/agents-api-CsSsC21b.js +710 -0
  24. package/dist/src/agents-api-DN-ibDc8.js +710 -0
  25. package/dist/src/agents-api-cNDsCCv1.cjs +710 -0
  26. package/dist/src/ai.studio-Bj6Dyi6o.js +2 -0
  27. package/dist/src/ai.studio-C-e0LzyW.js +369 -0
  28. package/dist/src/ai.studio-CR8M6Aqf.cjs +391 -0
  29. package/dist/src/ai.studio-YKk7F0tv.js +374 -0
  30. package/dist/src/aimlapi-BGunsuTu.js +30 -0
  31. package/dist/src/aimlapi-BkzcfBsL.js +29 -0
  32. package/dist/src/aimlapi-DXFcEdP8.js +28 -0
  33. package/dist/src/aimlapi-r-8iCcAw.cjs +29 -0
  34. package/dist/src/anthropicMessages-7-YNRgQR.js +114 -0
  35. package/dist/src/anthropicMessages-C8m9Whrd.cjs +114 -0
  36. package/dist/src/anthropicMessages-DS1vXD0f.js +115 -0
  37. package/dist/src/anthropicMessages-DmvGkz-0.js +114 -0
  38. package/dist/src/app/assets/index-CrdXWTXm.js +392 -0
  39. package/dist/src/app/browser-inventory.json +4 -4
  40. package/dist/src/app/index.html +1 -1
  41. package/dist/src/audio-BLgFgyw-.cjs +104 -0
  42. package/dist/src/audio-C2sibT7Q.js +104 -0
  43. package/dist/src/audio-DXEXb03H.js +104 -0
  44. package/dist/src/audio-TkvojpwO.js +105 -0
  45. package/dist/src/authoritativeMarkupInjection-BAT9B-Wj.js +79 -0
  46. package/dist/src/authoritativeMarkupInjection-B_yHETKT.js +78 -0
  47. package/dist/src/authoritativeMarkupInjection-BfjecQ3Q.cjs +78 -0
  48. package/dist/src/authoritativeMarkupInjection-D-hDKrhD.js +78 -0
  49. package/dist/src/aws-B_9unI_-.js +1149 -0
  50. package/dist/src/aws-D0FY3qkc.js +2433 -0
  51. package/dist/src/aws-Dh1-a90n.js +2433 -0
  52. package/dist/src/aws-qskKGczY.cjs +2454 -0
  53. package/dist/src/base-CaWlBkVz.js +462 -0
  54. package/dist/src/base-CcViNwVs.js +255 -0
  55. package/dist/src/base-CsVbPJkU.cjs +467 -0
  56. package/dist/src/base-DNK9py25.js +255 -0
  57. package/dist/src/base-DlH5tjEZ.js +463 -0
  58. package/dist/src/base-DyLOZ_iX.js +256 -0
  59. package/dist/src/base-RRYXfG7l.cjs +305 -0
  60. package/dist/src/base-oXVgvtVn.js +462 -0
  61. package/dist/src/bedrock-BP17ZXbR.cjs +2 -0
  62. package/dist/src/bedrock-CsjM1dOt.js +1300 -0
  63. package/dist/src/bedrock-CzPwj8GO.js +1 -0
  64. package/dist/src/bedrock-eGXZw8oh.js +1 -0
  65. package/dist/src/bedrock-tSWjmXdj.js +2 -0
  66. package/dist/src/bestOfN-BQ93nUKV.js +160 -0
  67. package/dist/src/bestOfN-ByGGwlcb.cjs +161 -0
  68. package/dist/src/bestOfN-CbP7csHr.js +159 -0
  69. package/dist/src/bestOfN-xn6i2Xs2.js +159 -0
  70. package/dist/src/cache-CHq9hPz9.js +2 -0
  71. package/dist/src/cache-D-9eZN3I.js +754 -0
  72. package/dist/src/cache-DSm6t1MZ.js +741 -0
  73. package/dist/src/cache-DeF5zIEN.js +782 -0
  74. package/dist/src/cache-iG87oYan.cjs +856 -0
  75. package/dist/src/cerebras-CTtM4yMH.js +98 -0
  76. package/dist/src/cerebras-CogcJ3ce.cjs +97 -0
  77. package/dist/src/cerebras-DmkRypTh.js +97 -0
  78. package/dist/src/cerebras-GUp0B8JY.js +97 -0
  79. package/dist/src/chat-B4ihd3fw.js +226 -0
  80. package/dist/src/chat-B9cAQ_rS.js +227 -0
  81. package/dist/src/chat-BU7EB4R-.cjs +76 -0
  82. package/dist/src/chat-C8yxJ2-s.cjs +226 -0
  83. package/dist/src/chat-ClTFM3qq.js +934 -0
  84. package/dist/src/chat-Cnq0Is68.js +123 -0
  85. package/dist/src/chat-CwrurR57.cjs +987 -0
  86. package/dist/src/chat-D0lsojPv.js +124 -0
  87. package/dist/src/chat-D7_8yFIx.js +76 -0
  88. package/dist/src/chat-DCoETlLG.js +226 -0
  89. package/dist/src/chat-DHE7xaTR.js +76 -0
  90. package/dist/src/chat-DmhT6rz2.cjs +123 -0
  91. package/dist/src/chat-DvfMe8KI.js +123 -0
  92. package/dist/src/chat-DwP5kVnl.js +935 -0
  93. package/dist/src/chat-MB7U-QE2.js +77 -0
  94. package/dist/src/chat-zCWuBKAj.js +934 -0
  95. package/dist/src/claude-agent-sdk-23bIVI75.js +999 -0
  96. package/dist/src/claude-agent-sdk-BACpnIJi.cjs +1005 -0
  97. package/dist/src/claude-agent-sdk-BlYlmcEr.js +999 -0
  98. package/dist/src/claude-agent-sdk-Cr-jqJZl.js +1000 -0
  99. package/dist/src/client-BktbiPx9.cjs +357 -0
  100. package/dist/src/client-CjztEBmW.js +351 -0
  101. package/dist/src/client-mRs2UvH9.js +351 -0
  102. package/dist/src/client-uCz0ydjC.js +352 -0
  103. package/dist/src/cloud-BtYF555L.js +2 -0
  104. package/dist/src/cloud-CVSUEmAy.js +287 -0
  105. package/dist/src/cloud-D7Ifb-Fl.js +599 -0
  106. package/dist/src/cloud-DB5oK5NX.cjs +666 -0
  107. package/dist/src/cloud-ecu989Em.js +657 -0
  108. package/dist/src/cloud-ramjGURF.js +599 -0
  109. package/dist/src/cloudflare-ai-BfDkIjO8.js +133 -0
  110. package/dist/src/cloudflare-ai-D9HaXz1M.js +134 -0
  111. package/dist/src/cloudflare-ai-HrD5WUK8.js +132 -0
  112. package/dist/src/cloudflare-ai-Qdj8aKP2.cjs +133 -0
  113. package/dist/src/cloudflare-gateway-C81uKETQ.js +276 -0
  114. package/dist/src/cloudflare-gateway-CX5Z9X0k.js +276 -0
  115. package/dist/src/cloudflare-gateway-DW-og8gb.js +277 -0
  116. package/dist/src/cloudflare-gateway-iRyXo9n2.cjs +276 -0
  117. package/dist/src/codex-app-server-BFIrSgdy.js +2155 -0
  118. package/dist/src/codex-app-server-By1eDVD4.js +2 -0
  119. package/dist/src/codex-app-server-DKsF4qmY.js +2156 -0
  120. package/dist/src/codex-app-server-n7n4uZzC.cjs +2162 -0
  121. package/dist/src/codex-app-server-xAoELVxu.js +2155 -0
  122. package/dist/src/codex-sdk-C2ZLxa6r.js +1552 -0
  123. package/dist/src/codex-sdk-CzG02tQt.cjs +1588 -0
  124. package/dist/src/codex-sdk-DNxAOhiV.js +2 -0
  125. package/dist/src/codex-sdk-DT3aQezK.js +1557 -0
  126. package/dist/src/codex-sdk-pw9DpcJP.js +1557 -0
  127. package/dist/src/codex-security-B0bLmXJF.js +406 -0
  128. package/dist/src/codex-security-BhYs-3iY.js +406 -0
  129. package/dist/src/codex-security-DQcOfxYW.js +407 -0
  130. package/dist/src/codex-security-DsCWr6GZ.cjs +411 -0
  131. package/dist/src/cometapi-B16asPLX.cjs +55 -0
  132. package/dist/src/cometapi-MgTbZA_H.js +53 -0
  133. package/dist/src/cometapi-i33vKzPV.js +55 -0
  134. package/dist/src/cometapi-wK2UWK0X.js +56 -0
  135. package/dist/src/compatible-COj8ZCy9.js +24 -0
  136. package/dist/src/compatible-CRSsIUGb.cjs +24 -0
  137. package/dist/src/compatible-Dy1vCcNF.js +25 -0
  138. package/dist/src/compatible-aUItQrpk.js +24 -0
  139. package/dist/src/completion-Bn7COFMk.js +119 -0
  140. package/dist/src/completion-Bub2N48b.js +118 -0
  141. package/dist/src/completion-Cf2G9OlM.cjs +123 -0
  142. package/dist/src/conversationScoring-BiTYJ9MD.js +374 -0
  143. package/dist/src/conversationScoring-CKL47uIu.js +373 -0
  144. package/dist/src/conversationScoring-DCvQKp6k.cjs +398 -0
  145. package/dist/src/conversationScoring-DLNJtDZI.js +373 -0
  146. package/dist/src/crescendo-5iLk9WiJ.cjs +734 -0
  147. package/dist/src/crescendo-B5ylG7kW.js +733 -0
  148. package/dist/src/crescendo-BD7k6TIx.js +730 -0
  149. package/dist/src/crescendo-DqO2Ch0P.js +732 -0
  150. package/dist/src/custom-8rv_aG2K.js +617 -0
  151. package/dist/src/custom-BOtrIHFN.js +619 -0
  152. package/dist/src/custom-BvN8seCs.cjs +620 -0
  153. package/dist/src/custom-Cld9v_Y4.js +618 -0
  154. package/dist/src/dataUrl-BdHUey2l.cjs +3187 -0
  155. package/dist/src/dataUrl-DBMifX6C.js +3133 -0
  156. package/dist/src/dataUrl-DUSr-ZvI.js +2868 -0
  157. package/dist/src/decisions-CLazADTw.js +516 -0
  158. package/dist/src/decisions-D5X93awq.js +515 -0
  159. package/dist/src/decisions-DmaeArEn.js +515 -0
  160. package/dist/src/decisions-DyQJyHJz.cjs +514 -0
  161. package/dist/src/docker-C9NYQFeu.js +94 -0
  162. package/dist/src/docker-CGq3mMol.cjs +94 -0
  163. package/dist/src/docker-DOm7nmpl.js +95 -0
  164. package/dist/src/docker-skFN-Kfo.js +93 -0
  165. package/dist/src/embedding-0UbzkTk9.js +82 -0
  166. package/dist/src/embedding-DTrSDt7k.cjs +86 -0
  167. package/dist/src/embedding-j2ORNl5H.js +81 -0
  168. package/dist/src/envoy-BvS8XTQO.js +60 -0
  169. package/dist/src/envoy-Cn6Hzw0e.js +60 -0
  170. package/dist/src/envoy-DC3KWcUY.cjs +60 -0
  171. package/dist/src/envoy-DetHjo5B.js +61 -0
  172. package/dist/src/eval-Cer9dPe9.js +1920 -0
  173. package/dist/src/eval-CytYmI2Z.js +2 -0
  174. package/dist/src/evalResult-DzOq5wt9.js +1300 -0
  175. package/dist/src/evaluator-BxCmvGtv.js +10578 -0
  176. package/dist/src/evaluator-Ct7YDELm.js +2 -0
  177. package/dist/src/evaluatorHelpers-B_AwIrsl.js +600 -0
  178. package/dist/src/evaluatorHelpers-D1Tpc7gd.js +601 -0
  179. package/dist/src/evaluatorHelpers-DRR3rLq0.cjs +622 -0
  180. package/dist/src/fetch-B5KxZuKu.js +1559 -0
  181. package/dist/src/fetch-BG_Jl7ty.js +1556 -0
  182. package/dist/src/fetch-BKlgUg08.cjs +1853 -0
  183. package/dist/src/fetch-C9Fsja0R.js +2 -0
  184. package/dist/src/fetch-CM7P8KWA.cjs +14 -0
  185. package/dist/src/fetch-D0FkIB3G.js +9 -0
  186. package/dist/src/fetch-RXHsZF-J.js +1280 -0
  187. package/dist/src/fetch-rSECy8jR.js +10 -0
  188. package/dist/src/functionCallbackUtils-BB9tmf6a.cjs +262 -0
  189. package/dist/src/functionCallbackUtils-BXk2iY01.js +246 -0
  190. package/dist/src/functionCallbackUtils-B_cYp7P5.js +245 -0
  191. package/dist/src/functionCallbackUtils-BfXnPo0o.js +245 -0
  192. package/dist/src/gemini-image-BXLMADDz.js +471 -0
  193. package/dist/src/gemini-image-BYUZyEUx.js +472 -0
  194. package/dist/src/gemini-image-DSt1QubZ.cjs +471 -0
  195. package/dist/src/gemini-image-DdNDMiZ_.js +471 -0
  196. package/dist/src/goat-9b-uU_k6.js +514 -0
  197. package/dist/src/goat-BCJuiDd0.js +515 -0
  198. package/dist/src/goat-CmAHbemm.js +512 -0
  199. package/dist/src/goat-DdOTdyoS.cjs +515 -0
  200. package/dist/src/goblin-Bp5C5lyb.js +22 -0
  201. package/dist/src/goblin-Dmr7GItI.js +23 -0
  202. package/dist/src/goblin-DpM8wxlf.cjs +22 -0
  203. package/dist/src/goblin-cJyH6Pq-.js +22 -0
  204. package/dist/src/google-B6eaPAbE.js +142 -0
  205. package/dist/src/google-D-FStdN6.cjs +142 -0
  206. package/dist/src/google-DAC7BsCW.js +142 -0
  207. package/dist/src/google-Id18H0Va.js +143 -0
  208. package/dist/src/graders-BjNQWkaB.js +2 -0
  209. package/dist/src/graders-CqdIp_vl.js +15470 -0
  210. package/dist/src/hydra-6Ouh74DE.js +610 -0
  211. package/dist/src/hydra-BHjhZnLB.cjs +612 -0
  212. package/dist/src/hydra-BL6k2REV.js +2 -0
  213. package/dist/src/hydra-BWUc0o67.js +613 -0
  214. package/dist/src/hydra-CUkEOLKw.js +612 -0
  215. package/dist/src/image-B6hG_xhb.js +481 -0
  216. package/dist/src/image-BFaq7Krd.cjs +209 -0
  217. package/dist/src/image-Bql5C0N9.cjs +504 -0
  218. package/dist/src/image-BtZfI2pT.js +163 -0
  219. package/dist/src/image-CIM4oN7Z.cjs +163 -0
  220. package/dist/src/image-CbAl7Jpu.js +209 -0
  221. package/dist/src/image-CiYm_yFw.js +209 -0
  222. package/dist/src/image-DCMNvBiV.js +163 -0
  223. package/dist/src/image-DL7pIuUZ.js +210 -0
  224. package/dist/src/image-ey0kxF8o.js +164 -0
  225. package/dist/src/image-smgIk3rE.js +482 -0
  226. package/dist/src/index.cjs +27 -27
  227. package/dist/src/index.d.cts +8 -8
  228. package/dist/src/index.js +27 -27
  229. package/dist/src/indirectWebPwn-B_-UpWY5.js +285 -0
  230. package/dist/src/indirectWebPwn-Cz3SLiEq.js +434 -0
  231. package/dist/src/indirectWebPwn-D2s8zGiM.cjs +463 -0
  232. package/dist/src/indirectWebPwn-DXbj2wGu.cjs +285 -0
  233. package/dist/src/indirectWebPwn-D_4H44E6.js +285 -0
  234. package/dist/src/indirectWebPwn-L044SrpV.js +434 -0
  235. package/dist/src/indirectWebPwn-cnmvdavH.js +435 -0
  236. package/dist/src/indirectWebPwn-zUBzsqTt.js +286 -0
  237. package/dist/src/interactions-Bu3oVQ-j.js +850 -0
  238. package/dist/src/interactions-CND010Lh.cjs +850 -0
  239. package/dist/src/interactions-DAx7tqUz.js +851 -0
  240. package/dist/src/interactions-DPkIumeh.js +850 -0
  241. package/dist/src/iterative-BO4JRnpG.js +545 -0
  242. package/dist/src/iterative-CAK-k9rz.js +548 -0
  243. package/dist/src/iterative-CDgHc0xO.cjs +549 -0
  244. package/dist/src/iterative-CXJlHLl9.js +547 -0
  245. package/dist/src/iterativeImage-BEdGKSmh.cjs +419 -0
  246. package/dist/src/iterativeImage-BfL0QZw5.js +417 -0
  247. package/dist/src/iterativeImage-C9KhnibC.js +417 -0
  248. package/dist/src/iterativeImage-btjkOfWG.js +418 -0
  249. package/dist/src/iterativeMeta-B5Bdw6QA.js +437 -0
  250. package/dist/src/iterativeMeta-C3mI4gpT.js +440 -0
  251. package/dist/src/iterativeMeta-Co2BKyqS.cjs +439 -0
  252. package/dist/src/iterativeMeta-DD8ihRWD.js +439 -0
  253. package/dist/src/iterativeTree-AMi4GV2O.js +878 -0
  254. package/dist/src/iterativeTree-C8FJOEje.cjs +879 -0
  255. package/dist/src/iterativeTree-CvrY1f2Z.js +877 -0
  256. package/dist/src/iterativeTree-bPtESmaD.js +876 -0
  257. package/dist/src/knowledgeBase-Cf5871e3.js +163 -0
  258. package/dist/src/knowledgeBase-D2PQhqLH.js +164 -0
  259. package/dist/src/knowledgeBase-DpoMw1IH.cjs +163 -0
  260. package/dist/src/knowledgeBase-npGFl763.js +163 -0
  261. package/dist/src/litellm-BBB5DQdt.cjs +146 -0
  262. package/dist/src/litellm-Bo43ow7r.js +145 -0
  263. package/dist/src/litellm-CaU8CMLS.js +146 -0
  264. package/dist/src/litellm-wY7Unh8o.js +147 -0
  265. package/dist/src/live-5g2w-M-E.js +891 -0
  266. package/dist/src/live-BfaXsDyD.cjs +891 -0
  267. package/dist/src/live-C1xewnGD.js +2 -0
  268. package/dist/src/live-DaF7nYy5.js +892 -0
  269. package/dist/src/live-lp3urLUw.js +891 -0
  270. package/dist/src/luma-ray-B7zvKGVG.js +309 -0
  271. package/dist/src/luma-ray-DCf5fnrz.cjs +309 -0
  272. package/dist/src/luma-ray-DepBcn6z.js +309 -0
  273. package/dist/src/luma-ray-XQC4M1pt.js +310 -0
  274. package/dist/src/main.js +26 -26
  275. package/dist/src/mantleChat-7xm95vSV.js +154 -0
  276. package/dist/src/mantleChat-CXhAs5RD.js +155 -0
  277. package/dist/src/mantleChat-CcE-zjfj.cjs +154 -0
  278. package/dist/src/mantleChat-Cpefl7Zm.js +154 -0
  279. package/dist/src/mcp-B0V0ikdM.js +84 -0
  280. package/dist/src/mcp-CV2k2gwj.js +85 -0
  281. package/dist/src/memoryPoisoning-BC5FQQWZ.js +111 -0
  282. package/dist/src/memoryPoisoning-BDwrtZKX.js +111 -0
  283. package/dist/src/memoryPoisoning-BFemS_FF.js +112 -0
  284. package/dist/src/memoryPoisoning-DRs2rbVV.cjs +111 -0
  285. package/dist/src/messages-Bc5oZoAJ.js +1128 -0
  286. package/dist/src/messages-BkaH8fRW.js +1127 -0
  287. package/dist/src/messages-CoHlziS5.js +1127 -0
  288. package/dist/src/messages-Cv_m6kYs.cjs +1161 -0
  289. package/dist/src/mischievousUser-BcyFxrqJ.js +51 -0
  290. package/dist/src/mischievousUser-BlhOQSd2.js +52 -0
  291. package/dist/src/mischievousUser-BuQiKE8D.js +51 -0
  292. package/dist/src/mischievousUser-ChIOk6cT.cjs +51 -0
  293. package/dist/src/modelslab-BXIWBTgX.js +171 -0
  294. package/dist/src/modelslab-ChVsUiaJ.js +170 -0
  295. package/dist/src/modelslab-DZ6BFlDv.js +170 -0
  296. package/dist/src/modelslab-DhRr-vyo.cjs +170 -0
  297. package/dist/src/nova-reel-BL8DrN4_.js +272 -0
  298. package/dist/src/nova-reel-BiOMUm5q.cjs +272 -0
  299. package/dist/src/nova-reel-CTsya1hV.js +273 -0
  300. package/dist/src/nova-reel-kgBY4Svd.js +272 -0
  301. package/dist/src/nova-sonic-CaSSA3Jq.cjs +374 -0
  302. package/dist/src/nova-sonic-DLpmoGsR.js +375 -0
  303. package/dist/src/nova-sonic-DwWc4SoN.js +374 -0
  304. package/dist/src/nova-sonic-qnReTaXm.js +374 -0
  305. package/dist/src/novita-B5mAt3Ui.js +114 -0
  306. package/dist/src/novita-D57vCjDD.js +116 -0
  307. package/dist/src/novita-ITRtG8IJ.js +115 -0
  308. package/dist/src/novita-Rh3T13YO.cjs +115 -0
  309. package/dist/src/nscale-8V7iZ_pI.js +210 -0
  310. package/dist/src/nscale-BQnMv4pH.cjs +209 -0
  311. package/dist/src/nscale-BWZXHZVF.js +209 -0
  312. package/dist/src/nscale-BqrHiUqU.js +207 -0
  313. package/dist/src/openaiResponses-BMtGTu8R.js +317 -0
  314. package/dist/src/openaiResponses-CvcI_viE.js +318 -0
  315. package/dist/src/openaiResponses-DYPZEMX1.cjs +318 -0
  316. package/dist/src/openaiResponses-DZTg1-kb.js +319 -0
  317. package/dist/src/openclaw-BeKuig4g.js +1338 -0
  318. package/dist/src/openclaw-COkdQ83y.js +1337 -0
  319. package/dist/src/openclaw-CSoX_HQ5.cjs +1344 -0
  320. package/dist/src/openclaw-DJlhPGCb.js +1336 -0
  321. package/dist/src/opencode-sdk-BEJftEs6.cjs +1018 -0
  322. package/dist/src/opencode-sdk-DMvBB3V7.js +1013 -0
  323. package/dist/src/opencode-sdk-Df7hMjLO.js +1012 -0
  324. package/dist/src/opencode-sdk-bQp5Xf3W.js +1012 -0
  325. package/dist/src/openinterpreter-B3GgVZjK.js +431 -0
  326. package/dist/src/openinterpreter-BiGcU-HN.cjs +435 -0
  327. package/dist/src/openinterpreter-Buj2l3Eh.js +432 -0
  328. package/dist/src/openinterpreter-C3_Cg5b_.js +431 -0
  329. package/dist/src/pricing-0Pampf0q.cjs +999 -0
  330. package/dist/src/pricing-B8VdhEhY.js +976 -0
  331. package/dist/src/pricing-CtLA-rKA.js +976 -0
  332. package/dist/src/promptfoo-4OkHtH9P.cjs +341 -0
  333. package/dist/src/promptfoo-Bhpm7sH6.js +286 -0
  334. package/dist/src/promptfoo-BqV8ogVA.js +285 -0
  335. package/dist/src/promptfoo-S1Q9OHk_.js +286 -0
  336. package/dist/src/providers-B5zs1ZRv.js +24437 -0
  337. package/dist/src/providers-Cd6CJh6m.js +2 -0
  338. package/dist/src/providers-CpJlgHET.js +24039 -0
  339. package/dist/src/providers-CzvLvK6G.cjs +24180 -0
  340. package/dist/src/quiverai-1E_IvLHn.js +325 -0
  341. package/dist/src/quiverai-BXH004Vv.js +325 -0
  342. package/dist/src/quiverai-Ccya2z8Y.cjs +325 -0
  343. package/dist/src/quiverai-Cez57oe-.js +326 -0
  344. package/dist/src/registry-3zX_M9Ik.js +131 -0
  345. package/dist/src/registry-AuCrKTvS.js +132 -0
  346. package/dist/src/registry-CxXWKtQG.js +131 -0
  347. package/dist/src/registry-DG3o66JQ.cjs +131 -0
  348. package/dist/src/remoteGeneration-CAtvamG6.js +370 -0
  349. package/dist/src/remoteGeneration-CF225pDl.cjs +482 -0
  350. package/dist/src/remoteGeneration-DtnqocnL.js +370 -0
  351. package/dist/src/remoteGeneration-g3KvW-sP.js +371 -0
  352. package/dist/src/responses-BMbaUXQI.js +1098 -0
  353. package/dist/src/responses-B_TOSof-.js +1099 -0
  354. package/dist/src/responses-v-yANwTA.cjs +1109 -0
  355. package/dist/src/runtimeTransform-BBZv-oUZ.js +156 -0
  356. package/dist/src/runtimeTransform-DT2v5ovW.js +156 -0
  357. package/dist/src/runtimeTransform-GXXEIXdS.cjs +161 -0
  358. package/dist/src/runtimeTransform-JTwBQc-P.js +157 -0
  359. package/dist/src/sagemaker-B8D0L4rj.cjs +716 -0
  360. package/dist/src/sagemaker-CR2_AGdB.js +713 -0
  361. package/dist/src/sagemaker-Cd9qSQUV.js +714 -0
  362. package/dist/src/sagemaker-mKlltN4p.js +713 -0
  363. package/dist/src/scanner-PG_8lh8r.js +1971 -0
  364. package/dist/src/server/index.js +55 -55
  365. package/dist/src/server-Bmh7sd9F.js +155 -0
  366. package/dist/src/server-C7b8z6aC.js +63 -0
  367. package/dist/src/server-CAcovgtL.js +2 -0
  368. package/dist/src/server-CuuMfKlh.cjs +74 -0
  369. package/dist/src/server-DMPCj9jy.js +189 -0
  370. package/dist/src/session-BksXvRH_.cjs +69 -0
  371. package/dist/src/session-DOxUjqGQ.js +63 -0
  372. package/dist/src/session-Dujsc-b9.js +62 -0
  373. package/dist/src/session-VjtIxREd.js +62 -0
  374. package/dist/src/shared-Bkyz_7e5.cjs +2185 -0
  375. package/dist/src/shared-DDJg8ycC.js +1929 -0
  376. package/dist/src/shared-Dh3yfRBd.js +1927 -0
  377. package/dist/src/shared-tfPT8Tna.js +1928 -0
  378. package/dist/src/simulatedUser-6JdkyL3k.cjs +252 -0
  379. package/dist/src/simulatedUser-CFr2mr3M.js +248 -0
  380. package/dist/src/simulatedUser-DjwwUqx-.js +247 -0
  381. package/dist/src/slack-C_gIYiUs.js +144 -0
  382. package/dist/src/slack-DhNbz9CM.cjs +144 -0
  383. package/dist/src/slack-Dm2iI1zu.js +145 -0
  384. package/dist/src/strategies-BIY-bNul.js +2248 -0
  385. package/dist/src/strategies-C1KQQj9G.cjs +2420 -0
  386. package/dist/src/strategies-DM_3mReG.js +2385 -0
  387. package/dist/src/telemetry-BhMTibZO.js +2 -0
  388. package/dist/src/telemetry-C04d25BM.cjs +216 -0
  389. package/dist/src/telemetry-CIqy4fSC.js +201 -0
  390. package/dist/src/telemetry-CXozp_6C.js +205 -0
  391. package/dist/src/telemetry-g7PkBxmY.js +205 -0
  392. package/dist/src/togetherai-BvCim68-.js +50 -0
  393. package/dist/src/togetherai-CWyDCA9m.cjs +49 -0
  394. package/dist/src/togetherai-CeSE31vK.js +49 -0
  395. package/dist/src/togetherai-_2W0URf8.js +48 -0
  396. package/dist/src/traceContext-Brw3Oe41.js +1016 -0
  397. package/dist/src/traceContext-DpAYv27G.js +1015 -0
  398. package/dist/src/traceContext-KSqhzZI2.cjs +1032 -0
  399. package/dist/src/transcription-BySopazW.js +175 -0
  400. package/dist/src/transcription-DO4UPkRI.cjs +178 -0
  401. package/dist/src/transcription-RJGBa-pC.js +176 -0
  402. package/dist/src/transcription-fZenF3G5.js +175 -0
  403. package/dist/src/transform-BzhRc5z2.js +125 -0
  404. package/dist/src/transform-CPQu05u6.cjs +154 -0
  405. package/dist/src/transform-DAED8imp.js +126 -0
  406. package/dist/src/transform-DIOIQDmM.js +125 -0
  407. package/dist/src/typesafe-ByE0Kxfg.js +253 -0
  408. package/dist/src/typesafe-CFqGFY34.js +253 -0
  409. package/dist/src/typesafe-DCWIw-CP.cjs +253 -0
  410. package/dist/src/typesafe-DyHFV5Qk.js +254 -0
  411. package/dist/src/util-BHkj9joz.js +2049 -0
  412. package/dist/src/util-CICwIpmu.cjs +934 -0
  413. package/dist/src/util-CePiY2xZ.js +286 -0
  414. package/dist/src/util-CgT3uf4p.js +743 -0
  415. package/dist/src/util-Cj9drvOY.js +1770 -0
  416. package/dist/src/util-ClJRjlQA.cjs +357 -0
  417. package/dist/src/util-Cxf8VF2M.js +395 -0
  418. package/dist/src/util-D7RdV7rS.js +395 -0
  419. package/dist/src/util-DMNFhk47.js +351 -0
  420. package/dist/src/util-DNzh3M0z.js +396 -0
  421. package/dist/src/util-Df7rfMGb.cjs +2305 -0
  422. package/dist/src/util-Kf0KnG_6.js +2051 -0
  423. package/dist/src/util-LEbeiYw_.js +743 -0
  424. package/dist/src/util-WH8CgVs4.js +352 -0
  425. package/dist/src/util-cx6Xw8Lw.cjs +478 -0
  426. package/dist/src/util-qzBqirBH.js +2050 -0
  427. package/dist/src/vertex-CBAMfRz3.js +854 -0
  428. package/dist/src/vertex-CMP2IpN9.js +2 -0
  429. package/dist/src/vertex-CZ5YOotT.js +848 -0
  430. package/dist/src/vertex-DNsh1F1M.cjs +871 -0
  431. package/dist/src/vertexLive-BTXYj3-F.js +55 -0
  432. package/dist/src/vertexLive-Ba_LAqEF.cjs +55 -0
  433. package/dist/src/vertexLive-DM4sFaaj.js +56 -0
  434. package/dist/src/vertexLive-JqZOw7HC.js +55 -0
  435. package/dist/src/video-BY7Q2Gii.cjs +706 -0
  436. package/dist/src/video-CYElP-CK.js +703 -0
  437. package/dist/src/video-C_AdEDH0.js +702 -0
  438. package/dist/src/video-DGvjQ_4j.js +702 -0
  439. package/package.json +1 -1
  440. package/dist/src/accounts-Dpb43yde.cjs +0 -276
  441. package/dist/src/accounts-GKrO1olH.js +0 -229
  442. package/dist/src/accounts-e4FGOsji.js +0 -227
  443. package/dist/src/accounts-sUiEJfkB.js +0 -222
  444. package/dist/src/agentWorkspace-B8A_wuMR.cjs +0 -619
  445. package/dist/src/agentWorkspace-DSPIscXR.js +0 -593
  446. package/dist/src/agentWorkspace-DxUqd-XK.js +0 -592
  447. package/dist/src/agentWorkspace-n0uOJXhD.js +0 -592
  448. package/dist/src/agentic-utils-9bCj4twQ.js +0 -197
  449. package/dist/src/agentic-utils-CyCLuLoj.js +0 -197
  450. package/dist/src/agentic-utils-D23qtOlx.cjs +0 -237
  451. package/dist/src/agentic-utils-DuBMMNCw.js +0 -198
  452. package/dist/src/agents-6hDRNoYD.js +0 -777
  453. package/dist/src/agents-B8w2o7Sc.cjs +0 -777
  454. package/dist/src/agents-Ck0NXl7v.js +0 -777
  455. package/dist/src/agents-CwT3B1qB.js +0 -778
  456. package/dist/src/agents-DOLjfOEq.js +0 -266
  457. package/dist/src/agents-OcF9hq--.js +0 -267
  458. package/dist/src/agents-api-CnZZt8bn.cjs +0 -710
  459. package/dist/src/agents-api-D04u3bmL.js +0 -711
  460. package/dist/src/agents-api-DWw0_Vio.js +0 -710
  461. package/dist/src/agents-api-IWHEwp8i.js +0 -710
  462. package/dist/src/agents-mHt2Mh9O.cjs +0 -266
  463. package/dist/src/agents-sICccZCA.js +0 -266
  464. package/dist/src/ai.studio-Ci4rypDT.js +0 -2
  465. package/dist/src/ai.studio-KkQ6KaHa.js +0 -369
  466. package/dist/src/ai.studio-gSXK2cGI.js +0 -374
  467. package/dist/src/ai.studio-nQF_B4DH.cjs +0 -391
  468. package/dist/src/aimlapi-BeSk5BDV.js +0 -30
  469. package/dist/src/aimlapi-CzNUhdKu.cjs +0 -29
  470. package/dist/src/aimlapi-DCkazDPI.js +0 -29
  471. package/dist/src/aimlapi-WeH5B6K1.js +0 -28
  472. package/dist/src/anthropicMessages-AcNWTpYO.js +0 -115
  473. package/dist/src/anthropicMessages-BUtvzbpL.js +0 -114
  474. package/dist/src/anthropicMessages-DTWhZDCd.js +0 -114
  475. package/dist/src/anthropicMessages-lGVnSgyx.cjs +0 -114
  476. package/dist/src/app/assets/index-CyEI5aDN.js +0 -392
  477. package/dist/src/audio-BE_Duiu1.js +0 -104
  478. package/dist/src/audio-CiUd00k2.cjs +0 -104
  479. package/dist/src/audio-Dop6omna.js +0 -105
  480. package/dist/src/audio-EZNTInr_.js +0 -104
  481. package/dist/src/authoritativeMarkupInjection-BUqH6hNk.js +0 -78
  482. package/dist/src/authoritativeMarkupInjection-BmbJdJO0.cjs +0 -78
  483. package/dist/src/authoritativeMarkupInjection-Cpz12Y3w.js +0 -78
  484. package/dist/src/authoritativeMarkupInjection-W4XfcH91.js +0 -79
  485. package/dist/src/aws-B2Jqbnet.js +0 -2433
  486. package/dist/src/aws-DHtuUIzQ.js +0 -1149
  487. package/dist/src/aws-DLqXP6wY.js +0 -2433
  488. package/dist/src/aws-DfduhmwL.cjs +0 -2454
  489. package/dist/src/base-B9L2Xvpc.js +0 -255
  490. package/dist/src/base-BTZnIsuH.cjs +0 -305
  491. package/dist/src/base-BhaWNQPJ.js +0 -462
  492. package/dist/src/base-Br-G_Xou.js +0 -256
  493. package/dist/src/base-Bzo8hiUS.cjs +0 -467
  494. package/dist/src/base-C82fd2jq.js +0 -463
  495. package/dist/src/base-CRdQwC1W.js +0 -462
  496. package/dist/src/base-CjGwZNOQ.js +0 -255
  497. package/dist/src/bedrock-BdMru_ro.js +0 -1300
  498. package/dist/src/bedrock-CBUmfLX1.cjs +0 -2
  499. package/dist/src/bedrock-DBDxBaF9.js +0 -2
  500. package/dist/src/bedrock-DDrECM21.js +0 -1
  501. package/dist/src/bedrock-DVwkgvRS.js +0 -1
  502. package/dist/src/bestOfN-AKF5beq4.js +0 -159
  503. package/dist/src/bestOfN-C1UIVGJV.js +0 -160
  504. package/dist/src/bestOfN-DlkETbXy.cjs +0 -161
  505. package/dist/src/bestOfN-XIfEgU-g.js +0 -159
  506. package/dist/src/cache-BZaVoKaA.js +0 -2
  507. package/dist/src/cache-CEYhFUsH.js +0 -741
  508. package/dist/src/cache-Cbw1zH6q.js +0 -782
  509. package/dist/src/cache-CdaZNb75.js +0 -754
  510. package/dist/src/cache-DpuIzPxh.cjs +0 -856
  511. package/dist/src/cerebras-Bpn6FPkJ.js +0 -97
  512. package/dist/src/cerebras-CqJ0BRCJ.cjs +0 -97
  513. package/dist/src/cerebras-D4ILa_TY.js +0 -97
  514. package/dist/src/cerebras-DR8uc7ee.js +0 -98
  515. package/dist/src/chat-B7PZfaYp.cjs +0 -987
  516. package/dist/src/chat-BVuSjdEb.js +0 -227
  517. package/dist/src/chat-BsaZRjXN.js +0 -76
  518. package/dist/src/chat-C5liqe3Y.js +0 -226
  519. package/dist/src/chat-C9hyHf5B.js +0 -124
  520. package/dist/src/chat-CFLalAck.js +0 -226
  521. package/dist/src/chat-CN8JGrHu.js +0 -76
  522. package/dist/src/chat-CaHBBpCb.js +0 -123
  523. package/dist/src/chat-CcbLSghx.js +0 -123
  524. package/dist/src/chat-CoSN6sr2.js +0 -934
  525. package/dist/src/chat-CsJRFX8a.cjs +0 -226
  526. package/dist/src/chat-DFoZLvO_.js +0 -934
  527. package/dist/src/chat-DiLQvL7r.js +0 -77
  528. package/dist/src/chat-F6qVSDk3.cjs +0 -123
  529. package/dist/src/chat-Oq4FaJgI.cjs +0 -76
  530. package/dist/src/chat-knMfQUKz.js +0 -935
  531. package/dist/src/claude-agent-sdk-CJkOLpnI.js +0 -999
  532. package/dist/src/claude-agent-sdk-Ckn76PRD.js +0 -999
  533. package/dist/src/claude-agent-sdk-DX0gTr11.cjs +0 -1005
  534. package/dist/src/claude-agent-sdk-LMeikxoR.js +0 -1000
  535. package/dist/src/client-BFf1r6Z8.js +0 -352
  536. package/dist/src/client-CdXyDdDi.js +0 -351
  537. package/dist/src/client-DV8XMu7i.js +0 -351
  538. package/dist/src/client-iEXtOBKW.cjs +0 -357
  539. package/dist/src/cloud-B02qcpjf.js +0 -2
  540. package/dist/src/cloud-BlHP-g1v.cjs +0 -666
  541. package/dist/src/cloud-C9BI4isF.js +0 -287
  542. package/dist/src/cloud-CTTLNdvj.js +0 -657
  543. package/dist/src/cloud-D5X5yQ_d.js +0 -599
  544. package/dist/src/cloud-QxPkpsHA.js +0 -599
  545. package/dist/src/cloudflare-ai-DRTRT1fc.js +0 -132
  546. package/dist/src/cloudflare-ai-DgaXapAV.cjs +0 -133
  547. package/dist/src/cloudflare-ai-DkuJXijS.js +0 -134
  548. package/dist/src/cloudflare-ai-wy9QCHku.js +0 -133
  549. package/dist/src/cloudflare-gateway-9cAN8g29.cjs +0 -276
  550. package/dist/src/cloudflare-gateway-BVFMD292.js +0 -277
  551. package/dist/src/cloudflare-gateway-BuUI4p6I.js +0 -276
  552. package/dist/src/cloudflare-gateway-TlYHizbW.js +0 -276
  553. package/dist/src/codex-app-server-BPz_feug.cjs +0 -2162
  554. package/dist/src/codex-app-server-C9noXM9C.js +0 -2155
  555. package/dist/src/codex-app-server-CEmD-Y5U.js +0 -2
  556. package/dist/src/codex-app-server-DZolc18r.js +0 -2156
  557. package/dist/src/codex-app-server-Dd0A37nO.js +0 -2155
  558. package/dist/src/codex-sdk-BbxjBvBk.cjs +0 -1588
  559. package/dist/src/codex-sdk-BpXeIs-_.js +0 -1557
  560. package/dist/src/codex-sdk-BtQp5X0f.js +0 -1552
  561. package/dist/src/codex-sdk-CH0v9Bk1.js +0 -2
  562. package/dist/src/codex-sdk-CgrN7JB8.js +0 -1557
  563. package/dist/src/codex-security-B5fENNUr.js +0 -406
  564. package/dist/src/codex-security-C6uuJx-y.cjs +0 -411
  565. package/dist/src/codex-security-CifWtZR_.js +0 -407
  566. package/dist/src/codex-security-Kg2bOEKy.js +0 -406
  567. package/dist/src/cometapi-BFpIDLIx.js +0 -55
  568. package/dist/src/cometapi-C6O2PIrN.js +0 -56
  569. package/dist/src/cometapi-D5Yupc6F.js +0 -53
  570. package/dist/src/cometapi-DzgIwJzJ.cjs +0 -55
  571. package/dist/src/compatible-0jhmVfOp.js +0 -25
  572. package/dist/src/compatible-DdtwWdJi.cjs +0 -24
  573. package/dist/src/compatible-Di4nR3sU.js +0 -24
  574. package/dist/src/compatible-iJKLWdnf.js +0 -24
  575. package/dist/src/completion-B0_hVUDG.js +0 -119
  576. package/dist/src/completion-BdI6v0-Q.cjs +0 -123
  577. package/dist/src/completion-CWcJscwv.js +0 -118
  578. package/dist/src/conversationScoring-99EOPJRa.js +0 -373
  579. package/dist/src/conversationScoring-BIq4J0Cq.js +0 -374
  580. package/dist/src/conversationScoring-DARyeATr.cjs +0 -398
  581. package/dist/src/conversationScoring-DS48t4Hb.js +0 -373
  582. package/dist/src/crescendo-CebvXIu4.js +0 -730
  583. package/dist/src/crescendo-CxrLS0oo.js +0 -732
  584. package/dist/src/crescendo-DZQXBSkj.js +0 -733
  585. package/dist/src/crescendo-wjEx68uD.cjs +0 -734
  586. package/dist/src/custom-BiQ-aUNw.cjs +0 -620
  587. package/dist/src/custom-ByyB5Z93.js +0 -619
  588. package/dist/src/custom-C5jOevNb.js +0 -617
  589. package/dist/src/custom-CCrsCz8o.js +0 -618
  590. package/dist/src/dataUrl-C9J7wz9H.js +0 -3133
  591. package/dist/src/dataUrl-CGsBT7UZ.cjs +0 -3187
  592. package/dist/src/dataUrl-CzKvvWNO.js +0 -2868
  593. package/dist/src/decisions-BTusXCUx.cjs +0 -514
  594. package/dist/src/decisions-BYtL9edD.js +0 -515
  595. package/dist/src/decisions-jYix_gCF.js +0 -515
  596. package/dist/src/decisions-nxxfHRAN.js +0 -516
  597. package/dist/src/docker-DDIv4zkg.js +0 -93
  598. package/dist/src/docker-DVLp_5OG.js +0 -94
  599. package/dist/src/docker-INm9w0SY.cjs +0 -94
  600. package/dist/src/docker-sGuoCul_.js +0 -95
  601. package/dist/src/embedding-CAhqLLrR.js +0 -82
  602. package/dist/src/embedding-D94GAsti.cjs +0 -86
  603. package/dist/src/embedding-zb4MAzQy.js +0 -81
  604. package/dist/src/envoy-BMPszwEa.cjs +0 -60
  605. package/dist/src/envoy-Bp-s39_8.js +0 -60
  606. package/dist/src/envoy-BswDt-Ou.js +0 -61
  607. package/dist/src/envoy-rVbYcV80.js +0 -60
  608. package/dist/src/eval-B1-XfrC7.js +0 -2
  609. package/dist/src/eval-pC4qCvLw.js +0 -1920
  610. package/dist/src/evalResult-CzjCb5bd.js +0 -1300
  611. package/dist/src/evaluator-CNq2K7J_.js +0 -10578
  612. package/dist/src/evaluator-LtfxdxEu.js +0 -2
  613. package/dist/src/evaluatorHelpers-C5J0NYpQ.js +0 -601
  614. package/dist/src/evaluatorHelpers-DcdCglCs.cjs +0 -622
  615. package/dist/src/evaluatorHelpers-Rvb88W6B.js +0 -600
  616. package/dist/src/fetch-5HtnNhHg.js +0 -1556
  617. package/dist/src/fetch-BCwjoIFd.js +0 -1559
  618. package/dist/src/fetch-BhfUnKen.js +0 -1280
  619. package/dist/src/fetch-C08w4vVl.js +0 -9
  620. package/dist/src/fetch-DBxy8Tlb.cjs +0 -14
  621. package/dist/src/fetch-DYte6oQX.cjs +0 -1853
  622. package/dist/src/fetch-ElpfcAVG.js +0 -10
  623. package/dist/src/fetch-lM1OIaSt.js +0 -2
  624. package/dist/src/functionCallbackUtils-BCAdWfHO.js +0 -246
  625. package/dist/src/functionCallbackUtils-BYq9qOhG.js +0 -245
  626. package/dist/src/functionCallbackUtils-ByWkmVud.cjs +0 -262
  627. package/dist/src/functionCallbackUtils-D_C_JaFd.js +0 -245
  628. package/dist/src/gemini-image-CAlwaJhZ.js +0 -471
  629. package/dist/src/gemini-image-DJoVoOnZ.cjs +0 -471
  630. package/dist/src/gemini-image-Waio-9Xx.js +0 -472
  631. package/dist/src/gemini-image-vbY6Ftbf.js +0 -471
  632. package/dist/src/goat-BWbtyY9c.js +0 -512
  633. package/dist/src/goat-CXzzeCOQ.cjs +0 -515
  634. package/dist/src/goat-CfgvzSgZ.js +0 -514
  635. package/dist/src/goat-DLeoIHBp.js +0 -515
  636. package/dist/src/goblin-CmfCfwqk.cjs +0 -22
  637. package/dist/src/goblin-CtcaORRH.js +0 -22
  638. package/dist/src/goblin-DF6DDhM-.js +0 -22
  639. package/dist/src/goblin-Nai0xxBV.js +0 -23
  640. package/dist/src/google-ClpkLtKL.cjs +0 -142
  641. package/dist/src/google-CrFgKu9k.js +0 -143
  642. package/dist/src/google-Dj_EIBqS.js +0 -142
  643. package/dist/src/google-e4-vARv6.js +0 -142
  644. package/dist/src/graders-BN1IIa71.js +0 -15470
  645. package/dist/src/graders-C5sCfSP5.js +0 -2
  646. package/dist/src/hydra-B7RfXVBK.js +0 -2
  647. package/dist/src/hydra-C1cFN-Jg.js +0 -613
  648. package/dist/src/hydra-CK6Uc1ia.js +0 -612
  649. package/dist/src/hydra-Dg65rAP_.js +0 -610
  650. package/dist/src/hydra-Fqx8l_Xu.cjs +0 -612
  651. package/dist/src/image-BdlUDAtp.js +0 -163
  652. package/dist/src/image-C-KwEhwt.cjs +0 -163
  653. package/dist/src/image-C76fp6NK.cjs +0 -209
  654. package/dist/src/image-D75ehv3D.js +0 -482
  655. package/dist/src/image-DKtc5v5W.js +0 -209
  656. package/dist/src/image-DT_xOkJY.js +0 -163
  657. package/dist/src/image-DVpdllEE.js +0 -209
  658. package/dist/src/image-DXZ8AzMf.js +0 -481
  659. package/dist/src/image-DZl_1mvy.js +0 -164
  660. package/dist/src/image-DcTD7Ak0.cjs +0 -504
  661. package/dist/src/image-ndxEvBKB.js +0 -210
  662. package/dist/src/indirectWebPwn-70WA5x_q.js +0 -435
  663. package/dist/src/indirectWebPwn-BRVyd3qV.cjs +0 -463
  664. package/dist/src/indirectWebPwn-BsJVsu0q.js +0 -285
  665. package/dist/src/indirectWebPwn-Cw6yJu0i.js +0 -285
  666. package/dist/src/indirectWebPwn-D-PhJzo4.js +0 -286
  667. package/dist/src/indirectWebPwn-DRPHt2I8.js +0 -434
  668. package/dist/src/indirectWebPwn-DXtfFhd9.cjs +0 -285
  669. package/dist/src/indirectWebPwn-DvpNouzc.js +0 -434
  670. package/dist/src/interactions-5ixfW7Cl.js +0 -850
  671. package/dist/src/interactions-BOUzfmg1.cjs +0 -850
  672. package/dist/src/interactions-CSSXcGNc.js +0 -851
  673. package/dist/src/interactions-WB_sgkN0.js +0 -850
  674. package/dist/src/iterative-BShRNqjC.cjs +0 -549
  675. package/dist/src/iterative-BcW_ELtB.js +0 -548
  676. package/dist/src/iterative-BpHbHz8B.js +0 -547
  677. package/dist/src/iterative-YcchP12d.js +0 -545
  678. package/dist/src/iterativeImage-BMFE5Hl7.cjs +0 -419
  679. package/dist/src/iterativeImage-CkSaYLMY.js +0 -417
  680. package/dist/src/iterativeImage-DAEUlQX_.js +0 -418
  681. package/dist/src/iterativeImage-DeUSkEnj.js +0 -417
  682. package/dist/src/iterativeMeta-DbdaKdEO.cjs +0 -439
  683. package/dist/src/iterativeMeta-DcF9JWEK.js +0 -437
  684. package/dist/src/iterativeMeta-DkfPqWIC.js +0 -439
  685. package/dist/src/iterativeMeta-DkrpnVSs.js +0 -440
  686. package/dist/src/iterativeTree-CEMY1FhE.cjs +0 -879
  687. package/dist/src/iterativeTree-Cv5W4tX9.js +0 -877
  688. package/dist/src/iterativeTree-DGvomd3M.js +0 -876
  689. package/dist/src/iterativeTree-KbtC2Mkz.js +0 -878
  690. package/dist/src/knowledgeBase-AYRXn4wO.js +0 -163
  691. package/dist/src/knowledgeBase-BNqQfx01.js +0 -163
  692. package/dist/src/knowledgeBase-C0IaCCVs.js +0 -164
  693. package/dist/src/knowledgeBase-C2uj6wK4.cjs +0 -163
  694. package/dist/src/litellm-CN1ScAwZ.js +0 -147
  695. package/dist/src/litellm-CTjwiKSa.js +0 -146
  696. package/dist/src/litellm-Cd4Nj5ue.js +0 -145
  697. package/dist/src/litellm-DMqLpEBg.cjs +0 -146
  698. package/dist/src/live-Bt50-InO.cjs +0 -891
  699. package/dist/src/live-Bu2ujadG.js +0 -2
  700. package/dist/src/live-C3M52i3p.js +0 -891
  701. package/dist/src/live-CRfHMO3B.js +0 -892
  702. package/dist/src/live-iCIpO14m.js +0 -891
  703. package/dist/src/luma-ray-B8eHC4c8.cjs +0 -309
  704. package/dist/src/luma-ray-BIvkPw0s.js +0 -309
  705. package/dist/src/luma-ray-ChsiBxMA.js +0 -309
  706. package/dist/src/luma-ray-DAvKrInz.js +0 -310
  707. package/dist/src/mantleChat-5YeEXAZI.js +0 -154
  708. package/dist/src/mantleChat-D--mW3hl.js +0 -154
  709. package/dist/src/mantleChat-DHP3siNg.cjs +0 -154
  710. package/dist/src/mantleChat-wBfAX46o.js +0 -155
  711. package/dist/src/mcp-49jlEcTQ.js +0 -85
  712. package/dist/src/mcp-__PIz81I.js +0 -84
  713. package/dist/src/memoryPoisoning-Chxge74M.js +0 -111
  714. package/dist/src/memoryPoisoning-QH6NCUVE.js +0 -112
  715. package/dist/src/memoryPoisoning-tCxZt8Nz.js +0 -111
  716. package/dist/src/memoryPoisoning-ymrRItRR.cjs +0 -111
  717. package/dist/src/messages-BE_eZ7NA.js +0 -1127
  718. package/dist/src/messages-Bo638ShI.js +0 -1127
  719. package/dist/src/messages-BzR0-NQ1.js +0 -1128
  720. package/dist/src/messages-Cbg5Pfd0.cjs +0 -1161
  721. package/dist/src/mischievousUser-BtED2Z5Z.cjs +0 -51
  722. package/dist/src/mischievousUser-KqSOjrDJ.js +0 -51
  723. package/dist/src/mischievousUser-YMD41YNZ.js +0 -51
  724. package/dist/src/mischievousUser-zBxlNdCu.js +0 -52
  725. package/dist/src/modelslab-B8gZxtfE.js +0 -171
  726. package/dist/src/modelslab-C7bmVpTB.js +0 -170
  727. package/dist/src/modelslab-CCeQCTZg.js +0 -170
  728. package/dist/src/modelslab-CvBJGv7y.cjs +0 -170
  729. package/dist/src/nova-reel-BOEWsEKA.cjs +0 -272
  730. package/dist/src/nova-reel-BtyBXq5M.js +0 -273
  731. package/dist/src/nova-reel-C1eF3-EE.js +0 -272
  732. package/dist/src/nova-reel-YhgrxEKT.js +0 -272
  733. package/dist/src/nova-sonic-BaERP20w.js +0 -374
  734. package/dist/src/nova-sonic-CxgM3O-P.cjs +0 -374
  735. package/dist/src/nova-sonic-DJS22fC3.js +0 -375
  736. package/dist/src/nova-sonic-DwvwHyRX.js +0 -374
  737. package/dist/src/novita-D1l2tG0O.js +0 -116
  738. package/dist/src/novita-D84VM3v0.cjs +0 -115
  739. package/dist/src/novita-DGInvwfR.js +0 -115
  740. package/dist/src/novita-vXHkXhTg.js +0 -114
  741. package/dist/src/nscale-CU0Ldr00.js +0 -209
  742. package/dist/src/nscale-ClfKlQeM.cjs +0 -209
  743. package/dist/src/nscale-DxaVnF0x.js +0 -210
  744. package/dist/src/nscale-_poVxIrO.js +0 -207
  745. package/dist/src/openaiResponses-CJGsneNj.js +0 -317
  746. package/dist/src/openaiResponses-CKSl5Sdg.js +0 -319
  747. package/dist/src/openaiResponses-DC8rzFUc.js +0 -318
  748. package/dist/src/openaiResponses-rMHIA3dV.cjs +0 -318
  749. package/dist/src/openclaw-CCbvsNFW.cjs +0 -1344
  750. package/dist/src/openclaw-CZw1lCDZ.js +0 -1336
  751. package/dist/src/openclaw-ChFLgC-a.js +0 -1338
  752. package/dist/src/openclaw-DrPMoRrH.js +0 -1337
  753. package/dist/src/opencode-sdk-2EfIDhFp.cjs +0 -1018
  754. package/dist/src/opencode-sdk-CHw3F845.js +0 -1013
  755. package/dist/src/opencode-sdk-D0EGGxvy.js +0 -1012
  756. package/dist/src/opencode-sdk-jSS7NI2Q.js +0 -1012
  757. package/dist/src/openinterpreter-CY622xHC.js +0 -431
  758. package/dist/src/openinterpreter-DATyhuhP.js +0 -432
  759. package/dist/src/openinterpreter-DDUMyIf1.js +0 -431
  760. package/dist/src/openinterpreter-s5Tz6Lid.cjs +0 -435
  761. package/dist/src/pricing-C498twd2.js +0 -976
  762. package/dist/src/pricing-DBd_bMIh.cjs +0 -999
  763. package/dist/src/pricing-ISrMCskv.js +0 -976
  764. package/dist/src/promptfoo-6p0WG2ih.js +0 -286
  765. package/dist/src/promptfoo-BQRfgNs_.js +0 -285
  766. package/dist/src/promptfoo-Bqo88z20.cjs +0 -341
  767. package/dist/src/promptfoo-Cq5AVI3I.js +0 -286
  768. package/dist/src/providers-ATbeMX5E.cjs +0 -24180
  769. package/dist/src/providers-B7F1FiNI.js +0 -2
  770. package/dist/src/providers-DazIw8mI.js +0 -24039
  771. package/dist/src/providers-QvGlNAD0.js +0 -24437
  772. package/dist/src/quiverai-BPlNcLkV.cjs +0 -325
  773. package/dist/src/quiverai-By99-YmJ.js +0 -325
  774. package/dist/src/quiverai-CmmByDqo.js +0 -325
  775. package/dist/src/quiverai-HZkoJJqw.js +0 -326
  776. package/dist/src/registry-BLTnTfjT.cjs +0 -131
  777. package/dist/src/registry-BMC-COHT.js +0 -132
  778. package/dist/src/registry-C8UZtmBp.js +0 -131
  779. package/dist/src/registry-CfwEUYXG.js +0 -131
  780. package/dist/src/remoteGeneration-Bgg6kC5V.js +0 -370
  781. package/dist/src/remoteGeneration-CKJFE960.cjs +0 -482
  782. package/dist/src/remoteGeneration-DaxwJDKv.js +0 -370
  783. package/dist/src/remoteGeneration-vHMGVKr1.js +0 -371
  784. package/dist/src/responses-BvnyIHrq.js +0 -1099
  785. package/dist/src/responses-CERAgvf-.js +0 -1098
  786. package/dist/src/responses-CwgjeuOg.cjs +0 -1109
  787. package/dist/src/runtimeTransform-3RF9Avyg.cjs +0 -161
  788. package/dist/src/runtimeTransform-C51Z5j4H.js +0 -156
  789. package/dist/src/runtimeTransform-CKE_Iyv8.js +0 -157
  790. package/dist/src/runtimeTransform-Cs11xJpj.js +0 -156
  791. package/dist/src/sagemaker-BJ4dOCxE.js +0 -713
  792. package/dist/src/sagemaker-Bt3JUAWq.js +0 -714
  793. package/dist/src/sagemaker-QVKyLgLF.cjs +0 -716
  794. package/dist/src/sagemaker-l3IB8iTs.js +0 -713
  795. package/dist/src/scanner-DGjIiTZ1.js +0 -1971
  796. package/dist/src/server-BNaLZH6u.js +0 -63
  797. package/dist/src/server-CBMuQul3.js +0 -189
  798. package/dist/src/server-CMKKIzKv.cjs +0 -74
  799. package/dist/src/server-CN2IS9Cs.js +0 -155
  800. package/dist/src/server-ua4cqbjC.js +0 -2
  801. package/dist/src/session-CQIjq_HZ.cjs +0 -69
  802. package/dist/src/session-FTlg8sEu.js +0 -62
  803. package/dist/src/session-GBQXtPWp.js +0 -63
  804. package/dist/src/session-_0-rTdwY.js +0 -62
  805. package/dist/src/shared-BtuO-OAM.js +0 -1927
  806. package/dist/src/shared-Ci78wTZX.js +0 -1928
  807. package/dist/src/shared-Dd3rimdM.js +0 -1929
  808. package/dist/src/shared-KAjFxRre.cjs +0 -2185
  809. package/dist/src/simulatedUser--OjW6xCx.js +0 -247
  810. package/dist/src/simulatedUser-D0-slRye.cjs +0 -252
  811. package/dist/src/simulatedUser-D1Kh_cwA.js +0 -248
  812. package/dist/src/slack-BX0FUevO.js +0 -144
  813. package/dist/src/slack-CcwXFiJE.cjs +0 -144
  814. package/dist/src/slack-CnfqKfXp.js +0 -145
  815. package/dist/src/strategies-2ntcK4tN.js +0 -2248
  816. package/dist/src/strategies-DZIW7Zcs.js +0 -2385
  817. package/dist/src/strategies-YRDF2j-N.cjs +0 -2420
  818. package/dist/src/telemetry-CL8CVA4p.js +0 -205
  819. package/dist/src/telemetry-Cix90qqz.js +0 -201
  820. package/dist/src/telemetry-CkmlqTjV.js +0 -205
  821. package/dist/src/telemetry-DQH7l5bb.js +0 -2
  822. package/dist/src/telemetry-DUCXc1-r.cjs +0 -216
  823. package/dist/src/togetherai-3yUt5Ck7.js +0 -49
  824. package/dist/src/togetherai-BJUByLwt.cjs +0 -49
  825. package/dist/src/togetherai-Bh6KZkmd.js +0 -50
  826. package/dist/src/togetherai-DDl9yk3b.js +0 -48
  827. package/dist/src/traceContext-BiJVppjT.cjs +0 -1032
  828. package/dist/src/traceContext-CKKluULP.js +0 -1016
  829. package/dist/src/traceContext-D3Sk8fO-.js +0 -1015
  830. package/dist/src/transcription-BoVQKIVz.js +0 -175
  831. package/dist/src/transcription-Bs5u8780.js +0 -175
  832. package/dist/src/transcription-Dl654d1p.cjs +0 -178
  833. package/dist/src/transcription-VEvhM1Fu.js +0 -176
  834. package/dist/src/transform-BAbkGpvl.js +0 -125
  835. package/dist/src/transform-C_j4hUH8.js +0 -126
  836. package/dist/src/transform-Da86hs4M.cjs +0 -154
  837. package/dist/src/transform-_i1raQNo.js +0 -125
  838. package/dist/src/typesafe-CKXBeh82.cjs +0 -253
  839. package/dist/src/typesafe-D3VaGeNm.js +0 -253
  840. package/dist/src/typesafe-DYM-SFNH.js +0 -253
  841. package/dist/src/typesafe-LXmSbw8F.js +0 -254
  842. package/dist/src/util-41rb0XHX.js +0 -743
  843. package/dist/src/util-B0WlHYFM.js +0 -2049
  844. package/dist/src/util-BD1R_PsR.js +0 -1770
  845. package/dist/src/util-BLbM_ItC.js +0 -395
  846. package/dist/src/util-C72P0iIa.js +0 -352
  847. package/dist/src/util-C7MpGlJ6.cjs +0 -2305
  848. package/dist/src/util-CCtqagKc.js +0 -286
  849. package/dist/src/util-CM2Ec_uY.js +0 -2051
  850. package/dist/src/util-CSSAWO8v.js +0 -351
  851. package/dist/src/util-CkQc-fx3.cjs +0 -934
  852. package/dist/src/util-DcOlFTFa.cjs +0 -478
  853. package/dist/src/util-DluGTGVB.js +0 -395
  854. package/dist/src/util-PfQ60chz.js +0 -743
  855. package/dist/src/util-f14-CPij.js +0 -396
  856. package/dist/src/util-l9pXX3Eu.cjs +0 -357
  857. package/dist/src/util-o_BnlYqS.js +0 -2050
  858. package/dist/src/vertex-B_-gQgzc.js +0 -2
  859. package/dist/src/vertex-CU4gqoYa.js +0 -854
  860. package/dist/src/vertex-DZ42UHb3.js +0 -848
  861. package/dist/src/vertex-DsYQJA0T.cjs +0 -871
  862. package/dist/src/vertexLive-BvIaHKGB.js +0 -55
  863. package/dist/src/vertexLive-CTULqNx7.js +0 -56
  864. package/dist/src/vertexLive-DjJ_YQBe.cjs +0 -55
  865. package/dist/src/vertexLive-STUGcteB.js +0 -55
  866. package/dist/src/video-CAQGmtEV.js +0 -703
  867. package/dist/src/video-_FSTWlwX.js +0 -702
  868. package/dist/src/video-aBPJPWdt.js +0 -702
  869. package/dist/src/video-gDjkWv5m.cjs +0 -706
@@ -0,0 +1,892 @@
1
+ #!/usr/bin/env node
2
+ import { Q as getEnvString, c as logger, tt as getProcessEnv } from "./logger-pCNnmVuz.js";
3
+ import { r as fetchWithProxy } from "./fetch-RXHsZF-J.js";
4
+ import { r as validatePythonPath } from "./pythonUtils-ToJdF6LB.js";
5
+ import { c as maybeLoadToolsFromExternalFile } from "./file-DnhgJopr.js";
6
+ import "./util-Cj9drvOY.js";
7
+ import { n as resolveProviderApiKey } from "./credentials-DPd2q2su.js";
8
+ import { g as withGenAIToolSpan } from "./genaiTracer-j8OXa5Va.js";
9
+ import "./tracing-Eev_7A4e.js";
10
+ import { r as loadProviderCallbackFromFileUrl } from "./functionCallbackUtils-BXk2iY01.js";
11
+ import { A as stripExecutableToolFileReferences, C as normalizeTools, D as removeGoogleFunctionDeclarations, H as loadCredentials, O as resolveGoogleToolConfig, P as GOOGLE_MODELS, _ as mergeGoogleCompletionOptions, j as validateFunctionCall, l as getGoogleAccessToken, s as geminiFormatAndSystemInstructions, t as calculateGoogleCost } from "./util-Kf0KnG_6.js";
12
+ import { spawn } from "child_process";
13
+ //#region src/providers/google/live.ts
14
+ const GEMINI_LIVE_TRANSLATE_MODEL = "gemini-3.5-live-translate-preview";
15
+ const ROBOTICS_TEXT_MODALITY_ERROR = "Gemini Robotics ER 2 Streaming only supports TEXT response modality. Omit generationConfig.response_modalities/responseModalities to use the TEXT default, or set it to [\"TEXT\"].";
16
+ const LIVE_TRANSLATE_AUDIO_MODALITY_ERROR = "Gemini 3.5 Live Translate only supports AUDIO response modality. Omit generationConfig.response_modalities/responseModalities to use the AUDIO default, or set it to [\"AUDIO\"].";
17
+ const ROBOTICS_CODE_EXECUTION_ERROR = "Gemini Robotics ER 2 Streaming does not support code execution. Use function calling or Google Search instead.";
18
+ const ROBOTICS_FILE_SEARCH_OR_COMPUTER_USE_ERROR = "Gemini Robotics ER 2 Streaming does not support file search or computer use.";
19
+ const ROBOTICS_GROUNDING_ERROR = "Gemini Robotics ER 2 Streaming does not support Google Maps or URL context grounding. Use Google Search instead.";
20
+ const ROBOTICS_STRUCTURED_OUTPUT_ERROR = "Gemini Robotics ER 2 Streaming does not support structured output. Remove responseSchema and generationConfig response schema/MIME type options.";
21
+ const LIVE_TRANSLATE_STRUCTURED_OUTPUT_ERROR = "Gemini 3.5 Live Translate does not support structured output. Remove responseSchema and generationConfig response schema/MIME type options.";
22
+ const ROBOTICS_UNSUPPORTED_TOOL_ERROR = "Gemini Robotics ER 2 Streaming only supports function declarations and Google Search tools.";
23
+ const ROBOTICS_API_VERSION_ERROR = "Gemini Robotics ER 2 Streaming requires apiVersion v1beta; remove the override or set apiVersion to v1beta.";
24
+ const ROBOTICS_SUPPORTED_TOOL_FIELDS = /* @__PURE__ */ new Set(["functionDeclarations", "googleSearch"]);
25
+ const LIVE_TRANSLATE_SILENCE_PEAK_THRESHOLD = 32;
26
+ function hasStructuredOutputConfiguration(config) {
27
+ const generationConfig = config.generationConfig;
28
+ return config.responseSchema !== void 0 || generationConfig?.response_schema !== void 0 || generationConfig?.response_mime_type !== void 0 || generationConfig?.responseSchema !== void 0 || generationConfig?.responseMimeType !== void 0;
29
+ }
30
+ function hasCodeExecutionTool(tools) {
31
+ return tools.some((tool) => tool.codeExecution !== void 0 || tool.code_execution !== void 0);
32
+ }
33
+ function hasUnsupportedRoboticsGroundingTool(tools) {
34
+ return tools.some((tool) => {
35
+ const groundingTool = tool;
36
+ return groundingTool.googleMaps !== void 0 || groundingTool.google_maps !== void 0 || groundingTool.urlContext !== void 0 || groundingTool.url_context !== void 0;
37
+ });
38
+ }
39
+ function hasUnsupportedRoboticsFileSearchOrComputerUseTool(tools) {
40
+ return tools.some((tool) => {
41
+ const unsupportedTool = tool;
42
+ return unsupportedTool.computerUse !== void 0 || unsupportedTool.computer_use !== void 0 || unsupportedTool.fileSearch !== void 0 || unsupportedTool.file_search !== void 0;
43
+ });
44
+ }
45
+ function hasUnsupportedRoboticsTool(tools) {
46
+ return tools.some((tool) => {
47
+ const fields = Object.keys(tool);
48
+ return fields.length === 0 || fields.some((field) => !ROBOTICS_SUPPORTED_TOOL_FIELDS.has(field));
49
+ });
50
+ }
51
+ function getRoboticsConfigError(isRoboticsStreamingModel, config, responseModalities, tools) {
52
+ if (!isRoboticsStreamingModel) return;
53
+ if (responseModalities !== void 0 && (responseModalities.length !== 1 || responseModalities[0] !== "TEXT")) return ROBOTICS_TEXT_MODALITY_ERROR;
54
+ if (hasStructuredOutputConfiguration(config)) return ROBOTICS_STRUCTURED_OUTPUT_ERROR;
55
+ if (hasCodeExecutionTool(tools)) return ROBOTICS_CODE_EXECUTION_ERROR;
56
+ if (hasUnsupportedRoboticsFileSearchOrComputerUseTool(tools)) return ROBOTICS_FILE_SEARCH_OR_COMPUTER_USE_ERROR;
57
+ if (hasUnsupportedRoboticsGroundingTool(tools)) return ROBOTICS_GROUNDING_ERROR;
58
+ return hasUnsupportedRoboticsTool(tools) ? ROBOTICS_UNSUPPORTED_TOOL_ERROR : void 0;
59
+ }
60
+ function hasUnsupportedLiveTranslateToolsOrInstructions(config, systemInstruction) {
61
+ return (Array.isArray(config.tools) ? config.tools.length > 0 : Boolean(config.tools)) || config.tool_choice !== void 0 || config.toolConfig !== void 0 || config.tool_config !== void 0 || config.mcp?.enabled || Boolean(config.functionToolStatefulApi?.file) || Boolean(systemInstruction);
62
+ }
63
+ function hasUnsupportedLiveTranslateThinkingConfig(config) {
64
+ const generationConfig = config.generationConfig;
65
+ return generationConfig?.thinkingConfig !== void 0 || generationConfig?.thinking_config !== void 0;
66
+ }
67
+ function getEffectiveLiveTranslateServiceTier(mergedConfig, promptConfig) {
68
+ const providerPassthrough = mergedConfig.passthrough;
69
+ const promptPassthrough = promptConfig?.passthrough;
70
+ const providerServiceTier = providerPassthrough?.service_tier ?? providerPassthrough?.serviceTier ?? mergedConfig.service_tier;
71
+ return promptPassthrough?.service_tier ?? promptPassthrough?.serviceTier ?? promptConfig?.service_tier ?? providerServiceTier;
72
+ }
73
+ function hasMeaningfulPcm(audio) {
74
+ for (let offset = 0; offset + 1 < audio.length; offset += 2) if (Math.abs(audio.readInt16LE(offset)) > LIVE_TRANSLATE_SILENCE_PEAK_THRESHOLD) return true;
75
+ return false;
76
+ }
77
+ function getUnsupportedLiveTranslateConfigurationError(config, systemInstruction, responseModalities, serviceTier) {
78
+ if (responseModalities !== void 0 && (responseModalities.length !== 1 || responseModalities[0] !== "AUDIO")) return LIVE_TRANSLATE_AUDIO_MODALITY_ERROR;
79
+ return (hasUnsupportedLiveTranslateToolsOrInstructions(config, systemInstruction) ? "Gemini 3.5 Live Translate does not support tools or instructions." : void 0) ?? (hasStructuredOutputConfiguration(config) ? LIVE_TRANSLATE_STRUCTURED_OUTPUT_ERROR : void 0) ?? (serviceTier !== void 0 && serviceTier !== "standard" ? "Gemini 3.5 Live Translate does not support flex, priority, batch, or other non-standard inference tiers; remove service_tier/serviceTier or set it to standard." : void 0);
80
+ }
81
+ const formatContentMessages = (contents, contentIndex, useRealtimeTextInput = false, useManualAudioActivity = false, useClientContentText = false) => {
82
+ if (contents[contentIndex].role !== "user") throw new Error("Can only take user role inputs.");
83
+ const parts = contents[contentIndex].parts;
84
+ if (useClientContentText && parts.every((part) => typeof part.text === "string")) return [{ clientContent: {
85
+ turns: [{
86
+ role: "user",
87
+ parts
88
+ }],
89
+ turnComplete: true
90
+ } }];
91
+ if (useRealtimeTextInput) {
92
+ const mappedMessages = parts.map((part) => {
93
+ const userPart = part;
94
+ if (userPart.text !== void 0) return { realtimeInput: { text: userPart.text } };
95
+ const inlineData = userPart.inlineData ?? userPart.inline_data;
96
+ if (inlineData) {
97
+ const mimeType = "mimeType" in inlineData ? inlineData.mimeType : inlineData.mime_type;
98
+ if (mimeType.startsWith("video/")) throw new Error("Google Live video input must be sent as individual image/jpeg or image/png frames (maximum 1 frame per second).");
99
+ if (mimeType.startsWith("audio/") && !mimeType.startsWith("audio/pcm")) throw new Error(`Unsupported Google Live realtime input MIME type: ${mimeType}. Audio input must be raw 16-bit PCM (for example, audio/pcm;rate=16000).`);
100
+ if (!mimeType.startsWith("audio/") && mimeType !== "image/jpeg" && mimeType !== "image/png") throw new Error(`Unsupported Google Live realtime input MIME type: ${mimeType}`);
101
+ return { realtimeInput: { [mimeType.startsWith("audio/") ? "audio" : "video"]: {
102
+ mimeType,
103
+ data: inlineData.data
104
+ } } };
105
+ }
106
+ throw new Error("Unsupported part in Google Live realtime input.");
107
+ });
108
+ const textMessages = mappedMessages.filter((message) => "text" in message.realtimeInput);
109
+ const contentMessages = mappedMessages.filter((message) => !("text" in message.realtimeInput));
110
+ if (useClientContentText && textMessages.length > 0) {
111
+ const text = textMessages.map((message) => message.realtimeInput.text).join("\n");
112
+ const hasAudio = contentMessages.some((message) => "audio" in message.realtimeInput);
113
+ const clientContent = { clientContent: {
114
+ turns: [{
115
+ role: "user",
116
+ parts: [{ text }]
117
+ }],
118
+ turnComplete: !hasAudio
119
+ } };
120
+ if (hasAudio) return [
121
+ clientContent,
122
+ { realtimeInput: { activityStart: {} } },
123
+ ...contentMessages,
124
+ { realtimeInput: { activityEnd: {} } }
125
+ ];
126
+ return [...contentMessages, clientContent];
127
+ }
128
+ if (textMessages.length > 0) contentMessages.push({ realtimeInput: { text: textMessages.map((message) => message.realtimeInput.text).join("\n") } });
129
+ if (contentMessages.some((message) => "audio" in message.realtimeInput)) {
130
+ if (useManualAudioActivity) return [
131
+ { realtimeInput: { activityStart: {} } },
132
+ ...contentMessages,
133
+ { realtimeInput: { activityEnd: {} } }
134
+ ];
135
+ contentMessages.push({ realtimeInput: { audioStreamEnd: true } });
136
+ } else if (contentMessages.some((message) => "video" in message.realtimeInput) && textMessages.length === 0) contentMessages.push({ clientContent: { turnComplete: true } });
137
+ return contentMessages;
138
+ }
139
+ if (parts.length !== 1) throw new Error("Unexpected number of parts in user input.");
140
+ return [{ client_content: {
141
+ turns: [{
142
+ role: "user",
143
+ parts: [{ text: parts[0].text }]
144
+ }],
145
+ turn_complete: true
146
+ } }];
147
+ };
148
+ const getModalityTokenCount = (details, modality) => {
149
+ if (!Array.isArray(details)) return 0;
150
+ return details.reduce((total, detail) => {
151
+ const count = detail?.tokenCount ?? detail?.token_count;
152
+ return detail?.modality === modality && typeof count === "number" && Number.isFinite(count) ? total + Math.max(count, 0) : total;
153
+ }, 0);
154
+ };
155
+ const getTokenCount = (...values) => {
156
+ const value = values.find((entry) => typeof entry === "number" && Number.isFinite(entry));
157
+ return typeof value === "number" ? Math.max(value, 0) : 0;
158
+ };
159
+ const getGemini38ConfigError = (generationConfig, extendedThinking) => {
160
+ const thinking = generationConfig?.thinkingConfig;
161
+ if (!extendedThinking && thinking) return "gemini-3.8-live does not support thinkingConfig. Use gemini-3.8-live-extended-thinking instead.";
162
+ if (thinking?.thinkingBudget !== void 0) return "gemini-3.8-live-extended-thinking does not support thinkingBudget. Use thinkingLevel LOW, MEDIUM, or HIGH.";
163
+ if (thinking?.thinkingLevel !== void 0 && ![
164
+ "LOW",
165
+ "MEDIUM",
166
+ "HIGH"
167
+ ].includes(thinking.thinkingLevel)) return "gemini-3.8-live-extended-thinking supports thinkingLevel LOW, MEDIUM, or HIGH.";
168
+ if (generationConfig?.enableAffectiveDialog !== void 0) return "Gemini 3.8 Live does not support enableAffectiveDialog.";
169
+ if (generationConfig?.proactivity?.proactiveAudio === false) return "Gemini 3.8 Live has permanently enabled proactive audio; proactivity.proactiveAudio cannot be false.";
170
+ };
171
+ /**
172
+ * Helper function to fetch JSON with error handling
173
+ */
174
+ const fetchJson = async (url, options) => {
175
+ const response = await fetchWithProxy(url, options);
176
+ if (!response.ok) throw new Error(`HTTP error - status: ${response.status}`);
177
+ return response.json();
178
+ };
179
+ /**
180
+ * Helper function to try GET with query params, fallback to POST with JSON body
181
+ */
182
+ const tryGetThenPost = async (url, data) => {
183
+ try {
184
+ const urlWithParams = new URL(url);
185
+ if (data) {
186
+ const params = typeof data === "string" ? JSON.parse(data) : data;
187
+ Object.entries(params).forEach(([key, value]) => {
188
+ urlWithParams.searchParams.append(key, String(value));
189
+ });
190
+ }
191
+ return await fetchJson(urlWithParams.href);
192
+ } catch {
193
+ return fetchJson(url, {
194
+ method: "POST",
195
+ headers: { "Content-Type": "application/json" },
196
+ body: data ? JSON.stringify(typeof data === "string" ? JSON.parse(data) : data) : null
197
+ });
198
+ }
199
+ };
200
+ var GoogleLiveProvider = class {
201
+ config;
202
+ modelName;
203
+ env;
204
+ isVertex = false;
205
+ loadedFunctionCallbacks = {};
206
+ constructor(modelName, options) {
207
+ this.modelName = modelName;
208
+ this.config = options.config || {};
209
+ this.env = options.env;
210
+ }
211
+ validateFunctionToolCall(output, vars) {
212
+ validateFunctionCall(output, this.config.tools, vars);
213
+ }
214
+ id() {
215
+ return `google:live:${this.modelName}`;
216
+ }
217
+ toString() {
218
+ return `[Google Live Provider ${this.modelName}]`;
219
+ }
220
+ convertPcmToWav(pcmBuffer) {
221
+ const wavBuffer = this.createWavHeader(pcmBuffer.length, 24e3, 16, 1);
222
+ return Buffer.concat([wavBuffer, pcmBuffer]).toString("base64");
223
+ }
224
+ createWavHeader(dataLength, sampleRate, bitsPerSample, channels) {
225
+ const header = Buffer.alloc(44);
226
+ header.write("RIFF", 0);
227
+ header.writeUInt32LE(36 + dataLength, 4);
228
+ header.write("WAVE", 8);
229
+ header.write("fmt ", 12);
230
+ header.writeUInt32LE(16, 16);
231
+ header.writeUInt16LE(1, 20);
232
+ header.writeUInt16LE(channels, 22);
233
+ header.writeUInt32LE(sampleRate, 24);
234
+ header.writeUInt32LE(sampleRate * channels * bitsPerSample / 8, 28);
235
+ header.writeUInt16LE(channels * bitsPerSample / 8, 32);
236
+ header.writeUInt16LE(bitsPerSample, 34);
237
+ header.write("data", 36);
238
+ header.writeUInt32LE(dataLength, 40);
239
+ return header;
240
+ }
241
+ getApiKey() {
242
+ return resolveProviderApiKey({ apiKey: this.config.apiKey }, this.env, ["GOOGLE_API_KEY", "GEMINI_API_KEY"]);
243
+ }
244
+ async getAccessToken(config) {
245
+ const credentials = loadCredentials(config.credentials);
246
+ return getGoogleAccessToken(credentials);
247
+ }
248
+ async getConnection(config) {
249
+ const apiKey = config.apiKey || (config.credentials ? void 0 : this.getApiKey());
250
+ const accessToken = apiKey ? void 0 : await this.getAccessToken(config);
251
+ if (!accessToken && !apiKey) throw new Error("Google authentication is not configured. For the Live API, set apiKey in the provider config, GOOGLE_API_KEY, or GEMINI_API_KEY. Alternatively, configure OAuth2 credentials; see https://ai.google.dev/gemini-api/docs/oauth.");
252
+ const prefersV1beta = this.modelName === GEMINI_LIVE_TRANSLATE_MODEL || this.modelName.startsWith("gemini-robotics-er-2-streaming-") || this.modelName.startsWith("gemini-3.1-flash-live") || this.modelName.startsWith("gemini-2.5-flash-native-audio-") || this.modelName.startsWith("gemini-live-2.5-flash-preview-native-audio-");
253
+ const apiVersion = config.apiVersion || (prefersV1beta ? "v1beta" : "v1alpha");
254
+ return {
255
+ url: `wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.BidiGenerateContent?${accessToken ? `access_token=${accessToken}` : `key=${apiKey}`}`,
256
+ model: `models/${this.modelName}`,
257
+ apiVersion
258
+ };
259
+ }
260
+ async callApi(prompt, context) {
261
+ const isGemini38Live = this.modelName === "gemini-3.8-live" || this.modelName === "gemini-3.8-live-extended-thinking";
262
+ const usesInteractionStatus = this.modelName === "gemini-3.8-live-extended-thinking";
263
+ const promptConfig = context?.prompt?.config;
264
+ const config = mergeGoogleCompletionOptions(this.config, promptConfig);
265
+ const promptBasePath = promptConfig?.basePath ?? this.config.basePath;
266
+ const supportsTextResponse = this.modelName.startsWith("gemini-robotics-er-2-streaming-");
267
+ const configuredResponseModalities = (config.generationConfig?.response_modalities ?? config.generationConfig?.responseModalities)?.map((modality) => modality.toUpperCase());
268
+ if (isGemini38Live) {
269
+ const error = getGemini38ConfigError(config.generationConfig, usesInteractionStatus);
270
+ if (error) return { error };
271
+ }
272
+ const connection = await this.getConnection(config);
273
+ const usesRealtimeTextInput = isGemini38Live || connection.apiVersion === "v1beta" || this.isVertex;
274
+ const { toolConfig, toolsDisabled } = resolveGoogleToolConfig(config);
275
+ const { contents, systemInstruction } = geminiFormatAndSystemInstructions(prompt, context?.vars, config.systemInstruction, {
276
+ basePath: promptConfig?.systemInstruction === void 0 ? this.config.basePath : promptBasePath,
277
+ useAssistantRole: config.useAssistantRole
278
+ });
279
+ const useManualAudioActivity = (isGemini38Live || this.isVertex) && contents.some((content) => content.parts.some((part) => {
280
+ const audioPart = part;
281
+ return (audioPart.inlineData?.mimeType ?? audioPart.inline_data?.mime_type)?.startsWith("audio/");
282
+ }));
283
+ let contentIndex = 0;
284
+ if (this.modelName === GEMINI_LIVE_TRANSLATE_MODEL) {
285
+ const translationConfig = config.generationConfig?.translationConfig;
286
+ if (!translationConfig) return { error: "Gemini 3.5 Live Translate requires generationConfig.translationConfig (targetLanguageCode defaults to en)." };
287
+ if (translationConfig.targetLanguageCode !== void 0 && (typeof translationConfig.targetLanguageCode !== "string" || translationConfig.targetLanguageCode.trim().length === 0)) return { error: "Gemini 3.5 Live Translate requires a non-empty targetLanguageCode in generationConfig.translationConfig when provided." };
288
+ if (translationConfig.targetLanguageCode === void 0) config.generationConfig = {
289
+ ...config.generationConfig,
290
+ translationConfig: {
291
+ ...translationConfig,
292
+ targetLanguageCode: "en"
293
+ }
294
+ };
295
+ if (hasUnsupportedLiveTranslateThinkingConfig(config)) return { error: "Gemini 3.5 Live Translate does not support generationConfig.thinkingConfig or generationConfig.thinking_config; remove the thinking configuration." };
296
+ if (!this.isVertex && config.apiVersion && config.apiVersion !== "v1beta") return { error: "Gemini 3.5 Live Translate requires apiVersion v1beta; remove the override or set apiVersion to v1beta." };
297
+ const unsupportedConfigurationError = getUnsupportedLiveTranslateConfigurationError(config, systemInstruction, configuredResponseModalities, getEffectiveLiveTranslateServiceTier(config, promptConfig));
298
+ if (unsupportedConfigurationError) return { error: unsupportedConfigurationError };
299
+ if (!(contents.length > 0 && contents.every((content) => content.role === "user" && content.parts.length > 0 && content.parts.every((part) => {
300
+ const inlineData = part.inlineData ?? part.inline_data;
301
+ return (inlineData?.mimeType ?? inlineData?.mime_type)?.toLowerCase() === "audio/pcm;rate=16000" && typeof inlineData?.data === "string" && inlineData.data.trim().length > 0;
302
+ })))) return { error: "Gemini 3.5 Live Translate only supports raw PCM audio input with MIME type audio/pcm;rate=16000 (16-bit mono) and non-empty base64 data; text, image, video, missing sample rates, and other sample rates are not supported." };
303
+ }
304
+ const configTools = toolsDisabled ? stripExecutableToolFileReferences(config.tools, context?.vars) : config.tools;
305
+ const fileTools = configTools ? await maybeLoadToolsFromExternalFile(configTools, context?.vars) : [];
306
+ const normalizedTools = fileTools ? normalizeTools(Array.isArray(fileTools) ? fileTools : [fileTools]) : [];
307
+ const requestTools = toolsDisabled ? removeGoogleFunctionDeclarations(normalizedTools) : normalizedTools;
308
+ if (supportsTextResponse && !this.isVertex && config.apiVersion && config.apiVersion !== "v1beta") return { error: ROBOTICS_API_VERSION_ERROR };
309
+ const roboticsConfigError = getRoboticsConfigError(supportsTextResponse, config, configuredResponseModalities, requestTools);
310
+ if (roboticsConfigError) return { error: roboticsConfigError };
311
+ if (usesInteractionStatus) for (const tool of requestTools) {
312
+ if (tool.functionDeclarations?.some((declaration) => declaration.behavior === "BLOCKING")) return { error: "gemini-3.8-live-extended-thinking requires NON_BLOCKING function declarations." };
313
+ if (tool.functionDeclarations) tool.functionDeclarations = tool.functionDeclarations.map((declaration) => ({
314
+ ...declaration,
315
+ behavior: "NON_BLOCKING"
316
+ }));
317
+ }
318
+ let statefulApi;
319
+ if (!toolsDisabled && config.functionToolStatefulApi?.file) try {
320
+ const pythonPath = await validatePythonPath(config.functionToolStatefulApi.pythonExecutable || getEnvString("PROMPTFOO_PYTHON") || "python3", !!config.functionToolStatefulApi.pythonExecutable || !!getEnvString("PROMPTFOO_PYTHON"));
321
+ logger.debug(`Spawning API with Python executable: ${pythonPath}`);
322
+ statefulApi = spawn(pythonPath, [config.functionToolStatefulApi.file], { env: getProcessEnv() });
323
+ statefulApi.on("error", (err) => {
324
+ logger.error(`Error spawning Python process: ${JSON.stringify(err)}`);
325
+ });
326
+ statefulApi.stdout?.on("data", (data) => {
327
+ logger.debug(`Python API stdout: ${data.toString()}`);
328
+ });
329
+ statefulApi.stderr?.on("data", (data) => {
330
+ logger.error(`Python API stderr: ${data.toString()}`);
331
+ });
332
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
333
+ logger.debug("Stateful API process started");
334
+ } catch (err) {
335
+ logger.error(`Failed to spawn Python API: ${JSON.stringify(err)}`);
336
+ }
337
+ const WebSocketCtor = (await import("ws")).default;
338
+ return new Promise((resolve) => {
339
+ const isNativeAudioModel = this.modelName.includes("native-audio");
340
+ let isResolved = false;
341
+ let liveTranslateCompletionTimeout;
342
+ let liveTranslateHardTimeout;
343
+ let timeout;
344
+ let cancelFinalStateRetrieval;
345
+ let statefulApiCleanupStarted = false;
346
+ let armLiveTranslateCompletion = () => {};
347
+ let armLiveTranslateHardTimeout = () => {};
348
+ const safeResolve = (response) => {
349
+ if (!isResolved) {
350
+ isResolved = true;
351
+ clearTimeout(timeout);
352
+ clearTimeout(liveTranslateCompletionTimeout);
353
+ clearTimeout(liveTranslateHardTimeout);
354
+ cancelFinalStateRetrieval?.(/* @__PURE__ */ new Error("Final state retrieval cancelled"));
355
+ if (statefulApi && !statefulApiCleanupStarted) {
356
+ statefulApiCleanupStarted = true;
357
+ try {
358
+ statefulApi.kill("SIGTERM");
359
+ } catch (error) {
360
+ logger.error("Failed to terminate stateful API process", { error });
361
+ }
362
+ }
363
+ resolve(response);
364
+ }
365
+ };
366
+ const ws = connection.headers ? new WebSocketCtor(connection.url, { headers: connection.headers }) : new WebSocketCtor(connection.url);
367
+ let response_text_total = "";
368
+ const responseAudioChunks = [];
369
+ let response_audio_transcript = "";
370
+ let hasAudioContent = false;
371
+ const function_calls_total = [];
372
+ let statefulApiState = void 0;
373
+ const usageMetadata = [];
374
+ let pendingUsageMetadata;
375
+ let completedGenerations = 0;
376
+ let completedTurns = 0;
377
+ let hasPendingToolFollowup = false;
378
+ let receivedMessageIndex = 0;
379
+ let lastToolResponseMessageIndex = 0;
380
+ let lastVideoFrameSentAt = 0;
381
+ let hasFinalized = false;
382
+ let liveTranslateInputEnded = false;
383
+ const requestedText = configuredResponseModalities?.includes("TEXT") ?? false;
384
+ const responseModalities = usesRealtimeTextInput && !supportsTextResponse ? configuredResponseModalities?.filter((modality) => modality !== "TEXT") : configuredResponseModalities;
385
+ const effectiveResponseModalities = supportsTextResponse && responseModalities === void 0 ? ["TEXT"] : usesRealtimeTextInput && !supportsTextResponse && !responseModalities?.length ? ["AUDIO"] : responseModalities;
386
+ if (requestedText && !effectiveResponseModalities?.includes("TEXT")) logger.warn(`[Google Live] ${this.modelName} does not support TEXT response modality; requesting AUDIO with output transcription instead. Audio output is billed at audio rates.`);
387
+ const isTextExpected = effectiveResponseModalities?.includes("TEXT") ?? false;
388
+ const isAudioExpected = effectiveResponseModalities?.includes("AUDIO") ?? false;
389
+ let hasTextStreamEnded = !isTextExpected;
390
+ let hasAudioStreamEnded = !isAudioExpected;
391
+ const sendContentMessages = async (contentMessages) => {
392
+ if (this.modelName === GEMINI_LIVE_TRANSLATE_MODEL) {
393
+ liveTranslateInputEnded = false;
394
+ clearTimeout(liveTranslateHardTimeout);
395
+ liveTranslateHardTimeout = void 0;
396
+ }
397
+ for (const contentMessage of contentMessages) {
398
+ if (contentMessage.realtimeInput?.video) {
399
+ const delayMs = Math.max(lastVideoFrameSentAt + 1e3 - Date.now(), 0);
400
+ if (delayMs > 0) await new Promise((resolve) => setTimeout(resolve, delayMs));
401
+ if (isResolved) return;
402
+ lastVideoFrameSentAt = Date.now();
403
+ }
404
+ ws.send(JSON.stringify(contentMessage));
405
+ if (this.modelName === GEMINI_LIVE_TRANSLATE_MODEL && contentMessage.realtimeInput?.audioStreamEnd) {
406
+ liveTranslateInputEnded = true;
407
+ armLiveTranslateHardTimeout();
408
+ }
409
+ }
410
+ };
411
+ const hasOutputTranscription = !!config.generationConfig?.outputAudioTranscription || isGemini38Live || this.isVertex || usesRealtimeTextInput && !supportsTextResponse && requestedText;
412
+ const videoFrameCount = contents.reduce((total, content) => total + content.parts.filter((part) => {
413
+ const inlineData = part.inlineData ?? part.inline_data;
414
+ const mimeType = inlineData?.mimeType ?? inlineData?.mime_type;
415
+ return mimeType === "image/jpeg" || mimeType === "image/png";
416
+ }).length, 0);
417
+ const framePacingAllowanceMs = Math.max(videoFrameCount - 1, 0) * 1e3;
418
+ const effectiveTimeoutMs = (config.timeoutMs || 3e4) + framePacingAllowanceMs;
419
+ const liveTranslateCompletionGraceMs = Math.min(4e3, Math.max(1, Math.floor(effectiveTimeoutMs / 2)));
420
+ const liveTranslateHardDeadlineMs = effectiveTimeoutMs + liveTranslateCompletionGraceMs;
421
+ const armIdleTimeout = () => {
422
+ clearTimeout(timeout);
423
+ if (isResolved || hasFinalized) return;
424
+ timeout = setTimeout(() => {
425
+ logger.error(`WebSocket connection timed out after ${effectiveTimeoutMs}ms of inactivity`);
426
+ ws.close();
427
+ safeResolve({ error: `WebSocket request timed out after ${effectiveTimeoutMs}ms of inactivity` });
428
+ }, effectiveTimeoutMs);
429
+ };
430
+ armIdleTimeout();
431
+ armLiveTranslateHardTimeout = () => {
432
+ clearTimeout(liveTranslateHardTimeout);
433
+ liveTranslateHardTimeout = setTimeout(() => {
434
+ liveTranslateHardTimeout = void 0;
435
+ logger.error(`WebSocket request timed out after ${liveTranslateHardDeadlineMs}ms waiting for Live Translate output`);
436
+ ws.close();
437
+ safeResolve({ error: `WebSocket request timed out after ${liveTranslateHardDeadlineMs}ms waiting for Live Translate output` });
438
+ }, liveTranslateHardDeadlineMs);
439
+ };
440
+ const sendNextContentMessages = async (isMultiTurn = false) => {
441
+ if (contentIndex >= contents.length) return;
442
+ clearTimeout(liveTranslateCompletionTimeout);
443
+ liveTranslateCompletionTimeout = void 0;
444
+ const contentMessages = formatContentMessages(contents, contentIndex, usesRealtimeTextInput, useManualAudioActivity, this.isVertex && !isGemini38Live);
445
+ contentIndex += 1;
446
+ armIdleTimeout();
447
+ logger.debug(isMultiTurn ? "WebSocket sent (multi-turn)" : "WebSocket sent", { messageCount: contentMessages.length });
448
+ await sendContentMessages(contentMessages);
449
+ };
450
+ const finalizeResponse = async () => {
451
+ if (hasFinalized || isResolved) {
452
+ logger.debug("Response already finalized or resolved, skipping finalization");
453
+ return;
454
+ }
455
+ hasFinalized = true;
456
+ clearTimeout(liveTranslateCompletionTimeout);
457
+ clearTimeout(liveTranslateHardTimeout);
458
+ if (pendingUsageMetadata) {
459
+ usageMetadata.push(pendingUsageMetadata);
460
+ pendingUsageMetadata = void 0;
461
+ }
462
+ if (ws.readyState === WebSocketCtor.OPEN) ws.close();
463
+ clearTimeout(timeout);
464
+ if (!isResolved && !toolsDisabled && config.functionToolStatefulApi) {
465
+ const controller = new AbortController();
466
+ const finalStateTimeoutMs = config.timeoutMs || 3e4;
467
+ let finalStateTimeout;
468
+ const cancelled = new Promise((_, reject) => {
469
+ cancelFinalStateRetrieval = (reason) => {
470
+ clearTimeout(finalStateTimeout);
471
+ reject(reason);
472
+ controller.abort();
473
+ };
474
+ finalStateTimeout = setTimeout(() => {
475
+ cancelFinalStateRetrieval?.(/* @__PURE__ */ new Error(`Final state retrieval timed out after ${finalStateTimeoutMs}ms`));
476
+ }, finalStateTimeoutMs);
477
+ });
478
+ try {
479
+ const url = new URL("get_state", config.functionToolStatefulApi.url).href;
480
+ const state = await Promise.race([fetchJson(url, { signal: controller.signal }), cancelled]);
481
+ if (isResolved) return;
482
+ statefulApiState = state;
483
+ logger.debug(`Stateful api state: ${JSON.stringify(statefulApiState)}`);
484
+ } catch (err) {
485
+ if (!isResolved) logger.error("Error retrieving final state of api", { error: err });
486
+ } finally {
487
+ clearTimeout(finalStateTimeout);
488
+ cancelFinalStateRetrieval = void 0;
489
+ }
490
+ }
491
+ if (isResolved) return;
492
+ let outputText = response_text_total;
493
+ let thinking = void 0;
494
+ if (hasAudioContent && response_audio_transcript) {
495
+ if (response_text_total) {
496
+ thinking = response_text_total;
497
+ outputText = response_audio_transcript;
498
+ } else outputText = response_audio_transcript;
499
+ }
500
+ const result = {
501
+ output: {
502
+ text: outputText,
503
+ toolCall: { functionCalls: function_calls_total },
504
+ statefulApiState,
505
+ ...thinking && { thinking }
506
+ },
507
+ metadata: {}
508
+ };
509
+ if (usageMetadata.length > 0) {
510
+ const promptTokens = usageMetadata.reduce((total, usage) => total + getTokenCount(usage.promptTokenCount, usage.prompt_token_count) + getTokenCount(usage.toolUsePromptTokenCount, usage.tool_use_prompt_token_count), 0);
511
+ const responseTokens = usageMetadata.reduce((total, usage) => total + getTokenCount(usage.responseTokenCount, usage.candidatesTokenCount, usage.response_token_count, usage.candidates_token_count), 0);
512
+ const thoughtTokens = usageMetadata.reduce((total, usage) => total + getTokenCount(usage.thoughtsTokenCount, usage.thoughts_token_count), 0);
513
+ const billableCompletionTokens = usageMetadata.reduce((total, usage) => {
514
+ const promptTokenCount = getTokenCount(usage.promptTokenCount, usage.prompt_token_count);
515
+ const toolUsePromptTokenCount = getTokenCount(usage.toolUsePromptTokenCount, usage.tool_use_prompt_token_count);
516
+ const responseTokenCount = getTokenCount(usage.responseTokenCount, usage.candidatesTokenCount, usage.response_token_count, usage.candidates_token_count);
517
+ const totalTokenCount = getTokenCount(usage.totalTokenCount, usage.total_token_count);
518
+ const thoughtsTokenCount = getTokenCount(usage.thoughtsTokenCount, usage.thoughts_token_count);
519
+ const thoughtsIncluded = totalTokenCount > 0 && (totalTokenCount === promptTokenCount + responseTokenCount || totalTokenCount === promptTokenCount + toolUsePromptTokenCount + responseTokenCount);
520
+ return total + responseTokenCount + (thoughtsIncluded ? 0 : thoughtsTokenCount);
521
+ }, 0);
522
+ const audioPromptTokens = usageMetadata.reduce((total, usage) => {
523
+ const details = usage.promptTokensDetails ?? usage.prompt_tokens_details;
524
+ if (this.modelName === GEMINI_LIVE_TRANSLATE_MODEL && (!Array.isArray(details) || details.length === 0)) return total + getTokenCount(usage.promptTokenCount, usage.prompt_token_count) + getTokenCount(usage.toolUsePromptTokenCount, usage.tool_use_prompt_token_count);
525
+ return total + getModalityTokenCount(details, "AUDIO") + getModalityTokenCount(usage.toolUsePromptTokensDetails ?? usage.tool_use_prompt_tokens_details, "AUDIO");
526
+ }, 0);
527
+ const audioCompletionTokens = usageMetadata.reduce((total, usage) => {
528
+ const details = usage.responseTokensDetails ?? usage.candidatesTokensDetails ?? usage.response_tokens_details ?? usage.candidates_tokens_details;
529
+ if (this.modelName === GEMINI_LIVE_TRANSLATE_MODEL && (!Array.isArray(details) || details.length === 0)) return total + getTokenCount(usage.responseTokenCount, usage.candidatesTokenCount, usage.response_token_count, usage.candidates_token_count);
530
+ return total + getModalityTokenCount(details, "AUDIO");
531
+ }, 0);
532
+ const imagePromptTokens = usageMetadata.reduce((total, usage) => total + getModalityTokenCount(usage.promptTokensDetails ?? usage.prompt_tokens_details, "IMAGE") + getModalityTokenCount(usage.toolUsePromptTokensDetails ?? usage.tool_use_prompt_tokens_details, "IMAGE") + getModalityTokenCount(usage.promptTokensDetails ?? usage.prompt_tokens_details, "DOCUMENT") + getModalityTokenCount(usage.toolUsePromptTokensDetails ?? usage.tool_use_prompt_tokens_details, "DOCUMENT"), 0);
533
+ const videoPromptTokens = usageMetadata.reduce((total, usage) => total + getModalityTokenCount(usage.promptTokensDetails ?? usage.prompt_tokens_details, "VIDEO") + getModalityTokenCount(usage.toolUsePromptTokensDetails ?? usage.tool_use_prompt_tokens_details, "VIDEO"), 0);
534
+ const cachedPromptTokens = usageMetadata.reduce((total, usage) => total + getTokenCount(usage.cachedContentTokenCount, usage.cached_content_token_count), 0);
535
+ const cachedAudioPromptTokens = usageMetadata.reduce((total, usage) => total + getModalityTokenCount(usage.cacheTokensDetails ?? usage.cache_tokens_details, "AUDIO"), 0);
536
+ const cachedImagePromptTokens = usageMetadata.reduce((total, usage) => total + getModalityTokenCount(usage.cacheTokensDetails ?? usage.cache_tokens_details, "IMAGE") + getModalityTokenCount(usage.cacheTokensDetails ?? usage.cache_tokens_details, "DOCUMENT"), 0);
537
+ const cachedVideoPromptTokens = usageMetadata.reduce((total, usage) => total + getModalityTokenCount(usage.cacheTokensDetails ?? usage.cache_tokens_details, "VIDEO"), 0);
538
+ const videoInputPerSecond = GOOGLE_MODELS.find((model) => model.id === this.modelName)?.cost?.videoInputPerSecond;
539
+ const billVideoPerSecond = videoFrameCount > 0 && videoInputPerSecond !== void 0 && (videoPromptTokens > 0 || imagePromptTokens === 0);
540
+ const billableVideoFrameCount = videoPromptTokens > 0 ? Math.min(videoFrameCount, Math.ceil(videoPromptTokens / 263)) : videoFrameCount;
541
+ result.tokenUsage = {
542
+ prompt: promptTokens,
543
+ completion: responseTokens,
544
+ total: usageMetadata.reduce((total, usage) => total + getTokenCount(usage.totalTokenCount, usage.total_token_count), 0),
545
+ numRequests: usageMetadata.length,
546
+ ...cachedPromptTokens > 0 ? { cached: cachedPromptTokens } : {},
547
+ ...thoughtTokens > 0 ? { completionDetails: { reasoning: thoughtTokens } } : {}
548
+ };
549
+ const costPromptTokens = this.modelName === GEMINI_LIVE_TRANSLATE_MODEL ? audioPromptTokens : Math.max(promptTokens - (billVideoPerSecond ? videoPromptTokens : 0), 0);
550
+ const costCompletionTokens = this.modelName === GEMINI_LIVE_TRANSLATE_MODEL ? audioCompletionTokens : billableCompletionTokens;
551
+ const tokenCost = calculateGoogleCost(this.modelName, config, costPromptTokens, costCompletionTokens, this.isVertex, audioPromptTokens, audioCompletionTokens, void 0, imagePromptTokens + (billVideoPerSecond ? 0 : videoPromptTokens), Math.max(cachedPromptTokens - (billVideoPerSecond ? cachedVideoPromptTokens : 0), 0), cachedAudioPromptTokens, cachedImagePromptTokens + (billVideoPerSecond ? 0 : cachedVideoPromptTokens));
552
+ result.cost = tokenCost === void 0 ? void 0 : tokenCost + (billVideoPerSecond ? billableVideoFrameCount * videoInputPerSecond : 0);
553
+ }
554
+ if (hasAudioContent && responseAudioChunks.length > 0) result.audio = {
555
+ data: this.convertPcmToWav(Buffer.concat(responseAudioChunks)),
556
+ format: "wav",
557
+ transcript: response_audio_transcript || response_text_total || void 0
558
+ };
559
+ safeResolve(result);
560
+ };
561
+ armLiveTranslateCompletion = () => {
562
+ if (this.modelName !== GEMINI_LIVE_TRANSLATE_MODEL || !liveTranslateInputEnded || hasFinalized || isResolved) return;
563
+ clearTimeout(liveTranslateHardTimeout);
564
+ liveTranslateHardTimeout = void 0;
565
+ clearTimeout(liveTranslateCompletionTimeout);
566
+ liveTranslateCompletionTimeout = setTimeout(() => {
567
+ liveTranslateCompletionTimeout = void 0;
568
+ (async () => {
569
+ if (contentIndex < contents.length) {
570
+ await sendNextContentMessages(true);
571
+ return;
572
+ }
573
+ await finalizeResponse();
574
+ })().catch((err) => {
575
+ logger.error(`Error advancing Live Translate response: ${err}`);
576
+ safeResolve({ error: `Error advancing Live Translate response: ${err}` });
577
+ });
578
+ }, liveTranslateCompletionGraceMs);
579
+ };
580
+ ws.onopen = () => {
581
+ logger.debug("WebSocket connection is opening...");
582
+ const { speechConfig: generationSpeechConfig, response_modalities: _responseModalities, responseModalities: _camelResponseModalities, outputAudioTranscription: configuredOutputAudioTranscription, inputAudioTranscription, enableAffectiveDialog, proactivity, ...restGenerationConfig } = config.generationConfig || {};
583
+ const speechConfig = generationSpeechConfig ?? config.speechConfig;
584
+ const outputAudioTranscription = configuredOutputAudioTranscription ?? (isGemini38Live || this.isVertex || usesRealtimeTextInput && !supportsTextResponse && requestedText ? {} : void 0);
585
+ let formattedSpeechConfig;
586
+ if (speechConfig) formattedSpeechConfig = {
587
+ ...speechConfig.voiceConfig && { [usesRealtimeTextInput ? "voiceConfig" : "voice_config"]: { [usesRealtimeTextInput ? "prebuiltVoiceConfig" : "prebuilt_voice_config"]: { [usesRealtimeTextInput ? "voiceName" : "voice_name"]: speechConfig.voiceConfig.prebuiltVoiceConfig?.voiceName } } },
588
+ ...speechConfig.languageCode && { [usesRealtimeTextInput ? "languageCode" : "language_code"]: speechConfig.languageCode }
589
+ };
590
+ let formattedProactivity;
591
+ if (proactivity && !usesRealtimeTextInput) formattedProactivity = { proactive_audio: proactivity.proactiveAudio };
592
+ const setupMessage = { setup: {
593
+ model: connection.model,
594
+ ...useManualAudioActivity ? { realtimeInputConfig: { automaticActivityDetection: { disabled: true } } } : {},
595
+ [usesRealtimeTextInput ? "generationConfig" : "generation_config"]: {
596
+ context: config.context,
597
+ examples: config.examples,
598
+ stopSequences: config.stopSequences,
599
+ temperature: config.temperature,
600
+ maxOutputTokens: config.maxOutputTokens,
601
+ topP: config.topP,
602
+ topK: config.topK,
603
+ ...restGenerationConfig,
604
+ ...usesInteractionStatus ? { thinkingConfig: {
605
+ thinkingLevel: "LOW",
606
+ ...restGenerationConfig.thinkingConfig
607
+ } } : {},
608
+ ...effectiveResponseModalities ? { [usesRealtimeTextInput ? "responseModalities" : "response_modalities"]: effectiveResponseModalities } : {},
609
+ ...formattedSpeechConfig ? { [usesRealtimeTextInput ? "speechConfig" : "speech_config"]: formattedSpeechConfig } : {},
610
+ ...enableAffectiveDialog && !usesRealtimeTextInput ? { enable_affective_dialog: enableAffectiveDialog } : {},
611
+ ...formattedProactivity ? { proactivity: formattedProactivity } : {},
612
+ ...this.modelName === GEMINI_LIVE_TRANSLATE_MODEL && inputAudioTranscription ? { inputAudioTranscription } : {},
613
+ ...this.modelName === GEMINI_LIVE_TRANSLATE_MODEL && outputAudioTranscription ? { outputAudioTranscription } : {}
614
+ },
615
+ ...toolConfig ? { toolConfig } : {},
616
+ ...requestTools.length > 0 ? { tools: requestTools } : {},
617
+ ...systemInstruction ? { systemInstruction } : {},
618
+ ...this.modelName !== GEMINI_LIVE_TRANSLATE_MODEL && outputAudioTranscription ? { [usesRealtimeTextInput ? "outputAudioTranscription" : "output_audio_transcription"]: outputAudioTranscription } : {},
619
+ ...this.modelName !== GEMINI_LIVE_TRANSLATE_MODEL && inputAudioTranscription ? { [usesRealtimeTextInput ? "inputAudioTranscription" : "input_audio_transcription"]: inputAudioTranscription } : {}
620
+ } };
621
+ logger.debug("Sending setup message", {
622
+ model: this.modelName,
623
+ hasTools: requestTools.length > 0,
624
+ hasSystemInstruction: !!systemInstruction
625
+ });
626
+ ws.send(JSON.stringify(setupMessage));
627
+ };
628
+ const processMessage = async (event, messageIndex) => {
629
+ if (isResolved) return;
630
+ armIdleTimeout();
631
+ logger.debug("WebSocket message received");
632
+ let responseData;
633
+ if (event.data instanceof ArrayBuffer || event.data instanceof Buffer) {
634
+ const dataString = event.data.toString("utf-8");
635
+ try {
636
+ JSON.parse(dataString);
637
+ responseData = dataString;
638
+ } catch {
639
+ hasAudioContent = true;
640
+ const audioBuffer = Buffer.isBuffer(event.data) ? event.data : Buffer.from(event.data);
641
+ responseAudioChunks.push(audioBuffer);
642
+ hasPendingToolFollowup = false;
643
+ if (isAudioExpected) hasAudioStreamEnded = false;
644
+ if (hasMeaningfulPcm(audioBuffer)) armLiveTranslateCompletion();
645
+ return;
646
+ }
647
+ } else if (typeof event.data === "string") responseData = event.data;
648
+ else {
649
+ logger.warn(`Unexpected event.data type: ${typeof event.data}`);
650
+ ws.close();
651
+ safeResolve({ error: "Unexpected response data format" });
652
+ return;
653
+ }
654
+ try {
655
+ const responseText = await new Response(responseData).text();
656
+ if (isResolved) return;
657
+ const response = JSON.parse(responseText);
658
+ if ((isGemini38Live || this.isVertex) && Object.keys(response).length === 0) return;
659
+ const interactionStatus = response.interactionStatus ?? response.interaction_status ?? response.serverContent?.interactionStatus ?? response.serverContent?.interaction_status;
660
+ const interactionComplete = usesInteractionStatus && interactionStatus === "IDLE";
661
+ const frameUsageMetadata = response.usageMetadata ?? response.usage_metadata;
662
+ if (frameUsageMetadata) pendingUsageMetadata = frameUsageMetadata;
663
+ if ((response.serverContent?.turnComplete || response.toolCall || interactionComplete) && pendingUsageMetadata) {
664
+ usageMetadata.push(pendingUsageMetadata);
665
+ pendingUsageMetadata = void 0;
666
+ }
667
+ if (response.error) {
668
+ logger.error(`Google Live API error: ${JSON.stringify(response.error)}`);
669
+ ws.close();
670
+ safeResolve({ error: `Google Live API error: ${JSON.stringify(response.error)}` });
671
+ return;
672
+ }
673
+ const messageType = response.setupComplete ? "setupComplete" : response.serverContent?.modelTurn ? "modelTurn" : response.serverContent?.generationComplete ? "generationComplete" : response.serverContent?.turnComplete ? "turnComplete" : response.toolCall ? "toolCall" : response.streamingCustomOp ? "streamingCustomOp" : "unknown";
674
+ logger.debug(`Message type: ${messageType}, hasAudioContent: ${hasAudioContent}, hasOutputTranscription: ${hasOutputTranscription}`);
675
+ if (response.setupComplete) await sendNextContentMessages();
676
+ else if (response.serverContent || interactionComplete) {
677
+ const serverContent = response.serverContent ?? {};
678
+ let hasMeaningfulLiveTranslateOutput = false;
679
+ const inputComplete = usesInteractionStatus ? interactionComplete && messageIndex > lastToolResponseMessageIndex : serverContent.turnComplete;
680
+ if (Boolean(serverContent.modelTurn?.parts?.length) || Boolean(serverContent.outputTranscription?.text) || !isGemini38Live && !this.isVertex && Boolean(serverContent.generationComplete)) hasPendingToolFollowup = false;
681
+ else if (!usesInteractionStatus && serverContent.turnComplete && hasPendingToolFollowup) {
682
+ hasPendingToolFollowup = false;
683
+ logger.debug("Ignoring Gemini Live bookkeeping turnComplete after a tool response.");
684
+ return;
685
+ }
686
+ if (serverContent.modelTurn?.parts) {
687
+ for (const part of serverContent.modelTurn.parts) {
688
+ if (part.text) {
689
+ response_text_total += part.text;
690
+ hasMeaningfulLiveTranslateOutput = true;
691
+ }
692
+ if (part.inlineData?.mimeType?.includes("audio")) {
693
+ hasAudioContent = true;
694
+ const audioChunk = Buffer.from(part.inlineData.data, "base64");
695
+ responseAudioChunks.push(audioChunk);
696
+ if (hasMeaningfulPcm(audioChunk)) hasMeaningfulLiveTranslateOutput = true;
697
+ if (isAudioExpected) hasAudioStreamEnded = false;
698
+ }
699
+ }
700
+ if (serverContent.outputTranscription?.text) {
701
+ response_audio_transcript += serverContent.outputTranscription.text;
702
+ hasMeaningfulLiveTranslateOutput = true;
703
+ if (isAudioExpected) hasAudioContent = true;
704
+ }
705
+ } else if (serverContent.outputTranscription?.text) {
706
+ response_audio_transcript += serverContent.outputTranscription.text;
707
+ hasMeaningfulLiveTranslateOutput = true;
708
+ if (isAudioExpected) hasAudioContent = true;
709
+ }
710
+ if (serverContent.generationComplete) {
711
+ completedGenerations += 1;
712
+ logger.debug(`Generation complete received - text expected: ${isTextExpected}, audio expected: ${isAudioExpected}, has transcription: ${hasOutputTranscription}`);
713
+ if (isTextExpected && !hasTextStreamEnded) hasTextStreamEnded = true;
714
+ if (isAudioExpected && !hasAudioStreamEnded && hasOutputTranscription) hasAudioStreamEnded = true;
715
+ }
716
+ if (hasMeaningfulLiveTranslateOutput) armLiveTranslateCompletion();
717
+ if (inputComplete && contentIndex < contents.length) {
718
+ completedTurns += 1;
719
+ hasTextStreamEnded = !isTextExpected;
720
+ hasAudioStreamEnded = !isAudioExpected;
721
+ await sendNextContentMessages(true);
722
+ return;
723
+ }
724
+ if (inputComplete && contentIndex >= contents.length) {
725
+ completedTurns += 1;
726
+ logger.debug(`Turn complete received - text expected: ${isTextExpected}, text ended: ${hasTextStreamEnded}, audio expected: ${isAudioExpected}, audio ended: ${hasAudioStreamEnded}, has audio: ${hasAudioContent}, has transcription: ${!!response_audio_transcript}`);
727
+ if (isTextExpected && !hasTextStreamEnded) hasTextStreamEnded = true;
728
+ if (isAudioExpected && !hasAudioStreamEnded) hasAudioStreamEnded = true;
729
+ }
730
+ if (inputComplete && Math.max(completedGenerations, completedTurns) >= contents.length && hasTextStreamEnded && hasAudioStreamEnded && contentIndex >= contents.length) try {
731
+ await finalizeResponse();
732
+ } catch (err) {
733
+ logger.error(`Error in finalizeResponse: ${err}`);
734
+ safeResolve({ error: `Error finalizing response: ${err}` });
735
+ }
736
+ return;
737
+ } else if (response.toolCall?.functionCalls) {
738
+ if (isResolved) return;
739
+ hasPendingToolFollowup = response.toolCall.functionCalls.some((functionCall) => Boolean(functionCall?.id && functionCall.name));
740
+ if (toolsDisabled) {
741
+ logger.warn("Ignoring function calls received while tools are disabled.");
742
+ for (const functionCall of response.toolCall.functionCalls) if (functionCall?.id && functionCall.name) {
743
+ const functionResponse = {
744
+ id: functionCall.id,
745
+ name: functionCall.name,
746
+ response: { error: "Tool calls are disabled for this request." }
747
+ };
748
+ const toolMessage = usesRealtimeTextInput ? { toolResponse: { functionResponses: [functionResponse] } } : { tool_response: { function_responses: functionResponse } };
749
+ lastToolResponseMessageIndex = receivedMessageIndex;
750
+ ws.send(JSON.stringify(toolMessage));
751
+ }
752
+ } else for (const functionCall of response.toolCall.functionCalls) {
753
+ function_calls_total.push(functionCall);
754
+ if (functionCall && functionCall.id && functionCall.name) {
755
+ let callbackResponse = {};
756
+ const functionName = functionCall.name;
757
+ try {
758
+ if (config.functionToolCallbacks?.[functionName]) callbackResponse = await this.executeFunctionCallback(functionName, JSON.stringify(typeof functionCall.args === "string" ? JSON.parse(functionCall.args) : functionCall.args), config.functionToolCallbacks, functionCall.id);
759
+ else if (config.functionToolStatefulApi) {
760
+ logger.warn("functionToolStatefulApi configured but no HTTP client implemented for it after cleanup.");
761
+ const baseUrl = new URL(functionName, config.functionToolStatefulApi.url).href;
762
+ try {
763
+ callbackResponse = await tryGetThenPost(baseUrl, functionCall.args);
764
+ logger.debug(`Stateful api response: ${JSON.stringify(callbackResponse)}`);
765
+ } catch (err) {
766
+ callbackResponse = { error: `Error executing function ${functionName}: ${JSON.stringify(err)}` };
767
+ logger.error(`Error executing function ${functionName}: ${JSON.stringify(err)}`);
768
+ }
769
+ }
770
+ } catch (err) {
771
+ callbackResponse = { error: `Error executing function ${functionName}: ${JSON.stringify(err)}` };
772
+ logger.error(`Error executing function ${functionName}: ${JSON.stringify(err)}`);
773
+ }
774
+ if (isResolved) return;
775
+ const functionResponse = {
776
+ id: functionCall.id,
777
+ name: functionName,
778
+ response: callbackResponse !== null && typeof callbackResponse === "object" && !Array.isArray(callbackResponse) ? callbackResponse : { result: callbackResponse }
779
+ };
780
+ const toolMessage = usesRealtimeTextInput ? { toolResponse: { functionResponses: [functionResponse] } } : { tool_response: { function_responses: functionResponse } };
781
+ logger.debug(`WebSocket sent: ${JSON.stringify(toolMessage)}`);
782
+ lastToolResponseMessageIndex = receivedMessageIndex;
783
+ ws.send(JSON.stringify(toolMessage));
784
+ }
785
+ }
786
+ } else if (frameUsageMetadata) logger.debug("Usage metadata update received.");
787
+ else if (response.sessionResumptionUpdate) logger.debug(`Session resumption update received: ${JSON.stringify(response.sessionResumptionUpdate)}`);
788
+ else if (response.realtimeInput?.mediaChunks) {
789
+ for (const chunk of response.realtimeInput.mediaChunks) if (chunk.mimeType?.includes("audio")) {
790
+ hasAudioContent = true;
791
+ responseAudioChunks.push(Buffer.from(chunk.data, "base64"));
792
+ hasPendingToolFollowup = false;
793
+ }
794
+ } else if (response.candidates?.[0]?.content?.parts) {
795
+ for (const part of response.candidates[0].content.parts) if (part.inlineData?.mimeType?.includes("audio")) {
796
+ hasAudioContent = true;
797
+ responseAudioChunks.push(Buffer.from(part.inlineData.data, "base64"));
798
+ hasPendingToolFollowup = false;
799
+ }
800
+ } else if (response.streamingCustomOp?.["type.googleapis.com/google.ai.generativelanguage.v1alpha.StreamingCustomOpOutput"]?.audioCompletionSignal) hasAudioStreamEnded = true;
801
+ else if (!response.setupComplete && !response.serverContent && !response.toolCall && !interactionStatus && !response.realtimeInput && !response.candidates && !response.streamingCustomOp) {
802
+ logger.warn(`Received unhandled WebSocket message structure: ${JSON.stringify(response).substring(0, 200)}`);
803
+ if (hasOutputTranscription && !isGemini38Live && !this.isVertex && hasAudioContent && isAudioExpected && !hasAudioStreamEnded) {
804
+ logger.debug("Unknown message with transcription enabled - marking audio as complete");
805
+ hasAudioStreamEnded = true;
806
+ if (hasTextStreamEnded) try {
807
+ await finalizeResponse();
808
+ } catch (err) {
809
+ logger.error(`Error in finalizeResponse: ${err}`);
810
+ safeResolve({ error: `Error finalizing response: ${err}` });
811
+ }
812
+ }
813
+ }
814
+ } catch (err) {
815
+ const message = err instanceof Error ? err.message : String(err);
816
+ logger.error(`Failed to process WebSocket response: ${message}`);
817
+ ws.close();
818
+ safeResolve({ error: `Failed to process WebSocket response: ${message}` });
819
+ }
820
+ };
821
+ let messageQueue = Promise.resolve();
822
+ ws.onmessage = (event) => {
823
+ if (isResolved) return;
824
+ const messageIndex = ++receivedMessageIndex;
825
+ if (!isGemini38Live && !this.isVertex) return processMessage(event, messageIndex);
826
+ armIdleTimeout();
827
+ messageQueue = messageQueue.then(() => processMessage(event, messageIndex));
828
+ return messageQueue;
829
+ };
830
+ ws.onerror = (err) => {
831
+ const message = err.message || "Connection failed";
832
+ logger.error("Google Live WebSocket error", {
833
+ model: this.modelName,
834
+ message
835
+ });
836
+ if (isNativeAudioModel) logger.error(`Native audio model ${this.modelName} may not be available or may require different configuration`);
837
+ clearTimeout(timeout);
838
+ ws.close();
839
+ safeResolve({ error: `WebSocket error for model ${this.modelName}: ${message}` });
840
+ };
841
+ ws.onclose = (event) => {
842
+ logger.debug(`WebSocket connection closed. Code: ${event.code}, Reason: ${event.reason}, Clean: ${event.wasClean}`);
843
+ if (hasFinalized) return;
844
+ clearTimeout(timeout);
845
+ if (!isResolved) safeResolve({ error: `WebSocket connection closed unexpectedly. Code: ${event.code}, Reason: ${event.reason}` });
846
+ };
847
+ });
848
+ }
849
+ /**
850
+ * Loads a function from an external file
851
+ * @param fileRef The file reference in the format 'file://path/to/file:functionName'
852
+ * @returns The loaded function
853
+ */
854
+ loadExternalFunction(fileRef) {
855
+ return loadProviderCallbackFromFileUrl(fileRef);
856
+ }
857
+ /**
858
+ * Executes a function callback with proper error handling
859
+ */
860
+ async executeFunctionCallback(functionName, args, callbacks = this.config.functionToolCallbacks, callId) {
861
+ try {
862
+ const shouldUseSharedCache = callbacks === this.config.functionToolCallbacks;
863
+ let callback = shouldUseSharedCache ? this.loadedFunctionCallbacks[functionName] : void 0;
864
+ if (!callback) {
865
+ const callbackRef = callbacks?.[functionName];
866
+ if (callbackRef && typeof callbackRef === "string") {
867
+ const callbackStr = callbackRef;
868
+ if (callbackStr.startsWith("file://")) callback = await this.loadExternalFunction(callbackStr);
869
+ else callback = new Function("return " + callbackStr)();
870
+ if (shouldUseSharedCache && callback) this.loadedFunctionCallbacks[functionName] = callback;
871
+ } else if (typeof callbackRef === "function") {
872
+ callback = callbackRef;
873
+ if (shouldUseSharedCache) this.loadedFunctionCallbacks[functionName] = callback;
874
+ }
875
+ }
876
+ if (!callback) throw new Error(`No callback found for function '${functionName}'`);
877
+ logger.debug(`Executing function '${functionName}' with args: ${args}`);
878
+ return await withGenAIToolSpan({
879
+ name: functionName,
880
+ arguments: args,
881
+ callId
882
+ }, () => callback(args));
883
+ } catch (error) {
884
+ logger.error(`Error executing function '${functionName}': ${error.message || String(error)}`);
885
+ throw error;
886
+ }
887
+ }
888
+ };
889
+ //#endregion
890
+ export { fetchJson as n, tryGetThenPost as r, GoogleLiveProvider as t };
891
+
892
+ //# sourceMappingURL=live-DaF7nYy5.js.map