promptfoo 0.120.24 → 0.120.26
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 +35 -22
- package/dist/src/{ListApp-55OAHww3.js → ListApp-D3DG0F8h.js} +1 -1
- package/dist/src/{accounts-BwVGYllP.cjs → accounts-BzEY8H3v.cjs} +5 -5
- package/dist/src/{accounts-BOlMHrvn.js → accounts-DHHiXsy6.js} +6 -6
- package/dist/src/{accounts-DxR9x_En.js → accounts-R3gfCR_g.js} +5 -5
- package/dist/src/{agentic-utils-t9-1raty.js → agentic-utils-D6_gzOUF.js} +3 -3
- package/dist/src/{agents-DMpQ860j.cjs → agents-C7BiinFI.cjs} +7 -7
- package/dist/src/{agents-9Z7pO8yx.js → agents-Cao4i7AX.js} +8 -8
- package/dist/src/{agents-DjExVR3v.js → agents-Cnph5GLD.js} +2 -2
- package/dist/src/{agents-CI0Ad69d.cjs → agents-CwM7re15.cjs} +5 -5
- package/dist/src/{agents-BwI-Tm5m.js → agents-DETIQHqF.js} +7 -7
- package/dist/src/{agents-CRAmwjo-.js → agents-DYIT-hQy.js} +6 -6
- package/dist/src/{agents-BbIpDhgp.js → agents-GiUianme.js} +5 -5
- package/dist/src/{agents-yL5DzIKY.js → agents-v4cW_ZgC.js} +2 -2
- package/dist/src/{aimlapi-xHHqwNg8.js → aimlapi-CMJpKK-B.js} +13 -13
- package/dist/src/{aimlapi-BM9P45Bp.js → aimlapi-DMF6v_vb.js} +15 -15
- package/dist/src/{aimlapi-DKo7IxJg.cjs → aimlapi-DoGLcQW_.cjs} +14 -14
- package/dist/src/{aimlapi-ivzDkqbs.js → aimlapi-DtSf1ykJ.js} +2 -2
- package/dist/src/app/assets/index-BOgkICuY.css +1 -0
- package/dist/src/app/assets/index-CSgqn_Vd.js +428 -0
- package/dist/src/app/assets/{vendor-charts-DnwydkkY.js → vendor-charts-CYyo8R8v.js} +1 -1
- package/dist/src/app/assets/{vendor-markdown-DjKAU15k.js → vendor-markdown-DSmzq4Jh.js} +1 -1
- package/dist/src/app/assets/vendor-react-AtKqiNEf.js +4 -0
- package/dist/src/app/assets/{vendor-syntax-Dc86c4Bu.js → vendor-syntax-D06x6TQF.js} +1 -1
- package/dist/src/app/index.html +6 -6
- package/dist/src/app/tsconfig.app.tsbuildinfo +1 -1
- package/dist/src/{audio-B3QGL6Nl.cjs → audio-BWjyvHn9.cjs} +4 -4
- package/dist/src/{audio-C-1oBiVZ.js → audio-BrJBFN2b.js} +4 -4
- package/dist/src/{audio-DnfDVjhL.js → audio-DUH4q0Xq.js} +5 -5
- package/dist/src/{audio-DQWHfAr8.js → audio-U580w8jM.js} +2 -2
- package/dist/src/{base-DHam07ip.js → base-BaXmtXYp.js} +3 -3
- package/dist/src/{base-BjsgxJp9.js → base-Dtp8b4_N.js} +3 -3
- package/dist/src/{base-Bso8ccGu.cjs → base-f71xxWai.cjs} +3 -3
- package/dist/src/{blobs-DOdc-E8L.cjs → blobs-673H0jCl.cjs} +3 -3
- package/dist/src/{blobs-Dcm272OH.js → blobs-C9J2mVgo.js} +3 -3
- package/dist/src/{blobs-MlVQyoSc.js → blobs-kt8v3UyH.js} +3 -3
- package/dist/src/{cache-KNsTJLKP.cjs → cache-7xULbvt3.cjs} +35 -8
- package/dist/src/{cache-BMl3AIo5.js → cache-BLLayYEN.js} +24 -9
- package/dist/src/{cache-B0ptF7sO.js → cache-BUPcq0Ad.js} +3 -3
- package/dist/src/cache-CVfRb-HD.cjs +6 -0
- package/dist/src/{cache-DPztwHxt.js → cache-O4EuX2JV.js} +4 -4
- package/dist/src/{cache-DHm8Pc8l.js → cache-mIszOnuz.js} +5 -22
- package/dist/src/{chat-DOQIJx7O.cjs → chat-C4zqjObh.cjs} +10 -10
- package/dist/src/{chat-DDGU7Tik.js → chat-C8Ei4f87.js} +9 -9
- package/dist/src/{chat-BnzIuoTQ.js → chat-CgyGj2hC.js} +12 -12
- package/dist/src/{chat-BRMJOuCv.js → chat-Cpz3O-Xl.js} +14 -14
- package/dist/src/{chat-CVOyOBYk.js → chat-DIywASPG.js} +11 -11
- package/dist/src/{chat-CrnXMbvh.cjs → chat-Fl6TZJRS.cjs} +13 -13
- package/dist/src/{chat-D8GcWK9l.js → chat-XPN9YHhr.js} +2 -2
- package/dist/src/{chatkit-IWIuhxFE.js → chatkit-DEls11hE.js} +4 -4
- package/dist/src/{chatkit-DlOZ-eNb.js → chatkit-DIrJX8xk.js} +4 -4
- package/dist/src/{chatkit-CcktkleS.js → chatkit-Dpxrq4eD.js} +2 -2
- package/dist/src/{chatkit-yeVtURUi.cjs → chatkit-e25Ziu17.cjs} +4 -4
- package/dist/src/{claude-agent-sdk-BiMgSH9g.js → claude-agent-sdk-6-xTaLwM.js} +48 -19
- package/dist/src/{claude-agent-sdk-Yj9Hq0cH.cjs → claude-agent-sdk-BzxF6NIJ.cjs} +48 -19
- package/dist/src/{claude-agent-sdk-rVqlUIJl.js → claude-agent-sdk-CmkTnKGH.js} +49 -20
- package/dist/src/{claude-agent-sdk-yid1kGsL.js → claude-agent-sdk-rXCBLK_o.js} +40 -11
- package/dist/src/{cloud-ByJVRSQI.js → cloud-BMbRVJFw.js} +3 -3
- package/dist/src/cloud-CZ4hytdm.js +5 -0
- package/dist/src/{cloudflare-ai-DmJZcvVx.cjs → cloudflare-ai-BAQ0u_dg.cjs} +14 -14
- package/dist/src/{cloudflare-ai-CWKYPCCF.js → cloudflare-ai-CUg4BTcj.js} +13 -13
- package/dist/src/{cloudflare-ai-goDJ5bwr.js → cloudflare-ai-CobxMTR4.js} +15 -15
- package/dist/src/{cloudflare-ai-CdKv38f6.js → cloudflare-ai-Z9X219gp.js} +2 -2
- package/dist/src/{cloudflare-gateway-BW8hcdB0.cjs → cloudflare-gateway-C0sgfr_z.cjs} +15 -15
- package/dist/src/{cloudflare-gateway-CDCOS1Os.js → cloudflare-gateway-D2_yi-Fh.js} +16 -16
- package/dist/src/{cloudflare-gateway-Dz_HCMGY.js → cloudflare-gateway-Djf3F3_H.js} +2 -2
- package/dist/src/{cloudflare-gateway-gzmTsXcd.js → cloudflare-gateway-_itGuXry.js} +14 -14
- package/dist/src/{codex-sdk-BlvhxMr0.js → codex-sdk-BASDNkIl.js} +90 -34
- package/dist/src/{codex-sdk-BC5qbCjh.js → codex-sdk-dSnGdgIp.js} +92 -36
- package/dist/src/{codex-sdk-CBpm53B8.js → codex-sdk-ibXwdglL.js} +91 -35
- package/dist/src/{codex-sdk-Cf5_CQch.cjs → codex-sdk-wTEpMM_X.cjs} +92 -36
- package/dist/src/{cometapi-DoaO5SLq.js → cometapi-B01btbfb.js} +16 -16
- package/dist/src/{cometapi-BUKGSUCw.js → cometapi-ChAaRjg5.js} +14 -14
- package/dist/src/{cometapi-C6BSw9k3.js → cometapi-DHUAH6nK.js} +2 -2
- package/dist/src/{cometapi-B3TzpkNI.cjs → cometapi-JbvOJSCO.cjs} +15 -15
- package/dist/src/{completion-BLe7SUA4.js → completion-BBJ6zmG3.js} +6 -6
- package/dist/src/{completion-1RAiLcwi.js → completion-D9_MDlnd.js} +6 -6
- package/dist/src/{completion-D6BTVt6e.cjs → completion-DDyL3Cb2.cjs} +6 -6
- package/dist/src/{docker-CkOzlD1W.js → docker-BuButc4D.js} +15 -15
- package/dist/src/{docker-BWsSX8Pn.cjs → docker-Ckw-j7Rr.cjs} +14 -14
- package/dist/src/{docker-CMf5SGLq.js → docker-JAAubMw3.js} +13 -13
- package/dist/src/{docker-C0AzMsuf.js → docker-vnOg96gi.js} +2 -2
- package/dist/src/errors-DnGCbnx8.js +36 -0
- package/dist/src/{esm-gWVPXn3r.cjs → esm-BQkx5roy.cjs} +2 -2
- package/dist/src/{esm-Lh6czAFT.js → esm-CYhseqj4.js} +2 -2
- package/dist/src/{esm-D40XsWlR.js → esm-rDtG_2rg.js} +2 -2
- package/dist/src/eval-CKHWqG9f.js +16 -0
- package/dist/src/{eval-WaSg64w3.js → eval-CYrbG57o.js} +106 -29
- package/dist/src/{evalResult-CGrGU_cG.js → evalResult-6JaUIStC.js} +7 -7
- package/dist/src/{evalResult-C_UM63nn.js → evalResult-COsVttMA.js} +7 -7
- package/dist/src/evalResult-CxTP-LMm.cjs +11 -0
- package/dist/src/evalResult-CzLURDcP.js +13 -0
- package/dist/src/{evalResult-BU4huold.cjs → evalResult-DlRfu_Rq.cjs} +7 -7
- package/dist/src/evalResult-DyttNQ_G.js +11 -0
- package/dist/src/evaluator-0PvfeBYh.js +38 -0
- package/dist/src/{evaluator-gmF3Vddp.js → evaluator-3EJCMTs0.js} +75 -49
- package/dist/src/{extractor-D-RM2m6A.cjs → extractor-DbhlYEeo.cjs} +23 -6
- package/dist/src/{extractor-Da8IxCeS.js → extractor-Hs7la_19.js} +23 -6
- package/dist/src/{extractor-BA90EtLq.js → extractor-LSYjrhK0.js} +23 -6
- package/dist/src/{fetch-BIfcW-Fd.js → fetch-18MuNu9i.js} +21 -7
- package/dist/src/{fetch-CW9GabAi.js → fetch-Bi0o-fdp.js} +2 -2
- package/dist/src/fetch-CMptBDVg.cjs +4 -0
- package/dist/src/fetch-DAZkv3gV.js +6 -0
- package/dist/src/{fetch-Mb7SbeM-.js → fetch-SRsE6Ctl.js} +21 -7
- package/dist/src/{fetch-MvWxCS5U.cjs → fetch-ZMn_oemb.cjs} +21 -7
- package/dist/src/{fileExtensions-CzcPkiKZ.js → fileExtensions-BpuMmaFL.js} +1 -1
- package/dist/src/{formatDuration-CCiZ-wBY.js → formatDuration-Doo0xq-z.js} +1 -1
- package/dist/src/{genaiTracer-BQ8AmajD.cjs → genaiTracer-CQlpZkrp.cjs} +2 -2
- package/dist/src/{genaiTracer-foKtbVa2.js → genaiTracer-CqNnnXrE.js} +1 -1
- package/dist/src/graders-BCytzXrb.js +34 -0
- package/dist/src/{graders-CwtelA9k.js → graders-BaMCwIKp.js} +212 -91
- package/dist/src/graders-CGZQShfJ.cjs +33 -0
- package/dist/src/{graders-2dabIkXs.cjs → graders-DzUUnUjC.cjs} +212 -91
- package/dist/src/{graders-BscQ6O1Q.js → graders-QsALpIdy.js} +211 -90
- package/dist/src/graders-spkuVC-E.js +36 -0
- package/dist/src/{image-Dv0o-Ab7.js → image-BXt_7u0v.js} +4 -4
- package/dist/src/{image-B6TV9l0v.js → image-BiEVdpdP.js} +7 -7
- package/dist/src/{image-DS9hlgSc.cjs → image-C3BjJUAU.cjs} +7 -7
- package/dist/src/{image-_jKUeeh9.js → image-COCWy5dX.js} +2 -2
- package/dist/src/{image-DqElR73O.cjs → image-D10zEe1f.cjs} +4 -4
- package/dist/src/{image-BVEVjrwl.js → image-DB4sHxdJ.js} +5 -5
- package/dist/src/{image-C1i3NoZo.js → image-mhAGP07h.js} +7 -7
- package/dist/src/index.cjs +305 -112
- package/dist/src/index.d.cts +137 -3
- package/dist/src/index.d.ts +137 -3
- package/dist/src/index.js +304 -111
- package/dist/src/{interactiveCheck-CjK2R4rB.js → interactiveCheck-DU-MAhp5.js} +2 -2
- package/dist/src/{knowledgeBase-K5fJN2kC.cjs → knowledgeBase-Bnb00xKs.cjs} +8 -8
- package/dist/src/{knowledgeBase-D-xthvn0.js → knowledgeBase-CMvMlLZR.js} +9 -9
- package/dist/src/{knowledgeBase-DJZHeJqg.js → knowledgeBase-DotRBzUE.js} +2 -2
- package/dist/src/{knowledgeBase-BSs2ldSR.js → knowledgeBase-XJQ0Qyez.js} +8 -8
- package/dist/src/{litellm-kPhaZkzz.js → litellm-BECdjOTx.js} +3 -3
- package/dist/src/{litellm-uRLukY7s.cjs → litellm-BrnZhMcL.cjs} +15 -15
- package/dist/src/{litellm-DH_rVIOd.js → litellm-CHrRmPAe.js} +16 -16
- package/dist/src/{litellm-DoXGHlpD.js → litellm-CrLJrPIm.js} +14 -14
- package/dist/src/{logger-CMp-NS-e.cjs → logger-BdZ-IqBc.cjs} +5 -2
- package/dist/src/{logger-Bzi5o47S.js → logger-BotXmWKW.js} +5 -2
- package/dist/src/{logger-q5I8CByj.js → logger-w8Ozp0Td.js} +5 -2
- package/dist/src/{luma-ray-B3GiVpuq.js → luma-ray-BOeX-h0M.js} +10 -10
- package/dist/src/{luma-ray-CPISsLu-.js → luma-ray-C-w6EsJm.js} +2 -2
- package/dist/src/{luma-ray-BrWrKIIB.cjs → luma-ray-C0RkI3lt.cjs} +10 -10
- package/dist/src/{luma-ray-gyI_GEy2.js → luma-ray-DgKLS0BF.js} +11 -11
- package/dist/src/main.js +3260 -2537
- package/dist/src/{messages-CJgEjRQF.js → messages-CDZYGNlS.js} +13 -10
- package/dist/src/{messages-BMkwrfmt.js → messages-D61tPFQo.js} +14 -11
- package/dist/src/{messages-B5HsO_dM.cjs → messages-DXV3Qh8_.cjs} +14 -11
- package/dist/src/{meteor-CBciquOS.js → meteor-Dj8cTkU_.js} +1 -1
- package/dist/src/{meteor-0cLf9TIn.js → meteor-P2rUE-Uz.js} +1 -1
- package/dist/src/{meteor-BQ6Ws9k2.js → meteor-SLNTgmXm.js} +2 -2
- package/dist/src/{meteor-DRuEfzuQ.cjs → meteor-odmwVbyG.cjs} +1 -1
- package/dist/src/{nova-reel-B5SOonY2.js → nova-reel-Bk5npr2q.js} +11 -11
- package/dist/src/{nova-reel-CT9ZuhJ3.js → nova-reel-C2LFfVTf.js} +2 -2
- package/dist/src/{nova-reel-ByTx85ed.cjs → nova-reel-D9FXq3Mt.cjs} +10 -10
- package/dist/src/{nova-reel-ChM7WaHR.js → nova-reel-DtCjbD5O.js} +10 -10
- package/dist/src/{nova-sonic-D4M3kKYu.js → nova-sonic-BXRfQyF-.js} +8 -8
- package/dist/src/{nova-sonic-C-H3eDvL.cjs → nova-sonic-BoRSY_U6.cjs} +7 -7
- package/dist/src/{nova-sonic-DgifpOKF.js → nova-sonic-CgaWLDM1.js} +7 -7
- package/dist/src/{nova-sonic-BqP59oOu.js → nova-sonic-D_qERM-K.js} +2 -2
- package/dist/src/{openai-BjpdxIOG.cjs → openai-Bigwjgo1.cjs} +2 -2
- package/dist/src/{openai-Cv9pEKxp.js → openai-CT5fwbve.js} +2 -2
- package/dist/src/{openai-CitF-gEN.js → openai-Dz3surb_.js} +2 -2
- package/dist/src/openclaw-B6XY2kUf.js +526 -0
- package/dist/src/openclaw-CpPrXwf6.js +524 -0
- package/dist/src/openclaw-DDSfq5fp.cjs +528 -0
- package/dist/src/openclaw-dHLcXUWZ.js +511 -0
- package/dist/src/{opencode-sdk-Dakn4QMp.js → opencode-sdk-CImWVqy9.js} +7 -7
- package/dist/src/{opencode-sdk-BcLvVMV-.js → opencode-sdk-CuCztr4P.js} +6 -6
- package/dist/src/{opencode-sdk-z7KKOCdB.js → opencode-sdk-DhcfRbBH.js} +3 -3
- package/dist/src/{opencode-sdk-Cqszt4br.cjs → opencode-sdk-mqF-Oj3f.cjs} +6 -6
- package/dist/src/{otlpReceiver-BvmMgacx.cjs → otlpReceiver-B6Xo4KZM.cjs} +6 -6
- package/dist/src/{otlpReceiver-DRNetlJH.js → otlpReceiver-BO0rbDzh.js} +6 -6
- package/dist/src/{otlpReceiver-Bhj_vnzl.js → otlpReceiver-Dg817agV.js} +6 -6
- package/dist/src/{otlpReceiver-Cpnk-Hjf.js → otlpReceiver-DmRb0NBj.js} +2 -2
- package/dist/src/{providerRegistry-D32Lt9vp.js → providerRegistry-Xf0qdqGQ.js} +2 -2
- package/dist/src/{providerRegistry-HGQd2MF6.cjs → providerRegistry-lc7a7utN.cjs} +2 -2
- package/dist/src/{providerRegistry-BdKWcUa8.js → providerRegistry-wCWd7sKQ.js} +2 -2
- package/dist/src/providers-BMZZmPBJ.cjs +32 -0
- package/dist/src/{providers-BWoVY_Wz.cjs → providers-BNKVY53V.cjs} +294 -782
- package/dist/src/{providers-Co_FGgH8.js → providers-BiNq_Iyc.js} +281 -769
- package/dist/src/{providers-CUCHJCHD.js → providers-BlEhY5mi.js} +286 -779
- package/dist/src/providers-CQQrNaJk.js +32 -0
- package/dist/src/providers-Ck8HyrC-.js +34 -0
- package/dist/src/{pythonUtils-rOCm9w_5.cjs → pythonUtils-DZ6EbdY4.cjs} +3 -3
- package/dist/src/{pythonUtils-B9JA-gsC.js → pythonUtils-r1uBuA0n.js} +3 -3
- package/dist/src/{pythonUtils-eNq6Wsfr.js → pythonUtils-vMlk9Qp5.js} +3 -3
- package/dist/src/{quiverai-BpWtOEQZ.cjs → quiverai-BNfIwKCO.cjs} +13 -13
- package/dist/src/{quiverai-Cj-PUa3p.js → quiverai-BQigKdIH.js} +14 -14
- package/dist/src/{quiverai-BN8OVvDE.js → quiverai-Bfy2WnE2.js} +12 -12
- package/dist/src/{quiverai-D5MSsd2c.js → quiverai-CedIP0PJ.js} +2 -2
- package/dist/src/{render-D2710HbA.js → render-CAZvKKkB.js} +4 -4
- package/dist/src/responses-DLLjADw5.js +653 -0
- package/dist/src/responses-TsdODUpm.js +654 -0
- package/dist/src/responses-zOtKtnY_.cjs +671 -0
- package/dist/src/{rubyUtils-Dn6MGcsk.js → rubyUtils-BtjlqyXt.js} +3 -3
- package/dist/src/{rubyUtils-LBsk3zIm.js → rubyUtils-Cs35SDYa.js} +3 -3
- package/dist/src/rubyUtils-D7--T12C.js +6 -0
- package/dist/src/{rubyUtils-rnCVDgH-.cjs → rubyUtils-DCVaJ3mc.cjs} +3 -3
- package/dist/src/rubyUtils-DRRiMFV2.js +5 -0
- package/dist/src/rubyUtils-vb8OYFC-.cjs +5 -0
- package/dist/src/{sagemaker-C8MeZIkH.js → sagemaker-BcgLu0U4.js} +18 -18
- package/dist/src/{sagemaker-4ukMNSN0.js → sagemaker-CLdUAv5z.js} +17 -17
- package/dist/src/{sagemaker-DyVHy2BW.js → sagemaker-Du4LIR97.js} +2 -2
- package/dist/src/{sagemaker-DB3Eojau.cjs → sagemaker-DwNnEVYt.cjs} +17 -17
- package/dist/src/{scanner-C28XVEq2.js → scanner-Dyw21Wg_.js} +12 -12
- package/dist/src/server/index.js +1818 -605
- package/dist/src/server-BUbS0Qfh.js +6 -0
- package/dist/src/{server-BF3HkMhe.js → server-CbMTRQkg.js} +8 -6
- package/dist/src/{server-CSbLW-UI.cjs → server-CgUQ25qW.cjs} +8 -6
- package/dist/src/{server-mycZbUH8.js → server-DWmZLfCy.js} +10 -7
- package/dist/src/server-XpGXFHkS.cjs +6 -0
- package/dist/src/server-gfOx5Zrk.js +8 -0
- package/dist/src/{signal-DM_SPNmi.js → signal-Bl32q42d.js} +3 -3
- package/dist/src/{slack-Ed1yyt_j.js → slack-BfdBx2tO.js} +2 -2
- package/dist/src/{slack-D1F9Y7CH.cjs → slack-BtMkB6xP.cjs} +2 -2
- package/dist/src/{slack-DkAF58Tr.js → slack-DPqj42Ts.js} +2 -2
- package/dist/src/{slack-BK312SXM.js → slack-OZYxoVON.js} +2 -2
- package/dist/src/{store-CT_e5OZX.js → store-2ocbYY9D.js} +3 -3
- package/dist/src/store-5u2yriTV.js +7 -0
- package/dist/src/{store-BpumNYCl.cjs → store-BqwfFEyF.cjs} +3 -3
- package/dist/src/{store-BFLqwuc_.js → store-D4gdn9ih.js} +3 -3
- package/dist/src/store-D_lq_8oQ.js +6 -0
- package/dist/src/store-m5KT6Ly7.cjs +6 -0
- package/dist/src/{tables-Dansasnu.cjs → tables-B9E1kRp-.cjs} +3 -3
- package/dist/src/{tables-BjaApSAB.js → tables-C7TT2XVn.js} +3 -3
- package/dist/src/{tables-Dwexr5Z6.js → tables-D-NSwNIb.js} +3 -3
- package/dist/src/telemetry-5RHFoCJh.js +6 -0
- package/dist/src/{telemetry-MVkZQxt9.js → telemetry-BXyVqyAg.js} +5 -4
- package/dist/src/{telemetry-DFDFKdnr.cjs → telemetry-D0_yFdtU.cjs} +5 -4
- package/dist/src/{telemetry-Ds5Nn81l.js → telemetry-DZ_7PaVq.js} +5 -4
- package/dist/src/telemetry-Do8wMnA-.js +8 -0
- package/dist/src/telemetry-LojxPoFq.cjs +6 -0
- package/dist/src/{text-PYISqVm1.cjs → text-DF2hMKdg.cjs} +1 -1
- package/dist/src/{text-DuYSUYPB.js → text-DgMr_tiM.js} +1 -1
- package/dist/src/{text-Dx0GJOCN.js → text-Dm78AVGG.js} +1 -1
- package/dist/src/{tokenUsageUtils-BtZd3sP7.cjs → tokenUsageUtils-CXhxVj72.cjs} +9 -4
- package/dist/src/{tokenUsageUtils-DoinwgKF.js → tokenUsageUtils-DmZSD2eU.js} +9 -4
- package/dist/src/{tokenUsageUtils-cFdLMERB.js → tokenUsageUtils-FZd5O_4A.js} +9 -4
- package/dist/src/{transcription-Cp19m_Mt.js → transcription-C-M81iDA.js} +2 -2
- package/dist/src/{transcription-CLRpAg07.js → transcription-CYuY5sFO.js} +10 -10
- package/dist/src/{transcription-D8ifIKOv.js → transcription-Ch7S-LWw.js} +11 -11
- package/dist/src/{transcription-CXXFEVM_.cjs → transcription-FNIz3YOe.cjs} +10 -10
- package/dist/src/transform-8eGmaH-7.js +7 -0
- package/dist/src/transform-BRVvWaG4.cjs +6 -0
- package/dist/src/{transform-Bn-lgBE2.js → transform-CoP2bJ7P.js} +44 -5
- package/dist/src/{transform-BFPYuBaW.js → transform-CqTFr7KR.js} +5 -5
- package/dist/src/{transform-DvQWeBSR.js → transform-D8dILpfZ.js} +4 -4
- package/dist/src/{transform-BUrxadlA.js → transform-DMaxQwDx.js} +44 -5
- package/dist/src/transform-GybT0X0u.js +8 -0
- package/dist/src/{transform-DshYLyBq.cjs → transform-Kd6u-oNm.cjs} +4 -4
- package/dist/src/{transform-Bw1IstDE.cjs → transform-ivxEY4f7.cjs} +55 -4
- package/dist/src/{transformersAvailability-BaoWHpu1.cjs → transformersAvailability-Bkep3ka7.cjs} +1 -1
- package/dist/src/{transformersAvailability-Dhh45n5P.js → transformersAvailability-DEU2naS1.js} +1 -1
- package/dist/src/{transformersAvailability-DtpwoeFC.js → transformersAvailability-DkAWaK5B.js} +1 -1
- package/dist/src/{transformersAvailability-O2YaCv9Z.js → transformersAvailability-DwmezkVe.js} +1 -1
- package/dist/src/{types-B-XUqfNs.cjs → types-BIfttHrT.cjs} +22 -2
- package/dist/src/{types-BsU_PxR3.js → types-DMVjYLpx.js} +16 -2
- package/dist/src/{types-CgrxBFgm.js → types-t52w-XsS.js} +19 -3
- package/dist/src/{util-M2MoNCUR.js → util-BSh4a_Q8.js} +7 -7
- package/dist/src/{util-DTJWKLkl.cjs → util-C08Kns6-.cjs} +18 -4
- package/dist/src/{util-DHBpsbZE.js → util-CUEt0Vum.js} +18 -4
- package/dist/src/{util-Bnw6EyZN.js → util-Cl0zfT3V.js} +18 -4
- package/dist/src/{util-C7A-PlKK.cjs → util-DUYOvxAy.cjs} +6 -6
- package/dist/src/{util-WYC3rB_p.js → util-DiCePfDu.js} +6 -6
- package/dist/src/{util-CV99ps44.cjs → util-DkFTvieG.cjs} +17 -5
- package/dist/src/{util-CfepsNVK.js → util-mJ58qbbw.js} +17 -5
- package/dist/src/{util-BZaMVBMq.js → util-vjscpUzy.js} +17 -5
- package/dist/src/{utils-BryuD3vq.js → utils-CVzb4YiI.js} +3 -3
- package/dist/src/{utils-Dezi3MBH.cjs → utils-DFaZa6Rf.cjs} +3 -3
- package/dist/src/{utils-GiyI2K4P.js → utils-JaY9veb5.js} +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +75 -77
- package/dist/src/app/assets/index-07dbAcWK.js +0 -427
- package/dist/src/app/assets/index-DnEcCQgk.css +0 -1
- package/dist/src/app/assets/vendor-react-DHoaNLma.js +0 -4
- package/dist/src/cache-BujOdYlc.cjs +0 -6
- package/dist/src/cloud-BHYz0XkH.js +0 -5
- package/dist/src/eval-0IFf8hON.js +0 -16
- package/dist/src/evalResult-BCCv6FXj.js +0 -13
- package/dist/src/evalResult-C8iVgVvr.js +0 -11
- package/dist/src/evalResult-CqFeWKYx.cjs +0 -11
- package/dist/src/evaluator-DwS5NAEj.js +0 -37
- package/dist/src/fetch-BH9KSaUC.cjs +0 -4
- package/dist/src/fetch-BL6kqunF.js +0 -6
- package/dist/src/graders-BK3LuhJ8.cjs +0 -32
- package/dist/src/graders-Bpjtip-E.js +0 -35
- package/dist/src/graders-KIf6Uej3.js +0 -33
- package/dist/src/providers-41mSodR_.js +0 -31
- package/dist/src/providers-CiZCpIxz.cjs +0 -31
- package/dist/src/providers-G531909f.js +0 -33
- package/dist/src/rubyUtils-BLd6EE1u.cjs +0 -5
- package/dist/src/rubyUtils-CVELPvUH.js +0 -6
- package/dist/src/rubyUtils-_t9Gmf7U.js +0 -5
- package/dist/src/server-Bc4T4XDt.cjs +0 -6
- package/dist/src/server-CMyxJ7ct.js +0 -6
- package/dist/src/server-D9FuxNYE.js +0 -8
- package/dist/src/store-CrMinjmN.cjs +0 -6
- package/dist/src/store-EaWZOoxz.js +0 -7
- package/dist/src/store-KXWnHB15.js +0 -6
- package/dist/src/telemetry-BXD2mCyr.cjs +0 -6
- package/dist/src/telemetry-CYiBm56v.js +0 -8
- package/dist/src/telemetry-lICYKIMB.js +0 -6
- package/dist/src/transform-DZI2t8-9.js +0 -8
- package/dist/src/transform-DZUV3qpO.js +0 -7
- package/dist/src/transform-XcotjzZX.cjs +0 -6
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
const require_logger = require('./logger-BdZ-IqBc.cjs');
|
|
2
|
+
require('./esm-BQkx5roy.cjs');
|
|
3
|
+
require('./pythonUtils-DZ6EbdY4.cjs');
|
|
4
|
+
require('./types-BIfttHrT.cjs');
|
|
5
|
+
require('./util-DUYOvxAy.cjs');
|
|
6
|
+
const require_fetch = require('./fetch-ZMn_oemb.cjs');
|
|
7
|
+
require('./cache-7xULbvt3.cjs');
|
|
8
|
+
require('./genaiTracer-CQlpZkrp.cjs');
|
|
9
|
+
const require_chat = require('./chat-C4zqjObh.cjs');
|
|
10
|
+
require('./transform-ivxEY4f7.cjs');
|
|
11
|
+
const require_responses = require('./responses-zOtKtnY_.cjs');
|
|
12
|
+
require('./openai-Bigwjgo1.cjs');
|
|
13
|
+
require('./util-C08Kns6-.cjs');
|
|
14
|
+
let fs = require("fs");
|
|
15
|
+
fs = require_logger.__toESM(fs);
|
|
16
|
+
let path = require("path");
|
|
17
|
+
path = require_logger.__toESM(path);
|
|
18
|
+
let os = require("os");
|
|
19
|
+
os = require_logger.__toESM(os);
|
|
20
|
+
let crypto = require("crypto");
|
|
21
|
+
crypto = require_logger.__toESM(crypto);
|
|
22
|
+
let ws = require("ws");
|
|
23
|
+
ws = require_logger.__toESM(ws);
|
|
24
|
+
|
|
25
|
+
//#region src/providers/openclaw/shared.ts
|
|
26
|
+
const DEFAULT_GATEWAY_PORT = 18789;
|
|
27
|
+
const DEFAULT_GATEWAY_HOST = "127.0.0.1";
|
|
28
|
+
/**
|
|
29
|
+
* Strip JSON5 syntax (comments and trailing commas) for JSON.parse compatibility.
|
|
30
|
+
* Uses a state machine to avoid corrupting strings containing // or slash characters.
|
|
31
|
+
*/
|
|
32
|
+
function stripJson5Syntax(raw) {
|
|
33
|
+
let result = "";
|
|
34
|
+
let i = 0;
|
|
35
|
+
let inString = false;
|
|
36
|
+
let stringQuote = "";
|
|
37
|
+
let escape = false;
|
|
38
|
+
while (i < raw.length) {
|
|
39
|
+
const ch = raw[i];
|
|
40
|
+
if (inString) {
|
|
41
|
+
result += ch;
|
|
42
|
+
if (escape) escape = false;
|
|
43
|
+
else if (ch === "\\") escape = true;
|
|
44
|
+
else if (ch === stringQuote) inString = false;
|
|
45
|
+
i++;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (ch === "\"" || ch === "'") {
|
|
49
|
+
inString = true;
|
|
50
|
+
stringQuote = ch;
|
|
51
|
+
result += ch;
|
|
52
|
+
i++;
|
|
53
|
+
} else if (ch === "/" && raw[i + 1] === "/") while (i < raw.length && raw[i] !== "\n") i++;
|
|
54
|
+
else if (ch === "/" && raw[i + 1] === "*") {
|
|
55
|
+
i += 2;
|
|
56
|
+
while (i < raw.length - 1 && !(raw[i] === "*" && raw[i + 1] === "/")) i++;
|
|
57
|
+
if (i < raw.length - 1 && raw[i] === "*" && raw[i + 1] === "/") i += 2;
|
|
58
|
+
} else if (ch === ",") {
|
|
59
|
+
let j = i + 1;
|
|
60
|
+
while (j < raw.length && (raw[j] === " " || raw[j] === " " || raw[j] === "\n" || raw[j] === "\r")) j++;
|
|
61
|
+
if (j < raw.length && (raw[j] === "}" || raw[j] === "]")) i++;
|
|
62
|
+
else {
|
|
63
|
+
result += ch;
|
|
64
|
+
i++;
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
result += ch;
|
|
68
|
+
i++;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Cached config to avoid re-reading the file multiple times during provider init.
|
|
75
|
+
*/
|
|
76
|
+
let cachedConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Read and parse the OpenClaw configuration file.
|
|
79
|
+
* Results are cached based on file modification time.
|
|
80
|
+
* Returns undefined if the file doesn't exist or can't be parsed.
|
|
81
|
+
*/
|
|
82
|
+
function readOpenClawConfig() {
|
|
83
|
+
const configPath = path.default.join(os.default.homedir(), ".openclaw", "openclaw.json");
|
|
84
|
+
try {
|
|
85
|
+
if (!fs.default.existsSync(configPath)) return;
|
|
86
|
+
const mtime = fs.default.statSync(configPath).mtimeMs;
|
|
87
|
+
if (cachedConfig && cachedConfig.mtime === mtime) return cachedConfig.config;
|
|
88
|
+
const cleaned = stripJson5Syntax(fs.default.readFileSync(configPath, "utf-8"));
|
|
89
|
+
const config = JSON.parse(cleaned);
|
|
90
|
+
cachedConfig = {
|
|
91
|
+
config,
|
|
92
|
+
mtime
|
|
93
|
+
};
|
|
94
|
+
return config;
|
|
95
|
+
} catch (err) {
|
|
96
|
+
require_logger.logger_default.debug(`Failed to read OpenClaw config at ${configPath}: ${err}`);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Auto-detect the OpenClaw gateway URL from config, env overrides, or environment.
|
|
102
|
+
*/
|
|
103
|
+
function resolveGatewayUrl(config, env) {
|
|
104
|
+
if (config?.gateway_url) return config.gateway_url;
|
|
105
|
+
const envUrl = env?.OPENCLAW_GATEWAY_URL || require_logger.getEnvString("OPENCLAW_GATEWAY_URL");
|
|
106
|
+
if (envUrl) return envUrl;
|
|
107
|
+
const openclawConfig = readOpenClawConfig();
|
|
108
|
+
if (openclawConfig?.gateway) {
|
|
109
|
+
const port = openclawConfig.gateway.port ?? DEFAULT_GATEWAY_PORT;
|
|
110
|
+
const bind = openclawConfig.gateway.bind;
|
|
111
|
+
return `http://${!bind || bind === "loopback" || bind === "0.0.0.0" || bind === "::" ? DEFAULT_GATEWAY_HOST : bind}:${port}`;
|
|
112
|
+
}
|
|
113
|
+
return `http://${DEFAULT_GATEWAY_HOST}:${DEFAULT_GATEWAY_PORT}`;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Auto-detect the OpenClaw gateway auth token from config, env overrides, or environment.
|
|
117
|
+
*/
|
|
118
|
+
function resolveAuthToken(config, env) {
|
|
119
|
+
if (config?.auth_token) return config.auth_token;
|
|
120
|
+
const envToken = env?.OPENCLAW_GATEWAY_TOKEN || require_logger.getEnvString("OPENCLAW_GATEWAY_TOKEN");
|
|
121
|
+
if (envToken) return envToken;
|
|
122
|
+
return readOpenClawConfig()?.gateway?.auth?.token;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Build common OpenClaw headers for agent-id and session-key.
|
|
126
|
+
* Note: thinking_level is only supported by the WS Agent provider and is
|
|
127
|
+
* passed as an RPC param there, not as an HTTP header.
|
|
128
|
+
*/
|
|
129
|
+
function buildOpenClawHeaders(agentId, config) {
|
|
130
|
+
const headers = { "x-openclaw-agent-id": agentId };
|
|
131
|
+
if (config?.session_key) headers["x-openclaw-session-key"] = config.session_key;
|
|
132
|
+
return headers;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Build provider options for OpenAI-compatible OpenClaw providers (chat, responses).
|
|
136
|
+
* Resolves gateway URL, auth token, and merges OpenClaw-specific headers.
|
|
137
|
+
*/
|
|
138
|
+
function buildOpenClawProviderOptions(agentId, providerOptions) {
|
|
139
|
+
const config = providerOptions.config || {};
|
|
140
|
+
const env = providerOptions.env;
|
|
141
|
+
const gatewayUrl = resolveGatewayUrl(config, env);
|
|
142
|
+
const authToken = resolveAuthToken(config, env);
|
|
143
|
+
return {
|
|
144
|
+
...providerOptions,
|
|
145
|
+
config: {
|
|
146
|
+
...config,
|
|
147
|
+
apiBaseUrl: `${gatewayUrl}/v1`,
|
|
148
|
+
...authToken && { apiKey: authToken },
|
|
149
|
+
apiKeyRequired: false,
|
|
150
|
+
headers: {
|
|
151
|
+
...config.headers,
|
|
152
|
+
...buildOpenClawHeaders(agentId, config)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/providers/openclaw/agent.ts
|
|
160
|
+
const OPENCLAW_PROTOCOL_VERSION = 3;
|
|
161
|
+
/**
|
|
162
|
+
* OpenClaw WebSocket Agent Provider
|
|
163
|
+
*
|
|
164
|
+
* Custom provider that uses the native OpenClaw WS RPC protocol to invoke agents.
|
|
165
|
+
* Supports full streaming with event accumulation.
|
|
166
|
+
*
|
|
167
|
+
* Protocol flow:
|
|
168
|
+
* 1. Open WS connection to gateway
|
|
169
|
+
* 2. Receive connect.challenge event → send connect request
|
|
170
|
+
* 3. Receive hello-ok response → send agent request
|
|
171
|
+
* 4. Receive agent accepted response → send agent.wait
|
|
172
|
+
* 5. Accumulate streaming "agent" events (stream: "assistant")
|
|
173
|
+
* 6. Resolve on agent.wait response
|
|
174
|
+
*
|
|
175
|
+
* Usage:
|
|
176
|
+
* openclaw:agent - default agent (main)
|
|
177
|
+
* openclaw:agent:main - explicit agent ID
|
|
178
|
+
* openclaw:agent:my-agent - custom agent ID
|
|
179
|
+
*/
|
|
180
|
+
var OpenClawAgentProvider = class {
|
|
181
|
+
agentId;
|
|
182
|
+
gatewayUrl;
|
|
183
|
+
authToken;
|
|
184
|
+
openclawConfig;
|
|
185
|
+
timeoutMs;
|
|
186
|
+
activeConnections = /* @__PURE__ */ new Set();
|
|
187
|
+
constructor(agentId, providerOptions = {}) {
|
|
188
|
+
this.agentId = agentId;
|
|
189
|
+
this.openclawConfig = providerOptions.config || {};
|
|
190
|
+
const env = providerOptions.env;
|
|
191
|
+
this.gatewayUrl = resolveGatewayUrl(this.openclawConfig, env);
|
|
192
|
+
this.authToken = resolveAuthToken(this.openclawConfig, env);
|
|
193
|
+
this.timeoutMs = this.openclawConfig.timeoutMs ?? require_fetch.REQUEST_TIMEOUT_MS;
|
|
194
|
+
}
|
|
195
|
+
id() {
|
|
196
|
+
return `openclaw:agent:${this.agentId}`;
|
|
197
|
+
}
|
|
198
|
+
toString() {
|
|
199
|
+
return `[OpenClaw Agent Provider ${this.agentId}]`;
|
|
200
|
+
}
|
|
201
|
+
toJSON() {
|
|
202
|
+
return { provider: this.id() };
|
|
203
|
+
}
|
|
204
|
+
async cleanup() {
|
|
205
|
+
for (const ws of this.activeConnections) ws.close();
|
|
206
|
+
this.activeConnections.clear();
|
|
207
|
+
}
|
|
208
|
+
async callApi(prompt) {
|
|
209
|
+
const wsUrl = this.gatewayUrl.replace(/^http(s?):\/\//, "ws$1://");
|
|
210
|
+
return new Promise((resolve) => {
|
|
211
|
+
const ws = new ws.default(wsUrl);
|
|
212
|
+
this.activeConnections.add(ws);
|
|
213
|
+
const agentRequestId = crypto.default.randomUUID();
|
|
214
|
+
const waitRequestId = crypto.default.randomUUID();
|
|
215
|
+
const idempotencyKey = crypto.default.randomUUID();
|
|
216
|
+
let lastText = "";
|
|
217
|
+
let runId;
|
|
218
|
+
let connected = false;
|
|
219
|
+
let resolved = false;
|
|
220
|
+
const timeout = setTimeout(() => {
|
|
221
|
+
if (!resolved) {
|
|
222
|
+
resolved = true;
|
|
223
|
+
ws.close();
|
|
224
|
+
resolve({ error: `OpenClaw agent request timed out after ${this.timeoutMs}ms` });
|
|
225
|
+
}
|
|
226
|
+
}, this.timeoutMs);
|
|
227
|
+
const finish = (result) => {
|
|
228
|
+
if (resolved) return;
|
|
229
|
+
resolved = true;
|
|
230
|
+
clearTimeout(timeout);
|
|
231
|
+
this.activeConnections.delete(ws);
|
|
232
|
+
ws.close();
|
|
233
|
+
resolve(result);
|
|
234
|
+
};
|
|
235
|
+
ws.on("error", (err) => {
|
|
236
|
+
finish({ error: `OpenClaw WebSocket error: ${err.message}` });
|
|
237
|
+
});
|
|
238
|
+
ws.on("close", () => {
|
|
239
|
+
this.activeConnections.delete(ws);
|
|
240
|
+
if (!resolved) finish({ error: "OpenClaw WebSocket connection closed unexpectedly" });
|
|
241
|
+
});
|
|
242
|
+
ws.on("message", (data) => {
|
|
243
|
+
let frame;
|
|
244
|
+
try {
|
|
245
|
+
frame = JSON.parse(data.toString());
|
|
246
|
+
} catch {
|
|
247
|
+
require_logger.logger_default.debug("[OpenClaw Agent] Failed to parse WS frame");
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
require_logger.logger_default.debug("[OpenClaw Agent] Frame received", {
|
|
251
|
+
type: frame.type,
|
|
252
|
+
event: frame.event,
|
|
253
|
+
id: frame.id
|
|
254
|
+
});
|
|
255
|
+
if (frame.type === "event" && frame.event === "connect.challenge") {
|
|
256
|
+
ws.send(JSON.stringify({
|
|
257
|
+
type: "req",
|
|
258
|
+
id: crypto.default.randomUUID(),
|
|
259
|
+
method: "connect",
|
|
260
|
+
params: {
|
|
261
|
+
minProtocol: OPENCLAW_PROTOCOL_VERSION,
|
|
262
|
+
maxProtocol: OPENCLAW_PROTOCOL_VERSION,
|
|
263
|
+
client: {
|
|
264
|
+
id: "gateway-client",
|
|
265
|
+
displayName: "promptfoo",
|
|
266
|
+
version: require_fetch.VERSION,
|
|
267
|
+
platform: process.platform,
|
|
268
|
+
mode: "cli"
|
|
269
|
+
},
|
|
270
|
+
role: "operator",
|
|
271
|
+
scopes: ["operator.read", "operator.write"],
|
|
272
|
+
caps: [],
|
|
273
|
+
commands: [],
|
|
274
|
+
permissions: {},
|
|
275
|
+
...this.authToken && { auth: { token: this.authToken } }
|
|
276
|
+
}
|
|
277
|
+
}));
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (frame.type === "res" && !connected) {
|
|
281
|
+
if (!frame.ok) {
|
|
282
|
+
finish({ error: `OpenClaw connect failed: ${frame.error?.message || "unknown error"}` });
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
connected = true;
|
|
286
|
+
ws.send(JSON.stringify({
|
|
287
|
+
type: "req",
|
|
288
|
+
id: agentRequestId,
|
|
289
|
+
method: "agent",
|
|
290
|
+
params: {
|
|
291
|
+
message: prompt,
|
|
292
|
+
agentId: this.agentId,
|
|
293
|
+
idempotencyKey,
|
|
294
|
+
...this.openclawConfig.session_key && { sessionKey: this.openclawConfig.session_key },
|
|
295
|
+
...this.openclawConfig.thinking_level && { thinking: this.openclawConfig.thinking_level }
|
|
296
|
+
}
|
|
297
|
+
}));
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (frame.type === "res" && frame.id === agentRequestId) {
|
|
301
|
+
if (!frame.ok) {
|
|
302
|
+
finish({ error: `OpenClaw agent error: ${frame.error?.message || "unknown error"}` });
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
runId = frame.payload?.runId;
|
|
306
|
+
if (runId) ws.send(JSON.stringify({
|
|
307
|
+
type: "req",
|
|
308
|
+
id: waitRequestId,
|
|
309
|
+
method: "agent.wait",
|
|
310
|
+
params: {
|
|
311
|
+
runId,
|
|
312
|
+
timeoutMs: this.timeoutMs
|
|
313
|
+
}
|
|
314
|
+
}));
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (frame.type === "event" && frame.event === "agent") {
|
|
318
|
+
const payload = frame.payload;
|
|
319
|
+
if (payload?.runId && runId && payload.runId !== runId) return;
|
|
320
|
+
if (payload?.stream === "assistant" && payload?.data?.text) lastText = payload.data.text;
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (frame.type === "res" && frame.id === waitRequestId) {
|
|
324
|
+
if (frame.ok) finish({ output: lastText || "No output from agent" });
|
|
325
|
+
else finish({ error: `OpenClaw agent error: ${frame.error?.message || "unknown error"}` });
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/providers/openclaw/chat.ts
|
|
335
|
+
/**
|
|
336
|
+
* OpenClaw chat provider extends OpenAI chat completion provider.
|
|
337
|
+
*
|
|
338
|
+
* OpenClaw exposes an OpenAI-compatible HTTP API at /v1/chat/completions.
|
|
339
|
+
* This provider auto-detects gateway URL and auth token from:
|
|
340
|
+
* 1. Explicit config (gateway_url, auth_token)
|
|
341
|
+
* 2. Environment variables (OPENCLAW_GATEWAY_URL, OPENCLAW_GATEWAY_TOKEN)
|
|
342
|
+
* 3. ~/.openclaw/openclaw.json
|
|
343
|
+
*
|
|
344
|
+
* Usage:
|
|
345
|
+
* openclaw - default agent (main)
|
|
346
|
+
* openclaw:main - specific agent
|
|
347
|
+
* openclaw:coding-agent - named agent
|
|
348
|
+
*/
|
|
349
|
+
var OpenClawChatProvider = class extends require_chat.OpenAiChatCompletionProvider {
|
|
350
|
+
agentId;
|
|
351
|
+
constructor(agentId, providerOptions = {}) {
|
|
352
|
+
super(`openclaw:${agentId}`, buildOpenClawProviderOptions(agentId, providerOptions));
|
|
353
|
+
this.agentId = agentId;
|
|
354
|
+
}
|
|
355
|
+
id() {
|
|
356
|
+
return `openclaw:${this.agentId}`;
|
|
357
|
+
}
|
|
358
|
+
toString() {
|
|
359
|
+
return `[OpenClaw Provider ${this.agentId}]`;
|
|
360
|
+
}
|
|
361
|
+
getApiUrlDefault() {
|
|
362
|
+
return `http://${DEFAULT_GATEWAY_HOST}:${DEFAULT_GATEWAY_PORT}/v1`;
|
|
363
|
+
}
|
|
364
|
+
getApiKey() {
|
|
365
|
+
return this.config.apiKey;
|
|
366
|
+
}
|
|
367
|
+
getApiUrl() {
|
|
368
|
+
return this.config.apiBaseUrl || this.getApiUrlDefault();
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/providers/openclaw/responses.ts
|
|
374
|
+
/**
|
|
375
|
+
* OpenClaw Responses API Provider
|
|
376
|
+
*
|
|
377
|
+
* Extends OpenAI Responses API provider with OpenClaw-specific configuration.
|
|
378
|
+
* Routes through the OpenClaw gateway's /v1/responses endpoint.
|
|
379
|
+
*
|
|
380
|
+
* Requires `gateway.http.endpoints.responses.enabled=true` in OpenClaw config.
|
|
381
|
+
*
|
|
382
|
+
* Usage:
|
|
383
|
+
* openclaw:responses - default agent (main)
|
|
384
|
+
* openclaw:responses:main - explicit agent ID
|
|
385
|
+
* openclaw:responses:X - custom agent ID
|
|
386
|
+
*/
|
|
387
|
+
var OpenClawResponsesProvider = class extends require_responses.OpenAiResponsesProvider {
|
|
388
|
+
agentId;
|
|
389
|
+
constructor(agentId, providerOptions = {}) {
|
|
390
|
+
super(`openclaw:${agentId}`, buildOpenClawProviderOptions(agentId, providerOptions));
|
|
391
|
+
this.agentId = agentId;
|
|
392
|
+
}
|
|
393
|
+
id() {
|
|
394
|
+
return `openclaw:responses:${this.agentId}`;
|
|
395
|
+
}
|
|
396
|
+
toString() {
|
|
397
|
+
return `[OpenClaw Responses Provider ${this.agentId}]`;
|
|
398
|
+
}
|
|
399
|
+
getApiUrlDefault() {
|
|
400
|
+
return `http://${DEFAULT_GATEWAY_HOST}:${DEFAULT_GATEWAY_PORT}/v1`;
|
|
401
|
+
}
|
|
402
|
+
getApiKey() {
|
|
403
|
+
return this.config.apiKey;
|
|
404
|
+
}
|
|
405
|
+
getApiUrl() {
|
|
406
|
+
return this.config.apiBaseUrl || this.getApiUrlDefault();
|
|
407
|
+
}
|
|
408
|
+
async getOpenAiBody(prompt, context, callApiOptions) {
|
|
409
|
+
const result = await super.getOpenAiBody(prompt, context, callApiOptions);
|
|
410
|
+
if ("text" in result.body) delete result.body.text;
|
|
411
|
+
return result;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/providers/openclaw/tools.ts
|
|
417
|
+
/**
|
|
418
|
+
* OpenClaw Tool Invoke Provider
|
|
419
|
+
*
|
|
420
|
+
* Simple HTTP provider for direct tool invocation via POST /tools/invoke.
|
|
421
|
+
* The tool name is extracted from the provider path: openclaw:tools:bash → tool="bash"
|
|
422
|
+
*
|
|
423
|
+
* The prompt is parsed as JSON for tool arguments. If it's not valid JSON,
|
|
424
|
+
* it's passed as a single `input` argument.
|
|
425
|
+
*
|
|
426
|
+
* Usage:
|
|
427
|
+
* openclaw:tools:bash - invoke the bash tool
|
|
428
|
+
* openclaw:tools:agents_list - invoke the agents_list tool
|
|
429
|
+
*/
|
|
430
|
+
var OpenClawToolInvokeProvider = class {
|
|
431
|
+
toolName;
|
|
432
|
+
gatewayUrl;
|
|
433
|
+
authToken;
|
|
434
|
+
openclawConfig;
|
|
435
|
+
timeoutMs;
|
|
436
|
+
constructor(toolName, providerOptions = {}) {
|
|
437
|
+
this.toolName = toolName;
|
|
438
|
+
this.openclawConfig = providerOptions.config || {};
|
|
439
|
+
const env = providerOptions.env;
|
|
440
|
+
this.gatewayUrl = resolveGatewayUrl(this.openclawConfig, env);
|
|
441
|
+
this.authToken = resolveAuthToken(this.openclawConfig, env);
|
|
442
|
+
this.timeoutMs = this.openclawConfig.timeoutMs ?? require_fetch.REQUEST_TIMEOUT_MS;
|
|
443
|
+
}
|
|
444
|
+
id() {
|
|
445
|
+
return `openclaw:tools:${this.toolName}`;
|
|
446
|
+
}
|
|
447
|
+
toString() {
|
|
448
|
+
return `[OpenClaw Tool Provider ${this.toolName}]`;
|
|
449
|
+
}
|
|
450
|
+
toJSON() {
|
|
451
|
+
return { provider: this.id() };
|
|
452
|
+
}
|
|
453
|
+
async callApi(prompt) {
|
|
454
|
+
let args;
|
|
455
|
+
try {
|
|
456
|
+
args = JSON.parse(prompt);
|
|
457
|
+
} catch {
|
|
458
|
+
args = { input: prompt };
|
|
459
|
+
}
|
|
460
|
+
const url = `${this.gatewayUrl}/tools/invoke`;
|
|
461
|
+
const headers = { "Content-Type": "application/json" };
|
|
462
|
+
if (this.authToken) headers["Authorization"] = `Bearer ${this.authToken}`;
|
|
463
|
+
const body = {
|
|
464
|
+
tool: this.toolName,
|
|
465
|
+
args,
|
|
466
|
+
...this.openclawConfig.session_key && { sessionKey: this.openclawConfig.session_key }
|
|
467
|
+
};
|
|
468
|
+
require_logger.logger_default.debug(`[OpenClaw Tool] POST ${url}`, {
|
|
469
|
+
tool: this.toolName,
|
|
470
|
+
args
|
|
471
|
+
});
|
|
472
|
+
try {
|
|
473
|
+
const controller = new AbortController();
|
|
474
|
+
const fetchTimeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
475
|
+
const response = await require_fetch.fetchWithProxy(url, {
|
|
476
|
+
method: "POST",
|
|
477
|
+
headers,
|
|
478
|
+
body: JSON.stringify(body),
|
|
479
|
+
signal: controller.signal
|
|
480
|
+
}).finally(() => clearTimeout(fetchTimeout));
|
|
481
|
+
if (!response.ok) {
|
|
482
|
+
const text = await response.text();
|
|
483
|
+
return { error: `OpenClaw tool invoke failed (${response.status}): ${text}` };
|
|
484
|
+
}
|
|
485
|
+
const data = await response.json();
|
|
486
|
+
if (data.ok) return { output: typeof data.result === "string" ? data.result : JSON.stringify(data.result) };
|
|
487
|
+
return { error: data.error || "Unknown tool error" };
|
|
488
|
+
} catch (err) {
|
|
489
|
+
return { error: `OpenClaw tool invoke error: ${err instanceof Error ? err.message : String(err)}` };
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region src/providers/openclaw/index.ts
|
|
496
|
+
/**
|
|
497
|
+
* Create an OpenClaw provider from a provider path string.
|
|
498
|
+
*
|
|
499
|
+
* Routing:
|
|
500
|
+
* openclaw → OpenClawChatProvider('main')
|
|
501
|
+
* openclaw:main → OpenClawChatProvider('main')
|
|
502
|
+
* openclaw:my-agent → OpenClawChatProvider('my-agent')
|
|
503
|
+
* openclaw:responses → OpenClawResponsesProvider('main')
|
|
504
|
+
* openclaw:responses:X → OpenClawResponsesProvider('X')
|
|
505
|
+
* openclaw:agent → OpenClawAgentProvider('main')
|
|
506
|
+
* openclaw:agent:X → OpenClawAgentProvider('X')
|
|
507
|
+
* openclaw:tools:bash → OpenClawToolInvokeProvider('bash')
|
|
508
|
+
*/
|
|
509
|
+
function createOpenClawProvider(providerPath, providerOptions = {}, env) {
|
|
510
|
+
const splits = providerPath.split(":");
|
|
511
|
+
const keyword = splits[1];
|
|
512
|
+
const opts = {
|
|
513
|
+
...providerOptions,
|
|
514
|
+
env
|
|
515
|
+
};
|
|
516
|
+
if (keyword === "responses") return new OpenClawResponsesProvider(splits[2] || "main", opts);
|
|
517
|
+
if (keyword === "agent") return new OpenClawAgentProvider(splits[2] || "main", opts);
|
|
518
|
+
if (keyword === "tools") {
|
|
519
|
+
const toolName = splits.slice(2).join(":");
|
|
520
|
+
if (!toolName) throw new Error("OpenClaw tools provider requires a tool name: openclaw:tools:<tool-name>");
|
|
521
|
+
return new OpenClawToolInvokeProvider(toolName, opts);
|
|
522
|
+
}
|
|
523
|
+
return new OpenClawChatProvider(splits.length > 1 ? splits.slice(1).join(":") : "main", opts);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
//#endregion
|
|
527
|
+
exports.createOpenClawProvider = createOpenClawProvider;
|
|
528
|
+
//# sourceMappingURL=openclaw-DDSfq5fp.cjs.map
|