promptfoo 0.68.3 → 0.69.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.
Files changed (285) hide show
  1. package/dist/drizzle/0002_tidy_juggernaut.sql +1 -0
  2. package/dist/drizzle/meta/0002_snapshot.json +244 -0
  3. package/dist/drizzle/meta/_journal.json +7 -0
  4. package/dist/package.json +18 -17
  5. package/dist/src/__mocks__/database.d.ts +0 -1
  6. package/dist/src/__mocks__/database.d.ts.map +1 -1
  7. package/dist/src/__mocks__/esm.js +2 -3
  8. package/dist/src/__mocks__/esm.js.map +1 -1
  9. package/dist/src/accounts.d.ts +2 -1
  10. package/dist/src/accounts.d.ts.map +1 -1
  11. package/dist/src/accounts.js +7 -4
  12. package/dist/src/accounts.js.map +1 -1
  13. package/dist/src/assertions/AssertionsResult.js +3 -3
  14. package/dist/src/assertions/AssertionsResult.js.map +1 -1
  15. package/dist/src/assertions/validateAssertions.js +2 -2
  16. package/dist/src/assertions/validateAssertions.js.map +1 -1
  17. package/dist/src/assertions.js +6 -6
  18. package/dist/src/assertions.js.map +1 -1
  19. package/dist/src/cache.d.ts.map +1 -1
  20. package/dist/src/cache.js +6 -7
  21. package/dist/src/cache.js.map +1 -1
  22. package/dist/src/commands/config.js +1 -2
  23. package/dist/src/commands/config.js.map +1 -1
  24. package/dist/src/commands/delete.js +1 -2
  25. package/dist/src/commands/delete.js.map +1 -1
  26. package/dist/src/commands/eval/filterFailingTests.js +1 -2
  27. package/dist/src/commands/eval/filterFailingTests.js.map +1 -1
  28. package/dist/src/commands/eval/filterProviders.d.ts +3 -0
  29. package/dist/src/commands/eval/filterProviders.d.ts.map +1 -0
  30. package/dist/src/commands/eval/filterProviders.js +15 -0
  31. package/dist/src/commands/eval/filterProviders.js.map +1 -0
  32. package/dist/src/commands/eval/filterTests.js +1 -2
  33. package/dist/src/commands/eval/filterTests.js.map +1 -1
  34. package/dist/src/commands/export.js +1 -2
  35. package/dist/src/commands/export.js.map +1 -1
  36. package/dist/src/commands/import.d.ts.map +1 -1
  37. package/dist/src/commands/import.js +2 -2
  38. package/dist/src/commands/import.js.map +1 -1
  39. package/dist/src/commands/list.js +1 -2
  40. package/dist/src/commands/list.js.map +1 -1
  41. package/dist/src/commands/show.js +3 -4
  42. package/dist/src/commands/show.js.map +1 -1
  43. package/dist/src/csv.js +2 -3
  44. package/dist/src/csv.js.map +1 -1
  45. package/dist/src/database.d.ts +12 -0
  46. package/dist/src/database.d.ts.map +1 -1
  47. package/dist/src/database.js +5 -4
  48. package/dist/src/database.js.map +1 -1
  49. package/dist/src/esm.js +2 -3
  50. package/dist/src/esm.js.map +1 -1
  51. package/dist/src/evaluator.d.ts.map +1 -1
  52. package/dist/src/evaluator.js +30 -17
  53. package/dist/src/evaluator.js.map +1 -1
  54. package/dist/src/feedback.js +2 -3
  55. package/dist/src/feedback.js.map +1 -1
  56. package/dist/src/fetch.d.ts +2 -3
  57. package/dist/src/fetch.d.ts.map +1 -1
  58. package/dist/src/fetch.js +7 -6
  59. package/dist/src/fetch.js.map +1 -1
  60. package/dist/src/globalConfig.js +5 -6
  61. package/dist/src/globalConfig.js.map +1 -1
  62. package/dist/src/googleSheets.js +4 -5
  63. package/dist/src/googleSheets.js.map +1 -1
  64. package/dist/src/index.js +2 -2
  65. package/dist/src/index.js.map +1 -1
  66. package/dist/src/integrations/langfuse.js +1 -2
  67. package/dist/src/integrations/langfuse.js.map +1 -1
  68. package/dist/src/integrations/portkey.js +1 -2
  69. package/dist/src/integrations/portkey.js.map +1 -1
  70. package/dist/src/logger.js +3 -3
  71. package/dist/src/logger.js.map +1 -1
  72. package/dist/src/main.js +23 -1
  73. package/dist/src/main.js.map +1 -1
  74. package/dist/src/matchers.d.ts.map +1 -1
  75. package/dist/src/matchers.js +16 -15
  76. package/dist/src/matchers.js.map +1 -1
  77. package/dist/src/migrate.js +1 -2
  78. package/dist/src/migrate.js.map +1 -1
  79. package/dist/src/onboarding.js +2 -2
  80. package/dist/src/onboarding.js.map +1 -1
  81. package/dist/src/prompts/grading.d.ts +1 -0
  82. package/dist/src/prompts/grading.d.ts.map +1 -1
  83. package/dist/src/prompts/grading.js +21 -1
  84. package/dist/src/prompts/grading.js.map +1 -1
  85. package/dist/src/prompts/index.js +3 -4
  86. package/dist/src/prompts/index.js.map +1 -1
  87. package/dist/src/prompts/processors/javascript.d.ts +5 -1
  88. package/dist/src/prompts/processors/javascript.d.ts.map +1 -1
  89. package/dist/src/prompts/processors/javascript.js +15 -3
  90. package/dist/src/prompts/processors/javascript.js.map +1 -1
  91. package/dist/src/prompts/processors/json.js +1 -2
  92. package/dist/src/prompts/processors/json.js.map +1 -1
  93. package/dist/src/prompts/processors/jsonl.js +1 -2
  94. package/dist/src/prompts/processors/jsonl.js.map +1 -1
  95. package/dist/src/prompts/processors/python.d.ts +1 -1
  96. package/dist/src/prompts/processors/python.d.ts.map +1 -1
  97. package/dist/src/prompts/processors/python.js +24 -18
  98. package/dist/src/prompts/processors/python.js.map +1 -1
  99. package/dist/src/prompts/processors/string.js +1 -2
  100. package/dist/src/prompts/processors/string.js.map +1 -1
  101. package/dist/src/prompts/processors/text.js +1 -2
  102. package/dist/src/prompts/processors/text.js.map +1 -1
  103. package/dist/src/prompts/processors/yaml.js +1 -2
  104. package/dist/src/prompts/processors/yaml.js.map +1 -1
  105. package/dist/src/prompts/utils.js +2 -3
  106. package/dist/src/prompts/utils.js.map +1 -1
  107. package/dist/src/providers/anthropic.d.ts +5 -0
  108. package/dist/src/providers/anthropic.d.ts.map +1 -1
  109. package/dist/src/providers/anthropic.js +58 -4
  110. package/dist/src/providers/anthropic.js.map +1 -1
  111. package/dist/src/providers/azureopenaiUtil.js +1 -2
  112. package/dist/src/providers/azureopenaiUtil.js.map +1 -1
  113. package/dist/src/providers/bedrock.d.ts +3 -3
  114. package/dist/src/providers/bedrock.d.ts.map +1 -1
  115. package/dist/src/providers/bedrock.js +3 -3
  116. package/dist/src/providers/bedrock.js.map +1 -1
  117. package/dist/src/providers/defaults.d.ts +3 -0
  118. package/dist/src/providers/defaults.d.ts.map +1 -1
  119. package/dist/src/providers/defaults.js +2 -2
  120. package/dist/src/providers/defaults.js.map +1 -1
  121. package/dist/src/providers/openai.d.ts.map +1 -1
  122. package/dist/src/providers/openai.js +1 -0
  123. package/dist/src/providers/openai.js.map +1 -1
  124. package/dist/src/providers/openaiUtil.js +1 -2
  125. package/dist/src/providers/openaiUtil.js.map +1 -1
  126. package/dist/src/providers/pythonCompletion.d.ts.map +1 -1
  127. package/dist/src/providers/scriptCompletion.d.ts.map +1 -1
  128. package/dist/src/providers/shared.js +3 -3
  129. package/dist/src/providers/shared.js.map +1 -1
  130. package/dist/src/providers/vertexUtil.js +3 -4
  131. package/dist/src/providers/vertexUtil.js.map +1 -1
  132. package/dist/src/providers.d.ts.map +1 -1
  133. package/dist/src/providers.js +5 -7
  134. package/dist/src/providers.js.map +1 -1
  135. package/dist/src/python/wrapper.d.ts +1 -1
  136. package/dist/src/python/wrapper.d.ts.map +1 -1
  137. package/dist/src/python/wrapper.js +2 -3
  138. package/dist/src/python/wrapper.js.map +1 -1
  139. package/dist/src/python/wrapper.py +9 -10
  140. package/dist/src/redteam/getCompetitorTests.js +1 -2
  141. package/dist/src/redteam/getCompetitorTests.js.map +1 -1
  142. package/dist/src/redteam/getHallucinationTests.js +1 -2
  143. package/dist/src/redteam/getHallucinationTests.js.map +1 -1
  144. package/dist/src/redteam/getHarmfulTests.d.ts +16 -16
  145. package/dist/src/redteam/getHarmfulTests.d.ts.map +1 -1
  146. package/dist/src/redteam/getHarmfulTests.js +6 -6
  147. package/dist/src/redteam/getHarmfulTests.js.map +1 -1
  148. package/dist/src/redteam/getHijackingTests.js +1 -2
  149. package/dist/src/redteam/getHijackingTests.js.map +1 -1
  150. package/dist/src/redteam/getOverconfidenceTests.js +1 -2
  151. package/dist/src/redteam/getOverconfidenceTests.js.map +1 -1
  152. package/dist/src/redteam/getPiiTests.js +1 -2
  153. package/dist/src/redteam/getPiiTests.js.map +1 -1
  154. package/dist/src/redteam/getPoliticalStatementsTests.js +1 -2
  155. package/dist/src/redteam/getPoliticalStatementsTests.js.map +1 -1
  156. package/dist/src/redteam/getUnderconfidenceTests.js +2 -3
  157. package/dist/src/redteam/getUnderconfidenceTests.js.map +1 -1
  158. package/dist/src/redteam/getUnintendedContractTests.js +1 -2
  159. package/dist/src/redteam/getUnintendedContractTests.js.map +1 -1
  160. package/dist/src/redteam/index.d.ts.map +1 -1
  161. package/dist/src/redteam/index.js +28 -9
  162. package/dist/src/redteam/index.js.map +1 -1
  163. package/dist/src/redteam/iterative.d.ts.map +1 -1
  164. package/dist/src/redteam/iterative.js +15 -2
  165. package/dist/src/redteam/iterative.js.map +1 -1
  166. package/dist/src/share.d.ts.map +1 -1
  167. package/dist/src/share.js +4 -3
  168. package/dist/src/share.js.map +1 -1
  169. package/dist/src/suggestions.js +1 -2
  170. package/dist/src/suggestions.js.map +1 -1
  171. package/dist/src/table.js +2 -3
  172. package/dist/src/table.js.map +1 -1
  173. package/dist/src/testCases.js +6 -7
  174. package/dist/src/testCases.js.map +1 -1
  175. package/dist/src/types.d.ts +951 -137
  176. package/dist/src/types.d.ts.map +1 -1
  177. package/dist/src/types.js +196 -4
  178. package/dist/src/types.js.map +1 -1
  179. package/dist/src/updates.js +2 -3
  180. package/dist/src/updates.js.map +1 -1
  181. package/dist/src/util.d.ts.map +1 -1
  182. package/dist/src/util.js +67 -56
  183. package/dist/src/util.js.map +1 -1
  184. package/dist/src/web/nextui/404/index.html +1 -1
  185. package/dist/src/web/nextui/404.html +1 -1
  186. package/dist/src/web/nextui/_next/static/chunks/2-671ad31c05d2c976.js +1 -0
  187. package/dist/src/web/nextui/_next/static/chunks/{540-378a20144435cec6.js → 540-c94eb8fa0d9db136.js} +1 -1
  188. package/dist/src/web/nextui/_next/static/chunks/{166-157bfb431b68d949.js → 858-5d3a3678769b7e36.js} +1 -1
  189. package/dist/src/web/nextui/_next/static/chunks/{897-1955b232a2148365.js → 998-d370cd9f4473ff31.js} +4 -4
  190. package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/{page-0a71ecaf651124c2.js → page-3c5a944373865122.js} +1 -1
  191. package/dist/src/web/nextui/_next/static/chunks/app/eval/{page-bf3968ed106645c6.js → page-73e894c39cc191f1.js} +1 -1
  192. package/dist/src/web/nextui/_next/static/chunks/app/{layout-b7b366d291dbc9db.js → layout-2038906de6c19565.js} +1 -1
  193. package/dist/src/web/nextui/_next/static/chunks/app/progress/page-73442c531d579c51.js +1 -0
  194. package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-50e27c24c9e255bd.js +1 -0
  195. package/dist/src/web/nextui/_next/static/chunks/app/setup/{page-71b3060b06865254.js → page-26cb5d2478fdbd34.js} +1 -1
  196. package/dist/src/web/nextui/_next/static/chunks/webpack-8a9bc9ee0defb756.js +1 -0
  197. package/dist/src/web/nextui/_next/static/css/106779eb64615639.css +1 -0
  198. package/dist/src/web/nextui/_next/static/css/35ab7ce8025438b0.css +1 -0
  199. package/dist/src/web/nextui/_next/static/css/94b771e23fc5d5f5.css +1 -0
  200. package/dist/src/web/nextui/_next/static/media/05a31a2ca4975f99-s.woff2 +0 -0
  201. package/dist/src/web/nextui/_next/static/media/513657b02c5c193f-s.woff2 +0 -0
  202. package/dist/src/web/nextui/_next/static/media/51ed15f9841b9f9d-s.woff2 +0 -0
  203. package/dist/src/web/nextui/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2 +0 -0
  204. package/dist/src/web/nextui/_next/static/media/d6b16ce4a6175f26-s.woff2 +0 -0
  205. package/dist/src/web/nextui/_next/static/media/ec159349637c90ad-s.woff2 +0 -0
  206. package/dist/src/web/nextui/_next/static/media/fd4db3eb5472fc27-s.woff2 +0 -0
  207. package/dist/src/web/nextui/auth/login/index.html +1 -1
  208. package/dist/src/web/nextui/auth/login/index.txt +10 -15
  209. package/dist/src/web/nextui/auth/signup/index.html +1 -1
  210. package/dist/src/web/nextui/auth/signup/index.txt +10 -15
  211. package/dist/src/web/nextui/datasets/index.html +1 -1
  212. package/dist/src/web/nextui/datasets/index.txt +10 -15
  213. package/dist/src/web/nextui/eval/index.html +1 -1
  214. package/dist/src/web/nextui/eval/index.txt +12 -17
  215. package/dist/src/web/nextui/index.html +1 -1
  216. package/dist/src/web/nextui/index.txt +11 -16
  217. package/dist/src/web/nextui/progress/index.html +1 -1
  218. package/dist/src/web/nextui/progress/index.txt +10 -15
  219. package/dist/src/web/nextui/prompts/index.html +1 -1
  220. package/dist/src/web/nextui/prompts/index.txt +10 -15
  221. package/dist/src/web/nextui/report/index.html +1 -1
  222. package/dist/src/web/nextui/report/index.txt +12 -17
  223. package/dist/src/web/nextui/setup/index.html +2 -2
  224. package/dist/src/web/nextui/setup/index.txt +12 -17
  225. package/dist/src/web/server.js +2 -2
  226. package/dist/src/web/server.js.map +1 -1
  227. package/package.json +18 -17
  228. package/dist/src/web/nextui/_next/static/chunks/2-d534f7b3af3e0505.js +0 -1
  229. package/dist/src/web/nextui/_next/static/chunks/app/progress/page-52079a97d0c2e2ea.js +0 -1
  230. package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-7da4796409bc2636.js +0 -1
  231. package/dist/src/web/nextui/_next/static/chunks/webpack-ac7a3125017b92ed.js +0 -1
  232. package/dist/src/web/nextui/_next/static/css/036bf4af64e53e86.css +0 -1
  233. package/dist/src/web/nextui/_next/static/css/b76f1739b5a14901.css +0 -1
  234. package/dist/src/web/nextui/_next/static/css/e141e895af3747c6.css +0 -1
  235. package/dist/src/web/nextui/_next/static/media/03b685511c0eaac3-s.woff2 +0 -0
  236. package/dist/src/web/nextui/_next/static/media/04fe87c30c4f76ea-s.woff2 +0 -0
  237. package/dist/src/web/nextui/_next/static/media/0e4fe491bf84089c-s.p.woff2 +0 -0
  238. package/dist/src/web/nextui/_next/static/media/101c7b68f2d8b610-s.woff2 +0 -0
  239. package/dist/src/web/nextui/_next/static/media/13259ce60de2aa3e-s.woff2 +0 -0
  240. package/dist/src/web/nextui/_next/static/media/1c57ca6f5208a29b-s.woff2 +0 -0
  241. package/dist/src/web/nextui/_next/static/media/1e8103c5d17beb1d-s.woff2 +0 -0
  242. package/dist/src/web/nextui/_next/static/media/388fb79562c9fc54-s.woff2 +0 -0
  243. package/dist/src/web/nextui/_next/static/media/3a04115668d8070d-s.p.woff2 +0 -0
  244. package/dist/src/web/nextui/_next/static/media/3a18fc8da1cdcd01-s.p.woff2 +0 -0
  245. package/dist/src/web/nextui/_next/static/media/3dbd163d3bb09d47-s.woff2 +0 -0
  246. package/dist/src/web/nextui/_next/static/media/42d52f46a26971a3-s.woff2 +0 -0
  247. package/dist/src/web/nextui/_next/static/media/5647e4c23315a2d2-s.woff2 +0 -0
  248. package/dist/src/web/nextui/_next/static/media/5f4dfe83faee04f1-s.woff2 +0 -0
  249. package/dist/src/web/nextui/_next/static/media/627622453ef56b0d-s.p.woff2 +0 -0
  250. package/dist/src/web/nextui/_next/static/media/67e05ba3467b9f4d-s.woff2 +0 -0
  251. package/dist/src/web/nextui/_next/static/media/699512af39861afa-s.p.woff2 +0 -0
  252. package/dist/src/web/nextui/_next/static/media/79015435f1a55eef-s.woff2 +0 -0
  253. package/dist/src/web/nextui/_next/static/media/7be645d133f3ee22-s.woff2 +0 -0
  254. package/dist/src/web/nextui/_next/static/media/7c53f7419436e04b-s.woff2 +0 -0
  255. package/dist/src/web/nextui/_next/static/media/8fb72f69fba4e3d2-s.woff2 +0 -0
  256. package/dist/src/web/nextui/_next/static/media/912a9cfe43c928d9-s.woff2 +0 -0
  257. package/dist/src/web/nextui/_next/static/media/91a88e0c5dd21dfa-s.woff2 +0 -0
  258. package/dist/src/web/nextui/_next/static/media/934c4b7cb736f2a3-s.p.woff2 +0 -0
  259. package/dist/src/web/nextui/_next/static/media/9b67ab375515cd6f-s.woff2 +0 -0
  260. package/dist/src/web/nextui/_next/static/media/9cf7d128be063d32-s.woff2 +0 -0
  261. package/dist/src/web/nextui/_next/static/media/a3c201c07e8eb753-s.woff2 +0 -0
  262. package/dist/src/web/nextui/_next/static/media/a5b77b63ef20339c-s.woff2 +0 -0
  263. package/dist/src/web/nextui/_next/static/media/a6d330d7873e7320-s.woff2 +0 -0
  264. package/dist/src/web/nextui/_next/static/media/b6db722c6886c2cd-s.woff2 +0 -0
  265. package/dist/src/web/nextui/_next/static/media/baf12dd90520ae41-s.woff2 +0 -0
  266. package/dist/src/web/nextui/_next/static/media/bbdb6f0234009aba-s.woff2 +0 -0
  267. package/dist/src/web/nextui/_next/static/media/cff529cd86cc0276-s.woff2 +0 -0
  268. package/dist/src/web/nextui/_next/static/media/d117eea74e01de14-s.woff2 +0 -0
  269. package/dist/src/web/nextui/_next/static/media/daa8cca6b52a70fa-s.woff2 +0 -0
  270. package/dist/src/web/nextui/_next/static/media/dfa8b99978df7bbc-s.woff2 +0 -0
  271. package/dist/src/web/nextui/_next/static/media/e195dd2ded485df3-s.woff2 +0 -0
  272. package/dist/src/web/nextui/_next/static/media/e25729ca87cc7df9-s.woff2 +0 -0
  273. package/dist/src/web/nextui/_next/static/media/e35c7314ac518ddc-s.woff2 +0 -0
  274. package/dist/src/web/nextui/_next/static/media/eb52b768f62eeeb4-s.woff2 +0 -0
  275. package/dist/src/web/nextui/_next/static/media/ee7e17a7bdd8636b-s.woff2 +0 -0
  276. package/dist/src/web/nextui/_next/static/media/f06116e890b3dadb-s.woff2 +0 -0
  277. /package/dist/src/web/nextui/_next/static/{4W0Qng9llk0Tg-jZCYupr → 1r10QuQFZj3AAU-Bx1DRP}/_buildManifest.js +0 -0
  278. /package/dist/src/web/nextui/_next/static/{4W0Qng9llk0Tg-jZCYupr → 1r10QuQFZj3AAU-Bx1DRP}/_ssgManifest.js +0 -0
  279. /package/dist/src/web/nextui/_next/static/chunks/{215-7d83203d614bcd6a.js → 215-7bd08e1ce7028897.js} +0 -0
  280. /package/dist/src/web/nextui/_next/static/chunks/{322-92c9551f32057648.js → 322-ac32773931b7a8aa.js} +0 -0
  281. /package/dist/src/web/nextui/_next/static/chunks/{378-4b0cc74c685f98f9.js → 378-c23e2864527ac3a0.js} +0 -0
  282. /package/dist/src/web/nextui/_next/static/chunks/{770-577cd7d7d380b3ac.js → 770-28c6d673e9540d80.js} +0 -0
  283. /package/dist/src/web/nextui/_next/static/chunks/{873-8bd18cf80e6e64e1.js → 873-e1436a5f57769f17.js} +0 -0
  284. /package/dist/src/web/nextui/_next/static/chunks/{915-cd96102a51e75c9d.js → 915-b1361d86b62c2cfe.js} +0 -0
  285. /package/dist/src/web/nextui/_next/static/chunks/{995-c9a656a43545902a.js → 995-81cea2f3d08297f2.js} +0 -0
package/dist/src/util.js CHANGED
@@ -26,7 +26,54 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.parsePathOrGlob = exports.extractJsonObjects = exports.renderVarsInObject = exports.safeJsonStringify = exports.resultIsForTestCase = exports.varsMatch = exports.providerToIdentifier = exports.getStandaloneEvals = exports.setupEnv = exports.transformOutput = exports.printBorder = exports.readFilters = exports.deleteEval = exports.getEvalFromId = exports.getEvals = exports.getEvalsWithPredicate = exports.getDatasetFromHash = exports.getPromptFromHash = exports.getTestCases = exports.getPrompts = exports.getTestCasesWithPredicate = exports.getPromptsForTestCases = exports.getPromptsForTestCasesHash = exports.getPromptsWithPredicate = exports.readLatestResults = exports.updateResult = exports.readResult = exports.cleanupOldFileResults = exports.migrateResultsFromFileSystemToDatabase = exports.readResult_fileSystem = exports.dateToFilename = exports.filenameToDate = exports.listPreviousResults_fileSystem = exports.listPreviousResultFilenames_fileSystem = exports.listPreviousResults = exports.writeResultsToDatabase = exports.getLatestResultsPath = exports.setConfigDirectoryPath = exports.getConfigDirectoryPath = exports.readOutput = exports.sha256 = exports.writeMultipleOutputs = exports.writeOutput = exports.getNunjucksEngine = exports.readConfigs = exports.maybeReadConfig = exports.readConfig = exports.dereferenceConfig = void 0;
29
+ exports.dereferenceConfig = dereferenceConfig;
30
+ exports.readConfig = readConfig;
31
+ exports.maybeReadConfig = maybeReadConfig;
32
+ exports.readConfigs = readConfigs;
33
+ exports.getNunjucksEngine = getNunjucksEngine;
34
+ exports.writeOutput = writeOutput;
35
+ exports.writeMultipleOutputs = writeMultipleOutputs;
36
+ exports.sha256 = sha256;
37
+ exports.readOutput = readOutput;
38
+ exports.getConfigDirectoryPath = getConfigDirectoryPath;
39
+ exports.setConfigDirectoryPath = setConfigDirectoryPath;
40
+ exports.getLatestResultsPath = getLatestResultsPath;
41
+ exports.writeResultsToDatabase = writeResultsToDatabase;
42
+ exports.listPreviousResults = listPreviousResults;
43
+ exports.listPreviousResultFilenames_fileSystem = listPreviousResultFilenames_fileSystem;
44
+ exports.listPreviousResults_fileSystem = listPreviousResults_fileSystem;
45
+ exports.filenameToDate = filenameToDate;
46
+ exports.dateToFilename = dateToFilename;
47
+ exports.readResult_fileSystem = readResult_fileSystem;
48
+ exports.migrateResultsFromFileSystemToDatabase = migrateResultsFromFileSystemToDatabase;
49
+ exports.cleanupOldFileResults = cleanupOldFileResults;
50
+ exports.readResult = readResult;
51
+ exports.updateResult = updateResult;
52
+ exports.readLatestResults = readLatestResults;
53
+ exports.getPromptsWithPredicate = getPromptsWithPredicate;
54
+ exports.getPromptsForTestCasesHash = getPromptsForTestCasesHash;
55
+ exports.getPromptsForTestCases = getPromptsForTestCases;
56
+ exports.getTestCasesWithPredicate = getTestCasesWithPredicate;
57
+ exports.getPrompts = getPrompts;
58
+ exports.getTestCases = getTestCases;
59
+ exports.getPromptFromHash = getPromptFromHash;
60
+ exports.getDatasetFromHash = getDatasetFromHash;
61
+ exports.getEvalsWithPredicate = getEvalsWithPredicate;
62
+ exports.getEvals = getEvals;
63
+ exports.getEvalFromId = getEvalFromId;
64
+ exports.deleteEval = deleteEval;
65
+ exports.readFilters = readFilters;
66
+ exports.printBorder = printBorder;
67
+ exports.transformOutput = transformOutput;
68
+ exports.setupEnv = setupEnv;
69
+ exports.getStandaloneEvals = getStandaloneEvals;
70
+ exports.providerToIdentifier = providerToIdentifier;
71
+ exports.varsMatch = varsMatch;
72
+ exports.resultIsForTestCase = resultIsForTestCase;
73
+ exports.safeJsonStringify = safeJsonStringify;
74
+ exports.renderVarsInObject = renderVarsInObject;
75
+ exports.extractJsonObjects = extractJsonObjects;
76
+ exports.parsePathOrGlob = parsePathOrGlob;
30
77
  const json_schema_ref_parser_1 = __importDefault(require("@apidevtools/json-schema-ref-parser"));
31
78
  const crypto_1 = require("crypto");
32
79
  const sync_1 = require("csv-stringify/sync");
@@ -40,6 +87,7 @@ const nunjucks_1 = __importDefault(require("nunjucks"));
40
87
  const os = __importStar(require("os"));
41
88
  const path = __importStar(require("path"));
42
89
  const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
90
+ const accounts_1 = require("./accounts");
43
91
  const cliState_1 = __importDefault(require("./cliState"));
44
92
  const constants_1 = require("./constants");
45
93
  const database_1 = require("./database");
@@ -135,7 +183,6 @@ async function dereferenceConfig(rawConfig) {
135
183
  }
136
184
  return config;
137
185
  }
138
- exports.dereferenceConfig = dereferenceConfig;
139
186
  async function readConfig(configPath) {
140
187
  const ext = path.parse(configPath).ext;
141
188
  switch (ext) {
@@ -152,14 +199,12 @@ async function readConfig(configPath) {
152
199
  throw new Error(`Unsupported configuration file format: ${ext}`);
153
200
  }
154
201
  }
155
- exports.readConfig = readConfig;
156
202
  async function maybeReadConfig(configPath) {
157
203
  if (!fs.existsSync(configPath)) {
158
204
  return undefined;
159
205
  }
160
206
  return readConfig(configPath);
161
207
  }
162
- exports.maybeReadConfig = maybeReadConfig;
163
208
  /**
164
209
  * Reads multiple configuration files and combines them into a single UnifiedConfig.
165
210
  *
@@ -290,7 +335,6 @@ async function readConfigs(configPaths) {
290
335
  };
291
336
  return combinedConfig;
292
337
  }
293
- exports.readConfigs = readConfigs;
294
338
  function getNunjucksEngine(filters) {
295
339
  if (process.env.PROMPTFOO_DISABLE_TEMPLATING) {
296
340
  return {
@@ -307,17 +351,16 @@ function getNunjucksEngine(filters) {
307
351
  }
308
352
  return env;
309
353
  }
310
- exports.getNunjucksEngine = getNunjucksEngine;
311
354
  async function writeOutput(outputPath, evalId, results, config, shareableUrl) {
312
355
  const outputExtension = outputPath.split('.').pop()?.toLowerCase();
313
356
  const outputToSimpleString = (output) => {
314
357
  const passFailText = output.pass ? '[PASS]' : '[FAIL]';
315
358
  const namedScoresText = Object.entries(output.namedScores)
316
- .map(([name, value]) => `${name}: ${value.toFixed(2)}`)
359
+ .map(([name, value]) => `${name}: ${value?.toFixed(2)}`)
317
360
  .join(', ');
318
361
  const scoreText = namedScoresText.length > 0
319
- ? `(${output.score.toFixed(2)}, ${namedScoresText})`
320
- : `(${output.score.toFixed(2)})`;
362
+ ? `(${output.score?.toFixed(2)}, ${namedScoresText})`
363
+ : `(${output.score?.toFixed(2)})`;
321
364
  const gradingResultText = output.gradingResult
322
365
  ? `${output.pass ? 'Pass' : 'Fail'} Reason: ${output.gradingResult.reason}`
323
366
  : '';
@@ -385,15 +428,12 @@ ${gradingResultText}`.trim();
385
428
  }
386
429
  }
387
430
  }
388
- exports.writeOutput = writeOutput;
389
431
  async function writeMultipleOutputs(outputPaths, evalId, results, config, shareableUrl) {
390
432
  await Promise.all(outputPaths.map((outputPath) => writeOutput(outputPath, evalId, results, config, shareableUrl)));
391
433
  }
392
- exports.writeMultipleOutputs = writeMultipleOutputs;
393
434
  function sha256(str) {
394
435
  return (0, crypto_1.createHash)('sha256').update(str).digest('hex');
395
436
  }
396
- exports.sha256 = sha256;
397
437
  async function readOutput(outputPath) {
398
438
  const ext = path.parse(outputPath).ext.slice(1);
399
439
  switch (ext) {
@@ -403,7 +443,6 @@ async function readOutput(outputPath) {
403
443
  throw new Error(`Unsupported output file format: ${ext} currently only supports json`);
404
444
  }
405
445
  }
406
- exports.readOutput = readOutput;
407
446
  let configDirectoryPath = process.env.PROMPTFOO_CONFIG_DIR;
408
447
  function getConfigDirectoryPath(createIfNotExists = false) {
409
448
  const p = configDirectoryPath || path.join(os.homedir(), '.promptfoo');
@@ -412,11 +451,9 @@ function getConfigDirectoryPath(createIfNotExists = false) {
412
451
  }
413
452
  return p;
414
453
  }
415
- exports.getConfigDirectoryPath = getConfigDirectoryPath;
416
454
  function setConfigDirectoryPath(newPath) {
417
455
  configDirectoryPath = newPath;
418
456
  }
419
- exports.setConfigDirectoryPath = setConfigDirectoryPath;
420
457
  /**
421
458
  * TODO(ian): Remove this
422
459
  * @deprecated Use readLatestResults directly instead.
@@ -424,7 +461,6 @@ exports.setConfigDirectoryPath = setConfigDirectoryPath;
424
461
  function getLatestResultsPath() {
425
462
  return path.join(getConfigDirectoryPath(), 'output', 'latest.json');
426
463
  }
427
- exports.getLatestResultsPath = getLatestResultsPath;
428
464
  async function writeResultsToDatabase(results, config, createdAt) {
429
465
  createdAt = createdAt || (results.timestamp ? new Date(results.timestamp) : new Date());
430
466
  const evalId = `eval-${createdAt.toISOString().slice(0, 19)}`;
@@ -435,6 +471,7 @@ async function writeResultsToDatabase(results, config, createdAt) {
435
471
  .values({
436
472
  id: evalId,
437
473
  createdAt: createdAt.getTime(),
474
+ author: (0, accounts_1.getAuthor)(),
438
475
  description: config.description,
439
476
  config,
440
477
  results,
@@ -496,7 +533,6 @@ async function writeResultsToDatabase(results, config, createdAt) {
496
533
  }
497
534
  return evalId;
498
535
  }
499
- exports.writeResultsToDatabase = writeResultsToDatabase;
500
536
  /**
501
537
  *
502
538
  * @returns Last n evals in descending order.
@@ -521,7 +557,6 @@ function listPreviousResults(limit = DEFAULT_QUERY_LIMIT, filterDescription) {
521
557
  description: result.description,
522
558
  }));
523
559
  }
524
- exports.listPreviousResults = listPreviousResults;
525
560
  /**
526
561
  * @deprecated Used only for migration to sqlite
527
562
  */
@@ -538,7 +573,6 @@ function listPreviousResultFilenames_fileSystem() {
538
573
  return statA.birthtime.getTime() - statB.birthtime.getTime(); // sort in ascending order
539
574
  });
540
575
  }
541
- exports.listPreviousResultFilenames_fileSystem = listPreviousResultFilenames_fileSystem;
542
576
  const resultsCache = {};
543
577
  /**
544
578
  * @deprecated Used only for migration to sqlite
@@ -566,7 +600,6 @@ function listPreviousResults_fileSystem() {
566
600
  };
567
601
  });
568
602
  }
569
- exports.listPreviousResults_fileSystem = listPreviousResults_fileSystem;
570
603
  function filenameToDate(filename) {
571
604
  const dateString = filename.slice('eval-'.length, filename.length - '.json'.length);
572
605
  // Replace hyphens with colons where necessary (Windows compatibility).
@@ -587,11 +620,9 @@ function filenameToDate(filename) {
587
620
  });
588
621
  */
589
622
  }
590
- exports.filenameToDate = filenameToDate;
591
623
  function dateToFilename(date) {
592
624
  return `eval-${date.toISOString().replace(/:/g, '-')}.json`;
593
625
  }
594
- exports.dateToFilename = dateToFilename;
595
626
  /**
596
627
  * @deprecated Used only for migration to sqlite
597
628
  */
@@ -611,7 +642,6 @@ function readResult_fileSystem(name) {
611
642
  logger_1.default.error(`Failed to read results from ${resultsPath}:\n${err}`);
612
643
  }
613
644
  }
614
- exports.readResult_fileSystem = readResult_fileSystem;
615
645
  let attemptedMigration = false;
616
646
  async function migrateResultsFromFileSystemToDatabase() {
617
647
  if (attemptedMigration) {
@@ -667,7 +697,6 @@ async function migrateResultsFromFileSystemToDatabase() {
667
697
  }
668
698
  logger_1.default.info('Migration complete. Please restart your web server if it is running.');
669
699
  }
670
- exports.migrateResultsFromFileSystemToDatabase = migrateResultsFromFileSystemToDatabase;
671
700
  const RESULT_HISTORY_LENGTH = parseInt(process.env.RESULT_HISTORY_LENGTH || '', 10) || DEFAULT_QUERY_LIMIT;
672
701
  function cleanupOldFileResults(remaining = RESULT_HISTORY_LENGTH) {
673
702
  const sortedFilenames = listPreviousResultFilenames_fileSystem();
@@ -675,7 +704,6 @@ function cleanupOldFileResults(remaining = RESULT_HISTORY_LENGTH) {
675
704
  fs.unlinkSync(path.join(getConfigDirectoryPath(), 'output', sortedFilenames[i]));
676
705
  }
677
706
  }
678
- exports.cleanupOldFileResults = cleanupOldFileResults;
679
707
  async function readResult(id) {
680
708
  const db = (0, database_1.getDb)();
681
709
  try {
@@ -683,6 +711,7 @@ async function readResult(id) {
683
711
  .select({
684
712
  id: database_1.evals.id,
685
713
  createdAt: database_1.evals.createdAt,
714
+ author: database_1.evals.author,
686
715
  results: database_1.evals.results,
687
716
  config: database_1.evals.config,
688
717
  })
@@ -692,10 +721,11 @@ async function readResult(id) {
692
721
  if (evalResult.length === 0) {
693
722
  return undefined;
694
723
  }
695
- const { id: resultId, createdAt, results, config } = evalResult[0];
724
+ const { id: resultId, createdAt, results, config, author } = evalResult[0];
696
725
  const result = {
697
726
  version: 3,
698
727
  createdAt: new Date(createdAt).toISOString().slice(0, 10),
728
+ author,
699
729
  results,
700
730
  config,
701
731
  };
@@ -709,7 +739,6 @@ async function readResult(id) {
709
739
  logger_1.default.error(`Failed to read result with ID ${id} from database:\n${err}`);
710
740
  }
711
741
  }
712
- exports.readResult = readResult;
713
742
  async function updateResult(id, newConfig, newTable) {
714
743
  const db = (0, database_1.getDb)();
715
744
  try {
@@ -749,13 +778,13 @@ async function updateResult(id, newConfig, newTable) {
749
778
  logger_1.default.error(`Failed to update eval with ID ${id}:\n${err}`);
750
779
  }
751
780
  }
752
- exports.updateResult = updateResult;
753
781
  async function readLatestResults(filterDescription) {
754
782
  const db = (0, database_1.getDb)();
755
783
  let latestResults = await db
756
784
  .select({
757
785
  id: database_1.evals.id,
758
786
  createdAt: database_1.evals.createdAt,
787
+ author: database_1.evals.author,
759
788
  description: database_1.evals.description,
760
789
  results: database_1.evals.results,
761
790
  config: database_1.evals.config,
@@ -774,11 +803,11 @@ async function readLatestResults(filterDescription) {
774
803
  return {
775
804
  version: 3,
776
805
  createdAt: new Date(latestResult.createdAt).toISOString(),
806
+ author: latestResult.author,
777
807
  results: latestResult.results,
778
808
  config: latestResult.config,
779
809
  };
780
810
  }
781
- exports.readLatestResults = readLatestResults;
782
811
  async function getPromptsWithPredicate(predicate, limit) {
783
812
  // TODO(ian): Make this use a proper database query
784
813
  const db = (0, database_1.getDb)();
@@ -786,6 +815,7 @@ async function getPromptsWithPredicate(predicate, limit) {
786
815
  .select({
787
816
  id: database_1.evals.id,
788
817
  createdAt: database_1.evals.createdAt,
818
+ author: database_1.evals.author,
789
819
  results: database_1.evals.results,
790
820
  config: database_1.evals.config,
791
821
  })
@@ -798,6 +828,7 @@ async function getPromptsWithPredicate(predicate, limit) {
798
828
  const resultWrapper = {
799
829
  version: 3,
800
830
  createdAt,
831
+ author: eval_.author,
801
832
  results: eval_.results,
802
833
  config: eval_.config,
803
834
  };
@@ -837,7 +868,6 @@ async function getPromptsWithPredicate(predicate, limit) {
837
868
  }
838
869
  return Object.values(groupedPrompts);
839
870
  }
840
- exports.getPromptsWithPredicate = getPromptsWithPredicate;
841
871
  function getPromptsForTestCasesHash(testCasesSha256, limit = DEFAULT_QUERY_LIMIT) {
842
872
  return getPromptsWithPredicate((result) => {
843
873
  const testsJson = JSON.stringify(result.config.tests);
@@ -845,19 +875,18 @@ function getPromptsForTestCasesHash(testCasesSha256, limit = DEFAULT_QUERY_LIMIT
845
875
  return hash === testCasesSha256;
846
876
  }, limit);
847
877
  }
848
- exports.getPromptsForTestCasesHash = getPromptsForTestCasesHash;
849
878
  function getPromptsForTestCases(testCases) {
850
879
  const testCasesJson = JSON.stringify(testCases);
851
880
  const testCasesSha256 = sha256(testCasesJson);
852
881
  return getPromptsForTestCasesHash(testCasesSha256);
853
882
  }
854
- exports.getPromptsForTestCases = getPromptsForTestCases;
855
883
  async function getTestCasesWithPredicate(predicate, limit) {
856
884
  const db = (0, database_1.getDb)();
857
885
  const evals_ = await db
858
886
  .select({
859
887
  id: database_1.evals.id,
860
888
  createdAt: database_1.evals.createdAt,
889
+ author: database_1.evals.author,
861
890
  results: database_1.evals.results,
862
891
  config: database_1.evals.config,
863
892
  })
@@ -870,6 +899,7 @@ async function getTestCasesWithPredicate(predicate, limit) {
870
899
  const resultWrapper = {
871
900
  version: 3,
872
901
  createdAt,
902
+ author: eval_.author,
873
903
  results: eval_.results,
874
904
  config: eval_.config,
875
905
  };
@@ -918,15 +948,12 @@ async function getTestCasesWithPredicate(predicate, limit) {
918
948
  }
919
949
  return Object.values(groupedTestCases);
920
950
  }
921
- exports.getTestCasesWithPredicate = getTestCasesWithPredicate;
922
951
  function getPrompts(limit = DEFAULT_QUERY_LIMIT) {
923
952
  return getPromptsWithPredicate(() => true, limit);
924
953
  }
925
- exports.getPrompts = getPrompts;
926
954
  async function getTestCases(limit = DEFAULT_QUERY_LIMIT) {
927
955
  return getTestCasesWithPredicate(() => true, limit);
928
956
  }
929
- exports.getTestCases = getTestCases;
930
957
  async function getPromptFromHash(hash) {
931
958
  const prompts = await getPrompts();
932
959
  for (const prompt of prompts) {
@@ -936,7 +963,6 @@ async function getPromptFromHash(hash) {
936
963
  }
937
964
  return undefined;
938
965
  }
939
- exports.getPromptFromHash = getPromptFromHash;
940
966
  async function getDatasetFromHash(hash) {
941
967
  const datasets = await getTestCases();
942
968
  for (const dataset of datasets) {
@@ -946,13 +972,13 @@ async function getDatasetFromHash(hash) {
946
972
  }
947
973
  return undefined;
948
974
  }
949
- exports.getDatasetFromHash = getDatasetFromHash;
950
975
  async function getEvalsWithPredicate(predicate, limit) {
951
976
  const db = (0, database_1.getDb)();
952
977
  const evals_ = await db
953
978
  .select({
954
979
  id: database_1.evals.id,
955
980
  createdAt: database_1.evals.createdAt,
981
+ author: database_1.evals.author,
956
982
  results: database_1.evals.results,
957
983
  config: database_1.evals.config,
958
984
  description: database_1.evals.description,
@@ -967,6 +993,7 @@ async function getEvalsWithPredicate(predicate, limit) {
967
993
  const resultWrapper = {
968
994
  version: 3,
969
995
  createdAt: createdAt,
996
+ author: eval_.author,
970
997
  results: eval_.results,
971
998
  config: eval_.config,
972
999
  };
@@ -983,11 +1010,9 @@ async function getEvalsWithPredicate(predicate, limit) {
983
1010
  }
984
1011
  return ret;
985
1012
  }
986
- exports.getEvalsWithPredicate = getEvalsWithPredicate;
987
1013
  async function getEvals(limit = DEFAULT_QUERY_LIMIT) {
988
1014
  return getEvalsWithPredicate(() => true, limit);
989
1015
  }
990
- exports.getEvals = getEvals;
991
1016
  async function getEvalFromId(hash) {
992
1017
  const evals_ = await getEvals();
993
1018
  for (const eval_ of evals_) {
@@ -997,7 +1022,6 @@ async function getEvalFromId(hash) {
997
1022
  }
998
1023
  return undefined;
999
1024
  }
1000
- exports.getEvalFromId = getEvalFromId;
1001
1025
  async function deleteEval(evalId) {
1002
1026
  const db = (0, database_1.getDb)();
1003
1027
  await db.transaction(async () => {
@@ -1011,7 +1035,6 @@ async function deleteEval(evalId) {
1011
1035
  }
1012
1036
  });
1013
1037
  }
1014
- exports.deleteEval = deleteEval;
1015
1038
  async function readFilters(filters) {
1016
1039
  const ret = {};
1017
1040
  const basePath = cliState_1.default.basePath || '';
@@ -1027,12 +1050,10 @@ async function readFilters(filters) {
1027
1050
  }
1028
1051
  return ret;
1029
1052
  }
1030
- exports.readFilters = readFilters;
1031
1053
  function printBorder() {
1032
1054
  const border = '='.repeat(constants_1.TERMINAL_MAX_WIDTH);
1033
1055
  logger_1.default.info(border);
1034
1056
  }
1035
- exports.printBorder = printBorder;
1036
1057
  async function transformOutput(codeOrFilepath, output, context) {
1037
1058
  let postprocessFn;
1038
1059
  if (codeOrFilepath.startsWith('file://')) {
@@ -1069,7 +1090,6 @@ async function transformOutput(codeOrFilepath, output, context) {
1069
1090
  }
1070
1091
  return ret;
1071
1092
  }
1072
- exports.transformOutput = transformOutput;
1073
1093
  function setupEnv(envPath) {
1074
1094
  if (envPath) {
1075
1095
  logger_1.default.info(`Loading environment variables from ${envPath}`);
@@ -1079,7 +1099,6 @@ function setupEnv(envPath) {
1079
1099
  dotenv_1.default.config();
1080
1100
  }
1081
1101
  }
1082
- exports.setupEnv = setupEnv;
1083
1102
  function getStandaloneEvals(limit = DEFAULT_QUERY_LIMIT) {
1084
1103
  const db = (0, database_1.getDb)();
1085
1104
  const results = db
@@ -1111,7 +1130,6 @@ function getStandaloneEvals(limit = DEFAULT_QUERY_LIMIT) {
1111
1130
  });
1112
1131
  return flatResults;
1113
1132
  }
1114
- exports.getStandaloneEvals = getStandaloneEvals;
1115
1133
  function providerToIdentifier(provider) {
1116
1134
  if ((0, types_1.isApiProvider)(provider)) {
1117
1135
  return provider.id();
@@ -1121,18 +1139,15 @@ function providerToIdentifier(provider) {
1121
1139
  }
1122
1140
  return provider;
1123
1141
  }
1124
- exports.providerToIdentifier = providerToIdentifier;
1125
1142
  function varsMatch(vars1, vars2) {
1126
1143
  return (0, fast_deep_equal_1.default)(vars1, vars2);
1127
1144
  }
1128
- exports.varsMatch = varsMatch;
1129
1145
  function resultIsForTestCase(result, testCase) {
1130
1146
  const providersMatch = testCase.provider
1131
1147
  ? providerToIdentifier(testCase.provider) === providerToIdentifier(result.provider)
1132
1148
  : true;
1133
1149
  return varsMatch(testCase.vars, result.vars) && providersMatch;
1134
1150
  }
1135
- exports.resultIsForTestCase = resultIsForTestCase;
1136
1151
  function safeJsonStringify(value, prettyPrint = false) {
1137
1152
  // Prevent circular references
1138
1153
  const cache = new Set();
@@ -1146,7 +1161,6 @@ function safeJsonStringify(value, prettyPrint = false) {
1146
1161
  return val;
1147
1162
  }, space);
1148
1163
  }
1149
- exports.safeJsonStringify = safeJsonStringify;
1150
1164
  function renderVarsInObject(obj, vars) {
1151
1165
  // Renders nunjucks template strings with context variables
1152
1166
  if (!vars || process.env.PROMPTFOO_DISABLE_TEMPLATING) {
@@ -1171,7 +1185,6 @@ function renderVarsInObject(obj, vars) {
1171
1185
  }
1172
1186
  return obj;
1173
1187
  }
1174
- exports.renderVarsInObject = renderVarsInObject;
1175
1188
  function extractJsonObjects(str) {
1176
1189
  // This will extract all json objects from a string
1177
1190
  const jsonObjects = [];
@@ -1201,7 +1214,6 @@ function extractJsonObjects(str) {
1201
1214
  }
1202
1215
  return jsonObjects;
1203
1216
  }
1204
- exports.extractJsonObjects = extractJsonObjects;
1205
1217
  /**
1206
1218
  * Parses a file path or glob pattern to extract function names and file extensions.
1207
1219
  * Function names can be specified in the filename like this:
@@ -1211,10 +1223,10 @@ exports.extractJsonObjects = extractJsonObjects;
1211
1223
  * @returns Parsed details including function name, file extension, and directory status.
1212
1224
  */
1213
1225
  function parsePathOrGlob(basePath, promptPath) {
1214
- let filePath = path.join(basePath, promptPath);
1215
- if (filePath.includes('file:')) {
1216
- filePath = filePath.split('file:')[1];
1226
+ if (promptPath.startsWith('file://')) {
1227
+ promptPath = promptPath.slice(7);
1217
1228
  }
1229
+ const filePath = path.join(basePath, promptPath);
1218
1230
  let stats;
1219
1231
  try {
1220
1232
  stats = fs.statSync(filePath);
@@ -1241,5 +1253,4 @@ function parsePathOrGlob(basePath, promptPath) {
1241
1253
  isPathPattern,
1242
1254
  };
1243
1255
  }
1244
- exports.parsePathOrGlob = parsePathOrGlob;
1245
1256
  //# sourceMappingURL=util.js.map