oh-my-promptfoo 1.34.3 → 1.34.4-next.207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {createRequire as __allagentsCreateRequire} from "node:module";const require=__allagentsCreateRequire(import.meta.url);
3
3
  import { t as canonicalJson } from "./config-dkfko4h5.js";
4
4
  import { n as helperInvoke, t as helperAvailable } from "./helper-CQLUwsX4.js";
5
- import { a as renderConsoleSummary, c as summarizeEvaluation, i as readWorkspaceTiming, l as addSourceLinks, o as renderProgress, r as readProgress, s as renderSummary } from "./eval-progress-hj6BssqE.js";
5
+ import { a as renderConsoleSummary, c as summarizeEvaluation, i as readWorkspaceTiming, l as addSourceLinks, o as renderProgress, r as readProgress, s as renderSummary } from "./eval-progress-B8F_gLSe.js";
6
6
  import { n as secrets } from "./redaction-Be3UM1sZ.js";
7
7
  import { createRequire } from "node:module";
8
8
  import { constants, createWriteStream, realpathSync } from "node:fs";
@@ -2849,6 +2849,12 @@ async function readResults(run, options, exitCode) {
2849
2849
  run.report = summarizeEvaluation(void 0, exitCode, options);
2850
2850
  }
2851
2851
  }
2852
+ async function hasMissingPackage(log) {
2853
+ const { size } = await log.stat();
2854
+ const tail = Buffer.alloc(Math.min(size, 65536));
2855
+ const { bytesRead } = await log.read(tail, 0, tail.length, size - tail.length);
2856
+ return /^Error: Package not found: [^\r\n]+\. Make sure it's installed in [^\r\n]+\r?\n[ \t]+at loadFromPackage\b/m.test(tail.toString("utf8", 0, bytesRead));
2857
+ }
2852
2858
  function reportingOptions(options) {
2853
2859
  return {
2854
2860
  suiteNumber: options.suiteNumber,
@@ -2916,7 +2922,7 @@ async function runEvaluation(options) {
2916
2922
  const cwd = resolve(options.workingDirectory || process.cwd());
2917
2923
  const reporting = reportingOptions(options);
2918
2924
  const run = await files(resolve(cwd, options.outputDirectory), reporting);
2919
- const log = await open(run.logPath, "wx", 384);
2925
+ const log = await open(run.logPath, "wx+", 384);
2920
2926
  const timings = toolchainTiming();
2921
2927
  let reportingStarted = setupStarted;
2922
2928
  try {
@@ -3007,6 +3013,7 @@ async function runEvaluation(options) {
3007
3013
  reportingStarted = performance.now();
3008
3014
  await readResults(run, reporting, run.exitCode);
3009
3015
  if (run.resultsAvailable) await chmod(run.resultPath, 384);
3016
+ if (run.exitCode && !run.report.cases.length && await hasMissingPackage(log).catch(() => false)) run.report.issues.push("package-not-found");
3010
3017
  } catch (error) {
3011
3018
  if (timings.setupMs === void 0) timings.setupMs = performance.now() - setupStarted;
3012
3019
  reportingStarted = performance.now();