@agentv/core 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -116,6 +116,161 @@ async function resolveFileReference(rawValue, searchRoots) {
116
116
  // src/evaluation/providers/targets.ts
117
117
  import path2 from "node:path";
118
118
  import { z } from "zod";
119
+ var CliHealthcheckHttpInputSchema = z.object({
120
+ type: z.literal("http"),
121
+ url: z.string().min(1, "healthcheck URL is required"),
122
+ timeout_seconds: z.number().positive().optional(),
123
+ timeoutSeconds: z.number().positive().optional()
124
+ });
125
+ var CliHealthcheckCommandInputSchema = z.object({
126
+ type: z.literal("command"),
127
+ command_template: z.string().optional(),
128
+ commandTemplate: z.string().optional(),
129
+ cwd: z.string().optional(),
130
+ timeout_seconds: z.number().positive().optional(),
131
+ timeoutSeconds: z.number().positive().optional()
132
+ });
133
+ var CliHealthcheckInputSchema = z.discriminatedUnion("type", [
134
+ CliHealthcheckHttpInputSchema,
135
+ CliHealthcheckCommandInputSchema
136
+ ]);
137
+ var CliTargetInputSchema = z.object({
138
+ name: z.string().min(1, "target name is required"),
139
+ provider: z.string().refine((p) => p.toLowerCase() === "cli", { message: "provider must be 'cli'" }),
140
+ // Command template - required (accept both naming conventions)
141
+ command_template: z.string().optional(),
142
+ commandTemplate: z.string().optional(),
143
+ // Files format - optional
144
+ files_format: z.string().optional(),
145
+ filesFormat: z.string().optional(),
146
+ attachments_format: z.string().optional(),
147
+ attachmentsFormat: z.string().optional(),
148
+ // Working directory - optional
149
+ cwd: z.string().optional(),
150
+ // Timeout in seconds - optional
151
+ timeout_seconds: z.number().positive().optional(),
152
+ timeoutSeconds: z.number().positive().optional(),
153
+ // Healthcheck configuration - optional
154
+ healthcheck: CliHealthcheckInputSchema.optional(),
155
+ // Verbose mode - optional
156
+ verbose: z.boolean().optional(),
157
+ cli_verbose: z.boolean().optional(),
158
+ cliVerbose: z.boolean().optional(),
159
+ // Keep temp files - optional
160
+ keep_temp_files: z.boolean().optional(),
161
+ keepTempFiles: z.boolean().optional(),
162
+ keep_output_files: z.boolean().optional(),
163
+ keepOutputFiles: z.boolean().optional(),
164
+ // Common target fields
165
+ judge_target: z.string().optional(),
166
+ workers: z.number().int().min(1).optional(),
167
+ provider_batching: z.boolean().optional(),
168
+ providerBatching: z.boolean().optional()
169
+ }).refine((data) => data.command_template !== void 0 || data.commandTemplate !== void 0, {
170
+ message: "Either command_template or commandTemplate is required"
171
+ });
172
+ var CliHealthcheckHttpSchema = z.object({
173
+ type: z.literal("http"),
174
+ url: z.string().min(1),
175
+ timeoutMs: z.number().positive().optional()
176
+ }).strict();
177
+ var CliHealthcheckCommandSchema = z.object({
178
+ type: z.literal("command"),
179
+ commandTemplate: z.string().min(1),
180
+ cwd: z.string().optional(),
181
+ timeoutMs: z.number().positive().optional()
182
+ }).strict();
183
+ var CliHealthcheckSchema = z.discriminatedUnion("type", [
184
+ CliHealthcheckHttpSchema,
185
+ CliHealthcheckCommandSchema
186
+ ]);
187
+ var CliTargetConfigSchema = z.object({
188
+ commandTemplate: z.string().min(1),
189
+ filesFormat: z.string().optional(),
190
+ cwd: z.string().optional(),
191
+ timeoutMs: z.number().positive().optional(),
192
+ healthcheck: CliHealthcheckSchema.optional(),
193
+ verbose: z.boolean().optional(),
194
+ keepTempFiles: z.boolean().optional()
195
+ }).strict();
196
+ function normalizeCliHealthcheck(input, env, targetName, evalFilePath) {
197
+ const timeoutSeconds = input.timeout_seconds ?? input.timeoutSeconds;
198
+ const timeoutMs = timeoutSeconds !== void 0 ? Math.floor(timeoutSeconds * 1e3) : void 0;
199
+ if (input.type === "http") {
200
+ const url = resolveString(input.url, env, `${targetName} healthcheck URL`);
201
+ return {
202
+ type: "http",
203
+ url,
204
+ timeoutMs
205
+ };
206
+ }
207
+ const commandTemplateSource = input.command_template ?? input.commandTemplate;
208
+ if (commandTemplateSource === void 0) {
209
+ throw new Error(
210
+ `${targetName} healthcheck: Either command_template or commandTemplate is required for command healthcheck`
211
+ );
212
+ }
213
+ const commandTemplate = resolveString(
214
+ commandTemplateSource,
215
+ env,
216
+ `${targetName} healthcheck command template`,
217
+ true
218
+ );
219
+ let cwd = resolveOptionalString(input.cwd, env, `${targetName} healthcheck cwd`, {
220
+ allowLiteral: true,
221
+ optionalEnv: true
222
+ });
223
+ if (cwd && evalFilePath && !path2.isAbsolute(cwd)) {
224
+ cwd = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), cwd);
225
+ }
226
+ return {
227
+ type: "command",
228
+ commandTemplate,
229
+ cwd,
230
+ timeoutMs
231
+ };
232
+ }
233
+ function normalizeCliTargetInput(input, env, evalFilePath) {
234
+ const targetName = input.name;
235
+ const commandTemplateSource = input.command_template ?? input.commandTemplate;
236
+ if (commandTemplateSource === void 0) {
237
+ throw new Error(`${targetName}: Either command_template or commandTemplate is required`);
238
+ }
239
+ const commandTemplate = resolveString(
240
+ commandTemplateSource,
241
+ env,
242
+ `${targetName} CLI command template`,
243
+ true
244
+ );
245
+ const filesFormatSource = input.files_format ?? input.filesFormat ?? input.attachments_format ?? input.attachmentsFormat;
246
+ const filesFormat = resolveOptionalLiteralString(filesFormatSource);
247
+ let cwd = resolveOptionalString(input.cwd, env, `${targetName} working directory`, {
248
+ allowLiteral: true,
249
+ optionalEnv: true
250
+ });
251
+ if (cwd && evalFilePath && !path2.isAbsolute(cwd)) {
252
+ cwd = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), cwd);
253
+ }
254
+ if (!cwd && evalFilePath) {
255
+ cwd = path2.dirname(path2.resolve(evalFilePath));
256
+ }
257
+ const timeoutSeconds = input.timeout_seconds ?? input.timeoutSeconds;
258
+ const timeoutMs = timeoutSeconds !== void 0 ? Math.floor(timeoutSeconds * 1e3) : void 0;
259
+ const verbose = resolveOptionalBoolean(input.verbose ?? input.cli_verbose ?? input.cliVerbose);
260
+ const keepTempFiles = resolveOptionalBoolean(
261
+ input.keep_temp_files ?? input.keepTempFiles ?? input.keep_output_files ?? input.keepOutputFiles
262
+ );
263
+ const healthcheck = input.healthcheck ? normalizeCliHealthcheck(input.healthcheck, env, targetName, evalFilePath) : void 0;
264
+ return {
265
+ commandTemplate,
266
+ filesFormat,
267
+ cwd,
268
+ timeoutMs,
269
+ healthcheck,
270
+ verbose,
271
+ keepTempFiles
272
+ };
273
+ }
119
274
  var CLI_PLACEHOLDERS = /* @__PURE__ */ new Set([
120
275
  "PROMPT",
121
276
  "GUIDELINES",
@@ -221,6 +376,16 @@ function resolveTargetDefinition(definition, env = process.env, evalFilePath) {
221
376
  providerBatching,
222
377
  config: resolveCodexConfig(parsed, env)
223
378
  };
379
+ case "pi":
380
+ case "pi-coding-agent":
381
+ return {
382
+ kind: "pi-coding-agent",
383
+ name: parsed.name,
384
+ judgeTarget: parsed.judge_target,
385
+ workers: parsed.workers,
386
+ providerBatching,
387
+ config: resolvePiCodingAgentConfig(parsed, env)
388
+ };
224
389
  case "mock":
225
390
  return {
226
391
  kind: "mock",
@@ -329,6 +494,7 @@ function resolveCodexConfig(target, env) {
329
494
  const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;
330
495
  const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
331
496
  const logFormatSource = target.log_format ?? target.logFormat ?? target.log_output_format ?? target.logOutputFormat ?? env.AGENTV_CODEX_LOG_FORMAT;
497
+ const systemPromptSource = target.system_prompt ?? target.systemPrompt;
332
498
  const executable = resolveOptionalString(executableSource, env, `${target.name} codex executable`, {
333
499
  allowLiteral: true,
334
500
  optionalEnv: true
@@ -344,13 +510,15 @@ function resolveCodexConfig(target, env) {
344
510
  optionalEnv: true
345
511
  });
346
512
  const logFormat = normalizeCodexLogFormat(logFormatSource);
513
+ const systemPrompt = typeof systemPromptSource === "string" && systemPromptSource.trim().length > 0 ? systemPromptSource.trim() : void 0;
347
514
  return {
348
515
  executable,
349
516
  args,
350
517
  cwd,
351
518
  timeoutMs,
352
519
  logDir,
353
- logFormat
520
+ logFormat,
521
+ systemPrompt
354
522
  };
355
523
  }
356
524
  function normalizeCodexLogFormat(value) {
@@ -366,6 +534,70 @@ function normalizeCodexLogFormat(value) {
366
534
  }
367
535
  throw new Error("codex log format must be 'summary' or 'json'");
368
536
  }
537
+ function resolvePiCodingAgentConfig(target, env) {
538
+ const executableSource = target.executable ?? target.command ?? target.binary;
539
+ const providerSource = target.pi_provider ?? target.piProvider ?? target.llm_provider;
540
+ const modelSource = target.model ?? target.pi_model ?? target.piModel;
541
+ const apiKeySource = target.api_key ?? target.apiKey;
542
+ const toolsSource = target.tools ?? target.pi_tools ?? target.piTools;
543
+ const thinkingSource = target.thinking ?? target.pi_thinking ?? target.piThinking;
544
+ const argsSource = target.args ?? target.arguments;
545
+ const cwdSource = target.cwd;
546
+ const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;
547
+ const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
548
+ const logFormatSource = target.log_format ?? target.logFormat;
549
+ const systemPromptSource = target.system_prompt ?? target.systemPrompt;
550
+ const executable = resolveOptionalString(executableSource, env, `${target.name} pi executable`, {
551
+ allowLiteral: true,
552
+ optionalEnv: true
553
+ }) ?? "pi";
554
+ const provider = resolveOptionalString(providerSource, env, `${target.name} pi provider`, {
555
+ allowLiteral: true,
556
+ optionalEnv: true
557
+ });
558
+ const model = resolveOptionalString(modelSource, env, `${target.name} pi model`, {
559
+ allowLiteral: true,
560
+ optionalEnv: true
561
+ });
562
+ const apiKey = resolveOptionalString(apiKeySource, env, `${target.name} pi api key`, {
563
+ allowLiteral: false,
564
+ optionalEnv: true
565
+ });
566
+ const tools = resolveOptionalString(toolsSource, env, `${target.name} pi tools`, {
567
+ allowLiteral: true,
568
+ optionalEnv: true
569
+ });
570
+ const thinking = resolveOptionalString(thinkingSource, env, `${target.name} pi thinking`, {
571
+ allowLiteral: true,
572
+ optionalEnv: true
573
+ });
574
+ const args = resolveOptionalStringArray(argsSource, env, `${target.name} pi args`);
575
+ const cwd = resolveOptionalString(cwdSource, env, `${target.name} pi cwd`, {
576
+ allowLiteral: true,
577
+ optionalEnv: true
578
+ });
579
+ const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} pi timeout`);
580
+ const logDir = resolveOptionalString(logDirSource, env, `${target.name} pi log directory`, {
581
+ allowLiteral: true,
582
+ optionalEnv: true
583
+ });
584
+ const logFormat = logFormatSource === "json" || logFormatSource === "summary" ? logFormatSource : void 0;
585
+ const systemPrompt = typeof systemPromptSource === "string" && systemPromptSource.trim().length > 0 ? systemPromptSource.trim() : void 0;
586
+ return {
587
+ executable,
588
+ provider,
589
+ model,
590
+ apiKey,
591
+ tools,
592
+ thinking,
593
+ args,
594
+ cwd,
595
+ timeoutMs,
596
+ logDir,
597
+ logFormat,
598
+ systemPrompt
599
+ };
600
+ }
369
601
  function resolveMockConfig(target) {
370
602
  const response = typeof target.response === "string" ? target.response : void 0;
371
603
  return { response };
@@ -400,46 +632,35 @@ function resolveVSCodeConfig(target, env, insiders) {
400
632
  workspaceTemplate
401
633
  };
402
634
  }
403
- function resolveCliConfig(target, env, evalFilePath) {
404
- const commandTemplateSource = target.command_template ?? target.commandTemplate;
405
- const filesFormat = resolveOptionalLiteralString(
406
- target.files_format ?? target.filesFormat ?? target.attachments_format ?? target.attachmentsFormat
407
- );
408
- const verbose = resolveOptionalBoolean(target.verbose ?? target.cli_verbose ?? target.cliVerbose);
409
- const keepTempFiles = resolveOptionalBoolean(
410
- target.keep_temp_files ?? target.keepTempFiles ?? target.keep_output_files ?? target.keepOutputFiles
411
- );
412
- let cwd = resolveOptionalString(target.cwd, env, `${target.name} working directory`, {
413
- allowLiteral: true,
414
- optionalEnv: true
415
- });
416
- if (cwd && evalFilePath && !path2.isAbsolute(cwd)) {
417
- cwd = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), cwd);
635
+ var cliErrorMap = (issue, ctx) => {
636
+ if (issue.code === z.ZodIssueCode.unrecognized_keys) {
637
+ return { message: `Unknown CLI provider settings: ${issue.keys.join(", ")}` };
418
638
  }
419
- if (!cwd && evalFilePath) {
420
- cwd = path2.dirname(path2.resolve(evalFilePath));
639
+ if (issue.code === z.ZodIssueCode.invalid_union_discriminator) {
640
+ return { message: "healthcheck type must be 'http' or 'command'" };
421
641
  }
422
- const timeoutMs = resolveTimeoutMs(
423
- target.timeout_seconds ?? target.timeoutSeconds,
424
- `${target.name} timeout`
425
- );
426
- const healthcheck = resolveCliHealthcheck(target.healthcheck, env, target.name, evalFilePath);
427
- const commandTemplate = resolveString(
428
- commandTemplateSource,
429
- env,
430
- `${target.name} CLI command template`,
431
- true
432
- );
433
- assertSupportedCliPlaceholders(commandTemplate, `${target.name} CLI command template`);
434
- return {
435
- commandTemplate,
436
- filesFormat,
437
- cwd,
438
- timeoutMs,
439
- healthcheck,
440
- verbose,
441
- keepTempFiles
442
- };
642
+ if (issue.code === z.ZodIssueCode.invalid_type && issue.expected === "string") {
643
+ return { message: `${ctx.defaultError} (expected a string value)` };
644
+ }
645
+ return { message: ctx.defaultError };
646
+ };
647
+ function resolveCliConfig(target, env, evalFilePath) {
648
+ const parseResult = CliTargetInputSchema.safeParse(target, { errorMap: cliErrorMap });
649
+ if (!parseResult.success) {
650
+ const firstError = parseResult.error.errors[0];
651
+ const path3 = firstError?.path.join(".") || "";
652
+ const prefix = path3 ? `${target.name} ${path3}: ` : `${target.name}: `;
653
+ throw new Error(`${prefix}${firstError?.message}`);
654
+ }
655
+ const normalized = normalizeCliTargetInput(parseResult.data, env, evalFilePath);
656
+ assertSupportedCliPlaceholders(normalized.commandTemplate, `${target.name} CLI command template`);
657
+ if (normalized.healthcheck?.type === "command") {
658
+ assertSupportedCliPlaceholders(
659
+ normalized.healthcheck.commandTemplate,
660
+ `${target.name} healthcheck command template`
661
+ );
662
+ }
663
+ return normalized;
443
664
  }
444
665
  function resolveTimeoutMs(source, description) {
445
666
  const seconds = resolveOptionalNumber(source, `${description} (seconds)`);
@@ -451,49 +672,6 @@ function resolveTimeoutMs(source, description) {
451
672
  }
452
673
  return Math.floor(seconds * 1e3);
453
674
  }
454
- function resolveCliHealthcheck(source, env, targetName, evalFilePath) {
455
- if (source === void 0 || source === null) {
456
- return void 0;
457
- }
458
- if (typeof source !== "object" || Array.isArray(source)) {
459
- throw new Error(`${targetName} healthcheck must be an object`);
460
- }
461
- const candidate = source;
462
- const type = candidate.type;
463
- const timeoutMs = resolveTimeoutMs(
464
- candidate.timeout_seconds ?? candidate.timeoutSeconds,
465
- `${targetName} healthcheck timeout`
466
- );
467
- if (type === "http") {
468
- const url = resolveString(candidate.url, env, `${targetName} healthcheck URL`);
469
- return {
470
- type: "http",
471
- url,
472
- timeoutMs
473
- };
474
- }
475
- if (type === "command") {
476
- const commandTemplate = resolveString(
477
- candidate.command_template ?? candidate.commandTemplate,
478
- env,
479
- `${targetName} healthcheck command template`,
480
- true
481
- );
482
- assertSupportedCliPlaceholders(commandTemplate, `${targetName} healthcheck command template`);
483
- const cwd = resolveOptionalString(candidate.cwd, env, `${targetName} healthcheck cwd`, {
484
- allowLiteral: true,
485
- optionalEnv: true
486
- });
487
- const resolvedCwd = cwd && evalFilePath && !path2.isAbsolute(cwd) ? path2.resolve(path2.dirname(path2.resolve(evalFilePath)), cwd) : cwd;
488
- return {
489
- type: "command",
490
- commandTemplate,
491
- timeoutMs,
492
- cwd: resolvedCwd
493
- };
494
- }
495
- throw new Error(`${targetName} healthcheck type must be 'http' or 'command'`);
496
- }
497
675
  function assertSupportedCliPlaceholders(template, description) {
498
676
  const placeholders = extractCliPlaceholders(template);
499
677
  for (const placeholder of placeholders) {
@@ -661,6 +839,7 @@ function resolveOptionalNumberArray(source, description) {
661
839
  // src/evaluation/providers/types.ts
662
840
  var AGENT_PROVIDER_KINDS = [
663
841
  "codex",
842
+ "pi-coding-agent",
664
843
  "vscode",
665
844
  "vscode-insiders"
666
845
  ];
@@ -669,6 +848,7 @@ var KNOWN_PROVIDERS = [
669
848
  "anthropic",
670
849
  "gemini",
671
850
  "codex",
851
+ "pi-coding-agent",
672
852
  "cli",
673
853
  "mock",
674
854
  "vscode",
@@ -683,6 +863,8 @@ var PROVIDER_ALIASES = [
683
863
  // alias for "gemini"
684
864
  "codex-cli",
685
865
  // alias for "codex"
866
+ "pi",
867
+ // alias for "pi-coding-agent"
686
868
  "openai",
687
869
  // legacy/future support
688
870
  "bedrock",
@@ -725,4 +907,4 @@ export {
725
907
  extractLastAssistantContent,
726
908
  isAgentProvider
727
909
  };
728
- //# sourceMappingURL=chunk-KPHTMTZ3.js.map
910
+ //# sourceMappingURL=chunk-E2VSU4WZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/evaluation/file-utils.ts","../src/evaluation/providers/targets.ts","../src/evaluation/providers/types.ts"],"sourcesContent":["import { constants } from 'node:fs';\nimport { access, readFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nexport async function fileExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Normalize line endings to LF (\\n).\n * This ensures consistent behavior across Windows (CRLF) and Unix (LF) systems.\n */\nexport function normalizeLineEndings(content: string): string {\n return content.replace(/\\r\\n/g, '\\n');\n}\n\n/**\n * Read a text file and normalize line endings to LF (\\n).\n * This ensures consistent behavior across Windows (CRLF) and Unix (LF) systems.\n */\nexport async function readTextFile(filePath: string): Promise<string> {\n const content = await readFile(filePath, 'utf8');\n return normalizeLineEndings(content);\n}\n\n/**\n * Read a JSON file and parse it.\n */\nexport async function readJsonFile<T = unknown>(filePath: string): Promise<T> {\n const content = await readFile(filePath, 'utf8');\n return JSON.parse(content) as T;\n}\n\n/**\n * Find git repository root by walking up the directory tree.\n */\nexport async function findGitRoot(startPath: string): Promise<string | null> {\n let currentDir = path.dirname(path.resolve(startPath));\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const gitPath = path.join(currentDir, '.git');\n if (await fileExists(gitPath)) {\n return currentDir;\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n break;\n }\n currentDir = parentDir;\n }\n\n return null;\n}\n\n/**\n * Build a chain of directories walking from a file's location up to repo root.\n * Used for discovering configuration files like targets.yaml or config.yaml.\n */\nexport function buildDirectoryChain(filePath: string, repoRoot: string): readonly string[] {\n const directories: string[] = [];\n const seen = new Set<string>();\n const boundary = path.resolve(repoRoot);\n let current: string | undefined = path.resolve(path.dirname(filePath));\n\n while (current !== undefined) {\n if (!seen.has(current)) {\n directories.push(current);\n seen.add(current);\n }\n if (current === boundary) {\n break;\n }\n const parent = path.dirname(current);\n if (parent === current) {\n break;\n }\n current = parent;\n }\n\n if (!seen.has(boundary)) {\n directories.push(boundary);\n }\n\n return directories;\n}\n\n/**\n * Build search roots for file resolution, matching yaml-parser behavior.\n * Searches from eval file directory up to repo root.\n */\nexport function buildSearchRoots(evalPath: string, repoRoot: string): readonly string[] {\n const uniqueRoots: string[] = [];\n const addRoot = (root: string): void => {\n const normalized = path.resolve(root);\n if (!uniqueRoots.includes(normalized)) {\n uniqueRoots.push(normalized);\n }\n };\n\n let currentDir = path.dirname(evalPath);\n let reachedBoundary = false;\n while (!reachedBoundary) {\n addRoot(currentDir);\n const parentDir = path.dirname(currentDir);\n if (currentDir === repoRoot || parentDir === currentDir) {\n reachedBoundary = true;\n } else {\n currentDir = parentDir;\n }\n }\n\n addRoot(repoRoot);\n addRoot(process.cwd());\n return uniqueRoots;\n}\n\n/**\n * Trim leading path separators for display.\n */\nfunction trimLeadingSeparators(value: string): string {\n const trimmed = value.replace(/^[/\\\\]+/, '');\n return trimmed.length > 0 ? trimmed : value;\n}\n\n/**\n * Resolve a file reference using search roots, matching yaml-parser behavior.\n */\nexport async function resolveFileReference(\n rawValue: string,\n searchRoots: readonly string[],\n): Promise<{\n readonly displayPath: string;\n readonly resolvedPath?: string;\n readonly attempted: readonly string[];\n}> {\n const displayPath = trimLeadingSeparators(rawValue);\n const potentialPaths: string[] = [];\n\n if (path.isAbsolute(rawValue)) {\n potentialPaths.push(path.normalize(rawValue));\n }\n\n for (const base of searchRoots) {\n potentialPaths.push(path.resolve(base, displayPath));\n }\n\n const attempted: string[] = [];\n const seen = new Set<string>();\n for (const candidate of potentialPaths) {\n const absoluteCandidate = path.resolve(candidate);\n if (seen.has(absoluteCandidate)) {\n continue;\n }\n seen.add(absoluteCandidate);\n attempted.push(absoluteCandidate);\n if (await fileExists(absoluteCandidate)) {\n return { displayPath, resolvedPath: absoluteCandidate, attempted };\n }\n }\n\n return { displayPath, attempted };\n}\n","import path from 'node:path';\nimport { z } from 'zod';\n\nimport type { EnvLookup, TargetDefinition } from './types.js';\n\n// ---------------------------------------------------------------------------\n// Zod Schemas for CLI Provider Configuration\n// ---------------------------------------------------------------------------\n\n/**\n * Loose input schema for HTTP healthcheck configuration.\n * Accepts both snake_case (YAML convention) and camelCase (JavaScript convention)\n * property names for flexibility in configuration files.\n *\n * @example\n * ```yaml\n * healthcheck:\n * type: http\n * url: http://localhost:8080/health\n * timeout_seconds: 30\n * ```\n */\nexport const CliHealthcheckHttpInputSchema = z.object({\n type: z.literal('http'),\n url: z.string().min(1, 'healthcheck URL is required'),\n timeout_seconds: z.number().positive().optional(),\n timeoutSeconds: z.number().positive().optional(),\n});\n\n/**\n * Loose input schema for command healthcheck configuration.\n * Accepts both snake_case (YAML convention) and camelCase (JavaScript convention)\n * property names for flexibility in configuration files.\n *\n * Note: discriminatedUnion requires plain ZodObject, so command_template/commandTemplate\n * presence is validated during normalization rather than here.\n *\n * @example\n * ```yaml\n * healthcheck:\n * type: command\n * command_template: curl http://localhost:8080/health\n * cwd: /app\n * timeout_seconds: 10\n * ```\n */\nexport const CliHealthcheckCommandInputSchema = z.object({\n type: z.literal('command'),\n command_template: z.string().optional(),\n commandTemplate: z.string().optional(),\n cwd: z.string().optional(),\n timeout_seconds: z.number().positive().optional(),\n timeoutSeconds: z.number().positive().optional(),\n});\n\n/**\n * Discriminated union for healthcheck input configuration.\n * Uses the 'type' field to distinguish between HTTP and command healthchecks.\n *\n * @see CliHealthcheckHttpInputSchema for HTTP healthcheck configuration\n * @see CliHealthcheckCommandInputSchema for command healthcheck configuration\n */\nexport const CliHealthcheckInputSchema = z.discriminatedUnion('type', [\n CliHealthcheckHttpInputSchema,\n CliHealthcheckCommandInputSchema,\n]);\n\n/**\n * Loose input schema for CLI target configuration.\n * Accepts both snake_case (YAML convention) and camelCase (JavaScript convention)\n * property names for maximum flexibility in configuration files.\n *\n * This schema validates the raw YAML input structure before normalization\n * and environment variable resolution. Unknown properties are allowed\n * (passthrough mode) to support future extensions.\n *\n * @example\n * ```yaml\n * targets:\n * - name: my-agent\n * provider: cli\n * command_template: agent run {PROMPT}\n * timeout_seconds: 120\n * healthcheck:\n * type: http\n * url: http://localhost:8080/health\n * ```\n */\nexport const CliTargetInputSchema = z\n .object({\n name: z.string().min(1, 'target name is required'),\n provider: z\n .string()\n .refine((p) => p.toLowerCase() === 'cli', { message: \"provider must be 'cli'\" }),\n\n // Command template - required (accept both naming conventions)\n command_template: z.string().optional(),\n commandTemplate: z.string().optional(),\n\n // Files format - optional\n files_format: z.string().optional(),\n filesFormat: z.string().optional(),\n attachments_format: z.string().optional(),\n attachmentsFormat: z.string().optional(),\n\n // Working directory - optional\n cwd: z.string().optional(),\n\n // Timeout in seconds - optional\n timeout_seconds: z.number().positive().optional(),\n timeoutSeconds: z.number().positive().optional(),\n\n // Healthcheck configuration - optional\n healthcheck: CliHealthcheckInputSchema.optional(),\n\n // Verbose mode - optional\n verbose: z.boolean().optional(),\n cli_verbose: z.boolean().optional(),\n cliVerbose: z.boolean().optional(),\n\n // Keep temp files - optional\n keep_temp_files: z.boolean().optional(),\n keepTempFiles: z.boolean().optional(),\n keep_output_files: z.boolean().optional(),\n keepOutputFiles: z.boolean().optional(),\n\n // Common target fields\n judge_target: z.string().optional(),\n workers: z.number().int().min(1).optional(),\n provider_batching: z.boolean().optional(),\n providerBatching: z.boolean().optional(),\n })\n .refine((data) => data.command_template !== undefined || data.commandTemplate !== undefined, {\n message: 'Either command_template or commandTemplate is required',\n });\n\n/**\n * Strict normalized schema for HTTP healthcheck configuration.\n * Uses camelCase property names only and rejects unknown properties.\n * This is an internal schema used as part of CliHealthcheckSchema.\n */\nconst CliHealthcheckHttpSchema = z\n .object({\n type: z.literal('http'),\n url: z.string().min(1),\n timeoutMs: z.number().positive().optional(),\n })\n .strict();\n\n/**\n * Strict normalized schema for command healthcheck configuration.\n * Uses camelCase property names only and rejects unknown properties.\n * This is an internal schema used as part of CliHealthcheckSchema.\n */\nconst CliHealthcheckCommandSchema = z\n .object({\n type: z.literal('command'),\n commandTemplate: z.string().min(1),\n cwd: z.string().optional(),\n timeoutMs: z.number().positive().optional(),\n })\n .strict();\n\n/**\n * Strict normalized schema for healthcheck configuration.\n * Discriminated union on 'type' field supporting HTTP and command healthchecks.\n * Rejects unknown properties to catch typos and misconfigurations.\n *\n * @see CliHealthcheckHttpSchema for HTTP healthcheck fields\n * @see CliHealthcheckCommandSchema for command healthcheck fields\n */\nexport const CliHealthcheckSchema = z.discriminatedUnion('type', [\n CliHealthcheckHttpSchema,\n CliHealthcheckCommandSchema,\n]);\n\n/**\n * Strict normalized schema for CLI target configuration.\n * This is the final validated shape after environment variable resolution\n * and snake_case to camelCase normalization.\n *\n * Uses .strict() to reject unknown properties, ensuring configuration\n * errors are caught early rather than silently ignored.\n *\n * @example\n * ```typescript\n * const config: CliNormalizedConfig = {\n * commandTemplate: 'agent run {PROMPT}',\n * timeoutMs: 120000,\n * verbose: true,\n * };\n * CliTargetConfigSchema.parse(config); // Validates the normalized config\n * ```\n */\nexport const CliTargetConfigSchema = z\n .object({\n commandTemplate: z.string().min(1),\n filesFormat: z.string().optional(),\n cwd: z.string().optional(),\n timeoutMs: z.number().positive().optional(),\n healthcheck: CliHealthcheckSchema.optional(),\n verbose: z.boolean().optional(),\n keepTempFiles: z.boolean().optional(),\n })\n .strict();\n\n// Type inference from schemas\nexport type CliHealthcheckInput = z.infer<typeof CliHealthcheckInputSchema>;\nexport type CliTargetInput = z.infer<typeof CliTargetInputSchema>;\nexport type CliNormalizedHealthcheck = z.infer<typeof CliHealthcheckSchema>;\nexport type CliNormalizedConfig = z.infer<typeof CliTargetConfigSchema>;\n\n/**\n * Resolved CLI configuration type derived from CliTargetConfigSchema.\n * This is the final validated shape used by the CLI provider at runtime.\n * Using Readonly to ensure immutability for runtime safety.\n */\nexport type CliResolvedConfig = Readonly<CliNormalizedConfig>;\n\n/**\n * Normalizes a healthcheck input from loose (snake_case + camelCase) to\n * strict normalized form (camelCase only). Resolves environment variables.\n *\n * @param input - The loose healthcheck input from YAML\n * @param env - Environment variable lookup\n * @param targetName - Name of the target (for error messages)\n * @param evalFilePath - Optional path to eval file for relative path resolution\n * @returns Normalized healthcheck configuration\n */\nexport function normalizeCliHealthcheck(\n input: CliHealthcheckInput,\n env: EnvLookup,\n targetName: string,\n evalFilePath?: string,\n): CliNormalizedHealthcheck {\n const timeoutSeconds = input.timeout_seconds ?? input.timeoutSeconds;\n const timeoutMs = timeoutSeconds !== undefined ? Math.floor(timeoutSeconds * 1000) : undefined;\n\n if (input.type === 'http') {\n const url = resolveString(input.url, env, `${targetName} healthcheck URL`);\n return {\n type: 'http',\n url,\n timeoutMs,\n };\n }\n\n // type === 'command'\n const commandTemplateSource = input.command_template ?? input.commandTemplate;\n if (commandTemplateSource === undefined) {\n throw new Error(\n `${targetName} healthcheck: Either command_template or commandTemplate is required for command healthcheck`,\n );\n }\n const commandTemplate = resolveString(\n commandTemplateSource,\n env,\n `${targetName} healthcheck command template`,\n true,\n );\n\n let cwd = resolveOptionalString(input.cwd, env, `${targetName} healthcheck cwd`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n // Resolve relative cwd paths against eval file directory\n if (cwd && evalFilePath && !path.isAbsolute(cwd)) {\n cwd = path.resolve(path.dirname(path.resolve(evalFilePath)), cwd);\n }\n\n return {\n type: 'command',\n commandTemplate,\n cwd,\n timeoutMs,\n };\n}\n\n/**\n * Normalizes a CLI target input from loose (snake_case + camelCase) to\n * strict normalized form (camelCase only). Resolves environment variables.\n *\n * This function coalesces snake_case/camelCase variants and resolves\n * environment variable references using ${{ VAR_NAME }} syntax.\n *\n * @param input - The loose CLI target input from YAML\n * @param env - Environment variable lookup\n * @param evalFilePath - Optional path to eval file for relative path resolution\n * @returns Normalized CLI configuration matching CliResolvedConfig\n */\nexport function normalizeCliTargetInput(\n input: CliTargetInput,\n env: EnvLookup,\n evalFilePath?: string,\n): CliNormalizedConfig {\n const targetName = input.name;\n\n // Coalesce command template variants - at least one is required by schema refinement\n const commandTemplateSource = input.command_template ?? input.commandTemplate;\n if (commandTemplateSource === undefined) {\n throw new Error(`${targetName}: Either command_template or commandTemplate is required`);\n }\n const commandTemplate = resolveString(\n commandTemplateSource,\n env,\n `${targetName} CLI command template`,\n true,\n );\n\n // Coalesce files format variants\n const filesFormatSource =\n input.files_format ?? input.filesFormat ?? input.attachments_format ?? input.attachmentsFormat;\n const filesFormat = resolveOptionalLiteralString(filesFormatSource);\n\n // Resolve working directory\n let cwd = resolveOptionalString(input.cwd, env, `${targetName} working directory`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n // Resolve relative cwd paths against eval file directory\n if (cwd && evalFilePath && !path.isAbsolute(cwd)) {\n cwd = path.resolve(path.dirname(path.resolve(evalFilePath)), cwd);\n }\n // Fallback: if cwd is not set and we have an eval file path, use the eval directory\n if (!cwd && evalFilePath) {\n cwd = path.dirname(path.resolve(evalFilePath));\n }\n\n // Coalesce timeout variants (seconds -> ms)\n const timeoutSeconds = input.timeout_seconds ?? input.timeoutSeconds;\n const timeoutMs = timeoutSeconds !== undefined ? Math.floor(timeoutSeconds * 1000) : undefined;\n\n // Coalesce verbose variants\n const verbose = resolveOptionalBoolean(input.verbose ?? input.cli_verbose ?? input.cliVerbose);\n\n // Coalesce keepTempFiles variants\n const keepTempFiles = resolveOptionalBoolean(\n input.keep_temp_files ??\n input.keepTempFiles ??\n input.keep_output_files ??\n input.keepOutputFiles,\n );\n\n // Normalize healthcheck if present\n const healthcheck = input.healthcheck\n ? normalizeCliHealthcheck(input.healthcheck, env, targetName, evalFilePath)\n : undefined;\n\n return {\n commandTemplate,\n filesFormat,\n cwd,\n timeoutMs,\n healthcheck,\n verbose,\n keepTempFiles,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Other Provider Configurations and Utilities\n// ---------------------------------------------------------------------------\n\n/**\n * Supported CLI placeholder tokens that can be used in command templates.\n * These are replaced with actual values during command execution.\n */\nexport const CLI_PLACEHOLDERS = new Set([\n 'PROMPT',\n 'GUIDELINES',\n 'EVAL_ID',\n 'ATTEMPT',\n 'FILES',\n 'OUTPUT_FILE',\n]);\n\nexport interface RetryConfig {\n readonly maxRetries?: number;\n readonly initialDelayMs?: number;\n readonly maxDelayMs?: number;\n readonly backoffFactor?: number;\n readonly retryableStatusCodes?: readonly number[];\n}\n\n/**\n * Azure OpenAI settings used by the Vercel AI SDK.\n */\nexport interface AzureResolvedConfig {\n readonly resourceName: string;\n readonly deploymentName: string;\n readonly apiKey: string;\n readonly version?: string;\n readonly temperature?: number;\n readonly maxOutputTokens?: number;\n readonly retry?: RetryConfig;\n}\n\n/**\n * Anthropic Claude settings used by the Vercel AI SDK.\n */\nexport interface AnthropicResolvedConfig {\n readonly apiKey: string;\n readonly model: string;\n readonly temperature?: number;\n readonly maxOutputTokens?: number;\n readonly thinkingBudget?: number;\n readonly retry?: RetryConfig;\n}\n\n/**\n * Google Gemini settings used by the Vercel AI SDK.\n */\nexport interface GeminiResolvedConfig {\n readonly apiKey: string;\n readonly model: string;\n readonly temperature?: number;\n readonly maxOutputTokens?: number;\n readonly retry?: RetryConfig;\n}\n\nexport interface CodexResolvedConfig {\n readonly executable: string;\n readonly args?: readonly string[];\n readonly cwd?: string;\n readonly timeoutMs?: number;\n readonly logDir?: string;\n readonly logFormat?: 'summary' | 'json';\n readonly systemPrompt?: string;\n}\n\nexport interface PiCodingAgentResolvedConfig {\n readonly executable: string;\n readonly provider?: string;\n readonly model?: string;\n readonly apiKey?: string;\n readonly tools?: string;\n readonly thinking?: string;\n readonly args?: readonly string[];\n readonly cwd?: string;\n readonly timeoutMs?: number;\n readonly logDir?: string;\n readonly logFormat?: 'summary' | 'json';\n readonly systemPrompt?: string;\n}\n\nexport interface MockResolvedConfig {\n readonly response?: string;\n readonly delayMs?: number;\n readonly delayMinMs?: number;\n readonly delayMaxMs?: number;\n}\n\nexport interface VSCodeResolvedConfig {\n readonly command: string;\n readonly waitForResponse: boolean;\n readonly dryRun: boolean;\n readonly subagentRoot?: string;\n readonly workspaceTemplate?: string;\n}\n\n/**\n * Healthcheck configuration type derived from CliHealthcheckSchema.\n * Supports both HTTP and command-based healthchecks.\n */\nexport type CliHealthcheck = Readonly<CliNormalizedHealthcheck>;\n\n// Note: CliResolvedConfig is a type alias derived from CliNormalizedConfig (see above),\n// which itself is inferred from CliTargetConfigSchema for type safety and single source of truth.\n\nexport type ResolvedTarget =\n | {\n readonly kind: 'azure';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: AzureResolvedConfig;\n }\n | {\n readonly kind: 'anthropic';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: AnthropicResolvedConfig;\n }\n | {\n readonly kind: 'gemini';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: GeminiResolvedConfig;\n }\n | {\n readonly kind: 'codex';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: CodexResolvedConfig;\n }\n | {\n readonly kind: 'pi-coding-agent';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: PiCodingAgentResolvedConfig;\n }\n | {\n readonly kind: 'mock';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: MockResolvedConfig;\n }\n | {\n readonly kind: 'vscode' | 'vscode-insiders';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: VSCodeResolvedConfig;\n }\n | {\n readonly kind: 'cli';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: CliResolvedConfig;\n };\n\nconst BASE_TARGET_SCHEMA = z\n .object({\n name: z.string().min(1, 'target name is required'),\n provider: z.string().min(1, 'provider is required'),\n judge_target: z.string().optional(),\n workers: z.number().int().min(1).optional(),\n })\n .passthrough();\n\nconst DEFAULT_AZURE_API_VERSION = '2024-12-01-preview';\n\nfunction normalizeAzureApiVersion(value: string | undefined): string {\n if (!value) {\n return DEFAULT_AZURE_API_VERSION;\n }\n\n const trimmed = value.trim();\n if (trimmed.length === 0) {\n return DEFAULT_AZURE_API_VERSION;\n }\n\n const withoutPrefix = trimmed.replace(/^api[-_]?version\\s*=\\s*/i, '').trim();\n return withoutPrefix.length > 0 ? withoutPrefix : DEFAULT_AZURE_API_VERSION;\n}\n\nfunction resolveRetryConfig(target: z.infer<typeof BASE_TARGET_SCHEMA>): RetryConfig | undefined {\n const maxRetries = resolveOptionalNumber(\n target.max_retries ?? target.maxRetries,\n `${target.name} max retries`,\n );\n const initialDelayMs = resolveOptionalNumber(\n target.retry_initial_delay_ms ?? target.retryInitialDelayMs,\n `${target.name} retry initial delay`,\n );\n const maxDelayMs = resolveOptionalNumber(\n target.retry_max_delay_ms ?? target.retryMaxDelayMs,\n `${target.name} retry max delay`,\n );\n const backoffFactor = resolveOptionalNumber(\n target.retry_backoff_factor ?? target.retryBackoffFactor,\n `${target.name} retry backoff factor`,\n );\n const retryableStatusCodes = resolveOptionalNumberArray(\n target.retry_status_codes ?? target.retryStatusCodes,\n `${target.name} retry status codes`,\n );\n\n // Only return retry config if at least one field is set\n if (\n maxRetries === undefined &&\n initialDelayMs === undefined &&\n maxDelayMs === undefined &&\n backoffFactor === undefined &&\n retryableStatusCodes === undefined\n ) {\n return undefined;\n }\n\n return {\n maxRetries,\n initialDelayMs,\n maxDelayMs,\n backoffFactor,\n retryableStatusCodes,\n };\n}\n\nexport function resolveTargetDefinition(\n definition: TargetDefinition,\n env: EnvLookup = process.env,\n evalFilePath?: string,\n): ResolvedTarget {\n const parsed = BASE_TARGET_SCHEMA.parse(definition);\n const provider = parsed.provider.toLowerCase();\n const providerBatching = resolveOptionalBoolean(\n parsed.provider_batching ?? parsed.providerBatching,\n );\n\n switch (provider) {\n case 'azure':\n case 'azure-openai':\n return {\n kind: 'azure',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveAzureConfig(parsed, env),\n };\n case 'anthropic':\n return {\n kind: 'anthropic',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveAnthropicConfig(parsed, env),\n };\n case 'gemini':\n case 'google':\n case 'google-gemini':\n return {\n kind: 'gemini',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveGeminiConfig(parsed, env),\n };\n case 'codex':\n case 'codex-cli':\n return {\n kind: 'codex',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveCodexConfig(parsed, env),\n };\n case 'pi':\n case 'pi-coding-agent':\n return {\n kind: 'pi-coding-agent',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolvePiCodingAgentConfig(parsed, env),\n };\n case 'mock':\n return {\n kind: 'mock',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveMockConfig(parsed),\n };\n case 'vscode':\n case 'vscode-insiders':\n return {\n kind: provider as 'vscode' | 'vscode-insiders',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveVSCodeConfig(parsed, env, provider === 'vscode-insiders'),\n };\n case 'cli':\n return {\n kind: 'cli',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveCliConfig(parsed, env, evalFilePath),\n };\n default:\n throw new Error(`Unsupported provider '${parsed.provider}' in target '${parsed.name}'`);\n }\n}\n\nfunction resolveAzureConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n): AzureResolvedConfig {\n const endpointSource = target.endpoint ?? target.resource ?? target.resourceName;\n const apiKeySource = target.api_key ?? target.apiKey;\n const deploymentSource = target.deployment ?? target.deploymentName ?? target.model;\n const versionSource = target.version ?? target.api_version;\n const temperatureSource = target.temperature;\n const maxTokensSource = target.max_output_tokens ?? target.maxTokens;\n\n const resourceName = resolveString(endpointSource, env, `${target.name} endpoint`);\n const apiKey = resolveString(apiKeySource, env, `${target.name} api key`);\n const deploymentName = resolveString(deploymentSource, env, `${target.name} deployment`);\n const version = normalizeAzureApiVersion(\n resolveOptionalString(versionSource, env, `${target.name} api version`, {\n allowLiteral: true,\n optionalEnv: true,\n }),\n );\n const temperature = resolveOptionalNumber(temperatureSource, `${target.name} temperature`);\n const maxOutputTokens = resolveOptionalNumber(\n maxTokensSource,\n `${target.name} max output tokens`,\n );\n const retry = resolveRetryConfig(target);\n\n return {\n resourceName,\n deploymentName,\n apiKey,\n version,\n temperature,\n maxOutputTokens,\n retry,\n };\n}\n\nfunction resolveAnthropicConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n): AnthropicResolvedConfig {\n const apiKeySource = target.api_key ?? target.apiKey;\n const modelSource = target.model ?? target.deployment ?? target.variant;\n const temperatureSource = target.temperature;\n const maxTokensSource = target.max_output_tokens ?? target.maxTokens;\n const thinkingBudgetSource = target.thinking_budget ?? target.thinkingBudget;\n\n const apiKey = resolveString(apiKeySource, env, `${target.name} Anthropic api key`);\n const model = resolveString(modelSource, env, `${target.name} Anthropic model`);\n const retry = resolveRetryConfig(target);\n\n return {\n apiKey,\n model,\n temperature: resolveOptionalNumber(temperatureSource, `${target.name} temperature`),\n maxOutputTokens: resolveOptionalNumber(maxTokensSource, `${target.name} max output tokens`),\n thinkingBudget: resolveOptionalNumber(thinkingBudgetSource, `${target.name} thinking budget`),\n retry,\n };\n}\n\nfunction resolveGeminiConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n): GeminiResolvedConfig {\n const apiKeySource = target.api_key ?? target.apiKey;\n const modelSource = target.model ?? target.deployment ?? target.variant;\n const temperatureSource = target.temperature;\n const maxTokensSource = target.max_output_tokens ?? target.maxTokens;\n\n const apiKey = resolveString(apiKeySource, env, `${target.name} Google API key`);\n const model =\n resolveOptionalString(modelSource, env, `${target.name} Gemini model`, {\n allowLiteral: true,\n optionalEnv: true,\n }) ?? 'gemini-2.5-flash';\n const retry = resolveRetryConfig(target);\n\n return {\n apiKey,\n model,\n temperature: resolveOptionalNumber(temperatureSource, `${target.name} temperature`),\n maxOutputTokens: resolveOptionalNumber(maxTokensSource, `${target.name} max output tokens`),\n retry,\n };\n}\n\nfunction resolveCodexConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n): CodexResolvedConfig {\n const executableSource = target.executable ?? target.command ?? target.binary;\n const argsSource = target.args ?? target.arguments;\n const cwdSource = target.cwd;\n const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;\n const logDirSource =\n target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;\n const logFormatSource =\n target.log_format ??\n target.logFormat ??\n target.log_output_format ??\n target.logOutputFormat ??\n env.AGENTV_CODEX_LOG_FORMAT;\n const systemPromptSource = target.system_prompt ?? target.systemPrompt;\n\n const executable =\n resolveOptionalString(executableSource, env, `${target.name} codex executable`, {\n allowLiteral: true,\n optionalEnv: true,\n }) ?? 'codex';\n\n const args = resolveOptionalStringArray(argsSource, env, `${target.name} codex args`);\n\n const cwd = resolveOptionalString(cwdSource, env, `${target.name} codex cwd`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} codex timeout`);\n const logDir = resolveOptionalString(logDirSource, env, `${target.name} codex log directory`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n const logFormat = normalizeCodexLogFormat(logFormatSource);\n\n const systemPrompt =\n typeof systemPromptSource === 'string' && systemPromptSource.trim().length > 0\n ? systemPromptSource.trim()\n : undefined;\n\n return {\n executable,\n args,\n cwd,\n timeoutMs,\n logDir,\n logFormat,\n systemPrompt,\n };\n}\n\nfunction normalizeCodexLogFormat(value: unknown): 'summary' | 'json' | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n if (typeof value !== 'string') {\n throw new Error(\"codex log format must be 'summary' or 'json'\");\n }\n const normalized = value.trim().toLowerCase();\n if (normalized === 'json' || normalized === 'summary') {\n return normalized;\n }\n throw new Error(\"codex log format must be 'summary' or 'json'\");\n}\n\nfunction resolvePiCodingAgentConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n): PiCodingAgentResolvedConfig {\n const executableSource = target.executable ?? target.command ?? target.binary;\n const providerSource = target.pi_provider ?? target.piProvider ?? target.llm_provider;\n const modelSource = target.model ?? target.pi_model ?? target.piModel;\n const apiKeySource = target.api_key ?? target.apiKey;\n const toolsSource = target.tools ?? target.pi_tools ?? target.piTools;\n const thinkingSource = target.thinking ?? target.pi_thinking ?? target.piThinking;\n const argsSource = target.args ?? target.arguments;\n const cwdSource = target.cwd;\n const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;\n const logDirSource =\n target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;\n const logFormatSource = target.log_format ?? target.logFormat;\n const systemPromptSource = target.system_prompt ?? target.systemPrompt;\n\n const executable =\n resolveOptionalString(executableSource, env, `${target.name} pi executable`, {\n allowLiteral: true,\n optionalEnv: true,\n }) ?? 'pi';\n\n const provider = resolveOptionalString(providerSource, env, `${target.name} pi provider`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const model = resolveOptionalString(modelSource, env, `${target.name} pi model`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const apiKey = resolveOptionalString(apiKeySource, env, `${target.name} pi api key`, {\n allowLiteral: false,\n optionalEnv: true,\n });\n\n const tools = resolveOptionalString(toolsSource, env, `${target.name} pi tools`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const thinking = resolveOptionalString(thinkingSource, env, `${target.name} pi thinking`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const args = resolveOptionalStringArray(argsSource, env, `${target.name} pi args`);\n\n const cwd = resolveOptionalString(cwdSource, env, `${target.name} pi cwd`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} pi timeout`);\n\n const logDir = resolveOptionalString(logDirSource, env, `${target.name} pi log directory`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const logFormat =\n logFormatSource === 'json' || logFormatSource === 'summary' ? logFormatSource : undefined;\n\n const systemPrompt =\n typeof systemPromptSource === 'string' && systemPromptSource.trim().length > 0\n ? systemPromptSource.trim()\n : undefined;\n\n return {\n executable,\n provider,\n model,\n apiKey,\n tools,\n thinking,\n args,\n cwd,\n timeoutMs,\n logDir,\n logFormat,\n systemPrompt,\n };\n}\n\nfunction resolveMockConfig(target: z.infer<typeof BASE_TARGET_SCHEMA>): MockResolvedConfig {\n const response = typeof target.response === 'string' ? target.response : undefined;\n return { response };\n}\n\nfunction resolveVSCodeConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n insiders: boolean,\n): VSCodeResolvedConfig {\n const workspaceTemplateEnvVar = resolveOptionalLiteralString(\n target.workspace_template ?? target.workspaceTemplate,\n );\n const workspaceTemplate = workspaceTemplateEnvVar\n ? resolveOptionalString(\n workspaceTemplateEnvVar,\n env,\n `${target.name} workspace template path`,\n {\n allowLiteral: false,\n optionalEnv: true,\n },\n )\n : undefined;\n\n const commandSource = target.vscode_cmd ?? target.command;\n const waitSource = target.wait;\n const dryRunSource = target.dry_run ?? target.dryRun;\n const subagentRootSource = target.subagent_root ?? target.subagentRoot;\n\n const defaultCommand = insiders ? 'code-insiders' : 'code';\n const command = resolveOptionalLiteralString(commandSource) ?? defaultCommand;\n\n return {\n command,\n waitForResponse: resolveOptionalBoolean(waitSource) ?? true,\n dryRun: resolveOptionalBoolean(dryRunSource) ?? false,\n subagentRoot: resolveOptionalString(subagentRootSource, env, `${target.name} subagent root`, {\n allowLiteral: true,\n optionalEnv: true,\n }),\n workspaceTemplate,\n };\n}\n\n/**\n * Custom Zod error map for CLI provider validation.\n * Provides clear, user-friendly error messages for common validation failures.\n */\nconst cliErrorMap: z.ZodErrorMap = (issue, ctx) => {\n if (issue.code === z.ZodIssueCode.unrecognized_keys) {\n return { message: `Unknown CLI provider settings: ${issue.keys.join(', ')}` };\n }\n if (issue.code === z.ZodIssueCode.invalid_union_discriminator) {\n return { message: \"healthcheck type must be 'http' or 'command'\" };\n }\n if (issue.code === z.ZodIssueCode.invalid_type && issue.expected === 'string') {\n return { message: `${ctx.defaultError} (expected a string value)` };\n }\n return { message: ctx.defaultError };\n};\n\n/**\n * Resolves a CLI target configuration using Zod schema validation and normalization.\n *\n * This function:\n * 1. Parses the raw target with CliTargetInputSchema for structural validation\n * 2. Normalizes the input using normalizeCliTargetInput() for env var resolution and casing\n * 3. Validates CLI placeholders in the command template\n *\n * @param target - The raw target definition from YAML\n * @param env - Environment variable lookup for ${{ VAR }} resolution\n * @param evalFilePath - Optional path to eval file for relative path resolution\n * @returns Normalized CLI configuration matching CliResolvedConfig\n */\nfunction resolveCliConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n evalFilePath?: string,\n): CliResolvedConfig {\n // Parse with Zod schema for structural validation with custom error messages\n const parseResult = CliTargetInputSchema.safeParse(target, { errorMap: cliErrorMap });\n if (!parseResult.success) {\n const firstError = parseResult.error.errors[0];\n const path = firstError?.path.join('.') || '';\n const prefix = path ? `${target.name} ${path}: ` : `${target.name}: `;\n throw new Error(`${prefix}${firstError?.message}`);\n }\n\n // Normalize the parsed input (handles env var resolution, casing, path resolution)\n const normalized = normalizeCliTargetInput(parseResult.data, env, evalFilePath);\n\n // Validate CLI placeholders in command template\n assertSupportedCliPlaceholders(normalized.commandTemplate, `${target.name} CLI command template`);\n\n // Validate CLI placeholders in healthcheck command template if present\n if (normalized.healthcheck?.type === 'command') {\n assertSupportedCliPlaceholders(\n normalized.healthcheck.commandTemplate,\n `${target.name} healthcheck command template`,\n );\n }\n\n return normalized;\n}\n\nfunction resolveTimeoutMs(source: unknown, description: string): number | undefined {\n const seconds = resolveOptionalNumber(source, `${description} (seconds)`);\n if (seconds === undefined) {\n return undefined;\n }\n if (seconds <= 0) {\n throw new Error(`${description} must be greater than zero seconds`);\n }\n return Math.floor(seconds * 1000);\n}\n\nfunction assertSupportedCliPlaceholders(template: string, description: string): void {\n const placeholders = extractCliPlaceholders(template);\n for (const placeholder of placeholders) {\n if (!CLI_PLACEHOLDERS.has(placeholder)) {\n throw new Error(\n `${description} includes unsupported placeholder '{${placeholder}}'. Supported placeholders: ${Array.from(CLI_PLACEHOLDERS).join(', ')}`,\n );\n }\n }\n}\n\nfunction extractCliPlaceholders(template: string): string[] {\n const matches = template.matchAll(/\\{([A-Z_]+)\\}/g);\n const results: string[] = [];\n for (const match of matches) {\n if (match[1]) {\n results.push(match[1]);\n }\n }\n return results;\n}\n\nfunction resolveString(\n source: unknown,\n env: EnvLookup,\n description: string,\n allowLiteral = false,\n): string {\n const value = resolveOptionalString(source, env, description, {\n allowLiteral,\n optionalEnv: false,\n });\n if (value === undefined) {\n throw new Error(`${description} is required`);\n }\n return value;\n}\n\nfunction resolveOptionalString(\n source: unknown,\n env: EnvLookup,\n description: string,\n options?: { allowLiteral?: boolean; optionalEnv?: boolean },\n): string | undefined {\n if (source === undefined || source === null) {\n return undefined;\n }\n if (typeof source !== 'string') {\n throw new Error(`${description} must be a string`);\n }\n const trimmed = source.trim();\n if (trimmed.length === 0) {\n return undefined;\n }\n\n // Check for ${{ variable }} syntax\n const envVarMatch = trimmed.match(/^\\$\\{\\{\\s*([A-Z0-9_]+)\\s*\\}\\}$/i);\n if (envVarMatch) {\n const varName = envVarMatch[1];\n const envValue = env[varName];\n const optionalEnv = options?.optionalEnv ?? false;\n\n // Treat empty or undefined env vars the same way\n if (envValue === undefined || envValue.trim().length === 0) {\n if (optionalEnv) {\n return undefined;\n }\n const status = envValue === undefined ? 'is not set' : 'is empty';\n throw new Error(`Environment variable '${varName}' required for ${description} ${status}`);\n }\n return envValue;\n }\n\n // Return as literal value\n const allowLiteral = options?.allowLiteral ?? false;\n if (!allowLiteral) {\n throw new Error(\n `${description} must use \\${{ VARIABLE_NAME }} syntax for environment variables or be marked as allowing literals`,\n );\n }\n return trimmed;\n}\n\nfunction resolveOptionalLiteralString(source: unknown): string | undefined {\n if (source === undefined || source === null) {\n return undefined;\n }\n if (typeof source !== 'string') {\n throw new Error('expected string value');\n }\n const trimmed = source.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\nfunction resolveOptionalNumber(source: unknown, description: string): number | undefined {\n if (source === undefined || source === null || source === '') {\n return undefined;\n }\n if (typeof source === 'number') {\n return Number.isFinite(source) ? source : undefined;\n }\n if (typeof source === 'string') {\n const numeric = Number(source);\n if (Number.isFinite(numeric)) {\n return numeric;\n }\n }\n throw new Error(`${description} must be a number`);\n}\n\nfunction resolveOptionalBoolean(source: unknown): boolean | undefined {\n if (source === undefined || source === null || source === '') {\n return undefined;\n }\n if (typeof source === 'boolean') {\n return source;\n }\n if (typeof source === 'string') {\n const lowered = source.trim().toLowerCase();\n if (lowered === 'true' || lowered === '1') {\n return true;\n }\n if (lowered === 'false' || lowered === '0') {\n return false;\n }\n }\n throw new Error('expected boolean value');\n}\n\nfunction resolveOptionalStringArray(\n source: unknown,\n env: EnvLookup,\n description: string,\n): readonly string[] | undefined {\n if (source === undefined || source === null) {\n return undefined;\n }\n if (!Array.isArray(source)) {\n throw new Error(`${description} must be an array of strings`);\n }\n if (source.length === 0) {\n return undefined;\n }\n const resolved: string[] = [];\n for (let i = 0; i < source.length; i++) {\n const item = source[i];\n if (typeof item !== 'string') {\n throw new Error(`${description}[${i}] must be a string`);\n }\n const trimmed = item.trim();\n if (trimmed.length === 0) {\n throw new Error(`${description}[${i}] cannot be empty`);\n }\n\n // Check for ${{ variable }} syntax\n const envVarMatch = trimmed.match(/^\\$\\{\\{\\s*([A-Z0-9_]+)\\s*\\}\\}$/i);\n if (envVarMatch) {\n const varName = envVarMatch[1];\n const envValue = env[varName];\n if (envValue !== undefined) {\n if (envValue.trim().length === 0) {\n throw new Error(`Environment variable '${varName}' for ${description}[${i}] is empty`);\n }\n resolved.push(envValue);\n continue;\n }\n throw new Error(`Environment variable '${varName}' for ${description}[${i}] is not set`);\n }\n\n // Treat as literal value\n resolved.push(trimmed);\n }\n return resolved.length > 0 ? resolved : undefined;\n}\n\nfunction resolveOptionalNumberArray(\n source: unknown,\n description: string,\n): readonly number[] | undefined {\n if (source === undefined || source === null) {\n return undefined;\n }\n if (!Array.isArray(source)) {\n throw new Error(`${description} must be an array of numbers`);\n }\n if (source.length === 0) {\n return undefined;\n }\n const resolved: number[] = [];\n for (let i = 0; i < source.length; i++) {\n const item = source[i];\n if (typeof item !== 'number' || !Number.isFinite(item)) {\n throw new Error(`${description}[${i}] must be a number`);\n }\n resolved.push(item);\n }\n return resolved.length > 0 ? resolved : undefined;\n}\n","import type { JsonObject } from '../types.js';\n\nexport type ChatMessageRole = 'system' | 'user' | 'assistant' | 'tool' | 'function';\n\nexport interface ChatMessage {\n readonly role: ChatMessageRole;\n readonly content: string;\n readonly name?: string;\n}\n\nexport type ChatPrompt = readonly ChatMessage[];\n\nexport type ProviderKind =\n | 'azure'\n | 'anthropic'\n | 'gemini'\n | 'codex'\n | 'pi-coding-agent'\n | 'cli'\n | 'mock'\n | 'vscode'\n | 'vscode-insiders';\n\n/**\n * Agent providers that have filesystem access and don't need unwrapped guidelines.\n * These providers read files directly from the filesystem using file:// URIs.\n */\nexport const AGENT_PROVIDER_KINDS: readonly ProviderKind[] = [\n 'codex',\n 'pi-coding-agent',\n 'vscode',\n 'vscode-insiders',\n] as const;\n\n/**\n * List of all supported provider kinds.\n * This is the source of truth for provider validation.\n */\nexport const KNOWN_PROVIDERS: readonly ProviderKind[] = [\n 'azure',\n 'anthropic',\n 'gemini',\n 'codex',\n 'pi-coding-agent',\n 'cli',\n 'mock',\n 'vscode',\n 'vscode-insiders',\n] as const;\n\n/**\n * Provider aliases that are accepted in target definitions.\n * These map to the canonical ProviderKind values.\n */\nexport const PROVIDER_ALIASES: readonly string[] = [\n 'azure-openai', // alias for \"azure\"\n 'google', // alias for \"gemini\"\n 'google-gemini', // alias for \"gemini\"\n 'codex-cli', // alias for \"codex\"\n 'pi', // alias for \"pi-coding-agent\"\n 'openai', // legacy/future support\n 'bedrock', // legacy/future support\n 'vertex', // legacy/future support\n] as const;\n\n/**\n * Schema identifier for targets.yaml files (version 2).\n */\nexport const TARGETS_SCHEMA_V2 = 'agentv-targets-v2.2';\n\nexport interface ProviderRequest {\n readonly question: string;\n readonly systemPrompt?: string;\n readonly guidelines?: string;\n readonly guideline_patterns?: readonly string[];\n readonly chatPrompt?: ChatPrompt;\n readonly inputFiles?: readonly string[];\n readonly evalCaseId?: string;\n readonly attempt?: number;\n readonly maxOutputTokens?: number;\n readonly temperature?: number;\n readonly metadata?: JsonObject;\n readonly signal?: AbortSignal;\n}\n\n/**\n * A tool call within an output message.\n * Represents a single tool invocation with its input and optional output.\n */\nexport interface ToolCall {\n /** Tool name */\n readonly tool: string;\n /** Tool input arguments */\n readonly input?: unknown;\n /** Tool output result */\n readonly output?: unknown;\n /** Stable identifier for pairing tool calls */\n readonly id?: string;\n /** ISO 8601 timestamp */\n readonly timestamp?: string;\n}\n\n/**\n * An output message from agent execution.\n * Represents a single message in the conversation with optional tool calls.\n */\nexport interface OutputMessage {\n /** Message role (e.g., 'assistant', 'user', 'tool') */\n readonly role: string;\n /** Optional name for the message sender */\n readonly name?: string;\n /** Message content */\n readonly content?: unknown;\n /** Tool calls made in this message */\n readonly toolCalls?: readonly ToolCall[];\n /** ISO 8601 timestamp */\n readonly timestamp?: string;\n /** Provider-specific metadata */\n readonly metadata?: Record<string, unknown>;\n}\n\n/**\n * Token usage metrics reported by provider.\n */\nexport interface ProviderTokenUsage {\n /** Input/prompt tokens consumed */\n readonly input: number;\n /** Output/completion tokens generated */\n readonly output: number;\n /** Cached tokens (optional, provider-specific) */\n readonly cached?: number;\n}\n\nexport interface ProviderResponse {\n readonly raw?: unknown;\n readonly usage?: JsonObject;\n /** Output messages from agent execution (primary source for tool trajectory) */\n readonly outputMessages?: readonly OutputMessage[];\n /** Token usage metrics (optional) */\n readonly tokenUsage?: ProviderTokenUsage;\n /** Total cost in USD (optional) */\n readonly costUsd?: number;\n /** Execution duration in milliseconds (optional) */\n readonly durationMs?: number;\n}\n\n/**\n * Extract the content from the last assistant message in an output message array.\n * Returns empty string if no assistant message found.\n */\nexport function extractLastAssistantContent(\n messages: readonly OutputMessage[] | undefined,\n): string {\n if (!messages || messages.length === 0) {\n return '';\n }\n\n // Find the last assistant message (reverse search)\n for (let i = messages.length - 1; i >= 0; i--) {\n const msg = messages[i];\n if (msg.role === 'assistant' && msg.content !== undefined) {\n if (typeof msg.content === 'string') {\n return msg.content;\n }\n return JSON.stringify(msg.content);\n }\n }\n\n return '';\n}\n\n/**\n * Type guard to check if a provider is an agent provider with filesystem access.\n * Agent providers read files directly and don't need unwrapped guideline content.\n */\nexport function isAgentProvider(provider: Provider | undefined): boolean {\n return provider ? AGENT_PROVIDER_KINDS.includes(provider.kind) : false;\n}\n\nexport interface Provider {\n readonly id: string;\n readonly kind: ProviderKind;\n readonly targetName: string;\n invoke(request: ProviderRequest): Promise<ProviderResponse>;\n /**\n * Optional capability marker for provider-managed batching (single session handling multiple requests).\n */\n readonly supportsBatch?: boolean;\n /**\n * Optional batch invocation hook. When defined alongside supportsBatch=true,\n * the orchestrator may send multiple requests in a single provider session.\n */\n invokeBatch?(requests: readonly ProviderRequest[]): Promise<readonly ProviderResponse[]>;\n /**\n * Optional method to get a Vercel AI SDK LanguageModel instance for structured output generation.\n * Used by evaluators that need generateObject/generateText from the AI SDK.\n */\n asLanguageModel?(): import('ai').LanguageModel;\n}\n\nexport type EnvLookup = Readonly<Record<string, string | undefined>>;\n\nexport interface TargetDefinition {\n readonly name: string;\n readonly provider: ProviderKind | string;\n readonly judge_target?: string | undefined;\n readonly workers?: number | undefined;\n // Provider batching\n readonly provider_batching?: boolean | undefined;\n readonly providerBatching?: boolean | undefined;\n // Azure fields\n readonly endpoint?: string | unknown | undefined;\n readonly resource?: string | unknown | undefined;\n readonly resourceName?: string | unknown | undefined;\n readonly api_key?: string | unknown | undefined;\n readonly apiKey?: string | unknown | undefined;\n readonly deployment?: string | unknown | undefined;\n readonly deploymentName?: string | unknown | undefined;\n readonly model?: string | unknown | undefined;\n readonly version?: string | unknown | undefined;\n readonly api_version?: string | unknown | undefined;\n // Anthropic fields\n readonly variant?: string | unknown | undefined;\n readonly thinking_budget?: number | unknown | undefined;\n readonly thinkingBudget?: number | unknown | undefined;\n // Common fields\n readonly temperature?: number | unknown | undefined;\n readonly max_output_tokens?: number | unknown | undefined;\n readonly maxTokens?: number | unknown | undefined;\n // Codex fields\n readonly executable?: string | unknown | undefined;\n readonly command?: string | unknown | undefined;\n readonly binary?: string | unknown | undefined;\n readonly args?: unknown | undefined;\n readonly arguments?: unknown | undefined;\n readonly cwd?: string | unknown | undefined;\n readonly timeout_seconds?: number | unknown | undefined;\n readonly timeoutSeconds?: number | unknown | undefined;\n readonly log_dir?: string | unknown | undefined;\n readonly logDir?: string | unknown | undefined;\n readonly log_directory?: string | unknown | undefined;\n readonly logDirectory?: string | unknown | undefined;\n readonly log_format?: string | unknown | undefined;\n readonly logFormat?: string | unknown | undefined;\n readonly log_output_format?: string | unknown | undefined;\n readonly logOutputFormat?: string | unknown | undefined;\n // Mock fields\n readonly response?: string | unknown | undefined;\n readonly delayMs?: number | unknown | undefined;\n readonly delayMinMs?: number | unknown | undefined;\n readonly delayMaxMs?: number | unknown | undefined;\n // VSCode fields\n readonly vscode_cmd?: string | unknown | undefined;\n readonly wait?: boolean | unknown | undefined;\n readonly dry_run?: boolean | unknown | undefined;\n readonly dryRun?: boolean | unknown | undefined;\n readonly subagent_root?: string | unknown | undefined;\n readonly subagentRoot?: string | unknown | undefined;\n readonly workspace_template?: string | unknown | undefined;\n readonly workspaceTemplate?: string | unknown | undefined;\n // CLI fields\n readonly command_template?: string | unknown | undefined;\n readonly commandTemplate?: string | unknown | undefined;\n readonly files_format?: string | unknown | undefined;\n readonly filesFormat?: string | unknown | undefined;\n readonly attachments_format?: string | unknown | undefined;\n readonly attachmentsFormat?: string | unknown | undefined;\n readonly env?: unknown | undefined;\n readonly healthcheck?: unknown | undefined;\n // Retry configuration fields\n readonly max_retries?: number | unknown | undefined;\n readonly maxRetries?: number | unknown | undefined;\n readonly retry_initial_delay_ms?: number | unknown | undefined;\n readonly retryInitialDelayMs?: number | unknown | undefined;\n readonly retry_max_delay_ms?: number | unknown | undefined;\n readonly retryMaxDelayMs?: number | unknown | undefined;\n readonly retry_backoff_factor?: number | unknown | undefined;\n readonly retryBackoffFactor?: number | unknown | undefined;\n readonly retry_status_codes?: unknown | undefined;\n readonly retryStatusCodes?: unknown | undefined;\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,QAAQ,gBAAgB;AACjC,OAAO,UAAU;AAEjB,eAAsB,WAAW,UAAoC;AACnE,MAAI;AACF,UAAM,OAAO,UAAU,UAAU,IAAI;AACrC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,SAAS,qBAAqB,SAAyB;AAC5D,SAAO,QAAQ,QAAQ,SAAS,IAAI;AACtC;AAMA,eAAsB,aAAa,UAAmC;AACpE,QAAM,UAAU,MAAM,SAAS,U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