promptfoo 0.120.26 → 0.121.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 +1 -1
- package/dist/drizzle/0023_wooden_mandrill.sql +2 -0
- package/dist/drizzle/meta/0023_snapshot.json +1496 -0
- package/dist/drizzle/meta/_journal.json +7 -0
- package/dist/src/{ListApp-D3DG0F8h.js → ListApp-Du7YVwj5.js} +2 -4
- package/dist/src/accounts-BgNJDBE6.js +206 -0
- package/dist/src/{accounts-BzEY8H3v.cjs → accounts-Bx-x3bmW.cjs} +99 -80
- package/dist/src/{accounts-DHHiXsy6.js → accounts-CMqkzrVf.js} +61 -36
- package/dist/src/{accounts-R3gfCR_g.js → accounts-xrUGFA6n.js} +60 -35
- package/dist/src/{agentic-utils-D6_gzOUF.js → agentic-utils-BKIN5PKu.js} +9 -10
- package/dist/src/{agents-CwM7re15.cjs → agents-B0f4HICh.cjs} +37 -40
- package/dist/src/{agents-Cnph5GLD.js → agents-C-dDThPK.js} +37 -37
- package/dist/src/{agents-C7BiinFI.cjs → agents-CErsqg5U.cjs} +19 -27
- package/dist/src/{agents-v4cW_ZgC.js → agents-CVIn-Utx.js} +19 -22
- package/dist/src/{agents-GiUianme.js → agents-CXknwsFX.js} +37 -40
- package/dist/src/{agents-DETIQHqF.js → agents-DeH4Gu94.js} +21 -28
- package/dist/src/{agents-DYIT-hQy.js → agents-Dy2YpZpa.js} +38 -41
- package/dist/src/{agents-Cao4i7AX.js → agents-aF4-T121.js} +19 -30
- package/dist/src/{aimlapi-DMF6v_vb.js → aimlapi-BAGZDo5G.js} +16 -18
- package/dist/src/{aimlapi-CMJpKK-B.js → aimlapi-BNfTBexL.js} +15 -17
- package/dist/src/{aimlapi-DtSf1ykJ.js → aimlapi-DHRKlBEA.js} +15 -4
- package/dist/src/{aimlapi-DoGLcQW_.cjs → aimlapi-tg0Gkcvr.cjs} +15 -16
- package/dist/src/app/assets/index-BFCZg7hQ.js +439 -0
- package/dist/src/app/assets/index-NCn4eVBv.css +1 -0
- package/dist/src/app/assets/{vendor-charts-CYyo8R8v.js → vendor-charts-CCl15Imd.js} +1 -1
- package/dist/src/app/assets/{vendor-markdown-DSmzq4Jh.js → vendor-markdown-0tekx3KX.js} +1 -1
- package/dist/src/app/index.html +4 -34
- package/dist/src/{audio-DUH4q0Xq.js → audio-BRODU0UK.js} +7 -9
- package/dist/src/{audio-BWjyvHn9.cjs → audio-BWeaWovU.cjs} +6 -7
- package/dist/src/{audio-U580w8jM.js → audio-CHQ4r-RV.js} +6 -5
- package/dist/src/{audio-BrJBFN2b.js → audio-tf_NBjlC.js} +6 -8
- package/dist/src/base-B0tcrnq_.js +193 -0
- package/dist/src/base-B4QJRyFS.js +194 -0
- package/dist/src/base-DBtwl2FR.cjs +222 -0
- package/dist/src/base-fEDN28WM.js +193 -0
- package/dist/src/{blobs-kt8v3UyH.js → blobs-BAU-dXan.js} +9 -12
- package/dist/src/{blobs-C9J2mVgo.js → blobs-Bpg5rH6i.js} +9 -12
- package/dist/src/{blobs-673H0jCl.cjs → blobs-DvS-O6be.cjs} +34 -37
- package/dist/src/blobs-qTYm-1PY.js +236 -0
- package/dist/src/{cache-BLLayYEN.js → cache-8XhNqPKW.js} +64 -67
- package/dist/src/cache-Bbn1Nyrd.cjs +5 -0
- package/dist/src/cache-BwsMSda7.js +6 -0
- package/dist/src/{cache-mIszOnuz.js → cache-CG0SlR1d.js} +64 -66
- package/dist/src/{cache-7xULbvt3.cjs → cache-COish3-W.cjs} +114 -117
- package/dist/src/cache-D3eqDYGU.js +739 -0
- package/dist/src/{chat-Fl6TZJRS.cjs → chat-2K608PeQ.cjs} +20 -21
- package/dist/src/chat-BKm79wib.js +764 -0
- package/dist/src/{chat-XPN9YHhr.js → chat-CM_kyI8B.js} +20 -9
- package/dist/src/{chat-DIywASPG.js → chat-CRWNNq73.js} +49 -49
- package/dist/src/{chat-C8Ei4f87.js → chat-CznLWr_D.js} +49 -49
- package/dist/src/{chat-CgyGj2hC.js → chat-DHMH-N64.js} +20 -22
- package/dist/src/{chat-C4zqjObh.cjs → chat-DaqekjFr.cjs} +69 -69
- package/dist/src/{chat-Cpz3O-Xl.js → chat-DxysjBvt.js} +21 -23
- package/dist/src/{chatkit-Dpxrq4eD.js → chatkit-65VXf5SR.js} +58 -58
- package/dist/src/{chatkit-DIrJX8xk.js → chatkit-Be-Q-a9F.js} +58 -60
- package/dist/src/{chatkit-DEls11hE.js → chatkit-BxFvW8KY.js} +58 -60
- package/dist/src/{chatkit-e25Ziu17.cjs → chatkit-DKyPi1Gs.cjs} +58 -60
- package/dist/src/chunk-DEq-mXcV.js +15 -0
- package/dist/src/chunk-DRamLcfz.js +16 -0
- package/dist/src/{claude-agent-sdk-6-xTaLwM.js → claude-agent-sdk-BLTu0WBO.js} +45 -31
- package/dist/src/{claude-agent-sdk-BzxF6NIJ.cjs → claude-agent-sdk-CJH22shf.cjs} +44 -29
- package/dist/src/{claude-agent-sdk-CmkTnKGH.js → claude-agent-sdk-D6_k9FKA.js} +45 -33
- package/dist/src/{claude-agent-sdk-rXCBLK_o.js → claude-agent-sdk-Dy5lT-Tx.js} +46 -21
- package/dist/src/{cloud-BMbRVJFw.js → cloud-Bc9526yV.js} +32 -12
- package/dist/src/cloud-DmE0EwsY.js +4 -0
- package/dist/src/{cloudflare-ai-CUg4BTcj.js → cloudflare-ai-C9r2sRhw.js} +16 -18
- package/dist/src/{cloudflare-ai-Z9X219gp.js → cloudflare-ai-CWWJCRim.js} +16 -4
- package/dist/src/{cloudflare-ai-BAQ0u_dg.cjs → cloudflare-ai-ClWSdor4.cjs} +16 -17
- package/dist/src/{cloudflare-ai-CobxMTR4.js → cloudflare-ai-ICsOuD-z.js} +17 -19
- package/dist/src/{cloudflare-gateway-C0sgfr_z.cjs → cloudflare-gateway-C2_-KG5o.cjs} +21 -22
- package/dist/src/{cloudflare-gateway-_itGuXry.js → cloudflare-gateway-D6O7AlYb.js} +23 -23
- package/dist/src/{cloudflare-gateway-D2_yi-Fh.js → cloudflare-gateway-D6xFc5pa.js} +21 -25
- package/dist/src/{cloudflare-gateway-Djf3F3_H.js → cloudflare-gateway-pXGHxJ47.js} +26 -14
- package/dist/src/{codex-sdk-ibXwdglL.js → codex-sdk-C6UMlxwV.js} +49 -32
- package/dist/src/{codex-sdk-BASDNkIl.js → codex-sdk-DUwKWezN.js} +49 -30
- package/dist/src/{codex-sdk-dSnGdgIp.js → codex-sdk-GGAw0qbD.js} +49 -32
- package/dist/src/{codex-sdk-wTEpMM_X.cjs → codex-sdk-fAO0c3yA.cjs} +49 -32
- package/dist/src/{cometapi-B01btbfb.js → cometapi-BasUi7-_.js} +17 -19
- package/dist/src/{cometapi-DHUAH6nK.js → cometapi-Bbjp5V4x.js} +16 -4
- package/dist/src/{cometapi-ChAaRjg5.js → cometapi-DkXrKi5z.js} +21 -24
- package/dist/src/{cometapi-JbvOJSCO.cjs → cometapi-vY6aDZgo.cjs} +21 -22
- package/dist/src/{completion-D9_MDlnd.js → completion-6Mx_iXxK.js} +11 -13
- package/dist/src/{completion-BBJ6zmG3.js → completion-C5rtR_9P.js} +11 -13
- package/dist/src/{completion-DDyL3Cb2.cjs → completion-CDOouNzq.cjs} +21 -23
- package/dist/src/completion-C_P3ypkJ.js +120 -0
- package/dist/src/createHash-CTQmL3G2.js +15 -0
- package/dist/src/createHash-CfZSc0b4.cjs +27 -0
- package/dist/src/createHash-Da8fMwqB.js +16 -0
- package/dist/src/createHash-DmPQkvBh.js +15 -0
- package/dist/src/{docker-JAAubMw3.js → docker-5KcG-_86.js} +18 -20
- package/dist/src/{docker-Ckw-j7Rr.cjs → docker-BwsKwxFs.cjs} +18 -19
- package/dist/src/{docker-vnOg96gi.js → docker-CZnqU1XV.js} +18 -7
- package/dist/src/{docker-BuButc4D.js → docker-DzxyDPIj.js} +19 -21
- package/dist/src/entrypoint.js +2 -3
- package/dist/src/{errors-DnGCbnx8.js → errors-P6ll7XSJ.js} +2 -2
- package/dist/src/{esm-CYhseqj4.js → esm-C03C-mv3.js} +17 -20
- package/dist/src/{esm-rDtG_2rg.js → esm-CaIwzWR5.js} +18 -21
- package/dist/src/esm-Cd1AjG1D.js +379 -0
- package/dist/src/{esm-BQkx5roy.cjs → esm-CnNt7sI4.cjs} +47 -49
- package/dist/src/eval-17JizQIv.js +15 -0
- package/dist/src/{eval-CYrbG57o.js → eval-DmFyWU7i.js} +49 -55
- package/dist/src/{evalResult-COsVttMA.js → evalResult-CDQiuUuf.js} +16 -12
- package/dist/src/{evalResult-6JaUIStC.js → evalResult-CTG2AHOS.js} +10 -11
- package/dist/src/evalResult-Cqj8pldJ.js +12 -0
- package/dist/src/{evalResult-DlRfu_Rq.cjs → evalResult-Dap2CekP.cjs} +20 -21
- package/dist/src/evalResult-DvcJAWJU.cjs +10 -0
- package/dist/src/evalResult-Hftn-S_i.js +10 -0
- package/dist/src/evaluator-B2CFNt-P.js +36 -0
- package/dist/src/{evaluator-3EJCMTs0.js → evaluator-DPFRbFIL.js} +210 -232
- package/dist/src/{extractor-LSYjrhK0.js → extractor-CFG6bcWJ.js} +23 -38
- package/dist/src/{extractor-DbhlYEeo.cjs → extractor-DX36oYEv.cjs} +37 -64
- package/dist/src/{extractor-Hs7la_19.js → extractor-M67RUtg6.js} +23 -38
- package/dist/src/extractor-YMU_Gvt8.js +374 -0
- package/dist/src/fetch-4M3YRaqL.js +780 -0
- package/dist/src/{fetch-18MuNu9i.js → fetch-60Gzydls.js} +60 -46
- package/dist/src/{fetch-SRsE6Ctl.js → fetch-BMv0O527.js} +41 -35
- package/dist/src/{fetch-ZMn_oemb.cjs → fetch-BxUk8odA.cjs} +268 -279
- package/dist/src/fetch-KV5kNASw.js +5 -0
- package/dist/src/{fileExtensions-ePDqouxn.js → fileExtensions-DnqA1y9x.js} +2 -2
- package/dist/src/{fileExtensions-BpuMmaFL.js → fileExtensions-Ds-foDzt.js} +2 -2
- package/dist/src/fileExtensions-LcDYkU4v.js +85 -0
- package/dist/src/{fileExtensions-DkJYkWUy.cjs → fileExtensions-bYh77CN8.cjs} +27 -28
- package/dist/src/{formatDuration-Doo0xq-z.js → formatDuration-DgBVMN65.js} +2 -2
- package/dist/src/{genaiTracer-Ce19n68P.js → genaiTracer-70Z8BIuV.js} +2 -3
- package/dist/src/{genaiTracer-CqNnnXrE.js → genaiTracer-C1rxGO8Q.js} +2 -3
- package/dist/src/genaiTracer-D3fD9dNV.js +256 -0
- package/dist/src/{genaiTracer-CQlpZkrp.cjs → genaiTracer-DN4dQywX.cjs} +13 -14
- package/dist/src/graders-Bu0H9nXi.js +32 -0
- package/dist/src/{graders-BaMCwIKp.js → graders-CHO8EPM4.js} +385 -417
- package/dist/src/graders-Cfhkvx-e.js +34 -0
- package/dist/src/{graders-QsALpIdy.js → graders-CpdqD9PI.js} +385 -417
- package/dist/src/graders-DClJVpGP.cjs +32 -0
- package/dist/src/{graders-DzUUnUjC.cjs → graders-DOXycdlG.cjs} +721 -753
- package/dist/src/graders-DcnJsrMO.js +32 -0
- package/dist/src/graders-R9rYUM0d.js +13466 -0
- package/dist/src/{image-BiEVdpdP.js → image-BmEZqVmk.js} +57 -18
- package/dist/src/{image-mhAGP07h.js → image-CBBVXWuT.js} +57 -18
- package/dist/src/{image-D10zEe1f.cjs → image-CDLQOcqT.cjs} +6 -7
- package/dist/src/{image-COCWy5dX.js → image-DJEvKveK.js} +6 -5
- package/dist/src/{image-C3BjJUAU.cjs → image-DTedmQPg.cjs} +77 -32
- package/dist/src/{image-DB4sHxdJ.js → image-gvmivTEe.js} +7 -9
- package/dist/src/image-pAX56tPG.js +257 -0
- package/dist/src/{image-BXt_7u0v.js → image-tL5hIOFh.js} +6 -8
- package/dist/src/index.cjs +696 -693
- package/dist/src/index.d.cts +113 -10
- package/dist/src/index.d.ts +113 -6
- package/dist/src/index.js +657 -658
- package/dist/src/{interactiveCheck-DU-MAhp5.js → interactiveCheck-BgLZUIt3.js} +7 -8
- package/dist/src/{invariant-DT20jrBd.js → invariant-BtWWVVhl.js} +2 -2
- package/dist/src/{invariant-1pAf2CD1.js → invariant-Ddh24eXh.js} +2 -2
- package/dist/src/{invariant-CKcJAQ6M.cjs → invariant-kfQ8Bu82.cjs} +7 -8
- package/dist/src/invariant-vgHWClmd.js +25 -0
- package/dist/src/{knowledgeBase-DotRBzUE.js → knowledgeBase-CLJybhnF.js} +19 -34
- package/dist/src/{knowledgeBase-XJQ0Qyez.js → knowledgeBase-CoU-UQBg.js} +17 -41
- package/dist/src/{knowledgeBase-CMvMlLZR.js → knowledgeBase-DjWPVqSb.js} +17 -43
- package/dist/src/{knowledgeBase-Bnb00xKs.cjs → knowledgeBase-wkxuRFhA.cjs} +17 -40
- package/dist/src/{litellm-CHrRmPAe.js → litellm-B9Hysuri.js} +16 -18
- package/dist/src/{litellm-CrLJrPIm.js → litellm-CTfa0hqi.js} +15 -17
- package/dist/src/{litellm-BrnZhMcL.cjs → litellm-NYpQ8RQu.cjs} +15 -16
- package/dist/src/{litellm-BECdjOTx.js → litellm-ePxtr9F1.js} +15 -4
- package/dist/src/{logger-w8Ozp0Td.js → logger-CT3IKMKA.js} +24 -41
- package/dist/src/{logger-BdZ-IqBc.cjs → logger-Cp1GPUjj.cjs} +166 -192
- package/dist/src/logger-DLcq4dWf.js +713 -0
- package/dist/src/{logger-BotXmWKW.js → logger-KkObSCzq.js} +27 -43
- package/dist/src/{luma-ray-C0RkI3lt.cjs → luma-ray-B0GGNRc1.cjs} +20 -21
- package/dist/src/{luma-ray-C-w6EsJm.js → luma-ray-BE2mOt6N.js} +20 -13
- package/dist/src/{luma-ray-BOeX-h0M.js → luma-ray-BW9IRGIc.js} +22 -21
- package/dist/src/{luma-ray-DgKLS0BF.js → luma-ray-Cm1KZBhs.js} +20 -23
- package/dist/src/main.js +1985 -2055
- package/dist/src/{messages-DXV3Qh8_.cjs → messages-1JrJs91T.cjs} +35 -34
- package/dist/src/{messages-D61tPFQo.js → messages-1x9atZmP.js} +25 -24
- package/dist/src/{messages-CDZYGNlS.js → messages-BLbWdsyt.js} +25 -24
- package/dist/src/messages-D8EA0oDc.js +240 -0
- package/dist/src/{meteor-P2rUE-Uz.js → meteor-44VjEACX.js} +3 -4
- package/dist/src/{meteor-SLNTgmXm.js → meteor-D-SotUw9.js} +3 -4
- package/dist/src/{meteor-odmwVbyG.cjs → meteor-DLZZ3osF.cjs} +3 -4
- package/dist/src/{meteor-Dj8cTkU_.js → meteor-DUiCJRC-.js} +3 -4
- package/dist/src/modelslab-C1OLRmVX.js +166 -0
- package/dist/src/modelslab-CqXBy3U8.js +168 -0
- package/dist/src/modelslab-DcOSFwKh.cjs +166 -0
- package/dist/src/modelslab-X5-4LroM.js +166 -0
- package/dist/src/{nova-reel-C2LFfVTf.js → nova-reel-BgS1ZWuK.js} +20 -13
- package/dist/src/{nova-reel-DtCjbD5O.js → nova-reel-D2ZkOSyr.js} +22 -21
- package/dist/src/{nova-reel-D9FXq3Mt.cjs → nova-reel-D9xfaMBs.cjs} +20 -21
- package/dist/src/{nova-reel-Bk5npr2q.js → nova-reel-DihqLeol.js} +20 -23
- package/dist/src/{nova-sonic-BoRSY_U6.cjs → nova-sonic-DVu3mMIy.cjs} +30 -31
- package/dist/src/{nova-sonic-D_qERM-K.js → nova-sonic-DezhVUYT.js} +30 -26
- package/dist/src/{nova-sonic-CgaWLDM1.js → nova-sonic-P-CdUMlV.js} +30 -31
- package/dist/src/{nova-sonic-BXRfQyF-.js → nova-sonic-Q3BOJeig.js} +31 -32
- package/dist/src/{openai-Bigwjgo1.cjs → openai-Cuif0GEt.cjs} +8 -9
- package/dist/src/{openai-Dz3surb_.js → openai-DElQ-fPX.js} +3 -4
- package/dist/src/{openai-CT5fwbve.js → openai-DhbB7eWK.js} +3 -4
- package/dist/src/openai-j-sE2O7r.js +44 -0
- package/dist/src/{openclaw-dHLcXUWZ.js → openclaw-BiSZPL7J.js} +20 -14
- package/dist/src/{openclaw-CpPrXwf6.js → openclaw-Bv1DINsX.js} +20 -27
- package/dist/src/{openclaw-B6XY2kUf.js → openclaw-D1D_ej1z.js} +21 -28
- package/dist/src/{openclaw-DDSfq5fp.cjs → openclaw-DAfWQn-o.cjs} +33 -39
- package/dist/src/opencode-sdk-C7m-wRfI.js +560 -0
- package/dist/src/opencode-sdk-CfaLN8PY.cjs +564 -0
- package/dist/src/opencode-sdk-D95s6SnR.js +562 -0
- package/dist/src/opencode-sdk-DxUPkLT7.js +560 -0
- package/dist/src/{otlpReceiver-DmRb0NBj.js → otlpReceiver--AIRW_S4.js} +53 -51
- package/dist/src/{otlpReceiver-Dg817agV.js → otlpReceiver-Bn5wGB1v.js} +53 -55
- package/dist/src/{otlpReceiver-B6Xo4KZM.cjs → otlpReceiver-Diec4cln.cjs} +53 -55
- package/dist/src/{otlpReceiver-BO0rbDzh.js → otlpReceiver-g3ByGaXs.js} +53 -55
- package/dist/src/{providerRegistry-Xf0qdqGQ.js → providerRegistry-B0RUOLI_.js} +7 -8
- package/dist/src/{providerRegistry-wCWd7sKQ.js → providerRegistry-CD8MEar9.js} +7 -8
- package/dist/src/{providerRegistry-lc7a7utN.cjs → providerRegistry-Civky8Ar.cjs} +12 -13
- package/dist/src/providerRegistry-DM8rZYol.js +45 -0
- package/dist/src/providers-B3HvufyI.js +33246 -0
- package/dist/src/{providers-BiNq_Iyc.js → providers-BKRJTjBz.js} +1743 -1795
- package/dist/src/providers-C1rOSHiR.js +32 -0
- package/dist/src/{providers-BlEhY5mi.js → providers-CFLy1_ji.js} +1750 -1802
- package/dist/src/{providers-BNKVY53V.cjs → providers-CFu-TZl-.cjs} +2111 -2163
- package/dist/src/providers-CxmDwEFf.cjs +31 -0
- package/dist/src/providers-Dodakqr0.js +30 -0
- package/dist/src/providers-GIQ2TcsA.js +30 -0
- package/dist/src/{pythonUtils-r1uBuA0n.js → pythonUtils-C3py6GC1.js} +18 -19
- package/dist/src/{pythonUtils-DZ6EbdY4.cjs → pythonUtils-CTU3Y3lw.cjs} +42 -43
- package/dist/src/{pythonUtils-vMlk9Qp5.js → pythonUtils-D5nxkQ0P.js} +18 -19
- package/dist/src/pythonUtils-D6fwaDSg.js +249 -0
- package/dist/src/quiverai-C2jVwbH1.js +213 -0
- package/dist/src/quiverai-CI6gYJVI.js +213 -0
- package/dist/src/quiverai-CLkWkyZc.cjs +213 -0
- package/dist/src/quiverai-MHSxbmmZ.js +215 -0
- package/dist/src/{render-CAZvKKkB.js → render-Drod8m7K.js} +4 -5
- package/dist/src/{responses-DLLjADw5.js → responses-BKqJmhhc.js} +34 -27
- package/dist/src/{responses-TsdODUpm.js → responses-CGw0DCzh.js} +34 -27
- package/dist/src/responses-jxdehPkC.js +660 -0
- package/dist/src/{responses-zOtKtnY_.cjs → responses-tD4Bd4dc.cjs} +49 -42
- package/dist/src/rubyUtils-BUHu6PhO.js +5 -0
- package/dist/src/{rubyUtils-Cs35SDYa.js → rubyUtils-BUVePouc.js} +27 -20
- package/dist/src/rubyUtils-BcuGX77l.js +222 -0
- package/dist/src/{rubyUtils-BtjlqyXt.js → rubyUtils-Boc4HZzX.js} +18 -19
- package/dist/src/rubyUtils-CP42kMvq.cjs +4 -0
- package/dist/src/{rubyUtils-DCVaJ3mc.cjs → rubyUtils-DhCAlxZr.cjs} +48 -50
- package/dist/src/{sagemaker-Du4LIR97.js → sagemaker-BK4Zb993.js} +75 -70
- package/dist/src/{sagemaker-CLdUAv5z.js → sagemaker-BfiWTmvn.js} +77 -77
- package/dist/src/{sagemaker-DwNnEVYt.cjs → sagemaker-CcQHM1jV.cjs} +75 -76
- package/dist/src/{sagemaker-BcgLu0U4.js → sagemaker-D2Q1c-sD.js} +75 -79
- package/dist/src/{scanner-Dyw21Wg_.js → scanner-J8CA3LsV.js} +149 -122
- package/dist/src/server/index.js +5620 -67302
- package/dist/src/{server-CgUQ25qW.cjs → server-B0PPuDw-.cjs} +57 -67
- package/dist/src/server-B1vi21hA.js +7 -0
- package/dist/src/{server-CbMTRQkg.js → server-BC7XJFgr.js} +19 -24
- package/dist/src/server-Cm9Kai_h.cjs +5 -0
- package/dist/src/{server-DWmZLfCy.js → server-DbFphssR.js} +26 -29
- package/dist/src/server-OAs3nBRT.js +229 -0
- package/dist/src/{signal-Bl32q42d.js → signal-BOTbd53Z.js} +9 -11
- package/dist/src/{slack-BtMkB6xP.cjs → slack-BmVAVGaK.cjs} +7 -8
- package/dist/src/{slack-OZYxoVON.js → slack-DCUPTzS2.js} +8 -8
- package/dist/src/{slack-DPqj42Ts.js → slack-DOdy_kyv.js} +7 -8
- package/dist/src/{slack-BfdBx2tO.js → slack-DXMKtA-f.js} +7 -9
- package/dist/src/store-BNmZ1KAz.cjs +5 -0
- package/dist/src/{store-BqwfFEyF.cjs → store-BSc-TF2w.cjs} +44 -45
- package/dist/src/store-BltJg2cd.js +6 -0
- package/dist/src/{store-D4gdn9ih.js → store-D1tv90v3.js} +34 -35
- package/dist/src/{store-2ocbYY9D.js → store-DQLEjuEO.js} +40 -36
- package/dist/src/store-Ub2vaGJ1.js +228 -0
- package/dist/src/{tables-D-NSwNIb.js → tables-5EvT_Bwn.js} +23 -23
- package/dist/src/{tables-B9E1kRp-.cjs → tables-C7K-XKWp.cjs} +93 -93
- package/dist/src/{tables-C7TT2XVn.js → tables-D36WTqKX.js} +25 -25
- package/dist/src/tables-xKANLRBD.js +288 -0
- package/dist/src/telemetry-5BCRNBbe.cjs +5 -0
- package/dist/src/{telemetry-DZ_7PaVq.js → telemetry-C15ziL8u.js} +17 -14
- package/dist/src/{telemetry-BXyVqyAg.js → telemetry-C2YDkUQH.js} +11 -13
- package/dist/src/{telemetry-D0_yFdtU.cjs → telemetry-CbrnxHp_.cjs} +21 -24
- package/dist/src/telemetry-D4W5hboe.js +7 -0
- package/dist/src/telemetry-DMb2Mpfm.js +171 -0
- package/dist/src/{text-Dm78AVGG.js → text-B_UCRPp2.js} +2 -2
- package/dist/src/{text-DF2hMKdg.cjs → text-CW1cyrwj.cjs} +12 -13
- package/dist/src/{text-DgMr_tiM.js → text-Db-Wt2u2.js} +2 -2
- package/dist/src/text-TIv0QYnd.js +22 -0
- package/dist/src/{tokenUsageUtils-FZd5O_4A.js → tokenUsageUtils-BDGe-iyI.js} +2 -2
- package/dist/src/{tokenUsageUtils-DmZSD2eU.js → tokenUsageUtils-DflFMjS0.js} +2 -2
- package/dist/src/tokenUsageUtils-NYT-WKS6.js +138 -0
- package/dist/src/{tokenUsageUtils-CXhxVj72.cjs → tokenUsageUtils-bVa1ga6f.cjs} +32 -33
- package/dist/src/{transcription-FNIz3YOe.cjs → transcription-CL78qbOU.cjs} +14 -15
- package/dist/src/{transcription-C-M81iDA.js → transcription-DAtxHhAM.js} +14 -7
- package/dist/src/{transcription-CYuY5sFO.js → transcription-LNZTNUUL.js} +14 -16
- package/dist/src/{transcription-Ch7S-LWw.js → transcription-QHh3AH6Z.js} +15 -17
- package/dist/src/{transform-CoP2bJ7P.js → transform-Cgi24fJ7.js} +94 -66
- package/dist/src/{transform-Kd6u-oNm.cjs → transform-CzK1Q0zl.cjs} +24 -26
- package/dist/src/{transform-D8dILpfZ.js → transform-DECvGmzp.js} +15 -13
- package/dist/src/{transform-DMaxQwDx.js → transform-DGLazrMm.js} +94 -66
- package/dist/src/transform-DGxXocjk.js +1506 -0
- package/dist/src/{transform-ivxEY4f7.cjs → transform-DOcQeLld.cjs} +234 -206
- package/dist/src/transform-DTGDnAzW.js +6 -0
- package/dist/src/{transform-CqTFr7KR.js → transform-DilY9wbS.js} +10 -12
- package/dist/src/transform-aa6tmVpZ.js +216 -0
- package/dist/src/transform-m3qNw4KP.cjs +5 -0
- package/dist/src/{transformersAvailability-DEU2naS1.js → transformersAvailability-CEVM2GNQ.js} +2 -2
- package/dist/src/{transformersAvailability-Bkep3ka7.cjs → transformersAvailability-CwayUSlh.cjs} +2 -3
- package/dist/src/{transformersAvailability-DwmezkVe.js → transformersAvailability-D6c6ROpT.js} +2 -2
- package/dist/src/{types-t52w-XsS.js → types-CH3Ge2sE.js} +103 -92
- package/dist/src/{types-DMVjYLpx.js → types-CLKiCBW3.js} +98 -91
- package/dist/src/types-CN_TZ2GJ.js +3260 -0
- package/dist/src/{types-BIfttHrT.cjs → types-LJ0r3wbR.cjs} +573 -566
- package/dist/src/util-5cB-L7U3.js +1430 -0
- package/dist/src/util-6-GqIvzS.js +599 -0
- package/dist/src/{util-vjscpUzy.js → util-B7T3SiBS.js} +5 -6
- package/dist/src/{util-Cl0zfT3V.js → util-Betm42rL.js} +44 -17
- package/dist/src/{util-CUEt0Vum.js → util-C-PPYSMq.js} +44 -17
- package/dist/src/{util-DkFTvieG.cjs → util-CchiqXh_.cjs} +35 -36
- package/dist/src/{util-mJ58qbbw.js → util-DaWTWKBK.js} +5 -6
- package/dist/src/{util-C08Kns6-.cjs → util-Db0a0AFH.cjs} +89 -62
- package/dist/src/{util-DiCePfDu.js → util-Dlz_Wvgm.js} +102 -53
- package/dist/src/{util-BSh4a_Q8.js → util-YT5HPZaS.js} +102 -53
- package/dist/src/{util-DUYOvxAy.cjs → util-Yz-1aEhW.cjs} +274 -219
- package/dist/src/util-ZZH-3QZz.js +293 -0
- package/dist/src/{utils-DFaZa6Rf.cjs → utils-Cz9qXqII.cjs} +32 -35
- package/dist/src/{utils-CVzb4YiI.js → utils-XiOAgly5.js} +4 -7
- package/dist/src/utils-dLokC-eR.js +94 -0
- package/dist/src/{utils-JaY9veb5.js → utils-f2-Moju7.js} +4 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +59 -53
- package/dist/src/app/assets/index-BOgkICuY.css +0 -1
- package/dist/src/app/assets/index-CSgqn_Vd.js +0 -428
- package/dist/src/app/tsconfig.app.tsbuildinfo +0 -1
- package/dist/src/base-BaXmtXYp.js +0 -107
- package/dist/src/base-Dtp8b4_N.js +0 -106
- package/dist/src/base-f71xxWai.cjs +0 -111
- package/dist/src/cache-BUPcq0Ad.js +0 -6
- package/dist/src/cache-CVfRb-HD.cjs +0 -6
- package/dist/src/cache-O4EuX2JV.js +0 -8
- package/dist/src/chunk-DHDDz29n.js +0 -22
- package/dist/src/chunk-FhC4c-0y.js +0 -21
- package/dist/src/cloud-CZ4hytdm.js +0 -5
- package/dist/src/eval-CKHWqG9f.js +0 -16
- package/dist/src/evalResult-CxTP-LMm.cjs +0 -11
- package/dist/src/evalResult-CzLURDcP.js +0 -13
- package/dist/src/evalResult-DyttNQ_G.js +0 -11
- package/dist/src/evaluator-0PvfeBYh.js +0 -38
- package/dist/src/fetch-Bi0o-fdp.js +0 -4
- package/dist/src/fetch-CMptBDVg.cjs +0 -4
- package/dist/src/fetch-DAZkv3gV.js +0 -6
- package/dist/src/graders-BCytzXrb.js +0 -34
- package/dist/src/graders-CGZQShfJ.cjs +0 -33
- package/dist/src/graders-spkuVC-E.js +0 -36
- package/dist/src/opencode-sdk-CImWVqy9.js +0 -382
- package/dist/src/opencode-sdk-CuCztr4P.js +0 -380
- package/dist/src/opencode-sdk-DhcfRbBH.js +0 -376
- package/dist/src/opencode-sdk-mqF-Oj3f.cjs +0 -383
- package/dist/src/providers-BMZZmPBJ.cjs +0 -32
- package/dist/src/providers-CQQrNaJk.js +0 -32
- package/dist/src/providers-Ck8HyrC-.js +0 -34
- package/dist/src/quiverai-BNfIwKCO.cjs +0 -54
- package/dist/src/quiverai-BQigKdIH.js +0 -57
- package/dist/src/quiverai-Bfy2WnE2.js +0 -55
- package/dist/src/quiverai-CedIP0PJ.js +0 -43
- package/dist/src/rubyUtils-D7--T12C.js +0 -6
- package/dist/src/rubyUtils-DRRiMFV2.js +0 -5
- package/dist/src/rubyUtils-vb8OYFC-.cjs +0 -5
- package/dist/src/server-BUbS0Qfh.js +0 -6
- package/dist/src/server-XpGXFHkS.cjs +0 -6
- package/dist/src/server-gfOx5Zrk.js +0 -8
- package/dist/src/store-5u2yriTV.js +0 -7
- package/dist/src/store-D_lq_8oQ.js +0 -6
- package/dist/src/store-m5KT6Ly7.cjs +0 -6
- package/dist/src/telemetry-5RHFoCJh.js +0 -6
- package/dist/src/telemetry-Do8wMnA-.js +0 -8
- package/dist/src/telemetry-LojxPoFq.cjs +0 -6
- package/dist/src/transform-8eGmaH-7.js +0 -7
- package/dist/src/transform-BRVvWaG4.cjs +0 -6
- package/dist/src/transform-GybT0X0u.js +0 -8
- package/dist/src/transformersAvailability-DkAWaK5B.js +0 -35
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
const require_logger = require(
|
|
2
|
-
const require_esm = require(
|
|
3
|
-
const require_fileExtensions = require(
|
|
4
|
-
const require_util = require(
|
|
5
|
-
const require_fetch = require(
|
|
6
|
-
const require_cache = require(
|
|
7
|
-
const require_openai = require(
|
|
8
|
-
const require_util$1 = require(
|
|
1
|
+
const require_logger = require("./logger-Cp1GPUjj.cjs");
|
|
2
|
+
const require_esm = require("./esm-CnNt7sI4.cjs");
|
|
3
|
+
const require_fileExtensions = require("./fileExtensions-bYh77CN8.cjs");
|
|
4
|
+
const require_util = require("./util-Yz-1aEhW.cjs");
|
|
5
|
+
const require_fetch = require("./fetch-BxUk8odA.cjs");
|
|
6
|
+
const require_cache = require("./cache-COish3-W.cjs");
|
|
7
|
+
const require_openai = require("./openai-Cuif0GEt.cjs");
|
|
8
|
+
const require_util$1 = require("./util-Db0a0AFH.cjs");
|
|
9
9
|
let path = require("path");
|
|
10
10
|
path = require_logger.__toESM(path);
|
|
11
|
-
|
|
12
11
|
//#region src/providers/functionCallbackUtils.ts
|
|
13
12
|
/**
|
|
14
13
|
* Handles function callback execution for AI providers.
|
|
@@ -46,7 +45,7 @@ var FunctionCallbackHandler = class {
|
|
|
46
45
|
isError: false
|
|
47
46
|
};
|
|
48
47
|
} catch (error) {
|
|
49
|
-
require_logger.
|
|
48
|
+
require_logger.logger.debug(`Function callback failed for ${functionInfo.name}: ${error}`);
|
|
50
49
|
return {
|
|
51
50
|
output: typeof call === "string" ? call : JSON.stringify(call),
|
|
52
51
|
isError: true
|
|
@@ -116,8 +115,8 @@ var FunctionCallbackHandler = class {
|
|
|
116
115
|
if (splits[0] && require_fileExtensions.isJavascriptFile(splits[0])) [filePath, functionName] = splits;
|
|
117
116
|
}
|
|
118
117
|
try {
|
|
119
|
-
const resolvedPath = path.default.resolve(require_logger.
|
|
120
|
-
require_logger.
|
|
118
|
+
const resolvedPath = path.default.resolve(require_logger.state.basePath || "", filePath);
|
|
119
|
+
require_logger.logger.debug(`Loading function from ${resolvedPath}${functionName ? `:${functionName}` : ""}`);
|
|
121
120
|
const mod = await require_esm.importModule(resolvedPath);
|
|
122
121
|
const func = functionName && mod[functionName] ? mod[functionName] : mod.default || mod;
|
|
123
122
|
if (typeof func !== "function") throw new Error(`Expected ${resolvedPath}${functionName ? `:${functionName}` : ""} to export a function, got ${typeof func}`);
|
|
@@ -159,7 +158,7 @@ var FunctionCallbackHandler = class {
|
|
|
159
158
|
};
|
|
160
159
|
} catch (error) {
|
|
161
160
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
162
|
-
require_logger.
|
|
161
|
+
require_logger.logger.debug(`MCP tool execution failed for ${toolName}: ${errorMessage}`);
|
|
163
162
|
return {
|
|
164
163
|
output: `MCP Tool Error (${toolName}): ${errorMessage}`,
|
|
165
164
|
isError: true
|
|
@@ -180,7 +179,6 @@ var FunctionCallbackHandler = class {
|
|
|
180
179
|
this.loadedCallbacks = {};
|
|
181
180
|
}
|
|
182
181
|
};
|
|
183
|
-
|
|
184
182
|
//#endregion
|
|
185
183
|
//#region src/providers/responses/processor.ts
|
|
186
184
|
/**
|
|
@@ -232,7 +230,7 @@ var ResponsesProcessor = class {
|
|
|
232
230
|
this.config = config;
|
|
233
231
|
}
|
|
234
232
|
async processResponseOutput(data, requestConfig, cached) {
|
|
235
|
-
require_logger.
|
|
233
|
+
require_logger.logger.debug(`Processing ${this.config.providerType} responses output`, {
|
|
236
234
|
responseId: data.id,
|
|
237
235
|
model: data.model
|
|
238
236
|
});
|
|
@@ -257,7 +255,7 @@ var ResponsesProcessor = class {
|
|
|
257
255
|
if (requestConfig.response_format?.type === "json_schema" && typeof finalOutput === "string") try {
|
|
258
256
|
finalOutput = JSON.parse(finalOutput);
|
|
259
257
|
} catch (error) {
|
|
260
|
-
require_logger.
|
|
258
|
+
require_logger.logger.error(`Failed to parse JSON output: ${error}`);
|
|
261
259
|
}
|
|
262
260
|
const result = {
|
|
263
261
|
output: finalOutput,
|
|
@@ -277,7 +275,7 @@ var ResponsesProcessor = class {
|
|
|
277
275
|
}
|
|
278
276
|
}
|
|
279
277
|
async processOutput(output, context) {
|
|
280
|
-
if (this.config.modelName.includes("deep-research")) require_logger.
|
|
278
|
+
if (this.config.modelName.includes("deep-research")) require_logger.logger.debug(`Deep research response structure: ${JSON.stringify(context.data, null, 2)}`);
|
|
281
279
|
if (!output || !Array.isArray(output) || output.length === 0) throw new Error("Invalid response format: Missing output array");
|
|
282
280
|
let result = "";
|
|
283
281
|
let refusal = "";
|
|
@@ -285,7 +283,7 @@ var ResponsesProcessor = class {
|
|
|
285
283
|
const annotations = [];
|
|
286
284
|
for (const item of output) {
|
|
287
285
|
if (!item || typeof item !== "object") {
|
|
288
|
-
require_logger.
|
|
286
|
+
require_logger.logger.warn(`Skipping invalid output item: ${JSON.stringify(item)}`);
|
|
289
287
|
continue;
|
|
290
288
|
}
|
|
291
289
|
const processed = await this.processOutputItem(item, context);
|
|
@@ -315,7 +313,7 @@ var ResponsesProcessor = class {
|
|
|
315
313
|
case "mcp_call": return this.processMcpCall(item);
|
|
316
314
|
case "mcp_approval_request": return this.processMcpApprovalRequest(item);
|
|
317
315
|
default:
|
|
318
|
-
require_logger.
|
|
316
|
+
require_logger.logger.debug(`Unknown output item type: ${item.type}`);
|
|
319
317
|
return {};
|
|
320
318
|
}
|
|
321
319
|
}
|
|
@@ -338,7 +336,7 @@ var ResponsesProcessor = class {
|
|
|
338
336
|
const annotations = [];
|
|
339
337
|
if (item.content) for (const contentItem of item.content) {
|
|
340
338
|
if (!contentItem || typeof contentItem !== "object") {
|
|
341
|
-
require_logger.
|
|
339
|
+
require_logger.logger.warn(`Skipping invalid content item: ${JSON.stringify(contentItem)}`);
|
|
342
340
|
continue;
|
|
343
341
|
}
|
|
344
342
|
if (contentItem.type === "output_text") {
|
|
@@ -399,7 +397,6 @@ var ResponsesProcessor = class {
|
|
|
399
397
|
return Promise.resolve({ content });
|
|
400
398
|
}
|
|
401
399
|
};
|
|
402
|
-
|
|
403
400
|
//#endregion
|
|
404
401
|
//#region src/providers/openai/responses.ts
|
|
405
402
|
var OpenAiResponsesProvider = class extends require_openai.OpenAiGenericProvider {
|
|
@@ -438,8 +435,17 @@ var OpenAiResponsesProvider = class extends require_openai.OpenAiGenericProvider
|
|
|
438
435
|
"gpt-5.1-chat-latest",
|
|
439
436
|
"gpt-5.2",
|
|
440
437
|
"gpt-5.2-2025-12-11",
|
|
438
|
+
"gpt-5.2-chat-latest",
|
|
439
|
+
"gpt-5.2-codex",
|
|
440
|
+
"gpt-5.2-pro",
|
|
441
|
+
"gpt-5.2-pro-2025-12-11",
|
|
442
|
+
"gpt-5.3-chat-latest",
|
|
441
443
|
"gpt-5.3-codex",
|
|
442
444
|
"gpt-5.3-codex-spark",
|
|
445
|
+
"gpt-5.4",
|
|
446
|
+
"gpt-5.4-2026-03-05",
|
|
447
|
+
"gpt-5.4-pro",
|
|
448
|
+
"gpt-5.4-pro-2026-03-05",
|
|
443
449
|
"gpt-audio",
|
|
444
450
|
"gpt-audio-2025-08-28",
|
|
445
451
|
"gpt-audio-mini",
|
|
@@ -532,7 +538,7 @@ var OpenAiResponsesProvider = class extends require_openai.OpenAiGenericProvider
|
|
|
532
538
|
...reasoningEffort ? { reasoning: { effort: reasoningEffort } } : {},
|
|
533
539
|
...temperature !== void 0 ? { temperature } : {},
|
|
534
540
|
...instructions ? { instructions } : {},
|
|
535
|
-
...config.top_p !== void 0 || require_logger.getEnvString("OPENAI_TOP_P") ? { top_p: config.top_p ?? require_logger.getEnvFloat("OPENAI_TOP_P", 1) } : {},
|
|
541
|
+
...(!reasoningEffort || reasoningEffort === "none") && (config.top_p !== void 0 || require_logger.getEnvString("OPENAI_TOP_P")) ? { top_p: config.top_p ?? require_logger.getEnvFloat("OPENAI_TOP_P", 1) } : {},
|
|
536
542
|
...loadedTools ? { tools: loadedTools } : {},
|
|
537
543
|
...config.tool_choice ? { tool_choice: config.tool_choice } : {},
|
|
538
544
|
...config.max_tool_calls ? { max_tool_calls: config.max_tool_calls } : {},
|
|
@@ -568,10 +574,11 @@ var OpenAiResponsesProvider = class extends require_openai.OpenAiGenericProvider
|
|
|
568
574
|
for (const mcpTool of mcpTools) if (mcpTool.require_approval !== "never") return { error: `Deep research model ${this.modelName} requires MCP tools to have require_approval: 'never'. Update your MCP tool configuration:\ntools:\n - type: mcp\n require_approval: never` };
|
|
569
575
|
}
|
|
570
576
|
let timeout = require_fetch.REQUEST_TIMEOUT_MS;
|
|
571
|
-
|
|
577
|
+
const isGpt5ProModel = /(^|\/)gpt-5(?:\.\d+)?-pro(?:-|$)/.test(this.modelName);
|
|
578
|
+
if (isDeepResearchModel || isGpt5ProModel) {
|
|
572
579
|
const evalTimeout = require_logger.getEnvInt("PROMPTFOO_EVAL_TIMEOUT_MS", 0);
|
|
573
580
|
timeout = evalTimeout > 0 ? evalTimeout : require_fetch.LONG_RUNNING_MODEL_TIMEOUT_MS;
|
|
574
|
-
require_logger.
|
|
581
|
+
require_logger.logger.debug(`Using timeout of ${timeout}ms for long-running model ${this.modelName}`);
|
|
575
582
|
}
|
|
576
583
|
let data;
|
|
577
584
|
let status;
|
|
@@ -612,7 +619,7 @@ var OpenAiResponsesProvider = class extends require_openai.OpenAiGenericProvider
|
|
|
612
619
|
};
|
|
613
620
|
}
|
|
614
621
|
} catch (err) {
|
|
615
|
-
require_logger.
|
|
622
|
+
require_logger.logger.error(`API call error: ${String(err)}`);
|
|
616
623
|
await deleteFromCache?.();
|
|
617
624
|
return {
|
|
618
625
|
error: `API call error: ${String(err)}`,
|
|
@@ -648,24 +655,24 @@ var OpenAiResponsesProvider = class extends require_openai.OpenAiGenericProvider
|
|
|
648
655
|
};
|
|
649
656
|
}
|
|
650
657
|
};
|
|
651
|
-
|
|
652
658
|
//#endregion
|
|
653
|
-
Object.defineProperty(exports,
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
659
|
+
Object.defineProperty(exports, "FunctionCallbackHandler", {
|
|
660
|
+
enumerable: true,
|
|
661
|
+
get: function() {
|
|
662
|
+
return FunctionCallbackHandler;
|
|
663
|
+
}
|
|
658
664
|
});
|
|
659
|
-
Object.defineProperty(exports,
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
665
|
+
Object.defineProperty(exports, "OpenAiResponsesProvider", {
|
|
666
|
+
enumerable: true,
|
|
667
|
+
get: function() {
|
|
668
|
+
return OpenAiResponsesProvider;
|
|
669
|
+
}
|
|
664
670
|
});
|
|
665
|
-
Object.defineProperty(exports,
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
671
|
+
Object.defineProperty(exports, "ResponsesProcessor", {
|
|
672
|
+
enumerable: true,
|
|
673
|
+
get: function() {
|
|
674
|
+
return ResponsesProcessor;
|
|
675
|
+
}
|
|
670
676
|
});
|
|
671
|
-
|
|
677
|
+
|
|
678
|
+
//# sourceMappingURL=responses-tD4Bd4dc.cjs.map
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./chunk-DEq-mXcV.js";
|
|
2
|
+
import { b as getEnvString, i as logger, m as safeJsonStringify } from "./logger-CT3IKMKA.js";
|
|
3
|
+
import { n as getWrapperDir } from "./esm-Cd1AjG1D.js";
|
|
3
4
|
import fs from "fs";
|
|
4
5
|
import path from "path";
|
|
5
6
|
import os from "os";
|
|
6
7
|
import { execFile } from "child_process";
|
|
7
8
|
import { promisify } from "util";
|
|
8
|
-
|
|
9
9
|
//#region src/ruby/rubyUtils.ts
|
|
10
|
+
var rubyUtils_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
getSysExecutable: () => getSysExecutable,
|
|
12
|
+
runRuby: () => runRuby,
|
|
13
|
+
state: () => state,
|
|
14
|
+
tryPath: () => tryPath,
|
|
15
|
+
validateRubyPath: () => validateRubyPath
|
|
16
|
+
});
|
|
10
17
|
const execFileAsync = promisify(execFile);
|
|
11
18
|
/**
|
|
12
19
|
* Global state for Ruby executable path caching.
|
|
@@ -26,7 +33,7 @@ async function tryWindowsWhere() {
|
|
|
26
33
|
try {
|
|
27
34
|
const output = (await execFileAsync("where", ["ruby"])).stdout.trim();
|
|
28
35
|
if (!output) {
|
|
29
|
-
|
|
36
|
+
logger.debug("Windows 'where ruby' returned empty output");
|
|
30
37
|
return null;
|
|
31
38
|
}
|
|
32
39
|
const paths = output.split("\n").filter((path) => path.trim());
|
|
@@ -38,8 +45,8 @@ async function tryWindowsWhere() {
|
|
|
38
45
|
}
|
|
39
46
|
} catch (error) {
|
|
40
47
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
41
|
-
|
|
42
|
-
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES"))
|
|
48
|
+
logger.debug(`Windows 'where ruby' failed: ${errorMsg}`);
|
|
49
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES")) logger.warn(`Permission denied when searching for Ruby: ${errorMsg}`);
|
|
43
50
|
}
|
|
44
51
|
return null;
|
|
45
52
|
}
|
|
@@ -55,8 +62,8 @@ async function tryRubyCommands(commands) {
|
|
|
55
62
|
if (executablePath && executablePath !== "None") return executablePath;
|
|
56
63
|
} catch (error) {
|
|
57
64
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
58
|
-
|
|
59
|
-
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM"))
|
|
65
|
+
logger.debug(`Ruby command "${cmd}" failed: ${errorMsg}`);
|
|
66
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM")) logger.warn(`Permission denied when trying Ruby command "${cmd}": ${errorMsg}`);
|
|
60
67
|
}
|
|
61
68
|
return null;
|
|
62
69
|
}
|
|
@@ -72,8 +79,8 @@ async function tryDirectCommands(commands) {
|
|
|
72
79
|
if (validated) return validated;
|
|
73
80
|
} catch (error) {
|
|
74
81
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
75
|
-
|
|
76
|
-
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM"))
|
|
82
|
+
logger.debug(`Direct command "${cmd}" failed: ${errorMsg}`);
|
|
83
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM")) logger.warn(`Permission denied when trying Ruby command "${cmd}": ${errorMsg}`);
|
|
77
84
|
}
|
|
78
85
|
return null;
|
|
79
86
|
}
|
|
@@ -175,7 +182,7 @@ async function runRuby(scriptPath, method, args, options = {}) {
|
|
|
175
182
|
const wrapperPath = path.join(getWrapperDir("ruby"), "wrapper.rb");
|
|
176
183
|
try {
|
|
177
184
|
fs.writeFileSync(tempJsonPath, safeJsonStringify(args), "utf-8");
|
|
178
|
-
|
|
185
|
+
logger.debug(`Running Ruby wrapper with args: ${safeJsonStringify(args)}`);
|
|
179
186
|
const { stdout, stderr } = await execFileAsync(rubyPath, [
|
|
180
187
|
wrapperPath,
|
|
181
188
|
absPath,
|
|
@@ -183,33 +190,33 @@ async function runRuby(scriptPath, method, args, options = {}) {
|
|
|
183
190
|
tempJsonPath,
|
|
184
191
|
outputPath
|
|
185
192
|
]);
|
|
186
|
-
if (stdout)
|
|
187
|
-
if (stderr)
|
|
193
|
+
if (stdout) logger.debug(stdout.trim());
|
|
194
|
+
if (stderr) logger.error(stderr.trim());
|
|
188
195
|
const output = fs.readFileSync(outputPath, "utf-8");
|
|
189
|
-
|
|
196
|
+
logger.debug(`Ruby script ${absPath} returned: ${output}`);
|
|
190
197
|
let result;
|
|
191
198
|
try {
|
|
192
199
|
result = JSON.parse(output);
|
|
193
|
-
|
|
200
|
+
logger.debug(`Ruby script ${absPath} parsed output type: ${typeof result}, structure: ${result ? JSON.stringify(Object.keys(result)) : "undefined"}`);
|
|
194
201
|
} catch (error) {
|
|
195
202
|
throw new Error(`Invalid JSON: ${error.message} when parsing result: ${output}\nStack Trace: ${error.stack}`);
|
|
196
203
|
}
|
|
197
204
|
if (result?.type !== "final_result") throw new Error("The Ruby script `call_api` function must return a hash with an `output`");
|
|
198
205
|
return result.data;
|
|
199
206
|
} catch (error) {
|
|
200
|
-
|
|
207
|
+
logger.error(`Error running Ruby script: ${error.message}\nStack Trace: ${error.stack || "No Ruby traceback available"}`);
|
|
201
208
|
throw new Error(`Error running Ruby script: ${error.message}\nStack Trace: ${error.stack || "No Ruby traceback available"}`);
|
|
202
209
|
} finally {
|
|
203
210
|
[tempJsonPath, outputPath].forEach((file) => {
|
|
204
211
|
try {
|
|
205
212
|
fs.unlinkSync(file);
|
|
206
213
|
} catch (error) {
|
|
207
|
-
|
|
214
|
+
logger.error(`Error removing ${file}: ${error}`);
|
|
208
215
|
}
|
|
209
216
|
});
|
|
210
217
|
}
|
|
211
218
|
}
|
|
212
|
-
|
|
213
219
|
//#endregion
|
|
214
|
-
export {
|
|
215
|
-
|
|
220
|
+
export { runRuby as n, rubyUtils_exports as t };
|
|
221
|
+
|
|
222
|
+
//# sourceMappingURL=rubyUtils-BUVePouc.js.map
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-DEq-mXcV.js";
|
|
2
|
+
import { b as getEnvString, i as logger, m as safeJsonStringify } from "./logger-DLcq4dWf.js";
|
|
3
|
+
import { n as getWrapperDir } from "./esm-CaIwzWR5.js";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import os from "os";
|
|
7
|
+
import { promisify } from "util";
|
|
8
|
+
import { execFile } from "child_process";
|
|
9
|
+
//#region src/ruby/rubyUtils.ts
|
|
10
|
+
var rubyUtils_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
getSysExecutable: () => getSysExecutable,
|
|
12
|
+
runRuby: () => runRuby,
|
|
13
|
+
state: () => state,
|
|
14
|
+
tryPath: () => tryPath,
|
|
15
|
+
validateRubyPath: () => validateRubyPath
|
|
16
|
+
});
|
|
17
|
+
const execFileAsync = promisify(execFile);
|
|
18
|
+
/**
|
|
19
|
+
* Global state for Ruby executable path caching.
|
|
20
|
+
* Ensures consistent Ruby executable usage across multiple provider instances.
|
|
21
|
+
*/
|
|
22
|
+
const state = {
|
|
23
|
+
cachedRubyPath: null,
|
|
24
|
+
validationPromise: null,
|
|
25
|
+
validatingPath: null
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Attempts to find Ruby using Windows 'where' command.
|
|
29
|
+
* Only applicable on Windows platforms.
|
|
30
|
+
* @returns The validated Ruby executable path, or null if not found
|
|
31
|
+
*/
|
|
32
|
+
async function tryWindowsWhere() {
|
|
33
|
+
try {
|
|
34
|
+
const output = (await execFileAsync("where", ["ruby"])).stdout.trim();
|
|
35
|
+
if (!output) {
|
|
36
|
+
logger.debug("Windows 'where ruby' returned empty output");
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const paths = output.split("\n").filter((path) => path.trim());
|
|
40
|
+
for (const rubyPath of paths) {
|
|
41
|
+
const trimmedPath = rubyPath.trim();
|
|
42
|
+
if (!trimmedPath.endsWith(".exe")) continue;
|
|
43
|
+
const validated = await tryPath(trimmedPath);
|
|
44
|
+
if (validated) return validated;
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
48
|
+
logger.debug(`Windows 'where ruby' failed: ${errorMsg}`);
|
|
49
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES")) logger.warn(`Permission denied when searching for Ruby: ${errorMsg}`);
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Attempts to get Ruby executable path by running Ruby commands.
|
|
55
|
+
* Uses RbConfig.ruby to get the actual Ruby executable path.
|
|
56
|
+
* @param commands - Array of Ruby command names to try (e.g., ['ruby'])
|
|
57
|
+
* @returns The Ruby executable path, or null if all commands fail
|
|
58
|
+
*/
|
|
59
|
+
async function tryRubyCommands(commands) {
|
|
60
|
+
for (const cmd of commands) try {
|
|
61
|
+
const executablePath = (await execFileAsync(cmd, ["-e", "puts RbConfig.ruby"])).stdout.trim();
|
|
62
|
+
if (executablePath && executablePath !== "None") return executablePath;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
65
|
+
logger.debug(`Ruby command "${cmd}" failed: ${errorMsg}`);
|
|
66
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM")) logger.warn(`Permission denied when trying Ruby command "${cmd}": ${errorMsg}`);
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Attempts to validate Ruby commands directly as a final fallback.
|
|
72
|
+
* Validates each command by running it with --version.
|
|
73
|
+
* @param commands - Array of Ruby command names to try (e.g., ['ruby'])
|
|
74
|
+
* @returns The validated Ruby executable path, or null if all commands fail
|
|
75
|
+
*/
|
|
76
|
+
async function tryDirectCommands(commands) {
|
|
77
|
+
for (const cmd of commands) try {
|
|
78
|
+
const validated = await tryPath(cmd);
|
|
79
|
+
if (validated) return validated;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
82
|
+
logger.debug(`Direct command "${cmd}" failed: ${errorMsg}`);
|
|
83
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM")) logger.warn(`Permission denied when trying Ruby command "${cmd}": ${errorMsg}`);
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Attempts to get the Ruby executable path using platform-appropriate strategies.
|
|
89
|
+
* @returns The Ruby executable path if successful, or null if failed.
|
|
90
|
+
*/
|
|
91
|
+
async function getSysExecutable() {
|
|
92
|
+
if (process.platform === "win32") {
|
|
93
|
+
const whereResult = await tryWindowsWhere();
|
|
94
|
+
if (whereResult) return whereResult;
|
|
95
|
+
const sysResult = await tryRubyCommands(["ruby"]);
|
|
96
|
+
if (sysResult) return sysResult;
|
|
97
|
+
return await tryDirectCommands(["ruby"]);
|
|
98
|
+
} else return await tryRubyCommands(["ruby"]);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Attempts to validate a Ruby executable path.
|
|
102
|
+
* @param path - The path to the Ruby executable to test.
|
|
103
|
+
* @returns The validated path if successful, or null if invalid.
|
|
104
|
+
*/
|
|
105
|
+
async function tryPath(path) {
|
|
106
|
+
let timeoutId;
|
|
107
|
+
try {
|
|
108
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
109
|
+
timeoutId = setTimeout(() => reject(/* @__PURE__ */ new Error("Command timed out")), 2500);
|
|
110
|
+
});
|
|
111
|
+
const result = await Promise.race([execFileAsync(path, ["--version"]), timeoutPromise]);
|
|
112
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
113
|
+
if (result.stdout.trim().toLowerCase().includes("ruby")) return path;
|
|
114
|
+
return null;
|
|
115
|
+
} catch {
|
|
116
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Validates and caches the Ruby executable path.
|
|
122
|
+
*
|
|
123
|
+
* @param rubyPath - Path to the Ruby executable.
|
|
124
|
+
* @param isExplicit - If true, only tries the provided path.
|
|
125
|
+
* @returns Validated Ruby executable path.
|
|
126
|
+
* @throws {Error} If no valid Ruby executable is found.
|
|
127
|
+
*/
|
|
128
|
+
async function validateRubyPath(rubyPath, isExplicit) {
|
|
129
|
+
if (state.cachedRubyPath && state.validatingPath === rubyPath) return state.cachedRubyPath;
|
|
130
|
+
if (state.validatingPath !== rubyPath) {
|
|
131
|
+
state.cachedRubyPath = null;
|
|
132
|
+
state.validationPromise = null;
|
|
133
|
+
state.validatingPath = rubyPath;
|
|
134
|
+
}
|
|
135
|
+
if (!state.validationPromise) state.validationPromise = (async () => {
|
|
136
|
+
try {
|
|
137
|
+
const primaryPath = await tryPath(rubyPath);
|
|
138
|
+
if (primaryPath) {
|
|
139
|
+
state.cachedRubyPath = primaryPath;
|
|
140
|
+
state.validationPromise = null;
|
|
141
|
+
return primaryPath;
|
|
142
|
+
}
|
|
143
|
+
if (isExplicit) {
|
|
144
|
+
const error = /* @__PURE__ */ new Error(`Ruby not found. Tried "${rubyPath}" Please ensure Ruby is installed and set the PROMPTFOO_RUBY environment variable to your Ruby executable path (e.g., '${process.platform === "win32" ? "C:\\Ruby32\\bin\\ruby.exe" : "/usr/bin/ruby"}').`);
|
|
145
|
+
state.validationPromise = null;
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
const detectedPath = await getSysExecutable();
|
|
149
|
+
if (detectedPath) {
|
|
150
|
+
state.cachedRubyPath = detectedPath;
|
|
151
|
+
state.validationPromise = null;
|
|
152
|
+
return detectedPath;
|
|
153
|
+
}
|
|
154
|
+
const error = /* @__PURE__ */ new Error(`Ruby not found. Tried "${rubyPath}", ruby executable detection, and fallback commands. Please ensure Ruby is installed and set the PROMPTFOO_RUBY environment variable to your Ruby executable path (e.g., '${process.platform === "win32" ? "C:\\Ruby32\\bin\\ruby.exe" : "/usr/bin/ruby"}').`);
|
|
155
|
+
state.validationPromise = null;
|
|
156
|
+
throw error;
|
|
157
|
+
} catch (error) {
|
|
158
|
+
state.validationPromise = null;
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
})();
|
|
162
|
+
return state.validationPromise;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Runs a Ruby script with the specified method and arguments.
|
|
166
|
+
*
|
|
167
|
+
* @param scriptPath - The path to the Ruby script to run.
|
|
168
|
+
* @param method - The name of the method to call in the Ruby script.
|
|
169
|
+
* @param args - An array of arguments to pass to the Ruby script.
|
|
170
|
+
* @param options - Optional settings for running the Ruby script.
|
|
171
|
+
* @param options.rubyExecutable - Optional path to the Ruby executable.
|
|
172
|
+
* @returns A promise that resolves to the output of the Ruby script.
|
|
173
|
+
* @throws An error if there's an issue running the Ruby script or parsing its output.
|
|
174
|
+
*/
|
|
175
|
+
async function runRuby(scriptPath, method, args, options = {}) {
|
|
176
|
+
const absPath = path.resolve(scriptPath);
|
|
177
|
+
const tempJsonPath = path.join(os.tmpdir(), `promptfoo-ruby-input-json-${Date.now()}-${Math.random().toString(16).slice(2)}.json`);
|
|
178
|
+
const outputPath = path.join(os.tmpdir(), `promptfoo-ruby-output-json-${Date.now()}-${Math.random().toString(16).slice(2)}.json`);
|
|
179
|
+
const customPath = options.rubyExecutable || getEnvString("PROMPTFOO_RUBY");
|
|
180
|
+
let rubyPath = customPath || "ruby";
|
|
181
|
+
rubyPath = await validateRubyPath(rubyPath, typeof customPath === "string");
|
|
182
|
+
const wrapperPath = path.join(getWrapperDir("ruby"), "wrapper.rb");
|
|
183
|
+
try {
|
|
184
|
+
fs.writeFileSync(tempJsonPath, safeJsonStringify(args), "utf-8");
|
|
185
|
+
logger.debug(`Running Ruby wrapper with args: ${safeJsonStringify(args)}`);
|
|
186
|
+
const { stdout, stderr } = await execFileAsync(rubyPath, [
|
|
187
|
+
wrapperPath,
|
|
188
|
+
absPath,
|
|
189
|
+
method,
|
|
190
|
+
tempJsonPath,
|
|
191
|
+
outputPath
|
|
192
|
+
]);
|
|
193
|
+
if (stdout) logger.debug(stdout.trim());
|
|
194
|
+
if (stderr) logger.error(stderr.trim());
|
|
195
|
+
const output = fs.readFileSync(outputPath, "utf-8");
|
|
196
|
+
logger.debug(`Ruby script ${absPath} returned: ${output}`);
|
|
197
|
+
let result;
|
|
198
|
+
try {
|
|
199
|
+
result = JSON.parse(output);
|
|
200
|
+
logger.debug(`Ruby script ${absPath} parsed output type: ${typeof result}, structure: ${result ? JSON.stringify(Object.keys(result)) : "undefined"}`);
|
|
201
|
+
} catch (error) {
|
|
202
|
+
throw new Error(`Invalid JSON: ${error.message} when parsing result: ${output}\nStack Trace: ${error.stack}`);
|
|
203
|
+
}
|
|
204
|
+
if (result?.type !== "final_result") throw new Error("The Ruby script `call_api` function must return a hash with an `output`");
|
|
205
|
+
return result.data;
|
|
206
|
+
} catch (error) {
|
|
207
|
+
logger.error(`Error running Ruby script: ${error.message}\nStack Trace: ${error.stack || "No Ruby traceback available"}`);
|
|
208
|
+
throw new Error(`Error running Ruby script: ${error.message}\nStack Trace: ${error.stack || "No Ruby traceback available"}`);
|
|
209
|
+
} finally {
|
|
210
|
+
[tempJsonPath, outputPath].forEach((file) => {
|
|
211
|
+
try {
|
|
212
|
+
fs.unlinkSync(file);
|
|
213
|
+
} catch (error) {
|
|
214
|
+
logger.error(`Error removing ${file}: ${error}`);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
export { runRuby as n, rubyUtils_exports as t };
|
|
221
|
+
|
|
222
|
+
//# sourceMappingURL=rubyUtils-BcuGX77l.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as getEnvString, g as safeJsonStringify, o as
|
|
3
|
-
import { n as getWrapperDir } from "./esm-
|
|
2
|
+
import { C as getEnvString, g as safeJsonStringify, o as logger } from "./logger-KkObSCzq.js";
|
|
3
|
+
import { n as getWrapperDir } from "./esm-C03C-mv3.js";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import os from "os";
|
|
7
7
|
import { promisify } from "util";
|
|
8
8
|
import { execFile } from "child_process";
|
|
9
|
-
|
|
10
9
|
//#region src/ruby/rubyUtils.ts
|
|
11
10
|
const execFileAsync = promisify(execFile);
|
|
12
11
|
/**
|
|
@@ -27,7 +26,7 @@ async function tryWindowsWhere() {
|
|
|
27
26
|
try {
|
|
28
27
|
const output = (await execFileAsync("where", ["ruby"])).stdout.trim();
|
|
29
28
|
if (!output) {
|
|
30
|
-
|
|
29
|
+
logger.debug("Windows 'where ruby' returned empty output");
|
|
31
30
|
return null;
|
|
32
31
|
}
|
|
33
32
|
const paths = output.split("\n").filter((path) => path.trim());
|
|
@@ -39,8 +38,8 @@ async function tryWindowsWhere() {
|
|
|
39
38
|
}
|
|
40
39
|
} catch (error) {
|
|
41
40
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
42
|
-
|
|
43
|
-
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES"))
|
|
41
|
+
logger.debug(`Windows 'where ruby' failed: ${errorMsg}`);
|
|
42
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES")) logger.warn(`Permission denied when searching for Ruby: ${errorMsg}`);
|
|
44
43
|
}
|
|
45
44
|
return null;
|
|
46
45
|
}
|
|
@@ -56,8 +55,8 @@ async function tryRubyCommands(commands) {
|
|
|
56
55
|
if (executablePath && executablePath !== "None") return executablePath;
|
|
57
56
|
} catch (error) {
|
|
58
57
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
59
|
-
|
|
60
|
-
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM"))
|
|
58
|
+
logger.debug(`Ruby command "${cmd}" failed: ${errorMsg}`);
|
|
59
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM")) logger.warn(`Permission denied when trying Ruby command "${cmd}": ${errorMsg}`);
|
|
61
60
|
}
|
|
62
61
|
return null;
|
|
63
62
|
}
|
|
@@ -73,8 +72,8 @@ async function tryDirectCommands(commands) {
|
|
|
73
72
|
if (validated) return validated;
|
|
74
73
|
} catch (error) {
|
|
75
74
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
76
|
-
|
|
77
|
-
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM"))
|
|
75
|
+
logger.debug(`Direct command "${cmd}" failed: ${errorMsg}`);
|
|
76
|
+
if (errorMsg.includes("Access is denied") || errorMsg.includes("EACCES") || errorMsg.includes("EPERM")) logger.warn(`Permission denied when trying Ruby command "${cmd}": ${errorMsg}`);
|
|
78
77
|
}
|
|
79
78
|
return null;
|
|
80
79
|
}
|
|
@@ -176,7 +175,7 @@ async function runRuby(scriptPath, method, args, options = {}) {
|
|
|
176
175
|
const wrapperPath = path.join(getWrapperDir("ruby"), "wrapper.rb");
|
|
177
176
|
try {
|
|
178
177
|
fs.writeFileSync(tempJsonPath, safeJsonStringify(args), "utf-8");
|
|
179
|
-
|
|
178
|
+
logger.debug(`Running Ruby wrapper with args: ${safeJsonStringify(args)}`);
|
|
180
179
|
const { stdout, stderr } = await execFileAsync(rubyPath, [
|
|
181
180
|
wrapperPath,
|
|
182
181
|
absPath,
|
|
@@ -184,33 +183,33 @@ async function runRuby(scriptPath, method, args, options = {}) {
|
|
|
184
183
|
tempJsonPath,
|
|
185
184
|
outputPath
|
|
186
185
|
]);
|
|
187
|
-
if (stdout)
|
|
188
|
-
if (stderr)
|
|
186
|
+
if (stdout) logger.debug(stdout.trim());
|
|
187
|
+
if (stderr) logger.error(stderr.trim());
|
|
189
188
|
const output = fs.readFileSync(outputPath, "utf-8");
|
|
190
|
-
|
|
189
|
+
logger.debug(`Ruby script ${absPath} returned: ${output}`);
|
|
191
190
|
let result;
|
|
192
191
|
try {
|
|
193
192
|
result = JSON.parse(output);
|
|
194
|
-
|
|
193
|
+
logger.debug(`Ruby script ${absPath} parsed output type: ${typeof result}, structure: ${result ? JSON.stringify(Object.keys(result)) : "undefined"}`);
|
|
195
194
|
} catch (error) {
|
|
196
195
|
throw new Error(`Invalid JSON: ${error.message} when parsing result: ${output}\nStack Trace: ${error.stack}`);
|
|
197
196
|
}
|
|
198
197
|
if (result?.type !== "final_result") throw new Error("The Ruby script `call_api` function must return a hash with an `output`");
|
|
199
198
|
return result.data;
|
|
200
199
|
} catch (error) {
|
|
201
|
-
|
|
200
|
+
logger.error(`Error running Ruby script: ${error.message}\nStack Trace: ${error.stack || "No Ruby traceback available"}`);
|
|
202
201
|
throw new Error(`Error running Ruby script: ${error.message}\nStack Trace: ${error.stack || "No Ruby traceback available"}`);
|
|
203
202
|
} finally {
|
|
204
203
|
[tempJsonPath, outputPath].forEach((file) => {
|
|
205
204
|
try {
|
|
206
205
|
fs.unlinkSync(file);
|
|
207
206
|
} catch (error) {
|
|
208
|
-
|
|
207
|
+
logger.error(`Error removing ${file}: ${error}`);
|
|
209
208
|
}
|
|
210
209
|
});
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
|
-
|
|
214
212
|
//#endregion
|
|
215
213
|
export { validateRubyPath as a, tryPath as i, runRuby as n, state as r, getSysExecutable as t };
|
|
216
|
-
|
|
214
|
+
|
|
215
|
+
//# sourceMappingURL=rubyUtils-Boc4HZzX.js.map
|