agentv 4.9.1 → 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,52 +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";
14531
14534
  import { existsSync as existsSync5 } from "node:fs";
14532
14535
  import { copyFile as copyFile2, mkdir as mkdir14, readdir as readdir7, stat as stat8 } from "node:fs/promises";
14533
- import path44 from "node:path";
14536
+ import path45 from "node:path";
14534
14537
  import micromatch3 from "micromatch";
14535
- import path36 from "node:path";
14536
14538
  import path37 from "node:path";
14537
- import fg22 from "fast-glob";
14538
14539
  import path38 from "node:path";
14540
+ import fg22 from "fast-glob";
14541
+ import path39 from "node:path";
14539
14542
  import fg3 from "fast-glob";
14540
14543
  import { exec as execCallback } from "node:child_process";
14541
14544
  import { readdirSync as readdirSync2, statSync } from "node:fs";
14542
- import path39 from "node:path";
14545
+ import path40 from "node:path";
14543
14546
  import { promisify as promisify4 } from "node:util";
14544
14547
  import { cp, mkdir as mkdir12, readdir as readdir4, rm as rm4, stat as stat6 } from "node:fs/promises";
14545
- import path40 from "node:path";
14548
+ import path41 from "node:path";
14546
14549
  import { execFile } from "node:child_process";
14547
14550
  import { createHash } from "node:crypto";
14548
14551
  import { existsSync as existsSync3 } from "node:fs";
14549
- import { cp as cp2, mkdir as mkdir13, readFile as readFile12, readdir as readdir5, rm as rm5, unlink, writeFile as writeFile7 } from "node:fs/promises";
14550
- 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";
14551
14554
  import { promisify as promisify5 } from "node:util";
14552
14555
  import { execFile as execFile2 } from "node:child_process";
14553
14556
  import { existsSync as existsSync4 } from "node:fs";
14554
- import path422 from "node:path";
14557
+ import path43 from "node:path";
14555
14558
  import { promisify as promisify6 } from "node:util";
14556
14559
  import { readdir as readdir6, stat as stat7 } from "node:fs/promises";
14557
- import path43 from "node:path";
14560
+ import path44 from "node:path";
14558
14561
  import { existsSync as existsSync6 } from "node:fs";
14559
- import path45 from "node:path";
14560
- import { readFile as readFile13 } from "node:fs/promises";
14561
14562
  import path46 from "node:path";
14562
- import { parse as parse5 } from "yaml";
14563
- import { mkdir as mkdir15, readFile as readFile14, writeFile as writeFile8 } from "node:fs/promises";
14563
+ import { readFile as readFile14 } from "node:fs/promises";
14564
14564
  import path47 from "node:path";
14565
- import { existsSync as existsSync7, 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";
14566
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";
14567
14570
  import { parse as parseYaml3, stringify as stringifyYaml } from "yaml";
14568
14571
  import { readdir as readdir8, stat as stat9 } from "node:fs/promises";
14569
14572
  import { homedir as homedir3 } from "node:os";
14570
- import path49 from "node:path";
14573
+ import path50 from "node:path";
14571
14574
  import { readdir as readdir9, stat as stat10 } from "node:fs/promises";
14572
14575
  import { homedir as homedir4 } from "node:os";
14573
- import path50 from "node:path";
14574
- import { readFile as readFile15 } from "node:fs/promises";
14576
+ import path51 from "node:path";
14577
+ import { readFile as readFile16 } from "node:fs/promises";
14575
14578
  function computeTraceSummary(messages) {
14576
14579
  const toolCallCounts = {};
14577
14580
  const toolDurations = {};
@@ -15195,6 +15198,305 @@ function parseExecutionDefaults(raw, configPath) {
15195
15198
  function logWarning(message) {
15196
15199
  console.warn(`${ANSI_YELLOW2}Warning: ${message}${ANSI_RESET22}`);
15197
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
+ }
15198
15500
  var TEMPLATE_VARIABLES = {
15199
15501
  EXPECTED_OUTPUT: "expected_output",
15200
15502
  CRITERIA: "criteria",
@@ -15221,7 +15523,7 @@ var DEPRECATED_TEMPLATE_VARIABLES = /* @__PURE__ */ new Map([
15221
15523
  var ANSI_YELLOW22 = "\x1B[33m";
15222
15524
  var ANSI_RESET3 = "\x1B[0m";
15223
15525
  async function validateCustomPromptContent(promptPath) {
15224
- const content = await readFile32(promptPath, "utf8");
15526
+ const content = await readFile4(promptPath, "utf8");
15225
15527
  validateTemplateVariables(content, promptPath);
15226
15528
  }
15227
15529
  function validateTemplateVariables(content, source) {
@@ -15276,22 +15578,32 @@ function normalizeEvaluatorType(type) {
15276
15578
  function isDeprecatedJudgeType(type) {
15277
15579
  return type === "code-judge" || type === "llm-judge";
15278
15580
  }
15279
- async function parseEvaluators(rawEvalCase, globalExecution, searchRoots, evalId) {
15581
+ async function parseEvaluators(rawEvalCase, globalExecution, searchRoots, evalId, defaultPreprocessors) {
15280
15582
  const execution = rawEvalCase.execution;
15281
15583
  const executionObject = isJsonObject2(execution) ? execution : void 0;
15282
15584
  const caseEvaluators = rawEvalCase.assertions ?? rawEvalCase.assert ?? (executionObject ? executionObject.evaluators : void 0) ?? // deprecated: use assertions
15283
15585
  rawEvalCase.evaluators;
15284
15586
  const skipDefaults = executionObject?.skip_defaults === true;
15285
15587
  const rootEvaluators = skipDefaults ? void 0 : globalExecution?.assertions ?? globalExecution?.assert ?? globalExecution?.evaluators;
15286
- const parsedCase = await parseEvaluatorList(caseEvaluators, searchRoots, evalId);
15287
- 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
+ );
15288
15600
  if (!parsedCase && !parsedRoot) {
15289
15601
  return void 0;
15290
15602
  }
15291
15603
  const evaluators = [...parsedCase ?? [], ...parsedRoot ?? []];
15292
15604
  return evaluators.length > 0 ? evaluators : void 0;
15293
15605
  }
15294
- async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15606
+ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId, defaultPreprocessors) {
15295
15607
  if (candidateEvaluators === void 0) {
15296
15608
  return void 0;
15297
15609
  }
@@ -15356,6 +15668,13 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15356
15668
  continue;
15357
15669
  }
15358
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
+ );
15359
15678
  if (isCustomType) {
15360
15679
  const weight2 = validateWeight(rawEvaluator.weight, name21, evalId);
15361
15680
  const { required: required2, min_score: min_score2 } = parseRequiredAndMinScore(
@@ -15414,7 +15733,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15414
15733
  if (cwd) {
15415
15734
  const resolved = await resolveFileReference22(cwd, searchRoots);
15416
15735
  if (resolved.resolvedPath) {
15417
- resolvedCwd = path42.resolve(resolved.resolvedPath);
15736
+ resolvedCwd = path5.resolve(resolved.resolvedPath);
15418
15737
  } else {
15419
15738
  logWarning2(
15420
15739
  `Code-grader evaluator '${name21}' in '${evalId}': cwd not found (${resolved.displayPath})`,
@@ -15460,6 +15779,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15460
15779
  "cwd",
15461
15780
  "weight",
15462
15781
  "target",
15782
+ "preprocessors",
15463
15783
  "required",
15464
15784
  "negate"
15465
15785
  ]);
@@ -15480,6 +15800,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15480
15800
  ...min_score2 !== void 0 ? { min_score: min_score2 } : {},
15481
15801
  ...negate !== void 0 ? { negate } : {},
15482
15802
  ...Object.keys(config2).length > 0 ? { config: config2 } : {},
15803
+ ...mergedPreprocessors ? { preprocessors: mergedPreprocessors } : {},
15483
15804
  ...targetConfig !== void 0 ? { target: targetConfig } : {}
15484
15805
  });
15485
15806
  continue;
@@ -15589,7 +15910,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
15589
15910
  aggregatorPrompt = fileRef;
15590
15911
  const resolved = await resolveFileReference22(fileRef, searchRoots);
15591
15912
  if (resolved.resolvedPath) {
15592
- promptPath2 = path42.resolve(resolved.resolvedPath);
15913
+ promptPath2 = path5.resolve(resolved.resolvedPath);
15593
15914
  } else {
15594
15915
  throw new Error(
15595
15916
  `Composite aggregator in '${evalId}': prompt file not found: ${resolved.displayPath}`
@@ -16243,7 +16564,8 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16243
16564
  ...weight2 !== void 0 ? { weight: weight2 } : {},
16244
16565
  ...required2 !== void 0 ? { required: required2 } : {},
16245
16566
  ...min_score2 !== void 0 ? { min_score: min_score2 } : {},
16246
- ...negate !== void 0 ? { negate } : {}
16567
+ ...negate !== void 0 ? { negate } : {},
16568
+ ...mergedPreprocessors ? { preprocessors: mergedPreprocessors } : {}
16247
16569
  });
16248
16570
  continue;
16249
16571
  }
@@ -16268,7 +16590,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16268
16590
  const commandPath = commandArray[commandArray.length - 1];
16269
16591
  const resolved = await resolveFileReference22(commandPath, searchRoots);
16270
16592
  if (resolved.resolvedPath) {
16271
- resolvedPromptScript = [...commandArray.slice(0, -1), path42.resolve(resolved.resolvedPath)];
16593
+ resolvedPromptScript = [...commandArray.slice(0, -1), path5.resolve(resolved.resolvedPath)];
16272
16594
  } else {
16273
16595
  throw new Error(
16274
16596
  `Evaluator '${name21}' in '${evalId}': prompt command file not found: ${resolved.displayPath}`
@@ -16283,7 +16605,7 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16283
16605
  prompt = fileRef;
16284
16606
  const resolved = await resolveFileReference22(fileRef, searchRoots);
16285
16607
  if (resolved.resolvedPath) {
16286
- promptPath = path42.resolve(resolved.resolvedPath);
16608
+ promptPath = path5.resolve(resolved.resolvedPath);
16287
16609
  try {
16288
16610
  await validateCustomPromptContent(promptPath);
16289
16611
  } catch (error) {
@@ -16326,7 +16648,8 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16326
16648
  ...weight2 !== void 0 ? { weight: weight2 } : {},
16327
16649
  ...required2 !== void 0 ? { required: required2 } : {},
16328
16650
  ...min_score2 !== void 0 ? { min_score: min_score2 } : {},
16329
- ...negate !== void 0 ? { negate } : {}
16651
+ ...negate !== void 0 ? { negate } : {},
16652
+ ...mergedPreprocessors ? { preprocessors: mergedPreprocessors } : {}
16330
16653
  });
16331
16654
  continue;
16332
16655
  }
@@ -16351,7 +16674,8 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16351
16674
  "negate",
16352
16675
  "max_steps",
16353
16676
  "maxSteps",
16354
- "temperature"
16677
+ "temperature",
16678
+ "preprocessors"
16355
16679
  ]);
16356
16680
  const config = {};
16357
16681
  for (const [key, value] of Object.entries(rawEvaluator)) {
@@ -16381,30 +16705,70 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
16381
16705
  ...negate !== void 0 ? { negate } : {},
16382
16706
  ...finalConfig ? { config: finalConfig } : {},
16383
16707
  ...llmMaxSteps !== void 0 ? { max_steps: llmMaxSteps } : {},
16384
- ...llmTemperature !== void 0 ? { temperature: llmTemperature } : {}
16708
+ ...llmTemperature !== void 0 ? { temperature: llmTemperature } : {},
16709
+ ...mergedPreprocessors ? { preprocessors: mergedPreprocessors } : {}
16385
16710
  });
16386
16711
  }
16387
16712
  return evaluators.length > 0 ? evaluators : void 0;
16388
16713
  }
16389
- var ASSERTION_TYPES = /* @__PURE__ */ new Set([
16390
- "skill-trigger",
16391
- "contains",
16392
- "contains-any",
16393
- "contains-all",
16394
- "icontains",
16395
- "icontains-any",
16396
- "icontains-all",
16397
- "starts-with",
16398
- "ends-with",
16399
- "regex",
16400
- "is-json",
16401
- "equals",
16402
- "rubrics"
16403
- ]);
16404
- function generateAssertionName(typeValue, rawEvaluator) {
16405
- 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)) {
16406
16718
  return void 0;
16407
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) {
16731
+ return void 0;
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) {
16408
16772
  const value = asString(rawEvaluator.value);
16409
16773
  const arrayValue = Array.isArray(rawEvaluator.value) ? rawEvaluator.value : void 0;
16410
16774
  switch (typeValue) {
@@ -16437,7 +16801,7 @@ function generateAssertionName(typeValue, rawEvaluator) {
16437
16801
  case "rubrics":
16438
16802
  return "rubrics";
16439
16803
  default:
16440
- return void 0;
16804
+ return typeValue;
16441
16805
  }
16442
16806
  }
16443
16807
  function coerceEvaluator(candidate, contextId) {
@@ -16854,7 +17218,7 @@ var IMAGE_MEDIA_TYPES = {
16854
17218
  ".bmp": "image/bmp"
16855
17219
  };
16856
17220
  function detectImageMediaType(filePath) {
16857
- const ext = path5.extname(filePath).toLowerCase();
17221
+ const ext = path6.extname(filePath).toLowerCase();
16858
17222
  return IMAGE_MEDIA_TYPES[ext];
16859
17223
  }
16860
17224
  var ANSI_YELLOW4 = "\x1B[33m";
@@ -16904,12 +17268,12 @@ async function processMessages(options) {
16904
17268
  continue;
16905
17269
  }
16906
17270
  try {
16907
- const fileContent = (await readFile4(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
17271
+ const fileContent = (await readFile5(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
16908
17272
  processedContent.push({
16909
17273
  ...cloneJsonObject(rawSegment),
16910
17274
  path: displayPath,
16911
17275
  text: fileContent,
16912
- resolvedPath: path5.resolve(resolvedPath)
17276
+ resolvedPath: path6.resolve(resolvedPath)
16913
17277
  });
16914
17278
  if (verbose) {
16915
17279
  const label = messageType === "input" ? "[File]" : "[Expected Output File]";
@@ -16945,7 +17309,7 @@ async function processMessages(options) {
16945
17309
  continue;
16946
17310
  }
16947
17311
  try {
16948
- const imageBuffer = await readFile4(resolvedPath);
17312
+ const imageBuffer = await readFile5(resolvedPath);
16949
17313
  const base64 = imageBuffer.toString("base64");
16950
17314
  processedContent.push({
16951
17315
  type: "image",
@@ -17022,12 +17386,12 @@ async function processExpectedMessages(options) {
17022
17386
  continue;
17023
17387
  }
17024
17388
  try {
17025
- const fileContent = (await readFile4(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
17389
+ const fileContent = (await readFile5(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
17026
17390
  processedContent.push({
17027
17391
  type: "file",
17028
17392
  path: displayPath,
17029
17393
  text: fileContent,
17030
- resolvedPath: path5.resolve(resolvedPath)
17394
+ resolvedPath: path6.resolve(resolvedPath)
17031
17395
  });
17032
17396
  if (verbose) {
17033
17397
  console.log(` [Expected Output File] Found: ${displayPath}`);
@@ -17062,7 +17426,7 @@ async function processExpectedMessages(options) {
17062
17426
  continue;
17063
17427
  }
17064
17428
  try {
17065
- const imageBuffer = await readFile4(resolvedPath);
17429
+ const imageBuffer = await readFile5(resolvedPath);
17066
17430
  const base64 = imageBuffer.toString("base64");
17067
17431
  processedContent.push({
17068
17432
  type: "image",
@@ -17167,7 +17531,7 @@ function matchesFilter(id, filter2) {
17167
17531
  return typeof filter2 === "string" ? micromatch.isMatch(id, filter2) : filter2.some((pattern) => micromatch.isMatch(id, pattern));
17168
17532
  }
17169
17533
  function detectFormat(filePath) {
17170
- const ext = path6.extname(filePath).toLowerCase();
17534
+ const ext = path7.extname(filePath).toLowerCase();
17171
17535
  if (ext === ".jsonl") return "jsonl";
17172
17536
  if (ext === ".yaml" || ext === ".yml") return "yaml";
17173
17537
  if (ext === ".json") return "agent-skills-json";
@@ -17176,9 +17540,9 @@ function detectFormat(filePath) {
17176
17540
  );
17177
17541
  }
17178
17542
  async function loadSidecarMetadata(jsonlPath, verbose) {
17179
- const dir = path6.dirname(jsonlPath);
17180
- const base = path6.basename(jsonlPath, ".jsonl");
17181
- 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`);
17182
17546
  if (!await fileExists2(sidecarPath)) {
17183
17547
  if (verbose) {
17184
17548
  logWarning4(`Sidecar metadata file not found: ${sidecarPath} (using defaults)`);
@@ -17186,7 +17550,7 @@ async function loadSidecarMetadata(jsonlPath, verbose) {
17186
17550
  return {};
17187
17551
  }
17188
17552
  try {
17189
- const content = await readFile5(sidecarPath, "utf8");
17553
+ const content = await readFile6(sidecarPath, "utf8");
17190
17554
  const parsed = interpolateEnv(parseYaml2(content), process.env);
17191
17555
  if (!isJsonObject(parsed)) {
17192
17556
  logWarning4(`Invalid sidecar metadata format in ${sidecarPath}`);
@@ -17227,13 +17591,13 @@ function parseJsonlContent(content, filePath) {
17227
17591
  async function loadTestsFromJsonl(evalFilePath, repoRoot, options) {
17228
17592
  const verbose = options?.verbose ?? false;
17229
17593
  const filterPattern = options?.filter;
17230
- const absoluteTestPath = path6.resolve(evalFilePath);
17594
+ const absoluteTestPath = path7.resolve(evalFilePath);
17231
17595
  const repoRootPath = resolveToAbsolutePath(repoRoot);
17232
17596
  const searchRoots = buildSearchRoots2(absoluteTestPath, repoRootPath);
17233
17597
  const sidecar = await loadSidecarMetadata(absoluteTestPath, verbose);
17234
- const rawFile = await readFile5(absoluteTestPath, "utf8");
17598
+ const rawFile = await readFile6(absoluteTestPath, "utf8");
17235
17599
  const rawCases = parseJsonlContent(rawFile, evalFilePath);
17236
- const fallbackSuiteName = path6.basename(absoluteTestPath, ".jsonl") || "eval";
17600
+ const fallbackSuiteName = path7.basename(absoluteTestPath, ".jsonl") || "eval";
17237
17601
  const suiteName = sidecar.name && sidecar.name.trim().length > 0 ? sidecar.name : fallbackSuiteName;
17238
17602
  const globalEvaluator = coerceEvaluator(sidecar.evaluator, "sidecar") ?? "llm-grader";
17239
17603
  const globalExecution = sidecar.execution;
@@ -17583,8 +17947,8 @@ function resolveTests(suite) {
17583
17947
  }
17584
17948
  async function readTestSuiteMetadata(testFilePath) {
17585
17949
  try {
17586
- const absolutePath = path7.resolve(testFilePath);
17587
- const content = await readFile6(absolutePath, "utf8");
17950
+ const absolutePath = path8.resolve(testFilePath);
17951
+ const content = await readFile7(absolutePath, "utf8");
17588
17952
  const parsed = interpolateEnv(parse2(content), process.env);
17589
17953
  if (!isJsonObject(parsed)) {
17590
17954
  return {};
@@ -17638,25 +18002,31 @@ var loadEvalCases = loadTests;
17638
18002
  async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
17639
18003
  const verbose = options?.verbose ?? false;
17640
18004
  const filterPattern = options?.filter;
17641
- const absoluteTestPath = path7.resolve(evalFilePath);
18005
+ const absoluteTestPath = path8.resolve(evalFilePath);
17642
18006
  const repoRootPath = resolveToAbsolutePath(repoRoot);
17643
18007
  const searchRoots = buildSearchRoots2(absoluteTestPath, repoRootPath);
17644
18008
  const config = await loadConfig(absoluteTestPath, repoRootPath);
17645
- const rawFile = await readFile6(absoluteTestPath, "utf8");
18009
+ const rawFile = await readFile7(absoluteTestPath, "utf8");
17646
18010
  const interpolated = interpolateEnv(parse2(rawFile), process.env);
17647
18011
  if (!isJsonObject(interpolated)) {
17648
18012
  throw new Error(`Invalid test file format: ${evalFilePath}`);
17649
18013
  }
17650
18014
  const suite = interpolated;
17651
18015
  const suiteNameFromFile = asString5(suite.name)?.trim();
17652
- 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";
17653
18017
  const suiteName = suiteNameFromFile && suiteNameFromFile.length > 0 ? suiteNameFromFile : fallbackSuiteName;
17654
18018
  const rawTestCases = resolveTests(suite);
17655
18019
  const globalEvaluator = coerceEvaluator(suite.evaluator, "global") ?? "llm-grader";
17656
- 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);
17657
18027
  let expandedTestCases;
17658
18028
  if (typeof rawTestCases === "string") {
17659
- const externalPath = path7.resolve(evalFileDir, rawTestCases);
18029
+ const externalPath = path8.resolve(evalFileDir, rawTestCases);
17660
18030
  expandedTestCases = await loadCasesFromFile(externalPath);
17661
18031
  } else if (Array.isArray(rawTestCases)) {
17662
18032
  expandedTestCases = await expandFileReferences(rawTestCases, evalFileDir);
@@ -17754,7 +18124,8 @@ async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
17754
18124
  testCaseConfig,
17755
18125
  globalExecution,
17756
18126
  searchRoots,
17757
- id ?? "unknown"
18127
+ id ?? "unknown",
18128
+ suitePreprocessors
17758
18129
  );
17759
18130
  } catch (error) {
17760
18131
  const message = error instanceof Error ? error.message : String(error);
@@ -17787,6 +18158,7 @@ async function loadTestsFromYaml(evalFilePath, repoRoot, options) {
17787
18158
  criteria: outcome ?? "",
17788
18159
  evaluator: testCaseEvaluatorKind,
17789
18160
  assertions: evaluators,
18161
+ ...suitePreprocessors ? { preprocessors: suitePreprocessors } : {},
17790
18162
  workspace: mergedWorkspace,
17791
18163
  metadata,
17792
18164
  targets: caseTargets,
@@ -17827,8 +18199,8 @@ function parseWorkspaceScriptConfig(raw, evalFileDir) {
17827
18199
  if (!command) return void 0;
17828
18200
  const timeoutMs = typeof obj.timeout_ms === "number" ? obj.timeout_ms : void 0;
17829
18201
  let cwd = typeof obj.cwd === "string" ? obj.cwd : void 0;
17830
- if (cwd && !path7.isAbsolute(cwd)) {
17831
- cwd = path7.resolve(evalFileDir, cwd);
18202
+ if (cwd && !path8.isAbsolute(cwd)) {
18203
+ cwd = path8.resolve(evalFileDir, cwd);
17832
18204
  }
17833
18205
  const config = { command };
17834
18206
  if (timeoutMs !== void 0) {
@@ -17866,10 +18238,10 @@ function parseWorkspaceHooksConfig(raw, evalFileDir) {
17866
18238
  }
17867
18239
  async function resolveWorkspaceConfig(raw, evalFileDir) {
17868
18240
  if (typeof raw === "string") {
17869
- const workspaceFilePath = path7.resolve(evalFileDir, raw);
18241
+ const workspaceFilePath = path8.resolve(evalFileDir, raw);
17870
18242
  let content;
17871
18243
  try {
17872
- content = await readFile6(workspaceFilePath, "utf8");
18244
+ content = await readFile7(workspaceFilePath, "utf8");
17873
18245
  } catch {
17874
18246
  throw new Error(`Workspace file not found: ${raw} (resolved to ${workspaceFilePath})`);
17875
18247
  }
@@ -17879,7 +18251,7 @@ async function resolveWorkspaceConfig(raw, evalFileDir) {
17879
18251
  `Invalid workspace file format: ${workspaceFilePath} (expected a YAML object)`
17880
18252
  );
17881
18253
  }
17882
- const workspaceFileDir = path7.dirname(workspaceFilePath);
18254
+ const workspaceFileDir = path8.dirname(workspaceFilePath);
17883
18255
  return parseWorkspaceConfig(parsed, workspaceFileDir);
17884
18256
  }
17885
18257
  return parseWorkspaceConfig(raw, evalFileDir);
@@ -17899,8 +18271,8 @@ function parseWorkspaceConfig(raw, evalFileDir) {
17899
18271
  throw new Error("workspace.static has been removed. Use workspace.mode='static'.");
17900
18272
  }
17901
18273
  let template = typeof obj.template === "string" ? obj.template : void 0;
17902
- if (template && !path7.isAbsolute(template)) {
17903
- template = path7.resolve(evalFileDir, template);
18274
+ if (template && !path8.isAbsolute(template)) {
18275
+ template = path8.resolve(evalFileDir, template);
17904
18276
  }
17905
18277
  const isolation = obj.isolation === "shared" || obj.isolation === "per_test" ? obj.isolation : void 0;
17906
18278
  const repos = Array.isArray(obj.repos) ? obj.repos.map(parseRepoConfig).filter(Boolean) : void 0;
@@ -18207,7 +18579,7 @@ function transpileEvalYaml(suite, source = "EVAL.yaml") {
18207
18579
  function transpileEvalYamlFile(evalYamlPath) {
18208
18580
  const content = readFileSync(evalYamlPath, "utf8");
18209
18581
  const parsed = parse3(content);
18210
- return transpileEvalYaml(parsed, path8.basename(evalYamlPath));
18582
+ return transpileEvalYaml(parsed, path9.basename(evalYamlPath));
18211
18583
  }
18212
18584
  function getOutputFilenames(result) {
18213
18585
  const names = /* @__PURE__ */ new Map();
@@ -18739,7 +19111,7 @@ function normalizeInputFiles(inputFiles) {
18739
19111
  }
18740
19112
  const deduped = /* @__PURE__ */ new Map();
18741
19113
  for (const inputFile of inputFiles) {
18742
- const absolutePath = path9.resolve(inputFile);
19114
+ const absolutePath = path10.resolve(inputFile);
18743
19115
  if (!deduped.has(absolutePath)) {
18744
19116
  deduped.set(absolutePath, absolutePath);
18745
19117
  }
@@ -18752,7 +19124,7 @@ function collectInputFiles(inputFiles) {
18752
19124
  }
18753
19125
  const unique = /* @__PURE__ */ new Map();
18754
19126
  for (const inputFile of inputFiles) {
18755
- const absolutePath = path9.resolve(inputFile);
19127
+ const absolutePath = path10.resolve(inputFile);
18756
19128
  if (!unique.has(absolutePath)) {
18757
19129
  unique.set(absolutePath, absolutePath);
18758
19130
  }
@@ -18764,7 +19136,7 @@ function buildMandatoryPrereadBlock(inputFiles) {
18764
19136
  return "";
18765
19137
  }
18766
19138
  const buildList = (files) => files.map((absolutePath) => {
18767
- const fileName = path9.basename(absolutePath);
19139
+ const fileName = path10.basename(absolutePath);
18768
19140
  const fileUri = pathToFileUri(absolutePath);
18769
19141
  return `* [${fileName}](${fileUri})`;
18770
19142
  });
@@ -18780,7 +19152,7 @@ ${buildList(inputFiles).join("\n")}.`);
18780
19152
  return sections.join("\n");
18781
19153
  }
18782
19154
  function pathToFileUri(filePath) {
18783
- const absolutePath = path9.isAbsolute(filePath) ? filePath : path9.resolve(filePath);
19155
+ const absolutePath = path10.isAbsolute(filePath) ? filePath : path10.resolve(filePath);
18784
19156
  const normalizedPath = absolutePath.replace(/\\/g, "/");
18785
19157
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
18786
19158
  return `file:///${normalizedPath}`;
@@ -18926,10 +19298,10 @@ var ClaudeCliProvider = class {
18926
19298
  }
18927
19299
  resolveCwd(cwdOverride) {
18928
19300
  if (cwdOverride) {
18929
- return path10.resolve(cwdOverride);
19301
+ return path11.resolve(cwdOverride);
18930
19302
  }
18931
19303
  if (this.config.cwd) {
18932
- return path10.resolve(this.config.cwd);
19304
+ return path11.resolve(this.config.cwd);
18933
19305
  }
18934
19306
  return void 0;
18935
19307
  }
@@ -18939,9 +19311,9 @@ var ClaudeCliProvider = class {
18939
19311
  return void 0;
18940
19312
  }
18941
19313
  if (this.config.logDir) {
18942
- return path10.resolve(this.config.logDir);
19314
+ return path11.resolve(this.config.logDir);
18943
19315
  }
18944
- return path10.join(process.cwd(), ".agentv", "logs", "claude-cli");
19316
+ return path11.join(process.cwd(), ".agentv", "logs", "claude-cli");
18945
19317
  }
18946
19318
  async createStreamLogger(request) {
18947
19319
  const logDir = this.resolveLogDirectory();
@@ -18955,7 +19327,7 @@ var ClaudeCliProvider = class {
18955
19327
  console.warn(`Skipping Claude CLI stream logging (could not create ${logDir}): ${message}`);
18956
19328
  return void 0;
18957
19329
  }
18958
- const filePath = path10.join(logDir, buildLogFilename(request, this.targetName));
19330
+ const filePath = path11.join(logDir, buildLogFilename(request, this.targetName));
18959
19331
  try {
18960
19332
  const logger = await ClaudeCliStreamLogger.create({
18961
19333
  filePath,
@@ -19412,10 +19784,10 @@ var ClaudeSdkProvider = class {
19412
19784
  }
19413
19785
  resolveCwd(cwdOverride) {
19414
19786
  if (cwdOverride) {
19415
- return path11.resolve(cwdOverride);
19787
+ return path12.resolve(cwdOverride);
19416
19788
  }
19417
19789
  if (this.config.cwd) {
19418
- return path11.resolve(this.config.cwd);
19790
+ return path12.resolve(this.config.cwd);
19419
19791
  }
19420
19792
  return void 0;
19421
19793
  }
@@ -19425,9 +19797,9 @@ var ClaudeSdkProvider = class {
19425
19797
  return void 0;
19426
19798
  }
19427
19799
  if (this.config.logDir) {
19428
- return path11.resolve(this.config.logDir);
19800
+ return path12.resolve(this.config.logDir);
19429
19801
  }
19430
- return path11.join(process.cwd(), ".agentv", "logs", "claude");
19802
+ return path12.join(process.cwd(), ".agentv", "logs", "claude");
19431
19803
  }
19432
19804
  async createStreamLogger(request) {
19433
19805
  const logDir = this.resolveLogDirectory();
@@ -19441,7 +19813,7 @@ var ClaudeSdkProvider = class {
19441
19813
  console.warn(`Skipping Claude stream logging (could not create ${logDir}): ${message}`);
19442
19814
  return void 0;
19443
19815
  }
19444
- const filePath = path11.join(logDir, buildLogFilename2(request, this.targetName));
19816
+ const filePath = path12.join(logDir, buildLogFilename2(request, this.targetName));
19445
19817
  try {
19446
19818
  const logger = await ClaudeStreamLogger.create({
19447
19819
  filePath,
@@ -20124,7 +20496,7 @@ function normalizeInputFiles2(inputFiles) {
20124
20496
  }
20125
20497
  const unique = /* @__PURE__ */ new Map();
20126
20498
  for (const inputFile of inputFiles) {
20127
- const absolutePath = path12.resolve(inputFile);
20499
+ const absolutePath = path13.resolve(inputFile);
20128
20500
  if (!unique.has(absolutePath)) {
20129
20501
  unique.set(absolutePath, absolutePath);
20130
20502
  }
@@ -20138,7 +20510,7 @@ function formatFileList(files, template) {
20138
20510
  const formatter = template ?? "{path}";
20139
20511
  return files.map((filePath) => {
20140
20512
  const escapedPath = shellEscape(filePath);
20141
- const escapedName = shellEscape(path12.basename(filePath));
20513
+ const escapedName = shellEscape(path13.basename(filePath));
20142
20514
  return formatter.replaceAll("{path}", escapedPath).replaceAll("{basename}", escapedName);
20143
20515
  }).join(" ");
20144
20516
  }
@@ -20162,7 +20534,7 @@ function generateOutputFilePath(evalCaseId, extension = ".json") {
20162
20534
  const safeEvalId = evalCaseId || "unknown";
20163
20535
  const timestamp = Date.now();
20164
20536
  const random = Math.random().toString(36).substring(2, 9);
20165
- return path12.join(os.tmpdir(), `agentv-${safeEvalId}-${timestamp}-${random}${extension}`);
20537
+ return path13.join(os.tmpdir(), `agentv-${safeEvalId}-${timestamp}-${random}${extension}`);
20166
20538
  }
20167
20539
  function formatTimeoutSuffix2(timeoutMs) {
20168
20540
  if (!timeoutMs || timeoutMs <= 0) {
@@ -20401,10 +20773,10 @@ ${basePrompt}` : basePrompt;
20401
20773
  }
20402
20774
  resolveCwd(cwdOverride) {
20403
20775
  if (cwdOverride) {
20404
- return path13.resolve(cwdOverride);
20776
+ return path14.resolve(cwdOverride);
20405
20777
  }
20406
20778
  if (this.config.cwd) {
20407
- return path13.resolve(this.config.cwd);
20779
+ return path14.resolve(this.config.cwd);
20408
20780
  }
20409
20781
  return void 0;
20410
20782
  }
@@ -20414,9 +20786,9 @@ ${basePrompt}` : basePrompt;
20414
20786
  return void 0;
20415
20787
  }
20416
20788
  if (this.config.logDir) {
20417
- return path13.resolve(this.config.logDir);
20789
+ return path14.resolve(this.config.logDir);
20418
20790
  }
20419
- return path13.join(process.cwd(), ".agentv", "logs", "codex");
20791
+ return path14.join(process.cwd(), ".agentv", "logs", "codex");
20420
20792
  }
20421
20793
  async createStreamLogger(request) {
20422
20794
  const logDir = this.resolveLogDirectory();
@@ -20430,7 +20802,7 @@ ${basePrompt}` : basePrompt;
20430
20802
  console.warn(`Skipping Codex SDK stream logging (could not create ${logDir}): ${message}`);
20431
20803
  return void 0;
20432
20804
  }
20433
- const filePath = path13.join(logDir, buildLogFilename3(request, this.targetName));
20805
+ const filePath = path14.join(logDir, buildLogFilename3(request, this.targetName));
20434
20806
  try {
20435
20807
  const logger = await CodexSdkStreamLogger.create({
20436
20808
  filePath,
@@ -20642,8 +21014,8 @@ function resolvePlatformCliPath() {
20642
21014
  const binaryName = os3 === "win32" ? "copilot.exe" : "copilot";
20643
21015
  try {
20644
21016
  const resolved = import.meta.resolve(`${packageName}/package.json`);
20645
- const packageJsonPath = resolved.startsWith("file:") ? fileURLToPath2(resolved) : resolved;
20646
- 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);
20647
21019
  if (existsSync(binaryPath)) {
20648
21020
  return binaryPath;
20649
21021
  }
@@ -20651,7 +21023,7 @@ function resolvePlatformCliPath() {
20651
21023
  }
20652
21024
  let searchDir = process.cwd();
20653
21025
  for (let i = 0; i < 10; i++) {
20654
- const standardPath = path14.join(
21026
+ const standardPath = path15.join(
20655
21027
  searchDir,
20656
21028
  "node_modules",
20657
21029
  ...packageName.split("/"),
@@ -20660,13 +21032,13 @@ function resolvePlatformCliPath() {
20660
21032
  if (existsSync(standardPath)) {
20661
21033
  return standardPath;
20662
21034
  }
20663
- const bunDir = path14.join(searchDir, "node_modules", ".bun");
21035
+ const bunDir = path15.join(searchDir, "node_modules", ".bun");
20664
21036
  const prefix = `@github+copilot-${osPart}-${archPart}@`;
20665
21037
  try {
20666
21038
  const entries = readdirSync(bunDir);
20667
21039
  for (const entry of entries) {
20668
21040
  if (entry.startsWith(prefix)) {
20669
- const candidate = path14.join(
21041
+ const candidate = path15.join(
20670
21042
  bunDir,
20671
21043
  entry,
20672
21044
  "node_modules",
@@ -20681,7 +21053,7 @@ function resolvePlatformCliPath() {
20681
21053
  }
20682
21054
  } catch {
20683
21055
  }
20684
- const parent = path14.dirname(searchDir);
21056
+ const parent = path15.dirname(searchDir);
20685
21057
  if (parent === searchDir) break;
20686
21058
  searchDir = parent;
20687
21059
  }
@@ -21023,10 +21395,10 @@ var CopilotCliProvider = class {
21023
21395
  }
21024
21396
  resolveCwd(cwdOverride) {
21025
21397
  if (cwdOverride) {
21026
- return path15.resolve(cwdOverride);
21398
+ return path16.resolve(cwdOverride);
21027
21399
  }
21028
21400
  if (this.config.cwd) {
21029
- return path15.resolve(this.config.cwd);
21401
+ return path16.resolve(this.config.cwd);
21030
21402
  }
21031
21403
  return void 0;
21032
21404
  }
@@ -21045,9 +21417,9 @@ var CopilotCliProvider = class {
21045
21417
  return void 0;
21046
21418
  }
21047
21419
  if (this.config.logDir) {
21048
- return path15.resolve(this.config.logDir);
21420
+ return path16.resolve(this.config.logDir);
21049
21421
  }
21050
- return path15.join(process.cwd(), ".agentv", "logs", "copilot-cli");
21422
+ return path16.join(process.cwd(), ".agentv", "logs", "copilot-cli");
21051
21423
  }
21052
21424
  async createStreamLogger(request) {
21053
21425
  const logDir = this.resolveLogDirectory();
@@ -21061,7 +21433,7 @@ var CopilotCliProvider = class {
21061
21433
  console.warn(`Skipping Copilot CLI stream logging (could not create ${logDir}): ${message}`);
21062
21434
  return void 0;
21063
21435
  }
21064
- const filePath = path15.join(logDir, buildLogFilename4(request, this.targetName, "copilot-cli"));
21436
+ const filePath = path16.join(logDir, buildLogFilename4(request, this.targetName, "copilot-cli"));
21065
21437
  try {
21066
21438
  const logger = await CopilotStreamLogger.create(
21067
21439
  {
@@ -21279,7 +21651,7 @@ function parseCopilotEvents(eventsJsonl) {
21279
21651
  durationMs
21280
21652
  };
21281
21653
  }
21282
- var DEFAULT_SESSION_STATE_DIR = () => path16.join(homedir(), ".copilot", "session-state");
21654
+ var DEFAULT_SESSION_STATE_DIR = () => path17.join(homedir(), ".copilot", "session-state");
21283
21655
  async function discoverCopilotSessions(opts) {
21284
21656
  const sessionStateDir = opts?.sessionStateDir ?? DEFAULT_SESSION_STATE_DIR();
21285
21657
  const limit = opts?.limit ?? 10;
@@ -21291,11 +21663,11 @@ async function discoverCopilotSessions(opts) {
21291
21663
  }
21292
21664
  const sessions = [];
21293
21665
  for (const entry of entries) {
21294
- const sessionDir = path16.join(sessionStateDir, entry);
21295
- const workspacePath = path16.join(sessionDir, "workspace.yaml");
21296
- 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");
21297
21669
  try {
21298
- const workspaceContent = await readFile7(workspacePath, "utf8");
21670
+ const workspaceContent = await readFile8(workspacePath, "utf8");
21299
21671
  const workspace = parseYaml22(workspaceContent) ?? {};
21300
21672
  const cwd = String(workspace.cwd ?? "");
21301
21673
  let updatedAt;
@@ -21352,10 +21724,10 @@ var CopilotLogProvider = class {
21352
21724
  }
21353
21725
  async invoke(_request) {
21354
21726
  const sessionDir = await this.resolveSessionDir();
21355
- const eventsPath = path17.join(sessionDir, "events.jsonl");
21727
+ const eventsPath = path18.join(sessionDir, "events.jsonl");
21356
21728
  let eventsContent;
21357
21729
  try {
21358
- eventsContent = await readFile8(eventsPath, "utf8");
21730
+ eventsContent = await readFile9(eventsPath, "utf8");
21359
21731
  } catch (err) {
21360
21732
  throw new Error(
21361
21733
  `Failed to read Copilot session transcript at ${eventsPath}: ${err instanceof Error ? err.message : String(err)}`
@@ -21374,8 +21746,8 @@ var CopilotLogProvider = class {
21374
21746
  return this.config.sessionDir;
21375
21747
  }
21376
21748
  if (this.config.sessionId) {
21377
- const stateDir = this.config.sessionStateDir ?? path17.join(homedir2(), ".copilot", "session-state");
21378
- 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);
21379
21751
  }
21380
21752
  if (this.config.discover === "latest") {
21381
21753
  const sessions = await discoverCopilotSessions({
@@ -21700,10 +22072,10 @@ var CopilotSdkProvider = class {
21700
22072
  }
21701
22073
  resolveCwd(cwdOverride) {
21702
22074
  if (cwdOverride) {
21703
- return path18.resolve(cwdOverride);
22075
+ return path19.resolve(cwdOverride);
21704
22076
  }
21705
22077
  if (this.config.cwd) {
21706
- return path18.resolve(this.config.cwd);
22078
+ return path19.resolve(this.config.cwd);
21707
22079
  }
21708
22080
  return void 0;
21709
22081
  }
@@ -21712,9 +22084,9 @@ var CopilotSdkProvider = class {
21712
22084
  return void 0;
21713
22085
  }
21714
22086
  if (this.config.logDir) {
21715
- return path18.resolve(this.config.logDir);
22087
+ return path19.resolve(this.config.logDir);
21716
22088
  }
21717
- return path18.join(process.cwd(), ".agentv", "logs", "copilot-sdk");
22089
+ return path19.join(process.cwd(), ".agentv", "logs", "copilot-sdk");
21718
22090
  }
21719
22091
  async createStreamLogger(request) {
21720
22092
  const logDir = this.resolveLogDirectory();
@@ -21728,7 +22100,7 @@ var CopilotSdkProvider = class {
21728
22100
  console.warn(`Skipping Copilot SDK stream logging (could not create ${logDir}): ${message}`);
21729
22101
  return void 0;
21730
22102
  }
21731
- const filePath = path18.join(logDir, buildLogFilename4(request, this.targetName, "copilot-sdk"));
22103
+ const filePath = path19.join(logDir, buildLogFilename4(request, this.targetName, "copilot-sdk"));
21732
22104
  try {
21733
22105
  const logger = await CopilotStreamLogger.create(
21734
22106
  {
@@ -21757,9 +22129,9 @@ var CopilotSdkProvider = class {
21757
22129
  };
21758
22130
  function resolveSkillDirectories(cwd) {
21759
22131
  const candidates = [
21760
- path18.join(cwd, ".claude", "skills"),
21761
- path18.join(cwd, ".agents", "skills"),
21762
- path18.join(cwd, ".codex", "skills")
22132
+ path19.join(cwd, ".claude", "skills"),
22133
+ path19.join(cwd, ".agents", "skills"),
22134
+ path19.join(cwd, ".codex", "skills")
21763
22135
  ];
21764
22136
  return candidates.filter((dir) => existsSync2(dir));
21765
22137
  }
@@ -22031,7 +22403,7 @@ var PiCliProvider = class {
22031
22403
  const cwd = this.resolveCwd(workspaceRoot, request.cwd);
22032
22404
  const logger = await this.createStreamLogger(request).catch(() => void 0);
22033
22405
  try {
22034
- const promptFile = path19.join(cwd, PROMPT_FILENAME);
22406
+ const promptFile = path20.join(cwd, PROMPT_FILENAME);
22035
22407
  await writeFile(promptFile, request.question, "utf8");
22036
22408
  const args = this.buildPiArgs(request.question, inputFiles);
22037
22409
  const result = await this.executePi(args, cwd, request.signal, logger);
@@ -22094,10 +22466,10 @@ var PiCliProvider = class {
22094
22466
  }
22095
22467
  resolveCwd(workspaceRoot, cwdOverride) {
22096
22468
  if (cwdOverride) {
22097
- return path19.resolve(cwdOverride);
22469
+ return path20.resolve(cwdOverride);
22098
22470
  }
22099
22471
  if (this.config.cwd) {
22100
- return path19.resolve(this.config.cwd);
22472
+ return path20.resolve(this.config.cwd);
22101
22473
  }
22102
22474
  if (workspaceRoot) {
22103
22475
  return workspaceRoot;
@@ -22203,7 +22575,7 @@ ${prompt}` : prompt;
22203
22575
  return env;
22204
22576
  }
22205
22577
  async createWorkspace() {
22206
- return await mkdtemp(path19.join(tmpdir(), WORKSPACE_PREFIX));
22578
+ return await mkdtemp(path20.join(tmpdir(), WORKSPACE_PREFIX));
22207
22579
  }
22208
22580
  async cleanupWorkspace(workspaceRoot) {
22209
22581
  try {
@@ -22213,9 +22585,9 @@ ${prompt}` : prompt;
22213
22585
  }
22214
22586
  resolveLogDirectory() {
22215
22587
  if (this.config.logDir) {
22216
- return path19.resolve(this.config.logDir);
22588
+ return path20.resolve(this.config.logDir);
22217
22589
  }
22218
- return path19.join(process.cwd(), ".agentv", "logs", "pi-cli");
22590
+ return path20.join(process.cwd(), ".agentv", "logs", "pi-cli");
22219
22591
  }
22220
22592
  async createStreamLogger(request) {
22221
22593
  const logDir = this.resolveLogDirectory();
@@ -22229,7 +22601,7 @@ ${prompt}` : prompt;
22229
22601
  console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
22230
22602
  return void 0;
22231
22603
  }
22232
- const filePath = path19.join(logDir, buildLogFilename5(request, this.targetName));
22604
+ const filePath = path20.join(logDir, buildLogFilename5(request, this.targetName));
22233
22605
  try {
22234
22606
  const logger = await PiStreamLogger.create({
22235
22607
  filePath,
@@ -22700,8 +23072,8 @@ function resolveWindowsCmd(executable) {
22700
23072
  const content = readFileSync2(cmdPath, "utf-8");
22701
23073
  const match = content.match(/"?%_prog%"?\s+"([^"]+\.js)"/);
22702
23074
  if (match) {
22703
- const dp0 = path19.dirname(path19.resolve(cmdPath));
22704
- 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}`);
22705
23077
  try {
22706
23078
  accessSync(scriptPath);
22707
23079
  return ["node", [scriptPath]];
@@ -22784,19 +23156,19 @@ function getAgentvHome() {
22784
23156
  }
22785
23157
  return envHome;
22786
23158
  }
22787
- return path20.join(os2.homedir(), ".agentv");
23159
+ return path21.join(os2.homedir(), ".agentv");
22788
23160
  }
22789
23161
  function getWorkspacesRoot() {
22790
- return path20.join(getAgentvHome(), "workspaces");
23162
+ return path21.join(getAgentvHome(), "workspaces");
22791
23163
  }
22792
23164
  function getSubagentsRoot() {
22793
- return path20.join(getAgentvHome(), "subagents");
23165
+ return path21.join(getAgentvHome(), "subagents");
22794
23166
  }
22795
23167
  function getTraceStateRoot() {
22796
- return path20.join(getAgentvHome(), "trace-state");
23168
+ return path21.join(getAgentvHome(), "trace-state");
22797
23169
  }
22798
23170
  function getWorkspacePoolRoot() {
22799
- return path20.join(getAgentvHome(), "workspace-pool");
23171
+ return path21.join(getAgentvHome(), "workspace-pool");
22800
23172
  }
22801
23173
  var piCodingAgentModule = null;
22802
23174
  var piAiModule = null;
@@ -22816,7 +23188,7 @@ async function promptInstall() {
22816
23188
  }
22817
23189
  }
22818
23190
  function findManagedSdkInstallRoot() {
22819
- return path21.join(getAgentvHome(), "deps", "pi-sdk");
23191
+ return path222.join(getAgentvHome(), "deps", "pi-sdk");
22820
23192
  }
22821
23193
  function resolveGlobalNpmRoot() {
22822
23194
  try {
@@ -22830,7 +23202,7 @@ function resolveGlobalNpmRoot() {
22830
23202
  }
22831
23203
  }
22832
23204
  function buildGlobalModuleEntry(moduleName, globalNpmRoot) {
22833
- return path21.join(globalNpmRoot, ...moduleName.split("/"), "dist", "index.js");
23205
+ return path222.join(globalNpmRoot, ...moduleName.split("/"), "dist", "index.js");
22834
23206
  }
22835
23207
  function findAccessiblePath(paths) {
22836
23208
  for (const candidate of paths) {
@@ -22856,11 +23228,11 @@ async function tryImportLocalSdkModules() {
22856
23228
  async function tryImportManagedSdkModules() {
22857
23229
  const managedRoot = findManagedSdkInstallRoot();
22858
23230
  const piCodingAgentEntry = findAccessiblePath([
22859
- 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")
22860
23232
  ]);
22861
23233
  const piAiEntry = findAccessiblePath([
22862
- path21.join(managedRoot, "node_modules", "@mariozechner", "pi-ai", "dist", "index.js"),
22863
- path21.join(
23234
+ path222.join(managedRoot, "node_modules", "@mariozechner", "pi-ai", "dist", "index.js"),
23235
+ path222.join(
22864
23236
  managedRoot,
22865
23237
  "node_modules",
22866
23238
  "@mariozechner",
@@ -22891,7 +23263,7 @@ async function tryImportGlobalSdkModules() {
22891
23263
  ]);
22892
23264
  const piAiEntry = findAccessiblePath([
22893
23265
  buildGlobalModuleEntry("@mariozechner/pi-ai", globalNpmRoot),
22894
- path21.join(
23266
+ path222.join(
22895
23267
  globalNpmRoot,
22896
23268
  "@mariozechner",
22897
23269
  "pi-coding-agent",
@@ -23192,10 +23564,10 @@ ${fileList}`;
23192
23564
  }
23193
23565
  resolveCwd(cwdOverride) {
23194
23566
  if (cwdOverride) {
23195
- return path21.resolve(cwdOverride);
23567
+ return path222.resolve(cwdOverride);
23196
23568
  }
23197
23569
  if (this.config.cwd) {
23198
- return path21.resolve(this.config.cwd);
23570
+ return path222.resolve(this.config.cwd);
23199
23571
  }
23200
23572
  return process.cwd();
23201
23573
  }
@@ -23214,9 +23586,9 @@ ${fileList}`;
23214
23586
  }
23215
23587
  resolveLogDirectory() {
23216
23588
  if (this.config.logDir) {
23217
- return path21.resolve(this.config.logDir);
23589
+ return path222.resolve(this.config.logDir);
23218
23590
  }
23219
- return path21.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
23591
+ return path222.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
23220
23592
  }
23221
23593
  async createStreamLogger(request) {
23222
23594
  const logDir = this.resolveLogDirectory();
@@ -23230,7 +23602,7 @@ ${fileList}`;
23230
23602
  console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
23231
23603
  return void 0;
23232
23604
  }
23233
- const filePath = path21.join(logDir, buildLogFilename6(request, this.targetName));
23605
+ const filePath = path222.join(logDir, buildLogFilename6(request, this.targetName));
23234
23606
  try {
23235
23607
  const logger = await PiStreamLogger2.create({
23236
23608
  filePath,
@@ -23454,7 +23826,7 @@ async function readDirEntries(target) {
23454
23826
  const entries = await readdir2(target, { withFileTypes: true });
23455
23827
  return entries.map((entry) => ({
23456
23828
  name: entry.name,
23457
- absolutePath: path222.join(target, entry.name),
23829
+ absolutePath: path23.join(target, entry.name),
23458
23830
  isDirectory: entry.isDirectory()
23459
23831
  }));
23460
23832
  }
@@ -23468,7 +23840,7 @@ async function removeIfExists(target) {
23468
23840
  }
23469
23841
  }
23470
23842
  function pathToFileUri2(filePath) {
23471
- const absolutePath = path23.isAbsolute(filePath) ? filePath : path23.resolve(filePath);
23843
+ const absolutePath = path24.isAbsolute(filePath) ? filePath : path24.resolve(filePath);
23472
23844
  const normalizedPath = absolutePath.replace(/\\/g, "/");
23473
23845
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
23474
23846
  return `file:///${normalizedPath}`;
@@ -23560,8 +23932,8 @@ function createBatchRequestPrompt(userQuery, responseFileTmp, responseFileFinal,
23560
23932
  });
23561
23933
  }
23562
23934
  function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateContent) {
23563
- const requestLines = requestFiles.map((file, index) => `${index + 1}. messages/${path24.basename(file)}`).join("\n");
23564
- 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(", ");
23565
23937
  return renderTemplate2(templateContent, {
23566
23938
  requestFiles: requestLines,
23567
23939
  responseList
@@ -23600,7 +23972,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
23600
23972
  const maxAttempts = 10;
23601
23973
  while (attempts < maxAttempts) {
23602
23974
  try {
23603
- const content = await readFile9(responseFileFinal, { encoding: "utf8" });
23975
+ const content = await readFile10(responseFileFinal, { encoding: "utf8" });
23604
23976
  if (!silent) {
23605
23977
  process.stdout.write(`${content}
23606
23978
  `);
@@ -23621,7 +23993,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
23621
23993
  }
23622
23994
  async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, silent = false, timeoutMs = DEFAULT_TIMEOUT_MS) {
23623
23995
  if (!silent) {
23624
- const fileList = responseFilesFinal.map((file) => path25.basename(file)).join(", ");
23996
+ const fileList = responseFilesFinal.map((file) => path26.basename(file)).join(", ");
23625
23997
  console.error(`waiting for ${responseFilesFinal.length} batch response(s): ${fileList}`);
23626
23998
  }
23627
23999
  const deadline = Date.now() + timeoutMs;
@@ -23630,7 +24002,7 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
23630
24002
  while (pending.size > 0) {
23631
24003
  if (Date.now() >= deadline) {
23632
24004
  if (!silent) {
23633
- const remaining = [...pending].map((f) => path25.basename(f)).join(", ");
24005
+ const remaining = [...pending].map((f) => path26.basename(f)).join(", ");
23634
24006
  console.error(
23635
24007
  `error: timed out after ${Math.round(timeoutMs / 1e3)}s waiting for batch responses. Still pending: ${remaining}`
23636
24008
  );
@@ -23657,7 +24029,7 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
23657
24029
  const maxAttempts = 10;
23658
24030
  while (attempts < maxAttempts) {
23659
24031
  try {
23660
- const content = await readFile9(file, { encoding: "utf8" });
24032
+ const content = await readFile10(file, { encoding: "utf8" });
23661
24033
  if (!silent) {
23662
24034
  process.stdout.write(`${content}
23663
24035
  `);
@@ -23681,7 +24053,7 @@ var DEFAULT_LOCK_NAME = "subagent.lock";
23681
24053
  var DEFAULT_ALIVE_FILENAME = ".alive";
23682
24054
  function getDefaultSubagentRoot(vscodeCmd = "code") {
23683
24055
  const folder = vscodeCmd === "code-insiders" ? "vscode-insiders-agents" : "vscode-agents";
23684
- return path26.join(getSubagentsRoot(), folder);
24056
+ return path27.join(getSubagentsRoot(), folder);
23685
24057
  }
23686
24058
  var DEFAULT_SUBAGENT_ROOT = getDefaultSubagentRoot();
23687
24059
  var execAsync2 = promisify2(exec);
@@ -23746,11 +24118,11 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
23746
24118
  await raceSpawnError(child);
23747
24119
  return true;
23748
24120
  }
23749
- const aliveFile = path27.join(subagentDir, DEFAULT_ALIVE_FILENAME);
24121
+ const aliveFile = path28.join(subagentDir, DEFAULT_ALIVE_FILENAME);
23750
24122
  await removeIfExists(aliveFile);
23751
- const githubAgentsDir = path27.join(subagentDir, ".github", "agents");
24123
+ const githubAgentsDir = path28.join(subagentDir, ".github", "agents");
23752
24124
  await mkdir9(githubAgentsDir, { recursive: true });
23753
- const wakeupDst = path27.join(githubAgentsDir, "wakeup.md");
24125
+ const wakeupDst = path28.join(githubAgentsDir, "wakeup.md");
23754
24126
  await writeFile2(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
23755
24127
  const workspaceChild = spawnVsCode(vscodeCmd, [workspacePath], {
23756
24128
  label: "open-workspace"
@@ -23763,7 +24135,7 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
23763
24135
  "chat",
23764
24136
  "-m",
23765
24137
  wakeupChatId,
23766
- `create a file named .alive in the ${path27.basename(subagentDir)} folder`
24138
+ `create a file named .alive in the ${path28.basename(subagentDir)} folder`
23767
24139
  ];
23768
24140
  const wakeupChild = spawnVsCode(vscodeCmd, chatArgs, { label: "send-wakeup-chat" });
23769
24141
  await raceSpawnError(wakeupChild);
@@ -23778,10 +24150,10 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
23778
24150
  return true;
23779
24151
  }
23780
24152
  async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, requestInstructions, timestamp, vscodeCmd) {
23781
- const workspacePath = path27.join(subagentDir, `${path27.basename(subagentDir)}.code-workspace`);
23782
- const messagesDir = path27.join(subagentDir, "messages");
24153
+ const workspacePath = path28.join(subagentDir, `${path28.basename(subagentDir)}.code-workspace`);
24154
+ const messagesDir = path28.join(subagentDir, "messages");
23783
24155
  await mkdir9(messagesDir, { recursive: true });
23784
- const reqFile = path27.join(messagesDir, `${timestamp}_req.md`);
24156
+ const reqFile = path28.join(messagesDir, `${timestamp}_req.md`);
23785
24157
  await writeFile2(reqFile, requestInstructions, { encoding: "utf8" });
23786
24158
  const reqUri = pathToFileUri2(reqFile);
23787
24159
  const chatArgs = ["-r", "chat", "-m", chatId];
@@ -23789,16 +24161,16 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
23789
24161
  chatArgs.push("-a", attachment);
23790
24162
  }
23791
24163
  chatArgs.push("-a", reqFile);
23792
- chatArgs.push(`Follow instructions in [${path27.basename(reqFile)}](${reqUri})`);
24164
+ chatArgs.push(`Follow instructions in [${path28.basename(reqFile)}](${reqUri})`);
23793
24165
  const workspaceReady = await ensureWorkspaceFocused(
23794
24166
  workspacePath,
23795
- path27.basename(subagentDir),
24167
+ path28.basename(subagentDir),
23796
24168
  subagentDir,
23797
24169
  vscodeCmd
23798
24170
  );
23799
24171
  if (!workspaceReady) {
23800
24172
  throw new Error(
23801
- `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.`
23802
24174
  );
23803
24175
  }
23804
24176
  await sleep2(500);
@@ -23806,8 +24178,8 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
23806
24178
  await raceSpawnError(child);
23807
24179
  }
23808
24180
  async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, chatInstruction, vscodeCmd) {
23809
- const workspacePath = path27.join(subagentDir, `${path27.basename(subagentDir)}.code-workspace`);
23810
- const messagesDir = path27.join(subagentDir, "messages");
24181
+ const workspacePath = path28.join(subagentDir, `${path28.basename(subagentDir)}.code-workspace`);
24182
+ const messagesDir = path28.join(subagentDir, "messages");
23811
24183
  await mkdir9(messagesDir, { recursive: true });
23812
24184
  const chatArgs = ["-r", "chat", "-m", chatId];
23813
24185
  for (const attachment of attachmentPaths) {
@@ -23816,13 +24188,13 @@ async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, c
23816
24188
  chatArgs.push(chatInstruction);
23817
24189
  const workspaceReady = await ensureWorkspaceFocused(
23818
24190
  workspacePath,
23819
- path27.basename(subagentDir),
24191
+ path28.basename(subagentDir),
23820
24192
  subagentDir,
23821
24193
  vscodeCmd
23822
24194
  );
23823
24195
  if (!workspaceReady) {
23824
24196
  throw new Error(
23825
- `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.`
23826
24198
  );
23827
24199
  }
23828
24200
  await sleep2(500);
@@ -23844,10 +24216,10 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
23844
24216
  }
23845
24217
  const transformedFolders = workspace.folders.map((folder) => {
23846
24218
  const folderPath = folder.path;
23847
- if (path28.isAbsolute(folderPath)) {
24219
+ if (path29.isAbsolute(folderPath)) {
23848
24220
  return folder;
23849
24221
  }
23850
- const absolutePath = path28.resolve(templateDir, folderPath);
24222
+ const absolutePath = path29.resolve(templateDir, folderPath);
23851
24223
  return {
23852
24224
  ...folder,
23853
24225
  path: absolutePath
@@ -23869,19 +24241,19 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
23869
24241
  if (locationMap && typeof locationMap === "object") {
23870
24242
  const transformedMap = {};
23871
24243
  for (const [locationPath, value] of Object.entries(locationMap)) {
23872
- const isAbsolute = path28.isAbsolute(locationPath);
24244
+ const isAbsolute = path29.isAbsolute(locationPath);
23873
24245
  if (isAbsolute) {
23874
24246
  transformedMap[locationPath] = value;
23875
24247
  } else {
23876
24248
  const firstGlobIndex = locationPath.search(/[*]/);
23877
24249
  if (firstGlobIndex === -1) {
23878
- const resolvedPath = path28.resolve(templateDir, locationPath).replace(/\\/g, "/");
24250
+ const resolvedPath = path29.resolve(templateDir, locationPath).replace(/\\/g, "/");
23879
24251
  transformedMap[resolvedPath] = value;
23880
24252
  } else {
23881
24253
  const basePathEnd = locationPath.lastIndexOf("/", firstGlobIndex);
23882
24254
  const basePath = basePathEnd !== -1 ? locationPath.substring(0, basePathEnd) : ".";
23883
24255
  const patternPath = locationPath.substring(basePathEnd !== -1 ? basePathEnd : 0);
23884
- const resolvedPath = (path28.resolve(templateDir, basePath) + patternPath).replace(
24256
+ const resolvedPath = (path29.resolve(templateDir, basePath) + patternPath).replace(
23885
24257
  /\\/g,
23886
24258
  "/"
23887
24259
  );
@@ -23920,7 +24292,7 @@ async function findUnlockedSubagent(subagentRoot) {
23920
24292
  number: Number.parseInt(entry.name.split("-")[1] ?? "", 10)
23921
24293
  })).filter((entry) => Number.isInteger(entry.number)).sort((a, b) => a.number - b.number);
23922
24294
  for (const subagent of subagents) {
23923
- const lockFile = path29.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
24295
+ const lockFile = path30.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
23924
24296
  if (!await pathExists(lockFile)) {
23925
24297
  return subagent.absolutePath;
23926
24298
  }
@@ -23930,7 +24302,7 @@ async function findUnlockedSubagent(subagentRoot) {
23930
24302
  async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
23931
24303
  let workspaceContent;
23932
24304
  if (workspaceTemplate) {
23933
- const workspaceSrc = path29.resolve(workspaceTemplate);
24305
+ const workspaceSrc = path30.resolve(workspaceTemplate);
23934
24306
  if (!await pathExists(workspaceSrc)) {
23935
24307
  throw new Error(`workspace template not found: ${workspaceSrc}`);
23936
24308
  }
@@ -23938,18 +24310,18 @@ async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
23938
24310
  if (!stats.isFile()) {
23939
24311
  throw new Error(`workspace template must be a file, not a directory: ${workspaceSrc}`);
23940
24312
  }
23941
- const templateText = await readFile10(workspaceSrc, "utf8");
24313
+ const templateText = await readFile11(workspaceSrc, "utf8");
23942
24314
  workspaceContent = JSON.parse(templateText);
23943
24315
  } else {
23944
24316
  workspaceContent = DEFAULT_WORKSPACE_TEMPLATE;
23945
24317
  }
23946
- const workspaceName = `${path29.basename(subagentDir)}.code-workspace`;
23947
- const workspaceDst = path29.join(subagentDir, workspaceName);
23948
- 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;
23949
24321
  const workspaceJson = JSON.stringify(workspaceContent, null, 2);
23950
24322
  let transformedContent = transformWorkspacePaths(workspaceJson, templateDir);
23951
24323
  if (cwd) {
23952
- const absCwd = path29.resolve(cwd);
24324
+ const absCwd = path30.resolve(cwd);
23953
24325
  const parsed = JSON.parse(transformedContent);
23954
24326
  const alreadyPresent = parsed.folders.some((f) => f.path === absCwd);
23955
24327
  if (!alreadyPresent) {
@@ -23958,35 +24330,35 @@ async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
23958
24330
  }
23959
24331
  }
23960
24332
  await writeFile3(workspaceDst, transformedContent, "utf8");
23961
- const messagesDir = path29.join(subagentDir, "messages");
24333
+ const messagesDir = path30.join(subagentDir, "messages");
23962
24334
  await mkdir10(messagesDir, { recursive: true });
23963
24335
  return { workspace: workspaceDst, messagesDir };
23964
24336
  }
23965
24337
  async function createSubagentLock(subagentDir) {
23966
- const messagesDir = path29.join(subagentDir, "messages");
24338
+ const messagesDir = path30.join(subagentDir, "messages");
23967
24339
  if (await pathExists(messagesDir)) {
23968
24340
  const files = await readdir3(messagesDir);
23969
24341
  await Promise.all(
23970
24342
  files.map(async (file) => {
23971
- const target = path29.join(messagesDir, file);
24343
+ const target = path30.join(messagesDir, file);
23972
24344
  await removeIfExists(target);
23973
24345
  })
23974
24346
  );
23975
24347
  }
23976
- const githubAgentsDir = path29.join(subagentDir, ".github", "agents");
24348
+ const githubAgentsDir = path30.join(subagentDir, ".github", "agents");
23977
24349
  if (await pathExists(githubAgentsDir)) {
23978
24350
  const agentFiles = await readdir3(githubAgentsDir);
23979
24351
  const preservedFiles = /* @__PURE__ */ new Set(["wakeup.md", "subagent.md"]);
23980
24352
  await Promise.all(
23981
- 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)))
23982
24354
  );
23983
24355
  }
23984
- const lockFile = path29.join(subagentDir, DEFAULT_LOCK_NAME);
24356
+ const lockFile = path30.join(subagentDir, DEFAULT_LOCK_NAME);
23985
24357
  await writeFile3(lockFile, "", { encoding: "utf8" });
23986
24358
  return lockFile;
23987
24359
  }
23988
24360
  async function removeSubagentLock(subagentDir) {
23989
- const lockFile = path29.join(subagentDir, DEFAULT_LOCK_NAME);
24361
+ const lockFile = path30.join(subagentDir, DEFAULT_LOCK_NAME);
23990
24362
  await removeIfExists(lockFile);
23991
24363
  }
23992
24364
  async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspaceTemplate, dryRun, cwd) {
@@ -24006,9 +24378,9 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
24006
24378
  return 1;
24007
24379
  }
24008
24380
  if (promptFile) {
24009
- const githubAgentsDir = path29.join(subagentDir, ".github", "agents");
24381
+ const githubAgentsDir = path30.join(subagentDir, ".github", "agents");
24010
24382
  await mkdir10(githubAgentsDir, { recursive: true });
24011
- const agentFile = path29.join(githubAgentsDir, `${chatId}.md`);
24383
+ const agentFile = path30.join(githubAgentsDir, `${chatId}.md`);
24012
24384
  try {
24013
24385
  await copyFile(promptFile, agentFile);
24014
24386
  } catch (error) {
@@ -24025,7 +24397,7 @@ async function resolvePromptFile(promptFile) {
24025
24397
  if (!promptFile) {
24026
24398
  return void 0;
24027
24399
  }
24028
- const resolvedPrompt = path30.resolve(promptFile);
24400
+ const resolvedPrompt = path31.resolve(promptFile);
24029
24401
  if (!await pathExists(resolvedPrompt)) {
24030
24402
  throw new Error(`Prompt file not found: ${resolvedPrompt}`);
24031
24403
  }
@@ -24041,7 +24413,7 @@ async function resolveAttachments(extraAttachments) {
24041
24413
  }
24042
24414
  const resolved = [];
24043
24415
  for (const attachment of extraAttachments) {
24044
- const resolvedPath = path30.resolve(attachment);
24416
+ const resolvedPath = path31.resolve(attachment);
24045
24417
  if (!await pathExists(resolvedPath)) {
24046
24418
  throw new Error(`Attachment not found: ${resolvedPath}`);
24047
24419
  }
@@ -24083,7 +24455,7 @@ async function dispatchAgentSession(options) {
24083
24455
  error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
24084
24456
  };
24085
24457
  }
24086
- const subagentName = path30.basename(subagentDir);
24458
+ const subagentName = path31.basename(subagentDir);
24087
24459
  const chatId = Math.random().toString(16).slice(2, 10);
24088
24460
  const preparationResult = await prepareSubagentDirectory(
24089
24461
  subagentDir,
@@ -24111,9 +24483,9 @@ async function dispatchAgentSession(options) {
24111
24483
  };
24112
24484
  }
24113
24485
  const timestamp = generateTimestamp();
24114
- const messagesDir = path30.join(subagentDir, "messages");
24115
- const responseFileTmp = path30.join(messagesDir, `${timestamp}_res.tmp.md`);
24116
- 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`);
24117
24489
  const requestInstructions = createRequestPrompt(
24118
24490
  userQuery,
24119
24491
  responseFileTmp,
@@ -24218,7 +24590,7 @@ async function dispatchBatchAgent(options) {
24218
24590
  error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
24219
24591
  };
24220
24592
  }
24221
- subagentName = path30.basename(subagentDir);
24593
+ subagentName = path31.basename(subagentDir);
24222
24594
  const chatId = Math.random().toString(16).slice(2, 10);
24223
24595
  const preparationResult = await prepareSubagentDirectory(
24224
24596
  subagentDir,
@@ -24249,17 +24621,17 @@ async function dispatchBatchAgent(options) {
24249
24621
  };
24250
24622
  }
24251
24623
  const timestamp = generateTimestamp();
24252
- const messagesDir = path30.join(subagentDir, "messages");
24624
+ const messagesDir = path31.join(subagentDir, "messages");
24253
24625
  requestFiles = userQueries.map(
24254
- (_, index) => path30.join(messagesDir, `${timestamp}_${index}_req.md`)
24626
+ (_, index) => path31.join(messagesDir, `${timestamp}_${index}_req.md`)
24255
24627
  );
24256
24628
  const responseTmpFiles = userQueries.map(
24257
- (_, index) => path30.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
24629
+ (_, index) => path31.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
24258
24630
  );
24259
24631
  responseFilesFinal = userQueries.map(
24260
- (_, index) => path30.join(messagesDir, `${timestamp}_${index}_res.md`)
24632
+ (_, index) => path31.join(messagesDir, `${timestamp}_${index}_res.md`)
24261
24633
  );
24262
- const orchestratorFile = path30.join(messagesDir, `${timestamp}_orchestrator.md`);
24634
+ const orchestratorFile = path31.join(messagesDir, `${timestamp}_orchestrator.md`);
24263
24635
  if (!dryRun) {
24264
24636
  await Promise.all(
24265
24637
  userQueries.map((query, index) => {
@@ -24372,7 +24744,7 @@ async function provisionSubagents(options) {
24372
24744
  if (!Number.isInteger(subagents) || subagents < 1) {
24373
24745
  throw new Error("subagents must be a positive integer");
24374
24746
  }
24375
- const targetPath = path31.resolve(targetRoot);
24747
+ const targetPath = path322.resolve(targetRoot);
24376
24748
  if (!dryRun) {
24377
24749
  await ensureDir(targetPath);
24378
24750
  }
@@ -24392,7 +24764,7 @@ async function provisionSubagents(options) {
24392
24764
  continue;
24393
24765
  }
24394
24766
  highestNumber = Math.max(highestNumber, parsed);
24395
- const lockFile = path31.join(entry.absolutePath, lockName);
24767
+ const lockFile = path322.join(entry.absolutePath, lockName);
24396
24768
  const locked = await pathExists(lockFile);
24397
24769
  if (locked) {
24398
24770
  lockedSubagents.add(entry.absolutePath);
@@ -24409,10 +24781,10 @@ async function provisionSubagents(options) {
24409
24781
  break;
24410
24782
  }
24411
24783
  const subagentDir = subagent.absolutePath;
24412
- const githubAgentsDir = path31.join(subagentDir, ".github", "agents");
24413
- const lockFile = path31.join(subagentDir, lockName);
24414
- const workspaceDst = path31.join(subagentDir, `${path31.basename(subagentDir)}.code-workspace`);
24415
- 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");
24416
24788
  const isLocked = await pathExists(lockFile);
24417
24789
  if (isLocked && !force) {
24418
24790
  continue;
@@ -24450,10 +24822,10 @@ async function provisionSubagents(options) {
24450
24822
  let nextIndex = highestNumber;
24451
24823
  while (subagentsProvisioned < subagents) {
24452
24824
  nextIndex += 1;
24453
- const subagentDir = path31.join(targetPath, `subagent-${nextIndex}`);
24454
- const githubAgentsDir = path31.join(subagentDir, ".github", "agents");
24455
- const workspaceDst = path31.join(subagentDir, `${path31.basename(subagentDir)}.code-workspace`);
24456
- 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");
24457
24829
  if (!dryRun) {
24458
24830
  await ensureDir(subagentDir);
24459
24831
  await ensureDir(githubAgentsDir);
@@ -24639,7 +25011,7 @@ var VSCodeProvider = class {
24639
25011
  async function locateVSCodeExecutable(candidate) {
24640
25012
  const includesPathSeparator = candidate.includes("/") || candidate.includes("\\");
24641
25013
  if (includesPathSeparator) {
24642
- const resolved = path322.isAbsolute(candidate) ? candidate : path322.resolve(candidate);
25014
+ const resolved = path33.isAbsolute(candidate) ? candidate : path33.resolve(candidate);
24643
25015
  try {
24644
25016
  await access3(resolved, constants3.F_OK);
24645
25017
  return resolved;
@@ -24668,7 +25040,7 @@ async function resolveWorkspaceTemplateFile(template) {
24668
25040
  return void 0;
24669
25041
  }
24670
25042
  try {
24671
- const stats = await stat5(path322.resolve(template));
25043
+ const stats = await stat5(path33.resolve(template));
24672
25044
  return stats.isFile() ? template : void 0;
24673
25045
  } catch {
24674
25046
  return template;
@@ -24692,7 +25064,7 @@ function buildMandatoryPrereadBlock2(attachmentFiles) {
24692
25064
  return "";
24693
25065
  }
24694
25066
  const buildList = (files) => files.map((absolutePath) => {
24695
- const fileName = path322.basename(absolutePath);
25067
+ const fileName = path33.basename(absolutePath);
24696
25068
  const fileUri = pathToFileUri3(absolutePath);
24697
25069
  return `* [${fileName}](${fileUri})`;
24698
25070
  });
@@ -24713,7 +25085,7 @@ function collectAttachmentFiles(attachments) {
24713
25085
  }
24714
25086
  const unique = /* @__PURE__ */ new Map();
24715
25087
  for (const attachment of attachments) {
24716
- const absolutePath = path322.resolve(attachment);
25088
+ const absolutePath = path33.resolve(attachment);
24717
25089
  if (!unique.has(absolutePath)) {
24718
25090
  unique.set(absolutePath, absolutePath);
24719
25091
  }
@@ -24721,7 +25093,7 @@ function collectAttachmentFiles(attachments) {
24721
25093
  return Array.from(unique.values());
24722
25094
  }
24723
25095
  function pathToFileUri3(filePath) {
24724
- const absolutePath = path322.isAbsolute(filePath) ? filePath : path322.resolve(filePath);
25096
+ const absolutePath = path33.isAbsolute(filePath) ? filePath : path33.resolve(filePath);
24725
25097
  const normalizedPath = absolutePath.replace(/\\/g, "/");
24726
25098
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
24727
25099
  return `file:///${normalizedPath}`;
@@ -24734,7 +25106,7 @@ function normalizeAttachments(attachments) {
24734
25106
  }
24735
25107
  const deduped = /* @__PURE__ */ new Set();
24736
25108
  for (const attachment of attachments) {
24737
- deduped.add(path322.resolve(attachment));
25109
+ deduped.add(path33.resolve(attachment));
24738
25110
  }
24739
25111
  return Array.from(deduped);
24740
25112
  }
@@ -24743,7 +25115,7 @@ function mergeAttachments(all) {
24743
25115
  for (const list of all) {
24744
25116
  if (!list) continue;
24745
25117
  for (const inputFile of list) {
24746
- deduped.add(path322.resolve(inputFile));
25118
+ deduped.add(path33.resolve(inputFile));
24747
25119
  }
24748
25120
  }
24749
25121
  return deduped.size > 0 ? Array.from(deduped) : void 0;
@@ -24826,11 +25198,11 @@ async function fileExists3(filePath) {
24826
25198
  }
24827
25199
  }
24828
25200
  async function readTargetDefinitions(filePath) {
24829
- const absolutePath = path33.resolve(filePath);
25201
+ const absolutePath = path34.resolve(filePath);
24830
25202
  if (!await fileExists3(absolutePath)) {
24831
25203
  throw new Error(`targets.yaml not found at ${absolutePath}`);
24832
25204
  }
24833
- const raw = await readFile11(absolutePath, "utf8");
25205
+ const raw = await readFile12(absolutePath, "utf8");
24834
25206
  const parsed = parse4(raw);
24835
25207
  if (!isRecord(parsed)) {
24836
25208
  throw new Error(`targets.yaml at ${absolutePath} must be a YAML object with a 'targets' field`);
@@ -24847,11 +25219,11 @@ function listTargetNames(definitions) {
24847
25219
  async function discoverProviders(registry, baseDir) {
24848
25220
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
24849
25221
  const candidateDirs = [];
24850
- let dir = path34.resolve(baseDir);
24851
- const root = path34.parse(dir).root;
25222
+ let dir = path35.resolve(baseDir);
25223
+ const root = path35.parse(dir).root;
24852
25224
  while (dir !== root) {
24853
- candidateDirs.push(path34.join(dir, ".agentv", "providers"));
24854
- dir = path34.dirname(dir);
25225
+ candidateDirs.push(path35.join(dir, ".agentv", "providers"));
25226
+ dir = path35.dirname(dir);
24855
25227
  }
24856
25228
  let files = [];
24857
25229
  for (const providersDir of candidateDirs) {
@@ -24867,7 +25239,7 @@ async function discoverProviders(registry, baseDir) {
24867
25239
  }
24868
25240
  const discoveredKinds = [];
24869
25241
  for (const filePath of files) {
24870
- const basename = path34.basename(filePath);
25242
+ const basename = path35.basename(filePath);
24871
25243
  const kindName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
24872
25244
  if (registry.has(kindName)) {
24873
25245
  continue;
@@ -24983,148 +25355,6 @@ function negateScore(score) {
24983
25355
  }))
24984
25356
  };
24985
25357
  }
24986
- function shellEscapePath(value) {
24987
- if (process.platform === "win32") {
24988
- return `"${value.replaceAll('"', '""')}"`;
24989
- }
24990
- return `'${value.replaceAll("'", `'"'"'`)}'`;
24991
- }
24992
- async function execFileWithStdin(argv, stdinPayload, options = {}) {
24993
- if (argv.length === 0) {
24994
- throw new Error("Executable argv must include at least one entry");
24995
- }
24996
- if (typeof Bun !== "undefined") {
24997
- return execFileWithStdinBun(argv, stdinPayload, options);
24998
- }
24999
- return execFileWithStdinNode(argv, stdinPayload, options);
25000
- }
25001
- async function execFileWithStdinBun(argv, stdinPayload, options) {
25002
- const command = [...argv];
25003
- const encoder = new TextEncoder();
25004
- const proc = Bun.spawn(command, {
25005
- cwd: options.cwd,
25006
- stdin: encoder.encode(stdinPayload),
25007
- stdout: "pipe",
25008
- stderr: "pipe",
25009
- // Merge additional env vars with process.env
25010
- env: options.env ? { ...process.env, ...options.env } : process.env
25011
- });
25012
- let timedOut = false;
25013
- const timeout = options.timeoutMs !== void 0 ? setTimeout(() => {
25014
- timedOut = true;
25015
- proc.kill("SIGKILL");
25016
- }, options.timeoutMs) : void 0;
25017
- try {
25018
- const stdoutPromise = proc.stdout ? new Response(proc.stdout).text() : Promise.resolve("");
25019
- const stderrPromise = proc.stderr ? new Response(proc.stderr).text() : Promise.resolve("");
25020
- const [stdout, stderr, exitCode] = await Promise.all([
25021
- stdoutPromise,
25022
- stderrPromise,
25023
- proc.exited
25024
- ]);
25025
- if (timedOut) {
25026
- throw new Error(`Process timed out after ${options.timeoutMs}ms`);
25027
- }
25028
- return {
25029
- stdout: stdout.replace(/\r\n/g, "\n"),
25030
- stderr: stderr.replace(/\r\n/g, "\n"),
25031
- exitCode
25032
- };
25033
- } finally {
25034
- if (timeout !== void 0) {
25035
- clearTimeout(timeout);
25036
- }
25037
- }
25038
- }
25039
- async function execFileWithStdinNode(argv, stdinPayload, options) {
25040
- const { spawn: spawn5 } = await import("node:child_process");
25041
- return new Promise((resolve2, reject) => {
25042
- const [cmd, ...args] = argv;
25043
- const child = spawn5(cmd, args, {
25044
- cwd: options.cwd,
25045
- stdio: ["pipe", "pipe", "pipe"],
25046
- // Merge additional env vars with process.env
25047
- env: options.env ? { ...process.env, ...options.env } : process.env
25048
- });
25049
- const stdoutChunks = [];
25050
- const stderrChunks = [];
25051
- child.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
25052
- child.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
25053
- let timedOut = false;
25054
- const timeout = options.timeoutMs !== void 0 ? setTimeout(() => {
25055
- timedOut = true;
25056
- child.kill("SIGKILL");
25057
- }, options.timeoutMs) : void 0;
25058
- child.on("error", (error) => {
25059
- if (timeout !== void 0) clearTimeout(timeout);
25060
- reject(error);
25061
- });
25062
- child.on("close", (code) => {
25063
- if (timeout !== void 0) clearTimeout(timeout);
25064
- if (timedOut) {
25065
- reject(new Error(`Process timed out after ${options.timeoutMs}ms`));
25066
- return;
25067
- }
25068
- const stdout = Buffer.concat(stdoutChunks).toString("utf8").replace(/\r\n/g, "\n");
25069
- const stderr = Buffer.concat(stderrChunks).toString("utf8").replace(/\r\n/g, "\n");
25070
- resolve2({
25071
- stdout,
25072
- stderr,
25073
- exitCode: code ?? 0
25074
- });
25075
- });
25076
- if (child.stdin) {
25077
- child.stdin.write(stdinPayload);
25078
- child.stdin.end();
25079
- }
25080
- });
25081
- }
25082
- async function execShellWithStdin(command, stdinPayload, options = {}) {
25083
- const { mkdir: mkdir16, readFile: readFile16, rm: rm6, writeFile: writeFile9 } = await import("node:fs/promises");
25084
- const { tmpdir: tmpdir3 } = await import("node:os");
25085
- const path51 = await import("node:path");
25086
- const { randomUUID: randomUUID10 } = await import("node:crypto");
25087
- const dir = path51.join(tmpdir3(), `agentv-exec-${randomUUID10()}`);
25088
- await mkdir16(dir, { recursive: true });
25089
- const stdinPath = path51.join(dir, "stdin.txt");
25090
- const stdoutPath = path51.join(dir, "stdout.txt");
25091
- const stderrPath = path51.join(dir, "stderr.txt");
25092
- await writeFile9(stdinPath, stdinPayload, "utf8");
25093
- const wrappedCommand = process.platform === "win32" ? `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}` : `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}`;
25094
- const { spawn: spawn5 } = await import("node:child_process");
25095
- try {
25096
- const exitCode = await new Promise((resolve2, reject) => {
25097
- const child = spawn5(wrappedCommand, {
25098
- shell: true,
25099
- cwd: options.cwd,
25100
- stdio: ["ignore", "ignore", "ignore"],
25101
- // Merge additional env vars with process.env
25102
- env: options.env ? { ...process.env, ...options.env } : process.env
25103
- });
25104
- const timeout = options.timeoutMs ? setTimeout(() => {
25105
- child.kill();
25106
- reject(new Error(`Process timed out after ${options.timeoutMs}ms`));
25107
- }, options.timeoutMs) : void 0;
25108
- child.on("error", (error) => {
25109
- if (timeout !== void 0) {
25110
- clearTimeout(timeout);
25111
- }
25112
- reject(error);
25113
- });
25114
- child.on("exit", (code) => {
25115
- if (timeout !== void 0) {
25116
- clearTimeout(timeout);
25117
- }
25118
- resolve2(code ?? 0);
25119
- });
25120
- });
25121
- const stdout = (await readFile16(stdoutPath, "utf8")).replace(/\r\n/g, "\n");
25122
- const stderr = (await readFile16(stderrPath, "utf8")).replace(/\r\n/g, "\n");
25123
- return { stdout, stderr, exitCode };
25124
- } finally {
25125
- await rm6(dir, { recursive: true, force: true });
25126
- }
25127
- }
25128
25358
  var DEFAULT_MAX_CALLS = 50;
25129
25359
  async function createTargetProxy(options) {
25130
25360
  const { defaultProvider, targetResolver, availableTargets, maxCalls } = options;
@@ -25702,6 +25932,15 @@ var scoreRangeEvaluationSchema = external_exports2.object({
25702
25932
  checks: external_exports2.array(scoreRangeCheckResultSchema).describe("Scores for each rubric criterion"),
25703
25933
  overall_reasoning: external_exports2.string().describe("Overall assessment summary (1-2 sentences)").optional()
25704
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
+ }
25705
25944
  var LlmGraderEvaluator = class {
25706
25945
  kind = "llm-grader";
25707
25946
  resolveGraderProvider;
@@ -25719,24 +25958,46 @@ var LlmGraderEvaluator = class {
25719
25958
  this.graderTargetProvider = options.graderTargetProvider ?? options.judgeTargetProvider;
25720
25959
  }
25721
25960
  async evaluate(context2) {
25961
+ const preparedContext = await this.prepareContext(context2);
25722
25962
  if (this.graderTargetProvider) {
25723
- return this.evaluateWithGraderTarget(context2);
25963
+ return this.evaluateWithGraderTarget(preparedContext);
25724
25964
  }
25725
- const graderProvider = await this.resolveGraderProvider(context2);
25965
+ const graderProvider = await this.resolveGraderProvider(preparedContext);
25726
25966
  if (!graderProvider) {
25727
25967
  throw new Error("No grader provider available for LLM grading");
25728
25968
  }
25729
25969
  if (graderProvider.kind === "agentv") {
25730
- return this.evaluateBuiltIn(context2, graderProvider);
25970
+ return this.evaluateBuiltIn(preparedContext, graderProvider);
25731
25971
  }
25732
25972
  if (isAgentProvider(graderProvider)) {
25733
- return this.evaluateWithDelegatedAgent(context2, graderProvider);
25973
+ return this.evaluateWithDelegatedAgent(preparedContext, graderProvider);
25734
25974
  }
25735
- const config = context2.evaluator;
25975
+ const config = preparedContext.evaluator;
25736
25976
  if (config?.type === "llm-grader" && config.rubrics && config.rubrics.length > 0) {
25737
- 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;
25738
25985
  }
25739
- return this.evaluateFreeform(context2, graderProvider);
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;
25989
+ }
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
+ };
25740
26001
  }
25741
26002
  // ---------------------------------------------------------------------------
25742
26003
  // LLM mode (existing)
@@ -26621,8 +26882,8 @@ function toAiSdkImageParts(images) {
26621
26882
  }));
26622
26883
  }
26623
26884
  function resolveSandboxed(basePath, relativePath) {
26624
- const resolved = path35.resolve(basePath, relativePath);
26625
- if (!resolved.startsWith(basePath + path35.sep) && resolved !== basePath) {
26885
+ const resolved = path36.resolve(basePath, relativePath);
26886
+ if (!resolved.startsWith(basePath + path36.sep) && resolved !== basePath) {
26626
26887
  throw new Error(`Path '${relativePath}' is outside the workspace`);
26627
26888
  }
26628
26889
  return resolved;
@@ -26712,11 +26973,11 @@ async function searchDirectory(dirPath, workspacePath, regex, matches) {
26712
26973
  for (const entry of entries) {
26713
26974
  if (matches.length >= MAX_SEARCH_MATCHES) return;
26714
26975
  if (SEARCH_SKIP_DIRS.has(entry.name)) continue;
26715
- const fullPath = path35.join(dirPath, entry.name);
26976
+ const fullPath = path36.join(dirPath, entry.name);
26716
26977
  if (entry.isDirectory()) {
26717
26978
  await searchDirectory(fullPath, workspacePath, regex, matches);
26718
26979
  } else if (entry.isFile()) {
26719
- const ext = path35.extname(entry.name).toLowerCase();
26980
+ const ext = path36.extname(entry.name).toLowerCase();
26720
26981
  if (BINARY_EXTENSIONS.has(ext)) continue;
26721
26982
  try {
26722
26983
  const stat11 = await fs2.stat(fullPath);
@@ -26728,7 +26989,7 @@ async function searchDirectory(dirPath, workspacePath, regex, matches) {
26728
26989
  regex.lastIndex = 0;
26729
26990
  if (regex.test(lines[i])) {
26730
26991
  matches.push({
26731
- file: path35.relative(workspacePath, fullPath),
26992
+ file: path36.relative(workspacePath, fullPath),
26732
26993
  line: i + 1,
26733
26994
  text: lines[i].substring(0, 200)
26734
26995
  });
@@ -27353,115 +27614,115 @@ var FieldAccuracyEvaluator = class {
27353
27614
  * Evaluate a single field against the expected value.
27354
27615
  */
27355
27616
  evaluateField(fieldConfig, candidateData, expectedData) {
27356
- const { path: path51, match, required = true, weight = 1 } = fieldConfig;
27357
- const candidateValue = resolvePath(candidateData, path51);
27358
- 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);
27359
27620
  if (expectedValue === void 0) {
27360
27621
  return {
27361
- path: path51,
27622
+ path: path52,
27362
27623
  score: 1,
27363
27624
  // No expected value means no comparison needed
27364
27625
  weight,
27365
27626
  hit: true,
27366
- message: `${path51}: no expected value`
27627
+ message: `${path52}: no expected value`
27367
27628
  };
27368
27629
  }
27369
27630
  if (candidateValue === void 0) {
27370
27631
  if (required) {
27371
27632
  return {
27372
- path: path51,
27633
+ path: path52,
27373
27634
  score: 0,
27374
27635
  weight,
27375
27636
  hit: false,
27376
- message: `${path51} (required, missing)`
27637
+ message: `${path52} (required, missing)`
27377
27638
  };
27378
27639
  }
27379
27640
  return {
27380
- path: path51,
27641
+ path: path52,
27381
27642
  score: 1,
27382
27643
  // Don't penalize missing optional fields
27383
27644
  weight: 0,
27384
27645
  // Zero weight means it won't affect the score
27385
27646
  hit: true,
27386
- message: `${path51}: optional field missing`
27647
+ message: `${path52}: optional field missing`
27387
27648
  };
27388
27649
  }
27389
27650
  switch (match) {
27390
27651
  case "exact":
27391
- return this.compareExact(path51, candidateValue, expectedValue, weight);
27652
+ return this.compareExact(path52, candidateValue, expectedValue, weight);
27392
27653
  case "numeric_tolerance":
27393
27654
  return this.compareNumericTolerance(
27394
- path51,
27655
+ path52,
27395
27656
  candidateValue,
27396
27657
  expectedValue,
27397
27658
  fieldConfig,
27398
27659
  weight
27399
27660
  );
27400
27661
  case "date":
27401
- return this.compareDate(path51, candidateValue, expectedValue, fieldConfig, weight);
27662
+ return this.compareDate(path52, candidateValue, expectedValue, fieldConfig, weight);
27402
27663
  default:
27403
27664
  return {
27404
- path: path51,
27665
+ path: path52,
27405
27666
  score: 0,
27406
27667
  weight,
27407
27668
  hit: false,
27408
- message: `${path51}: unknown match type "${match}"`
27669
+ message: `${path52}: unknown match type "${match}"`
27409
27670
  };
27410
27671
  }
27411
27672
  }
27412
27673
  /**
27413
27674
  * Exact equality comparison.
27414
27675
  */
27415
- compareExact(path51, candidateValue, expectedValue, weight) {
27676
+ compareExact(path52, candidateValue, expectedValue, weight) {
27416
27677
  if (deepEqual(candidateValue, expectedValue)) {
27417
27678
  return {
27418
- path: path51,
27679
+ path: path52,
27419
27680
  score: 1,
27420
27681
  weight,
27421
27682
  hit: true,
27422
- message: path51
27683
+ message: path52
27423
27684
  };
27424
27685
  }
27425
27686
  if (typeof candidateValue !== typeof expectedValue) {
27426
27687
  return {
27427
- path: path51,
27688
+ path: path52,
27428
27689
  score: 0,
27429
27690
  weight,
27430
27691
  hit: false,
27431
- message: `${path51} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
27692
+ message: `${path52} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
27432
27693
  };
27433
27694
  }
27434
27695
  return {
27435
- path: path51,
27696
+ path: path52,
27436
27697
  score: 0,
27437
27698
  weight,
27438
27699
  hit: false,
27439
- message: `${path51} (value mismatch)`
27700
+ message: `${path52} (value mismatch)`
27440
27701
  };
27441
27702
  }
27442
27703
  /**
27443
27704
  * Numeric comparison with absolute or relative tolerance.
27444
27705
  */
27445
- compareNumericTolerance(path51, candidateValue, expectedValue, fieldConfig, weight) {
27706
+ compareNumericTolerance(path52, candidateValue, expectedValue, fieldConfig, weight) {
27446
27707
  const { tolerance = 0, relative = false } = fieldConfig;
27447
27708
  const candidateNum = toNumber(candidateValue);
27448
27709
  const expectedNum = toNumber(expectedValue);
27449
27710
  if (candidateNum === null || expectedNum === null) {
27450
27711
  return {
27451
- path: path51,
27712
+ path: path52,
27452
27713
  score: 0,
27453
27714
  weight,
27454
27715
  hit: false,
27455
- message: `${path51} (non-numeric value)`
27716
+ message: `${path52} (non-numeric value)`
27456
27717
  };
27457
27718
  }
27458
27719
  if (!Number.isFinite(candidateNum) || !Number.isFinite(expectedNum)) {
27459
27720
  return {
27460
- path: path51,
27721
+ path: path52,
27461
27722
  score: 0,
27462
27723
  weight,
27463
27724
  hit: false,
27464
- message: `${path51} (invalid numeric value)`
27725
+ message: `${path52} (invalid numeric value)`
27465
27726
  };
27466
27727
  }
27467
27728
  const diff = Math.abs(candidateNum - expectedNum);
@@ -27474,61 +27735,61 @@ var FieldAccuracyEvaluator = class {
27474
27735
  }
27475
27736
  if (withinTolerance) {
27476
27737
  return {
27477
- path: path51,
27738
+ path: path52,
27478
27739
  score: 1,
27479
27740
  weight,
27480
27741
  hit: true,
27481
- message: `${path51} (within tolerance: diff=${diff.toFixed(2)})`
27742
+ message: `${path52} (within tolerance: diff=${diff.toFixed(2)})`
27482
27743
  };
27483
27744
  }
27484
27745
  return {
27485
- path: path51,
27746
+ path: path52,
27486
27747
  score: 0,
27487
27748
  weight,
27488
27749
  hit: false,
27489
- message: `${path51} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
27750
+ message: `${path52} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
27490
27751
  };
27491
27752
  }
27492
27753
  /**
27493
27754
  * Date comparison with format normalization.
27494
27755
  */
27495
- compareDate(path51, candidateValue, expectedValue, fieldConfig, weight) {
27756
+ compareDate(path52, candidateValue, expectedValue, fieldConfig, weight) {
27496
27757
  const formats = fieldConfig.formats ?? DEFAULT_DATE_FORMATS;
27497
27758
  const candidateDate = parseDate(String(candidateValue), formats);
27498
27759
  const expectedDate = parseDate(String(expectedValue), formats);
27499
27760
  if (candidateDate === null) {
27500
27761
  return {
27501
- path: path51,
27762
+ path: path52,
27502
27763
  score: 0,
27503
27764
  weight,
27504
27765
  hit: false,
27505
- message: `${path51} (unparseable candidate date)`
27766
+ message: `${path52} (unparseable candidate date)`
27506
27767
  };
27507
27768
  }
27508
27769
  if (expectedDate === null) {
27509
27770
  return {
27510
- path: path51,
27771
+ path: path52,
27511
27772
  score: 0,
27512
27773
  weight,
27513
27774
  hit: false,
27514
- message: `${path51} (unparseable expected date)`
27775
+ message: `${path52} (unparseable expected date)`
27515
27776
  };
27516
27777
  }
27517
27778
  if (candidateDate.getFullYear() === expectedDate.getFullYear() && candidateDate.getMonth() === expectedDate.getMonth() && candidateDate.getDate() === expectedDate.getDate()) {
27518
27779
  return {
27519
- path: path51,
27780
+ path: path52,
27520
27781
  score: 1,
27521
27782
  weight,
27522
27783
  hit: true,
27523
- message: path51
27784
+ message: path52
27524
27785
  };
27525
27786
  }
27526
27787
  return {
27527
- path: path51,
27788
+ path: path52,
27528
27789
  score: 0,
27529
27790
  weight,
27530
27791
  hit: false,
27531
- message: `${path51} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
27792
+ message: `${path52} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
27532
27793
  };
27533
27794
  }
27534
27795
  /**
@@ -27561,11 +27822,11 @@ var FieldAccuracyEvaluator = class {
27561
27822
  };
27562
27823
  }
27563
27824
  };
27564
- function resolvePath(obj, path51) {
27565
- if (!path51 || !obj) {
27825
+ function resolvePath(obj, path52) {
27826
+ if (!path52 || !obj) {
27566
27827
  return void 0;
27567
27828
  }
27568
- const parts = path51.split(/\.|\[|\]/).filter((p) => p.length > 0);
27829
+ const parts = path52.split(/\.|\[|\]/).filter((p) => p.length > 0);
27569
27830
  let current = obj;
27570
27831
  for (const part of parts) {
27571
27832
  if (current === null || current === void 0) {
@@ -28047,8 +28308,8 @@ var TokenUsageEvaluator = class {
28047
28308
  };
28048
28309
  }
28049
28310
  };
28050
- function getNestedValue(obj, path51) {
28051
- const parts = path51.split(".");
28311
+ function getNestedValue(obj, path52) {
28312
+ const parts = path52.split(".");
28052
28313
  let current = obj;
28053
28314
  for (const part of parts) {
28054
28315
  if (current === null || current === void 0 || typeof current !== "object") {
@@ -28908,7 +29169,7 @@ async function executePromptTemplate(script, context2, config, timeoutMs) {
28908
29169
  };
28909
29170
  const inputJson = JSON.stringify(toSnakeCaseDeep(payload), null, 2);
28910
29171
  const scriptPath = script[script.length - 1];
28911
- const cwd = path36.dirname(scriptPath);
29172
+ const cwd = path37.dirname(scriptPath);
28912
29173
  try {
28913
29174
  const stdout = await executeScript(script, inputJson, timeoutMs, cwd);
28914
29175
  const prompt = stdout.trim();
@@ -29179,11 +29440,11 @@ function createBuiltinRegistry() {
29179
29440
  async function discoverAssertions(registry, baseDir) {
29180
29441
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
29181
29442
  const candidateDirs = [];
29182
- let dir = path37.resolve(baseDir);
29183
- const root = path37.parse(dir).root;
29443
+ let dir = path38.resolve(baseDir);
29444
+ const root = path38.parse(dir).root;
29184
29445
  while (dir !== root) {
29185
- candidateDirs.push(path37.join(dir, ".agentv", "assertions"));
29186
- dir = path37.dirname(dir);
29446
+ candidateDirs.push(path38.join(dir, ".agentv", "assertions"));
29447
+ dir = path38.dirname(dir);
29187
29448
  }
29188
29449
  let files = [];
29189
29450
  for (const assertionsDir of candidateDirs) {
@@ -29199,7 +29460,7 @@ async function discoverAssertions(registry, baseDir) {
29199
29460
  }
29200
29461
  const discoveredTypes = [];
29201
29462
  for (const filePath of files) {
29202
- const basename = path37.basename(filePath);
29463
+ const basename = path38.basename(filePath);
29203
29464
  const typeName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
29204
29465
  if (registry.has(typeName)) {
29205
29466
  continue;
@@ -29218,12 +29479,12 @@ async function discoverAssertions(registry, baseDir) {
29218
29479
  async function discoverGraders(registry, baseDir) {
29219
29480
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
29220
29481
  const candidateDirs = [];
29221
- let dir = path38.resolve(baseDir);
29222
- const root = path38.parse(dir).root;
29482
+ let dir = path39.resolve(baseDir);
29483
+ const root = path39.parse(dir).root;
29223
29484
  while (dir !== root) {
29224
- candidateDirs.push(path38.join(dir, ".agentv", "graders"));
29225
- candidateDirs.push(path38.join(dir, ".agentv", "judges"));
29226
- 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);
29227
29488
  }
29228
29489
  let files = [];
29229
29490
  for (const gradersDir of candidateDirs) {
@@ -29239,7 +29500,7 @@ async function discoverGraders(registry, baseDir) {
29239
29500
  }
29240
29501
  const discoveredTypes = [];
29241
29502
  for (const filePath of files) {
29242
- const basename = path38.basename(filePath);
29503
+ const basename = path39.basename(filePath);
29243
29504
  const typeName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
29244
29505
  if (registry.has(typeName)) {
29245
29506
  continue;
@@ -29425,10 +29686,10 @@ async function stageNestedRepoChanges(workspacePath) {
29425
29686
  }
29426
29687
  for (const entry of entries) {
29427
29688
  if (entry === ".git" || entry === "node_modules") continue;
29428
- const childPath = path39.join(workspacePath, entry);
29689
+ const childPath = path40.join(workspacePath, entry);
29429
29690
  try {
29430
29691
  if (!statSync(childPath).isDirectory()) continue;
29431
- if (!statSync(path39.join(childPath, ".git")).isDirectory()) continue;
29692
+ if (!statSync(path40.join(childPath, ".git")).isDirectory()) continue;
29432
29693
  } catch {
29433
29694
  continue;
29434
29695
  }
@@ -29465,14 +29726,14 @@ async function isDirectory(filePath) {
29465
29726
  }
29466
29727
  function getWorkspacePath(evalRunId, caseId, workspaceRoot) {
29467
29728
  const root = workspaceRoot ?? getWorkspacesRoot();
29468
- return path40.join(root, evalRunId, caseId);
29729
+ return path41.join(root, evalRunId, caseId);
29469
29730
  }
29470
29731
  async function copyDirectoryRecursive(src, dest) {
29471
29732
  await mkdir12(dest, { recursive: true });
29472
29733
  const entries = await readdir4(src, { withFileTypes: true });
29473
29734
  for (const entry of entries) {
29474
- const srcPath = path40.join(src, entry.name);
29475
- const destPath = path40.join(dest, entry.name);
29735
+ const srcPath = path41.join(src, entry.name);
29736
+ const destPath = path41.join(dest, entry.name);
29476
29737
  if (entry.name === ".git") {
29477
29738
  continue;
29478
29739
  }
@@ -29484,7 +29745,7 @@ async function copyDirectoryRecursive(src, dest) {
29484
29745
  }
29485
29746
  }
29486
29747
  async function createTempWorkspace(templatePath, evalRunId, caseId, workspaceRoot) {
29487
- const resolvedTemplatePath = path40.resolve(templatePath);
29748
+ const resolvedTemplatePath = path41.resolve(templatePath);
29488
29749
  if (!await fileExists(resolvedTemplatePath)) {
29489
29750
  throw new TemplateNotFoundError(resolvedTemplatePath);
29490
29751
  }
@@ -29533,7 +29794,7 @@ async function cleanupWorkspace(workspacePath) {
29533
29794
  }
29534
29795
  async function cleanupEvalWorkspaces(evalRunId, workspaceRoot) {
29535
29796
  const root = workspaceRoot ?? getWorkspacesRoot();
29536
- const evalDir = path40.join(root, evalRunId);
29797
+ const evalDir = path41.join(root, evalRunId);
29537
29798
  if (await fileExists(evalDir)) {
29538
29799
  await rm4(evalDir, { recursive: true, force: true });
29539
29800
  }
@@ -29590,8 +29851,8 @@ async function copyDirectoryRecursive2(src, dest, skipDirs) {
29590
29851
  await mkdir13(dest, { recursive: true });
29591
29852
  const entries = await readdir5(src, { withFileTypes: true });
29592
29853
  for (const entry of entries) {
29593
- const srcPath = path41.join(src, entry.name);
29594
- const destPath = path41.join(dest, entry.name);
29854
+ const srcPath = path422.join(src, entry.name);
29855
+ const destPath = path422.join(dest, entry.name);
29595
29856
  if (entry.name === ".git") {
29596
29857
  continue;
29597
29858
  }
@@ -29624,7 +29885,7 @@ var WorkspacePoolManager = class {
29624
29885
  async acquireWorkspace(options) {
29625
29886
  const { templatePath, repos, maxSlots, repoManager, poolReset } = options;
29626
29887
  const fingerprint = computeWorkspaceFingerprint(repos);
29627
- const poolDir = path41.join(this.poolRoot, fingerprint);
29888
+ const poolDir = path422.join(this.poolRoot, fingerprint);
29628
29889
  await mkdir13(poolDir, { recursive: true });
29629
29890
  const drifted = await this.checkDrift(poolDir, fingerprint);
29630
29891
  if (drifted) {
@@ -29634,7 +29895,7 @@ var WorkspacePoolManager = class {
29634
29895
  await this.removeAllSlots(poolDir);
29635
29896
  }
29636
29897
  for (let i = 0; i < maxSlots; i++) {
29637
- const slotPath = path41.join(poolDir, `slot-${i}`);
29898
+ const slotPath = path422.join(poolDir, `slot-${i}`);
29638
29899
  const lockPath = `${slotPath}.lock`;
29639
29900
  const locked = await this.tryLock(lockPath);
29640
29901
  if (!locked) {
@@ -29696,7 +29957,7 @@ var WorkspacePoolManager = class {
29696
29957
  throw err;
29697
29958
  }
29698
29959
  try {
29699
- const pidStr = await readFile12(lockPath, "utf-8");
29960
+ const pidStr = await readFile13(lockPath, "utf-8");
29700
29961
  const pid = Number.parseInt(pidStr.trim(), 10);
29701
29962
  if (!Number.isNaN(pid)) {
29702
29963
  try {
@@ -29721,9 +29982,9 @@ var WorkspacePoolManager = class {
29721
29982
  * Returns false (no drift) if metadata.json doesn't exist (first use).
29722
29983
  */
29723
29984
  async checkDrift(poolDir, fingerprint) {
29724
- const metadataPath = path41.join(poolDir, "metadata.json");
29985
+ const metadataPath = path422.join(poolDir, "metadata.json");
29725
29986
  try {
29726
- const raw = await readFile12(metadataPath, "utf-8");
29987
+ const raw = await readFile13(metadataPath, "utf-8");
29727
29988
  const metadata = JSON.parse(raw);
29728
29989
  return metadata.fingerprint !== fingerprint;
29729
29990
  } catch {
@@ -29738,17 +29999,17 @@ var WorkspacePoolManager = class {
29738
29999
  repos,
29739
30000
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
29740
30001
  };
29741
- 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));
29742
30003
  }
29743
30004
  /** Remove all slot directories and their lock files from a pool directory. */
29744
30005
  async removeAllSlots(poolDir) {
29745
30006
  const entries = await readdir5(poolDir);
29746
30007
  for (const entry of entries) {
29747
30008
  if (entry.startsWith("slot-") && !entry.endsWith(".lock")) {
29748
- const lockPath = path41.join(poolDir, `${entry}.lock`);
30009
+ const lockPath = path422.join(poolDir, `${entry}.lock`);
29749
30010
  if (existsSync3(lockPath)) {
29750
30011
  try {
29751
- const pidStr = await readFile12(lockPath, "utf-8");
30012
+ const pidStr = await readFile13(lockPath, "utf-8");
29752
30013
  const pid = Number.parseInt(pidStr.trim(), 10);
29753
30014
  if (!Number.isNaN(pid)) {
29754
30015
  try {
@@ -29761,12 +30022,12 @@ var WorkspacePoolManager = class {
29761
30022
  } catch {
29762
30023
  }
29763
30024
  }
29764
- await rm5(path41.join(poolDir, entry), { recursive: true, force: true });
30025
+ await rm5(path422.join(poolDir, entry), { recursive: true, force: true });
29765
30026
  await rm5(lockPath, { force: true }).catch(() => {
29766
30027
  });
29767
30028
  }
29768
30029
  }
29769
- await rm5(path41.join(poolDir, "metadata.json"), { force: true }).catch(() => {
30030
+ await rm5(path422.join(poolDir, "metadata.json"), { force: true }).catch(() => {
29770
30031
  });
29771
30032
  }
29772
30033
  /**
@@ -29776,7 +30037,7 @@ var WorkspacePoolManager = class {
29776
30037
  */
29777
30038
  async resetSlot(slotPath, templatePath, repos, poolReset = "fast") {
29778
30039
  for (const repo of repos) {
29779
- const repoDir = path41.join(slotPath, repo.path);
30040
+ const repoDir = path422.join(slotPath, repo.path);
29780
30041
  if (!existsSync3(repoDir)) {
29781
30042
  continue;
29782
30043
  }
@@ -29907,7 +30168,7 @@ ${lines.join("\n")}`;
29907
30168
  * Handles checkout, ref resolution, ancestor walking, shallow clone, sparse checkout.
29908
30169
  */
29909
30170
  async materialize(repo, workspacePath) {
29910
- const targetDir = path422.join(workspacePath, repo.path);
30171
+ const targetDir = path43.join(workspacePath, repo.path);
29911
30172
  const sourceUrl = getSourceUrl(repo.source);
29912
30173
  const startedAt = Date.now();
29913
30174
  if (this.verbose) {
@@ -29998,7 +30259,7 @@ ${lines.join("\n")}`;
29998
30259
  async reset(repos, workspacePath, reset) {
29999
30260
  const cleanFlag = reset === "strict" ? "-fdx" : "-fd";
30000
30261
  for (const repo of repos) {
30001
- const targetDir = path422.join(workspacePath, repo.path);
30262
+ const targetDir = path43.join(workspacePath, repo.path);
30002
30263
  await this.runGit(["reset", "--hard", "HEAD"], { cwd: targetDir });
30003
30264
  await this.runGit(["clean", cleanFlag], { cwd: targetDir });
30004
30265
  }
@@ -30008,11 +30269,11 @@ async function resolveWorkspaceTemplate(templatePath) {
30008
30269
  if (!templatePath) {
30009
30270
  return void 0;
30010
30271
  }
30011
- const resolved = path43.resolve(templatePath);
30272
+ const resolved = path44.resolve(templatePath);
30012
30273
  const stats = await stat7(resolved);
30013
30274
  if (stats.isFile()) {
30014
30275
  return {
30015
- dir: path43.dirname(resolved),
30276
+ dir: path44.dirname(resolved),
30016
30277
  workspaceFile: resolved
30017
30278
  };
30018
30279
  }
@@ -30024,14 +30285,14 @@ async function resolveWorkspaceTemplate(templatePath) {
30024
30285
  if (workspaceFiles.length === 1) {
30025
30286
  return {
30026
30287
  dir: resolved,
30027
- workspaceFile: path43.join(resolved, workspaceFiles[0])
30288
+ workspaceFile: path44.join(resolved, workspaceFiles[0])
30028
30289
  };
30029
30290
  }
30030
30291
  if (workspaceFiles.length > 1) {
30031
30292
  const conventionFile = workspaceFiles.find((f) => f === "template.code-workspace");
30032
30293
  return {
30033
30294
  dir: resolved,
30034
- workspaceFile: conventionFile ? path43.join(resolved, conventionFile) : void 0
30295
+ workspaceFile: conventionFile ? path44.join(resolved, conventionFile) : void 0
30035
30296
  };
30036
30297
  }
30037
30298
  return { dir: resolved };
@@ -30246,7 +30507,7 @@ async function runEvaluation(options) {
30246
30507
  ];
30247
30508
  const evaluatorRegistry = buildEvaluatorRegistry(evaluators, resolveGraderProvider);
30248
30509
  const typeRegistry = createBuiltinRegistry();
30249
- const discoveryBaseDir = evalFilePath ? path44.dirname(path44.resolve(evalFilePath)) : process.cwd();
30510
+ const discoveryBaseDir = evalFilePath ? path45.dirname(path45.resolve(evalFilePath)) : process.cwd();
30250
30511
  const evalDir = discoveryBaseDir;
30251
30512
  await discoverAssertions(typeRegistry, discoveryBaseDir);
30252
30513
  await discoverGraders(typeRegistry, discoveryBaseDir);
@@ -30444,7 +30705,7 @@ async function runEvaluation(options) {
30444
30705
  }
30445
30706
  try {
30446
30707
  if (suiteWorkspaceFile && sharedWorkspacePath) {
30447
- const copiedWorkspaceFile = path44.join(sharedWorkspacePath, path44.basename(suiteWorkspaceFile));
30708
+ const copiedWorkspaceFile = path45.join(sharedWorkspacePath, path45.basename(suiteWorkspaceFile));
30448
30709
  try {
30449
30710
  await stat8(copiedWorkspaceFile);
30450
30711
  suiteWorkspaceFile = copiedWorkspaceFile;
@@ -30459,7 +30720,7 @@ async function runEvaluation(options) {
30459
30720
  try {
30460
30721
  if (needsPerRepoCheck) {
30461
30722
  for (const repo of suiteWorkspace.repos) {
30462
- const targetDir = path44.join(sharedWorkspacePath, repo.path);
30723
+ const targetDir = path45.join(sharedWorkspacePath, repo.path);
30463
30724
  if (existsSync5(targetDir)) {
30464
30725
  setupLog(`reusing existing repo at: ${targetDir}`);
30465
30726
  continue;
@@ -31046,7 +31307,7 @@ async function runEvalCase(options) {
31046
31307
  );
31047
31308
  }
31048
31309
  if (caseWorkspaceFile && workspacePath) {
31049
- const copiedFile = path44.join(workspacePath, path44.basename(caseWorkspaceFile));
31310
+ const copiedFile = path45.join(workspacePath, path45.basename(caseWorkspaceFile));
31050
31311
  try {
31051
31312
  await stat8(copiedFile);
31052
31313
  caseWorkspaceFile = copiedFile;
@@ -31108,10 +31369,10 @@ async function runEvalCase(options) {
31108
31369
  const files = evalCase.metadata.agent_skills_files;
31109
31370
  if (baseDir && files.length > 0) {
31110
31371
  for (const relPath of files) {
31111
- const srcPath = path44.resolve(baseDir, relPath);
31112
- const destPath = path44.resolve(workspacePath, relPath);
31372
+ const srcPath = path45.resolve(baseDir, relPath);
31373
+ const destPath = path45.resolve(workspacePath, relPath);
31113
31374
  try {
31114
- await mkdir14(path44.dirname(destPath), { recursive: true });
31375
+ await mkdir14(path45.dirname(destPath), { recursive: true });
31115
31376
  await copyFile2(srcPath, destPath);
31116
31377
  } catch (error) {
31117
31378
  const message = error instanceof Error ? error.message : String(error);
@@ -31707,6 +31968,7 @@ async function runEvaluatorsForCase(options) {
31707
31968
  if (!activeEvaluator) {
31708
31969
  throw new Error(`No evaluator registered for kind '${evaluatorKind}'`);
31709
31970
  }
31971
+ const implicitEvaluator = evaluatorKind === "llm-grader" && !evalCase.assertions ? buildImplicitLlmGraderConfig(evalCase) : void 0;
31710
31972
  const score = await activeEvaluator.evaluate({
31711
31973
  evalCase,
31712
31974
  candidate,
@@ -31726,10 +31988,21 @@ async function runEvaluatorsForCase(options) {
31726
31988
  targetResolver,
31727
31989
  availableTargets,
31728
31990
  fileChanges,
31729
- workspacePath
31991
+ workspacePath,
31992
+ ...implicitEvaluator ? { evaluator: implicitEvaluator } : {}
31730
31993
  });
31731
31994
  return { score };
31732
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
+ }
31733
32006
  async function runEvaluatorList(options) {
31734
32007
  const {
31735
32008
  evalCase,
@@ -31779,7 +32052,7 @@ async function runEvaluatorList(options) {
31779
32052
  fileChanges,
31780
32053
  workspacePath
31781
32054
  };
31782
- 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();
31783
32056
  const dispatchContext = {
31784
32057
  graderProvider,
31785
32058
  targetResolver,
@@ -32176,7 +32449,7 @@ async function evaluate(config) {
32176
32449
  }
32177
32450
  const gitRoot = await findGitRoot(process.cwd());
32178
32451
  const repoRoot = gitRoot ?? process.cwd();
32179
- 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");
32180
32453
  await loadEnvHierarchy(repoRoot, testFilePath);
32181
32454
  let resolvedTarget;
32182
32455
  let taskProvider;
@@ -32291,10 +32564,10 @@ function computeSummary(results, durationMs, threshold = DEFAULT_THRESHOLD) {
32291
32564
  var TARGET_FILE_CANDIDATES = [".agentv/targets.yaml", ".agentv/targets.yml"];
32292
32565
  async function discoverDefaultTarget(repoRoot) {
32293
32566
  const cwd = process.cwd();
32294
- const chain = buildDirectoryChain(path45.join(cwd, "_placeholder"), repoRoot);
32567
+ const chain = buildDirectoryChain(path46.join(cwd, "_placeholder"), repoRoot);
32295
32568
  for (const dir of chain) {
32296
32569
  for (const candidate of TARGET_FILE_CANDIDATES) {
32297
- const targetsPath = path45.join(dir, candidate);
32570
+ const targetsPath = path46.join(dir, candidate);
32298
32571
  if (!existsSync6(targetsPath)) continue;
32299
32572
  try {
32300
32573
  const definitions = await readTargetDefinitions(targetsPath);
@@ -32311,7 +32584,7 @@ async function loadEnvHierarchy(repoRoot, startPath) {
32311
32584
  const chain = buildDirectoryChain(startPath, repoRoot);
32312
32585
  const envFiles = [];
32313
32586
  for (const dir of chain) {
32314
- const envPath = path45.join(dir, ".env");
32587
+ const envPath = path46.join(dir, ".env");
32315
32588
  if (existsSync6(envPath)) envFiles.push(envPath);
32316
32589
  }
32317
32590
  for (let i = 0; i < envFiles.length; i++) {
@@ -32526,11 +32799,11 @@ async function scanRepoDeps(evalFilePaths) {
32526
32799
  return { repos: [...seen.values()], errors };
32527
32800
  }
32528
32801
  async function extractReposFromEvalFile(filePath) {
32529
- const content = await readFile13(filePath, "utf8");
32802
+ const content = await readFile14(filePath, "utf8");
32530
32803
  const parsed = interpolateEnv(parse5(content), process.env);
32531
32804
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
32532
32805
  const obj = parsed;
32533
- const evalFileDir = path46.dirname(path46.resolve(filePath));
32806
+ const evalFileDir = path47.dirname(path47.resolve(filePath));
32534
32807
  const repos = [];
32535
32808
  const suiteRepos = await extractReposFromWorkspaceRaw(obj.workspace, evalFileDir);
32536
32809
  repos.push(...suiteRepos);
@@ -32546,8 +32819,8 @@ async function extractReposFromEvalFile(filePath) {
32546
32819
  }
32547
32820
  async function extractReposFromWorkspaceRaw(raw, evalFileDir) {
32548
32821
  if (typeof raw === "string") {
32549
- const workspaceFilePath = path46.resolve(evalFileDir, raw);
32550
- const content = await readFile13(workspaceFilePath, "utf8");
32822
+ const workspaceFilePath = path47.resolve(evalFileDir, raw);
32823
+ const content = await readFile14(workspaceFilePath, "utf8");
32551
32824
  const parsed = interpolateEnv(parse5(content), process.env);
32552
32825
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
32553
32826
  return extractReposFromObject(parsed);
@@ -32582,7 +32855,7 @@ var ResponseCache = class {
32582
32855
  async get(key) {
32583
32856
  const filePath = this.keyToPath(key);
32584
32857
  try {
32585
- const data = await readFile14(filePath, "utf8");
32858
+ const data = await readFile15(filePath, "utf8");
32586
32859
  return JSON.parse(data);
32587
32860
  } catch {
32588
32861
  return void 0;
@@ -32590,13 +32863,13 @@ var ResponseCache = class {
32590
32863
  }
32591
32864
  async set(key, value) {
32592
32865
  const filePath = this.keyToPath(key);
32593
- const dir = path47.dirname(filePath);
32866
+ const dir = path48.dirname(filePath);
32594
32867
  await mkdir15(dir, { recursive: true });
32595
32868
  await writeFile8(filePath, JSON.stringify(value, null, 2), "utf8");
32596
32869
  }
32597
32870
  keyToPath(key) {
32598
32871
  const prefix = key.slice(0, 2);
32599
- return path47.join(this.cachePath, prefix, `${key}.json`);
32872
+ return path48.join(this.cachePath, prefix, `${key}.json`);
32600
32873
  }
32601
32874
  };
32602
32875
  function shouldEnableCache(params) {
@@ -32611,7 +32884,7 @@ function shouldSkipCacheForTemperature(targetConfig) {
32611
32884
  return false;
32612
32885
  }
32613
32886
  function getProjectsRegistryPath() {
32614
- return path48.join(getAgentvHome(), "projects.yaml");
32887
+ return path49.join(getAgentvHome(), "projects.yaml");
32615
32888
  }
32616
32889
  function loadProjectRegistry() {
32617
32890
  const registryPath = getProjectsRegistryPath();
@@ -32631,14 +32904,14 @@ function loadProjectRegistry() {
32631
32904
  }
32632
32905
  function saveProjectRegistry(registry) {
32633
32906
  const registryPath = getProjectsRegistryPath();
32634
- const dir = path48.dirname(registryPath);
32907
+ const dir = path49.dirname(registryPath);
32635
32908
  if (!existsSync7(dir)) {
32636
32909
  mkdirSync2(dir, { recursive: true });
32637
32910
  }
32638
32911
  writeFileSync(registryPath, stringifyYaml(registry), "utf-8");
32639
32912
  }
32640
32913
  function deriveProjectId(dirPath, existingIds) {
32641
- 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, "");
32642
32915
  let candidate = base || "project";
32643
32916
  let suffix = 2;
32644
32917
  while (existingIds.includes(candidate)) {
@@ -32648,11 +32921,11 @@ function deriveProjectId(dirPath, existingIds) {
32648
32921
  return candidate;
32649
32922
  }
32650
32923
  function addProject(projectPath) {
32651
- const absPath = path48.resolve(projectPath);
32924
+ const absPath = path49.resolve(projectPath);
32652
32925
  if (!existsSync7(absPath)) {
32653
32926
  throw new Error(`Directory not found: ${absPath}`);
32654
32927
  }
32655
- if (!existsSync7(path48.join(absPath, ".agentv"))) {
32928
+ if (!existsSync7(path49.join(absPath, ".agentv"))) {
32656
32929
  throw new Error(`No .agentv/ directory found in ${absPath}. Run an evaluation first.`);
32657
32930
  }
32658
32931
  const registry = loadProjectRegistry();
@@ -32666,7 +32939,7 @@ function addProject(projectPath) {
32666
32939
  absPath,
32667
32940
  registry.projects.map((p) => p.id)
32668
32941
  ),
32669
- name: path48.basename(absPath),
32942
+ name: path49.basename(absPath),
32670
32943
  path: absPath,
32671
32944
  addedAt: now2,
32672
32945
  lastOpenedAt: now2
@@ -32695,14 +32968,14 @@ function touchProject(projectId) {
32695
32968
  }
32696
32969
  }
32697
32970
  function discoverProjects(rootDir, maxDepth = 2) {
32698
- const absRoot = path48.resolve(rootDir);
32971
+ const absRoot = path49.resolve(rootDir);
32699
32972
  if (!existsSync7(absRoot) || !statSync2(absRoot).isDirectory()) {
32700
32973
  return [];
32701
32974
  }
32702
32975
  const results = [];
32703
32976
  function scan(dir, depth) {
32704
32977
  if (depth > maxDepth) return;
32705
- if (existsSync7(path48.join(dir, ".agentv"))) {
32978
+ if (existsSync7(path49.join(dir, ".agentv"))) {
32706
32979
  results.push(dir);
32707
32980
  return;
32708
32981
  }
@@ -32712,7 +32985,7 @@ function discoverProjects(rootDir, maxDepth = 2) {
32712
32985
  for (const entry of entries) {
32713
32986
  if (!entry.isDirectory()) continue;
32714
32987
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
32715
- scan(path48.join(dir, entry.name), depth + 1);
32988
+ scan(path49.join(dir, entry.name), depth + 1);
32716
32989
  }
32717
32990
  } catch {
32718
32991
  }
@@ -33611,7 +33884,7 @@ function extractResponseItemContent(content) {
33611
33884
  }
33612
33885
  return parts.length > 0 ? parts.join("") : void 0;
33613
33886
  }
33614
- var DEFAULT_SESSIONS_DIR = () => path49.join(homedir3(), ".codex", "sessions");
33887
+ var DEFAULT_SESSIONS_DIR = () => path50.join(homedir3(), ".codex", "sessions");
33615
33888
  async function discoverCodexSessions(opts) {
33616
33889
  const sessionsDir = opts?.sessionsDir ?? DEFAULT_SESSIONS_DIR();
33617
33890
  const limit = opts?.latest ? 1 : opts?.limit ?? 10;
@@ -33623,7 +33896,7 @@ async function discoverCodexSessions(opts) {
33623
33896
  return [];
33624
33897
  }
33625
33898
  for (const year of yearDirs) {
33626
- const yearPath = path49.join(sessionsDir, year);
33899
+ const yearPath = path50.join(sessionsDir, year);
33627
33900
  let monthDirs;
33628
33901
  try {
33629
33902
  monthDirs = await readdir8(yearPath);
@@ -33631,7 +33904,7 @@ async function discoverCodexSessions(opts) {
33631
33904
  continue;
33632
33905
  }
33633
33906
  for (const month of monthDirs) {
33634
- const monthPath = path49.join(yearPath, month);
33907
+ const monthPath = path50.join(yearPath, month);
33635
33908
  let dayDirs;
33636
33909
  try {
33637
33910
  dayDirs = await readdir8(monthPath);
@@ -33643,7 +33916,7 @@ async function discoverCodexSessions(opts) {
33643
33916
  const dirDate = `${year}-${month}-${day}`;
33644
33917
  if (dirDate !== opts.date) continue;
33645
33918
  }
33646
- const dayPath = path49.join(monthPath, day);
33919
+ const dayPath = path50.join(monthPath, day);
33647
33920
  let files;
33648
33921
  try {
33649
33922
  files = await readdir8(dayPath);
@@ -33652,7 +33925,7 @@ async function discoverCodexSessions(opts) {
33652
33925
  }
33653
33926
  for (const file of files) {
33654
33927
  if (!file.startsWith("rollout-") || !file.endsWith(".jsonl")) continue;
33655
- const filePath = path49.join(dayPath, file);
33928
+ const filePath = path50.join(dayPath, file);
33656
33929
  const nameWithoutExt = file.replace(/\.jsonl$/, "");
33657
33930
  const parts = nameWithoutExt.split("-");
33658
33931
  const sessionId = parts.length >= 6 ? parts.slice(-5).join("-") : nameWithoutExt;
@@ -33671,7 +33944,7 @@ async function discoverCodexSessions(opts) {
33671
33944
  sessions.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
33672
33945
  return sessions.slice(0, limit);
33673
33946
  }
33674
- var DEFAULT_PROJECTS_DIR = () => path50.join(homedir4(), ".claude", "projects");
33947
+ var DEFAULT_PROJECTS_DIR = () => path51.join(homedir4(), ".claude", "projects");
33675
33948
  function encodeProjectPath(projectPath) {
33676
33949
  return projectPath.replace(/\//g, "-");
33677
33950
  }
@@ -33690,7 +33963,7 @@ async function discoverClaudeSessions(opts) {
33690
33963
  }
33691
33964
  const sessions = [];
33692
33965
  for (const projectDir of projectDirs) {
33693
- const dirPath = path50.join(projectsDir, projectDir);
33966
+ const dirPath = path51.join(projectsDir, projectDir);
33694
33967
  let entries;
33695
33968
  try {
33696
33969
  entries = await readdir9(dirPath);
@@ -33701,7 +33974,7 @@ async function discoverClaudeSessions(opts) {
33701
33974
  if (!entry.endsWith(".jsonl")) continue;
33702
33975
  const sessionId = entry.replace(/\.jsonl$/, "");
33703
33976
  if (opts?.sessionId && sessionId !== opts.sessionId) continue;
33704
- const filePath = path50.join(dirPath, entry);
33977
+ const filePath = path51.join(dirPath, entry);
33705
33978
  let updatedAt;
33706
33979
  try {
33707
33980
  const fileStat = await stat10(filePath);
@@ -33745,11 +34018,11 @@ function toTranscriptJsonLine(entry) {
33745
34018
  };
33746
34019
  }
33747
34020
  async function readTranscriptJsonl(filePath) {
33748
- const text2 = await readFile15(filePath, "utf8");
34021
+ const text2 = await readFile16(filePath, "utf8");
33749
34022
  return text2.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
33750
34023
  }
33751
34024
  async function readTranscriptFile(filePath) {
33752
- return readFile15(filePath, "utf8");
34025
+ return readFile16(filePath, "utf8");
33753
34026
  }
33754
34027
  var TranscriptProvider = class _TranscriptProvider {
33755
34028
  id;
@@ -33981,4 +34254,4 @@ export {
33981
34254
  TranscriptProvider,
33982
34255
  createAgentKernel
33983
34256
  };
33984
- //# sourceMappingURL=chunk-RHAXSXIY.js.map
34257
+ //# sourceMappingURL=chunk-SE73HJZG.js.map