@agentv/core 4.9.0 → 4.9.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.
package/dist/index.cjs CHANGED
@@ -17979,6 +17979,7 @@ function runEqualsAssertion(output, value) {
17979
17979
  // src/evaluation/orchestrator.ts
17980
17980
  init_cjs_shims();
17981
17981
  var import_node_crypto11 = require("crypto");
17982
+ var import_node_fs16 = require("fs");
17982
17983
  var import_promises33 = require("fs/promises");
17983
17984
  var import_node_path48 = __toESM(require("path"), 1);
17984
17985
  var import_micromatch3 = __toESM(require("micromatch"), 1);
@@ -19780,8 +19781,8 @@ async function runEvaluation(options) {
19780
19781
  const poolSlotBaselines = /* @__PURE__ */ new Map();
19781
19782
  const poolMaxSlots = Math.min(configPoolMaxSlots ?? 10, 50);
19782
19783
  let staticMaterialised = false;
19784
+ const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
19783
19785
  if (useStaticWorkspace && configuredStaticPath) {
19784
- const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
19785
19786
  const dirExists = await (0, import_promises33.stat)(configuredStaticPath).then(
19786
19787
  (s) => s.isDirectory(),
19787
19788
  () => false
@@ -19846,14 +19847,28 @@ async function runEvaluation(options) {
19846
19847
  } catch {
19847
19848
  }
19848
19849
  }
19849
- const needsRepoMaterialisation = !!suiteWorkspace?.repos?.length && !usePool && (!useStaticWorkspace || staticMaterialised);
19850
- const repoManager = needsRepoMaterialisation ? new RepoManager(verbose) : void 0;
19851
- if (repoManager && sharedWorkspacePath && suiteWorkspace?.repos && !isPerTestIsolation) {
19852
- setupLog(
19853
- `materializing ${suiteWorkspace.repos.length} shared repo(s) into ${sharedWorkspacePath}`
19854
- );
19850
+ const hasReposToMaterialize = !!suiteWorkspace?.repos?.length && !usePool && !isPerTestIsolation;
19851
+ const needsRepoMaterialisation = hasReposToMaterialize && (!useStaticWorkspace || staticMaterialised);
19852
+ const needsPerRepoCheck = hasReposToMaterialize && useStaticWorkspace && !staticMaterialised && isYamlConfiguredPath;
19853
+ const repoManager = needsRepoMaterialisation || needsPerRepoCheck ? new RepoManager(verbose) : void 0;
19854
+ if (repoManager && sharedWorkspacePath && suiteWorkspace?.repos) {
19855
19855
  try {
19856
- await repoManager.materializeAll(suiteWorkspace.repos, sharedWorkspacePath);
19856
+ if (needsPerRepoCheck) {
19857
+ for (const repo of suiteWorkspace.repos) {
19858
+ const targetDir = import_node_path48.default.join(sharedWorkspacePath, repo.path);
19859
+ if ((0, import_node_fs16.existsSync)(targetDir)) {
19860
+ setupLog(`reusing existing repo at: ${targetDir}`);
19861
+ continue;
19862
+ }
19863
+ setupLog(`materializing missing repo: ${repo.path}`);
19864
+ await repoManager.materialize(repo, sharedWorkspacePath);
19865
+ }
19866
+ } else {
19867
+ setupLog(
19868
+ `materializing ${suiteWorkspace.repos.length} shared repo(s) into ${sharedWorkspacePath}`
19869
+ );
19870
+ await repoManager.materializeAll(suiteWorkspace.repos, sharedWorkspacePath);
19871
+ }
19857
19872
  setupLog("shared repo materialization complete");
19858
19873
  } catch (error) {
19859
19874
  const message = error instanceof Error ? error.message : String(error);
@@ -21528,7 +21543,7 @@ function computeWeightedMean(entries) {
21528
21543
 
21529
21544
  // src/evaluation/evaluate.ts
21530
21545
  init_cjs_shims();
21531
- var import_node_fs16 = require("fs");
21546
+ var import_node_fs17 = require("fs");
21532
21547
  var import_node_path49 = __toESM(require("path"), 1);
21533
21548
 
21534
21549
  // src/evaluation/providers/function-provider.ts
@@ -21686,7 +21701,7 @@ async function discoverDefaultTarget(repoRoot) {
21686
21701
  for (const dir of chain) {
21687
21702
  for (const candidate of TARGET_FILE_CANDIDATES) {
21688
21703
  const targetsPath = import_node_path49.default.join(dir, candidate);
21689
- if (!(0, import_node_fs16.existsSync)(targetsPath)) continue;
21704
+ if (!(0, import_node_fs17.existsSync)(targetsPath)) continue;
21690
21705
  try {
21691
21706
  const definitions = await readTargetDefinitions(targetsPath);
21692
21707
  const defaultTarget = definitions.find((d) => d.name === "default");
@@ -21703,7 +21718,7 @@ async function loadEnvHierarchy(repoRoot, startPath) {
21703
21718
  const envFiles = [];
21704
21719
  for (const dir of chain) {
21705
21720
  const envPath = import_node_path49.default.join(dir, ".env");
21706
- if ((0, import_node_fs16.existsSync)(envPath)) envFiles.push(envPath);
21721
+ if ((0, import_node_fs17.existsSync)(envPath)) envFiles.push(envPath);
21707
21722
  }
21708
21723
  for (let i = 0; i < envFiles.length; i++) {
21709
21724
  try {
@@ -21780,12 +21795,12 @@ var CONFIG_FILE_NAMES = [
21780
21795
  ".agentv/config.js"
21781
21796
  ];
21782
21797
  async function loadTsConfig(projectRoot) {
21783
- const { existsSync: existsSync7 } = await import("fs");
21798
+ const { existsSync: existsSync8 } = await import("fs");
21784
21799
  const { pathToFileURL: pathToFileURL2 } = await import("url");
21785
21800
  const { join: join2 } = await import("path");
21786
21801
  for (const fileName of CONFIG_FILE_NAMES) {
21787
21802
  const filePath = join2(projectRoot, fileName);
21788
- if (!existsSync7(filePath)) {
21803
+ if (!existsSync8(filePath)) {
21789
21804
  continue;
21790
21805
  }
21791
21806
  try {
@@ -22030,7 +22045,7 @@ function shouldSkipCacheForTemperature(targetConfig) {
22030
22045
 
22031
22046
  // src/projects.ts
22032
22047
  init_cjs_shims();
22033
- var import_node_fs17 = require("fs");
22048
+ var import_node_fs18 = require("fs");
22034
22049
  var import_node_path52 = __toESM(require("path"), 1);
22035
22050
  var import_yaml9 = require("yaml");
22036
22051
  function getProjectsRegistryPath() {
@@ -22038,11 +22053,11 @@ function getProjectsRegistryPath() {
22038
22053
  }
22039
22054
  function loadProjectRegistry() {
22040
22055
  const registryPath = getProjectsRegistryPath();
22041
- if (!(0, import_node_fs17.existsSync)(registryPath)) {
22056
+ if (!(0, import_node_fs18.existsSync)(registryPath)) {
22042
22057
  return { projects: [] };
22043
22058
  }
22044
22059
  try {
22045
- const raw = (0, import_node_fs17.readFileSync)(registryPath, "utf-8");
22060
+ const raw = (0, import_node_fs18.readFileSync)(registryPath, "utf-8");
22046
22061
  const parsed = (0, import_yaml9.parse)(raw);
22047
22062
  if (!parsed || !Array.isArray(parsed.projects)) {
22048
22063
  return { projects: [] };
@@ -22055,10 +22070,10 @@ function loadProjectRegistry() {
22055
22070
  function saveProjectRegistry(registry) {
22056
22071
  const registryPath = getProjectsRegistryPath();
22057
22072
  const dir = import_node_path52.default.dirname(registryPath);
22058
- if (!(0, import_node_fs17.existsSync)(dir)) {
22059
- (0, import_node_fs17.mkdirSync)(dir, { recursive: true });
22073
+ if (!(0, import_node_fs18.existsSync)(dir)) {
22074
+ (0, import_node_fs18.mkdirSync)(dir, { recursive: true });
22060
22075
  }
22061
- (0, import_node_fs17.writeFileSync)(registryPath, (0, import_yaml9.stringify)(registry), "utf-8");
22076
+ (0, import_node_fs18.writeFileSync)(registryPath, (0, import_yaml9.stringify)(registry), "utf-8");
22062
22077
  }
22063
22078
  function deriveProjectId(dirPath, existingIds) {
22064
22079
  const base = import_node_path52.default.basename(dirPath).toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
@@ -22072,10 +22087,10 @@ function deriveProjectId(dirPath, existingIds) {
22072
22087
  }
22073
22088
  function addProject(projectPath) {
22074
22089
  const absPath = import_node_path52.default.resolve(projectPath);
22075
- if (!(0, import_node_fs17.existsSync)(absPath)) {
22090
+ if (!(0, import_node_fs18.existsSync)(absPath)) {
22076
22091
  throw new Error(`Directory not found: ${absPath}`);
22077
22092
  }
22078
- if (!(0, import_node_fs17.existsSync)(import_node_path52.default.join(absPath, ".agentv"))) {
22093
+ if (!(0, import_node_fs18.existsSync)(import_node_path52.default.join(absPath, ".agentv"))) {
22079
22094
  throw new Error(`No .agentv/ directory found in ${absPath}. Run an evaluation first.`);
22080
22095
  }
22081
22096
  const registry = loadProjectRegistry();
@@ -22119,19 +22134,19 @@ function touchProject(projectId) {
22119
22134
  }
22120
22135
  function discoverProjects(rootDir, maxDepth = 2) {
22121
22136
  const absRoot = import_node_path52.default.resolve(rootDir);
22122
- if (!(0, import_node_fs17.existsSync)(absRoot) || !(0, import_node_fs17.statSync)(absRoot).isDirectory()) {
22137
+ if (!(0, import_node_fs18.existsSync)(absRoot) || !(0, import_node_fs18.statSync)(absRoot).isDirectory()) {
22123
22138
  return [];
22124
22139
  }
22125
22140
  const results = [];
22126
22141
  function scan(dir, depth) {
22127
22142
  if (depth > maxDepth) return;
22128
- if ((0, import_node_fs17.existsSync)(import_node_path52.default.join(dir, ".agentv"))) {
22143
+ if ((0, import_node_fs18.existsSync)(import_node_path52.default.join(dir, ".agentv"))) {
22129
22144
  results.push(dir);
22130
22145
  return;
22131
22146
  }
22132
22147
  if (depth === maxDepth) return;
22133
22148
  try {
22134
- const entries = (0, import_node_fs17.readdirSync)(dir, { withFileTypes: true });
22149
+ const entries = (0, import_node_fs18.readdirSync)(dir, { withFileTypes: true });
22135
22150
  for (const entry of entries) {
22136
22151
  if (!entry.isDirectory()) continue;
22137
22152
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;