agentv 2.5.4 → 2.5.6

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.
@@ -1,11 +1,13 @@
1
1
  import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  __commonJS,
4
+ __esm,
4
5
  __export,
5
6
  __require,
7
+ __toCommonJS,
6
8
  __toESM,
7
9
  require_token_error
8
- } from "./chunk-LTPZBEJU.js";
10
+ } from "./chunk-BKMQNEUD.js";
9
11
 
10
12
  // ../../node_modules/.bun/didyoumean@1.2.2/node_modules/didyoumean/didYouMean-1.2.1.js
11
13
  var require_didYouMean_1_2_1 = __commonJS({
@@ -228,7 +230,7 @@ var require_ms = __commonJS({
228
230
  var require_common = __commonJS({
229
231
  "../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/common.js"(exports, module) {
230
232
  "use strict";
231
- function setup(env2) {
233
+ function setup(env3) {
232
234
  createDebug.debug = createDebug;
233
235
  createDebug.default = createDebug;
234
236
  createDebug.coerce = coerce2;
@@ -237,8 +239,8 @@ var require_common = __commonJS({
237
239
  createDebug.enabled = enabled;
238
240
  createDebug.humanize = require_ms();
239
241
  createDebug.destroy = destroy;
240
- Object.keys(env2).forEach((key) => {
241
- createDebug[key] = env2[key];
242
+ Object.keys(env3).forEach((key) => {
243
+ createDebug[key] = env3[key];
242
244
  });
243
245
  createDebug.names = [];
244
246
  createDebug.skips = [];
@@ -573,11 +575,161 @@ var require_browser = __commonJS({
573
575
  }
574
576
  });
575
577
 
578
+ // ../../node_modules/.bun/supports-color@10.2.2/node_modules/supports-color/index.js
579
+ var supports_color_exports = {};
580
+ __export(supports_color_exports, {
581
+ createSupportsColor: () => createSupportsColor2,
582
+ default: () => supports_color_default2
583
+ });
584
+ import process3 from "node:process";
585
+ import os2 from "node:os";
586
+ import tty2 from "node:tty";
587
+ function hasFlag2(flag2, argv = globalThis.Deno ? globalThis.Deno.args : process3.argv) {
588
+ const prefix = flag2.startsWith("-") ? "" : flag2.length === 1 ? "-" : "--";
589
+ const position = argv.indexOf(prefix + flag2);
590
+ const terminatorPosition = argv.indexOf("--");
591
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
592
+ }
593
+ function envForceColor2() {
594
+ if (!("FORCE_COLOR" in env2)) {
595
+ return;
596
+ }
597
+ if (env2.FORCE_COLOR === "true") {
598
+ return 1;
599
+ }
600
+ if (env2.FORCE_COLOR === "false") {
601
+ return 0;
602
+ }
603
+ if (env2.FORCE_COLOR.length === 0) {
604
+ return 1;
605
+ }
606
+ const level = Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
607
+ if (![0, 1, 2, 3].includes(level)) {
608
+ return;
609
+ }
610
+ return level;
611
+ }
612
+ function translateLevel2(level) {
613
+ if (level === 0) {
614
+ return false;
615
+ }
616
+ return {
617
+ level,
618
+ hasBasic: true,
619
+ has256: level >= 2,
620
+ has16m: level >= 3
621
+ };
622
+ }
623
+ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
624
+ const noFlagForceColor = envForceColor2();
625
+ if (noFlagForceColor !== void 0) {
626
+ flagForceColor2 = noFlagForceColor;
627
+ }
628
+ const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
629
+ if (forceColor === 0) {
630
+ return 0;
631
+ }
632
+ if (sniffFlags) {
633
+ if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
634
+ return 3;
635
+ }
636
+ if (hasFlag2("color=256")) {
637
+ return 2;
638
+ }
639
+ }
640
+ if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
641
+ return 1;
642
+ }
643
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
644
+ return 0;
645
+ }
646
+ const min = forceColor || 0;
647
+ if (env2.TERM === "dumb") {
648
+ return min;
649
+ }
650
+ if (process3.platform === "win32") {
651
+ const osRelease = os2.release().split(".");
652
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
653
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
654
+ }
655
+ return 1;
656
+ }
657
+ if ("CI" in env2) {
658
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env2)) {
659
+ return 3;
660
+ }
661
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
662
+ return 1;
663
+ }
664
+ return min;
665
+ }
666
+ if ("TEAMCITY_VERSION" in env2) {
667
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
668
+ }
669
+ if (env2.COLORTERM === "truecolor") {
670
+ return 3;
671
+ }
672
+ if (env2.TERM === "xterm-kitty") {
673
+ return 3;
674
+ }
675
+ if (env2.TERM === "xterm-ghostty") {
676
+ return 3;
677
+ }
678
+ if (env2.TERM === "wezterm") {
679
+ return 3;
680
+ }
681
+ if ("TERM_PROGRAM" in env2) {
682
+ const version2 = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
683
+ switch (env2.TERM_PROGRAM) {
684
+ case "iTerm.app": {
685
+ return version2 >= 3 ? 3 : 2;
686
+ }
687
+ case "Apple_Terminal": {
688
+ return 2;
689
+ }
690
+ }
691
+ }
692
+ if (/-256(color)?$/i.test(env2.TERM)) {
693
+ return 2;
694
+ }
695
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
696
+ return 1;
697
+ }
698
+ if ("COLORTERM" in env2) {
699
+ return 1;
700
+ }
701
+ return min;
702
+ }
703
+ function createSupportsColor2(stream, options = {}) {
704
+ const level = _supportsColor2(stream, {
705
+ streamIsTTY: stream && stream.isTTY,
706
+ ...options
707
+ });
708
+ return translateLevel2(level);
709
+ }
710
+ var env2, flagForceColor2, supportsColor2, supports_color_default2;
711
+ var init_supports_color = __esm({
712
+ "../../node_modules/.bun/supports-color@10.2.2/node_modules/supports-color/index.js"() {
713
+ "use strict";
714
+ ({ env: env2 } = process3);
715
+ if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
716
+ flagForceColor2 = 0;
717
+ } else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
718
+ flagForceColor2 = 1;
719
+ }
720
+ supportsColor2 = {
721
+ stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
722
+ stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
723
+ };
724
+ supports_color_default2 = supportsColor2;
725
+ }
726
+ });
727
+
576
728
  // ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/node.js
577
729
  var require_node = __commonJS({
578
730
  "../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/node.js"(exports, module) {
579
731
  "use strict";
580
- var tty2 = __require("tty");
732
+ var tty3 = __require("tty");
581
733
  var util2 = __require("util");
582
734
  exports.init = init;
583
735
  exports.log = log;
@@ -592,8 +744,8 @@ var require_node = __commonJS({
592
744
  );
593
745
  exports.colors = [6, 2, 3, 4, 5, 1];
594
746
  try {
595
- const supportsColor2 = __require("supports-color");
596
- if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
747
+ const supportsColor3 = (init_supports_color(), __toCommonJS(supports_color_exports));
748
+ if (supportsColor3 && (supportsColor3.stderr || supportsColor3).level >= 2) {
597
749
  exports.colors = [
598
750
  20,
599
751
  21,
@@ -695,7 +847,7 @@ var require_node = __commonJS({
695
847
  return obj;
696
848
  }, {});
697
849
  function useColors() {
698
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty2.isatty(process.stderr.fd);
850
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty3.isatty(process.stderr.fd);
699
851
  }
700
852
  function formatArgs(args) {
701
853
  const { namespace: name16, useColors: useColors2 } = this;
@@ -780,13 +932,13 @@ var require_get_context = __commonJS({
780
932
  }
781
933
  return to;
782
934
  };
783
- var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
935
+ var __toCommonJS2 = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
784
936
  var get_context_exports = {};
785
937
  __export3(get_context_exports, {
786
938
  SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
787
939
  getContext: () => getContext3
788
940
  });
789
- module.exports = __toCommonJS(get_context_exports);
941
+ module.exports = __toCommonJS2(get_context_exports);
790
942
  var SYMBOL_FOR_REQ_CONTEXT = Symbol.for("@vercel/request-context");
791
943
  function getContext3() {
792
944
  const fromSymbol = globalThis;
@@ -815,13 +967,13 @@ var require_get_vercel_oidc_token = __commonJS({
815
967
  }
816
968
  return to;
817
969
  };
818
- var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
970
+ var __toCommonJS2 = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
819
971
  var get_vercel_oidc_token_exports = {};
820
972
  __export3(get_vercel_oidc_token_exports, {
821
973
  getVercelOidcToken: () => getVercelOidcToken3,
822
974
  getVercelOidcTokenSync: () => getVercelOidcTokenSync2
823
975
  });
824
- module.exports = __toCommonJS(get_vercel_oidc_token_exports);
976
+ module.exports = __toCommonJS2(get_vercel_oidc_token_exports);
825
977
  var import_get_context = require_get_context();
826
978
  var import_token_error = require_token_error();
827
979
  async function getVercelOidcToken3() {
@@ -834,8 +986,8 @@ var require_get_vercel_oidc_token = __commonJS({
834
986
  }
835
987
  try {
836
988
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
837
- await import("./token-util-YEKFTEJA.js"),
838
- await import("./token-DVVSDOYP.js")
989
+ await import("./token-util-FWFPR2BV.js"),
990
+ await import("./token-D3IYDJQZ.js")
839
991
  ]);
840
992
  if (!token || isExpired(getTokenPayload(token))) {
841
993
  await refreshToken();
@@ -882,14 +1034,14 @@ var require_dist = __commonJS({
882
1034
  }
883
1035
  return to;
884
1036
  };
885
- var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
1037
+ var __toCommonJS2 = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
886
1038
  var src_exports = {};
887
1039
  __export3(src_exports, {
888
1040
  getContext: () => import_get_context.getContext,
889
1041
  getVercelOidcToken: () => import_get_vercel_oidc_token.getVercelOidcToken,
890
1042
  getVercelOidcTokenSync: () => import_get_vercel_oidc_token.getVercelOidcTokenSync
891
1043
  });
892
- module.exports = __toCommonJS(src_exports);
1044
+ module.exports = __toCommonJS2(src_exports);
893
1045
  var import_get_vercel_oidc_token = require_get_vercel_oidc_token();
894
1046
  var import_get_context = require_get_context();
895
1047
  }
@@ -1557,8 +1709,8 @@ function fullFlag(config2) {
1557
1709
  }
1558
1710
  const defaults = [];
1559
1711
  if (config2.env) {
1560
- const env2 = process.env[config2.env] === void 0 ? "" : `=${source_default.italic(process.env[config2.env])}`;
1561
- defaults.push(`env: ${config2.env}${env2}`);
1712
+ const env3 = process.env[config2.env] === void 0 ? "" : `=${source_default.italic(process.env[config2.env])}`;
1713
+ defaults.push(`env: ${config2.env}${env3}`);
1562
1714
  }
1563
1715
  if (config2.defaultValue) {
1564
1716
  try {
@@ -2175,8 +2327,8 @@ function fullOption(config2) {
2175
2327
  usage += ` <${displayName}>`;
2176
2328
  const defaults = [];
2177
2329
  if (config2.env) {
2178
- const env2 = process.env[config2.env] === void 0 ? "" : `=${source_default.italic(process.env[config2.env])}`;
2179
- defaults.push(`env: ${config2.env}${env2}`);
2330
+ const env3 = process.env[config2.env] === void 0 ? "" : `=${source_default.italic(process.env[config2.env])}`;
2331
+ defaults.push(`env: ${config2.env}${env3}`);
2180
2332
  }
2181
2333
  if (config2.defaultValue) {
2182
2334
  try {
@@ -2933,9 +3085,9 @@ var compareCommand = command({
2933
3085
 
2934
3086
  // src/commands/convert/index.ts
2935
3087
  import { readFileSync as readFileSync2, writeFileSync } from "node:fs";
2936
- import path26 from "node:path";
3088
+ import path27 from "node:path";
2937
3089
 
2938
- // ../../packages/core/dist/chunk-RP3M7COZ.js
3090
+ // ../../packages/core/dist/chunk-LGQ5OPJD.js
2939
3091
  import { constants } from "node:fs";
2940
3092
  import { access, readFile } from "node:fs/promises";
2941
3093
  import path from "node:path";
@@ -3419,8 +3571,8 @@ function getErrorMap() {
3419
3571
 
3420
3572
  // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
3421
3573
  var makeIssue = (params) => {
3422
- const { data, path: path40, errorMaps, issueData } = params;
3423
- const fullPath = [...path40, ...issueData.path || []];
3574
+ const { data, path: path41, errorMaps, issueData } = params;
3575
+ const fullPath = [...path41, ...issueData.path || []];
3424
3576
  const fullIssue = {
3425
3577
  ...issueData,
3426
3578
  path: fullPath
@@ -3536,11 +3688,11 @@ var errorUtil;
3536
3688
 
3537
3689
  // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
3538
3690
  var ParseInputLazyPath = class {
3539
- constructor(parent, value, path40, key) {
3691
+ constructor(parent, value, path41, key) {
3540
3692
  this._cachedPath = [];
3541
3693
  this.parent = parent;
3542
3694
  this.data = value;
3543
- this._path = path40;
3695
+ this._path = path41;
3544
3696
  this._key = key;
3545
3697
  }
3546
3698
  get path() {
@@ -6982,7 +7134,7 @@ var coerce = {
6982
7134
  };
6983
7135
  var NEVER = INVALID;
6984
7136
 
6985
- // ../../packages/core/dist/chunk-RP3M7COZ.js
7137
+ // ../../packages/core/dist/chunk-LGQ5OPJD.js
6986
7138
  async function fileExists(filePath) {
6987
7139
  try {
6988
7140
  await access(filePath, constants.F_OK);
@@ -7166,11 +7318,11 @@ var CliTargetConfigSchema = external_exports.object({
7166
7318
  verbose: external_exports.boolean().optional(),
7167
7319
  keepTempFiles: external_exports.boolean().optional()
7168
7320
  }).strict();
7169
- function normalizeCliHealthcheck(input, env2, targetName, evalFilePath) {
7321
+ function normalizeCliHealthcheck(input, env3, targetName, evalFilePath) {
7170
7322
  const timeoutSeconds = input.timeout_seconds ?? input.timeoutSeconds;
7171
7323
  const timeoutMs = timeoutSeconds !== void 0 ? Math.floor(timeoutSeconds * 1e3) : void 0;
7172
7324
  if (input.type === "http") {
7173
- const url2 = resolveString(input.url, env2, `${targetName} healthcheck URL`);
7325
+ const url2 = resolveString(input.url, env3, `${targetName} healthcheck URL`);
7174
7326
  return {
7175
7327
  type: "http",
7176
7328
  url: url2,
@@ -7185,11 +7337,11 @@ function normalizeCliHealthcheck(input, env2, targetName, evalFilePath) {
7185
7337
  }
7186
7338
  const commandTemplate = resolveString(
7187
7339
  commandTemplateSource,
7188
- env2,
7340
+ env3,
7189
7341
  `${targetName} healthcheck command template`,
7190
7342
  true
7191
7343
  );
7192
- let cwd = resolveOptionalString(input.cwd, env2, `${targetName} healthcheck cwd`, {
7344
+ let cwd = resolveOptionalString(input.cwd, env3, `${targetName} healthcheck cwd`, {
7193
7345
  allowLiteral: true,
7194
7346
  optionalEnv: true
7195
7347
  });
@@ -7206,7 +7358,7 @@ function normalizeCliHealthcheck(input, env2, targetName, evalFilePath) {
7206
7358
  timeoutMs
7207
7359
  };
7208
7360
  }
7209
- function normalizeCliTargetInput(input, env2, evalFilePath) {
7361
+ function normalizeCliTargetInput(input, env3, evalFilePath) {
7210
7362
  const targetName = input.name;
7211
7363
  const commandTemplateSource = input.command_template ?? input.commandTemplate;
7212
7364
  if (commandTemplateSource === void 0) {
@@ -7214,13 +7366,13 @@ function normalizeCliTargetInput(input, env2, evalFilePath) {
7214
7366
  }
7215
7367
  const commandTemplate = resolveString(
7216
7368
  commandTemplateSource,
7217
- env2,
7369
+ env3,
7218
7370
  `${targetName} CLI command template`,
7219
7371
  true
7220
7372
  );
7221
7373
  const filesFormatSource = input.files_format ?? input.filesFormat ?? input.attachments_format ?? input.attachmentsFormat;
7222
7374
  const filesFormat = resolveOptionalLiteralString(filesFormatSource);
7223
- let cwd = resolveOptionalString(input.cwd, env2, `${targetName} working directory`, {
7375
+ let cwd = resolveOptionalString(input.cwd, env3, `${targetName} working directory`, {
7224
7376
  allowLiteral: true,
7225
7377
  optionalEnv: true
7226
7378
  });
@@ -7236,7 +7388,7 @@ function normalizeCliTargetInput(input, env2, evalFilePath) {
7236
7388
  const keepTempFiles = resolveOptionalBoolean(
7237
7389
  input.keep_temp_files ?? input.keepTempFiles ?? input.keep_output_files ?? input.keepOutputFiles
7238
7390
  );
7239
- const healthcheck = input.healthcheck ? normalizeCliHealthcheck(input.healthcheck, env2, targetName, evalFilePath) : void 0;
7391
+ const healthcheck = input.healthcheck ? normalizeCliHealthcheck(input.healthcheck, env3, targetName, evalFilePath) : void 0;
7240
7392
  return {
7241
7393
  commandTemplate,
7242
7394
  filesFormat,
@@ -7305,7 +7457,7 @@ function resolveRetryConfig(target) {
7305
7457
  retryableStatusCodes
7306
7458
  };
7307
7459
  }
7308
- function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7460
+ function resolveTargetDefinition(definition, env3 = process.env, evalFilePath) {
7309
7461
  const parsed = BASE_TARGET_SCHEMA.parse(definition);
7310
7462
  const provider = parsed.provider.toLowerCase();
7311
7463
  const providerBatching = resolveOptionalBoolean(
@@ -7320,7 +7472,7 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7320
7472
  judgeTarget: parsed.judge_target,
7321
7473
  workers: parsed.workers,
7322
7474
  providerBatching,
7323
- config: resolveAzureConfig(parsed, env2)
7475
+ config: resolveAzureConfig(parsed, env3)
7324
7476
  };
7325
7477
  case "anthropic":
7326
7478
  return {
@@ -7329,7 +7481,7 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7329
7481
  judgeTarget: parsed.judge_target,
7330
7482
  workers: parsed.workers,
7331
7483
  providerBatching,
7332
- config: resolveAnthropicConfig(parsed, env2)
7484
+ config: resolveAnthropicConfig(parsed, env3)
7333
7485
  };
7334
7486
  case "gemini":
7335
7487
  case "google":
@@ -7340,7 +7492,7 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7340
7492
  judgeTarget: parsed.judge_target,
7341
7493
  workers: parsed.workers,
7342
7494
  providerBatching,
7343
- config: resolveGeminiConfig(parsed, env2)
7495
+ config: resolveGeminiConfig(parsed, env3)
7344
7496
  };
7345
7497
  case "codex":
7346
7498
  case "codex-cli":
@@ -7350,7 +7502,16 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7350
7502
  judgeTarget: parsed.judge_target,
7351
7503
  workers: parsed.workers,
7352
7504
  providerBatching,
7353
- config: resolveCodexConfig(parsed, env2)
7505
+ config: resolveCodexConfig(parsed, env3)
7506
+ };
7507
+ case "copilot-cli":
7508
+ return {
7509
+ kind: "copilot-cli",
7510
+ name: parsed.name,
7511
+ judgeTarget: parsed.judge_target,
7512
+ workers: parsed.workers,
7513
+ providerBatching,
7514
+ config: resolveCopilotConfig(parsed, env3)
7354
7515
  };
7355
7516
  case "pi":
7356
7517
  case "pi-coding-agent":
@@ -7360,7 +7521,7 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7360
7521
  judgeTarget: parsed.judge_target,
7361
7522
  workers: parsed.workers,
7362
7523
  providerBatching,
7363
- config: resolvePiCodingAgentConfig(parsed, env2)
7524
+ config: resolvePiCodingAgentConfig(parsed, env3)
7364
7525
  };
7365
7526
  case "pi-agent-sdk":
7366
7527
  return {
@@ -7369,7 +7530,7 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7369
7530
  judgeTarget: parsed.judge_target,
7370
7531
  workers: parsed.workers,
7371
7532
  providerBatching,
7372
- config: resolvePiAgentSdkConfig(parsed, env2)
7533
+ config: resolvePiAgentSdkConfig(parsed, env3)
7373
7534
  };
7374
7535
  case "claude-code":
7375
7536
  return {
@@ -7378,7 +7539,7 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7378
7539
  judgeTarget: parsed.judge_target,
7379
7540
  workers: parsed.workers,
7380
7541
  providerBatching,
7381
- config: resolveClaudeCodeConfig(parsed, env2)
7542
+ config: resolveClaudeCodeConfig(parsed, env3)
7382
7543
  };
7383
7544
  case "mock":
7384
7545
  return {
@@ -7397,7 +7558,7 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7397
7558
  judgeTarget: parsed.judge_target,
7398
7559
  workers: parsed.workers,
7399
7560
  providerBatching,
7400
- config: resolveVSCodeConfig(parsed, env2, provider === "vscode-insiders")
7561
+ config: resolveVSCodeConfig(parsed, env3, provider === "vscode-insiders")
7401
7562
  };
7402
7563
  case "cli":
7403
7564
  return {
@@ -7406,24 +7567,24 @@ function resolveTargetDefinition(definition, env2 = process.env, evalFilePath) {
7406
7567
  judgeTarget: parsed.judge_target,
7407
7568
  workers: parsed.workers,
7408
7569
  providerBatching,
7409
- config: resolveCliConfig(parsed, env2, evalFilePath)
7570
+ config: resolveCliConfig(parsed, env3, evalFilePath)
7410
7571
  };
7411
7572
  default:
7412
7573
  throw new Error(`Unsupported provider '${parsed.provider}' in target '${parsed.name}'`);
7413
7574
  }
7414
7575
  }
7415
- function resolveAzureConfig(target, env2) {
7576
+ function resolveAzureConfig(target, env3) {
7416
7577
  const endpointSource = target.endpoint ?? target.resource ?? target.resourceName;
7417
7578
  const apiKeySource = target.api_key ?? target.apiKey;
7418
7579
  const deploymentSource = target.deployment ?? target.deploymentName ?? target.model;
7419
7580
  const versionSource = target.version ?? target.api_version;
7420
7581
  const temperatureSource = target.temperature;
7421
7582
  const maxTokensSource = target.max_output_tokens ?? target.maxTokens;
7422
- const resourceName = resolveString(endpointSource, env2, `${target.name} endpoint`);
7423
- const apiKey = resolveString(apiKeySource, env2, `${target.name} api key`);
7424
- const deploymentName = resolveString(deploymentSource, env2, `${target.name} deployment`);
7583
+ const resourceName = resolveString(endpointSource, env3, `${target.name} endpoint`);
7584
+ const apiKey = resolveString(apiKeySource, env3, `${target.name} api key`);
7585
+ const deploymentName = resolveString(deploymentSource, env3, `${target.name} deployment`);
7425
7586
  const version2 = normalizeAzureApiVersion(
7426
- resolveOptionalString(versionSource, env2, `${target.name} api version`, {
7587
+ resolveOptionalString(versionSource, env3, `${target.name} api version`, {
7427
7588
  allowLiteral: true,
7428
7589
  optionalEnv: true
7429
7590
  })
@@ -7444,14 +7605,14 @@ function resolveAzureConfig(target, env2) {
7444
7605
  retry
7445
7606
  };
7446
7607
  }
7447
- function resolveAnthropicConfig(target, env2) {
7608
+ function resolveAnthropicConfig(target, env3) {
7448
7609
  const apiKeySource = target.api_key ?? target.apiKey;
7449
7610
  const modelSource = target.model ?? target.deployment ?? target.variant;
7450
7611
  const temperatureSource = target.temperature;
7451
7612
  const maxTokensSource = target.max_output_tokens ?? target.maxTokens;
7452
7613
  const thinkingBudgetSource = target.thinking_budget ?? target.thinkingBudget;
7453
- const apiKey = resolveString(apiKeySource, env2, `${target.name} Anthropic api key`);
7454
- const model = resolveString(modelSource, env2, `${target.name} Anthropic model`);
7614
+ const apiKey = resolveString(apiKeySource, env3, `${target.name} Anthropic api key`);
7615
+ const model = resolveString(modelSource, env3, `${target.name} Anthropic model`);
7455
7616
  const retry = resolveRetryConfig(target);
7456
7617
  return {
7457
7618
  apiKey,
@@ -7462,13 +7623,13 @@ function resolveAnthropicConfig(target, env2) {
7462
7623
  retry
7463
7624
  };
7464
7625
  }
7465
- function resolveGeminiConfig(target, env2) {
7626
+ function resolveGeminiConfig(target, env3) {
7466
7627
  const apiKeySource = target.api_key ?? target.apiKey;
7467
7628
  const modelSource = target.model ?? target.deployment ?? target.variant;
7468
7629
  const temperatureSource = target.temperature;
7469
7630
  const maxTokensSource = target.max_output_tokens ?? target.maxTokens;
7470
- const apiKey = resolveString(apiKeySource, env2, `${target.name} Google API key`);
7471
- const model = resolveOptionalString(modelSource, env2, `${target.name} Gemini model`, {
7631
+ const apiKey = resolveString(apiKeySource, env3, `${target.name} Google API key`);
7632
+ const model = resolveOptionalString(modelSource, env3, `${target.name} Gemini model`, {
7472
7633
  allowLiteral: true,
7473
7634
  optionalEnv: true
7474
7635
  }) ?? "gemini-2.5-flash";
@@ -7481,25 +7642,25 @@ function resolveGeminiConfig(target, env2) {
7481
7642
  retry
7482
7643
  };
7483
7644
  }
7484
- function resolveCodexConfig(target, env2) {
7645
+ function resolveCodexConfig(target, env3) {
7485
7646
  const executableSource = target.executable ?? target.command ?? target.binary;
7486
7647
  const argsSource = target.args ?? target.arguments;
7487
7648
  const cwdSource = target.cwd;
7488
7649
  const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;
7489
7650
  const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
7490
- const logFormatSource = target.log_format ?? target.logFormat ?? target.log_output_format ?? target.logOutputFormat ?? env2.AGENTV_CODEX_LOG_FORMAT;
7651
+ const logFormatSource = target.log_format ?? target.logFormat ?? target.log_output_format ?? target.logOutputFormat ?? env3.AGENTV_CODEX_LOG_FORMAT;
7491
7652
  const systemPromptSource = target.system_prompt ?? target.systemPrompt;
7492
- const executable = resolveOptionalString(executableSource, env2, `${target.name} codex executable`, {
7653
+ const executable = resolveOptionalString(executableSource, env3, `${target.name} codex executable`, {
7493
7654
  allowLiteral: true,
7494
7655
  optionalEnv: true
7495
7656
  }) ?? "codex";
7496
- const args = resolveOptionalStringArray(argsSource, env2, `${target.name} codex args`);
7497
- const cwd = resolveOptionalString(cwdSource, env2, `${target.name} codex cwd`, {
7657
+ const args = resolveOptionalStringArray(argsSource, env3, `${target.name} codex args`);
7658
+ const cwd = resolveOptionalString(cwdSource, env3, `${target.name} codex cwd`, {
7498
7659
  allowLiteral: true,
7499
7660
  optionalEnv: true
7500
7661
  });
7501
7662
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} codex timeout`);
7502
- const logDir = resolveOptionalString(logDirSource, env2, `${target.name} codex log directory`, {
7663
+ const logDir = resolveOptionalString(logDirSource, env3, `${target.name} codex log directory`, {
7503
7664
  allowLiteral: true,
7504
7665
  optionalEnv: true
7505
7666
  });
@@ -7528,7 +7689,45 @@ function normalizeCodexLogFormat(value) {
7528
7689
  }
7529
7690
  throw new Error("codex log format must be 'summary' or 'json'");
7530
7691
  }
7531
- function resolvePiCodingAgentConfig(target, env2) {
7692
+ function resolveCopilotConfig(target, env3) {
7693
+ const executableSource = target.executable ?? target.command ?? target.binary;
7694
+ const modelSource = target.model;
7695
+ const argsSource = target.args ?? target.arguments;
7696
+ const cwdSource = target.cwd;
7697
+ const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;
7698
+ const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
7699
+ const logFormatSource = target.log_format ?? target.logFormat ?? target.log_output_format ?? target.logOutputFormat;
7700
+ const systemPromptSource = target.system_prompt ?? target.systemPrompt;
7701
+ const executable = resolveOptionalString(executableSource, env3, `${target.name} copilot executable`, {
7702
+ allowLiteral: true,
7703
+ optionalEnv: true
7704
+ }) ?? "copilot";
7705
+ const model = resolveOptionalString(modelSource, env3, `${target.name} copilot model`, {
7706
+ allowLiteral: true,
7707
+ optionalEnv: true
7708
+ });
7709
+ const args = resolveOptionalStringArray(argsSource, env3, `${target.name} copilot args`);
7710
+ const cwd = resolveOptionalString(cwdSource, env3, `${target.name} copilot cwd`, {
7711
+ allowLiteral: true,
7712
+ optionalEnv: true
7713
+ });
7714
+ const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} copilot timeout`);
7715
+ const logDir = resolveOptionalString(logDirSource, env3, `${target.name} copilot log directory`, {
7716
+ allowLiteral: true,
7717
+ optionalEnv: true
7718
+ });
7719
+ const logFormat = normalizeCopilotLogFormat(logFormatSource);
7720
+ const systemPrompt = typeof systemPromptSource === "string" && systemPromptSource.trim().length > 0 ? systemPromptSource.trim() : void 0;
7721
+ return { executable, model, args, cwd, timeoutMs, logDir, logFormat, systemPrompt };
7722
+ }
7723
+ function normalizeCopilotLogFormat(value) {
7724
+ if (value === void 0 || value === null) return void 0;
7725
+ if (typeof value !== "string") throw new Error("copilot log format must be 'summary' or 'json'");
7726
+ const normalized = value.trim().toLowerCase();
7727
+ if (normalized === "json" || normalized === "summary") return normalized;
7728
+ throw new Error("copilot log format must be 'summary' or 'json'");
7729
+ }
7730
+ function resolvePiCodingAgentConfig(target, env3) {
7532
7731
  const executableSource = target.executable ?? target.command ?? target.binary;
7533
7732
  const providerSource = target.pi_provider ?? target.piProvider ?? target.llm_provider;
7534
7733
  const modelSource = target.model ?? target.pi_model ?? target.piModel;
@@ -7541,37 +7740,37 @@ function resolvePiCodingAgentConfig(target, env2) {
7541
7740
  const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
7542
7741
  const logFormatSource = target.log_format ?? target.logFormat;
7543
7742
  const systemPromptSource = target.system_prompt ?? target.systemPrompt;
7544
- const executable = resolveOptionalString(executableSource, env2, `${target.name} pi executable`, {
7743
+ const executable = resolveOptionalString(executableSource, env3, `${target.name} pi executable`, {
7545
7744
  allowLiteral: true,
7546
7745
  optionalEnv: true
7547
7746
  }) ?? "pi";
7548
- const provider = resolveOptionalString(providerSource, env2, `${target.name} pi provider`, {
7747
+ const provider = resolveOptionalString(providerSource, env3, `${target.name} pi provider`, {
7549
7748
  allowLiteral: true,
7550
7749
  optionalEnv: true
7551
7750
  });
7552
- const model = resolveOptionalString(modelSource, env2, `${target.name} pi model`, {
7751
+ const model = resolveOptionalString(modelSource, env3, `${target.name} pi model`, {
7553
7752
  allowLiteral: true,
7554
7753
  optionalEnv: true
7555
7754
  });
7556
- const apiKey = resolveOptionalString(apiKeySource, env2, `${target.name} pi api key`, {
7755
+ const apiKey = resolveOptionalString(apiKeySource, env3, `${target.name} pi api key`, {
7557
7756
  allowLiteral: false,
7558
7757
  optionalEnv: true
7559
7758
  });
7560
- const tools = resolveOptionalString(toolsSource, env2, `${target.name} pi tools`, {
7759
+ const tools = resolveOptionalString(toolsSource, env3, `${target.name} pi tools`, {
7561
7760
  allowLiteral: true,
7562
7761
  optionalEnv: true
7563
7762
  });
7564
- const thinking = resolveOptionalString(thinkingSource, env2, `${target.name} pi thinking`, {
7763
+ const thinking = resolveOptionalString(thinkingSource, env3, `${target.name} pi thinking`, {
7565
7764
  allowLiteral: true,
7566
7765
  optionalEnv: true
7567
7766
  });
7568
- const args = resolveOptionalStringArray(argsSource, env2, `${target.name} pi args`);
7569
- const cwd = resolveOptionalString(cwdSource, env2, `${target.name} pi cwd`, {
7767
+ const args = resolveOptionalStringArray(argsSource, env3, `${target.name} pi args`);
7768
+ const cwd = resolveOptionalString(cwdSource, env3, `${target.name} pi cwd`, {
7570
7769
  allowLiteral: true,
7571
7770
  optionalEnv: true
7572
7771
  });
7573
7772
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} pi timeout`);
7574
- const logDir = resolveOptionalString(logDirSource, env2, `${target.name} pi log directory`, {
7773
+ const logDir = resolveOptionalString(logDirSource, env3, `${target.name} pi log directory`, {
7575
7774
  allowLiteral: true,
7576
7775
  optionalEnv: true
7577
7776
  });
@@ -7592,7 +7791,7 @@ function resolvePiCodingAgentConfig(target, env2) {
7592
7791
  systemPrompt
7593
7792
  };
7594
7793
  }
7595
- function resolvePiAgentSdkConfig(target, env2) {
7794
+ function resolvePiAgentSdkConfig(target, env3) {
7596
7795
  const providerSource = target.pi_provider ?? target.piProvider ?? target.llm_provider;
7597
7796
  const modelSource = target.model ?? target.pi_model ?? target.piModel;
7598
7797
  const apiKeySource = target.api_key ?? target.apiKey;
@@ -7600,18 +7799,18 @@ function resolvePiAgentSdkConfig(target, env2) {
7600
7799
  const systemPromptSource = target.system_prompt ?? target.systemPrompt;
7601
7800
  const provider = resolveOptionalString(
7602
7801
  providerSource,
7603
- env2,
7802
+ env3,
7604
7803
  `${target.name} pi-agent-sdk provider`,
7605
7804
  {
7606
7805
  allowLiteral: true,
7607
7806
  optionalEnv: true
7608
7807
  }
7609
7808
  );
7610
- const model = resolveOptionalString(modelSource, env2, `${target.name} pi-agent-sdk model`, {
7809
+ const model = resolveOptionalString(modelSource, env3, `${target.name} pi-agent-sdk model`, {
7611
7810
  allowLiteral: true,
7612
7811
  optionalEnv: true
7613
7812
  });
7614
- const apiKey = resolveOptionalString(apiKeySource, env2, `${target.name} pi-agent-sdk api key`, {
7813
+ const apiKey = resolveOptionalString(apiKeySource, env3, `${target.name} pi-agent-sdk api key`, {
7615
7814
  allowLiteral: false,
7616
7815
  optionalEnv: true
7617
7816
  });
@@ -7625,32 +7824,32 @@ function resolvePiAgentSdkConfig(target, env2) {
7625
7824
  systemPrompt
7626
7825
  };
7627
7826
  }
7628
- function resolveClaudeCodeConfig(target, env2) {
7827
+ function resolveClaudeCodeConfig(target, env3) {
7629
7828
  const executableSource = target.executable ?? target.command ?? target.binary;
7630
7829
  const modelSource = target.model;
7631
7830
  const argsSource = target.args ?? target.arguments;
7632
7831
  const cwdSource = target.cwd;
7633
7832
  const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;
7634
7833
  const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
7635
- const logFormatSource = target.log_format ?? target.logFormat ?? target.log_output_format ?? target.logOutputFormat ?? env2.AGENTV_CLAUDE_CODE_LOG_FORMAT;
7834
+ const logFormatSource = target.log_format ?? target.logFormat ?? target.log_output_format ?? target.logOutputFormat ?? env3.AGENTV_CLAUDE_CODE_LOG_FORMAT;
7636
7835
  const systemPromptSource = target.system_prompt ?? target.systemPrompt;
7637
- const executable = resolveOptionalString(executableSource, env2, `${target.name} claude-code executable`, {
7836
+ const executable = resolveOptionalString(executableSource, env3, `${target.name} claude-code executable`, {
7638
7837
  allowLiteral: true,
7639
7838
  optionalEnv: true
7640
7839
  }) ?? "claude";
7641
- const model = resolveOptionalString(modelSource, env2, `${target.name} claude-code model`, {
7840
+ const model = resolveOptionalString(modelSource, env3, `${target.name} claude-code model`, {
7642
7841
  allowLiteral: true,
7643
7842
  optionalEnv: true
7644
7843
  });
7645
- const args = resolveOptionalStringArray(argsSource, env2, `${target.name} claude-code args`);
7646
- const cwd = resolveOptionalString(cwdSource, env2, `${target.name} claude-code cwd`, {
7844
+ const args = resolveOptionalStringArray(argsSource, env3, `${target.name} claude-code args`);
7845
+ const cwd = resolveOptionalString(cwdSource, env3, `${target.name} claude-code cwd`, {
7647
7846
  allowLiteral: true,
7648
7847
  optionalEnv: true
7649
7848
  });
7650
7849
  const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} claude-code timeout`);
7651
7850
  const logDir = resolveOptionalString(
7652
7851
  logDirSource,
7653
- env2,
7852
+ env3,
7654
7853
  `${target.name} claude-code log directory`,
7655
7854
  {
7656
7855
  allowLiteral: true,
@@ -7687,13 +7886,13 @@ function resolveMockConfig(target) {
7687
7886
  const response = typeof target.response === "string" ? target.response : void 0;
7688
7887
  return { response };
7689
7888
  }
7690
- function resolveVSCodeConfig(target, env2, insiders) {
7889
+ function resolveVSCodeConfig(target, env3, insiders) {
7691
7890
  const workspaceTemplateEnvVar = resolveOptionalLiteralString(
7692
7891
  target.workspace_template ?? target.workspaceTemplate
7693
7892
  );
7694
7893
  const workspaceTemplate = workspaceTemplateEnvVar ? resolveOptionalString(
7695
7894
  workspaceTemplateEnvVar,
7696
- env2,
7895
+ env3,
7697
7896
  `${target.name} workspace template path`,
7698
7897
  {
7699
7898
  allowLiteral: false,
@@ -7710,7 +7909,7 @@ function resolveVSCodeConfig(target, env2, insiders) {
7710
7909
  command: command2,
7711
7910
  waitForResponse: resolveOptionalBoolean(waitSource) ?? true,
7712
7911
  dryRun: resolveOptionalBoolean(dryRunSource) ?? false,
7713
- subagentRoot: resolveOptionalString(subagentRootSource, env2, `${target.name} subagent root`, {
7912
+ subagentRoot: resolveOptionalString(subagentRootSource, env3, `${target.name} subagent root`, {
7714
7913
  allowLiteral: true,
7715
7914
  optionalEnv: true
7716
7915
  }),
@@ -7729,7 +7928,7 @@ var cliErrorMap = (issue2, ctx) => {
7729
7928
  }
7730
7929
  return { message: ctx.defaultError };
7731
7930
  };
7732
- function resolveCliConfig(target, env2, evalFilePath) {
7931
+ function resolveCliConfig(target, env3, evalFilePath) {
7733
7932
  const parseResult = CliTargetInputSchema.safeParse(target, { errorMap: cliErrorMap });
7734
7933
  if (!parseResult.success) {
7735
7934
  const firstError = parseResult.error.errors[0];
@@ -7737,7 +7936,7 @@ function resolveCliConfig(target, env2, evalFilePath) {
7737
7936
  const prefix = path310 ? `${target.name} ${path310}: ` : `${target.name}: `;
7738
7937
  throw new Error(`${prefix}${firstError?.message}`);
7739
7938
  }
7740
- const normalized = normalizeCliTargetInput(parseResult.data, env2, evalFilePath);
7939
+ const normalized = normalizeCliTargetInput(parseResult.data, env3, evalFilePath);
7741
7940
  assertSupportedCliPlaceholders(normalized.commandTemplate, `${target.name} CLI command template`);
7742
7941
  if (normalized.healthcheck?.type === "command") {
7743
7942
  assertSupportedCliPlaceholders(
@@ -7777,8 +7976,8 @@ function extractCliPlaceholders(template) {
7777
7976
  }
7778
7977
  return results;
7779
7978
  }
7780
- function resolveString(source, env2, description, allowLiteral = false) {
7781
- const value = resolveOptionalString(source, env2, description, {
7979
+ function resolveString(source, env3, description, allowLiteral = false) {
7980
+ const value = resolveOptionalString(source, env3, description, {
7782
7981
  allowLiteral,
7783
7982
  optionalEnv: false
7784
7983
  });
@@ -7787,7 +7986,7 @@ function resolveString(source, env2, description, allowLiteral = false) {
7787
7986
  }
7788
7987
  return value;
7789
7988
  }
7790
- function resolveOptionalString(source, env2, description, options) {
7989
+ function resolveOptionalString(source, env3, description, options) {
7791
7990
  if (source === void 0 || source === null) {
7792
7991
  return void 0;
7793
7992
  }
@@ -7801,7 +8000,7 @@ function resolveOptionalString(source, env2, description, options) {
7801
8000
  const envVarMatch = trimmed.match(/^\$\{\{\s*([A-Z0-9_]+)\s*\}\}$/i);
7802
8001
  if (envVarMatch) {
7803
8002
  const varName = envVarMatch[1];
7804
- const envValue = env2[varName];
8003
+ const envValue = env3[varName];
7805
8004
  const optionalEnv = options?.optionalEnv ?? false;
7806
8005
  if (envValue === void 0 || envValue.trim().length === 0) {
7807
8006
  if (optionalEnv) {
@@ -7863,7 +8062,7 @@ function resolveOptionalBoolean(source) {
7863
8062
  }
7864
8063
  throw new Error("expected boolean value");
7865
8064
  }
7866
- function resolveOptionalStringArray(source, env2, description) {
8065
+ function resolveOptionalStringArray(source, env3, description) {
7867
8066
  if (source === void 0 || source === null) {
7868
8067
  return void 0;
7869
8068
  }
@@ -7886,7 +8085,7 @@ function resolveOptionalStringArray(source, env2, description) {
7886
8085
  const envVarMatch = trimmed.match(/^\$\{\{\s*([A-Z0-9_]+)\s*\}\}$/i);
7887
8086
  if (envVarMatch) {
7888
8087
  const varName = envVarMatch[1];
7889
- const envValue = env2[varName];
8088
+ const envValue = env3[varName];
7890
8089
  if (envValue !== void 0) {
7891
8090
  if (envValue.trim().length === 0) {
7892
8091
  throw new Error(`Environment variable '${varName}' for ${description}[${i}] is empty`);
@@ -7922,6 +8121,7 @@ function resolveOptionalNumberArray(source, description) {
7922
8121
  }
7923
8122
  var AGENT_PROVIDER_KINDS = [
7924
8123
  "codex",
8124
+ "copilot-cli",
7925
8125
  "pi-coding-agent",
7926
8126
  "claude-code",
7927
8127
  "vscode",
@@ -7932,6 +8132,7 @@ var KNOWN_PROVIDERS = [
7932
8132
  "anthropic",
7933
8133
  "gemini",
7934
8134
  "codex",
8135
+ "copilot-cli",
7935
8136
  "pi-coding-agent",
7936
8137
  "pi-agent-sdk",
7937
8138
  "claude-code",
@@ -9088,10 +9289,10 @@ function assignProp(target, prop, value) {
9088
9289
  configurable: true
9089
9290
  });
9090
9291
  }
9091
- function getElementAtPath(obj, path40) {
9092
- if (!path40)
9292
+ function getElementAtPath(obj, path41) {
9293
+ if (!path41)
9093
9294
  return obj;
9094
- return path40.reduce((acc, key) => acc?.[key], obj);
9295
+ return path41.reduce((acc, key) => acc?.[key], obj);
9095
9296
  }
9096
9297
  function promiseAllObject(promisesObj) {
9097
9298
  const keys = Object.keys(promisesObj);
@@ -9411,11 +9612,11 @@ function aborted(x, startIndex = 0) {
9411
9612
  }
9412
9613
  return false;
9413
9614
  }
9414
- function prefixIssues(path40, issues) {
9615
+ function prefixIssues(path41, issues) {
9415
9616
  return issues.map((iss) => {
9416
9617
  var _a17;
9417
9618
  (_a17 = iss).path ?? (_a17.path = []);
9418
- iss.path.unshift(path40);
9619
+ iss.path.unshift(path41);
9419
9620
  return iss;
9420
9621
  });
9421
9622
  }
@@ -9552,7 +9753,7 @@ function treeifyError(error40, _mapper) {
9552
9753
  return issue2.message;
9553
9754
  };
9554
9755
  const result = { errors: [] };
9555
- const processError = (error41, path40 = []) => {
9756
+ const processError = (error41, path41 = []) => {
9556
9757
  var _a17, _b8;
9557
9758
  for (const issue2 of error41.issues) {
9558
9759
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -9562,7 +9763,7 @@ function treeifyError(error40, _mapper) {
9562
9763
  } else if (issue2.code === "invalid_element") {
9563
9764
  processError({ issues: issue2.issues }, issue2.path);
9564
9765
  } else {
9565
- const fullpath = [...path40, ...issue2.path];
9766
+ const fullpath = [...path41, ...issue2.path];
9566
9767
  if (fullpath.length === 0) {
9567
9768
  result.errors.push(mapper(issue2));
9568
9769
  continue;
@@ -9592,9 +9793,9 @@ function treeifyError(error40, _mapper) {
9592
9793
  processError(error40);
9593
9794
  return result;
9594
9795
  }
9595
- function toDotPath(path40) {
9796
+ function toDotPath(path41) {
9596
9797
  const segs = [];
9597
- for (const seg of path40) {
9798
+ for (const seg of path41) {
9598
9799
  if (typeof seg === "number")
9599
9800
  segs.push(`[${seg}]`);
9600
9801
  else if (typeof seg === "symbol")
@@ -29147,14 +29348,14 @@ function createAzure(options = {}) {
29147
29348
  description: "Azure OpenAI resource name"
29148
29349
  });
29149
29350
  const apiVersion = (_a17 = options.apiVersion) != null ? _a17 : "v1";
29150
- const url2 = ({ path: path40, modelId }) => {
29351
+ const url2 = ({ path: path41, modelId }) => {
29151
29352
  var _a24;
29152
29353
  const baseUrlPrefix = (_a24 = options.baseURL) != null ? _a24 : `https://${getResourceName()}.openai.azure.com/openai`;
29153
29354
  let fullUrl;
29154
29355
  if (options.useDeploymentBasedUrls) {
29155
- fullUrl = new URL(`${baseUrlPrefix}/deployments/${modelId}${path40}`);
29356
+ fullUrl = new URL(`${baseUrlPrefix}/deployments/${modelId}${path41}`);
29156
29357
  } else {
29157
- fullUrl = new URL(`${baseUrlPrefix}/v1${path40}`);
29358
+ fullUrl = new URL(`${baseUrlPrefix}/v1${path41}`);
29158
29359
  }
29159
29360
  fullUrl.searchParams.set("api-version", apiVersion);
29160
29361
  return fullUrl.toString();
@@ -35594,7 +35795,7 @@ import path9 from "node:path";
35594
35795
  import path8 from "node:path";
35595
35796
  import { exec as execWithCallback } from "node:child_process";
35596
35797
  import fs from "node:fs/promises";
35597
- import os2 from "node:os";
35798
+ import os3 from "node:os";
35598
35799
  import path10 from "node:path";
35599
35800
  import { promisify } from "node:util";
35600
35801
  import { exec as execCallback, spawn as spawn2 } from "node:child_process";
@@ -35604,42 +35805,49 @@ import { access as access22, mkdir as mkdir2, mkdtemp as mkdtemp2, rm as rm2, wr
35604
35805
  import { tmpdir as tmpdir2 } from "node:os";
35605
35806
  import path11 from "node:path";
35606
35807
  import { promisify as promisify2 } from "node:util";
35607
- import { spawn as spawn3 } from "node:child_process";
35808
+ import { exec as execCallback2, spawn as spawn3 } from "node:child_process";
35608
35809
  import { randomUUID as randomUUID3 } from "node:crypto";
35609
- import { createWriteStream as createWriteStream3 } from "node:fs";
35610
- import { mkdir as mkdir3, mkdtemp as mkdtemp3, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
35810
+ import { constants as constants3, createWriteStream as createWriteStream3 } from "node:fs";
35811
+ import { access as access3, copyFile, mkdir as mkdir3, mkdtemp as mkdtemp3, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
35611
35812
  import { tmpdir as tmpdir3 } from "node:os";
35612
35813
  import path12 from "node:path";
35613
- import path23 from "node:path";
35614
- import { stat as stat3, writeFile as writeFile6 } from "node:fs/promises";
35615
- import path21 from "node:path";
35616
- import { constants as constants3 } from "node:fs";
35617
- import { access as access3, mkdir as mkdir4, readdir, rm as rm4, stat } from "node:fs/promises";
35814
+ import { promisify as promisify3 } from "node:util";
35815
+ import { spawn as spawn4 } from "node:child_process";
35816
+ import { randomUUID as randomUUID4 } from "node:crypto";
35817
+ import { createWriteStream as createWriteStream4 } from "node:fs";
35818
+ import { mkdir as mkdir4, mkdtemp as mkdtemp4, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
35819
+ import { tmpdir as tmpdir4 } from "node:os";
35618
35820
  import path13 from "node:path";
35821
+ import path24 from "node:path";
35822
+ import { stat as stat3, writeFile as writeFile7 } from "node:fs/promises";
35823
+ import path222 from "node:path";
35824
+ import { constants as constants4 } from "node:fs";
35825
+ import { access as access4, mkdir as mkdir5, readdir, rm as rm5, stat } from "node:fs/promises";
35619
35826
  import path14 from "node:path";
35620
35827
  import path15 from "node:path";
35621
- import { readFile as readFile7 } from "node:fs/promises";
35622
35828
  import path16 from "node:path";
35623
- import { exec, spawn as spawn4 } from "node:child_process";
35624
- import { mkdir as mkdir5, writeFile as writeFile4 } from "node:fs/promises";
35625
- import path18 from "node:path";
35626
- import { promisify as promisify3 } from "node:util";
35627
- import os22 from "node:os";
35829
+ import { readFile as readFile7 } from "node:fs/promises";
35628
35830
  import path17 from "node:path";
35629
- import { copyFile, mkdir as mkdir6, readFile as readFile8, readdir as readdir2, stat as stat2, writeFile as writeFile5 } from "node:fs/promises";
35630
- import path20 from "node:path";
35831
+ import { exec, spawn as spawn5 } from "node:child_process";
35832
+ import { mkdir as mkdir6, writeFile as writeFile5 } from "node:fs/promises";
35631
35833
  import path19 from "node:path";
35834
+ import { promisify as promisify4 } from "node:util";
35835
+ import os22 from "node:os";
35836
+ import path18 from "node:path";
35837
+ import { copyFile as copyFile2, mkdir as mkdir7, readFile as readFile8, readdir as readdir2, stat as stat2, writeFile as writeFile6 } from "node:fs/promises";
35838
+ import path21 from "node:path";
35839
+ import path20 from "node:path";
35632
35840
  import JSON5 from "json5";
35633
- import { writeFile as writeFile7 } from "node:fs/promises";
35634
- import path222 from "node:path";
35635
- import { constants as constants4 } from "node:fs";
35636
- import { access as access4, readFile as readFile9 } from "node:fs/promises";
35637
- import path24 from "node:path";
35841
+ import { writeFile as writeFile8 } from "node:fs/promises";
35842
+ import path23 from "node:path";
35843
+ import { constants as constants5 } from "node:fs";
35844
+ import { access as access5, readFile as readFile9 } from "node:fs/promises";
35845
+ import path25 from "node:path";
35638
35846
  import { parse as parse32 } from "yaml";
35639
35847
  import { randomBytes } from "node:crypto";
35640
35848
  import { createServer } from "node:http";
35641
35849
  import { createHash } from "node:crypto";
35642
- import path25 from "node:path";
35850
+ import path26 from "node:path";
35643
35851
  import micromatch4 from "micromatch";
35644
35852
  var TEST_MESSAGE_ROLE_VALUES = ["system", "user", "assistant", "tool"];
35645
35853
  var TEST_MESSAGE_ROLE_SET = new Set(TEST_MESSAGE_ROLE_VALUES);
@@ -36540,12 +36748,13 @@ function parseRubricItems(rawRubrics, evaluatorName, evalId) {
36540
36748
  let scoreRanges;
36541
36749
  const rawScoreRanges = rawRubric.score_ranges;
36542
36750
  if (rawScoreRanges !== void 0) {
36543
- if (!Array.isArray(rawScoreRanges)) {
36751
+ const normalized = normalizeScoreRangesShorthand(rawScoreRanges);
36752
+ if (!Array.isArray(normalized)) {
36544
36753
  throw new Error(
36545
- `Invalid score_ranges for rubric '${id}' in evaluator '${evaluatorName}' in '${evalId}': must be an array`
36754
+ `Invalid score_ranges for rubric '${id}' in evaluator '${evaluatorName}' in '${evalId}': must be an array or shorthand map`
36546
36755
  );
36547
36756
  }
36548
- scoreRanges = parseScoreRanges(rawScoreRanges, id, evaluatorName, evalId);
36757
+ scoreRanges = parseScoreRanges(normalized, id, evaluatorName, evalId);
36549
36758
  items.push({
36550
36759
  id,
36551
36760
  weight,
@@ -36573,6 +36782,37 @@ function parseRubricItems(rawRubrics, evaluatorName, evalId) {
36573
36782
  }
36574
36783
  return items.length > 0 ? items : void 0;
36575
36784
  }
36785
+ function normalizeScoreRangesShorthand(raw) {
36786
+ if (Array.isArray(raw)) return raw;
36787
+ if (!isJsonObject2(raw)) return raw;
36788
+ const keys = Object.keys(raw);
36789
+ if (keys.length === 0) return raw;
36790
+ const numericKeys = [];
36791
+ for (const key of keys) {
36792
+ const num = Number(key);
36793
+ if (!Number.isInteger(num) || num < 0 || num > 10) {
36794
+ return raw;
36795
+ }
36796
+ if (typeof raw[key] !== "string" || raw[key].length === 0) {
36797
+ return raw;
36798
+ }
36799
+ numericKeys.push(num);
36800
+ }
36801
+ numericKeys.sort((a, b) => a - b);
36802
+ if (numericKeys[0] !== 0) {
36803
+ throw new Error(`score_ranges shorthand map must start at 0 (got ${numericKeys[0]})`);
36804
+ }
36805
+ const result = [];
36806
+ for (let i = 0; i < numericKeys.length; i++) {
36807
+ const min = numericKeys[i];
36808
+ const max = i < numericKeys.length - 1 ? numericKeys[i + 1] - 1 : 10;
36809
+ result.push({
36810
+ score_range: [min, max],
36811
+ expected_outcome: raw[String(min)]
36812
+ });
36813
+ }
36814
+ return result;
36815
+ }
36576
36816
  function parseScoreRanges(rawRanges, rubricId, evaluatorName, evalId) {
36577
36817
  const ranges = [];
36578
36818
  for (const [index, rawRange] of rawRanges.entries()) {
@@ -36655,7 +36895,8 @@ function parseInlineRubrics(rawRubrics) {
36655
36895
  }
36656
36896
  const expectedOutcome = asString(rubric.expected_outcome) ?? asString(rubric.description) ?? "";
36657
36897
  const rawScoreRanges = rubric.score_ranges;
36658
- const scoreRanges = Array.isArray(rawScoreRanges) && rawScoreRanges.length > 0 ? rawScoreRanges.filter((r) => isJsonObject2(r)).map((range) => ({
36898
+ const normalizedScoreRanges = rawScoreRanges !== void 0 ? normalizeScoreRangesShorthand(rawScoreRanges) : void 0;
36899
+ const scoreRanges = Array.isArray(normalizedScoreRanges) && normalizedScoreRanges.length > 0 ? normalizedScoreRanges.filter((r) => isJsonObject2(r)).map((range) => ({
36659
36900
  score_range: Array.isArray(range.score_range) ? range.score_range : [0, 10],
36660
36901
  expected_outcome: asString(range.expected_outcome) ?? asString(range.description) ?? ""
36661
36902
  })).filter((r) => r.expected_outcome.length > 0) : void 0;
@@ -38169,10 +38410,10 @@ ${filesContext}`;
38169
38410
  return args;
38170
38411
  }
38171
38412
  buildEnv() {
38172
- const env2 = { ...process.env };
38173
- env2.CLAUDECODE = void 0;
38174
- env2.CLAUDE_CODE_ENTRYPOINT = void 0;
38175
- return env2;
38413
+ const env3 = { ...process.env };
38414
+ env3.CLAUDECODE = void 0;
38415
+ env3.CLAUDE_CODE_ENTRYPOINT = void 0;
38416
+ return env3;
38176
38417
  }
38177
38418
  async executeClaudeCode(args, cwd, signal, logger) {
38178
38419
  try {
@@ -38683,8 +38924,8 @@ async function runClaudeCodeWithTempFiles(options, stdoutFile, stderrFile, exitF
38683
38924
  };
38684
38925
  const fileExists42 = async (filePath) => {
38685
38926
  try {
38686
- const { access: access52 } = await import("node:fs/promises");
38687
- await access52(filePath);
38927
+ const { access: access62 } = await import("node:fs/promises");
38928
+ await access62(filePath);
38688
38929
  return true;
38689
38930
  } catch {
38690
38931
  return false;
@@ -39248,7 +39489,7 @@ function generateOutputFilePath(evalCaseId, extension = ".json") {
39248
39489
  const safeEvalId = evalCaseId || "unknown";
39249
39490
  const timestamp = Date.now();
39250
39491
  const random = Math.random().toString(36).substring(2, 9);
39251
- return path10.join(os2.tmpdir(), `agentv-${safeEvalId}-${timestamp}-${random}${extension}`);
39492
+ return path10.join(os3.tmpdir(), `agentv-${safeEvalId}-${timestamp}-${random}${extension}`);
39252
39493
  }
39253
39494
  function formatTimeoutSuffix2(timeoutMs) {
39254
39495
  if (!timeoutMs || timeoutMs <= 0) {
@@ -39980,6 +40221,518 @@ function shouldShellExecute(executable) {
39980
40221
  const lower = executable.toLowerCase();
39981
40222
  return lower.endsWith(".cmd") || lower.endsWith(".bat") || lower.endsWith(".ps1");
39982
40223
  }
40224
+ var GLOBAL_LOGS_KEY3 = Symbol.for("agentv.copilotCliLogs");
40225
+ var GLOBAL_SUBSCRIBERS_KEY3 = Symbol.for("agentv.copilotCliLogSubscribers");
40226
+ function getCopilotCliLogStore() {
40227
+ const globalObject = globalThis;
40228
+ const existing = globalObject[GLOBAL_LOGS_KEY3];
40229
+ if (existing) {
40230
+ return existing;
40231
+ }
40232
+ const created = [];
40233
+ globalObject[GLOBAL_LOGS_KEY3] = created;
40234
+ return created;
40235
+ }
40236
+ function getSubscriberStore3() {
40237
+ const globalObject = globalThis;
40238
+ const existing = globalObject[GLOBAL_SUBSCRIBERS_KEY3];
40239
+ if (existing) {
40240
+ return existing;
40241
+ }
40242
+ const created = /* @__PURE__ */ new Set();
40243
+ globalObject[GLOBAL_SUBSCRIBERS_KEY3] = created;
40244
+ return created;
40245
+ }
40246
+ function notifySubscribers3(entry) {
40247
+ const subscribers = Array.from(getSubscriberStore3());
40248
+ for (const listener of subscribers) {
40249
+ try {
40250
+ listener(entry);
40251
+ } catch (error40) {
40252
+ const message = error40 instanceof Error ? error40.message : String(error40);
40253
+ console.warn(`Copilot CLI log subscriber failed: ${message}`);
40254
+ }
40255
+ }
40256
+ }
40257
+ function recordCopilotCliLogEntry(entry) {
40258
+ getCopilotCliLogStore().push(entry);
40259
+ notifySubscribers3(entry);
40260
+ }
40261
+ function subscribeToCopilotCliLogEntries(listener) {
40262
+ const store = getSubscriberStore3();
40263
+ store.add(listener);
40264
+ return () => {
40265
+ store.delete(listener);
40266
+ };
40267
+ }
40268
+ var execAsync3 = promisify3(execCallback2);
40269
+ var WORKSPACE_PREFIX3 = "agentv-copilot-";
40270
+ var PROMPT_FILENAME3 = "prompt.md";
40271
+ var DEFAULT_SYSTEM_PROMPT4 = `**IMPORTANT**: Follow these instructions for your response:
40272
+ - Do NOT create any additional output files in the workspace.
40273
+ - All intended file outputs/changes MUST be written in your response.
40274
+ - For each intended file, include the relative path and unified git diff following the convention \`diff --git ...\`.
40275
+ This is required for evaluation scoring.`;
40276
+ async function copyInputFilesToWorkspace(workspaceRoot, inputFiles) {
40277
+ const usedNames = /* @__PURE__ */ new Map();
40278
+ const mappings = [];
40279
+ for (const originalPath of inputFiles) {
40280
+ const ext = path12.extname(originalPath);
40281
+ const stem = path12.basename(originalPath, ext);
40282
+ let relativeName;
40283
+ const baseKey = `${stem}${ext}`;
40284
+ const count = usedNames.get(baseKey) ?? 0;
40285
+ if (count === 0) {
40286
+ relativeName = baseKey;
40287
+ } else {
40288
+ relativeName = `${stem}_${count}${ext}`;
40289
+ }
40290
+ usedNames.set(baseKey, count + 1);
40291
+ const dest = path12.join(workspaceRoot, relativeName);
40292
+ await copyFile(originalPath, dest);
40293
+ mappings.push({ originalPath, workspaceRelativePath: relativeName });
40294
+ }
40295
+ return mappings;
40296
+ }
40297
+ function buildCopilotFilePrereadBlock(guidelineMappings, inputMappings) {
40298
+ if (guidelineMappings.length === 0 && inputMappings.length === 0) {
40299
+ return "";
40300
+ }
40301
+ const buildList = (mappings) => mappings.map((m) => `* ${m.workspaceRelativePath}`).join("\n");
40302
+ const sections = [];
40303
+ if (guidelineMappings.length > 0) {
40304
+ sections.push(`Read all guideline files:
40305
+ ${buildList(guidelineMappings)}.`);
40306
+ }
40307
+ if (inputMappings.length > 0) {
40308
+ sections.push(`Read all input files:
40309
+ ${buildList(inputMappings)}.`);
40310
+ }
40311
+ sections.push(
40312
+ "If any file is missing, fail with ERROR: missing-file <filename> and stop.",
40313
+ "Then apply system_instructions on the user query below."
40314
+ );
40315
+ return sections.join("\n");
40316
+ }
40317
+ var CopilotCliProvider = class {
40318
+ id;
40319
+ kind = "copilot-cli";
40320
+ targetName;
40321
+ supportsBatch = false;
40322
+ config;
40323
+ runCopilot;
40324
+ environmentCheck;
40325
+ resolvedExecutable;
40326
+ constructor(targetName, config2, runner = defaultCopilotCliRunner) {
40327
+ this.id = `copilot-cli:${targetName}`;
40328
+ this.targetName = targetName;
40329
+ this.config = config2;
40330
+ this.runCopilot = runner;
40331
+ }
40332
+ async invoke(request) {
40333
+ if (request.signal?.aborted) {
40334
+ throw new Error("Copilot CLI request was aborted before execution");
40335
+ }
40336
+ await this.ensureEnvironmentReady();
40337
+ const inputFiles = normalizeInputFiles(request.inputFiles);
40338
+ const workspaceRoot = await this.createWorkspace();
40339
+ const logger = await this.createStreamLogger(request).catch(() => void 0);
40340
+ try {
40341
+ const copiedFiles = inputFiles ? await copyInputFilesToWorkspace(workspaceRoot, inputFiles) : [];
40342
+ const guidelineFileSet = new Set(
40343
+ collectGuidelineFiles(inputFiles, request.guideline_patterns)
40344
+ );
40345
+ const guidelineMappings = copiedFiles.filter((m) => guidelineFileSet.has(m.originalPath));
40346
+ const nonGuidelineMappings = copiedFiles.filter((m) => !guidelineFileSet.has(m.originalPath));
40347
+ const prereadBlock = buildCopilotFilePrereadBlock(guidelineMappings, nonGuidelineMappings);
40348
+ const systemPrompt = this.config.systemPrompt ?? DEFAULT_SYSTEM_PROMPT4;
40349
+ const promptParts = [systemPrompt];
40350
+ if (prereadBlock.length > 0) {
40351
+ promptParts.push("", prereadBlock);
40352
+ }
40353
+ promptParts.push("", "[[ ## user_query ## ]]", request.question.trim());
40354
+ const promptContent = promptParts.join("\n");
40355
+ const promptFile = path12.join(workspaceRoot, PROMPT_FILENAME3);
40356
+ await writeFile3(promptFile, promptContent, "utf8");
40357
+ const args = this.buildCopilotArgs(promptContent);
40358
+ const cwd = this.resolveCwd(workspaceRoot);
40359
+ const result = await this.executeCopilot(args, cwd, promptContent, request.signal, logger);
40360
+ if (result.timedOut) {
40361
+ throw new Error(
40362
+ `Copilot CLI timed out${formatTimeoutSuffix4(this.config.timeoutMs ?? void 0)}`
40363
+ );
40364
+ }
40365
+ if (result.exitCode !== 0) {
40366
+ const detail = pickDetail3(result.stderr, result.stdout);
40367
+ const prefix = `Copilot CLI exited with code ${result.exitCode}`;
40368
+ throw new Error(detail ? `${prefix}: ${detail}` : prefix);
40369
+ }
40370
+ const assistantText = extractCopilotResponse(result.stdout);
40371
+ return {
40372
+ raw: {
40373
+ stdout: result.stdout,
40374
+ stderr: result.stderr,
40375
+ exitCode: result.exitCode,
40376
+ args,
40377
+ executable: this.resolvedExecutable ?? this.config.executable,
40378
+ promptFile,
40379
+ workspace: workspaceRoot,
40380
+ inputFiles,
40381
+ copiedFiles,
40382
+ logFile: logger?.filePath
40383
+ },
40384
+ outputMessages: [{ role: "assistant", content: assistantText }]
40385
+ };
40386
+ } finally {
40387
+ await logger?.close();
40388
+ await this.cleanupWorkspace(workspaceRoot);
40389
+ }
40390
+ }
40391
+ async ensureEnvironmentReady() {
40392
+ if (!this.environmentCheck) {
40393
+ this.environmentCheck = this.validateEnvironment();
40394
+ }
40395
+ await this.environmentCheck;
40396
+ }
40397
+ async validateEnvironment() {
40398
+ this.resolvedExecutable = await locateExecutable2(this.config.executable);
40399
+ }
40400
+ resolveCwd(workspaceRoot) {
40401
+ if (!this.config.cwd) {
40402
+ return workspaceRoot;
40403
+ }
40404
+ return path12.resolve(this.config.cwd);
40405
+ }
40406
+ buildCopilotArgs(prompt) {
40407
+ const args = [];
40408
+ args.push("-s");
40409
+ args.push("--allow-all-tools");
40410
+ args.push("--no-color");
40411
+ if (this.config.model) {
40412
+ args.push("--model", this.config.model);
40413
+ }
40414
+ if (this.config.args && this.config.args.length > 0) {
40415
+ args.push(...this.config.args);
40416
+ }
40417
+ args.push("-p", prompt);
40418
+ return args;
40419
+ }
40420
+ async executeCopilot(args, cwd, promptContent, signal, logger) {
40421
+ try {
40422
+ return await this.runCopilot({
40423
+ executable: this.resolvedExecutable ?? this.config.executable,
40424
+ args,
40425
+ cwd,
40426
+ prompt: promptContent,
40427
+ timeoutMs: this.config.timeoutMs,
40428
+ env: process.env,
40429
+ signal,
40430
+ onStdoutChunk: logger ? (chunk) => logger.handleStdoutChunk(chunk) : void 0,
40431
+ onStderrChunk: logger ? (chunk) => logger.handleStderrChunk(chunk) : void 0
40432
+ });
40433
+ } catch (error40) {
40434
+ const err2 = error40;
40435
+ if (err2.code === "ENOENT") {
40436
+ throw new Error(
40437
+ `Copilot executable '${this.config.executable}' was not found. Update the target settings.executable or add it to PATH.`
40438
+ );
40439
+ }
40440
+ throw error40;
40441
+ }
40442
+ }
40443
+ async createWorkspace() {
40444
+ return await mkdtemp3(path12.join(tmpdir3(), WORKSPACE_PREFIX3));
40445
+ }
40446
+ async cleanupWorkspace(workspaceRoot) {
40447
+ try {
40448
+ await rm3(workspaceRoot, { recursive: true, force: true });
40449
+ } catch {
40450
+ }
40451
+ }
40452
+ resolveLogDirectory() {
40453
+ const disabled = isCopilotLogStreamingDisabled();
40454
+ if (disabled) {
40455
+ return void 0;
40456
+ }
40457
+ if (this.config.logDir) {
40458
+ return path12.resolve(this.config.logDir);
40459
+ }
40460
+ return path12.join(process.cwd(), ".agentv", "logs", "copilot-cli");
40461
+ }
40462
+ async createStreamLogger(request) {
40463
+ const logDir = this.resolveLogDirectory();
40464
+ if (!logDir) {
40465
+ return void 0;
40466
+ }
40467
+ try {
40468
+ await mkdir3(logDir, { recursive: true });
40469
+ } catch (error40) {
40470
+ const message = error40 instanceof Error ? error40.message : String(error40);
40471
+ console.warn(`Skipping Copilot CLI stream logging (could not create ${logDir}): ${message}`);
40472
+ return void 0;
40473
+ }
40474
+ const filePath = path12.join(logDir, buildLogFilename3(request, this.targetName));
40475
+ try {
40476
+ const logger = await CopilotCliStreamLogger.create({
40477
+ filePath,
40478
+ targetName: this.targetName,
40479
+ evalCaseId: request.evalCaseId,
40480
+ attempt: request.attempt,
40481
+ format: this.config.logFormat ?? "summary"
40482
+ });
40483
+ recordCopilotCliLogEntry({
40484
+ filePath,
40485
+ targetName: this.targetName,
40486
+ evalCaseId: request.evalCaseId,
40487
+ attempt: request.attempt
40488
+ });
40489
+ return logger;
40490
+ } catch (error40) {
40491
+ const message = error40 instanceof Error ? error40.message : String(error40);
40492
+ console.warn(`Skipping Copilot CLI stream logging for ${filePath}: ${message}`);
40493
+ return void 0;
40494
+ }
40495
+ }
40496
+ };
40497
+ var CopilotCliStreamLogger = class _CopilotCliStreamLogger {
40498
+ filePath;
40499
+ stream;
40500
+ startedAt = Date.now();
40501
+ stdoutBuffer = "";
40502
+ stderrBuffer = "";
40503
+ format;
40504
+ constructor(filePath, format) {
40505
+ this.filePath = filePath;
40506
+ this.format = format;
40507
+ this.stream = createWriteStream3(filePath, { flags: "a" });
40508
+ }
40509
+ static async create(options) {
40510
+ const logger = new _CopilotCliStreamLogger(options.filePath, options.format);
40511
+ const header = [
40512
+ "# Copilot CLI stream log",
40513
+ `# target: ${options.targetName}`,
40514
+ options.evalCaseId ? `# eval: ${options.evalCaseId}` : void 0,
40515
+ options.attempt !== void 0 ? `# attempt: ${options.attempt + 1}` : void 0,
40516
+ `# started: ${(/* @__PURE__ */ new Date()).toISOString()}`,
40517
+ ""
40518
+ ].filter((line) => Boolean(line));
40519
+ logger.writeLines(header);
40520
+ return logger;
40521
+ }
40522
+ handleStdoutChunk(chunk) {
40523
+ this.stdoutBuffer += chunk;
40524
+ this.flushBuffer("stdout");
40525
+ }
40526
+ handleStderrChunk(chunk) {
40527
+ this.stderrBuffer += chunk;
40528
+ this.flushBuffer("stderr");
40529
+ }
40530
+ async close() {
40531
+ this.flushBuffer("stdout");
40532
+ this.flushBuffer("stderr");
40533
+ this.flushRemainder();
40534
+ await new Promise((resolve2, reject) => {
40535
+ this.stream.once("error", reject);
40536
+ this.stream.end(() => resolve2());
40537
+ });
40538
+ }
40539
+ writeLines(lines) {
40540
+ for (const line of lines) {
40541
+ this.stream.write(`${line}
40542
+ `);
40543
+ }
40544
+ }
40545
+ flushBuffer(source) {
40546
+ const buffer = source === "stdout" ? this.stdoutBuffer : this.stderrBuffer;
40547
+ const lines = buffer.split(/\r?\n/);
40548
+ const remainder = lines.pop() ?? "";
40549
+ if (source === "stdout") {
40550
+ this.stdoutBuffer = remainder;
40551
+ } else {
40552
+ this.stderrBuffer = remainder;
40553
+ }
40554
+ for (const line of lines) {
40555
+ const formatted = this.formatLine(line, source);
40556
+ if (formatted) {
40557
+ this.stream.write(formatted);
40558
+ this.stream.write("\n");
40559
+ }
40560
+ }
40561
+ }
40562
+ formatLine(rawLine, source) {
40563
+ const trimmed = rawLine.trim();
40564
+ if (trimmed.length === 0) {
40565
+ return void 0;
40566
+ }
40567
+ const prefix = source === "stderr" ? "stderr: " : "";
40568
+ return `[+${formatElapsed3(this.startedAt)}] [${source}] ${prefix}${trimmed}`;
40569
+ }
40570
+ flushRemainder() {
40571
+ const stdoutRemainder = this.stdoutBuffer.trim();
40572
+ if (stdoutRemainder.length > 0) {
40573
+ const formatted = this.formatLine(stdoutRemainder, "stdout");
40574
+ if (formatted) {
40575
+ this.stream.write(formatted);
40576
+ this.stream.write("\n");
40577
+ }
40578
+ }
40579
+ const stderrRemainder = this.stderrBuffer.trim();
40580
+ if (stderrRemainder.length > 0) {
40581
+ const formatted = this.formatLine(stderrRemainder, "stderr");
40582
+ if (formatted) {
40583
+ this.stream.write(formatted);
40584
+ this.stream.write("\n");
40585
+ }
40586
+ }
40587
+ this.stdoutBuffer = "";
40588
+ this.stderrBuffer = "";
40589
+ }
40590
+ };
40591
+ function isCopilotLogStreamingDisabled() {
40592
+ const envValue = process.env.AGENTV_COPILOT_STREAM_LOGS;
40593
+ if (!envValue) {
40594
+ return false;
40595
+ }
40596
+ const normalized = envValue.trim().toLowerCase();
40597
+ return normalized === "false" || normalized === "0" || normalized === "off";
40598
+ }
40599
+ function buildLogFilename3(request, targetName) {
40600
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
40601
+ const evalId = sanitizeForFilename3(request.evalCaseId ?? "copilot");
40602
+ const attemptSuffix = request.attempt !== void 0 ? `_attempt-${request.attempt + 1}` : "";
40603
+ const target = sanitizeForFilename3(targetName);
40604
+ return `${timestamp}_${target}_${evalId}${attemptSuffix}_${randomUUID3().slice(0, 8)}.log`;
40605
+ }
40606
+ function sanitizeForFilename3(value) {
40607
+ const sanitized = value.replace(/[^A-Za-z0-9._-]+/g, "_");
40608
+ return sanitized.length > 0 ? sanitized : "copilot";
40609
+ }
40610
+ function formatElapsed3(startedAt) {
40611
+ const elapsedSeconds = Math.floor((Date.now() - startedAt) / 1e3);
40612
+ const hours = Math.floor(elapsedSeconds / 3600);
40613
+ const minutes = Math.floor(elapsedSeconds % 3600 / 60);
40614
+ const seconds = elapsedSeconds % 60;
40615
+ if (hours > 0) {
40616
+ return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
40617
+ }
40618
+ return `${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
40619
+ }
40620
+ var ANSI_ESCAPE_RE = /\x1B\[[0-9;]*[A-Za-z]/g;
40621
+ var ANSI_OSC_RE = /\x1B\][^\x07]*\x07/g;
40622
+ function stripAnsiEscapes(text2) {
40623
+ return text2.replace(ANSI_ESCAPE_RE, "").replace(ANSI_OSC_RE, "");
40624
+ }
40625
+ function extractCopilotResponse(stdout) {
40626
+ const cleaned = stripAnsiEscapes(stdout).trim();
40627
+ if (cleaned.length === 0) {
40628
+ throw new Error("Copilot CLI produced no output");
40629
+ }
40630
+ return cleaned;
40631
+ }
40632
+ function pickDetail3(stderr, stdout) {
40633
+ const errorText = stderr.trim();
40634
+ if (errorText.length > 0) {
40635
+ return errorText;
40636
+ }
40637
+ const stdoutText = stdout.trim();
40638
+ return stdoutText.length > 0 ? stdoutText : void 0;
40639
+ }
40640
+ function formatTimeoutSuffix4(timeoutMs) {
40641
+ if (!timeoutMs || timeoutMs <= 0) {
40642
+ return "";
40643
+ }
40644
+ const seconds = Math.ceil(timeoutMs / 1e3);
40645
+ return ` after ${seconds}s`;
40646
+ }
40647
+ async function locateExecutable2(candidate) {
40648
+ const includesPathSeparator = candidate.includes("/") || candidate.includes("\\");
40649
+ if (includesPathSeparator) {
40650
+ const resolved = path12.isAbsolute(candidate) ? candidate : path12.resolve(candidate);
40651
+ await access3(resolved, constants3.F_OK);
40652
+ return resolved;
40653
+ }
40654
+ const locator = process.platform === "win32" ? "where" : "which";
40655
+ try {
40656
+ const { stdout } = await execAsync3(`${locator} ${candidate}`);
40657
+ const lines = stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
40658
+ if (lines.length > 0 && lines[0]) {
40659
+ await access3(lines[0], constants3.F_OK);
40660
+ return lines[0];
40661
+ }
40662
+ } catch {
40663
+ }
40664
+ throw new Error(`Copilot executable '${candidate}' was not found on PATH`);
40665
+ }
40666
+ function shouldShellExecute2(executable) {
40667
+ if (process.platform !== "win32") {
40668
+ return false;
40669
+ }
40670
+ const lower = executable.toLowerCase();
40671
+ return lower.endsWith(".cmd") || lower.endsWith(".bat") || lower.endsWith(".ps1");
40672
+ }
40673
+ async function defaultCopilotCliRunner(options) {
40674
+ return await new Promise((resolve2, reject) => {
40675
+ const child = spawn3(options.executable, options.args, {
40676
+ cwd: options.cwd,
40677
+ env: options.env,
40678
+ stdio: ["pipe", "pipe", "pipe"],
40679
+ shell: shouldShellExecute2(options.executable)
40680
+ });
40681
+ let stdout = "";
40682
+ let stderr = "";
40683
+ let timedOut = false;
40684
+ const onAbort = () => {
40685
+ child.kill("SIGTERM");
40686
+ };
40687
+ if (options.signal) {
40688
+ if (options.signal.aborted) {
40689
+ onAbort();
40690
+ } else {
40691
+ options.signal.addEventListener("abort", onAbort, { once: true });
40692
+ }
40693
+ }
40694
+ let timeoutHandle;
40695
+ if (options.timeoutMs && options.timeoutMs > 0) {
40696
+ timeoutHandle = setTimeout(() => {
40697
+ timedOut = true;
40698
+ child.kill("SIGTERM");
40699
+ }, options.timeoutMs);
40700
+ timeoutHandle.unref?.();
40701
+ }
40702
+ child.stdout.setEncoding("utf8");
40703
+ child.stdout.on("data", (chunk) => {
40704
+ stdout += chunk;
40705
+ options.onStdoutChunk?.(chunk);
40706
+ });
40707
+ child.stderr.setEncoding("utf8");
40708
+ child.stderr.on("data", (chunk) => {
40709
+ stderr += chunk;
40710
+ options.onStderrChunk?.(chunk);
40711
+ });
40712
+ child.stdin.end();
40713
+ const cleanup = () => {
40714
+ if (timeoutHandle) {
40715
+ clearTimeout(timeoutHandle);
40716
+ }
40717
+ if (options.signal) {
40718
+ options.signal.removeEventListener("abort", onAbort);
40719
+ }
40720
+ };
40721
+ child.on("error", (error40) => {
40722
+ cleanup();
40723
+ reject(error40);
40724
+ });
40725
+ child.on("close", (code) => {
40726
+ cleanup();
40727
+ resolve2({
40728
+ stdout,
40729
+ stderr,
40730
+ exitCode: typeof code === "number" ? code : -1,
40731
+ timedOut
40732
+ });
40733
+ });
40734
+ });
40735
+ }
39983
40736
  var DEFAULT_MOCK_RESPONSE = '{"answer":"Mock provider response. Configure targets.yaml to supply a custom value."}';
39984
40737
  var MockProvider = class {
39985
40738
  id;
@@ -40178,30 +40931,30 @@ function extractToolCalls2(content) {
40178
40931
  }
40179
40932
  return toolCalls;
40180
40933
  }
40181
- var GLOBAL_LOGS_KEY3 = Symbol.for("agentv.piLogs");
40182
- var GLOBAL_SUBSCRIBERS_KEY3 = Symbol.for("agentv.piLogSubscribers");
40934
+ var GLOBAL_LOGS_KEY4 = Symbol.for("agentv.piLogs");
40935
+ var GLOBAL_SUBSCRIBERS_KEY4 = Symbol.for("agentv.piLogSubscribers");
40183
40936
  function getPiLogStore() {
40184
40937
  const globalObject = globalThis;
40185
- const existing = globalObject[GLOBAL_LOGS_KEY3];
40938
+ const existing = globalObject[GLOBAL_LOGS_KEY4];
40186
40939
  if (existing) {
40187
40940
  return existing;
40188
40941
  }
40189
40942
  const created = [];
40190
- globalObject[GLOBAL_LOGS_KEY3] = created;
40943
+ globalObject[GLOBAL_LOGS_KEY4] = created;
40191
40944
  return created;
40192
40945
  }
40193
- function getSubscriberStore3() {
40946
+ function getSubscriberStore4() {
40194
40947
  const globalObject = globalThis;
40195
- const existing = globalObject[GLOBAL_SUBSCRIBERS_KEY3];
40948
+ const existing = globalObject[GLOBAL_SUBSCRIBERS_KEY4];
40196
40949
  if (existing) {
40197
40950
  return existing;
40198
40951
  }
40199
40952
  const created = /* @__PURE__ */ new Set();
40200
- globalObject[GLOBAL_SUBSCRIBERS_KEY3] = created;
40953
+ globalObject[GLOBAL_SUBSCRIBERS_KEY4] = created;
40201
40954
  return created;
40202
40955
  }
40203
- function notifySubscribers3(entry) {
40204
- const subscribers = Array.from(getSubscriberStore3());
40956
+ function notifySubscribers4(entry) {
40957
+ const subscribers = Array.from(getSubscriberStore4());
40205
40958
  for (const listener of subscribers) {
40206
40959
  try {
40207
40960
  listener(entry);
@@ -40213,18 +40966,18 @@ function notifySubscribers3(entry) {
40213
40966
  }
40214
40967
  function recordPiLogEntry(entry) {
40215
40968
  getPiLogStore().push(entry);
40216
- notifySubscribers3(entry);
40969
+ notifySubscribers4(entry);
40217
40970
  }
40218
40971
  function subscribeToPiLogEntries(listener) {
40219
- const store = getSubscriberStore3();
40972
+ const store = getSubscriberStore4();
40220
40973
  store.add(listener);
40221
40974
  return () => {
40222
40975
  store.delete(listener);
40223
40976
  };
40224
40977
  }
40225
- var WORKSPACE_PREFIX3 = "agentv-pi-";
40226
- var PROMPT_FILENAME3 = "prompt.md";
40227
- var DEFAULT_SYSTEM_PROMPT4 = `**IMPORTANT**: Follow these instructions for your response:
40978
+ var WORKSPACE_PREFIX4 = "agentv-pi-";
40979
+ var PROMPT_FILENAME4 = "prompt.md";
40980
+ var DEFAULT_SYSTEM_PROMPT5 = `**IMPORTANT**: Follow these instructions for your response:
40228
40981
  - Do NOT create any additional output files in the workspace.
40229
40982
  - All intended file outputs/changes MUST be written in your response.
40230
40983
  - For each intended file, include the relative path and unified git diff following the convention \`diff --git ...\`.
@@ -40250,18 +41003,18 @@ var PiCodingAgentProvider = class {
40250
41003
  const workspaceRoot = await this.createWorkspace();
40251
41004
  const logger = await this.createStreamLogger(request).catch(() => void 0);
40252
41005
  try {
40253
- const promptFile = path12.join(workspaceRoot, PROMPT_FILENAME3);
40254
- await writeFile3(promptFile, request.question, "utf8");
41006
+ const promptFile = path13.join(workspaceRoot, PROMPT_FILENAME4);
41007
+ await writeFile4(promptFile, request.question, "utf8");
40255
41008
  const args = this.buildPiArgs(request.question, inputFiles);
40256
41009
  const cwd = this.resolveCwd(workspaceRoot);
40257
41010
  const result = await this.executePi(args, cwd, request.signal, logger);
40258
41011
  if (result.timedOut) {
40259
41012
  throw new Error(
40260
- `Pi coding agent timed out${formatTimeoutSuffix4(this.config.timeoutMs ?? void 0)}`
41013
+ `Pi coding agent timed out${formatTimeoutSuffix5(this.config.timeoutMs ?? void 0)}`
40261
41014
  );
40262
41015
  }
40263
41016
  if (result.exitCode !== 0) {
40264
- const detail = pickDetail3(result.stderr, result.stdout);
41017
+ const detail = pickDetail4(result.stderr, result.stdout);
40265
41018
  const prefix = `Pi coding agent exited with code ${result.exitCode}`;
40266
41019
  throw new Error(detail ? `${prefix}: ${detail}` : prefix);
40267
41020
  }
@@ -40292,7 +41045,7 @@ var PiCodingAgentProvider = class {
40292
41045
  if (!this.config.cwd) {
40293
41046
  return workspaceRoot;
40294
41047
  }
40295
- return path12.resolve(this.config.cwd);
41048
+ return path13.resolve(this.config.cwd);
40296
41049
  }
40297
41050
  buildPiArgs(prompt, inputFiles) {
40298
41051
  const args = [];
@@ -40322,7 +41075,7 @@ var PiCodingAgentProvider = class {
40322
41075
  args.push(`@${file2}`);
40323
41076
  }
40324
41077
  }
40325
- const systemPrompt = this.config.systemPrompt ?? DEFAULT_SYSTEM_PROMPT4;
41078
+ const systemPrompt = this.config.systemPrompt ?? DEFAULT_SYSTEM_PROMPT5;
40326
41079
  const fullPrompt = `${systemPrompt}
40327
41080
 
40328
41081
  ${prompt}`;
@@ -40353,47 +41106,47 @@ ${prompt}`;
40353
41106
  }
40354
41107
  }
40355
41108
  buildEnv() {
40356
- const env2 = { ...process.env };
41109
+ const env3 = { ...process.env };
40357
41110
  if (this.config.apiKey) {
40358
41111
  const provider = this.config.provider?.toLowerCase() ?? "google";
40359
41112
  switch (provider) {
40360
41113
  case "google":
40361
41114
  case "gemini":
40362
- env2.GEMINI_API_KEY = this.config.apiKey;
41115
+ env3.GEMINI_API_KEY = this.config.apiKey;
40363
41116
  break;
40364
41117
  case "anthropic":
40365
- env2.ANTHROPIC_API_KEY = this.config.apiKey;
41118
+ env3.ANTHROPIC_API_KEY = this.config.apiKey;
40366
41119
  break;
40367
41120
  case "openai":
40368
- env2.OPENAI_API_KEY = this.config.apiKey;
41121
+ env3.OPENAI_API_KEY = this.config.apiKey;
40369
41122
  break;
40370
41123
  case "groq":
40371
- env2.GROQ_API_KEY = this.config.apiKey;
41124
+ env3.GROQ_API_KEY = this.config.apiKey;
40372
41125
  break;
40373
41126
  case "xai":
40374
- env2.XAI_API_KEY = this.config.apiKey;
41127
+ env3.XAI_API_KEY = this.config.apiKey;
40375
41128
  break;
40376
41129
  case "openrouter":
40377
- env2.OPENROUTER_API_KEY = this.config.apiKey;
41130
+ env3.OPENROUTER_API_KEY = this.config.apiKey;
40378
41131
  break;
40379
41132
  }
40380
41133
  }
40381
- return env2;
41134
+ return env3;
40382
41135
  }
40383
41136
  async createWorkspace() {
40384
- return await mkdtemp3(path12.join(tmpdir3(), WORKSPACE_PREFIX3));
41137
+ return await mkdtemp4(path13.join(tmpdir4(), WORKSPACE_PREFIX4));
40385
41138
  }
40386
41139
  async cleanupWorkspace(workspaceRoot) {
40387
41140
  try {
40388
- await rm3(workspaceRoot, { recursive: true, force: true });
41141
+ await rm4(workspaceRoot, { recursive: true, force: true });
40389
41142
  } catch {
40390
41143
  }
40391
41144
  }
40392
41145
  resolveLogDirectory() {
40393
41146
  if (this.config.logDir) {
40394
- return path12.resolve(this.config.logDir);
41147
+ return path13.resolve(this.config.logDir);
40395
41148
  }
40396
- return path12.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
41149
+ return path13.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
40397
41150
  }
40398
41151
  async createStreamLogger(request) {
40399
41152
  const logDir = this.resolveLogDirectory();
@@ -40401,13 +41154,13 @@ ${prompt}`;
40401
41154
  return void 0;
40402
41155
  }
40403
41156
  try {
40404
- await mkdir3(logDir, { recursive: true });
41157
+ await mkdir4(logDir, { recursive: true });
40405
41158
  } catch (error40) {
40406
41159
  const message = error40 instanceof Error ? error40.message : String(error40);
40407
41160
  console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
40408
41161
  return void 0;
40409
41162
  }
40410
- const filePath = path12.join(logDir, buildLogFilename3(request, this.targetName));
41163
+ const filePath = path13.join(logDir, buildLogFilename4(request, this.targetName));
40411
41164
  try {
40412
41165
  const logger = await PiStreamLogger.create({
40413
41166
  filePath,
@@ -40440,7 +41193,7 @@ var PiStreamLogger = class _PiStreamLogger {
40440
41193
  constructor(filePath, format) {
40441
41194
  this.filePath = filePath;
40442
41195
  this.format = format;
40443
- this.stream = createWriteStream3(filePath, { flags: "a" });
41196
+ this.stream = createWriteStream4(filePath, { flags: "a" });
40444
41197
  }
40445
41198
  static async create(options) {
40446
41199
  const logger = new _PiStreamLogger(options.filePath, options.format);
@@ -40501,7 +41254,7 @@ var PiStreamLogger = class _PiStreamLogger {
40501
41254
  return void 0;
40502
41255
  }
40503
41256
  const message = this.format === "json" ? formatPiJsonLog(trimmed) : formatPiLogMessage(trimmed, source);
40504
- return `[+${formatElapsed3(this.startedAt)}] [${source}] ${message}`;
41257
+ return `[+${formatElapsed4(this.startedAt)}] [${source}] ${message}`;
40505
41258
  }
40506
41259
  flushRemainder() {
40507
41260
  const stdoutRemainder = this.stdoutBuffer.trim();
@@ -40524,18 +41277,18 @@ var PiStreamLogger = class _PiStreamLogger {
40524
41277
  this.stderrBuffer = "";
40525
41278
  }
40526
41279
  };
40527
- function buildLogFilename3(request, targetName) {
41280
+ function buildLogFilename4(request, targetName) {
40528
41281
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
40529
- const evalId = sanitizeForFilename3(request.evalCaseId ?? "pi");
41282
+ const evalId = sanitizeForFilename4(request.evalCaseId ?? "pi");
40530
41283
  const attemptSuffix = request.attempt !== void 0 ? `_attempt-${request.attempt + 1}` : "";
40531
- const target = sanitizeForFilename3(targetName);
40532
- return `${timestamp}_${target}_${evalId}${attemptSuffix}_${randomUUID3().slice(0, 8)}.log`;
41284
+ const target = sanitizeForFilename4(targetName);
41285
+ return `${timestamp}_${target}_${evalId}${attemptSuffix}_${randomUUID4().slice(0, 8)}.log`;
40533
41286
  }
40534
- function sanitizeForFilename3(value) {
41287
+ function sanitizeForFilename4(value) {
40535
41288
  const sanitized = value.replace(/[^A-Za-z0-9._-]+/g, "_");
40536
41289
  return sanitized.length > 0 ? sanitized : "pi";
40537
41290
  }
40538
- function formatElapsed3(startedAt) {
41291
+ function formatElapsed4(startedAt) {
40539
41292
  const elapsedSeconds = Math.floor((Date.now() - startedAt) / 1e3);
40540
41293
  const hours = Math.floor(elapsedSeconds / 3600);
40541
41294
  const minutes = Math.floor(elapsedSeconds % 3600 / 60);
@@ -40756,7 +41509,7 @@ function extractAssistantText2(messages) {
40756
41509
  function escapeAtSymbols(prompt) {
40757
41510
  return prompt.replace(/@\[([^\]]+)\]:/g, "[[$1]]:");
40758
41511
  }
40759
- function pickDetail3(stderr, stdout) {
41512
+ function pickDetail4(stderr, stdout) {
40760
41513
  const errorText = stderr.trim();
40761
41514
  if (errorText.length > 0) {
40762
41515
  return errorText;
@@ -40764,7 +41517,7 @@ function pickDetail3(stderr, stdout) {
40764
41517
  const stdoutText = stdout.trim();
40765
41518
  return stdoutText.length > 0 ? stdoutText : void 0;
40766
41519
  }
40767
- function formatTimeoutSuffix4(timeoutMs) {
41520
+ function formatTimeoutSuffix5(timeoutMs) {
40768
41521
  if (!timeoutMs || timeoutMs <= 0) {
40769
41522
  return "";
40770
41523
  }
@@ -40777,7 +41530,7 @@ async function defaultPiRunner(options) {
40777
41530
  const executable = parts[0];
40778
41531
  const executableArgs = parts.slice(1);
40779
41532
  const allArgs = [...executableArgs, ...options.args];
40780
- const child = spawn3(executable, allArgs, {
41533
+ const child = spawn4(executable, allArgs, {
40781
41534
  cwd: options.cwd,
40782
41535
  env: options.env,
40783
41536
  stdio: ["pipe", "pipe", "pipe"],
@@ -40840,26 +41593,26 @@ async function defaultPiRunner(options) {
40840
41593
  }
40841
41594
  async function pathExists(target) {
40842
41595
  try {
40843
- await access3(target, constants3.F_OK);
41596
+ await access4(target, constants4.F_OK);
40844
41597
  return true;
40845
41598
  } catch {
40846
41599
  return false;
40847
41600
  }
40848
41601
  }
40849
41602
  async function ensureDir(target) {
40850
- await mkdir4(target, { recursive: true });
41603
+ await mkdir5(target, { recursive: true });
40851
41604
  }
40852
41605
  async function readDirEntries(target) {
40853
41606
  const entries2 = await readdir(target, { withFileTypes: true });
40854
41607
  return entries2.map((entry) => ({
40855
41608
  name: entry.name,
40856
- absolutePath: path13.join(target, entry.name),
41609
+ absolutePath: path14.join(target, entry.name),
40857
41610
  isDirectory: entry.isDirectory()
40858
41611
  }));
40859
41612
  }
40860
41613
  async function removeIfExists(target) {
40861
41614
  try {
40862
- await rm4(target, { force: true, recursive: false });
41615
+ await rm5(target, { force: true, recursive: false });
40863
41616
  } catch (error40) {
40864
41617
  if (error40.code !== "ENOENT") {
40865
41618
  throw error40;
@@ -40867,7 +41620,7 @@ async function removeIfExists(target) {
40867
41620
  }
40868
41621
  }
40869
41622
  function pathToFileUri2(filePath) {
40870
- const absolutePath = path14.isAbsolute(filePath) ? filePath : path14.resolve(filePath);
41623
+ const absolutePath = path15.isAbsolute(filePath) ? filePath : path15.resolve(filePath);
40871
41624
  const normalizedPath = absolutePath.replace(/\\/g, "/");
40872
41625
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
40873
41626
  return `file:///${normalizedPath}`;
@@ -40959,8 +41712,8 @@ function createBatchRequestPrompt(userQuery, responseFileTmp, responseFileFinal,
40959
41712
  });
40960
41713
  }
40961
41714
  function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateContent) {
40962
- const requestLines = requestFiles.map((file2, index) => `${index + 1}. messages/${path15.basename(file2)}`).join("\n");
40963
- const responseList = responseFiles.map((file2) => `"${path15.basename(file2)}"`).join(", ");
41715
+ const requestLines = requestFiles.map((file2, index) => `${index + 1}. messages/${path16.basename(file2)}`).join("\n");
41716
+ const responseList = responseFiles.map((file2) => `"${path16.basename(file2)}"`).join(", ");
40964
41717
  return renderTemplate2(templateContent, {
40965
41718
  requestFiles: requestLines,
40966
41719
  responseList
@@ -41010,7 +41763,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
41010
41763
  }
41011
41764
  async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, silent = false) {
41012
41765
  if (!silent) {
41013
- const fileList = responseFilesFinal.map((file2) => path16.basename(file2)).join(", ");
41766
+ const fileList = responseFilesFinal.map((file2) => path17.basename(file2)).join(", ");
41014
41767
  console.error(`waiting for ${responseFilesFinal.length} batch response(s): ${fileList}`);
41015
41768
  }
41016
41769
  try {
@@ -41060,17 +41813,17 @@ var DEFAULT_LOCK_NAME = "subagent.lock";
41060
41813
  var DEFAULT_ALIVE_FILENAME = ".alive";
41061
41814
  function getDefaultSubagentRoot(vscodeCmd = "code") {
41062
41815
  const folder = vscodeCmd === "code-insiders" ? "vscode-insiders-agents" : "vscode-agents";
41063
- return path17.join(os22.homedir(), ".agentv", "subagents", folder);
41816
+ return path18.join(os22.homedir(), ".agentv", "subagents", folder);
41064
41817
  }
41065
41818
  var DEFAULT_SUBAGENT_ROOT = getDefaultSubagentRoot();
41066
- var execAsync3 = promisify3(exec);
41819
+ var execAsync4 = promisify4(exec);
41067
41820
  var DEFAULT_WAKEUP_CONTENT = `---
41068
41821
  description: 'Wake-up Signal'
41069
41822
  model: Grok Code Fast 1 (copilot)
41070
41823
  ---`;
41071
41824
  async function checkWorkspaceOpened(workspaceName, vscodeCmd) {
41072
41825
  try {
41073
- const { stdout } = await execAsync3(`${vscodeCmd} --status`, {
41826
+ const { stdout } = await execAsync4(`${vscodeCmd} --status`, {
41074
41827
  timeout: 1e4,
41075
41828
  windowsHide: true
41076
41829
  });
@@ -41082,16 +41835,16 @@ async function checkWorkspaceOpened(workspaceName, vscodeCmd) {
41082
41835
  async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir, vscodeCmd, pollInterval = 1, timeout = 60) {
41083
41836
  const alreadyOpen = await checkWorkspaceOpened(workspaceName, vscodeCmd);
41084
41837
  if (alreadyOpen) {
41085
- spawn4(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
41838
+ spawn5(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
41086
41839
  return true;
41087
41840
  }
41088
- const aliveFile = path18.join(subagentDir, DEFAULT_ALIVE_FILENAME);
41841
+ const aliveFile = path19.join(subagentDir, DEFAULT_ALIVE_FILENAME);
41089
41842
  await removeIfExists(aliveFile);
41090
- const githubAgentsDir = path18.join(subagentDir, ".github", "agents");
41091
- await mkdir5(githubAgentsDir, { recursive: true });
41092
- const wakeupDst = path18.join(githubAgentsDir, "wakeup.md");
41093
- await writeFile4(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
41094
- spawn4(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
41843
+ const githubAgentsDir = path19.join(subagentDir, ".github", "agents");
41844
+ await mkdir6(githubAgentsDir, { recursive: true });
41845
+ const wakeupDst = path19.join(githubAgentsDir, "wakeup.md");
41846
+ await writeFile5(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
41847
+ spawn5(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
41095
41848
  await sleep2(100);
41096
41849
  const wakeupChatId = "wakeup";
41097
41850
  const chatArgs = [
@@ -41099,9 +41852,9 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
41099
41852
  "chat",
41100
41853
  "-m",
41101
41854
  wakeupChatId,
41102
- `create a file named .alive in the ${path18.basename(subagentDir)} folder`
41855
+ `create a file named .alive in the ${path19.basename(subagentDir)} folder`
41103
41856
  ];
41104
- spawn4(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
41857
+ spawn5(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
41105
41858
  const start = Date.now();
41106
41859
  while (!await pathExists(aliveFile)) {
41107
41860
  if (Date.now() - start > timeout * 1e3) {
@@ -41114,21 +41867,21 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
41114
41867
  }
41115
41868
  async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, requestInstructions, timestamp, vscodeCmd) {
41116
41869
  try {
41117
- const workspacePath = path18.join(subagentDir, `${path18.basename(subagentDir)}.code-workspace`);
41118
- const messagesDir = path18.join(subagentDir, "messages");
41119
- await mkdir5(messagesDir, { recursive: true });
41120
- const reqFile = path18.join(messagesDir, `${timestamp}_req.md`);
41121
- await writeFile4(reqFile, requestInstructions, { encoding: "utf8" });
41870
+ const workspacePath = path19.join(subagentDir, `${path19.basename(subagentDir)}.code-workspace`);
41871
+ const messagesDir = path19.join(subagentDir, "messages");
41872
+ await mkdir6(messagesDir, { recursive: true });
41873
+ const reqFile = path19.join(messagesDir, `${timestamp}_req.md`);
41874
+ await writeFile5(reqFile, requestInstructions, { encoding: "utf8" });
41122
41875
  const reqUri = pathToFileUri2(reqFile);
41123
41876
  const chatArgs = ["-r", "chat", "-m", chatId];
41124
41877
  for (const attachment of attachmentPaths) {
41125
41878
  chatArgs.push("-a", attachment);
41126
41879
  }
41127
41880
  chatArgs.push("-a", reqFile);
41128
- chatArgs.push(`Follow instructions in [${path18.basename(reqFile)}](${reqUri})`);
41881
+ chatArgs.push(`Follow instructions in [${path19.basename(reqFile)}](${reqUri})`);
41129
41882
  const workspaceReady = await ensureWorkspaceFocused(
41130
41883
  workspacePath,
41131
- path18.basename(subagentDir),
41884
+ path19.basename(subagentDir),
41132
41885
  subagentDir,
41133
41886
  vscodeCmd
41134
41887
  );
@@ -41136,7 +41889,7 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
41136
41889
  console.error("warning: Workspace may not be fully ready");
41137
41890
  }
41138
41891
  await sleep2(500);
41139
- spawn4(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
41892
+ spawn5(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
41140
41893
  return true;
41141
41894
  } catch (error40) {
41142
41895
  console.error(`warning: Failed to launch VS Code: ${error40.message}`);
@@ -41145,9 +41898,9 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
41145
41898
  }
41146
41899
  async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, chatInstruction, vscodeCmd) {
41147
41900
  try {
41148
- const workspacePath = path18.join(subagentDir, `${path18.basename(subagentDir)}.code-workspace`);
41149
- const messagesDir = path18.join(subagentDir, "messages");
41150
- await mkdir5(messagesDir, { recursive: true });
41901
+ const workspacePath = path19.join(subagentDir, `${path19.basename(subagentDir)}.code-workspace`);
41902
+ const messagesDir = path19.join(subagentDir, "messages");
41903
+ await mkdir6(messagesDir, { recursive: true });
41151
41904
  const chatArgs = ["-r", "chat", "-m", chatId];
41152
41905
  for (const attachment of attachmentPaths) {
41153
41906
  chatArgs.push("-a", attachment);
@@ -41155,7 +41908,7 @@ async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, c
41155
41908
  chatArgs.push(chatInstruction);
41156
41909
  const workspaceReady = await ensureWorkspaceFocused(
41157
41910
  workspacePath,
41158
- path18.basename(subagentDir),
41911
+ path19.basename(subagentDir),
41159
41912
  subagentDir,
41160
41913
  vscodeCmd
41161
41914
  );
@@ -41163,7 +41916,7 @@ async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, c
41163
41916
  console.error("warning: Workspace may not be fully ready");
41164
41917
  }
41165
41918
  await sleep2(500);
41166
- spawn4(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
41919
+ spawn5(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
41167
41920
  return true;
41168
41921
  } catch (error40) {
41169
41922
  console.error(`warning: Failed to launch VS Code: ${error40.message}`);
@@ -41185,10 +41938,10 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
41185
41938
  }
41186
41939
  const transformedFolders = workspace.folders.map((folder) => {
41187
41940
  const folderPath = folder.path;
41188
- if (path19.isAbsolute(folderPath)) {
41941
+ if (path20.isAbsolute(folderPath)) {
41189
41942
  return folder;
41190
41943
  }
41191
- const absolutePath = path19.resolve(templateDir, folderPath);
41944
+ const absolutePath = path20.resolve(templateDir, folderPath);
41192
41945
  return {
41193
41946
  ...folder,
41194
41947
  path: absolutePath
@@ -41210,19 +41963,19 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
41210
41963
  if (locationMap && typeof locationMap === "object") {
41211
41964
  const transformedMap = {};
41212
41965
  for (const [locationPath, value] of Object.entries(locationMap)) {
41213
- const isAbsolute = path19.isAbsolute(locationPath);
41966
+ const isAbsolute = path20.isAbsolute(locationPath);
41214
41967
  if (isAbsolute) {
41215
41968
  transformedMap[locationPath] = value;
41216
41969
  } else {
41217
41970
  const firstGlobIndex = locationPath.search(/[*]/);
41218
41971
  if (firstGlobIndex === -1) {
41219
- const resolvedPath = path19.resolve(templateDir, locationPath).replace(/\\/g, "/");
41972
+ const resolvedPath = path20.resolve(templateDir, locationPath).replace(/\\/g, "/");
41220
41973
  transformedMap[resolvedPath] = value;
41221
41974
  } else {
41222
41975
  const basePathEnd = locationPath.lastIndexOf("/", firstGlobIndex);
41223
41976
  const basePath = basePathEnd !== -1 ? locationPath.substring(0, basePathEnd) : ".";
41224
41977
  const patternPath = locationPath.substring(basePathEnd !== -1 ? basePathEnd : 0);
41225
- const resolvedPath = (path19.resolve(templateDir, basePath) + patternPath).replace(
41978
+ const resolvedPath = (path20.resolve(templateDir, basePath) + patternPath).replace(
41226
41979
  /\\/g,
41227
41980
  "/"
41228
41981
  );
@@ -41261,7 +42014,7 @@ async function findUnlockedSubagent(subagentRoot) {
41261
42014
  number: Number.parseInt(entry.name.split("-")[1] ?? "", 10)
41262
42015
  })).filter((entry) => Number.isInteger(entry.number)).sort((a, b) => a.number - b.number);
41263
42016
  for (const subagent of subagents) {
41264
- const lockFile = path20.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
42017
+ const lockFile = path21.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
41265
42018
  if (!await pathExists(lockFile)) {
41266
42019
  return subagent.absolutePath;
41267
42020
  }
@@ -41271,7 +42024,7 @@ async function findUnlockedSubagent(subagentRoot) {
41271
42024
  async function copyAgentConfig(subagentDir, workspaceTemplate) {
41272
42025
  let workspaceContent;
41273
42026
  if (workspaceTemplate) {
41274
- const workspaceSrc = path20.resolve(workspaceTemplate);
42027
+ const workspaceSrc = path21.resolve(workspaceTemplate);
41275
42028
  if (!await pathExists(workspaceSrc)) {
41276
42029
  throw new Error(`workspace template not found: ${workspaceSrc}`);
41277
42030
  }
@@ -41284,41 +42037,41 @@ async function copyAgentConfig(subagentDir, workspaceTemplate) {
41284
42037
  } else {
41285
42038
  workspaceContent = DEFAULT_WORKSPACE_TEMPLATE;
41286
42039
  }
41287
- const workspaceName = `${path20.basename(subagentDir)}.code-workspace`;
41288
- const workspaceDst = path20.join(subagentDir, workspaceName);
41289
- const templateDir = workspaceTemplate ? path20.dirname(path20.resolve(workspaceTemplate)) : subagentDir;
42040
+ const workspaceName = `${path21.basename(subagentDir)}.code-workspace`;
42041
+ const workspaceDst = path21.join(subagentDir, workspaceName);
42042
+ const templateDir = workspaceTemplate ? path21.dirname(path21.resolve(workspaceTemplate)) : subagentDir;
41290
42043
  const workspaceJson = JSON.stringify(workspaceContent, null, 2);
41291
42044
  const transformedContent = transformWorkspacePaths(workspaceJson, templateDir);
41292
- await writeFile5(workspaceDst, transformedContent, "utf8");
41293
- const messagesDir = path20.join(subagentDir, "messages");
41294
- await mkdir6(messagesDir, { recursive: true });
42045
+ await writeFile6(workspaceDst, transformedContent, "utf8");
42046
+ const messagesDir = path21.join(subagentDir, "messages");
42047
+ await mkdir7(messagesDir, { recursive: true });
41295
42048
  return { workspace: workspaceDst, messagesDir };
41296
42049
  }
41297
42050
  async function createSubagentLock(subagentDir) {
41298
- const messagesDir = path20.join(subagentDir, "messages");
42051
+ const messagesDir = path21.join(subagentDir, "messages");
41299
42052
  if (await pathExists(messagesDir)) {
41300
42053
  const files = await readdir2(messagesDir);
41301
42054
  await Promise.all(
41302
42055
  files.map(async (file2) => {
41303
- const target = path20.join(messagesDir, file2);
42056
+ const target = path21.join(messagesDir, file2);
41304
42057
  await removeIfExists(target);
41305
42058
  })
41306
42059
  );
41307
42060
  }
41308
- const githubAgentsDir = path20.join(subagentDir, ".github", "agents");
42061
+ const githubAgentsDir = path21.join(subagentDir, ".github", "agents");
41309
42062
  if (await pathExists(githubAgentsDir)) {
41310
42063
  const agentFiles = await readdir2(githubAgentsDir);
41311
42064
  const preservedFiles = /* @__PURE__ */ new Set(["wakeup.md", "subagent.md"]);
41312
42065
  await Promise.all(
41313
- agentFiles.filter((file2) => file2.endsWith(".md") && !preservedFiles.has(file2)).map((file2) => removeIfExists(path20.join(githubAgentsDir, file2)))
42066
+ agentFiles.filter((file2) => file2.endsWith(".md") && !preservedFiles.has(file2)).map((file2) => removeIfExists(path21.join(githubAgentsDir, file2)))
41314
42067
  );
41315
42068
  }
41316
- const lockFile = path20.join(subagentDir, DEFAULT_LOCK_NAME);
41317
- await writeFile5(lockFile, "", { encoding: "utf8" });
42069
+ const lockFile = path21.join(subagentDir, DEFAULT_LOCK_NAME);
42070
+ await writeFile6(lockFile, "", { encoding: "utf8" });
41318
42071
  return lockFile;
41319
42072
  }
41320
42073
  async function removeSubagentLock(subagentDir) {
41321
- const lockFile = path20.join(subagentDir, DEFAULT_LOCK_NAME);
42074
+ const lockFile = path21.join(subagentDir, DEFAULT_LOCK_NAME);
41322
42075
  await removeIfExists(lockFile);
41323
42076
  }
41324
42077
  async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspaceTemplate, dryRun2) {
@@ -41338,11 +42091,11 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
41338
42091
  return 1;
41339
42092
  }
41340
42093
  if (promptFile) {
41341
- const githubAgentsDir = path20.join(subagentDir, ".github", "agents");
41342
- await mkdir6(githubAgentsDir, { recursive: true });
41343
- const agentFile = path20.join(githubAgentsDir, `${chatId}.md`);
42094
+ const githubAgentsDir = path21.join(subagentDir, ".github", "agents");
42095
+ await mkdir7(githubAgentsDir, { recursive: true });
42096
+ const agentFile = path21.join(githubAgentsDir, `${chatId}.md`);
41344
42097
  try {
41345
- await copyFile(promptFile, agentFile);
42098
+ await copyFile2(promptFile, agentFile);
41346
42099
  } catch (error40) {
41347
42100
  console.error(`error: Failed to copy prompt file to agent mode: ${error40.message}`);
41348
42101
  return 1;
@@ -41357,7 +42110,7 @@ async function resolvePromptFile(promptFile) {
41357
42110
  if (!promptFile) {
41358
42111
  return void 0;
41359
42112
  }
41360
- const resolvedPrompt = path21.resolve(promptFile);
42113
+ const resolvedPrompt = path222.resolve(promptFile);
41361
42114
  if (!await pathExists(resolvedPrompt)) {
41362
42115
  throw new Error(`Prompt file not found: ${resolvedPrompt}`);
41363
42116
  }
@@ -41373,7 +42126,7 @@ async function resolveAttachments(extraAttachments) {
41373
42126
  }
41374
42127
  const resolved = [];
41375
42128
  for (const attachment of extraAttachments) {
41376
- const resolvedPath = path21.resolve(attachment);
42129
+ const resolvedPath = path222.resolve(attachment);
41377
42130
  if (!await pathExists(resolvedPath)) {
41378
42131
  throw new Error(`Attachment not found: ${resolvedPath}`);
41379
42132
  }
@@ -41413,7 +42166,7 @@ async function dispatchAgentSession(options) {
41413
42166
  error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
41414
42167
  };
41415
42168
  }
41416
- const subagentName = path21.basename(subagentDir);
42169
+ const subagentName = path222.basename(subagentDir);
41417
42170
  const chatId = Math.random().toString(16).slice(2, 10);
41418
42171
  const preparationResult = await prepareSubagentDirectory(
41419
42172
  subagentDir,
@@ -41440,9 +42193,9 @@ async function dispatchAgentSession(options) {
41440
42193
  };
41441
42194
  }
41442
42195
  const timestamp = generateTimestamp();
41443
- const messagesDir = path21.join(subagentDir, "messages");
41444
- const responseFileTmp = path21.join(messagesDir, `${timestamp}_res.tmp.md`);
41445
- const responseFileFinal = path21.join(messagesDir, `${timestamp}_res.md`);
42196
+ const messagesDir = path222.join(subagentDir, "messages");
42197
+ const responseFileTmp = path222.join(messagesDir, `${timestamp}_res.tmp.md`);
42198
+ const responseFileFinal = path222.join(messagesDir, `${timestamp}_res.md`);
41446
42199
  const requestInstructions = createRequestPrompt(
41447
42200
  userQuery,
41448
42201
  responseFileTmp,
@@ -41555,7 +42308,7 @@ async function dispatchBatchAgent(options) {
41555
42308
  error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
41556
42309
  };
41557
42310
  }
41558
- subagentName = path21.basename(subagentDir);
42311
+ subagentName = path222.basename(subagentDir);
41559
42312
  const chatId = Math.random().toString(16).slice(2, 10);
41560
42313
  const preparationResult = await prepareSubagentDirectory(
41561
42314
  subagentDir,
@@ -41586,24 +42339,24 @@ async function dispatchBatchAgent(options) {
41586
42339
  };
41587
42340
  }
41588
42341
  const timestamp = generateTimestamp();
41589
- const messagesDir = path21.join(subagentDir, "messages");
42342
+ const messagesDir = path222.join(subagentDir, "messages");
41590
42343
  requestFiles = userQueries.map(
41591
- (_, index) => path21.join(messagesDir, `${timestamp}_${index}_req.md`)
42344
+ (_, index) => path222.join(messagesDir, `${timestamp}_${index}_req.md`)
41592
42345
  );
41593
42346
  const responseTmpFiles = userQueries.map(
41594
- (_, index) => path21.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
42347
+ (_, index) => path222.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
41595
42348
  );
41596
42349
  responseFilesFinal = userQueries.map(
41597
- (_, index) => path21.join(messagesDir, `${timestamp}_${index}_res.md`)
42350
+ (_, index) => path222.join(messagesDir, `${timestamp}_${index}_res.md`)
41598
42351
  );
41599
- const orchestratorFile = path21.join(messagesDir, `${timestamp}_orchestrator.md`);
42352
+ const orchestratorFile = path222.join(messagesDir, `${timestamp}_orchestrator.md`);
41600
42353
  if (!dryRun2) {
41601
42354
  await Promise.all(
41602
42355
  userQueries.map((query, index) => {
41603
42356
  const reqFile = requestFiles[index];
41604
42357
  const tmpFile = responseTmpFiles[index];
41605
42358
  const finalFile = responseFilesFinal[index];
41606
- return writeFile6(
42359
+ return writeFile7(
41607
42360
  reqFile,
41608
42361
  createBatchRequestPrompt(query, tmpFile, finalFile, batchRequestTemplateContent),
41609
42362
  { encoding: "utf8" }
@@ -41615,7 +42368,7 @@ async function dispatchBatchAgent(options) {
41615
42368
  responseFilesFinal,
41616
42369
  orchestratorTemplateContent
41617
42370
  );
41618
- await writeFile6(orchestratorFile, orchestratorContent, { encoding: "utf8" });
42371
+ await writeFile7(orchestratorFile, orchestratorContent, { encoding: "utf8" });
41619
42372
  }
41620
42373
  const chatAttachments = [orchestratorFile, ...attachments];
41621
42374
  const orchestratorUri = pathToFileUri2(orchestratorFile);
@@ -41713,7 +42466,7 @@ async function provisionSubagents(options) {
41713
42466
  if (!Number.isInteger(subagents) || subagents < 1) {
41714
42467
  throw new Error("subagents must be a positive integer");
41715
42468
  }
41716
- const targetPath = path222.resolve(targetRoot);
42469
+ const targetPath = path23.resolve(targetRoot);
41717
42470
  if (!dryRun2) {
41718
42471
  await ensureDir(targetPath);
41719
42472
  }
@@ -41733,7 +42486,7 @@ async function provisionSubagents(options) {
41733
42486
  continue;
41734
42487
  }
41735
42488
  highestNumber = Math.max(highestNumber, parsed);
41736
- const lockFile = path222.join(entry.absolutePath, lockName);
42489
+ const lockFile = path23.join(entry.absolutePath, lockName);
41737
42490
  const locked = await pathExists(lockFile);
41738
42491
  if (locked) {
41739
42492
  lockedSubagents.add(entry.absolutePath);
@@ -41750,10 +42503,10 @@ async function provisionSubagents(options) {
41750
42503
  break;
41751
42504
  }
41752
42505
  const subagentDir = subagent.absolutePath;
41753
- const githubAgentsDir = path222.join(subagentDir, ".github", "agents");
41754
- const lockFile = path222.join(subagentDir, lockName);
41755
- const workspaceDst = path222.join(subagentDir, `${path222.basename(subagentDir)}.code-workspace`);
41756
- const wakeupDst = path222.join(githubAgentsDir, "wakeup.md");
42506
+ const githubAgentsDir = path23.join(subagentDir, ".github", "agents");
42507
+ const lockFile = path23.join(subagentDir, lockName);
42508
+ const workspaceDst = path23.join(subagentDir, `${path23.basename(subagentDir)}.code-workspace`);
42509
+ const wakeupDst = path23.join(githubAgentsDir, "wakeup.md");
41757
42510
  const isLocked = await pathExists(lockFile);
41758
42511
  if (isLocked && !force) {
41759
42512
  continue;
@@ -41762,8 +42515,8 @@ async function provisionSubagents(options) {
41762
42515
  if (!dryRun2) {
41763
42516
  await removeIfExists(lockFile);
41764
42517
  await ensureDir(githubAgentsDir);
41765
- await writeFile7(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
41766
- await writeFile7(wakeupDst, wakeupContent, "utf8");
42518
+ await writeFile8(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
42519
+ await writeFile8(wakeupDst, wakeupContent, "utf8");
41767
42520
  }
41768
42521
  created.push(subagentDir);
41769
42522
  lockedSubagents.delete(subagentDir);
@@ -41773,8 +42526,8 @@ async function provisionSubagents(options) {
41773
42526
  if (!isLocked && force) {
41774
42527
  if (!dryRun2) {
41775
42528
  await ensureDir(githubAgentsDir);
41776
- await writeFile7(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
41777
- await writeFile7(wakeupDst, wakeupContent, "utf8");
42529
+ await writeFile8(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
42530
+ await writeFile8(wakeupDst, wakeupContent, "utf8");
41778
42531
  }
41779
42532
  created.push(subagentDir);
41780
42533
  subagentsProvisioned += 1;
@@ -41782,8 +42535,8 @@ async function provisionSubagents(options) {
41782
42535
  }
41783
42536
  if (!dryRun2 && !await pathExists(workspaceDst)) {
41784
42537
  await ensureDir(githubAgentsDir);
41785
- await writeFile7(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
41786
- await writeFile7(wakeupDst, wakeupContent, "utf8");
42538
+ await writeFile8(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
42539
+ await writeFile8(wakeupDst, wakeupContent, "utf8");
41787
42540
  }
41788
42541
  skippedExisting.push(subagentDir);
41789
42542
  subagentsProvisioned += 1;
@@ -41791,15 +42544,15 @@ async function provisionSubagents(options) {
41791
42544
  let nextIndex = highestNumber;
41792
42545
  while (subagentsProvisioned < subagents) {
41793
42546
  nextIndex += 1;
41794
- const subagentDir = path222.join(targetPath, `subagent-${nextIndex}`);
41795
- const githubAgentsDir = path222.join(subagentDir, ".github", "agents");
41796
- const workspaceDst = path222.join(subagentDir, `${path222.basename(subagentDir)}.code-workspace`);
41797
- const wakeupDst = path222.join(githubAgentsDir, "wakeup.md");
42547
+ const subagentDir = path23.join(targetPath, `subagent-${nextIndex}`);
42548
+ const githubAgentsDir = path23.join(subagentDir, ".github", "agents");
42549
+ const workspaceDst = path23.join(subagentDir, `${path23.basename(subagentDir)}.code-workspace`);
42550
+ const wakeupDst = path23.join(githubAgentsDir, "wakeup.md");
41798
42551
  if (!dryRun2) {
41799
42552
  await ensureDir(subagentDir);
41800
42553
  await ensureDir(githubAgentsDir);
41801
- await writeFile7(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
41802
- await writeFile7(wakeupDst, wakeupContent, "utf8");
42554
+ await writeFile8(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
42555
+ await writeFile8(wakeupDst, wakeupContent, "utf8");
41803
42556
  }
41804
42557
  created.push(subagentDir);
41805
42558
  subagentsProvisioned += 1;
@@ -41974,7 +42727,7 @@ function buildMandatoryPrereadBlock2(guidelineFiles, attachmentFiles) {
41974
42727
  return "";
41975
42728
  }
41976
42729
  const buildList = (files) => files.map((absolutePath) => {
41977
- const fileName = path23.basename(absolutePath);
42730
+ const fileName = path24.basename(absolutePath);
41978
42731
  const fileUri = pathToFileUri3(absolutePath);
41979
42732
  return `* [${fileName}](${fileUri})`;
41980
42733
  });
@@ -41999,8 +42752,8 @@ function collectGuidelineFiles2(attachments, guidelinePatterns) {
41999
42752
  }
42000
42753
  const unique = /* @__PURE__ */ new Map();
42001
42754
  for (const attachment of attachments) {
42002
- const absolutePath = path23.resolve(attachment);
42003
- const normalized = absolutePath.split(path23.sep).join("/");
42755
+ const absolutePath = path24.resolve(attachment);
42756
+ const normalized = absolutePath.split(path24.sep).join("/");
42004
42757
  if (isGuidelineFile(normalized, guidelinePatterns)) {
42005
42758
  if (!unique.has(absolutePath)) {
42006
42759
  unique.set(absolutePath, absolutePath);
@@ -42015,7 +42768,7 @@ function collectAttachmentFiles(attachments) {
42015
42768
  }
42016
42769
  const unique = /* @__PURE__ */ new Map();
42017
42770
  for (const attachment of attachments) {
42018
- const absolutePath = path23.resolve(attachment);
42771
+ const absolutePath = path24.resolve(attachment);
42019
42772
  if (!unique.has(absolutePath)) {
42020
42773
  unique.set(absolutePath, absolutePath);
42021
42774
  }
@@ -42023,7 +42776,7 @@ function collectAttachmentFiles(attachments) {
42023
42776
  return Array.from(unique.values());
42024
42777
  }
42025
42778
  function pathToFileUri3(filePath) {
42026
- const absolutePath = path23.isAbsolute(filePath) ? filePath : path23.resolve(filePath);
42779
+ const absolutePath = path24.isAbsolute(filePath) ? filePath : path24.resolve(filePath);
42027
42780
  const normalizedPath = absolutePath.replace(/\\/g, "/");
42028
42781
  if (/^[a-zA-Z]:\//.test(normalizedPath)) {
42029
42782
  return `file:///${normalizedPath}`;
@@ -42036,7 +42789,7 @@ function normalizeAttachments(attachments) {
42036
42789
  }
42037
42790
  const deduped = /* @__PURE__ */ new Set();
42038
42791
  for (const attachment of attachments) {
42039
- deduped.add(path23.resolve(attachment));
42792
+ deduped.add(path24.resolve(attachment));
42040
42793
  }
42041
42794
  return Array.from(deduped);
42042
42795
  }
@@ -42045,7 +42798,7 @@ function mergeAttachments(all) {
42045
42798
  for (const list of all) {
42046
42799
  if (!list) continue;
42047
42800
  for (const inputFile of list) {
42048
- deduped.add(path23.resolve(inputFile));
42801
+ deduped.add(path24.resolve(inputFile));
42049
42802
  }
42050
42803
  }
42051
42804
  return deduped.size > 0 ? Array.from(deduped) : void 0;
@@ -42118,14 +42871,14 @@ function assertTargetDefinition(value, index, filePath) {
42118
42871
  }
42119
42872
  async function fileExists3(filePath) {
42120
42873
  try {
42121
- await access4(filePath, constants4.F_OK);
42874
+ await access5(filePath, constants5.F_OK);
42122
42875
  return true;
42123
42876
  } catch {
42124
42877
  return false;
42125
42878
  }
42126
42879
  }
42127
42880
  async function readTargetDefinitions(filePath) {
42128
- const absolutePath = path24.resolve(filePath);
42881
+ const absolutePath = path25.resolve(filePath);
42129
42882
  if (!await fileExists3(absolutePath)) {
42130
42883
  throw new Error(`targets.yaml not found at ${absolutePath}`);
42131
42884
  }
@@ -42155,6 +42908,8 @@ function createProvider(target) {
42155
42908
  return new CliProvider(target.name, target.config);
42156
42909
  case "codex":
42157
42910
  return new CodexProvider(target.name, target.config);
42911
+ case "copilot-cli":
42912
+ return new CopilotCliProvider(target.name, target.config);
42158
42913
  case "pi-coding-agent":
42159
42914
  return new PiCodingAgentProvider(target.name, target.config);
42160
42915
  case "pi-agent-sdk":
@@ -42283,10 +43038,10 @@ async function execFileWithStdinBun(argv, stdinPayload, options) {
42283
43038
  }
42284
43039
  }
42285
43040
  async function execFileWithStdinNode(argv, stdinPayload, options) {
42286
- const { spawn: spawn5 } = await import("node:child_process");
43041
+ const { spawn: spawn6 } = await import("node:child_process");
42287
43042
  return new Promise((resolve2, reject) => {
42288
43043
  const [cmd, ...args] = argv;
42289
- const child = spawn5(cmd, args, {
43044
+ const child = spawn6(cmd, args, {
42290
43045
  cwd: options.cwd,
42291
43046
  stdio: ["pipe", "pipe", "pipe"],
42292
43047
  // Merge additional env vars with process.env
@@ -42326,21 +43081,21 @@ async function execFileWithStdinNode(argv, stdinPayload, options) {
42326
43081
  });
42327
43082
  }
42328
43083
  async function execShellWithStdin(command2, stdinPayload, options = {}) {
42329
- const { mkdir: mkdir82, readFile: readFile102, rm: rm5, writeFile: writeFile82 } = await import("node:fs/promises");
42330
- const { tmpdir: tmpdir4 } = await import("node:os");
42331
- const path262 = await import("node:path");
42332
- const { randomUUID: randomUUID4 } = await import("node:crypto");
42333
- const dir = path262.join(tmpdir4(), `agentv-exec-${randomUUID4()}`);
42334
- await mkdir82(dir, { recursive: true });
42335
- const stdinPath = path262.join(dir, "stdin.txt");
42336
- const stdoutPath = path262.join(dir, "stdout.txt");
42337
- const stderrPath = path262.join(dir, "stderr.txt");
42338
- await writeFile82(stdinPath, stdinPayload, "utf8");
43084
+ const { mkdir: mkdir92, readFile: readFile102, rm: rm6, writeFile: writeFile92 } = await import("node:fs/promises");
43085
+ const { tmpdir: tmpdir5 } = await import("node:os");
43086
+ const path272 = await import("node:path");
43087
+ const { randomUUID: randomUUID5 } = await import("node:crypto");
43088
+ const dir = path272.join(tmpdir5(), `agentv-exec-${randomUUID5()}`);
43089
+ await mkdir92(dir, { recursive: true });
43090
+ const stdinPath = path272.join(dir, "stdin.txt");
43091
+ const stdoutPath = path272.join(dir, "stdout.txt");
43092
+ const stderrPath = path272.join(dir, "stderr.txt");
43093
+ await writeFile92(stdinPath, stdinPayload, "utf8");
42339
43094
  const wrappedCommand = process.platform === "win32" ? `(${command2}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}` : `(${command2}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}`;
42340
- const { spawn: spawn5 } = await import("node:child_process");
43095
+ const { spawn: spawn6 } = await import("node:child_process");
42341
43096
  try {
42342
43097
  const exitCode = await new Promise((resolve2, reject) => {
42343
- const child = spawn5(wrappedCommand, {
43098
+ const child = spawn6(wrappedCommand, {
42344
43099
  shell: true,
42345
43100
  cwd: options.cwd,
42346
43101
  stdio: ["ignore", "ignore", "ignore"],
@@ -42368,7 +43123,7 @@ async function execShellWithStdin(command2, stdinPayload, options = {}) {
42368
43123
  const stderr = (await readFile102(stderrPath, "utf8")).replace(/\r\n/g, "\n");
42369
43124
  return { stdout, stderr, exitCode };
42370
43125
  } finally {
42371
- await rm5(dir, { recursive: true, force: true });
43126
+ await rm6(dir, { recursive: true, force: true });
42372
43127
  }
42373
43128
  }
42374
43129
  var DEFAULT_MAX_CALLS = 50;
@@ -42629,7 +43384,7 @@ var CodeEvaluator = class {
42629
43384
  outputMessages: context.outputMessages ?? null,
42630
43385
  guidelineFiles: context.evalCase.guideline_paths,
42631
43386
  inputFiles: context.evalCase.file_paths.filter(
42632
- (path262) => !context.evalCase.guideline_paths.includes(path262)
43387
+ (path272) => !context.evalCase.guideline_paths.includes(path272)
42633
43388
  ),
42634
43389
  inputMessages: context.evalCase.input_messages,
42635
43390
  traceSummary: context.traceSummary ?? null,
@@ -42718,8 +43473,8 @@ var CodeEvaluator = class {
42718
43473
  }
42719
43474
  }
42720
43475
  };
42721
- async function executeScript(scriptPath, input, agentTimeoutMs, cwd, env2) {
42722
- const { stdout, stderr, exitCode } = typeof scriptPath === "string" ? await execShellWithStdin(scriptPath, input, { cwd, timeoutMs: agentTimeoutMs, env: env2 }) : await execFileWithStdin(scriptPath, input, { cwd, timeoutMs: agentTimeoutMs, env: env2 });
43476
+ async function executeScript(scriptPath, input, agentTimeoutMs, cwd, env3) {
43477
+ const { stdout, stderr, exitCode } = typeof scriptPath === "string" ? await execShellWithStdin(scriptPath, input, { cwd, timeoutMs: agentTimeoutMs, env: env3 }) : await execFileWithStdin(scriptPath, input, { cwd, timeoutMs: agentTimeoutMs, env: env3 });
42723
43478
  if (exitCode !== 0) {
42724
43479
  const trimmedErr = formatStderr(stderr);
42725
43480
  throw new Error(
@@ -43536,115 +44291,115 @@ var FieldAccuracyEvaluator = class {
43536
44291
  * Evaluate a single field against the expected value.
43537
44292
  */
43538
44293
  evaluateField(fieldConfig, candidateData, expectedData) {
43539
- const { path: path262, match, required: required2 = true, weight = 1 } = fieldConfig;
43540
- const candidateValue = resolvePath(candidateData, path262);
43541
- const expectedValue = resolvePath(expectedData, path262);
44294
+ const { path: path272, match, required: required2 = true, weight = 1 } = fieldConfig;
44295
+ const candidateValue = resolvePath(candidateData, path272);
44296
+ const expectedValue = resolvePath(expectedData, path272);
43542
44297
  if (expectedValue === void 0) {
43543
44298
  return {
43544
- path: path262,
44299
+ path: path272,
43545
44300
  score: 1,
43546
44301
  // No expected value means no comparison needed
43547
44302
  weight,
43548
44303
  hit: true,
43549
- message: `${path262}: no expected value`
44304
+ message: `${path272}: no expected value`
43550
44305
  };
43551
44306
  }
43552
44307
  if (candidateValue === void 0) {
43553
44308
  if (required2) {
43554
44309
  return {
43555
- path: path262,
44310
+ path: path272,
43556
44311
  score: 0,
43557
44312
  weight,
43558
44313
  hit: false,
43559
- message: `${path262} (required, missing)`
44314
+ message: `${path272} (required, missing)`
43560
44315
  };
43561
44316
  }
43562
44317
  return {
43563
- path: path262,
44318
+ path: path272,
43564
44319
  score: 1,
43565
44320
  // Don't penalize missing optional fields
43566
44321
  weight: 0,
43567
44322
  // Zero weight means it won't affect the score
43568
44323
  hit: true,
43569
- message: `${path262}: optional field missing`
44324
+ message: `${path272}: optional field missing`
43570
44325
  };
43571
44326
  }
43572
44327
  switch (match) {
43573
44328
  case "exact":
43574
- return this.compareExact(path262, candidateValue, expectedValue, weight);
44329
+ return this.compareExact(path272, candidateValue, expectedValue, weight);
43575
44330
  case "numeric_tolerance":
43576
44331
  return this.compareNumericTolerance(
43577
- path262,
44332
+ path272,
43578
44333
  candidateValue,
43579
44334
  expectedValue,
43580
44335
  fieldConfig,
43581
44336
  weight
43582
44337
  );
43583
44338
  case "date":
43584
- return this.compareDate(path262, candidateValue, expectedValue, fieldConfig, weight);
44339
+ return this.compareDate(path272, candidateValue, expectedValue, fieldConfig, weight);
43585
44340
  default:
43586
44341
  return {
43587
- path: path262,
44342
+ path: path272,
43588
44343
  score: 0,
43589
44344
  weight,
43590
44345
  hit: false,
43591
- message: `${path262}: unknown match type "${match}"`
44346
+ message: `${path272}: unknown match type "${match}"`
43592
44347
  };
43593
44348
  }
43594
44349
  }
43595
44350
  /**
43596
44351
  * Exact equality comparison.
43597
44352
  */
43598
- compareExact(path262, candidateValue, expectedValue, weight) {
44353
+ compareExact(path272, candidateValue, expectedValue, weight) {
43599
44354
  if (deepEqual(candidateValue, expectedValue)) {
43600
44355
  return {
43601
- path: path262,
44356
+ path: path272,
43602
44357
  score: 1,
43603
44358
  weight,
43604
44359
  hit: true,
43605
- message: path262
44360
+ message: path272
43606
44361
  };
43607
44362
  }
43608
44363
  if (typeof candidateValue !== typeof expectedValue) {
43609
44364
  return {
43610
- path: path262,
44365
+ path: path272,
43611
44366
  score: 0,
43612
44367
  weight,
43613
44368
  hit: false,
43614
- message: `${path262} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
44369
+ message: `${path272} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
43615
44370
  };
43616
44371
  }
43617
44372
  return {
43618
- path: path262,
44373
+ path: path272,
43619
44374
  score: 0,
43620
44375
  weight,
43621
44376
  hit: false,
43622
- message: `${path262} (value mismatch)`
44377
+ message: `${path272} (value mismatch)`
43623
44378
  };
43624
44379
  }
43625
44380
  /**
43626
44381
  * Numeric comparison with absolute or relative tolerance.
43627
44382
  */
43628
- compareNumericTolerance(path262, candidateValue, expectedValue, fieldConfig, weight) {
44383
+ compareNumericTolerance(path272, candidateValue, expectedValue, fieldConfig, weight) {
43629
44384
  const { tolerance = 0, relative = false } = fieldConfig;
43630
44385
  const candidateNum = toNumber(candidateValue);
43631
44386
  const expectedNum = toNumber(expectedValue);
43632
44387
  if (candidateNum === null || expectedNum === null) {
43633
44388
  return {
43634
- path: path262,
44389
+ path: path272,
43635
44390
  score: 0,
43636
44391
  weight,
43637
44392
  hit: false,
43638
- message: `${path262} (non-numeric value)`
44393
+ message: `${path272} (non-numeric value)`
43639
44394
  };
43640
44395
  }
43641
44396
  if (!Number.isFinite(candidateNum) || !Number.isFinite(expectedNum)) {
43642
44397
  return {
43643
- path: path262,
44398
+ path: path272,
43644
44399
  score: 0,
43645
44400
  weight,
43646
44401
  hit: false,
43647
- message: `${path262} (invalid numeric value)`
44402
+ message: `${path272} (invalid numeric value)`
43648
44403
  };
43649
44404
  }
43650
44405
  const diff = Math.abs(candidateNum - expectedNum);
@@ -43657,61 +44412,61 @@ var FieldAccuracyEvaluator = class {
43657
44412
  }
43658
44413
  if (withinTolerance) {
43659
44414
  return {
43660
- path: path262,
44415
+ path: path272,
43661
44416
  score: 1,
43662
44417
  weight,
43663
44418
  hit: true,
43664
- message: `${path262} (within tolerance: diff=${diff.toFixed(2)})`
44419
+ message: `${path272} (within tolerance: diff=${diff.toFixed(2)})`
43665
44420
  };
43666
44421
  }
43667
44422
  return {
43668
- path: path262,
44423
+ path: path272,
43669
44424
  score: 0,
43670
44425
  weight,
43671
44426
  hit: false,
43672
- message: `${path262} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
44427
+ message: `${path272} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
43673
44428
  };
43674
44429
  }
43675
44430
  /**
43676
44431
  * Date comparison with format normalization.
43677
44432
  */
43678
- compareDate(path262, candidateValue, expectedValue, fieldConfig, weight) {
44433
+ compareDate(path272, candidateValue, expectedValue, fieldConfig, weight) {
43679
44434
  const formats = fieldConfig.formats ?? DEFAULT_DATE_FORMATS;
43680
44435
  const candidateDate = parseDate(String(candidateValue), formats);
43681
44436
  const expectedDate = parseDate(String(expectedValue), formats);
43682
44437
  if (candidateDate === null) {
43683
44438
  return {
43684
- path: path262,
44439
+ path: path272,
43685
44440
  score: 0,
43686
44441
  weight,
43687
44442
  hit: false,
43688
- message: `${path262} (unparseable candidate date)`
44443
+ message: `${path272} (unparseable candidate date)`
43689
44444
  };
43690
44445
  }
43691
44446
  if (expectedDate === null) {
43692
44447
  return {
43693
- path: path262,
44448
+ path: path272,
43694
44449
  score: 0,
43695
44450
  weight,
43696
44451
  hit: false,
43697
- message: `${path262} (unparseable expected date)`
44452
+ message: `${path272} (unparseable expected date)`
43698
44453
  };
43699
44454
  }
43700
44455
  if (candidateDate.getFullYear() === expectedDate.getFullYear() && candidateDate.getMonth() === expectedDate.getMonth() && candidateDate.getDate() === expectedDate.getDate()) {
43701
44456
  return {
43702
- path: path262,
44457
+ path: path272,
43703
44458
  score: 1,
43704
44459
  weight,
43705
44460
  hit: true,
43706
- message: path262
44461
+ message: path272
43707
44462
  };
43708
44463
  }
43709
44464
  return {
43710
- path: path262,
44465
+ path: path272,
43711
44466
  score: 0,
43712
44467
  weight,
43713
44468
  hit: false,
43714
- message: `${path262} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
44469
+ message: `${path272} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
43715
44470
  };
43716
44471
  }
43717
44472
  /**
@@ -43751,11 +44506,11 @@ var FieldAccuracyEvaluator = class {
43751
44506
  };
43752
44507
  }
43753
44508
  };
43754
- function resolvePath(obj, path262) {
43755
- if (!path262 || !obj) {
44509
+ function resolvePath(obj, path272) {
44510
+ if (!path272 || !obj) {
43756
44511
  return void 0;
43757
44512
  }
43758
- const parts = path262.split(/\.|\[|\]/).filter((p) => p.length > 0);
44513
+ const parts = path272.split(/\.|\[|\]/).filter((p) => p.length > 0);
43759
44514
  let current = obj;
43760
44515
  for (const part of parts) {
43761
44516
  if (current === null || current === void 0) {
@@ -44410,7 +45165,7 @@ async function runEvaluation(options) {
44410
45165
  repoRoot,
44411
45166
  target,
44412
45167
  targets,
44413
- env: env2,
45168
+ env: env3,
44414
45169
  providerFactory,
44415
45170
  evaluators,
44416
45171
  maxRetries,
@@ -44438,7 +45193,7 @@ async function runEvaluation(options) {
44438
45193
  for (const definition of targets ?? []) {
44439
45194
  targetDefinitions.set(definition.name, definition);
44440
45195
  }
44441
- const envLookup = env2 ?? process.env;
45196
+ const envLookup = env3 ?? process.env;
44442
45197
  const providerCache = /* @__PURE__ */ new Map();
44443
45198
  const getOrCreateProvider = (resolved) => {
44444
45199
  const existing = providerCache.get(resolved.name);
@@ -45061,7 +45816,7 @@ async function runEvaluatorList(options) {
45061
45816
  });
45062
45817
  }
45063
45818
  if (evaluator.type === "composite") {
45064
- const evalFileDir = evalCase.guideline_paths[0] ? path25.dirname(evalCase.guideline_paths[0]) : process.cwd();
45819
+ const evalFileDir = evalCase.guideline_paths[0] ? path26.dirname(evalCase.guideline_paths[0]) : process.cwd();
45065
45820
  const createEvaluator = (memberConfig) => {
45066
45821
  switch (memberConfig.type) {
45067
45822
  case "llm_judge":
@@ -45417,7 +46172,7 @@ async function executePromptTemplate(script, context, config2, timeoutMs) {
45417
46172
  };
45418
46173
  const inputJson = JSON.stringify(toSnakeCaseDeep2(payload), null, 2);
45419
46174
  const scriptPath = script[script.length - 1];
45420
- const cwd = path25.dirname(scriptPath);
46175
+ const cwd = path26.dirname(scriptPath);
45421
46176
  try {
45422
46177
  const stdout = await executeScript(script, inputJson, timeoutMs, cwd);
45423
46178
  const prompt = stdout.trim();
@@ -45708,7 +46463,7 @@ var convertCommand = command({
45708
46463
  const outputPath = out ?? input.replace(/\.jsonl$/, ".yaml");
45709
46464
  try {
45710
46465
  const count = convertJsonlToYaml(input, outputPath);
45711
- console.log(`Converted ${count} records to ${path26.resolve(outputPath)}`);
46466
+ console.log(`Converted ${count} records to ${path27.resolve(outputPath)}`);
45712
46467
  } catch (error40) {
45713
46468
  console.error(`Error: ${error40.message}`);
45714
46469
  process.exit(1);
@@ -45718,25 +46473,25 @@ var convertCommand = command({
45718
46473
 
45719
46474
  // src/commands/eval/index.ts
45720
46475
  import { stat as stat4 } from "node:fs/promises";
45721
- import path35 from "node:path";
46476
+ import path36 from "node:path";
45722
46477
  import fg from "fast-glob";
45723
46478
 
45724
46479
  // src/commands/eval/run-eval.ts
45725
- import { constants as constants7 } from "node:fs";
45726
- import { access as access7 } from "node:fs/promises";
45727
- import path34 from "node:path";
46480
+ import { constants as constants8 } from "node:fs";
46481
+ import { access as access8 } from "node:fs/promises";
46482
+ import path35 from "node:path";
45728
46483
  import { pathToFileURL } from "node:url";
45729
46484
 
45730
46485
  // src/commands/eval/env.ts
45731
- import { constants as constants5 } from "node:fs";
45732
- import { access as access5 } from "node:fs/promises";
45733
- import path27 from "node:path";
46486
+ import { constants as constants6 } from "node:fs";
46487
+ import { access as access6 } from "node:fs/promises";
46488
+ import path28 from "node:path";
45734
46489
  import { config as loadDotenv } from "dotenv";
45735
46490
  function uniqueDirs(directories) {
45736
46491
  const seen = /* @__PURE__ */ new Set();
45737
46492
  const result = [];
45738
46493
  for (const dir of directories) {
45739
- const absolute = path27.resolve(dir);
46494
+ const absolute = path28.resolve(dir);
45740
46495
  if (seen.has(absolute)) {
45741
46496
  continue;
45742
46497
  }
@@ -45747,7 +46502,7 @@ function uniqueDirs(directories) {
45747
46502
  }
45748
46503
  async function fileExists4(filePath) {
45749
46504
  try {
45750
- await access5(filePath, constants5.F_OK);
46505
+ await access6(filePath, constants6.F_OK);
45751
46506
  return true;
45752
46507
  } catch {
45753
46508
  return false;
@@ -45755,14 +46510,14 @@ async function fileExists4(filePath) {
45755
46510
  }
45756
46511
  function collectAncestorDirectories(start, boundary) {
45757
46512
  const directories = [];
45758
- const boundaryDir = path27.resolve(boundary);
45759
- let current = path27.resolve(start);
46513
+ const boundaryDir = path28.resolve(boundary);
46514
+ let current = path28.resolve(start);
45760
46515
  while (current !== void 0) {
45761
46516
  directories.push(current);
45762
46517
  if (current === boundaryDir) {
45763
46518
  break;
45764
46519
  }
45765
- const parent = path27.dirname(current);
46520
+ const parent = path28.dirname(current);
45766
46521
  if (parent === current) {
45767
46522
  break;
45768
46523
  }
@@ -45772,12 +46527,12 @@ function collectAncestorDirectories(start, boundary) {
45772
46527
  }
45773
46528
  async function loadEnvFromHierarchy(options) {
45774
46529
  const { testFilePath, repoRoot, verbose } = options;
45775
- const testDir = path27.dirname(path27.resolve(testFilePath));
46530
+ const testDir = path28.dirname(path28.resolve(testFilePath));
45776
46531
  const cwd = process.cwd();
45777
46532
  const searchDirs = uniqueDirs([...collectAncestorDirectories(testDir, repoRoot), repoRoot, cwd]);
45778
46533
  const envFiles = [];
45779
46534
  for (const dir of searchDirs) {
45780
- const candidate = path27.join(dir, ".env");
46535
+ const candidate = path28.join(dir, ".env");
45781
46536
  if (await fileExists4(candidate)) {
45782
46537
  envFiles.push(candidate);
45783
46538
  }
@@ -45799,9 +46554,9 @@ async function loadEnvFromHierarchy(options) {
45799
46554
  }
45800
46555
 
45801
46556
  // src/commands/eval/jsonl-writer.ts
45802
- import { createWriteStream as createWriteStream4 } from "node:fs";
45803
- import { mkdir as mkdir7 } from "node:fs/promises";
45804
- import path28 from "node:path";
46557
+ import { createWriteStream as createWriteStream5 } from "node:fs";
46558
+ import { mkdir as mkdir8 } from "node:fs/promises";
46559
+ import path29 from "node:path";
45805
46560
  import { finished } from "node:stream/promises";
45806
46561
 
45807
46562
  // ../../node_modules/.bun/async-mutex@0.5.0/node_modules/async-mutex/index.mjs
@@ -46019,8 +46774,8 @@ var JsonlWriter = class _JsonlWriter {
46019
46774
  this.stream = stream;
46020
46775
  }
46021
46776
  static async open(filePath) {
46022
- await mkdir7(path28.dirname(filePath), { recursive: true });
46023
- const stream = createWriteStream4(filePath, { flags: "w", encoding: "utf8" });
46777
+ await mkdir8(path29.dirname(filePath), { recursive: true });
46778
+ const stream = createWriteStream5(filePath, { flags: "w", encoding: "utf8" });
46024
46779
  return new _JsonlWriter(stream);
46025
46780
  }
46026
46781
  async append(record2) {
@@ -46050,9 +46805,9 @@ var JsonlWriter = class _JsonlWriter {
46050
46805
  };
46051
46806
 
46052
46807
  // src/commands/eval/yaml-writer.ts
46053
- import { createWriteStream as createWriteStream5 } from "node:fs";
46054
- import { mkdir as mkdir8 } from "node:fs/promises";
46055
- import path29 from "node:path";
46808
+ import { createWriteStream as createWriteStream6 } from "node:fs";
46809
+ import { mkdir as mkdir9 } from "node:fs/promises";
46810
+ import path30 from "node:path";
46056
46811
  import { finished as finished2 } from "node:stream/promises";
46057
46812
  import { stringify as stringifyYaml2 } from "yaml";
46058
46813
  var YamlWriter = class _YamlWriter {
@@ -46064,8 +46819,8 @@ var YamlWriter = class _YamlWriter {
46064
46819
  this.stream = stream;
46065
46820
  }
46066
46821
  static async open(filePath) {
46067
- await mkdir8(path29.dirname(filePath), { recursive: true });
46068
- const stream = createWriteStream5(filePath, { flags: "w", encoding: "utf8" });
46822
+ await mkdir9(path30.dirname(filePath), { recursive: true });
46823
+ const stream = createWriteStream6(filePath, { flags: "w", encoding: "utf8" });
46069
46824
  return new _YamlWriter(stream);
46070
46825
  }
46071
46826
  async append(record2) {
@@ -46184,12 +46939,12 @@ var ProgressDisplay = class {
46184
46939
  }
46185
46940
  addLogPaths(paths, provider) {
46186
46941
  const newPaths = [];
46187
- for (const path40 of paths) {
46188
- if (this.logPathSet.has(path40)) {
46942
+ for (const path41 of paths) {
46943
+ if (this.logPathSet.has(path41)) {
46189
46944
  continue;
46190
46945
  }
46191
- this.logPathSet.add(path40);
46192
- newPaths.push(path40);
46946
+ this.logPathSet.add(path41);
46947
+ newPaths.push(path41);
46193
46948
  }
46194
46949
  if (newPaths.length === 0) {
46195
46950
  return;
@@ -46197,13 +46952,13 @@ var ProgressDisplay = class {
46197
46952
  this.logPaths.push(...newPaths);
46198
46953
  if (!this.hasPrintedLogHeader) {
46199
46954
  console.log("");
46200
- const label = provider === "pi" ? "Pi Coding Agent" : "Codex CLI";
46955
+ const label = provider === "pi" ? "Pi Coding Agent" : provider === "copilot" ? "Copilot CLI" : "Codex CLI";
46201
46956
  console.log(`${label} logs:`);
46202
46957
  this.hasPrintedLogHeader = true;
46203
46958
  }
46204
46959
  const startIndex = this.logPaths.length - newPaths.length;
46205
- newPaths.forEach((path40, offset) => {
46206
- console.log(`${startIndex + offset + 1}. ${path40}`);
46960
+ newPaths.forEach((path41, offset) => {
46961
+ console.log(`${startIndex + offset + 1}. ${path41}`);
46207
46962
  });
46208
46963
  }
46209
46964
  finish() {
@@ -46358,7 +47113,7 @@ function formatEvaluationSummary(summary) {
46358
47113
 
46359
47114
  // ../../packages/core/dist/evaluation/validation/index.js
46360
47115
  import { readFile as readFile10 } from "node:fs/promises";
46361
- import path30 from "node:path";
47116
+ import path31 from "node:path";
46362
47117
  import { parse as parse6 } from "yaml";
46363
47118
  import { readFile as readFile23 } from "node:fs/promises";
46364
47119
  import path210 from "node:path";
@@ -46401,8 +47156,8 @@ async function detectFileType(filePath) {
46401
47156
  }
46402
47157
  }
46403
47158
  function inferFileTypeFromPath(filePath) {
46404
- const normalized = path30.normalize(filePath).replace(/\\/g, "/");
46405
- const basename = path30.basename(filePath);
47159
+ const normalized = path31.normalize(filePath).replace(/\\/g, "/");
47160
+ const basename = path31.basename(filePath);
46406
47161
  if (normalized.includes("/.agentv/")) {
46407
47162
  if (basename === "config.yaml" || basename === "config.yml") {
46408
47163
  return "config";
@@ -46723,6 +47478,28 @@ var CODEX_SETTINGS = /* @__PURE__ */ new Set([
46723
47478
  "log_output_format",
46724
47479
  "logOutputFormat"
46725
47480
  ]);
47481
+ var COPILOT_SETTINGS = /* @__PURE__ */ new Set([
47482
+ ...COMMON_SETTINGS,
47483
+ "executable",
47484
+ "command",
47485
+ "binary",
47486
+ "args",
47487
+ "arguments",
47488
+ "model",
47489
+ "cwd",
47490
+ "timeout_seconds",
47491
+ "timeoutSeconds",
47492
+ "log_dir",
47493
+ "logDir",
47494
+ "log_directory",
47495
+ "logDirectory",
47496
+ "log_format",
47497
+ "logFormat",
47498
+ "log_output_format",
47499
+ "logOutputFormat",
47500
+ "system_prompt",
47501
+ "systemPrompt"
47502
+ ]);
46726
47503
  var VSCODE_SETTINGS = /* @__PURE__ */ new Set([
46727
47504
  ...COMMON_SETTINGS,
46728
47505
  "workspace_template",
@@ -46759,6 +47536,8 @@ function getKnownSettings(provider) {
46759
47536
  case "codex":
46760
47537
  case "codex-cli":
46761
47538
  return CODEX_SETTINGS;
47539
+ case "copilot-cli":
47540
+ return COPILOT_SETTINGS;
46762
47541
  case "vscode":
46763
47542
  case "vscode-insiders":
46764
47543
  return VSCODE_SETTINGS;
@@ -47199,18 +47978,18 @@ async function validateMessagesFileRefs(messages, location, searchRoots, filePat
47199
47978
  }
47200
47979
 
47201
47980
  // src/utils/targets.ts
47202
- import { constants as constants6 } from "node:fs";
47203
- import { access as access6 } from "node:fs/promises";
47204
- import path31 from "node:path";
47981
+ import { constants as constants7 } from "node:fs";
47982
+ import { access as access7 } from "node:fs/promises";
47983
+ import path34 from "node:path";
47205
47984
  var TARGET_FILE_CANDIDATES = [
47206
47985
  "targets.yaml",
47207
47986
  "targets.yml",
47208
- path31.join(".agentv", "targets.yaml"),
47209
- path31.join(".agentv", "targets.yml")
47987
+ path34.join(".agentv", "targets.yaml"),
47988
+ path34.join(".agentv", "targets.yml")
47210
47989
  ];
47211
47990
  async function fileExists5(filePath) {
47212
47991
  try {
47213
- await access6(filePath, constants6.F_OK);
47992
+ await access7(filePath, constants7.F_OK);
47214
47993
  return true;
47215
47994
  } catch {
47216
47995
  return false;
@@ -47219,12 +47998,12 @@ async function fileExists5(filePath) {
47219
47998
  async function discoverTargetsFile(options) {
47220
47999
  const { explicitPath, testFilePath, repoRoot, cwd } = options;
47221
48000
  if (explicitPath) {
47222
- const resolvedExplicit = path31.resolve(explicitPath);
48001
+ const resolvedExplicit = path34.resolve(explicitPath);
47223
48002
  if (await fileExists5(resolvedExplicit)) {
47224
48003
  return resolvedExplicit;
47225
48004
  }
47226
48005
  for (const candidate of TARGET_FILE_CANDIDATES) {
47227
- const nested = path31.join(resolvedExplicit, candidate);
48006
+ const nested = path34.join(resolvedExplicit, candidate);
47228
48007
  if (await fileExists5(nested)) {
47229
48008
  return nested;
47230
48009
  }
@@ -47232,13 +48011,13 @@ async function discoverTargetsFile(options) {
47232
48011
  throw new Error(`targets.yaml not found at provided path: ${resolvedExplicit}`);
47233
48012
  }
47234
48013
  const directories = [...buildDirectoryChain(testFilePath, repoRoot)];
47235
- const resolvedCwd = path31.resolve(cwd);
48014
+ const resolvedCwd = path34.resolve(cwd);
47236
48015
  if (!directories.includes(resolvedCwd)) {
47237
48016
  directories.push(resolvedCwd);
47238
48017
  }
47239
48018
  for (const directory of directories) {
47240
48019
  for (const candidate of TARGET_FILE_CANDIDATES) {
47241
- const fullPath = path31.join(directory, candidate);
48020
+ const fullPath = path34.join(directory, candidate);
47242
48021
  if (await fileExists5(fullPath)) {
47243
48022
  return fullPath;
47244
48023
  }
@@ -47280,7 +48059,7 @@ async function selectTarget(options) {
47280
48059
  dryRunDelay,
47281
48060
  dryRunDelayMin,
47282
48061
  dryRunDelayMax,
47283
- env: env2
48062
+ env: env3
47284
48063
  } = options;
47285
48064
  const targetsFilePath = await discoverTargetsFile({
47286
48065
  explicitPath: explicitTargetsPath,
@@ -47347,7 +48126,7 @@ Errors in ${targetsFilePath}:`);
47347
48126
  };
47348
48127
  }
47349
48128
  try {
47350
- const resolvedTarget = resolveTargetDefinition(targetDefinition, env2, testFilePath);
48129
+ const resolvedTarget = resolveTargetDefinition(targetDefinition, env3, testFilePath);
47351
48130
  return {
47352
48131
  definitions,
47353
48132
  resolvedTarget,
@@ -47408,21 +48187,21 @@ function normalizeOptions(rawOptions) {
47408
48187
  }
47409
48188
  async function ensureFileExists(filePath, description) {
47410
48189
  try {
47411
- await access7(filePath, constants7.F_OK);
48190
+ await access8(filePath, constants8.F_OK);
47412
48191
  } catch {
47413
48192
  throw new Error(`${description} not found: ${filePath}`);
47414
48193
  }
47415
48194
  }
47416
48195
  async function findRepoRoot(start) {
47417
- const fallback = path34.resolve(start);
48196
+ const fallback = path35.resolve(start);
47418
48197
  let current = fallback;
47419
48198
  while (current !== void 0) {
47420
- const candidate = path34.join(current, ".git");
48199
+ const candidate = path35.join(current, ".git");
47421
48200
  try {
47422
- await access7(candidate, constants7.F_OK);
48201
+ await access8(candidate, constants8.F_OK);
47423
48202
  return current;
47424
48203
  } catch {
47425
- const parent = path34.dirname(current);
48204
+ const parent = path35.dirname(current);
47426
48205
  if (parent === current) {
47427
48206
  break;
47428
48207
  }
@@ -47435,7 +48214,7 @@ function buildDefaultOutputPath(cwd, format) {
47435
48214
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
47436
48215
  const baseName = "eval";
47437
48216
  const extension = getDefaultExtension(format);
47438
- return path34.join(cwd, ".agentv", "results", `${baseName}_${timestamp}${extension}`);
48217
+ return path35.join(cwd, ".agentv", "results", `${baseName}_${timestamp}${extension}`);
47439
48218
  }
47440
48219
  function createEvaluationCache() {
47441
48220
  const store = /* @__PURE__ */ new Map();
@@ -47460,7 +48239,7 @@ function createProgressReporter(maxWorkers, options) {
47460
48239
  };
47461
48240
  }
47462
48241
  function makeEvalKey(testFilePath, evalId) {
47463
- return `${path34.resolve(testFilePath)}::${evalId}`;
48242
+ return `${path35.resolve(testFilePath)}::${evalId}`;
47464
48243
  }
47465
48244
  function createDisplayIdTracker() {
47466
48245
  const map2 = /* @__PURE__ */ new Map();
@@ -47623,14 +48402,14 @@ async function runEvalCommand(input) {
47623
48402
  if (options.verbose) {
47624
48403
  console.log(`Repository root: ${repoRoot}`);
47625
48404
  }
47626
- const outputPath = options.outPath ? path34.resolve(options.outPath) : buildDefaultOutputPath(cwd, options.format);
48405
+ const outputPath = options.outPath ? path35.resolve(options.outPath) : buildDefaultOutputPath(cwd, options.format);
47627
48406
  console.log(`Output path: ${outputPath}`);
47628
48407
  const outputWriter = await createOutputWriter(outputPath, options.format);
47629
48408
  const cache = options.cache ? createEvaluationCache() : void 0;
47630
48409
  const evaluationRunner = await resolveEvaluationRunner();
47631
48410
  const allResults = [];
47632
48411
  const seenEvalCases = /* @__PURE__ */ new Set();
47633
- const resolvedTestFiles = input.testFiles.map((file2) => path34.resolve(file2));
48412
+ const resolvedTestFiles = input.testFiles.map((file2) => path35.resolve(file2));
47634
48413
  const displayIdTracker = createDisplayIdTracker();
47635
48414
  const totalWorkers = options.workers ?? DEFAULT_WORKERS;
47636
48415
  const fileConcurrency = Math.min(
@@ -47674,6 +48453,14 @@ async function runEvalCommand(input) {
47674
48453
  seenPiLogPaths.add(entry.filePath);
47675
48454
  progressReporter.addLogPaths([entry.filePath], "pi");
47676
48455
  });
48456
+ const seenCopilotLogPaths = /* @__PURE__ */ new Set();
48457
+ const unsubscribeCopilotLogs = subscribeToCopilotCliLogEntries((entry) => {
48458
+ if (!entry.filePath || seenCopilotLogPaths.has(entry.filePath)) {
48459
+ return;
48460
+ }
48461
+ seenCopilotLogPaths.add(entry.filePath);
48462
+ progressReporter.addLogPaths([entry.filePath], "copilot");
48463
+ });
47677
48464
  for (const [testFilePath, meta] of fileMetadata.entries()) {
47678
48465
  for (const evalId of meta.evalIds) {
47679
48466
  const evalKey = makeEvalKey(testFilePath, evalId);
@@ -47721,6 +48508,7 @@ Results written to: ${outputPath}`);
47721
48508
  } finally {
47722
48509
  unsubscribeCodexLogs();
47723
48510
  unsubscribePiLogs();
48511
+ unsubscribeCopilotLogs();
47724
48512
  await outputWriter.close().catch(() => void 0);
47725
48513
  }
47726
48514
  }
@@ -47729,7 +48517,7 @@ async function resolveEvaluationRunner() {
47729
48517
  if (!overridePath) {
47730
48518
  return runEvaluation;
47731
48519
  }
47732
- const resolved = path34.isAbsolute(overridePath) ? overridePath : path34.resolve(process.cwd(), overridePath);
48520
+ const resolved = path35.isAbsolute(overridePath) ? overridePath : path35.resolve(process.cwd(), overridePath);
47733
48521
  const moduleUrl = pathToFileURL(resolved).href;
47734
48522
  const mod = await import(moduleUrl);
47735
48523
  const candidate = mod.runEvaluation;
@@ -47856,7 +48644,7 @@ async function resolveEvalPaths(evalPaths, cwd) {
47856
48644
  const unmatched = [];
47857
48645
  const results = /* @__PURE__ */ new Set();
47858
48646
  for (const pattern of normalizedInputs) {
47859
- const candidatePath = path35.isAbsolute(pattern) ? path35.normalize(pattern) : path35.resolve(cwd, pattern);
48647
+ const candidatePath = path36.isAbsolute(pattern) ? path36.normalize(pattern) : path36.resolve(cwd, pattern);
47860
48648
  try {
47861
48649
  const stats = await stat4(candidatePath);
47862
48650
  if (stats.isFile() && /\.(ya?ml|jsonl)$/i.test(candidatePath)) {
@@ -47880,7 +48668,7 @@ async function resolveEvalPaths(evalPaths, cwd) {
47880
48668
  continue;
47881
48669
  }
47882
48670
  for (const filePath of yamlMatches) {
47883
- results.add(path35.normalize(filePath));
48671
+ results.add(path36.normalize(filePath));
47884
48672
  }
47885
48673
  }
47886
48674
  if (unmatched.length > 0) {
@@ -47896,8 +48684,8 @@ async function resolveEvalPaths(evalPaths, cwd) {
47896
48684
  }
47897
48685
 
47898
48686
  // src/commands/generate/rubrics.ts
47899
- import { readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
47900
- import path36 from "node:path";
48687
+ import { readFile as readFile11, writeFile as writeFile9 } from "node:fs/promises";
48688
+ import path37 from "node:path";
47901
48689
  import { pathToFileURL as pathToFileURL2 } from "node:url";
47902
48690
  import { isMap, isSeq, parseDocument } from "yaml";
47903
48691
  function isJsonObject3(value) {
@@ -47909,7 +48697,7 @@ function asString7(value) {
47909
48697
  async function loadRubricGenerator() {
47910
48698
  const customGenerator = process.env.AGENTEVO_CLI_RUBRIC_GENERATOR;
47911
48699
  if (customGenerator) {
47912
- const generatorPath = path36.resolve(customGenerator);
48700
+ const generatorPath = path37.resolve(customGenerator);
47913
48701
  const generatorUrl = pathToFileURL2(generatorPath).href;
47914
48702
  const module = await import(generatorUrl);
47915
48703
  return module.generateRubrics;
@@ -47919,7 +48707,7 @@ async function loadRubricGenerator() {
47919
48707
  async function generateRubricsCommand(options) {
47920
48708
  const { file: file2, target: targetOverride, verbose } = options;
47921
48709
  console.log(`Generating rubrics for: ${file2}`);
47922
- const absolutePath = path36.resolve(file2);
48710
+ const absolutePath = path37.resolve(file2);
47923
48711
  const content = await readFile11(absolutePath, "utf8");
47924
48712
  const doc = parseDocument(content);
47925
48713
  const parsed = doc.toJSON();
@@ -48003,7 +48791,7 @@ async function generateRubricsCommand(options) {
48003
48791
  }
48004
48792
  if (updatedCount > 0) {
48005
48793
  const output = doc.toString();
48006
- await writeFile8(absolutePath, output, "utf8");
48794
+ await writeFile9(absolutePath, output, "utf8");
48007
48795
  console.log(`
48008
48796
  Updated ${updatedCount} eval case(s) with generated rubrics`);
48009
48797
  if (skippedCount > 0) {
@@ -48078,23 +48866,23 @@ var generateCommand = subcommands({
48078
48866
 
48079
48867
  // src/commands/init/index.ts
48080
48868
  import { existsSync, mkdirSync, writeFileSync as writeFileSync2 } from "node:fs";
48081
- import path38 from "node:path";
48869
+ import path39 from "node:path";
48082
48870
  import * as readline from "node:readline/promises";
48083
48871
 
48084
48872
  // src/templates/index.ts
48085
48873
  import { readFileSync as readFileSync3, readdirSync, statSync } from "node:fs";
48086
- import path37 from "node:path";
48874
+ import path38 from "node:path";
48087
48875
  import { fileURLToPath } from "node:url";
48088
48876
  function getGithubTemplates() {
48089
48877
  if (isDistRuntime()) {
48090
48878
  return getTemplatesFromDir(".github");
48091
48879
  }
48092
48880
  const templatesDir = getRepoRootFromDev();
48093
- const promptsDir = path37.join(templatesDir, ".github", "prompts");
48881
+ const promptsDir = path38.join(templatesDir, ".github", "prompts");
48094
48882
  const promptFiles = readdirSync(promptsDir).filter((file2) => file2.startsWith("agentv-"));
48095
48883
  return promptFiles.map((file2) => ({
48096
48884
  path: `prompts/${file2}`,
48097
- content: readFileSync3(path37.join(promptsDir, file2), "utf-8")
48885
+ content: readFileSync3(path38.join(promptsDir, file2), "utf-8")
48098
48886
  }));
48099
48887
  }
48100
48888
  function getAgentvTemplates() {
@@ -48105,47 +48893,47 @@ function getClaudeTemplates() {
48105
48893
  return getTemplatesFromDir(".claude");
48106
48894
  }
48107
48895
  const repoRoot = getRepoRootFromDev();
48108
- const skillsRoot = path37.join(repoRoot, ".claude", "skills");
48896
+ const skillsRoot = path38.join(repoRoot, ".claude", "skills");
48109
48897
  const skillsToInclude = ["agentv-eval-builder", "agentv-prompt-optimizer"];
48110
48898
  const templates = [];
48111
48899
  for (const skill of skillsToInclude) {
48112
- const skillDir = path37.join(skillsRoot, skill);
48113
- const skillTemplates = readTemplatesRecursively(skillDir, path37.join("skills", skill));
48900
+ const skillDir = path38.join(skillsRoot, skill);
48901
+ const skillTemplates = readTemplatesRecursively(skillDir, path38.join("skills", skill));
48114
48902
  templates.push(...skillTemplates);
48115
48903
  }
48116
48904
  return templates;
48117
48905
  }
48118
48906
  function getTemplatesFromDir(subdir) {
48119
- const currentDir = path37.dirname(fileURLToPath(import.meta.url));
48907
+ const currentDir = path38.dirname(fileURLToPath(import.meta.url));
48120
48908
  let templatesDir;
48121
- if (currentDir.includes(`${path37.sep}dist`)) {
48122
- templatesDir = path37.join(currentDir, "templates", subdir);
48909
+ if (currentDir.includes(`${path38.sep}dist`)) {
48910
+ templatesDir = path38.join(currentDir, "templates", subdir);
48123
48911
  } else {
48124
- templatesDir = path37.join(currentDir, subdir);
48912
+ templatesDir = path38.join(currentDir, subdir);
48125
48913
  }
48126
48914
  return readTemplatesRecursively(templatesDir, "");
48127
48915
  }
48128
48916
  function isDistRuntime() {
48129
- const currentDir = path37.dirname(fileURLToPath(import.meta.url));
48130
- return currentDir.includes(`${path37.sep}dist`);
48917
+ const currentDir = path38.dirname(fileURLToPath(import.meta.url));
48918
+ return currentDir.includes(`${path38.sep}dist`);
48131
48919
  }
48132
48920
  function getRepoRootFromDev() {
48133
- const currentDir = path37.dirname(fileURLToPath(import.meta.url));
48134
- return path37.resolve(currentDir, "..", "..", "..", "..");
48921
+ const currentDir = path38.dirname(fileURLToPath(import.meta.url));
48922
+ return path38.resolve(currentDir, "..", "..", "..", "..");
48135
48923
  }
48136
48924
  function readTemplatesRecursively(dir, relativePath) {
48137
48925
  const templates = [];
48138
48926
  const entries2 = readdirSync(dir);
48139
48927
  for (const entry of entries2) {
48140
- const fullPath = path37.join(dir, entry);
48928
+ const fullPath = path38.join(dir, entry);
48141
48929
  const stat6 = statSync(fullPath);
48142
- const entryRelativePath = relativePath ? path37.join(relativePath, entry) : entry;
48930
+ const entryRelativePath = relativePath ? path38.join(relativePath, entry) : entry;
48143
48931
  if (stat6.isDirectory()) {
48144
48932
  templates.push(...readTemplatesRecursively(fullPath, entryRelativePath));
48145
48933
  } else {
48146
48934
  const content = readFileSync3(fullPath, "utf-8");
48147
48935
  templates.push({
48148
- path: entryRelativePath.split(path37.sep).join("/"),
48936
+ path: entryRelativePath.split(path38.sep).join("/"),
48149
48937
  // Normalize to forward slashes
48150
48938
  content
48151
48939
  });
@@ -48168,10 +48956,10 @@ async function promptYesNo(message) {
48168
48956
  }
48169
48957
  }
48170
48958
  async function initCommand(options = {}) {
48171
- const targetPath = path38.resolve(options.targetPath ?? ".");
48172
- const githubDir = path38.join(targetPath, ".github");
48173
- const agentvDir = path38.join(targetPath, ".agentv");
48174
- const claudeDir = path38.join(targetPath, ".claude");
48959
+ const targetPath = path39.resolve(options.targetPath ?? ".");
48960
+ const githubDir = path39.join(targetPath, ".github");
48961
+ const agentvDir = path39.join(targetPath, ".agentv");
48962
+ const claudeDir = path39.join(targetPath, ".claude");
48175
48963
  const githubTemplates = getGithubTemplates();
48176
48964
  const agentvTemplates = getAgentvTemplates();
48177
48965
  const claudeTemplates = getClaudeTemplates();
@@ -48179,32 +48967,32 @@ async function initCommand(options = {}) {
48179
48967
  const otherAgentvTemplates = agentvTemplates.filter((t) => t.path !== ".env.example");
48180
48968
  const existingFiles = [];
48181
48969
  if (envTemplate) {
48182
- const envFilePath = path38.join(targetPath, ".env.example");
48970
+ const envFilePath = path39.join(targetPath, ".env.example");
48183
48971
  if (existsSync(envFilePath)) {
48184
48972
  existingFiles.push(".env.example");
48185
48973
  }
48186
48974
  }
48187
48975
  if (existsSync(githubDir)) {
48188
48976
  for (const template of githubTemplates) {
48189
- const targetFilePath = path38.join(githubDir, template.path);
48977
+ const targetFilePath = path39.join(githubDir, template.path);
48190
48978
  if (existsSync(targetFilePath)) {
48191
- existingFiles.push(path38.relative(targetPath, targetFilePath));
48979
+ existingFiles.push(path39.relative(targetPath, targetFilePath));
48192
48980
  }
48193
48981
  }
48194
48982
  }
48195
48983
  if (existsSync(agentvDir)) {
48196
48984
  for (const template of otherAgentvTemplates) {
48197
- const targetFilePath = path38.join(agentvDir, template.path);
48985
+ const targetFilePath = path39.join(agentvDir, template.path);
48198
48986
  if (existsSync(targetFilePath)) {
48199
- existingFiles.push(path38.relative(targetPath, targetFilePath));
48987
+ existingFiles.push(path39.relative(targetPath, targetFilePath));
48200
48988
  }
48201
48989
  }
48202
48990
  }
48203
48991
  if (existsSync(claudeDir)) {
48204
48992
  for (const template of claudeTemplates) {
48205
- const targetFilePath = path38.join(claudeDir, template.path);
48993
+ const targetFilePath = path39.join(claudeDir, template.path);
48206
48994
  if (existsSync(targetFilePath)) {
48207
- existingFiles.push(path38.relative(targetPath, targetFilePath));
48995
+ existingFiles.push(path39.relative(targetPath, targetFilePath));
48208
48996
  }
48209
48997
  }
48210
48998
  }
@@ -48231,36 +49019,36 @@ async function initCommand(options = {}) {
48231
49019
  mkdirSync(claudeDir, { recursive: true });
48232
49020
  }
48233
49021
  if (envTemplate) {
48234
- const envFilePath = path38.join(targetPath, ".env.example");
49022
+ const envFilePath = path39.join(targetPath, ".env.example");
48235
49023
  writeFileSync2(envFilePath, envTemplate.content, "utf-8");
48236
49024
  console.log("Created .env.example");
48237
49025
  }
48238
49026
  for (const template of githubTemplates) {
48239
- const targetFilePath = path38.join(githubDir, template.path);
48240
- const targetDirPath = path38.dirname(targetFilePath);
49027
+ const targetFilePath = path39.join(githubDir, template.path);
49028
+ const targetDirPath = path39.dirname(targetFilePath);
48241
49029
  if (!existsSync(targetDirPath)) {
48242
49030
  mkdirSync(targetDirPath, { recursive: true });
48243
49031
  }
48244
49032
  writeFileSync2(targetFilePath, template.content, "utf-8");
48245
- console.log(`Created ${path38.relative(targetPath, targetFilePath)}`);
49033
+ console.log(`Created ${path39.relative(targetPath, targetFilePath)}`);
48246
49034
  }
48247
49035
  for (const template of otherAgentvTemplates) {
48248
- const targetFilePath = path38.join(agentvDir, template.path);
48249
- const targetDirPath = path38.dirname(targetFilePath);
49036
+ const targetFilePath = path39.join(agentvDir, template.path);
49037
+ const targetDirPath = path39.dirname(targetFilePath);
48250
49038
  if (!existsSync(targetDirPath)) {
48251
49039
  mkdirSync(targetDirPath, { recursive: true });
48252
49040
  }
48253
49041
  writeFileSync2(targetFilePath, template.content, "utf-8");
48254
- console.log(`Created ${path38.relative(targetPath, targetFilePath)}`);
49042
+ console.log(`Created ${path39.relative(targetPath, targetFilePath)}`);
48255
49043
  }
48256
49044
  for (const template of claudeTemplates) {
48257
- const targetFilePath = path38.join(claudeDir, template.path);
48258
- const targetDirPath = path38.dirname(targetFilePath);
49045
+ const targetFilePath = path39.join(claudeDir, template.path);
49046
+ const targetDirPath = path39.dirname(targetFilePath);
48259
49047
  if (!existsSync(targetDirPath)) {
48260
49048
  mkdirSync(targetDirPath, { recursive: true });
48261
49049
  }
48262
49050
  writeFileSync2(targetFilePath, template.content, "utf-8");
48263
- console.log(`Created ${path38.relative(targetPath, targetFilePath)}`);
49051
+ console.log(`Created ${path39.relative(targetPath, targetFilePath)}`);
48264
49052
  }
48265
49053
  console.log("\nAgentV initialized successfully!");
48266
49054
  console.log("\nFiles installed to root:");
@@ -48268,17 +49056,17 @@ async function initCommand(options = {}) {
48268
49056
  console.log(" - .env.example");
48269
49057
  }
48270
49058
  console.log(`
48271
- Files installed to ${path38.relative(targetPath, githubDir)}:`);
49059
+ Files installed to ${path39.relative(targetPath, githubDir)}:`);
48272
49060
  for (const t of githubTemplates) {
48273
49061
  console.log(` - ${t.path}`);
48274
49062
  }
48275
49063
  console.log(`
48276
- Files installed to ${path38.relative(targetPath, agentvDir)}:`);
49064
+ Files installed to ${path39.relative(targetPath, agentvDir)}:`);
48277
49065
  for (const t of otherAgentvTemplates) {
48278
49066
  console.log(` - ${t.path}`);
48279
49067
  }
48280
49068
  console.log(`
48281
- Files installed to ${path38.relative(targetPath, claudeDir)}:`);
49069
+ Files installed to ${path39.relative(targetPath, claudeDir)}:`);
48282
49070
  for (const t of claudeTemplates) {
48283
49071
  console.log(` - ${t.path}`);
48284
49072
  }
@@ -48388,9 +49176,9 @@ function isTTY2() {
48388
49176
  }
48389
49177
 
48390
49178
  // src/commands/validate/validate-files.ts
48391
- import { constants as constants8 } from "node:fs";
48392
- import { access as access8, readdir as readdir3, stat as stat5 } from "node:fs/promises";
48393
- import path39 from "node:path";
49179
+ import { constants as constants9 } from "node:fs";
49180
+ import { access as access9, readdir as readdir3, stat as stat5 } from "node:fs/promises";
49181
+ import path40 from "node:path";
48394
49182
  async function validateFiles(paths) {
48395
49183
  const filePaths = await expandPaths(paths);
48396
49184
  const results = [];
@@ -48408,7 +49196,7 @@ async function validateFiles(paths) {
48408
49196
  };
48409
49197
  }
48410
49198
  async function validateSingleFile(filePath) {
48411
- const absolutePath = path39.resolve(filePath);
49199
+ const absolutePath = path40.resolve(filePath);
48412
49200
  const fileType = await detectFileType(absolutePath);
48413
49201
  let result;
48414
49202
  if (fileType === "eval") {
@@ -48433,9 +49221,9 @@ async function validateSingleFile(filePath) {
48433
49221
  async function expandPaths(paths) {
48434
49222
  const expanded = [];
48435
49223
  for (const inputPath of paths) {
48436
- const absolutePath = path39.resolve(inputPath);
49224
+ const absolutePath = path40.resolve(inputPath);
48437
49225
  try {
48438
- await access8(absolutePath, constants8.F_OK);
49226
+ await access9(absolutePath, constants9.F_OK);
48439
49227
  } catch {
48440
49228
  console.warn(`Warning: Path not found: ${inputPath}`);
48441
49229
  continue;
@@ -48457,7 +49245,7 @@ async function findYamlFiles(dirPath) {
48457
49245
  try {
48458
49246
  const entries2 = await readdir3(dirPath, { withFileTypes: true });
48459
49247
  for (const entry of entries2) {
48460
- const fullPath = path39.join(dirPath, entry.name);
49248
+ const fullPath = path40.join(dirPath, entry.name);
48461
49249
  if (entry.isDirectory()) {
48462
49250
  if (entry.name === "node_modules" || entry.name.startsWith(".")) {
48463
49251
  continue;
@@ -48474,7 +49262,7 @@ async function findYamlFiles(dirPath) {
48474
49262
  return results;
48475
49263
  }
48476
49264
  function isYamlFile(filePath) {
48477
- const ext = path39.extname(filePath).toLowerCase();
49265
+ const ext = path40.extname(filePath).toLowerCase();
48478
49266
  return ext === ".yaml" || ext === ".yml";
48479
49267
  }
48480
49268
 
@@ -48534,4 +49322,4 @@ export {
48534
49322
  app,
48535
49323
  runCli
48536
49324
  };
48537
- //# sourceMappingURL=chunk-I4EMT5Q2.js.map
49325
+ //# sourceMappingURL=chunk-APKXUJF3.js.map