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.
- package/README.md +3 -3
- package/dist/src/accounts-BOxNYxVN.js +229 -0
- package/dist/src/accounts-BezXLdAW.cjs +276 -0
- package/dist/src/accounts-CPISMNlh.js +227 -0
- package/dist/src/accounts-vJBPs89d.js +222 -0
- package/dist/src/agentWorkspace-Bom7SpF2.js +592 -0
- package/dist/src/agentWorkspace-CEomAcws.cjs +619 -0
- package/dist/src/agentWorkspace-DPtMLrlI.js +593 -0
- package/dist/src/agentWorkspace-DkAeEYLz.js +592 -0
- package/dist/src/agentic-utils-121v7mJo.js +197 -0
- package/dist/src/agentic-utils-CBWD_rcd.cjs +237 -0
- package/dist/src/agentic-utils-D8wyQwPG.js +198 -0
- package/dist/src/agentic-utils-EP1QkQCs.js +197 -0
- package/dist/src/agents-Br3ah8iA.js +778 -0
- package/dist/src/agents-C5wj_UTv.js +777 -0
- package/dist/src/agents-C9Efp4mC.js +266 -0
- package/dist/src/agents-CQYwaVCO.js +267 -0
- package/dist/src/agents-CjCd4Vo8.js +777 -0
- package/dist/src/agents-DRWiCHYz.js +266 -0
- package/dist/src/agents-F2rhx0iL.cjs +266 -0
- package/dist/src/agents-RTYyy69h.cjs +777 -0
- package/dist/src/agents-api-CY72O86e.js +711 -0
- package/dist/src/agents-api-CsSsC21b.js +710 -0
- package/dist/src/agents-api-DN-ibDc8.js +710 -0
- package/dist/src/agents-api-cNDsCCv1.cjs +710 -0
- package/dist/src/ai.studio-Bj6Dyi6o.js +2 -0
- package/dist/src/ai.studio-C-e0LzyW.js +369 -0
- package/dist/src/ai.studio-CR8M6Aqf.cjs +391 -0
- package/dist/src/ai.studio-YKk7F0tv.js +374 -0
- package/dist/src/aimlapi-BGunsuTu.js +30 -0
- package/dist/src/aimlapi-BkzcfBsL.js +29 -0
- package/dist/src/aimlapi-DXFcEdP8.js +28 -0
- package/dist/src/aimlapi-r-8iCcAw.cjs +29 -0
- package/dist/src/anthropicMessages-7-YNRgQR.js +114 -0
- package/dist/src/anthropicMessages-C8m9Whrd.cjs +114 -0
- package/dist/src/anthropicMessages-DS1vXD0f.js +115 -0
- package/dist/src/anthropicMessages-DmvGkz-0.js +114 -0
- package/dist/src/app/assets/index-CrdXWTXm.js +392 -0
- package/dist/src/app/browser-inventory.json +4 -4
- package/dist/src/app/index.html +1 -1
- package/dist/src/audio-BLgFgyw-.cjs +104 -0
- package/dist/src/audio-C2sibT7Q.js +104 -0
- package/dist/src/audio-DXEXb03H.js +104 -0
- package/dist/src/audio-TkvojpwO.js +105 -0
- package/dist/src/authoritativeMarkupInjection-BAT9B-Wj.js +79 -0
- package/dist/src/authoritativeMarkupInjection-B_yHETKT.js +78 -0
- package/dist/src/authoritativeMarkupInjection-BfjecQ3Q.cjs +78 -0
- package/dist/src/authoritativeMarkupInjection-D-hDKrhD.js +78 -0
- package/dist/src/aws-B_9unI_-.js +1149 -0
- package/dist/src/aws-D0FY3qkc.js +2433 -0
- package/dist/src/aws-Dh1-a90n.js +2433 -0
- package/dist/src/aws-qskKGczY.cjs +2454 -0
- package/dist/src/base-CaWlBkVz.js +462 -0
- package/dist/src/base-CcViNwVs.js +255 -0
- package/dist/src/base-CsVbPJkU.cjs +467 -0
- package/dist/src/base-DNK9py25.js +255 -0
- package/dist/src/base-DlH5tjEZ.js +463 -0
- package/dist/src/base-DyLOZ_iX.js +256 -0
- package/dist/src/base-RRYXfG7l.cjs +305 -0
- package/dist/src/base-oXVgvtVn.js +462 -0
- package/dist/src/bedrock-BP17ZXbR.cjs +2 -0
- package/dist/src/bedrock-CsjM1dOt.js +1300 -0
- package/dist/src/bedrock-CzPwj8GO.js +1 -0
- package/dist/src/bedrock-eGXZw8oh.js +1 -0
- package/dist/src/bedrock-tSWjmXdj.js +2 -0
- package/dist/src/bestOfN-BQ93nUKV.js +160 -0
- package/dist/src/bestOfN-ByGGwlcb.cjs +161 -0
- package/dist/src/bestOfN-CbP7csHr.js +159 -0
- package/dist/src/bestOfN-xn6i2Xs2.js +159 -0
- package/dist/src/cache-CHq9hPz9.js +2 -0
- package/dist/src/cache-D-9eZN3I.js +754 -0
- package/dist/src/cache-DSm6t1MZ.js +741 -0
- package/dist/src/cache-DeF5zIEN.js +782 -0
- package/dist/src/cache-iG87oYan.cjs +856 -0
- package/dist/src/cerebras-CTtM4yMH.js +98 -0
- package/dist/src/cerebras-CogcJ3ce.cjs +97 -0
- package/dist/src/cerebras-DmkRypTh.js +97 -0
- package/dist/src/cerebras-GUp0B8JY.js +97 -0
- package/dist/src/chat-B4ihd3fw.js +226 -0
- package/dist/src/chat-B9cAQ_rS.js +227 -0
- package/dist/src/chat-BU7EB4R-.cjs +76 -0
- package/dist/src/chat-C8yxJ2-s.cjs +226 -0
- package/dist/src/chat-ClTFM3qq.js +934 -0
- package/dist/src/chat-Cnq0Is68.js +123 -0
- package/dist/src/chat-CwrurR57.cjs +987 -0
- package/dist/src/chat-D0lsojPv.js +124 -0
- package/dist/src/chat-D7_8yFIx.js +76 -0
- package/dist/src/chat-DCoETlLG.js +226 -0
- package/dist/src/chat-DHE7xaTR.js +76 -0
- package/dist/src/chat-DmhT6rz2.cjs +123 -0
- package/dist/src/chat-DvfMe8KI.js +123 -0
- package/dist/src/chat-DwP5kVnl.js +935 -0
- package/dist/src/chat-MB7U-QE2.js +77 -0
- package/dist/src/chat-zCWuBKAj.js +934 -0
- package/dist/src/claude-agent-sdk-23bIVI75.js +999 -0
- package/dist/src/claude-agent-sdk-BACpnIJi.cjs +1005 -0
- package/dist/src/claude-agent-sdk-BlYlmcEr.js +999 -0
- package/dist/src/claude-agent-sdk-Cr-jqJZl.js +1000 -0
- package/dist/src/client-BktbiPx9.cjs +357 -0
- package/dist/src/client-CjztEBmW.js +351 -0
- package/dist/src/client-mRs2UvH9.js +351 -0
- package/dist/src/client-uCz0ydjC.js +352 -0
- package/dist/src/cloud-BtYF555L.js +2 -0
- package/dist/src/cloud-CVSUEmAy.js +287 -0
- package/dist/src/cloud-D7Ifb-Fl.js +599 -0
- package/dist/src/cloud-DB5oK5NX.cjs +666 -0
- package/dist/src/cloud-ecu989Em.js +657 -0
- package/dist/src/cloud-ramjGURF.js +599 -0
- package/dist/src/cloudflare-ai-BfDkIjO8.js +133 -0
- package/dist/src/cloudflare-ai-D9HaXz1M.js +134 -0
- package/dist/src/cloudflare-ai-HrD5WUK8.js +132 -0
- package/dist/src/cloudflare-ai-Qdj8aKP2.cjs +133 -0
- package/dist/src/cloudflare-gateway-C81uKETQ.js +276 -0
- package/dist/src/cloudflare-gateway-CX5Z9X0k.js +276 -0
- package/dist/src/cloudflare-gateway-DW-og8gb.js +277 -0
- package/dist/src/cloudflare-gateway-iRyXo9n2.cjs +276 -0
- package/dist/src/codex-app-server-BFIrSgdy.js +2155 -0
- package/dist/src/codex-app-server-By1eDVD4.js +2 -0
- package/dist/src/codex-app-server-DKsF4qmY.js +2156 -0
- package/dist/src/codex-app-server-n7n4uZzC.cjs +2162 -0
- package/dist/src/codex-app-server-xAoELVxu.js +2155 -0
- package/dist/src/codex-sdk-C2ZLxa6r.js +1552 -0
- package/dist/src/codex-sdk-CzG02tQt.cjs +1588 -0
- package/dist/src/codex-sdk-DNxAOhiV.js +2 -0
- package/dist/src/codex-sdk-DT3aQezK.js +1557 -0
- package/dist/src/codex-sdk-pw9DpcJP.js +1557 -0
- package/dist/src/codex-security-B0bLmXJF.js +406 -0
- package/dist/src/codex-security-BhYs-3iY.js +406 -0
- package/dist/src/codex-security-DQcOfxYW.js +407 -0
- package/dist/src/codex-security-DsCWr6GZ.cjs +411 -0
- package/dist/src/cometapi-B16asPLX.cjs +55 -0
- package/dist/src/cometapi-MgTbZA_H.js +53 -0
- package/dist/src/cometapi-i33vKzPV.js +55 -0
- package/dist/src/cometapi-wK2UWK0X.js +56 -0
- package/dist/src/compatible-COj8ZCy9.js +24 -0
- package/dist/src/compatible-CRSsIUGb.cjs +24 -0
- package/dist/src/compatible-Dy1vCcNF.js +25 -0
- package/dist/src/compatible-aUItQrpk.js +24 -0
- package/dist/src/completion-Bn7COFMk.js +119 -0
- package/dist/src/completion-Bub2N48b.js +118 -0
- package/dist/src/completion-Cf2G9OlM.cjs +123 -0
- package/dist/src/conversationScoring-BiTYJ9MD.js +374 -0
- package/dist/src/conversationScoring-CKL47uIu.js +373 -0
- package/dist/src/conversationScoring-DCvQKp6k.cjs +398 -0
- package/dist/src/conversationScoring-DLNJtDZI.js +373 -0
- package/dist/src/crescendo-5iLk9WiJ.cjs +734 -0
- package/dist/src/crescendo-B5ylG7kW.js +733 -0
- package/dist/src/crescendo-BD7k6TIx.js +730 -0
- package/dist/src/crescendo-DqO2Ch0P.js +732 -0
- package/dist/src/custom-8rv_aG2K.js +617 -0
- package/dist/src/custom-BOtrIHFN.js +619 -0
- package/dist/src/custom-BvN8seCs.cjs +620 -0
- package/dist/src/custom-Cld9v_Y4.js +618 -0
- package/dist/src/dataUrl-BdHUey2l.cjs +3187 -0
- package/dist/src/dataUrl-DBMifX6C.js +3133 -0
- package/dist/src/dataUrl-DUSr-ZvI.js +2868 -0
- package/dist/src/decisions-CLazADTw.js +516 -0
- package/dist/src/decisions-D5X93awq.js +515 -0
- package/dist/src/decisions-DmaeArEn.js +515 -0
- package/dist/src/decisions-DyQJyHJz.cjs +514 -0
- package/dist/src/docker-C9NYQFeu.js +94 -0
- package/dist/src/docker-CGq3mMol.cjs +94 -0
- package/dist/src/docker-DOm7nmpl.js +95 -0
- package/dist/src/docker-skFN-Kfo.js +93 -0
- package/dist/src/embedding-0UbzkTk9.js +82 -0
- package/dist/src/embedding-DTrSDt7k.cjs +86 -0
- package/dist/src/embedding-j2ORNl5H.js +81 -0
- package/dist/src/envoy-BvS8XTQO.js +60 -0
- package/dist/src/envoy-Cn6Hzw0e.js +60 -0
- package/dist/src/envoy-DC3KWcUY.cjs +60 -0
- package/dist/src/envoy-DetHjo5B.js +61 -0
- package/dist/src/eval-Cer9dPe9.js +1920 -0
- package/dist/src/eval-CytYmI2Z.js +2 -0
- package/dist/src/evalResult-DzOq5wt9.js +1300 -0
- package/dist/src/evaluator-BxCmvGtv.js +10578 -0
- package/dist/src/evaluator-Ct7YDELm.js +2 -0
- package/dist/src/evaluatorHelpers-B_AwIrsl.js +600 -0
- package/dist/src/evaluatorHelpers-D1Tpc7gd.js +601 -0
- package/dist/src/evaluatorHelpers-DRR3rLq0.cjs +622 -0
- package/dist/src/fetch-B5KxZuKu.js +1559 -0
- package/dist/src/fetch-BG_Jl7ty.js +1556 -0
- package/dist/src/fetch-BKlgUg08.cjs +1853 -0
- package/dist/src/fetch-C9Fsja0R.js +2 -0
- package/dist/src/fetch-CM7P8KWA.cjs +14 -0
- package/dist/src/fetch-D0FkIB3G.js +9 -0
- package/dist/src/fetch-RXHsZF-J.js +1280 -0
- package/dist/src/fetch-rSECy8jR.js +10 -0
- package/dist/src/functionCallbackUtils-BB9tmf6a.cjs +262 -0
- package/dist/src/functionCallbackUtils-BXk2iY01.js +246 -0
- package/dist/src/functionCallbackUtils-B_cYp7P5.js +245 -0
- package/dist/src/functionCallbackUtils-BfXnPo0o.js +245 -0
- package/dist/src/gemini-image-BXLMADDz.js +471 -0
- package/dist/src/gemini-image-BYUZyEUx.js +472 -0
- package/dist/src/gemini-image-DSt1QubZ.cjs +471 -0
- package/dist/src/gemini-image-DdNDMiZ_.js +471 -0
- package/dist/src/goat-9b-uU_k6.js +514 -0
- package/dist/src/goat-BCJuiDd0.js +515 -0
- package/dist/src/goat-CmAHbemm.js +512 -0
- package/dist/src/goat-DdOTdyoS.cjs +515 -0
- package/dist/src/goblin-Bp5C5lyb.js +22 -0
- package/dist/src/goblin-Dmr7GItI.js +23 -0
- package/dist/src/goblin-DpM8wxlf.cjs +22 -0
- package/dist/src/goblin-cJyH6Pq-.js +22 -0
- package/dist/src/google-B6eaPAbE.js +142 -0
- package/dist/src/google-D-FStdN6.cjs +142 -0
- package/dist/src/google-DAC7BsCW.js +142 -0
- package/dist/src/google-Id18H0Va.js +143 -0
- package/dist/src/graders-BjNQWkaB.js +2 -0
- package/dist/src/graders-CqdIp_vl.js +15470 -0
- package/dist/src/hydra-6Ouh74DE.js +610 -0
- package/dist/src/hydra-BHjhZnLB.cjs +612 -0
- package/dist/src/hydra-BL6k2REV.js +2 -0
- package/dist/src/hydra-BWUc0o67.js +613 -0
- package/dist/src/hydra-CUkEOLKw.js +612 -0
- package/dist/src/image-B6hG_xhb.js +481 -0
- package/dist/src/image-BFaq7Krd.cjs +209 -0
- package/dist/src/image-Bql5C0N9.cjs +504 -0
- package/dist/src/image-BtZfI2pT.js +163 -0
- package/dist/src/image-CIM4oN7Z.cjs +163 -0
- package/dist/src/image-CbAl7Jpu.js +209 -0
- package/dist/src/image-CiYm_yFw.js +209 -0
- package/dist/src/image-DCMNvBiV.js +163 -0
- package/dist/src/image-DL7pIuUZ.js +210 -0
- package/dist/src/image-ey0kxF8o.js +164 -0
- package/dist/src/image-smgIk3rE.js +482 -0
- package/dist/src/index.cjs +27 -27
- package/dist/src/index.d.cts +8 -8
- package/dist/src/index.js +27 -27
- package/dist/src/indirectWebPwn-B_-UpWY5.js +285 -0
- package/dist/src/indirectWebPwn-Cz3SLiEq.js +434 -0
- package/dist/src/indirectWebPwn-D2s8zGiM.cjs +463 -0
- package/dist/src/indirectWebPwn-DXbj2wGu.cjs +285 -0
- package/dist/src/indirectWebPwn-D_4H44E6.js +285 -0
- package/dist/src/indirectWebPwn-L044SrpV.js +434 -0
- package/dist/src/indirectWebPwn-cnmvdavH.js +435 -0
- package/dist/src/indirectWebPwn-zUBzsqTt.js +286 -0
- package/dist/src/interactions-Bu3oVQ-j.js +850 -0
- package/dist/src/interactions-CND010Lh.cjs +850 -0
- package/dist/src/interactions-DAx7tqUz.js +851 -0
- package/dist/src/interactions-DPkIumeh.js +850 -0
- package/dist/src/iterative-BO4JRnpG.js +545 -0
- package/dist/src/iterative-CAK-k9rz.js +548 -0
- package/dist/src/iterative-CDgHc0xO.cjs +549 -0
- package/dist/src/iterative-CXJlHLl9.js +547 -0
- package/dist/src/iterativeImage-BEdGKSmh.cjs +419 -0
- package/dist/src/iterativeImage-BfL0QZw5.js +417 -0
- package/dist/src/iterativeImage-C9KhnibC.js +417 -0
- package/dist/src/iterativeImage-btjkOfWG.js +418 -0
- package/dist/src/iterativeMeta-B5Bdw6QA.js +437 -0
- package/dist/src/iterativeMeta-C3mI4gpT.js +440 -0
- package/dist/src/iterativeMeta-Co2BKyqS.cjs +439 -0
- package/dist/src/iterativeMeta-DD8ihRWD.js +439 -0
- package/dist/src/iterativeTree-AMi4GV2O.js +878 -0
- package/dist/src/iterativeTree-C8FJOEje.cjs +879 -0
- package/dist/src/iterativeTree-CvrY1f2Z.js +877 -0
- package/dist/src/iterativeTree-bPtESmaD.js +876 -0
- package/dist/src/knowledgeBase-Cf5871e3.js +163 -0
- package/dist/src/knowledgeBase-D2PQhqLH.js +164 -0
- package/dist/src/knowledgeBase-DpoMw1IH.cjs +163 -0
- package/dist/src/knowledgeBase-npGFl763.js +163 -0
- package/dist/src/litellm-BBB5DQdt.cjs +146 -0
- package/dist/src/litellm-Bo43ow7r.js +145 -0
- package/dist/src/litellm-CaU8CMLS.js +146 -0
- package/dist/src/litellm-wY7Unh8o.js +147 -0
- package/dist/src/live-5g2w-M-E.js +891 -0
- package/dist/src/live-BfaXsDyD.cjs +891 -0
- package/dist/src/live-C1xewnGD.js +2 -0
- package/dist/src/live-DaF7nYy5.js +892 -0
- package/dist/src/live-lp3urLUw.js +891 -0
- package/dist/src/luma-ray-B7zvKGVG.js +309 -0
- package/dist/src/luma-ray-DCf5fnrz.cjs +309 -0
- package/dist/src/luma-ray-DepBcn6z.js +309 -0
- package/dist/src/luma-ray-XQC4M1pt.js +310 -0
- package/dist/src/main.js +26 -26
- package/dist/src/mantleChat-7xm95vSV.js +154 -0
- package/dist/src/mantleChat-CXhAs5RD.js +155 -0
- package/dist/src/mantleChat-CcE-zjfj.cjs +154 -0
- package/dist/src/mantleChat-Cpefl7Zm.js +154 -0
- package/dist/src/mcp-B0V0ikdM.js +84 -0
- package/dist/src/mcp-CV2k2gwj.js +85 -0
- package/dist/src/memoryPoisoning-BC5FQQWZ.js +111 -0
- package/dist/src/memoryPoisoning-BDwrtZKX.js +111 -0
- package/dist/src/memoryPoisoning-BFemS_FF.js +112 -0
- package/dist/src/memoryPoisoning-DRs2rbVV.cjs +111 -0
- package/dist/src/messages-Bc5oZoAJ.js +1128 -0
- package/dist/src/messages-BkaH8fRW.js +1127 -0
- package/dist/src/messages-CoHlziS5.js +1127 -0
- package/dist/src/messages-Cv_m6kYs.cjs +1161 -0
- package/dist/src/mischievousUser-BcyFxrqJ.js +51 -0
- package/dist/src/mischievousUser-BlhOQSd2.js +52 -0
- package/dist/src/mischievousUser-BuQiKE8D.js +51 -0
- package/dist/src/mischievousUser-ChIOk6cT.cjs +51 -0
- package/dist/src/modelslab-BXIWBTgX.js +171 -0
- package/dist/src/modelslab-ChVsUiaJ.js +170 -0
- package/dist/src/modelslab-DZ6BFlDv.js +170 -0
- package/dist/src/modelslab-DhRr-vyo.cjs +170 -0
- package/dist/src/nova-reel-BL8DrN4_.js +272 -0
- package/dist/src/nova-reel-BiOMUm5q.cjs +272 -0
- package/dist/src/nova-reel-CTsya1hV.js +273 -0
- package/dist/src/nova-reel-kgBY4Svd.js +272 -0
- package/dist/src/nova-sonic-CaSSA3Jq.cjs +374 -0
- package/dist/src/nova-sonic-DLpmoGsR.js +375 -0
- package/dist/src/nova-sonic-DwWc4SoN.js +374 -0
- package/dist/src/nova-sonic-qnReTaXm.js +374 -0
- package/dist/src/novita-B5mAt3Ui.js +114 -0
- package/dist/src/novita-D57vCjDD.js +116 -0
- package/dist/src/novita-ITRtG8IJ.js +115 -0
- package/dist/src/novita-Rh3T13YO.cjs +115 -0
- package/dist/src/nscale-8V7iZ_pI.js +210 -0
- package/dist/src/nscale-BQnMv4pH.cjs +209 -0
- package/dist/src/nscale-BWZXHZVF.js +209 -0
- package/dist/src/nscale-BqrHiUqU.js +207 -0
- package/dist/src/openaiResponses-BMtGTu8R.js +317 -0
- package/dist/src/openaiResponses-CvcI_viE.js +318 -0
- package/dist/src/openaiResponses-DYPZEMX1.cjs +318 -0
- package/dist/src/openaiResponses-DZTg1-kb.js +319 -0
- package/dist/src/openclaw-BeKuig4g.js +1338 -0
- package/dist/src/openclaw-COkdQ83y.js +1337 -0
- package/dist/src/openclaw-CSoX_HQ5.cjs +1344 -0
- package/dist/src/openclaw-DJlhPGCb.js +1336 -0
- package/dist/src/opencode-sdk-BEJftEs6.cjs +1018 -0
- package/dist/src/opencode-sdk-DMvBB3V7.js +1013 -0
- package/dist/src/opencode-sdk-Df7hMjLO.js +1012 -0
- package/dist/src/opencode-sdk-bQp5Xf3W.js +1012 -0
- package/dist/src/openinterpreter-B3GgVZjK.js +431 -0
- package/dist/src/openinterpreter-BiGcU-HN.cjs +435 -0
- package/dist/src/openinterpreter-Buj2l3Eh.js +432 -0
- package/dist/src/openinterpreter-C3_Cg5b_.js +431 -0
- package/dist/src/pricing-0Pampf0q.cjs +999 -0
- package/dist/src/pricing-B8VdhEhY.js +976 -0
- package/dist/src/pricing-CtLA-rKA.js +976 -0
- package/dist/src/promptfoo-4OkHtH9P.cjs +341 -0
- package/dist/src/promptfoo-Bhpm7sH6.js +286 -0
- package/dist/src/promptfoo-BqV8ogVA.js +285 -0
- package/dist/src/promptfoo-S1Q9OHk_.js +286 -0
- package/dist/src/providers-B5zs1ZRv.js +24437 -0
- package/dist/src/providers-Cd6CJh6m.js +2 -0
- package/dist/src/providers-CpJlgHET.js +24039 -0
- package/dist/src/providers-CzvLvK6G.cjs +24180 -0
- package/dist/src/quiverai-1E_IvLHn.js +325 -0
- package/dist/src/quiverai-BXH004Vv.js +325 -0
- package/dist/src/quiverai-Ccya2z8Y.cjs +325 -0
- package/dist/src/quiverai-Cez57oe-.js +326 -0
- package/dist/src/registry-3zX_M9Ik.js +131 -0
- package/dist/src/registry-AuCrKTvS.js +132 -0
- package/dist/src/registry-CxXWKtQG.js +131 -0
- package/dist/src/registry-DG3o66JQ.cjs +131 -0
- package/dist/src/remoteGeneration-CAtvamG6.js +370 -0
- package/dist/src/remoteGeneration-CF225pDl.cjs +482 -0
- package/dist/src/remoteGeneration-DtnqocnL.js +370 -0
- package/dist/src/remoteGeneration-g3KvW-sP.js +371 -0
- package/dist/src/responses-BMbaUXQI.js +1098 -0
- package/dist/src/responses-B_TOSof-.js +1099 -0
- package/dist/src/responses-v-yANwTA.cjs +1109 -0
- package/dist/src/runtimeTransform-BBZv-oUZ.js +156 -0
- package/dist/src/runtimeTransform-DT2v5ovW.js +156 -0
- package/dist/src/runtimeTransform-GXXEIXdS.cjs +161 -0
- package/dist/src/runtimeTransform-JTwBQc-P.js +157 -0
- package/dist/src/sagemaker-B8D0L4rj.cjs +716 -0
- package/dist/src/sagemaker-CR2_AGdB.js +713 -0
- package/dist/src/sagemaker-Cd9qSQUV.js +714 -0
- package/dist/src/sagemaker-mKlltN4p.js +713 -0
- package/dist/src/scanner-PG_8lh8r.js +1971 -0
- package/dist/src/server/index.js +55 -55
- package/dist/src/server-Bmh7sd9F.js +155 -0
- package/dist/src/server-C7b8z6aC.js +63 -0
- package/dist/src/server-CAcovgtL.js +2 -0
- package/dist/src/server-CuuMfKlh.cjs +74 -0
- package/dist/src/server-DMPCj9jy.js +189 -0
- package/dist/src/session-BksXvRH_.cjs +69 -0
- package/dist/src/session-DOxUjqGQ.js +63 -0
- package/dist/src/session-Dujsc-b9.js +62 -0
- package/dist/src/session-VjtIxREd.js +62 -0
- package/dist/src/shared-Bkyz_7e5.cjs +2185 -0
- package/dist/src/shared-DDJg8ycC.js +1929 -0
- package/dist/src/shared-Dh3yfRBd.js +1927 -0
- package/dist/src/shared-tfPT8Tna.js +1928 -0
- package/dist/src/simulatedUser-6JdkyL3k.cjs +252 -0
- package/dist/src/simulatedUser-CFr2mr3M.js +248 -0
- package/dist/src/simulatedUser-DjwwUqx-.js +247 -0
- package/dist/src/slack-C_gIYiUs.js +144 -0
- package/dist/src/slack-DhNbz9CM.cjs +144 -0
- package/dist/src/slack-Dm2iI1zu.js +145 -0
- package/dist/src/strategies-BIY-bNul.js +2248 -0
- package/dist/src/strategies-C1KQQj9G.cjs +2420 -0
- package/dist/src/strategies-DM_3mReG.js +2385 -0
- package/dist/src/telemetry-BhMTibZO.js +2 -0
- package/dist/src/telemetry-C04d25BM.cjs +216 -0
- package/dist/src/telemetry-CIqy4fSC.js +201 -0
- package/dist/src/telemetry-CXozp_6C.js +205 -0
- package/dist/src/telemetry-g7PkBxmY.js +205 -0
- package/dist/src/togetherai-BvCim68-.js +50 -0
- package/dist/src/togetherai-CWyDCA9m.cjs +49 -0
- package/dist/src/togetherai-CeSE31vK.js +49 -0
- package/dist/src/togetherai-_2W0URf8.js +48 -0
- package/dist/src/traceContext-Brw3Oe41.js +1016 -0
- package/dist/src/traceContext-DpAYv27G.js +1015 -0
- package/dist/src/traceContext-KSqhzZI2.cjs +1032 -0
- package/dist/src/transcription-BySopazW.js +175 -0
- package/dist/src/transcription-DO4UPkRI.cjs +178 -0
- package/dist/src/transcription-RJGBa-pC.js +176 -0
- package/dist/src/transcription-fZenF3G5.js +175 -0
- package/dist/src/transform-BzhRc5z2.js +125 -0
- package/dist/src/transform-CPQu05u6.cjs +154 -0
- package/dist/src/transform-DAED8imp.js +126 -0
- package/dist/src/transform-DIOIQDmM.js +125 -0
- package/dist/src/typesafe-ByE0Kxfg.js +253 -0
- package/dist/src/typesafe-CFqGFY34.js +253 -0
- package/dist/src/typesafe-DCWIw-CP.cjs +253 -0
- package/dist/src/typesafe-DyHFV5Qk.js +254 -0
- package/dist/src/util-BHkj9joz.js +2049 -0
- package/dist/src/util-CICwIpmu.cjs +934 -0
- package/dist/src/util-CePiY2xZ.js +286 -0
- package/dist/src/util-CgT3uf4p.js +743 -0
- package/dist/src/util-Cj9drvOY.js +1770 -0
- package/dist/src/util-ClJRjlQA.cjs +357 -0
- package/dist/src/util-Cxf8VF2M.js +395 -0
- package/dist/src/util-D7RdV7rS.js +395 -0
- package/dist/src/util-DMNFhk47.js +351 -0
- package/dist/src/util-DNzh3M0z.js +396 -0
- package/dist/src/util-Df7rfMGb.cjs +2305 -0
- package/dist/src/util-Kf0KnG_6.js +2051 -0
- package/dist/src/util-LEbeiYw_.js +743 -0
- package/dist/src/util-WH8CgVs4.js +352 -0
- package/dist/src/util-cx6Xw8Lw.cjs +478 -0
- package/dist/src/util-qzBqirBH.js +2050 -0
- package/dist/src/vertex-CBAMfRz3.js +854 -0
- package/dist/src/vertex-CMP2IpN9.js +2 -0
- package/dist/src/vertex-CZ5YOotT.js +848 -0
- package/dist/src/vertex-DNsh1F1M.cjs +871 -0
- package/dist/src/vertexLive-BTXYj3-F.js +55 -0
- package/dist/src/vertexLive-Ba_LAqEF.cjs +55 -0
- package/dist/src/vertexLive-DM4sFaaj.js +56 -0
- package/dist/src/vertexLive-JqZOw7HC.js +55 -0
- package/dist/src/video-BY7Q2Gii.cjs +706 -0
- package/dist/src/video-CYElP-CK.js +703 -0
- package/dist/src/video-C_AdEDH0.js +702 -0
- package/dist/src/video-DGvjQ_4j.js +702 -0
- package/package.json +1 -1
- package/dist/src/accounts-Dpb43yde.cjs +0 -276
- package/dist/src/accounts-GKrO1olH.js +0 -229
- package/dist/src/accounts-e4FGOsji.js +0 -227
- package/dist/src/accounts-sUiEJfkB.js +0 -222
- package/dist/src/agentWorkspace-B8A_wuMR.cjs +0 -619
- package/dist/src/agentWorkspace-DSPIscXR.js +0 -593
- package/dist/src/agentWorkspace-DxUqd-XK.js +0 -592
- package/dist/src/agentWorkspace-n0uOJXhD.js +0 -592
- package/dist/src/agentic-utils-9bCj4twQ.js +0 -197
- package/dist/src/agentic-utils-CyCLuLoj.js +0 -197
- package/dist/src/agentic-utils-D23qtOlx.cjs +0 -237
- package/dist/src/agentic-utils-DuBMMNCw.js +0 -198
- package/dist/src/agents-6hDRNoYD.js +0 -777
- package/dist/src/agents-B8w2o7Sc.cjs +0 -777
- package/dist/src/agents-Ck0NXl7v.js +0 -777
- package/dist/src/agents-CwT3B1qB.js +0 -778
- package/dist/src/agents-DOLjfOEq.js +0 -266
- package/dist/src/agents-OcF9hq--.js +0 -267
- package/dist/src/agents-api-CnZZt8bn.cjs +0 -710
- package/dist/src/agents-api-D04u3bmL.js +0 -711
- package/dist/src/agents-api-DWw0_Vio.js +0 -710
- package/dist/src/agents-api-IWHEwp8i.js +0 -710
- package/dist/src/agents-mHt2Mh9O.cjs +0 -266
- package/dist/src/agents-sICccZCA.js +0 -266
- package/dist/src/ai.studio-Ci4rypDT.js +0 -2
- package/dist/src/ai.studio-KkQ6KaHa.js +0 -369
- package/dist/src/ai.studio-gSXK2cGI.js +0 -374
- package/dist/src/ai.studio-nQF_B4DH.cjs +0 -391
- package/dist/src/aimlapi-BeSk5BDV.js +0 -30
- package/dist/src/aimlapi-CzNUhdKu.cjs +0 -29
- package/dist/src/aimlapi-DCkazDPI.js +0 -29
- package/dist/src/aimlapi-WeH5B6K1.js +0 -28
- package/dist/src/anthropicMessages-AcNWTpYO.js +0 -115
- package/dist/src/anthropicMessages-BUtvzbpL.js +0 -114
- package/dist/src/anthropicMessages-DTWhZDCd.js +0 -114
- package/dist/src/anthropicMessages-lGVnSgyx.cjs +0 -114
- package/dist/src/app/assets/index-CyEI5aDN.js +0 -392
- package/dist/src/audio-BE_Duiu1.js +0 -104
- package/dist/src/audio-CiUd00k2.cjs +0 -104
- package/dist/src/audio-Dop6omna.js +0 -105
- package/dist/src/audio-EZNTInr_.js +0 -104
- package/dist/src/authoritativeMarkupInjection-BUqH6hNk.js +0 -78
- package/dist/src/authoritativeMarkupInjection-BmbJdJO0.cjs +0 -78
- package/dist/src/authoritativeMarkupInjection-Cpz12Y3w.js +0 -78
- package/dist/src/authoritativeMarkupInjection-W4XfcH91.js +0 -79
- package/dist/src/aws-B2Jqbnet.js +0 -2433
- package/dist/src/aws-DHtuUIzQ.js +0 -1149
- package/dist/src/aws-DLqXP6wY.js +0 -2433
- package/dist/src/aws-DfduhmwL.cjs +0 -2454
- package/dist/src/base-B9L2Xvpc.js +0 -255
- package/dist/src/base-BTZnIsuH.cjs +0 -305
- package/dist/src/base-BhaWNQPJ.js +0 -462
- package/dist/src/base-Br-G_Xou.js +0 -256
- package/dist/src/base-Bzo8hiUS.cjs +0 -467
- package/dist/src/base-C82fd2jq.js +0 -463
- package/dist/src/base-CRdQwC1W.js +0 -462
- package/dist/src/base-CjGwZNOQ.js +0 -255
- package/dist/src/bedrock-BdMru_ro.js +0 -1300
- package/dist/src/bedrock-CBUmfLX1.cjs +0 -2
- package/dist/src/bedrock-DBDxBaF9.js +0 -2
- package/dist/src/bedrock-DDrECM21.js +0 -1
- package/dist/src/bedrock-DVwkgvRS.js +0 -1
- package/dist/src/bestOfN-AKF5beq4.js +0 -159
- package/dist/src/bestOfN-C1UIVGJV.js +0 -160
- package/dist/src/bestOfN-DlkETbXy.cjs +0 -161
- package/dist/src/bestOfN-XIfEgU-g.js +0 -159
- package/dist/src/cache-BZaVoKaA.js +0 -2
- package/dist/src/cache-CEYhFUsH.js +0 -741
- package/dist/src/cache-Cbw1zH6q.js +0 -782
- package/dist/src/cache-CdaZNb75.js +0 -754
- package/dist/src/cache-DpuIzPxh.cjs +0 -856
- package/dist/src/cerebras-Bpn6FPkJ.js +0 -97
- package/dist/src/cerebras-CqJ0BRCJ.cjs +0 -97
- package/dist/src/cerebras-D4ILa_TY.js +0 -97
- package/dist/src/cerebras-DR8uc7ee.js +0 -98
- package/dist/src/chat-B7PZfaYp.cjs +0 -987
- package/dist/src/chat-BVuSjdEb.js +0 -227
- package/dist/src/chat-BsaZRjXN.js +0 -76
- package/dist/src/chat-C5liqe3Y.js +0 -226
- package/dist/src/chat-C9hyHf5B.js +0 -124
- package/dist/src/chat-CFLalAck.js +0 -226
- package/dist/src/chat-CN8JGrHu.js +0 -76
- package/dist/src/chat-CaHBBpCb.js +0 -123
- package/dist/src/chat-CcbLSghx.js +0 -123
- package/dist/src/chat-CoSN6sr2.js +0 -934
- package/dist/src/chat-CsJRFX8a.cjs +0 -226
- package/dist/src/chat-DFoZLvO_.js +0 -934
- package/dist/src/chat-DiLQvL7r.js +0 -77
- package/dist/src/chat-F6qVSDk3.cjs +0 -123
- package/dist/src/chat-Oq4FaJgI.cjs +0 -76
- package/dist/src/chat-knMfQUKz.js +0 -935
- package/dist/src/claude-agent-sdk-CJkOLpnI.js +0 -999
- package/dist/src/claude-agent-sdk-Ckn76PRD.js +0 -999
- package/dist/src/claude-agent-sdk-DX0gTr11.cjs +0 -1005
- package/dist/src/claude-agent-sdk-LMeikxoR.js +0 -1000
- package/dist/src/client-BFf1r6Z8.js +0 -352
- package/dist/src/client-CdXyDdDi.js +0 -351
- package/dist/src/client-DV8XMu7i.js +0 -351
- package/dist/src/client-iEXtOBKW.cjs +0 -357
- package/dist/src/cloud-B02qcpjf.js +0 -2
- package/dist/src/cloud-BlHP-g1v.cjs +0 -666
- package/dist/src/cloud-C9BI4isF.js +0 -287
- package/dist/src/cloud-CTTLNdvj.js +0 -657
- package/dist/src/cloud-D5X5yQ_d.js +0 -599
- package/dist/src/cloud-QxPkpsHA.js +0 -599
- package/dist/src/cloudflare-ai-DRTRT1fc.js +0 -132
- package/dist/src/cloudflare-ai-DgaXapAV.cjs +0 -133
- package/dist/src/cloudflare-ai-DkuJXijS.js +0 -134
- package/dist/src/cloudflare-ai-wy9QCHku.js +0 -133
- package/dist/src/cloudflare-gateway-9cAN8g29.cjs +0 -276
- package/dist/src/cloudflare-gateway-BVFMD292.js +0 -277
- package/dist/src/cloudflare-gateway-BuUI4p6I.js +0 -276
- package/dist/src/cloudflare-gateway-TlYHizbW.js +0 -276
- package/dist/src/codex-app-server-BPz_feug.cjs +0 -2162
- package/dist/src/codex-app-server-C9noXM9C.js +0 -2155
- package/dist/src/codex-app-server-CEmD-Y5U.js +0 -2
- package/dist/src/codex-app-server-DZolc18r.js +0 -2156
- package/dist/src/codex-app-server-Dd0A37nO.js +0 -2155
- package/dist/src/codex-sdk-BbxjBvBk.cjs +0 -1588
- package/dist/src/codex-sdk-BpXeIs-_.js +0 -1557
- package/dist/src/codex-sdk-BtQp5X0f.js +0 -1552
- package/dist/src/codex-sdk-CH0v9Bk1.js +0 -2
- package/dist/src/codex-sdk-CgrN7JB8.js +0 -1557
- package/dist/src/codex-security-B5fENNUr.js +0 -406
- package/dist/src/codex-security-C6uuJx-y.cjs +0 -411
- package/dist/src/codex-security-CifWtZR_.js +0 -407
- package/dist/src/codex-security-Kg2bOEKy.js +0 -406
- package/dist/src/cometapi-BFpIDLIx.js +0 -55
- package/dist/src/cometapi-C6O2PIrN.js +0 -56
- package/dist/src/cometapi-D5Yupc6F.js +0 -53
- package/dist/src/cometapi-DzgIwJzJ.cjs +0 -55
- package/dist/src/compatible-0jhmVfOp.js +0 -25
- package/dist/src/compatible-DdtwWdJi.cjs +0 -24
- package/dist/src/compatible-Di4nR3sU.js +0 -24
- package/dist/src/compatible-iJKLWdnf.js +0 -24
- package/dist/src/completion-B0_hVUDG.js +0 -119
- package/dist/src/completion-BdI6v0-Q.cjs +0 -123
- package/dist/src/completion-CWcJscwv.js +0 -118
- package/dist/src/conversationScoring-99EOPJRa.js +0 -373
- package/dist/src/conversationScoring-BIq4J0Cq.js +0 -374
- package/dist/src/conversationScoring-DARyeATr.cjs +0 -398
- package/dist/src/conversationScoring-DS48t4Hb.js +0 -373
- package/dist/src/crescendo-CebvXIu4.js +0 -730
- package/dist/src/crescendo-CxrLS0oo.js +0 -732
- package/dist/src/crescendo-DZQXBSkj.js +0 -733
- package/dist/src/crescendo-wjEx68uD.cjs +0 -734
- package/dist/src/custom-BiQ-aUNw.cjs +0 -620
- package/dist/src/custom-ByyB5Z93.js +0 -619
- package/dist/src/custom-C5jOevNb.js +0 -617
- package/dist/src/custom-CCrsCz8o.js +0 -618
- package/dist/src/dataUrl-C9J7wz9H.js +0 -3133
- package/dist/src/dataUrl-CGsBT7UZ.cjs +0 -3187
- package/dist/src/dataUrl-CzKvvWNO.js +0 -2868
- package/dist/src/decisions-BTusXCUx.cjs +0 -514
- package/dist/src/decisions-BYtL9edD.js +0 -515
- package/dist/src/decisions-jYix_gCF.js +0 -515
- package/dist/src/decisions-nxxfHRAN.js +0 -516
- package/dist/src/docker-DDIv4zkg.js +0 -93
- package/dist/src/docker-DVLp_5OG.js +0 -94
- package/dist/src/docker-INm9w0SY.cjs +0 -94
- package/dist/src/docker-sGuoCul_.js +0 -95
- package/dist/src/embedding-CAhqLLrR.js +0 -82
- package/dist/src/embedding-D94GAsti.cjs +0 -86
- package/dist/src/embedding-zb4MAzQy.js +0 -81
- package/dist/src/envoy-BMPszwEa.cjs +0 -60
- package/dist/src/envoy-Bp-s39_8.js +0 -60
- package/dist/src/envoy-BswDt-Ou.js +0 -61
- package/dist/src/envoy-rVbYcV80.js +0 -60
- package/dist/src/eval-B1-XfrC7.js +0 -2
- package/dist/src/eval-pC4qCvLw.js +0 -1920
- package/dist/src/evalResult-CzjCb5bd.js +0 -1300
- package/dist/src/evaluator-CNq2K7J_.js +0 -10578
- package/dist/src/evaluator-LtfxdxEu.js +0 -2
- package/dist/src/evaluatorHelpers-C5J0NYpQ.js +0 -601
- package/dist/src/evaluatorHelpers-DcdCglCs.cjs +0 -622
- package/dist/src/evaluatorHelpers-Rvb88W6B.js +0 -600
- package/dist/src/fetch-5HtnNhHg.js +0 -1556
- package/dist/src/fetch-BCwjoIFd.js +0 -1559
- package/dist/src/fetch-BhfUnKen.js +0 -1280
- package/dist/src/fetch-C08w4vVl.js +0 -9
- package/dist/src/fetch-DBxy8Tlb.cjs +0 -14
- package/dist/src/fetch-DYte6oQX.cjs +0 -1853
- package/dist/src/fetch-ElpfcAVG.js +0 -10
- package/dist/src/fetch-lM1OIaSt.js +0 -2
- package/dist/src/functionCallbackUtils-BCAdWfHO.js +0 -246
- package/dist/src/functionCallbackUtils-BYq9qOhG.js +0 -245
- package/dist/src/functionCallbackUtils-ByWkmVud.cjs +0 -262
- package/dist/src/functionCallbackUtils-D_C_JaFd.js +0 -245
- package/dist/src/gemini-image-CAlwaJhZ.js +0 -471
- package/dist/src/gemini-image-DJoVoOnZ.cjs +0 -471
- package/dist/src/gemini-image-Waio-9Xx.js +0 -472
- package/dist/src/gemini-image-vbY6Ftbf.js +0 -471
- package/dist/src/goat-BWbtyY9c.js +0 -512
- package/dist/src/goat-CXzzeCOQ.cjs +0 -515
- package/dist/src/goat-CfgvzSgZ.js +0 -514
- package/dist/src/goat-DLeoIHBp.js +0 -515
- package/dist/src/goblin-CmfCfwqk.cjs +0 -22
- package/dist/src/goblin-CtcaORRH.js +0 -22
- package/dist/src/goblin-DF6DDhM-.js +0 -22
- package/dist/src/goblin-Nai0xxBV.js +0 -23
- package/dist/src/google-ClpkLtKL.cjs +0 -142
- package/dist/src/google-CrFgKu9k.js +0 -143
- package/dist/src/google-Dj_EIBqS.js +0 -142
- package/dist/src/google-e4-vARv6.js +0 -142
- package/dist/src/graders-BN1IIa71.js +0 -15470
- package/dist/src/graders-C5sCfSP5.js +0 -2
- package/dist/src/hydra-B7RfXVBK.js +0 -2
- package/dist/src/hydra-C1cFN-Jg.js +0 -613
- package/dist/src/hydra-CK6Uc1ia.js +0 -612
- package/dist/src/hydra-Dg65rAP_.js +0 -610
- package/dist/src/hydra-Fqx8l_Xu.cjs +0 -612
- package/dist/src/image-BdlUDAtp.js +0 -163
- package/dist/src/image-C-KwEhwt.cjs +0 -163
- package/dist/src/image-C76fp6NK.cjs +0 -209
- package/dist/src/image-D75ehv3D.js +0 -482
- package/dist/src/image-DKtc5v5W.js +0 -209
- package/dist/src/image-DT_xOkJY.js +0 -163
- package/dist/src/image-DVpdllEE.js +0 -209
- package/dist/src/image-DXZ8AzMf.js +0 -481
- package/dist/src/image-DZl_1mvy.js +0 -164
- package/dist/src/image-DcTD7Ak0.cjs +0 -504
- package/dist/src/image-ndxEvBKB.js +0 -210
- package/dist/src/indirectWebPwn-70WA5x_q.js +0 -435
- package/dist/src/indirectWebPwn-BRVyd3qV.cjs +0 -463
- package/dist/src/indirectWebPwn-BsJVsu0q.js +0 -285
- package/dist/src/indirectWebPwn-Cw6yJu0i.js +0 -285
- package/dist/src/indirectWebPwn-D-PhJzo4.js +0 -286
- package/dist/src/indirectWebPwn-DRPHt2I8.js +0 -434
- package/dist/src/indirectWebPwn-DXtfFhd9.cjs +0 -285
- package/dist/src/indirectWebPwn-DvpNouzc.js +0 -434
- package/dist/src/interactions-5ixfW7Cl.js +0 -850
- package/dist/src/interactions-BOUzfmg1.cjs +0 -850
- package/dist/src/interactions-CSSXcGNc.js +0 -851
- package/dist/src/interactions-WB_sgkN0.js +0 -850
- package/dist/src/iterative-BShRNqjC.cjs +0 -549
- package/dist/src/iterative-BcW_ELtB.js +0 -548
- package/dist/src/iterative-BpHbHz8B.js +0 -547
- package/dist/src/iterative-YcchP12d.js +0 -545
- package/dist/src/iterativeImage-BMFE5Hl7.cjs +0 -419
- package/dist/src/iterativeImage-CkSaYLMY.js +0 -417
- package/dist/src/iterativeImage-DAEUlQX_.js +0 -418
- package/dist/src/iterativeImage-DeUSkEnj.js +0 -417
- package/dist/src/iterativeMeta-DbdaKdEO.cjs +0 -439
- package/dist/src/iterativeMeta-DcF9JWEK.js +0 -437
- package/dist/src/iterativeMeta-DkfPqWIC.js +0 -439
- package/dist/src/iterativeMeta-DkrpnVSs.js +0 -440
- package/dist/src/iterativeTree-CEMY1FhE.cjs +0 -879
- package/dist/src/iterativeTree-Cv5W4tX9.js +0 -877
- package/dist/src/iterativeTree-DGvomd3M.js +0 -876
- package/dist/src/iterativeTree-KbtC2Mkz.js +0 -878
- package/dist/src/knowledgeBase-AYRXn4wO.js +0 -163
- package/dist/src/knowledgeBase-BNqQfx01.js +0 -163
- package/dist/src/knowledgeBase-C0IaCCVs.js +0 -164
- package/dist/src/knowledgeBase-C2uj6wK4.cjs +0 -163
- package/dist/src/litellm-CN1ScAwZ.js +0 -147
- package/dist/src/litellm-CTjwiKSa.js +0 -146
- package/dist/src/litellm-Cd4Nj5ue.js +0 -145
- package/dist/src/litellm-DMqLpEBg.cjs +0 -146
- package/dist/src/live-Bt50-InO.cjs +0 -891
- package/dist/src/live-Bu2ujadG.js +0 -2
- package/dist/src/live-C3M52i3p.js +0 -891
- package/dist/src/live-CRfHMO3B.js +0 -892
- package/dist/src/live-iCIpO14m.js +0 -891
- package/dist/src/luma-ray-B8eHC4c8.cjs +0 -309
- package/dist/src/luma-ray-BIvkPw0s.js +0 -309
- package/dist/src/luma-ray-ChsiBxMA.js +0 -309
- package/dist/src/luma-ray-DAvKrInz.js +0 -310
- package/dist/src/mantleChat-5YeEXAZI.js +0 -154
- package/dist/src/mantleChat-D--mW3hl.js +0 -154
- package/dist/src/mantleChat-DHP3siNg.cjs +0 -154
- package/dist/src/mantleChat-wBfAX46o.js +0 -155
- package/dist/src/mcp-49jlEcTQ.js +0 -85
- package/dist/src/mcp-__PIz81I.js +0 -84
- package/dist/src/memoryPoisoning-Chxge74M.js +0 -111
- package/dist/src/memoryPoisoning-QH6NCUVE.js +0 -112
- package/dist/src/memoryPoisoning-tCxZt8Nz.js +0 -111
- package/dist/src/memoryPoisoning-ymrRItRR.cjs +0 -111
- package/dist/src/messages-BE_eZ7NA.js +0 -1127
- package/dist/src/messages-Bo638ShI.js +0 -1127
- package/dist/src/messages-BzR0-NQ1.js +0 -1128
- package/dist/src/messages-Cbg5Pfd0.cjs +0 -1161
- package/dist/src/mischievousUser-BtED2Z5Z.cjs +0 -51
- package/dist/src/mischievousUser-KqSOjrDJ.js +0 -51
- package/dist/src/mischievousUser-YMD41YNZ.js +0 -51
- package/dist/src/mischievousUser-zBxlNdCu.js +0 -52
- package/dist/src/modelslab-B8gZxtfE.js +0 -171
- package/dist/src/modelslab-C7bmVpTB.js +0 -170
- package/dist/src/modelslab-CCeQCTZg.js +0 -170
- package/dist/src/modelslab-CvBJGv7y.cjs +0 -170
- package/dist/src/nova-reel-BOEWsEKA.cjs +0 -272
- package/dist/src/nova-reel-BtyBXq5M.js +0 -273
- package/dist/src/nova-reel-C1eF3-EE.js +0 -272
- package/dist/src/nova-reel-YhgrxEKT.js +0 -272
- package/dist/src/nova-sonic-BaERP20w.js +0 -374
- package/dist/src/nova-sonic-CxgM3O-P.cjs +0 -374
- package/dist/src/nova-sonic-DJS22fC3.js +0 -375
- package/dist/src/nova-sonic-DwvwHyRX.js +0 -374
- package/dist/src/novita-D1l2tG0O.js +0 -116
- package/dist/src/novita-D84VM3v0.cjs +0 -115
- package/dist/src/novita-DGInvwfR.js +0 -115
- package/dist/src/novita-vXHkXhTg.js +0 -114
- package/dist/src/nscale-CU0Ldr00.js +0 -209
- package/dist/src/nscale-ClfKlQeM.cjs +0 -209
- package/dist/src/nscale-DxaVnF0x.js +0 -210
- package/dist/src/nscale-_poVxIrO.js +0 -207
- package/dist/src/openaiResponses-CJGsneNj.js +0 -317
- package/dist/src/openaiResponses-CKSl5Sdg.js +0 -319
- package/dist/src/openaiResponses-DC8rzFUc.js +0 -318
- package/dist/src/openaiResponses-rMHIA3dV.cjs +0 -318
- package/dist/src/openclaw-CCbvsNFW.cjs +0 -1344
- package/dist/src/openclaw-CZw1lCDZ.js +0 -1336
- package/dist/src/openclaw-ChFLgC-a.js +0 -1338
- package/dist/src/openclaw-DrPMoRrH.js +0 -1337
- package/dist/src/opencode-sdk-2EfIDhFp.cjs +0 -1018
- package/dist/src/opencode-sdk-CHw3F845.js +0 -1013
- package/dist/src/opencode-sdk-D0EGGxvy.js +0 -1012
- package/dist/src/opencode-sdk-jSS7NI2Q.js +0 -1012
- package/dist/src/openinterpreter-CY622xHC.js +0 -431
- package/dist/src/openinterpreter-DATyhuhP.js +0 -432
- package/dist/src/openinterpreter-DDUMyIf1.js +0 -431
- package/dist/src/openinterpreter-s5Tz6Lid.cjs +0 -435
- package/dist/src/pricing-C498twd2.js +0 -976
- package/dist/src/pricing-DBd_bMIh.cjs +0 -999
- package/dist/src/pricing-ISrMCskv.js +0 -976
- package/dist/src/promptfoo-6p0WG2ih.js +0 -286
- package/dist/src/promptfoo-BQRfgNs_.js +0 -285
- package/dist/src/promptfoo-Bqo88z20.cjs +0 -341
- package/dist/src/promptfoo-Cq5AVI3I.js +0 -286
- package/dist/src/providers-ATbeMX5E.cjs +0 -24180
- package/dist/src/providers-B7F1FiNI.js +0 -2
- package/dist/src/providers-DazIw8mI.js +0 -24039
- package/dist/src/providers-QvGlNAD0.js +0 -24437
- package/dist/src/quiverai-BPlNcLkV.cjs +0 -325
- package/dist/src/quiverai-By99-YmJ.js +0 -325
- package/dist/src/quiverai-CmmByDqo.js +0 -325
- package/dist/src/quiverai-HZkoJJqw.js +0 -326
- package/dist/src/registry-BLTnTfjT.cjs +0 -131
- package/dist/src/registry-BMC-COHT.js +0 -132
- package/dist/src/registry-C8UZtmBp.js +0 -131
- package/dist/src/registry-CfwEUYXG.js +0 -131
- package/dist/src/remoteGeneration-Bgg6kC5V.js +0 -370
- package/dist/src/remoteGeneration-CKJFE960.cjs +0 -482
- package/dist/src/remoteGeneration-DaxwJDKv.js +0 -370
- package/dist/src/remoteGeneration-vHMGVKr1.js +0 -371
- package/dist/src/responses-BvnyIHrq.js +0 -1099
- package/dist/src/responses-CERAgvf-.js +0 -1098
- package/dist/src/responses-CwgjeuOg.cjs +0 -1109
- package/dist/src/runtimeTransform-3RF9Avyg.cjs +0 -161
- package/dist/src/runtimeTransform-C51Z5j4H.js +0 -156
- package/dist/src/runtimeTransform-CKE_Iyv8.js +0 -157
- package/dist/src/runtimeTransform-Cs11xJpj.js +0 -156
- package/dist/src/sagemaker-BJ4dOCxE.js +0 -713
- package/dist/src/sagemaker-Bt3JUAWq.js +0 -714
- package/dist/src/sagemaker-QVKyLgLF.cjs +0 -716
- package/dist/src/sagemaker-l3IB8iTs.js +0 -713
- package/dist/src/scanner-DGjIiTZ1.js +0 -1971
- package/dist/src/server-BNaLZH6u.js +0 -63
- package/dist/src/server-CBMuQul3.js +0 -189
- package/dist/src/server-CMKKIzKv.cjs +0 -74
- package/dist/src/server-CN2IS9Cs.js +0 -155
- package/dist/src/server-ua4cqbjC.js +0 -2
- package/dist/src/session-CQIjq_HZ.cjs +0 -69
- package/dist/src/session-FTlg8sEu.js +0 -62
- package/dist/src/session-GBQXtPWp.js +0 -63
- package/dist/src/session-_0-rTdwY.js +0 -62
- package/dist/src/shared-BtuO-OAM.js +0 -1927
- package/dist/src/shared-Ci78wTZX.js +0 -1928
- package/dist/src/shared-Dd3rimdM.js +0 -1929
- package/dist/src/shared-KAjFxRre.cjs +0 -2185
- package/dist/src/simulatedUser--OjW6xCx.js +0 -247
- package/dist/src/simulatedUser-D0-slRye.cjs +0 -252
- package/dist/src/simulatedUser-D1Kh_cwA.js +0 -248
- package/dist/src/slack-BX0FUevO.js +0 -144
- package/dist/src/slack-CcwXFiJE.cjs +0 -144
- package/dist/src/slack-CnfqKfXp.js +0 -145
- package/dist/src/strategies-2ntcK4tN.js +0 -2248
- package/dist/src/strategies-DZIW7Zcs.js +0 -2385
- package/dist/src/strategies-YRDF2j-N.cjs +0 -2420
- package/dist/src/telemetry-CL8CVA4p.js +0 -205
- package/dist/src/telemetry-Cix90qqz.js +0 -201
- package/dist/src/telemetry-CkmlqTjV.js +0 -205
- package/dist/src/telemetry-DQH7l5bb.js +0 -2
- package/dist/src/telemetry-DUCXc1-r.cjs +0 -216
- package/dist/src/togetherai-3yUt5Ck7.js +0 -49
- package/dist/src/togetherai-BJUByLwt.cjs +0 -49
- package/dist/src/togetherai-Bh6KZkmd.js +0 -50
- package/dist/src/togetherai-DDl9yk3b.js +0 -48
- package/dist/src/traceContext-BiJVppjT.cjs +0 -1032
- package/dist/src/traceContext-CKKluULP.js +0 -1016
- package/dist/src/traceContext-D3Sk8fO-.js +0 -1015
- package/dist/src/transcription-BoVQKIVz.js +0 -175
- package/dist/src/transcription-Bs5u8780.js +0 -175
- package/dist/src/transcription-Dl654d1p.cjs +0 -178
- package/dist/src/transcription-VEvhM1Fu.js +0 -176
- package/dist/src/transform-BAbkGpvl.js +0 -125
- package/dist/src/transform-C_j4hUH8.js +0 -126
- package/dist/src/transform-Da86hs4M.cjs +0 -154
- package/dist/src/transform-_i1raQNo.js +0 -125
- package/dist/src/typesafe-CKXBeh82.cjs +0 -253
- package/dist/src/typesafe-D3VaGeNm.js +0 -253
- package/dist/src/typesafe-DYM-SFNH.js +0 -253
- package/dist/src/typesafe-LXmSbw8F.js +0 -254
- package/dist/src/util-41rb0XHX.js +0 -743
- package/dist/src/util-B0WlHYFM.js +0 -2049
- package/dist/src/util-BD1R_PsR.js +0 -1770
- package/dist/src/util-BLbM_ItC.js +0 -395
- package/dist/src/util-C72P0iIa.js +0 -352
- package/dist/src/util-C7MpGlJ6.cjs +0 -2305
- package/dist/src/util-CCtqagKc.js +0 -286
- package/dist/src/util-CM2Ec_uY.js +0 -2051
- package/dist/src/util-CSSAWO8v.js +0 -351
- package/dist/src/util-CkQc-fx3.cjs +0 -934
- package/dist/src/util-DcOlFTFa.cjs +0 -478
- package/dist/src/util-DluGTGVB.js +0 -395
- package/dist/src/util-PfQ60chz.js +0 -743
- package/dist/src/util-f14-CPij.js +0 -396
- package/dist/src/util-l9pXX3Eu.cjs +0 -357
- package/dist/src/util-o_BnlYqS.js +0 -2050
- package/dist/src/vertex-B_-gQgzc.js +0 -2
- package/dist/src/vertex-CU4gqoYa.js +0 -854
- package/dist/src/vertex-DZ42UHb3.js +0 -848
- package/dist/src/vertex-DsYQJA0T.cjs +0 -871
- package/dist/src/vertexLive-BvIaHKGB.js +0 -55
- package/dist/src/vertexLive-CTULqNx7.js +0 -56
- package/dist/src/vertexLive-DjJ_YQBe.cjs +0 -55
- package/dist/src/vertexLive-STUGcteB.js +0 -55
- package/dist/src/video-CAQGmtEV.js +0 -703
- package/dist/src/video-_FSTWlwX.js +0 -702
- package/dist/src/video-aBPJPWdt.js +0 -702
- package/dist/src/video-gDjkWv5m.cjs +0 -706
|
@@ -1,1127 +0,0 @@
|
|
|
1
|
-
import { J as getEnvInt, X as getEnvString, Y as getEnvOverrides, et as getProviderEnvString, it as parseEnvFloat, o as logger, ot as getExplicitProviderEnv } from "./logger-Gff7RMNF.js";
|
|
2
|
-
import "./dataUrl-C9J7wz9H.js";
|
|
3
|
-
import { _ as transformToolChoice, v as transformTools } from "./shared-BBI-NXjW.js";
|
|
4
|
-
import { n as resolveProviderApiKey } from "./credentials-DH6z4brQ.js";
|
|
5
|
-
import { h as withGenAISpan } from "./genaiTracer-CuSjHi4t.js";
|
|
6
|
-
import { c as getCacheTtlMs, l as getScopedCacheKey, o as getCache, s as getCacheClearGeneration, u as isCacheEnabled } from "./cache-CEYhFUsH.js";
|
|
7
|
-
import { c as maybeLoadToolsFromExternalFile, s as maybeLoadResponseFormatFromExternalFile } from "./file-Di0ypTgN.js";
|
|
8
|
-
import { d as createEmptyTokenUsage } from "./tokenUsageUtils-BfzeNdYY.js";
|
|
9
|
-
import { n as normalizeFinishReason } from "./finishReason-BixMIdSI.js";
|
|
10
|
-
import { c as normalizeMcpToolContent, i as getMcpErrorMessage, o as isMcpErrorResult } from "./util-CSSAWO8v.js";
|
|
11
|
-
import { t as McpClientSession } from "./session-_0-rTdwY.js";
|
|
12
|
-
import { n as transformMCPToolsToAnthropic } from "./transform-_i1raQNo.js";
|
|
13
|
-
import { A as parseMessages, C as isForcedToolChoiceUnsupportedClaudeModel, D as normalizeAnthropicModelName, M as resolveClaudeSamplingParams, O as normalizeClaudeThinkingConfig, S as isDisabledThinkingRejectedAtEffort, a as calculateAnthropicCost, c as claudeThinkingConsumesTokens, d as getRefusalDetails, f as getTokenUsage, j as processAnthropicTools, k as outputFromMessage, l as getClaudeModelWarningName, m as isBetweenToolsLowestThinkingClaudeModel, p as isAlwaysOnAdaptiveThinkingClaudeModel, s as clampMaxTokensForThinkingBudget, t as ANTHROPIC_MODELS, u as getFileReferences, w as isSamplingParamsDeprecatedClaudeModel, x as isClaudeThinkingEnabled, y as isClaudeSonnet55Model } from "./util-PfQ60chz.js";
|
|
14
|
-
import fs from "node:fs";
|
|
15
|
-
import os from "node:os";
|
|
16
|
-
import path from "node:path";
|
|
17
|
-
import { createHash } from "node:crypto";
|
|
18
|
-
import { createHash as createHash$1, randomUUID as randomUUID$1 } from "crypto";
|
|
19
|
-
import { execFileSync } from "node:child_process";
|
|
20
|
-
import Anthropic, { APIError } from "@anthropic-ai/sdk";
|
|
21
|
-
//#region src/providers/anthropic/claudeCodeAuth.ts
|
|
22
|
-
/**
|
|
23
|
-
* Claude Code prepends this identity block as the first `system` message when
|
|
24
|
-
* calling the Anthropic Messages API with an OAuth token. As of 2025-Q4 the
|
|
25
|
-
* API returns HTTP 400 `invalid_request_error` when an OAuth-authenticated
|
|
26
|
-
* request's first system block is not this exact string, so any caller
|
|
27
|
-
* reusing a Claude Code OAuth token must inject this block before the
|
|
28
|
-
* user-provided system prompt. Re-verify if Anthropic ships an OAuth-native
|
|
29
|
-
* `/v1/messages` path that drops the requirement.
|
|
30
|
-
*/
|
|
31
|
-
const CLAUDE_CODE_IDENTITY_PROMPT = "You are Claude Code, Anthropic's official CLI for Claude.";
|
|
32
|
-
/**
|
|
33
|
-
* Anthropic beta headers required when authenticating the Messages API with a
|
|
34
|
-
* Claude Code OAuth token (e.g. a Claude Max subscription access token, or a
|
|
35
|
-
* long-lived token minted by `claude setup-token`).
|
|
36
|
-
*
|
|
37
|
-
* - `oauth-2025-04-20` enables OAuth bearer tokens on `/v1/messages`.
|
|
38
|
-
* - `claude-code-20250219` enables the Claude Code tool-use surface area the
|
|
39
|
-
* OAuth token is scoped to.
|
|
40
|
-
*
|
|
41
|
-
* Revisit if Anthropic ships an OAuth-native Messages path that no longer
|
|
42
|
-
* requires these betas.
|
|
43
|
-
*/
|
|
44
|
-
const CLAUDE_CODE_OAUTH_BETA_FEATURES = Object.freeze(["claude-code-20250219", "oauth-2025-04-20"]);
|
|
45
|
-
/**
|
|
46
|
-
* The `user-agent` value Claude Code CLI sends on OAuth-authenticated
|
|
47
|
-
* Messages requests. Anthropic's API gates OAuth tokens to the Claude Code
|
|
48
|
-
* app identity, so requests that use a different user-agent fail with 401.
|
|
49
|
-
*
|
|
50
|
-
* The semver is load-bearing too: newer models reject OAuth requests whose
|
|
51
|
-
* `claude-cli` version predates the model's minimum client with 400
|
|
52
|
-
* `invalid_request_error` (e.g. claude-opus-5-5 requires 2.1.280 or newer).
|
|
53
|
-
* Keep this at a current CLI release and bump it alongside CLI updates.
|
|
54
|
-
*/
|
|
55
|
-
const CLAUDE_CODE_USER_AGENT = "claude-cli/2.1.285 (external, promptfoo)";
|
|
56
|
-
const CLAUDE_CODE_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
57
|
-
const CLAUDE_CODE_CREDENTIALS_FILENAME = ".credentials.json";
|
|
58
|
-
/**
|
|
59
|
-
* Returns the `CLAUDE_CONFIG_DIR` override when one is set, or `undefined`
|
|
60
|
-
* for the default `~/.claude` layout. A provider-scoped `env` override takes
|
|
61
|
-
* precedence over the root config / process environment, matching how other
|
|
62
|
-
* provider env vars resolve (see `AnthropicGenericProvider.getApiKey`).
|
|
63
|
-
*
|
|
64
|
-
* The raw configured value is returned without path normalization on
|
|
65
|
-
* purpose: the Claude Code CLI derives its macOS keychain service name from
|
|
66
|
-
* the exact string (see {@link resolveKeychainService}), so normalizing here
|
|
67
|
-
* would break keychain lookups for values with e.g. a trailing slash.
|
|
68
|
-
*/
|
|
69
|
-
function resolveConfiguredDir(env) {
|
|
70
|
-
return env?.CLAUDE_CONFIG_DIR || getEnvString("CLAUDE_CONFIG_DIR") || void 0;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Resolves the directory Claude Code stores its config (including
|
|
74
|
-
* `.credentials.json`) in. Honors `CLAUDE_CONFIG_DIR`, the same environment
|
|
75
|
-
* variable the Claude Code CLI itself uses to relocate `~/.claude`, so
|
|
76
|
-
* Promptfoo finds the credential file when a user has customized their
|
|
77
|
-
* Claude Code config location.
|
|
78
|
-
*/
|
|
79
|
-
function resolveConfigDir(env) {
|
|
80
|
-
return resolveConfiguredDir(env) ?? path.join(os.homedir(), ".claude");
|
|
81
|
-
}
|
|
82
|
-
function resolveCredentialsPath(env) {
|
|
83
|
-
return path.join(resolveConfigDir(env), CLAUDE_CODE_CREDENTIALS_FILENAME);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Resolves the macOS keychain service name for the Claude Code credential,
|
|
87
|
-
* mirroring the Claude Code CLI: with the default config dir it is
|
|
88
|
-
* `Claude Code-credentials`, but whenever `CLAUDE_CONFIG_DIR` is set — even
|
|
89
|
-
* to the default `~/.claude` — the CLI appends `-` plus the first 8 hex
|
|
90
|
-
* chars of sha256 of the *raw* configured value (no path normalization; a
|
|
91
|
-
* trailing slash produces a different hash). Empirically verified against
|
|
92
|
-
* claude v2.1.204 by tracing its `security find-generic-password` calls;
|
|
93
|
-
* this is an internal CLI detail that may drift, in which case the lookup
|
|
94
|
-
* misses and falls through to the credentials-file path, then to the
|
|
95
|
-
* caller's "no credential found" warning.
|
|
96
|
-
*/
|
|
97
|
-
function resolveKeychainService(env) {
|
|
98
|
-
const configuredDir = resolveConfiguredDir(env);
|
|
99
|
-
if (!configuredDir) return CLAUDE_CODE_KEYCHAIN_SERVICE;
|
|
100
|
-
const suffix = createHash("sha256").update(configuredDir).digest("hex").slice(0, 8);
|
|
101
|
-
return `${CLAUDE_CODE_KEYCHAIN_SERVICE}-${suffix}`;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* `security` exits with status 44 when the requested generic-password entry
|
|
105
|
-
* does not exist. Any other non-zero exit (or throw) indicates a real failure
|
|
106
|
-
* — ACL denial, corrupted entry, missing binary, timeout — and is worth a
|
|
107
|
-
* `warn` log rather than silently falling through.
|
|
108
|
-
*/
|
|
109
|
-
const SECURITY_ENTRY_NOT_FOUND = 44;
|
|
110
|
-
function parseCredential(raw) {
|
|
111
|
-
if (!raw || typeof raw !== "object") return {
|
|
112
|
-
ok: false,
|
|
113
|
-
reason: "credential JSON is not an object"
|
|
114
|
-
};
|
|
115
|
-
const claudeAiOauth = raw.claudeAiOauth;
|
|
116
|
-
if (!claudeAiOauth || typeof claudeAiOauth !== "object") return {
|
|
117
|
-
ok: false,
|
|
118
|
-
reason: "missing `claudeAiOauth` object"
|
|
119
|
-
};
|
|
120
|
-
const inner = claudeAiOauth;
|
|
121
|
-
const accessToken = inner.accessToken;
|
|
122
|
-
if (typeof accessToken !== "string" || !accessToken) return {
|
|
123
|
-
ok: false,
|
|
124
|
-
reason: "missing `claudeAiOauth.accessToken` string"
|
|
125
|
-
};
|
|
126
|
-
const credential = { accessToken };
|
|
127
|
-
if (typeof inner.refreshToken === "string" && inner.refreshToken) credential.refreshToken = inner.refreshToken;
|
|
128
|
-
if (typeof inner.expiresAt === "number" && Number.isFinite(inner.expiresAt)) credential.expiresAt = inner.expiresAt;
|
|
129
|
-
if (typeof inner.subscriptionType === "string") credential.subscriptionType = inner.subscriptionType;
|
|
130
|
-
return {
|
|
131
|
-
ok: true,
|
|
132
|
-
credential
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
function parseJsonBlob(blob) {
|
|
136
|
-
let parsed;
|
|
137
|
-
try {
|
|
138
|
-
parsed = JSON.parse(blob);
|
|
139
|
-
} catch (err) {
|
|
140
|
-
return {
|
|
141
|
-
ok: false,
|
|
142
|
-
reason: `invalid JSON: ${err instanceof Error ? err.message : String(err)}`
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
return parseCredential(parsed);
|
|
146
|
-
}
|
|
147
|
-
function readFromMacosKeychain(env) {
|
|
148
|
-
if (process.platform !== "darwin") return null;
|
|
149
|
-
let out;
|
|
150
|
-
try {
|
|
151
|
-
out = execFileSync("security", [
|
|
152
|
-
"find-generic-password",
|
|
153
|
-
"-s",
|
|
154
|
-
resolveKeychainService(env),
|
|
155
|
-
"-w"
|
|
156
|
-
], {
|
|
157
|
-
encoding: "utf-8",
|
|
158
|
-
stdio: [
|
|
159
|
-
"ignore",
|
|
160
|
-
"pipe",
|
|
161
|
-
"ignore"
|
|
162
|
-
],
|
|
163
|
-
timeout: 5e3
|
|
164
|
-
});
|
|
165
|
-
} catch (err) {
|
|
166
|
-
if (err?.status === SECURITY_ENTRY_NOT_FOUND) {
|
|
167
|
-
logger.debug("[anthropic] No Claude Code credential entry in the macOS keychain; trying file fallback.");
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
logger.warn("[anthropic] Failed to read Claude Code credential from macOS keychain; falling back to file lookup.", { error: err instanceof Error ? err.message : String(err) });
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
const trimmed = out.trim();
|
|
174
|
-
if (!trimmed) {
|
|
175
|
-
logger.warn("[anthropic] Claude Code macOS keychain entry is empty. Run `claude /login` to refresh it.");
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
const result = parseJsonBlob(trimmed);
|
|
179
|
-
if (!result.ok) {
|
|
180
|
-
logger.warn(`[anthropic] Claude Code macOS keychain entry is malformed (${result.reason}). Run \`claude /login\` to refresh it.`);
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
return result.credential;
|
|
184
|
-
}
|
|
185
|
-
function readFromFile(env) {
|
|
186
|
-
const filePath = resolveCredentialsPath(env);
|
|
187
|
-
if (!fs.existsSync(filePath)) return null;
|
|
188
|
-
let raw;
|
|
189
|
-
try {
|
|
190
|
-
raw = fs.readFileSync(filePath, "utf-8");
|
|
191
|
-
} catch (err) {
|
|
192
|
-
logger.warn(`[anthropic] Claude Code credentials file at ${filePath} exists but could not be read. Run \`claude /login\` to refresh it.`, { error: err instanceof Error ? err.message : String(err) });
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
const result = parseJsonBlob(raw);
|
|
196
|
-
if (!result.ok) {
|
|
197
|
-
logger.warn(`[anthropic] Claude Code credentials file at ${filePath} is malformed (${result.reason}). Run \`claude /login\` to refresh it.`);
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
return result.credential;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Loads a Claude Code OAuth credential from the local environment.
|
|
204
|
-
*
|
|
205
|
-
* Resolution order:
|
|
206
|
-
* 1. macOS keychain — only attempted on darwin. The service name mirrors the
|
|
207
|
-
* Claude Code CLI: `Claude Code-credentials` for the default config dir,
|
|
208
|
-
* or `Claude Code-credentials-<sha256(CLAUDE_CONFIG_DIR)[:8]>` when
|
|
209
|
-
* `CLAUDE_CONFIG_DIR` is set (see {@link resolveKeychainService}), so each
|
|
210
|
-
* Claude Code profile resolves to its own credential.
|
|
211
|
-
* 2. `$HOME/.claude/.credentials.json` — the Linux/Windows default used by
|
|
212
|
-
* Claude Code, and a fallback on macOS when the keychain entry is missing.
|
|
213
|
-
* On Windows this resolves to `%USERPROFILE%\.claude\.credentials.json`.
|
|
214
|
-
* Set `CLAUDE_CONFIG_DIR` to read from a different directory instead —
|
|
215
|
-
* the same environment variable the Claude Code CLI itself uses to
|
|
216
|
-
* relocate `~/.claude`. It resolves from the provider-scoped `env`
|
|
217
|
-
* override first, then the root config / process environment.
|
|
218
|
-
*
|
|
219
|
-
* Returns `null` when no credential is available. Callers should check
|
|
220
|
-
* {@link isCredentialExpired} on a non-null return before using it — this
|
|
221
|
-
* function does not filter out expired credentials so callers can decide
|
|
222
|
-
* whether to warn, refuse, or surface a 401 to the user.
|
|
223
|
-
*
|
|
224
|
-
* Never throws. Missing credentials fall through silently; corrupted or
|
|
225
|
-
* unreadable credentials are logged at `warn` level with a reason so broken
|
|
226
|
-
* setups are diagnosable without enabling debug logging.
|
|
227
|
-
*/
|
|
228
|
-
function loadClaudeCodeCredential(env) {
|
|
229
|
-
return readFromMacosKeychain(env) ?? readFromFile(env);
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Returns `true` when the credential's `expiresAt` (ms since epoch) is in the
|
|
233
|
-
* past. Credentials without an `expiresAt` are treated as non-expired — the
|
|
234
|
-
* Anthropic API will reject them with a 401 if the token is actually invalid.
|
|
235
|
-
*/
|
|
236
|
-
function isCredentialExpired(credential) {
|
|
237
|
-
if (credential.expiresAt == null) return false;
|
|
238
|
-
return Date.now() >= credential.expiresAt;
|
|
239
|
-
}
|
|
240
|
-
//#endregion
|
|
241
|
-
//#region src/providers/anthropic/generic.ts
|
|
242
|
-
function getScopedCustomHeaders(env) {
|
|
243
|
-
return getExplicitProviderEnv(env)?.ANTHROPIC_CUSTOM_HEADERS ?? getEnvOverrides("provider")?.ANTHROPIC_CUSTOM_HEADERS ?? env?.ANTHROPIC_CUSTOM_HEADERS ?? getEnvOverrides()?.ANTHROPIC_CUSTOM_HEADERS ?? getEnvOverrides("file")?.ANTHROPIC_CUSTOM_HEADERS;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Parse ANTHROPIC_CUSTOM_HEADERS the same way the Anthropic SDK does
|
|
247
|
-
* (newline-separated `Name: value` lines) and map each header name to null so
|
|
248
|
-
* the SDK omits it. Providers that reuse the SDK against Anthropic-compatible
|
|
249
|
-
* third-party endpoints use this to keep Anthropic-scoped headers (often
|
|
250
|
-
* gateway/proxy secrets) off foreign hosts.
|
|
251
|
-
*/
|
|
252
|
-
function getAnthropicEnvHeaderSuppressions(env) {
|
|
253
|
-
const scopedHeaders = getScopedCustomHeaders(env);
|
|
254
|
-
return Object.fromEntries(Object.keys({
|
|
255
|
-
...parseAnthropicCustomHeaders(process.env.ANTHROPIC_CUSTOM_HEADERS),
|
|
256
|
-
...parseAnthropicCustomHeaders(scopedHeaders)
|
|
257
|
-
}).map((name) => [name, null]));
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Client options for an Anthropic-compatible endpoint that is *not* Anthropic
|
|
261
|
-
* (Bedrock's mantle host, a Cloudflare AI Gateway).
|
|
262
|
-
*
|
|
263
|
-
* `ANTHROPIC_CUSTOM_HEADERS` is scoped to api.anthropic.com, so anything it
|
|
264
|
-
* defines — an Authorization bearer, a proxy secret, an Anthropic `x-api-key` —
|
|
265
|
-
* must never ride along to a third-party host. Drop every name it defines, in
|
|
266
|
-
* every case variant (HTTP header names are case-insensitive, so `X-Api-Key`
|
|
267
|
-
* and `x-api-key` are the same header and both have to go), then re-assert this
|
|
268
|
-
* provider's own credential.
|
|
269
|
-
*/
|
|
270
|
-
function buildIsolatedAnthropicClientOptions(options, env, apiKey) {
|
|
271
|
-
const suppressedEnvHeaders = getAnthropicEnvHeaderSuppressions(env);
|
|
272
|
-
const suppressedNames = new Set(Object.keys(suppressedEnvHeaders).map((name) => name.toLowerCase()));
|
|
273
|
-
const safeDefaultHeaders = Object.fromEntries(Object.entries(options.defaultHeaders ?? {}).filter(([name]) => !suppressedNames.has(name.toLowerCase())));
|
|
274
|
-
const apiKeyHeaders = Object.fromEntries(Object.keys(suppressedEnvHeaders).filter((name) => name.toLowerCase() === "x-api-key").map((name) => [name, apiKey]));
|
|
275
|
-
return {
|
|
276
|
-
...options,
|
|
277
|
-
defaultHeaders: {
|
|
278
|
-
...safeDefaultHeaders,
|
|
279
|
-
...suppressedEnvHeaders,
|
|
280
|
-
...apiKey ? {
|
|
281
|
-
"x-api-key": apiKey,
|
|
282
|
-
...apiKeyHeaders
|
|
283
|
-
} : {}
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function parseAnthropicCustomHeaders(value) {
|
|
288
|
-
const headers = {};
|
|
289
|
-
for (const line of value?.split("\n") ?? []) {
|
|
290
|
-
const colon = line.indexOf(":");
|
|
291
|
-
if (colon >= 0) {
|
|
292
|
-
const name = line.substring(0, colon).trim();
|
|
293
|
-
if (name) headers[name] = line.substring(colon + 1).trim();
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return headers;
|
|
297
|
-
}
|
|
298
|
-
function setCaseInsensitiveHeaderValue(headers, headerName, value) {
|
|
299
|
-
headers[headerName] = value;
|
|
300
|
-
for (const name of Object.keys(headers)) if (name.toLowerCase() === headerName.toLowerCase()) headers[name] = value;
|
|
301
|
-
}
|
|
302
|
-
function getAnthropicCustomHeaderOverrides(env) {
|
|
303
|
-
const customHeaders = getScopedCustomHeaders(env);
|
|
304
|
-
if (customHeaders === void 0) return {};
|
|
305
|
-
return {
|
|
306
|
-
...getAnthropicEnvHeaderSuppressions(env),
|
|
307
|
-
...parseAnthropicCustomHeaders(customHeaders)
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
const ANTHROPIC_CACHE_HASH_CONTEXT = "promptfoo:anthropic:cache-key:v1";
|
|
311
|
-
const MAX_EPHEMERAL_RESPONSE_CACHE_ENTRIES = 512;
|
|
312
|
-
function isPlainObject(value) {
|
|
313
|
-
if (value === null || typeof value !== "object") return false;
|
|
314
|
-
const proto = Object.getPrototypeOf(value);
|
|
315
|
-
return proto === Object.prototype || proto === null;
|
|
316
|
-
}
|
|
317
|
-
function canonicalize(value) {
|
|
318
|
-
if (Array.isArray(value)) return value.map(canonicalize);
|
|
319
|
-
if (isPlainObject(value)) {
|
|
320
|
-
const entries = Object.keys(value).sort().map((k) => [k, canonicalize(value[k])]);
|
|
321
|
-
return Object.fromEntries(entries);
|
|
322
|
-
}
|
|
323
|
-
return value;
|
|
324
|
-
}
|
|
325
|
-
function hashAnthropicCacheValue(value) {
|
|
326
|
-
const canonical = canonicalize(value);
|
|
327
|
-
const serialized = typeof canonical === "string" ? canonical : JSON.stringify(canonical) ?? String(canonical);
|
|
328
|
-
return createHash$1("sha256").update(ANTHROPIC_CACHE_HASH_CONTEXT).update("\0").update(serialized).digest("hex");
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Generic provider class for Anthropic APIs.
|
|
332
|
-
*
|
|
333
|
-
* Serves as a base class with shared functionality for all Anthropic
|
|
334
|
-
* subclass providers. Handles API key resolution and, for subclasses that
|
|
335
|
-
* opt in via {@link AnthropicGenericProvider.SUPPORTS_CLAUDE_CODE_OAUTH},
|
|
336
|
-
* falls back to an OAuth token loaded from a local Claude Code session so
|
|
337
|
-
* Claude.ai subscribers can run evals without a separate console API key.
|
|
338
|
-
*
|
|
339
|
-
* The OAuth fallback is opt-in so it only affects
|
|
340
|
-
* `AnthropicMessagesProvider`. Claude Code OAuth tokens are gated to the
|
|
341
|
-
* Messages API (`/v1/messages`) — forwarding them to the legacy
|
|
342
|
-
* text-completion endpoint would fail at request time, which would cause
|
|
343
|
-
* `anthropic:completion:*` configs to bypass promptfoo's upfront preflight
|
|
344
|
-
* check and then produce a less useful error for every test case.
|
|
345
|
-
*/
|
|
346
|
-
var AnthropicGenericProvider = class {
|
|
347
|
-
/**
|
|
348
|
-
* Subclasses that can authenticate via a Claude Code OAuth session
|
|
349
|
-
* should override this to `true`. The base class's constructor reads the
|
|
350
|
-
* flag from `this.constructor` so only OAuth-capable subclasses attempt
|
|
351
|
-
* the credential lookup (and only they honor `apiKeyRequired: false`).
|
|
352
|
-
*/
|
|
353
|
-
static SUPPORTS_CLAUDE_CODE_OAUTH = false;
|
|
354
|
-
modelName;
|
|
355
|
-
config;
|
|
356
|
-
env;
|
|
357
|
-
apiKey;
|
|
358
|
-
/**
|
|
359
|
-
* `true` when this provider is authenticating via a Claude Code OAuth token
|
|
360
|
-
* rather than a standard `ANTHROPIC_API_KEY`. Subclasses use this to inject
|
|
361
|
-
* the Claude Code identity system block that Anthropic's API requires for
|
|
362
|
-
* OAuth-authenticated Messages requests.
|
|
363
|
-
*/
|
|
364
|
-
usingClaudeCodeOAuth;
|
|
365
|
-
/**
|
|
366
|
-
* The Claude Code credential used to authenticate, when
|
|
367
|
-
* `usingClaudeCodeOAuth` is `true`. Kept so subclasses can re-check expiry
|
|
368
|
-
* at request time and surface a "run `claude /login`" error instead of a
|
|
369
|
-
* raw 401 from the SDK.
|
|
370
|
-
*/
|
|
371
|
-
claudeCodeCredential;
|
|
372
|
-
anthropic;
|
|
373
|
-
label;
|
|
374
|
-
clientHasCustomHeaders;
|
|
375
|
-
ephemeralCacheNamespace = randomUUID$1();
|
|
376
|
-
ephemeralResponseCache = /* @__PURE__ */ new Map();
|
|
377
|
-
ephemeralCacheClearGeneration = 0;
|
|
378
|
-
constructor(modelName, options = {}) {
|
|
379
|
-
const { config, id, label, env } = options;
|
|
380
|
-
this.env = env;
|
|
381
|
-
this.modelName = modelName;
|
|
382
|
-
this.config = config || {};
|
|
383
|
-
this.label = label;
|
|
384
|
-
const customHeaders = getScopedCustomHeaders(this.env) ?? getEnvString("ANTHROPIC_CUSTOM_HEADERS");
|
|
385
|
-
this.clientHasCustomHeaders = Object.keys(this.config.headers ?? {}).length > 0 || Object.keys(parseAnthropicCustomHeaders(customHeaders)).length > 0;
|
|
386
|
-
this.apiKey = this.getApiKey();
|
|
387
|
-
this.usingClaudeCodeOAuth = false;
|
|
388
|
-
let authToken;
|
|
389
|
-
const defaultHeaders = {};
|
|
390
|
-
const subclass = this.constructor;
|
|
391
|
-
if (!this.apiKey && this.config.apiKeyRequired === false && subclass.SUPPORTS_CLAUDE_CODE_OAUTH) {
|
|
392
|
-
const credential = loadClaudeCodeCredential(this.env);
|
|
393
|
-
if (credential) {
|
|
394
|
-
if (isCredentialExpired(credential)) logger.warn("[anthropic] Claude Code OAuth credential is expired. Run `claude /login` to refresh it.");
|
|
395
|
-
else logger.debug("[anthropic] Authenticating with Claude Code OAuth credential from local session.");
|
|
396
|
-
authToken = credential.accessToken;
|
|
397
|
-
this.usingClaudeCodeOAuth = true;
|
|
398
|
-
this.claudeCodeCredential = credential;
|
|
399
|
-
defaultHeaders["anthropic-beta"] = CLAUDE_CODE_OAUTH_BETA_FEATURES.join(",");
|
|
400
|
-
defaultHeaders["user-agent"] = CLAUDE_CODE_USER_AGENT;
|
|
401
|
-
defaultHeaders["x-app"] = "cli";
|
|
402
|
-
} else logger.warn("[anthropic] apiKeyRequired is false but no Claude Code credential was found. Run `claude /login` to create one, or set ANTHROPIC_API_KEY.");
|
|
403
|
-
}
|
|
404
|
-
const clientDefaultHeaders = {
|
|
405
|
-
...getAnthropicCustomHeaderOverrides(this.env),
|
|
406
|
-
...defaultHeaders
|
|
407
|
-
};
|
|
408
|
-
const scopedCustomHeaderValue = getScopedCustomHeaders(this.env);
|
|
409
|
-
const scopedCustomHeaders = parseAnthropicCustomHeaders(scopedCustomHeaderValue);
|
|
410
|
-
const scopedAuthHeaders = new Set(Object.keys(scopedCustomHeaders).map((name) => name.toLowerCase()));
|
|
411
|
-
if (scopedCustomHeaderValue !== void 0 && this.apiKey && !scopedAuthHeaders.has("x-api-key")) setCaseInsensitiveHeaderValue(clientDefaultHeaders, "x-api-key", this.apiKey);
|
|
412
|
-
if (scopedCustomHeaderValue !== void 0 && authToken && !scopedAuthHeaders.has("authorization")) setCaseInsensitiveHeaderValue(clientDefaultHeaders, "authorization", `Bearer ${authToken}`);
|
|
413
|
-
this.anthropic = new Anthropic(this.buildAnthropicClientOptions({
|
|
414
|
-
apiKey: this.apiKey ?? null,
|
|
415
|
-
authToken: authToken ?? null,
|
|
416
|
-
baseURL: this.getApiBaseUrl(),
|
|
417
|
-
...Object.keys(clientDefaultHeaders).length > 0 ? { defaultHeaders: clientDefaultHeaders } : {}
|
|
418
|
-
}));
|
|
419
|
-
this.id = id ? () => id : this.id;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Options for the Anthropic SDK client built during construction.
|
|
423
|
-
* Subclasses that point the SDK at an Anthropic-compatible third-party
|
|
424
|
-
* endpoint can override this to adjust auth or headers (e.g. bearer-token
|
|
425
|
-
* services). Called from the constructor, so overrides may only rely on
|
|
426
|
-
* `config`, `env`, and `apiKey`, which are set before the client is built.
|
|
427
|
-
*/
|
|
428
|
-
buildAnthropicClientOptions(options) {
|
|
429
|
-
return options;
|
|
430
|
-
}
|
|
431
|
-
id() {
|
|
432
|
-
return `anthropic:${this.modelName}`;
|
|
433
|
-
}
|
|
434
|
-
toString() {
|
|
435
|
-
return `[Anthropic Provider ${this.modelName}]`;
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Whether promptfoo's preflight check should require an API key before
|
|
439
|
-
* dispatching requests to this provider. Returns `false` only for
|
|
440
|
-
* OAuth-capable subclasses (see {@link SUPPORTS_CLAUDE_CODE_OAUTH}) when
|
|
441
|
-
* the user has opted in via `apiKeyRequired: false`. All other subclasses
|
|
442
|
-
* keep the preflight check so missing-credential errors surface upfront
|
|
443
|
-
* rather than at per-request call time.
|
|
444
|
-
*/
|
|
445
|
-
requiresApiKey() {
|
|
446
|
-
if (this.constructor.SUPPORTS_CLAUDE_CODE_OAUTH && this.config.apiKeyRequired === false) return false;
|
|
447
|
-
return true;
|
|
448
|
-
}
|
|
449
|
-
getApiKey() {
|
|
450
|
-
return resolveProviderApiKey(this.config, this.env, ["ANTHROPIC_API_KEY"]);
|
|
451
|
-
}
|
|
452
|
-
getApiBaseUrl() {
|
|
453
|
-
const envUrl = getProviderEnvString(this.env, "ANTHROPIC_BASE_URL") ?? getEnvString("ANTHROPIC_BASE_URL");
|
|
454
|
-
return this.config?.apiBaseUrl || (envUrl === "" ? "https://api.anthropic.com" : envUrl);
|
|
455
|
-
}
|
|
456
|
-
getCacheIdentityHash() {
|
|
457
|
-
return hashAnthropicCacheValue({ apiBaseUrl: this.getApiBaseUrl() });
|
|
458
|
-
}
|
|
459
|
-
hasCustomHeaders() {
|
|
460
|
-
const customHeaders = getScopedCustomHeaders(this.env) ?? getEnvString("ANTHROPIC_CUSTOM_HEADERS");
|
|
461
|
-
return this.clientHasCustomHeaders || Object.keys(parseAnthropicCustomHeaders(customHeaders)).length > 0;
|
|
462
|
-
}
|
|
463
|
-
getCacheNamespace() {
|
|
464
|
-
return hashAnthropicCacheValue({
|
|
465
|
-
providerId: this.id(),
|
|
466
|
-
providerLabel: this.label || this.ephemeralCacheNamespace
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
async getCachedResponse(cache, cacheKey, ephemeralCacheKey, clearGeneration) {
|
|
470
|
-
if (this.label) return cache.get(cacheKey);
|
|
471
|
-
this.syncEphemeralCache(clearGeneration);
|
|
472
|
-
const entry = this.ephemeralResponseCache.get(ephemeralCacheKey);
|
|
473
|
-
if (!entry) return;
|
|
474
|
-
if (entry.expiresAt <= Date.now()) {
|
|
475
|
-
this.ephemeralResponseCache.delete(ephemeralCacheKey);
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
return entry.response;
|
|
479
|
-
}
|
|
480
|
-
async setCachedResponse(cache, cacheKey, ephemeralCacheKey, clearGeneration, ttlMs, response) {
|
|
481
|
-
if (this.label) {
|
|
482
|
-
await cache.set(cacheKey, response);
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
this.syncEphemeralCache(clearGeneration);
|
|
486
|
-
if (!this.ephemeralResponseCache.has(ephemeralCacheKey) && this.ephemeralResponseCache.size >= MAX_EPHEMERAL_RESPONSE_CACHE_ENTRIES) {
|
|
487
|
-
const oldestKey = this.ephemeralResponseCache.keys().next().value;
|
|
488
|
-
if (oldestKey !== void 0) this.ephemeralResponseCache.delete(oldestKey);
|
|
489
|
-
}
|
|
490
|
-
this.ephemeralResponseCache.set(ephemeralCacheKey, {
|
|
491
|
-
response,
|
|
492
|
-
expiresAt: ttlMs <= 0 ? Number.POSITIVE_INFINITY : Date.now() + ttlMs
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
syncEphemeralCache(clearGeneration) {
|
|
496
|
-
if (this.ephemeralCacheClearGeneration !== clearGeneration) {
|
|
497
|
-
this.ephemeralResponseCache.clear();
|
|
498
|
-
this.ephemeralCacheClearGeneration = clearGeneration;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Base implementation - should be overridden by specific provider implementations
|
|
503
|
-
*/
|
|
504
|
-
async callApi(_prompt, _context) {
|
|
505
|
-
throw new Error("Not implemented: callApi must be implemented by subclasses");
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
//#endregion
|
|
509
|
-
//#region src/providers/anthropic/messages.ts
|
|
510
|
-
const DEFAULT_MAX_MCP_TOOL_CALLS = 8;
|
|
511
|
-
const MAX_PAUSE_TURN_RESUMES = 5;
|
|
512
|
-
async function finalMessageWithStreamedStopDetails(stream) {
|
|
513
|
-
let streamedStopDetails;
|
|
514
|
-
stream.on?.("streamEvent", (event) => {
|
|
515
|
-
if (event.type === "message_delta" && event.delta.stop_details != null) streamedStopDetails = event.delta.stop_details;
|
|
516
|
-
});
|
|
517
|
-
const finalMessage = await stream.finalMessage();
|
|
518
|
-
return finalMessage.stop_details == null && streamedStopDetails != null ? {
|
|
519
|
-
...finalMessage,
|
|
520
|
-
stop_details: streamedStopDetails
|
|
521
|
-
} : finalMessage;
|
|
522
|
-
}
|
|
523
|
-
function normalizeHeadersForCacheKey(headers) {
|
|
524
|
-
if (Object.keys(headers).length === 0) return;
|
|
525
|
-
return Object.entries(headers).map(([name, value]) => ({
|
|
526
|
-
name: name.toLowerCase(),
|
|
527
|
-
valueHash: hashAnthropicCacheValue(value)
|
|
528
|
-
})).sort((headerA, headerB) => {
|
|
529
|
-
const nameComparison = headerA.name.localeCompare(headerB.name);
|
|
530
|
-
return nameComparison === 0 ? headerA.valueHash.localeCompare(headerB.valueHash) : nameComparison;
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
function getMessagesRequestMetadata(params) {
|
|
534
|
-
const mcpServers = params.mcp_servers;
|
|
535
|
-
return {
|
|
536
|
-
model: params.model,
|
|
537
|
-
max_tokens: params.max_tokens,
|
|
538
|
-
messageCount: params.messages.length,
|
|
539
|
-
stream: params.stream,
|
|
540
|
-
temperature: params.temperature,
|
|
541
|
-
hasSystem: params.system !== void 0,
|
|
542
|
-
stopSequenceCount: Array.isArray(params.stop_sequences) ? params.stop_sequences.length : void 0,
|
|
543
|
-
thinkingEnabled: isClaudeThinkingEnabled(params.thinking),
|
|
544
|
-
toolCount: Array.isArray(params.tools) ? params.tools.length : void 0,
|
|
545
|
-
hasToolChoice: params.tool_choice !== void 0,
|
|
546
|
-
hasMetadata: params.metadata !== void 0,
|
|
547
|
-
hasMcpServers: Array.isArray(mcpServers) && mcpServers.length > 0,
|
|
548
|
-
hasOutputConfig: params.output_config !== void 0
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
function getMessagesResponseMetadata(response) {
|
|
552
|
-
return {
|
|
553
|
-
model: response.model,
|
|
554
|
-
type: response.type,
|
|
555
|
-
contentBlockCount: Array.isArray(response.content) ? response.content.length : void 0,
|
|
556
|
-
stopReason: response.stop_reason,
|
|
557
|
-
inputTokens: response.usage?.input_tokens,
|
|
558
|
-
outputTokens: response.usage?.output_tokens,
|
|
559
|
-
cacheReadInputTokens: response.usage?.cache_read_input_tokens,
|
|
560
|
-
cacheCreationInputTokens: response.usage?.cache_creation_input_tokens
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
function getMaxMcpToolCalls(config) {
|
|
564
|
-
if (config.max_tool_calls == null) return DEFAULT_MAX_MCP_TOOL_CALLS;
|
|
565
|
-
if (!Number.isFinite(config.max_tool_calls) || config.max_tool_calls < 0) return DEFAULT_MAX_MCP_TOOL_CALLS;
|
|
566
|
-
return Math.floor(config.max_tool_calls);
|
|
567
|
-
}
|
|
568
|
-
function getMcpContinuationParams(params, messages) {
|
|
569
|
-
if (params.tool_choice?.type === "any" || params.tool_choice?.type === "tool") {
|
|
570
|
-
const { tool_choice: _toolChoice, ...continuationParams } = params;
|
|
571
|
-
return {
|
|
572
|
-
...continuationParams,
|
|
573
|
-
messages
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
return {
|
|
577
|
-
...params,
|
|
578
|
-
messages
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
/** Reuse the turn's container unless the caller pinned a different one. */
|
|
582
|
-
function withTurnContainer(params, responses) {
|
|
583
|
-
const requested = params.container;
|
|
584
|
-
if (typeof requested === "string" || requested?.id != null) return params;
|
|
585
|
-
for (let i = responses.length - 1; i >= 0; i--) {
|
|
586
|
-
const container = responses[i].container;
|
|
587
|
-
if (container) return {
|
|
588
|
-
...params,
|
|
589
|
-
container: requested ? {
|
|
590
|
-
...requested,
|
|
591
|
-
id: container.id
|
|
592
|
-
} : container.id
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
return params;
|
|
596
|
-
}
|
|
597
|
-
function coerceMcpToolInput(input) {
|
|
598
|
-
if (input == null || input === "") return {};
|
|
599
|
-
if (typeof input === "string") {
|
|
600
|
-
const parsed = JSON.parse(input);
|
|
601
|
-
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
|
|
602
|
-
}
|
|
603
|
-
return typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
604
|
-
}
|
|
605
|
-
function mergeAnthropicUsage(messages) {
|
|
606
|
-
const usageEntries = messages.map((message) => message.usage).filter((usage) => usage != null);
|
|
607
|
-
if (usageEntries.length === 0) return;
|
|
608
|
-
const [firstUsage, ...remainingUsageEntries] = usageEntries;
|
|
609
|
-
return remainingUsageEntries.reduce((acc, usage) => ({
|
|
610
|
-
...usage,
|
|
611
|
-
input_tokens: acc.input_tokens + (usage.input_tokens ?? 0),
|
|
612
|
-
output_tokens: acc.output_tokens + (usage.output_tokens ?? 0),
|
|
613
|
-
cache_creation_input_tokens: (acc.cache_creation_input_tokens ?? 0) + (usage.cache_creation_input_tokens ?? 0),
|
|
614
|
-
cache_creation: acc.cache_creation || usage.cache_creation ? {
|
|
615
|
-
ephemeral_5m_input_tokens: (acc.cache_creation?.ephemeral_5m_input_tokens ?? 0) + (usage.cache_creation?.ephemeral_5m_input_tokens ?? 0),
|
|
616
|
-
ephemeral_1h_input_tokens: (acc.cache_creation?.ephemeral_1h_input_tokens ?? 0) + (usage.cache_creation?.ephemeral_1h_input_tokens ?? 0)
|
|
617
|
-
} : null,
|
|
618
|
-
cache_read_input_tokens: (acc.cache_read_input_tokens ?? 0) + (usage.cache_read_input_tokens ?? 0),
|
|
619
|
-
output_tokens_details: acc.output_tokens_details || usage.output_tokens_details ? { thinking_tokens: (acc.output_tokens_details?.thinking_tokens ?? 0) + (usage.output_tokens_details?.thinking_tokens ?? 0) } : null
|
|
620
|
-
}), firstUsage);
|
|
621
|
-
}
|
|
622
|
-
function withMergedAnthropicUsage(response, responses) {
|
|
623
|
-
const usage = mergeAnthropicUsage(responses);
|
|
624
|
-
return usage ? {
|
|
625
|
-
...response,
|
|
626
|
-
usage
|
|
627
|
-
} : response;
|
|
628
|
-
}
|
|
629
|
-
function toCachedMessage(message, responses) {
|
|
630
|
-
if (responses.length === 1) return message;
|
|
631
|
-
return {
|
|
632
|
-
...message,
|
|
633
|
-
fileReferences: responses.flatMap((response) => response.content.flatMap(getFileReferences)),
|
|
634
|
-
finalText: responses[responses.length - 1].content.filter((block) => block.type === "text").map((block) => block.text).join(""),
|
|
635
|
-
billedCalls: responses.map(({ stop_details, stop_reason, usage }) => ({
|
|
636
|
-
stop_details,
|
|
637
|
-
stop_reason,
|
|
638
|
-
usage
|
|
639
|
-
}))
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
var AnthropicMessagesProvider = class AnthropicMessagesProvider extends AnthropicGenericProvider {
|
|
643
|
-
calculateMessageCost(config, message, modelName = this.modelName) {
|
|
644
|
-
if (message.stop_reason === "refusal" && message.usage?.output_tokens === 0 && ![
|
|
645
|
-
"bio",
|
|
646
|
-
"frontier_llm",
|
|
647
|
-
"reasoning_extraction"
|
|
648
|
-
].includes(message.stop_details?.category ?? "")) return 0;
|
|
649
|
-
return calculateAnthropicCost(modelName, config, message.usage?.input_tokens, message.usage?.output_tokens, message.usage?.cache_read_input_tokens ?? void 0, message.usage?.cache_creation_input_tokens ?? void 0, message.usage?.cache_creation?.ephemeral_1h_input_tokens ?? void 0, message.usage?.inference_geo);
|
|
650
|
-
}
|
|
651
|
-
calculateMessageCosts(config, calls) {
|
|
652
|
-
return calls.reduce((total, call) => {
|
|
653
|
-
const callCost = this.calculateMessageCost(config, call);
|
|
654
|
-
return total != null && callCost != null ? total + callCost : void 0;
|
|
655
|
-
}, 0);
|
|
656
|
-
}
|
|
657
|
-
mcpClient = null;
|
|
658
|
-
mcpSession;
|
|
659
|
-
samplingParamsDeprecationWarned = false;
|
|
660
|
-
manualThinkingConversionWarned = false;
|
|
661
|
-
disabledThinkingRemovalWarned = false;
|
|
662
|
-
static SUPPORTS_CLAUDE_CODE_OAUTH = true;
|
|
663
|
-
static ANTHROPIC_MODELS = ANTHROPIC_MODELS;
|
|
664
|
-
static ANTHROPIC_MODELS_NAMES = ANTHROPIC_MODELS.map((model) => model.id);
|
|
665
|
-
static WARNS_ON_UNKNOWN_MODEL = true;
|
|
666
|
-
constructor(modelName, options = {}) {
|
|
667
|
-
super(modelName, options);
|
|
668
|
-
if (this.constructor.WARNS_ON_UNKNOWN_MODEL && !AnthropicMessagesProvider.ANTHROPIC_MODELS_NAMES.includes(normalizeAnthropicModelName(modelName))) logger.warn(`Using unknown Anthropic model: ${modelName}`);
|
|
669
|
-
const { id } = options;
|
|
670
|
-
this.id = id ? () => id : this.id;
|
|
671
|
-
this.initializeMCP().catch(() => void 0);
|
|
672
|
-
}
|
|
673
|
-
async initializeMCP(signal) {
|
|
674
|
-
if (!this.config.mcp?.enabled) return;
|
|
675
|
-
this.mcpSession ??= new McpClientSession(this.config.mcp);
|
|
676
|
-
this.mcpClient = await this.mcpSession.initialize(signal);
|
|
677
|
-
}
|
|
678
|
-
async cleanup() {
|
|
679
|
-
try {
|
|
680
|
-
await this.mcpSession?.cleanup();
|
|
681
|
-
} finally {
|
|
682
|
-
this.mcpClient = this.mcpSession?.client ?? null;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
/** Resume paused server-tool turns, retaining each request for usage and cost. */
|
|
686
|
-
async sendMessage(params, headers, shouldStream, responses, signal) {
|
|
687
|
-
const requestOptions = {
|
|
688
|
-
...Object.keys(headers).length > 0 && { headers },
|
|
689
|
-
...signal && { signal }
|
|
690
|
-
};
|
|
691
|
-
const send = async (requestParams) => {
|
|
692
|
-
signal?.throwIfAborted();
|
|
693
|
-
requestParams = withTurnContainer(requestParams, responses);
|
|
694
|
-
const message = shouldStream ? await finalMessageWithStreamedStopDetails(await this.anthropic.messages.stream(requestParams, requestOptions)) : await this.anthropic.messages.create(requestParams, requestOptions);
|
|
695
|
-
logger.debug("Anthropic Messages API response", { response: getMessagesResponseMetadata(message) });
|
|
696
|
-
responses.push(message);
|
|
697
|
-
return message;
|
|
698
|
-
};
|
|
699
|
-
let message = await send(params);
|
|
700
|
-
if (message.stop_reason !== "pause_turn") return message;
|
|
701
|
-
let turnContent = message.content;
|
|
702
|
-
for (let resumes = 0; message.stop_reason === "pause_turn"; resumes++) {
|
|
703
|
-
if (resumes === MAX_PAUSE_TURN_RESUMES) {
|
|
704
|
-
logger.warn(`Claude's turn was still paused (stop_reason: pause_turn) after ${MAX_PAUSE_TURN_RESUMES} resumes, so the output may be incomplete. Lower the tool max_uses or split the task.`);
|
|
705
|
-
break;
|
|
706
|
-
}
|
|
707
|
-
try {
|
|
708
|
-
message = await send({
|
|
709
|
-
...params,
|
|
710
|
-
messages: [...params.messages, {
|
|
711
|
-
role: "assistant",
|
|
712
|
-
content: turnContent
|
|
713
|
-
}]
|
|
714
|
-
});
|
|
715
|
-
} catch (err) {
|
|
716
|
-
signal?.throwIfAborted();
|
|
717
|
-
logger.warn(`Could not resume a paused Claude turn, so the output may be incomplete: ${err instanceof Error ? err.message : String(err)}`);
|
|
718
|
-
break;
|
|
719
|
-
}
|
|
720
|
-
turnContent = [...turnContent, ...message.content];
|
|
721
|
-
}
|
|
722
|
-
return {
|
|
723
|
-
...message,
|
|
724
|
-
content: turnContent
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
async resolveMcpToolUse({ config, headers, initialResponse, params, responses, shouldStream, signal }) {
|
|
728
|
-
const toolCalls = [];
|
|
729
|
-
const unchanged = () => ({
|
|
730
|
-
response: withMergedAnthropicUsage(initialResponse, responses),
|
|
731
|
-
responses,
|
|
732
|
-
toolCalls
|
|
733
|
-
});
|
|
734
|
-
if (!this.mcpClient) return unchanged();
|
|
735
|
-
const mcpToolNames = new Set(this.mcpClient.getAllTools().map((tool) => tool.name));
|
|
736
|
-
if (mcpToolNames.size === 0) return unchanged();
|
|
737
|
-
const maxToolCalls = getMaxMcpToolCalls(config);
|
|
738
|
-
if (maxToolCalls === 0) return unchanged();
|
|
739
|
-
let response = initialResponse;
|
|
740
|
-
let messages = params.messages;
|
|
741
|
-
let executedMcpToolCalls = 0;
|
|
742
|
-
for (let iteration = 0; iteration < maxToolCalls; iteration++) {
|
|
743
|
-
signal?.throwIfAborted();
|
|
744
|
-
const responseToolUses = response.content.filter((block) => block.type === "tool_use");
|
|
745
|
-
const toolUses = responseToolUses.filter((block) => mcpToolNames.has(block.name));
|
|
746
|
-
if (toolUses.length === 0) return {
|
|
747
|
-
response: withMergedAnthropicUsage(response, responses),
|
|
748
|
-
responses,
|
|
749
|
-
toolCalls
|
|
750
|
-
};
|
|
751
|
-
if (toolUses.length !== responseToolUses.length) {
|
|
752
|
-
logger.warn("Skipping Anthropic MCP continuation because the response mixes MCP and non-MCP tool_use blocks.");
|
|
753
|
-
return {
|
|
754
|
-
response: withMergedAnthropicUsage(response, responses),
|
|
755
|
-
responses,
|
|
756
|
-
toolCalls
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
if (executedMcpToolCalls + toolUses.length > maxToolCalls) return {
|
|
760
|
-
response: withMergedAnthropicUsage(response, responses),
|
|
761
|
-
responses,
|
|
762
|
-
error: `Anthropic MCP tool execution exceeded max_tool_calls=${maxToolCalls}. Increase provider config.max_tool_calls if this evaluation legitimately needs more tool calls.`,
|
|
763
|
-
toolCalls
|
|
764
|
-
};
|
|
765
|
-
executedMcpToolCalls += toolUses.length;
|
|
766
|
-
const toolResultBlocks = await Promise.all(toolUses.map((toolUse) => this.callMcpToolForAnthropic(toolUse)));
|
|
767
|
-
toolUses.forEach((toolUse, index) => {
|
|
768
|
-
const resultBlock = toolResultBlocks[index];
|
|
769
|
-
toolCalls.push({
|
|
770
|
-
id: toolUse.id,
|
|
771
|
-
name: toolUse.name,
|
|
772
|
-
input: coerceMcpToolInput(toolUse.input),
|
|
773
|
-
output: resultBlock.content,
|
|
774
|
-
is_error: resultBlock.is_error ?? false
|
|
775
|
-
});
|
|
776
|
-
});
|
|
777
|
-
messages = [
|
|
778
|
-
...messages,
|
|
779
|
-
{
|
|
780
|
-
role: "assistant",
|
|
781
|
-
content: response.content
|
|
782
|
-
},
|
|
783
|
-
{
|
|
784
|
-
role: "user",
|
|
785
|
-
content: toolResultBlocks
|
|
786
|
-
}
|
|
787
|
-
];
|
|
788
|
-
response = await this.sendMessage(getMcpContinuationParams(params, messages), headers, shouldStream, responses, signal);
|
|
789
|
-
}
|
|
790
|
-
const unresolvedToolUses = response.content.filter((block) => block.type === "tool_use" && mcpToolNames.has(block.name));
|
|
791
|
-
return {
|
|
792
|
-
response: withMergedAnthropicUsage(response, responses),
|
|
793
|
-
responses,
|
|
794
|
-
toolCalls,
|
|
795
|
-
...unresolvedToolUses.length > 0 ? { error: `Anthropic MCP tool execution exceeded max_tool_calls=${maxToolCalls}. Increase provider config.max_tool_calls if this evaluation legitimately needs more tool calls.` } : {}
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
async callMcpToolForAnthropic(toolUse) {
|
|
799
|
-
try {
|
|
800
|
-
const result = await this.mcpClient.callTool(toolUse.name, coerceMcpToolInput(toolUse.input));
|
|
801
|
-
if (isMcpErrorResult(result)) return {
|
|
802
|
-
type: "tool_result",
|
|
803
|
-
tool_use_id: toolUse.id,
|
|
804
|
-
content: `MCP Tool Error (${toolUse.name}): ${getMcpErrorMessage(result)}`,
|
|
805
|
-
is_error: true
|
|
806
|
-
};
|
|
807
|
-
return {
|
|
808
|
-
type: "tool_result",
|
|
809
|
-
tool_use_id: toolUse.id,
|
|
810
|
-
content: normalizeMcpToolContent(result.content)
|
|
811
|
-
};
|
|
812
|
-
} catch (error) {
|
|
813
|
-
return {
|
|
814
|
-
type: "tool_result",
|
|
815
|
-
tool_use_id: toolUse.id,
|
|
816
|
-
content: `MCP Tool Error (${toolUse.name}): ${error instanceof Error ? error.message : String(error)}`,
|
|
817
|
-
is_error: true
|
|
818
|
-
};
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
toString() {
|
|
822
|
-
if (!this.modelName) throw new Error("Anthropic model name is not set. Please provide a valid model name.");
|
|
823
|
-
return `[Anthropic Messages Provider ${this.modelName}]`;
|
|
824
|
-
}
|
|
825
|
-
getGenAISystem() {
|
|
826
|
-
return "anthropic";
|
|
827
|
-
}
|
|
828
|
-
sanitizeRequestHeaders(headers) {
|
|
829
|
-
return headers;
|
|
830
|
-
}
|
|
831
|
-
allowsClaudeGenerationFallback() {
|
|
832
|
-
return URL.canParse(this.anthropic.baseURL) && new URL(this.anthropic.baseURL).hostname.toLowerCase() === "api.anthropic.com";
|
|
833
|
-
}
|
|
834
|
-
/** Adapters with transport-managed authentication can defer validation to HTTP dispatch. */
|
|
835
|
-
validateAuthentication() {
|
|
836
|
-
if (!this.apiKey && !this.usingClaudeCodeOAuth) throw new Error("Anthropic API key is not set. Set the ANTHROPIC_API_KEY environment variable or add `apiKey` to the provider config. Alternatively, if you have an active Claude Code session, set `apiKeyRequired: false` in the provider config to authenticate via Claude Code.");
|
|
837
|
-
}
|
|
838
|
-
/** Independent of authentication: adapters decide whether their response cache is safe. */
|
|
839
|
-
shouldCacheResponses() {
|
|
840
|
-
return true;
|
|
841
|
-
}
|
|
842
|
-
async callApi(prompt, context, options) {
|
|
843
|
-
if (options?.abortSignal?.aborted) return { error: "Operation aborted" };
|
|
844
|
-
await this.initializeMCP(options?.abortSignal);
|
|
845
|
-
this.validateAuthentication();
|
|
846
|
-
if (this.usingClaudeCodeOAuth && this.claudeCodeCredential && isCredentialExpired(this.claudeCodeCredential)) throw new Error("Claude Code OAuth credential is expired. Run `claude /login` to refresh it, then re-run the eval.");
|
|
847
|
-
if (!this.modelName) throw new Error("Anthropic model name is not set. Please provide a valid model name.");
|
|
848
|
-
const spanContext = {
|
|
849
|
-
system: this.getGenAISystem(),
|
|
850
|
-
operationName: "chat",
|
|
851
|
-
model: this.modelName,
|
|
852
|
-
providerId: this.id(),
|
|
853
|
-
maxTokens: this.config.max_tokens,
|
|
854
|
-
temperature: this.config.temperature,
|
|
855
|
-
testIndex: context?.testIdx ?? context?.test?.vars?.__testIdx,
|
|
856
|
-
promptLabel: context?.prompt?.label,
|
|
857
|
-
traceparent: context?.traceparent,
|
|
858
|
-
requestBody: prompt
|
|
859
|
-
};
|
|
860
|
-
const resultExtractor = (response) => {
|
|
861
|
-
const result = {};
|
|
862
|
-
if (response.tokenUsage) result.tokenUsage = {
|
|
863
|
-
prompt: response.tokenUsage.prompt,
|
|
864
|
-
completion: response.tokenUsage.completion,
|
|
865
|
-
total: response.tokenUsage.total,
|
|
866
|
-
cached: response.tokenUsage.cached,
|
|
867
|
-
completionDetails: response.tokenUsage.completionDetails
|
|
868
|
-
};
|
|
869
|
-
if (response.finishReason) result.finishReasons = [response.finishReason];
|
|
870
|
-
if (response.cached !== void 0) result.cacheHit = response.cached;
|
|
871
|
-
if (response.output !== void 0) result.responseBody = typeof response.output === "string" ? response.output : JSON.stringify(response.output);
|
|
872
|
-
return result;
|
|
873
|
-
};
|
|
874
|
-
return withGenAISpan(spanContext, () => this.callApiInternal(prompt, context, options), resultExtractor);
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Reconcile a requested thinking config with what the target model actually accepts, and
|
|
878
|
-
* report whether the request will end up thinking.
|
|
879
|
-
*
|
|
880
|
-
* Three model-level rules apply, each verified against the live API:
|
|
881
|
-
* - Manual budget thinking (`type: 'enabled'`) is rejected on adaptive-only models and is
|
|
882
|
-
* converted to `type: 'adaptive'`.
|
|
883
|
-
* - `type: 'disabled'` is rejected outright on always-on models, and on
|
|
884
|
-
* Opus 5 when `effort` is `xhigh`/`max`. In both cases it is dropped rather than sent.
|
|
885
|
-
* - On Opus 5 and Sonnet 5 an *omitted* thinking config still runs adaptive thinking, so it
|
|
886
|
-
* consumes output tokens — callers size the default `max_tokens` off this, and treating it
|
|
887
|
-
* as disabled truncates responses mid-answer.
|
|
888
|
-
*
|
|
889
|
-
* Warnings are emitted at most once per provider instance.
|
|
890
|
-
*/
|
|
891
|
-
resolveModelThinking(requested, effort, flags) {
|
|
892
|
-
const { samplingParamsDeprecated, alwaysOnAdaptiveThinking, modelWarningName } = flags;
|
|
893
|
-
if ((samplingParamsDeprecated || alwaysOnAdaptiveThinking) && requested?.type === "enabled") {
|
|
894
|
-
if (!this.manualThinkingConversionWarned) {
|
|
895
|
-
logger.warn(alwaysOnAdaptiveThinking ? `Adaptive thinking is always on for ${modelWarningName}. Manual thinking budgets have been removed; use effort to control reasoning depth.` : `Manual extended thinking (thinking.type "enabled") is not supported on ${modelWarningName} and has been converted to adaptive thinking. Use thinking: { type: "adaptive" } with effort to control reasoning depth.`);
|
|
896
|
-
this.manualThinkingConversionWarned = true;
|
|
897
|
-
}
|
|
898
|
-
} else if (requested?.type === "disabled" && !this.disabledThinkingRemovalWarned) {
|
|
899
|
-
const betweenTools = isBetweenToolsLowestThinkingClaudeModel(this.modelName);
|
|
900
|
-
if (alwaysOnAdaptiveThinking) {
|
|
901
|
-
logger.warn(`Adaptive thinking is always on for ${modelWarningName}. thinking.type "disabled" has been omitted.`);
|
|
902
|
-
this.disabledThinkingRemovalWarned = true;
|
|
903
|
-
} else if (isDisabledThinkingRejectedAtEffort(this.modelName, effort)) {
|
|
904
|
-
logger.warn(`${modelWarningName} only accepts thinking.type "${betweenTools ? "between_tools" : "disabled"}" at effort "high" or below (got "${effort}"), so thinking.type "disabled" has been omitted. Lower effort to "high" if you need thinking off.`);
|
|
905
|
-
this.disabledThinkingRemovalWarned = true;
|
|
906
|
-
} else if (betweenTools) {
|
|
907
|
-
logger.warn(`${modelWarningName} does not accept thinking.type "disabled", so it has been sent as "between_tools", the model's lowest setting, which turns off up-front thinking. Set thinking.type "between_tools" to silence this warning.`);
|
|
908
|
-
this.disabledThinkingRemovalWarned = true;
|
|
909
|
-
}
|
|
910
|
-
} else if (requested?.type === "between_tools" && !this.disabledThinkingRemovalWarned && isBetweenToolsLowestThinkingClaudeModel(this.modelName) && isDisabledThinkingRejectedAtEffort(this.modelName, effort)) {
|
|
911
|
-
logger.warn(`${modelWarningName} only accepts thinking.type "between_tools" at effort "high" or below (got "${effort}"), so it has been omitted and the model thinks adaptively. Lower effort to "high" to turn off up-front thinking.`);
|
|
912
|
-
this.disabledThinkingRemovalWarned = true;
|
|
913
|
-
}
|
|
914
|
-
const resolved = normalizeClaudeThinkingConfig(this.modelName, requested, effort, { allowGenerationFallback: samplingParamsDeprecated });
|
|
915
|
-
return {
|
|
916
|
-
thinking: resolved,
|
|
917
|
-
thinkingEnabled: alwaysOnAdaptiveThinking || isClaudeThinkingEnabled(resolved),
|
|
918
|
-
thinkingConsumesTokens: claudeThinkingConsumesTokens(this.modelName, resolved)
|
|
919
|
-
};
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* Build the ProviderResponse for a completed Anthropic message.
|
|
923
|
-
*
|
|
924
|
-
* Shared by the cache-hit and fresh-call paths, which are otherwise identical. `cached`
|
|
925
|
-
* drives the only three differences: token usage is attributed to the cache, the refusal
|
|
926
|
-
* warning is suppressed (it was already logged when the response was first fetched), and
|
|
927
|
-
* the `cached` marker is set. Keeping one builder is what stops the two paths drifting —
|
|
928
|
-
* they have diverged before, which is why the cached-refusal regression test exists.
|
|
929
|
-
*/
|
|
930
|
-
buildMessageResponse(message, config, processedOutputFormat, cached) {
|
|
931
|
-
const finishReason = normalizeFinishReason(message.stop_reason);
|
|
932
|
-
let output = outputFromMessage(message, config.showThinking ?? true);
|
|
933
|
-
const isStructuredOutput = processedOutputFormat?.type === "json_schema";
|
|
934
|
-
const fileReferences = message.fileReferences ?? message.content.flatMap(getFileReferences);
|
|
935
|
-
if (isStructuredOutput) {
|
|
936
|
-
const text = message.stop_reason === "pause_turn" || message.content.some((block) => block.type === "tool_use") ? "" : message.finalText ?? message.content.filter((block) => block.type === "text").map((block) => block.text).join("");
|
|
937
|
-
try {
|
|
938
|
-
output = JSON.parse(text || output);
|
|
939
|
-
} catch (error) {
|
|
940
|
-
logger.error(`Failed to parse JSON output from structured outputs: ${error}`);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
const refusalDetails = getRefusalDetails(message);
|
|
944
|
-
if (refusalDetails && !cached) logger.warn(refusalDetails);
|
|
945
|
-
return {
|
|
946
|
-
output,
|
|
947
|
-
...fileReferences.length > 0 && { metadata: { fileReferences } },
|
|
948
|
-
tokenUsage: getTokenUsage(message, cached),
|
|
949
|
-
...finishReason && { finishReason },
|
|
950
|
-
...refusalDetails && { guardrails: {
|
|
951
|
-
flagged: true,
|
|
952
|
-
reason: refusalDetails
|
|
953
|
-
} },
|
|
954
|
-
cost: this.calculateMessageCosts(config, message.billedCalls ?? [message]),
|
|
955
|
-
...cached && { cached: true }
|
|
956
|
-
};
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Internal implementation of callApi without tracing wrapper.
|
|
960
|
-
*/
|
|
961
|
-
async callApiInternal(prompt, context, options) {
|
|
962
|
-
const config = {
|
|
963
|
-
...this.config,
|
|
964
|
-
...context?.prompt?.config
|
|
965
|
-
};
|
|
966
|
-
const { system, extractedMessages, thinking } = parseMessages(prompt);
|
|
967
|
-
let mcpTools = [];
|
|
968
|
-
if (this.mcpClient) mcpTools = transformMCPToolsToAnthropic(this.mcpClient.getAllTools());
|
|
969
|
-
const loadedTools = await maybeLoadToolsFromExternalFile(config.tools, context?.vars) || [];
|
|
970
|
-
const configTools = transformTools(loadedTools, "anthropic");
|
|
971
|
-
const { processedTools: processedConfigTools, requiredBetaFeatures } = processAnthropicTools(configTools);
|
|
972
|
-
const allTools = [...mcpTools, ...processedConfigTools];
|
|
973
|
-
const processedOutputFormat = maybeLoadResponseFormatFromExternalFile(config.output_format, context?.vars);
|
|
974
|
-
const samplingParamsDeprecated = isSamplingParamsDeprecatedClaudeModel(this.modelName, { allowGenerationFallback: this.allowsClaudeGenerationFallback() });
|
|
975
|
-
const alwaysOnAdaptiveThinking = isAlwaysOnAdaptiveThinkingClaudeModel(this.modelName);
|
|
976
|
-
const modelWarningName = getClaudeModelWarningName(this.modelName) ?? "this Claude model";
|
|
977
|
-
const { thinking: resolvedThinking, thinkingEnabled, thinkingConsumesTokens } = this.resolveModelThinking(config.thinking ?? thinking, config.effort, {
|
|
978
|
-
samplingParamsDeprecated,
|
|
979
|
-
alwaysOnAdaptiveThinking,
|
|
980
|
-
modelWarningName
|
|
981
|
-
});
|
|
982
|
-
const modelRejectsForcedToolChoice = isForcedToolChoiceUnsupportedClaudeModel(this.modelName);
|
|
983
|
-
const forcedToolChoiceRejected = resolvedThinking?.type === "enabled" || modelRejectsForcedToolChoice;
|
|
984
|
-
let resolvedToolChoice;
|
|
985
|
-
if (config.tool_choice) {
|
|
986
|
-
const transformed = transformToolChoice(config.tool_choice, "anthropic");
|
|
987
|
-
if (forcedToolChoiceRejected && (transformed.type === "any" || transformed.type === "tool")) logger.warn(modelRejectsForcedToolChoice ? `tool_choice type '${transformed.type}' (forced tool use) is not supported on ${modelWarningName} and will be omitted. Use 'auto' or 'none' instead.` : `tool_choice type '${transformed.type}' (forced tool use) is incompatible with extended thinking and will be omitted. Use 'auto' or remove tool_choice.`);
|
|
988
|
-
else resolvedToolChoice = transformed;
|
|
989
|
-
}
|
|
990
|
-
const envTemperature = parseEnvFloat(this.env?.ANTHROPIC_TEMPERATURE ?? getEnvString("ANTHROPIC_TEMPERATURE"));
|
|
991
|
-
const { sampling, warnings: samplingWarnings } = resolveClaudeSamplingParams(config, {
|
|
992
|
-
thinkingEnabled,
|
|
993
|
-
samplingParamsDeprecated,
|
|
994
|
-
defaultTemperature: envTemperature ?? 0
|
|
995
|
-
});
|
|
996
|
-
for (const warning of samplingWarnings) logger.warn(warning);
|
|
997
|
-
const explicitSamplingParam = config.temperature != null || config.top_p != null || config.top_k != null || envTemperature != null;
|
|
998
|
-
if (samplingParamsDeprecated && explicitSamplingParam && !this.samplingParamsDeprecationWarned) {
|
|
999
|
-
logger.warn(alwaysOnAdaptiveThinking ? `temperature, top_p, and top_k are not supported on ${modelWarningName} and will be omitted. Remove these sampling parameters from your config (or unset ANTHROPIC_TEMPERATURE) to silence this warning.` : `temperature is deprecated on ${modelWarningName} and will be omitted (along with top_p and top_k). Remove these sampling parameters from your config (or unset ANTHROPIC_TEMPERATURE) to silence this warning.`);
|
|
1000
|
-
this.samplingParamsDeprecationWarned = true;
|
|
1001
|
-
}
|
|
1002
|
-
const resolvedSystem = this.usingClaudeCodeOAuth ? [{
|
|
1003
|
-
type: "text",
|
|
1004
|
-
text: CLAUDE_CODE_IDENTITY_PROMPT
|
|
1005
|
-
}, ...system ?? []] : system;
|
|
1006
|
-
const shouldStream = config.stream ?? false;
|
|
1007
|
-
const params = {
|
|
1008
|
-
model: this.modelName,
|
|
1009
|
-
...resolvedSystem && resolvedSystem.length > 0 ? { system: resolvedSystem } : {},
|
|
1010
|
-
max_tokens: clampMaxTokensForThinkingBudget(config.max_tokens ?? getEnvInt("ANTHROPIC_MAX_TOKENS", thinkingConsumesTokens ? 2048 : 1024), resolvedThinking),
|
|
1011
|
-
messages: extractedMessages,
|
|
1012
|
-
stream: shouldStream,
|
|
1013
|
-
...sampling,
|
|
1014
|
-
...config.cache_control ? { cache_control: config.cache_control } : {},
|
|
1015
|
-
...config.service_tier ? { service_tier: config.service_tier } : {},
|
|
1016
|
-
...config.stop_sequences?.length ? { stop_sequences: config.stop_sequences } : {},
|
|
1017
|
-
...config.metadata ? { metadata: config.metadata } : {},
|
|
1018
|
-
...allTools.length > 0 ? { tools: allTools } : {},
|
|
1019
|
-
...resolvedToolChoice ? { tool_choice: resolvedToolChoice } : {},
|
|
1020
|
-
...resolvedThinking ? { thinking: resolvedThinking } : {},
|
|
1021
|
-
...processedOutputFormat || config.effort ? { output_config: {
|
|
1022
|
-
...processedOutputFormat ? { format: processedOutputFormat } : {},
|
|
1023
|
-
...config.effort ? { effort: config.effort } : {}
|
|
1024
|
-
} } : {},
|
|
1025
|
-
...typeof config?.extra_body === "object" && config.extra_body ? config.extra_body : {}
|
|
1026
|
-
};
|
|
1027
|
-
logger.debug("Calling Anthropic Messages API", { params: getMessagesRequestMetadata(params) });
|
|
1028
|
-
const headers = this.sanitizeRequestHeaders({ ...config.headers || {} });
|
|
1029
|
-
let allBetaFeatures = [...config.beta || [], ...requiredBetaFeatures];
|
|
1030
|
-
const userBetaHeader = config.headers?.["anthropic-beta"];
|
|
1031
|
-
if (typeof userBetaHeader === "string" && userBetaHeader.length > 0) allBetaFeatures.push(...userBetaHeader.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0));
|
|
1032
|
-
if (processedOutputFormat && !allBetaFeatures.includes("structured-outputs-2025-11-13")) allBetaFeatures.push("structured-outputs-2025-11-13");
|
|
1033
|
-
if (this.usingClaudeCodeOAuth) allBetaFeatures.push(...CLAUDE_CODE_OAUTH_BETA_FEATURES);
|
|
1034
|
-
allBetaFeatures = [...new Set(allBetaFeatures)];
|
|
1035
|
-
if (allBetaFeatures.length > 0) headers["anthropic-beta"] = allBetaFeatures.join(",");
|
|
1036
|
-
if (this.usingClaudeCodeOAuth) {
|
|
1037
|
-
headers["user-agent"] = CLAUDE_CODE_USER_AGENT;
|
|
1038
|
-
headers["x-app"] = "cli";
|
|
1039
|
-
}
|
|
1040
|
-
const shouldUseResponseCache = isCacheEnabled() && config.mcp?.enabled !== true && this.shouldCacheResponses() && !this.hasCustomHeaders() && Object.keys(config.headers ?? {}).length === 0;
|
|
1041
|
-
const cache = shouldUseResponseCache ? await getCache() : void 0;
|
|
1042
|
-
const { metadata: _metadata, ...cacheKeyParams } = params;
|
|
1043
|
-
const cacheKeyHeaders = normalizeHeadersForCacheKey(headers);
|
|
1044
|
-
const cacheKey = shouldUseResponseCache ? `anthropic:messages:${this.modelName}:${this.getCacheIdentityHash()}:${this.getCacheNamespace()}:${hashAnthropicCacheValue({
|
|
1045
|
-
...cacheKeyParams,
|
|
1046
|
-
...cacheKeyHeaders ? { headers: cacheKeyHeaders } : {}
|
|
1047
|
-
})}` : void 0;
|
|
1048
|
-
const ephemeralCacheKey = cacheKey ? getScopedCacheKey(cacheKey) : void 0;
|
|
1049
|
-
const cacheClearGeneration = getCacheClearGeneration();
|
|
1050
|
-
if (cache && cacheKey && ephemeralCacheKey) {
|
|
1051
|
-
const cachedResponse = await this.getCachedResponse(cache, cacheKey, ephemeralCacheKey, cacheClearGeneration);
|
|
1052
|
-
if (cachedResponse) try {
|
|
1053
|
-
const cachedMessage = JSON.parse(cachedResponse);
|
|
1054
|
-
if (cachedMessage.stop_reason !== "pause_turn") {
|
|
1055
|
-
logger.debug("Returning cached Anthropic Messages response", { model: this.modelName });
|
|
1056
|
-
return this.buildMessageResponse(cachedMessage, config, processedOutputFormat, true);
|
|
1057
|
-
}
|
|
1058
|
-
} catch {
|
|
1059
|
-
return {
|
|
1060
|
-
output: cachedResponse,
|
|
1061
|
-
cached: true,
|
|
1062
|
-
tokenUsage: createEmptyTokenUsage()
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
const responses = [];
|
|
1067
|
-
try {
|
|
1068
|
-
const signal = options?.abortSignal;
|
|
1069
|
-
const initialMessage = await this.sendMessage(params, headers, shouldStream, responses, signal);
|
|
1070
|
-
signal?.throwIfAborted();
|
|
1071
|
-
const { error, response: resolvedMessage, toolCalls } = await this.resolveMcpToolUse({
|
|
1072
|
-
config,
|
|
1073
|
-
headers,
|
|
1074
|
-
initialResponse: initialMessage,
|
|
1075
|
-
params,
|
|
1076
|
-
responses,
|
|
1077
|
-
shouldStream,
|
|
1078
|
-
signal
|
|
1079
|
-
});
|
|
1080
|
-
const cost = this.calculateMessageCosts(config, responses);
|
|
1081
|
-
const mcpMetadata = toolCalls.length > 0 ? { toolCalls } : void 0;
|
|
1082
|
-
if (error) return {
|
|
1083
|
-
error,
|
|
1084
|
-
tokenUsage: getTokenUsage(resolvedMessage, false),
|
|
1085
|
-
cost,
|
|
1086
|
-
...mcpMetadata ? { metadata: mcpMetadata } : {}
|
|
1087
|
-
};
|
|
1088
|
-
const message = toCachedMessage(resolvedMessage, responses);
|
|
1089
|
-
if (cache && cacheKey && ephemeralCacheKey && message.stop_reason !== "pause_turn") try {
|
|
1090
|
-
await this.setCachedResponse(cache, cacheKey, ephemeralCacheKey, cacheClearGeneration, getCacheTtlMs(), JSON.stringify(message));
|
|
1091
|
-
} catch (err) {
|
|
1092
|
-
logger.error(`Failed to cache response: ${String(err)}`);
|
|
1093
|
-
}
|
|
1094
|
-
const outputMessage = isClaudeSonnet55Model(this.modelName) ? {
|
|
1095
|
-
...message,
|
|
1096
|
-
content: [...responses.slice(0, -1).flatMap((turn) => turn.content.filter((block) => block.type === "thinking" && !message.content.includes(block))), ...message.content]
|
|
1097
|
-
} : message;
|
|
1098
|
-
const response = this.buildMessageResponse(outputMessage, config, processedOutputFormat, false);
|
|
1099
|
-
return mcpMetadata ? {
|
|
1100
|
-
...response,
|
|
1101
|
-
metadata: {
|
|
1102
|
-
...response.metadata,
|
|
1103
|
-
...mcpMetadata
|
|
1104
|
-
}
|
|
1105
|
-
} : response;
|
|
1106
|
-
} catch (err) {
|
|
1107
|
-
logger.error(`Anthropic Messages API call error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1108
|
-
let error = `API call error: ${err instanceof Error ? err.message : String(err)}`;
|
|
1109
|
-
if (err instanceof APIError && err.error) {
|
|
1110
|
-
const errorDetails = err.error;
|
|
1111
|
-
error = `API call error: ${errorDetails.error.message}, status ${err.status}, type ${errorDetails.error.type}`;
|
|
1112
|
-
}
|
|
1113
|
-
const lastResponse = responses[responses.length - 1];
|
|
1114
|
-
return {
|
|
1115
|
-
error,
|
|
1116
|
-
...lastResponse ? {
|
|
1117
|
-
tokenUsage: getTokenUsage(withMergedAnthropicUsage(lastResponse, responses), false),
|
|
1118
|
-
cost: this.calculateMessageCosts(config, responses)
|
|
1119
|
-
} : {}
|
|
1120
|
-
};
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
};
|
|
1124
|
-
//#endregion
|
|
1125
|
-
export { hashAnthropicCacheValue as a, getAnthropicEnvHeaderSuppressions as i, AnthropicGenericProvider as n, buildIsolatedAnthropicClientOptions as r, AnthropicMessagesProvider as t };
|
|
1126
|
-
|
|
1127
|
-
//# sourceMappingURL=messages-BE_eZ7NA.js.map
|