promptfoo 0.121.1 → 0.121.3

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.
Files changed (316) hide show
  1. package/README.md +2 -0
  2. package/dist/src/{accounts-xrUGFA6n.js → accounts-B2XmGjty.js} +5 -5
  3. package/dist/src/{accounts-Bx-x3bmW.cjs → accounts-BPyfpSeU.cjs} +5 -5
  4. package/dist/src/{accounts-CMqkzrVf.js → accounts-CFLK3mnD.js} +6 -6
  5. package/dist/src/{accounts-BgNJDBE6.js → accounts-Xatc0RYb.js} +5 -5
  6. package/dist/src/{agentic-utils-BKIN5PKu.js → agentic-utils-36epdqwB.js} +3 -3
  7. package/dist/src/{cometapi-DkXrKi5z.js → agentic-utils-D8yXo5Lm.js} +4 -61
  8. package/dist/src/{cometapi-vY6aDZgo.cjs → agentic-utils-DAVsChuB.cjs} +24 -62
  9. package/dist/src/agentic-utils-DIYAAYE7.js +153 -0
  10. package/dist/src/{agents-C-dDThPK.js → agents-BBVJCIYr.js} +226 -13
  11. package/dist/src/{agents-CErsqg5U.cjs → agents-BBWxKSM0.cjs} +7 -7
  12. package/dist/src/{agents-Dy2YpZpa.js → agents-Bqgfdokm.js} +227 -14
  13. package/dist/src/{agents-B0f4HICh.cjs → agents-CAYbM7qD.cjs} +226 -13
  14. package/dist/src/{agents-CVIn-Utx.js → agents-CLQ-P15P.js} +7 -7
  15. package/dist/src/{agents-DeH4Gu94.js → agents-CgBniSlI.js} +8 -8
  16. package/dist/src/{agents-CXknwsFX.js → agents-DSSTV4bv.js} +226 -13
  17. package/dist/src/{agents-aF4-T121.js → agents-wg3ohknq.js} +7 -7
  18. package/dist/src/{aimlapi-tg0Gkcvr.cjs → aimlapi-Bv8Fmc-b.cjs} +14 -14
  19. package/dist/src/{aimlapi-BNfTBexL.js → aimlapi-BwGC1TtS.js} +13 -13
  20. package/dist/src/{aimlapi-BAGZDo5G.js → aimlapi-DaC3qZ-o.js} +14 -14
  21. package/dist/src/{aimlapi-DHRKlBEA.js → aimlapi-MgSLdvy7.js} +13 -13
  22. package/dist/src/app/assets/index-B6l9CVVb.js +439 -0
  23. package/dist/src/app/assets/index-DyZ0Ep37.css +1 -0
  24. package/dist/src/app/assets/sync-CStkzc6u.js +4 -0
  25. package/dist/src/app/assets/vendor-charts-BnDWwBlI.js +36 -0
  26. package/dist/src/app/assets/vendor-markdown-Bz7N-ca6.js +29 -0
  27. package/dist/src/app/index.html +4 -4
  28. package/dist/src/{audio-tf_NBjlC.js → audio-Bn44pQxv.js} +4 -4
  29. package/dist/src/{audio-CHQ4r-RV.js → audio-DDA5WHdx.js} +4 -4
  30. package/dist/src/{audio-BWeaWovU.cjs → audio-DVFjQ67_.cjs} +4 -4
  31. package/dist/src/{audio-BRODU0UK.js → audio-DjU9GswO.js} +5 -5
  32. package/dist/src/{base-DBtwl2FR.cjs → base-BboXIF_0.cjs} +3 -3
  33. package/dist/src/{base-B4QJRyFS.js → base-CKjwebIH.js} +3 -3
  34. package/dist/src/{base-B0tcrnq_.js → base-CqzQ4K8j.js} +3 -3
  35. package/dist/src/{base-fEDN28WM.js → base-Cz2ZC_iA.js} +3 -3
  36. package/dist/src/{blobs-BAU-dXan.js → blobs-B1JriOyi.js} +3 -3
  37. package/dist/src/{blobs-qTYm-1PY.js → blobs-BUWmKWzo.js} +3 -3
  38. package/dist/src/{blobs-DvS-O6be.cjs → blobs-C6j0bvFz.cjs} +3 -3
  39. package/dist/src/{blobs-Bpg5rH6i.js → blobs-DXTl6J3H.js} +3 -3
  40. package/dist/src/{cache-COish3-W.cjs → cache-C5yFZ4gC.cjs} +75 -58
  41. package/dist/src/{cache-8XhNqPKW.js → cache-CaT5tPgo.js} +75 -58
  42. package/dist/src/cache-CyCanoMu.js +6 -0
  43. package/dist/src/{cache-CG0SlR1d.js → cache-DSqR6ezl.js} +75 -58
  44. package/dist/src/cache-Df_QFDNu.cjs +5 -0
  45. package/dist/src/{cache-D3eqDYGU.js → cache-HP0NP4k3.js} +75 -58
  46. package/dist/src/{chat-DHMH-N64.js → chat-B-52XYI1.js} +12 -12
  47. package/dist/src/{chat-BKm79wib.js → chat-B0iaWhoh.js} +16 -14
  48. package/dist/src/{chat-DxysjBvt.js → chat-BE0qTA8e.js} +13 -13
  49. package/dist/src/{chat-CRWNNq73.js → chat-BEwdgGEg.js} +16 -14
  50. package/dist/src/{chat-2K608PeQ.cjs → chat-BtIKkLKx.cjs} +13 -13
  51. package/dist/src/{chat-DaqekjFr.cjs → chat-CM8qWR3_.cjs} +17 -15
  52. package/dist/src/{chat-CM_kyI8B.js → chat-DK1U-eZ-.js} +12 -12
  53. package/dist/src/{chat-CznLWr_D.js → chat-pxmiVpWe.js} +16 -14
  54. package/dist/src/{chatkit-65VXf5SR.js → chatkit-BYGQlHlV.js} +4 -4
  55. package/dist/src/{chatkit-DKyPi1Gs.cjs → chatkit-Cx174XI3.cjs} +4 -4
  56. package/dist/src/{chatkit-BxFvW8KY.js → chatkit-_8eJqKcD.js} +4 -4
  57. package/dist/src/{chatkit-Be-Q-a9F.js → chatkit-a2D6mY6s.js} +4 -4
  58. package/dist/src/{claude-agent-sdk-CJH22shf.cjs → claude-agent-sdk-8ddRp1L2.cjs} +35 -17
  59. package/dist/src/{claude-agent-sdk-Dy5lT-Tx.js → claude-agent-sdk-Bq5EArsX.js} +33 -15
  60. package/dist/src/{claude-agent-sdk-BLTu0WBO.js → claude-agent-sdk-CMjh4LFH.js} +33 -15
  61. package/dist/src/{claude-agent-sdk-D6_k9FKA.js → claude-agent-sdk-HgbFioFw.js} +33 -15
  62. package/dist/src/cloud-DE3t1-ZI.js +4 -0
  63. package/dist/src/{cloud-Bc9526yV.js → cloud-z8KZpUoa.js} +3 -3
  64. package/dist/src/{cloudflare-ai-CWWJCRim.js → cloudflare-ai-BGyXlpXJ.js} +13 -13
  65. package/dist/src/{cloudflare-ai-C9r2sRhw.js → cloudflare-ai-Bbp26N0L.js} +13 -13
  66. package/dist/src/{cloudflare-ai-ClWSdor4.cjs → cloudflare-ai-C62x6MQG.cjs} +14 -14
  67. package/dist/src/{cloudflare-ai-ICsOuD-z.js → cloudflare-ai-DdKP9TKT.js} +14 -14
  68. package/dist/src/{cloudflare-gateway-D6xFc5pa.js → cloudflare-gateway-BwAaUgeW.js} +14 -14
  69. package/dist/src/{cloudflare-gateway-D6O7AlYb.js → cloudflare-gateway-D-e9i1Sn.js} +15 -15
  70. package/dist/src/{cloudflare-gateway-pXGHxJ47.js → cloudflare-gateway-DXhtXDRb.js} +15 -163
  71. package/dist/src/{cloudflare-gateway-C2_-KG5o.cjs → cloudflare-gateway-Dx36ftqF.cjs} +15 -15
  72. package/dist/src/{codex-sdk-DUwKWezN.js → codex-sdk-BQEw16R_.js} +180 -11
  73. package/dist/src/{codex-sdk-C6UMlxwV.js → codex-sdk-C_07GuVS.js} +180 -11
  74. package/dist/src/{codex-sdk-GGAw0qbD.js → codex-sdk-DE5G18dx.js} +180 -11
  75. package/dist/src/{codex-sdk-fAO0c3yA.cjs → codex-sdk-ZLKfDjqP.cjs} +181 -12
  76. package/dist/src/cometapi-BDyV-NNm.js +62 -0
  77. package/dist/src/cometapi-C3hOlM7-.cjs +62 -0
  78. package/dist/src/{cometapi-Bbjp5V4x.js → cometapi-hhL4TAh3.js} +14 -14
  79. package/dist/src/{cometapi-BasUi7-_.js → cometapi-sp7sJpBD.js} +15 -15
  80. package/dist/src/{completion-C_P3ypkJ.js → completion-BCimtq-h.js} +6 -6
  81. package/dist/src/{completion-6Mx_iXxK.js → completion-DCjv7RZ3.js} +6 -6
  82. package/dist/src/{completion-CDOouNzq.cjs → completion-DlXUhj5c.cjs} +6 -6
  83. package/dist/src/{completion-C5rtR_9P.js → completion-DoYy49ti.js} +6 -6
  84. package/dist/src/{createHash-CfZSc0b4.cjs → createHash-BYwImsYv.cjs} +2 -2
  85. package/dist/src/{docker-BwsKwxFs.cjs → docker-Cqj2-QVi.cjs} +14 -14
  86. package/dist/src/{docker-CZnqU1XV.js → docker-CxCkwMzc.js} +13 -13
  87. package/dist/src/{docker-DzxyDPIj.js → docker-DpguQj-w.js} +14 -14
  88. package/dist/src/{docker-5KcG-_86.js → docker-FeBni2dw.js} +13 -13
  89. package/dist/src/{esm-C03C-mv3.js → esm-7UIl0pPM.js} +2 -2
  90. package/dist/src/{esm-Cd1AjG1D.js → esm-CKWP3u_P.js} +3 -3
  91. package/dist/src/{esm-CnNt7sI4.cjs → esm-CipptfDu.cjs} +2 -2
  92. package/dist/src/{esm-CaIwzWR5.js → esm-SUNIX1x3.js} +3 -3
  93. package/dist/src/eval-7aEqoMs3.js +15 -0
  94. package/dist/src/{eval-DmFyWU7i.js → eval-BTqTn7lb.js} +10 -10
  95. package/dist/src/{evalResult-CDQiuUuf.js → evalResult-BkIhRdTe.js} +7 -7
  96. package/dist/src/evalResult-CYNHkk5A.js +12 -0
  97. package/dist/src/evalResult-CuvJeNiM.js +10 -0
  98. package/dist/src/{evalResult-CTG2AHOS.js → evalResult-DUDShQrm.js} +7 -7
  99. package/dist/src/{evalResult-Dap2CekP.cjs → evalResult-DpARzUCb.cjs} +7 -7
  100. package/dist/src/evalResult-tGdilrWt.cjs +10 -0
  101. package/dist/src/evaluator-BBUqRhz1.js +36 -0
  102. package/dist/src/{evaluator-DPFRbFIL.js → evaluator-BcvOGaam.js} +833 -79
  103. package/dist/src/{extractor-YMU_Gvt8.js → extractor-C8XwivI9.js} +6 -6
  104. package/dist/src/{extractor-CFG6bcWJ.js → extractor-CAZ2G3Kh.js} +6 -6
  105. package/dist/src/{extractor-DX36oYEv.cjs → extractor-DG3sSfXE.cjs} +6 -6
  106. package/dist/src/{extractor-M67RUtg6.js → extractor-D_wd8jxt.js} +6 -6
  107. package/dist/src/{fetch-4M3YRaqL.js → fetch-BiYv2BZc.js} +3 -3
  108. package/dist/src/{fetch-BxUk8odA.cjs → fetch-BnR9wSnm.cjs} +3 -3
  109. package/dist/src/{fetch-60Gzydls.js → fetch-CVAtKnI3.js} +3 -3
  110. package/dist/src/{fetch-BMv0O527.js → fetch-DoVRJZhJ.js} +4 -4
  111. package/dist/src/fetch-UWU706qb.js +5 -0
  112. package/dist/src/{genaiTracer-DN4dQywX.cjs → genaiTracer-BfxrvSUb.cjs} +2 -2
  113. package/dist/src/{graders-DOXycdlG.cjs → graders-BElhu9ZY.cjs} +126 -55
  114. package/dist/src/{graders-R9rYUM0d.js → graders-BXAJ0sbS.js} +120 -55
  115. package/dist/src/graders-BxfEguVY.js +32 -0
  116. package/dist/src/graders-CzVMbEnv.js +34 -0
  117. package/dist/src/{graders-CpdqD9PI.js → graders-DG7mhg-b.js} +120 -55
  118. package/dist/src/graders-DjCXfj0l.cjs +32 -0
  119. package/dist/src/{graders-CHO8EPM4.js → graders-RjHF8VfG.js} +120 -55
  120. package/dist/src/graders-kHzIWOKu.js +32 -0
  121. package/dist/src/{image-DTedmQPg.cjs → image--F58eEIn.cjs} +6 -6
  122. package/dist/src/{image-DJEvKveK.js → image-6WQXK8m8.js} +4 -4
  123. package/dist/src/{image-pAX56tPG.js → image-B8b6f36E.js} +6 -6
  124. package/dist/src/{image-BmEZqVmk.js → image-CoxZp9PZ.js} +6 -6
  125. package/dist/src/{image-gvmivTEe.js → image-DO0RYnjH.js} +5 -5
  126. package/dist/src/{image-CBBVXWuT.js → image-PoF6DN3x.js} +6 -6
  127. package/dist/src/{image-CDLQOcqT.cjs → image-fza3zuKs.cjs} +4 -4
  128. package/dist/src/{image-tL5hIOFh.js → image-xNbw5ph2.js} +4 -4
  129. package/dist/src/index.cjs +863 -110
  130. package/dist/src/index.d.cts +833 -60
  131. package/dist/src/index.d.ts +833 -60
  132. package/dist/src/index.js +860 -108
  133. package/dist/src/{interactiveCheck-BgLZUIt3.js → interactiveCheck-BnMYOjMu.js} +2 -2
  134. package/dist/src/{knowledgeBase-CoU-UQBg.js → knowledgeBase-Bi7CmDbx.js} +7 -7
  135. package/dist/src/{knowledgeBase-CLJybhnF.js → knowledgeBase-Ce3ofVan.js} +8 -8
  136. package/dist/src/{knowledgeBase-DjWPVqSb.js → knowledgeBase-DFRXPZl_.js} +7 -7
  137. package/dist/src/{knowledgeBase-wkxuRFhA.cjs → knowledgeBase-DqrLX8fy.cjs} +7 -7
  138. package/dist/src/{litellm-B9Hysuri.js → litellm-Bo2gQXpo.js} +16 -15
  139. package/dist/src/{litellm-ePxtr9F1.js → litellm-CKiAxnoM.js} +15 -14
  140. package/dist/src/{litellm-NYpQ8RQu.cjs → litellm-CnHI69aj.cjs} +16 -15
  141. package/dist/src/{litellm-CTfa0hqi.js → litellm-Tc294Jhj.js} +15 -14
  142. package/dist/src/{logger-KkObSCzq.js → logger-BcJBzSSA.js} +10 -14
  143. package/dist/src/{logger-DLcq4dWf.js → logger-BnkjG2jt.js} +10 -14
  144. package/dist/src/{logger-Cp1GPUjj.cjs → logger-D5iKBpu_.cjs} +27 -13
  145. package/dist/src/{logger-CT3IKMKA.js → logger-DO8_zM18.js} +10 -14
  146. package/dist/src/{luma-ray-BW9IRGIc.js → luma-ray-0ehMPt5N.js} +10 -10
  147. package/dist/src/{luma-ray-BE2mOt6N.js → luma-ray-C9q8rdQe.js} +9 -9
  148. package/dist/src/{luma-ray-Cm1KZBhs.js → luma-ray-DP0QA9qn.js} +9 -9
  149. package/dist/src/{luma-ray-B0GGNRc1.cjs → luma-ray-m9Ku2meV.cjs} +9 -9
  150. package/dist/src/main.js +69 -71
  151. package/dist/src/{messages-1x9atZmP.js → messages-DJNo37Ko.js} +14 -9
  152. package/dist/src/{messages-BLbWdsyt.js → messages-Dy9QecMs.js} +14 -9
  153. package/dist/src/{messages-1JrJs91T.cjs → messages-HJsyEh4o.cjs} +15 -10
  154. package/dist/src/{messages-D8EA0oDc.js → messages-biC_ex-p.js} +14 -9
  155. package/dist/src/{modelslab-C1OLRmVX.js → modelslab-B5J-ZM5c.js} +9 -9
  156. package/dist/src/{modelslab-CqXBy3U8.js → modelslab-BI458moT.js} +10 -10
  157. package/dist/src/{modelslab-X5-4LroM.js → modelslab-BTOT8FUO.js} +9 -9
  158. package/dist/src/{modelslab-DcOSFwKh.cjs → modelslab-IQbNg-r7.cjs} +9 -9
  159. package/dist/src/{nova-reel-DihqLeol.js → nova-reel-BZ9y-Y5s.js} +9 -9
  160. package/dist/src/{nova-reel-D9xfaMBs.cjs → nova-reel-CE5etkv9.cjs} +9 -9
  161. package/dist/src/{nova-reel-D2ZkOSyr.js → nova-reel-DEeQlnOJ.js} +10 -10
  162. package/dist/src/{nova-reel-BgS1ZWuK.js → nova-reel-Xw1SXLpg.js} +9 -9
  163. package/dist/src/{nova-sonic-Q3BOJeig.js → nova-sonic-DWswpN1E.js} +7 -7
  164. package/dist/src/{nova-sonic-DezhVUYT.js → nova-sonic-DXTLpi-r.js} +6 -6
  165. package/dist/src/{nova-sonic-DVu3mMIy.cjs → nova-sonic-N0yCm0vb.cjs} +6 -6
  166. package/dist/src/{nova-sonic-P-CdUMlV.js → nova-sonic-Ogqf-csn.js} +6 -6
  167. package/dist/src/{openai-DhbB7eWK.js → openai-BMcwgD5C.js} +2 -2
  168. package/dist/src/{openai-j-sE2O7r.js → openai-BcB5KlTk.js} +2 -2
  169. package/dist/src/{openai-Cuif0GEt.cjs → openai-CoxGAQwn.cjs} +2 -2
  170. package/dist/src/{openai-DElQ-fPX.js → openai-D6wITiVn.js} +2 -2
  171. package/dist/src/{openclaw-Bv1DINsX.js → openclaw-0Sv7AK3O.js} +172 -109
  172. package/dist/src/{openclaw-DAfWQn-o.cjs → openclaw-CXxbKgDH.cjs} +174 -110
  173. package/dist/src/{openclaw-BiSZPL7J.js → openclaw-D1FSCps-.js} +172 -109
  174. package/dist/src/{openclaw-D1D_ej1z.js → openclaw-D2ENvu7a.js} +173 -110
  175. package/dist/src/{opencode-sdk-D95s6SnR.js → opencode-sdk-C71Z0ehR.js} +13 -13
  176. package/dist/src/{opencode-sdk-DxUPkLT7.js → opencode-sdk-CHCs7dEb.js} +12 -12
  177. package/dist/src/{opencode-sdk-C7m-wRfI.js → opencode-sdk-DDxj4QqH.js} +12 -12
  178. package/dist/src/{opencode-sdk-CfaLN8PY.cjs → opencode-sdk-WWJhnbKr.cjs} +16 -16
  179. package/dist/src/{otlpReceiver-g3ByGaXs.js → otlpReceiver-C9KlUtxh.js} +6 -6
  180. package/dist/src/{otlpReceiver--AIRW_S4.js → otlpReceiver-CZL48YfC.js} +6 -6
  181. package/dist/src/{otlpReceiver-Bn5wGB1v.js → otlpReceiver-CavGAA6k.js} +6 -6
  182. package/dist/src/{otlpReceiver-Diec4cln.cjs → otlpReceiver-DHKqJlsz.cjs} +6 -6
  183. package/dist/src/{providerRegistry-B0RUOLI_.js → providerRegistry-B9lh-_tx.js} +2 -2
  184. package/dist/src/{providerRegistry-Civky8Ar.cjs → providerRegistry-BTDgfV5h.cjs} +2 -2
  185. package/dist/src/{providerRegistry-CD8MEar9.js → providerRegistry-BkzVH5Ba.js} +2 -2
  186. package/dist/src/{providerRegistry-DM8rZYol.js → providerRegistry-CUWki5mQ.js} +2 -2
  187. package/dist/src/providers-BSLEaIQG.js +32 -0
  188. package/dist/src/{providers-CFu-TZl-.cjs → providers-CScd1wN6.cjs} +733 -464
  189. package/dist/src/{providers-CFLy1_ji.js → providers-Ch6Mr0gn.js} +795 -526
  190. package/dist/src/{providers-BKRJTjBz.js → providers-Cn73d5sr.js} +795 -526
  191. package/dist/src/providers-D-FnDg8k.cjs +31 -0
  192. package/dist/src/providers-DEYiFVAo.js +30 -0
  193. package/dist/src/{providers-B3HvufyI.js → providers-DvddrgxL.js} +795 -526
  194. package/dist/src/providers-sS2WI8YD.js +30 -0
  195. package/dist/src/{pythonUtils-D6fwaDSg.js → pythonUtils-Bzwbgpbg.js} +3 -3
  196. package/dist/src/{pythonUtils-D5nxkQ0P.js → pythonUtils-Cpo0Ez1p.js} +3 -3
  197. package/dist/src/{pythonUtils-CTU3Y3lw.cjs → pythonUtils-dAVigVK-.cjs} +3 -3
  198. package/dist/src/{pythonUtils-C3py6GC1.js → pythonUtils-wIqk7zAf.js} +3 -3
  199. package/dist/src/{quiverai-CI6gYJVI.js → quiverai-BeofbLVc.js} +4 -4
  200. package/dist/src/{quiverai-MHSxbmmZ.js → quiverai-CCQn73lq.js} +5 -5
  201. package/dist/src/{quiverai-CLkWkyZc.cjs → quiverai-CcUhPIBg.cjs} +4 -4
  202. package/dist/src/{quiverai-C2jVwbH1.js → quiverai-DVSEqJiq.js} +4 -4
  203. package/dist/src/{render-Drod8m7K.js → render-BHl6QVq9.js} +3 -3
  204. package/dist/src/{responses-CGw0DCzh.js → responses-BKP_WYis.js} +16 -12
  205. package/dist/src/{responses-BKqJmhhc.js → responses-CQb1Tj69.js} +16 -12
  206. package/dist/src/{responses-jxdehPkC.js → responses-CgNyTPsY.js} +16 -12
  207. package/dist/src/{responses-tD4Bd4dc.cjs → responses-mo0KQDbu.cjs} +16 -12
  208. package/dist/src/rubyUtils-B1HXG4ej.cjs +4 -0
  209. package/dist/src/{rubyUtils-DhCAlxZr.cjs → rubyUtils-CGeUtCfW.cjs} +3 -3
  210. package/dist/src/{rubyUtils-Boc4HZzX.js → rubyUtils-CiVfln3g.js} +3 -3
  211. package/dist/src/{rubyUtils-BcuGX77l.js → rubyUtils-DECSbsfY.js} +3 -3
  212. package/dist/src/{rubyUtils-BUVePouc.js → rubyUtils-PgU-gHmx.js} +3 -3
  213. package/dist/src/rubyUtils-Rt6pKA96.js +5 -0
  214. package/dist/src/{sagemaker-BK4Zb993.js → sagemaker-CVv8W7so.js} +17 -17
  215. package/dist/src/{sagemaker-D2Q1c-sD.js → sagemaker-CqeASYE5.js} +17 -17
  216. package/dist/src/{sagemaker-BfiWTmvn.js → sagemaker-MUbD5V3v.js} +18 -18
  217. package/dist/src/{sagemaker-CcQHM1jV.cjs → sagemaker-jiw1wQa-.cjs} +17 -17
  218. package/dist/src/{scanner-J8CA3LsV.js → scanner-DVDeUz1r.js} +10 -10
  219. package/dist/src/server/index.js +864 -112
  220. package/dist/src/server-B0Xh1Gx-.js +7 -0
  221. package/dist/src/{server-B0PPuDw-.cjs → server-BtoCXeXI.cjs} +4 -4
  222. package/dist/src/{server-BC7XJFgr.js → server-CP9qKM40.js} +4 -4
  223. package/dist/src/{server-OAs3nBRT.js → server-Cns05F1j.js} +5 -5
  224. package/dist/src/server-DJTKu9IR.cjs +5 -0
  225. package/dist/src/{server-DbFphssR.js → server-DZ9MtCn0.js} +6 -6
  226. package/dist/src/{signal-BOTbd53Z.js → signal-C3ZTsUgi.js} +3 -3
  227. package/dist/src/{slack-DXMKtA-f.js → slack-2sdpGzbt.js} +2 -2
  228. package/dist/src/{slack-BmVAVGaK.cjs → slack-94iG3T0s.cjs} +2 -2
  229. package/dist/src/{slack-DCUPTzS2.js → slack-BR0HtO3K.js} +2 -2
  230. package/dist/src/{slack-DOdy_kyv.js → slack-DCEV-vWP.js} +2 -2
  231. package/dist/src/store-C5u6MgC8.js +6 -0
  232. package/dist/src/{store-BSc-TF2w.cjs → store-CLyU7AtI.cjs} +17 -5
  233. package/dist/src/store-CNHk-De4.cjs +5 -0
  234. package/dist/src/{store-DQLEjuEO.js → store-Cj258DgL.js} +17 -5
  235. package/dist/src/{store-D1tv90v3.js → store-P8OKm19S.js} +17 -5
  236. package/dist/src/{store-Ub2vaGJ1.js → store-VB0GP46K.js} +17 -5
  237. package/dist/src/{tables-xKANLRBD.js → tables-BEIFz2tM.js} +3 -3
  238. package/dist/src/{tables-C7K-XKWp.cjs → tables-BdZQEpRz.cjs} +3 -3
  239. package/dist/src/{tables-D36WTqKX.js → tables-DmzvLbeZ.js} +3 -3
  240. package/dist/src/{tables-5EvT_Bwn.js → tables-kC7R5kiK.js} +3 -3
  241. package/dist/src/{telemetry-C2YDkUQH.js → telemetry-BnH5VJAU.js} +4 -4
  242. package/dist/src/{telemetry-C15ziL8u.js → telemetry-BugWqKiu.js} +4 -4
  243. package/dist/src/{telemetry-DMb2Mpfm.js → telemetry-DPXLd7UE.js} +4 -4
  244. package/dist/src/telemetry-Yig0Tino.js +7 -0
  245. package/dist/src/telemetry-p8Pwqm1i.cjs +5 -0
  246. package/dist/src/{telemetry-CbrnxHp_.cjs → telemetry-re627Lre.cjs} +4 -4
  247. package/dist/src/{transcription-CL78qbOU.cjs → transcription-BvtsrzRG.cjs} +13 -13
  248. package/dist/src/{transcription-DAtxHhAM.js → transcription-CaMivnjG.js} +13 -13
  249. package/dist/src/{transcription-QHh3AH6Z.js → transcription-DOMMTu01.js} +14 -14
  250. package/dist/src/{transcription-LNZTNUUL.js → transcription-Hb3VnC4M.js} +13 -13
  251. package/dist/src/{transform-DOcQeLld.cjs → transform-0BwoBsvO.cjs} +19 -5
  252. package/dist/src/{transform-DGxXocjk.js → transform-B2-jIv68.js} +8 -6
  253. package/dist/src/{transform-DECvGmzp.js → transform-BqPkNPYm.js} +4 -4
  254. package/dist/src/{transform-aa6tmVpZ.js → transform-BzK09Q_9.js} +4 -4
  255. package/dist/src/transform-ChNIpHz7.js +6 -0
  256. package/dist/src/{transform-Cgi24fJ7.js → transform-DrleutM3.js} +8 -6
  257. package/dist/src/{transform-DGLazrMm.js → transform-DyDAwEpE.js} +8 -6
  258. package/dist/src/transform-PtQ6rAE3.cjs +5 -0
  259. package/dist/src/{transform-CzK1Q0zl.cjs → transform-ZrG2dvlo.cjs} +4 -4
  260. package/dist/src/{transform-DilY9wbS.js → transform-ljLYHEPh.js} +4 -4
  261. package/dist/src/{transformersAvailability-CEVM2GNQ.js → transformersAvailability-BGkzavwb.js} +1 -1
  262. package/dist/src/{transformersAvailability-CwayUSlh.cjs → transformersAvailability-DKoRtQLy.cjs} +1 -1
  263. package/dist/src/{types-CH3Ge2sE.js → types-CIhFeUC4.js} +45 -11
  264. package/dist/src/{types-CN_TZ2GJ.js → types-Cd3ygw8W.js} +45 -11
  265. package/dist/src/{types-LJ0r3wbR.cjs → types-D8cGDZbL.cjs} +46 -12
  266. package/dist/src/{types-CLKiCBW3.js → types-q8GXGF65.js} +45 -11
  267. package/dist/src/{util-CchiqXh_.cjs → util--9u9UVCt.cjs} +3 -3
  268. package/dist/src/{util-5cB-L7U3.js → util-BLvy9qfE.js} +7 -11
  269. package/dist/src/{util-YT5HPZaS.js → util-Bm3E9jpK.js} +7 -11
  270. package/dist/src/{util-6-GqIvzS.js → util-BtoGs5Cb.js} +18 -4
  271. package/dist/src/{util-Db0a0AFH.cjs → util-CFj4YKIn.cjs} +18 -4
  272. package/dist/src/{util-Dlz_Wvgm.js → util-CMMkIxfU.js} +7 -11
  273. package/dist/src/{util-Betm42rL.js → util-CgDCK4KI.js} +18 -4
  274. package/dist/src/{util-Yz-1aEhW.cjs → util-CuLo2pMR.cjs} +7 -11
  275. package/dist/src/{util-C-PPYSMq.js → util-DM2rTn_6.js} +18 -4
  276. package/dist/src/{util-B7T3SiBS.js → util-DMFeUvLz.js} +3 -3
  277. package/dist/src/{util-ZZH-3QZz.js → util-DbVG-yZU.js} +3 -3
  278. package/dist/src/{util-DaWTWKBK.js → util-vNmDL5DT.js} +3 -3
  279. package/dist/src/{utils-XiOAgly5.js → utils-CFxO9KGo.js} +2 -2
  280. package/dist/src/{utils-f2-Moju7.js → utils-DEuL4VNB.js} +2 -2
  281. package/dist/src/{utils-Cz9qXqII.cjs → utils-DKw8mrgr.cjs} +3 -3
  282. package/dist/src/{utils-dLokC-eR.js → utils-DOjD4dTC.js} +2 -2
  283. package/dist/tsconfig.tsbuildinfo +1 -1
  284. package/package.json +38 -38
  285. package/dist/src/app/assets/index-BFCZg7hQ.js +0 -439
  286. package/dist/src/app/assets/index-NCn4eVBv.css +0 -1
  287. package/dist/src/app/assets/sync-9qqYcY-B.js +0 -4
  288. package/dist/src/app/assets/vendor-charts-CCl15Imd.js +0 -36
  289. package/dist/src/app/assets/vendor-markdown-0tekx3KX.js +0 -29
  290. package/dist/src/cache-Bbn1Nyrd.cjs +0 -5
  291. package/dist/src/cache-BwsMSda7.js +0 -6
  292. package/dist/src/cloud-DmE0EwsY.js +0 -4
  293. package/dist/src/eval-17JizQIv.js +0 -15
  294. package/dist/src/evalResult-Cqj8pldJ.js +0 -12
  295. package/dist/src/evalResult-DvcJAWJU.cjs +0 -10
  296. package/dist/src/evalResult-Hftn-S_i.js +0 -10
  297. package/dist/src/evaluator-B2CFNt-P.js +0 -36
  298. package/dist/src/fetch-KV5kNASw.js +0 -5
  299. package/dist/src/graders-Bu0H9nXi.js +0 -32
  300. package/dist/src/graders-Cfhkvx-e.js +0 -34
  301. package/dist/src/graders-DClJVpGP.cjs +0 -32
  302. package/dist/src/graders-DcnJsrMO.js +0 -32
  303. package/dist/src/providers-C1rOSHiR.js +0 -32
  304. package/dist/src/providers-CxmDwEFf.cjs +0 -31
  305. package/dist/src/providers-Dodakqr0.js +0 -30
  306. package/dist/src/providers-GIQ2TcsA.js +0 -30
  307. package/dist/src/rubyUtils-BUHu6PhO.js +0 -5
  308. package/dist/src/rubyUtils-CP42kMvq.cjs +0 -4
  309. package/dist/src/server-B1vi21hA.js +0 -7
  310. package/dist/src/server-Cm9Kai_h.cjs +0 -5
  311. package/dist/src/store-BNmZ1KAz.cjs +0 -5
  312. package/dist/src/store-BltJg2cd.js +0 -6
  313. package/dist/src/telemetry-5BCRNBbe.cjs +0 -5
  314. package/dist/src/telemetry-D4W5hboe.js +0 -7
  315. package/dist/src/transform-DTGDnAzW.js +0 -6
  316. package/dist/src/transform-m3qNw4KP.cjs +0 -5
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
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";
2
+ import { s as logger, x as getConfigDirectoryPath } from "./logger-BcJBzSSA.js";
3
+ import { g as getDb, n as blobReferencesTable, t as blobAssetsTable } from "./tables-DmzvLbeZ.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";
@@ -234,4 +234,4 @@ async function recordBlobReference(hash, refContext) {
234
234
  //#endregion
235
235
  export { BLOB_MAX_SIZE as a, storeBlob as i, getBlobUrl as n, BLOB_MIN_SIZE as o, recordBlobReference as r, getBlobByHash as t };
236
236
 
237
- //# sourceMappingURL=blobs-BAU-dXan.js.map
237
+ //# sourceMappingURL=blobs-B1JriOyi.js.map
@@ -1,5 +1,5 @@
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";
1
+ import { a as logger, y as getConfigDirectoryPath } from "./logger-BnkjG2jt.js";
2
+ import { h as getDb, n as blobReferencesTable, t as blobAssetsTable } from "./tables-BEIFz2tM.js";
3
3
  import * as fs$1 from "node:fs";
4
4
  import * as path$1 from "node:path";
5
5
  import * as fsPromises$1 from "node:fs/promises";
@@ -233,4 +233,4 @@ async function recordBlobReference(hash, refContext) {
233
233
  //#endregion
234
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
235
 
236
- //# sourceMappingURL=blobs-qTYm-1PY.js.map
236
+ //# sourceMappingURL=blobs-BUWmKWzo.js.map
@@ -1,5 +1,5 @@
1
- const require_logger = require("./logger-Cp1GPUjj.cjs");
2
- const require_tables = require("./tables-C7K-XKWp.cjs");
1
+ const require_logger = require("./logger-D5iKBpu_.cjs");
2
+ const require_tables = require("./tables-BdZQEpRz.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");
@@ -262,4 +262,4 @@ Object.defineProperty(exports, "storeBlob", {
262
262
  }
263
263
  });
264
264
 
265
- //# sourceMappingURL=blobs-DvS-O6be.cjs.map
265
+ //# sourceMappingURL=blobs-C6j0bvFz.cjs.map
@@ -1,5 +1,5 @@
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";
1
+ import { a as logger, y as getConfigDirectoryPath } from "./logger-DO8_zM18.js";
2
+ import { n as blobReferencesTable, p as getDb, t as blobAssetsTable } from "./tables-kC7R5kiK.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";
@@ -230,4 +230,4 @@ async function recordBlobReference(hash, refContext) {
230
230
  //#endregion
231
231
  export { BLOB_MIN_SIZE as a, BLOB_MAX_SIZE as i, recordBlobReference as n, storeBlob as r, getBlobByHash as t };
232
232
 
233
- //# sourceMappingURL=blobs-Bpg5rH6i.js.map
233
+ //# sourceMappingURL=blobs-DXTl6J3H.js.map
@@ -1,5 +1,5 @@
1
- const require_logger = require("./logger-Cp1GPUjj.cjs");
2
- const require_fetch = require("./fetch-BxUk8odA.cjs");
1
+ const require_logger = require("./logger-D5iKBpu_.cjs");
2
+ const require_fetch = require("./fetch-BnR9wSnm.cjs");
3
3
  let fs = require("fs");
4
4
  fs = require_logger.__toESM(fs);
5
5
  let path = require("path");
@@ -608,6 +608,31 @@ function getCache() {
608
608
  }
609
609
  return cacheInstance;
610
610
  }
611
+ const inflightFetchResponses = /* @__PURE__ */ new Map();
612
+ function serializeFetchResponse(data, status, statusText, headers, latencyMs) {
613
+ return JSON.stringify({
614
+ data,
615
+ status,
616
+ statusText,
617
+ headers,
618
+ latencyMs
619
+ });
620
+ }
621
+ function deserializeFetchResponse(response, cached, cache, cacheKey) {
622
+ const parsedResponse = JSON.parse(response);
623
+ return {
624
+ cached,
625
+ data: parsedResponse.data,
626
+ status: parsedResponse.status,
627
+ statusText: parsedResponse.statusText,
628
+ headers: parsedResponse.headers,
629
+ latencyMs: parsedResponse.latencyMs,
630
+ deleteFromCache: async () => {
631
+ await cache.del(cacheKey);
632
+ require_logger.logger.debug(`Evicted from cache: ${cacheKey}`);
633
+ }
634
+ };
635
+ }
611
636
  async function fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent) {
612
637
  const maxBodyRetries = isIdempotent ? 2 : 0;
613
638
  for (let bodyAttempt = 0; bodyAttempt <= maxBodyRetries; bodyAttempt++) {
@@ -637,6 +662,35 @@ async function fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent)
637
662
  }
638
663
  throw new Error("Exhausted body retries without returning or throwing");
639
664
  }
665
+ async function prepareFetchResponse(url, options, timeout, maxRetries, isIdempotent, format) {
666
+ const result = await fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent);
667
+ const response = result.resp;
668
+ const responseText = result.respText;
669
+ const fetchLatencyMs = result.fetchLatencyMs;
670
+ const headers = Object.fromEntries(response.headers.entries());
671
+ try {
672
+ const parsedData = format === "json" ? JSON.parse(responseText) : responseText;
673
+ const serializedResponse = serializeFetchResponse(parsedData, response.status, response.statusText, headers, fetchLatencyMs);
674
+ if (!response.ok) return {
675
+ response: responseText === "" ? serializeFetchResponse(`Empty Response: ${response.status}: ${response.statusText}`, response.status, response.statusText, headers, fetchLatencyMs) : serializedResponse,
676
+ cacheable: false
677
+ };
678
+ if (format === "json" && parsedData?.error) {
679
+ require_logger.logger.debug(`Not caching ${url} because it contains an 'error' key: ${parsedData.error}`);
680
+ return {
681
+ response: serializedResponse,
682
+ cacheable: false
683
+ };
684
+ }
685
+ require_logger.logger.debug(`Storing ${url} response in cache with latencyMs=${fetchLatencyMs}: ${serializedResponse}`);
686
+ return {
687
+ response: serializedResponse,
688
+ cacheable: true
689
+ };
690
+ } catch (err) {
691
+ throw new Error(`Error parsing response from ${url}: ${err.message}. Received text: ${responseText}`);
692
+ }
693
+ }
640
694
  async function fetchWithCache(url, options = {}, timeout = require_fetch.REQUEST_TIMEOUT_MS, format = "json", bust = false, maxRetries) {
641
695
  const method = (options.method ?? (url instanceof Request ? url.method : "GET")).toUpperCase();
642
696
  const isIdempotent = [
@@ -666,61 +720,23 @@ async function fetchWithCache(url, options = {}, timeout = require_fetch.REQUEST
666
720
  delete copy.headers;
667
721
  const cacheKey = `fetch:v2:${url}:${JSON.stringify(copy)}`;
668
722
  const cache = await getCache();
669
- let cached = true;
670
- let errorResponse = null;
671
- let fetchLatencyMs;
672
- const cachedResponse = await cache.wrap(cacheKey, async () => {
673
- cached = false;
674
- const result = await fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent);
675
- const response = result.resp;
676
- const responseText = result.respText;
677
- fetchLatencyMs = result.fetchLatencyMs;
678
- const headers = Object.fromEntries(response.headers.entries());
679
- try {
680
- const parsedData = format === "json" ? JSON.parse(responseText) : responseText;
681
- const data = JSON.stringify({
682
- data: parsedData,
683
- status: response.status,
684
- statusText: response.statusText,
685
- headers,
686
- latencyMs: fetchLatencyMs
687
- });
688
- if (!response.ok) {
689
- if (responseText == "") errorResponse = JSON.stringify({
690
- data: `Empty Response: ${response.status}: ${response.statusText}`,
691
- status: response.status,
692
- statusText: response.statusText,
693
- headers,
694
- latencyMs: fetchLatencyMs
695
- });
696
- else errorResponse = data;
697
- return;
698
- }
699
- if (!data) return;
700
- if (format === "json" && parsedData?.error) {
701
- require_logger.logger.debug(`Not caching ${url} because it contains an 'error' key: ${parsedData.error}`);
702
- return data;
703
- }
704
- require_logger.logger.debug(`Storing ${url} response in cache with latencyMs=${fetchLatencyMs}: ${data}`);
705
- return data;
706
- } catch (err) {
707
- throw new Error(`Error parsing response from ${url}: ${err.message}. Received text: ${responseText}`);
708
- }
709
- });
710
- if (cached && cachedResponse) require_logger.logger.debug(`Returning cached response for ${url}: ${cachedResponse}`);
711
- const parsedResponse = JSON.parse(cachedResponse ?? errorResponse);
712
- return {
713
- cached,
714
- data: parsedResponse.data,
715
- status: parsedResponse.status,
716
- statusText: parsedResponse.statusText,
717
- headers: parsedResponse.headers,
718
- latencyMs: parsedResponse.latencyMs,
719
- deleteFromCache: async () => {
720
- await cache.del(cacheKey);
721
- require_logger.logger.debug(`Evicted from cache: ${cacheKey}`);
722
- }
723
- };
723
+ const cachedResponse = await cache.get(cacheKey);
724
+ if (cachedResponse != null) {
725
+ require_logger.logger.debug(`Returning cached response for ${url}: ${cachedResponse}`);
726
+ return deserializeFetchResponse(cachedResponse, true, cache, cacheKey);
727
+ }
728
+ let inflightResponse = inflightFetchResponses.get(cacheKey);
729
+ if (!inflightResponse) {
730
+ inflightResponse = (async () => {
731
+ const preparedResponse = await prepareFetchResponse(url, options, timeout, maxRetries, isIdempotent, format);
732
+ if (preparedResponse.cacheable) await cache.set(cacheKey, preparedResponse.response);
733
+ return preparedResponse.response;
734
+ })().finally(() => {
735
+ inflightFetchResponses.delete(cacheKey);
736
+ });
737
+ inflightFetchResponses.set(cacheKey, inflightResponse);
738
+ }
739
+ return deserializeFetchResponse(await inflightResponse, false, cache, cacheKey);
724
740
  }
725
741
  function enableCache() {
726
742
  enabled = true;
@@ -729,6 +745,7 @@ function disableCache() {
729
745
  enabled = false;
730
746
  }
731
747
  async function clearCache() {
748
+ inflightFetchResponses.clear();
732
749
  return getCache().clear();
733
750
  }
734
751
  function isCacheEnabled() {
@@ -796,4 +813,4 @@ Object.defineProperty(exports, "isTransientConnectionError", {
796
813
  }
797
814
  });
798
815
 
799
- //# sourceMappingURL=cache-COish3-W.cjs.map
816
+ //# sourceMappingURL=cache-C5yFZ4gC.cjs.map
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./chunk-DEq-mXcV.js";
2
- import { _ as getEnvBool, b as getEnvString, g as getConfigDirectoryPath, i as logger, y as getEnvInt } from "./logger-CT3IKMKA.js";
3
- import { d as sleep, n as fetchWithRetries, p as REQUEST_TIMEOUT_MS } from "./fetch-60Gzydls.js";
2
+ import { C as getEnvString, S as getEnvInt, a as logger, b as getEnvBool, y as getConfigDirectoryPath } from "./logger-DO8_zM18.js";
3
+ import { d as sleep, n as fetchWithRetries, p as REQUEST_TIMEOUT_MS } from "./fetch-CVAtKnI3.js";
4
4
  import fs from "fs";
5
5
  import path from "path";
6
6
  import { createCache } from "cache-manager";
@@ -607,6 +607,31 @@ function getCache() {
607
607
  }
608
608
  return cacheInstance;
609
609
  }
610
+ const inflightFetchResponses = /* @__PURE__ */ new Map();
611
+ function serializeFetchResponse(data, status, statusText, headers, latencyMs) {
612
+ return JSON.stringify({
613
+ data,
614
+ status,
615
+ statusText,
616
+ headers,
617
+ latencyMs
618
+ });
619
+ }
620
+ function deserializeFetchResponse(response, cached, cache, cacheKey) {
621
+ const parsedResponse = JSON.parse(response);
622
+ return {
623
+ cached,
624
+ data: parsedResponse.data,
625
+ status: parsedResponse.status,
626
+ statusText: parsedResponse.statusText,
627
+ headers: parsedResponse.headers,
628
+ latencyMs: parsedResponse.latencyMs,
629
+ deleteFromCache: async () => {
630
+ await cache.del(cacheKey);
631
+ logger.debug(`Evicted from cache: ${cacheKey}`);
632
+ }
633
+ };
634
+ }
610
635
  async function fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent) {
611
636
  const maxBodyRetries = isIdempotent ? 2 : 0;
612
637
  for (let bodyAttempt = 0; bodyAttempt <= maxBodyRetries; bodyAttempt++) {
@@ -636,6 +661,35 @@ async function fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent)
636
661
  }
637
662
  throw new Error("Exhausted body retries without returning or throwing");
638
663
  }
664
+ async function prepareFetchResponse(url, options, timeout, maxRetries, isIdempotent, format) {
665
+ const result = await fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent);
666
+ const response = result.resp;
667
+ const responseText = result.respText;
668
+ const fetchLatencyMs = result.fetchLatencyMs;
669
+ const headers = Object.fromEntries(response.headers.entries());
670
+ try {
671
+ const parsedData = format === "json" ? JSON.parse(responseText) : responseText;
672
+ const serializedResponse = serializeFetchResponse(parsedData, response.status, response.statusText, headers, fetchLatencyMs);
673
+ if (!response.ok) return {
674
+ response: responseText === "" ? serializeFetchResponse(`Empty Response: ${response.status}: ${response.statusText}`, response.status, response.statusText, headers, fetchLatencyMs) : serializedResponse,
675
+ cacheable: false
676
+ };
677
+ if (format === "json" && parsedData?.error) {
678
+ logger.debug(`Not caching ${url} because it contains an 'error' key: ${parsedData.error}`);
679
+ return {
680
+ response: serializedResponse,
681
+ cacheable: false
682
+ };
683
+ }
684
+ logger.debug(`Storing ${url} response in cache with latencyMs=${fetchLatencyMs}: ${serializedResponse}`);
685
+ return {
686
+ response: serializedResponse,
687
+ cacheable: true
688
+ };
689
+ } catch (err) {
690
+ throw new Error(`Error parsing response from ${url}: ${err.message}. Received text: ${responseText}`);
691
+ }
692
+ }
639
693
  async function fetchWithCache(url, options = {}, timeout = REQUEST_TIMEOUT_MS, format = "json", bust = false, maxRetries) {
640
694
  const method = (options.method ?? (url instanceof Request ? url.method : "GET")).toUpperCase();
641
695
  const isIdempotent = [
@@ -665,61 +719,23 @@ async function fetchWithCache(url, options = {}, timeout = REQUEST_TIMEOUT_MS, f
665
719
  delete copy.headers;
666
720
  const cacheKey = `fetch:v2:${url}:${JSON.stringify(copy)}`;
667
721
  const cache = await getCache();
668
- let cached = true;
669
- let errorResponse = null;
670
- let fetchLatencyMs;
671
- const cachedResponse = await cache.wrap(cacheKey, async () => {
672
- cached = false;
673
- const result = await fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent);
674
- const response = result.resp;
675
- const responseText = result.respText;
676
- fetchLatencyMs = result.fetchLatencyMs;
677
- const headers = Object.fromEntries(response.headers.entries());
678
- try {
679
- const parsedData = format === "json" ? JSON.parse(responseText) : responseText;
680
- const data = JSON.stringify({
681
- data: parsedData,
682
- status: response.status,
683
- statusText: response.statusText,
684
- headers,
685
- latencyMs: fetchLatencyMs
686
- });
687
- if (!response.ok) {
688
- if (responseText == "") errorResponse = JSON.stringify({
689
- data: `Empty Response: ${response.status}: ${response.statusText}`,
690
- status: response.status,
691
- statusText: response.statusText,
692
- headers,
693
- latencyMs: fetchLatencyMs
694
- });
695
- else errorResponse = data;
696
- return;
697
- }
698
- if (!data) return;
699
- if (format === "json" && parsedData?.error) {
700
- logger.debug(`Not caching ${url} because it contains an 'error' key: ${parsedData.error}`);
701
- return data;
702
- }
703
- logger.debug(`Storing ${url} response in cache with latencyMs=${fetchLatencyMs}: ${data}`);
704
- return data;
705
- } catch (err) {
706
- throw new Error(`Error parsing response from ${url}: ${err.message}. Received text: ${responseText}`);
707
- }
708
- });
709
- if (cached && cachedResponse) logger.debug(`Returning cached response for ${url}: ${cachedResponse}`);
710
- const parsedResponse = JSON.parse(cachedResponse ?? errorResponse);
711
- return {
712
- cached,
713
- data: parsedResponse.data,
714
- status: parsedResponse.status,
715
- statusText: parsedResponse.statusText,
716
- headers: parsedResponse.headers,
717
- latencyMs: parsedResponse.latencyMs,
718
- deleteFromCache: async () => {
719
- await cache.del(cacheKey);
720
- logger.debug(`Evicted from cache: ${cacheKey}`);
721
- }
722
- };
722
+ const cachedResponse = await cache.get(cacheKey);
723
+ if (cachedResponse != null) {
724
+ logger.debug(`Returning cached response for ${url}: ${cachedResponse}`);
725
+ return deserializeFetchResponse(cachedResponse, true, cache, cacheKey);
726
+ }
727
+ let inflightResponse = inflightFetchResponses.get(cacheKey);
728
+ if (!inflightResponse) {
729
+ inflightResponse = (async () => {
730
+ const preparedResponse = await prepareFetchResponse(url, options, timeout, maxRetries, isIdempotent, format);
731
+ if (preparedResponse.cacheable) await cache.set(cacheKey, preparedResponse.response);
732
+ return preparedResponse.response;
733
+ })().finally(() => {
734
+ inflightFetchResponses.delete(cacheKey);
735
+ });
736
+ inflightFetchResponses.set(cacheKey, inflightResponse);
737
+ }
738
+ return deserializeFetchResponse(await inflightResponse, false, cache, cacheKey);
723
739
  }
724
740
  function enableCache() {
725
741
  enabled = true;
@@ -728,6 +744,7 @@ function disableCache() {
728
744
  enabled = false;
729
745
  }
730
746
  async function clearCache() {
747
+ inflightFetchResponses.clear();
731
748
  return getCache().clear();
732
749
  }
733
750
  function isCacheEnabled() {
@@ -736,4 +753,4 @@ function isCacheEnabled() {
736
753
  //#endregion
737
754
  export { isCacheEnabled as a, isTransientConnectionError as c, getCache as i, disableCache as n, NON_TRANSIENT_HTTP_STATUSES as o, fetchWithCache as r, isNonTransientHttpStatus as s, cache_exports as t };
738
755
 
739
- //# sourceMappingURL=cache-8XhNqPKW.js.map
756
+ //# sourceMappingURL=cache-CaT5tPgo.js.map
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import "./logger-BcJBzSSA.js";
3
+ import "./fetch-DoVRJZhJ.js";
4
+ import "./cloud-z8KZpUoa.js";
5
+ import { o as getCache, s as isCacheEnabled } from "./cache-DSqR6ezl.js";
6
+ export { getCache, isCacheEnabled };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as __exportAll } from "./chunk-DRamLcfz.js";
3
- import { C as getEnvString, S as getEnvInt, b as getEnvBool, o as logger, v as getConfigDirectoryPath } from "./logger-KkObSCzq.js";
4
- import { f as REQUEST_TIMEOUT_MS, l as sleep, r as fetchWithRetries } from "./fetch-BMv0O527.js";
3
+ import { C as getEnvBool, E as getEnvString, T as getEnvInt, s as logger, x as getConfigDirectoryPath } from "./logger-BcJBzSSA.js";
4
+ import { f as REQUEST_TIMEOUT_MS, l as sleep, r as fetchWithRetries } from "./fetch-DoVRJZhJ.js";
5
5
  import { r as isTransientConnectionError } from "./errors-P6ll7XSJ.js";
6
6
  import fs from "fs";
7
7
  import path from "path";
@@ -577,6 +577,31 @@ function getCache() {
577
577
  }
578
578
  return cacheInstance;
579
579
  }
580
+ const inflightFetchResponses = /* @__PURE__ */ new Map();
581
+ function serializeFetchResponse(data, status, statusText, headers, latencyMs) {
582
+ return JSON.stringify({
583
+ data,
584
+ status,
585
+ statusText,
586
+ headers,
587
+ latencyMs
588
+ });
589
+ }
590
+ function deserializeFetchResponse(response, cached, cache, cacheKey) {
591
+ const parsedResponse = JSON.parse(response);
592
+ return {
593
+ cached,
594
+ data: parsedResponse.data,
595
+ status: parsedResponse.status,
596
+ statusText: parsedResponse.statusText,
597
+ headers: parsedResponse.headers,
598
+ latencyMs: parsedResponse.latencyMs,
599
+ deleteFromCache: async () => {
600
+ await cache.del(cacheKey);
601
+ logger.debug(`Evicted from cache: ${cacheKey}`);
602
+ }
603
+ };
604
+ }
580
605
  async function fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent) {
581
606
  const maxBodyRetries = isIdempotent ? 2 : 0;
582
607
  for (let bodyAttempt = 0; bodyAttempt <= maxBodyRetries; bodyAttempt++) {
@@ -606,6 +631,35 @@ async function fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent)
606
631
  }
607
632
  throw new Error("Exhausted body retries without returning or throwing");
608
633
  }
634
+ async function prepareFetchResponse(url, options, timeout, maxRetries, isIdempotent, format) {
635
+ const result = await fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent);
636
+ const response = result.resp;
637
+ const responseText = result.respText;
638
+ const fetchLatencyMs = result.fetchLatencyMs;
639
+ const headers = Object.fromEntries(response.headers.entries());
640
+ try {
641
+ const parsedData = format === "json" ? JSON.parse(responseText) : responseText;
642
+ const serializedResponse = serializeFetchResponse(parsedData, response.status, response.statusText, headers, fetchLatencyMs);
643
+ if (!response.ok) return {
644
+ response: responseText === "" ? serializeFetchResponse(`Empty Response: ${response.status}: ${response.statusText}`, response.status, response.statusText, headers, fetchLatencyMs) : serializedResponse,
645
+ cacheable: false
646
+ };
647
+ if (format === "json" && parsedData?.error) {
648
+ logger.debug(`Not caching ${url} because it contains an 'error' key: ${parsedData.error}`);
649
+ return {
650
+ response: serializedResponse,
651
+ cacheable: false
652
+ };
653
+ }
654
+ logger.debug(`Storing ${url} response in cache with latencyMs=${fetchLatencyMs}: ${serializedResponse}`);
655
+ return {
656
+ response: serializedResponse,
657
+ cacheable: true
658
+ };
659
+ } catch (err) {
660
+ throw new Error(`Error parsing response from ${url}: ${err.message}. Received text: ${responseText}`);
661
+ }
662
+ }
609
663
  async function fetchWithCache(url, options = {}, timeout = REQUEST_TIMEOUT_MS, format = "json", bust = false, maxRetries) {
610
664
  const method = (options.method ?? (url instanceof Request ? url.method : "GET")).toUpperCase();
611
665
  const isIdempotent = [
@@ -635,61 +689,23 @@ async function fetchWithCache(url, options = {}, timeout = REQUEST_TIMEOUT_MS, f
635
689
  delete copy.headers;
636
690
  const cacheKey = `fetch:v2:${url}:${JSON.stringify(copy)}`;
637
691
  const cache = await getCache();
638
- let cached = true;
639
- let errorResponse = null;
640
- let fetchLatencyMs;
641
- const cachedResponse = await cache.wrap(cacheKey, async () => {
642
- cached = false;
643
- const result = await fetchAndReadBody(url, options, timeout, maxRetries, isIdempotent);
644
- const response = result.resp;
645
- const responseText = result.respText;
646
- fetchLatencyMs = result.fetchLatencyMs;
647
- const headers = Object.fromEntries(response.headers.entries());
648
- try {
649
- const parsedData = format === "json" ? JSON.parse(responseText) : responseText;
650
- const data = JSON.stringify({
651
- data: parsedData,
652
- status: response.status,
653
- statusText: response.statusText,
654
- headers,
655
- latencyMs: fetchLatencyMs
656
- });
657
- if (!response.ok) {
658
- if (responseText == "") errorResponse = JSON.stringify({
659
- data: `Empty Response: ${response.status}: ${response.statusText}`,
660
- status: response.status,
661
- statusText: response.statusText,
662
- headers,
663
- latencyMs: fetchLatencyMs
664
- });
665
- else errorResponse = data;
666
- return;
667
- }
668
- if (!data) return;
669
- if (format === "json" && parsedData?.error) {
670
- logger.debug(`Not caching ${url} because it contains an 'error' key: ${parsedData.error}`);
671
- return data;
672
- }
673
- logger.debug(`Storing ${url} response in cache with latencyMs=${fetchLatencyMs}: ${data}`);
674
- return data;
675
- } catch (err) {
676
- throw new Error(`Error parsing response from ${url}: ${err.message}. Received text: ${responseText}`);
677
- }
678
- });
679
- if (cached && cachedResponse) logger.debug(`Returning cached response for ${url}: ${cachedResponse}`);
680
- const parsedResponse = JSON.parse(cachedResponse ?? errorResponse);
681
- return {
682
- cached,
683
- data: parsedResponse.data,
684
- status: parsedResponse.status,
685
- statusText: parsedResponse.statusText,
686
- headers: parsedResponse.headers,
687
- latencyMs: parsedResponse.latencyMs,
688
- deleteFromCache: async () => {
689
- await cache.del(cacheKey);
690
- logger.debug(`Evicted from cache: ${cacheKey}`);
691
- }
692
- };
692
+ const cachedResponse = await cache.get(cacheKey);
693
+ if (cachedResponse != null) {
694
+ logger.debug(`Returning cached response for ${url}: ${cachedResponse}`);
695
+ return deserializeFetchResponse(cachedResponse, true, cache, cacheKey);
696
+ }
697
+ let inflightResponse = inflightFetchResponses.get(cacheKey);
698
+ if (!inflightResponse) {
699
+ inflightResponse = (async () => {
700
+ const preparedResponse = await prepareFetchResponse(url, options, timeout, maxRetries, isIdempotent, format);
701
+ if (preparedResponse.cacheable) await cache.set(cacheKey, preparedResponse.response);
702
+ return preparedResponse.response;
703
+ })().finally(() => {
704
+ inflightFetchResponses.delete(cacheKey);
705
+ });
706
+ inflightFetchResponses.set(cacheKey, inflightResponse);
707
+ }
708
+ return deserializeFetchResponse(await inflightResponse, false, cache, cacheKey);
693
709
  }
694
710
  function enableCache() {
695
711
  enabled = true;
@@ -698,6 +714,7 @@ function disableCache() {
698
714
  enabled = false;
699
715
  }
700
716
  async function clearCache() {
717
+ inflightFetchResponses.clear();
701
718
  return getCache().clear();
702
719
  }
703
720
  function isCacheEnabled() {
@@ -706,4 +723,4 @@ function isCacheEnabled() {
706
723
  //#endregion
707
724
  export { fetchWithCache as a, enableCache as i, clearCache as n, getCache as o, disableCache as r, isCacheEnabled as s, cache_exports as t };
708
725
 
709
- //# sourceMappingURL=cache-CG0SlR1d.js.map
726
+ //# sourceMappingURL=cache-DSqR6ezl.js.map
@@ -0,0 +1,5 @@
1
+ require("./logger-D5iKBpu_.cjs");
2
+ require("./fetch-BnR9wSnm.cjs");
3
+ const require_cache = require("./cache-C5yFZ4gC.cjs");
4
+ exports.getCache = require_cache.getCache;
5
+ exports.isCacheEnabled = require_cache.isCacheEnabled;