@agentv/core 4.22.0 → 4.24.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.
@@ -13,10 +13,11 @@ import {
13
13
  isTestMessage,
14
14
  loadCasesFromDirectory,
15
15
  loadCasesFromFile,
16
+ parseYamlValue,
16
17
  readTextFile,
17
18
  resolveDelegatedTargetDefinition,
18
19
  resolveTargetDefinition
19
- } from "./chunk-LKX4QW3G.js";
20
+ } from "./chunk-4VLOUBFL.js";
20
21
  import {
21
22
  execFileWithStdin,
22
23
  execShellWithStdin
@@ -7762,7 +7763,6 @@ function parseCopilotEvents(eventsJsonl) {
7762
7763
  import { readFile as readFile3, readdir as readdir2, stat as stat2 } from "node:fs/promises";
7763
7764
  import { homedir as homedir3 } from "node:os";
7764
7765
  import path12 from "node:path";
7765
- import { parse as parseYaml } from "yaml";
7766
7766
  var DEFAULT_SESSION_STATE_DIR = () => path12.join(homedir3(), ".copilot", "session-state");
7767
7767
  async function discoverCopilotSessions(opts) {
7768
7768
  const sessionStateDir = opts?.sessionStateDir ?? DEFAULT_SESSION_STATE_DIR();
@@ -7780,7 +7780,7 @@ async function discoverCopilotSessions(opts) {
7780
7780
  const eventsPath = path12.join(sessionDir, "events.jsonl");
7781
7781
  try {
7782
7782
  const workspaceContent = await readFile3(workspacePath, "utf8");
7783
- const workspace = parseYaml(workspaceContent) ?? {};
7783
+ const workspace = parseYamlValue(workspaceContent) ?? {};
7784
7784
  const cwd = String(workspace.cwd ?? "");
7785
7785
  let updatedAt;
7786
7786
  try {
@@ -11371,7 +11371,6 @@ total unlocked subagents available: ${result.created.length + result.skippedExis
11371
11371
  import { constants as constants3 } from "node:fs";
11372
11372
  import { access as access3, readFile as readFile7 } from "node:fs/promises";
11373
11373
  import path28 from "node:path";
11374
- import { parse } from "yaml";
11375
11374
  function isRecord(value) {
11376
11375
  return typeof value === "object" && value !== null && !Array.isArray(value);
11377
11376
  }
@@ -11415,7 +11414,7 @@ async function readTargetDefinitions(filePath) {
11415
11414
  throw new Error(`targets.yaml not found at ${absolutePath}`);
11416
11415
  }
11417
11416
  const raw = await readFile7(absolutePath, "utf8");
11418
- const parsed = parse(raw);
11417
+ const parsed = parseYamlValue(raw);
11419
11418
  if (!isRecord(parsed)) {
11420
11419
  throw new Error(`targets.yaml at ${absolutePath} must be a YAML object with a 'targets' field`);
11421
11420
  }
@@ -12803,7 +12802,6 @@ async function executeWorkspaceScript(config, context, failureMode = "fatal") {
12803
12802
  import { readFile as readFile15, stat as stat8 } from "node:fs/promises";
12804
12803
  import path43 from "node:path";
12805
12804
  import micromatch2 from "micromatch";
12806
- import { parse as parse4 } from "yaml";
12807
12805
 
12808
12806
  // src/evaluation/input-message-utils.ts
12809
12807
  function flattenInputMessages(messages) {
@@ -12952,7 +12950,6 @@ function parseAgentSkillsEvals(parsed, source = "evals.json", baseDir) {
12952
12950
  // src/evaluation/loaders/config-loader.ts
12953
12951
  import { readFile as readFile10 } from "node:fs/promises";
12954
12952
  import path39 from "node:path";
12955
- import { parse as parse2 } from "yaml";
12956
12953
 
12957
12954
  // src/evaluation/loaders/file-resolver.ts
12958
12955
  import { constants as constants4 } from "node:fs";
@@ -13072,7 +13069,7 @@ async function loadConfig(evalFilePath, repoRoot) {
13072
13069
  }
13073
13070
  try {
13074
13071
  const rawConfig = await readFile10(configPath, "utf8");
13075
- const parsed = interpolateEnv(parse2(rawConfig), process.env);
13072
+ const parsed = interpolateEnv(parseYamlValue(rawConfig), process.env);
13076
13073
  if (!isJsonObject(parsed)) {
13077
13074
  logWarning(`Invalid .agentv/config.yaml format at ${configPath}`);
13078
13075
  continue;
@@ -13481,7 +13478,6 @@ function logWarning(message) {
13481
13478
  // src/evaluation/loaders/grader-parser.ts
13482
13479
  import { readFile as readFile12 } from "node:fs/promises";
13483
13480
  import path40 from "node:path";
13484
- import { parse as parse3 } from "yaml";
13485
13481
 
13486
13482
  // src/evaluation/validation/prompt-validator.ts
13487
13483
  import { readFile as readFile11 } from "node:fs/promises";
@@ -13621,7 +13617,7 @@ ${resolved.attempted.map((attempt) => ` Tried: ${attempt}`).join("\n")}` : "";
13621
13617
  throw new Error(`Assertion template cycle detected in '${evalId}': ${cycle}`);
13622
13618
  }
13623
13619
  const content = await readFile12(resolved.resolvedPath, "utf8");
13624
- const parsed = interpolateEnv(parse3(content), process.env);
13620
+ const parsed = interpolateEnv(parseYamlValue(content), process.env);
13625
13621
  if (!isJsonObject2(parsed)) {
13626
13622
  throw new Error(
13627
13623
  `Invalid assertion template file in '${evalId}': ${resolved.resolvedPath} (expected a YAML object with an assertions array)`
@@ -15235,7 +15231,6 @@ function parseInlineRubrics(rawRubrics) {
15235
15231
  import { readFile as readFile14 } from "node:fs/promises";
15236
15232
  import path42 from "node:path";
15237
15233
  import micromatch from "micromatch";
15238
- import { parse as parseYaml2 } from "yaml";
15239
15234
 
15240
15235
  // src/evaluation/loaders/message-processor.ts
15241
15236
  import { readFile as readFile13 } from "node:fs/promises";
@@ -15659,7 +15654,7 @@ async function loadSidecarMetadata(jsonlPath, verbose) {
15659
15654
  }
15660
15655
  try {
15661
15656
  const content = await readFile14(sidecarPath, "utf8");
15662
- const parsed = interpolateEnv(parseYaml2(content), process.env);
15657
+ const parsed = interpolateEnv(parseYamlValue(content), process.env);
15663
15658
  if (!isJsonObject(parsed)) {
15664
15659
  logWarning4(`Invalid sidecar metadata format in ${sidecarPath}`);
15665
15660
  return {};
@@ -15842,7 +15837,7 @@ ${detailBlock}${ANSI_RESET7}`);
15842
15837
  // src/evaluation/metadata.ts
15843
15838
  import { z as z3 } from "zod";
15844
15839
  var MetadataSchema = z3.object({
15845
- name: z3.string().min(1).max(64).regex(/^[a-z0-9-]+$/),
15840
+ name: z3.string().min(1).max(64).regex(/^[a-z0-9-]+$/).optional(),
15846
15841
  description: z3.string().min(1).max(1024).optional(),
15847
15842
  version: z3.string().optional(),
15848
15843
  author: z3.string().optional(),
@@ -15853,9 +15848,7 @@ var MetadataSchema = z3.object({
15853
15848
  }).optional()
15854
15849
  });
15855
15850
  function parseMetadata(suite) {
15856
- const hasName = typeof suite.name === "string";
15857
- const hasDescription = typeof suite.description === "string";
15858
- if (!hasName) {
15851
+ if (typeof suite.name !== "string") {
15859
15852
  return void 0;
15860
15853
  }
15861
15854
  return MetadataSchema.parse({
@@ -16089,7 +16082,7 @@ async function readTestSuiteMetadata(testFilePath) {
16089
16082
  try {
16090
16083
  const absolutePath = path43.resolve(testFilePath);
16091
16084
  const content = await readFile15(absolutePath, "utf8");
16092
- const parsed = interpolateEnv(parse4(content), process.env);
16085
+ const parsed = interpolateEnv(parseYamlValue(content), process.env);
16093
16086
  if (!isJsonObject(parsed)) {
16094
16087
  return {};
16095
16088
  }
@@ -16112,7 +16105,7 @@ async function loadTestSuite(evalFilePath, repoRoot, options) {
16112
16105
  return { tests: await loadTestsFromAgentSkills(evalFilePath) };
16113
16106
  }
16114
16107
  if (format === "typescript") {
16115
- const { loadTsEvalSuite: loadTsEvalSuite2 } = await import("./ts-eval-loader-PA4YFM5D.js");
16108
+ const { loadTsEvalSuite: loadTsEvalSuite2 } = await import("./ts-eval-loader-SYQYQPMC.js");
16116
16109
  return loadTsEvalSuite2(evalFilePath, resolveToAbsolutePath(repoRoot), options);
16117
16110
  }
16118
16111
  const { tests, parsed, suiteWorkspacePath } = await loadTestsFromYaml(
@@ -16147,7 +16140,7 @@ async function loadTests(evalFilePath, repoRoot, options) {
16147
16140
  return loadTestsFromAgentSkills(evalFilePath);
16148
16141
  }
16149
16142
  if (format === "typescript") {
16150
- const { loadTsEvalSuite: loadTsEvalSuite2 } = await import("./ts-eval-loader-PA4YFM5D.js");
16143
+ const { loadTsEvalSuite: loadTsEvalSuite2 } = await import("./ts-eval-loader-SYQYQPMC.js");
16151
16144
  const suite = await loadTsEvalSuite2(evalFilePath, resolveToAbsolutePath(repoRoot), options);
16152
16145
  return suite.tests;
16153
16146
  }
@@ -16163,7 +16156,7 @@ async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
16163
16156
  const searchRoots = buildSearchRoots(absoluteTestPath, repoRootPath);
16164
16157
  const config = await loadConfig(absoluteTestPath, repoRootPath);
16165
16158
  const rawFile = await readFile15(absoluteTestPath, "utf8");
16166
- const interpolated = interpolateEnv(parse4(rawFile), process.env);
16159
+ const interpolated = interpolateEnv(parseYamlValue(rawFile), process.env);
16167
16160
  if (!isJsonObject(interpolated)) {
16168
16161
  throw new Error(`Invalid test file format: ${evalFilePath}`);
16169
16162
  }
@@ -16200,6 +16193,7 @@ async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
16200
16193
  throw new Error(`Invalid test file format: ${evalFilePath} - missing 'tests' field`);
16201
16194
  }
16202
16195
  const suiteWorkspace = await resolveWorkspaceConfig(suite.workspace, evalFileDir);
16196
+ const suiteGovernance = extractSuiteGovernance(suite);
16203
16197
  const suiteInputMessages = expandInputShorthand(suite.input);
16204
16198
  const suiteInputFiles = suite.input_files;
16205
16199
  const rawGlobalExecution = isJsonObject(suite.execution) ? suite.execution : void 0;
@@ -16309,7 +16303,9 @@ async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
16309
16303
  const userFilePaths = collectResolvedInputFilePaths(inputMessages);
16310
16304
  const caseWorkspace = await resolveWorkspaceConfig(testCaseConfig.workspace, evalFileDir);
16311
16305
  const mergedWorkspace = mergeWorkspaceConfigs(suiteWorkspace, caseWorkspace);
16312
- const metadata = isJsonObject(testCaseConfig.metadata) ? testCaseConfig.metadata : void 0;
16306
+ const rawCaseMetadata = isJsonObject(testCaseConfig.metadata) ? testCaseConfig.metadata : void 0;
16307
+ const suitePayload = suiteGovernance !== void 0 ? { governance: suiteGovernance } : void 0;
16308
+ const metadata = mergeSuiteMetadataPayload(rawCaseMetadata, suitePayload);
16313
16309
  const caseTargets = extractTargetsFromTestCase(testCaseConfig);
16314
16310
  const dependsOn = Array.isArray(testCaseConfig.depends_on) ? testCaseConfig.depends_on.filter(
16315
16311
  (v) => typeof v === "string"
@@ -16450,7 +16446,7 @@ async function resolveWorkspaceConfig(raw, evalFileDir) {
16450
16446
  } catch {
16451
16447
  throw new Error(`Workspace file not found: ${raw} (resolved to ${workspaceFilePath})`);
16452
16448
  }
16453
- const parsed = interpolateEnv(parse4(content), process.env);
16449
+ const parsed = interpolateEnv(parseYamlValue(content), process.env);
16454
16450
  if (!isJsonObject(parsed)) {
16455
16451
  throw new Error(
16456
16452
  `Invalid workspace file format: ${workspaceFilePath} (expected a YAML object)`
@@ -16557,6 +16553,47 @@ function mergeWorkspaceConfigs(suiteLevel, caseLevel) {
16557
16553
  function asString5(value) {
16558
16554
  return typeof value === "string" ? value : void 0;
16559
16555
  }
16556
+ function extractSuiteGovernance(suite) {
16557
+ const top = suite.governance;
16558
+ if (isJsonObject(top)) {
16559
+ return top;
16560
+ }
16561
+ const wrapper = suite.metadata;
16562
+ if (isJsonObject(wrapper)) {
16563
+ const nested = wrapper.governance;
16564
+ if (isJsonObject(nested)) {
16565
+ return nested;
16566
+ }
16567
+ }
16568
+ return void 0;
16569
+ }
16570
+ function mergeSuiteMetadataPayload(caseMetadata, suitePayload) {
16571
+ if (!suitePayload) return caseMetadata;
16572
+ const result = { ...caseMetadata ?? {} };
16573
+ for (const [key, suiteVal] of Object.entries(suitePayload)) {
16574
+ const caseVal = result[key];
16575
+ if (Array.isArray(suiteVal) && Array.isArray(caseVal)) {
16576
+ const seen = /* @__PURE__ */ new Set();
16577
+ const out = [];
16578
+ for (const v of [...suiteVal, ...caseVal]) {
16579
+ const k = typeof v === "string" ? v : JSON.stringify(v);
16580
+ if (!seen.has(k)) {
16581
+ seen.add(k);
16582
+ out.push(v);
16583
+ }
16584
+ }
16585
+ result[key] = out;
16586
+ } else if (isJsonObject(suiteVal) && isJsonObject(caseVal)) {
16587
+ result[key] = mergeSuiteMetadataPayload(
16588
+ caseVal,
16589
+ suiteVal
16590
+ );
16591
+ } else if (caseVal === void 0) {
16592
+ result[key] = suiteVal;
16593
+ }
16594
+ }
16595
+ return result;
16596
+ }
16560
16597
  function logWarning5(message, details) {
16561
16598
  if (details && details.length > 0) {
16562
16599
  const detailBlock = details.join("\n");
@@ -17465,6 +17502,9 @@ async function runEvaluation(options) {
17465
17502
  result = { ...result, beforeAllOutput };
17466
17503
  beforeAllOutputAttached = true;
17467
17504
  }
17505
+ if (evalCase.metadata && !result.metadata) {
17506
+ result = { ...result, metadata: evalCase.metadata };
17507
+ }
17468
17508
  if (onProgress) {
17469
17509
  await onProgress({
17470
17510
  workerId,
@@ -17475,7 +17515,9 @@ async function runEvaluation(options) {
17475
17515
  completedAt: Date.now(),
17476
17516
  error: result.error,
17477
17517
  score: result.score,
17478
- executionStatus: result.executionStatus
17518
+ executionStatus: result.executionStatus,
17519
+ durationMs: result.durationMs,
17520
+ evalRunDurationMs: result.evalRun?.durationMs
17479
17521
  });
17480
17522
  }
17481
17523
  if (onResult) {
@@ -17789,7 +17831,8 @@ async function runBatchEvaluation(options) {
17789
17831
  completedAt: Date.now(),
17790
17832
  error: error instanceof Error ? error.message : String(error),
17791
17833
  score: errorResult.score,
17792
- executionStatus: errorResult.executionStatus
17834
+ executionStatus: errorResult.executionStatus,
17835
+ evalRunDurationMs: errorResult.evalRun?.durationMs
17793
17836
  });
17794
17837
  }
17795
17838
  continue;
@@ -17807,7 +17850,9 @@ async function runBatchEvaluation(options) {
17807
17850
  completedAt: Date.now(),
17808
17851
  error: result.error,
17809
17852
  score: result.score,
17810
- executionStatus: result.executionStatus
17853
+ executionStatus: result.executionStatus,
17854
+ durationMs: result.durationMs,
17855
+ evalRunDurationMs: result.evalRun?.durationMs
17811
17856
  });
17812
17857
  }
17813
17858
  }
@@ -19909,4 +19954,4 @@ export {
19909
19954
  loadTestById,
19910
19955
  loadEvalCaseById
19911
19956
  };
19912
- //# sourceMappingURL=chunk-B3BLJRYI.js.map
19957
+ //# sourceMappingURL=chunk-CUVG5O5P.js.map