promptfoo 0.120.27 → 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/src/{ListApp-8WOe2nT6.js → ListApp-Du7YVwj5.js} +2 -4
- package/dist/src/accounts-BgNJDBE6.js +206 -0
- package/dist/src/{accounts-Fl2J3_Fu.cjs → accounts-Bx-x3bmW.cjs} +77 -78
- package/dist/src/{accounts-DVINui-2.js → accounts-CMqkzrVf.js} +39 -34
- package/dist/src/{accounts-CPDRAMND.js → accounts-xrUGFA6n.js} +38 -33
- package/dist/src/{agentic-utils-D922n6mm.js → agentic-utils-BKIN5PKu.js} +9 -10
- package/dist/src/{agents-BO2n8Z0d.cjs → agents-B0f4HICh.cjs} +37 -40
- package/dist/src/{agents-BXLmVsxR.js → agents-C-dDThPK.js} +37 -37
- package/dist/src/{agents-DgJf2-ez.cjs → agents-CErsqg5U.cjs} +16 -17
- package/dist/src/{agents-BcsN_BgB.js → agents-CVIn-Utx.js} +16 -12
- package/dist/src/{agents-hqgSV-3o.js → agents-CXknwsFX.js} +37 -40
- package/dist/src/{agents-pMfppv9Z.js → agents-DeH4Gu94.js} +18 -18
- package/dist/src/{agents-BdUTAwi-.js → agents-Dy2YpZpa.js} +38 -41
- package/dist/src/{agents-DNvSH78i.js → agents-aF4-T121.js} +16 -20
- package/dist/src/{aimlapi-DOib86oE.js → aimlapi-BAGZDo5G.js} +16 -18
- package/dist/src/{aimlapi-DtgPI0nE.js → aimlapi-BNfTBexL.js} +15 -17
- package/dist/src/{aimlapi-DTPACCB1.js → aimlapi-DHRKlBEA.js} +15 -4
- package/dist/src/{aimlapi-BE_Tg9Fl.cjs → aimlapi-tg0Gkcvr.cjs} +15 -16
- package/dist/src/app/assets/index-BFCZg7hQ.js +439 -0
- package/dist/src/app/index.html +1 -1
- package/dist/src/{audio-BRYU0BFo.js → audio-BRODU0UK.js} +7 -9
- package/dist/src/{audio-Cwo68yZS.cjs → audio-BWeaWovU.cjs} +6 -7
- package/dist/src/{audio-BnRUGAm_.js → audio-CHQ4r-RV.js} +6 -5
- package/dist/src/{audio-MSRki4JU.js → audio-tf_NBjlC.js} +6 -8
- package/dist/src/{base-h961VXYk.js → base-B0tcrnq_.js} +11 -13
- package/dist/src/{base-XB2tDJrB.js → base-B4QJRyFS.js} +11 -13
- package/dist/src/{base-pGVmXNl4.cjs → base-DBtwl2FR.cjs} +36 -38
- package/dist/src/base-fEDN28WM.js +193 -0
- package/dist/src/{blobs-BM_e6hCa.js → blobs-BAU-dXan.js} +9 -12
- package/dist/src/{blobs-CR5C4Ihh.js → blobs-Bpg5rH6i.js} +9 -12
- package/dist/src/{blobs-B-KQAFhX.cjs → blobs-DvS-O6be.cjs} +34 -37
- package/dist/src/blobs-qTYm-1PY.js +236 -0
- package/dist/src/{cache-CIpsoBZR.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-jsiwsAJv.js → cache-CG0SlR1d.js} +64 -66
- package/dist/src/{cache-BTVYfbka.cjs → cache-COish3-W.cjs} +114 -117
- package/dist/src/cache-D3eqDYGU.js +739 -0
- package/dist/src/{chat-D31K7C4u.cjs → chat-2K608PeQ.cjs} +20 -21
- package/dist/src/chat-BKm79wib.js +764 -0
- package/dist/src/{chat-B84t99NW.js → chat-CM_kyI8B.js} +20 -9
- package/dist/src/{chat-BcPjZXIp.js → chat-CRWNNq73.js} +41 -44
- package/dist/src/{chat-CcUCysjU.js → chat-CznLWr_D.js} +41 -44
- package/dist/src/{chat-DwWifjxi.js → chat-DHMH-N64.js} +20 -22
- package/dist/src/{chat-BE44YOc6.cjs → chat-DaqekjFr.cjs} +61 -64
- package/dist/src/{chat-DZM2GUHO.js → chat-DxysjBvt.js} +21 -23
- package/dist/src/{chatkit-D67HS_0b.js → chatkit-65VXf5SR.js} +58 -58
- package/dist/src/{chatkit-DAB_qfzI.js → chatkit-Be-Q-a9F.js} +58 -60
- package/dist/src/{chatkit-Biqb_wsD.js → chatkit-BxFvW8KY.js} +58 -60
- package/dist/src/{chatkit-PGG4ZYIn.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-SVM6AdBu.js → claude-agent-sdk-BLTu0WBO.js} +31 -31
- package/dist/src/{claude-agent-sdk-C9SiaQub.cjs → claude-agent-sdk-CJH22shf.cjs} +31 -28
- package/dist/src/{claude-agent-sdk-C-IOTPfo.js → claude-agent-sdk-D6_k9FKA.js} +31 -29
- package/dist/src/{claude-agent-sdk-CiluSyW1.js → claude-agent-sdk-Dy5lT-Tx.js} +33 -20
- package/dist/src/{cloud-CZ-q9Ier.js → cloud-Bc9526yV.js} +7 -9
- package/dist/src/cloud-DmE0EwsY.js +4 -0
- package/dist/src/{cloudflare-ai-BahKHyhh.js → cloudflare-ai-C9r2sRhw.js} +16 -18
- package/dist/src/{cloudflare-ai-Dxyt50Nl.js → cloudflare-ai-CWWJCRim.js} +16 -4
- package/dist/src/{cloudflare-ai-Dfahv5SY.cjs → cloudflare-ai-ClWSdor4.cjs} +16 -17
- package/dist/src/{cloudflare-ai-v_qZD6_q.js → cloudflare-ai-ICsOuD-z.js} +17 -19
- package/dist/src/{cloudflare-gateway-BPWoZIzJ.cjs → cloudflare-gateway-C2_-KG5o.cjs} +21 -22
- package/dist/src/{cloudflare-gateway-Bi_FpOFy.js → cloudflare-gateway-D6O7AlYb.js} +23 -23
- package/dist/src/{cloudflare-gateway-btS7h1OZ.js → cloudflare-gateway-D6xFc5pa.js} +21 -25
- package/dist/src/{cloudflare-gateway-C0guUNwk.js → cloudflare-gateway-pXGHxJ47.js} +26 -14
- package/dist/src/{codex-sdk-DSxAnbfT.js → codex-sdk-C6UMlxwV.js} +28 -29
- package/dist/src/{codex-sdk-IYVi9fuM.js → codex-sdk-DUwKWezN.js} +28 -27
- package/dist/src/{codex-sdk-DulY0ZRq.js → codex-sdk-GGAw0qbD.js} +28 -29
- package/dist/src/{codex-sdk-DFKMtAyf.cjs → codex-sdk-fAO0c3yA.cjs} +28 -29
- package/dist/src/{cometapi-DkNBMk0G.js → cometapi-BasUi7-_.js} +17 -19
- package/dist/src/{cometapi-DzrR3SR_.js → cometapi-Bbjp5V4x.js} +16 -4
- package/dist/src/{cometapi-C9EEpJzT.js → cometapi-DkXrKi5z.js} +21 -24
- package/dist/src/{cometapi-DIO64tf4.cjs → cometapi-vY6aDZgo.cjs} +21 -22
- package/dist/src/{completion-CG29bfKX.js → completion-6Mx_iXxK.js} +11 -13
- package/dist/src/{completion-Bgf1VJoq.js → completion-C5rtR_9P.js} +11 -13
- package/dist/src/{completion-CCRT4kX1.cjs → completion-CDOouNzq.cjs} +21 -23
- package/dist/src/completion-C_P3ypkJ.js +120 -0
- package/dist/src/{createHash-Dw_iLu31.js → createHash-CTQmL3G2.js} +2 -3
- package/dist/src/{createHash-CYQy4YeL.cjs → createHash-CfZSc0b4.cjs} +13 -14
- package/dist/src/{createHash-CJcfskIZ.js → createHash-Da8fMwqB.js} +2 -3
- package/dist/src/createHash-DmPQkvBh.js +15 -0
- package/dist/src/{docker-D-ayp2FW.js → docker-5KcG-_86.js} +18 -20
- package/dist/src/{docker-DNcLR4Ig.cjs → docker-BwsKwxFs.cjs} +18 -19
- package/dist/src/{docker-egERKxCF.js → docker-CZnqU1XV.js} +18 -7
- package/dist/src/{docker-B81N0t4e.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-B9dPm_BF.js → esm-C03C-mv3.js} +17 -20
- package/dist/src/{esm-D2pZ87fL.js → esm-CaIwzWR5.js} +18 -21
- package/dist/src/esm-Cd1AjG1D.js +379 -0
- package/dist/src/{esm-Ct-Joyue.cjs → esm-CnNt7sI4.cjs} +47 -49
- package/dist/src/eval-17JizQIv.js +15 -0
- package/dist/src/{eval-C-Nr6wX_.js → eval-DmFyWU7i.js} +47 -54
- package/dist/src/{evalResult-4BzI2tmj.js → evalResult-CDQiuUuf.js} +16 -12
- package/dist/src/{evalResult-DXMWJ3sx.js → evalResult-CTG2AHOS.js} +10 -11
- package/dist/src/evalResult-Cqj8pldJ.js +12 -0
- package/dist/src/{evalResult-CX8wQecI.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-8aGyV12L.js → evaluator-DPFRbFIL.js} +201 -229
- package/dist/src/{extractor-CD5yKL-G.js → extractor-CFG6bcWJ.js} +22 -24
- package/dist/src/{extractor-C031XmTA.cjs → extractor-DX36oYEv.cjs} +37 -39
- package/dist/src/{extractor-V5x_m1i0.js → extractor-M67RUtg6.js} +22 -24
- package/dist/src/extractor-YMU_Gvt8.js +374 -0
- package/dist/src/{fetch-D3OHf-lV.js → fetch-4M3YRaqL.js} +40 -45
- package/dist/src/fetch-60Gzydls.js +777 -0
- package/dist/src/{fetch-CXZI9RRr.js → fetch-BMv0O527.js} +23 -35
- package/dist/src/{fetch-BmbD-v1L.cjs → fetch-BxUk8odA.cjs} +244 -277
- 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-CdevI3An.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-Dres3qrN.cjs → genaiTracer-DN4dQywX.cjs} +13 -14
- package/dist/src/graders-Bu0H9nXi.js +32 -0
- package/dist/src/{graders-DTeBrzWp.js → graders-CHO8EPM4.js} +349 -397
- package/dist/src/graders-Cfhkvx-e.js +34 -0
- package/dist/src/{graders--1y2u9HO.js → graders-CpdqD9PI.js} +349 -397
- package/dist/src/graders-DClJVpGP.cjs +32 -0
- package/dist/src/{graders-DohM2dir.cjs → graders-DOXycdlG.cjs} +684 -732
- package/dist/src/graders-DcnJsrMO.js +32 -0
- package/dist/src/graders-R9rYUM0d.js +13466 -0
- package/dist/src/{image-C3wHC9_h.js → image-BmEZqVmk.js} +9 -10
- package/dist/src/{image-O1u4bCFg.js → image-CBBVXWuT.js} +9 -10
- package/dist/src/{image-DpKl2F15.cjs → image-CDLQOcqT.cjs} +6 -7
- package/dist/src/{image-DmE-niFE.js → image-DJEvKveK.js} +6 -5
- package/dist/src/{image-CuKHuccK.cjs → image-DTedmQPg.cjs} +29 -30
- package/dist/src/{image-B0U4Hqll.js → image-gvmivTEe.js} +7 -9
- package/dist/src/image-pAX56tPG.js +257 -0
- package/dist/src/{image-DNEIf_aI.js → image-tL5hIOFh.js} +6 -8
- package/dist/src/index.cjs +605 -689
- package/dist/src/index.d.cts +11 -7
- package/dist/src/index.d.ts +11 -3
- package/dist/src/index.js +570 -658
- package/dist/src/{interactiveCheck-Bxj1Swex.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-Be_zyW4L.js → knowledgeBase-CLJybhnF.js} +16 -16
- package/dist/src/{knowledgeBase-CEzQobWX.js → knowledgeBase-CoU-UQBg.js} +14 -9
- package/dist/src/{knowledgeBase-BZ41IFwq.js → knowledgeBase-DjWPVqSb.js} +14 -18
- package/dist/src/{knowledgeBase-D-5BMXlr.cjs → knowledgeBase-wkxuRFhA.cjs} +14 -15
- package/dist/src/{litellm-DnbRJ2if.js → litellm-B9Hysuri.js} +16 -18
- package/dist/src/{litellm-CRDqPhNI.js → litellm-CTfa0hqi.js} +15 -17
- package/dist/src/{litellm-hUSNM_M2.cjs → litellm-NYpQ8RQu.cjs} +15 -16
- package/dist/src/{litellm-9vR8zpfU.js → litellm-ePxtr9F1.js} +15 -4
- package/dist/src/{logger-CG1uZPbQ.js → logger-CT3IKMKA.js} +10 -29
- package/dist/src/{logger-B7sBeGa0.cjs → logger-Cp1GPUjj.cjs} +152 -180
- package/dist/src/logger-DLcq4dWf.js +713 -0
- package/dist/src/{logger-LSBxlt7a.js → logger-KkObSCzq.js} +13 -31
- package/dist/src/{luma-ray-Hm3d6VJE.cjs → luma-ray-B0GGNRc1.cjs} +20 -21
- package/dist/src/{luma-ray-drvgdpP9.js → luma-ray-BE2mOt6N.js} +20 -13
- package/dist/src/{luma-ray-4blv9iZ2.js → luma-ray-BW9IRGIc.js} +22 -21
- package/dist/src/{luma-ray-B2__8lYH.js → luma-ray-Cm1KZBhs.js} +20 -23
- package/dist/src/main.js +1170 -1321
- package/dist/src/{messages-XhiwCbi4.cjs → messages-1JrJs91T.cjs} +32 -34
- package/dist/src/{messages-CGPPidQr.js → messages-1x9atZmP.js} +22 -24
- package/dist/src/{messages-Uee41Mj5.js → messages-BLbWdsyt.js} +22 -24
- package/dist/src/messages-D8EA0oDc.js +240 -0
- package/dist/src/{meteor-BYykdXrV.js → meteor-44VjEACX.js} +3 -4
- package/dist/src/{meteor-CsopaHrH.js → meteor-D-SotUw9.js} +3 -4
- package/dist/src/{meteor-e-E-2vVl.cjs → meteor-DLZZ3osF.cjs} +3 -4
- package/dist/src/{meteor-C8lGP6P4.js → meteor-DUiCJRC-.js} +3 -4
- package/dist/src/{modelslab-yKz-ZNB4.js → modelslab-C1OLRmVX.js} +17 -10
- package/dist/src/{modelslab-E9gO-bYd.js → modelslab-CqXBy3U8.js} +18 -20
- package/dist/src/{modelslab-lUVW0cmB.cjs → modelslab-DcOSFwKh.cjs} +17 -18
- package/dist/src/{modelslab-ClBkr8_9.js → modelslab-X5-4LroM.js} +17 -19
- package/dist/src/{nova-reel-Dk8jNpId.js → nova-reel-BgS1ZWuK.js} +20 -13
- package/dist/src/{nova-reel-u2eF2Cxm.js → nova-reel-D2ZkOSyr.js} +22 -21
- package/dist/src/{nova-reel-D8CuO6QH.cjs → nova-reel-D9xfaMBs.cjs} +20 -21
- package/dist/src/{nova-reel-P9bwvtYX.js → nova-reel-DihqLeol.js} +20 -23
- package/dist/src/{nova-sonic-Ds1C-dpm.cjs → nova-sonic-DVu3mMIy.cjs} +30 -31
- package/dist/src/{nova-sonic-CK2rAiKi.js → nova-sonic-DezhVUYT.js} +30 -26
- package/dist/src/{nova-sonic-BaqWlkds.js → nova-sonic-P-CdUMlV.js} +30 -31
- package/dist/src/{nova-sonic-yZapPLv7.js → nova-sonic-Q3BOJeig.js} +31 -32
- package/dist/src/{openai-DUFopMrH.cjs → openai-Cuif0GEt.cjs} +8 -9
- package/dist/src/{openai-PblZ3jUE.js → openai-DElQ-fPX.js} +3 -4
- package/dist/src/{openai-CcN1B8Sb.js → openai-DhbB7eWK.js} +3 -4
- package/dist/src/openai-j-sE2O7r.js +44 -0
- package/dist/src/{openclaw-A-3_loM7.js → openclaw-BiSZPL7J.js} +20 -14
- package/dist/src/{openclaw-COn6QzDi.js → openclaw-Bv1DINsX.js} +20 -27
- package/dist/src/{openclaw-a3lylB-V.js → openclaw-D1D_ej1z.js} +21 -28
- package/dist/src/{openclaw-B6qqDr_u.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-oyf5wLGC.js → otlpReceiver--AIRW_S4.js} +53 -51
- package/dist/src/{otlpReceiver-BmmTiMjA.js → otlpReceiver-Bn5wGB1v.js} +53 -55
- package/dist/src/{otlpReceiver-lXsYVbpj.cjs → otlpReceiver-Diec4cln.cjs} +53 -55
- package/dist/src/{otlpReceiver-94URx7UW.js → otlpReceiver-g3ByGaXs.js} +53 -55
- package/dist/src/{providerRegistry-Cq_JK_CJ.js → providerRegistry-B0RUOLI_.js} +7 -8
- package/dist/src/{providerRegistry-DSSHjMKf.js → providerRegistry-CD8MEar9.js} +7 -8
- package/dist/src/{providerRegistry-CvHEVJad.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-BnFpbY_s.js → providers-BKRJTjBz.js} +1536 -1669
- package/dist/src/providers-C1rOSHiR.js +32 -0
- package/dist/src/{providers-Iil64vk9.js → providers-CFLy1_ji.js} +1543 -1676
- package/dist/src/{providers-DHbjzW2e.cjs → providers-CFu-TZl-.cjs} +1896 -2029
- 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-CcT5LH1M.js → pythonUtils-C3py6GC1.js} +18 -19
- package/dist/src/{pythonUtils-DBbuI3QJ.cjs → pythonUtils-CTU3Y3lw.cjs} +42 -43
- package/dist/src/{pythonUtils-hZ8LeQLv.js → pythonUtils-D5nxkQ0P.js} +18 -19
- package/dist/src/pythonUtils-D6fwaDSg.js +249 -0
- package/dist/src/{quiverai-BuI0tE39.js → quiverai-C2jVwbH1.js} +8 -7
- package/dist/src/{quiverai-DCGSZt4U.js → quiverai-CI6gYJVI.js} +8 -10
- package/dist/src/{quiverai-DiMVJQDz.cjs → quiverai-CLkWkyZc.cjs} +8 -9
- package/dist/src/{quiverai-fQNkExW4.js → quiverai-MHSxbmmZ.js} +9 -11
- package/dist/src/{render-Dj1smHEb.js → render-Drod8m7K.js} +4 -5
- package/dist/src/{responses-DOAFFENS.js → responses-BKqJmhhc.js} +22 -25
- package/dist/src/{responses-CxzoQoBe.js → responses-CGw0DCzh.js} +22 -25
- package/dist/src/responses-jxdehPkC.js +660 -0
- package/dist/src/{responses-ghR3IOfy.cjs → responses-tD4Bd4dc.cjs} +37 -40
- package/dist/src/rubyUtils-BUHu6PhO.js +5 -0
- package/dist/src/{rubyUtils-CwbGmgYN.js → rubyUtils-BUVePouc.js} +27 -20
- package/dist/src/rubyUtils-BcuGX77l.js +222 -0
- package/dist/src/{rubyUtils-DudlFZed.js → rubyUtils-Boc4HZzX.js} +18 -19
- package/dist/src/rubyUtils-CP42kMvq.cjs +4 -0
- package/dist/src/{rubyUtils-C8MhKGHb.cjs → rubyUtils-DhCAlxZr.cjs} +48 -50
- package/dist/src/{sagemaker-gmskuyre.js → sagemaker-BK4Zb993.js} +75 -70
- package/dist/src/{sagemaker-DuM71dVU.js → sagemaker-BfiWTmvn.js} +77 -77
- package/dist/src/{sagemaker-77zbJ2Q2.cjs → sagemaker-CcQHM1jV.cjs} +75 -76
- package/dist/src/{sagemaker-CcxhlOAR.js → sagemaker-D2Q1c-sD.js} +75 -79
- package/dist/src/{scanner-DJYiSXQj.js → scanner-J8CA3LsV.js} +100 -121
- package/dist/src/server/index.js +5505 -67416
- package/dist/src/{server-B5v33lvE.cjs → server-B0PPuDw-.cjs} +57 -67
- package/dist/src/server-B1vi21hA.js +7 -0
- package/dist/src/{server-RV_i_YX5.js → server-BC7XJFgr.js} +19 -24
- package/dist/src/server-Cm9Kai_h.cjs +5 -0
- package/dist/src/{server-BJ4m4f1D.js → server-DbFphssR.js} +26 -29
- package/dist/src/server-OAs3nBRT.js +229 -0
- package/dist/src/{signal-BW33JuId.js → signal-BOTbd53Z.js} +9 -11
- package/dist/src/{slack-DEURelTy.cjs → slack-BmVAVGaK.cjs} +7 -8
- package/dist/src/{slack-BQYeW9L3.js → slack-DCUPTzS2.js} +8 -8
- package/dist/src/{slack-BB6yuZzp.js → slack-DOdy_kyv.js} +7 -8
- package/dist/src/{slack-2pRrhhgJ.js → slack-DXMKtA-f.js} +7 -9
- package/dist/src/store-BNmZ1KAz.cjs +5 -0
- package/dist/src/{store-D7CgQzAR.cjs → store-BSc-TF2w.cjs} +44 -45
- package/dist/src/store-BltJg2cd.js +6 -0
- package/dist/src/{store-s3SftUwF.js → store-D1tv90v3.js} +34 -35
- package/dist/src/{store-DJNsD1iC.js → store-DQLEjuEO.js} +40 -36
- package/dist/src/store-Ub2vaGJ1.js +228 -0
- package/dist/src/{tables-DfTsNN7X.js → tables-5EvT_Bwn.js} +19 -21
- package/dist/src/{tables-BKTmd6u7.cjs → tables-C7K-XKWp.cjs} +89 -91
- package/dist/src/{tables-DMegD0Xf.js → tables-D36WTqKX.js} +21 -23
- package/dist/src/tables-xKANLRBD.js +288 -0
- package/dist/src/telemetry-5BCRNBbe.cjs +5 -0
- package/dist/src/{telemetry-BedSm-bZ.js → telemetry-C15ziL8u.js} +17 -14
- package/dist/src/{telemetry--WAdAfVi.js → telemetry-C2YDkUQH.js} +11 -13
- package/dist/src/{telemetry-DQgVBCAb.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-oiSbwSOI.js → text-B_UCRPp2.js} +2 -2
- package/dist/src/{text-oKzCBnK6.cjs → text-CW1cyrwj.cjs} +12 -13
- package/dist/src/{text-B_IrO4GZ.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-BO1AHegO.cjs → transcription-CL78qbOU.cjs} +14 -15
- package/dist/src/{transcription-mYS9vd5v.js → transcription-DAtxHhAM.js} +14 -7
- package/dist/src/{transcription-X2-B4vkX.js → transcription-LNZTNUUL.js} +14 -16
- package/dist/src/{transcription-lzBLiTFJ.js → transcription-QHh3AH6Z.js} +15 -17
- package/dist/src/{transform-DeGlxb0D.js → transform-Cgi24fJ7.js} +39 -47
- package/dist/src/{transform-B1Hi5lWS.cjs → transform-CzK1Q0zl.cjs} +24 -26
- package/dist/src/{transform-CYDILYDe.js → transform-DECvGmzp.js} +15 -13
- package/dist/src/{transform-Dfl89yi4.js → transform-DGLazrMm.js} +39 -47
- package/dist/src/transform-DGxXocjk.js +1506 -0
- package/dist/src/{transform-D5PjiWiZ.cjs → transform-DOcQeLld.cjs} +179 -187
- package/dist/src/transform-DTGDnAzW.js +6 -0
- package/dist/src/{transform-BEgStbHK.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-SZnTS3pJ.js → transformersAvailability-CEVM2GNQ.js} +2 -2
- package/dist/src/{transformersAvailability-D-glmEy7.cjs → transformersAvailability-CwayUSlh.cjs} +2 -3
- package/dist/src/{transformersAvailability-CjeFXhuJ.js → transformersAvailability-D6c6ROpT.js} +2 -2
- package/dist/src/{types-CXQduE9o.js → types-CH3Ge2sE.js} +30 -90
- package/dist/src/{types-C5hEkb-x.js → types-CLKiCBW3.js} +25 -89
- package/dist/src/types-CN_TZ2GJ.js +3260 -0
- package/dist/src/{types-DWNf48sT.cjs → types-LJ0r3wbR.cjs} +500 -564
- package/dist/src/util-5cB-L7U3.js +1430 -0
- package/dist/src/util-6-GqIvzS.js +599 -0
- package/dist/src/{util-CoQjmE3u.js → util-B7T3SiBS.js} +4 -5
- package/dist/src/{util-D9eLdGfa.js → util-Betm42rL.js} +5 -6
- package/dist/src/{util-Bm_-UMD_.js → util-C-PPYSMq.js} +5 -6
- package/dist/src/{util-CyUdMzV0.cjs → util-CchiqXh_.cjs} +34 -35
- package/dist/src/{util-Du96oyYS.js → util-DaWTWKBK.js} +4 -5
- package/dist/src/{util-1wWM599Z.cjs → util-Db0a0AFH.cjs} +50 -51
- package/dist/src/{util-DQ984syk.js → util-Dlz_Wvgm.js} +37 -48
- package/dist/src/{util-_h4pVqrz.js → util-YT5HPZaS.js} +37 -48
- package/dist/src/{util-aLhtl3fe.cjs → util-Yz-1aEhW.cjs} +209 -220
- package/dist/src/util-ZZH-3QZz.js +293 -0
- package/dist/src/{utils-BjLy-Q72.cjs → utils-Cz9qXqII.cjs} +29 -32
- package/dist/src/{utils-CFMn2yHW.js → utils-XiOAgly5.js} +4 -7
- package/dist/src/utils-dLokC-eR.js +94 -0
- package/dist/src/{utils-DvWMzuMx.js → utils-f2-Moju7.js} +4 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +30 -30
- package/dist/src/app/assets/index-B2D0bCSI.js +0 -439
- package/dist/src/app/tsconfig.app.tsbuildinfo +0 -1
- package/dist/src/cache-ChPcurj7.js +0 -6
- package/dist/src/cache-VVu_W-yg.js +0 -8
- package/dist/src/cache-YLNCFEM2.cjs +0 -6
- package/dist/src/chunk-DHDDz29n.js +0 -22
- package/dist/src/chunk-FhC4c-0y.js +0 -21
- package/dist/src/cloud-BndfXy4H.js +0 -5
- package/dist/src/eval-BhHvMY82.js +0 -17
- package/dist/src/evalResult-Dq2gFNQY.js +0 -12
- package/dist/src/evalResult-nmcP5VKH.cjs +0 -12
- package/dist/src/evalResult-trqZjVYh.js +0 -14
- package/dist/src/evaluator-CnfPstzT.js +0 -39
- package/dist/src/fetch-IDPDue6F.cjs +0 -4
- package/dist/src/fetch-hKJ-It8q.js +0 -6
- package/dist/src/fetch-ouKnrWK-.js +0 -4
- package/dist/src/graders-CQn7WUsd.cjs +0 -34
- package/dist/src/graders-DC6QAbpW.js +0 -35
- package/dist/src/graders-DUWz3Y7j.js +0 -37
- package/dist/src/opencode-sdk-4bL9n-Gk.js +0 -382
- package/dist/src/opencode-sdk-BfC2zWcR.js +0 -376
- package/dist/src/opencode-sdk-DMJyuwMg.js +0 -380
- package/dist/src/opencode-sdk-Da-9adza.cjs +0 -383
- package/dist/src/providers-CsXB2Ix-.js +0 -35
- package/dist/src/providers-DO8ltjLC.js +0 -33
- package/dist/src/providers-Dtq-xnXd.cjs +0 -33
- package/dist/src/rubyUtils-BUbcND2f.js +0 -6
- package/dist/src/rubyUtils-Cr55X_KE.js +0 -5
- package/dist/src/rubyUtils-DlIiqoYo.cjs +0 -5
- package/dist/src/server-C2eQH4Gu.js +0 -6
- package/dist/src/server-CXWycu7H.cjs +0 -6
- package/dist/src/server-Q6OGlxxT.js +0 -8
- package/dist/src/store-B3EDO9Q3.js +0 -7
- package/dist/src/store-Dl9F8aw5.js +0 -6
- package/dist/src/store-SnrGrlt9.cjs +0 -6
- package/dist/src/telemetry-BGhiPZtl.js +0 -8
- package/dist/src/telemetry-CFfiYan6.cjs +0 -6
- package/dist/src/telemetry-DHzEduxX.js +0 -6
- package/dist/src/transform-C1x1ZlMQ.cjs +0 -6
- package/dist/src/transform-DYHjFmQu.js +0 -8
- package/dist/src/transform-rmwJT5JQ.js +0 -7
- package/dist/src/transformersAvailability-eJooj0gX.js +0 -35
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { o as
|
|
3
|
-
import { g as getDb, n as blobReferencesTable, t as blobAssetsTable } from "./tables-
|
|
2
|
+
import { o as logger, v as getConfigDirectoryPath } from "./logger-KkObSCzq.js";
|
|
3
|
+
import { g as getDb, n as blobReferencesTable, t as blobAssetsTable } from "./tables-D36WTqKX.js";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
6
6
|
import * as fsPromises$1 from "node:fs/promises";
|
|
7
7
|
import { createHash, randomUUID } from "node:crypto";
|
|
8
8
|
import { and, eq } from "drizzle-orm";
|
|
9
|
-
|
|
10
9
|
//#region src/blobs/constants.ts
|
|
11
10
|
const BLOB_MIN_SIZE = 1024;
|
|
12
11
|
const BLOB_MAX_SIZE = 52428800;
|
|
13
12
|
const BLOB_SCHEME = "promptfoo://blob/";
|
|
14
13
|
const DEFAULT_FILESYSTEM_SUBDIR = "blobs";
|
|
15
|
-
|
|
16
14
|
//#endregion
|
|
17
15
|
//#region src/blobs/filesystemProvider.ts
|
|
18
16
|
const BLOB_HASH_REGEX = /^[a-f0-9]{64}$/i;
|
|
@@ -33,7 +31,7 @@ var FilesystemBlobStorageProvider = class {
|
|
|
33
31
|
ensureDirectory() {
|
|
34
32
|
if (!fs$1.existsSync(this.basePath)) {
|
|
35
33
|
fs$1.mkdirSync(this.basePath, { recursive: true });
|
|
36
|
-
|
|
34
|
+
logger.debug("[BlobFS] Created blob directory", { basePath: this.basePath });
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
assertValidHash(hash) {
|
|
@@ -152,12 +150,11 @@ var FilesystemBlobStorageProvider = class {
|
|
|
152
150
|
return JSON.parse(raw);
|
|
153
151
|
} catch (error) {
|
|
154
152
|
if (error.code === "ENOENT") return null;
|
|
155
|
-
|
|
153
|
+
logger.warn("[BlobFS] Failed to read metadata", { error });
|
|
156
154
|
return null;
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
};
|
|
160
|
-
|
|
161
158
|
//#endregion
|
|
162
159
|
//#region src/blobs/index.ts
|
|
163
160
|
let defaultProvider = null;
|
|
@@ -167,7 +164,7 @@ function createDefaultProvider() {
|
|
|
167
164
|
function getBlobStorageProvider() {
|
|
168
165
|
if (!defaultProvider) {
|
|
169
166
|
defaultProvider = createDefaultProvider();
|
|
170
|
-
|
|
167
|
+
logger.debug("[BlobStorage] Initialized provider", { provider: defaultProvider.providerId });
|
|
171
168
|
}
|
|
172
169
|
return defaultProvider;
|
|
173
170
|
}
|
|
@@ -197,7 +194,7 @@ async function storeBlob(data, mimeType, refContext) {
|
|
|
197
194
|
try {
|
|
198
195
|
await provider.deleteByHash(result.ref.hash);
|
|
199
196
|
} catch (cleanupError) {
|
|
200
|
-
|
|
197
|
+
logger.warn("[BlobStorage] Failed to rollback blob after DB error", {
|
|
201
198
|
error: cleanupError,
|
|
202
199
|
hash: result.ref.hash
|
|
203
200
|
});
|
|
@@ -215,7 +212,7 @@ async function getBlobUrl(hash, expiresInSeconds) {
|
|
|
215
212
|
async function recordBlobReference(hash, refContext) {
|
|
216
213
|
if (!refContext.evalId) return;
|
|
217
214
|
if (!await getBlobStorageProvider().exists(hash).catch(() => false)) {
|
|
218
|
-
|
|
215
|
+
logger.debug("[BlobStorage] Attempted to record reference for missing blob", {
|
|
219
216
|
hash,
|
|
220
217
|
evalId: refContext.evalId,
|
|
221
218
|
location: refContext.location
|
|
@@ -234,7 +231,7 @@ async function recordBlobReference(hash, refContext) {
|
|
|
234
231
|
kind: refContext.kind
|
|
235
232
|
}).run();
|
|
236
233
|
}
|
|
237
|
-
|
|
238
234
|
//#endregion
|
|
239
235
|
export { BLOB_MAX_SIZE as a, storeBlob as i, getBlobUrl as n, BLOB_MIN_SIZE as o, recordBlobReference as r, getBlobByHash as t };
|
|
240
|
-
|
|
236
|
+
|
|
237
|
+
//# sourceMappingURL=blobs-BAU-dXan.js.map
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { g as getConfigDirectoryPath, i as
|
|
2
|
-
import { n as blobReferencesTable, p as getDb, t as blobAssetsTable } from "./tables-
|
|
1
|
+
import { g as getConfigDirectoryPath, i as logger } from "./logger-CT3IKMKA.js";
|
|
2
|
+
import { n as blobReferencesTable, p as getDb, t as blobAssetsTable } from "./tables-5EvT_Bwn.js";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
5
5
|
import * as fsPromises$1 from "node:fs/promises";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import { and, eq } from "drizzle-orm";
|
|
8
|
-
|
|
9
8
|
//#region src/blobs/constants.ts
|
|
10
9
|
const BLOB_MIN_SIZE = 1024;
|
|
11
10
|
const BLOB_MAX_SIZE = 52428800;
|
|
12
11
|
const BLOB_SCHEME = "promptfoo://blob/";
|
|
13
12
|
const DEFAULT_FILESYSTEM_SUBDIR = "blobs";
|
|
14
|
-
|
|
15
13
|
//#endregion
|
|
16
14
|
//#region src/blobs/filesystemProvider.ts
|
|
17
15
|
const BLOB_HASH_REGEX = /^[a-f0-9]{64}$/i;
|
|
@@ -32,7 +30,7 @@ var FilesystemBlobStorageProvider = class {
|
|
|
32
30
|
ensureDirectory() {
|
|
33
31
|
if (!fs$1.existsSync(this.basePath)) {
|
|
34
32
|
fs$1.mkdirSync(this.basePath, { recursive: true });
|
|
35
|
-
|
|
33
|
+
logger.debug("[BlobFS] Created blob directory", { basePath: this.basePath });
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
assertValidHash(hash) {
|
|
@@ -151,12 +149,11 @@ var FilesystemBlobStorageProvider = class {
|
|
|
151
149
|
return JSON.parse(raw);
|
|
152
150
|
} catch (error) {
|
|
153
151
|
if (error.code === "ENOENT") return null;
|
|
154
|
-
|
|
152
|
+
logger.warn("[BlobFS] Failed to read metadata", { error });
|
|
155
153
|
return null;
|
|
156
154
|
}
|
|
157
155
|
}
|
|
158
156
|
};
|
|
159
|
-
|
|
160
157
|
//#endregion
|
|
161
158
|
//#region src/blobs/index.ts
|
|
162
159
|
let defaultProvider = null;
|
|
@@ -166,7 +163,7 @@ function createDefaultProvider() {
|
|
|
166
163
|
function getBlobStorageProvider() {
|
|
167
164
|
if (!defaultProvider) {
|
|
168
165
|
defaultProvider = createDefaultProvider();
|
|
169
|
-
|
|
166
|
+
logger.debug("[BlobStorage] Initialized provider", { provider: defaultProvider.providerId });
|
|
170
167
|
}
|
|
171
168
|
return defaultProvider;
|
|
172
169
|
}
|
|
@@ -196,7 +193,7 @@ async function storeBlob(data, mimeType, refContext) {
|
|
|
196
193
|
try {
|
|
197
194
|
await provider.deleteByHash(result.ref.hash);
|
|
198
195
|
} catch (cleanupError) {
|
|
199
|
-
|
|
196
|
+
logger.warn("[BlobStorage] Failed to rollback blob after DB error", {
|
|
200
197
|
error: cleanupError,
|
|
201
198
|
hash: result.ref.hash
|
|
202
199
|
});
|
|
@@ -211,7 +208,7 @@ async function getBlobByHash(hash) {
|
|
|
211
208
|
async function recordBlobReference(hash, refContext) {
|
|
212
209
|
if (!refContext.evalId) return;
|
|
213
210
|
if (!await getBlobStorageProvider().exists(hash).catch(() => false)) {
|
|
214
|
-
|
|
211
|
+
logger.debug("[BlobStorage] Attempted to record reference for missing blob", {
|
|
215
212
|
hash,
|
|
216
213
|
evalId: refContext.evalId,
|
|
217
214
|
location: refContext.location
|
|
@@ -230,7 +227,7 @@ async function recordBlobReference(hash, refContext) {
|
|
|
230
227
|
kind: refContext.kind
|
|
231
228
|
}).run();
|
|
232
229
|
}
|
|
233
|
-
|
|
234
230
|
//#endregion
|
|
235
231
|
export { BLOB_MIN_SIZE as a, BLOB_MAX_SIZE as i, recordBlobReference as n, storeBlob as r, getBlobByHash as t };
|
|
236
|
-
|
|
232
|
+
|
|
233
|
+
//# sourceMappingURL=blobs-Bpg5rH6i.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_logger = require(
|
|
2
|
-
const require_tables = require(
|
|
1
|
+
const require_logger = require("./logger-Cp1GPUjj.cjs");
|
|
2
|
+
const require_tables = require("./tables-C7K-XKWp.cjs");
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
node_fs = require_logger.__toESM(node_fs);
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -8,13 +8,11 @@ let node_path = require("node:path");
|
|
|
8
8
|
node_path = require_logger.__toESM(node_path);
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
10
10
|
let drizzle_orm = require("drizzle-orm");
|
|
11
|
-
|
|
12
11
|
//#region src/blobs/constants.ts
|
|
13
12
|
const BLOB_MIN_SIZE = 1024;
|
|
14
13
|
const BLOB_MAX_SIZE = 52428800;
|
|
15
14
|
const BLOB_SCHEME = "promptfoo://blob/";
|
|
16
15
|
const DEFAULT_FILESYSTEM_SUBDIR = "blobs";
|
|
17
|
-
|
|
18
16
|
//#endregion
|
|
19
17
|
//#region src/blobs/filesystemProvider.ts
|
|
20
18
|
const BLOB_HASH_REGEX = /^[a-f0-9]{64}$/i;
|
|
@@ -35,7 +33,7 @@ var FilesystemBlobStorageProvider = class {
|
|
|
35
33
|
ensureDirectory() {
|
|
36
34
|
if (!node_fs.existsSync(this.basePath)) {
|
|
37
35
|
node_fs.mkdirSync(this.basePath, { recursive: true });
|
|
38
|
-
require_logger.
|
|
36
|
+
require_logger.logger.debug("[BlobFS] Created blob directory", { basePath: this.basePath });
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
assertValidHash(hash) {
|
|
@@ -154,12 +152,11 @@ var FilesystemBlobStorageProvider = class {
|
|
|
154
152
|
return JSON.parse(raw);
|
|
155
153
|
} catch (error) {
|
|
156
154
|
if (error.code === "ENOENT") return null;
|
|
157
|
-
require_logger.
|
|
155
|
+
require_logger.logger.warn("[BlobFS] Failed to read metadata", { error });
|
|
158
156
|
return null;
|
|
159
157
|
}
|
|
160
158
|
}
|
|
161
159
|
};
|
|
162
|
-
|
|
163
160
|
//#endregion
|
|
164
161
|
//#region src/blobs/index.ts
|
|
165
162
|
let defaultProvider = null;
|
|
@@ -169,7 +166,7 @@ function createDefaultProvider() {
|
|
|
169
166
|
function getBlobStorageProvider() {
|
|
170
167
|
if (!defaultProvider) {
|
|
171
168
|
defaultProvider = createDefaultProvider();
|
|
172
|
-
require_logger.
|
|
169
|
+
require_logger.logger.debug("[BlobStorage] Initialized provider", { provider: defaultProvider.providerId });
|
|
173
170
|
}
|
|
174
171
|
return defaultProvider;
|
|
175
172
|
}
|
|
@@ -199,7 +196,7 @@ async function storeBlob(data, mimeType, refContext) {
|
|
|
199
196
|
try {
|
|
200
197
|
await provider.deleteByHash(result.ref.hash);
|
|
201
198
|
} catch (cleanupError) {
|
|
202
|
-
require_logger.
|
|
199
|
+
require_logger.logger.warn("[BlobStorage] Failed to rollback blob after DB error", {
|
|
203
200
|
error: cleanupError,
|
|
204
201
|
hash: result.ref.hash
|
|
205
202
|
});
|
|
@@ -214,7 +211,7 @@ async function getBlobByHash(hash) {
|
|
|
214
211
|
async function recordBlobReference(hash, refContext) {
|
|
215
212
|
if (!refContext.evalId) return;
|
|
216
213
|
if (!await getBlobStorageProvider().exists(hash).catch(() => false)) {
|
|
217
|
-
require_logger.
|
|
214
|
+
require_logger.logger.debug("[BlobStorage] Attempted to record reference for missing blob", {
|
|
218
215
|
hash,
|
|
219
216
|
evalId: refContext.evalId,
|
|
220
217
|
location: refContext.location
|
|
@@ -233,36 +230,36 @@ async function recordBlobReference(hash, refContext) {
|
|
|
233
230
|
kind: refContext.kind
|
|
234
231
|
}).run();
|
|
235
232
|
}
|
|
236
|
-
|
|
237
233
|
//#endregion
|
|
238
|
-
Object.defineProperty(exports,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
234
|
+
Object.defineProperty(exports, "BLOB_MAX_SIZE", {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
get: function() {
|
|
237
|
+
return BLOB_MAX_SIZE;
|
|
238
|
+
}
|
|
243
239
|
});
|
|
244
|
-
Object.defineProperty(exports,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
240
|
+
Object.defineProperty(exports, "BLOB_MIN_SIZE", {
|
|
241
|
+
enumerable: true,
|
|
242
|
+
get: function() {
|
|
243
|
+
return BLOB_MIN_SIZE;
|
|
244
|
+
}
|
|
249
245
|
});
|
|
250
|
-
Object.defineProperty(exports,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
246
|
+
Object.defineProperty(exports, "getBlobByHash", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function() {
|
|
249
|
+
return getBlobByHash;
|
|
250
|
+
}
|
|
255
251
|
});
|
|
256
|
-
Object.defineProperty(exports,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
252
|
+
Object.defineProperty(exports, "recordBlobReference", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function() {
|
|
255
|
+
return recordBlobReference;
|
|
256
|
+
}
|
|
261
257
|
});
|
|
262
|
-
Object.defineProperty(exports,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
258
|
+
Object.defineProperty(exports, "storeBlob", {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
get: function() {
|
|
261
|
+
return storeBlob;
|
|
262
|
+
}
|
|
267
263
|
});
|
|
268
|
-
|
|
264
|
+
|
|
265
|
+
//# sourceMappingURL=blobs-DvS-O6be.cjs.map
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { g as getConfigDirectoryPath, i as logger } from "./logger-DLcq4dWf.js";
|
|
2
|
+
import { h as getDb, n as blobReferencesTable, t as blobAssetsTable } from "./tables-xKANLRBD.js";
|
|
3
|
+
import * as fs$1 from "node:fs";
|
|
4
|
+
import * as path$1 from "node:path";
|
|
5
|
+
import * as fsPromises$1 from "node:fs/promises";
|
|
6
|
+
import { and, eq } from "drizzle-orm";
|
|
7
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
8
|
+
//#region src/blobs/constants.ts
|
|
9
|
+
const BLOB_MIN_SIZE = 1024;
|
|
10
|
+
const BLOB_MAX_SIZE = 52428800;
|
|
11
|
+
const BLOB_SCHEME = "promptfoo://blob/";
|
|
12
|
+
const DEFAULT_FILESYSTEM_SUBDIR = "blobs";
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/blobs/filesystemProvider.ts
|
|
15
|
+
const BLOB_HASH_REGEX = /^[a-f0-9]{64}$/i;
|
|
16
|
+
function computeHash(data) {
|
|
17
|
+
return createHash("sha256").update(data).digest("hex");
|
|
18
|
+
}
|
|
19
|
+
function buildUri(hash) {
|
|
20
|
+
return `${BLOB_SCHEME}${hash}`;
|
|
21
|
+
}
|
|
22
|
+
var FilesystemBlobStorageProvider = class {
|
|
23
|
+
providerId = "filesystem";
|
|
24
|
+
basePath;
|
|
25
|
+
constructor(config) {
|
|
26
|
+
const defaultBase = path$1.join(getConfigDirectoryPath(true), DEFAULT_FILESYSTEM_SUBDIR);
|
|
27
|
+
this.basePath = path$1.resolve(config?.basePath || defaultBase);
|
|
28
|
+
this.ensureDirectory();
|
|
29
|
+
}
|
|
30
|
+
ensureDirectory() {
|
|
31
|
+
if (!fs$1.existsSync(this.basePath)) {
|
|
32
|
+
fs$1.mkdirSync(this.basePath, { recursive: true });
|
|
33
|
+
logger.debug("[BlobFS] Created blob directory", { basePath: this.basePath });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
assertValidHash(hash) {
|
|
37
|
+
if (!BLOB_HASH_REGEX.test(hash)) throw new Error(`[BlobFS] Invalid blob hash: "${hash}"`);
|
|
38
|
+
}
|
|
39
|
+
resolvePathInBase(unsafePath) {
|
|
40
|
+
const targetPath = path$1.isAbsolute(unsafePath) ? path$1.resolve(unsafePath) : path$1.resolve(this.basePath, unsafePath);
|
|
41
|
+
const safeBase = path$1.resolve(this.basePath) + path$1.sep;
|
|
42
|
+
if (!targetPath.startsWith(safeBase)) throw new Error("[BlobFS] Path traversal attempt detected");
|
|
43
|
+
return targetPath;
|
|
44
|
+
}
|
|
45
|
+
hashToPath(hash) {
|
|
46
|
+
this.assertValidHash(hash);
|
|
47
|
+
const dirRelative = path$1.join(hash.slice(0, 2), hash.slice(2, 4));
|
|
48
|
+
const fileRelative = path$1.join(dirRelative, hash);
|
|
49
|
+
return this.resolvePathInBase(fileRelative);
|
|
50
|
+
}
|
|
51
|
+
async ensureHashDir(hash) {
|
|
52
|
+
this.assertValidHash(hash);
|
|
53
|
+
const dirRelative = path$1.join(hash.slice(0, 2), hash.slice(2, 4));
|
|
54
|
+
const dirPath = this.resolvePathInBase(dirRelative);
|
|
55
|
+
await fsPromises$1.mkdir(dirPath, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
metadataPath(filePath) {
|
|
58
|
+
return `${filePath}.meta.json`;
|
|
59
|
+
}
|
|
60
|
+
async store(data, mimeType) {
|
|
61
|
+
const hash = computeHash(data);
|
|
62
|
+
await this.ensureHashDir(hash);
|
|
63
|
+
const filePath = this.hashToPath(hash);
|
|
64
|
+
try {
|
|
65
|
+
await fsPromises$1.access(filePath);
|
|
66
|
+
const meta = await this.readMetadata(filePath);
|
|
67
|
+
return {
|
|
68
|
+
ref: this.buildRef(hash, meta?.mimeType ?? mimeType, meta?.sizeBytes ?? data.length, meta?.provider ?? this.providerId),
|
|
69
|
+
deduplicated: true
|
|
70
|
+
};
|
|
71
|
+
} catch {}
|
|
72
|
+
await fsPromises$1.writeFile(filePath, data);
|
|
73
|
+
const metadata = {
|
|
74
|
+
mimeType,
|
|
75
|
+
sizeBytes: data.length,
|
|
76
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
77
|
+
provider: this.providerId,
|
|
78
|
+
key: filePath
|
|
79
|
+
};
|
|
80
|
+
await fsPromises$1.writeFile(this.metadataPath(filePath), JSON.stringify(metadata, null, 2));
|
|
81
|
+
return {
|
|
82
|
+
ref: this.buildRef(hash, mimeType, data.length, this.providerId),
|
|
83
|
+
deduplicated: false
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async getByHash(hash) {
|
|
87
|
+
const filePath = this.hashToPath(hash);
|
|
88
|
+
let data;
|
|
89
|
+
try {
|
|
90
|
+
data = await fsPromises$1.readFile(filePath);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (error.code === "ENOENT") throw new Error(`Blob not found: ${hash}`);
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
const metadata = await this.readMetadata(filePath) || {
|
|
96
|
+
mimeType: "application/octet-stream",
|
|
97
|
+
sizeBytes: data.length,
|
|
98
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
99
|
+
provider: this.providerId,
|
|
100
|
+
key: filePath
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
data,
|
|
104
|
+
metadata
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async exists(hash) {
|
|
108
|
+
try {
|
|
109
|
+
const filePath = this.hashToPath(hash);
|
|
110
|
+
await fsPromises$1.access(filePath);
|
|
111
|
+
return true;
|
|
112
|
+
} catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async deleteByHash(hash) {
|
|
117
|
+
try {
|
|
118
|
+
const filePath = this.hashToPath(hash);
|
|
119
|
+
const metaPath = this.metadataPath(filePath);
|
|
120
|
+
try {
|
|
121
|
+
await fsPromises$1.unlink(filePath);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (error.code !== "ENOENT") throw error;
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
await fsPromises$1.unlink(metaPath);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (error.code !== "ENOENT") throw error;
|
|
129
|
+
}
|
|
130
|
+
} catch {}
|
|
131
|
+
}
|
|
132
|
+
async getUrl(_hash, _expiresInSeconds) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
buildRef(hash, mimeType, sizeBytes, provider) {
|
|
136
|
+
return {
|
|
137
|
+
uri: buildUri(hash),
|
|
138
|
+
hash,
|
|
139
|
+
mimeType,
|
|
140
|
+
sizeBytes,
|
|
141
|
+
provider
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
async readMetadata(filePath) {
|
|
145
|
+
const safeFilePath = this.resolvePathInBase(filePath);
|
|
146
|
+
const metaPath = this.metadataPath(safeFilePath);
|
|
147
|
+
try {
|
|
148
|
+
const raw = await fsPromises$1.readFile(metaPath, "utf8");
|
|
149
|
+
return JSON.parse(raw);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
if (error.code === "ENOENT") return null;
|
|
152
|
+
logger.warn("[BlobFS] Failed to read metadata", { error });
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/blobs/index.ts
|
|
159
|
+
let defaultProvider = null;
|
|
160
|
+
function createDefaultProvider() {
|
|
161
|
+
return new FilesystemBlobStorageProvider();
|
|
162
|
+
}
|
|
163
|
+
function getBlobStorageProvider() {
|
|
164
|
+
if (!defaultProvider) {
|
|
165
|
+
defaultProvider = createDefaultProvider();
|
|
166
|
+
logger.debug("[BlobStorage] Initialized provider", { provider: defaultProvider.providerId });
|
|
167
|
+
}
|
|
168
|
+
return defaultProvider;
|
|
169
|
+
}
|
|
170
|
+
async function storeBlob(data, mimeType, refContext) {
|
|
171
|
+
const provider = getBlobStorageProvider();
|
|
172
|
+
const result = await provider.store(data, mimeType);
|
|
173
|
+
const db = getDb();
|
|
174
|
+
try {
|
|
175
|
+
db.transaction(() => {
|
|
176
|
+
const assetInsert = db.insert(blobAssetsTable).values({
|
|
177
|
+
hash: result.ref.hash,
|
|
178
|
+
sizeBytes: result.ref.sizeBytes,
|
|
179
|
+
mimeType: result.ref.mimeType,
|
|
180
|
+
provider: result.ref.provider
|
|
181
|
+
}).onConflictDoNothing().run();
|
|
182
|
+
return (refContext?.evalId && db.insert(blobReferencesTable).values({
|
|
183
|
+
id: randomUUID(),
|
|
184
|
+
blobHash: result.ref.hash,
|
|
185
|
+
evalId: refContext.evalId,
|
|
186
|
+
testIdx: refContext.testIdx,
|
|
187
|
+
promptIdx: refContext.promptIdx,
|
|
188
|
+
location: refContext.location,
|
|
189
|
+
kind: refContext.kind
|
|
190
|
+
}).onConflictDoNothing().run()) ?? assetInsert;
|
|
191
|
+
});
|
|
192
|
+
} catch (error) {
|
|
193
|
+
try {
|
|
194
|
+
await provider.deleteByHash(result.ref.hash);
|
|
195
|
+
} catch (cleanupError) {
|
|
196
|
+
logger.warn("[BlobStorage] Failed to rollback blob after DB error", {
|
|
197
|
+
error: cleanupError,
|
|
198
|
+
hash: result.ref.hash
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
async function getBlobByHash(hash) {
|
|
206
|
+
return getBlobStorageProvider().getByHash(hash);
|
|
207
|
+
}
|
|
208
|
+
async function getBlobUrl(hash, expiresInSeconds) {
|
|
209
|
+
return getBlobStorageProvider().getUrl(hash, expiresInSeconds);
|
|
210
|
+
}
|
|
211
|
+
async function recordBlobReference(hash, refContext) {
|
|
212
|
+
if (!refContext.evalId) return;
|
|
213
|
+
if (!await getBlobStorageProvider().exists(hash).catch(() => false)) {
|
|
214
|
+
logger.debug("[BlobStorage] Attempted to record reference for missing blob", {
|
|
215
|
+
hash,
|
|
216
|
+
evalId: refContext.evalId,
|
|
217
|
+
location: refContext.location
|
|
218
|
+
});
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const db = getDb();
|
|
222
|
+
if (db.select({ id: blobReferencesTable.id }).from(blobReferencesTable).where(and(eq(blobReferencesTable.blobHash, hash), eq(blobReferencesTable.evalId, refContext.evalId))).get()) return;
|
|
223
|
+
db.insert(blobReferencesTable).values({
|
|
224
|
+
id: randomUUID(),
|
|
225
|
+
blobHash: hash,
|
|
226
|
+
evalId: refContext.evalId,
|
|
227
|
+
testIdx: refContext.testIdx,
|
|
228
|
+
promptIdx: refContext.promptIdx,
|
|
229
|
+
location: refContext.location,
|
|
230
|
+
kind: refContext.kind
|
|
231
|
+
}).run();
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
export { BLOB_MAX_SIZE as a, storeBlob as i, getBlobUrl as n, BLOB_MIN_SIZE as o, recordBlobReference as r, getBlobByHash as t };
|
|
235
|
+
|
|
236
|
+
//# sourceMappingURL=blobs-qTYm-1PY.js.map
|