agentv 3.13.3 → 3.14.2

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-ZB3AUPES.js
304
+ // ../../packages/core/dist/chunk-HP5PFOVK.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-ZB3AUPES.js
422
+ // ../../packages/core/dist/chunk-HP5PFOVK.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";
@@ -926,6 +926,15 @@ function resolveTargetDefinition(definition, env = process.env, evalFilePath) {
926
926
  providerBatching,
927
927
  config: resolveCopilotCliConfig(parsed, env, evalFilePath)
928
928
  };
929
+ case "copilot-log":
930
+ return {
931
+ kind: "copilot-log",
932
+ name: parsed.name,
933
+ graderTarget: parsed.grader_target ?? parsed.judge_target,
934
+ workers: parsed.workers,
935
+ providerBatching,
936
+ config: resolveCopilotLogConfig(parsed, env)
937
+ };
929
938
  case "pi":
930
939
  case "pi-coding-agent":
931
940
  return {
@@ -1644,8 +1653,8 @@ function resolveCliConfig(target, env, evalFilePath) {
1644
1653
  const parseResult = CliTargetInputSchema.safeParse(target, { errorMap: cliErrorMap });
1645
1654
  if (!parseResult.success) {
1646
1655
  const firstError = parseResult.error.errors[0];
1647
- const path45 = firstError?.path.join(".") || "";
1648
- const prefix = path45 ? `${target.name} ${path45}: ` : `${target.name}: `;
1656
+ const path47 = firstError?.path.join(".") || "";
1657
+ const prefix = path47 ? `${target.name} ${path47}: ` : `${target.name}: `;
1649
1658
  throw new Error(`${prefix}${firstError?.message}`);
1650
1659
  }
1651
1660
  const normalized = normalizeCliTargetInput(parseResult.data, env, evalFilePath);
@@ -1718,6 +1727,43 @@ function resolveString(source, env, description, allowLiteral = false) {
1718
1727
  }
1719
1728
  return value;
1720
1729
  }
1730
+ function resolveDiscover(value, targetName) {
1731
+ if (value === void 0 || value === null) return void 0;
1732
+ if (value === "latest") return "latest";
1733
+ throw new Error(`Target "${targetName}": discover must be "latest" (got "${String(value)}")`);
1734
+ }
1735
+ function resolveCopilotLogConfig(target, env) {
1736
+ const sessionDirSource = target.session_dir ?? target.sessionDir;
1737
+ const sessionIdSource = target.session_id ?? target.sessionId;
1738
+ const discoverSource = target.discover;
1739
+ const sessionStateDirSource = target.session_state_dir ?? target.sessionStateDir;
1740
+ const cwdSource = target.cwd;
1741
+ return {
1742
+ sessionDir: resolveOptionalString(
1743
+ sessionDirSource,
1744
+ env,
1745
+ `${target.name} copilot-log session_dir`,
1746
+ { allowLiteral: true, optionalEnv: true }
1747
+ ),
1748
+ sessionId: resolveOptionalString(
1749
+ sessionIdSource,
1750
+ env,
1751
+ `${target.name} copilot-log session_id`,
1752
+ { allowLiteral: true, optionalEnv: true }
1753
+ ),
1754
+ discover: resolveDiscover(discoverSource, target.name),
1755
+ sessionStateDir: resolveOptionalString(
1756
+ sessionStateDirSource,
1757
+ env,
1758
+ `${target.name} copilot-log session_state_dir`,
1759
+ { allowLiteral: true, optionalEnv: true }
1760
+ ),
1761
+ cwd: resolveOptionalString(cwdSource, env, `${target.name} copilot-log cwd`, {
1762
+ allowLiteral: true,
1763
+ optionalEnv: true
1764
+ })
1765
+ };
1766
+ }
1721
1767
  function resolveOptionalString(source, env, description, options) {
1722
1768
  if (source === void 0 || source === null) {
1723
1769
  return void 0;
@@ -2001,6 +2047,7 @@ var KNOWN_PROVIDERS = [
2001
2047
  "codex",
2002
2048
  "copilot-sdk",
2003
2049
  "copilot-cli",
2050
+ "copilot-log",
2004
2051
  "pi-coding-agent",
2005
2052
  "pi-cli",
2006
2053
  "claude",
@@ -6687,7 +6734,7 @@ function createOpenRouter(options = {}) {
6687
6734
  );
6688
6735
  const createChatModel = (modelId, settings = {}) => new OpenRouterChatLanguageModel(modelId, settings, {
6689
6736
  provider: "openrouter.chat",
6690
- url: ({ path: path45 }) => `${baseURL}${path45}`,
6737
+ url: ({ path: path47 }) => `${baseURL}${path47}`,
6691
6738
  headers: getHeaders,
6692
6739
  compatibility,
6693
6740
  fetch: options.fetch,
@@ -6695,7 +6742,7 @@ function createOpenRouter(options = {}) {
6695
6742
  });
6696
6743
  const createCompletionModel = (modelId, settings = {}) => new OpenRouterCompletionLanguageModel(modelId, settings, {
6697
6744
  provider: "openrouter.completion",
6698
- url: ({ path: path45 }) => `${baseURL}${path45}`,
6745
+ url: ({ path: path47 }) => `${baseURL}${path47}`,
6699
6746
  headers: getHeaders,
6700
6747
  compatibility,
6701
6748
  fetch: options.fetch,
@@ -6703,14 +6750,14 @@ function createOpenRouter(options = {}) {
6703
6750
  });
6704
6751
  const createEmbeddingModel = (modelId, settings = {}) => new OpenRouterEmbeddingModel(modelId, settings, {
6705
6752
  provider: "openrouter.embedding",
6706
- url: ({ path: path45 }) => `${baseURL}${path45}`,
6753
+ url: ({ path: path47 }) => `${baseURL}${path47}`,
6707
6754
  headers: getHeaders,
6708
6755
  fetch: options.fetch,
6709
6756
  extraBody: options.extraBody
6710
6757
  });
6711
6758
  const createImageModel = (modelId, settings = {}) => new OpenRouterImageModel(modelId, settings, {
6712
6759
  provider: "openrouter.image",
6713
- url: ({ path: path45 }) => `${baseURL}${path45}`,
6760
+ url: ({ path: path47 }) => `${baseURL}${path47}`,
6714
6761
  headers: getHeaders,
6715
6762
  fetch: options.fetch,
6716
6763
  extraBody: options.extraBody
@@ -14210,52 +14257,60 @@ import { createWriteStream as createWriteStream4, existsSync, readdirSync } from
14210
14257
  import { arch, platform } from "node:os";
14211
14258
  import path14 from "node:path";
14212
14259
  import { fileURLToPath as fileURLToPath2 } from "node:url";
14260
+ import { readFile as readFile8 } from "node:fs/promises";
14261
+ import { homedir as homedir2 } from "node:os";
14262
+ import path17 from "node:path";
14263
+ import { readFile as readFile7, readdir, stat } from "node:fs/promises";
14264
+ import { homedir } from "node:os";
14265
+ import path16 from "node:path";
14266
+ import { parse as parseYaml22 } from "yaml";
14213
14267
  import { randomUUID as randomUUID6 } from "node:crypto";
14214
14268
  import { mkdir as mkdir5 } from "node:fs/promises";
14215
- import path16 from "node:path";
14269
+ import path18 from "node:path";
14216
14270
  import { spawn as spawn3 } from "node:child_process";
14217
14271
  import { randomUUID as randomUUID7 } from "node:crypto";
14218
14272
  import { createWriteStream as createWriteStream5 } from "node:fs";
14219
14273
  import { mkdir as mkdir6, mkdtemp, rm, writeFile } from "node:fs/promises";
14220
14274
  import { tmpdir } from "node:os";
14221
- import path17 from "node:path";
14275
+ import path19 from "node:path";
14222
14276
  import { execSync } from "node:child_process";
14223
14277
  import { randomUUID as randomUUID8 } from "node:crypto";
14224
- import { createWriteStream as createWriteStream6 } from "node:fs";
14278
+ import { accessSync, createWriteStream as createWriteStream6 } from "node:fs";
14225
14279
  import { mkdir as mkdir7 } from "node:fs/promises";
14226
- import path18 from "node:path";
14280
+ import path20 from "node:path";
14227
14281
  import { createInterface } from "node:readline";
14282
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
14228
14283
  import { exec as exec2 } from "node:child_process";
14229
- import { constants as constants3, access as access3, stat as stat4 } from "node:fs/promises";
14230
- import path30 from "node:path";
14284
+ import { constants as constants3, access as access3, stat as stat5 } from "node:fs/promises";
14285
+ import path322 from "node:path";
14231
14286
  import { promisify as promisify3 } from "node:util";
14232
- import { stat as stat3, writeFile as writeFile4 } from "node:fs/promises";
14233
- import path28 from "node:path";
14287
+ import { stat as stat4, writeFile as writeFile4 } from "node:fs/promises";
14288
+ import path30 from "node:path";
14234
14289
  import { constants as constants22 } from "node:fs";
14235
- import { access as access22, mkdir as mkdir8, readdir, rm as rm2, stat } from "node:fs/promises";
14236
- import path19 from "node:path";
14237
- import path20 from "node:path";
14290
+ import { access as access22, mkdir as mkdir8, readdir as readdir2, rm as rm2, stat as stat2 } from "node:fs/promises";
14238
14291
  import path21 from "node:path";
14239
- import { readFile as readFile7 } from "node:fs/promises";
14240
14292
  import path222 from "node:path";
14293
+ import path23 from "node:path";
14294
+ import { readFile as readFile9 } from "node:fs/promises";
14295
+ import path24 from "node:path";
14241
14296
  import { exec, spawn as spawn4 } from "node:child_process";
14242
14297
  import { mkdir as mkdir9, writeFile as writeFile2 } from "node:fs/promises";
14243
- import path25 from "node:path";
14244
- import { promisify as promisify2 } from "node:util";
14245
- import path24 from "node:path";
14246
- import os2 from "node:os";
14247
- import path23 from "node:path";
14248
- import { copyFile, mkdir as mkdir10, readFile as readFile8, readdir as readdir2, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
14249
14298
  import path27 from "node:path";
14299
+ import { promisify as promisify2 } from "node:util";
14250
14300
  import path26 from "node:path";
14301
+ import os2 from "node:os";
14302
+ import path25 from "node:path";
14303
+ import { copyFile, mkdir as mkdir10, readFile as readFile10, readdir as readdir3, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
14304
+ import path29 from "node:path";
14305
+ import path28 from "node:path";
14251
14306
  import JSON5 from "json5";
14252
14307
  import { writeFile as writeFile5 } from "node:fs/promises";
14253
- import path29 from "node:path";
14254
- import { constants as constants4 } from "node:fs";
14255
- import { access as access4, readFile as readFile9 } from "node:fs/promises";
14256
14308
  import path31 from "node:path";
14309
+ import { constants as constants4 } from "node:fs";
14310
+ import { access as access4, readFile as readFile11 } from "node:fs/promises";
14311
+ import path33 from "node:path";
14257
14312
  import { parse as parse4 } from "yaml";
14258
- import path322 from "node:path";
14313
+ import path34 from "node:path";
14259
14314
  import fg2 from "fast-glob";
14260
14315
  import { mkdtemp as mkdtemp2, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
14261
14316
  import { tmpdir as tmpdir2 } from "node:os";
@@ -14263,38 +14318,38 @@ import { dirname, join } from "node:path";
14263
14318
  import { randomBytes } from "node:crypto";
14264
14319
  import { createServer } from "node:http";
14265
14320
  import fs2 from "node:fs/promises";
14266
- import path33 from "node:path";
14321
+ import path35 from "node:path";
14267
14322
  import { createHash as createHash2, randomUUID as randomUUID9 } from "node:crypto";
14268
- import { copyFile as copyFile2, mkdir as mkdir14, readdir as readdir6, stat as stat7 } from "node:fs/promises";
14269
- import path422 from "node:path";
14323
+ import { copyFile as copyFile2, mkdir as mkdir14, readdir as readdir7, stat as stat8 } from "node:fs/promises";
14324
+ import path44 from "node:path";
14270
14325
  import micromatch3 from "micromatch";
14271
- import path34 from "node:path";
14272
- import path35 from "node:path";
14273
- import fg22 from "fast-glob";
14274
14326
  import path36 from "node:path";
14327
+ import path37 from "node:path";
14328
+ import fg22 from "fast-glob";
14329
+ import path38 from "node:path";
14275
14330
  import fg3 from "fast-glob";
14276
14331
  import { exec as execCallback } from "node:child_process";
14277
14332
  import { readdirSync as readdirSync2, statSync } from "node:fs";
14278
- import path37 from "node:path";
14333
+ import path39 from "node:path";
14279
14334
  import { promisify as promisify4 } from "node:util";
14280
- import { cp, mkdir as mkdir12, readdir as readdir3, rm as rm4, stat as stat5 } from "node:fs/promises";
14281
- import path38 from "node:path";
14335
+ import { cp, mkdir as mkdir12, readdir as readdir4, rm as rm4, stat as stat6 } from "node:fs/promises";
14336
+ import path40 from "node:path";
14282
14337
  import { execFile } from "node:child_process";
14283
14338
  import { createHash } from "node:crypto";
14284
14339
  import { existsSync as existsSync2 } from "node:fs";
14285
- import { cp as cp2, mkdir as mkdir13, readFile as readFile10, readdir as readdir4, rm as rm5, unlink, writeFile as writeFile7 } from "node:fs/promises";
14286
- import path39 from "node:path";
14340
+ import { cp as cp2, mkdir as mkdir13, readFile as readFile12, readdir as readdir5, rm as rm5, unlink, writeFile as writeFile7 } from "node:fs/promises";
14341
+ import path41 from "node:path";
14287
14342
  import { promisify as promisify5 } from "node:util";
14288
14343
  import { execFile as execFile2 } from "node:child_process";
14289
14344
  import { existsSync as existsSync3 } from "node:fs";
14290
- import path40 from "node:path";
14345
+ import path422 from "node:path";
14291
14346
  import { promisify as promisify6 } from "node:util";
14292
- import { readdir as readdir5, stat as stat6 } from "node:fs/promises";
14293
- import path41 from "node:path";
14294
- import { existsSync as existsSync4 } from "node:fs";
14347
+ import { readdir as readdir6, stat as stat7 } from "node:fs/promises";
14295
14348
  import path43 from "node:path";
14296
- import { mkdir as mkdir15, readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
14297
- import path44 from "node:path";
14349
+ import { existsSync as existsSync4 } from "node:fs";
14350
+ import path45 from "node:path";
14351
+ import { mkdir as mkdir15, readFile as readFile13, writeFile as writeFile8 } from "node:fs/promises";
14352
+ import path46 from "node:path";
14298
14353
  function computeTraceSummary(messages) {
14299
14354
  const toolCallCounts = {};
14300
14355
  const toolDurations = {};
@@ -17160,22 +17215,31 @@ async function loadTestById(evalFilePath, repoRoot, evalId) {
17160
17215
  return match;
17161
17216
  }
17162
17217
  var loadEvalCaseById = loadTestById;
17218
+ function parseCommandArray(source) {
17219
+ if (typeof source === "string") {
17220
+ const parts = source.trim().split(/\s+/);
17221
+ return parts.length > 0 && parts[0] !== "" ? parts : void 0;
17222
+ }
17223
+ if (Array.isArray(source)) {
17224
+ const arr = source.filter((s) => typeof s === "string");
17225
+ return arr.length > 0 ? arr : void 0;
17226
+ }
17227
+ return void 0;
17228
+ }
17163
17229
  function parseWorkspaceScriptConfig(raw, evalFileDir) {
17164
17230
  if (!isJsonObject(raw)) return void 0;
17165
17231
  const obj = raw;
17166
17232
  if (obj.script !== void 0 && obj.command === void 0) {
17167
17233
  logWarning5("'script' is deprecated. Use 'command' instead.");
17168
17234
  }
17169
- const commandSource = obj.command ?? obj.script;
17170
- if (!Array.isArray(commandSource) || commandSource.length === 0) return void 0;
17171
- const commandArr = commandSource.filter((s) => typeof s === "string");
17172
- if (commandArr.length === 0) return void 0;
17235
+ const command = parseCommandArray(obj.command ?? obj.script);
17236
+ if (!command) return void 0;
17173
17237
  const timeoutMs = typeof obj.timeout_ms === "number" ? obj.timeout_ms : void 0;
17174
17238
  let cwd = typeof obj.cwd === "string" ? obj.cwd : void 0;
17175
17239
  if (cwd && !path7.isAbsolute(cwd)) {
17176
17240
  cwd = path7.resolve(evalFileDir, cwd);
17177
17241
  }
17178
- const config = { command: commandArr };
17242
+ const config = { command };
17179
17243
  if (timeoutMs !== void 0) {
17180
17244
  return { ...config, timeout_ms: timeoutMs, ...cwd !== void 0 && { cwd } };
17181
17245
  }
@@ -20541,6 +20605,249 @@ function summarizeAcpEvent(eventType, data) {
20541
20605
  return void 0;
20542
20606
  }
20543
20607
  }
20608
+ function parseCopilotEvents(eventsJsonl) {
20609
+ const messages = [];
20610
+ const meta = { sessionId: "", model: "", cwd: "" };
20611
+ let totalInputTokens = 0;
20612
+ let totalOutputTokens = 0;
20613
+ let hasUsage = false;
20614
+ let startTimestamp;
20615
+ let endTimestamp;
20616
+ const toolCallsInProgress = /* @__PURE__ */ new Map();
20617
+ const lines = eventsJsonl.split("\n").filter((l) => l.trim().length > 0);
20618
+ for (const line of lines) {
20619
+ let event;
20620
+ try {
20621
+ event = JSON.parse(line);
20622
+ } catch {
20623
+ continue;
20624
+ }
20625
+ const eventType = event.type;
20626
+ if (!eventType) continue;
20627
+ const data = event.data ?? {};
20628
+ switch (eventType) {
20629
+ case "session.start": {
20630
+ meta.sessionId = String(data.sessionId ?? "");
20631
+ const ctx = data.context;
20632
+ meta.cwd = String(ctx?.cwd ?? "");
20633
+ meta.repository = ctx?.repository ? String(ctx.repository) : void 0;
20634
+ meta.branch = ctx?.branch ? String(ctx.branch) : void 0;
20635
+ const ts = event.timestamp ?? data.startTime;
20636
+ meta.startedAt = ts ? String(ts) : void 0;
20637
+ startTimestamp = ts ? String(ts) : void 0;
20638
+ break;
20639
+ }
20640
+ case "user.message": {
20641
+ messages.push({
20642
+ role: "user",
20643
+ content: data.content != null ? String(data.content) : ""
20644
+ });
20645
+ break;
20646
+ }
20647
+ case "assistant.message": {
20648
+ const toolRequests = data.toolRequests;
20649
+ const toolCalls = (toolRequests ?? []).map((req) => ({
20650
+ tool: String(req.name ?? req.toolName ?? ""),
20651
+ input: req.arguments,
20652
+ id: req.toolCallId ? String(req.toolCallId) : void 0
20653
+ }));
20654
+ messages.push({
20655
+ role: "assistant",
20656
+ content: data.content != null ? String(data.content) : void 0,
20657
+ toolCalls: toolCalls.length > 0 ? toolCalls : void 0
20658
+ });
20659
+ break;
20660
+ }
20661
+ case "skill.invoked": {
20662
+ const skillName = String(data.name ?? "");
20663
+ messages.push({
20664
+ role: "assistant",
20665
+ toolCalls: [
20666
+ {
20667
+ tool: "Skill",
20668
+ input: { skill: skillName }
20669
+ }
20670
+ ]
20671
+ });
20672
+ break;
20673
+ }
20674
+ case "tool.execution_start": {
20675
+ const toolCallId = String(data.toolCallId ?? "");
20676
+ if (toolCallId) {
20677
+ toolCallsInProgress.set(toolCallId, {
20678
+ toolName: String(data.toolName ?? ""),
20679
+ input: data.arguments,
20680
+ toolCallId
20681
+ });
20682
+ }
20683
+ break;
20684
+ }
20685
+ case "tool.execution_complete": {
20686
+ const toolCallId = String(data.toolCallId ?? "");
20687
+ const started = toolCallsInProgress.get(toolCallId);
20688
+ if (started) {
20689
+ toolCallsInProgress.delete(toolCallId);
20690
+ messages.push({
20691
+ role: "assistant",
20692
+ toolCalls: [
20693
+ {
20694
+ tool: started.toolName,
20695
+ input: started.input,
20696
+ output: data.result,
20697
+ id: toolCallId
20698
+ }
20699
+ ]
20700
+ });
20701
+ }
20702
+ break;
20703
+ }
20704
+ case "session.shutdown": {
20705
+ endTimestamp = event.timestamp ? String(event.timestamp) : void 0;
20706
+ const modelMetrics = data.modelMetrics;
20707
+ if (modelMetrics) {
20708
+ for (const metrics of Object.values(modelMetrics)) {
20709
+ if (metrics.usage) {
20710
+ hasUsage = true;
20711
+ totalInputTokens += Number(metrics.usage.inputTokens ?? 0);
20712
+ totalOutputTokens += Number(metrics.usage.outputTokens ?? 0);
20713
+ }
20714
+ }
20715
+ }
20716
+ const currentModel = data.currentModel;
20717
+ if (currentModel && !meta.model) {
20718
+ meta.model = String(currentModel);
20719
+ }
20720
+ break;
20721
+ }
20722
+ }
20723
+ }
20724
+ let durationMs;
20725
+ if (startTimestamp && endTimestamp) {
20726
+ durationMs = new Date(endTimestamp).getTime() - new Date(startTimestamp).getTime();
20727
+ }
20728
+ return {
20729
+ messages,
20730
+ meta,
20731
+ tokenUsage: hasUsage ? { input: totalInputTokens, output: totalOutputTokens } : void 0,
20732
+ durationMs
20733
+ };
20734
+ }
20735
+ var DEFAULT_SESSION_STATE_DIR = () => path16.join(homedir(), ".copilot", "session-state");
20736
+ async function discoverCopilotSessions(opts) {
20737
+ const sessionStateDir = opts?.sessionStateDir ?? DEFAULT_SESSION_STATE_DIR();
20738
+ const limit = opts?.limit ?? 10;
20739
+ let entries;
20740
+ try {
20741
+ entries = await readdir(sessionStateDir);
20742
+ } catch {
20743
+ return [];
20744
+ }
20745
+ const sessions = [];
20746
+ for (const entry of entries) {
20747
+ const sessionDir = path16.join(sessionStateDir, entry);
20748
+ const workspacePath = path16.join(sessionDir, "workspace.yaml");
20749
+ const eventsPath = path16.join(sessionDir, "events.jsonl");
20750
+ try {
20751
+ const workspaceContent = await readFile7(workspacePath, "utf8");
20752
+ const workspace = parseYaml22(workspaceContent) ?? {};
20753
+ const cwd = String(workspace.cwd ?? "");
20754
+ let updatedAt;
20755
+ try {
20756
+ const eventsStat = await stat(eventsPath);
20757
+ updatedAt = eventsStat.mtime;
20758
+ } catch {
20759
+ updatedAt = /* @__PURE__ */ new Date(0);
20760
+ }
20761
+ let isActive = true;
20762
+ try {
20763
+ const fd = await import("node:fs/promises").then((fs3) => fs3.open(eventsPath, "r"));
20764
+ try {
20765
+ const fstat = await fd.stat();
20766
+ const tailSize = Math.min(fstat.size, 4096);
20767
+ const buf = Buffer.alloc(tailSize);
20768
+ await fd.read(buf, 0, tailSize, Math.max(0, fstat.size - tailSize));
20769
+ isActive = !buf.toString("utf8").includes('"session.shutdown"');
20770
+ } finally {
20771
+ await fd.close();
20772
+ }
20773
+ } catch {
20774
+ }
20775
+ sessions.push({
20776
+ sessionId: entry,
20777
+ sessionDir,
20778
+ cwd,
20779
+ repository: workspace.repository ? String(workspace.repository) : void 0,
20780
+ updatedAt,
20781
+ isActive
20782
+ });
20783
+ } catch {
20784
+ }
20785
+ }
20786
+ let filtered = sessions;
20787
+ if (opts?.cwd) {
20788
+ filtered = filtered.filter((s) => s.cwd === opts.cwd);
20789
+ }
20790
+ if (opts?.repository) {
20791
+ filtered = filtered.filter((s) => s.repository === opts.repository);
20792
+ }
20793
+ filtered.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
20794
+ return filtered.slice(0, limit);
20795
+ }
20796
+ var CopilotLogProvider = class {
20797
+ id;
20798
+ kind = "copilot-log";
20799
+ targetName;
20800
+ config;
20801
+ constructor(targetName, config) {
20802
+ this.targetName = targetName;
20803
+ this.id = `copilot-log:${targetName}`;
20804
+ this.config = config;
20805
+ }
20806
+ async invoke(_request) {
20807
+ const sessionDir = await this.resolveSessionDir();
20808
+ const eventsPath = path17.join(sessionDir, "events.jsonl");
20809
+ let eventsContent;
20810
+ try {
20811
+ eventsContent = await readFile8(eventsPath, "utf8");
20812
+ } catch (err) {
20813
+ throw new Error(
20814
+ `Failed to read Copilot session transcript at ${eventsPath}: ${err instanceof Error ? err.message : String(err)}`
20815
+ );
20816
+ }
20817
+ const parsed = parseCopilotEvents(eventsContent);
20818
+ return {
20819
+ output: parsed.messages,
20820
+ tokenUsage: parsed.tokenUsage,
20821
+ durationMs: parsed.durationMs,
20822
+ startTime: parsed.meta.startedAt
20823
+ };
20824
+ }
20825
+ async resolveSessionDir() {
20826
+ if (this.config.sessionDir) {
20827
+ return this.config.sessionDir;
20828
+ }
20829
+ if (this.config.sessionId) {
20830
+ const stateDir = this.config.sessionStateDir ?? path17.join(homedir2(), ".copilot", "session-state");
20831
+ return path17.join(stateDir, this.config.sessionId);
20832
+ }
20833
+ if (this.config.discover === "latest") {
20834
+ const sessions = await discoverCopilotSessions({
20835
+ sessionStateDir: this.config.sessionStateDir,
20836
+ cwd: this.config.cwd,
20837
+ limit: 1
20838
+ });
20839
+ if (sessions.length === 0) {
20840
+ throw new Error(
20841
+ `No Copilot CLI sessions found${this.config.cwd ? ` for cwd=${this.config.cwd}` : ""}. Check that sessions exist in ${this.config.sessionStateDir ?? "~/.copilot/session-state/"}`
20842
+ );
20843
+ }
20844
+ return sessions[0].sessionDir;
20845
+ }
20846
+ throw new Error(
20847
+ 'CopilotLogProvider requires one of: sessionDir, sessionId, or discover="latest"'
20848
+ );
20849
+ }
20850
+ };
20544
20851
  var GLOBAL_LOGS_KEY4 = Symbol.for("agentv.copilotSdkLogs");
20545
20852
  var GLOBAL_SUBSCRIBERS_KEY4 = Symbol.for("agentv.copilotSdkLogSubscribers");
20546
20853
  function getCopilotSdkLogStore() {
@@ -20826,10 +21133,10 @@ var CopilotSdkProvider = class {
20826
21133
  }
20827
21134
  resolveCwd(cwdOverride) {
20828
21135
  if (cwdOverride) {
20829
- return path16.resolve(cwdOverride);
21136
+ return path18.resolve(cwdOverride);
20830
21137
  }
20831
21138
  if (this.config.cwd) {
20832
- return path16.resolve(this.config.cwd);
21139
+ return path18.resolve(this.config.cwd);
20833
21140
  }
20834
21141
  return void 0;
20835
21142
  }
@@ -20838,9 +21145,9 @@ var CopilotSdkProvider = class {
20838
21145
  return void 0;
20839
21146
  }
20840
21147
  if (this.config.logDir) {
20841
- return path16.resolve(this.config.logDir);
21148
+ return path18.resolve(this.config.logDir);
20842
21149
  }
20843
- return path16.join(process.cwd(), ".agentv", "logs", "copilot-sdk");
21150
+ return path18.join(process.cwd(), ".agentv", "logs", "copilot-sdk");
20844
21151
  }
20845
21152
  async createStreamLogger(request) {
20846
21153
  const logDir = this.resolveLogDirectory();
@@ -20854,7 +21161,7 @@ var CopilotSdkProvider = class {
20854
21161
  console.warn(`Skipping Copilot SDK stream logging (could not create ${logDir}): ${message}`);
20855
21162
  return void 0;
20856
21163
  }
20857
- const filePath = path16.join(logDir, buildLogFilename4(request, this.targetName, "copilot-sdk"));
21164
+ const filePath = path18.join(logDir, buildLogFilename4(request, this.targetName, "copilot-sdk"));
20858
21165
  try {
20859
21166
  const logger = await CopilotStreamLogger.create(
20860
21167
  {
@@ -21038,13 +21345,14 @@ var PiCliProvider = class {
21038
21345
  const inputFiles = normalizeInputFiles(request.inputFiles);
21039
21346
  const startTime = (/* @__PURE__ */ new Date()).toISOString();
21040
21347
  const startMs = Date.now();
21041
- const workspaceRoot = await this.createWorkspace();
21348
+ const hasExternalCwd = !!(request.cwd || this.config.cwd);
21349
+ const workspaceRoot = hasExternalCwd ? void 0 : await this.createWorkspace();
21350
+ const cwd = this.resolveCwd(workspaceRoot, request.cwd);
21042
21351
  const logger = await this.createStreamLogger(request).catch(() => void 0);
21043
21352
  try {
21044
- const promptFile = path17.join(workspaceRoot, PROMPT_FILENAME);
21353
+ const promptFile = path19.join(cwd, PROMPT_FILENAME);
21045
21354
  await writeFile(promptFile, request.question, "utf8");
21046
21355
  const args = this.buildPiArgs(request.question, inputFiles);
21047
- const cwd = this.resolveCwd(workspaceRoot, request.cwd);
21048
21356
  const result = await this.executePi(args, cwd, request.signal, logger);
21049
21357
  if (result.timedOut) {
21050
21358
  throw new Error(
@@ -21086,7 +21394,7 @@ var PiCliProvider = class {
21086
21394
  args,
21087
21395
  executable: this.config.executable,
21088
21396
  promptFile,
21089
- workspace: workspaceRoot,
21397
+ workspace: workspaceRoot ?? cwd,
21090
21398
  inputFiles,
21091
21399
  logFile: logger?.filePath
21092
21400
  },
@@ -21098,17 +21406,22 @@ var PiCliProvider = class {
21098
21406
  };
21099
21407
  } finally {
21100
21408
  await logger?.close();
21101
- await this.cleanupWorkspace(workspaceRoot);
21409
+ if (workspaceRoot) {
21410
+ await this.cleanupWorkspace(workspaceRoot);
21411
+ }
21102
21412
  }
21103
21413
  }
21104
21414
  resolveCwd(workspaceRoot, cwdOverride) {
21105
21415
  if (cwdOverride) {
21106
- return path17.resolve(cwdOverride);
21416
+ return path19.resolve(cwdOverride);
21107
21417
  }
21108
- if (!this.config.cwd) {
21418
+ if (this.config.cwd) {
21419
+ return path19.resolve(this.config.cwd);
21420
+ }
21421
+ if (workspaceRoot) {
21109
21422
  return workspaceRoot;
21110
21423
  }
21111
- return path17.resolve(this.config.cwd);
21424
+ return process.cwd();
21112
21425
  }
21113
21426
  buildPiArgs(prompt, inputFiles) {
21114
21427
  const args = [];
@@ -21186,10 +21499,30 @@ ${prompt}` : prompt;
21186
21499
  env[envKey] = this.config.apiKey;
21187
21500
  }
21188
21501
  }
21502
+ if (this.config.subprovider) {
21503
+ const provider = this.config.subprovider.toLowerCase();
21504
+ const PROVIDER_OWN_PREFIXES = {
21505
+ openrouter: ["OPENROUTER_"],
21506
+ anthropic: ["ANTHROPIC_"],
21507
+ openai: ["OPENAI_"],
21508
+ azure: ["AZURE_OPENAI_"],
21509
+ google: ["GEMINI_", "GOOGLE_GENERATIVE_AI_"],
21510
+ gemini: ["GEMINI_", "GOOGLE_GENERATIVE_AI_"],
21511
+ groq: ["GROQ_"],
21512
+ xai: ["XAI_"]
21513
+ };
21514
+ const ownPrefixes = PROVIDER_OWN_PREFIXES[provider] ?? [];
21515
+ const allOtherPrefixes = Object.entries(PROVIDER_OWN_PREFIXES).filter(([key]) => key !== provider).flatMap(([, prefixes]) => prefixes);
21516
+ for (const key of Object.keys(env)) {
21517
+ if (allOtherPrefixes.some((prefix) => key.startsWith(prefix)) && !ownPrefixes.some((prefix) => key.startsWith(prefix))) {
21518
+ delete env[key];
21519
+ }
21520
+ }
21521
+ }
21189
21522
  return env;
21190
21523
  }
21191
21524
  async createWorkspace() {
21192
- return await mkdtemp(path17.join(tmpdir(), WORKSPACE_PREFIX));
21525
+ return await mkdtemp(path19.join(tmpdir(), WORKSPACE_PREFIX));
21193
21526
  }
21194
21527
  async cleanupWorkspace(workspaceRoot) {
21195
21528
  try {
@@ -21199,9 +21532,9 @@ ${prompt}` : prompt;
21199
21532
  }
21200
21533
  resolveLogDirectory() {
21201
21534
  if (this.config.logDir) {
21202
- return path17.resolve(this.config.logDir);
21535
+ return path19.resolve(this.config.logDir);
21203
21536
  }
21204
- return path17.join(process.cwd(), ".agentv", "logs", "pi-cli");
21537
+ return path19.join(process.cwd(), ".agentv", "logs", "pi-cli");
21205
21538
  }
21206
21539
  async createStreamLogger(request) {
21207
21540
  const logDir = this.resolveLogDirectory();
@@ -21215,7 +21548,7 @@ ${prompt}` : prompt;
21215
21548
  console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
21216
21549
  return void 0;
21217
21550
  }
21218
- const filePath = path17.join(logDir, buildLogFilename5(request, this.targetName));
21551
+ const filePath = path19.join(logDir, buildLogFilename5(request, this.targetName));
21219
21552
  try {
21220
21553
  const logger = await PiStreamLogger.create({
21221
21554
  filePath,
@@ -21413,6 +21746,10 @@ function summarizePiEvent(event) {
21413
21746
  }
21414
21747
  return `message_update: ${eventType}`;
21415
21748
  }
21749
+ case "tool_execution_start":
21750
+ return `tool_start: ${record.toolName}`;
21751
+ case "tool_execution_end":
21752
+ return `tool_end: ${record.toolName}`;
21416
21753
  default:
21417
21754
  return type;
21418
21755
  }
@@ -21443,25 +21780,89 @@ function parsePiJsonl(output) {
21443
21780
  return parsed;
21444
21781
  }
21445
21782
  function extractMessages(events) {
21783
+ let messages;
21446
21784
  for (let i = events.length - 1; i >= 0; i--) {
21447
21785
  const event = events[i];
21448
21786
  if (!event || typeof event !== "object") continue;
21449
21787
  const record = event;
21450
21788
  if (record.type !== "agent_end") continue;
21451
- const messages = record.messages;
21452
- if (!Array.isArray(messages)) continue;
21453
- return messages.map(convertPiMessage).filter((m) => m !== void 0);
21789
+ const msgs = record.messages;
21790
+ if (!Array.isArray(msgs)) continue;
21791
+ messages = msgs.map(convertPiMessage).filter((m) => m !== void 0);
21792
+ break;
21793
+ }
21794
+ if (!messages) {
21795
+ messages = [];
21796
+ for (const event of events) {
21797
+ if (!event || typeof event !== "object") continue;
21798
+ const record = event;
21799
+ if (record.type === "turn_end") {
21800
+ const converted = convertPiMessage(record.message);
21801
+ if (converted) messages.push(converted);
21802
+ }
21803
+ }
21804
+ }
21805
+ const eventToolCalls = extractToolCallsFromEvents(events);
21806
+ if (eventToolCalls.length > 0) {
21807
+ injectEventToolCalls(messages, eventToolCalls);
21454
21808
  }
21455
- const output = [];
21809
+ return messages;
21810
+ }
21811
+ function extractToolCallsFromEvents(events) {
21812
+ const starts = /* @__PURE__ */ new Map();
21813
+ const results = /* @__PURE__ */ new Map();
21456
21814
  for (const event of events) {
21457
21815
  if (!event || typeof event !== "object") continue;
21458
- const record = event;
21459
- if (record.type === "turn_end") {
21460
- const converted = convertPiMessage(record.message);
21461
- if (converted) output.push(converted);
21816
+ const r = event;
21817
+ const type = r.type;
21818
+ if (type === "tool_execution_start" && typeof r.toolName === "string") {
21819
+ const id = typeof r.toolCallId === "string" ? r.toolCallId : void 0;
21820
+ starts.set(id ?? `anon-${starts.size}`, { tool: r.toolName, input: r.args });
21821
+ } else if (type === "tool_execution_end") {
21822
+ const id = typeof r.toolCallId === "string" ? r.toolCallId : void 0;
21823
+ if (id) results.set(id, r.result);
21462
21824
  }
21463
21825
  }
21464
- return output;
21826
+ const toolCalls = [];
21827
+ for (const [id, { tool: tool2, input }] of starts) {
21828
+ toolCalls.push({
21829
+ tool: tool2,
21830
+ input,
21831
+ id: id.startsWith("anon-") ? void 0 : id,
21832
+ output: results.get(id)
21833
+ });
21834
+ }
21835
+ return toolCalls;
21836
+ }
21837
+ function injectEventToolCalls(messages, eventToolCalls) {
21838
+ const existingIds = /* @__PURE__ */ new Set();
21839
+ const existingTools = /* @__PURE__ */ new Set();
21840
+ for (const msg of messages) {
21841
+ if (!msg.toolCalls) continue;
21842
+ for (const tc of msg.toolCalls) {
21843
+ if (tc.id) existingIds.add(tc.id);
21844
+ existingTools.add(`${tc.tool}:${JSON.stringify(tc.input)}`);
21845
+ }
21846
+ }
21847
+ const missing = eventToolCalls.filter((tc) => {
21848
+ if (tc.id && existingIds.has(tc.id)) return false;
21849
+ if (existingTools.has(`${tc.tool}:${JSON.stringify(tc.input)}`)) return false;
21850
+ return true;
21851
+ });
21852
+ if (missing.length === 0) return;
21853
+ let targetIdx = -1;
21854
+ for (let i = messages.length - 1; i >= 0; i--) {
21855
+ if (messages[i].role === "assistant") {
21856
+ targetIdx = i;
21857
+ break;
21858
+ }
21859
+ }
21860
+ if (targetIdx >= 0) {
21861
+ const target = messages[targetIdx];
21862
+ messages[targetIdx] = { ...target, toolCalls: [...target.toolCalls ?? [], ...missing] };
21863
+ } else {
21864
+ messages.push({ role: "assistant", content: "", toolCalls: missing });
21865
+ }
21465
21866
  }
21466
21867
  function extractTokenUsage(events) {
21467
21868
  for (let i = events.length - 1; i >= 0; i--) {
@@ -21556,15 +21957,13 @@ function extractToolCalls3(content) {
21556
21957
  input: p.input,
21557
21958
  id: typeof p.id === "string" ? p.id : void 0
21558
21959
  });
21559
- }
21560
- if (p.type === "toolCall" && typeof p.name === "string") {
21960
+ } else if ((p.type === "toolCall" || p.type === "tool_call") && typeof p.name === "string") {
21561
21961
  toolCalls.push({
21562
21962
  tool: p.name,
21563
- input: p.arguments,
21963
+ input: p.arguments ?? p.input,
21564
21964
  id: typeof p.id === "string" ? p.id : void 0
21565
21965
  });
21566
- }
21567
- if (p.type === "tool_result" && typeof p.tool_use_id === "string") {
21966
+ } else if (p.type === "tool_result" && typeof p.tool_use_id === "string") {
21568
21967
  const existing = toolCalls.find((tc) => tc.id === p.tool_use_id);
21569
21968
  if (existing) {
21570
21969
  const idx = toolCalls.indexOf(existing);
@@ -21652,9 +22051,10 @@ async function defaultPiRunner(options) {
21652
22051
  }
21653
22052
  var piCodingAgentModule = null;
21654
22053
  var piAiModule = null;
22054
+ var loadingPromise = null;
21655
22055
  async function promptInstall() {
21656
22056
  if (!process.stdout.isTTY) return false;
21657
- const rl = createInterface({ input: process.stdin, output: process.stderr });
22057
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
21658
22058
  try {
21659
22059
  return await new Promise((resolve2) => {
21660
22060
  rl.question(
@@ -21666,43 +22066,74 @@ async function promptInstall() {
21666
22066
  rl.close();
21667
22067
  }
21668
22068
  }
21669
- async function loadSdkModules() {
21670
- if (!piCodingAgentModule || !piAiModule) {
22069
+ function findAgentvRoot() {
22070
+ const thisFile = fileURLToPath3(import.meta.url);
22071
+ let dir = path20.dirname(thisFile);
22072
+ for (let i = 0; i < 10; i++) {
21671
22073
  try {
22074
+ const pkg = path20.join(dir, "package.json");
22075
+ accessSync(pkg);
22076
+ return dir;
22077
+ } catch {
22078
+ const parent = path20.dirname(dir);
22079
+ if (parent === dir) break;
22080
+ dir = parent;
22081
+ }
22082
+ }
22083
+ return path20.dirname(thisFile);
22084
+ }
22085
+ async function doLoadSdkModules() {
22086
+ try {
22087
+ [piCodingAgentModule, piAiModule] = await Promise.all([
22088
+ import("@mariozechner/pi-coding-agent"),
22089
+ import("@mariozechner/pi-ai")
22090
+ ]);
22091
+ } catch {
22092
+ if (await promptInstall()) {
22093
+ const installDir = findAgentvRoot();
22094
+ console.error(`Installing @mariozechner/pi-coding-agent into ${installDir}...`);
22095
+ execSync("bun add @mariozechner/pi-coding-agent", {
22096
+ cwd: installDir,
22097
+ stdio: "inherit"
22098
+ });
21672
22099
  [piCodingAgentModule, piAiModule] = await Promise.all([
21673
22100
  import("@mariozechner/pi-coding-agent"),
21674
22101
  import("@mariozechner/pi-ai")
21675
22102
  ]);
21676
- } catch {
21677
- if (await promptInstall()) {
21678
- console.error("Installing @mariozechner/pi-coding-agent...");
21679
- execSync("bun add @mariozechner/pi-coding-agent", { stdio: "inherit" });
21680
- [piCodingAgentModule, piAiModule] = await Promise.all([
21681
- import("@mariozechner/pi-coding-agent"),
21682
- import("@mariozechner/pi-ai")
21683
- ]);
21684
- } else {
21685
- throw new Error(
21686
- "pi-coding-agent SDK is not installed. Install it with:\n bun add @mariozechner/pi-coding-agent"
21687
- );
21688
- }
22103
+ } else {
22104
+ throw new Error(
22105
+ "pi-coding-agent SDK is not installed. Install it with:\n bun add @mariozechner/pi-coding-agent"
22106
+ );
21689
22107
  }
21690
22108
  }
22109
+ }
22110
+ async function loadSdkModules() {
22111
+ if (!piCodingAgentModule || !piAiModule) {
22112
+ if (!loadingPromise) {
22113
+ loadingPromise = doLoadSdkModules().catch((err) => {
22114
+ loadingPromise = null;
22115
+ throw err;
22116
+ });
22117
+ }
22118
+ await loadingPromise;
22119
+ }
22120
+ const piSdk = piCodingAgentModule;
22121
+ const piAi = piAiModule;
21691
22122
  const toolMap = {
21692
- read: piCodingAgentModule.readTool,
21693
- bash: piCodingAgentModule.bashTool,
21694
- edit: piCodingAgentModule.editTool,
21695
- write: piCodingAgentModule.writeTool,
21696
- grep: piCodingAgentModule.grepTool,
21697
- find: piCodingAgentModule.findTool,
21698
- ls: piCodingAgentModule.lsTool
22123
+ read: piSdk.readTool,
22124
+ bash: piSdk.bashTool,
22125
+ edit: piSdk.editTool,
22126
+ write: piSdk.writeTool,
22127
+ grep: piSdk.grepTool,
22128
+ find: piSdk.findTool,
22129
+ ls: piSdk.lsTool
21699
22130
  };
21700
22131
  return {
21701
- createAgentSession: piCodingAgentModule.createAgentSession,
21702
- codingTools: piCodingAgentModule.codingTools,
22132
+ createAgentSession: piSdk.createAgentSession,
22133
+ codingTools: piSdk.codingTools,
21703
22134
  toolMap,
21704
- SessionManager: piCodingAgentModule.SessionManager,
21705
- getModel: piAiModule.getModel
22135
+ SessionManager: piSdk.SessionManager,
22136
+ getModel: piAi.getModel
21706
22137
  };
21707
22138
  }
21708
22139
  var PiCodingAgentProvider = class {
@@ -21891,10 +22322,10 @@ ${fileList}`;
21891
22322
  }
21892
22323
  resolveCwd(cwdOverride) {
21893
22324
  if (cwdOverride) {
21894
- return path18.resolve(cwdOverride);
22325
+ return path20.resolve(cwdOverride);
21895
22326
  }
21896
22327
  if (this.config.cwd) {
21897
- return path18.resolve(this.config.cwd);
22328
+ return path20.resolve(this.config.cwd);
21898
22329
  }
21899
22330
  return process.cwd();
21900
22331
  }
@@ -21913,9 +22344,9 @@ ${fileList}`;
21913
22344
  }
21914
22345
  resolveLogDirectory() {
21915
22346
  if (this.config.logDir) {
21916
- return path18.resolve(this.config.logDir);
22347
+ return path20.resolve(this.config.logDir);
21917
22348
  }
21918
- return path18.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
22349
+ return path20.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
21919
22350
  }
21920
22351
  async createStreamLogger(request) {
21921
22352
  const logDir = this.resolveLogDirectory();
@@ -21929,7 +22360,7 @@ ${fileList}`;
21929
22360
  console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
21930
22361
  return void 0;
21931
22362
  }
21932
- const filePath = path18.join(logDir, buildLogFilename6(request, this.targetName));
22363
+ const filePath = path20.join(logDir, buildLogFilename6(request, this.targetName));
21933
22364
  try {
21934
22365
  const logger = await PiStreamLogger2.create({
21935
22366
  filePath,
@@ -22149,10 +22580,10 @@ async function ensureDir(target) {
22149
22580
  await mkdir8(target, { recursive: true });
22150
22581
  }
22151
22582
  async function readDirEntries(target) {
22152
- const entries = await readdir(target, { withFileTypes: true });
22583
+ const entries = await readdir2(target, { withFileTypes: true });
22153
22584
  return entries.map((entry) => ({
22154
22585
  name: entry.name,
22155
- absolutePath: path19.join(target, entry.name),
22586
+ absolutePath: path21.join(target, entry.name),
22156
22587
  isDirectory: entry.isDirectory()
22157
22588
  }));
22158
22589
  }
@@ -22166,7 +22597,7 @@ async function removeIfExists(target) {
22166
22597
  }
22167
22598
  }
22168
22599
  function pathToFileUri2(filePath) {
22169
- const absolutePath = path20.isAbsolute(filePath) ? filePath : path20.resolve(filePath);
22600
+ const absolutePath = path222.isAbsolute(filePath) ? filePath : path222.resolve(filePath);
22170
22601
  const normalizedPath = absolutePath.replace(/\\/g, "/");
22171
22602
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
22172
22603
  return `file:///${normalizedPath}`;
@@ -22258,8 +22689,8 @@ function createBatchRequestPrompt(userQuery, responseFileTmp, responseFileFinal,
22258
22689
  });
22259
22690
  }
22260
22691
  function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateContent) {
22261
- const requestLines = requestFiles.map((file, index) => `${index + 1}. messages/${path21.basename(file)}`).join("\n");
22262
- const responseList = responseFiles.map((file) => `"${path21.basename(file)}"`).join(", ");
22692
+ const requestLines = requestFiles.map((file, index) => `${index + 1}. messages/${path23.basename(file)}`).join("\n");
22693
+ const responseList = responseFiles.map((file) => `"${path23.basename(file)}"`).join(", ");
22263
22694
  return renderTemplate2(templateContent, {
22264
22695
  requestFiles: requestLines,
22265
22696
  responseList
@@ -22298,7 +22729,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
22298
22729
  const maxAttempts = 10;
22299
22730
  while (attempts < maxAttempts) {
22300
22731
  try {
22301
- const content = await readFile7(responseFileFinal, { encoding: "utf8" });
22732
+ const content = await readFile9(responseFileFinal, { encoding: "utf8" });
22302
22733
  if (!silent) {
22303
22734
  process.stdout.write(`${content}
22304
22735
  `);
@@ -22319,7 +22750,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
22319
22750
  }
22320
22751
  async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, silent = false, timeoutMs = DEFAULT_TIMEOUT_MS) {
22321
22752
  if (!silent) {
22322
- const fileList = responseFilesFinal.map((file) => path222.basename(file)).join(", ");
22753
+ const fileList = responseFilesFinal.map((file) => path24.basename(file)).join(", ");
22323
22754
  console.error(`waiting for ${responseFilesFinal.length} batch response(s): ${fileList}`);
22324
22755
  }
22325
22756
  const deadline = Date.now() + timeoutMs;
@@ -22328,7 +22759,7 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
22328
22759
  while (pending.size > 0) {
22329
22760
  if (Date.now() >= deadline) {
22330
22761
  if (!silent) {
22331
- const remaining = [...pending].map((f) => path222.basename(f)).join(", ");
22762
+ const remaining = [...pending].map((f) => path24.basename(f)).join(", ");
22332
22763
  console.error(
22333
22764
  `error: timed out after ${Math.round(timeoutMs / 1e3)}s waiting for batch responses. Still pending: ${remaining}`
22334
22765
  );
@@ -22355,7 +22786,7 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
22355
22786
  const maxAttempts = 10;
22356
22787
  while (attempts < maxAttempts) {
22357
22788
  try {
22358
- const content = await readFile7(file, { encoding: "utf8" });
22789
+ const content = await readFile9(file, { encoding: "utf8" });
22359
22790
  if (!silent) {
22360
22791
  process.stdout.write(`${content}
22361
22792
  `);
@@ -22385,25 +22816,25 @@ function getAgentvHome() {
22385
22816
  }
22386
22817
  return envHome;
22387
22818
  }
22388
- return path23.join(os2.homedir(), ".agentv");
22819
+ return path25.join(os2.homedir(), ".agentv");
22389
22820
  }
22390
22821
  function getWorkspacesRoot() {
22391
- return path23.join(getAgentvHome(), "workspaces");
22822
+ return path25.join(getAgentvHome(), "workspaces");
22392
22823
  }
22393
22824
  function getSubagentsRoot() {
22394
- return path23.join(getAgentvHome(), "subagents");
22825
+ return path25.join(getAgentvHome(), "subagents");
22395
22826
  }
22396
22827
  function getTraceStateRoot() {
22397
- return path23.join(getAgentvHome(), "trace-state");
22828
+ return path25.join(getAgentvHome(), "trace-state");
22398
22829
  }
22399
22830
  function getWorkspacePoolRoot() {
22400
- return path23.join(getAgentvHome(), "workspace-pool");
22831
+ return path25.join(getAgentvHome(), "workspace-pool");
22401
22832
  }
22402
22833
  var DEFAULT_LOCK_NAME = "subagent.lock";
22403
22834
  var DEFAULT_ALIVE_FILENAME = ".alive";
22404
22835
  function getDefaultSubagentRoot(vscodeCmd = "code") {
22405
22836
  const folder = vscodeCmd === "code-insiders" ? "vscode-insiders-agents" : "vscode-agents";
22406
- return path24.join(getSubagentsRoot(), folder);
22837
+ return path26.join(getSubagentsRoot(), folder);
22407
22838
  }
22408
22839
  var DEFAULT_SUBAGENT_ROOT = getDefaultSubagentRoot();
22409
22840
  var execAsync2 = promisify2(exec);
@@ -22468,11 +22899,11 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
22468
22899
  await raceSpawnError(child);
22469
22900
  return true;
22470
22901
  }
22471
- const aliveFile = path25.join(subagentDir, DEFAULT_ALIVE_FILENAME);
22902
+ const aliveFile = path27.join(subagentDir, DEFAULT_ALIVE_FILENAME);
22472
22903
  await removeIfExists(aliveFile);
22473
- const githubAgentsDir = path25.join(subagentDir, ".github", "agents");
22904
+ const githubAgentsDir = path27.join(subagentDir, ".github", "agents");
22474
22905
  await mkdir9(githubAgentsDir, { recursive: true });
22475
- const wakeupDst = path25.join(githubAgentsDir, "wakeup.md");
22906
+ const wakeupDst = path27.join(githubAgentsDir, "wakeup.md");
22476
22907
  await writeFile2(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
22477
22908
  const workspaceChild = spawnVsCode(vscodeCmd, [workspacePath], {
22478
22909
  label: "open-workspace"
@@ -22485,7 +22916,7 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
22485
22916
  "chat",
22486
22917
  "-m",
22487
22918
  wakeupChatId,
22488
- `create a file named .alive in the ${path25.basename(subagentDir)} folder`
22919
+ `create a file named .alive in the ${path27.basename(subagentDir)} folder`
22489
22920
  ];
22490
22921
  const wakeupChild = spawnVsCode(vscodeCmd, chatArgs, { label: "send-wakeup-chat" });
22491
22922
  await raceSpawnError(wakeupChild);
@@ -22500,10 +22931,10 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
22500
22931
  return true;
22501
22932
  }
22502
22933
  async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, requestInstructions, timestamp, vscodeCmd) {
22503
- const workspacePath = path25.join(subagentDir, `${path25.basename(subagentDir)}.code-workspace`);
22504
- const messagesDir = path25.join(subagentDir, "messages");
22934
+ const workspacePath = path27.join(subagentDir, `${path27.basename(subagentDir)}.code-workspace`);
22935
+ const messagesDir = path27.join(subagentDir, "messages");
22505
22936
  await mkdir9(messagesDir, { recursive: true });
22506
- const reqFile = path25.join(messagesDir, `${timestamp}_req.md`);
22937
+ const reqFile = path27.join(messagesDir, `${timestamp}_req.md`);
22507
22938
  await writeFile2(reqFile, requestInstructions, { encoding: "utf8" });
22508
22939
  const reqUri = pathToFileUri2(reqFile);
22509
22940
  const chatArgs = ["-r", "chat", "-m", chatId];
@@ -22511,16 +22942,16 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
22511
22942
  chatArgs.push("-a", attachment);
22512
22943
  }
22513
22944
  chatArgs.push("-a", reqFile);
22514
- chatArgs.push(`Follow instructions in [${path25.basename(reqFile)}](${reqUri})`);
22945
+ chatArgs.push(`Follow instructions in [${path27.basename(reqFile)}](${reqUri})`);
22515
22946
  const workspaceReady = await ensureWorkspaceFocused(
22516
22947
  workspacePath,
22517
- path25.basename(subagentDir),
22948
+ path27.basename(subagentDir),
22518
22949
  subagentDir,
22519
22950
  vscodeCmd
22520
22951
  );
22521
22952
  if (!workspaceReady) {
22522
22953
  throw new Error(
22523
- `VS Code workspace '${path25.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
22954
+ `VS Code workspace '${path27.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
22524
22955
  );
22525
22956
  }
22526
22957
  await sleep2(500);
@@ -22528,8 +22959,8 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
22528
22959
  await raceSpawnError(child);
22529
22960
  }
22530
22961
  async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, chatInstruction, vscodeCmd) {
22531
- const workspacePath = path25.join(subagentDir, `${path25.basename(subagentDir)}.code-workspace`);
22532
- const messagesDir = path25.join(subagentDir, "messages");
22962
+ const workspacePath = path27.join(subagentDir, `${path27.basename(subagentDir)}.code-workspace`);
22963
+ const messagesDir = path27.join(subagentDir, "messages");
22533
22964
  await mkdir9(messagesDir, { recursive: true });
22534
22965
  const chatArgs = ["-r", "chat", "-m", chatId];
22535
22966
  for (const attachment of attachmentPaths) {
@@ -22538,13 +22969,13 @@ async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, c
22538
22969
  chatArgs.push(chatInstruction);
22539
22970
  const workspaceReady = await ensureWorkspaceFocused(
22540
22971
  workspacePath,
22541
- path25.basename(subagentDir),
22972
+ path27.basename(subagentDir),
22542
22973
  subagentDir,
22543
22974
  vscodeCmd
22544
22975
  );
22545
22976
  if (!workspaceReady) {
22546
22977
  throw new Error(
22547
- `VS Code workspace '${path25.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
22978
+ `VS Code workspace '${path27.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
22548
22979
  );
22549
22980
  }
22550
22981
  await sleep2(500);
@@ -22566,10 +22997,10 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
22566
22997
  }
22567
22998
  const transformedFolders = workspace.folders.map((folder) => {
22568
22999
  const folderPath = folder.path;
22569
- if (path26.isAbsolute(folderPath)) {
23000
+ if (path28.isAbsolute(folderPath)) {
22570
23001
  return folder;
22571
23002
  }
22572
- const absolutePath = path26.resolve(templateDir, folderPath);
23003
+ const absolutePath = path28.resolve(templateDir, folderPath);
22573
23004
  return {
22574
23005
  ...folder,
22575
23006
  path: absolutePath
@@ -22591,19 +23022,19 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
22591
23022
  if (locationMap && typeof locationMap === "object") {
22592
23023
  const transformedMap = {};
22593
23024
  for (const [locationPath, value] of Object.entries(locationMap)) {
22594
- const isAbsolute = path26.isAbsolute(locationPath);
23025
+ const isAbsolute = path28.isAbsolute(locationPath);
22595
23026
  if (isAbsolute) {
22596
23027
  transformedMap[locationPath] = value;
22597
23028
  } else {
22598
23029
  const firstGlobIndex = locationPath.search(/[*]/);
22599
23030
  if (firstGlobIndex === -1) {
22600
- const resolvedPath = path26.resolve(templateDir, locationPath).replace(/\\/g, "/");
23031
+ const resolvedPath = path28.resolve(templateDir, locationPath).replace(/\\/g, "/");
22601
23032
  transformedMap[resolvedPath] = value;
22602
23033
  } else {
22603
23034
  const basePathEnd = locationPath.lastIndexOf("/", firstGlobIndex);
22604
23035
  const basePath = basePathEnd !== -1 ? locationPath.substring(0, basePathEnd) : ".";
22605
23036
  const patternPath = locationPath.substring(basePathEnd !== -1 ? basePathEnd : 0);
22606
- const resolvedPath = (path26.resolve(templateDir, basePath) + patternPath).replace(
23037
+ const resolvedPath = (path28.resolve(templateDir, basePath) + patternPath).replace(
22607
23038
  /\\/g,
22608
23039
  "/"
22609
23040
  );
@@ -22642,7 +23073,7 @@ async function findUnlockedSubagent(subagentRoot) {
22642
23073
  number: Number.parseInt(entry.name.split("-")[1] ?? "", 10)
22643
23074
  })).filter((entry) => Number.isInteger(entry.number)).sort((a, b) => a.number - b.number);
22644
23075
  for (const subagent of subagents) {
22645
- const lockFile = path27.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
23076
+ const lockFile = path29.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
22646
23077
  if (!await pathExists(lockFile)) {
22647
23078
  return subagent.absolutePath;
22648
23079
  }
@@ -22652,26 +23083,26 @@ async function findUnlockedSubagent(subagentRoot) {
22652
23083
  async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
22653
23084
  let workspaceContent;
22654
23085
  if (workspaceTemplate) {
22655
- const workspaceSrc = path27.resolve(workspaceTemplate);
23086
+ const workspaceSrc = path29.resolve(workspaceTemplate);
22656
23087
  if (!await pathExists(workspaceSrc)) {
22657
23088
  throw new Error(`workspace template not found: ${workspaceSrc}`);
22658
23089
  }
22659
- const stats = await stat2(workspaceSrc);
23090
+ const stats = await stat3(workspaceSrc);
22660
23091
  if (!stats.isFile()) {
22661
23092
  throw new Error(`workspace template must be a file, not a directory: ${workspaceSrc}`);
22662
23093
  }
22663
- const templateText = await readFile8(workspaceSrc, "utf8");
23094
+ const templateText = await readFile10(workspaceSrc, "utf8");
22664
23095
  workspaceContent = JSON.parse(templateText);
22665
23096
  } else {
22666
23097
  workspaceContent = DEFAULT_WORKSPACE_TEMPLATE;
22667
23098
  }
22668
- const workspaceName = `${path27.basename(subagentDir)}.code-workspace`;
22669
- const workspaceDst = path27.join(subagentDir, workspaceName);
22670
- const templateDir = workspaceTemplate ? path27.dirname(path27.resolve(workspaceTemplate)) : subagentDir;
23099
+ const workspaceName = `${path29.basename(subagentDir)}.code-workspace`;
23100
+ const workspaceDst = path29.join(subagentDir, workspaceName);
23101
+ const templateDir = workspaceTemplate ? path29.dirname(path29.resolve(workspaceTemplate)) : subagentDir;
22671
23102
  const workspaceJson = JSON.stringify(workspaceContent, null, 2);
22672
23103
  let transformedContent = transformWorkspacePaths(workspaceJson, templateDir);
22673
23104
  if (cwd) {
22674
- const absCwd = path27.resolve(cwd);
23105
+ const absCwd = path29.resolve(cwd);
22675
23106
  const parsed = JSON.parse(transformedContent);
22676
23107
  const alreadyPresent = parsed.folders.some((f) => f.path === absCwd);
22677
23108
  if (!alreadyPresent) {
@@ -22680,35 +23111,35 @@ async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
22680
23111
  }
22681
23112
  }
22682
23113
  await writeFile3(workspaceDst, transformedContent, "utf8");
22683
- const messagesDir = path27.join(subagentDir, "messages");
23114
+ const messagesDir = path29.join(subagentDir, "messages");
22684
23115
  await mkdir10(messagesDir, { recursive: true });
22685
23116
  return { workspace: workspaceDst, messagesDir };
22686
23117
  }
22687
23118
  async function createSubagentLock(subagentDir) {
22688
- const messagesDir = path27.join(subagentDir, "messages");
23119
+ const messagesDir = path29.join(subagentDir, "messages");
22689
23120
  if (await pathExists(messagesDir)) {
22690
- const files = await readdir2(messagesDir);
23121
+ const files = await readdir3(messagesDir);
22691
23122
  await Promise.all(
22692
23123
  files.map(async (file) => {
22693
- const target = path27.join(messagesDir, file);
23124
+ const target = path29.join(messagesDir, file);
22694
23125
  await removeIfExists(target);
22695
23126
  })
22696
23127
  );
22697
23128
  }
22698
- const githubAgentsDir = path27.join(subagentDir, ".github", "agents");
23129
+ const githubAgentsDir = path29.join(subagentDir, ".github", "agents");
22699
23130
  if (await pathExists(githubAgentsDir)) {
22700
- const agentFiles = await readdir2(githubAgentsDir);
23131
+ const agentFiles = await readdir3(githubAgentsDir);
22701
23132
  const preservedFiles = /* @__PURE__ */ new Set(["wakeup.md", "subagent.md"]);
22702
23133
  await Promise.all(
22703
- agentFiles.filter((file) => file.endsWith(".md") && !preservedFiles.has(file)).map((file) => removeIfExists(path27.join(githubAgentsDir, file)))
23134
+ agentFiles.filter((file) => file.endsWith(".md") && !preservedFiles.has(file)).map((file) => removeIfExists(path29.join(githubAgentsDir, file)))
22704
23135
  );
22705
23136
  }
22706
- const lockFile = path27.join(subagentDir, DEFAULT_LOCK_NAME);
23137
+ const lockFile = path29.join(subagentDir, DEFAULT_LOCK_NAME);
22707
23138
  await writeFile3(lockFile, "", { encoding: "utf8" });
22708
23139
  return lockFile;
22709
23140
  }
22710
23141
  async function removeSubagentLock(subagentDir) {
22711
- const lockFile = path27.join(subagentDir, DEFAULT_LOCK_NAME);
23142
+ const lockFile = path29.join(subagentDir, DEFAULT_LOCK_NAME);
22712
23143
  await removeIfExists(lockFile);
22713
23144
  }
22714
23145
  async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspaceTemplate, dryRun, cwd) {
@@ -22728,9 +23159,9 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
22728
23159
  return 1;
22729
23160
  }
22730
23161
  if (promptFile) {
22731
- const githubAgentsDir = path27.join(subagentDir, ".github", "agents");
23162
+ const githubAgentsDir = path29.join(subagentDir, ".github", "agents");
22732
23163
  await mkdir10(githubAgentsDir, { recursive: true });
22733
- const agentFile = path27.join(githubAgentsDir, `${chatId}.md`);
23164
+ const agentFile = path29.join(githubAgentsDir, `${chatId}.md`);
22734
23165
  try {
22735
23166
  await copyFile(promptFile, agentFile);
22736
23167
  } catch (error) {
@@ -22747,11 +23178,11 @@ async function resolvePromptFile(promptFile) {
22747
23178
  if (!promptFile) {
22748
23179
  return void 0;
22749
23180
  }
22750
- const resolvedPrompt = path28.resolve(promptFile);
23181
+ const resolvedPrompt = path30.resolve(promptFile);
22751
23182
  if (!await pathExists(resolvedPrompt)) {
22752
23183
  throw new Error(`Prompt file not found: ${resolvedPrompt}`);
22753
23184
  }
22754
- const promptStats = await stat3(resolvedPrompt);
23185
+ const promptStats = await stat4(resolvedPrompt);
22755
23186
  if (!promptStats.isFile()) {
22756
23187
  throw new Error(`Prompt file must be a file, not a directory: ${resolvedPrompt}`);
22757
23188
  }
@@ -22763,7 +23194,7 @@ async function resolveAttachments(extraAttachments) {
22763
23194
  }
22764
23195
  const resolved = [];
22765
23196
  for (const attachment of extraAttachments) {
22766
- const resolvedPath = path28.resolve(attachment);
23197
+ const resolvedPath = path30.resolve(attachment);
22767
23198
  if (!await pathExists(resolvedPath)) {
22768
23199
  throw new Error(`Attachment not found: ${resolvedPath}`);
22769
23200
  }
@@ -22805,7 +23236,7 @@ async function dispatchAgentSession(options) {
22805
23236
  error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
22806
23237
  };
22807
23238
  }
22808
- const subagentName = path28.basename(subagentDir);
23239
+ const subagentName = path30.basename(subagentDir);
22809
23240
  const chatId = Math.random().toString(16).slice(2, 10);
22810
23241
  const preparationResult = await prepareSubagentDirectory(
22811
23242
  subagentDir,
@@ -22833,9 +23264,9 @@ async function dispatchAgentSession(options) {
22833
23264
  };
22834
23265
  }
22835
23266
  const timestamp = generateTimestamp();
22836
- const messagesDir = path28.join(subagentDir, "messages");
22837
- const responseFileTmp = path28.join(messagesDir, `${timestamp}_res.tmp.md`);
22838
- const responseFileFinal = path28.join(messagesDir, `${timestamp}_res.md`);
23267
+ const messagesDir = path30.join(subagentDir, "messages");
23268
+ const responseFileTmp = path30.join(messagesDir, `${timestamp}_res.tmp.md`);
23269
+ const responseFileFinal = path30.join(messagesDir, `${timestamp}_res.md`);
22839
23270
  const requestInstructions = createRequestPrompt(
22840
23271
  userQuery,
22841
23272
  responseFileTmp,
@@ -22940,7 +23371,7 @@ async function dispatchBatchAgent(options) {
22940
23371
  error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
22941
23372
  };
22942
23373
  }
22943
- subagentName = path28.basename(subagentDir);
23374
+ subagentName = path30.basename(subagentDir);
22944
23375
  const chatId = Math.random().toString(16).slice(2, 10);
22945
23376
  const preparationResult = await prepareSubagentDirectory(
22946
23377
  subagentDir,
@@ -22971,17 +23402,17 @@ async function dispatchBatchAgent(options) {
22971
23402
  };
22972
23403
  }
22973
23404
  const timestamp = generateTimestamp();
22974
- const messagesDir = path28.join(subagentDir, "messages");
23405
+ const messagesDir = path30.join(subagentDir, "messages");
22975
23406
  requestFiles = userQueries.map(
22976
- (_, index) => path28.join(messagesDir, `${timestamp}_${index}_req.md`)
23407
+ (_, index) => path30.join(messagesDir, `${timestamp}_${index}_req.md`)
22977
23408
  );
22978
23409
  const responseTmpFiles = userQueries.map(
22979
- (_, index) => path28.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
23410
+ (_, index) => path30.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
22980
23411
  );
22981
23412
  responseFilesFinal = userQueries.map(
22982
- (_, index) => path28.join(messagesDir, `${timestamp}_${index}_res.md`)
23413
+ (_, index) => path30.join(messagesDir, `${timestamp}_${index}_res.md`)
22983
23414
  );
22984
- const orchestratorFile = path28.join(messagesDir, `${timestamp}_orchestrator.md`);
23415
+ const orchestratorFile = path30.join(messagesDir, `${timestamp}_orchestrator.md`);
22985
23416
  if (!dryRun) {
22986
23417
  await Promise.all(
22987
23418
  userQueries.map((query, index) => {
@@ -23094,7 +23525,7 @@ async function provisionSubagents(options) {
23094
23525
  if (!Number.isInteger(subagents) || subagents < 1) {
23095
23526
  throw new Error("subagents must be a positive integer");
23096
23527
  }
23097
- const targetPath = path29.resolve(targetRoot);
23528
+ const targetPath = path31.resolve(targetRoot);
23098
23529
  if (!dryRun) {
23099
23530
  await ensureDir(targetPath);
23100
23531
  }
@@ -23114,7 +23545,7 @@ async function provisionSubagents(options) {
23114
23545
  continue;
23115
23546
  }
23116
23547
  highestNumber = Math.max(highestNumber, parsed);
23117
- const lockFile = path29.join(entry.absolutePath, lockName);
23548
+ const lockFile = path31.join(entry.absolutePath, lockName);
23118
23549
  const locked = await pathExists(lockFile);
23119
23550
  if (locked) {
23120
23551
  lockedSubagents.add(entry.absolutePath);
@@ -23131,10 +23562,10 @@ async function provisionSubagents(options) {
23131
23562
  break;
23132
23563
  }
23133
23564
  const subagentDir = subagent.absolutePath;
23134
- const githubAgentsDir = path29.join(subagentDir, ".github", "agents");
23135
- const lockFile = path29.join(subagentDir, lockName);
23136
- const workspaceDst = path29.join(subagentDir, `${path29.basename(subagentDir)}.code-workspace`);
23137
- const wakeupDst = path29.join(githubAgentsDir, "wakeup.md");
23565
+ const githubAgentsDir = path31.join(subagentDir, ".github", "agents");
23566
+ const lockFile = path31.join(subagentDir, lockName);
23567
+ const workspaceDst = path31.join(subagentDir, `${path31.basename(subagentDir)}.code-workspace`);
23568
+ const wakeupDst = path31.join(githubAgentsDir, "wakeup.md");
23138
23569
  const isLocked = await pathExists(lockFile);
23139
23570
  if (isLocked && !force) {
23140
23571
  continue;
@@ -23172,10 +23603,10 @@ async function provisionSubagents(options) {
23172
23603
  let nextIndex = highestNumber;
23173
23604
  while (subagentsProvisioned < subagents) {
23174
23605
  nextIndex += 1;
23175
- const subagentDir = path29.join(targetPath, `subagent-${nextIndex}`);
23176
- const githubAgentsDir = path29.join(subagentDir, ".github", "agents");
23177
- const workspaceDst = path29.join(subagentDir, `${path29.basename(subagentDir)}.code-workspace`);
23178
- const wakeupDst = path29.join(githubAgentsDir, "wakeup.md");
23606
+ const subagentDir = path31.join(targetPath, `subagent-${nextIndex}`);
23607
+ const githubAgentsDir = path31.join(subagentDir, ".github", "agents");
23608
+ const workspaceDst = path31.join(subagentDir, `${path31.basename(subagentDir)}.code-workspace`);
23609
+ const wakeupDst = path31.join(githubAgentsDir, "wakeup.md");
23179
23610
  if (!dryRun) {
23180
23611
  await ensureDir(subagentDir);
23181
23612
  await ensureDir(githubAgentsDir);
@@ -23361,7 +23792,7 @@ var VSCodeProvider = class {
23361
23792
  async function locateVSCodeExecutable(candidate) {
23362
23793
  const includesPathSeparator = candidate.includes("/") || candidate.includes("\\");
23363
23794
  if (includesPathSeparator) {
23364
- const resolved = path30.isAbsolute(candidate) ? candidate : path30.resolve(candidate);
23795
+ const resolved = path322.isAbsolute(candidate) ? candidate : path322.resolve(candidate);
23365
23796
  try {
23366
23797
  await access3(resolved, constants3.F_OK);
23367
23798
  return resolved;
@@ -23390,7 +23821,7 @@ async function resolveWorkspaceTemplateFile(template) {
23390
23821
  return void 0;
23391
23822
  }
23392
23823
  try {
23393
- const stats = await stat4(path30.resolve(template));
23824
+ const stats = await stat5(path322.resolve(template));
23394
23825
  return stats.isFile() ? template : void 0;
23395
23826
  } catch {
23396
23827
  return template;
@@ -23414,7 +23845,7 @@ function buildMandatoryPrereadBlock2(attachmentFiles) {
23414
23845
  return "";
23415
23846
  }
23416
23847
  const buildList = (files) => files.map((absolutePath) => {
23417
- const fileName = path30.basename(absolutePath);
23848
+ const fileName = path322.basename(absolutePath);
23418
23849
  const fileUri = pathToFileUri3(absolutePath);
23419
23850
  return `* [${fileName}](${fileUri})`;
23420
23851
  });
@@ -23435,7 +23866,7 @@ function collectAttachmentFiles(attachments) {
23435
23866
  }
23436
23867
  const unique = /* @__PURE__ */ new Map();
23437
23868
  for (const attachment of attachments) {
23438
- const absolutePath = path30.resolve(attachment);
23869
+ const absolutePath = path322.resolve(attachment);
23439
23870
  if (!unique.has(absolutePath)) {
23440
23871
  unique.set(absolutePath, absolutePath);
23441
23872
  }
@@ -23443,7 +23874,7 @@ function collectAttachmentFiles(attachments) {
23443
23874
  return Array.from(unique.values());
23444
23875
  }
23445
23876
  function pathToFileUri3(filePath) {
23446
- const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.resolve(filePath);
23877
+ const absolutePath = path322.isAbsolute(filePath) ? filePath : path322.resolve(filePath);
23447
23878
  const normalizedPath = absolutePath.replace(/\\/g, "/");
23448
23879
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
23449
23880
  return `file:///${normalizedPath}`;
@@ -23456,7 +23887,7 @@ function normalizeAttachments(attachments) {
23456
23887
  }
23457
23888
  const deduped = /* @__PURE__ */ new Set();
23458
23889
  for (const attachment of attachments) {
23459
- deduped.add(path30.resolve(attachment));
23890
+ deduped.add(path322.resolve(attachment));
23460
23891
  }
23461
23892
  return Array.from(deduped);
23462
23893
  }
@@ -23465,7 +23896,7 @@ function mergeAttachments(all) {
23465
23896
  for (const list of all) {
23466
23897
  if (!list) continue;
23467
23898
  for (const inputFile of list) {
23468
- deduped.add(path30.resolve(inputFile));
23899
+ deduped.add(path322.resolve(inputFile));
23469
23900
  }
23470
23901
  }
23471
23902
  return deduped.size > 0 ? Array.from(deduped) : void 0;
@@ -23545,11 +23976,11 @@ async function fileExists3(filePath) {
23545
23976
  }
23546
23977
  }
23547
23978
  async function readTargetDefinitions(filePath) {
23548
- const absolutePath = path31.resolve(filePath);
23979
+ const absolutePath = path33.resolve(filePath);
23549
23980
  if (!await fileExists3(absolutePath)) {
23550
23981
  throw new Error(`targets.yaml not found at ${absolutePath}`);
23551
23982
  }
23552
- const raw = await readFile9(absolutePath, "utf8");
23983
+ const raw = await readFile11(absolutePath, "utf8");
23553
23984
  const parsed = parse4(raw);
23554
23985
  if (!isRecord(parsed)) {
23555
23986
  throw new Error(`targets.yaml at ${absolutePath} must be a YAML object with a 'targets' field`);
@@ -23566,11 +23997,11 @@ function listTargetNames(definitions) {
23566
23997
  async function discoverProviders(registry, baseDir) {
23567
23998
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
23568
23999
  const candidateDirs = [];
23569
- let dir = path322.resolve(baseDir);
23570
- const root = path322.parse(dir).root;
24000
+ let dir = path34.resolve(baseDir);
24001
+ const root = path34.parse(dir).root;
23571
24002
  while (dir !== root) {
23572
- candidateDirs.push(path322.join(dir, ".agentv", "providers"));
23573
- dir = path322.dirname(dir);
24003
+ candidateDirs.push(path34.join(dir, ".agentv", "providers"));
24004
+ dir = path34.dirname(dir);
23574
24005
  }
23575
24006
  let files = [];
23576
24007
  for (const providersDir of candidateDirs) {
@@ -23586,7 +24017,7 @@ async function discoverProviders(registry, baseDir) {
23586
24017
  }
23587
24018
  const discoveredKinds = [];
23588
24019
  for (const filePath of files) {
23589
- const basename = path322.basename(filePath);
24020
+ const basename = path34.basename(filePath);
23590
24021
  const kindName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
23591
24022
  if (registry.has(kindName)) {
23592
24023
  continue;
@@ -23602,7 +24033,7 @@ async function discoverProviders(registry, baseDir) {
23602
24033
  }
23603
24034
  function createBuiltinProviderRegistry() {
23604
24035
  const registry = new ProviderRegistry();
23605
- registry.register("openai", (t) => new OpenAIProvider(t.name, t.config)).register("openrouter", (t) => new OpenRouterProvider(t.name, t.config)).register("azure", (t) => new AzureProvider(t.name, t.config)).register("anthropic", (t) => new AnthropicProvider(t.name, t.config)).register("gemini", (t) => new GeminiProvider(t.name, t.config)).register("cli", (t) => new CliProvider(t.name, t.config)).register("codex", (t) => new CodexProvider(t.name, t.config)).register("copilot-sdk", (t) => new CopilotSdkProvider(t.name, t.config)).register("copilot-cli", (t) => new CopilotCliProvider(t.name, t.config)).register("pi-coding-agent", (t) => new PiCodingAgentProvider(t.name, t.config)).register("pi-cli", (t) => new PiCliProvider(t.name, t.config)).register("claude-cli", (t) => new ClaudeCliProvider(t.name, t.config)).register("claude", (t) => new ClaudeCliProvider(t.name, t.config)).register("claude-sdk", (t) => new ClaudeSdkProvider(t.name, t.config)).register("mock", (t) => new MockProvider(t.name, t.config)).register("agentv", (t) => new AgentvProvider(t.name, t.config)).register("vscode", (t) => new VSCodeProvider(t.name, t.config, "vscode")).register(
24036
+ registry.register("openai", (t) => new OpenAIProvider(t.name, t.config)).register("openrouter", (t) => new OpenRouterProvider(t.name, t.config)).register("azure", (t) => new AzureProvider(t.name, t.config)).register("anthropic", (t) => new AnthropicProvider(t.name, t.config)).register("gemini", (t) => new GeminiProvider(t.name, t.config)).register("cli", (t) => new CliProvider(t.name, t.config)).register("codex", (t) => new CodexProvider(t.name, t.config)).register("copilot-sdk", (t) => new CopilotSdkProvider(t.name, t.config)).register("copilot-cli", (t) => new CopilotCliProvider(t.name, t.config)).register("copilot-log", (t) => new CopilotLogProvider(t.name, t.config)).register("pi-coding-agent", (t) => new PiCodingAgentProvider(t.name, t.config)).register("pi-cli", (t) => new PiCliProvider(t.name, t.config)).register("claude-cli", (t) => new ClaudeCliProvider(t.name, t.config)).register("claude", (t) => new ClaudeCliProvider(t.name, t.config)).register("claude-sdk", (t) => new ClaudeSdkProvider(t.name, t.config)).register("mock", (t) => new MockProvider(t.name, t.config)).register("agentv", (t) => new AgentvProvider(t.name, t.config)).register("vscode", (t) => new VSCodeProvider(t.name, t.config, "vscode")).register(
23606
24037
  "vscode-insiders",
23607
24038
  (t) => new VSCodeProvider(t.name, t.config, "vscode-insiders")
23608
24039
  );
@@ -23800,15 +24231,15 @@ async function execFileWithStdinNode(argv, stdinPayload, options) {
23800
24231
  });
23801
24232
  }
23802
24233
  async function execShellWithStdin(command, stdinPayload, options = {}) {
23803
- const { mkdir: mkdir16, readFile: readFile12, rm: rm6, writeFile: writeFile9 } = await import("node:fs/promises");
24234
+ const { mkdir: mkdir16, readFile: readFile14, rm: rm6, writeFile: writeFile9 } = await import("node:fs/promises");
23804
24235
  const { tmpdir: tmpdir3 } = await import("node:os");
23805
- const path45 = await import("node:path");
24236
+ const path47 = await import("node:path");
23806
24237
  const { randomUUID: randomUUID10 } = await import("node:crypto");
23807
- const dir = path45.join(tmpdir3(), `agentv-exec-${randomUUID10()}`);
24238
+ const dir = path47.join(tmpdir3(), `agentv-exec-${randomUUID10()}`);
23808
24239
  await mkdir16(dir, { recursive: true });
23809
- const stdinPath = path45.join(dir, "stdin.txt");
23810
- const stdoutPath = path45.join(dir, "stdout.txt");
23811
- const stderrPath = path45.join(dir, "stderr.txt");
24240
+ const stdinPath = path47.join(dir, "stdin.txt");
24241
+ const stdoutPath = path47.join(dir, "stdout.txt");
24242
+ const stderrPath = path47.join(dir, "stderr.txt");
23812
24243
  await writeFile9(stdinPath, stdinPayload, "utf8");
23813
24244
  const wrappedCommand = process.platform === "win32" ? `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}` : `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}`;
23814
24245
  const { spawn: spawn5 } = await import("node:child_process");
@@ -23838,8 +24269,8 @@ async function execShellWithStdin(command, stdinPayload, options = {}) {
23838
24269
  resolve2(code ?? 0);
23839
24270
  });
23840
24271
  });
23841
- const stdout = (await readFile12(stdoutPath, "utf8")).replace(/\r\n/g, "\n");
23842
- const stderr = (await readFile12(stderrPath, "utf8")).replace(/\r\n/g, "\n");
24272
+ const stdout = (await readFile14(stdoutPath, "utf8")).replace(/\r\n/g, "\n");
24273
+ const stderr = (await readFile14(stderrPath, "utf8")).replace(/\r\n/g, "\n");
23843
24274
  return { stdout, stderr, exitCode };
23844
24275
  } finally {
23845
24276
  await rm6(dir, { recursive: true, force: true });
@@ -25125,8 +25556,8 @@ function calculateScoreRangeResult(result, rubrics) {
25125
25556
  };
25126
25557
  }
25127
25558
  function resolveSandboxed(basePath, relativePath) {
25128
- const resolved = path33.resolve(basePath, relativePath);
25129
- if (!resolved.startsWith(basePath + path33.sep) && resolved !== basePath) {
25559
+ const resolved = path35.resolve(basePath, relativePath);
25560
+ if (!resolved.startsWith(basePath + path35.sep) && resolved !== basePath) {
25130
25561
  throw new Error(`Path '${relativePath}' is outside the workspace`);
25131
25562
  }
25132
25563
  return resolved;
@@ -25159,11 +25590,11 @@ function createFilesystemTools(workspacePath) {
25159
25590
  execute: async (input) => {
25160
25591
  try {
25161
25592
  const resolved = resolveSandboxed(workspacePath, input.path);
25162
- const stat8 = await fs2.stat(resolved);
25163
- if (stat8.isDirectory()) {
25593
+ const stat9 = await fs2.stat(resolved);
25594
+ if (stat9.isDirectory()) {
25164
25595
  return { error: `'${input.path}' is a directory, not a file` };
25165
25596
  }
25166
- const buffer = Buffer.alloc(Math.min(stat8.size, MAX_FILE_SIZE));
25597
+ const buffer = Buffer.alloc(Math.min(stat9.size, MAX_FILE_SIZE));
25167
25598
  const fd = await fs2.open(resolved, "r");
25168
25599
  try {
25169
25600
  await fd.read(buffer, 0, buffer.length, 0);
@@ -25171,8 +25602,8 @@ function createFilesystemTools(workspacePath) {
25171
25602
  await fd.close();
25172
25603
  }
25173
25604
  const content = buffer.toString("utf-8");
25174
- const truncated = stat8.size > MAX_FILE_SIZE;
25175
- return { content, truncated, size: stat8.size };
25605
+ const truncated = stat9.size > MAX_FILE_SIZE;
25606
+ return { content, truncated, size: stat9.size };
25176
25607
  } catch (error) {
25177
25608
  return { error: error instanceof Error ? error.message : String(error) };
25178
25609
  }
@@ -25216,15 +25647,15 @@ async function searchDirectory(dirPath, workspacePath, regex, matches) {
25216
25647
  for (const entry of entries) {
25217
25648
  if (matches.length >= MAX_SEARCH_MATCHES) return;
25218
25649
  if (SEARCH_SKIP_DIRS.has(entry.name)) continue;
25219
- const fullPath = path33.join(dirPath, entry.name);
25650
+ const fullPath = path35.join(dirPath, entry.name);
25220
25651
  if (entry.isDirectory()) {
25221
25652
  await searchDirectory(fullPath, workspacePath, regex, matches);
25222
25653
  } else if (entry.isFile()) {
25223
- const ext = path33.extname(entry.name).toLowerCase();
25654
+ const ext = path35.extname(entry.name).toLowerCase();
25224
25655
  if (BINARY_EXTENSIONS.has(ext)) continue;
25225
25656
  try {
25226
- const stat8 = await fs2.stat(fullPath);
25227
- if (stat8.size > MAX_FILE_SIZE) continue;
25657
+ const stat9 = await fs2.stat(fullPath);
25658
+ if (stat9.size > MAX_FILE_SIZE) continue;
25228
25659
  const content = await fs2.readFile(fullPath, "utf-8");
25229
25660
  const lines = content.split("\n");
25230
25661
  for (let i = 0; i < lines.length; i++) {
@@ -25232,7 +25663,7 @@ async function searchDirectory(dirPath, workspacePath, regex, matches) {
25232
25663
  regex.lastIndex = 0;
25233
25664
  if (regex.test(lines[i])) {
25234
25665
  matches.push({
25235
- file: path33.relative(workspacePath, fullPath),
25666
+ file: path35.relative(workspacePath, fullPath),
25236
25667
  line: i + 1,
25237
25668
  text: lines[i].substring(0, 200)
25238
25669
  });
@@ -25857,115 +26288,115 @@ var FieldAccuracyEvaluator = class {
25857
26288
  * Evaluate a single field against the expected value.
25858
26289
  */
25859
26290
  evaluateField(fieldConfig, candidateData, expectedData) {
25860
- const { path: path45, match, required = true, weight = 1 } = fieldConfig;
25861
- const candidateValue = resolvePath(candidateData, path45);
25862
- const expectedValue = resolvePath(expectedData, path45);
26291
+ const { path: path47, match, required = true, weight = 1 } = fieldConfig;
26292
+ const candidateValue = resolvePath(candidateData, path47);
26293
+ const expectedValue = resolvePath(expectedData, path47);
25863
26294
  if (expectedValue === void 0) {
25864
26295
  return {
25865
- path: path45,
26296
+ path: path47,
25866
26297
  score: 1,
25867
26298
  // No expected value means no comparison needed
25868
26299
  weight,
25869
26300
  hit: true,
25870
- message: `${path45}: no expected value`
26301
+ message: `${path47}: no expected value`
25871
26302
  };
25872
26303
  }
25873
26304
  if (candidateValue === void 0) {
25874
26305
  if (required) {
25875
26306
  return {
25876
- path: path45,
26307
+ path: path47,
25877
26308
  score: 0,
25878
26309
  weight,
25879
26310
  hit: false,
25880
- message: `${path45} (required, missing)`
26311
+ message: `${path47} (required, missing)`
25881
26312
  };
25882
26313
  }
25883
26314
  return {
25884
- path: path45,
26315
+ path: path47,
25885
26316
  score: 1,
25886
26317
  // Don't penalize missing optional fields
25887
26318
  weight: 0,
25888
26319
  // Zero weight means it won't affect the score
25889
26320
  hit: true,
25890
- message: `${path45}: optional field missing`
26321
+ message: `${path47}: optional field missing`
25891
26322
  };
25892
26323
  }
25893
26324
  switch (match) {
25894
26325
  case "exact":
25895
- return this.compareExact(path45, candidateValue, expectedValue, weight);
26326
+ return this.compareExact(path47, candidateValue, expectedValue, weight);
25896
26327
  case "numeric_tolerance":
25897
26328
  return this.compareNumericTolerance(
25898
- path45,
26329
+ path47,
25899
26330
  candidateValue,
25900
26331
  expectedValue,
25901
26332
  fieldConfig,
25902
26333
  weight
25903
26334
  );
25904
26335
  case "date":
25905
- return this.compareDate(path45, candidateValue, expectedValue, fieldConfig, weight);
26336
+ return this.compareDate(path47, candidateValue, expectedValue, fieldConfig, weight);
25906
26337
  default:
25907
26338
  return {
25908
- path: path45,
26339
+ path: path47,
25909
26340
  score: 0,
25910
26341
  weight,
25911
26342
  hit: false,
25912
- message: `${path45}: unknown match type "${match}"`
26343
+ message: `${path47}: unknown match type "${match}"`
25913
26344
  };
25914
26345
  }
25915
26346
  }
25916
26347
  /**
25917
26348
  * Exact equality comparison.
25918
26349
  */
25919
- compareExact(path45, candidateValue, expectedValue, weight) {
26350
+ compareExact(path47, candidateValue, expectedValue, weight) {
25920
26351
  if (deepEqual(candidateValue, expectedValue)) {
25921
26352
  return {
25922
- path: path45,
26353
+ path: path47,
25923
26354
  score: 1,
25924
26355
  weight,
25925
26356
  hit: true,
25926
- message: path45
26357
+ message: path47
25927
26358
  };
25928
26359
  }
25929
26360
  if (typeof candidateValue !== typeof expectedValue) {
25930
26361
  return {
25931
- path: path45,
26362
+ path: path47,
25932
26363
  score: 0,
25933
26364
  weight,
25934
26365
  hit: false,
25935
- message: `${path45} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
26366
+ message: `${path47} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
25936
26367
  };
25937
26368
  }
25938
26369
  return {
25939
- path: path45,
26370
+ path: path47,
25940
26371
  score: 0,
25941
26372
  weight,
25942
26373
  hit: false,
25943
- message: `${path45} (value mismatch)`
26374
+ message: `${path47} (value mismatch)`
25944
26375
  };
25945
26376
  }
25946
26377
  /**
25947
26378
  * Numeric comparison with absolute or relative tolerance.
25948
26379
  */
25949
- compareNumericTolerance(path45, candidateValue, expectedValue, fieldConfig, weight) {
26380
+ compareNumericTolerance(path47, candidateValue, expectedValue, fieldConfig, weight) {
25950
26381
  const { tolerance = 0, relative = false } = fieldConfig;
25951
26382
  const candidateNum = toNumber(candidateValue);
25952
26383
  const expectedNum = toNumber(expectedValue);
25953
26384
  if (candidateNum === null || expectedNum === null) {
25954
26385
  return {
25955
- path: path45,
26386
+ path: path47,
25956
26387
  score: 0,
25957
26388
  weight,
25958
26389
  hit: false,
25959
- message: `${path45} (non-numeric value)`
26390
+ message: `${path47} (non-numeric value)`
25960
26391
  };
25961
26392
  }
25962
26393
  if (!Number.isFinite(candidateNum) || !Number.isFinite(expectedNum)) {
25963
26394
  return {
25964
- path: path45,
26395
+ path: path47,
25965
26396
  score: 0,
25966
26397
  weight,
25967
26398
  hit: false,
25968
- message: `${path45} (invalid numeric value)`
26399
+ message: `${path47} (invalid numeric value)`
25969
26400
  };
25970
26401
  }
25971
26402
  const diff = Math.abs(candidateNum - expectedNum);
@@ -25978,61 +26409,61 @@ var FieldAccuracyEvaluator = class {
25978
26409
  }
25979
26410
  if (withinTolerance) {
25980
26411
  return {
25981
- path: path45,
26412
+ path: path47,
25982
26413
  score: 1,
25983
26414
  weight,
25984
26415
  hit: true,
25985
- message: `${path45} (within tolerance: diff=${diff.toFixed(2)})`
26416
+ message: `${path47} (within tolerance: diff=${diff.toFixed(2)})`
25986
26417
  };
25987
26418
  }
25988
26419
  return {
25989
- path: path45,
26420
+ path: path47,
25990
26421
  score: 0,
25991
26422
  weight,
25992
26423
  hit: false,
25993
- message: `${path45} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
26424
+ message: `${path47} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
25994
26425
  };
25995
26426
  }
25996
26427
  /**
25997
26428
  * Date comparison with format normalization.
25998
26429
  */
25999
- compareDate(path45, candidateValue, expectedValue, fieldConfig, weight) {
26430
+ compareDate(path47, candidateValue, expectedValue, fieldConfig, weight) {
26000
26431
  const formats = fieldConfig.formats ?? DEFAULT_DATE_FORMATS;
26001
26432
  const candidateDate = parseDate(String(candidateValue), formats);
26002
26433
  const expectedDate = parseDate(String(expectedValue), formats);
26003
26434
  if (candidateDate === null) {
26004
26435
  return {
26005
- path: path45,
26436
+ path: path47,
26006
26437
  score: 0,
26007
26438
  weight,
26008
26439
  hit: false,
26009
- message: `${path45} (unparseable candidate date)`
26440
+ message: `${path47} (unparseable candidate date)`
26010
26441
  };
26011
26442
  }
26012
26443
  if (expectedDate === null) {
26013
26444
  return {
26014
- path: path45,
26445
+ path: path47,
26015
26446
  score: 0,
26016
26447
  weight,
26017
26448
  hit: false,
26018
- message: `${path45} (unparseable expected date)`
26449
+ message: `${path47} (unparseable expected date)`
26019
26450
  };
26020
26451
  }
26021
26452
  if (candidateDate.getFullYear() === expectedDate.getFullYear() && candidateDate.getMonth() === expectedDate.getMonth() && candidateDate.getDate() === expectedDate.getDate()) {
26022
26453
  return {
26023
- path: path45,
26454
+ path: path47,
26024
26455
  score: 1,
26025
26456
  weight,
26026
26457
  hit: true,
26027
- message: path45
26458
+ message: path47
26028
26459
  };
26029
26460
  }
26030
26461
  return {
26031
- path: path45,
26462
+ path: path47,
26032
26463
  score: 0,
26033
26464
  weight,
26034
26465
  hit: false,
26035
- message: `${path45} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
26466
+ message: `${path47} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
26036
26467
  };
26037
26468
  }
26038
26469
  /**
@@ -26065,11 +26496,11 @@ var FieldAccuracyEvaluator = class {
26065
26496
  };
26066
26497
  }
26067
26498
  };
26068
- function resolvePath(obj, path45) {
26069
- if (!path45 || !obj) {
26499
+ function resolvePath(obj, path47) {
26500
+ if (!path47 || !obj) {
26070
26501
  return void 0;
26071
26502
  }
26072
- const parts = path45.split(/\.|\[|\]/).filter((p) => p.length > 0);
26503
+ const parts = path47.split(/\.|\[|\]/).filter((p) => p.length > 0);
26073
26504
  let current = obj;
26074
26505
  for (const part of parts) {
26075
26506
  if (current === null || current === void 0) {
@@ -26233,6 +26664,7 @@ var PROVIDER_TOOL_SEMANTICS = {
26233
26664
  "pi-coding-agent": PI_CODING_AGENT_MATCHER,
26234
26665
  "pi-cli": PI_CODING_AGENT_MATCHER,
26235
26666
  "copilot-cli": COPILOT_MATCHER,
26667
+ "copilot-log": COPILOT_MATCHER,
26236
26668
  "copilot-sdk": COPILOT_MATCHER,
26237
26669
  vscode: COPILOT_MATCHER,
26238
26670
  "vscode-insiders": COPILOT_MATCHER
@@ -26259,8 +26691,9 @@ var SkillTriggerEvaluator = class {
26259
26691
  let triggered = false;
26260
26692
  let evidence = "";
26261
26693
  for (const toolCall of allToolCalls) {
26694
+ const toolName = toolCall.tool ?? "";
26262
26695
  const input = toolCall.input ?? {};
26263
- if (matcher.skillTools.includes(toolCall.tool)) {
26696
+ if (matcher.skillTools.includes(toolName)) {
26264
26697
  const skillArg = String(input[matcher.skillInputField] ?? "");
26265
26698
  if (skillArg.includes(skillName)) {
26266
26699
  triggered = true;
@@ -26268,12 +26701,12 @@ var SkillTriggerEvaluator = class {
26268
26701
  break;
26269
26702
  }
26270
26703
  } else if (matcher.skillToolPrefixes?.some(
26271
- (prefix) => toolCall.tool.startsWith(prefix) && toolCall.tool.includes(skillName)
26704
+ (prefix) => toolName.startsWith(prefix) && toolName.includes(skillName)
26272
26705
  )) {
26273
26706
  triggered = true;
26274
- evidence = `Skill tool invoked via tool name "${toolCall.tool}"`;
26707
+ evidence = `Skill tool invoked via tool name "${toolName}"`;
26275
26708
  break;
26276
- } else if (matcher.readTools.includes(toolCall.tool)) {
26709
+ } else if (matcher.readTools.includes(toolName)) {
26277
26710
  const filePath = this.readPathFromInput(input, matcher);
26278
26711
  if (filePath.includes(skillName)) {
26279
26712
  triggered = true;
@@ -26281,10 +26714,10 @@ var SkillTriggerEvaluator = class {
26281
26714
  break;
26282
26715
  }
26283
26716
  } else if (matcher.readToolPrefixes?.some(
26284
- (prefix) => toolCall.tool.startsWith(prefix) && toolCall.tool.includes(skillName)
26717
+ (prefix) => toolName.startsWith(prefix) && toolName.includes(skillName)
26285
26718
  )) {
26286
26719
  triggered = true;
26287
- evidence = `Read tool loaded skill file via tool name "${toolCall.tool}"`;
26720
+ evidence = `Read tool loaded skill file via tool name "${toolName}"`;
26288
26721
  break;
26289
26722
  }
26290
26723
  }
@@ -26540,8 +26973,8 @@ var TokenUsageEvaluator = class {
26540
26973
  };
26541
26974
  }
26542
26975
  };
26543
- function getNestedValue(obj, path45) {
26544
- const parts = path45.split(".");
26976
+ function getNestedValue(obj, path47) {
26977
+ const parts = path47.split(".");
26545
26978
  let current = obj;
26546
26979
  for (const part of parts) {
26547
26980
  if (current === null || current === void 0 || typeof current !== "object") {
@@ -27404,7 +27837,7 @@ async function executePromptTemplate(script, context2, config, timeoutMs) {
27404
27837
  };
27405
27838
  const inputJson = JSON.stringify(toSnakeCaseDeep(payload), null, 2);
27406
27839
  const scriptPath = script[script.length - 1];
27407
- const cwd = path34.dirname(scriptPath);
27840
+ const cwd = path36.dirname(scriptPath);
27408
27841
  try {
27409
27842
  const stdout = await executeScript(script, inputJson, timeoutMs, cwd);
27410
27843
  const prompt = stdout.trim();
@@ -27675,11 +28108,11 @@ function createBuiltinRegistry() {
27675
28108
  async function discoverAssertions(registry, baseDir) {
27676
28109
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
27677
28110
  const candidateDirs = [];
27678
- let dir = path35.resolve(baseDir);
27679
- const root = path35.parse(dir).root;
28111
+ let dir = path37.resolve(baseDir);
28112
+ const root = path37.parse(dir).root;
27680
28113
  while (dir !== root) {
27681
- candidateDirs.push(path35.join(dir, ".agentv", "assertions"));
27682
- dir = path35.dirname(dir);
28114
+ candidateDirs.push(path37.join(dir, ".agentv", "assertions"));
28115
+ dir = path37.dirname(dir);
27683
28116
  }
27684
28117
  let files = [];
27685
28118
  for (const assertionsDir of candidateDirs) {
@@ -27695,7 +28128,7 @@ async function discoverAssertions(registry, baseDir) {
27695
28128
  }
27696
28129
  const discoveredTypes = [];
27697
28130
  for (const filePath of files) {
27698
- const basename = path35.basename(filePath);
28131
+ const basename = path37.basename(filePath);
27699
28132
  const typeName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
27700
28133
  if (registry.has(typeName)) {
27701
28134
  continue;
@@ -27714,12 +28147,12 @@ async function discoverAssertions(registry, baseDir) {
27714
28147
  async function discoverGraders(registry, baseDir) {
27715
28148
  const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
27716
28149
  const candidateDirs = [];
27717
- let dir = path36.resolve(baseDir);
27718
- const root = path36.parse(dir).root;
28150
+ let dir = path38.resolve(baseDir);
28151
+ const root = path38.parse(dir).root;
27719
28152
  while (dir !== root) {
27720
- candidateDirs.push(path36.join(dir, ".agentv", "graders"));
27721
- candidateDirs.push(path36.join(dir, ".agentv", "judges"));
27722
- dir = path36.dirname(dir);
28153
+ candidateDirs.push(path38.join(dir, ".agentv", "graders"));
28154
+ candidateDirs.push(path38.join(dir, ".agentv", "judges"));
28155
+ dir = path38.dirname(dir);
27723
28156
  }
27724
28157
  let files = [];
27725
28158
  for (const gradersDir of candidateDirs) {
@@ -27735,7 +28168,7 @@ async function discoverGraders(registry, baseDir) {
27735
28168
  }
27736
28169
  const discoveredTypes = [];
27737
28170
  for (const filePath of files) {
27738
- const basename = path36.basename(filePath);
28171
+ const basename = path38.basename(filePath);
27739
28172
  const typeName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
27740
28173
  if (registry.has(typeName)) {
27741
28174
  continue;
@@ -27921,10 +28354,10 @@ async function stageNestedRepoChanges(workspacePath) {
27921
28354
  }
27922
28355
  for (const entry of entries) {
27923
28356
  if (entry === ".git" || entry === "node_modules") continue;
27924
- const childPath = path37.join(workspacePath, entry);
28357
+ const childPath = path39.join(workspacePath, entry);
27925
28358
  try {
27926
28359
  if (!statSync(childPath).isDirectory()) continue;
27927
- if (!statSync(path37.join(childPath, ".git")).isDirectory()) continue;
28360
+ if (!statSync(path39.join(childPath, ".git")).isDirectory()) continue;
27928
28361
  } catch {
27929
28362
  continue;
27930
28363
  }
@@ -27953,7 +28386,7 @@ var WorkspaceCreationError = class extends Error {
27953
28386
  };
27954
28387
  async function isDirectory(filePath) {
27955
28388
  try {
27956
- const stats = await stat5(filePath);
28389
+ const stats = await stat6(filePath);
27957
28390
  return stats.isDirectory();
27958
28391
  } catch {
27959
28392
  return false;
@@ -27961,14 +28394,14 @@ async function isDirectory(filePath) {
27961
28394
  }
27962
28395
  function getWorkspacePath(evalRunId, caseId, workspaceRoot) {
27963
28396
  const root = workspaceRoot ?? getWorkspacesRoot();
27964
- return path38.join(root, evalRunId, caseId);
28397
+ return path40.join(root, evalRunId, caseId);
27965
28398
  }
27966
28399
  async function copyDirectoryRecursive(src, dest) {
27967
28400
  await mkdir12(dest, { recursive: true });
27968
- const entries = await readdir3(src, { withFileTypes: true });
28401
+ const entries = await readdir4(src, { withFileTypes: true });
27969
28402
  for (const entry of entries) {
27970
- const srcPath = path38.join(src, entry.name);
27971
- const destPath = path38.join(dest, entry.name);
28403
+ const srcPath = path40.join(src, entry.name);
28404
+ const destPath = path40.join(dest, entry.name);
27972
28405
  if (entry.name === ".git") {
27973
28406
  continue;
27974
28407
  }
@@ -27980,7 +28413,7 @@ async function copyDirectoryRecursive(src, dest) {
27980
28413
  }
27981
28414
  }
27982
28415
  async function createTempWorkspace(templatePath, evalRunId, caseId, workspaceRoot) {
27983
- const resolvedTemplatePath = path38.resolve(templatePath);
28416
+ const resolvedTemplatePath = path40.resolve(templatePath);
27984
28417
  if (!await fileExists(resolvedTemplatePath)) {
27985
28418
  throw new TemplateNotFoundError(resolvedTemplatePath);
27986
28419
  }
@@ -28029,7 +28462,7 @@ async function cleanupWorkspace(workspacePath) {
28029
28462
  }
28030
28463
  async function cleanupEvalWorkspaces(evalRunId, workspaceRoot) {
28031
28464
  const root = workspaceRoot ?? getWorkspacesRoot();
28032
- const evalDir = path38.join(root, evalRunId);
28465
+ const evalDir = path40.join(root, evalRunId);
28033
28466
  if (await fileExists(evalDir)) {
28034
28467
  await rm4(evalDir, { recursive: true, force: true });
28035
28468
  }
@@ -28084,10 +28517,10 @@ function computeWorkspaceFingerprint(repos) {
28084
28517
  }
28085
28518
  async function copyDirectoryRecursive2(src, dest, skipDirs) {
28086
28519
  await mkdir13(dest, { recursive: true });
28087
- const entries = await readdir4(src, { withFileTypes: true });
28520
+ const entries = await readdir5(src, { withFileTypes: true });
28088
28521
  for (const entry of entries) {
28089
- const srcPath = path39.join(src, entry.name);
28090
- const destPath = path39.join(dest, entry.name);
28522
+ const srcPath = path41.join(src, entry.name);
28523
+ const destPath = path41.join(dest, entry.name);
28091
28524
  if (entry.name === ".git") {
28092
28525
  continue;
28093
28526
  }
@@ -28120,7 +28553,7 @@ var WorkspacePoolManager = class {
28120
28553
  async acquireWorkspace(options) {
28121
28554
  const { templatePath, repos, maxSlots, repoManager, poolReset } = options;
28122
28555
  const fingerprint = computeWorkspaceFingerprint(repos);
28123
- const poolDir = path39.join(this.poolRoot, fingerprint);
28556
+ const poolDir = path41.join(this.poolRoot, fingerprint);
28124
28557
  await mkdir13(poolDir, { recursive: true });
28125
28558
  const drifted = await this.checkDrift(poolDir, fingerprint);
28126
28559
  if (drifted) {
@@ -28130,7 +28563,7 @@ var WorkspacePoolManager = class {
28130
28563
  await this.removeAllSlots(poolDir);
28131
28564
  }
28132
28565
  for (let i = 0; i < maxSlots; i++) {
28133
- const slotPath = path39.join(poolDir, `slot-${i}`);
28566
+ const slotPath = path41.join(poolDir, `slot-${i}`);
28134
28567
  const lockPath = `${slotPath}.lock`;
28135
28568
  const locked = await this.tryLock(lockPath);
28136
28569
  if (!locked) {
@@ -28192,7 +28625,7 @@ var WorkspacePoolManager = class {
28192
28625
  throw err;
28193
28626
  }
28194
28627
  try {
28195
- const pidStr = await readFile10(lockPath, "utf-8");
28628
+ const pidStr = await readFile12(lockPath, "utf-8");
28196
28629
  const pid = Number.parseInt(pidStr.trim(), 10);
28197
28630
  if (!Number.isNaN(pid)) {
28198
28631
  try {
@@ -28217,9 +28650,9 @@ var WorkspacePoolManager = class {
28217
28650
  * Returns false (no drift) if metadata.json doesn't exist (first use).
28218
28651
  */
28219
28652
  async checkDrift(poolDir, fingerprint) {
28220
- const metadataPath = path39.join(poolDir, "metadata.json");
28653
+ const metadataPath = path41.join(poolDir, "metadata.json");
28221
28654
  try {
28222
- const raw = await readFile10(metadataPath, "utf-8");
28655
+ const raw = await readFile12(metadataPath, "utf-8");
28223
28656
  const metadata = JSON.parse(raw);
28224
28657
  return metadata.fingerprint !== fingerprint;
28225
28658
  } catch {
@@ -28234,17 +28667,17 @@ var WorkspacePoolManager = class {
28234
28667
  repos,
28235
28668
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
28236
28669
  };
28237
- await writeFile7(path39.join(poolDir, "metadata.json"), JSON.stringify(metadata, null, 2));
28670
+ await writeFile7(path41.join(poolDir, "metadata.json"), JSON.stringify(metadata, null, 2));
28238
28671
  }
28239
28672
  /** Remove all slot directories and their lock files from a pool directory. */
28240
28673
  async removeAllSlots(poolDir) {
28241
- const entries = await readdir4(poolDir);
28674
+ const entries = await readdir5(poolDir);
28242
28675
  for (const entry of entries) {
28243
28676
  if (entry.startsWith("slot-") && !entry.endsWith(".lock")) {
28244
- const lockPath = path39.join(poolDir, `${entry}.lock`);
28677
+ const lockPath = path41.join(poolDir, `${entry}.lock`);
28245
28678
  if (existsSync2(lockPath)) {
28246
28679
  try {
28247
- const pidStr = await readFile10(lockPath, "utf-8");
28680
+ const pidStr = await readFile12(lockPath, "utf-8");
28248
28681
  const pid = Number.parseInt(pidStr.trim(), 10);
28249
28682
  if (!Number.isNaN(pid)) {
28250
28683
  try {
@@ -28257,12 +28690,12 @@ var WorkspacePoolManager = class {
28257
28690
  } catch {
28258
28691
  }
28259
28692
  }
28260
- await rm5(path39.join(poolDir, entry), { recursive: true, force: true });
28693
+ await rm5(path41.join(poolDir, entry), { recursive: true, force: true });
28261
28694
  await rm5(lockPath, { force: true }).catch(() => {
28262
28695
  });
28263
28696
  }
28264
28697
  }
28265
- await rm5(path39.join(poolDir, "metadata.json"), { force: true }).catch(() => {
28698
+ await rm5(path41.join(poolDir, "metadata.json"), { force: true }).catch(() => {
28266
28699
  });
28267
28700
  }
28268
28701
  /**
@@ -28272,7 +28705,7 @@ var WorkspacePoolManager = class {
28272
28705
  */
28273
28706
  async resetSlot(slotPath, templatePath, repos, poolReset = "fast") {
28274
28707
  for (const repo of repos) {
28275
- const repoDir = path39.join(slotPath, repo.path);
28708
+ const repoDir = path41.join(slotPath, repo.path);
28276
28709
  if (!existsSync2(repoDir)) {
28277
28710
  continue;
28278
28711
  }
@@ -28393,7 +28826,7 @@ ${lines.join("\n")}`;
28393
28826
  * Handles checkout, ref resolution, ancestor walking, shallow clone, sparse checkout.
28394
28827
  */
28395
28828
  async materialize(repo, workspacePath) {
28396
- const targetDir = path40.join(workspacePath, repo.path);
28829
+ const targetDir = path422.join(workspacePath, repo.path);
28397
28830
  const sourceUrl = getSourceUrl(repo.source);
28398
28831
  const startedAt = Date.now();
28399
28832
  if (this.verbose) {
@@ -28484,7 +28917,7 @@ ${lines.join("\n")}`;
28484
28917
  async reset(repos, workspacePath, reset) {
28485
28918
  const cleanFlag = reset === "strict" ? "-fdx" : "-fd";
28486
28919
  for (const repo of repos) {
28487
- const targetDir = path40.join(workspacePath, repo.path);
28920
+ const targetDir = path422.join(workspacePath, repo.path);
28488
28921
  await this.runGit(["reset", "--hard", "HEAD"], { cwd: targetDir });
28489
28922
  await this.runGit(["clean", cleanFlag], { cwd: targetDir });
28490
28923
  }
@@ -28494,30 +28927,30 @@ async function resolveWorkspaceTemplate(templatePath) {
28494
28927
  if (!templatePath) {
28495
28928
  return void 0;
28496
28929
  }
28497
- const resolved = path41.resolve(templatePath);
28498
- const stats = await stat6(resolved);
28930
+ const resolved = path43.resolve(templatePath);
28931
+ const stats = await stat7(resolved);
28499
28932
  if (stats.isFile()) {
28500
28933
  return {
28501
- dir: path41.dirname(resolved),
28934
+ dir: path43.dirname(resolved),
28502
28935
  workspaceFile: resolved
28503
28936
  };
28504
28937
  }
28505
28938
  if (!stats.isDirectory()) {
28506
28939
  throw new Error(`workspace template is neither a file nor a directory: ${resolved}`);
28507
28940
  }
28508
- const entries = await readdir5(resolved);
28941
+ const entries = await readdir6(resolved);
28509
28942
  const workspaceFiles = entries.filter((e) => e.endsWith(".code-workspace"));
28510
28943
  if (workspaceFiles.length === 1) {
28511
28944
  return {
28512
28945
  dir: resolved,
28513
- workspaceFile: path41.join(resolved, workspaceFiles[0])
28946
+ workspaceFile: path43.join(resolved, workspaceFiles[0])
28514
28947
  };
28515
28948
  }
28516
28949
  if (workspaceFiles.length > 1) {
28517
28950
  const conventionFile = workspaceFiles.find((f) => f === "template.code-workspace");
28518
28951
  return {
28519
28952
  dir: resolved,
28520
- workspaceFile: conventionFile ? path41.join(resolved, conventionFile) : void 0
28953
+ workspaceFile: conventionFile ? path43.join(resolved, conventionFile) : void 0
28521
28954
  };
28522
28955
  }
28523
28956
  return { dir: resolved };
@@ -28729,7 +29162,7 @@ async function runEvaluation(options) {
28729
29162
  ];
28730
29163
  const evaluatorRegistry = buildEvaluatorRegistry(evaluators, resolveGraderProvider);
28731
29164
  const typeRegistry = createBuiltinRegistry();
28732
- const discoveryBaseDir = evalFilePath ? path422.dirname(path422.resolve(evalFilePath)) : process.cwd();
29165
+ const discoveryBaseDir = evalFilePath ? path44.dirname(path44.resolve(evalFilePath)) : process.cwd();
28733
29166
  const evalDir = discoveryBaseDir;
28734
29167
  await discoverAssertions(typeRegistry, discoveryBaseDir);
28735
29168
  await discoverGraders(typeRegistry, discoveryBaseDir);
@@ -28869,11 +29302,11 @@ async function runEvaluation(options) {
28869
29302
  let staticMaterialised = false;
28870
29303
  if (useStaticWorkspace && configuredStaticPath) {
28871
29304
  const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
28872
- const dirExists = await stat7(configuredStaticPath).then(
29305
+ const dirExists = await stat8(configuredStaticPath).then(
28873
29306
  (s) => s.isDirectory(),
28874
29307
  () => false
28875
29308
  );
28876
- const isEmpty = dirExists ? (await readdir6(configuredStaticPath)).length === 0 : false;
29309
+ const isEmpty = dirExists ? (await readdir7(configuredStaticPath)).length === 0 : false;
28877
29310
  if (isYamlConfiguredPath && (!dirExists || isEmpty)) {
28878
29311
  if (!dirExists) {
28879
29312
  await mkdir14(configuredStaticPath, { recursive: true });
@@ -28926,9 +29359,9 @@ async function runEvaluation(options) {
28926
29359
  }
28927
29360
  try {
28928
29361
  if (suiteWorkspaceFile && sharedWorkspacePath) {
28929
- const copiedWorkspaceFile = path422.join(sharedWorkspacePath, path422.basename(suiteWorkspaceFile));
29362
+ const copiedWorkspaceFile = path44.join(sharedWorkspacePath, path44.basename(suiteWorkspaceFile));
28930
29363
  try {
28931
- await stat7(copiedWorkspaceFile);
29364
+ await stat8(copiedWorkspaceFile);
28932
29365
  suiteWorkspaceFile = copiedWorkspaceFile;
28933
29366
  } catch {
28934
29367
  }
@@ -29508,9 +29941,9 @@ async function runEvalCase(options) {
29508
29941
  );
29509
29942
  }
29510
29943
  if (caseWorkspaceFile && workspacePath) {
29511
- const copiedFile = path422.join(workspacePath, path422.basename(caseWorkspaceFile));
29944
+ const copiedFile = path44.join(workspacePath, path44.basename(caseWorkspaceFile));
29512
29945
  try {
29513
- await stat7(copiedFile);
29946
+ await stat8(copiedFile);
29514
29947
  caseWorkspaceFile = copiedFile;
29515
29948
  } catch {
29516
29949
  }
@@ -29570,10 +30003,10 @@ async function runEvalCase(options) {
29570
30003
  const files = evalCase.metadata.agent_skills_files;
29571
30004
  if (baseDir && files.length > 0) {
29572
30005
  for (const relPath of files) {
29573
- const srcPath = path422.resolve(baseDir, relPath);
29574
- const destPath = path422.resolve(workspacePath, relPath);
30006
+ const srcPath = path44.resolve(baseDir, relPath);
30007
+ const destPath = path44.resolve(workspacePath, relPath);
29575
30008
  try {
29576
- await mkdir14(path422.dirname(destPath), { recursive: true });
30009
+ await mkdir14(path44.dirname(destPath), { recursive: true });
29577
30010
  await copyFile2(srcPath, destPath);
29578
30011
  } catch (error) {
29579
30012
  const message = error instanceof Error ? error.message : String(error);
@@ -30219,7 +30652,7 @@ async function runEvaluatorList(options) {
30219
30652
  fileChanges,
30220
30653
  workspacePath
30221
30654
  };
30222
- const evalFileDir = evalCase.file_paths[0] ? path422.dirname(evalCase.file_paths[0]) : process.cwd();
30655
+ const evalFileDir = evalCase.file_paths[0] ? path44.dirname(evalCase.file_paths[0]) : process.cwd();
30223
30656
  const dispatchContext = {
30224
30657
  graderProvider,
30225
30658
  targetResolver,
@@ -30582,7 +31015,7 @@ async function evaluate(config) {
30582
31015
  }
30583
31016
  const gitRoot = await findGitRoot(process.cwd());
30584
31017
  const repoRoot = gitRoot ?? process.cwd();
30585
- const testFilePath = config.specFile ? path43.resolve(config.specFile) : path43.join(process.cwd(), "__programmatic__.yaml");
31018
+ const testFilePath = config.specFile ? path45.resolve(config.specFile) : path45.join(process.cwd(), "__programmatic__.yaml");
30586
31019
  await loadEnvHierarchy(repoRoot, testFilePath);
30587
31020
  let resolvedTarget;
30588
31021
  let taskProvider;
@@ -30703,10 +31136,10 @@ function computeSummary(results, durationMs) {
30703
31136
  var TARGET_FILE_CANDIDATES = [".agentv/targets.yaml", ".agentv/targets.yml"];
30704
31137
  async function discoverDefaultTarget(repoRoot) {
30705
31138
  const cwd = process.cwd();
30706
- const chain = buildDirectoryChain(path43.join(cwd, "_placeholder"), repoRoot);
31139
+ const chain = buildDirectoryChain(path45.join(cwd, "_placeholder"), repoRoot);
30707
31140
  for (const dir of chain) {
30708
31141
  for (const candidate of TARGET_FILE_CANDIDATES) {
30709
- const targetsPath = path43.join(dir, candidate);
31142
+ const targetsPath = path45.join(dir, candidate);
30710
31143
  if (!existsSync4(targetsPath)) continue;
30711
31144
  try {
30712
31145
  const definitions = await readTargetDefinitions(targetsPath);
@@ -30723,7 +31156,7 @@ async function loadEnvHierarchy(repoRoot, startPath) {
30723
31156
  const chain = buildDirectoryChain(startPath, repoRoot);
30724
31157
  const envFiles = [];
30725
31158
  for (const dir of chain) {
30726
- const envPath = path43.join(dir, ".env");
31159
+ const envPath = path45.join(dir, ".env");
30727
31160
  if (existsSync4(envPath)) envFiles.push(envPath);
30728
31161
  }
30729
31162
  for (let i = 0; i < envFiles.length; i++) {
@@ -30902,7 +31335,7 @@ var ResponseCache = class {
30902
31335
  async get(key) {
30903
31336
  const filePath = this.keyToPath(key);
30904
31337
  try {
30905
- const data = await readFile11(filePath, "utf8");
31338
+ const data = await readFile13(filePath, "utf8");
30906
31339
  return JSON.parse(data);
30907
31340
  } catch {
30908
31341
  return void 0;
@@ -30910,13 +31343,13 @@ var ResponseCache = class {
30910
31343
  }
30911
31344
  async set(key, value) {
30912
31345
  const filePath = this.keyToPath(key);
30913
- const dir = path44.dirname(filePath);
31346
+ const dir = path46.dirname(filePath);
30914
31347
  await mkdir15(dir, { recursive: true });
30915
31348
  await writeFile8(filePath, JSON.stringify(value, null, 2), "utf8");
30916
31349
  }
30917
31350
  keyToPath(key) {
30918
31351
  const prefix = key.slice(0, 2);
30919
- return path44.join(this.cachePath, prefix, `${key}.json`);
31352
+ return path46.join(this.cachePath, prefix, `${key}.json`);
30920
31353
  }
30921
31354
  };
30922
31355
  function shouldEnableCache(params) {
@@ -31530,6 +31963,7 @@ export {
31530
31963
  subscribeToCodexLogEntries,
31531
31964
  consumeCopilotCliLogEntries,
31532
31965
  subscribeToCopilotCliLogEntries,
31966
+ discoverCopilotSessions,
31533
31967
  consumeCopilotSdkLogEntries,
31534
31968
  subscribeToCopilotSdkLogEntries,
31535
31969
  consumePiLogEntries,
@@ -31622,4 +32056,4 @@ export {
31622
32056
  OtelStreamingObserver,
31623
32057
  createAgentKernel
31624
32058
  };
31625
- //# sourceMappingURL=chunk-D3LNJUUB.js.map
32059
+ //# sourceMappingURL=chunk-ELQEFMGO.js.map