agentv 4.9.0 → 4.10.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.
@@ -301,7 +301,7 @@ var require_dist = __commonJS({
301
301
  }
302
302
  });
303
303
 
304
- // ../../packages/core/dist/chunk-VCVVKCC4.js
304
+ // ../../packages/core/dist/chunk-BWHUWLGW.js
305
305
  import { constants } from "node:fs";
306
306
  import { access, readFile } from "node:fs/promises";
307
307
  import path from "node:path";
@@ -419,7 +419,7 @@ __export(external_exports2, {
419
419
  void: () => voidType
420
420
  });
421
421
 
422
- // ../../packages/core/dist/chunk-VCVVKCC4.js
422
+ // ../../packages/core/dist/chunk-BWHUWLGW.js
423
423
  import { readFile as readFile2 } from "node:fs/promises";
424
424
  import path3 from "node:path";
425
425
  import fg from "fast-glob";
@@ -2308,8 +2308,8 @@ async function expandFileReferences(tests, evalFileDir) {
2308
2308
  }
2309
2309
 
2310
2310
  // ../../packages/core/dist/index.js
2311
- import { readFile as readFile6 } from "node:fs/promises";
2312
- import path7 from "node:path";
2311
+ import { readFile as readFile7 } from "node:fs/promises";
2312
+ import path8 from "node:path";
2313
2313
  import micromatch2 from "micromatch";
2314
2314
  import { parse as parse2 } from "yaml";
2315
2315
  import { readFile as readFile3 } from "node:fs/promises";
@@ -2321,16 +2321,19 @@ import { constants as constants2 } from "node:fs";
2321
2321
  import { access as access2 } from "node:fs/promises";
2322
2322
  import path22 from "node:path";
2323
2323
  import { fileURLToPath } from "node:url";
2324
- import path42 from "node:path";
2324
+ import path5 from "node:path";
2325
2325
  import { readFile as readFile32 } from "node:fs/promises";
2326
- import { readFile as readFile5 } from "node:fs/promises";
2327
- import path6 from "node:path";
2326
+ import path42 from "node:path";
2327
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
2328
+ import { readFile as readFile4 } from "node:fs/promises";
2329
+ import { readFile as readFile6 } from "node:fs/promises";
2330
+ import path7 from "node:path";
2328
2331
  import micromatch from "micromatch";
2329
2332
  import { parse as parseYaml2 } from "yaml";
2330
- import { readFile as readFile4 } from "node:fs/promises";
2331
- import path5 from "node:path";
2333
+ import { readFile as readFile5 } from "node:fs/promises";
2334
+ import path6 from "node:path";
2332
2335
  import { readFileSync } from "node:fs";
2333
- import path8 from "node:path";
2336
+ import path9 from "node:path";
2334
2337
  import { parse as parse3 } from "yaml";
2335
2338
  import { createOpenAI } from "@ai-sdk/openai";
2336
2339
 
@@ -6941,7 +6944,7 @@ function createOpenRouter(options = {}) {
6941
6944
  );
6942
6945
  const createChatModel = (modelId, settings = {}) => new OpenRouterChatLanguageModel(modelId, settings, {
6943
6946
  provider: "openrouter.chat",
6944
- url: ({ path: path51 }) => `${baseURL}${path51}`,
6947
+ url: ({ path: path52 }) => `${baseURL}${path52}`,
6945
6948
  headers: getHeaders,
6946
6949
  compatibility,
6947
6950
  fetch: options.fetch,
@@ -6949,7 +6952,7 @@ function createOpenRouter(options = {}) {
6949
6952
  });
6950
6953
  const createCompletionModel = (modelId, settings = {}) => new OpenRouterCompletionLanguageModel(modelId, settings, {
6951
6954
  provider: "openrouter.completion",
6952
- url: ({ path: path51 }) => `${baseURL}${path51}`,
6955
+ url: ({ path: path52 }) => `${baseURL}${path52}`,
6953
6956
  headers: getHeaders,
6954
6957
  compatibility,
6955
6958
  fetch: options.fetch,
@@ -6957,14 +6960,14 @@ function createOpenRouter(options = {}) {
6957
6960
  });
6958
6961
  const createEmbeddingModel = (modelId, settings = {}) => new OpenRouterEmbeddingModel(modelId, settings, {
6959
6962
  provider: "openrouter.embedding",
6960
- url: ({ path: path51 }) => `${baseURL}${path51}`,
6963
+ url: ({ path: path52 }) => `${baseURL}${path52}`,
6961
6964
  headers: getHeaders,
6962
6965
  fetch: options.fetch,
6963
6966
  extraBody: options.extraBody
6964
6967
  });
6965
6968
  const createImageModel = (modelId, settings = {}) => new OpenRouterImageModel(modelId, settings, {
6966
6969
  provider: "openrouter.image",
6967
- url: ({ path: path51 }) => `${baseURL}${path51}`,
6970
+ url: ({ path: path52 }) => `${baseURL}${path52}`,
6968
6971
  headers: getHeaders,
6969
6972
  fetch: options.fetch,
6970
6973
  extraBody: options.extraBody
@@ -12960,24 +12963,24 @@ import { spawn } from "node:child_process";
12960
12963
  import { randomUUID } from "node:crypto";
12961
12964
  import { createWriteStream } from "node:fs";
12962
12965
  import { mkdir } from "node:fs/promises";
12966
+ import path11 from "node:path";
12963
12967
  import path10 from "node:path";
12964
- import path9 from "node:path";
12965
12968
  import { randomUUID as randomUUID2 } from "node:crypto";
12966
12969
  import { createWriteStream as createWriteStream2 } from "node:fs";
12967
12970
  import { mkdir as mkdir2 } from "node:fs/promises";
12968
- import path11 from "node:path";
12971
+ import path12 from "node:path";
12969
12972
  import { exec as execWithCallback } from "node:child_process";
12970
12973
  import fs from "node:fs/promises";
12971
12974
  import os from "node:os";
12972
- import path12 from "node:path";
12975
+ import path13 from "node:path";
12973
12976
  import { promisify } from "node:util";
12974
12977
  import { randomUUID as randomUUID3 } from "node:crypto";
12975
12978
  import { createWriteStream as createWriteStream3 } from "node:fs";
12976
12979
  import { mkdir as mkdir3 } from "node:fs/promises";
12977
- import path13 from "node:path";
12980
+ import path14 from "node:path";
12978
12981
  import { randomUUID as randomUUID5 } from "node:crypto";
12979
12982
  import { mkdir as mkdir4 } from "node:fs/promises";
12980
- import path15 from "node:path";
12983
+ import path16 from "node:path";
12981
12984
  import { Readable, Writable } from "node:stream";
12982
12985
  import { spawn as spawn2 } from "node:child_process";
12983
12986
 
@@ -14462,63 +14465,63 @@ var RequestError = class _RequestError extends Error {
14462
14465
  import { randomUUID as randomUUID4 } from "node:crypto";
14463
14466
  import { createWriteStream as createWriteStream4, existsSync, readdirSync } from "node:fs";
14464
14467
  import { arch, platform } from "node:os";
14465
- import path14 from "node:path";
14466
- import { fileURLToPath as fileURLToPath2 } from "node:url";
14467
- import { readFile as readFile8 } from "node:fs/promises";
14468
+ import path15 from "node:path";
14469
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
14470
+ import { readFile as readFile9 } from "node:fs/promises";
14468
14471
  import { homedir as homedir2 } from "node:os";
14469
- import path17 from "node:path";
14470
- import { readFile as readFile7, readdir, stat } from "node:fs/promises";
14472
+ import path18 from "node:path";
14473
+ import { readFile as readFile8, readdir, stat } from "node:fs/promises";
14471
14474
  import { homedir } from "node:os";
14472
- import path16 from "node:path";
14475
+ import path17 from "node:path";
14473
14476
  import { parse as parseYaml22 } from "yaml";
14474
14477
  import { randomUUID as randomUUID6 } from "node:crypto";
14475
14478
  import { existsSync as existsSync2 } from "node:fs";
14476
14479
  import { mkdir as mkdir5 } from "node:fs/promises";
14477
- import path18 from "node:path";
14480
+ import path19 from "node:path";
14478
14481
  import { execSync, spawn as spawn3 } from "node:child_process";
14479
14482
  import { randomUUID as randomUUID7 } from "node:crypto";
14480
14483
  import { accessSync, createWriteStream as createWriteStream5, readFileSync as readFileSync2 } from "node:fs";
14481
14484
  import { mkdir as mkdir6, mkdtemp, rm, writeFile } from "node:fs/promises";
14482
14485
  import { tmpdir } from "node:os";
14483
- import path19 from "node:path";
14486
+ import path20 from "node:path";
14484
14487
  import { execSync as execSync2 } from "node:child_process";
14485
14488
  import { randomUUID as randomUUID8 } from "node:crypto";
14486
14489
  import { accessSync as accessSync2, createWriteStream as createWriteStream6, mkdirSync } from "node:fs";
14487
14490
  import { mkdir as mkdir7 } from "node:fs/promises";
14488
- import path21 from "node:path";
14491
+ import path222 from "node:path";
14489
14492
  import { createInterface } from "node:readline";
14490
- import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
14493
+ import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
14491
14494
  import os2 from "node:os";
14492
- import path20 from "node:path";
14495
+ import path21 from "node:path";
14493
14496
  import { exec as exec2 } from "node:child_process";
14494
14497
  import { constants as constants3, access as access3, stat as stat5 } from "node:fs/promises";
14495
- import path322 from "node:path";
14498
+ import path33 from "node:path";
14496
14499
  import { promisify as promisify3 } from "node:util";
14497
14500
  import { stat as stat4, writeFile as writeFile4 } from "node:fs/promises";
14498
- import path30 from "node:path";
14501
+ import path31 from "node:path";
14499
14502
  import { constants as constants22 } from "node:fs";
14500
14503
  import { access as access22, mkdir as mkdir8, readdir as readdir2, rm as rm2, stat as stat2 } from "node:fs/promises";
14501
- import path222 from "node:path";
14502
14504
  import path23 from "node:path";
14503
14505
  import path24 from "node:path";
14504
- import { readFile as readFile9 } from "node:fs/promises";
14505
14506
  import path25 from "node:path";
14507
+ import { readFile as readFile10 } from "node:fs/promises";
14508
+ import path26 from "node:path";
14506
14509
  import { exec, spawn as spawn4 } from "node:child_process";
14507
14510
  import { mkdir as mkdir9, writeFile as writeFile2 } from "node:fs/promises";
14508
- import path27 from "node:path";
14511
+ import path28 from "node:path";
14509
14512
  import { promisify as promisify2 } from "node:util";
14510
- import path26 from "node:path";
14511
- import { copyFile, mkdir as mkdir10, readFile as readFile10, readdir as readdir3, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
14513
+ import path27 from "node:path";
14514
+ import { copyFile, mkdir as mkdir10, readFile as readFile11, readdir as readdir3, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
14515
+ import path30 from "node:path";
14512
14516
  import path29 from "node:path";
14513
- import path28 from "node:path";
14514
14517
  import JSON5 from "json5";
14515
14518
  import { writeFile as writeFile5 } from "node:fs/promises";
14516
- import path31 from "node:path";
14519
+ import path322 from "node:path";
14517
14520
  import { constants as constants4 } from "node:fs";
14518
- import { access as access4, readFile as readFile11 } from "node:fs/promises";
14519
- import path33 from "node:path";
14520
- import { parse as parse4 } from "yaml";
14521
+ import { access as access4, readFile as readFile12 } from "node:fs/promises";
14521
14522
  import path34 from "node:path";
14523
+ import { parse as parse4 } from "yaml";
14524
+ import path35 from "node:path";
14522
14525
  import fg2 from "fast-glob";
14523
14526
  import { mkdtemp as mkdtemp2, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
14524
14527
  import { tmpdir as tmpdir2 } from "node:os";
@@ -14526,51 +14529,52 @@ import { dirname, join } from "node:path";
14526
14529
  import { randomBytes } from "node:crypto";
14527
14530
  import { createServer } from "node:http";
14528
14531
  import fs2 from "node:fs/promises";
14529
- import path35 from "node:path";
14532
+ import path36 from "node:path";
14530
14533
  import { createHash as createHash2, randomUUID as randomUUID9 } from "node:crypto";
14534
+ import { existsSync as existsSync5 } from "node:fs";
14531
14535
  import { copyFile as copyFile2, mkdir as mkdir14, readdir as readdir7, stat as stat8 } from "node:fs/promises";
14532
- import path44 from "node:path";
14536
+ import path45 from "node:path";
14533
14537
  import micromatch3 from "micromatch";
14534
- import path36 from "node:path";
14535
14538
  import path37 from "node:path";
14536
- import fg22 from "fast-glob";
14537
14539
  import path38 from "node:path";
14540
+ import fg22 from "fast-glob";
14541
+ import path39 from "node:path";
14538
14542
  import fg3 from "fast-glob";
14539
14543
  import { exec as execCallback } from "node:child_process";
14540
14544
  import { readdirSync as readdirSync2, statSync } from "node:fs";
14541
- import path39 from "node:path";
14545
+ import path40 from "node:path";
14542
14546
  import { promisify as promisify4 } from "node:util";
14543
14547
  import { cp, mkdir as mkdir12, readdir as readdir4, rm as rm4, stat as stat6 } from "node:fs/promises";
14544
- import path40 from "node:path";
14548
+ import path41 from "node:path";
14545
14549
  import { execFile } from "node:child_process";
14546
14550
  import { createHash } from "node:crypto";
14547
14551
  import { existsSync as existsSync3 } from "node:fs";
14548
- import { cp as cp2, mkdir as mkdir13, readFile as readFile12, readdir as readdir5, rm as rm5, unlink, writeFile as writeFile7 } from "node:fs/promises";
14549
- import path41 from "node:path";
14552
+ import { cp as cp2, mkdir as mkdir13, readFile as readFile13, readdir as readdir5, rm as rm5, unlink, writeFile as writeFile7 } from "node:fs/promises";
14553
+ import path422 from "node:path";
14550
14554
  import { promisify as promisify5 } from "node:util";
14551
14555
  import { execFile as execFile2 } from "node:child_process";
14552
14556
  import { existsSync as existsSync4 } from "node:fs";
14553
- import path422 from "node:path";
14557
+ import path43 from "node:path";
14554
14558
  import { promisify as promisify6 } from "node:util";
14555
14559
  import { readdir as readdir6, stat as stat7 } from "node:fs/promises";
14556
- import path43 from "node:path";
14557
- import { existsSync as existsSync5 } from "node:fs";
14558
- import path45 from "node:path";
14559
- import { readFile as readFile13 } from "node:fs/promises";
14560
+ import path44 from "node:path";
14561
+ import { existsSync as existsSync6 } from "node:fs";
14560
14562
  import path46 from "node:path";
14561
- import { parse as parse5 } from "yaml";
14562
- import { mkdir as mkdir15, readFile as readFile14, writeFile as writeFile8 } from "node:fs/promises";
14563
+ import { readFile as readFile14 } from "node:fs/promises";
14563
14564
  import path47 from "node:path";
14564
- import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync3, readdirSync as readdirSync3, statSync as statSync2, writeFileSync } from "node:fs";
14565
+ import { parse as parse5 } from "yaml";
14566
+ import { mkdir as mkdir15, readFile as readFile15, writeFile as writeFile8 } from "node:fs/promises";
14565
14567
  import path48 from "node:path";
14568
+ import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync3, readdirSync as readdirSync3, statSync as statSync2, writeFileSync } from "node:fs";
14569
+ import path49 from "node:path";
14566
14570
  import { parse as parseYaml3, stringify as stringifyYaml } from "yaml";
14567
14571
  import { readdir as readdir8, stat as stat9 } from "node:fs/promises";
14568
14572
  import { homedir as homedir3 } from "node:os";
14569
- import path49 from "node:path";
14573
+ import path50 from "node:path";
14570
14574
  import { readdir as readdir9, stat as stat10 } from "node:fs/promises";
14571
14575
  import { homedir as homedir4 } from "node:os";
14572
- import path50 from "node:path";
14573
- import { readFile as readFile15 } from "node:fs/promises";
14576
+ import path51 from "node:path";
14577
+ import { readFile as readFile16 } from "node:fs/promises";
14574
14578
  function computeTraceSummary(messages) {
14575
14579
  const toolCallCounts = {};
14576
14580
  const toolDurations = {};
@@ -15194,6 +15198,305 @@ function parseExecutionDefaults(raw, configPath) {
15194
15198
  function logWarning(message) {
15195
15199
  console.warn(`${ANSI_YELLOW2}Warning: ${message}${ANSI_RESET22}`);
15196
15200
  }
15201
+ function shellEscapePath(value) {
15202
+ if (process.platform === "win32") {
15203
+ return `"${value.replaceAll('"', '""')}"`;
15204
+ }
15205
+ return `'${value.replaceAll("'", `'"'"'`)}'`;
15206
+ }
15207
+ async function execFileWithStdin(argv, stdinPayload, options = {}) {
15208
+ if (argv.length === 0) {
15209
+ throw new Error("Executable argv must include at least one entry");
15210
+ }
15211
+ if (typeof Bun !== "undefined") {
15212
+ return execFileWithStdinBun(argv, stdinPayload, options);
15213
+ }
15214
+ return execFileWithStdinNode(argv, stdinPayload, options);
15215
+ }
15216
+ async function execFileWithStdinBun(argv, stdinPayload, options) {
15217
+ const command = [...argv];
15218
+ const encoder = new TextEncoder();
15219
+ const proc = Bun.spawn(command, {
15220
+ cwd: options.cwd,
15221
+ stdin: encoder.encode(stdinPayload),
15222
+ stdout: "pipe",
15223
+ stderr: "pipe",
15224
+ // Merge additional env vars with process.env
15225
+ env: options.env ? { ...process.env, ...options.env } : process.env
15226
+ });
15227
+ let timedOut = false;
15228
+ const timeout = options.timeoutMs !== void 0 ? setTimeout(() => {
15229
+ timedOut = true;
15230
+ proc.kill("SIGKILL");
15231
+ }, options.timeoutMs) : void 0;
15232
+ try {
15233
+ const stdoutPromise = proc.stdout ? new Response(proc.stdout).text() : Promise.resolve("");
15234
+ const stderrPromise = proc.stderr ? new Response(proc.stderr).text() : Promise.resolve("");
15235
+ const [stdout, stderr, exitCode] = await Promise.all([
15236
+ stdoutPromise,
15237
+ stderrPromise,
15238
+ proc.exited
15239
+ ]);
15240
+ if (timedOut) {
15241
+ throw new Error(`Process timed out after ${options.timeoutMs}ms`);
15242
+ }
15243
+ return {
15244
+ stdout: stdout.replace(/\r\n/g, "\n"),
15245
+ stderr: stderr.replace(/\r\n/g, "\n"),
15246
+ exitCode
15247
+ };
15248
+ } finally {
15249
+ if (timeout !== void 0) {
15250
+ clearTimeout(timeout);
15251
+ }
15252
+ }
15253
+ }
15254
+ async function execFileWithStdinNode(argv, stdinPayload, options) {
15255
+ const { spawn: spawn5 } = await import("node:child_process");
15256
+ return new Promise((resolve2, reject) => {
15257
+ const [cmd, ...args] = argv;
15258
+ const child = spawn5(cmd, args, {
15259
+ cwd: options.cwd,
15260
+ stdio: ["pipe", "pipe", "pipe"],
15261
+ // Merge additional env vars with process.env
15262
+ env: options.env ? { ...process.env, ...options.env } : process.env
15263
+ });
15264
+ const stdoutChunks = [];
15265
+ const stderrChunks = [];
15266
+ child.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
15267
+ child.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
15268
+ let timedOut = false;
15269
+ const timeout = options.timeoutMs !== void 0 ? setTimeout(() => {
15270
+ timedOut = true;
15271
+ child.kill("SIGKILL");
15272
+ }, options.timeoutMs) : void 0;
15273
+ child.on("error", (error) => {
15274
+ if (timeout !== void 0) clearTimeout(timeout);
15275
+ reject(error);
15276
+ });
15277
+ child.on("close", (code) => {
15278
+ if (timeout !== void 0) clearTimeout(timeout);
15279
+ if (timedOut) {
15280
+ reject(new Error(`Process timed out after ${options.timeoutMs}ms`));
15281
+ return;
15282
+ }
15283
+ const stdout = Buffer.concat(stdoutChunks).toString("utf8").replace(/\r\n/g, "\n");
15284
+ const stderr = Buffer.concat(stderrChunks).toString("utf8").replace(/\r\n/g, "\n");
15285
+ resolve2({
15286
+ stdout,
15287
+ stderr,
15288
+ exitCode: code ?? 0
15289
+ });
15290
+ });
15291
+ if (child.stdin) {
15292
+ child.stdin.write(stdinPayload);
15293
+ child.stdin.end();
15294
+ }
15295
+ });
15296
+ }
15297
+ async function execShellWithStdin(command, stdinPayload, options = {}) {
15298
+ const { mkdir: mkdir16, readFile: readFile17, rm: rm6, writeFile: writeFile9 } = await import("node:fs/promises");
15299
+ const { tmpdir: tmpdir3 } = await import("node:os");
15300
+ const path52 = await import("node:path");
15301
+ const { randomUUID: randomUUID10 } = await import("node:crypto");
15302
+ const dir = path52.join(tmpdir3(), `agentv-exec-${randomUUID10()}`);
15303
+ await mkdir16(dir, { recursive: true });
15304
+ const stdinPath = path52.join(dir, "stdin.txt");
15305
+ const stdoutPath = path52.join(dir, "stdout.txt");
15306
+ const stderrPath = path52.join(dir, "stderr.txt");
15307
+ await writeFile9(stdinPath, stdinPayload, "utf8");
15308
+ const wrappedCommand = process.platform === "win32" ? `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}` : `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}`;
15309
+ const { spawn: spawn5 } = await import("node:child_process");
15310
+ try {
15311
+ const exitCode = await new Promise((resolve2, reject) => {
15312
+ const child = spawn5(wrappedCommand, {
15313
+ shell: true,
15314
+ cwd: options.cwd,
15315
+ stdio: ["ignore", "ignore", "ignore"],
15316
+ // Merge additional env vars with process.env
15317
+ env: options.env ? { ...process.env, ...options.env } : process.env
15318
+ });
15319
+ const timeout = options.timeoutMs ? setTimeout(() => {
15320
+ child.kill();
15321
+ reject(new Error(`Process timed out after ${options.timeoutMs}ms`));
15322
+ }, options.timeoutMs) : void 0;
15323
+ child.on("error", (error) => {
15324
+ if (timeout !== void 0) {
15325
+ clearTimeout(timeout);
15326
+ }
15327
+ reject(error);
15328
+ });
15329
+ child.on("exit", (code) => {
15330
+ if (timeout !== void 0) {
15331
+ clearTimeout(timeout);
15332
+ }
15333
+ resolve2(code ?? 0);
15334
+ });
15335
+ });
15336
+ const stdout = (await readFile17(stdoutPath, "utf8")).replace(/\r\n/g, "\n");
15337
+ const stderr = (await readFile17(stderrPath, "utf8")).replace(/\r\n/g, "\n");
15338
+ return { stdout, stderr, exitCode };
15339
+ } finally {
15340
+ await rm6(dir, { recursive: true, force: true });
15341
+ }
15342
+ }
15343
+ var MIME_TYPE_ALIASES = {
15344
+ csv: "text/csv",
15345
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
15346
+ htm: "text/html",
15347
+ html: "text/html",
15348
+ json: "application/json",
15349
+ markdown: "text/markdown",
15350
+ md: "text/markdown",
15351
+ pdf: "application/pdf",
15352
+ sql: "application/sql",
15353
+ txt: "text/plain",
15354
+ xhtml: "application/xhtml+xml",
15355
+ xls: "application/vnd.ms-excel",
15356
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
15357
+ xml: "application/xml",
15358
+ yaml: "application/yaml",
15359
+ yml: "application/yaml"
15360
+ };
15361
+ var REPLACEMENT_CHAR = "\uFFFD";
15362
+ async function extractTextWithPreprocessors(content, preprocessors, options = {}) {
15363
+ if (typeof content === "string") {
15364
+ return { text: content, warnings: [] };
15365
+ }
15366
+ if (!content || content.length === 0) {
15367
+ return { text: "", warnings: [] };
15368
+ }
15369
+ const parts = [];
15370
+ const warnings = [];
15371
+ for (const block of content) {
15372
+ if (block.type === "text") {
15373
+ parts.push(block.text);
15374
+ continue;
15375
+ }
15376
+ if (block.type !== "file") {
15377
+ continue;
15378
+ }
15379
+ const result = await preprocessContentFile(block, preprocessors, options.basePath);
15380
+ if (result.text) {
15381
+ parts.push(result.text);
15382
+ }
15383
+ warnings.push(...result.warnings);
15384
+ }
15385
+ return { text: parts.join("\n"), warnings };
15386
+ }
15387
+ async function preprocessContentFile(block, preprocessors, basePath) {
15388
+ const mediaType = normalizePreprocessorType(block.media_type);
15389
+ const resolvedPath = resolveLocalFilePath(block.path, basePath);
15390
+ if (!resolvedPath) {
15391
+ return {
15392
+ text: "",
15393
+ warnings: [
15394
+ {
15395
+ file: block.path,
15396
+ mediaType: block.media_type,
15397
+ reason: "remote file paths are not supported for preprocessing"
15398
+ }
15399
+ ]
15400
+ };
15401
+ }
15402
+ const preprocessor = preprocessors?.find(
15403
+ (entry) => normalizePreprocessorType(entry.type) === mediaType
15404
+ );
15405
+ if (preprocessor) {
15406
+ return runContentPreprocessor(block, resolvedPath, preprocessor);
15407
+ }
15408
+ try {
15409
+ const buffer = await readFile32(resolvedPath);
15410
+ const text2 = buffer.toString("utf8").replace(/\r\n/g, "\n");
15411
+ if (buffer.includes(0) || text2.includes(REPLACEMENT_CHAR)) {
15412
+ return {
15413
+ text: "",
15414
+ warnings: [
15415
+ {
15416
+ file: block.path,
15417
+ mediaType: block.media_type,
15418
+ reason: "default UTF-8 read produced binary or invalid text; configure a preprocessor"
15419
+ }
15420
+ ]
15421
+ };
15422
+ }
15423
+ return { text: formatFileText(block.path, text2), warnings: [] };
15424
+ } catch (error) {
15425
+ return {
15426
+ text: "",
15427
+ warnings: [
15428
+ {
15429
+ file: block.path,
15430
+ mediaType: block.media_type,
15431
+ reason: error instanceof Error ? error.message : String(error)
15432
+ }
15433
+ ]
15434
+ };
15435
+ }
15436
+ }
15437
+ async function runContentPreprocessor(block, resolvedPath, preprocessor) {
15438
+ try {
15439
+ const argv = preprocessor.resolvedCommand ?? preprocessor.command;
15440
+ const { stdout, stderr, exitCode } = await execFileWithStdin(
15441
+ argv,
15442
+ JSON.stringify({
15443
+ path: resolvedPath,
15444
+ original_path: block.path,
15445
+ media_type: block.media_type
15446
+ })
15447
+ );
15448
+ if (exitCode !== 0) {
15449
+ return {
15450
+ text: "",
15451
+ warnings: [
15452
+ {
15453
+ file: block.path,
15454
+ mediaType: block.media_type,
15455
+ reason: stderr.trim() || `preprocessor exited with code ${exitCode}`
15456
+ }
15457
+ ]
15458
+ };
15459
+ }
15460
+ return { text: formatFileText(block.path, stdout.trim()), warnings: [] };
15461
+ } catch (error) {
15462
+ return {
15463
+ text: "",
15464
+ warnings: [
15465
+ {
15466
+ file: block.path,
15467
+ mediaType: block.media_type,
15468
+ reason: error instanceof Error ? error.message : String(error)
15469
+ }
15470
+ ]
15471
+ };
15472
+ }
15473
+ }
15474
+ function appendPreprocessingWarnings(text2, warnings) {
15475
+ if (warnings.length === 0) {
15476
+ return text2;
15477
+ }
15478
+ const notes = warnings.map(
15479
+ (warning) => `[file preprocessing warning] ${warning.file} (${warning.mediaType}): ${warning.reason}`
15480
+ );
15481
+ return [text2, ...notes].filter((part) => part.length > 0).join("\n");
15482
+ }
15483
+ function normalizePreprocessorType(value) {
15484
+ const normalized = value.trim().toLowerCase();
15485
+ return MIME_TYPE_ALIASES[normalized] ?? normalized;
15486
+ }
15487
+ function resolveLocalFilePath(value, basePath) {
15488
+ if (value.startsWith("file://")) {
15489
+ return fileURLToPath2(value);
15490
+ }
15491
+ if (/^[a-z]+:\/\//i.test(value)) {
15492
+ return void 0;
15493
+ }
15494
+ return basePath ? path42.resolve(basePath, value) : path42.resolve(value);
15495
+ }
15496
+ function formatFileText(filePath, text2) {
15497
+ return `[[ file: ${filePath} ]]
15498
+ ${text2}`;
15499
+ }
15197
15500
  var TEMPLATE_VARIABLES = {
15198
15501
  EXPECTED_OUTPUT: "expected_output",
15199
15502
  CRITERIA: "criteria",
@@ -15220,7 +15523,7 @@ var DEPRECATED_TEMPLATE_VARIABLES = /* @__PURE__ */ new Map([
15220
15523
  var ANSI_YELLOW22 = "\x1B[33m";
15221
15524
  var ANSI_RESET3 = "\x1B[0m";
15222
15525
  async function validateCustomPromptContent(promptPath) {
15223
- const content = await readFile32(promptPath, "utf8");
15526
+ const content = await readFile4(promptPath, "utf8");
15224
15527
  validateTemplateVariables(content, promptPath);
15225
15528
  }
15226
15529
  function validateTemplateVariables(content, source) {
@@ -15275,22 +15578,32 @@ function normalizeEvaluatorType(type) {
15275
15578
  function isDeprecatedJudgeType(type) {
15276
15579
  return type === "code-judge" || type === "llm-judge";
15277
15580
  }
15278
- async function parseEvaluators(rawEvalCase, globalExecution, searchRoots, evalId) {
15581
+ async function parseEvaluators(rawEvalCase, globalExecution, searchRoots, evalId, defaultPreprocessors) {
15279
15582
  const execution = rawEvalCase.execution;
15280
15583
  const executionObject = isJsonObject2(execution) ? execution : void 0;
15281
15584
  const caseEvaluators = rawEvalCase.assertions ?? rawEvalCase.assert ?? (executionObject ? executionObject.evaluators : void 0) ?? // deprecated: use assertions
15282
15585
  rawEvalCase.evaluators;
15283
15586
  const skipDefaults = executionObject?.skip_defaults === true;
15284
15587
  const rootEvaluators = skipDefaults ? void 0 : globalExecution?.assertions ?? globalExecution?.assert ?? globalExecution?.evaluators;
15285
- const parsedCase = await parseEvaluatorList(caseEvaluators, searchRoots, evalId);
15286
- const parsedRoot = await parseEvaluatorList(rootEvaluators, searchRoots, evalId);
15588
+ const parsedCase = await parseEvaluatorList(
15589
+ caseEvaluators,
15590
+ searchRoots,
15591
+ evalId,
15592
+ defaultPreprocessors
15593
+ );
15594
+ const parsedRoot = await parseEvaluatorList(
15595
+ rootEvaluators,
15596
+ searchRoots,
15597
+ evalId,
15598
+ defaultPreprocessors
15599
+ );
15287
15600
  if (!parsedCase && !parsedRoot) {
15288
15601
  return void 0;
15289
15602
  }
15290
15603
  const evaluators = [...parsedCase ?? [], ...parsedRoot ?? []];
15291
15604
  return evaluators.length > 0 ? evaluators : void 0;
15292
15605
  }
15293
- async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15606
+ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId, defaultPreprocessors) {
15294
15607
  if (candidateEvaluators === void 0) {
15295
15608
  return void 0;
15296
15609
  }
@@ -15355,6 +15668,13 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15355
15668
  continue;
15356
15669
  }
15357
15670
  const negate = rawEvaluator.negate === true ? true : void 0;
15671
+ const mergedPreprocessors = await parseMergedPreprocessors(
15672
+ rawEvaluator.preprocessors,
15673
+ defaultPreprocessors,
15674
+ searchRoots,
15675
+ name21,
15676
+ evalId
15677
+ );
15358
15678
  if (isCustomType) {
15359
15679
  const weight2 = validateWeight(rawEvaluator.weight, name21, evalId);
15360
15680
  const { required: required2, min_score: min_score2 } = parseRequiredAndMinScore(
@@ -15413,7 +15733,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15413
15733
  if (cwd) {
15414
15734
  const resolved = await resolveFileReference22(cwd, searchRoots);
15415
15735
  if (resolved.resolvedPath) {
15416
- resolvedCwd = path42.resolve(resolved.resolvedPath);
15736
+ resolvedCwd = path5.resolve(resolved.resolvedPath);
15417
15737
  } else {
15418
15738
  logWarning2(
15419
15739
  `Code-grader evaluator '${name21}' in '${evalId}': cwd not found (${resolved.displayPath})`,
@@ -15459,6 +15779,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15459
15779
  "cwd",
15460
15780
  "weight",
15461
15781
  "target",
15782
+ "preprocessors",
15462
15783
  "required",
15463
15784
  "negate"
15464
15785
  ]);
@@ -15479,6 +15800,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15479
15800
  ...min_score2 !== void 0 ? { min_score: min_score2 } : {},
15480
15801
  ...negate !== void 0 ? { negate } : {},
15481
15802
  ...Object.keys(config2).length > 0 ? { config: config2 } : {},
15803
+ ...mergedPreprocessors ? { preprocessors: mergedPreprocessors } : {},
15482
15804
  ...targetConfig !== void 0 ? { target: targetConfig } : {}
15483
15805
  });
15484
15806
  continue;
@@ -15588,7 +15910,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15588
15910
  aggregatorPrompt = fileRef;
15589
15911
  const resolved = await resolveFileReference22(fileRef, searchRoots);
15590
15912
  if (resolved.resolvedPath) {
15591
- promptPath2 = path42.resolve(resolved.resolvedPath);
15913
+ promptPath2 = path5.resolve(resolved.resolvedPath);
15592
15914
  } else {
15593
15915
  throw new Error(
15594
15916
  `Composite aggregator in '${evalId}': prompt file not found: ${resolved.displayPath}`
@@ -16242,7 +16564,8 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16242
16564
  ...weight2 !== void 0 ? { weight: weight2 } : {},
16243
16565
  ...required2 !== void 0 ? { required: required2 } : {},
16244
16566
  ...min_score2 !== void 0 ? { min_score: min_score2 } : {},
16245
- ...negate !== void 0 ? { negate } : {}
16567
+ ...negate !== void 0 ? { negate } : {},
16568
+ ...mergedPreprocessors ? { preprocessors: mergedPreprocessors } : {}
16246
16569
  });
16247
16570
  continue;
16248
16571
  }
@@ -16267,7 +16590,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16267
16590
  const commandPath = commandArray[commandArray.length - 1];
16268
16591
  const resolved = await resolveFileReference22(commandPath, searchRoots);
16269
16592
  if (resolved.resolvedPath) {
16270
- resolvedPromptScript = [...commandArray.slice(0, -1), path42.resolve(resolved.resolvedPath)];
16593
+ resolvedPromptScript = [...commandArray.slice(0, -1), path5.resolve(resolved.resolvedPath)];
16271
16594
  } else {
16272
16595
  throw new Error(
16273
16596
  `Evaluator '${name21}' in '${evalId}': prompt command file not found: ${resolved.displayPath}`
@@ -16282,7 +16605,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16282
16605
  prompt = fileRef;
16283
16606
  const resolved = await resolveFileReference22(fileRef, searchRoots);
16284
16607
  if (resolved.resolvedPath) {
16285
- promptPath = path42.resolve(resolved.resolvedPath);
16608
+ promptPath = path5.resolve(resolved.resolvedPath);
16286
16609
  try {
16287
16610
  await validateCustomPromptContent(promptPath);
16288
16611
  } catch (error) {
@@ -16325,7 +16648,8 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16325
16648
  ...weight2 !== void 0 ? { weight: weight2 } : {},
16326
16649
  ...required2 !== void 0 ? { required: required2 } : {},
16327
16650
  ...min_score2 !== void 0 ? { min_score: min_score2 } : {},
16328
- ...negate !== void 0 ? { negate } : {}
16651
+ ...negate !== void 0 ? { negate } : {},
16652
+ ...mergedPreprocessors ? { preprocessors: mergedPreprocessors } : {}
16329
16653
  });
16330
16654
  continue;
16331
16655
  }
@@ -16350,7 +16674,8 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16350
16674
  "negate",
16351
16675
  "max_steps",
16352
16676
  "maxSteps",
16353
- "temperature"
16677
+ "temperature",
16678
+ "preprocessors"
16354
16679
  ]);
16355
16680
  const config = {};
16356
16681
  for (const [key, value] of Object.entries(rawEvaluator)) {
@@ -16380,30 +16705,70 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16380
16705
  ...negate !== void 0 ? { negate } : {},
16381
16706
  ...finalConfig ? { config: finalConfig } : {},
16382
16707
  ...llmMaxSteps !== void 0 ? { max_steps: llmMaxSteps } : {},
16383
- ...llmTemperature !== void 0 ? { temperature: llmTemperature } : {}
16708
+ ...llmTemperature !== void 0 ? { temperature: llmTemperature } : {},
16709
+ ...mergedPreprocessors ? { preprocessors: mergedPreprocessors } : {}
16384
16710
  });
16385
16711
  }
16386
16712
  return evaluators.length > 0 ? evaluators : void 0;
16387
16713
  }
16388
- var ASSERTION_TYPES = /* @__PURE__ */ new Set([
16389
- "skill-trigger",
16390
- "contains",
16391
- "contains-any",
16392
- "contains-all",
16393
- "icontains",
16394
- "icontains-any",
16395
- "icontains-all",
16396
- "starts-with",
16397
- "ends-with",
16398
- "regex",
16399
- "is-json",
16400
- "equals",
16401
- "rubrics"
16402
- ]);
16403
- function generateAssertionName(typeValue, rawEvaluator) {
16404
- if (!ASSERTION_TYPES.has(typeValue)) {
16714
+ async function parseMergedPreprocessors(rawValue, defaultPreprocessors, searchRoots, evaluatorName, evalId) {
16715
+ const parsedDefaults = defaultPreprocessors ?? [];
16716
+ const parsedOverrides = await parsePreprocessors(rawValue, searchRoots, evaluatorName, evalId);
16717
+ if (parsedDefaults.length === 0 && (!parsedOverrides || parsedOverrides.length === 0)) {
16718
+ return void 0;
16719
+ }
16720
+ const merged = /* @__PURE__ */ new Map();
16721
+ for (const entry of parsedDefaults) {
16722
+ merged.set(normalizePreprocessorType(entry.type), entry);
16723
+ }
16724
+ for (const entry of parsedOverrides ?? []) {
16725
+ merged.set(normalizePreprocessorType(entry.type), entry);
16726
+ }
16727
+ return [...merged.values()];
16728
+ }
16729
+ async function parsePreprocessors(rawValue, searchRoots, evaluatorName, evalId) {
16730
+ if (rawValue === void 0) {
16405
16731
  return void 0;
16406
16732
  }
16733
+ if (!Array.isArray(rawValue)) {
16734
+ throw new Error(`Evaluator '${evaluatorName}' in '${evalId}': preprocessors must be an array`);
16735
+ }
16736
+ const preprocessors = [];
16737
+ for (const rawEntry of rawValue) {
16738
+ if (!isJsonObject2(rawEntry)) {
16739
+ throw new Error(
16740
+ `Evaluator '${evaluatorName}' in '${evalId}': each preprocessor must be an object`
16741
+ );
16742
+ }
16743
+ const type = asString(rawEntry.type)?.trim();
16744
+ if (!type) {
16745
+ throw new Error(`Evaluator '${evaluatorName}' in '${evalId}': preprocessor.type is required`);
16746
+ }
16747
+ const command = asStringArray(
16748
+ rawEntry.command,
16749
+ `preprocessor command for evaluator '${evaluatorName}' in '${evalId}'`
16750
+ );
16751
+ if (!command || command.length === 0) {
16752
+ throw new Error(
16753
+ `Evaluator '${evaluatorName}' in '${evalId}': preprocessor '${type}' requires command`
16754
+ );
16755
+ }
16756
+ const commandPath = command[command.length - 1];
16757
+ const resolved = await resolveFileReference22(commandPath, searchRoots);
16758
+ if (!resolved.resolvedPath) {
16759
+ throw new Error(
16760
+ `Evaluator '${evaluatorName}' in '${evalId}': preprocessor command file not found: ${resolved.displayPath}`
16761
+ );
16762
+ }
16763
+ preprocessors.push({
16764
+ type,
16765
+ command,
16766
+ resolvedCommand: [...command.slice(0, -1), path5.resolve(resolved.resolvedPath)]
16767
+ });
16768
+ }
16769
+ return preprocessors;
16770
+ }
16771
+ function generateAssertionName(typeValue, rawEvaluator) {
16407
16772
  const value = asString(rawEvaluator.value);
16408
16773
  const arrayValue = Array.isArray(rawEvaluator.value) ? rawEvaluator.value : void 0;
16409
16774
  switch (typeValue) {
@@ -16436,7 +16801,7 @@ function generateAssertionName(typeValue, rawEvaluator) {
16436
16801
  case "rubrics":
16437
16802
  return "rubrics";
16438
16803
  default:
16439
- return void 0;
16804
+ return typeValue;
16440
16805
  }
16441
16806
  }
16442
16807
  function coerceEvaluator(candidate, contextId) {
@@ -16853,7 +17218,7 @@ var IMAGE_MEDIA_TYPES = {
16853
17218
  ".bmp": "image/bmp"
16854
17219
  };
16855
17220
  function detectImageMediaType(filePath) {
16856
- const ext = path5.extname(filePath).toLowerCase();
17221
+ const ext = path6.extname(filePath).toLowerCase();
16857
17222
  return IMAGE_MEDIA_TYPES[ext];
16858
17223
  }
16859
17224
  var ANSI_YELLOW4 = "\x1B[33m";
@@ -16903,12 +17268,12 @@ async function processMessages(options) {
16903
17268
  continue;
16904
17269
  }
16905
17270
  try {
16906
- const fileContent = (await readFile4(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
17271
+ const fileContent = (await readFile5(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
16907
17272
  processedContent.push({
16908
17273
  ...cloneJsonObject(rawSegment),
16909
17274
  path: displayPath,
16910
17275
  text: fileContent,
16911
- resolvedPath: path5.resolve(resolvedPath)
17276
+ resolvedPath: path6.resolve(resolvedPath)
16912
17277
  });
16913
17278
  if (verbose) {
16914
17279
  const label = messageType === "input" ? "[File]" : "[Expected Output File]";
@@ -16944,7 +17309,7 @@ async function processMessages(options) {
16944
17309
  continue;
16945
17310
  }
16946
17311
  try {
16947
- const imageBuffer = await readFile4(resolvedPath);
17312
+ const imageBuffer = await readFile5(resolvedPath);
16948
17313
  const base64 = imageBuffer.toString("base64");
16949
17314
  processedContent.push({
16950
17315
  type: "image",
@@ -17021,12 +17386,12 @@ async function processExpectedMessages(options) {
17021
17386
  continue;
17022
17387
  }
17023
17388
  try {
17024
- const fileContent = (await readFile4(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
17389
+ const fileContent = (await readFile5(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
17025
17390
  processedContent.push({
17026
17391
  type: "file",
17027
17392
  path: displayPath,
17028
17393
  text: fileContent,
17029
- resolvedPath: path5.resolve(resolvedPath)
17394
+ resolvedPath: path6.resolve(resolvedPath)
17030
17395
  });
17031
17396
  if (verbose) {
17032
17397
  console.log(` [Expected Output File] Found: ${displayPath}`);
@@ -17061,7 +17426,7 @@ async function processExpectedMessages(options) {
17061
17426
  continue;
17062
17427
  }
17063
17428
  try {
17064
- const imageBuffer = await readFile4(resolvedPath);
17429
+ const imageBuffer = await readFile5(resolvedPath);
17065
17430
  const base64 = imageBuffer.toString("base64");
17066
17431
  processedContent.push({
17067
17432
  type: "image",
@@ -17166,7 +17531,7 @@ function matchesFilter(id, filter2) {
17166
17531
  return typeof filter2 === "string" ? micromatch.isMatch(id, filter2) : filter2.some((pattern) => micromatch.isMatch(id, pattern));
17167
17532
  }
17168
17533
  function detectFormat(filePath) {
17169
- const ext = path6.extname(filePath).toLowerCase();
17534
+ const ext = path7.extname(filePath).toLowerCase();
17170
17535
  if (ext === ".jsonl") return "jsonl";
17171
17536
  if (ext === ".yaml" || ext === ".yml") return "yaml";
17172
17537
  if (ext === ".json") return "agent-skills-json";
@@ -17175,9 +17540,9 @@ function detectFormat(filePath) {
17175
17540
  );
17176
17541
  }
17177
17542
  async function loadSidecarMetadata(jsonlPath, verbose) {
17178
- const dir = path6.dirname(jsonlPath);
17179
- const base = path6.basename(jsonlPath, ".jsonl");
17180
- const sidecarPath = path6.join(dir, `${base}.yaml`);
17543
+ const dir = path7.dirname(jsonlPath);
17544
+ const base = path7.basename(jsonlPath, ".jsonl");
17545
+ const sidecarPath = path7.join(dir, `${base}.yaml`);
17181
17546
  if (!await fileExists2(sidecarPath)) {
17182
17547
  if (verbose) {
17183
17548
  logWarning4(`Sidecar metadata file not found: ${sidecarPath} (using defaults)`);
@@ -17185,7 +17550,7 @@ async function loadSidecarMetadata(jsonlPath, verbose) {
17185
17550
  return {};
17186
17551
  }
17187
17552
  try {
17188
- const content = await readFile5(sidecarPath, "utf8");
17553
+ const content = await readFile6(sidecarPath, "utf8");
17189
17554
  const parsed = interpolateEnv(parseYaml2(content), process.env);
17190
17555
  if (!isJsonObject(parsed)) {
17191
17556
  logWarning4(`Invalid sidecar metadata format in ${sidecarPath}`);
@@ -17226,13 +17591,13 @@ function parseJsonlContent(content, filePath) {
17226
17591
  async function loadTestsFromJsonl(evalFilePath, repoRoot, options) {
17227
17592
  const verbose = options?.verbose ?? false;
17228
17593
  const filterPattern = options?.filter;
17229
- const absoluteTestPath = path6.resolve(evalFilePath);
17594
+ const absoluteTestPath = path7.resolve(evalFilePath);
17230
17595
  const repoRootPath = resolveToAbsolutePath(repoRoot);
17231
17596
  const searchRoots = buildSearchRoots2(absoluteTestPath, repoRootPath);
17232
17597
  const sidecar = await loadSidecarMetadata(absoluteTestPath, verbose);
17233
- const rawFile = await readFile5(absoluteTestPath, "utf8");
17598
+ const rawFile = await readFile6(absoluteTestPath, "utf8");
17234
17599
  const rawCases = parseJsonlContent(rawFile, evalFilePath);
17235
- const fallbackSuiteName = path6.basename(absoluteTestPath, ".jsonl") || "eval";
17600
+ const fallbackSuiteName = path7.basename(absoluteTestPath, ".jsonl") || "eval";
17236
17601
  const suiteName = sidecar.name && sidecar.name.trim().length > 0 ? sidecar.name : fallbackSuiteName;
17237
17602
  const globalEvaluator = coerceEvaluator(sidecar.evaluator, "sidecar") ?? "llm-grader";
17238
17603
  const globalExecution = sidecar.execution;
@@ -17582,8 +17947,8 @@ function resolveTests(suite) {
17582
17947
  }
17583
17948
  async function readTestSuiteMetadata(testFilePath) {
17584
17949
  try {
17585
- const absolutePath = path7.resolve(testFilePath);
17586
- const content = await readFile6(absolutePath, "utf8");
17950
+ const absolutePath = path8.resolve(testFilePath);
17951
+ const content = await readFile7(absolutePath, "utf8");
17587
17952
  const parsed = interpolateEnv(parse2(content), process.env);
17588
17953
  if (!isJsonObject(parsed)) {
17589
17954
  return {};
@@ -17637,25 +18002,31 @@ var loadEvalCases = loadTests;
17637
18002
  async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
17638
18003
  const verbose = options?.verbose ?? false;
17639
18004
  const filterPattern = options?.filter;
17640
- const absoluteTestPath = path7.resolve(evalFilePath);
18005
+ const absoluteTestPath = path8.resolve(evalFilePath);
17641
18006
  const repoRootPath = resolveToAbsolutePath(repoRoot);
17642
18007
  const searchRoots = buildSearchRoots2(absoluteTestPath, repoRootPath);
17643
18008
  const config = await loadConfig(absoluteTestPath, repoRootPath);
17644
- const rawFile = await readFile6(absoluteTestPath, "utf8");
18009
+ const rawFile = await readFile7(absoluteTestPath, "utf8");
17645
18010
  const interpolated = interpolateEnv(parse2(rawFile), process.env);
17646
18011
  if (!isJsonObject(interpolated)) {
17647
18012
  throw new Error(`Invalid test file format: ${evalFilePath}`);
17648
18013
  }
17649
18014
  const suite = interpolated;
17650
18015
  const suiteNameFromFile = asString5(suite.name)?.trim();
17651
- const fallbackSuiteName = path7.basename(absoluteTestPath).replace(/\.eval\.ya?ml$/i, "").replace(/\.ya?ml$/i, "") || "eval";
18016
+ const fallbackSuiteName = path8.basename(absoluteTestPath).replace(/\.eval\.ya?ml$/i, "").replace(/\.ya?ml$/i, "") || "eval";
17652
18017
  const suiteName = suiteNameFromFile && suiteNameFromFile.length > 0 ? suiteNameFromFile : fallbackSuiteName;
17653
18018
  const rawTestCases = resolveTests(suite);
17654
18019
  const globalEvaluator = coerceEvaluator(suite.evaluator, "global") ?? "llm-grader";
17655
- const evalFileDir = path7.dirname(absoluteTestPath);
18020
+ const suitePreprocessors = await parsePreprocessors(
18021
+ suite.preprocessors,
18022
+ searchRoots,
18023
+ "<suite>",
18024
+ absoluteTestPath
18025
+ );
18026
+ const evalFileDir = path8.dirname(absoluteTestPath);
17656
18027
  let expandedTestCases;
17657
18028
  if (typeof rawTestCases === "string") {
17658
- const externalPath = path7.resolve(evalFileDir, rawTestCases);
18029
+ const externalPath = path8.resolve(evalFileDir, rawTestCases);
17659
18030
  expandedTestCases = await loadCasesFromFile(externalPath);
17660
18031
  } else if (Array.isArray(rawTestCases)) {
17661
18032
  expandedTestCases = await expandFileReferences(rawTestCases, evalFileDir);
@@ -17753,7 +18124,8 @@ async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
17753
18124
  testCaseConfig,
17754
18125
  globalExecution,
17755
18126
  searchRoots,
17756
- id ?? "unknown"
18127
+ id ?? "unknown",
18128
+ suitePreprocessors
17757
18129
  );
17758
18130
  } catch (error) {
17759
18131
  const message = error instanceof Error ? error.message : String(error);
@@ -17786,6 +18158,7 @@ async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
17786
18158
  criteria: outcome ?? "",
17787
18159
  evaluator: testCaseEvaluatorKind,
17788
18160
  assertions: evaluators,
18161
+ ...suitePreprocessors ? { preprocessors: suitePreprocessors } : {},
17789
18162
  workspace: mergedWorkspace,
17790
18163
  metadata,
17791
18164
  targets: caseTargets,
@@ -17826,8 +18199,8 @@ function parseWorkspaceScriptConfig(raw, evalFileDir) {
17826
18199
  if (!command) return void 0;
17827
18200
  const timeoutMs = typeof obj.timeout_ms === "number" ? obj.timeout_ms : void 0;
17828
18201
  let cwd = typeof obj.cwd === "string" ? obj.cwd : void 0;
17829
- if (cwd && !path7.isAbsolute(cwd)) {
17830
- cwd = path7.resolve(evalFileDir, cwd);
18202
+ if (cwd && !path8.isAbsolute(cwd)) {
18203
+ cwd = path8.resolve(evalFileDir, cwd);
17831
18204
  }
17832
18205
  const config = { command };
17833
18206
  if (timeoutMs !== void 0) {
@@ -17865,10 +18238,10 @@ function parseWorkspaceHooksConfig(raw, evalFileDir) {
17865
18238
  }
17866
18239
  async function resolveWorkspaceConfig(raw, evalFileDir) {
17867
18240
  if (typeof raw === "string") {
17868
- const workspaceFilePath = path7.resolve(evalFileDir, raw);
18241
+ const workspaceFilePath = path8.resolve(evalFileDir, raw);
17869
18242
  let content;
17870
18243
  try {
17871
- content = await readFile6(workspaceFilePath, "utf8");
18244
+ content = await readFile7(workspaceFilePath, "utf8");
17872
18245
  } catch {
17873
18246
  throw new Error(`Workspace file not found: ${raw} (resolved to ${workspaceFilePath})`);
17874
18247
  }
@@ -17878,7 +18251,7 @@ async function resolveWorkspaceConfig(raw, evalFileDir) {
17878
18251
  `Invalid workspace file format: ${workspaceFilePath} (expected a YAML object)`
17879
18252
  );
17880
18253
  }
17881
- const workspaceFileDir = path7.dirname(workspaceFilePath);
18254
+ const workspaceFileDir = path8.dirname(workspaceFilePath);
17882
18255
  return parseWorkspaceConfig(parsed, workspaceFileDir);
17883
18256
  }
17884
18257
  return parseWorkspaceConfig(raw, evalFileDir);
@@ -17898,8 +18271,8 @@ function parseWorkspaceConfig(raw, evalFileDir) {
17898
18271
  throw new Error("workspace.static has been removed. Use workspace.mode='static'.");
17899
18272
  }
17900
18273
  let template = typeof obj.template === "string" ? obj.template : void 0;
17901
- if (template && !path7.isAbsolute(template)) {
17902
- template = path7.resolve(evalFileDir, template);
18274
+ if (template && !path8.isAbsolute(template)) {
18275
+ template = path8.resolve(evalFileDir, template);
17903
18276
  }
17904
18277
  const isolation = obj.isolation === "shared" || obj.isolation === "per_test" ? obj.isolation : void 0;
17905
18278
  const repos = Array.isArray(obj.repos) ? obj.repos.map(parseRepoConfig).filter(Boolean) : void 0;
@@ -18206,7 +18579,7 @@ function transpileEvalYaml(suite, source = "EVAL.yaml") {
18206
18579
  function transpileEvalYamlFile(evalYamlPath) {
18207
18580
  const content = readFileSync(evalYamlPath, "utf8");
18208
18581
  const parsed = parse3(content);
18209
- return transpileEvalYaml(parsed, path8.basename(evalYamlPath));
18582
+ return transpileEvalYaml(parsed, path9.basename(evalYamlPath));
18210
18583
  }
18211
18584
  function getOutputFilenames(result) {
18212
18585
  const names = /* @__PURE__ */ new Map();
@@ -18738,7 +19111,7 @@ function normalizeInputFiles(inputFiles) {
18738
19111
  }
18739
19112
  const deduped = /* @__PURE__ */ new Map();
18740
19113
  for (const inputFile of inputFiles) {
18741
- const absolutePath = path9.resolve(inputFile);
19114
+ const absolutePath = path10.resolve(inputFile);
18742
19115
  if (!deduped.has(absolutePath)) {
18743
19116
  deduped.set(absolutePath, absolutePath);
18744
19117
  }
@@ -18751,7 +19124,7 @@ function collectInputFiles(inputFiles) {
18751
19124
  }
18752
19125
  const unique = /* @__PURE__ */ new Map();
18753
19126
  for (const inputFile of inputFiles) {
18754
- const absolutePath = path9.resolve(inputFile);
19127
+ const absolutePath = path10.resolve(inputFile);
18755
19128
  if (!unique.has(absolutePath)) {
18756
19129
  unique.set(absolutePath, absolutePath);
18757
19130
  }
@@ -18763,7 +19136,7 @@ function buildMandatoryPrereadBlock(inputFiles) {
18763
19136
  return "";
18764
19137
  }
18765
19138
  const buildList = (files) => files.map((absolutePath) => {
18766
- const fileName = path9.basename(absolutePath);
19139
+ const fileName = path10.basename(absolutePath);
18767
19140
  const fileUri = pathToFileUri(absolutePath);
18768
19141
  return `* [${fileName}](${fileUri})`;
18769
19142
  });
@@ -18779,7 +19152,7 @@ ${buildList(inputFiles).join("\n")}.`);
18779
19152
  return sections.join("\n");
18780
19153
  }
18781
19154
  function pathToFileUri(filePath) {
18782
- const absolutePath = path9.isAbsolute(filePath) ? filePath : path9.resolve(filePath);
19155
+ const absolutePath = path10.isAbsolute(filePath) ? filePath : path10.resolve(filePath);
18783
19156
  const normalizedPath = absolutePath.replace(/\\/g, "/");
18784
19157
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
18785
19158
  return `file:///${normalizedPath}`;
@@ -18925,10 +19298,10 @@ var ClaudeCliProvider = class {
18925
19298
  }
18926
19299
  resolveCwd(cwdOverride) {
18927
19300
  if (cwdOverride) {
18928
- return path10.resolve(cwdOverride);
19301
+ return path11.resolve(cwdOverride);
18929
19302
  }
18930
19303
  if (this.config.cwd) {
18931
- return path10.resolve(this.config.cwd);
19304
+ return path11.resolve(this.config.cwd);
18932
19305
  }
18933
19306
  return void 0;
18934
19307
  }
@@ -18938,9 +19311,9 @@ var ClaudeCliProvider = class {
18938
19311
  return void 0;
18939
19312
  }
18940
19313
  if (this.config.logDir) {
18941
- return path10.resolve(this.config.logDir);
19314
+ return path11.resolve(this.config.logDir);
18942
19315
  }
18943
- return path10.join(process.cwd(), ".agentv", "logs", "claude-cli");
19316
+ return path11.join(process.cwd(), ".agentv", "logs", "claude-cli");
18944
19317
  }
18945
19318
  async createStreamLogger(request) {
18946
19319
  const logDir = this.resolveLogDirectory();
@@ -18954,7 +19327,7 @@ var ClaudeCliProvider = class {
18954
19327
  console.warn(`Skipping Claude CLI stream logging (could not create ${logDir}): ${message}`);
18955
19328
  return void 0;
18956
19329
  }
18957
- const filePath = path10.join(logDir, buildLogFilename(request, this.targetName));
19330
+ const filePath = path11.join(logDir, buildLogFilename(request, this.targetName));
18958
19331
  try {
18959
19332
  const logger = await ClaudeCliStreamLogger.create({
18960
19333
  filePath,
@@ -19411,10 +19784,10 @@ var ClaudeSdkProvider = class {
19411
19784
  }
19412
19785
  resolveCwd(cwdOverride) {
19413
19786
  if (cwdOverride) {
19414
- return path11.resolve(cwdOverride);
19787
+ return path12.resolve(cwdOverride);
19415
19788
  }
19416
19789
  if (this.config.cwd) {
19417
- return path11.resolve(this.config.cwd);
19790
+ return path12.resolve(this.config.cwd);
19418
19791
  }
19419
19792
  return void 0;
19420
19793
  }
@@ -19424,9 +19797,9 @@ var ClaudeSdkProvider = class {
19424
19797
  return void 0;
19425
19798
  }
19426
19799
  if (this.config.logDir) {
19427
- return path11.resolve(this.config.logDir);
19800
+ return path12.resolve(this.config.logDir);
19428
19801
  }
19429
- return path11.join(process.cwd(), ".agentv", "logs", "claude");
19802
+ return path12.join(process.cwd(), ".agentv", "logs", "claude");
19430
19803
  }
19431
19804
  async createStreamLogger(request) {
19432
19805
  const logDir = this.resolveLogDirectory();
@@ -19440,7 +19813,7 @@ var ClaudeSdkProvider = class {
19440
19813
  console.warn(`Skipping Claude stream logging (could not create ${logDir}): ${message}`);
19441
19814
  return void 0;
19442
19815
  }
19443
- const filePath = path11.join(logDir, buildLogFilename2(request, this.targetName));
19816
+ const filePath = path12.join(logDir, buildLogFilename2(request, this.targetName));
19444
19817
  try {
19445
19818
  const logger = await ClaudeStreamLogger.create({
19446
19819
  filePath,
@@ -20123,7 +20496,7 @@ function normalizeInputFiles2(inputFiles) {
20123
20496
  }
20124
20497
  const unique = /* @__PURE__ */ new Map();
20125
20498
  for (const inputFile of inputFiles) {
20126
- const absolutePath = path12.resolve(inputFile);
20499
+ const absolutePath = path13.resolve(inputFile);
20127
20500
  if (!unique.has(absolutePath)) {
20128
20501
  unique.set(absolutePath, absolutePath);
20129
20502
  }
@@ -20137,7 +20510,7 @@ function formatFileList(files, template) {
20137
20510
  const formatter = template ?? "{path}";
20138
20511
  return files.map((filePath) => {
20139
20512
  const escapedPath = shellEscape(filePath);
20140
- const escapedName = shellEscape(path12.basename(filePath));
20513
+ const escapedName = shellEscape(path13.basename(filePath));
20141
20514
  return formatter.replaceAll("{path}", escapedPath).replaceAll("{basename}", escapedName);
20142
20515
  }).join(" ");
20143
20516
  }
@@ -20161,7 +20534,7 @@ function generateOutputFilePath(evalCaseId, extension = ".json") {
20161
20534
  const safeEvalId = evalCaseId || "unknown";
20162
20535
  const timestamp = Date.now();
20163
20536
  const random = Math.random().toString(36).substring(2, 9);
20164
- return path12.join(os.tmpdir(), `agentv-${safeEvalId}-${timestamp}-${random}${extension}`);
20537
+ return path13.join(os.tmpdir(), `agentv-${safeEvalId}-${timestamp}-${random}${extension}`);
20165
20538
  }
20166
20539
  function formatTimeoutSuffix2(timeoutMs) {
20167
20540
  if (!timeoutMs || timeoutMs <= 0) {
@@ -20400,10 +20773,10 @@ ${basePrompt}` : basePrompt;
20400
20773
  }
20401
20774
  resolveCwd(cwdOverride) {
20402
20775
  if (cwdOverride) {
20403
- return path13.resolve(cwdOverride);
20776
+ return path14.resolve(cwdOverride);
20404
20777
  }
20405
20778
  if (this.config.cwd) {
20406
- return path13.resolve(this.config.cwd);
20779
+ return path14.resolve(this.config.cwd);
20407
20780
  }
20408
20781
  return void 0;
20409
20782
  }
@@ -20413,9 +20786,9 @@ ${basePrompt}` : basePrompt;
20413
20786
  return void 0;
20414
20787
  }
20415
20788
  if (this.config.logDir) {
20416
- return path13.resolve(this.config.logDir);
20789
+ return path14.resolve(this.config.logDir);
20417
20790
  }
20418
- return path13.join(process.cwd(), ".agentv", "logs", "codex");
20791
+ return path14.join(process.cwd(), ".agentv", "logs", "codex");
20419
20792
  }
20420
20793
  async createStreamLogger(request) {
20421
20794
  const logDir = this.resolveLogDirectory();
@@ -20429,7 +20802,7 @@ ${basePrompt}` : basePrompt;
20429
20802
  console.warn(`Skipping Codex SDK stream logging (could not create ${logDir}): ${message}`);
20430
20803
  return void 0;
20431
20804
  }
20432
- const filePath = path13.join(logDir, buildLogFilename3(request, this.targetName));
20805
+ const filePath = path14.join(logDir, buildLogFilename3(request, this.targetName));
20433
20806
  try {
20434
20807
  const logger = await CodexSdkStreamLogger.create({
20435
20808
  filePath,
@@ -20641,8 +21014,8 @@ function resolvePlatformCliPath() {
20641
21014
  const binaryName = os3 === "win32" ? "copilot.exe" : "copilot";
20642
21015
  try {
20643
21016
  const resolved = import.meta.resolve(`${packageName}/package.json`);
20644
- const packageJsonPath = resolved.startsWith("file:") ? fileURLToPath2(resolved) : resolved;
20645
- const binaryPath = path14.join(path14.dirname(packageJsonPath), binaryName);
21017
+ const packageJsonPath = resolved.startsWith("file:") ? fileURLToPath3(resolved) : resolved;
21018
+ const binaryPath = path15.join(path15.dirname(packageJsonPath), binaryName);
20646
21019
  if (existsSync(binaryPath)) {
20647
21020
  return binaryPath;
20648
21021
  }
@@ -20650,7 +21023,7 @@ function resolvePlatformCliPath() {
20650
21023
  }
20651
21024
  let searchDir = process.cwd();
20652
21025
  for (let i = 0; i < 10; i++) {
20653
- const standardPath = path14.join(
21026
+ const standardPath = path15.join(
20654
21027
  searchDir,
20655
21028
  "node_modules",
20656
21029
  ...packageName.split("/"),
@@ -20659,13 +21032,13 @@ function resolvePlatformCliPath() {
20659
21032
  if (existsSync(standardPath)) {
20660
21033
  return standardPath;
20661
21034
  }
20662
- const bunDir = path14.join(searchDir, "node_modules", ".bun");
21035
+ const bunDir = path15.join(searchDir, "node_modules", ".bun");
20663
21036
  const prefix = `@github+copilot-${osPart}-${archPart}@`;
20664
21037
  try {
20665
21038
  const entries = readdirSync(bunDir);
20666
21039
  for (const entry of entries) {
20667
21040
  if (entry.startsWith(prefix)) {
20668
- const candidate = path14.join(
21041
+ const candidate = path15.join(
20669
21042
  bunDir,
20670
21043
  entry,
20671
21044
  "node_modules",
@@ -20680,7 +21053,7 @@ function resolvePlatformCliPath() {
20680
21053
  }
20681
21054
  } catch {
20682
21055
  }
20683
- const parent = path14.dirname(searchDir);
21056
+ const parent = path15.dirname(searchDir);
20684
21057
  if (parent === searchDir) break;
20685
21058
  searchDir = parent;
20686
21059
  }
@@ -21022,10 +21395,10 @@ var CopilotCliProvider = class {
21022
21395
  }
21023
21396
  resolveCwd(cwdOverride) {
21024
21397
  if (cwdOverride) {
21025
- return path15.resolve(cwdOverride);
21398
+ return path16.resolve(cwdOverride);
21026
21399
  }
21027
21400
  if (this.config.cwd) {
21028
- return path15.resolve(this.config.cwd);
21401
+ return path16.resolve(this.config.cwd);
21029
21402
  }
21030
21403
  return void 0;
21031
21404
  }
@@ -21044,9 +21417,9 @@ var CopilotCliProvider = class {
21044
21417
  return void 0;
21045
21418
  }
21046
21419
  if (this.config.logDir) {
21047
- return path15.resolve(this.config.logDir);
21420
+ return path16.resolve(this.config.logDir);
21048
21421
  }
21049
- return path15.join(process.cwd(), ".agentv", "logs", "copilot-cli");
21422
+ return path16.join(process.cwd(), ".agentv", "logs", "copilot-cli");
21050
21423
  }
21051
21424
  async createStreamLogger(request) {
21052
21425
  const logDir = this.resolveLogDirectory();
@@ -21060,7 +21433,7 @@ var CopilotCliProvider = class {
21060
21433
  console.warn(`Skipping Copilot CLI stream logging (could not create ${logDir}): ${message}`);
21061
21434
  return void 0;
21062
21435
  }
21063
- const filePath = path15.join(logDir, buildLogFilename4(request, this.targetName, "copilot-cli"));
21436
+ const filePath = path16.join(logDir, buildLogFilename4(request, this.targetName, "copilot-cli"));
21064
21437
  try {
21065
21438
  const logger = await CopilotStreamLogger.create(
21066
21439
  {
@@ -21278,7 +21651,7 @@ function parseCopilotEvents(eventsJsonl) {
21278
21651
  durationMs
21279
21652
  };
21280
21653
  }
21281
- var DEFAULT_SESSION_STATE_DIR = () => path16.join(homedir(), ".copilot", "session-state");
21654
+ var DEFAULT_SESSION_STATE_DIR = () => path17.join(homedir(), ".copilot", "session-state");
21282
21655
  async function discoverCopilotSessions(opts) {
21283
21656
  const sessionStateDir = opts?.sessionStateDir ?? DEFAULT_SESSION_STATE_DIR();
21284
21657
  const limit = opts?.limit ?? 10;
@@ -21290,11 +21663,11 @@ async function discoverCopilotSessions(opts) {
21290
21663
  }
21291
21664
  const sessions = [];
21292
21665
  for (const entry of entries) {
21293
- const sessionDir = path16.join(sessionStateDir, entry);
21294
- const workspacePath = path16.join(sessionDir, "workspace.yaml");
21295
- const eventsPath = path16.join(sessionDir, "events.jsonl");
21666
+ const sessionDir = path17.join(sessionStateDir, entry);
21667
+ const workspacePath = path17.join(sessionDir, "workspace.yaml");
21668
+ const eventsPath = path17.join(sessionDir, "events.jsonl");
21296
21669
  try {
21297
- const workspaceContent = await readFile7(workspacePath, "utf8");
21670
+ const workspaceContent = await readFile8(workspacePath, "utf8");
21298
21671
  const workspace = parseYaml22(workspaceContent) ?? {};
21299
21672
  const cwd = String(workspace.cwd ?? "");
21300
21673
  let updatedAt;
@@ -21351,10 +21724,10 @@ var CopilotLogProvider = class {
21351
21724
  }
21352
21725
  async invoke(_request) {
21353
21726
  const sessionDir = await this.resolveSessionDir();
21354
- const eventsPath = path17.join(sessionDir, "events.jsonl");
21727
+ const eventsPath = path18.join(sessionDir, "events.jsonl");
21355
21728
  let eventsContent;
21356
21729
  try {
21357
- eventsContent = await readFile8(eventsPath, "utf8");
21730
+ eventsContent = await readFile9(eventsPath, "utf8");
21358
21731
  } catch (err) {
21359
21732
  throw new Error(
21360
21733
  `Failed to read Copilot session transcript at ${eventsPath}: ${err instanceof Error ? err.message : String(err)}`
@@ -21373,8 +21746,8 @@ var CopilotLogProvider = class {
21373
21746
  return this.config.sessionDir;
21374
21747
  }
21375
21748
  if (this.config.sessionId) {
21376
- const stateDir = this.config.sessionStateDir ?? path17.join(homedir2(), ".copilot", "session-state");
21377
- return path17.join(stateDir, this.config.sessionId);
21749
+ const stateDir = this.config.sessionStateDir ?? path18.join(homedir2(), ".copilot", "session-state");
21750
+ return path18.join(stateDir, this.config.sessionId);
21378
21751
  }
21379
21752
  if (this.config.discover === "latest") {
21380
21753
  const sessions = await discoverCopilotSessions({
@@ -21699,10 +22072,10 @@ var CopilotSdkProvider = class {
21699
22072
  }
21700
22073
  resolveCwd(cwdOverride) {
21701
22074
  if (cwdOverride) {
21702
- return path18.resolve(cwdOverride);
22075
+ return path19.resolve(cwdOverride);
21703
22076
  }
21704
22077
  if (this.config.cwd) {
21705
- return path18.resolve(this.config.cwd);
22078
+ return path19.resolve(this.config.cwd);
21706
22079
  }
21707
22080
  return void 0;
21708
22081
  }
@@ -21711,9 +22084,9 @@ var CopilotSdkProvider = class {
21711
22084
  return void 0;
21712
22085
  }
21713
22086
  if (this.config.logDir) {
21714
- return path18.resolve(this.config.logDir);
22087
+ return path19.resolve(this.config.logDir);
21715
22088
  }
21716
- return path18.join(process.cwd(), ".agentv", "logs", "copilot-sdk");
22089
+ return path19.join(process.cwd(), ".agentv", "logs", "copilot-sdk");
21717
22090
  }
21718
22091
  async createStreamLogger(request) {
21719
22092
  const logDir = this.resolveLogDirectory();
@@ -21727,7 +22100,7 @@ var CopilotSdkProvider = class {
21727
22100
  console.warn(`Skipping Copilot SDK stream logging (could not create ${logDir}): ${message}`);
21728
22101
  return void 0;
21729
22102
  }
21730
- const filePath = path18.join(logDir, buildLogFilename4(request, this.targetName, "copilot-sdk"));
22103
+ const filePath = path19.join(logDir, buildLogFilename4(request, this.targetName, "copilot-sdk"));
21731
22104
  try {
21732
22105
  const logger = await CopilotStreamLogger.create(
21733
22106
  {
@@ -21756,9 +22129,9 @@ var CopilotSdkProvider = class {
21756
22129
  };
21757
22130
  function resolveSkillDirectories(cwd) {
21758
22131
  const candidates = [
21759
- path18.join(cwd, ".claude", "skills"),
21760
- path18.join(cwd, ".agents", "skills"),
21761
- path18.join(cwd, ".codex", "skills")
22132
+ path19.join(cwd, ".claude", "skills"),
22133
+ path19.join(cwd, ".agents", "skills"),
22134
+ path19.join(cwd, ".codex", "skills")
21762
22135
  ];
21763
22136
  return candidates.filter((dir) => existsSync2(dir));
21764
22137
  }
@@ -22030,7 +22403,7 @@ var PiCliProvider = class {
22030
22403
  const cwd = this.resolveCwd(workspaceRoot, request.cwd);
22031
22404
  const logger = await this.createStreamLogger(request).catch(() => void 0);
22032
22405
  try {
22033
- const promptFile = path19.join(cwd, PROMPT_FILENAME);
22406
+ const promptFile = path20.join(cwd, PROMPT_FILENAME);
22034
22407
  await writeFile(promptFile, request.question, "utf8");
22035
22408
  const args = this.buildPiArgs(request.question, inputFiles);
22036
22409
  const result = await this.executePi(args, cwd, request.signal, logger);
@@ -22093,10 +22466,10 @@ var PiCliProvider = class {
22093
22466
  }
22094
22467
  resolveCwd(workspaceRoot, cwdOverride) {
22095
22468
  if (cwdOverride) {
22096
- return path19.resolve(cwdOverride);
22469
+ return path20.resolve(cwdOverride);
22097
22470
  }
22098
22471
  if (this.config.cwd) {
22099
- return path19.resolve(this.config.cwd);
22472
+ return path20.resolve(this.config.cwd);
22100
22473
  }
22101
22474
  if (workspaceRoot) {
22102
22475
  return workspaceRoot;
@@ -22202,7 +22575,7 @@ ${prompt}` : prompt;
22202
22575
  return env;
22203
22576
  }
22204
22577
  async createWorkspace() {
22205
- return await mkdtemp(path19.join(tmpdir(), WORKSPACE_PREFIX));
22578
+ return await mkdtemp(path20.join(tmpdir(), WORKSPACE_PREFIX));
22206
22579
  }
22207
22580
  async cleanupWorkspace(workspaceRoot) {
22208
22581
  try {
@@ -22212,9 +22585,9 @@ ${prompt}` : prompt;
22212
22585
  }
22213
22586
  resolveLogDirectory() {
22214
22587
  if (this.config.logDir) {
22215
- return path19.resolve(this.config.logDir);
22588
+ return path20.resolve(this.config.logDir);
22216
22589
  }
22217
- return path19.join(process.cwd(), ".agentv", "logs", "pi-cli");
22590
+ return path20.join(process.cwd(), ".agentv", "logs", "pi-cli");
22218
22591
  }
22219
22592
  async createStreamLogger(request) {
22220
22593
  const logDir = this.resolveLogDirectory();
@@ -22228,7 +22601,7 @@ ${prompt}` : prompt;
22228
22601
  console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
22229
22602
  return void 0;
22230
22603
  }
22231
- const filePath = path19.join(logDir, buildLogFilename5(request, this.targetName));
22604
+ const filePath = path20.join(logDir, buildLogFilename5(request, this.targetName));
22232
22605
  try {
22233
22606
  const logger = await PiStreamLogger.create({
22234
22607
  filePath,
@@ -22699,8 +23072,8 @@ function resolveWindowsCmd(executable) {
22699
23072
  const content = readFileSync2(cmdPath, "utf-8");
22700
23073
  const match = content.match(/"?%_prog%"?\s+"([^"]+\.js)"/);
22701
23074
  if (match) {
22702
- const dp0 = path19.dirname(path19.resolve(cmdPath));
22703
- const scriptPath = match[1].replace(/%dp0%[/\\]?/gi, `${dp0}${path19.sep}`);
23075
+ const dp0 = path20.dirname(path20.resolve(cmdPath));
23076
+ const scriptPath = match[1].replace(/%dp0%[/\\]?/gi, `${dp0}${path20.sep}`);
22704
23077
  try {
22705
23078
  accessSync(scriptPath);
22706
23079
  return ["node", [scriptPath]];
@@ -22783,19 +23156,19 @@ function getAgentvHome() {
22783
23156
  }
22784
23157
  return envHome;
22785
23158
  }
22786
- return path20.join(os2.homedir(), ".agentv");
23159
+ return path21.join(os2.homedir(), ".agentv");
22787
23160
  }
22788
23161
  function getWorkspacesRoot() {
22789
- return path20.join(getAgentvHome(), "workspaces");
23162
+ return path21.join(getAgentvHome(), "workspaces");
22790
23163
  }
22791
23164
  function getSubagentsRoot() {
22792
- return path20.join(getAgentvHome(), "subagents");
23165
+ return path21.join(getAgentvHome(), "subagents");
22793
23166
  }
22794
23167
  function getTraceStateRoot() {
22795
- return path20.join(getAgentvHome(), "trace-state");
23168
+ return path21.join(getAgentvHome(), "trace-state");
22796
23169
  }
22797
23170
  function getWorkspacePoolRoot() {
22798
- return path20.join(getAgentvHome(), "workspace-pool");
23171
+ return path21.join(getAgentvHome(), "workspace-pool");
22799
23172
  }
22800
23173
  var piCodingAgentModule = null;
22801
23174
  var piAiModule = null;
@@ -22815,7 +23188,7 @@ async function promptInstall() {
22815
23188
  }
22816
23189
  }
22817
23190
  function findManagedSdkInstallRoot() {
22818
- return path21.join(getAgentvHome(), "deps", "pi-sdk");
23191
+ return path222.join(getAgentvHome(), "deps", "pi-sdk");
22819
23192
  }
22820
23193
  function resolveGlobalNpmRoot() {
22821
23194
  try {
@@ -22829,7 +23202,7 @@ function resolveGlobalNpmRoot() {
22829
23202
  }
22830
23203
  }
22831
23204
  function buildGlobalModuleEntry(moduleName, globalNpmRoot) {
22832
- return path21.join(globalNpmRoot, ...moduleName.split("/"), "dist", "index.js");
23205
+ return path222.join(globalNpmRoot, ...moduleName.split("/"), "dist", "index.js");
22833
23206
  }
22834
23207
  function findAccessiblePath(paths) {
22835
23208
  for (const candidate of paths) {
@@ -22855,11 +23228,11 @@ async function tryImportLocalSdkModules() {
22855
23228
  async function tryImportManagedSdkModules() {
22856
23229
  const managedRoot = findManagedSdkInstallRoot();
22857
23230
  const piCodingAgentEntry = findAccessiblePath([
22858
- path21.join(managedRoot, "node_modules", "@mariozechner", "pi-coding-agent", "dist", "index.js")
23231
+ path222.join(managedRoot, "node_modules", "@mariozechner", "pi-coding-agent", "dist", "index.js")
22859
23232
  ]);
22860
23233
  const piAiEntry = findAccessiblePath([
22861
- path21.join(managedRoot, "node_modules", "@mariozechner", "pi-ai", "dist", "index.js"),
22862
- path21.join(
23234
+ path222.join(managedRoot, "node_modules", "@mariozechner", "pi-ai", "dist", "index.js"),
23235
+ path222.join(
22863
23236
  managedRoot,
22864
23237
  "node_modules",
22865
23238
  "@mariozechner",
@@ -22890,7 +23263,7 @@ async function tryImportGlobalSdkModules() {
22890
23263
  ]);
22891
23264
  const piAiEntry = findAccessiblePath([
22892
23265
  buildGlobalModuleEntry("@mariozechner/pi-ai", globalNpmRoot),
22893
- path21.join(
23266
+ path222.join(
22894
23267
  globalNpmRoot,
22895
23268
  "@mariozechner",
22896
23269
  "pi-coding-agent",
@@ -23191,10 +23564,10 @@ ${fileList}`;
23191
23564
  }
23192
23565
  resolveCwd(cwdOverride) {
23193
23566
  if (cwdOverride) {
23194
- return path21.resolve(cwdOverride);
23567
+ return path222.resolve(cwdOverride);
23195
23568
  }
23196
23569
  if (this.config.cwd) {
23197
- return path21.resolve(this.config.cwd);
23570
+ return path222.resolve(this.config.cwd);
23198
23571
  }
23199
23572
  return process.cwd();
23200
23573
  }
@@ -23213,9 +23586,9 @@ ${fileList}`;
23213
23586
  }
23214
23587
  resolveLogDirectory() {
23215
23588
  if (this.config.logDir) {
23216
- return path21.resolve(this.config.logDir);
23589
+ return path222.resolve(this.config.logDir);
23217
23590
  }
23218
- return path21.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
23591
+ return path222.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
23219
23592
  }
23220
23593
  async createStreamLogger(request) {
23221
23594
  const logDir = this.resolveLogDirectory();
@@ -23229,7 +23602,7 @@ ${fileList}`;
23229
23602
  console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
23230
23603
  return void 0;
23231
23604
  }
23232
- const filePath = path21.join(logDir, buildLogFilename6(request, this.targetName));
23605
+ const filePath = path222.join(logDir, buildLogFilename6(request, this.targetName));
23233
23606
  try {
23234
23607
  const logger = await PiStreamLogger2.create({
23235
23608
  filePath,
@@ -23453,7 +23826,7 @@ async function readDirEntries(target) {
23453
23826
  const entries = await readdir2(target, { withFileTypes: true });
23454
23827
  return entries.map((entry) => ({
23455
23828
  name: entry.name,
23456
- absolutePath: path222.join(target, entry.name),
23829
+ absolutePath: path23.join(target, entry.name),
23457
23830
  isDirectory: entry.isDirectory()
23458
23831
  }));
23459
23832
  }
@@ -23467,7 +23840,7 @@ async function removeIfExists(target) {
23467
23840
  }
23468
23841
  }
23469
23842
  function pathToFileUri2(filePath) {
23470
- const absolutePath = path23.isAbsolute(filePath) ? filePath : path23.resolve(filePath);
23843
+ const absolutePath = path24.isAbsolute(filePath) ? filePath : path24.resolve(filePath);
23471
23844
  const normalizedPath = absolutePath.replace(/\\/g, "/");
23472
23845
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
23473
23846
  return `file:///${normalizedPath}`;
@@ -23559,8 +23932,8 @@ function createBatchRequestPrompt(userQuery, responseFileTmp, responseFileFinal,
23559
23932
  });
23560
23933
  }
23561
23934
  function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateContent) {
23562
- const requestLines = requestFiles.map((file, index) => `${index + 1}. messages/${path24.basename(file)}`).join("\n");
23563
- const responseList = responseFiles.map((file) => `"${path24.basename(file)}"`).join(", ");
23935
+ const requestLines = requestFiles.map((file, index) => `${index + 1}. messages/${path25.basename(file)}`).join("\n");
23936
+ const responseList = responseFiles.map((file) => `"${path25.basename(file)}"`).join(", ");
23564
23937
  return renderTemplate2(templateContent, {
23565
23938
  requestFiles: requestLines,
23566
23939
  responseList
@@ -23599,7 +23972,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
23599
23972
  const maxAttempts = 10;
23600
23973
  while (attempts < maxAttempts) {
23601
23974
  try {
23602
- const content = await readFile9(responseFileFinal, { encoding: "utf8" });
23975
+ const content = await readFile10(responseFileFinal, { encoding: "utf8" });
23603
23976
  if (!silent) {
23604
23977
  process.stdout.write(`${content}
23605
23978
  `);
@@ -23620,7 +23993,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
23620
23993
  }
23621
23994
  async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, silent = false, timeoutMs = DEFAULT_TIMEOUT_MS) {
23622
23995
  if (!silent) {
23623
- const fileList = responseFilesFinal.map((file) => path25.basename(file)).join(", ");
23996
+ const fileList = responseFilesFinal.map((file) => path26.basename(file)).join(", ");
23624
23997
  console.error(`waiting for ${responseFilesFinal.length} batch response(s): ${fileList}`);
23625
23998
  }
23626
23999
  const deadline = Date.now() + timeoutMs;
@@ -23629,7 +24002,7 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
23629
24002
  while (pending.size > 0) {
23630
24003
  if (Date.now() >= deadline) {
23631
24004
  if (!silent) {
23632
- const remaining = [...pending].map((f) => path25.basename(f)).join(", ");
24005
+ const remaining = [...pending].map((f) => path26.basename(f)).join(", ");
23633
24006
  console.error(
23634
24007
  `error: timed out after ${Math.round(timeoutMs / 1e3)}s waiting for batch responses. Still pending: ${remaining}`
23635
24008
  );
@@ -23656,7 +24029,7 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
23656
24029
  const maxAttempts = 10;
23657
24030
  while (attempts < maxAttempts) {
23658
24031
  try {
23659
- const content = await readFile9(file, { encoding: "utf8" });
24032
+ const content = await readFile10(file, { encoding: "utf8" });
23660
24033
  if (!silent) {
23661
24034
  process.stdout.write(`${content}
23662
24035
  `);
@@ -23680,7 +24053,7 @@ var DEFAULT_LOCK_NAME = "subagent.lock";
23680
24053
  var DEFAULT_ALIVE_FILENAME = ".alive";
23681
24054
  function getDefaultSubagentRoot(vscodeCmd = "code") {
23682
24055
  const folder = vscodeCmd === "code-insiders" ? "vscode-insiders-agents" : "vscode-agents";
23683
- return path26.join(getSubagentsRoot(), folder);
24056
+ return path27.join(getSubagentsRoot(), folder);
23684
24057
  }
23685
24058
  var DEFAULT_SUBAGENT_ROOT = getDefaultSubagentRoot();
23686
24059
  var execAsync2 = promisify2(exec);
@@ -23745,11 +24118,11 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
23745
24118
  await raceSpawnError(child);
23746
24119
  return true;
23747
24120
  }
23748
- const aliveFile = path27.join(subagentDir, DEFAULT_ALIVE_FILENAME);
24121
+ const aliveFile = path28.join(subagentDir, DEFAULT_ALIVE_FILENAME);
23749
24122
  await removeIfExists(aliveFile);
23750
- const githubAgentsDir = path27.join(subagentDir, ".github", "agents");
24123
+ const githubAgentsDir = path28.join(subagentDir, ".github", "agents");
23751
24124
  await mkdir9(githubAgentsDir, { recursive: true });
23752
- const wakeupDst = path27.join(githubAgentsDir, "wakeup.md");
24125
+ const wakeupDst = path28.join(githubAgentsDir, "wakeup.md");
23753
24126
  await writeFile2(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
23754
24127
  const workspaceChild = spawnVsCode(vscodeCmd, [workspacePath], {
23755
24128
  label: "open-workspace"
@@ -23762,7 +24135,7 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
23762
24135
  "chat",
23763
24136
  "-m",
23764
24137
  wakeupChatId,
23765
- `create a file named .alive in the ${path27.basename(subagentDir)} folder`
24138
+ `create a file named .alive in the ${path28.basename(subagentDir)} folder`
23766
24139
  ];
23767
24140
  const wakeupChild = spawnVsCode(vscodeCmd, chatArgs, { label: "send-wakeup-chat" });
23768
24141
  await raceSpawnError(wakeupChild);
@@ -23777,10 +24150,10 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
23777
24150
  return true;
23778
24151
  }
23779
24152
  async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, requestInstructions, timestamp, vscodeCmd) {
23780
- const workspacePath = path27.join(subagentDir, `${path27.basename(subagentDir)}.code-workspace`);
23781
- const messagesDir = path27.join(subagentDir, "messages");
24153
+ const workspacePath = path28.join(subagentDir, `${path28.basename(subagentDir)}.code-workspace`);
24154
+ const messagesDir = path28.join(subagentDir, "messages");
23782
24155
  await mkdir9(messagesDir, { recursive: true });
23783
- const reqFile = path27.join(messagesDir, `${timestamp}_req.md`);
24156
+ const reqFile = path28.join(messagesDir, `${timestamp}_req.md`);
23784
24157
  await writeFile2(reqFile, requestInstructions, { encoding: "utf8" });
23785
24158
  const reqUri = pathToFileUri2(reqFile);
23786
24159
  const chatArgs = ["-r", "chat", "-m", chatId];
@@ -23788,16 +24161,16 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
23788
24161
  chatArgs.push("-a", attachment);
23789
24162
  }
23790
24163
  chatArgs.push("-a", reqFile);
23791
- chatArgs.push(`Follow instructions in [${path27.basename(reqFile)}](${reqUri})`);
24164
+ chatArgs.push(`Follow instructions in [${path28.basename(reqFile)}](${reqUri})`);
23792
24165
  const workspaceReady = await ensureWorkspaceFocused(
23793
24166
  workspacePath,
23794
- path27.basename(subagentDir),
24167
+ path28.basename(subagentDir),
23795
24168
  subagentDir,
23796
24169
  vscodeCmd
23797
24170
  );
23798
24171
  if (!workspaceReady) {
23799
24172
  throw new Error(
23800
- `VS Code workspace '${path27.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
24173
+ `VS Code workspace '${path28.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
23801
24174
  );
23802
24175
  }
23803
24176
  await sleep2(500);
@@ -23805,8 +24178,8 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
23805
24178
  await raceSpawnError(child);
23806
24179
  }
23807
24180
  async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, chatInstruction, vscodeCmd) {
23808
- const workspacePath = path27.join(subagentDir, `${path27.basename(subagentDir)}.code-workspace`);
23809
- const messagesDir = path27.join(subagentDir, "messages");
24181
+ const workspacePath = path28.join(subagentDir, `${path28.basename(subagentDir)}.code-workspace`);
24182
+ const messagesDir = path28.join(subagentDir, "messages");
23810
24183
  await mkdir9(messagesDir, { recursive: true });
23811
24184
  const chatArgs = ["-r", "chat", "-m", chatId];
23812
24185
  for (const attachment of attachmentPaths) {
@@ -23815,13 +24188,13 @@ async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, c
23815
24188
  chatArgs.push(chatInstruction);
23816
24189
  const workspaceReady = await ensureWorkspaceFocused(
23817
24190
  workspacePath,
23818
- path27.basename(subagentDir),
24191
+ path28.basename(subagentDir),
23819
24192
  subagentDir,
23820
24193
  vscodeCmd
23821
24194
  );
23822
24195
  if (!workspaceReady) {
23823
24196
  throw new Error(
23824
- `VS Code workspace '${path27.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
24197
+ `VS Code workspace '${path28.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
23825
24198
  );
23826
24199
  }
23827
24200
  await sleep2(500);
@@ -23843,10 +24216,10 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
23843
24216
  }
23844
24217
  const transformedFolders = workspace.folders.map((folder) => {
23845
24218
  const folderPath = folder.path;
23846
- if (path28.isAbsolute(folderPath)) {
24219
+ if (path29.isAbsolute(folderPath)) {
23847
24220
  return folder;
23848
24221
  }
23849
- const absolutePath = path28.resolve(templateDir, folderPath);
24222
+ const absolutePath = path29.resolve(templateDir, folderPath);
23850
24223
  return {
23851
24224
  ...folder,
23852
24225
  path: absolutePath
@@ -23868,19 +24241,19 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
23868
24241
  if (locationMap && typeof locationMap === "object") {
23869
24242
  const transformedMap = {};
23870
24243
  for (const [locationPath, value] of Object.entries(locationMap)) {
23871
- const isAbsolute = path28.isAbsolute(locationPath);
24244
+ const isAbsolute = path29.isAbsolute(locationPath);
23872
24245
  if (isAbsolute) {
23873
24246
  transformedMap[locationPath] = value;
23874
24247
  } else {
23875
24248
  const firstGlobIndex = locationPath.search(/[*]/);
23876
24249
  if (firstGlobIndex === -1) {
23877
- const resolvedPath = path28.resolve(templateDir, locationPath).replace(/\\/g, "/");
24250
+ const resolvedPath = path29.resolve(templateDir, locationPath).replace(/\\/g, "/");
23878
24251
  transformedMap[resolvedPath] = value;
23879
24252
  } else {
23880
24253
  const basePathEnd = locationPath.lastIndexOf("/", firstGlobIndex);
23881
24254
  const basePath = basePathEnd !== -1 ? locationPath.substring(0, basePathEnd) : ".";
23882
24255
  const patternPath = locationPath.substring(basePathEnd !== -1 ? basePathEnd : 0);
23883
- const resolvedPath = (path28.resolve(templateDir, basePath) + patternPath).replace(
24256
+ const resolvedPath = (path29.resolve(templateDir, basePath) + patternPath).replace(
23884
24257
  /\\/g,
23885
24258
  "/"
23886
24259
  );
@@ -23919,7 +24292,7 @@ async function findUnlockedSubagent(subagentRoot) {
23919
24292
  number: Number.parseInt(entry.name.split("-")[1] ?? "", 10)
23920
24293
  })).filter((entry) => Number.isInteger(entry.number)).sort((a, b) => a.number - b.number);
23921
24294
  for (const subagent of subagents) {
23922
- const lockFile = path29.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
24295
+ const lockFile = path30.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
23923
24296
  if (!await pathExists(lockFile)) {
23924
24297
  return subagent.absolutePath;
23925
24298
  }
@@ -23929,7 +24302,7 @@ async function findUnlockedSubagent(subagentRoot) {
23929
24302
  async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
23930
24303
  let workspaceContent;
23931
24304
  if (workspaceTemplate) {
23932
- const workspaceSrc = path29.resolve(workspaceTemplate);
24305
+ const workspaceSrc = path30.resolve(workspaceTemplate);
23933
24306
  if (!await pathExists(workspaceSrc)) {
23934
24307
  throw new Error(`workspace template not found: ${workspaceSrc}`);
23935
24308
  }
@@ -23937,18 +24310,18 @@ async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
23937
24310
  if (!stats.isFile()) {
23938
24311
  throw new Error(`workspace template must be a file, not a directory: ${workspaceSrc}`);
23939
24312
  }
23940
- const templateText = await readFile10(workspaceSrc, "utf8");
24313
+ const templateText = await readFile11(workspaceSrc, "utf8");
23941
24314
  workspaceContent = JSON.parse(templateText);
23942
24315
  } else {
23943
24316
  workspaceContent = DEFAULT_WORKSPACE_TEMPLATE;
23944
24317
  }
23945
- const workspaceName = `${path29.basename(subagentDir)}.code-workspace`;
23946
- const workspaceDst = path29.join(subagentDir, workspaceName);
23947
- const templateDir = workspaceTemplate ? path29.dirname(path29.resolve(workspaceTemplate)) : subagentDir;
24318
+ const workspaceName = `${path30.basename(subagentDir)}.code-workspace`;
24319
+ const workspaceDst = path30.join(subagentDir, workspaceName);
24320
+ const templateDir = workspaceTemplate ? path30.dirname(path30.resolve(workspaceTemplate)) : subagentDir;
23948
24321
  const workspaceJson = JSON.stringify(workspaceContent, null, 2);
23949
24322
  let transformedContent = transformWorkspacePaths(workspaceJson, templateDir);
23950
24323
  if (cwd) {
23951
- const absCwd = path29.resolve(cwd);
24324
+ const absCwd = path30.resolve(cwd);
23952
24325
  const parsed = JSON.parse(transformedContent);
23953
24326
  const alreadyPresent = parsed.folders.some((f) => f.path === absCwd);
23954
24327
  if (!alreadyPresent) {
@@ -23957,35 +24330,35 @@ async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
23957
24330
  }
23958
24331
  }
23959
24332
  await writeFile3(workspaceDst, transformedContent, "utf8");
23960
- const messagesDir = path29.join(subagentDir, "messages");
24333
+ const messagesDir = path30.join(subagentDir, "messages");
23961
24334
  await mkdir10(messagesDir, { recursive: true });
23962
24335
  return { workspace: workspaceDst, messagesDir };
23963
24336
  }
23964
24337
  async function createSubagentLock(subagentDir) {
23965
- const messagesDir = path29.join(subagentDir, "messages");
24338
+ const messagesDir = path30.join(subagentDir, "messages");
23966
24339
  if (await pathExists(messagesDir)) {
23967
24340
  const files = await readdir3(messagesDir);
23968
24341
  await Promise.all(
23969
24342
  files.map(async (file) => {
23970
- const target = path29.join(messagesDir, file);
24343
+ const target = path30.join(messagesDir, file);
23971
24344
  await removeIfExists(target);
23972
24345
  })
23973
24346
  );
23974
24347
  }
23975
- const githubAgentsDir = path29.join(subagentDir, ".github", "agents");
24348
+ const githubAgentsDir = path30.join(subagentDir, ".github", "agents");
23976
24349
  if (await pathExists(githubAgentsDir)) {
23977
24350
  const agentFiles = await readdir3(githubAgentsDir);
23978
24351
  const preservedFiles = /* @__PURE__ */ new Set(["wakeup.md", "subagent.md"]);
23979
24352
  await Promise.all(
23980
- agentFiles.filter((file) => file.endsWith(".md") && !preservedFiles.has(file)).map((file) => removeIfExists(path29.join(githubAgentsDir, file)))
24353
+ agentFiles.filter((file) => file.endsWith(".md") && !preservedFiles.has(file)).map((file) => removeIfExists(path30.join(githubAgentsDir, file)))
23981
24354
  );
23982
24355
  }
23983
- const lockFile = path29.join(subagentDir, DEFAULT_LOCK_NAME);
24356
+ const lockFile = path30.join(subagentDir, DEFAULT_LOCK_NAME);
23984
24357
  await writeFile3(lockFile, "", { encoding: "utf8" });
23985
24358
  return lockFile;
23986
24359
  }
23987
24360
  async function removeSubagentLock(subagentDir) {
23988
- const lockFile = path29.join(subagentDir, DEFAULT_LOCK_NAME);
24361
+ const lockFile = path30.join(subagentDir, DEFAULT_LOCK_NAME);
23989
24362
  await removeIfExists(lockFile);
23990
24363
  }
23991
24364
  async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspaceTemplate, dryRun, cwd) {
@@ -24005,9 +24378,9 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
24005
24378
  return 1;
24006
24379
  }
24007
24380
  if (promptFile) {
24008
- const githubAgentsDir = path29.join(subagentDir, ".github", "agents");
24381
+ const githubAgentsDir = path30.join(subagentDir, ".github", "agents");
24009
24382
  await mkdir10(githubAgentsDir, { recursive: true });
24010
- const agentFile = path29.join(githubAgentsDir, `${chatId}.md`);
24383
+ const agentFile = path30.join(githubAgentsDir, `${chatId}.md`);
24011
24384
  try {
24012
24385
  await copyFile(promptFile, agentFile);
24013
24386
  } catch (error) {
@@ -24024,7 +24397,7 @@ async function resolvePromptFile(promptFile) {
24024
24397
  if (!promptFile) {
24025
24398
  return void 0;
24026
24399
  }
24027
- const resolvedPrompt = path30.resolve(promptFile);
24400
+ const resolvedPrompt = path31.resolve(promptFile);
24028
24401
  if (!await pathExists(resolvedPrompt)) {
24029
24402
  throw new Error(`Prompt file not found: ${resolvedPrompt}`);
24030
24403
  }
@@ -24040,7 +24413,7 @@ async function resolveAttachments(extraAttachments) {
24040
24413
  }
24041
24414
  const resolved = [];
24042
24415
  for (const attachment of extraAttachments) {
24043
- const resolvedPath = path30.resolve(attachment);
24416
+ const resolvedPath = path31.resolve(attachment);
24044
24417
  if (!await pathExists(resolvedPath)) {
24045
24418
  throw new Error(`Attachment not found: ${resolvedPath}`);
24046
24419
  }
@@ -24082,7 +24455,7 @@ async function dispatchAgentSession(options) {
24082
24455
  error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
24083
24456
  };
24084
24457
  }
24085
- const subagentName = path30.basename(subagentDir);
24458
+ const subagentName = path31.basename(subagentDir);
24086
24459
  const chatId = Math.random().toString(16).slice(2, 10);
24087
24460
  const preparationResult = await prepareSubagentDirectory(
24088
24461
  subagentDir,
@@ -24110,9 +24483,9 @@ async function dispatchAgentSession(options) {
24110
24483
  };
24111
24484
  }
24112
24485
  const timestamp = generateTimestamp();
24113
- const messagesDir = path30.join(subagentDir, "messages");
24114
- const responseFileTmp = path30.join(messagesDir, `${timestamp}_res.tmp.md`);
24115
- const responseFileFinal = path30.join(messagesDir, `${timestamp}_res.md`);
24486
+ const messagesDir = path31.join(subagentDir, "messages");
24487
+ const responseFileTmp = path31.join(messagesDir, `${timestamp}_res.tmp.md`);
24488
+ const responseFileFinal = path31.join(messagesDir, `${timestamp}_res.md`);
24116
24489
  const requestInstructions = createRequestPrompt(
24117
24490
  userQuery,
24118
24491
  responseFileTmp,
@@ -24217,7 +24590,7 @@ async function dispatchBatchAgent(options) {
24217
24590
  error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
24218
24591
  };
24219
24592
  }
24220
- subagentName = path30.basename(subagentDir);
24593
+ subagentName = path31.basename(subagentDir);
24221
24594
  const chatId = Math.random().toString(16).slice(2, 10);
24222
24595
  const preparationResult = await prepareSubagentDirectory(
24223
24596
  subagentDir,
@@ -24248,17 +24621,17 @@ async function dispatchBatchAgent(options) {
24248
24621
  };
24249
24622
  }
24250
24623
  const timestamp = generateTimestamp();
24251
- const messagesDir = path30.join(subagentDir, "messages");
24624
+ const messagesDir = path31.join(subagentDir, "messages");
24252
24625
  requestFiles = userQueries.map(
24253
- (_, index) => path30.join(messagesDir, `${timestamp}_${index}_req.md`)
24626
+ (_, index) => path31.join(messagesDir, `${timestamp}_${index}_req.md`)
24254
24627
  );
24255
24628
  const responseTmpFiles = userQueries.map(
24256
- (_, index) => path30.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
24629
+ (_, index) => path31.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
24257
24630
  );
24258
24631
  responseFilesFinal = userQueries.map(
24259
- (_, index) => path30.join(messagesDir, `${timestamp}_${index}_res.md`)
24632
+ (_, index) => path31.join(messagesDir, `${timestamp}_${index}_res.md`)
24260
24633
  );
24261
- const orchestratorFile = path30.join(messagesDir, `${timestamp}_orchestrator.md`);
24634
+ const orchestratorFile = path31.join(messagesDir, `${timestamp}_orchestrator.md`);
24262
24635
  if (!dryRun) {
24263
24636
  await Promise.all(
24264
24637
  userQueries.map((query, index) => {
@@ -24371,7 +24744,7 @@ async function provisionSubagents(options) {
24371
24744
  if (!Number.isInteger(subagents) || subagents < 1) {
24372
24745
  throw new Error("subagents must be a positive integer");
24373
24746
  }
24374
- const targetPath = path31.resolve(targetRoot);
24747
+ const targetPath = path322.resolve(targetRoot);
24375
24748
  if (!dryRun) {
24376
24749
  await ensureDir(targetPath);
24377
24750
  }
@@ -24391,7 +24764,7 @@ async function provisionSubagents(options) {
24391
24764
  continue;
24392
24765
  }
24393
24766
  highestNumber = Math.max(highestNumber, parsed);
24394
- const lockFile = path31.join(entry.absolutePath, lockName);
24767
+ const lockFile = path322.join(entry.absolutePath, lockName);
24395
24768
  const locked = await pathExists(lockFile);
24396
24769
  if (locked) {
24397
24770
  lockedSubagents.add(entry.absolutePath);
@@ -24408,10 +24781,10 @@ async function provisionSubagents(options) {
24408
24781
  break;
24409
24782
  }
24410
24783
  const subagentDir = subagent.absolutePath;
24411
- const githubAgentsDir = path31.join(subagentDir, ".github", "agents");
24412
- const lockFile = path31.join(subagentDir, lockName);
24413
- const workspaceDst = path31.join(subagentDir, `${path31.basename(subagentDir)}.code-workspace`);
24414
- const wakeupDst = path31.join(githubAgentsDir, "wakeup.md");
24784
+ const githubAgentsDir = path322.join(subagentDir, ".github", "agents");
24785
+ const lockFile = path322.join(subagentDir, lockName);
24786
+ const workspaceDst = path322.join(subagentDir, `${path322.basename(subagentDir)}.code-workspace`);
24787
+ const wakeupDst = path322.join(githubAgentsDir, "wakeup.md");
24415
24788
  const isLocked = await pathExists(lockFile);
24416
24789
  if (isLocked && !force) {
24417
24790
  continue;
@@ -24449,10 +24822,10 @@ async function provisionSubagents(options) {
24449
24822
  let nextIndex = highestNumber;
24450
24823
  while (subagentsProvisioned < subagents) {
24451
24824
  nextIndex += 1;
24452
- const subagentDir = path31.join(targetPath, `subagent-${nextIndex}`);
24453
- const githubAgentsDir = path31.join(subagentDir, ".github", "agents");
24454
- const workspaceDst = path31.join(subagentDir, `${path31.basename(subagentDir)}.code-workspace`);
24455
- const wakeupDst = path31.join(githubAgentsDir, "wakeup.md");
24825
+ const subagentDir = path322.join(targetPath, `subagent-${nextIndex}`);
24826
+ const githubAgentsDir = path322.join(subagentDir, ".github", "agents");
24827
+ const workspaceDst = path322.join(subagentDir, `${path322.basename(subagentDir)}.code-workspace`);
24828
+ const wakeupDst = path322.join(githubAgentsDir, "wakeup.md");
24456
24829
  if (!dryRun) {
24457
24830
  await ensureDir(subagentDir);
24458
24831
  await ensureDir(githubAgentsDir);
@@ -24638,7 +25011,7 @@ var VSCodeProvider = class {
24638
25011
  async function locateVSCodeExecutable(candidate) {
24639
25012
  const includesPathSeparator = candidate.includes("/") || candidate.includes("\\");
24640
25013
  if (includesPathSeparator) {
24641
- const resolved = path322.isAbsolute(candidate) ? candidate : path322.resolve(candidate);
25014
+ const resolved = path33.isAbsolute(candidate) ? candidate : path33.resolve(candidate);
24642
25015
  try {
24643
25016
  await access3(resolved, constants3.F_OK);
24644
25017
  return resolved;
@@ -24667,7 +25040,7 @@ async function resolveWorkspaceTemplateFile(template) {
24667
25040
  return void 0;
24668
25041
  }
24669
25042
  try {
24670
- const stats = await stat5(path322.resolve(template));
25043
+ const stats = await stat5(path33.resolve(template));
24671
25044
  return stats.isFile() ? template : void 0;
24672
25045
  } catch {
24673
25046
  return template;
@@ -24691,7 +25064,7 @@ function buildMandatoryPrereadBlock2(attachmentFiles) {
24691
25064
  return "";
24692
25065
  }
24693
25066
  const buildList = (files) => files.map((absolutePath) => {
24694
- const fileName = path322.basename(absolutePath);
25067
+ const fileName = path33.basename(absolutePath);
24695
25068
  const fileUri = pathToFileUri3(absolutePath);
24696
25069
  return `* [${fileName}](${fileUri})`;
24697
25070
  });
@@ -24712,7 +25085,7 @@ function collectAttachmentFiles(attachments) {
24712
25085
  }
24713
25086
  const unique = /* @__PURE__ */ new Map();
24714
25087
  for (const attachment of attachments) {
24715
- const absolutePath = path322.resolve(attachment);
25088
+ const absolutePath = path33.resolve(attachment);
24716
25089
  if (!unique.has(absolutePath)) {
24717
25090
  unique.set(absolutePath, absolutePath);
24718
25091
  }
@@ -24720,7 +25093,7 @@ function collectAttachmentFiles(attachments) {
24720
25093
  return Array.from(unique.values());
24721
25094
  }
24722
25095
  function pathToFileUri3(filePath) {
24723
- const absolutePath = path322.isAbsolute(filePath) ? filePath : path322.resolve(filePath);
25096
+ const absolutePath = path33.isAbsolute(filePath) ? filePath : path33.resolve(filePath);
24724
25097
  const normalizedPath = absolutePath.replace(/\\/g, "/");
24725
25098
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
24726
25099
  return `file:///${normalizedPath}`;
@@ -24733,7 +25106,7 @@ function normalizeAttachments(attachments) {
24733
25106
  }
24734
25107
  const deduped = /* @__PURE__ */ new Set();
24735
25108
  for (const attachment of attachments) {
24736
- deduped.add(path322.resolve(attachment));
25109
+ deduped.add(path33.resolve(attachment));
24737
25110
  }
24738
25111
  return Array.from(deduped);
24739
25112
  }
@@ -24742,7 +25115,7 @@ function mergeAttachments(all) {
24742
25115
  for (const list of all) {
24743
25116
  if (!list) continue;
24744
25117
  for (const inputFile of list) {
24745
- deduped.add(path322.resolve(inputFile));
25118
+ deduped.add(path33.resolve(inputFile));
24746
25119
  }
24747
25120
  }
24748
25121
  return deduped.size > 0 ? Array.from(deduped) : void 0;
@@ -24825,11 +25198,11 @@ async function fileExists3(filePath) {
24825
25198
  }
24826
25199
  }
24827
25200
  async function readTargetDefinitions(filePath) {
24828
- const absolutePath = path33.resolve(filePath);
25201
+ const absolutePath = path34.resolve(filePath);
24829
25202
  if (!await fileExists3(absolutePath)) {
24830
25203
  throw new Error(`targets.yaml not found at ${absolutePath}`);
24831
25204
  }
24832
- const raw = await readFile11(absolutePath, "utf8");
25205
+ const raw = await readFile12(absolutePath, "utf8");
24833
25206
  const parsed = parse4(raw);
24834
25207
  if (!isRecord(parsed)) {
24835
25208
  throw new Error(`targets.yaml at ${absolutePath} must be a YAML object with a 'targets' field`);
@@ -24846,11 +25219,11 @@ function listTargetNames(definitions) {
24846
25219
  async function discoverProviders(registry, baseDir) {
24847
25220
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
24848
25221
  const candidateDirs = [];
24849
- let dir = path34.resolve(baseDir);
24850
- const root = path34.parse(dir).root;
25222
+ let dir = path35.resolve(baseDir);
25223
+ const root = path35.parse(dir).root;
24851
25224
  while (dir !== root) {
24852
- candidateDirs.push(path34.join(dir, ".agentv", "providers"));
24853
- dir = path34.dirname(dir);
25225
+ candidateDirs.push(path35.join(dir, ".agentv", "providers"));
25226
+ dir = path35.dirname(dir);
24854
25227
  }
24855
25228
  let files = [];
24856
25229
  for (const providersDir of candidateDirs) {
@@ -24866,7 +25239,7 @@ async function discoverProviders(registry, baseDir) {
24866
25239
  }
24867
25240
  const discoveredKinds = [];
24868
25241
  for (const filePath of files) {
24869
- const basename = path34.basename(filePath);
25242
+ const basename = path35.basename(filePath);
24870
25243
  const kindName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
24871
25244
  if (registry.has(kindName)) {
24872
25245
  continue;
@@ -24982,148 +25355,6 @@ function negateScore(score) {
24982
25355
  }))
24983
25356
  };
24984
25357
  }
24985
- function shellEscapePath(value) {
24986
- if (process.platform === "win32") {
24987
- return `"${value.replaceAll('"', '""')}"`;
24988
- }
24989
- return `'${value.replaceAll("'", `'"'"'`)}'`;
24990
- }
24991
- async function execFileWithStdin(argv, stdinPayload, options = {}) {
24992
- if (argv.length === 0) {
24993
- throw new Error("Executable argv must include at least one entry");
24994
- }
24995
- if (typeof Bun !== "undefined") {
24996
- return execFileWithStdinBun(argv, stdinPayload, options);
24997
- }
24998
- return execFileWithStdinNode(argv, stdinPayload, options);
24999
- }
25000
- async function execFileWithStdinBun(argv, stdinPayload, options) {
25001
- const command = [...argv];
25002
- const encoder = new TextEncoder();
25003
- const proc = Bun.spawn(command, {
25004
- cwd: options.cwd,
25005
- stdin: encoder.encode(stdinPayload),
25006
- stdout: "pipe",
25007
- stderr: "pipe",
25008
- // Merge additional env vars with process.env
25009
- env: options.env ? { ...process.env, ...options.env } : process.env
25010
- });
25011
- let timedOut = false;
25012
- const timeout = options.timeoutMs !== void 0 ? setTimeout(() => {
25013
- timedOut = true;
25014
- proc.kill("SIGKILL");
25015
- }, options.timeoutMs) : void 0;
25016
- try {
25017
- const stdoutPromise = proc.stdout ? new Response(proc.stdout).text() : Promise.resolve("");
25018
- const stderrPromise = proc.stderr ? new Response(proc.stderr).text() : Promise.resolve("");
25019
- const [stdout, stderr, exitCode] = await Promise.all([
25020
- stdoutPromise,
25021
- stderrPromise,
25022
- proc.exited
25023
- ]);
25024
- if (timedOut) {
25025
- throw new Error(`Process timed out after ${options.timeoutMs}ms`);
25026
- }
25027
- return {
25028
- stdout: stdout.replace(/\r\n/g, "\n"),
25029
- stderr: stderr.replace(/\r\n/g, "\n"),
25030
- exitCode
25031
- };
25032
- } finally {
25033
- if (timeout !== void 0) {
25034
- clearTimeout(timeout);
25035
- }
25036
- }
25037
- }
25038
- async function execFileWithStdinNode(argv, stdinPayload, options) {
25039
- const { spawn: spawn5 } = await import("node:child_process");
25040
- return new Promise((resolve2, reject) => {
25041
- const [cmd, ...args] = argv;
25042
- const child = spawn5(cmd, args, {
25043
- cwd: options.cwd,
25044
- stdio: ["pipe", "pipe", "pipe"],
25045
- // Merge additional env vars with process.env
25046
- env: options.env ? { ...process.env, ...options.env } : process.env
25047
- });
25048
- const stdoutChunks = [];
25049
- const stderrChunks = [];
25050
- child.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
25051
- child.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
25052
- let timedOut = false;
25053
- const timeout = options.timeoutMs !== void 0 ? setTimeout(() => {
25054
- timedOut = true;
25055
- child.kill("SIGKILL");
25056
- }, options.timeoutMs) : void 0;
25057
- child.on("error", (error) => {
25058
- if (timeout !== void 0) clearTimeout(timeout);
25059
- reject(error);
25060
- });
25061
- child.on("close", (code) => {
25062
- if (timeout !== void 0) clearTimeout(timeout);
25063
- if (timedOut) {
25064
- reject(new Error(`Process timed out after ${options.timeoutMs}ms`));
25065
- return;
25066
- }
25067
- const stdout = Buffer.concat(stdoutChunks).toString("utf8").replace(/\r\n/g, "\n");
25068
- const stderr = Buffer.concat(stderrChunks).toString("utf8").replace(/\r\n/g, "\n");
25069
- resolve2({
25070
- stdout,
25071
- stderr,
25072
- exitCode: code ?? 0
25073
- });
25074
- });
25075
- if (child.stdin) {
25076
- child.stdin.write(stdinPayload);
25077
- child.stdin.end();
25078
- }
25079
- });
25080
- }
25081
- async function execShellWithStdin(command, stdinPayload, options = {}) {
25082
- const { mkdir: mkdir16, readFile: readFile16, rm: rm6, writeFile: writeFile9 } = await import("node:fs/promises");
25083
- const { tmpdir: tmpdir3 } = await import("node:os");
25084
- const path51 = await import("node:path");
25085
- const { randomUUID: randomUUID10 } = await import("node:crypto");
25086
- const dir = path51.join(tmpdir3(), `agentv-exec-${randomUUID10()}`);
25087
- await mkdir16(dir, { recursive: true });
25088
- const stdinPath = path51.join(dir, "stdin.txt");
25089
- const stdoutPath = path51.join(dir, "stdout.txt");
25090
- const stderrPath = path51.join(dir, "stderr.txt");
25091
- await writeFile9(stdinPath, stdinPayload, "utf8");
25092
- const wrappedCommand = process.platform === "win32" ? `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}` : `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}`;
25093
- const { spawn: spawn5 } = await import("node:child_process");
25094
- try {
25095
- const exitCode = await new Promise((resolve2, reject) => {
25096
- const child = spawn5(wrappedCommand, {
25097
- shell: true,
25098
- cwd: options.cwd,
25099
- stdio: ["ignore", "ignore", "ignore"],
25100
- // Merge additional env vars with process.env
25101
- env: options.env ? { ...process.env, ...options.env } : process.env
25102
- });
25103
- const timeout = options.timeoutMs ? setTimeout(() => {
25104
- child.kill();
25105
- reject(new Error(`Process timed out after ${options.timeoutMs}ms`));
25106
- }, options.timeoutMs) : void 0;
25107
- child.on("error", (error) => {
25108
- if (timeout !== void 0) {
25109
- clearTimeout(timeout);
25110
- }
25111
- reject(error);
25112
- });
25113
- child.on("exit", (code) => {
25114
- if (timeout !== void 0) {
25115
- clearTimeout(timeout);
25116
- }
25117
- resolve2(code ?? 0);
25118
- });
25119
- });
25120
- const stdout = (await readFile16(stdoutPath, "utf8")).replace(/\r\n/g, "\n");
25121
- const stderr = (await readFile16(stderrPath, "utf8")).replace(/\r\n/g, "\n");
25122
- return { stdout, stderr, exitCode };
25123
- } finally {
25124
- await rm6(dir, { recursive: true, force: true });
25125
- }
25126
- }
25127
25358
  var DEFAULT_MAX_CALLS = 50;
25128
25359
  async function createTargetProxy(options) {
25129
25360
  const { defaultProvider, targetResolver, availableTargets, maxCalls } = options;
@@ -25701,6 +25932,15 @@ var scoreRangeEvaluationSchema = external_exports2.object({
25701
25932
  checks: external_exports2.array(scoreRangeCheckResultSchema).describe("Scores for each rubric criterion"),
25702
25933
  overall_reasoning: external_exports2.string().describe("Overall assessment summary (1-2 sentences)").optional()
25703
25934
  });
25935
+ function resolveContentBasePath(context2) {
25936
+ if (context2.workspacePath) {
25937
+ return context2.workspacePath;
25938
+ }
25939
+ if ("config" in context2.target && context2.target.config && typeof context2.target.config === "object" && "cwd" in context2.target.config && typeof context2.target.config.cwd === "string") {
25940
+ return context2.target.config.cwd;
25941
+ }
25942
+ return void 0;
25943
+ }
25704
25944
  var LlmGraderEvaluator = class {
25705
25945
  kind = "llm-grader";
25706
25946
  resolveGraderProvider;
@@ -25718,24 +25958,46 @@ var LlmGraderEvaluator = class {
25718
25958
  this.graderTargetProvider = options.graderTargetProvider ?? options.judgeTargetProvider;
25719
25959
  }
25720
25960
  async evaluate(context2) {
25961
+ const preparedContext = await this.prepareContext(context2);
25721
25962
  if (this.graderTargetProvider) {
25722
- return this.evaluateWithGraderTarget(context2);
25963
+ return this.evaluateWithGraderTarget(preparedContext);
25723
25964
  }
25724
- const graderProvider = await this.resolveGraderProvider(context2);
25965
+ const graderProvider = await this.resolveGraderProvider(preparedContext);
25725
25966
  if (!graderProvider) {
25726
25967
  throw new Error("No grader provider available for LLM grading");
25727
25968
  }
25728
25969
  if (graderProvider.kind === "agentv") {
25729
- return this.evaluateBuiltIn(context2, graderProvider);
25970
+ return this.evaluateBuiltIn(preparedContext, graderProvider);
25730
25971
  }
25731
25972
  if (isAgentProvider(graderProvider)) {
25732
- return this.evaluateWithDelegatedAgent(context2, graderProvider);
25973
+ return this.evaluateWithDelegatedAgent(preparedContext, graderProvider);
25733
25974
  }
25734
- const config = context2.evaluator;
25975
+ const config = preparedContext.evaluator;
25735
25976
  if (config?.type === "llm-grader" && config.rubrics && config.rubrics.length > 0) {
25736
- return this.evaluateWithRubrics(context2, graderProvider, config.rubrics);
25977
+ return this.evaluateWithRubrics(preparedContext, graderProvider, config.rubrics);
25978
+ }
25979
+ return this.evaluateFreeform(preparedContext, graderProvider);
25980
+ }
25981
+ async prepareContext(context2) {
25982
+ const config = context2.evaluator;
25983
+ if (config?.type !== "llm-grader" || !context2.output) {
25984
+ return context2;
25985
+ }
25986
+ const lastAssistant = [...context2.output].reverse().find((message) => message.role === "assistant" && message.content !== void 0);
25987
+ if (!lastAssistant || typeof lastAssistant.content === "string") {
25988
+ return context2;
25737
25989
  }
25738
- return this.evaluateFreeform(context2, graderProvider);
25990
+ const extracted = await extractTextWithPreprocessors(
25991
+ lastAssistant.content,
25992
+ config.preprocessors,
25993
+ {
25994
+ basePath: resolveContentBasePath(context2)
25995
+ }
25996
+ );
25997
+ return {
25998
+ ...context2,
25999
+ candidate: appendPreprocessingWarnings(extracted.text, extracted.warnings)
26000
+ };
25739
26001
  }
25740
26002
  // ---------------------------------------------------------------------------
25741
26003
  // LLM mode (existing)
@@ -26620,8 +26882,8 @@ function toAiSdkImageParts(images) {
26620
26882
  }));
26621
26883
  }
26622
26884
  function resolveSandboxed(basePath, relativePath) {
26623
- const resolved = path35.resolve(basePath, relativePath);
26624
- if (!resolved.startsWith(basePath + path35.sep) && resolved !== basePath) {
26885
+ const resolved = path36.resolve(basePath, relativePath);
26886
+ if (!resolved.startsWith(basePath + path36.sep) && resolved !== basePath) {
26625
26887
  throw new Error(`Path '${relativePath}' is outside the workspace`);
26626
26888
  }
26627
26889
  return resolved;
@@ -26711,11 +26973,11 @@ async function searchDirectory(dirPath, workspacePath, regex, matches) {
26711
26973
  for (const entry of entries) {
26712
26974
  if (matches.length >= MAX_SEARCH_MATCHES) return;
26713
26975
  if (SEARCH_SKIP_DIRS.has(entry.name)) continue;
26714
- const fullPath = path35.join(dirPath, entry.name);
26976
+ const fullPath = path36.join(dirPath, entry.name);
26715
26977
  if (entry.isDirectory()) {
26716
26978
  await searchDirectory(fullPath, workspacePath, regex, matches);
26717
26979
  } else if (entry.isFile()) {
26718
- const ext = path35.extname(entry.name).toLowerCase();
26980
+ const ext = path36.extname(entry.name).toLowerCase();
26719
26981
  if (BINARY_EXTENSIONS.has(ext)) continue;
26720
26982
  try {
26721
26983
  const stat11 = await fs2.stat(fullPath);
@@ -26727,7 +26989,7 @@ async function searchDirectory(dirPath, workspacePath, regex, matches) {
26727
26989
  regex.lastIndex = 0;
26728
26990
  if (regex.test(lines[i])) {
26729
26991
  matches.push({
26730
- file: path35.relative(workspacePath, fullPath),
26992
+ file: path36.relative(workspacePath, fullPath),
26731
26993
  line: i + 1,
26732
26994
  text: lines[i].substring(0, 200)
26733
26995
  });
@@ -27352,115 +27614,115 @@ var FieldAccuracyEvaluator = class {
27352
27614
  * Evaluate a single field against the expected value.
27353
27615
  */
27354
27616
  evaluateField(fieldConfig, candidateData, expectedData) {
27355
- const { path: path51, match, required = true, weight = 1 } = fieldConfig;
27356
- const candidateValue = resolvePath(candidateData, path51);
27357
- const expectedValue = resolvePath(expectedData, path51);
27617
+ const { path: path52, match, required = true, weight = 1 } = fieldConfig;
27618
+ const candidateValue = resolvePath(candidateData, path52);
27619
+ const expectedValue = resolvePath(expectedData, path52);
27358
27620
  if (expectedValue === void 0) {
27359
27621
  return {
27360
- path: path51,
27622
+ path: path52,
27361
27623
  score: 1,
27362
27624
  // No expected value means no comparison needed
27363
27625
  weight,
27364
27626
  hit: true,
27365
- message: `${path51}: no expected value`
27627
+ message: `${path52}: no expected value`
27366
27628
  };
27367
27629
  }
27368
27630
  if (candidateValue === void 0) {
27369
27631
  if (required) {
27370
27632
  return {
27371
- path: path51,
27633
+ path: path52,
27372
27634
  score: 0,
27373
27635
  weight,
27374
27636
  hit: false,
27375
- message: `${path51} (required, missing)`
27637
+ message: `${path52} (required, missing)`
27376
27638
  };
27377
27639
  }
27378
27640
  return {
27379
- path: path51,
27641
+ path: path52,
27380
27642
  score: 1,
27381
27643
  // Don't penalize missing optional fields
27382
27644
  weight: 0,
27383
27645
  // Zero weight means it won't affect the score
27384
27646
  hit: true,
27385
- message: `${path51}: optional field missing`
27647
+ message: `${path52}: optional field missing`
27386
27648
  };
27387
27649
  }
27388
27650
  switch (match) {
27389
27651
  case "exact":
27390
- return this.compareExact(path51, candidateValue, expectedValue, weight);
27652
+ return this.compareExact(path52, candidateValue, expectedValue, weight);
27391
27653
  case "numeric_tolerance":
27392
27654
  return this.compareNumericTolerance(
27393
- path51,
27655
+ path52,
27394
27656
  candidateValue,
27395
27657
  expectedValue,
27396
27658
  fieldConfig,
27397
27659
  weight
27398
27660
  );
27399
27661
  case "date":
27400
- return this.compareDate(path51, candidateValue, expectedValue, fieldConfig, weight);
27662
+ return this.compareDate(path52, candidateValue, expectedValue, fieldConfig, weight);
27401
27663
  default:
27402
27664
  return {
27403
- path: path51,
27665
+ path: path52,
27404
27666
  score: 0,
27405
27667
  weight,
27406
27668
  hit: false,
27407
- message: `${path51}: unknown match type "${match}"`
27669
+ message: `${path52}: unknown match type "${match}"`
27408
27670
  };
27409
27671
  }
27410
27672
  }
27411
27673
  /**
27412
27674
  * Exact equality comparison.
27413
27675
  */
27414
- compareExact(path51, candidateValue, expectedValue, weight) {
27676
+ compareExact(path52, candidateValue, expectedValue, weight) {
27415
27677
  if (deepEqual(candidateValue, expectedValue)) {
27416
27678
  return {
27417
- path: path51,
27679
+ path: path52,
27418
27680
  score: 1,
27419
27681
  weight,
27420
27682
  hit: true,
27421
- message: path51
27683
+ message: path52
27422
27684
  };
27423
27685
  }
27424
27686
  if (typeof candidateValue !== typeof expectedValue) {
27425
27687
  return {
27426
- path: path51,
27688
+ path: path52,
27427
27689
  score: 0,
27428
27690
  weight,
27429
27691
  hit: false,
27430
- message: `${path51} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
27692
+ message: `${path52} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
27431
27693
  };
27432
27694
  }
27433
27695
  return {
27434
- path: path51,
27696
+ path: path52,
27435
27697
  score: 0,
27436
27698
  weight,
27437
27699
  hit: false,
27438
- message: `${path51} (value mismatch)`
27700
+ message: `${path52} (value mismatch)`
27439
27701
  };
27440
27702
  }
27441
27703
  /**
27442
27704
  * Numeric comparison with absolute or relative tolerance.
27443
27705
  */
27444
- compareNumericTolerance(path51, candidateValue, expectedValue, fieldConfig, weight) {
27706
+ compareNumericTolerance(path52, candidateValue, expectedValue, fieldConfig, weight) {
27445
27707
  const { tolerance = 0, relative = false } = fieldConfig;
27446
27708
  const candidateNum = toNumber(candidateValue);
27447
27709
  const expectedNum = toNumber(expectedValue);
27448
27710
  if (candidateNum === null || expectedNum === null) {
27449
27711
  return {
27450
- path: path51,
27712
+ path: path52,
27451
27713
  score: 0,
27452
27714
  weight,
27453
27715
  hit: false,
27454
- message: `${path51} (non-numeric value)`
27716
+ message: `${path52} (non-numeric value)`
27455
27717
  };
27456
27718
  }
27457
27719
  if (!Number.isFinite(candidateNum) || !Number.isFinite(expectedNum)) {
27458
27720
  return {
27459
- path: path51,
27721
+ path: path52,
27460
27722
  score: 0,
27461
27723
  weight,
27462
27724
  hit: false,
27463
- message: `${path51} (invalid numeric value)`
27725
+ message: `${path52} (invalid numeric value)`
27464
27726
  };
27465
27727
  }
27466
27728
  const diff = Math.abs(candidateNum - expectedNum);
@@ -27473,61 +27735,61 @@ var FieldAccuracyEvaluator = class {
27473
27735
  }
27474
27736
  if (withinTolerance) {
27475
27737
  return {
27476
- path: path51,
27738
+ path: path52,
27477
27739
  score: 1,
27478
27740
  weight,
27479
27741
  hit: true,
27480
- message: `${path51} (within tolerance: diff=${diff.toFixed(2)})`
27742
+ message: `${path52} (within tolerance: diff=${diff.toFixed(2)})`
27481
27743
  };
27482
27744
  }
27483
27745
  return {
27484
- path: path51,
27746
+ path: path52,
27485
27747
  score: 0,
27486
27748
  weight,
27487
27749
  hit: false,
27488
- message: `${path51} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
27750
+ message: `${path52} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
27489
27751
  };
27490
27752
  }
27491
27753
  /**
27492
27754
  * Date comparison with format normalization.
27493
27755
  */
27494
- compareDate(path51, candidateValue, expectedValue, fieldConfig, weight) {
27756
+ compareDate(path52, candidateValue, expectedValue, fieldConfig, weight) {
27495
27757
  const formats = fieldConfig.formats ?? DEFAULT_DATE_FORMATS;
27496
27758
  const candidateDate = parseDate(String(candidateValue), formats);
27497
27759
  const expectedDate = parseDate(String(expectedValue), formats);
27498
27760
  if (candidateDate === null) {
27499
27761
  return {
27500
- path: path51,
27762
+ path: path52,
27501
27763
  score: 0,
27502
27764
  weight,
27503
27765
  hit: false,
27504
- message: `${path51} (unparseable candidate date)`
27766
+ message: `${path52} (unparseable candidate date)`
27505
27767
  };
27506
27768
  }
27507
27769
  if (expectedDate === null) {
27508
27770
  return {
27509
- path: path51,
27771
+ path: path52,
27510
27772
  score: 0,
27511
27773
  weight,
27512
27774
  hit: false,
27513
- message: `${path51} (unparseable expected date)`
27775
+ message: `${path52} (unparseable expected date)`
27514
27776
  };
27515
27777
  }
27516
27778
  if (candidateDate.getFullYear() === expectedDate.getFullYear() && candidateDate.getMonth() === expectedDate.getMonth() && candidateDate.getDate() === expectedDate.getDate()) {
27517
27779
  return {
27518
- path: path51,
27780
+ path: path52,
27519
27781
  score: 1,
27520
27782
  weight,
27521
27783
  hit: true,
27522
- message: path51
27784
+ message: path52
27523
27785
  };
27524
27786
  }
27525
27787
  return {
27526
- path: path51,
27788
+ path: path52,
27527
27789
  score: 0,
27528
27790
  weight,
27529
27791
  hit: false,
27530
- message: `${path51} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
27792
+ message: `${path52} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
27531
27793
  };
27532
27794
  }
27533
27795
  /**
@@ -27560,11 +27822,11 @@ var FieldAccuracyEvaluator = class {
27560
27822
  };
27561
27823
  }
27562
27824
  };
27563
- function resolvePath(obj, path51) {
27564
- if (!path51 || !obj) {
27825
+ function resolvePath(obj, path52) {
27826
+ if (!path52 || !obj) {
27565
27827
  return void 0;
27566
27828
  }
27567
- const parts = path51.split(/\.|\[|\]/).filter((p) => p.length > 0);
27829
+ const parts = path52.split(/\.|\[|\]/).filter((p) => p.length > 0);
27568
27830
  let current = obj;
27569
27831
  for (const part of parts) {
27570
27832
  if (current === null || current === void 0) {
@@ -28046,8 +28308,8 @@ var TokenUsageEvaluator = class {
28046
28308
  };
28047
28309
  }
28048
28310
  };
28049
- function getNestedValue(obj, path51) {
28050
- const parts = path51.split(".");
28311
+ function getNestedValue(obj, path52) {
28312
+ const parts = path52.split(".");
28051
28313
  let current = obj;
28052
28314
  for (const part of parts) {
28053
28315
  if (current === null || current === void 0 || typeof current !== "object") {
@@ -28907,7 +29169,7 @@ async function executePromptTemplate(script, context2, config, timeoutMs) {
28907
29169
  };
28908
29170
  const inputJson = JSON.stringify(toSnakeCaseDeep(payload), null, 2);
28909
29171
  const scriptPath = script[script.length - 1];
28910
- const cwd = path36.dirname(scriptPath);
29172
+ const cwd = path37.dirname(scriptPath);
28911
29173
  try {
28912
29174
  const stdout = await executeScript(script, inputJson, timeoutMs, cwd);
28913
29175
  const prompt = stdout.trim();
@@ -29178,11 +29440,11 @@ function createBuiltinRegistry() {
29178
29440
  async function discoverAssertions(registry, baseDir) {
29179
29441
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
29180
29442
  const candidateDirs = [];
29181
- let dir = path37.resolve(baseDir);
29182
- const root = path37.parse(dir).root;
29443
+ let dir = path38.resolve(baseDir);
29444
+ const root = path38.parse(dir).root;
29183
29445
  while (dir !== root) {
29184
- candidateDirs.push(path37.join(dir, ".agentv", "assertions"));
29185
- dir = path37.dirname(dir);
29446
+ candidateDirs.push(path38.join(dir, ".agentv", "assertions"));
29447
+ dir = path38.dirname(dir);
29186
29448
  }
29187
29449
  let files = [];
29188
29450
  for (const assertionsDir of candidateDirs) {
@@ -29198,7 +29460,7 @@ async function discoverAssertions(registry, baseDir) {
29198
29460
  }
29199
29461
  const discoveredTypes = [];
29200
29462
  for (const filePath of files) {
29201
- const basename = path37.basename(filePath);
29463
+ const basename = path38.basename(filePath);
29202
29464
  const typeName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
29203
29465
  if (registry.has(typeName)) {
29204
29466
  continue;
@@ -29217,12 +29479,12 @@ async function discoverAssertions(registry, baseDir) {
29217
29479
  async function discoverGraders(registry, baseDir) {
29218
29480
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
29219
29481
  const candidateDirs = [];
29220
- let dir = path38.resolve(baseDir);
29221
- const root = path38.parse(dir).root;
29482
+ let dir = path39.resolve(baseDir);
29483
+ const root = path39.parse(dir).root;
29222
29484
  while (dir !== root) {
29223
- candidateDirs.push(path38.join(dir, ".agentv", "graders"));
29224
- candidateDirs.push(path38.join(dir, ".agentv", "judges"));
29225
- dir = path38.dirname(dir);
29485
+ candidateDirs.push(path39.join(dir, ".agentv", "graders"));
29486
+ candidateDirs.push(path39.join(dir, ".agentv", "judges"));
29487
+ dir = path39.dirname(dir);
29226
29488
  }
29227
29489
  let files = [];
29228
29490
  for (const gradersDir of candidateDirs) {
@@ -29238,7 +29500,7 @@ async function discoverGraders(registry, baseDir) {
29238
29500
  }
29239
29501
  const discoveredTypes = [];
29240
29502
  for (const filePath of files) {
29241
- const basename = path38.basename(filePath);
29503
+ const basename = path39.basename(filePath);
29242
29504
  const typeName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
29243
29505
  if (registry.has(typeName)) {
29244
29506
  continue;
@@ -29424,10 +29686,10 @@ async function stageNestedRepoChanges(workspacePath) {
29424
29686
  }
29425
29687
  for (const entry of entries) {
29426
29688
  if (entry === ".git" || entry === "node_modules") continue;
29427
- const childPath = path39.join(workspacePath, entry);
29689
+ const childPath = path40.join(workspacePath, entry);
29428
29690
  try {
29429
29691
  if (!statSync(childPath).isDirectory()) continue;
29430
- if (!statSync(path39.join(childPath, ".git")).isDirectory()) continue;
29692
+ if (!statSync(path40.join(childPath, ".git")).isDirectory()) continue;
29431
29693
  } catch {
29432
29694
  continue;
29433
29695
  }
@@ -29464,14 +29726,14 @@ async function isDirectory(filePath) {
29464
29726
  }
29465
29727
  function getWorkspacePath(evalRunId, caseId, workspaceRoot) {
29466
29728
  const root = workspaceRoot ?? getWorkspacesRoot();
29467
- return path40.join(root, evalRunId, caseId);
29729
+ return path41.join(root, evalRunId, caseId);
29468
29730
  }
29469
29731
  async function copyDirectoryRecursive(src, dest) {
29470
29732
  await mkdir12(dest, { recursive: true });
29471
29733
  const entries = await readdir4(src, { withFileTypes: true });
29472
29734
  for (const entry of entries) {
29473
- const srcPath = path40.join(src, entry.name);
29474
- const destPath = path40.join(dest, entry.name);
29735
+ const srcPath = path41.join(src, entry.name);
29736
+ const destPath = path41.join(dest, entry.name);
29475
29737
  if (entry.name === ".git") {
29476
29738
  continue;
29477
29739
  }
@@ -29483,7 +29745,7 @@ async function copyDirectoryRecursive(src, dest) {
29483
29745
  }
29484
29746
  }
29485
29747
  async function createTempWorkspace(templatePath, evalRunId, caseId, workspaceRoot) {
29486
- const resolvedTemplatePath = path40.resolve(templatePath);
29748
+ const resolvedTemplatePath = path41.resolve(templatePath);
29487
29749
  if (!await fileExists(resolvedTemplatePath)) {
29488
29750
  throw new TemplateNotFoundError(resolvedTemplatePath);
29489
29751
  }
@@ -29532,7 +29794,7 @@ async function cleanupWorkspace(workspacePath) {
29532
29794
  }
29533
29795
  async function cleanupEvalWorkspaces(evalRunId, workspaceRoot) {
29534
29796
  const root = workspaceRoot ?? getWorkspacesRoot();
29535
- const evalDir = path40.join(root, evalRunId);
29797
+ const evalDir = path41.join(root, evalRunId);
29536
29798
  if (await fileExists(evalDir)) {
29537
29799
  await rm4(evalDir, { recursive: true, force: true });
29538
29800
  }
@@ -29589,8 +29851,8 @@ async function copyDirectoryRecursive2(src, dest, skipDirs) {
29589
29851
  await mkdir13(dest, { recursive: true });
29590
29852
  const entries = await readdir5(src, { withFileTypes: true });
29591
29853
  for (const entry of entries) {
29592
- const srcPath = path41.join(src, entry.name);
29593
- const destPath = path41.join(dest, entry.name);
29854
+ const srcPath = path422.join(src, entry.name);
29855
+ const destPath = path422.join(dest, entry.name);
29594
29856
  if (entry.name === ".git") {
29595
29857
  continue;
29596
29858
  }
@@ -29623,7 +29885,7 @@ var WorkspacePoolManager = class {
29623
29885
  async acquireWorkspace(options) {
29624
29886
  const { templatePath, repos, maxSlots, repoManager, poolReset } = options;
29625
29887
  const fingerprint = computeWorkspaceFingerprint(repos);
29626
- const poolDir = path41.join(this.poolRoot, fingerprint);
29888
+ const poolDir = path422.join(this.poolRoot, fingerprint);
29627
29889
  await mkdir13(poolDir, { recursive: true });
29628
29890
  const drifted = await this.checkDrift(poolDir, fingerprint);
29629
29891
  if (drifted) {
@@ -29633,7 +29895,7 @@ var WorkspacePoolManager = class {
29633
29895
  await this.removeAllSlots(poolDir);
29634
29896
  }
29635
29897
  for (let i = 0; i < maxSlots; i++) {
29636
- const slotPath = path41.join(poolDir, `slot-${i}`);
29898
+ const slotPath = path422.join(poolDir, `slot-${i}`);
29637
29899
  const lockPath = `${slotPath}.lock`;
29638
29900
  const locked = await this.tryLock(lockPath);
29639
29901
  if (!locked) {
@@ -29695,7 +29957,7 @@ var WorkspacePoolManager = class {
29695
29957
  throw err;
29696
29958
  }
29697
29959
  try {
29698
- const pidStr = await readFile12(lockPath, "utf-8");
29960
+ const pidStr = await readFile13(lockPath, "utf-8");
29699
29961
  const pid = Number.parseInt(pidStr.trim(), 10);
29700
29962
  if (!Number.isNaN(pid)) {
29701
29963
  try {
@@ -29720,9 +29982,9 @@ var WorkspacePoolManager = class {
29720
29982
  * Returns false (no drift) if metadata.json doesn't exist (first use).
29721
29983
  */
29722
29984
  async checkDrift(poolDir, fingerprint) {
29723
- const metadataPath = path41.join(poolDir, "metadata.json");
29985
+ const metadataPath = path422.join(poolDir, "metadata.json");
29724
29986
  try {
29725
- const raw = await readFile12(metadataPath, "utf-8");
29987
+ const raw = await readFile13(metadataPath, "utf-8");
29726
29988
  const metadata = JSON.parse(raw);
29727
29989
  return metadata.fingerprint !== fingerprint;
29728
29990
  } catch {
@@ -29737,17 +29999,17 @@ var WorkspacePoolManager = class {
29737
29999
  repos,
29738
30000
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
29739
30001
  };
29740
- await writeFile7(path41.join(poolDir, "metadata.json"), JSON.stringify(metadata, null, 2));
30002
+ await writeFile7(path422.join(poolDir, "metadata.json"), JSON.stringify(metadata, null, 2));
29741
30003
  }
29742
30004
  /** Remove all slot directories and their lock files from a pool directory. */
29743
30005
  async removeAllSlots(poolDir) {
29744
30006
  const entries = await readdir5(poolDir);
29745
30007
  for (const entry of entries) {
29746
30008
  if (entry.startsWith("slot-") && !entry.endsWith(".lock")) {
29747
- const lockPath = path41.join(poolDir, `${entry}.lock`);
30009
+ const lockPath = path422.join(poolDir, `${entry}.lock`);
29748
30010
  if (existsSync3(lockPath)) {
29749
30011
  try {
29750
- const pidStr = await readFile12(lockPath, "utf-8");
30012
+ const pidStr = await readFile13(lockPath, "utf-8");
29751
30013
  const pid = Number.parseInt(pidStr.trim(), 10);
29752
30014
  if (!Number.isNaN(pid)) {
29753
30015
  try {
@@ -29760,12 +30022,12 @@ var WorkspacePoolManager = class {
29760
30022
  } catch {
29761
30023
  }
29762
30024
  }
29763
- await rm5(path41.join(poolDir, entry), { recursive: true, force: true });
30025
+ await rm5(path422.join(poolDir, entry), { recursive: true, force: true });
29764
30026
  await rm5(lockPath, { force: true }).catch(() => {
29765
30027
  });
29766
30028
  }
29767
30029
  }
29768
- await rm5(path41.join(poolDir, "metadata.json"), { force: true }).catch(() => {
30030
+ await rm5(path422.join(poolDir, "metadata.json"), { force: true }).catch(() => {
29769
30031
  });
29770
30032
  }
29771
30033
  /**
@@ -29775,7 +30037,7 @@ var WorkspacePoolManager = class {
29775
30037
  */
29776
30038
  async resetSlot(slotPath, templatePath, repos, poolReset = "fast") {
29777
30039
  for (const repo of repos) {
29778
- const repoDir = path41.join(slotPath, repo.path);
30040
+ const repoDir = path422.join(slotPath, repo.path);
29779
30041
  if (!existsSync3(repoDir)) {
29780
30042
  continue;
29781
30043
  }
@@ -29906,7 +30168,7 @@ ${lines.join("\n")}`;
29906
30168
  * Handles checkout, ref resolution, ancestor walking, shallow clone, sparse checkout.
29907
30169
  */
29908
30170
  async materialize(repo, workspacePath) {
29909
- const targetDir = path422.join(workspacePath, repo.path);
30171
+ const targetDir = path43.join(workspacePath, repo.path);
29910
30172
  const sourceUrl = getSourceUrl(repo.source);
29911
30173
  const startedAt = Date.now();
29912
30174
  if (this.verbose) {
@@ -29997,7 +30259,7 @@ ${lines.join("\n")}`;
29997
30259
  async reset(repos, workspacePath, reset) {
29998
30260
  const cleanFlag = reset === "strict" ? "-fdx" : "-fd";
29999
30261
  for (const repo of repos) {
30000
- const targetDir = path422.join(workspacePath, repo.path);
30262
+ const targetDir = path43.join(workspacePath, repo.path);
30001
30263
  await this.runGit(["reset", "--hard", "HEAD"], { cwd: targetDir });
30002
30264
  await this.runGit(["clean", cleanFlag], { cwd: targetDir });
30003
30265
  }
@@ -30007,11 +30269,11 @@ async function resolveWorkspaceTemplate(templatePath) {
30007
30269
  if (!templatePath) {
30008
30270
  return void 0;
30009
30271
  }
30010
- const resolved = path43.resolve(templatePath);
30272
+ const resolved = path44.resolve(templatePath);
30011
30273
  const stats = await stat7(resolved);
30012
30274
  if (stats.isFile()) {
30013
30275
  return {
30014
- dir: path43.dirname(resolved),
30276
+ dir: path44.dirname(resolved),
30015
30277
  workspaceFile: resolved
30016
30278
  };
30017
30279
  }
@@ -30023,14 +30285,14 @@ async function resolveWorkspaceTemplate(templatePath) {
30023
30285
  if (workspaceFiles.length === 1) {
30024
30286
  return {
30025
30287
  dir: resolved,
30026
- workspaceFile: path43.join(resolved, workspaceFiles[0])
30288
+ workspaceFile: path44.join(resolved, workspaceFiles[0])
30027
30289
  };
30028
30290
  }
30029
30291
  if (workspaceFiles.length > 1) {
30030
30292
  const conventionFile = workspaceFiles.find((f) => f === "template.code-workspace");
30031
30293
  return {
30032
30294
  dir: resolved,
30033
- workspaceFile: conventionFile ? path43.join(resolved, conventionFile) : void 0
30295
+ workspaceFile: conventionFile ? path44.join(resolved, conventionFile) : void 0
30034
30296
  };
30035
30297
  }
30036
30298
  return { dir: resolved };
@@ -30245,7 +30507,7 @@ async function runEvaluation(options) {
30245
30507
  ];
30246
30508
  const evaluatorRegistry = buildEvaluatorRegistry(evaluators, resolveGraderProvider);
30247
30509
  const typeRegistry = createBuiltinRegistry();
30248
- const discoveryBaseDir = evalFilePath ? path44.dirname(path44.resolve(evalFilePath)) : process.cwd();
30510
+ const discoveryBaseDir = evalFilePath ? path45.dirname(path45.resolve(evalFilePath)) : process.cwd();
30249
30511
  const evalDir = discoveryBaseDir;
30250
30512
  await discoverAssertions(typeRegistry, discoveryBaseDir);
30251
30513
  await discoverGraders(typeRegistry, discoveryBaseDir);
@@ -30384,8 +30646,8 @@ async function runEvaluation(options) {
30384
30646
  const poolSlotBaselines = /* @__PURE__ */ new Map();
30385
30647
  const poolMaxSlots = Math.min(configPoolMaxSlots ?? 10, 50);
30386
30648
  let staticMaterialised = false;
30649
+ const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
30387
30650
  if (useStaticWorkspace && configuredStaticPath) {
30388
- const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
30389
30651
  const dirExists = await stat8(configuredStaticPath).then(
30390
30652
  (s) => s.isDirectory(),
30391
30653
  () => false
@@ -30443,21 +30705,35 @@ async function runEvaluation(options) {
30443
30705
  }
30444
30706
  try {
30445
30707
  if (suiteWorkspaceFile && sharedWorkspacePath) {
30446
- const copiedWorkspaceFile = path44.join(sharedWorkspacePath, path44.basename(suiteWorkspaceFile));
30708
+ const copiedWorkspaceFile = path45.join(sharedWorkspacePath, path45.basename(suiteWorkspaceFile));
30447
30709
  try {
30448
30710
  await stat8(copiedWorkspaceFile);
30449
30711
  suiteWorkspaceFile = copiedWorkspaceFile;
30450
30712
  } catch {
30451
30713
  }
30452
30714
  }
30453
- const needsRepoMaterialisation = !!suiteWorkspace?.repos?.length && !usePool && (!useStaticWorkspace || staticMaterialised);
30454
- const repoManager = needsRepoMaterialisation ? new RepoManager(verbose) : void 0;
30455
- if (repoManager && sharedWorkspacePath && suiteWorkspace?.repos && !isPerTestIsolation) {
30456
- setupLog(
30457
- `materializing ${suiteWorkspace.repos.length} shared repo(s) into ${sharedWorkspacePath}`
30458
- );
30715
+ const hasReposToMaterialize = !!suiteWorkspace?.repos?.length && !usePool && !isPerTestIsolation;
30716
+ const needsRepoMaterialisation = hasReposToMaterialize && (!useStaticWorkspace || staticMaterialised);
30717
+ const needsPerRepoCheck = hasReposToMaterialize && useStaticWorkspace && !staticMaterialised && isYamlConfiguredPath;
30718
+ const repoManager = needsRepoMaterialisation || needsPerRepoCheck ? new RepoManager(verbose) : void 0;
30719
+ if (repoManager && sharedWorkspacePath && suiteWorkspace?.repos) {
30459
30720
  try {
30460
- await repoManager.materializeAll(suiteWorkspace.repos, sharedWorkspacePath);
30721
+ if (needsPerRepoCheck) {
30722
+ for (const repo of suiteWorkspace.repos) {
30723
+ const targetDir = path45.join(sharedWorkspacePath, repo.path);
30724
+ if (existsSync5(targetDir)) {
30725
+ setupLog(`reusing existing repo at: ${targetDir}`);
30726
+ continue;
30727
+ }
30728
+ setupLog(`materializing missing repo: ${repo.path}`);
30729
+ await repoManager.materialize(repo, sharedWorkspacePath);
30730
+ }
30731
+ } else {
30732
+ setupLog(
30733
+ `materializing ${suiteWorkspace.repos.length} shared repo(s) into ${sharedWorkspacePath}`
30734
+ );
30735
+ await repoManager.materializeAll(suiteWorkspace.repos, sharedWorkspacePath);
30736
+ }
30461
30737
  setupLog("shared repo materialization complete");
30462
30738
  } catch (error) {
30463
30739
  const message = error instanceof Error ? error.message : String(error);
@@ -31031,7 +31307,7 @@ async function runEvalCase(options) {
31031
31307
  );
31032
31308
  }
31033
31309
  if (caseWorkspaceFile && workspacePath) {
31034
- const copiedFile = path44.join(workspacePath, path44.basename(caseWorkspaceFile));
31310
+ const copiedFile = path45.join(workspacePath, path45.basename(caseWorkspaceFile));
31035
31311
  try {
31036
31312
  await stat8(copiedFile);
31037
31313
  caseWorkspaceFile = copiedFile;
@@ -31093,10 +31369,10 @@ async function runEvalCase(options) {
31093
31369
  const files = evalCase.metadata.agent_skills_files;
31094
31370
  if (baseDir && files.length > 0) {
31095
31371
  for (const relPath of files) {
31096
- const srcPath = path44.resolve(baseDir, relPath);
31097
- const destPath = path44.resolve(workspacePath, relPath);
31372
+ const srcPath = path45.resolve(baseDir, relPath);
31373
+ const destPath = path45.resolve(workspacePath, relPath);
31098
31374
  try {
31099
- await mkdir14(path44.dirname(destPath), { recursive: true });
31375
+ await mkdir14(path45.dirname(destPath), { recursive: true });
31100
31376
  await copyFile2(srcPath, destPath);
31101
31377
  } catch (error) {
31102
31378
  const message = error instanceof Error ? error.message : String(error);
@@ -31692,6 +31968,7 @@ async function runEvaluatorsForCase(options) {
31692
31968
  if (!activeEvaluator) {
31693
31969
  throw new Error(`No evaluator registered for kind '${evaluatorKind}'`);
31694
31970
  }
31971
+ const implicitEvaluator = evaluatorKind === "llm-grader" && !evalCase.assertions ? buildImplicitLlmGraderConfig(evalCase) : void 0;
31695
31972
  const score = await activeEvaluator.evaluate({
31696
31973
  evalCase,
31697
31974
  candidate,
@@ -31711,10 +31988,21 @@ async function runEvaluatorsForCase(options) {
31711
31988
  targetResolver,
31712
31989
  availableTargets,
31713
31990
  fileChanges,
31714
- workspacePath
31991
+ workspacePath,
31992
+ ...implicitEvaluator ? { evaluator: implicitEvaluator } : {}
31715
31993
  });
31716
31994
  return { score };
31717
31995
  }
31996
+ function buildImplicitLlmGraderConfig(evalCase) {
31997
+ if (!evalCase.preprocessors || evalCase.preprocessors.length === 0) {
31998
+ return void 0;
31999
+ }
32000
+ return {
32001
+ name: "llm-grader",
32002
+ type: "llm-grader",
32003
+ preprocessors: evalCase.preprocessors
32004
+ };
32005
+ }
31718
32006
  async function runEvaluatorList(options) {
31719
32007
  const {
31720
32008
  evalCase,
@@ -31764,7 +32052,7 @@ async function runEvaluatorList(options) {
31764
32052
  fileChanges,
31765
32053
  workspacePath
31766
32054
  };
31767
- const evalFileDir = evalCase.file_paths[0] ? path44.dirname(evalCase.file_paths[0]) : process.cwd();
32055
+ const evalFileDir = evalCase.file_paths[0] ? path45.dirname(evalCase.file_paths[0]) : process.cwd();
31768
32056
  const dispatchContext = {
31769
32057
  graderProvider,
31770
32058
  targetResolver,
@@ -32161,7 +32449,7 @@ async function evaluate(config) {
32161
32449
  }
32162
32450
  const gitRoot = await findGitRoot(process.cwd());
32163
32451
  const repoRoot = gitRoot ?? process.cwd();
32164
- const testFilePath = config.specFile ? path45.resolve(config.specFile) : path45.join(process.cwd(), "__programmatic__.yaml");
32452
+ const testFilePath = config.specFile ? path46.resolve(config.specFile) : path46.join(process.cwd(), "__programmatic__.yaml");
32165
32453
  await loadEnvHierarchy(repoRoot, testFilePath);
32166
32454
  let resolvedTarget;
32167
32455
  let taskProvider;
@@ -32276,11 +32564,11 @@ function computeSummary(results, durationMs, threshold = DEFAULT_THRESHOLD) {
32276
32564
  var TARGET_FILE_CANDIDATES = [".agentv/targets.yaml", ".agentv/targets.yml"];
32277
32565
  async function discoverDefaultTarget(repoRoot) {
32278
32566
  const cwd = process.cwd();
32279
- const chain = buildDirectoryChain(path45.join(cwd, "_placeholder"), repoRoot);
32567
+ const chain = buildDirectoryChain(path46.join(cwd, "_placeholder"), repoRoot);
32280
32568
  for (const dir of chain) {
32281
32569
  for (const candidate of TARGET_FILE_CANDIDATES) {
32282
- const targetsPath = path45.join(dir, candidate);
32283
- if (!existsSync5(targetsPath)) continue;
32570
+ const targetsPath = path46.join(dir, candidate);
32571
+ if (!existsSync6(targetsPath)) continue;
32284
32572
  try {
32285
32573
  const definitions = await readTargetDefinitions(targetsPath);
32286
32574
  const defaultTarget = definitions.find((d) => d.name === "default");
@@ -32296,8 +32584,8 @@ async function loadEnvHierarchy(repoRoot, startPath) {
32296
32584
  const chain = buildDirectoryChain(startPath, repoRoot);
32297
32585
  const envFiles = [];
32298
32586
  for (const dir of chain) {
32299
- const envPath = path45.join(dir, ".env");
32300
- if (existsSync5(envPath)) envFiles.push(envPath);
32587
+ const envPath = path46.join(dir, ".env");
32588
+ if (existsSync6(envPath)) envFiles.push(envPath);
32301
32589
  }
32302
32590
  for (let i = 0; i < envFiles.length; i++) {
32303
32591
  try {
@@ -32370,12 +32658,12 @@ var CONFIG_FILE_NAMES = [
32370
32658
  ".agentv/config.js"
32371
32659
  ];
32372
32660
  async function loadTsConfig(projectRoot) {
32373
- const { existsSync: existsSync7 } = await import("node:fs");
32661
+ const { existsSync: existsSync8 } = await import("node:fs");
32374
32662
  const { pathToFileURL: pathToFileURL2 } = await import("node:url");
32375
32663
  const { join: join2 } = await import("node:path");
32376
32664
  for (const fileName of CONFIG_FILE_NAMES) {
32377
32665
  const filePath = join2(projectRoot, fileName);
32378
- if (!existsSync7(filePath)) {
32666
+ if (!existsSync8(filePath)) {
32379
32667
  continue;
32380
32668
  }
32381
32669
  try {
@@ -32511,11 +32799,11 @@ async function scanRepoDeps(evalFilePaths) {
32511
32799
  return { repos: [...seen.values()], errors };
32512
32800
  }
32513
32801
  async function extractReposFromEvalFile(filePath) {
32514
- const content = await readFile13(filePath, "utf8");
32802
+ const content = await readFile14(filePath, "utf8");
32515
32803
  const parsed = interpolateEnv(parse5(content), process.env);
32516
32804
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
32517
32805
  const obj = parsed;
32518
- const evalFileDir = path46.dirname(path46.resolve(filePath));
32806
+ const evalFileDir = path47.dirname(path47.resolve(filePath));
32519
32807
  const repos = [];
32520
32808
  const suiteRepos = await extractReposFromWorkspaceRaw(obj.workspace, evalFileDir);
32521
32809
  repos.push(...suiteRepos);
@@ -32531,8 +32819,8 @@ async function extractReposFromEvalFile(filePath) {
32531
32819
  }
32532
32820
  async function extractReposFromWorkspaceRaw(raw, evalFileDir) {
32533
32821
  if (typeof raw === "string") {
32534
- const workspaceFilePath = path46.resolve(evalFileDir, raw);
32535
- const content = await readFile13(workspaceFilePath, "utf8");
32822
+ const workspaceFilePath = path47.resolve(evalFileDir, raw);
32823
+ const content = await readFile14(workspaceFilePath, "utf8");
32536
32824
  const parsed = interpolateEnv(parse5(content), process.env);
32537
32825
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
32538
32826
  return extractReposFromObject(parsed);
@@ -32567,7 +32855,7 @@ var ResponseCache = class {
32567
32855
  async get(key) {
32568
32856
  const filePath = this.keyToPath(key);
32569
32857
  try {
32570
- const data = await readFile14(filePath, "utf8");
32858
+ const data = await readFile15(filePath, "utf8");
32571
32859
  return JSON.parse(data);
32572
32860
  } catch {
32573
32861
  return void 0;
@@ -32575,13 +32863,13 @@ var ResponseCache = class {
32575
32863
  }
32576
32864
  async set(key, value) {
32577
32865
  const filePath = this.keyToPath(key);
32578
- const dir = path47.dirname(filePath);
32866
+ const dir = path48.dirname(filePath);
32579
32867
  await mkdir15(dir, { recursive: true });
32580
32868
  await writeFile8(filePath, JSON.stringify(value, null, 2), "utf8");
32581
32869
  }
32582
32870
  keyToPath(key) {
32583
32871
  const prefix = key.slice(0, 2);
32584
- return path47.join(this.cachePath, prefix, `${key}.json`);
32872
+ return path48.join(this.cachePath, prefix, `${key}.json`);
32585
32873
  }
32586
32874
  };
32587
32875
  function shouldEnableCache(params) {
@@ -32596,11 +32884,11 @@ function shouldSkipCacheForTemperature(targetConfig) {
32596
32884
  return false;
32597
32885
  }
32598
32886
  function getProjectsRegistryPath() {
32599
- return path48.join(getAgentvHome(), "projects.yaml");
32887
+ return path49.join(getAgentvHome(), "projects.yaml");
32600
32888
  }
32601
32889
  function loadProjectRegistry() {
32602
32890
  const registryPath = getProjectsRegistryPath();
32603
- if (!existsSync6(registryPath)) {
32891
+ if (!existsSync7(registryPath)) {
32604
32892
  return { projects: [] };
32605
32893
  }
32606
32894
  try {
@@ -32616,14 +32904,14 @@ function loadProjectRegistry() {
32616
32904
  }
32617
32905
  function saveProjectRegistry(registry) {
32618
32906
  const registryPath = getProjectsRegistryPath();
32619
- const dir = path48.dirname(registryPath);
32620
- if (!existsSync6(dir)) {
32907
+ const dir = path49.dirname(registryPath);
32908
+ if (!existsSync7(dir)) {
32621
32909
  mkdirSync2(dir, { recursive: true });
32622
32910
  }
32623
32911
  writeFileSync(registryPath, stringifyYaml(registry), "utf-8");
32624
32912
  }
32625
32913
  function deriveProjectId(dirPath, existingIds) {
32626
- const base = path48.basename(dirPath).toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
32914
+ const base = path49.basename(dirPath).toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
32627
32915
  let candidate = base || "project";
32628
32916
  let suffix = 2;
32629
32917
  while (existingIds.includes(candidate)) {
@@ -32633,11 +32921,11 @@ function deriveProjectId(dirPath, existingIds) {
32633
32921
  return candidate;
32634
32922
  }
32635
32923
  function addProject(projectPath) {
32636
- const absPath = path48.resolve(projectPath);
32637
- if (!existsSync6(absPath)) {
32924
+ const absPath = path49.resolve(projectPath);
32925
+ if (!existsSync7(absPath)) {
32638
32926
  throw new Error(`Directory not found: ${absPath}`);
32639
32927
  }
32640
- if (!existsSync6(path48.join(absPath, ".agentv"))) {
32928
+ if (!existsSync7(path49.join(absPath, ".agentv"))) {
32641
32929
  throw new Error(`No .agentv/ directory found in ${absPath}. Run an evaluation first.`);
32642
32930
  }
32643
32931
  const registry = loadProjectRegistry();
@@ -32651,7 +32939,7 @@ function addProject(projectPath) {
32651
32939
  absPath,
32652
32940
  registry.projects.map((p) => p.id)
32653
32941
  ),
32654
- name: path48.basename(absPath),
32942
+ name: path49.basename(absPath),
32655
32943
  path: absPath,
32656
32944
  addedAt: now2,
32657
32945
  lastOpenedAt: now2
@@ -32680,14 +32968,14 @@ function touchProject(projectId) {
32680
32968
  }
32681
32969
  }
32682
32970
  function discoverProjects(rootDir, maxDepth = 2) {
32683
- const absRoot = path48.resolve(rootDir);
32684
- if (!existsSync6(absRoot) || !statSync2(absRoot).isDirectory()) {
32971
+ const absRoot = path49.resolve(rootDir);
32972
+ if (!existsSync7(absRoot) || !statSync2(absRoot).isDirectory()) {
32685
32973
  return [];
32686
32974
  }
32687
32975
  const results = [];
32688
32976
  function scan(dir, depth) {
32689
32977
  if (depth > maxDepth) return;
32690
- if (existsSync6(path48.join(dir, ".agentv"))) {
32978
+ if (existsSync7(path49.join(dir, ".agentv"))) {
32691
32979
  results.push(dir);
32692
32980
  return;
32693
32981
  }
@@ -32697,7 +32985,7 @@ function discoverProjects(rootDir, maxDepth = 2) {
32697
32985
  for (const entry of entries) {
32698
32986
  if (!entry.isDirectory()) continue;
32699
32987
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
32700
- scan(path48.join(dir, entry.name), depth + 1);
32988
+ scan(path49.join(dir, entry.name), depth + 1);
32701
32989
  }
32702
32990
  } catch {
32703
32991
  }
@@ -33596,7 +33884,7 @@ function extractResponseItemContent(content) {
33596
33884
  }
33597
33885
  return parts.length > 0 ? parts.join("") : void 0;
33598
33886
  }
33599
- var DEFAULT_SESSIONS_DIR = () => path49.join(homedir3(), ".codex", "sessions");
33887
+ var DEFAULT_SESSIONS_DIR = () => path50.join(homedir3(), ".codex", "sessions");
33600
33888
  async function discoverCodexSessions(opts) {
33601
33889
  const sessionsDir = opts?.sessionsDir ?? DEFAULT_SESSIONS_DIR();
33602
33890
  const limit = opts?.latest ? 1 : opts?.limit ?? 10;
@@ -33608,7 +33896,7 @@ async function discoverCodexSessions(opts) {
33608
33896
  return [];
33609
33897
  }
33610
33898
  for (const year of yearDirs) {
33611
- const yearPath = path49.join(sessionsDir, year);
33899
+ const yearPath = path50.join(sessionsDir, year);
33612
33900
  let monthDirs;
33613
33901
  try {
33614
33902
  monthDirs = await readdir8(yearPath);
@@ -33616,7 +33904,7 @@ async function discoverCodexSessions(opts) {
33616
33904
  continue;
33617
33905
  }
33618
33906
  for (const month of monthDirs) {
33619
- const monthPath = path49.join(yearPath, month);
33907
+ const monthPath = path50.join(yearPath, month);
33620
33908
  let dayDirs;
33621
33909
  try {
33622
33910
  dayDirs = await readdir8(monthPath);
@@ -33628,7 +33916,7 @@ async function discoverCodexSessions(opts) {
33628
33916
  const dirDate = `${year}-${month}-${day}`;
33629
33917
  if (dirDate !== opts.date) continue;
33630
33918
  }
33631
- const dayPath = path49.join(monthPath, day);
33919
+ const dayPath = path50.join(monthPath, day);
33632
33920
  let files;
33633
33921
  try {
33634
33922
  files = await readdir8(dayPath);
@@ -33637,7 +33925,7 @@ async function discoverCodexSessions(opts) {
33637
33925
  }
33638
33926
  for (const file of files) {
33639
33927
  if (!file.startsWith("rollout-") || !file.endsWith(".jsonl")) continue;
33640
- const filePath = path49.join(dayPath, file);
33928
+ const filePath = path50.join(dayPath, file);
33641
33929
  const nameWithoutExt = file.replace(/\.jsonl$/, "");
33642
33930
  const parts = nameWithoutExt.split("-");
33643
33931
  const sessionId = parts.length >= 6 ? parts.slice(-5).join("-") : nameWithoutExt;
@@ -33656,7 +33944,7 @@ async function discoverCodexSessions(opts) {
33656
33944
  sessions.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
33657
33945
  return sessions.slice(0, limit);
33658
33946
  }
33659
- var DEFAULT_PROJECTS_DIR = () => path50.join(homedir4(), ".claude", "projects");
33947
+ var DEFAULT_PROJECTS_DIR = () => path51.join(homedir4(), ".claude", "projects");
33660
33948
  function encodeProjectPath(projectPath) {
33661
33949
  return projectPath.replace(/\//g, "-");
33662
33950
  }
@@ -33675,7 +33963,7 @@ async function discoverClaudeSessions(opts) {
33675
33963
  }
33676
33964
  const sessions = [];
33677
33965
  for (const projectDir of projectDirs) {
33678
- const dirPath = path50.join(projectsDir, projectDir);
33966
+ const dirPath = path51.join(projectsDir, projectDir);
33679
33967
  let entries;
33680
33968
  try {
33681
33969
  entries = await readdir9(dirPath);
@@ -33686,7 +33974,7 @@ async function discoverClaudeSessions(opts) {
33686
33974
  if (!entry.endsWith(".jsonl")) continue;
33687
33975
  const sessionId = entry.replace(/\.jsonl$/, "");
33688
33976
  if (opts?.sessionId && sessionId !== opts.sessionId) continue;
33689
- const filePath = path50.join(dirPath, entry);
33977
+ const filePath = path51.join(dirPath, entry);
33690
33978
  let updatedAt;
33691
33979
  try {
33692
33980
  const fileStat = await stat10(filePath);
@@ -33730,11 +34018,11 @@ function toTranscriptJsonLine(entry) {
33730
34018
  };
33731
34019
  }
33732
34020
  async function readTranscriptJsonl(filePath) {
33733
- const text2 = await readFile15(filePath, "utf8");
34021
+ const text2 = await readFile16(filePath, "utf8");
33734
34022
  return text2.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
33735
34023
  }
33736
34024
  async function readTranscriptFile(filePath) {
33737
- return readFile15(filePath, "utf8");
34025
+ return readFile16(filePath, "utf8");
33738
34026
  }
33739
34027
  var TranscriptProvider = class _TranscriptProvider {
33740
34028
  id;
@@ -33966,4 +34254,4 @@ export {
33966
34254
  TranscriptProvider,
33967
34255
  createAgentKernel
33968
34256
  };
33969
- //# sourceMappingURL=chunk-7K5LYK5B.js.map
34257
+ //# sourceMappingURL=chunk-SE73HJZG.js.map