agentv 4.38.0 → 4.38.1-next.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.
@@ -190,7 +190,7 @@ async function findRepoRoot(start) {
190
190
  // package.json
191
191
  var package_default = {
192
192
  name: "agentv",
193
- version: "4.38.0",
193
+ version: "4.38.1-next.1",
194
194
  description: "CLI entry point for AgentV",
195
195
  type: "module",
196
196
  repository: {
@@ -298,162 +298,15 @@ async function discoverTargetsFile(options) {
298
298
  }
299
299
 
300
300
  // src/commands/eval/run-eval.ts
301
- import { constants as constants4, existsSync as existsSync7, mkdirSync as mkdirSync2 } from "node:fs";
301
+ import { constants as constants4, existsSync as existsSync6, mkdirSync as mkdirSync2 } from "node:fs";
302
302
  import { access as access5, readFile as readFile8 } from "node:fs/promises";
303
303
  import path12 from "node:path";
304
304
  import { pathToFileURL } from "node:url";
305
305
 
306
306
  // src/version-check.ts
307
- import { coerce, major, satisfies, validRange } from "semver";
308
-
309
- // src/self-update.ts
310
- import { spawn } from "node:child_process";
311
- import { existsSync } from "node:fs";
312
- import { get } from "node:https";
313
- import { basename, dirname, join, win32 } from "node:path";
314
- var NPM_REGISTRY_BASE = "https://registry.npmjs.org/agentv/";
315
- function getDistTagForVersion(version) {
316
- return version.includes("-") ? "next" : "latest";
317
- }
318
- function detectPackageManagerFromPath(scriptPath) {
319
- if (scriptPath.includes(".bun")) {
320
- return "bun";
321
- }
322
- return "npm";
323
- }
324
- function detectPackageManager() {
325
- return detectPackageManagerFromPath(process.argv[1] ?? "");
326
- }
327
- function detectInstallScopeFromPath(scriptPath, cwd = process.cwd()) {
328
- const normalizedScriptPath = scriptPath.replace(/\\/g, "/");
329
- const normalizedCwd = cwd.replace(/\\/g, "/");
330
- if (!normalizedScriptPath.includes("/node_modules/")) {
331
- return "global";
332
- }
333
- if (normalizedScriptPath.includes("/.npm/_npx/") || normalizedScriptPath.includes("/npm-cache/_npx/")) {
334
- return "local";
335
- }
336
- const packageRoot = normalizedScriptPath.split("/node_modules/")[0];
337
- if (!packageRoot) {
338
- return "global";
339
- }
340
- const scriptPathComparable = process.platform === "win32" ? normalizedScriptPath.toLowerCase() : normalizedScriptPath;
341
- const cwdComparable = process.platform === "win32" ? normalizedCwd.toLowerCase() : normalizedCwd;
342
- const packageRootComparable = process.platform === "win32" ? packageRoot.toLowerCase() : packageRoot;
343
- const projectOwnsPackage = cwdComparable === packageRootComparable || cwdComparable.startsWith(`${packageRootComparable}/`);
344
- return projectOwnsPackage ? "local" : "global";
345
- }
346
- function detectInstallScope() {
347
- return detectInstallScopeFromPath(process.argv[1] ?? "");
348
- }
349
- function runCommand(cmd, args) {
350
- return new Promise((resolve, reject) => {
351
- const child = spawn(cmd, args, { stdio: ["inherit", "pipe", "inherit"] });
352
- let stdout = "";
353
- child.stdout?.on("data", (data) => {
354
- process.stdout.write(data);
355
- stdout += data.toString();
356
- });
357
- child.on("error", reject);
358
- child.on("close", (code) => resolve({ exitCode: code ?? 1, stdout }));
359
- });
360
- }
361
- function fetchLatestVersion(distTag = "latest") {
362
- return new Promise((resolve) => {
363
- const req = get(`${NPM_REGISTRY_BASE}${distTag}`, { timeout: 5e3 }, (res) => {
364
- if (res.statusCode !== 200) {
365
- res.resume();
366
- resolve(null);
367
- return;
368
- }
369
- let body = "";
370
- res.on("data", (chunk) => {
371
- body += chunk.toString();
372
- });
373
- res.on("end", () => {
374
- try {
375
- const version = JSON.parse(body).version;
376
- resolve(typeof version === "string" ? version : null);
377
- } catch {
378
- resolve(null);
379
- }
380
- });
381
- });
382
- req.on("error", () => resolve(null));
383
- req.on("timeout", () => {
384
- req.destroy();
385
- resolve(null);
386
- });
387
- });
388
- }
389
- function getInstallArgs(pm, versionSpec, scope) {
390
- const pkg = `agentv@${versionSpec}`;
391
- const baseCmd = pm === "npm" ? "install" : "add";
392
- return scope === "global" ? [baseCmd, "-g", pkg] : [baseCmd, pkg];
393
- }
394
- function findBundledNpmCli(execPath, platform, exists) {
395
- const pathApi = platform === "win32" ? win32 : { dirname, join };
396
- const execDir = pathApi.dirname(execPath);
397
- const candidates = platform === "win32" ? [pathApi.join(execDir, "node_modules", "npm", "bin", "npm-cli.js")] : [
398
- pathApi.join(execDir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
399
- pathApi.join(execDir, "node_modules", "npm", "bin", "npm-cli.js")
400
- ];
401
- return candidates.find((candidate) => exists(candidate));
402
- }
403
- function resolvePackageManagerCommand(pm, args, options) {
404
- const execPath = options?.execPath ?? process.execPath;
405
- const platform = options?.platform ?? process.platform;
406
- const exists = options?.exists ?? existsSync;
407
- const pathApi = platform === "win32" ? win32 : { basename };
408
- if (pm === "bun") {
409
- const runtimeName = pathApi.basename(execPath).toLowerCase();
410
- if ((runtimeName === "bun" || runtimeName === "bun.exe") && exists(execPath)) {
411
- return { cmd: execPath, args };
412
- }
413
- return { cmd: "bun", args };
414
- }
415
- const npmCliPath = findBundledNpmCli(execPath, platform, exists);
416
- if (npmCliPath) {
417
- return { cmd: execPath, args: [npmCliPath, ...args] };
418
- }
419
- return { cmd: "npm", args };
420
- }
421
- async function performSelfUpdate(options) {
422
- const pm = options?.pm ?? detectPackageManager();
423
- const currentVersion = options?.currentVersion ?? "unknown";
424
- const versionSpec = options?.versionRange ?? getDistTagForVersion(currentVersion === "unknown" ? "" : currentVersion);
425
- const scope = options?.scope ?? detectInstallScope();
426
- const args = getInstallArgs(pm, versionSpec, scope);
427
- const command = resolvePackageManagerCommand(pm, args);
428
- try {
429
- const result = await runCommand(command.cmd, command.args);
430
- if (result.exitCode !== 0) {
431
- return { success: false, currentVersion, scope };
432
- }
433
- let newVersion;
434
- try {
435
- const versionResult = await runCommand("agentv", ["--version"]);
436
- newVersion = versionResult.stdout.trim();
437
- } catch {
438
- }
439
- return { success: true, currentVersion, newVersion, scope };
440
- } catch (error) {
441
- if (error instanceof Error) {
442
- if (error.message.includes("ENOENT") || error.message.includes("not found")) {
443
- const alternative = pm === "npm" ? "bun" : "npm";
444
- console.error(`Error: ${pm} not found. Try using --${alternative} flag.`);
445
- } else {
446
- console.error(`Error: ${error.message}`);
447
- }
448
- }
449
- return { success: false, currentVersion, scope };
450
- }
451
- }
452
-
453
- // src/version-check.ts
307
+ import { coerce, satisfies, validRange } from "semver";
454
308
  var ANSI_YELLOW = "\x1B[33m";
455
309
  var ANSI_RED = "\x1B[31m";
456
- var ANSI_GREEN = "\x1B[32m";
457
310
  var ANSI_RESET = "\x1B[0m";
458
311
  function checkVersion(requiredVersion) {
459
312
  const currentVersion = package_default.version;
@@ -468,7 +321,16 @@ function checkVersion(requiredVersion) {
468
321
  requiredRange: requiredVersion
469
322
  };
470
323
  }
471
- async function enforceRequiredVersion(requiredVersion, options) {
324
+ function formatVersionMismatch(result) {
325
+ return `agentv ${result.currentVersion} does not satisfy this project's required_version ${result.requiredRange}`;
326
+ }
327
+ function formatRequiredVersionWarning(result) {
328
+ return `${ANSI_YELLOW}Warning: ${formatVersionMismatch(result)}. Run \`agentv self update\`.${ANSI_RESET}`;
329
+ }
330
+ function formatRequiredVersionFailureNote(result) {
331
+ return `note: ${formatVersionMismatch(result)} - this may be the cause. Run \`agentv self update\`.`;
332
+ }
333
+ function enforceRequiredVersion(requiredVersion, options) {
472
334
  let result;
473
335
  try {
474
336
  result = checkVersion(requiredVersion);
@@ -477,57 +339,23 @@ async function enforceRequiredVersion(requiredVersion, options) {
477
339
  process.exit(1);
478
340
  }
479
341
  if (result.satisfied) {
480
- return;
342
+ return result;
481
343
  }
482
- const warning = `${ANSI_YELLOW}Warning: This project requires agentv ${result.requiredRange} but you have ${result.currentVersion}.${ANSI_RESET}`;
344
+ const warning = formatRequiredVersionWarning(result);
483
345
  if (options?.strict) {
484
- console.error(`${warning}
485
- Run \`agentv self update\` to upgrade.`);
346
+ console.error(warning);
486
347
  console.error(
487
348
  `${ANSI_RED}Aborting: --strict mode requires the installed version to satisfy the required range.${ANSI_RESET}`
488
349
  );
489
350
  process.exit(1);
490
351
  }
491
- if (process.stdin.isTTY && process.stdout.isTTY) {
492
- console.warn(warning);
493
- const shouldUpdate = await promptUpdate();
494
- if (shouldUpdate) {
495
- await runInlineUpdate(result.currentVersion, result.requiredRange);
496
- }
497
- } else {
498
- process.stderr.write(`${warning}
499
- Run \`agentv self update\` to upgrade.
352
+ process.stderr.write(`${warning}
500
353
  `);
501
- }
502
- }
503
- async function promptUpdate() {
504
- const { confirm } = await import("@inquirer/prompts");
505
- return confirm({ message: "Update now?", default: true });
506
- }
507
- async function runInlineUpdate(currentVersion, versionRange) {
508
- const currentMajor = major(coerce(currentVersion) ?? currentVersion);
509
- const safeRange = `${versionRange} <${currentMajor + 1}.0.0`;
510
- console.log("");
511
- const result = await performSelfUpdate({ currentVersion, versionRange: safeRange });
512
- if (!result.success) {
513
- console.error(`${ANSI_RED}Update failed. Run \`agentv self update\` manually.${ANSI_RESET}`);
514
- process.exit(1);
515
- }
516
- if (result.newVersion) {
517
- console.log(
518
- `
519
- ${ANSI_GREEN}Update complete: ${currentVersion} \u2192 ${result.newVersion}${ANSI_RESET}`
520
- );
521
- } else {
522
- console.log(`
523
- ${ANSI_GREEN}Update complete.${ANSI_RESET}`);
524
- }
525
- console.log("Please re-run your command.");
526
- process.exit(0);
354
+ return result;
527
355
  }
528
356
 
529
357
  // src/commands/results/remote.ts
530
- import { existsSync as existsSync5 } from "node:fs";
358
+ import { existsSync as existsSync4 } from "node:fs";
531
359
  import path7 from "node:path";
532
360
 
533
361
  // src/commands/inspect/utils.ts
@@ -535,7 +363,7 @@ import { readFileSync as readFileSync2, readdirSync, statSync } from "node:fs";
535
363
  import path4 from "node:path";
536
364
 
537
365
  // src/commands/results/manifest.ts
538
- import { existsSync as existsSync2, readFileSync } from "node:fs";
366
+ import { existsSync, readFileSync } from "node:fs";
539
367
  import path3 from "node:path";
540
368
  function parseJsonlLines(content) {
541
369
  return content.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).map((line) => JSON.parse(line));
@@ -556,7 +384,7 @@ function readOptionalText(baseDir, relativePath) {
556
384
  return void 0;
557
385
  }
558
386
  const absolutePath = path3.join(baseDir, relativePath);
559
- if (!existsSync2(absolutePath)) {
387
+ if (!existsSync(absolutePath)) {
560
388
  return void 0;
561
389
  }
562
390
  return readFileSync(absolutePath, "utf8");
@@ -1117,11 +945,11 @@ function formatScore(score) {
1117
945
 
1118
946
  // src/commands/results/remote-metadata.ts
1119
947
  import { execFileSync } from "node:child_process";
1120
- import { existsSync as existsSync4, mkdirSync, readFileSync as readFileSync4, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
948
+ import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync4, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
1121
949
  import path6 from "node:path";
1122
950
 
1123
951
  // src/commands/results/run-tags.ts
1124
- import { existsSync as existsSync3, readFileSync as readFileSync3, unlinkSync, writeFileSync } from "node:fs";
952
+ import { existsSync as existsSync2, readFileSync as readFileSync3, unlinkSync, writeFileSync } from "node:fs";
1125
953
  import path5 from "node:path";
1126
954
  var RUN_TAGS_FILENAME = "tags.json";
1127
955
  var MAX_TAGS_PER_RUN = 20;
@@ -1131,7 +959,7 @@ function runTagsPath(manifestPath) {
1131
959
  }
1132
960
  function readRunTags(manifestPath) {
1133
961
  const fp = runTagsPath(manifestPath);
1134
- if (!existsSync3(fp)) return void 0;
962
+ if (!existsSync2(fp)) return void 0;
1135
963
  try {
1136
964
  const parsed = JSON.parse(readFileSync3(fp, "utf8"));
1137
965
  if (!parsed || typeof parsed !== "object") return void 0;
@@ -1165,7 +993,7 @@ function writeRunTags(manifestPath, tags) {
1165
993
  }
1166
994
  function deleteRunTags(manifestPath) {
1167
995
  const fp = runTagsPath(manifestPath);
1168
- if (existsSync3(fp)) {
996
+ if (existsSync2(fp)) {
1169
997
  unlinkSync(fp);
1170
998
  }
1171
999
  }
@@ -1228,7 +1056,7 @@ function toGitPath(filePath) {
1228
1056
  return filePath.split(path6.sep).join("/");
1229
1057
  }
1230
1058
  function readTagsFile(filePath) {
1231
- if (!existsSync4(filePath)) return void 0;
1059
+ if (!existsSync3(filePath)) return void 0;
1232
1060
  try {
1233
1061
  return parseTagsFile(readFileSync4(filePath, "utf8"));
1234
1062
  } catch {
@@ -1321,7 +1149,7 @@ function toRemoteRunTagState(context) {
1321
1149
  };
1322
1150
  }
1323
1151
  function assertWritableResultsRepo(repoDir) {
1324
- if (!existsSync4(repoDir)) {
1152
+ if (!existsSync3(repoDir)) {
1325
1153
  throw new Error("Writable results repo is not configured for remote metadata");
1326
1154
  }
1327
1155
  const insideWorkTree = tryRunGit(repoDir, ["rev-parse", "--is-inside-work-tree"]);
@@ -1566,7 +1394,7 @@ async function findRunById(cwd, runId, projectId) {
1566
1394
  return runs.find((run) => run.filename === runId);
1567
1395
  }
1568
1396
  async function ensureRemoteRunAvailable(cwd, meta, projectId) {
1569
- if (meta.source !== "remote" || existsSync5(meta.path)) {
1397
+ if (meta.source !== "remote" || existsSync4(meta.path)) {
1570
1398
  return;
1571
1399
  }
1572
1400
  const config = await loadNormalizedResultsConfig(cwd, projectId);
@@ -1973,7 +1801,7 @@ async function createOutputWriter(filePath, options) {
1973
1801
 
1974
1802
  // src/commands/eval/progress-display.ts
1975
1803
  var ANSI_BOLD = "\x1B[1m";
1976
- var ANSI_GREEN2 = "\x1B[32m";
1804
+ var ANSI_GREEN = "\x1B[32m";
1977
1805
  var ANSI_RED2 = "\x1B[31m";
1978
1806
  var ANSI_YELLOW2 = "\x1B[33m";
1979
1807
  var ANSI_RESET2 = "\x1B[0m";
@@ -1987,7 +1815,7 @@ function formatVerdict(score, verdict) {
1987
1815
  const scoreStr = score !== void 0 ? `${Math.round(score * 100)}%` : "";
1988
1816
  const verdictLabel = verdict === "ERROR" ? "ERROR" : `${scoreStr} ${verdict}`;
1989
1817
  if (!colors2) return ` | ${verdictLabel}`;
1990
- const color = verdict === "PASS" ? ANSI_GREEN2 : verdict === "FAIL" ? ANSI_RED2 : ANSI_YELLOW2;
1818
+ const color = verdict === "PASS" ? ANSI_GREEN : verdict === "FAIL" ? ANSI_RED2 : ANSI_YELLOW2;
1991
1819
  return ` | ${color}${ANSI_BOLD}${verdictLabel}${ANSI_RESET2}`;
1992
1820
  }
1993
1821
  function formatDurations(durationMs, totalDurationMs) {
@@ -2118,7 +1946,7 @@ async function loadNonErrorResults(jsonlPath) {
2118
1946
  }
2119
1947
 
2120
1948
  // src/commands/eval/run-cache.ts
2121
- import { existsSync as existsSync6 } from "node:fs";
1949
+ import { existsSync as existsSync5 } from "node:fs";
2122
1950
  import { mkdir as mkdir2, readFile, writeFile } from "node:fs/promises";
2123
1951
  import path10 from "node:path";
2124
1952
  var CACHE_FILENAME = "cache.json";
@@ -2142,7 +1970,7 @@ async function loadRunCache(cwd) {
2142
1970
  async function resolveCachedRunDir(cwd) {
2143
1971
  const cache = await loadRunCache(cwd);
2144
1972
  if (!cache?.lastRunDir) return void 0;
2145
- if (!existsSync6(cache.lastRunDir)) return void 0;
1973
+ if (!existsSync5(cache.lastRunDir)) return void 0;
2146
1974
  return cache.lastRunDir;
2147
1975
  }
2148
1976
  async function saveRunCache(cwd, resultPath) {
@@ -2468,16 +2296,16 @@ async function detectFileType(filePath) {
2468
2296
  }
2469
2297
  function inferFileTypeFromPath(filePath) {
2470
2298
  const normalized = path11.normalize(filePath).replace(/\\/g, "/");
2471
- const basename2 = path11.basename(filePath);
2299
+ const basename = path11.basename(filePath);
2472
2300
  if (normalized.includes("/.agentv/")) {
2473
- if (basename2 === "config.yaml" || basename2 === "config.yml") {
2301
+ if (basename === "config.yaml" || basename === "config.yml") {
2474
2302
  return "config";
2475
2303
  }
2476
- if (basename2 === "targets.yaml" || basename2 === "targets.yml") {
2304
+ if (basename === "targets.yaml" || basename === "targets.yml") {
2477
2305
  return "targets";
2478
2306
  }
2479
2307
  }
2480
- const lower = basename2.toLowerCase();
2308
+ const lower = basename.toLowerCase();
2481
2309
  if (lower.endsWith(".eval.yaml") || lower.endsWith(".eval.yml")) {
2482
2310
  return "eval";
2483
2311
  }
@@ -5442,8 +5270,9 @@ async function runEvalCommand(input) {
5442
5270
  }
5443
5271
  const repoRoot = await findRepoRoot(cwd);
5444
5272
  const yamlConfig = await loadConfig(path12.join(cwd, "_"), repoRoot);
5273
+ let requiredVersionCheck;
5445
5274
  if (yamlConfig?.required_version) {
5446
- await enforceRequiredVersion(yamlConfig.required_version, {
5275
+ requiredVersionCheck = await enforceRequiredVersion(yamlConfig.required_version, {
5447
5276
  strict: normalizeBoolean(input.rawOptions.strict)
5448
5277
  });
5449
5278
  }
@@ -5504,7 +5333,7 @@ async function runEvalCommand(input) {
5504
5333
  const explicitResumeDir = options.outputDir;
5505
5334
  if (explicitResumeDir) {
5506
5335
  const resumeIndexPath = path12.join(path12.resolve(explicitResumeDir), "index.jsonl");
5507
- if (existsSync7(resumeIndexPath)) {
5336
+ if (existsSync6(resumeIndexPath)) {
5508
5337
  const content = await readFile8(resumeIndexPath, "utf8");
5509
5338
  const existingResults = parseJsonlResults(content);
5510
5339
  resumeSkipKeys = /* @__PURE__ */ new Set();
@@ -5961,6 +5790,10 @@ async function runEvalCommand(input) {
5961
5790
  const thresholdOpts = resolvedThreshold !== void 0 ? { threshold: resolvedThreshold } : void 0;
5962
5791
  const summary = calculateEvaluationSummary(summaryResults, thresholdOpts);
5963
5792
  console.log(formatEvaluationSummary(summary, thresholdOpts));
5793
+ if (requiredVersionCheck && !requiredVersionCheck.satisfied && (summary.qualityFailureCount > 0 || summary.executionErrorCount > 0)) {
5794
+ console.log(`
5795
+ ${formatRequiredVersionFailureNote(requiredVersionCheck)}`);
5796
+ }
5964
5797
  const allExecutionErrors = summary.total > 0 && summary.executionErrorCount === summary.total;
5965
5798
  const thresholdFailed = resolvedThreshold !== void 0 && summary.qualityFailureCount > 0;
5966
5799
  if (isMatrixMode && summaryResults.length > 0) {
@@ -6159,11 +5992,6 @@ export {
6159
5992
  loadManifestResults,
6160
5993
  loadLightweightResults,
6161
5994
  Mutex,
6162
- getDistTagForVersion,
6163
- detectPackageManager,
6164
- detectInstallScope,
6165
- fetchLatestVersion,
6166
- performSelfUpdate,
6167
5995
  enforceRequiredVersion,
6168
5996
  c,
6169
5997
  padRight,
@@ -6208,4 +6036,4 @@ export {
6208
6036
  getCategories,
6209
6037
  filterByCategory
6210
6038
  };
6211
- //# sourceMappingURL=chunk-EKMMIULD.js.map
6039
+ //# sourceMappingURL=chunk-Z4BVJJXA.js.map