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,1588 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
-
const require_logger = require("./logger-DXUHJBHJ.cjs");
|
|
3
|
-
const require_fetch = require("./fetch-DYte6oQX.cjs");
|
|
4
|
-
const require_esm = require("./esm-DITT-qdS.cjs");
|
|
5
|
-
const require_render = require("./render-j-UNQw7s.cjs");
|
|
6
|
-
const require_packageVersion = require("./packageVersion-CJ4hVGlE.cjs");
|
|
7
|
-
const require_credentials = require("./credentials-CFfK32uY.cjs");
|
|
8
|
-
const require_providerRegistry = require("./providerRegistry-CAn7vpBJ.cjs");
|
|
9
|
-
const require_resourceAttributes = require("./resourceAttributes-DLxFq_6t.cjs");
|
|
10
|
-
const require_genaiTracer = require("./genaiTracer-C32xFIB8.cjs");
|
|
11
|
-
const require_agentic_utils = require("./agentic-utils-D23qtOlx.cjs");
|
|
12
|
-
const require_agenticRunQueue = require("./agenticRunQueue-Cd8lOVSn.cjs");
|
|
13
|
-
const require_agentWorkspace = require("./agentWorkspace-B8A_wuMR.cjs");
|
|
14
|
-
const require_billing = require("./billing-ZA1NkqAK.cjs");
|
|
15
|
-
require("./codex-runtime-Cd55T6a8.cjs");
|
|
16
|
-
const require_codexSkillMetadata = require("./codexSkillMetadata-B5SLnY2i.cjs");
|
|
17
|
-
let zod = require("zod");
|
|
18
|
-
let path = require("path");
|
|
19
|
-
path = require_rolldown_runtime.__toESM(path, 1);
|
|
20
|
-
let node_fs = require("node:fs");
|
|
21
|
-
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
22
|
-
let node_path = require("node:path");
|
|
23
|
-
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
24
|
-
let fs = require("fs");
|
|
25
|
-
fs = require_rolldown_runtime.__toESM(fs, 1);
|
|
26
|
-
let dedent = require("dedent");
|
|
27
|
-
dedent = require_rolldown_runtime.__toESM(dedent, 1);
|
|
28
|
-
let _opentelemetry_api = require("@opentelemetry/api");
|
|
29
|
-
let semver_functions_satisfies_js = require("semver/functions/satisfies.js");
|
|
30
|
-
semver_functions_satisfies_js = require_rolldown_runtime.__toESM(semver_functions_satisfies_js, 1);
|
|
31
|
-
let crypto = require("crypto");
|
|
32
|
-
crypto = require_rolldown_runtime.__toESM(crypto, 1);
|
|
33
|
-
let node_child_process = require("node:child_process");
|
|
34
|
-
let semver = require("semver");
|
|
35
|
-
semver = require_rolldown_runtime.__toESM(semver, 1);
|
|
36
|
-
//#region src/providers/openai/codexCliCompatibility.ts
|
|
37
|
-
const CODEX_SDK_PACKAGE = "@openai/codex-sdk";
|
|
38
|
-
const CODEX_CLI_PACKAGE = "@openai/codex";
|
|
39
|
-
const CODEX_SDK_DOCS_URL = "https://www.promptfoo.dev/docs/providers/openai-codex-sdk/";
|
|
40
|
-
const CODEX_VERSION_PATTERN = /\bcodex-cli(?:-exec)?\s+v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)/;
|
|
41
|
-
const VERSION_PROBE_TIMEOUT_MS = 1e4;
|
|
42
|
-
const VERSION_PROBE_MAX_OUTPUT_BYTES = 1048576;
|
|
43
|
-
const VERSION_PROBE_MAX_STATUS_BYTES = 8192;
|
|
44
|
-
const VERSION_PROBE_SUPERVISOR = `
|
|
45
|
-
const { writeSync } = require('node:fs');
|
|
46
|
-
let child;
|
|
47
|
-
let stopping = false;
|
|
48
|
-
let finalized = false;
|
|
49
|
-
let commandExit;
|
|
50
|
-
const finalize = (result) => {
|
|
51
|
-
if (finalized) return;
|
|
52
|
-
finalized = true;
|
|
53
|
-
try {
|
|
54
|
-
writeSync(3, JSON.stringify(result));
|
|
55
|
-
} catch {
|
|
56
|
-
// The owning process may already have closed its end of the status pipe.
|
|
57
|
-
} finally {
|
|
58
|
-
process.kill(-process.pid, 'SIGKILL');
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const finish = (result) => {
|
|
62
|
-
if (stopping) return;
|
|
63
|
-
stopping = true;
|
|
64
|
-
if (!child || child.pid === undefined || commandExit) return finalize(result);
|
|
65
|
-
|
|
66
|
-
// Keep the direct CLI's reaper alive until its exit has been collected. Do
|
|
67
|
-
// not wait for close: descendants can retain its output pipes until group cleanup.
|
|
68
|
-
child.once('exit', () => finalize(result));
|
|
69
|
-
const terminationFailed = (error) => {
|
|
70
|
-
if (error.code === 'ESRCH') return; // Its exit notification may still be pending.
|
|
71
|
-
finalize({ error: (result.error ?? 'Could not finish Codex CLI version command') +
|
|
72
|
-
'; could not terminate the direct CLI process' });
|
|
73
|
-
};
|
|
74
|
-
child.on('error', terminationFailed);
|
|
75
|
-
try {
|
|
76
|
-
child.kill('SIGKILL');
|
|
77
|
-
} catch (error) {
|
|
78
|
-
terminationFailed(error);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const timeout = () => finish(commandExit ?? { error: 'Codex CLI version check timed out after ${VERSION_PROBE_TIMEOUT_MS}ms' });
|
|
82
|
-
process.once('SIGTERM', timeout);
|
|
83
|
-
process.stdin.once('end', () => finish({ error: 'Codex CLI version check owner disconnected' }));
|
|
84
|
-
process.stdin.once('error', () => finish({ error: 'Codex CLI version check owner channel failed' }));
|
|
85
|
-
const outputFailed = () => finish({ error: 'Could not capture Codex CLI version output' });
|
|
86
|
-
process.stdout.once('error', outputFailed);
|
|
87
|
-
process.stderr.once('error', outputFailed);
|
|
88
|
-
const { spawn } = require('node:child_process');
|
|
89
|
-
const { createInterface } = require('node:readline');
|
|
90
|
-
let deadline = setTimeout(timeout, ${VERSION_PROBE_TIMEOUT_MS});
|
|
91
|
-
createInterface({ input: process.stdin }).once('line', (line) => {
|
|
92
|
-
if (stopping) return;
|
|
93
|
-
let options;
|
|
94
|
-
try {
|
|
95
|
-
options = JSON.parse(line);
|
|
96
|
-
} catch {
|
|
97
|
-
return finish({ error: 'Codex CLI version check initialization failed' });
|
|
98
|
-
}
|
|
99
|
-
// process.ppid is a startup snapshot, so check the known owner as well as EOF.
|
|
100
|
-
try {
|
|
101
|
-
process.kill(options.ownerPid, 0);
|
|
102
|
-
} catch {
|
|
103
|
-
return finish({ error: 'Codex CLI version check owner exited before initialization' });
|
|
104
|
-
}
|
|
105
|
-
if (Date.now() >= options.deadlineAt) return timeout();
|
|
106
|
-
clearTimeout(deadline);
|
|
107
|
-
deadline = setTimeout(timeout, options.deadlineAt - Date.now());
|
|
108
|
-
try {
|
|
109
|
-
const { NODE_CHANNEL_FD, NODE_CHANNEL_SERIALIZATION_MODE, ...env } = options.env;
|
|
110
|
-
child = spawn(options.command, ['exec', '--experimental-json', '--version'], {
|
|
111
|
-
env,
|
|
112
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
113
|
-
});
|
|
114
|
-
child.stdout.once('error', outputFailed);
|
|
115
|
-
child.stderr.once('error', outputFailed);
|
|
116
|
-
child.stdout.pipe(process.stdout, { end: false });
|
|
117
|
-
child.stderr.pipe(process.stderr, { end: false });
|
|
118
|
-
child.once('error', () => finish({ error: 'Could not start Codex CLI version command' }));
|
|
119
|
-
child.once('exit', (code, signal) => { commandExit = { code, signal }; });
|
|
120
|
-
child.once('close', (code, signal) => {
|
|
121
|
-
// Descendants can finish writing after the launcher exits. Drain both
|
|
122
|
-
// capture pipes and forwarding queues before ending the owned group.
|
|
123
|
-
const result = commandExit ?? { code, signal };
|
|
124
|
-
let pending = 2;
|
|
125
|
-
const flushed = (error) => {
|
|
126
|
-
if (error) outputFailed();
|
|
127
|
-
else if (--pending === 0) finish(result);
|
|
128
|
-
};
|
|
129
|
-
try {
|
|
130
|
-
process.stdout.write('', flushed);
|
|
131
|
-
process.stderr.write('', flushed);
|
|
132
|
-
} catch {
|
|
133
|
-
outputFailed();
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
} catch {
|
|
137
|
-
// Spawn/JSON diagnostics can include environment values. Keep these private.
|
|
138
|
-
finish({ error: 'Could not start Codex CLI version command' });
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
`;
|
|
142
|
-
var CodexCliCompatibilityError = class extends Error {
|
|
143
|
-
name = "CodexCliCompatibilityError";
|
|
144
|
-
};
|
|
145
|
-
function getSupportedCliVersion(sdkEntryPoint) {
|
|
146
|
-
let directory = node_path.default.dirname(sdkEntryPoint);
|
|
147
|
-
while (true) {
|
|
148
|
-
const manifestPath = node_path.default.join(directory, "package.json");
|
|
149
|
-
if (node_fs.default.existsSync(manifestPath)) {
|
|
150
|
-
const manifest = JSON.parse(node_fs.default.readFileSync(manifestPath, "utf8"));
|
|
151
|
-
if (manifest.name === CODEX_SDK_PACKAGE) {
|
|
152
|
-
const version = manifest.dependencies?.[CODEX_CLI_PACKAGE];
|
|
153
|
-
if (!version || !semver.default.valid(version)) throw new Error(`${CODEX_SDK_PACKAGE} does not declare an exact ${CODEX_CLI_PACKAGE} version`);
|
|
154
|
-
return version;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const parent = node_path.default.dirname(directory);
|
|
158
|
-
if (parent === directory) throw new Error(`Could not find ${CODEX_SDK_PACKAGE}/package.json for ${sdkEntryPoint}`);
|
|
159
|
-
directory = parent;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
/** Stop the trusted supervisor, or the direct Windows CLI process tree. */
|
|
163
|
-
async function terminateProbe(child) {
|
|
164
|
-
if (process.platform !== "win32") {
|
|
165
|
-
child.stdin?.end();
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const pid = child.pid;
|
|
169
|
-
if (pid === void 0) return;
|
|
170
|
-
if (child.exitCode !== null || child.signalCode !== null) return;
|
|
171
|
-
const hostWindowsDir = process.env.SystemRoot;
|
|
172
|
-
if (!hostWindowsDir || !/^[a-z]:[\\/]/i.test(hostWindowsDir) || hostWindowsDir.includes("\0")) {
|
|
173
|
-
child.kill("SIGKILL");
|
|
174
|
-
throw new Error("Cannot locate the Windows system directory for Codex version cleanup");
|
|
175
|
-
}
|
|
176
|
-
const windowsDir = node_path.default.win32.normalize(hostWindowsDir);
|
|
177
|
-
const systemDir = node_path.default.win32.join(windowsDir, "System32");
|
|
178
|
-
try {
|
|
179
|
-
await new Promise((resolve, reject) => {
|
|
180
|
-
(0, node_child_process.execFile)(node_path.default.win32.join(systemDir, "taskkill.exe"), [
|
|
181
|
-
"/pid",
|
|
182
|
-
String(pid),
|
|
183
|
-
"/t",
|
|
184
|
-
"/f"
|
|
185
|
-
], {
|
|
186
|
-
windowsHide: true,
|
|
187
|
-
timeout: 1e3,
|
|
188
|
-
killSignal: "SIGKILL",
|
|
189
|
-
cwd: systemDir,
|
|
190
|
-
env: {
|
|
191
|
-
SystemRoot: windowsDir,
|
|
192
|
-
WINDIR: windowsDir,
|
|
193
|
-
PATH: systemDir
|
|
194
|
-
}
|
|
195
|
-
}, (error) => {
|
|
196
|
-
if (error && child.exitCode === null && child.signalCode === null) reject(error);
|
|
197
|
-
else resolve();
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
} catch (error) {
|
|
201
|
-
if (child.exitCode === null && child.signalCode === null) child.kill("SIGKILL");
|
|
202
|
-
throw error;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
function parseProbeStatus(status) {
|
|
206
|
-
const result = JSON.parse(status);
|
|
207
|
-
if (result && typeof result === "object") {
|
|
208
|
-
const keys = Object.keys(result);
|
|
209
|
-
if (keys.length === 1 && "error" in result && typeof result.error === "string" && result.error.length > 0) return { error: result.error };
|
|
210
|
-
if (keys.length === 2 && "code" in result && "signal" in result && (typeof result.code === "number" && Number.isInteger(result.code) && result.code >= 0 && result.code <= 255 && result.signal === null || result.code === null && typeof result.signal === "string" && result.signal.length > 0)) return {
|
|
211
|
-
code: result.code,
|
|
212
|
-
signal: result.signal
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
throw new Error("Invalid Codex CLI version check status");
|
|
216
|
-
}
|
|
217
|
-
function runVersionProbe(options) {
|
|
218
|
-
options.signal?.throwIfAborted();
|
|
219
|
-
return new Promise((resolve, reject) => {
|
|
220
|
-
const deadlineAt = Date.now() + VERSION_PROBE_TIMEOUT_MS;
|
|
221
|
-
const supervised = process.platform !== "win32";
|
|
222
|
-
let initialization;
|
|
223
|
-
if (supervised) try {
|
|
224
|
-
initialization = `${JSON.stringify({
|
|
225
|
-
command: options.codexPathOverride,
|
|
226
|
-
env: options.env,
|
|
227
|
-
ownerPid: process.pid,
|
|
228
|
-
deadlineAt
|
|
229
|
-
})}\n`;
|
|
230
|
-
} catch {
|
|
231
|
-
throw new Error("Codex CLI version check initialization failed");
|
|
232
|
-
}
|
|
233
|
-
const child = supervised ? (0, node_child_process.spawn)(process.execPath, [
|
|
234
|
-
"--input-type=commonjs",
|
|
235
|
-
"--eval",
|
|
236
|
-
VERSION_PROBE_SUPERVISOR
|
|
237
|
-
], {
|
|
238
|
-
env: {},
|
|
239
|
-
detached: true,
|
|
240
|
-
stdio: [
|
|
241
|
-
"pipe",
|
|
242
|
-
"pipe",
|
|
243
|
-
"pipe",
|
|
244
|
-
"pipe"
|
|
245
|
-
]
|
|
246
|
-
}) : (0, node_child_process.spawn)(options.codexPathOverride, [
|
|
247
|
-
"exec",
|
|
248
|
-
"--experimental-json",
|
|
249
|
-
"--version"
|
|
250
|
-
], {
|
|
251
|
-
env: options.env,
|
|
252
|
-
windowsHide: true,
|
|
253
|
-
stdio: [
|
|
254
|
-
"ignore",
|
|
255
|
-
"pipe",
|
|
256
|
-
"pipe"
|
|
257
|
-
]
|
|
258
|
-
});
|
|
259
|
-
const stdout = [];
|
|
260
|
-
const stderr = [];
|
|
261
|
-
let stdoutBytes = 0;
|
|
262
|
-
let stderrBytes = 0;
|
|
263
|
-
let failure;
|
|
264
|
-
let termination;
|
|
265
|
-
let commandExit;
|
|
266
|
-
let deadlineReached = false;
|
|
267
|
-
const stop = (error) => {
|
|
268
|
-
failure ??= error;
|
|
269
|
-
termination ??= terminateProbe(child).catch((cleanupError) => {
|
|
270
|
-
failure = cleanupError instanceof Error ? cleanupError : new Error(String(cleanupError));
|
|
271
|
-
}).finally(() => {
|
|
272
|
-
child.stdout?.destroy();
|
|
273
|
-
child.stderr?.destroy();
|
|
274
|
-
});
|
|
275
|
-
};
|
|
276
|
-
const timeout = setTimeout(() => {
|
|
277
|
-
if (supervised) {
|
|
278
|
-
deadlineReached = true;
|
|
279
|
-
child.kill("SIGTERM");
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
if (!supervised && commandExit) {
|
|
283
|
-
child.stdout?.destroy();
|
|
284
|
-
child.stderr?.destroy();
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
stop(/* @__PURE__ */ new Error(`Codex CLI version check timed out after ${VERSION_PROBE_TIMEOUT_MS}ms`));
|
|
288
|
-
}, Math.max(0, deadlineAt - Date.now()));
|
|
289
|
-
const onAbort = () => stop(new DOMException("Codex compatibility check aborted", "AbortError"));
|
|
290
|
-
if (!supervised) child.once("exit", (code, signal) => {
|
|
291
|
-
commandExit = {
|
|
292
|
-
code,
|
|
293
|
-
signal
|
|
294
|
-
};
|
|
295
|
-
});
|
|
296
|
-
child.stdout?.on("data", (chunk) => {
|
|
297
|
-
stdoutBytes += chunk.length;
|
|
298
|
-
if (stdoutBytes > VERSION_PROBE_MAX_OUTPUT_BYTES) stop(/* @__PURE__ */ new Error("Codex CLI version stdout exceeded the maximum buffer length"));
|
|
299
|
-
else if (!failure) stdout.push(chunk);
|
|
300
|
-
});
|
|
301
|
-
child.stderr?.on("data", (chunk) => {
|
|
302
|
-
stderrBytes += chunk.length;
|
|
303
|
-
if (stderrBytes > VERSION_PROBE_MAX_OUTPUT_BYTES) stop(/* @__PURE__ */ new Error("Codex CLI version stderr exceeded the maximum buffer length"));
|
|
304
|
-
else if (!failure) stderr.push(chunk);
|
|
305
|
-
});
|
|
306
|
-
child.once("error", stop);
|
|
307
|
-
child.stdin?.on("error", () => stop(/* @__PURE__ */ new Error("Codex CLI version check owner channel failed")));
|
|
308
|
-
if (supervised) {
|
|
309
|
-
const statusPipe = child.stdio[3];
|
|
310
|
-
const status = [];
|
|
311
|
-
let statusBytes = 0;
|
|
312
|
-
let statusRead = false;
|
|
313
|
-
const invalidStatus = () => {
|
|
314
|
-
if (statusRead) return;
|
|
315
|
-
statusRead = true;
|
|
316
|
-
failure ??= /* @__PURE__ */ new Error(deadlineReached ? `Codex CLI version check timed out after ${VERSION_PROBE_TIMEOUT_MS}ms` : "Codex CLI version supervisor exited without a valid command status");
|
|
317
|
-
termination = Promise.resolve().then(() => {
|
|
318
|
-
if (child.pid !== void 0) try {
|
|
319
|
-
process.kill(-child.pid, "SIGKILL");
|
|
320
|
-
} catch (error) {
|
|
321
|
-
if (error.code !== "ESRCH") throw error;
|
|
322
|
-
}
|
|
323
|
-
}).catch((error) => {
|
|
324
|
-
failure = error instanceof Error ? error : /* @__PURE__ */ new Error("Codex version probe cleanup failed");
|
|
325
|
-
}).finally(() => {
|
|
326
|
-
child.stdout?.destroy();
|
|
327
|
-
child.stderr?.destroy();
|
|
328
|
-
});
|
|
329
|
-
};
|
|
330
|
-
statusPipe?.on("data", (chunk) => {
|
|
331
|
-
statusBytes += chunk.length;
|
|
332
|
-
if (statusBytes > VERSION_PROBE_MAX_STATUS_BYTES) stop(/* @__PURE__ */ new Error("Codex CLI version check status exceeded the maximum buffer length"));
|
|
333
|
-
else status.push(chunk);
|
|
334
|
-
});
|
|
335
|
-
statusPipe?.once("error", invalidStatus);
|
|
336
|
-
statusPipe?.once("end", () => {
|
|
337
|
-
if (statusRead) return;
|
|
338
|
-
try {
|
|
339
|
-
if (statusBytes > VERSION_PROBE_MAX_STATUS_BYTES) throw new Error("Oversized status");
|
|
340
|
-
const result = parseProbeStatus(Buffer.concat(status).toString("utf8"));
|
|
341
|
-
statusRead = true;
|
|
342
|
-
if ("error" in result) failure ??= new Error(result.error);
|
|
343
|
-
else commandExit = result;
|
|
344
|
-
} catch {
|
|
345
|
-
invalidStatus();
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
child.stdin?.write(initialization);
|
|
349
|
-
}
|
|
350
|
-
child.once("close", async (code, signal) => {
|
|
351
|
-
clearTimeout(timeout);
|
|
352
|
-
options.signal?.removeEventListener("abort", onAbort);
|
|
353
|
-
try {
|
|
354
|
-
await (termination ?? (supervised ? void 0 : terminateProbe(child)));
|
|
355
|
-
} catch (error) {
|
|
356
|
-
failure = error instanceof Error ? error : new Error(String(error));
|
|
357
|
-
}
|
|
358
|
-
const exit = commandExit ?? (supervised ? void 0 : {
|
|
359
|
-
code,
|
|
360
|
-
signal
|
|
361
|
-
});
|
|
362
|
-
if (failure) reject(failure);
|
|
363
|
-
else if (exit?.code === 0) resolve(`${Buffer.concat(stdout).toString("utf8")}\n${Buffer.concat(stderr).toString("utf8")}`);
|
|
364
|
-
else reject(/* @__PURE__ */ new Error(`Codex CLI version check exited with ${exit?.signal ?? exit?.code ?? "no command status"}: ${Buffer.concat(stderr).toString("utf8")}`));
|
|
365
|
-
});
|
|
366
|
-
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
367
|
-
if (options.signal?.aborted) onAbort();
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
async function runCompatibilityCheck(options) {
|
|
371
|
-
let supportedVersion;
|
|
372
|
-
try {
|
|
373
|
-
supportedVersion = getSupportedCliVersion(options.sdkEntryPoint);
|
|
374
|
-
} catch (error) {
|
|
375
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
376
|
-
throw new CodexCliCompatibilityError(`Could not verify Codex CLI compatibility for ${options.codexPathOverride}: ${message}. For more information, see: ${CODEX_SDK_DOCS_URL}`);
|
|
377
|
-
}
|
|
378
|
-
let output;
|
|
379
|
-
try {
|
|
380
|
-
output = await runVersionProbe(options);
|
|
381
|
-
} catch (error) {
|
|
382
|
-
if (options.signal?.aborted) throw new DOMException("Codex compatibility check aborted", "AbortError");
|
|
383
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
384
|
-
throw new CodexCliCompatibilityError(`Could not verify Codex CLI compatibility for ${options.codexPathOverride}: ${message}. For more information, see: ${CODEX_SDK_DOCS_URL}`);
|
|
385
|
-
}
|
|
386
|
-
const version = CODEX_VERSION_PATTERN.exec(output)?.[1];
|
|
387
|
-
if (!version || !semver.default.valid(version) || semver.default.compareBuild(version, supportedVersion) !== 0) throw new CodexCliCompatibilityError(`${CODEX_SDK_PACKAGE} supports Codex CLI/event schema ${supportedVersion}, but ${options.codexPathOverride} reports ${version ?? "an unknown version"}. For more information, see: ${CODEX_SDK_DOCS_URL}`);
|
|
388
|
-
}
|
|
389
|
-
function checkCodexCliCompatibility(options) {
|
|
390
|
-
return runCompatibilityCheck(options);
|
|
391
|
-
}
|
|
392
|
-
//#endregion
|
|
393
|
-
//#region src/providers/openai/codex-sdk.ts
|
|
394
|
-
var codex_sdk_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
395
|
-
CODEX_SDK_VERSION_RANGE: () => CODEX_SDK_VERSION_RANGE,
|
|
396
|
-
OpenAICodexSDKProvider: () => OpenAICodexSDKProvider,
|
|
397
|
-
resolveCodexSdkPackage: () => resolveCodexSdkPackage
|
|
398
|
-
});
|
|
399
|
-
function appendPromptfooResourceAttrs(existing, traceId, parentSpanId) {
|
|
400
|
-
const traceKey = require_resourceAttributes.PROMPTFOO_RESOURCE_ATTR_TRACE_ID;
|
|
401
|
-
const parentSpanKey = require_resourceAttributes.PROMPTFOO_RESOURCE_ATTR_PARENT_SPAN_ID;
|
|
402
|
-
const incoming = `${traceKey}=${traceId},${parentSpanKey}=${parentSpanId}`;
|
|
403
|
-
if (!existing) return incoming;
|
|
404
|
-
const cleaned = existing.split(",").map((pair) => pair.trim()).filter((pair) => pair.length > 0 && !pair.startsWith(`${traceKey}=`) && !pair.startsWith(`${parentSpanKey}=`)).join(",");
|
|
405
|
-
return cleaned.length > 0 ? `${cleaned},${incoming}` : incoming;
|
|
406
|
-
}
|
|
407
|
-
const ZERO_TRACE_ID = "00000000000000000000000000000000";
|
|
408
|
-
const ZERO_SPAN_ID = "0000000000000000";
|
|
409
|
-
function isValidTraceparent(traceparent) {
|
|
410
|
-
if (!traceparent) return false;
|
|
411
|
-
const [, traceId, spanId] = traceparent.split("-");
|
|
412
|
-
return Boolean(traceId && spanId && traceId !== ZERO_TRACE_ID && spanId !== ZERO_SPAN_ID);
|
|
413
|
-
}
|
|
414
|
-
const CodexCliEnvValueSchema = zod.z.union([
|
|
415
|
-
zod.z.string(),
|
|
416
|
-
zod.z.number(),
|
|
417
|
-
zod.z.boolean()
|
|
418
|
-
]).transform(String);
|
|
419
|
-
const OpenAICodexSDKConfigShape = {
|
|
420
|
-
basePath: zod.z.string().optional(),
|
|
421
|
-
prefix: zod.z.string().optional(),
|
|
422
|
-
suffix: zod.z.string().optional(),
|
|
423
|
-
provider: zod.z.unknown().optional(),
|
|
424
|
-
linkedTargetId: zod.z.string().optional(),
|
|
425
|
-
apiKey: zod.z.string().min(1).optional(),
|
|
426
|
-
base_url: zod.z.string().min(1).optional(),
|
|
427
|
-
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
428
|
-
working_dir: zod.z.string().min(1).optional(),
|
|
429
|
-
copy_working_dir: zod.z.union([zod.z.boolean(), zod.z.enum(["git", "copy"])]).optional(),
|
|
430
|
-
additional_directories: zod.z.array(zod.z.string().min(1)).optional(),
|
|
431
|
-
skip_git_repo_check: zod.z.boolean().optional(),
|
|
432
|
-
codex_path_override: zod.z.string().min(1).optional(),
|
|
433
|
-
skip_codex_version_check: zod.z.boolean().optional(),
|
|
434
|
-
model: zod.z.string().min(1).optional(),
|
|
435
|
-
model_provider: zod.z.string().min(1).optional(),
|
|
436
|
-
sandbox_mode: zod.z.enum([
|
|
437
|
-
"read-only",
|
|
438
|
-
"workspace-write",
|
|
439
|
-
"danger-full-access"
|
|
440
|
-
]).optional(),
|
|
441
|
-
model_reasoning_effort: zod.z.enum([
|
|
442
|
-
"minimal",
|
|
443
|
-
"low",
|
|
444
|
-
"medium",
|
|
445
|
-
"high",
|
|
446
|
-
"xhigh",
|
|
447
|
-
"max",
|
|
448
|
-
"ultra"
|
|
449
|
-
]).optional(),
|
|
450
|
-
network_access_enabled: zod.z.boolean().optional(),
|
|
451
|
-
web_search_enabled: zod.z.boolean().optional(),
|
|
452
|
-
web_search_mode: zod.z.enum([
|
|
453
|
-
"disabled",
|
|
454
|
-
"cached",
|
|
455
|
-
"live"
|
|
456
|
-
]).optional(),
|
|
457
|
-
collaboration_mode: zod.z.enum(["coding", "plan"]).optional(),
|
|
458
|
-
approval_policy: zod.z.enum([
|
|
459
|
-
"never",
|
|
460
|
-
"on-request",
|
|
461
|
-
"on-failure",
|
|
462
|
-
"untrusted"
|
|
463
|
-
]).optional(),
|
|
464
|
-
thread_id: zod.z.string().min(1).optional(),
|
|
465
|
-
persist_threads: zod.z.boolean().optional(),
|
|
466
|
-
thread_pool_size: zod.z.number().int().positive().optional(),
|
|
467
|
-
output_schema: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
468
|
-
cli_env: zod.z.record(zod.z.string(), CodexCliEnvValueSchema).optional(),
|
|
469
|
-
inherit_process_env: zod.z.boolean().optional(),
|
|
470
|
-
enable_streaming: zod.z.boolean().optional(),
|
|
471
|
-
deep_tracing: zod.z.boolean().optional(),
|
|
472
|
-
cli_config: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
473
|
-
};
|
|
474
|
-
const OpenAICodexSDKConfigSchema = zod.z.object(OpenAICodexSDKConfigShape).strict();
|
|
475
|
-
const OpenAICodexSDKMergedPromptConfigSchema = zod.z.object(OpenAICodexSDKConfigShape).strip();
|
|
476
|
-
function parseCodexConfig(config, options = {}) {
|
|
477
|
-
const schema = options.stripUnknownKeys ? OpenAICodexSDKMergedPromptConfigSchema : OpenAICodexSDKConfigSchema;
|
|
478
|
-
try {
|
|
479
|
-
return schema.parse(config ?? {});
|
|
480
|
-
} catch (error) {
|
|
481
|
-
if (error instanceof zod.z.ZodError) {
|
|
482
|
-
const issues = error.issues.map((issue) => {
|
|
483
|
-
return `${issue.path.length > 0 ? issue.path.join(".") : "(root)"}: ${issue.message}`;
|
|
484
|
-
}).join("; ");
|
|
485
|
-
throw new Error(`Invalid OpenAI Codex SDK config: ${issues}`);
|
|
486
|
-
}
|
|
487
|
-
throw error;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
const CODEX_RATE_LIMIT_CODES = ["rate_limit_exceeded", ...require_fetch.HARD_QUOTA_ERROR_CODES];
|
|
491
|
-
const CODEX_DEFAULT_RATE_LIMIT_WAIT_MS = 6e4;
|
|
492
|
-
const CODEX_RATE_LIMIT_PATTERNS = [
|
|
493
|
-
/\b429\b/,
|
|
494
|
-
/\brate[\s_-]*limit(?:ed|ing| reached| exceeded)?\b/i,
|
|
495
|
-
/\btoo many requests\b/i,
|
|
496
|
-
/\btokens per (?:minute|min)\b/i,
|
|
497
|
-
/\brequests per (?:minute|min)\b/i,
|
|
498
|
-
/\bexceeded your current quota\b/i
|
|
499
|
-
];
|
|
500
|
-
function extractCodexRateLimitCode(message) {
|
|
501
|
-
const lowerMessage = message.toLowerCase();
|
|
502
|
-
const billingCode = CODEX_RATE_LIMIT_CODES.find((code) => require_fetch.isDefinitiveBillingCode(code) && lowerMessage.includes(code));
|
|
503
|
-
if (billingCode) return billingCode;
|
|
504
|
-
if (/\bno credits remaining\b/i.test(message)) return "credit_balance_exhausted";
|
|
505
|
-
const explicitCode = CODEX_RATE_LIMIT_CODES.find((code) => lowerMessage.includes(code));
|
|
506
|
-
if (explicitCode) return explicitCode;
|
|
507
|
-
if (/\bexceeded your current quota\b/i.test(message) || /\bcheck your plan and billing details\b/i.test(message)) return "insufficient_quota";
|
|
508
|
-
}
|
|
509
|
-
function extractCodexRetryAfterMs(message) {
|
|
510
|
-
const match = message.match(/\b(?:please\s+)?(?:try\s+again\s+in|retry(?:\s+again)?\s+(?:after|in))\s+(\d+(?:\.\d+)?)\s*(milliseconds?|ms|seconds?|secs?|s|minutes?|mins?|m)\b/i);
|
|
511
|
-
if (!match) return;
|
|
512
|
-
const amount = Number(match[1]);
|
|
513
|
-
if (!Number.isFinite(amount) || amount < 0) return;
|
|
514
|
-
const unit = match[2].toLowerCase();
|
|
515
|
-
const multiplier = unit.startsWith("m") && unit !== "ms" && !unit.startsWith("milli") ? 6e4 : unit.startsWith("s") ? 1e3 : 1;
|
|
516
|
-
return Math.ceil(amount * multiplier);
|
|
517
|
-
}
|
|
518
|
-
function buildCodexRateLimitResponse(error, message) {
|
|
519
|
-
const errorRecord = typeof error === "object" && error !== null ? error : void 0;
|
|
520
|
-
const status = typeof errorRecord?.status === "number" ? errorRecord.status : typeof errorRecord?.statusCode === "number" ? errorRecord.statusCode : void 0;
|
|
521
|
-
const rawCode = typeof errorRecord?.code === "string" ? errorRecord.code.toLowerCase() : void 0;
|
|
522
|
-
const rawType = typeof errorRecord?.type === "string" ? errorRecord.type.toLowerCase() : void 0;
|
|
523
|
-
const code = rawCode && CODEX_RATE_LIMIT_CODES.some((knownCode) => knownCode === rawCode) ? rawCode : extractCodexRateLimitCode(message);
|
|
524
|
-
if (status !== 429 && code === void 0 && !require_fetch.isHardQuotaCode(rawType) && !CODEX_RATE_LIMIT_PATTERNS.some((pattern) => pattern.test(message))) return;
|
|
525
|
-
const retryAfterMs = extractCodexRetryAfterMs(message);
|
|
526
|
-
const rateLimitError = new require_fetch.HttpRateLimitError({
|
|
527
|
-
status: status ?? 429,
|
|
528
|
-
retryAfterMs,
|
|
529
|
-
code: code ?? rawCode,
|
|
530
|
-
type: rawType
|
|
531
|
-
});
|
|
532
|
-
const schedulerRetryAfterMs = rateLimitError.kind === "rate_limit" ? retryAfterMs ?? CODEX_DEFAULT_RATE_LIMIT_WAIT_MS : void 0;
|
|
533
|
-
const headers = schedulerRetryAfterMs === void 0 ? {} : { "retry-after-ms": String(schedulerRetryAfterMs) };
|
|
534
|
-
return {
|
|
535
|
-
error: require_fetch.formatRateLimitErrorMessage(rateLimitError, message),
|
|
536
|
-
metadata: {
|
|
537
|
-
rateLimitKind: rateLimitError.kind,
|
|
538
|
-
http: {
|
|
539
|
-
status: rateLimitError.status,
|
|
540
|
-
statusText: rateLimitError.statusText,
|
|
541
|
-
headers
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
const CODEX_SDK_VERSION_RANGE = "^0.156.1";
|
|
547
|
-
function resolveCodexSdkPackage() {
|
|
548
|
-
const basePaths = [
|
|
549
|
-
require_logger.state.basePath ? path.default.resolve(require_logger.state.basePath) : void 0,
|
|
550
|
-
process.cwd(),
|
|
551
|
-
path.default.resolve(require_esm.getDirectory(), ".."),
|
|
552
|
-
path.default.resolve(require_esm.getDirectory(), "../..")
|
|
553
|
-
].filter((candidate) => Boolean(candidate));
|
|
554
|
-
for (const basePath of new Set(basePaths)) {
|
|
555
|
-
const entryPoint = require_esm.resolvePackageEntryPoint("@openai/codex-sdk", basePath);
|
|
556
|
-
if (entryPoint) return entryPoint;
|
|
557
|
-
}
|
|
558
|
-
return null;
|
|
559
|
-
}
|
|
560
|
-
async function loadCodexSDK() {
|
|
561
|
-
const codexPath = resolveCodexSdkPackage();
|
|
562
|
-
if (!codexPath) throw new Error(dedent.default`The @openai/codex-sdk package is required but not installed.
|
|
563
|
-
|
|
564
|
-
To use the OpenAI Codex SDK provider, install it with:
|
|
565
|
-
npm install promptfoo @openai/codex-sdk@${CODEX_SDK_VERSION_RANGE}
|
|
566
|
-
|
|
567
|
-
Requires Node.js >=22.22.0.
|
|
568
|
-
|
|
569
|
-
For more information, see: https://www.promptfoo.dev/docs/providers/openai-codex-sdk/`);
|
|
570
|
-
const version = require_packageVersion.getPackageVersion("@openai/codex-sdk", codexPath);
|
|
571
|
-
if (!version || !(0, semver_functions_satisfies_js.default)(version, "^0.156.1")) throw new Error(`The OpenAI Codex SDK provider requires @openai/codex-sdk@${CODEX_SDK_VERSION_RANGE} (found ${version ?? "unknown"}). Install it with: npm install promptfoo @openai/codex-sdk@${CODEX_SDK_VERSION_RANGE}`);
|
|
572
|
-
try {
|
|
573
|
-
return {
|
|
574
|
-
entryPoint: codexPath,
|
|
575
|
-
module: await require_esm.importModule(codexPath)
|
|
576
|
-
};
|
|
577
|
-
} catch (err) {
|
|
578
|
-
require_logger.logger.error(`Failed to load OpenAI Codex SDK: ${err}`);
|
|
579
|
-
if (err.stack) require_logger.logger.error(err.stack);
|
|
580
|
-
throw new Error(dedent.default`Failed to load @openai/codex-sdk.
|
|
581
|
-
|
|
582
|
-
The package was found but could not be loaded. This may be due to:
|
|
583
|
-
- Incompatible Node.js version (requires Node.js >=22.22.0)
|
|
584
|
-
- Corrupted installation
|
|
585
|
-
|
|
586
|
-
Try reinstalling:
|
|
587
|
-
npm install promptfoo @openai/codex-sdk@${CODEX_SDK_VERSION_RANGE}
|
|
588
|
-
|
|
589
|
-
For more information, see: https://www.promptfoo.dev/docs/providers/openai-codex-sdk/`);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
var OpenAICodexSDKProvider = class OpenAICodexSDKProvider {
|
|
593
|
-
cleanupGeneration = 0;
|
|
594
|
-
static OPENAI_MODELS = [
|
|
595
|
-
"gpt-6-astra",
|
|
596
|
-
"gpt-6-sol",
|
|
597
|
-
"gpt-6-luna",
|
|
598
|
-
"gpt-5.6-sol",
|
|
599
|
-
"gpt-5.6-terra",
|
|
600
|
-
"gpt-5.6-luna",
|
|
601
|
-
"gpt-5.5",
|
|
602
|
-
"gpt-5.5-pro",
|
|
603
|
-
"gpt-5.4",
|
|
604
|
-
"gpt-5.4-pro",
|
|
605
|
-
"gpt-5.4-mini",
|
|
606
|
-
"gpt-5.3-codex",
|
|
607
|
-
"gpt-5.3-codex-spark",
|
|
608
|
-
"gpt-5.2",
|
|
609
|
-
"gpt-5-codex-mini",
|
|
610
|
-
"gpt-5"
|
|
611
|
-
];
|
|
612
|
-
config;
|
|
613
|
-
env;
|
|
614
|
-
apiKey;
|
|
615
|
-
providerId = "openai:codex-sdk";
|
|
616
|
-
codexSdk;
|
|
617
|
-
codexInstances = /* @__PURE__ */ new Map();
|
|
618
|
-
threads = /* @__PURE__ */ new Map();
|
|
619
|
-
threadRunQueues = new require_agenticRunQueue.AgenticRunQueue("Codex thread turn wait aborted");
|
|
620
|
-
deepTracingWarningShown = false;
|
|
621
|
-
ignoredProviderEnvWarningShown = false;
|
|
622
|
-
omittedProcessEnvWarningShown = false;
|
|
623
|
-
compatibilitySkipWarningShown = false;
|
|
624
|
-
compatibilityChecks = /* @__PURE__ */ new Map();
|
|
625
|
-
constructor(options = {}) {
|
|
626
|
-
const { config, env, id } = options;
|
|
627
|
-
this.config = parseCodexConfig(config);
|
|
628
|
-
this.env = env;
|
|
629
|
-
this.apiKey = this.getApiKey();
|
|
630
|
-
this.providerId = id ?? this.providerId;
|
|
631
|
-
require_providerRegistry.providerRegistry.register(this);
|
|
632
|
-
if (this.config.model && !require_codexSkillMetadata.usesCustomModelProvider(this.config) && !OpenAICodexSDKProvider.OPENAI_MODELS.includes(this.config.model)) require_logger.logger.warn(`Using unknown model for OpenAI Codex SDK: ${this.config.model}`);
|
|
633
|
-
}
|
|
634
|
-
id() {
|
|
635
|
-
return this.providerId;
|
|
636
|
-
}
|
|
637
|
-
getApiKey(config = this.config) {
|
|
638
|
-
return require_credentials.resolveProviderApiKey(config, this.env, ["OPENAI_API_KEY", "CODEX_API_KEY"]);
|
|
639
|
-
}
|
|
640
|
-
requiresApiKey() {
|
|
641
|
-
return false;
|
|
642
|
-
}
|
|
643
|
-
toString() {
|
|
644
|
-
return "[OpenAI Codex SDK Provider]";
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Safely tear down a Codex instance by calling its cleanup method
|
|
648
|
-
* (destroy, cleanup, or close -- whichever is available).
|
|
649
|
-
*/
|
|
650
|
-
async destroyInstance(instance) {
|
|
651
|
-
if (typeof instance.destroy === "function") await instance.destroy();
|
|
652
|
-
else if (typeof instance.cleanup === "function") await instance.cleanup();
|
|
653
|
-
else if (typeof instance.close === "function") await instance.close();
|
|
654
|
-
}
|
|
655
|
-
async cleanup() {
|
|
656
|
-
this.cleanupGeneration++;
|
|
657
|
-
require_providerRegistry.providerRegistry.unregister(this);
|
|
658
|
-
const compatibilityChecks = [...this.compatibilityChecks.entries()];
|
|
659
|
-
for (const [controller] of compatibilityChecks) controller.abort(require_agenticRunQueue.createAbortError("Codex compatibility check interrupted by cleanup"));
|
|
660
|
-
const instances = [...this.codexInstances.values()];
|
|
661
|
-
this.codexInstances.clear();
|
|
662
|
-
this.threads.clear();
|
|
663
|
-
this.threadRunQueues.clear();
|
|
664
|
-
for (const instance of instances) try {
|
|
665
|
-
await this.destroyInstance(instance);
|
|
666
|
-
} catch (error) {
|
|
667
|
-
require_logger.logger.warn("[CodexSDK] Error during cleanup", { error });
|
|
668
|
-
}
|
|
669
|
-
if (compatibilityChecks.length > 0) await Promise.allSettled(compatibilityChecks.map(([, pending]) => pending));
|
|
670
|
-
}
|
|
671
|
-
async shutdown() {
|
|
672
|
-
await this.cleanup();
|
|
673
|
-
}
|
|
674
|
-
prepareEnvironment(config, traceparent, apiKey = this.getApiKey(config)) {
|
|
675
|
-
const inheritProcessEnv = config.inherit_process_env === true;
|
|
676
|
-
const cliEnv = Object.fromEntries(Object.entries(config.cli_env ?? {}).map(([key, value]) => [key, String(value)]));
|
|
677
|
-
const env = {
|
|
678
|
-
...inheritProcessEnv ? require_logger.getProcessEnv() : require_codexSkillMetadata.getMinimalProcessEnv(),
|
|
679
|
-
...cliEnv
|
|
680
|
-
};
|
|
681
|
-
const ignoredProviderEnvKeys = Object.keys(this.env ?? {}).filter((key) => key !== "OPENAI_API_KEY" && key !== "CODEX_API_KEY" && !(key in (config.cli_env ?? {}))).sort();
|
|
682
|
-
if (ignoredProviderEnvKeys.length > 0 && !this.ignoredProviderEnvWarningShown) {
|
|
683
|
-
require_logger.logger.warn("[CodexSDK] Ignoring promptfoo-level env overrides for the Codex CLI process. Move these keys into config.cli_env if Codex shell commands need them.", { envKeys: ignoredProviderEnvKeys });
|
|
684
|
-
this.ignoredProviderEnvWarningShown = true;
|
|
685
|
-
}
|
|
686
|
-
if (!inheritProcessEnv && !this.omittedProcessEnvWarningShown) {
|
|
687
|
-
const omittedProcessEnvKeys = this.getOmittedOptionalProcessEnvKeys(config, env);
|
|
688
|
-
if (omittedProcessEnvKeys.length > 0) {
|
|
689
|
-
require_logger.logger.warn("[CodexSDK] Optional Codex CLI process env vars are not inherited by default. Move these keys into config.cli_env or set inherit_process_env: true if Codex CLI commands need them.", { envKeys: omittedProcessEnvKeys });
|
|
690
|
-
this.omittedProcessEnvWarningShown = true;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
const sortedEnv = {};
|
|
694
|
-
for (const key of Object.keys(env).sort()) if (env[key] !== void 0) sortedEnv[key] = env[key];
|
|
695
|
-
require_codexSkillMetadata.applyApiKeyToCliEnv(sortedEnv, config, apiKey);
|
|
696
|
-
if (config.deep_tracing) {
|
|
697
|
-
if (!sortedEnv.OTEL_EXPORTER_OTLP_ENDPOINT) sortedEnv.OTEL_EXPORTER_OTLP_ENDPOINT = require_codexSkillMetadata.getCodexTraceEndpoint();
|
|
698
|
-
if (!sortedEnv.OTEL_EXPORTER_OTLP_PROTOCOL) sortedEnv.OTEL_EXPORTER_OTLP_PROTOCOL = require_codexSkillMetadata.getCodexTraceProtocol();
|
|
699
|
-
if (!sortedEnv.OTEL_SERVICE_NAME) sortedEnv.OTEL_SERVICE_NAME = "codex-cli";
|
|
700
|
-
if (!sortedEnv.OTEL_TRACES_EXPORTER) sortedEnv.OTEL_TRACES_EXPORTER = "otlp";
|
|
701
|
-
if (traceparent) {
|
|
702
|
-
sortedEnv.TRACEPARENT = traceparent;
|
|
703
|
-
const [, tpTraceId, tpSpanId] = traceparent.split("-");
|
|
704
|
-
if (tpTraceId && tpSpanId) sortedEnv.OTEL_RESOURCE_ATTRIBUTES = appendPromptfooResourceAttrs(sortedEnv.OTEL_RESOURCE_ATTRIBUTES, tpTraceId, tpSpanId);
|
|
705
|
-
}
|
|
706
|
-
require_logger.logger.debug("[CodexSDK] Injecting OTEL config for deep tracing", {
|
|
707
|
-
traceparent: traceparent || "(none - CLI will start own trace)",
|
|
708
|
-
endpoint: sortedEnv.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
709
|
-
userConfigured: {
|
|
710
|
-
endpoint: !!env.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
711
|
-
protocol: !!env.OTEL_EXPORTER_OTLP_PROTOCOL,
|
|
712
|
-
serviceName: !!env.OTEL_SERVICE_NAME
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
|
-
} else delete sortedEnv.TRACEPARENT;
|
|
716
|
-
return sortedEnv;
|
|
717
|
-
}
|
|
718
|
-
getOmittedOptionalProcessEnvKeys(config, env) {
|
|
719
|
-
const shouldWarnForSshEnv = config.network_access_enabled === true || config.web_search_enabled === true || config.web_search_mode === "live";
|
|
720
|
-
return require_codexSkillMetadata.COMMON_OPTIONAL_PROCESS_ENV_KEYS.filter((key) => typeof process.env[key] === "string" && !(key in env) && (shouldWarnForSshEnv || key !== "SSH_AUTH_SOCK" && key !== "GIT_SSH_COMMAND"));
|
|
721
|
-
}
|
|
722
|
-
getResolvedCliConfig(config, env = {}) {
|
|
723
|
-
if (!config.cli_config && !config.collaboration_mode && !config.model_provider && !config.deep_tracing) return;
|
|
724
|
-
const cliConfig = {
|
|
725
|
-
...config.cli_config ?? {},
|
|
726
|
-
...config.model_provider ? { model_provider: config.model_provider } : {},
|
|
727
|
-
...config.collaboration_mode ? { collaboration_mode: config.collaboration_mode } : {}
|
|
728
|
-
};
|
|
729
|
-
return require_codexSkillMetadata.withCodexTraceExporter(cliConfig, env, config.deep_tracing === true);
|
|
730
|
-
}
|
|
731
|
-
getSkillRootPrefixes(env, workingDir) {
|
|
732
|
-
const resolvedWorkingDir = workingDir ? path.default.resolve(workingDir).replace(/\\/g, "/") : void 0;
|
|
733
|
-
return require_codexSkillMetadata.getCodexSkillRootPrefixes({
|
|
734
|
-
codexHome: env.CODEX_HOME,
|
|
735
|
-
gitRepositoryRoot: resolvedWorkingDir ? this.findGitRepositoryRoot(resolvedWorkingDir) : void 0,
|
|
736
|
-
homeDir: env.HOME || env.USERPROFILE || process.env.HOME || process.env.USERPROFILE,
|
|
737
|
-
workingDir: resolvedWorkingDir
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
buildSkillMetadata(items, skillRootPrefixes = []) {
|
|
741
|
-
return require_codexSkillMetadata.buildCodexSkillMetadata(items, skillRootPrefixes, {
|
|
742
|
-
getCommand: (item) => item?.type === "command_execution" && typeof item.command === "string" && item.command.trim() ? item.command : void 0,
|
|
743
|
-
isSuccessfulCommand: (item) => this.isSuccessfulCommandExecution(item)
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
isSuccessfulCommandExecution(item) {
|
|
747
|
-
if (item?.type !== "command_execution") return false;
|
|
748
|
-
if (typeof item.status === "string" && item.status !== "completed") return false;
|
|
749
|
-
if (typeof item.exit_code === "number" && item.exit_code !== 0) return false;
|
|
750
|
-
return true;
|
|
751
|
-
}
|
|
752
|
-
validateWorkingDirectory(workingDir, skipGitCheck = false) {
|
|
753
|
-
let stats;
|
|
754
|
-
try {
|
|
755
|
-
stats = fs.default.statSync(workingDir);
|
|
756
|
-
} catch (err) {
|
|
757
|
-
throw new Error(`Working directory ${workingDir} does not exist or isn't accessible: ${err.message}`);
|
|
758
|
-
}
|
|
759
|
-
if (!stats.isDirectory()) throw new Error(`Working directory ${workingDir} is not a directory`);
|
|
760
|
-
if (!skipGitCheck && !this.isInsideGitRepository(workingDir)) throw new Error(dedent.default`Working directory ${workingDir} is not inside a Git repository.
|
|
761
|
-
|
|
762
|
-
Codex requires a Git repository by default to prevent unrecoverable errors.
|
|
763
|
-
|
|
764
|
-
To bypass this check, set skip_git_repo_check: true in your provider config.`);
|
|
765
|
-
}
|
|
766
|
-
isInsideGitRepository(workingDir) {
|
|
767
|
-
return this.findGitRepositoryRoot(workingDir) !== void 0;
|
|
768
|
-
}
|
|
769
|
-
findGitRepositoryRoot(workingDir) {
|
|
770
|
-
return require_codexSkillMetadata.findGitRepositoryRoot(workingDir);
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* Build Codex constructor options from provider config.
|
|
774
|
-
* Used when creating both local (deep-tracing) and cached instances.
|
|
775
|
-
*/
|
|
776
|
-
buildCodexOptions(env, config, apiKey = this.getApiKey(config)) {
|
|
777
|
-
const cliConfig = this.getResolvedCliConfig(config, env);
|
|
778
|
-
return {
|
|
779
|
-
env,
|
|
780
|
-
...require_codexSkillMetadata.shouldInjectApiKey(config, apiKey) ? { apiKey } : {},
|
|
781
|
-
...config.codex_path_override ? { codexPathOverride: config.codex_path_override } : {},
|
|
782
|
-
...config.base_url ? { baseUrl: config.base_url } : {},
|
|
783
|
-
...cliConfig ? { config: cliConfig } : {}
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
buildThreadOptions(config) {
|
|
787
|
-
return {
|
|
788
|
-
workingDirectory: config.working_dir,
|
|
789
|
-
skipGitRepoCheck: config.skip_git_repo_check ?? false,
|
|
790
|
-
...config.model ? { model: config.model } : {},
|
|
791
|
-
...config.additional_directories?.length ? { additionalDirectories: config.additional_directories } : {},
|
|
792
|
-
...config.sandbox_mode ? { sandboxMode: config.sandbox_mode } : {},
|
|
793
|
-
...config.model_reasoning_effort ? { modelReasoningEffort: config.model_reasoning_effort } : {},
|
|
794
|
-
...config.network_access_enabled === void 0 ? {} : { networkAccessEnabled: config.network_access_enabled },
|
|
795
|
-
...config.web_search_mode ? { webSearchMode: config.web_search_mode } : {},
|
|
796
|
-
...config.web_search_enabled !== void 0 && !config.web_search_mode ? { webSearchEnabled: config.web_search_enabled } : {},
|
|
797
|
-
...config.approval_policy ? { approvalPolicy: config.approval_policy } : {}
|
|
798
|
-
};
|
|
799
|
-
}
|
|
800
|
-
async getOrCreateThread(config, cacheKey, instanceKey, instance) {
|
|
801
|
-
const threadOptions = this.buildThreadOptions(config);
|
|
802
|
-
if (config.deep_tracing) return instance.startThread(threadOptions);
|
|
803
|
-
if (config.thread_id) {
|
|
804
|
-
const threadIdCacheKey = this.getExplicitThreadCacheKey(config, instanceKey);
|
|
805
|
-
const cached = this.threads.get(threadIdCacheKey);
|
|
806
|
-
if (cached) return cached;
|
|
807
|
-
const thread = instance.resumeThread(config.thread_id, threadOptions);
|
|
808
|
-
if (config.persist_threads) {
|
|
809
|
-
const explicitThreadCachePrefix = this.getExplicitThreadCachePrefix(config);
|
|
810
|
-
for (const cacheKey of this.threads.keys()) if (cacheKey !== threadIdCacheKey && cacheKey.startsWith(explicitThreadCachePrefix)) this.threads.delete(cacheKey);
|
|
811
|
-
this.threads.set(threadIdCacheKey, thread);
|
|
812
|
-
}
|
|
813
|
-
return thread;
|
|
814
|
-
}
|
|
815
|
-
if (config.persist_threads && cacheKey) {
|
|
816
|
-
const cached = this.threads.get(cacheKey);
|
|
817
|
-
if (cached) return cached;
|
|
818
|
-
const poolSize = config.thread_pool_size ?? 1;
|
|
819
|
-
if (this.threads.size >= poolSize) {
|
|
820
|
-
const oldestKey = this.threads.keys().next().value;
|
|
821
|
-
if (oldestKey) this.threads.delete(oldestKey);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
const thread = instance.startThread(threadOptions);
|
|
825
|
-
if (config.persist_threads && cacheKey) this.threads.set(cacheKey, thread);
|
|
826
|
-
return thread;
|
|
827
|
-
}
|
|
828
|
-
async runStreaming(thread, prompt, runOptions, callOptions, skillRootPrefixes = []) {
|
|
829
|
-
const { events } = await thread.runStreamed(prompt, runOptions);
|
|
830
|
-
const tracer = _opentelemetry_api.trace.getTracer("promptfoo.codex-sdk");
|
|
831
|
-
const state = this.createCodexStreamingState(prompt);
|
|
832
|
-
try {
|
|
833
|
-
for await (const event of events) {
|
|
834
|
-
const eventTime = Date.now();
|
|
835
|
-
if (callOptions?.abortSignal?.aborted) throw require_agenticRunQueue.createAbortError("OpenAI Codex SDK call aborted");
|
|
836
|
-
this.handleStreamingEvent(event, state, tracer, eventTime, skillRootPrefixes);
|
|
837
|
-
state.lastEventTime = eventTime;
|
|
838
|
-
}
|
|
839
|
-
if (!state.turnCompleted) {
|
|
840
|
-
if (state.lastStreamError) {
|
|
841
|
-
if (!state.activeTurnSpan) this.startTurnSpan(state, tracer, state.lastEventTime);
|
|
842
|
-
this.endTurnSpan(state, state.lastEventTime, void 0, state.lastStreamError);
|
|
843
|
-
throw new Error(`Codex stream ended after error: ${state.lastStreamError}`);
|
|
844
|
-
}
|
|
845
|
-
throw new Error("Codex stream ended before turn completion");
|
|
846
|
-
}
|
|
847
|
-
} finally {
|
|
848
|
-
this.endUnclosedStreamingSpans(state);
|
|
849
|
-
}
|
|
850
|
-
return this.buildStreamingTurnResult(state);
|
|
851
|
-
}
|
|
852
|
-
createCodexStreamingState(prompt) {
|
|
853
|
-
return {
|
|
854
|
-
items: [],
|
|
855
|
-
usage: void 0,
|
|
856
|
-
turnCompleted: false,
|
|
857
|
-
lastStreamError: void 0,
|
|
858
|
-
activeSpans: /* @__PURE__ */ new Map(),
|
|
859
|
-
itemStartTimes: /* @__PURE__ */ new Map(),
|
|
860
|
-
lastEventTime: Date.now(),
|
|
861
|
-
reasoningTexts: [],
|
|
862
|
-
conversationMessages: [{
|
|
863
|
-
role: "user",
|
|
864
|
-
content: this.formatPromptInputForTrace(prompt)
|
|
865
|
-
}],
|
|
866
|
-
turnCount: 0,
|
|
867
|
-
activeTurnSpan: void 0,
|
|
868
|
-
activeTurnIndex: 0
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
handleStreamingEvent(event, state, tracer, eventTime, skillRootPrefixes) {
|
|
872
|
-
switch (event.type) {
|
|
873
|
-
case "item.started":
|
|
874
|
-
this.handleStreamingItemStarted(event, state, tracer, eventTime);
|
|
875
|
-
return;
|
|
876
|
-
case "item.completed":
|
|
877
|
-
this.handleStreamingItemCompleted(event, state, tracer, eventTime, skillRootPrefixes);
|
|
878
|
-
return;
|
|
879
|
-
case "item.updated":
|
|
880
|
-
this.handleStreamingItemUpdated(event, state, skillRootPrefixes);
|
|
881
|
-
return;
|
|
882
|
-
case "turn.completed":
|
|
883
|
-
state.usage = event.usage;
|
|
884
|
-
state.turnCompleted = true;
|
|
885
|
-
if (!state.activeTurnSpan) this.startTurnSpan(state, tracer, state.lastEventTime);
|
|
886
|
-
this.endTurnSpan(state, eventTime, event.usage);
|
|
887
|
-
require_logger.logger.debug("Codex turn completed", { usage: state.usage });
|
|
888
|
-
return;
|
|
889
|
-
case "turn.failed": {
|
|
890
|
-
const errorMsg = event.error?.message || "Turn failed";
|
|
891
|
-
if (!state.activeTurnSpan) this.startTurnSpan(state, tracer, state.lastEventTime);
|
|
892
|
-
this.endTurnSpan(state, eventTime, void 0, errorMsg);
|
|
893
|
-
require_logger.logger.error("Codex turn failed", { error: errorMsg });
|
|
894
|
-
const previousStreamError = state.lastStreamError && state.lastStreamError !== errorMsg ? ` Previous stream error: ${state.lastStreamError}` : "";
|
|
895
|
-
throw new Error(`Codex turn failed: ${errorMsg}${previousStreamError}`);
|
|
896
|
-
}
|
|
897
|
-
case "error": {
|
|
898
|
-
const errorMsg = typeof event.message === "string" && event.message ? event.message : "Stream failed";
|
|
899
|
-
state.lastStreamError = errorMsg;
|
|
900
|
-
require_logger.logger.debug("Codex stream error event received; waiting for terminal event", { error: errorMsg });
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
case "thread.started": return;
|
|
904
|
-
case "turn.started":
|
|
905
|
-
this.startTurnSpan(state, tracer, eventTime);
|
|
906
|
-
return;
|
|
907
|
-
default: require_logger.logger.debug("Codex unknown event type", { type: event.type });
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
handleStreamingItemStarted(event, state, tracer, eventTime) {
|
|
911
|
-
const item = event.item;
|
|
912
|
-
if (!item) {
|
|
913
|
-
require_logger.logger.warn("Codex item.started event missing item", { event });
|
|
914
|
-
return;
|
|
915
|
-
}
|
|
916
|
-
if (!state.activeTurnSpan) this.startTurnSpan(state, tracer, eventTime);
|
|
917
|
-
if (!item.id) {
|
|
918
|
-
require_logger.logger.debug("Codex item.started without id, will create span at completion", { type: item.type });
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
const itemId = String(item.id);
|
|
922
|
-
const span = this.startStreamingItemSpan(tracer, item, itemId, void 0, state.activeTurnIndex > 0 ? state.activeTurnIndex : void 0);
|
|
923
|
-
state.activeSpans.set(itemId, span);
|
|
924
|
-
state.itemStartTimes.set(itemId, eventTime);
|
|
925
|
-
require_logger.logger.debug("Codex item started", {
|
|
926
|
-
itemId,
|
|
927
|
-
type: item.type
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
handleStreamingItemCompleted(event, state, tracer, eventTime, skillRootPrefixes) {
|
|
931
|
-
const item = event.item;
|
|
932
|
-
if (!item) {
|
|
933
|
-
require_logger.logger.warn("Codex item.completed event missing item", { event });
|
|
934
|
-
return;
|
|
935
|
-
}
|
|
936
|
-
if (!state.activeTurnSpan) this.startTurnSpan(state, tracer, state.lastEventTime);
|
|
937
|
-
const itemId = item.id ? String(item.id) : crypto.default.randomUUID();
|
|
938
|
-
state.items.push(item);
|
|
939
|
-
this.collectStreamingItemText(item, state);
|
|
940
|
-
const span = state.activeSpans.get(itemId) ?? this.startStreamingItemSpan(tracer, item, itemId, state.lastEventTime, state.activeTurnIndex > 0 ? state.activeTurnIndex : void 0);
|
|
941
|
-
const hadStartEvent = state.activeSpans.has(itemId);
|
|
942
|
-
const startTime = state.itemStartTimes.get(itemId) ?? state.lastEventTime;
|
|
943
|
-
const durationMs = eventTime - startTime;
|
|
944
|
-
this.applyStreamingCompletionAttributes(span, item, skillRootPrefixes, eventTime, startTime, hadStartEvent);
|
|
945
|
-
span.end();
|
|
946
|
-
state.activeSpans.delete(itemId);
|
|
947
|
-
state.itemStartTimes.delete(itemId);
|
|
948
|
-
require_logger.logger.debug("Codex item completed", {
|
|
949
|
-
itemId,
|
|
950
|
-
type: item.type,
|
|
951
|
-
durationMs
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
handleStreamingItemUpdated(event, state, skillRootPrefixes) {
|
|
955
|
-
const item = event.item;
|
|
956
|
-
if (item?.id) {
|
|
957
|
-
const itemId = String(item.id);
|
|
958
|
-
const span = state.activeSpans.get(itemId);
|
|
959
|
-
if (span) this.setStreamingCompletionAttributes(span, item, skillRootPrefixes);
|
|
960
|
-
}
|
|
961
|
-
require_logger.logger.debug("Codex item updated", {
|
|
962
|
-
itemId: item?.id,
|
|
963
|
-
type: item?.type
|
|
964
|
-
});
|
|
965
|
-
}
|
|
966
|
-
startStreamingItemSpan(tracer, item, itemId, startTime, turnIndex) {
|
|
967
|
-
return tracer.startSpan(this.getSpanNameForItem(item), {
|
|
968
|
-
kind: _opentelemetry_api.SpanKind.INTERNAL,
|
|
969
|
-
...startTime === void 0 ? {} : { startTime },
|
|
970
|
-
attributes: require_genaiTracer.addActiveSpanRoleAttribute({
|
|
971
|
-
"codex.item.id": itemId,
|
|
972
|
-
"codex.item.type": item.type,
|
|
973
|
-
...startTime === void 0 ? {} : { "codex.timing.estimated": true },
|
|
974
|
-
...typeof turnIndex === "number" ? { "gen_ai.turn.index": turnIndex } : {},
|
|
975
|
-
...this.getAttributesForItem(item)
|
|
976
|
-
})
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
startTurnSpan(state, tracer, eventTime) {
|
|
980
|
-
require_genaiTracer.openTurnSpan(state, {
|
|
981
|
-
tracer,
|
|
982
|
-
eventTime,
|
|
983
|
-
system: "openai",
|
|
984
|
-
logLabel: "CodexSDK"
|
|
985
|
-
});
|
|
986
|
-
}
|
|
987
|
-
endTurnSpan(state, eventTime, usage, errorMessage) {
|
|
988
|
-
const attributes = {};
|
|
989
|
-
if (usage) {
|
|
990
|
-
const inputTokens = usage.input_tokens ?? usage.inputTokens;
|
|
991
|
-
const outputTokens = usage.output_tokens ?? usage.outputTokens;
|
|
992
|
-
const cachedTokens = usage.cached_input_tokens ?? usage.cachedInputTokens;
|
|
993
|
-
const cacheWriteTokens = usage.cache_write_input_tokens ?? usage.cacheWriteInputTokens;
|
|
994
|
-
const reasoningTokens = usage.reasoning_output_tokens ?? usage.reasoningOutputTokens;
|
|
995
|
-
if (typeof inputTokens === "number") attributes["gen_ai.usage.input_tokens"] = inputTokens;
|
|
996
|
-
if (typeof outputTokens === "number") attributes["gen_ai.usage.output_tokens"] = outputTokens;
|
|
997
|
-
if (typeof cachedTokens === "number") attributes[require_genaiTracer.GenAIAttributes.USAGE_CACHE_READ_INPUT_TOKENS] = cachedTokens;
|
|
998
|
-
if (typeof cacheWriteTokens === "number") attributes[require_genaiTracer.GenAIAttributes.USAGE_CACHE_CREATION_INPUT_TOKENS] = cacheWriteTokens;
|
|
999
|
-
if (typeof reasoningTokens === "number") attributes[require_genaiTracer.GenAIAttributes.USAGE_REASONING_OUTPUT_TOKENS] = reasoningTokens;
|
|
1000
|
-
}
|
|
1001
|
-
require_genaiTracer.closeTurnSpan(state, {
|
|
1002
|
-
eventTime,
|
|
1003
|
-
attributes,
|
|
1004
|
-
errorMessage,
|
|
1005
|
-
logLabel: "CodexSDK"
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
collectStreamingItemText(item, state) {
|
|
1009
|
-
if (item.type === "reasoning" && typeof item.text === "string") {
|
|
1010
|
-
const sanitizedReasoning = this.sanitizeTraceText(item.text, "Codex reasoning trace event");
|
|
1011
|
-
if (sanitizedReasoning) state.reasoningTexts.push(sanitizedReasoning);
|
|
1012
|
-
}
|
|
1013
|
-
if (item.type === "agent_message" && typeof item.text === "string") state.conversationMessages.push({
|
|
1014
|
-
role: "assistant",
|
|
1015
|
-
content: this.sanitizeTraceText(item.text, "Codex agent message trace event") ?? ""
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
applyStreamingCompletionAttributes(span, item, skillRootPrefixes, eventTime, startTime, hadStartEvent) {
|
|
1019
|
-
this.setStreamingCompletionAttributes(span, item, skillRootPrefixes);
|
|
1020
|
-
span.setAttribute("codex.duration_ms", eventTime - startTime);
|
|
1021
|
-
span.setAttribute("codex.had_start_event", hadStartEvent);
|
|
1022
|
-
this.addStreamingSpanEvents(span, item);
|
|
1023
|
-
this.setStreamingSpanStatus(span, item);
|
|
1024
|
-
}
|
|
1025
|
-
setStreamingCompletionAttributes(span, item, skillRootPrefixes) {
|
|
1026
|
-
const completionAttrs = this.getCompletionAttributesForItem(item, skillRootPrefixes);
|
|
1027
|
-
for (const [key, value] of Object.entries(completionAttrs)) span.setAttribute(key, value);
|
|
1028
|
-
}
|
|
1029
|
-
addStreamingSpanEvents(span, item) {
|
|
1030
|
-
if (item.type === "reasoning" && typeof item.text === "string") span.addEvent("reasoning", { "codex.reasoning.text": this.sanitizeTraceText(item.text, "Codex reasoning span event") ?? "" });
|
|
1031
|
-
if (item.type === "agent_message" && typeof item.text === "string") span.addEvent("message", { "codex.message.text": this.sanitizeTraceText(item.text, "Codex agent message span event") ?? "" });
|
|
1032
|
-
if (item.type === "command_execution" && typeof item.aggregated_output === "string") span.addEvent("output", { "codex.command.output": this.sanitizeTraceText(item.aggregated_output, "Codex command output span event") ?? "" });
|
|
1033
|
-
}
|
|
1034
|
-
setStreamingSpanStatus(span, item) {
|
|
1035
|
-
if (!this.isStreamingItemError(item)) {
|
|
1036
|
-
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.OK });
|
|
1037
|
-
return;
|
|
1038
|
-
}
|
|
1039
|
-
span.setStatus({
|
|
1040
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1041
|
-
message: this.getStreamingItemErrorMessage(item)
|
|
1042
|
-
});
|
|
1043
|
-
}
|
|
1044
|
-
isStreamingItemError(item) {
|
|
1045
|
-
return item.status === "failed" || item.type === "error" || item.error !== void 0 || item.type === "command_execution" && typeof item.exit_code === "number" && item.exit_code !== 0;
|
|
1046
|
-
}
|
|
1047
|
-
getStreamingItemErrorMessage(item) {
|
|
1048
|
-
return (typeof item.message === "string" ? item.message : null) || (typeof item.error?.message === "string" ? item.error.message : null) || (item.type === "command_execution" && item.exit_code !== 0 ? `Command exited with code ${item.exit_code}` : null) || "Item failed";
|
|
1049
|
-
}
|
|
1050
|
-
endUnclosedStreamingSpans(state) {
|
|
1051
|
-
for (const [itemId, span] of state.activeSpans) {
|
|
1052
|
-
require_logger.logger.warn("Codex item span not properly closed", { itemId });
|
|
1053
|
-
span.setStatus({
|
|
1054
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1055
|
-
message: "Span not properly closed"
|
|
1056
|
-
});
|
|
1057
|
-
span.end();
|
|
1058
|
-
}
|
|
1059
|
-
state.activeSpans.clear();
|
|
1060
|
-
state.itemStartTimes.clear();
|
|
1061
|
-
require_genaiTracer.closeTurnSpan(state, {
|
|
1062
|
-
errorMessage: "Turn span not properly closed",
|
|
1063
|
-
logLabel: "CodexSDK"
|
|
1064
|
-
});
|
|
1065
|
-
}
|
|
1066
|
-
buildStreamingTurnResult(state) {
|
|
1067
|
-
return {
|
|
1068
|
-
finalResponse: [...state.items.filter((item) => item.type === "agent_message")].reverse().find((item) => typeof item.text === "string")?.text ?? "",
|
|
1069
|
-
items: state.items,
|
|
1070
|
-
usage: state.usage,
|
|
1071
|
-
reasoningTexts: state.reasoningTexts,
|
|
1072
|
-
conversationMessages: state.conversationMessages
|
|
1073
|
-
};
|
|
1074
|
-
}
|
|
1075
|
-
parsePromptInput(prompt) {
|
|
1076
|
-
let parsedPrompt;
|
|
1077
|
-
try {
|
|
1078
|
-
parsedPrompt = JSON.parse(prompt);
|
|
1079
|
-
} catch {
|
|
1080
|
-
return prompt;
|
|
1081
|
-
}
|
|
1082
|
-
if (!Array.isArray(parsedPrompt) || parsedPrompt.length === 0 || !parsedPrompt.every((item) => this.isCodexPromptInputItem(item))) return prompt;
|
|
1083
|
-
return parsedPrompt;
|
|
1084
|
-
}
|
|
1085
|
-
isCodexPromptInputItem(item) {
|
|
1086
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) return false;
|
|
1087
|
-
const keys = Object.keys(item);
|
|
1088
|
-
if ("type" in item && item.type === "text") return keys.length === 2 && keys.includes("type") && "text" in item && typeof item.text === "string";
|
|
1089
|
-
if ("type" in item && item.type === "local_image") return keys.length === 2 && keys.includes("type") && "path" in item && typeof item.path === "string";
|
|
1090
|
-
return false;
|
|
1091
|
-
}
|
|
1092
|
-
formatPromptInputForTrace(prompt) {
|
|
1093
|
-
if (typeof prompt === "string") return prompt;
|
|
1094
|
-
return prompt.map((item) => item.type === "text" ? item.text : `[local_image: ${item.path}]`).join("\n");
|
|
1095
|
-
}
|
|
1096
|
-
/**
|
|
1097
|
-
* Get a descriptive span name for a Codex item
|
|
1098
|
-
*/
|
|
1099
|
-
getSpanNameForItem(item) {
|
|
1100
|
-
switch (item.type) {
|
|
1101
|
-
case "command_execution": return `exec ${typeof item.command === "string" ? item.command.split(" ")[0] || "command" : "command"}`;
|
|
1102
|
-
case "file_change": return `file ${item.changes?.[0]?.kind || "change"}`;
|
|
1103
|
-
case "mcp_tool_call": return `mcp ${typeof item.server === "string" ? item.server : "unknown"}/${typeof item.tool === "string" ? item.tool : "unknown"}`;
|
|
1104
|
-
case "agent_message": return "agent response";
|
|
1105
|
-
case "reasoning": return "reasoning";
|
|
1106
|
-
case "web_search": return `search "${typeof item.query === "string" ? (this.sanitizeTraceText(item.query, "Codex web search span name") ?? "").slice(0, 30) : ""}"`;
|
|
1107
|
-
case "todo_list": return "todo update";
|
|
1108
|
-
case "error": return "error";
|
|
1109
|
-
case "collaboration_tool_call": return `collab ${typeof item.tool === "string" ? item.tool : "unknown"}`;
|
|
1110
|
-
case "spawn_agent": return `spawn ${typeof item.role === "string" ? item.role : "agent"}`;
|
|
1111
|
-
case "send_input": return "send input";
|
|
1112
|
-
case "agent_wait": return "wait";
|
|
1113
|
-
default: return `codex.${item.type || "unknown"}`;
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
/**
|
|
1117
|
-
* Get attributes for a Codex item at start
|
|
1118
|
-
*/
|
|
1119
|
-
getSkillTraceAttributes(item, skillRootPrefixes = [], options = {}) {
|
|
1120
|
-
if (item?.type !== "command_execution") return {};
|
|
1121
|
-
if (options.requireSuccessfulCommand && !this.isSuccessfulCommandExecution(item)) return {};
|
|
1122
|
-
const command = typeof item.command === "string" && item.command.trim() ? item.command : void 0;
|
|
1123
|
-
const skillCandidates = /* @__PURE__ */ new Map();
|
|
1124
|
-
if (command) for (const skill of require_codexSkillMetadata.extractCodexSkillPathCandidates(command, skillRootPrefixes)) skillCandidates.set(skill.path, skill);
|
|
1125
|
-
if (skillCandidates.size === 0) return {};
|
|
1126
|
-
const skills = Array.from(skillCandidates.values());
|
|
1127
|
-
const attrs = {
|
|
1128
|
-
"promptfoo.skill.count": skills.length,
|
|
1129
|
-
"promptfoo.skill.names": skills.map((skill) => skill.name).join(","),
|
|
1130
|
-
"promptfoo.skill.paths": skills.map((skill) => skill.path).join(",")
|
|
1131
|
-
};
|
|
1132
|
-
if (skills.length === 1) {
|
|
1133
|
-
attrs["promptfoo.skill.name"] = skills[0].name;
|
|
1134
|
-
attrs["promptfoo.skill.path"] = skills[0].path;
|
|
1135
|
-
}
|
|
1136
|
-
return attrs;
|
|
1137
|
-
}
|
|
1138
|
-
getAttributesForItem(item) {
|
|
1139
|
-
const attrs = {};
|
|
1140
|
-
switch (item.type) {
|
|
1141
|
-
case "command_execution":
|
|
1142
|
-
if (typeof item.command === "string") attrs["codex.command"] = this.sanitizeTraceText(item.command, "Codex command trace attribute") ?? "";
|
|
1143
|
-
break;
|
|
1144
|
-
case "mcp_tool_call":
|
|
1145
|
-
if (typeof item.server === "string") attrs["codex.mcp.server"] = item.server;
|
|
1146
|
-
if (typeof item.tool === "string") {
|
|
1147
|
-
attrs["gen_ai.operation.name"] = "execute_tool";
|
|
1148
|
-
attrs["gen_ai.tool.name"] = item.tool;
|
|
1149
|
-
attrs["codex.mcp.tool"] = item.tool;
|
|
1150
|
-
}
|
|
1151
|
-
{
|
|
1152
|
-
const serializedArgs = this.serializeItemValue(item.arguments ?? item.args ?? item.input);
|
|
1153
|
-
if (serializedArgs) attrs["codex.mcp.input"] = serializedArgs;
|
|
1154
|
-
}
|
|
1155
|
-
break;
|
|
1156
|
-
case "web_search":
|
|
1157
|
-
if (typeof item.query === "string") attrs["codex.search.query"] = this.sanitizeTraceText(item.query, "Codex web search query trace attribute") ?? "";
|
|
1158
|
-
break;
|
|
1159
|
-
case "collaboration_tool_call":
|
|
1160
|
-
if (typeof item.tool === "string") {
|
|
1161
|
-
attrs["gen_ai.operation.name"] = "execute_tool";
|
|
1162
|
-
attrs["gen_ai.tool.name"] = item.tool;
|
|
1163
|
-
attrs["codex.collab.tool"] = item.tool;
|
|
1164
|
-
}
|
|
1165
|
-
if (typeof item.target_thread_id === "string") attrs["codex.collab.target_thread"] = item.target_thread_id;
|
|
1166
|
-
break;
|
|
1167
|
-
case "spawn_agent":
|
|
1168
|
-
if (typeof item.role === "string") attrs["codex.collab.role"] = item.role;
|
|
1169
|
-
if (typeof item.thread_id === "string") attrs["codex.collab.spawned_thread"] = item.thread_id;
|
|
1170
|
-
break;
|
|
1171
|
-
case "send_input": if (typeof item.target_thread_id === "string") attrs["codex.collab.target_thread"] = item.target_thread_id;
|
|
1172
|
-
}
|
|
1173
|
-
return attrs;
|
|
1174
|
-
}
|
|
1175
|
-
serializeItemValue(value) {
|
|
1176
|
-
if (typeof value === "string") {
|
|
1177
|
-
const trimmed = value.trim();
|
|
1178
|
-
if (!trimmed) return;
|
|
1179
|
-
try {
|
|
1180
|
-
return JSON.stringify(this.redactTracePii(require_logger.sanitizeObject(JSON.parse(trimmed))));
|
|
1181
|
-
} catch {
|
|
1182
|
-
return this.redactTracePii(require_logger.sanitizeObject(trimmed, { context: "Codex MCP trace input" }));
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
if (value === void 0 || value === null) return;
|
|
1186
|
-
try {
|
|
1187
|
-
return JSON.stringify(this.redactTracePii(require_logger.sanitizeObject(value, { context: "Codex MCP trace input" })));
|
|
1188
|
-
} catch {
|
|
1189
|
-
return;
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
sanitizeTraceText(value, context) {
|
|
1193
|
-
const sanitized = this.redactTracePii(require_logger.sanitizeObject(value, { context }));
|
|
1194
|
-
if (typeof sanitized === "string") return sanitized;
|
|
1195
|
-
if (sanitized === void 0 || sanitized === null) return;
|
|
1196
|
-
try {
|
|
1197
|
-
return JSON.stringify(sanitized);
|
|
1198
|
-
} catch {
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
redactTracePii(value) {
|
|
1203
|
-
if (typeof value === "string") return value.replace(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi, require_logger.REDACTED).replace(/\b(?:sk-(?:proj-)?[A-Za-z0-9_-]{20,}|sk-ant-[A-Za-z0-9_-]{20,}|AKIA[A-Z0-9]{16}|AIza[A-Za-z0-9_-]{35}|Bearer\s+[A-Za-z0-9._~+/-]{20,}|Basic\s+[A-Za-z0-9+/=]{20,})\b/g, require_logger.REDACTED).replace(/\b(api[_-]?key|token|password|secret|authorization|auth)\s*([=:])(\s*)(["']?)[^\s"'`]+(\4)/gi, (_match, key, separator, spacing, quote) => `${key}${separator}${spacing}${quote}${require_logger.REDACTED}${quote}`);
|
|
1204
|
-
if (Array.isArray(value)) return value.map((item) => this.redactTracePii(item));
|
|
1205
|
-
if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, entryValue]) => [key, require_logger.normalizeFieldName(key).includes("email") ? require_logger.REDACTED : this.redactTracePii(entryValue)]));
|
|
1206
|
-
return value;
|
|
1207
|
-
}
|
|
1208
|
-
/**
|
|
1209
|
-
* Get attributes for a Codex item at completion
|
|
1210
|
-
*/
|
|
1211
|
-
getCompletionAttributesForItem(item, skillRootPrefixes = []) {
|
|
1212
|
-
const attrs = {};
|
|
1213
|
-
switch (item.type) {
|
|
1214
|
-
case "command_execution":
|
|
1215
|
-
if (typeof item.exit_code === "number") attrs["codex.exit_code"] = item.exit_code;
|
|
1216
|
-
if (typeof item.status === "string") attrs["codex.status"] = item.status;
|
|
1217
|
-
if (typeof item.aggregated_output === "string") attrs["codex.output"] = this.sanitizeTraceText(item.aggregated_output, "Codex command output trace attribute") ?? "";
|
|
1218
|
-
Object.assign(attrs, this.getSkillTraceAttributes(item, skillRootPrefixes, { requireSuccessfulCommand: true }));
|
|
1219
|
-
break;
|
|
1220
|
-
case "file_change":
|
|
1221
|
-
if (typeof item.status === "string") attrs["codex.status"] = item.status;
|
|
1222
|
-
if (Array.isArray(item.changes) && item.changes.length) {
|
|
1223
|
-
attrs["codex.files_changed"] = item.changes.length;
|
|
1224
|
-
attrs["codex.files"] = item.changes.map((c) => typeof c?.path === "string" ? c.path : "").filter(Boolean).join(", ");
|
|
1225
|
-
}
|
|
1226
|
-
break;
|
|
1227
|
-
case "mcp_tool_call":
|
|
1228
|
-
if (typeof item.status === "string") attrs["codex.status"] = item.status;
|
|
1229
|
-
if (typeof item.error?.message === "string") attrs["codex.error"] = this.sanitizeTraceText(item.error.message, "Codex MCP error trace attribute") ?? "";
|
|
1230
|
-
{
|
|
1231
|
-
const serializedArgs = this.serializeItemValue(item.arguments ?? item.args ?? item.input);
|
|
1232
|
-
if (serializedArgs) attrs["codex.mcp.input"] = serializedArgs;
|
|
1233
|
-
}
|
|
1234
|
-
break;
|
|
1235
|
-
case "agent_message":
|
|
1236
|
-
if (typeof item.text === "string") attrs["codex.message"] = this.sanitizeTraceText(item.text, "Codex agent message trace attribute") ?? "";
|
|
1237
|
-
break;
|
|
1238
|
-
case "reasoning":
|
|
1239
|
-
if (typeof item.text === "string") attrs["codex.reasoning"] = this.sanitizeTraceText(item.text, "Codex reasoning trace attribute") ?? "";
|
|
1240
|
-
break;
|
|
1241
|
-
case "error": if (typeof item.message === "string") attrs["codex.error"] = this.sanitizeTraceText(item.message, "Codex error trace attribute") ?? "";
|
|
1242
|
-
}
|
|
1243
|
-
return attrs;
|
|
1244
|
-
}
|
|
1245
|
-
generateInstanceKey(env, config) {
|
|
1246
|
-
const keyData = {
|
|
1247
|
-
env,
|
|
1248
|
-
base_url: config.base_url,
|
|
1249
|
-
cli_config: this.getResolvedCliConfig(config, env),
|
|
1250
|
-
codex_path_override: config.codex_path_override
|
|
1251
|
-
};
|
|
1252
|
-
return `openai:codex-sdk:instance:${crypto.default.createHash("sha256").update(JSON.stringify(keyData)).digest("hex")}`;
|
|
1253
|
-
}
|
|
1254
|
-
generateCacheKey(config, prompt, instanceKey) {
|
|
1255
|
-
const keyData = {
|
|
1256
|
-
instanceKey,
|
|
1257
|
-
working_dir: config.working_dir,
|
|
1258
|
-
additional_directories: config.additional_directories,
|
|
1259
|
-
model: config.model,
|
|
1260
|
-
output_schema: config.output_schema,
|
|
1261
|
-
sandbox_mode: config.sandbox_mode,
|
|
1262
|
-
model_reasoning_effort: config.model_reasoning_effort,
|
|
1263
|
-
network_access_enabled: config.network_access_enabled,
|
|
1264
|
-
web_search_enabled: config.web_search_enabled,
|
|
1265
|
-
web_search_mode: config.web_search_mode,
|
|
1266
|
-
approval_policy: config.approval_policy,
|
|
1267
|
-
prompt
|
|
1268
|
-
};
|
|
1269
|
-
return `openai:codex-sdk:${crypto.default.createHash("sha256").update(JSON.stringify(keyData)).digest("hex")}`;
|
|
1270
|
-
}
|
|
1271
|
-
getThreadRunQueueKey(config, cacheKey) {
|
|
1272
|
-
if (config.deep_tracing) return;
|
|
1273
|
-
if (config.thread_id) return `explicit:${this.getExplicitThreadIdentity(config)}`;
|
|
1274
|
-
if (config.persist_threads && cacheKey) return cacheKey;
|
|
1275
|
-
}
|
|
1276
|
-
getExplicitThreadCacheKey(config, instanceKey) {
|
|
1277
|
-
const variant = crypto.default.createHash("sha256").update(JSON.stringify({
|
|
1278
|
-
instanceKey,
|
|
1279
|
-
threadOptions: this.buildThreadOptions(config)
|
|
1280
|
-
})).digest("hex");
|
|
1281
|
-
return `${this.getExplicitThreadCachePrefix(config)}${variant}`;
|
|
1282
|
-
}
|
|
1283
|
-
getExplicitThreadCachePrefix(config) {
|
|
1284
|
-
return `explicit:${this.getExplicitThreadIdentity(config)}:`;
|
|
1285
|
-
}
|
|
1286
|
-
getExplicitThreadIdentity(config) {
|
|
1287
|
-
return crypto.default.createHash("sha256").update(config.thread_id ?? "").digest("hex");
|
|
1288
|
-
}
|
|
1289
|
-
async callApi(prompt, context, callOptions) {
|
|
1290
|
-
const cleanupGeneration = this.cleanupGeneration;
|
|
1291
|
-
const mergedConfig = {
|
|
1292
|
-
...this.config,
|
|
1293
|
-
...context?.prompt?.config
|
|
1294
|
-
};
|
|
1295
|
-
delete mergedConfig.provider;
|
|
1296
|
-
const config = require_render.renderVarsInObject(mergedConfig, context?.vars);
|
|
1297
|
-
const inIsolatedWorkspace = require_agentWorkspace.assertIsolatedWorkingDir(config);
|
|
1298
|
-
const requestedModel = typeof config.model === "string" && config.model ? config.model : void 0;
|
|
1299
|
-
return require_genaiTracer.withGenAISpan(this.buildCodexSpanContext(prompt, context, requestedModel), () => this.callApiInternal(prompt, context, callOptions, config, inIsolatedWorkspace, cleanupGeneration), (response) => this.extractCodexSpanResult(response, requestedModel));
|
|
1300
|
-
}
|
|
1301
|
-
buildCodexSpanContext(prompt, context, requestedModel) {
|
|
1302
|
-
return {
|
|
1303
|
-
system: "openai",
|
|
1304
|
-
operationName: "invoke_agent",
|
|
1305
|
-
model: requestedModel ?? "Codex",
|
|
1306
|
-
agentName: "Codex",
|
|
1307
|
-
providerId: this.id(),
|
|
1308
|
-
evalId: context?.evaluationId || context?.test?.metadata?.evaluationId,
|
|
1309
|
-
testIndex: typeof context?.test?.vars?.__testIdx === "number" ? context.test.vars.__testIdx : void 0,
|
|
1310
|
-
promptLabel: context?.prompt?.label,
|
|
1311
|
-
traceparent: context?.traceparent,
|
|
1312
|
-
requestBody: prompt
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
extractCodexSpanResult(response, requestedModel) {
|
|
1316
|
-
const result = {};
|
|
1317
|
-
if (response.tokenUsage) result.tokenUsage = response.tokenUsage;
|
|
1318
|
-
if (response.sessionId) result.responseId = response.sessionId;
|
|
1319
|
-
if (response.cached !== void 0) result.cacheHit = response.cached;
|
|
1320
|
-
if (requestedModel) result.responseModel = requestedModel;
|
|
1321
|
-
this.setCodexSpanResponseBody(result, response.output);
|
|
1322
|
-
this.setCodexSpanRawAttributes(result, response.raw);
|
|
1323
|
-
return result;
|
|
1324
|
-
}
|
|
1325
|
-
setCodexSpanResponseBody(result, output) {
|
|
1326
|
-
if (output === void 0) return;
|
|
1327
|
-
try {
|
|
1328
|
-
result.responseBody = typeof output === "string" ? output : JSON.stringify(output);
|
|
1329
|
-
} catch {
|
|
1330
|
-
result.responseBody = "[unable to serialize output]";
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
setCodexSpanRawAttributes(result, raw) {
|
|
1334
|
-
if (!raw) return;
|
|
1335
|
-
try {
|
|
1336
|
-
const rawData = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
1337
|
-
if (rawData.reasoningTexts?.length > 0) result.additionalAttributes = {
|
|
1338
|
-
...result.additionalAttributes,
|
|
1339
|
-
"codex.reasoning.count": rawData.reasoningTexts.length,
|
|
1340
|
-
"codex.reasoning.summary": rawData.reasoningTexts.join("\n---\n").slice(0, 2e3)
|
|
1341
|
-
};
|
|
1342
|
-
if (rawData.conversationMessages?.length > 0) result.additionalAttributes = {
|
|
1343
|
-
...result.additionalAttributes,
|
|
1344
|
-
"codex.conversation.message_count": rawData.conversationMessages.length
|
|
1345
|
-
};
|
|
1346
|
-
if (rawData.items?.length > 0) result.additionalAttributes = {
|
|
1347
|
-
...result.additionalAttributes,
|
|
1348
|
-
"codex.items.total": rawData.items.length,
|
|
1349
|
-
"codex.items.breakdown": JSON.stringify(this.getCodexItemCounts(rawData.items))
|
|
1350
|
-
};
|
|
1351
|
-
} catch {}
|
|
1352
|
-
}
|
|
1353
|
-
getCodexItemCounts(items) {
|
|
1354
|
-
const itemCounts = {};
|
|
1355
|
-
for (const item of items) itemCounts[item.type] = (itemCounts[item.type] || 0) + 1;
|
|
1356
|
-
return itemCounts;
|
|
1357
|
-
}
|
|
1358
|
-
/**
|
|
1359
|
-
* Internal implementation of callApi without tracing wrapper.
|
|
1360
|
-
* Context is available for future use (e.g., _context?.vars for template rendering,
|
|
1361
|
-
* _context?.bustCache for cache control, _context?.debug for debug mode).
|
|
1362
|
-
*/
|
|
1363
|
-
async callApiInternal(prompt, context, callOptions, rawConfig, inIsolatedWorkspace, cleanupGeneration) {
|
|
1364
|
-
let config;
|
|
1365
|
-
try {
|
|
1366
|
-
config = parseCodexConfig(rawConfig, { stripUnknownKeys: true });
|
|
1367
|
-
} catch (error) {
|
|
1368
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1369
|
-
require_logger.logger.error("Error calling OpenAI Codex SDK", { error: errorMessage });
|
|
1370
|
-
return { error: `Error calling OpenAI Codex SDK: ${errorMessage}` };
|
|
1371
|
-
}
|
|
1372
|
-
const activeTraceparent = require_genaiTracer.getTraceparent();
|
|
1373
|
-
const currentTraceparent = isValidTraceparent(activeTraceparent) ? activeTraceparent : context?.traceparent;
|
|
1374
|
-
const apiKey = this.getApiKey(config);
|
|
1375
|
-
const workingDirectory = require_agentic_utils.resolveAgenticWorkingDir(config.working_dir, require_logger.state.basePath) ?? process.cwd();
|
|
1376
|
-
const additionalDirectories = config.additional_directories?.map((directory) => require_agentic_utils.resolveAgenticWorkingDir(directory, require_logger.state.basePath) ?? directory);
|
|
1377
|
-
const resolvedConfig = {
|
|
1378
|
-
...config,
|
|
1379
|
-
working_dir: workingDirectory,
|
|
1380
|
-
...additionalDirectories ? { additional_directories: additionalDirectories } : {}
|
|
1381
|
-
};
|
|
1382
|
-
const env = this.prepareEnvironment(resolvedConfig, currentTraceparent, apiKey);
|
|
1383
|
-
if (inIsolatedWorkspace) require_agentWorkspace.clearRepositoryEnv(env);
|
|
1384
|
-
const skillRootPrefixes = this.getSkillRootPrefixes(env, resolvedConfig.working_dir);
|
|
1385
|
-
const promptInput = this.parsePromptInput(prompt);
|
|
1386
|
-
if (apiKey) require_logger.logger.debug("[CodexSDK] Using explicit API credentials from promptfoo config/environment");
|
|
1387
|
-
else require_logger.logger.debug("[CodexSDK] No explicit API credentials configured; deferring auth resolution to Codex SDK login state");
|
|
1388
|
-
if (callOptions?.abortSignal?.aborted) return { error: "OpenAI Codex SDK call aborted before it started" };
|
|
1389
|
-
let localInstance = void 0;
|
|
1390
|
-
let useLocalInstance = false;
|
|
1391
|
-
let cacheKey = void 0;
|
|
1392
|
-
try {
|
|
1393
|
-
this.validateWorkingDirectory(resolvedConfig.working_dir, resolvedConfig.skip_git_repo_check);
|
|
1394
|
-
const codexInstance = await this.getCodexInstanceForTurn(env, resolvedConfig, apiKey, cleanupGeneration, callOptions?.abortSignal);
|
|
1395
|
-
const activeInstance = codexInstance.activeInstance;
|
|
1396
|
-
localInstance = codexInstance.localInstance;
|
|
1397
|
-
useLocalInstance = codexInstance.useLocalInstance;
|
|
1398
|
-
const promptCacheBasis = context?.prompt?.raw ?? prompt;
|
|
1399
|
-
cacheKey = this.generateCacheKey(resolvedConfig, promptCacheBasis, codexInstance.instanceKey);
|
|
1400
|
-
const { turn, sessionId } = await this.executeCodexTurn(activeInstance, codexInstance.instanceKey, cacheKey, promptInput, resolvedConfig, callOptions, skillRootPrefixes, cleanupGeneration);
|
|
1401
|
-
return this.buildCodexProviderResponse(turn, sessionId, skillRootPrefixes, resolvedConfig);
|
|
1402
|
-
} catch (error) {
|
|
1403
|
-
if (error instanceof Error && error.name === "AbortError" || callOptions?.abortSignal?.aborted) {
|
|
1404
|
-
require_logger.logger.warn("OpenAI Codex SDK call aborted");
|
|
1405
|
-
return { error: "OpenAI Codex SDK call aborted" };
|
|
1406
|
-
}
|
|
1407
|
-
if (error instanceof CodexCliCompatibilityError) return { error: `Error calling OpenAI Codex SDK: ${error.message}` };
|
|
1408
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1409
|
-
require_logger.logger.error("Error calling OpenAI Codex SDK", { error: errorMessage });
|
|
1410
|
-
return buildCodexRateLimitResponse(error, errorMessage) ?? { error: `Error calling OpenAI Codex SDK: ${errorMessage}` };
|
|
1411
|
-
} finally {
|
|
1412
|
-
await this.cleanupCodexTurn(resolvedConfig, cacheKey, useLocalInstance, localInstance);
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
buildCodexRunOptions(config, callOptions) {
|
|
1416
|
-
return {
|
|
1417
|
-
...config.output_schema ? { outputSchema: config.output_schema } : {},
|
|
1418
|
-
...callOptions?.abortSignal ? { signal: callOptions.abortSignal } : {}
|
|
1419
|
-
};
|
|
1420
|
-
}
|
|
1421
|
-
async getCodexInstanceForTurn(env, resolvedConfig, apiKey, cleanupGeneration, abortSignal) {
|
|
1422
|
-
if (!this.codexSdk) this.codexSdk = await loadCodexSDK();
|
|
1423
|
-
const codexSdk = this.codexSdk;
|
|
1424
|
-
if (cleanupGeneration !== this.cleanupGeneration) throw new Error("Codex SDK call was interrupted by cleanup");
|
|
1425
|
-
await this.ensureCodexCompatibility(env, resolvedConfig, codexSdk.entryPoint, abortSignal);
|
|
1426
|
-
if (cleanupGeneration !== this.cleanupGeneration) throw new Error("Codex SDK call was interrupted by cleanup");
|
|
1427
|
-
require_providerRegistry.providerRegistry.register(this);
|
|
1428
|
-
const stableEnv = { ...env };
|
|
1429
|
-
delete stableEnv.TRACEPARENT;
|
|
1430
|
-
const instanceKey = this.generateInstanceKey(stableEnv, resolvedConfig);
|
|
1431
|
-
if (resolvedConfig.deep_tracing) {
|
|
1432
|
-
this.warnOnceForDeepTracingThreadOptions(resolvedConfig);
|
|
1433
|
-
const localInstance = new codexSdk.module.Codex(this.buildCodexOptions(env, resolvedConfig, apiKey));
|
|
1434
|
-
return {
|
|
1435
|
-
activeInstance: localInstance,
|
|
1436
|
-
instanceKey,
|
|
1437
|
-
localInstance,
|
|
1438
|
-
useLocalInstance: true
|
|
1439
|
-
};
|
|
1440
|
-
}
|
|
1441
|
-
let activeInstance = this.codexInstances.get(instanceKey);
|
|
1442
|
-
if (!activeInstance) {
|
|
1443
|
-
activeInstance = new codexSdk.module.Codex(this.buildCodexOptions(env, resolvedConfig, apiKey));
|
|
1444
|
-
this.codexInstances.set(instanceKey, activeInstance);
|
|
1445
|
-
}
|
|
1446
|
-
return {
|
|
1447
|
-
activeInstance,
|
|
1448
|
-
instanceKey,
|
|
1449
|
-
localInstance: void 0,
|
|
1450
|
-
useLocalInstance: false
|
|
1451
|
-
};
|
|
1452
|
-
}
|
|
1453
|
-
async ensureCodexCompatibility(env, resolvedConfig, sdkEntryPoint, abortSignal) {
|
|
1454
|
-
const codexPathOverride = resolvedConfig.codex_path_override;
|
|
1455
|
-
if (!codexPathOverride) return;
|
|
1456
|
-
if (resolvedConfig.skip_codex_version_check) {
|
|
1457
|
-
if (!this.compatibilitySkipWarningShown) {
|
|
1458
|
-
require_logger.logger.warn("[CodexSDK] Skipping custom Codex binary version compatibility check by explicit configuration.", { codexPathOverride });
|
|
1459
|
-
this.compatibilitySkipWarningShown = true;
|
|
1460
|
-
}
|
|
1461
|
-
return;
|
|
1462
|
-
}
|
|
1463
|
-
const preflightEnv = { ...env };
|
|
1464
|
-
delete preflightEnv.CODEX_API_KEY;
|
|
1465
|
-
delete preflightEnv.OPENAI_API_KEY;
|
|
1466
|
-
delete preflightEnv.TRACEPARENT;
|
|
1467
|
-
delete preflightEnv.OTEL_RESOURCE_ATTRIBUTES;
|
|
1468
|
-
if (abortSignal?.aborted) throw require_agenticRunQueue.createAbortError("Codex compatibility check aborted");
|
|
1469
|
-
const controller = new AbortController();
|
|
1470
|
-
const signal = abortSignal ? AbortSignal.any([abortSignal, controller.signal]) : controller.signal;
|
|
1471
|
-
const compatibilityCheck = Promise.resolve().then(() => checkCodexCliCompatibility({
|
|
1472
|
-
sdkEntryPoint,
|
|
1473
|
-
codexPathOverride,
|
|
1474
|
-
env: preflightEnv,
|
|
1475
|
-
signal
|
|
1476
|
-
}));
|
|
1477
|
-
this.compatibilityChecks.set(controller, compatibilityCheck);
|
|
1478
|
-
try {
|
|
1479
|
-
await compatibilityCheck;
|
|
1480
|
-
} finally {
|
|
1481
|
-
this.compatibilityChecks.delete(controller);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
warnOnceForDeepTracingThreadOptions(resolvedConfig) {
|
|
1485
|
-
if (this.deepTracingWarningShown || !resolvedConfig.persist_threads && !resolvedConfig.thread_id && (resolvedConfig.thread_pool_size ?? 0) <= 1) return;
|
|
1486
|
-
require_logger.logger.warn("[CodexSDK] deep_tracing is incompatible with thread persistence. Thread options (persist_threads, thread_id, thread_pool_size) are ignored when deep_tracing is enabled.");
|
|
1487
|
-
this.deepTracingWarningShown = true;
|
|
1488
|
-
}
|
|
1489
|
-
async executeCodexTurn(activeInstance, instanceKey, cacheKey, promptInput, resolvedConfig, callOptions, skillRootPrefixes, cleanupGeneration) {
|
|
1490
|
-
const queueKey = this.getThreadRunQueueKey(resolvedConfig, cacheKey);
|
|
1491
|
-
const runOptions = this.buildCodexRunOptions(resolvedConfig, callOptions);
|
|
1492
|
-
return this.threadRunQueues.run(queueKey, callOptions?.abortSignal, async () => {
|
|
1493
|
-
if (cleanupGeneration !== this.cleanupGeneration) throw new Error("Codex SDK call was interrupted by cleanup");
|
|
1494
|
-
const thread = await this.getOrCreateThread(resolvedConfig, cacheKey, instanceKey, activeInstance);
|
|
1495
|
-
if (cleanupGeneration !== this.cleanupGeneration) throw new Error("Codex SDK call was interrupted by cleanup");
|
|
1496
|
-
return {
|
|
1497
|
-
turn: resolvedConfig.enable_streaming ? await this.runStreaming(thread, promptInput, runOptions, callOptions, skillRootPrefixes) : await thread.run(promptInput, runOptions),
|
|
1498
|
-
sessionId: thread.id || "unknown"
|
|
1499
|
-
};
|
|
1500
|
-
});
|
|
1501
|
-
}
|
|
1502
|
-
buildCodexProviderResponse(turn, sessionId, skillRootPrefixes, resolvedConfig) {
|
|
1503
|
-
const output = turn.finalResponse || "";
|
|
1504
|
-
const tokenUsage = this.buildCodexTokenUsage(turn.usage);
|
|
1505
|
-
require_logger.logger.debug("OpenAI Codex SDK response", {
|
|
1506
|
-
output,
|
|
1507
|
-
usage: turn.usage
|
|
1508
|
-
});
|
|
1509
|
-
return {
|
|
1510
|
-
output,
|
|
1511
|
-
tokenUsage,
|
|
1512
|
-
cost: this.calculateCodexResponseCost(tokenUsage, this.getCodexBillingModelName(resolvedConfig), Boolean(resolvedConfig.codex_path_override)),
|
|
1513
|
-
metadata: this.buildCodexResponseMetadata(turn.items, skillRootPrefixes),
|
|
1514
|
-
raw: JSON.stringify(turn),
|
|
1515
|
-
sessionId
|
|
1516
|
-
};
|
|
1517
|
-
}
|
|
1518
|
-
buildCodexResponseMetadata(items, skillRootPrefixes) {
|
|
1519
|
-
const skillMetadata = this.buildSkillMetadata(items, skillRootPrefixes);
|
|
1520
|
-
if (!skillMetadata) return;
|
|
1521
|
-
return require_codexSkillMetadata.getCodexSkillMetadataFields(skillMetadata);
|
|
1522
|
-
}
|
|
1523
|
-
buildCodexTokenUsage(turnUsage) {
|
|
1524
|
-
if (!turnUsage) return;
|
|
1525
|
-
const reasoningTokens = turnUsage.reasoning_output_tokens;
|
|
1526
|
-
const cacheWriteTokens = turnUsage.cache_write_input_tokens;
|
|
1527
|
-
const hasCompletionDetails = typeof reasoningTokens === "number" || typeof cacheWriteTokens === "number";
|
|
1528
|
-
return {
|
|
1529
|
-
prompt: turnUsage.input_tokens,
|
|
1530
|
-
completion: turnUsage.output_tokens,
|
|
1531
|
-
total: turnUsage.input_tokens + turnUsage.output_tokens,
|
|
1532
|
-
cached: turnUsage.cached_input_tokens || 0,
|
|
1533
|
-
...hasCompletionDetails ? { completionDetails: {
|
|
1534
|
-
...typeof reasoningTokens === "number" ? { reasoning: reasoningTokens } : {},
|
|
1535
|
-
...typeof cacheWriteTokens === "number" ? { cacheCreationInputTokens: cacheWriteTokens } : {}
|
|
1536
|
-
} } : {}
|
|
1537
|
-
};
|
|
1538
|
-
}
|
|
1539
|
-
calculateCodexResponseCost(tokenUsage, model, usesCustomCodexBinary) {
|
|
1540
|
-
const normalizedModel = model?.replace(/^bedrock:/, "");
|
|
1541
|
-
if (usesCustomCodexBinary && normalizedModel?.startsWith("gpt-5.6")) {
|
|
1542
|
-
const cacheWriteTokens = tokenUsage?.completionDetails?.cacheCreationInputTokens;
|
|
1543
|
-
if (typeof cacheWriteTokens !== "number" || !Number.isFinite(cacheWriteTokens) || cacheWriteTokens <= 0) return;
|
|
1544
|
-
}
|
|
1545
|
-
return require_billing.calculateOpenAIUsageCostFromTokenUsage(model, tokenUsage);
|
|
1546
|
-
}
|
|
1547
|
-
getCodexBillingModelName(config) {
|
|
1548
|
-
const cliConfigProvider = config.cli_config?.model_provider;
|
|
1549
|
-
if ((config.model_provider ?? (typeof cliConfigProvider === "string" ? cliConfigProvider : void 0))?.trim().toLowerCase() === "amazon-bedrock" && config.model !== void 0 && /^openai\.gpt-5\.6(?:-|$)/.test(config.model)) return `bedrock:${config.model.slice(7)}`;
|
|
1550
|
-
return config.model;
|
|
1551
|
-
}
|
|
1552
|
-
async cleanupCodexTurn(resolvedConfig, cacheKey, useLocalInstance, localInstance) {
|
|
1553
|
-
if (!resolvedConfig.deep_tracing && !resolvedConfig.persist_threads && !resolvedConfig.thread_id && cacheKey) this.threads.delete(cacheKey);
|
|
1554
|
-
if (!useLocalInstance || !localInstance) return;
|
|
1555
|
-
try {
|
|
1556
|
-
await this.destroyInstance(localInstance);
|
|
1557
|
-
} catch (cleanupError) {
|
|
1558
|
-
require_logger.logger.debug("[CodexSDK] Error cleaning up local instance", { error: cleanupError });
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
};
|
|
1562
|
-
//#endregion
|
|
1563
|
-
Object.defineProperty(exports, "CODEX_SDK_VERSION_RANGE", {
|
|
1564
|
-
enumerable: true,
|
|
1565
|
-
get: function() {
|
|
1566
|
-
return CODEX_SDK_VERSION_RANGE;
|
|
1567
|
-
}
|
|
1568
|
-
});
|
|
1569
|
-
Object.defineProperty(exports, "OpenAICodexSDKProvider", {
|
|
1570
|
-
enumerable: true,
|
|
1571
|
-
get: function() {
|
|
1572
|
-
return OpenAICodexSDKProvider;
|
|
1573
|
-
}
|
|
1574
|
-
});
|
|
1575
|
-
Object.defineProperty(exports, "codex_sdk_exports", {
|
|
1576
|
-
enumerable: true,
|
|
1577
|
-
get: function() {
|
|
1578
|
-
return codex_sdk_exports;
|
|
1579
|
-
}
|
|
1580
|
-
});
|
|
1581
|
-
Object.defineProperty(exports, "resolveCodexSdkPackage", {
|
|
1582
|
-
enumerable: true,
|
|
1583
|
-
get: function() {
|
|
1584
|
-
return resolveCodexSdkPackage;
|
|
1585
|
-
}
|
|
1586
|
-
});
|
|
1587
|
-
|
|
1588
|
-
//# sourceMappingURL=codex-sdk-BbxjBvBk.cjs.map
|