agentv 4.15.9 → 4.16.0

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.
@@ -305,10 +305,12 @@ var require_dist = __commonJS({
305
305
  }
306
306
  });
307
307
 
308
- // ../../packages/core/dist/chunk-HVEQNYTC.js
308
+ // ../../packages/core/dist/chunk-6VZY3B6M.js
309
309
  import { constants } from "node:fs";
310
310
  import { access, readFile } from "node:fs/promises";
311
311
  import path from "node:path";
312
+ import { existsSync, readFileSync } from "node:fs";
313
+ import { homedir } from "node:os";
312
314
  import path2 from "node:path";
313
315
 
314
316
  // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
@@ -423,7 +425,7 @@ __export(external_exports2, {
423
425
  void: () => voidType
424
426
  });
425
427
 
426
- // ../../packages/core/dist/chunk-HVEQNYTC.js
428
+ // ../../packages/core/dist/chunk-6VZY3B6M.js
427
429
  import { readFile as readFile2 } from "node:fs/promises";
428
430
  import path3 from "node:path";
429
431
  import fg from "fast-glob";
@@ -658,8 +660,6 @@ var CliTargetInputSchema = external_exports2.object({
658
660
  attachments_format: external_exports2.string().optional(),
659
661
  // Working directory - optional
660
662
  cwd: external_exports2.string().optional(),
661
- // Workspace template directory - optional (mutually exclusive with cwd)
662
- workspace_template: external_exports2.string().optional(),
663
663
  // Timeout in seconds - optional
664
664
  timeout_seconds: external_exports2.number().positive().optional(),
665
665
  // Healthcheck configuration - optional
@@ -694,7 +694,6 @@ var CliTargetConfigSchema = external_exports2.object({
694
694
  command: external_exports2.string().min(1),
695
695
  filesFormat: external_exports2.string().optional(),
696
696
  cwd: external_exports2.string().optional(),
697
- workspaceTemplate: external_exports2.string().optional(),
698
697
  timeoutMs: external_exports2.number().positive().optional(),
699
698
  healthcheck: CliHealthcheckSchema.optional(),
700
699
  verbose: external_exports2.boolean().optional(),
@@ -737,19 +736,6 @@ function normalizeCliTargetInput(input, env, evalFilePath) {
737
736
  const command = resolveString(input.command, env, `${targetName} CLI command`, true);
738
737
  const filesFormatSource = input.files_format ?? input.attachments_format;
739
738
  const filesFormat = resolveOptionalLiteralString(filesFormatSource);
740
- const workspaceTemplateSource = input.workspace_template;
741
- let workspaceTemplate = resolveOptionalString(
742
- workspaceTemplateSource,
743
- env,
744
- `${targetName} workspace template`,
745
- {
746
- allowLiteral: true,
747
- optionalEnv: true
748
- }
749
- );
750
- if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
751
- workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
752
- }
753
739
  let cwd = resolveOptionalString(input.cwd, env, `${targetName} working directory`, {
754
740
  allowLiteral: true,
755
741
  optionalEnv: true
@@ -757,12 +743,7 @@ function normalizeCliTargetInput(input, env, evalFilePath) {
757
743
  if (cwd && evalFilePath && !path2.isAbsolute(cwd)) {
758
744
  cwd = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), cwd);
759
745
  }
760
- if (cwd && workspaceTemplate) {
761
- throw new Error(
762
- `${targetName}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`
763
- );
764
- }
765
- if (!cwd && !workspaceTemplate && evalFilePath) {
746
+ if (!cwd && evalFilePath) {
766
747
  cwd = path2.dirname(path2.resolve(evalFilePath));
767
748
  }
768
749
  const timeoutSeconds = input.timeout_seconds;
@@ -774,7 +755,6 @@ function normalizeCliTargetInput(input, env, evalFilePath) {
774
755
  command,
775
756
  filesFormat,
776
757
  cwd,
777
- workspaceTemplate,
778
758
  timeoutMs,
779
759
  healthcheck,
780
760
  verbose,
@@ -843,11 +823,6 @@ function collectDeprecatedCamelCaseWarnings(value, location, aliases) {
843
823
  return warnings;
844
824
  }
845
825
  function assertNoDeprecatedCamelCaseTargetFields(definition) {
846
- if (Object.prototype.hasOwnProperty.call(definition, "workspaceTemplate")) {
847
- throw new Error(
848
- `${definition.name}: target-level workspace_template has been removed. Use eval-level workspace.template.`
849
- );
850
- }
851
826
  const warning = findDeprecatedCamelCaseTargetWarnings(
852
827
  definition,
853
828
  `target "${definition.name}"`
@@ -897,7 +872,6 @@ var BASE_TARGET_SCHEMA = external_exports2.object({
897
872
  judge_target: external_exports2.string().optional(),
898
873
  // backward compat
899
874
  workers: external_exports2.number().int().min(1).optional(),
900
- workspace_template: external_exports2.string().optional(),
901
875
  subagent_mode_allowed: external_exports2.boolean().optional(),
902
876
  fallback_targets: external_exports2.array(external_exports2.string().min(1)).optional()
903
877
  }).passthrough();
@@ -994,11 +968,6 @@ function resolveDelegatedTargetDefinition(name21, definitions, env = process.env
994
968
  function resolveTargetDefinition(definition, env = process.env, evalFilePath, options) {
995
969
  assertNoDeprecatedCamelCaseTargetFields(definition);
996
970
  const parsed = BASE_TARGET_SCHEMA.parse(definition);
997
- if (parsed.workspace_template !== void 0) {
998
- throw new Error(
999
- `${parsed.name}: target-level workspace_template has been removed. Use eval-level workspace.template.`
1000
- );
1001
- }
1002
971
  if (!parsed.provider) {
1003
972
  throw new Error(
1004
973
  `${parsed.name}: 'provider' is required (targets with use_target must be resolved before calling resolveTargetDefinition)`
@@ -1095,6 +1064,20 @@ function resolveTargetDefinition(definition, env = process.env, evalFilePath, op
1095
1064
  ...base,
1096
1065
  config: resolvePiCliConfig(parsed, env, evalFilePath)
1097
1066
  };
1067
+ case "cc-mirror": {
1068
+ const variantName = resolveOptionalString(parsed.variant, env, `${parsed.name} cc-mirror variant`, {
1069
+ allowLiteral: true,
1070
+ optionalEnv: true
1071
+ }) ?? parsed.name;
1072
+ if (!parsed.executable) {
1073
+ parsed.executable = resolveCcMirrorBinaryPath(variantName);
1074
+ }
1075
+ return {
1076
+ kind: "claude-cli",
1077
+ ...base,
1078
+ config: resolveClaudeConfig(parsed, env, evalFilePath)
1079
+ };
1080
+ }
1098
1081
  case "claude":
1099
1082
  case "claude-code":
1100
1083
  case "claude-cli":
@@ -1283,12 +1266,11 @@ function resolveGeminiConfig(target, env) {
1283
1266
  retry
1284
1267
  };
1285
1268
  }
1286
- function resolveCodexConfig(target, env, evalFilePath) {
1269
+ function resolveCodexConfig(target, env, _evalFilePath) {
1287
1270
  const modelSource = target.model;
1288
1271
  const executableSource = target.executable ?? target.command ?? target.binary;
1289
1272
  const argsSource = target.args ?? target.arguments;
1290
1273
  const cwdSource = target.cwd;
1291
- const workspaceTemplateSource = target.workspace_template;
1292
1274
  const timeoutSource = target.timeout_seconds;
1293
1275
  const logDirSource = target.log_dir ?? target.log_directory;
1294
1276
  const logFormatSource = target.log_format ?? target.log_output_format ?? env.AGENTV_CODEX_LOG_FORMAT;
@@ -1311,23 +1293,6 @@ function resolveCodexConfig(target, env, evalFilePath) {
1311
1293
  allowLiteral: true,
1312
1294
  optionalEnv: true
1313
1295
  });
1314
- let workspaceTemplate = resolveOptionalString(
1315
- workspaceTemplateSource,
1316
- env,
1317
- `${target.name} codex workspace template`,
1318
- {
1319
- allowLiteral: true,
1320
- optionalEnv: true
1321
- }
1322
- );
1323
- if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
1324
- workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
1325
- }
1326
- if (cwd && workspaceTemplate) {
1327
- throw new Error(
1328
- `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`
1329
- );
1330
- }
1331
1296
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} codex timeout`);
1332
1297
  const logDir = resolveOptionalString(logDirSource, env, `${target.name} codex log directory`, {
1333
1298
  allowLiteral: true,
@@ -1340,7 +1305,6 @@ function resolveCodexConfig(target, env, evalFilePath) {
1340
1305
  executable,
1341
1306
  args,
1342
1307
  cwd,
1343
- workspaceTemplate,
1344
1308
  timeoutMs,
1345
1309
  logDir,
1346
1310
  logFormat,
@@ -1393,13 +1357,12 @@ function resolveStreamLog(target, envFallback) {
1393
1357
  deprecationWarning: `${target.name}: 'log_format' is deprecated and will be removed in v4.16. Use 'stream_log: ${streamLogEquivalent}' instead (log_format: '${normalized}' \u2192 stream_log: '${streamLogEquivalent}').`
1394
1358
  };
1395
1359
  }
1396
- function resolveCopilotSdkConfig(target, env, evalFilePath) {
1360
+ function resolveCopilotSdkConfig(target, env, _evalFilePath) {
1397
1361
  const cliUrlSource = target.cli_url;
1398
1362
  const cliPathSource = target.cli_path;
1399
1363
  const githubTokenSource = target.github_token;
1400
1364
  const modelSource = target.model;
1401
1365
  const cwdSource = target.cwd;
1402
- const workspaceTemplateSource = target.workspace_template;
1403
1366
  const timeoutSource = target.timeout_seconds;
1404
1367
  const logDirSource = target.log_dir ?? target.log_directory;
1405
1368
  const logFormatSource = target.log_format;
@@ -1434,23 +1397,6 @@ function resolveCopilotSdkConfig(target, env, evalFilePath) {
1434
1397
  allowLiteral: true,
1435
1398
  optionalEnv: true
1436
1399
  });
1437
- let workspaceTemplate = resolveOptionalString(
1438
- workspaceTemplateSource,
1439
- env,
1440
- `${target.name} copilot-sdk workspace template`,
1441
- {
1442
- allowLiteral: true,
1443
- optionalEnv: true
1444
- }
1445
- );
1446
- if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
1447
- workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
1448
- }
1449
- if (cwd && workspaceTemplate) {
1450
- throw new Error(
1451
- `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`
1452
- );
1453
- }
1454
1400
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} copilot-sdk timeout`);
1455
1401
  const logDir = resolveOptionalString(
1456
1402
  logDirSource,
@@ -1515,7 +1461,6 @@ function resolveCopilotSdkConfig(target, env, evalFilePath) {
1515
1461
  githubToken,
1516
1462
  model,
1517
1463
  cwd,
1518
- workspaceTemplate,
1519
1464
  timeoutMs,
1520
1465
  logDir,
1521
1466
  logFormat,
@@ -1529,12 +1474,11 @@ function resolveCopilotSdkConfig(target, env, evalFilePath) {
1529
1474
  byokWireApi
1530
1475
  };
1531
1476
  }
1532
- function resolveCopilotCliConfig(target, env, evalFilePath) {
1477
+ function resolveCopilotCliConfig(target, env, _evalFilePath) {
1533
1478
  const executableSource = target.executable ?? target.command ?? target.binary;
1534
1479
  const modelSource = target.model;
1535
1480
  const argsSource = target.args ?? target.arguments;
1536
1481
  const cwdSource = target.cwd;
1537
- const workspaceTemplateSource = target.workspace_template;
1538
1482
  const timeoutSource = target.timeout_seconds;
1539
1483
  const logDirSource = target.log_dir ?? target.log_directory;
1540
1484
  const logFormatSource = target.log_format;
@@ -1557,23 +1501,6 @@ function resolveCopilotCliConfig(target, env, evalFilePath) {
1557
1501
  allowLiteral: true,
1558
1502
  optionalEnv: true
1559
1503
  });
1560
- let workspaceTemplate = resolveOptionalString(
1561
- workspaceTemplateSource,
1562
- env,
1563
- `${target.name} copilot-cli workspace template`,
1564
- {
1565
- allowLiteral: true,
1566
- optionalEnv: true
1567
- }
1568
- );
1569
- if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
1570
- workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
1571
- }
1572
- if (cwd && workspaceTemplate) {
1573
- throw new Error(
1574
- `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`
1575
- );
1576
- }
1577
1504
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} copilot-cli timeout`);
1578
1505
  const logDir = resolveOptionalString(
1579
1506
  logDirSource,
@@ -1591,7 +1518,6 @@ function resolveCopilotCliConfig(target, env, evalFilePath) {
1591
1518
  model,
1592
1519
  args,
1593
1520
  cwd,
1594
- workspaceTemplate,
1595
1521
  timeoutMs,
1596
1522
  logDir,
1597
1523
  logFormat,
@@ -1606,14 +1532,13 @@ function normalizeCopilotLogFormat(value) {
1606
1532
  if (normalized === "json" || normalized === "summary") return normalized;
1607
1533
  throw new Error("copilot log format must be 'summary' or 'json'");
1608
1534
  }
1609
- function resolvePiCodingAgentConfig(target, env, evalFilePath) {
1535
+ function resolvePiCodingAgentConfig(target, env, _evalFilePath) {
1610
1536
  const subproviderSource = target.subprovider;
1611
1537
  const modelSource = target.model ?? target.pi_model;
1612
1538
  const apiKeySource = target.api_key;
1613
1539
  const toolsSource = target.tools ?? target.pi_tools;
1614
1540
  const thinkingSource = target.thinking ?? target.pi_thinking;
1615
1541
  const cwdSource = target.cwd;
1616
- const workspaceTemplateSource = target.workspace_template;
1617
1542
  const timeoutSource = target.timeout_seconds;
1618
1543
  const logDirSource = target.log_dir ?? target.log_directory;
1619
1544
  const logFormatSource = target.log_format;
@@ -1657,23 +1582,6 @@ function resolvePiCodingAgentConfig(target, env, evalFilePath) {
1657
1582
  allowLiteral: true,
1658
1583
  optionalEnv: true
1659
1584
  });
1660
- let workspaceTemplate = resolveOptionalString(
1661
- workspaceTemplateSource,
1662
- env,
1663
- `${target.name} pi workspace template`,
1664
- {
1665
- allowLiteral: true,
1666
- optionalEnv: true
1667
- }
1668
- );
1669
- if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
1670
- workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
1671
- }
1672
- if (cwd && workspaceTemplate) {
1673
- throw new Error(
1674
- `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`
1675
- );
1676
- }
1677
1585
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} pi timeout`);
1678
1586
  const logDir = resolveOptionalString(logDirSource, env, `${target.name} pi log directory`, {
1679
1587
  allowLiteral: true,
@@ -1689,7 +1597,6 @@ function resolvePiCodingAgentConfig(target, env, evalFilePath) {
1689
1597
  tools,
1690
1598
  thinking,
1691
1599
  cwd,
1692
- workspaceTemplate,
1693
1600
  timeoutMs,
1694
1601
  logDir,
1695
1602
  logFormat,
@@ -1697,7 +1604,7 @@ function resolvePiCodingAgentConfig(target, env, evalFilePath) {
1697
1604
  systemPrompt
1698
1605
  };
1699
1606
  }
1700
- function resolvePiCliConfig(target, env, evalFilePath) {
1607
+ function resolvePiCliConfig(target, env, _evalFilePath) {
1701
1608
  const executableSource = target.executable ?? target.command ?? target.binary;
1702
1609
  const subproviderSource = target.subprovider;
1703
1610
  const modelSource = target.model ?? target.pi_model;
@@ -1705,7 +1612,6 @@ function resolvePiCliConfig(target, env, evalFilePath) {
1705
1612
  const toolsSource = target.tools ?? target.pi_tools;
1706
1613
  const thinkingSource = target.thinking ?? target.pi_thinking;
1707
1614
  const cwdSource = target.cwd;
1708
- const workspaceTemplateSource = target.workspace_template;
1709
1615
  const timeoutSource = target.timeout_seconds;
1710
1616
  const logDirSource = target.log_dir ?? target.log_directory;
1711
1617
  const logFormatSource = target.log_format;
@@ -1752,18 +1658,6 @@ function resolvePiCliConfig(target, env, evalFilePath) {
1752
1658
  allowLiteral: true,
1753
1659
  optionalEnv: true
1754
1660
  });
1755
- let workspaceTemplate = resolveOptionalString(
1756
- workspaceTemplateSource,
1757
- env,
1758
- `${target.name} pi-cli workspace template`,
1759
- { allowLiteral: true, optionalEnv: true }
1760
- );
1761
- if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
1762
- workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
1763
- }
1764
- if (cwd && workspaceTemplate) {
1765
- throw new Error(`${target.name}: 'cwd' and 'workspace_template' are mutually exclusive.`);
1766
- }
1767
1661
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} pi-cli timeout`);
1768
1662
  const logDir = resolveOptionalString(logDirSource, env, `${target.name} pi-cli log directory`, {
1769
1663
  allowLiteral: true,
@@ -1781,7 +1675,6 @@ function resolvePiCliConfig(target, env, evalFilePath) {
1781
1675
  thinking,
1782
1676
  args,
1783
1677
  cwd,
1784
- workspaceTemplate,
1785
1678
  timeoutMs,
1786
1679
  logDir,
1787
1680
  logFormat,
@@ -1789,10 +1682,10 @@ function resolvePiCliConfig(target, env, evalFilePath) {
1789
1682
  systemPrompt
1790
1683
  };
1791
1684
  }
1792
- function resolveClaudeConfig(target, env, evalFilePath) {
1685
+ function resolveClaudeConfig(target, env, _evalFilePath) {
1686
+ const executableSource = target.executable ?? target.command ?? target.binary;
1793
1687
  const modelSource = target.model;
1794
1688
  const cwdSource = target.cwd;
1795
- const workspaceTemplateSource = target.workspace_template;
1796
1689
  const timeoutSource = target.timeout_seconds;
1797
1690
  const logDirSource = target.log_dir ?? target.log_directory;
1798
1691
  const logFormatSource = target.log_format ?? target.log_output_format ?? env.AGENTV_CLAUDE_LOG_FORMAT;
@@ -1802,6 +1695,10 @@ function resolveClaudeConfig(target, env, evalFilePath) {
1802
1695
  process.stderr.write(`[agentv] \u26A0 ${streamLogResult.deprecationWarning}
1803
1696
  `);
1804
1697
  }
1698
+ const executable = resolveOptionalString(executableSource, env, `${target.name} claude-cli executable`, {
1699
+ allowLiteral: true,
1700
+ optionalEnv: true
1701
+ }) ?? "claude";
1805
1702
  const model = resolveOptionalString(modelSource, env, `${target.name} claude model`, {
1806
1703
  allowLiteral: true,
1807
1704
  optionalEnv: true
@@ -1810,23 +1707,6 @@ function resolveClaudeConfig(target, env, evalFilePath) {
1810
1707
  allowLiteral: true,
1811
1708
  optionalEnv: true
1812
1709
  });
1813
- let workspaceTemplate = resolveOptionalString(
1814
- workspaceTemplateSource,
1815
- env,
1816
- `${target.name} claude workspace template`,
1817
- {
1818
- allowLiteral: true,
1819
- optionalEnv: true
1820
- }
1821
- );
1822
- if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
1823
- workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
1824
- }
1825
- if (cwd && workspaceTemplate) {
1826
- throw new Error(
1827
- `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`
1828
- );
1829
- }
1830
1710
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} claude timeout`);
1831
1711
  const logDir = resolveOptionalString(logDirSource, env, `${target.name} claude log directory`, {
1832
1712
  allowLiteral: true,
@@ -1837,10 +1717,10 @@ function resolveClaudeConfig(target, env, evalFilePath) {
1837
1717
  const maxTurns = typeof target.max_turns === "number" ? target.max_turns : void 0;
1838
1718
  const maxBudgetUsd = typeof target.max_budget_usd === "number" ? target.max_budget_usd : void 0;
1839
1719
  return {
1720
+ executable,
1840
1721
  model,
1841
1722
  systemPrompt,
1842
1723
  cwd,
1843
- workspaceTemplate,
1844
1724
  timeoutMs,
1845
1725
  maxTurns,
1846
1726
  maxBudgetUsd,
@@ -1849,6 +1729,28 @@ function resolveClaudeConfig(target, env, evalFilePath) {
1849
1729
  streamLog: streamLogResult.streamLog
1850
1730
  };
1851
1731
  }
1732
+ function resolveCcMirrorBinaryPath(variant) {
1733
+ const variantJsonPath = path2.join(homedir(), ".cc-mirror", variant, "variant.json");
1734
+ if (!existsSync(variantJsonPath)) {
1735
+ throw new Error(
1736
+ `cc-mirror variant "${variant}": ${variantJsonPath} not found. Install the variant or set "executable" explicitly.`
1737
+ );
1738
+ }
1739
+ let parsed;
1740
+ try {
1741
+ parsed = JSON.parse(readFileSync(variantJsonPath, "utf8"));
1742
+ } catch (e) {
1743
+ throw new Error(
1744
+ `cc-mirror variant "${variant}": failed to parse ${variantJsonPath}: ${e.message}`
1745
+ );
1746
+ }
1747
+ if (typeof parsed.binaryPath !== "string" || parsed.binaryPath.trim().length === 0) {
1748
+ throw new Error(
1749
+ `cc-mirror variant "${variant}": ${variantJsonPath} missing "binaryPath" field`
1750
+ );
1751
+ }
1752
+ return parsed.binaryPath;
1753
+ }
1852
1754
  function normalizeClaudeLogFormat(value) {
1853
1755
  if (value === void 0 || value === null) {
1854
1756
  return void 0;
@@ -1866,20 +1768,7 @@ function resolveMockConfig(target) {
1866
1768
  const response = typeof target.response === "string" ? target.response : void 0;
1867
1769
  return { response };
1868
1770
  }
1869
- function resolveVSCodeConfig(target, env, insiders, evalFilePath) {
1870
- const workspaceTemplateEnvVar = resolveOptionalLiteralString(target.workspace_template);
1871
- let workspaceTemplate = workspaceTemplateEnvVar ? resolveOptionalString(
1872
- workspaceTemplateEnvVar,
1873
- env,
1874
- `${target.name} workspace template path`,
1875
- {
1876
- allowLiteral: true,
1877
- optionalEnv: true
1878
- }
1879
- ) : void 0;
1880
- if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
1881
- workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
1882
- }
1771
+ function resolveVSCodeConfig(target, env, insiders, _evalFilePath) {
1883
1772
  const executableSource = target.executable;
1884
1773
  const waitSource = target.wait;
1885
1774
  const dryRunSource = target.dry_run;
@@ -1899,7 +1788,6 @@ function resolveVSCodeConfig(target, env, insiders, evalFilePath) {
1899
1788
  allowLiteral: true,
1900
1789
  optionalEnv: true
1901
1790
  }),
1902
- workspaceTemplate,
1903
1791
  timeoutMs
1904
1792
  };
1905
1793
  }
@@ -2223,6 +2111,8 @@ var PROVIDER_ALIASES = [
2223
2111
  // alias for "pi-coding-agent"
2224
2112
  "claude-code",
2225
2113
  // alias for "claude" (legacy)
2114
+ "cc-mirror",
2115
+ // alias for "claude-cli" (auto-discovers binary from ~/.cc-mirror/<variant>/)
2226
2116
  "bedrock",
2227
2117
  // legacy/future support
2228
2118
  "vertex"
@@ -2406,7 +2296,7 @@ import micromatch from "micromatch";
2406
2296
  import { parse as parseYaml2 } from "yaml";
2407
2297
  import { readFile as readFile6 } from "node:fs/promises";
2408
2298
  import path6 from "node:path";
2409
- import { readFileSync } from "node:fs";
2299
+ import { readFileSync as readFileSync2 } from "node:fs";
2410
2300
  import path9 from "node:path";
2411
2301
  import { parse as parse4 } from "yaml";
2412
2302
  import { createOpenAI } from "@ai-sdk/openai";
@@ -14543,24 +14433,24 @@ import { readFile as readFile9, readdir, stat } from "node:fs/promises";
14543
14433
  import path15 from "node:path";
14544
14434
  import { promisify as promisify2 } from "node:util";
14545
14435
  import { randomUUID as randomUUID4 } from "node:crypto";
14546
- import { createWriteStream as createWriteStream4, existsSync, readdirSync as readdirSync2 } from "node:fs";
14547
- import { arch, homedir, platform } from "node:os";
14436
+ import { createWriteStream as createWriteStream4, existsSync as existsSync2, readdirSync as readdirSync2 } from "node:fs";
14437
+ import { arch, homedir as homedir3, platform } from "node:os";
14548
14438
  import path16 from "node:path";
14549
14439
  import { fileURLToPath as fileURLToPath3 } from "node:url";
14550
14440
  import { readFile as readFile11 } from "node:fs/promises";
14551
14441
  import { homedir as homedir4 } from "node:os";
14552
14442
  import path19 from "node:path";
14553
14443
  import { readFile as readFile10, readdir as readdir2, stat as stat2 } from "node:fs/promises";
14554
- import { homedir as homedir3 } from "node:os";
14444
+ import { homedir as homedir32 } from "node:os";
14555
14445
  import path18 from "node:path";
14556
14446
  import { parse as parseYaml22 } from "yaml";
14557
14447
  import { randomUUID as randomUUID6 } from "node:crypto";
14558
- import { existsSync as existsSync2 } from "node:fs";
14448
+ import { existsSync as existsSync22 } from "node:fs";
14559
14449
  import { mkdir as mkdir5 } from "node:fs/promises";
14560
14450
  import path20 from "node:path";
14561
14451
  import { execSync, spawn as spawn3 } from "node:child_process";
14562
14452
  import { randomUUID as randomUUID7 } from "node:crypto";
14563
- import { accessSync, createWriteStream as createWriteStream5, readFileSync as readFileSync2 } from "node:fs";
14453
+ import { accessSync, createWriteStream as createWriteStream5, readFileSync as readFileSync22 } from "node:fs";
14564
14454
  import { mkdir as mkdir6, mkdtemp, rm, writeFile } from "node:fs/promises";
14565
14455
  import { tmpdir } from "node:os";
14566
14456
  import path21 from "node:path";
@@ -14574,7 +14464,7 @@ import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
14574
14464
  import os2 from "node:os";
14575
14465
  import path222 from "node:path";
14576
14466
  import { exec as exec2 } from "node:child_process";
14577
- import { constants as constants3, access as access3, stat as stat6 } from "node:fs/promises";
14467
+ import { constants as constants3, access as access3 } from "node:fs/promises";
14578
14468
  import path34 from "node:path";
14579
14469
  import { promisify as promisify4 } from "node:util";
14580
14470
  import { stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
@@ -14613,7 +14503,7 @@ import path37 from "node:path";
14613
14503
  import { execFile as execFile3 } from "node:child_process";
14614
14504
  import { createHash as createHash2, randomUUID as randomUUID9 } from "node:crypto";
14615
14505
  import { existsSync as existsSync5 } from "node:fs";
14616
- import { copyFile as copyFile2, mkdir as mkdir14, readdir as readdir8, stat as stat9 } from "node:fs/promises";
14506
+ import { copyFile as copyFile2, mkdir as mkdir14, readdir as readdir8, stat as stat8 } from "node:fs/promises";
14617
14507
  import path45 from "node:path";
14618
14508
  import { promisify as promisify7 } from "node:util";
14619
14509
  import micromatch3 from "micromatch";
@@ -14622,7 +14512,7 @@ import path39 from "node:path";
14622
14512
  import fg22 from "fast-glob";
14623
14513
  import path40 from "node:path";
14624
14514
  import fg3 from "fast-glob";
14625
- import { cp, mkdir as mkdir12, readdir as readdir5, rm as rm4, stat as stat7 } from "node:fs/promises";
14515
+ import { cp, mkdir as mkdir12, readdir as readdir5, rm as rm4, stat as stat6 } from "node:fs/promises";
14626
14516
  import path41 from "node:path";
14627
14517
  import { execFile } from "node:child_process";
14628
14518
  import { createHash } from "node:crypto";
@@ -14634,7 +14524,7 @@ import { execFile as execFile2 } from "node:child_process";
14634
14524
  import { existsSync as existsSync4 } from "node:fs";
14635
14525
  import path43 from "node:path";
14636
14526
  import { promisify as promisify6 } from "node:util";
14637
- import { readdir as readdir7, stat as stat8 } from "node:fs/promises";
14527
+ import { readdir as readdir7, stat as stat7 } from "node:fs/promises";
14638
14528
  import path44 from "node:path";
14639
14529
  import { existsSync as existsSync6 } from "node:fs";
14640
14530
  import path46 from "node:path";
@@ -14645,17 +14535,25 @@ import { mkdir as mkdir15, readFile as readFile17, writeFile as writeFile8 } fro
14645
14535
  import path48 from "node:path";
14646
14536
  import { execFile as execFile4 } from "node:child_process";
14647
14537
  import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync, writeFileSync } from "node:fs";
14648
- import { cp as cp3, mkdtemp as mkdtemp3, readdir as readdir9, rm as rm6, stat as stat10 } from "node:fs/promises";
14538
+ import { cp as cp3, mkdtemp as mkdtemp3, readdir as readdir9, rm as rm6, stat as stat9 } from "node:fs/promises";
14649
14539
  import os3 from "node:os";
14650
14540
  import path49 from "node:path";
14651
14541
  import { promisify as promisify8 } from "node:util";
14652
- import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, readdirSync as readdirSync3, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
14542
+ import {
14543
+ copyFileSync,
14544
+ existsSync as existsSync8,
14545
+ mkdirSync as mkdirSync3,
14546
+ readFileSync as readFileSync4,
14547
+ readdirSync as readdirSync3,
14548
+ statSync as statSync2,
14549
+ writeFileSync as writeFileSync2
14550
+ } from "node:fs";
14653
14551
  import path50 from "node:path";
14654
14552
  import { parse as parseYaml3, stringify as stringifyYaml } from "yaml";
14655
- import { readdir as readdir10, stat as stat11 } from "node:fs/promises";
14553
+ import { readdir as readdir10, stat as stat10 } from "node:fs/promises";
14656
14554
  import { homedir as homedir5 } from "node:os";
14657
14555
  import path51 from "node:path";
14658
- import { readdir as readdir11, stat as stat12 } from "node:fs/promises";
14556
+ import { readdir as readdir11, stat as stat11 } from "node:fs/promises";
14659
14557
  import { homedir as homedir6 } from "node:os";
14660
14558
  import path52 from "node:path";
14661
14559
  import { readFile as readFile18 } from "node:fs/promises";
@@ -15076,17 +14974,76 @@ function extractTargetFromSuite(suite) {
15076
14974
  }
15077
14975
  return void 0;
15078
14976
  }
15079
- function extractTargetsFromSuite(suite) {
14977
+ function extractTargetRefsFromSuite(suite) {
15080
14978
  const execution = suite.execution;
15081
14979
  if (!execution || typeof execution !== "object" || Array.isArray(execution)) {
15082
14980
  return void 0;
15083
14981
  }
15084
14982
  const targets = execution.targets;
15085
- if (Array.isArray(targets)) {
15086
- const valid = targets.filter((t) => typeof t === "string" && t.trim().length > 0);
15087
- return valid.length > 0 ? valid.map((t) => t.trim()) : void 0;
14983
+ if (!Array.isArray(targets)) {
14984
+ return void 0;
15088
14985
  }
15089
- return void 0;
14986
+ const refs = [];
14987
+ for (const t of targets) {
14988
+ if (typeof t === "string" && t.trim().length > 0) {
14989
+ refs.push({ name: t.trim() });
14990
+ } else if (t && typeof t === "object" && !Array.isArray(t) && "name" in t) {
14991
+ const obj = t;
14992
+ const name21 = typeof obj.name === "string" ? obj.name.trim() : "";
14993
+ if (name21.length === 0) continue;
14994
+ const useTarget = typeof obj.use_target === "string" ? obj.use_target.trim() : void 0;
14995
+ const hooks = parseTargetHooks(obj.hooks);
14996
+ refs.push({
14997
+ name: name21,
14998
+ ...useTarget && { use_target: useTarget },
14999
+ ...hooks && { hooks }
15000
+ });
15001
+ }
15002
+ }
15003
+ return refs.length > 0 ? refs : void 0;
15004
+ }
15005
+ function extractTargetsFromSuite(suite) {
15006
+ const refs = extractTargetRefsFromSuite(suite);
15007
+ if (!refs) return void 0;
15008
+ const names = refs.map((r) => r.name);
15009
+ return names.length > 0 ? names : void 0;
15010
+ }
15011
+ function parseHookConfig(raw) {
15012
+ if (!raw || typeof raw !== "object") return void 0;
15013
+ const obj = raw;
15014
+ let command;
15015
+ if (typeof obj.command === "string") {
15016
+ command = ["sh", "-c", obj.command];
15017
+ } else if (Array.isArray(obj.command)) {
15018
+ command = obj.command.filter((s) => typeof s === "string");
15019
+ } else if (typeof obj.script === "string") {
15020
+ command = ["sh", "-c", obj.script];
15021
+ } else if (Array.isArray(obj.script)) {
15022
+ command = obj.script.filter((s) => typeof s === "string");
15023
+ }
15024
+ if (!command || command.length === 0) return void 0;
15025
+ const timeoutMs = typeof obj.timeout_ms === "number" ? obj.timeout_ms : typeof obj.timeoutMs === "number" ? obj.timeoutMs : void 0;
15026
+ const cwd = typeof obj.cwd === "string" ? obj.cwd : void 0;
15027
+ return {
15028
+ command,
15029
+ ...timeoutMs !== void 0 && { timeout_ms: timeoutMs },
15030
+ ...cwd && { cwd }
15031
+ };
15032
+ }
15033
+ function parseTargetHooks(raw) {
15034
+ if (!raw || typeof raw !== "object") return void 0;
15035
+ const obj = raw;
15036
+ const beforeAll = parseHookConfig(obj.before_all);
15037
+ const beforeEach = parseHookConfig(obj.before_each);
15038
+ const afterEach = parseHookConfig(obj.after_each);
15039
+ const afterAll = parseHookConfig(obj.after_all);
15040
+ if (!beforeAll && !beforeEach && !afterEach && !afterAll) return void 0;
15041
+ return {
15042
+ ...beforeAll && { before_all: beforeAll },
15043
+ ...beforeEach && { before_each: beforeEach },
15044
+ ...afterEach && { after_each: afterEach },
15045
+ ...afterAll && { after_all: afterAll }
15046
+ };
15090
15047
  }
15091
15048
  function extractWorkersFromSuite(suite) {
15092
15049
  const execution = suite.execution;
@@ -15734,7 +15691,11 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId, defa
15734
15691
  }
15735
15692
  const placeholderIndex = result.indexOf(PLACEHOLDER);
15736
15693
  if (strings.length > 0 && placeholderIndex !== -1) {
15737
- result[placeholderIndex] = { type: "rubrics", criteria: strings };
15694
+ result[placeholderIndex] = {
15695
+ type: "rubrics",
15696
+ criteria: strings,
15697
+ weight: strings.length
15698
+ };
15738
15699
  } else if (placeholderIndex !== -1) {
15739
15700
  result.splice(placeholderIndex, 1);
15740
15701
  }
@@ -18102,6 +18063,7 @@ async function readTestSuiteMetadata(testFilePath) {
18102
18063
  return {
18103
18064
  target: extractTargetFromSuite(parsed),
18104
18065
  targets: extractTargetsFromSuite(parsed),
18066
+ targetRefs: extractTargetRefsFromSuite(parsed),
18105
18067
  trials: extractTrialsConfig(parsed)
18106
18068
  };
18107
18069
  } catch {
@@ -18128,6 +18090,7 @@ async function loadTestSuite(evalFilePath, repoRoot, options) {
18128
18090
  tests,
18129
18091
  trials: extractTrialsConfig(parsed),
18130
18092
  targets: extractTargetsFromSuite(parsed),
18093
+ targetRefs: extractTargetRefsFromSuite(parsed),
18131
18094
  workers: extractWorkersFromSuite(parsed),
18132
18095
  cacheConfig: extractCacheConfig(parsed),
18133
18096
  totalBudgetUsd: extractTotalBudgetUsd(parsed),
@@ -18797,7 +18760,7 @@ function transpileEvalYaml(suite, source = "EVAL.yaml") {
18797
18760
  return { files, warnings };
18798
18761
  }
18799
18762
  function transpileEvalYamlFile(evalYamlPath) {
18800
- const content = readFileSync(evalYamlPath, "utf8");
18763
+ const content = readFileSync2(evalYamlPath, "utf8");
18801
18764
  const parsed = parse4(content);
18802
18765
  return transpileEvalYaml(parsed, path9.basename(evalYamlPath));
18803
18766
  }
@@ -19724,7 +19687,7 @@ var ClaudeCliProvider = class {
19724
19687
  if (options.cwd) {
19725
19688
  spawnOptions.cwd = options.cwd;
19726
19689
  }
19727
- const child = spawn("claude", options.args, spawnOptions);
19690
+ const child = spawn(this.config.executable, options.args, spawnOptions);
19728
19691
  let stdout = "";
19729
19692
  let stderr = "";
19730
19693
  let timedOut = false;
@@ -19783,7 +19746,7 @@ var ClaudeCliProvider = class {
19783
19746
  if (err.code === "ENOENT") {
19784
19747
  reject(
19785
19748
  new Error(
19786
- `Claude CLI executable 'claude' was not found on PATH. Install claude-code or ensure it is in PATH.`
19749
+ `Claude CLI executable '${this.config.executable}' was not found on PATH. Install claude-code or ensure it is in PATH.`
19787
19750
  )
19788
19751
  );
19789
19752
  } else {
@@ -21496,7 +21459,7 @@ function resolvePlatformCliPath() {
21496
21459
  const resolved = import.meta.resolve(`${packageName}/package.json`);
21497
21460
  const packageJsonPath = resolved.startsWith("file:") ? fileURLToPath3(resolved) : resolved;
21498
21461
  const binaryPath = path16.join(path16.dirname(packageJsonPath), binaryName);
21499
- if (existsSync(binaryPath)) {
21462
+ if (existsSync2(binaryPath)) {
21500
21463
  return binaryPath;
21501
21464
  }
21502
21465
  } catch {
@@ -21509,7 +21472,7 @@ function resolvePlatformCliPath() {
21509
21472
  ...packageName.split("/"),
21510
21473
  binaryName
21511
21474
  );
21512
- if (existsSync(standardPath)) {
21475
+ if (existsSync2(standardPath)) {
21513
21476
  return standardPath;
21514
21477
  }
21515
21478
  const bunDir = path16.join(searchDir, "node_modules", ".bun");
@@ -21526,7 +21489,7 @@ function resolvePlatformCliPath() {
21526
21489
  `copilot-${osPart}-${archPart}`,
21527
21490
  binaryName
21528
21491
  );
21529
- if (existsSync(candidate)) {
21492
+ if (existsSync2(candidate)) {
21530
21493
  return candidate;
21531
21494
  }
21532
21495
  }
@@ -21539,7 +21502,7 @@ function resolvePlatformCliPath() {
21539
21502
  }
21540
21503
  for (const root of globalNpmRoots()) {
21541
21504
  const hoisted = path16.join(root, "@github", `copilot-${osPart}-${archPart}`, binaryName);
21542
- if (existsSync(hoisted)) {
21505
+ if (existsSync2(hoisted)) {
21543
21506
  return hoisted;
21544
21507
  }
21545
21508
  const nested = path16.join(
@@ -21551,7 +21514,7 @@ function resolvePlatformCliPath() {
21551
21514
  `copilot-${osPart}-${archPart}`,
21552
21515
  binaryName
21553
21516
  );
21554
- if (existsSync(nested)) {
21517
+ if (existsSync2(nested)) {
21555
21518
  return nested;
21556
21519
  }
21557
21520
  }
@@ -21560,7 +21523,7 @@ function resolvePlatformCliPath() {
21560
21523
  function globalNpmRoots() {
21561
21524
  const roots = [];
21562
21525
  const os4 = platform();
21563
- const home = homedir();
21526
+ const home = homedir3();
21564
21527
  if (os4 === "win32") {
21565
21528
  if (process.env.APPDATA) {
21566
21529
  roots.push(path16.join(process.env.APPDATA, "npm", "node_modules"));
@@ -22229,7 +22192,7 @@ function parseCopilotEvents(eventsJsonl) {
22229
22192
  durationMs
22230
22193
  };
22231
22194
  }
22232
- var DEFAULT_SESSION_STATE_DIR = () => path18.join(homedir3(), ".copilot", "session-state");
22195
+ var DEFAULT_SESSION_STATE_DIR = () => path18.join(homedir32(), ".copilot", "session-state");
22233
22196
  async function discoverCopilotSessions(opts) {
22234
22197
  const sessionStateDir = opts?.sessionStateDir ?? DEFAULT_SESSION_STATE_DIR();
22235
22198
  const limit = opts?.limit ?? 10;
@@ -22722,7 +22685,7 @@ function resolveSkillDirectories(cwd) {
22722
22685
  path20.join(cwd, ".agents", "skills"),
22723
22686
  path20.join(cwd, ".codex", "skills")
22724
22687
  ];
22725
- return candidates.filter((dir) => existsSync2(dir));
22688
+ return candidates.filter((dir) => existsSync22(dir));
22726
22689
  }
22727
22690
  function normalizeByokBaseUrl(baseUrl, type) {
22728
22691
  const trimmed = baseUrl.trim().replace(/\/+$/, "");
@@ -23670,7 +23633,7 @@ function resolveWindowsCmd(executable) {
23670
23633
  }
23671
23634
  const cmdPath = fullPath.endsWith(".cmd") ? fullPath : `${fullPath}.cmd`;
23672
23635
  try {
23673
- const content = readFileSync2(cmdPath, "utf-8");
23636
+ const content = readFileSync22(cmdPath, "utf-8");
23674
23637
  const match = content.match(/"?%_prog%"?\s+"([^"]+\.js)"/);
23675
23638
  if (match) {
23676
23639
  const dp0 = path21.dirname(path21.resolve(cmdPath));
@@ -23748,6 +23711,9 @@ async function defaultPiRunner(options) {
23748
23711
  });
23749
23712
  }
23750
23713
  var logged = false;
23714
+ function getAgentvConfigDir() {
23715
+ return path222.join(os2.homedir(), ".agentv");
23716
+ }
23751
23717
  function getAgentvHome() {
23752
23718
  const envHome = process.env.AGENTV_HOME;
23753
23719
  if (envHome && envHome !== "undefined") {
@@ -25490,7 +25456,7 @@ var VSCodeProvider = class {
25490
25456
  await this.ensureEnvironmentReady();
25491
25457
  const inputFiles = normalizeAttachments(request.inputFiles);
25492
25458
  const promptContent = buildPromptDocument2(request, inputFiles);
25493
- const workspaceTemplate = request.workspaceFile ?? await resolveWorkspaceTemplateFile(this.config.workspaceTemplate);
25459
+ const workspaceTemplate = request.workspaceFile;
25494
25460
  const startTime = Date.now();
25495
25461
  const session = await dispatchAgentSession({
25496
25462
  userQuery: promptContent,
@@ -25546,9 +25512,6 @@ var VSCodeProvider = class {
25546
25512
  const userQueries = normalizedRequests.map(
25547
25513
  ({ request, inputFiles }) => buildPromptDocument2(request, inputFiles)
25548
25514
  );
25549
- const batchWorkspaceTemplate = await resolveWorkspaceTemplateFile(
25550
- this.config.workspaceTemplate
25551
- );
25552
25515
  const startTime = Date.now();
25553
25516
  const session = await dispatchBatchAgent({
25554
25517
  userQueries,
@@ -25558,7 +25521,7 @@ var VSCodeProvider = class {
25558
25521
  dryRun: this.config.dryRun,
25559
25522
  vscodeCmd: this.config.executable,
25560
25523
  subagentRoot: this.config.subagentRoot,
25561
- workspaceTemplate: batchWorkspaceTemplate,
25524
+ workspaceTemplate: void 0,
25562
25525
  silent: true,
25563
25526
  timeoutMs: this.config.timeoutMs
25564
25527
  });
@@ -25638,17 +25601,6 @@ async function locateVSCodeExecutable(candidate) {
25638
25601
  `VS Code executable '${candidate}' was not found on PATH. Check the 'executable' setting in your target configuration.`
25639
25602
  );
25640
25603
  }
25641
- async function resolveWorkspaceTemplateFile(template) {
25642
- if (!template) {
25643
- return void 0;
25644
- }
25645
- try {
25646
- const stats = await stat6(path34.resolve(template));
25647
- return stats.isFile() ? template : void 0;
25648
- } catch {
25649
- return template;
25650
- }
25651
- }
25652
25604
  function buildPromptDocument2(request, attachments) {
25653
25605
  const parts = [];
25654
25606
  if (request.systemPrompt && request.systemPrompt.trim().length > 0) {
@@ -26808,7 +26760,7 @@ ${context2.fileChanges}`;
26808
26760
  const workspacePath = context2.workspacePath;
26809
26761
  if (!workspacePath) {
26810
26762
  throw new Error(
26811
- "llm-grader built-in agent mode requires a workspace_template target (workspacePath is not set)"
26763
+ "llm-grader built-in agent mode requires a workspace (workspacePath is not set)"
26812
26764
  );
26813
26765
  }
26814
26766
  const systemPrompt = this.buildAgentSystemPrompt(context2);
@@ -27547,11 +27499,11 @@ function createFilesystemTools(workspacePath) {
27547
27499
  execute: async (input) => {
27548
27500
  try {
27549
27501
  const resolved = resolveSandboxed(workspacePath, input.path);
27550
- const stat13 = await fs2.stat(resolved);
27551
- if (stat13.isDirectory()) {
27502
+ const stat12 = await fs2.stat(resolved);
27503
+ if (stat12.isDirectory()) {
27552
27504
  return { error: `'${input.path}' is a directory, not a file` };
27553
27505
  }
27554
- const buffer = Buffer.alloc(Math.min(stat13.size, MAX_FILE_SIZE));
27506
+ const buffer = Buffer.alloc(Math.min(stat12.size, MAX_FILE_SIZE));
27555
27507
  const fd = await fs2.open(resolved, "r");
27556
27508
  try {
27557
27509
  await fd.read(buffer, 0, buffer.length, 0);
@@ -27559,8 +27511,8 @@ function createFilesystemTools(workspacePath) {
27559
27511
  await fd.close();
27560
27512
  }
27561
27513
  const content = buffer.toString("utf-8");
27562
- const truncated = stat13.size > MAX_FILE_SIZE;
27563
- return { content, truncated, size: stat13.size };
27514
+ const truncated = stat12.size > MAX_FILE_SIZE;
27515
+ return { content, truncated, size: stat12.size };
27564
27516
  } catch (error) {
27565
27517
  return { error: error instanceof Error ? error.message : String(error) };
27566
27518
  }
@@ -27611,8 +27563,8 @@ async function searchDirectory(dirPath, workspacePath, regex, matches) {
27611
27563
  const ext = path37.extname(entry.name).toLowerCase();
27612
27564
  if (BINARY_EXTENSIONS.has(ext)) continue;
27613
27565
  try {
27614
- const stat13 = await fs2.stat(fullPath);
27615
- if (stat13.size > MAX_FILE_SIZE) continue;
27566
+ const stat12 = await fs2.stat(fullPath);
27567
+ if (stat12.size > MAX_FILE_SIZE) continue;
27616
27568
  const content = await fs2.readFile(fullPath, "utf-8");
27617
27569
  const lines = content.split("\n");
27618
27570
  for (let i = 0; i < lines.length; i++) {
@@ -30251,7 +30203,7 @@ var WorkspaceCreationError = class extends Error {
30251
30203
  };
30252
30204
  async function isDirectory(filePath) {
30253
30205
  try {
30254
- const stats = await stat7(filePath);
30206
+ const stats = await stat6(filePath);
30255
30207
  return stats.isDirectory();
30256
30208
  } catch {
30257
30209
  return false;
@@ -30816,7 +30768,7 @@ async function resolveWorkspaceTemplate(templatePath) {
30816
30768
  return void 0;
30817
30769
  }
30818
30770
  const resolved = path44.resolve(templatePath);
30819
- const stats = await stat8(resolved);
30771
+ const stats = await stat7(resolved);
30820
30772
  if (stats.isFile()) {
30821
30773
  return {
30822
30774
  dir: path44.dirname(resolved),
@@ -30952,13 +30904,6 @@ async function resetWorkspaceRoot(workspacePath, resetMode, baselineRef) {
30952
30904
  await execFileAsync3("git", ["clean", cleanFlag], opts);
30953
30905
  return true;
30954
30906
  }
30955
- function getWorkspaceTemplate(target) {
30956
- const config = target.config;
30957
- if ("workspaceTemplate" in config && typeof config.workspaceTemplate === "string") {
30958
- return config.workspaceTemplate;
30959
- }
30960
- return void 0;
30961
- }
30962
30907
  function validateDependencyGraph(tests) {
30963
30908
  const ids = /* @__PURE__ */ new Set();
30964
30909
  for (const test of tests) {
@@ -31232,7 +31177,7 @@ async function runEvaluation(options) {
31232
31177
  }
31233
31178
  }
31234
31179
  const suiteWorkspace = filteredEvalCases[0]?.workspace;
31235
- const rawTemplate = suiteWorkspace?.template ?? getWorkspaceTemplate(target);
31180
+ const rawTemplate = suiteWorkspace?.template;
31236
31181
  const resolvedTemplate = await resolveWorkspaceTemplate(rawTemplate);
31237
31182
  const workspaceTemplate = resolvedTemplate?.dir;
31238
31183
  let suiteWorkspaceFile = resolvedTemplate?.workspaceFile;
@@ -31325,7 +31270,7 @@ async function runEvaluation(options) {
31325
31270
  let staticMaterialised = false;
31326
31271
  const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
31327
31272
  if (useStaticWorkspace && configuredStaticPath) {
31328
- const dirExists = await stat9(configuredStaticPath).then(
31273
+ const dirExists = await stat8(configuredStaticPath).then(
31329
31274
  (s) => s.isDirectory(),
31330
31275
  () => false
31331
31276
  );
@@ -31415,7 +31360,7 @@ async function runEvaluation(options) {
31415
31360
  if (suiteWorkspaceFile && sharedWorkspacePath) {
31416
31361
  const copiedWorkspaceFile = path45.join(sharedWorkspacePath, path45.basename(suiteWorkspaceFile));
31417
31362
  try {
31418
- await stat9(copiedWorkspaceFile);
31363
+ await stat8(copiedWorkspaceFile);
31419
31364
  suiteWorkspaceFile = copiedWorkspaceFile;
31420
31365
  } catch {
31421
31366
  }
@@ -31520,6 +31465,54 @@ async function runEvaluation(options) {
31520
31465
  }
31521
31466
  }
31522
31467
  }
31468
+ const targetHooks = options.targetHooks;
31469
+ const targetBeforeAllHook = targetHooks?.before_all;
31470
+ if (sharedWorkspacePath && hasHookCommand(targetBeforeAllHook)) {
31471
+ const beforeAllCommand = (targetBeforeAllHook.command ?? []).join(" ");
31472
+ setupLog(`running target before_all command=${beforeAllCommand}`);
31473
+ const scriptContext = {
31474
+ workspacePath: sharedWorkspacePath,
31475
+ testId: "__target_before_all__",
31476
+ evalRunId,
31477
+ evalDir,
31478
+ workspaceFileDir: suiteWorkspace?.workspaceFileDir
31479
+ };
31480
+ try {
31481
+ await executeWorkspaceScript(
31482
+ toScriptConfig(targetBeforeAllHook, "before_all", "target hooks"),
31483
+ scriptContext
31484
+ );
31485
+ setupLog("target before_all completed");
31486
+ } catch (error) {
31487
+ const message = error instanceof Error ? error.message : String(error);
31488
+ if (sharedWorkspacePath && !useStaticWorkspace) {
31489
+ await cleanupWorkspace(sharedWorkspacePath).catch(() => {
31490
+ });
31491
+ }
31492
+ throw new Error(`target before_all hook failed: ${message}`);
31493
+ }
31494
+ }
31495
+ if (availablePoolSlots.length > 0 && hasHookCommand(targetBeforeAllHook)) {
31496
+ for (const slot of availablePoolSlots) {
31497
+ setupLog(`running target before_all on pool slot ${slot.index}`);
31498
+ const scriptContext = {
31499
+ workspacePath: slot.path,
31500
+ testId: "__target_before_all__",
31501
+ evalRunId,
31502
+ evalDir,
31503
+ workspaceFileDir: suiteWorkspace?.workspaceFileDir
31504
+ };
31505
+ try {
31506
+ await executeWorkspaceScript(
31507
+ toScriptConfig(targetBeforeAllHook, "before_all", "target hooks"),
31508
+ scriptContext
31509
+ );
31510
+ } catch (error) {
31511
+ const message = error instanceof Error ? error.message : String(error);
31512
+ throw new Error(`target before_all hook failed on pool slot ${slot.index}: ${message}`);
31513
+ }
31514
+ }
31515
+ }
31523
31516
  if (sharedWorkspacePath) {
31524
31517
  try {
31525
31518
  sharedBaselineCommit = await initializeBaseline(sharedWorkspacePath);
@@ -31665,6 +31658,7 @@ async function runEvaluation(options) {
31665
31658
  evalDir,
31666
31659
  verbose,
31667
31660
  threshold: scoreThreshold,
31661
+ targetHooks: options.targetHooks,
31668
31662
  ...depResults && Object.keys(depResults).length > 0 ? { dependencyResults: depResults } : {}
31669
31663
  };
31670
31664
  let result = trials && trials.count > 1 ? await runEvalCaseWithTrials(runCaseOptions, trials) : await runEvalCase(runCaseOptions);
@@ -31806,6 +31800,26 @@ async function runEvaluation(options) {
31806
31800
  }
31807
31801
  }
31808
31802
  const afterAllWorkspaces = poolSlots.length > 1 ? poolSlots.map((s) => s.path) : sharedWorkspacePath ? [sharedWorkspacePath] : [];
31803
+ const targetAfterAllHook = targetHooks?.after_all;
31804
+ if (afterAllWorkspaces.length > 0 && hasHookCommand(targetAfterAllHook)) {
31805
+ for (const wsPath of afterAllWorkspaces) {
31806
+ const scriptContext = {
31807
+ workspacePath: wsPath,
31808
+ testId: "__target_after_all__",
31809
+ evalRunId,
31810
+ evalDir,
31811
+ workspaceFileDir: suiteWorkspace?.workspaceFileDir
31812
+ };
31813
+ try {
31814
+ await executeWorkspaceScript(
31815
+ toScriptConfig(targetAfterAllHook, "after_all", "target hooks"),
31816
+ scriptContext,
31817
+ "warn"
31818
+ );
31819
+ } catch {
31820
+ }
31821
+ }
31822
+ }
31809
31823
  const suiteAfterAllHook = suiteWorkspace?.hooks?.after_all;
31810
31824
  if (afterAllWorkspaces.length > 0 && suiteHooksEnabled && hasHookCommand(suiteAfterAllHook)) {
31811
31825
  const afterAllHook = suiteAfterAllHook;
@@ -32068,7 +32082,7 @@ async function runEvalCase(options) {
32068
32082
  let caseWorkspaceFile;
32069
32083
  const caseHooksEnabled = hooksEnabled(evalCase.workspace);
32070
32084
  if (!workspacePath) {
32071
- const rawCaseTemplate = evalCase.workspace?.template ?? getWorkspaceTemplate(target);
32085
+ const rawCaseTemplate = evalCase.workspace?.template;
32072
32086
  const resolvedCaseTemplate = await resolveWorkspaceTemplate(rawCaseTemplate);
32073
32087
  const caseWorkspaceTemplate = resolvedCaseTemplate?.dir;
32074
32088
  caseWorkspaceFile = resolvedCaseTemplate?.workspaceFile;
@@ -32092,7 +32106,7 @@ async function runEvalCase(options) {
32092
32106
  if (caseWorkspaceFile && workspacePath) {
32093
32107
  const copiedFile = path45.join(workspacePath, path45.basename(caseWorkspaceFile));
32094
32108
  try {
32095
- await stat9(copiedFile);
32109
+ await stat8(copiedFile);
32096
32110
  caseWorkspaceFile = copiedFile;
32097
32111
  } catch {
32098
32112
  }
@@ -32286,6 +32300,38 @@ async function runEvalCase(options) {
32286
32300
  );
32287
32301
  }
32288
32302
  }
32303
+ const targetBeforeEachHook = options.targetHooks?.before_each;
32304
+ if (workspacePath && hasHookCommand(targetBeforeEachHook)) {
32305
+ const scriptContext = {
32306
+ workspacePath,
32307
+ testId: evalCase.id,
32308
+ evalRunId: evalRunId ?? "",
32309
+ caseInput: evalCase.question,
32310
+ caseMetadata: evalCase.metadata,
32311
+ evalDir,
32312
+ workspaceFileDir: evalCase.workspace?.workspaceFileDir
32313
+ };
32314
+ try {
32315
+ await executeWorkspaceScript(
32316
+ toScriptConfig(targetBeforeEachHook, "before_each", `target hook for '${evalCase.id}'`),
32317
+ scriptContext
32318
+ );
32319
+ beforeEachNeedsFreshBaseline = true;
32320
+ } catch (error) {
32321
+ const message = error instanceof Error ? error.message : String(error);
32322
+ return buildErrorResult(
32323
+ evalCase,
32324
+ target.name,
32325
+ nowFn(),
32326
+ new Error(`target before_each hook failed: ${message}`),
32327
+ promptInputs,
32328
+ provider,
32329
+ "setup",
32330
+ "script_error",
32331
+ verbose
32332
+ );
32333
+ }
32334
+ }
32289
32335
  let baselineCommit = beforeEachNeedsFreshBaseline ? void 0 : sharedBaselineCommit;
32290
32336
  if (!baselineCommit && workspacePath) {
32291
32337
  try {
@@ -32440,6 +32486,26 @@ async function runEvalCase(options) {
32440
32486
  ${providerFileChanges}` : providerFileChanges;
32441
32487
  }
32442
32488
  const providerError = extractProviderError(providerResponse);
32489
+ const targetAfterEachHook = options.targetHooks?.after_each;
32490
+ if (workspacePath && hasHookCommand(targetAfterEachHook)) {
32491
+ const scriptContext = {
32492
+ workspacePath,
32493
+ testId: evalCase.id,
32494
+ evalRunId: evalRunId ?? "",
32495
+ caseInput: evalCase.question,
32496
+ caseMetadata: evalCase.metadata,
32497
+ evalDir,
32498
+ workspaceFileDir: evalCase.workspace?.workspaceFileDir
32499
+ };
32500
+ try {
32501
+ await executeWorkspaceScript(
32502
+ toScriptConfig(targetAfterEachHook, "after_each", `target hook for '${evalCase.id}'`),
32503
+ scriptContext,
32504
+ "warn"
32505
+ );
32506
+ } catch {
32507
+ }
32508
+ }
32443
32509
  if (caseHooksEnabled && workspacePath && evalCase.workspace?.hooks?.after_each?.reset && evalCase.workspace.hooks.after_each.reset !== "none") {
32444
32510
  try {
32445
32511
  if (repoManager && evalCase.workspace.repos?.length) {
@@ -34252,7 +34318,7 @@ function resolveResultsRepoRunsDir(config) {
34252
34318
  );
34253
34319
  }
34254
34320
  async function directorySizeBytes(targetPath) {
34255
- const entry = await stat10(targetPath);
34321
+ const entry = await stat9(targetPath);
34256
34322
  if (entry.isFile()) {
34257
34323
  return entry.size;
34258
34324
  }
@@ -34307,10 +34373,22 @@ async function createDraftResultsPr(params) {
34307
34373
  return stdout.trim();
34308
34374
  }
34309
34375
  function getBenchmarksRegistryPath() {
34310
- return path50.join(getAgentvHome(), "projects.yaml");
34376
+ return path50.join(getAgentvConfigDir(), "projects.yaml");
34377
+ }
34378
+ function migrateProjectsYaml(targetPath) {
34379
+ const dataHome = getAgentvHome();
34380
+ const configDir = getAgentvConfigDir();
34381
+ if (dataHome === configDir) return;
34382
+ const legacyPath = path50.join(dataHome, "projects.yaml");
34383
+ if (!existsSync8(legacyPath)) return;
34384
+ mkdirSync3(path50.dirname(targetPath), { recursive: true });
34385
+ copyFileSync(legacyPath, targetPath);
34311
34386
  }
34312
34387
  function loadBenchmarkRegistry() {
34313
34388
  const registryPath = getBenchmarksRegistryPath();
34389
+ if (!existsSync8(registryPath)) {
34390
+ migrateProjectsYaml(registryPath);
34391
+ }
34314
34392
  if (!existsSync8(registryPath)) {
34315
34393
  return { benchmarks: [] };
34316
34394
  }
@@ -35364,7 +35442,7 @@ async function discoverCodexSessions(opts) {
35364
35442
  const sessionId = parts.length >= 6 ? parts.slice(-5).join("-") : nameWithoutExt;
35365
35443
  let updatedAt;
35366
35444
  try {
35367
- const fileStat = await stat11(filePath);
35445
+ const fileStat = await stat10(filePath);
35368
35446
  updatedAt = fileStat.mtime;
35369
35447
  } catch {
35370
35448
  updatedAt = /* @__PURE__ */ new Date(0);
@@ -35410,7 +35488,7 @@ async function discoverClaudeSessions(opts) {
35410
35488
  const filePath = path52.join(dirPath, entry);
35411
35489
  let updatedAt;
35412
35490
  try {
35413
- const fileStat = await stat12(filePath);
35491
+ const fileStat = await stat11(filePath);
35414
35492
  updatedAt = fileStat.mtime;
35415
35493
  } catch {
35416
35494
  updatedAt = /* @__PURE__ */ new Date(0);
@@ -35608,6 +35686,7 @@ export {
35608
35686
  DEFAULT_EVAL_PATTERNS,
35609
35687
  loadConfig,
35610
35688
  extractTargetFromSuite,
35689
+ extractTargetRefsFromSuite,
35611
35690
  extractTargetsFromSuite,
35612
35691
  extractWorkersFromSuite,
35613
35692
  extractTargetsFromTestCase,
@@ -35641,6 +35720,7 @@ export {
35641
35720
  subscribeToCopilotSdkLogEntries,
35642
35721
  consumePiLogEntries,
35643
35722
  subscribeToPiLogEntries,
35723
+ getAgentvConfigDir,
35644
35724
  getAgentvHome,
35645
35725
  getWorkspacesRoot,
35646
35726
  getSubagentsRoot,
@@ -35765,4 +35845,4 @@ export {
35765
35845
  TranscriptProvider,
35766
35846
  createAgentKernel
35767
35847
  };
35768
- //# sourceMappingURL=chunk-3GULESPF.js.map
35848
+ //# sourceMappingURL=chunk-IRU2UOWN.js.map