@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.js CHANGED
@@ -14449,6 +14449,7 @@ function runEqualsAssertion(output, value) {
14449
14449
 
14450
14450
  // src/evaluation/orchestrator.ts
14451
14451
  import { createHash as createHash2, randomUUID as randomUUID9 } from "node:crypto";
14452
+ import { existsSync as existsSync5 } from "node:fs";
14452
14453
  import { copyFile as copyFile2, mkdir as mkdir14, readdir as readdir7, stat as stat8 } from "node:fs/promises";
14453
14454
  import path44 from "node:path";
14454
14455
  import micromatch3 from "micromatch";
@@ -16228,8 +16229,8 @@ async function runEvaluation(options) {
16228
16229
  const poolSlotBaselines = /* @__PURE__ */ new Map();
16229
16230
  const poolMaxSlots = Math.min(configPoolMaxSlots ?? 10, 50);
16230
16231
  let staticMaterialised = false;
16232
+ const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
16231
16233
  if (useStaticWorkspace && configuredStaticPath) {
16232
- const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
16233
16234
  const dirExists = await stat8(configuredStaticPath).then(
16234
16235
  (s) => s.isDirectory(),
16235
16236
  () => false
@@ -16294,14 +16295,28 @@ async function runEvaluation(options) {
16294
16295
  } catch {
16295
16296
  }
16296
16297
  }
16297
- const needsRepoMaterialisation = !!suiteWorkspace?.repos?.length && !usePool && (!useStaticWorkspace || staticMaterialised);
16298
- const repoManager = needsRepoMaterialisation ? new RepoManager(verbose) : void 0;
16299
- if (repoManager && sharedWorkspacePath && suiteWorkspace?.repos && !isPerTestIsolation) {
16300
- setupLog(
16301
- `materializing ${suiteWorkspace.repos.length} shared repo(s) into ${sharedWorkspacePath}`
16302
- );
16298
+ const hasReposToMaterialize = !!suiteWorkspace?.repos?.length && !usePool && !isPerTestIsolation;
16299
+ const needsRepoMaterialisation = hasReposToMaterialize && (!useStaticWorkspace || staticMaterialised);
16300
+ const needsPerRepoCheck = hasReposToMaterialize && useStaticWorkspace && !staticMaterialised && isYamlConfiguredPath;
16301
+ const repoManager = needsRepoMaterialisation || needsPerRepoCheck ? new RepoManager(verbose) : void 0;
16302
+ if (repoManager && sharedWorkspacePath && suiteWorkspace?.repos) {
16303
16303
  try {
16304
- await repoManager.materializeAll(suiteWorkspace.repos, sharedWorkspacePath);
16304
+ if (needsPerRepoCheck) {
16305
+ for (const repo of suiteWorkspace.repos) {
16306
+ const targetDir = path44.join(sharedWorkspacePath, repo.path);
16307
+ if (existsSync5(targetDir)) {
16308
+ setupLog(`reusing existing repo at: ${targetDir}`);
16309
+ continue;
16310
+ }
16311
+ setupLog(`materializing missing repo: ${repo.path}`);
16312
+ await repoManager.materialize(repo, sharedWorkspacePath);
16313
+ }
16314
+ } else {
16315
+ setupLog(
16316
+ `materializing ${suiteWorkspace.repos.length} shared repo(s) into ${sharedWorkspacePath}`
16317
+ );
16318
+ await repoManager.materializeAll(suiteWorkspace.repos, sharedWorkspacePath);
16319
+ }
16305
16320
  setupLog("shared repo materialization complete");
16306
16321
  } catch (error) {
16307
16322
  const message = error instanceof Error ? error.message : String(error);
@@ -17975,7 +17990,7 @@ function computeWeightedMean(entries) {
17975
17990
  }
17976
17991
 
17977
17992
  // src/evaluation/evaluate.ts
17978
- import { existsSync as existsSync5 } from "node:fs";
17993
+ import { existsSync as existsSync6 } from "node:fs";
17979
17994
  import path45 from "node:path";
17980
17995
 
17981
17996
  // src/evaluation/providers/function-provider.ts
@@ -18132,7 +18147,7 @@ async function discoverDefaultTarget(repoRoot) {
18132
18147
  for (const dir of chain) {
18133
18148
  for (const candidate of TARGET_FILE_CANDIDATES) {
18134
18149
  const targetsPath = path45.join(dir, candidate);
18135
- if (!existsSync5(targetsPath)) continue;
18150
+ if (!existsSync6(targetsPath)) continue;
18136
18151
  try {
18137
18152
  const definitions = await readTargetDefinitions(targetsPath);
18138
18153
  const defaultTarget = definitions.find((d) => d.name === "default");
@@ -18149,7 +18164,7 @@ async function loadEnvHierarchy(repoRoot, startPath) {
18149
18164
  const envFiles = [];
18150
18165
  for (const dir of chain) {
18151
18166
  const envPath = path45.join(dir, ".env");
18152
- if (existsSync5(envPath)) envFiles.push(envPath);
18167
+ if (existsSync6(envPath)) envFiles.push(envPath);
18153
18168
  }
18154
18169
  for (let i = 0; i < envFiles.length; i++) {
18155
18170
  try {
@@ -18225,12 +18240,12 @@ var CONFIG_FILE_NAMES = [
18225
18240
  ".agentv/config.js"
18226
18241
  ];
18227
18242
  async function loadTsConfig(projectRoot) {
18228
- const { existsSync: existsSync7 } = await import("node:fs");
18243
+ const { existsSync: existsSync8 } = await import("node:fs");
18229
18244
  const { pathToFileURL: pathToFileURL2 } = await import("node:url");
18230
18245
  const { join: join2 } = await import("node:path");
18231
18246
  for (const fileName of CONFIG_FILE_NAMES) {
18232
18247
  const filePath = join2(projectRoot, fileName);
18233
- if (!existsSync7(filePath)) {
18248
+ if (!existsSync8(filePath)) {
18234
18249
  continue;
18235
18250
  }
18236
18251
  try {
@@ -18465,7 +18480,7 @@ function shouldSkipCacheForTemperature(targetConfig) {
18465
18480
  }
18466
18481
 
18467
18482
  // src/projects.ts
18468
- import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync3, readdirSync as readdirSync3, statSync as statSync2, writeFileSync } from "node:fs";
18483
+ import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync3, readdirSync as readdirSync3, statSync as statSync2, writeFileSync } from "node:fs";
18469
18484
  import path48 from "node:path";
18470
18485
  import { parse as parseYaml3, stringify as stringifyYaml } from "yaml";
18471
18486
  function getProjectsRegistryPath() {
@@ -18473,7 +18488,7 @@ function getProjectsRegistryPath() {
18473
18488
  }
18474
18489
  function loadProjectRegistry() {
18475
18490
  const registryPath = getProjectsRegistryPath();
18476
- if (!existsSync6(registryPath)) {
18491
+ if (!existsSync7(registryPath)) {
18477
18492
  return { projects: [] };
18478
18493
  }
18479
18494
  try {
@@ -18490,7 +18505,7 @@ function loadProjectRegistry() {
18490
18505
  function saveProjectRegistry(registry) {
18491
18506
  const registryPath = getProjectsRegistryPath();
18492
18507
  const dir = path48.dirname(registryPath);
18493
- if (!existsSync6(dir)) {
18508
+ if (!existsSync7(dir)) {
18494
18509
  mkdirSync2(dir, { recursive: true });
18495
18510
  }
18496
18511
  writeFileSync(registryPath, stringifyYaml(registry), "utf-8");
@@ -18507,10 +18522,10 @@ function deriveProjectId(dirPath, existingIds) {
18507
18522
  }
18508
18523
  function addProject(projectPath) {
18509
18524
  const absPath = path48.resolve(projectPath);
18510
- if (!existsSync6(absPath)) {
18525
+ if (!existsSync7(absPath)) {
18511
18526
  throw new Error(`Directory not found: ${absPath}`);
18512
18527
  }
18513
- if (!existsSync6(path48.join(absPath, ".agentv"))) {
18528
+ if (!existsSync7(path48.join(absPath, ".agentv"))) {
18514
18529
  throw new Error(`No .agentv/ directory found in ${absPath}. Run an evaluation first.`);
18515
18530
  }
18516
18531
  const registry = loadProjectRegistry();
@@ -18554,13 +18569,13 @@ function touchProject(projectId) {
18554
18569
  }
18555
18570
  function discoverProjects(rootDir, maxDepth = 2) {
18556
18571
  const absRoot = path48.resolve(rootDir);
18557
- if (!existsSync6(absRoot) || !statSync2(absRoot).isDirectory()) {
18572
+ if (!existsSync7(absRoot) || !statSync2(absRoot).isDirectory()) {
18558
18573
  return [];
18559
18574
  }
18560
18575
  const results = [];
18561
18576
  function scan(dir, depth) {
18562
18577
  if (depth > maxDepth) return;
18563
- if (existsSync6(path48.join(dir, ".agentv"))) {
18578
+ if (existsSync7(path48.join(dir, ".agentv"))) {
18564
18579
  results.push(dir);
18565
18580
  return;
18566
18581
  }