@agentv/core 4.32.0-next.1 → 4.34.0-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.
@@ -98,6 +98,7 @@ var GRADER_KIND_SET = new Set(GRADER_KIND_VALUES);
98
98
  function isGraderKind(value) {
99
99
  return typeof value === "string" && GRADER_KIND_SET.has(value);
100
100
  }
101
+ var RUBRIC_OPERATOR_VALUES = ["correctness", "contradiction"];
101
102
 
102
103
  // src/evaluation/yaml-loader.ts
103
104
  import { parse } from "yaml";
@@ -106,10 +107,40 @@ function parseYamlValue(content) {
106
107
  return parse(content, PARSE_OPTIONS);
107
108
  }
108
109
 
110
+ // src/paths.ts
111
+ import os from "node:os";
112
+ import path from "node:path";
113
+ function readEnvPath(name) {
114
+ const value = process.env[name];
115
+ if (!value || value === "undefined") return void 0;
116
+ return value;
117
+ }
118
+ function getAgentvConfigDir() {
119
+ return readEnvPath("AGENTV_HOME") ?? path.join(os.homedir(), ".agentv");
120
+ }
121
+ function getAgentvHome() {
122
+ return getAgentvConfigDir();
123
+ }
124
+ function getAgentvDataDir() {
125
+ return readEnvPath("AGENTV_DATA_DIR") ?? getAgentvConfigDir();
126
+ }
127
+ function getWorkspacesRoot() {
128
+ return path.join(getAgentvDataDir(), "workspaces");
129
+ }
130
+ function getSubagentsRoot() {
131
+ return path.join(getAgentvDataDir(), "subagents");
132
+ }
133
+ function getTraceStateRoot() {
134
+ return path.join(getAgentvDataDir(), "trace-state");
135
+ }
136
+ function getWorkspacePoolRoot() {
137
+ return path.join(getAgentvDataDir(), "workspace-pool");
138
+ }
139
+
109
140
  // src/evaluation/file-utils.ts
110
141
  import { constants } from "node:fs";
111
142
  import { access, readFile } from "node:fs/promises";
112
- import path from "node:path";
143
+ import path2 from "node:path";
113
144
  async function fileExists(filePath) {
114
145
  try {
115
146
  await access(filePath, constants.F_OK);
@@ -130,14 +161,14 @@ async function readJsonFile(filePath) {
130
161
  return JSON.parse(content);
131
162
  }
132
163
  async function findGitRoot(startPath) {
133
- let currentDir = path.dirname(path.resolve(startPath));
134
- const root = path.parse(currentDir).root;
164
+ let currentDir = path2.dirname(path2.resolve(startPath));
165
+ const root = path2.parse(currentDir).root;
135
166
  while (currentDir !== root) {
136
- const gitPath = path.join(currentDir, ".git");
167
+ const gitPath = path2.join(currentDir, ".git");
137
168
  if (await fileExists(gitPath)) {
138
169
  return currentDir;
139
170
  }
140
- const parentDir = path.dirname(currentDir);
171
+ const parentDir = path2.dirname(currentDir);
141
172
  if (parentDir === currentDir) {
142
173
  break;
143
174
  }
@@ -148,8 +179,8 @@ async function findGitRoot(startPath) {
148
179
  function buildDirectoryChain(filePath, repoRoot) {
149
180
  const directories = [];
150
181
  const seen = /* @__PURE__ */ new Set();
151
- const boundary = path.resolve(repoRoot);
152
- let current = path.resolve(path.dirname(filePath));
182
+ const boundary = path2.resolve(repoRoot);
183
+ let current = path2.resolve(path2.dirname(filePath));
153
184
  while (current !== void 0) {
154
185
  if (!seen.has(current)) {
155
186
  directories.push(current);
@@ -158,7 +189,7 @@ function buildDirectoryChain(filePath, repoRoot) {
158
189
  if (current === boundary) {
159
190
  break;
160
191
  }
161
- const parent = path.dirname(current);
192
+ const parent = path2.dirname(current);
162
193
  if (parent === current) {
163
194
  break;
164
195
  }
@@ -172,16 +203,16 @@ function buildDirectoryChain(filePath, repoRoot) {
172
203
  function buildSearchRoots(evalPath, repoRoot) {
173
204
  const uniqueRoots = [];
174
205
  const addRoot = (root) => {
175
- const normalized = path.resolve(root);
206
+ const normalized = path2.resolve(root);
176
207
  if (!uniqueRoots.includes(normalized)) {
177
208
  uniqueRoots.push(normalized);
178
209
  }
179
210
  };
180
- let currentDir = path.dirname(evalPath);
211
+ let currentDir = path2.dirname(evalPath);
181
212
  let reachedBoundary = false;
182
213
  while (!reachedBoundary) {
183
214
  addRoot(currentDir);
184
- const parentDir = path.dirname(currentDir);
215
+ const parentDir = path2.dirname(currentDir);
185
216
  if (currentDir === repoRoot || parentDir === currentDir) {
186
217
  reachedBoundary = true;
187
218
  } else {
@@ -199,16 +230,16 @@ function trimLeadingSeparators(value) {
199
230
  async function resolveFileReference(rawValue, searchRoots) {
200
231
  const displayPath = trimLeadingSeparators(rawValue);
201
232
  const potentialPaths = [];
202
- if (path.isAbsolute(rawValue)) {
203
- potentialPaths.push(path.normalize(rawValue));
233
+ if (path2.isAbsolute(rawValue)) {
234
+ potentialPaths.push(path2.normalize(rawValue));
204
235
  }
205
236
  for (const base of searchRoots) {
206
- potentialPaths.push(path.resolve(base, displayPath));
237
+ potentialPaths.push(path2.resolve(base, displayPath));
207
238
  }
208
239
  const attempted = [];
209
240
  const seen = /* @__PURE__ */ new Set();
210
241
  for (const candidate of potentialPaths) {
211
- const absoluteCandidate = path.resolve(candidate);
242
+ const absoluteCandidate = path2.resolve(candidate);
212
243
  if (seen.has(absoluteCandidate)) {
213
244
  continue;
214
245
  }
@@ -314,7 +345,7 @@ function isAgentProvider(provider) {
314
345
  // src/evaluation/providers/targets.ts
315
346
  import { existsSync, readFileSync } from "node:fs";
316
347
  import { homedir } from "node:os";
317
- import path2 from "node:path";
348
+ import path3 from "node:path";
318
349
  import { z } from "zod";
319
350
  var CliHealthcheckHttpInputSchema = z.object({
320
351
  url: z.string().min(1, "healthcheck URL is required"),
@@ -398,11 +429,11 @@ function normalizeCliHealthcheck(input, env, targetName, evalFilePath) {
398
429
  allowLiteral: true,
399
430
  optionalEnv: true
400
431
  });
401
- if (cwd && evalFilePath && !path2.isAbsolute(cwd)) {
402
- cwd = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), cwd);
432
+ if (cwd && evalFilePath && !path3.isAbsolute(cwd)) {
433
+ cwd = path3.resolve(path3.dirname(path3.resolve(evalFilePath)), cwd);
403
434
  }
404
435
  if (!cwd && evalFilePath) {
405
- cwd = path2.dirname(path2.resolve(evalFilePath));
436
+ cwd = path3.dirname(path3.resolve(evalFilePath));
406
437
  }
407
438
  return {
408
439
  command,
@@ -419,11 +450,11 @@ function normalizeCliTargetInput(input, env, evalFilePath) {
419
450
  allowLiteral: true,
420
451
  optionalEnv: true
421
452
  });
422
- if (cwd && evalFilePath && !path2.isAbsolute(cwd)) {
423
- cwd = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), cwd);
453
+ if (cwd && evalFilePath && !path3.isAbsolute(cwd)) {
454
+ cwd = path3.resolve(path3.dirname(path3.resolve(evalFilePath)), cwd);
424
455
  }
425
456
  if (!cwd && evalFilePath) {
426
- cwd = path2.dirname(path2.resolve(evalFilePath));
457
+ cwd = path3.dirname(path3.resolve(evalFilePath));
427
458
  }
428
459
  const timeoutSeconds = input.timeout_seconds;
429
460
  const timeoutMs = timeoutSeconds !== void 0 ? Math.floor(timeoutSeconds * 1e3) : void 0;
@@ -481,7 +512,15 @@ var DEPRECATED_TARGET_CAMEL_CASE_FIELDS = /* @__PURE__ */ new Map([
481
512
  ["retryInitialDelayMs", "retry_initial_delay_ms"],
482
513
  ["retryMaxDelayMs", "retry_max_delay_ms"],
483
514
  ["retryBackoffFactor", "retry_backoff_factor"],
484
- ["retryStatusCodes", "retry_status_codes"]
515
+ ["retryStatusCodes", "retry_status_codes"],
516
+ ["modelReasoningEffort", "model_reasoning_effort"]
517
+ ]);
518
+ var CODEX_MODEL_REASONING_EFFORT_VALUES = /* @__PURE__ */ new Set([
519
+ "minimal",
520
+ "low",
521
+ "medium",
522
+ "high",
523
+ "xhigh"
485
524
  ]);
486
525
  var DEPRECATED_HEALTHCHECK_CAMEL_CASE_FIELDS = /* @__PURE__ */ new Map([
487
526
  ["timeoutSeconds", "timeout_seconds"]
@@ -819,6 +858,9 @@ function normalizeOpenAIBaseUrl(value) {
819
858
  if (trimmed.length === 0) {
820
859
  return DEFAULT_OPENAI_BASE_URL;
821
860
  }
861
+ if (/\.openai\.azure\.com\/openai\/deployments\/[^/]+$/i.test(trimmed)) {
862
+ return trimmed;
863
+ }
822
864
  return trimmed.endsWith("/v1") ? trimmed : `${trimmed}/v1`;
823
865
  }
824
866
  function resolveAzureConfig(target, env) {
@@ -947,22 +989,34 @@ function resolveGeminiConfig(target, env) {
947
989
  }
948
990
  function resolveCodexConfig(target, env, _evalFilePath) {
949
991
  const modelSource = target.model;
992
+ const modelReasoningEffortSource = target.model_reasoning_effort;
950
993
  const executableSource = target.executable ?? target.command ?? target.binary;
951
994
  const argsSource = target.args ?? target.arguments;
952
995
  const cwdSource = target.cwd;
953
996
  const timeoutSource = target.timeout_seconds;
954
997
  const logDirSource = target.log_dir ?? target.log_directory;
955
- const logFormatSource = target.log_format ?? target.log_output_format ?? env.AGENTV_CODEX_LOG_FORMAT;
956
998
  const systemPromptSource = target.system_prompt;
957
- const streamLogResult = resolveStreamLog(target, env.AGENTV_CODEX_LOG_FORMAT);
958
- if (streamLogResult.deprecationWarning) {
959
- process.stderr.write(`[agentv] \u26A0 ${streamLogResult.deprecationWarning}
960
- `);
999
+ if (target.log_format !== void 0 || target.log_output_format !== void 0) {
1000
+ throw new Error(
1001
+ `${target.name}: log_format is no longer supported for codex targets. Use stream_log instead.`
1002
+ );
961
1003
  }
1004
+ const streamLogResult = resolveStreamLog({ name: target.name, stream_log: target.stream_log });
962
1005
  const model = resolveOptionalString(modelSource, env, `${target.name} codex model`, {
963
1006
  allowLiteral: true,
964
1007
  optionalEnv: true
965
1008
  });
1009
+ const modelReasoningEffort = normalizeCodexModelReasoningEffort(
1010
+ resolveOptionalString(
1011
+ modelReasoningEffortSource,
1012
+ env,
1013
+ `${target.name} codex model reasoning effort`,
1014
+ {
1015
+ allowLiteral: true,
1016
+ optionalEnv: true
1017
+ }
1018
+ )
1019
+ );
966
1020
  const executable = resolveOptionalString(executableSource, env, `${target.name} codex executable`, {
967
1021
  allowLiteral: true,
968
1022
  optionalEnv: true
@@ -977,32 +1031,30 @@ function resolveCodexConfig(target, env, _evalFilePath) {
977
1031
  allowLiteral: true,
978
1032
  optionalEnv: true
979
1033
  });
980
- const logFormat = normalizeCodexLogFormat(logFormatSource);
981
1034
  const systemPrompt = typeof systemPromptSource === "string" && systemPromptSource.trim().length > 0 ? systemPromptSource.trim() : void 0;
982
1035
  return {
983
1036
  model,
1037
+ modelReasoningEffort,
984
1038
  executable,
985
1039
  args,
986
1040
  cwd,
987
1041
  timeoutMs,
988
1042
  logDir,
989
- logFormat,
990
1043
  streamLog: streamLogResult.streamLog,
991
1044
  systemPrompt
992
1045
  };
993
1046
  }
994
- function normalizeCodexLogFormat(value) {
995
- if (value === void 0 || value === null) {
1047
+ function normalizeCodexModelReasoningEffort(value) {
1048
+ if (value === void 0) {
996
1049
  return void 0;
997
1050
  }
998
- if (typeof value !== "string") {
999
- throw new Error("codex log format must be 'summary' or 'json'");
1000
- }
1001
1051
  const normalized = value.trim().toLowerCase();
1002
- if (normalized === "json" || normalized === "summary") {
1052
+ if (CODEX_MODEL_REASONING_EFFORT_VALUES.has(normalized)) {
1003
1053
  return normalized;
1004
1054
  }
1005
- throw new Error("codex log format must be 'summary' or 'json'");
1055
+ throw new Error(
1056
+ `codex model_reasoning_effort must be one of: ${[...CODEX_MODEL_REASONING_EFFORT_VALUES].join(", ")}`
1057
+ );
1006
1058
  }
1007
1059
  function resolveStreamLog(target, envFallback) {
1008
1060
  if (target.stream_log !== void 0 && target.stream_log !== null) {
@@ -1411,7 +1463,7 @@ function resolveClaudeConfig(target, env, _evalFilePath) {
1411
1463
  };
1412
1464
  }
1413
1465
  function resolveCcMirrorBinaryPath(variant) {
1414
- const variantJsonPath = path2.join(homedir(), ".cc-mirror", variant, "variant.json");
1466
+ const variantJsonPath = path3.join(homedir(), ".cc-mirror", variant, "variant.json");
1415
1467
  if (!existsSync(variantJsonPath)) {
1416
1468
  throw new Error(
1417
1469
  `cc-mirror variant "${variant}": ${variantJsonPath} not found. Install the variant or set "executable" explicitly.`
@@ -1488,8 +1540,8 @@ function resolveCliConfig(target, env, evalFilePath) {
1488
1540
  const parseResult = CliTargetInputSchema.safeParse(target, { errorMap: cliErrorMap });
1489
1541
  if (!parseResult.success) {
1490
1542
  const firstError = parseResult.error.errors[0];
1491
- const path4 = firstError?.path.join(".") || "";
1492
- const prefix = path4 ? `${target.name} ${path4}: ` : `${target.name}: `;
1543
+ const path5 = firstError?.path.join(".") || "";
1544
+ const prefix = path5 ? `${target.name} ${path5}: ` : `${target.name}: `;
1493
1545
  throw new Error(`${prefix}${firstError?.message}`);
1494
1546
  }
1495
1547
  const normalized = normalizeCliTargetInput(parseResult.data, env, evalFilePath);
@@ -1510,11 +1562,11 @@ function resolveDiscoveredProviderConfig(target, providerKind, env, evalFilePath
1510
1562
  allowLiteral: true,
1511
1563
  optionalEnv: true
1512
1564
  });
1513
- if (cwd && evalFilePath && !path2.isAbsolute(cwd)) {
1514
- cwd = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), cwd);
1565
+ if (cwd && evalFilePath && !path3.isAbsolute(cwd)) {
1566
+ cwd = path3.resolve(path3.dirname(path3.resolve(evalFilePath)), cwd);
1515
1567
  }
1516
1568
  if (!cwd && evalFilePath) {
1517
- cwd = path2.dirname(path2.resolve(evalFilePath));
1569
+ cwd = path3.dirname(path3.resolve(evalFilePath));
1518
1570
  }
1519
1571
  return {
1520
1572
  command,
@@ -1822,7 +1874,7 @@ function interpolateTemplateVars(value, vars) {
1822
1874
 
1823
1875
  // src/evaluation/loaders/case-file-loader.ts
1824
1876
  import { readFile as readFile2, readdir, stat } from "node:fs/promises";
1825
- import path3 from "node:path";
1877
+ import path4 from "node:path";
1826
1878
  import fg from "fast-glob";
1827
1879
  var ANSI_YELLOW = "\x1B[33m";
1828
1880
  var ANSI_RESET = "\x1B[0m";
@@ -1875,7 +1927,7 @@ function parseJsonlCases(content, filePath) {
1875
1927
  return results;
1876
1928
  }
1877
1929
  async function loadCasesFromFile(filePath) {
1878
- const ext = path3.extname(filePath).toLowerCase();
1930
+ const ext = path4.extname(filePath).toLowerCase();
1879
1931
  let content;
1880
1932
  try {
1881
1933
  content = await readFile2(filePath, "utf8");
@@ -1902,7 +1954,7 @@ async function loadCasesFromFile(filePath) {
1902
1954
  }
1903
1955
  async function resolveFileReference2(ref, evalFileDir) {
1904
1956
  const rawPath = extractFilePath(ref);
1905
- const absolutePattern = path3.resolve(evalFileDir, rawPath);
1957
+ const absolutePattern = path4.resolve(evalFileDir, rawPath);
1906
1958
  if (isGlobPattern(rawPath)) {
1907
1959
  const matches = await fg(absolutePattern.replaceAll("\\", "/"), {
1908
1960
  onlyFiles: true,
@@ -1929,10 +1981,10 @@ async function loadCasesFromDirectory(dirPath) {
1929
1981
  const subdirs = entries.filter((e) => e.isDirectory()).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
1930
1982
  const results = [];
1931
1983
  for (const subdir of subdirs) {
1932
- const subdirPath = path3.join(dirPath, subdir.name);
1984
+ const subdirPath = path4.join(dirPath, subdir.name);
1933
1985
  let caseFilePath;
1934
1986
  for (const filename of ["case.yaml", "case.yml"]) {
1935
- const candidate = path3.join(subdirPath, filename);
1987
+ const candidate = path4.join(subdirPath, filename);
1936
1988
  try {
1937
1989
  const s = await stat(candidate);
1938
1990
  if (s.isFile()) {
@@ -1968,7 +2020,7 @@ async function loadCasesFromDirectory(dirPath) {
1968
2020
  caseObj.id = subdir.name;
1969
2021
  }
1970
2022
  if (!caseObj.workspace) {
1971
- const workspaceDirPath = path3.join(subdirPath, "workspace");
2023
+ const workspaceDirPath = path4.join(subdirPath, "workspace");
1972
2024
  try {
1973
2025
  const s = await stat(workspaceDirPath);
1974
2026
  if (s.isDirectory()) {
@@ -2004,12 +2056,20 @@ export {
2004
2056
  isJsonValue,
2005
2057
  isTestMessage,
2006
2058
  isGraderKind,
2059
+ RUBRIC_OPERATOR_VALUES,
2007
2060
  parseYamlValue,
2008
2061
  interpolateEnv,
2009
2062
  interpolateTemplateVars,
2010
2063
  loadCasesFromFile,
2011
2064
  loadCasesFromDirectory,
2012
2065
  expandFileReferences,
2066
+ getAgentvConfigDir,
2067
+ getAgentvHome,
2068
+ getAgentvDataDir,
2069
+ getWorkspacesRoot,
2070
+ getSubagentsRoot,
2071
+ getTraceStateRoot,
2072
+ getWorkspacePoolRoot,
2013
2073
  fileExists,
2014
2074
  normalizeLineEndings,
2015
2075
  readTextFile,
@@ -2029,4 +2089,4 @@ export {
2029
2089
  resolveDelegatedTargetDefinition,
2030
2090
  resolveTargetDefinition
2031
2091
  };
2032
- //# sourceMappingURL=chunk-5RQMJZDJ.js.map
2092
+ //# sourceMappingURL=chunk-EW5X2RGJ.js.map