@agentv/core 2.7.1-next.5 → 2.7.1-next.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.
@@ -190,27 +190,25 @@ async function resolveFileReference(rawValue, searchRoots) {
190
190
  import path2 from "node:path";
191
191
  import { z } from "zod";
192
192
  var CliHealthcheckHttpInputSchema = z.object({
193
- type: z.literal("http"),
194
193
  url: z.string().min(1, "healthcheck URL is required"),
195
194
  timeout_seconds: z.number().positive().optional(),
196
195
  timeoutSeconds: z.number().positive().optional()
197
196
  });
198
197
  var CliHealthcheckCommandInputSchema = z.object({
199
- type: z.literal("command"),
200
- command_template: z.string().optional(),
201
- commandTemplate: z.string().optional(),
198
+ command: z.string().min(1, "healthcheck command is required"),
202
199
  cwd: z.string().optional(),
203
200
  timeout_seconds: z.number().positive().optional(),
204
201
  timeoutSeconds: z.number().positive().optional()
205
202
  });
206
- var CliHealthcheckInputSchema = z.discriminatedUnion("type", [
203
+ var CliHealthcheckInputSchema = z.union([
207
204
  CliHealthcheckHttpInputSchema,
208
205
  CliHealthcheckCommandInputSchema
209
206
  ]);
210
207
  var CliTargetInputSchema = z.object({
211
208
  name: z.string().min(1, "target name is required"),
212
209
  provider: z.string().refine((p) => p.toLowerCase() === "cli", { message: "provider must be 'cli'" }),
213
- // Command template - required (accept both naming conventions)
210
+ // Command - required (accept both naming conventions)
211
+ command: z.string().optional(),
214
212
  command_template: z.string().optional(),
215
213
  commandTemplate: z.string().optional(),
216
214
  // Files format - optional
@@ -242,26 +240,27 @@ var CliTargetInputSchema = z.object({
242
240
  workers: z.number().int().min(1).optional(),
243
241
  provider_batching: z.boolean().optional(),
244
242
  providerBatching: z.boolean().optional()
245
- }).refine((data) => data.command_template !== void 0 || data.commandTemplate !== void 0, {
246
- message: "Either command_template or commandTemplate is required"
247
- });
243
+ }).refine(
244
+ (data) => data.command !== void 0 || data.command_template !== void 0 || data.commandTemplate !== void 0,
245
+ {
246
+ message: "'command' is required"
247
+ }
248
+ );
248
249
  var CliHealthcheckHttpSchema = z.object({
249
- type: z.literal("http"),
250
250
  url: z.string().min(1),
251
251
  timeoutMs: z.number().positive().optional()
252
252
  }).strict();
253
253
  var CliHealthcheckCommandSchema = z.object({
254
- type: z.literal("command"),
255
- commandTemplate: z.string().min(1),
254
+ command: z.string().min(1),
256
255
  cwd: z.string().optional(),
257
256
  timeoutMs: z.number().positive().optional()
258
257
  }).strict();
259
- var CliHealthcheckSchema = z.discriminatedUnion("type", [
258
+ var CliHealthcheckSchema = z.union([
260
259
  CliHealthcheckHttpSchema,
261
260
  CliHealthcheckCommandSchema
262
261
  ]);
263
262
  var CliTargetConfigSchema = z.object({
264
- commandTemplate: z.string().min(1),
263
+ command: z.string().min(1),
265
264
  filesFormat: z.string().optional(),
266
265
  cwd: z.string().optional(),
267
266
  workspaceTemplate: z.string().optional(),
@@ -273,26 +272,19 @@ var CliTargetConfigSchema = z.object({
273
272
  function normalizeCliHealthcheck(input, env, targetName, evalFilePath) {
274
273
  const timeoutSeconds = input.timeout_seconds ?? input.timeoutSeconds;
275
274
  const timeoutMs = timeoutSeconds !== void 0 ? Math.floor(timeoutSeconds * 1e3) : void 0;
276
- if (input.type === "http") {
275
+ if ("url" in input && input.url) {
277
276
  const url = resolveString(input.url, env, `${targetName} healthcheck URL`);
278
277
  return {
279
- type: "http",
280
278
  url,
281
279
  timeoutMs
282
280
  };
283
281
  }
284
- const commandTemplateSource = input.command_template ?? input.commandTemplate;
285
- if (commandTemplateSource === void 0) {
282
+ if (!("command" in input) || !input.command) {
286
283
  throw new Error(
287
- `${targetName} healthcheck: Either command_template or commandTemplate is required for command healthcheck`
284
+ `${targetName} healthcheck: Either 'command' or 'url' is required for healthcheck`
288
285
  );
289
286
  }
290
- const commandTemplate = resolveString(
291
- commandTemplateSource,
292
- env,
293
- `${targetName} healthcheck command template`,
294
- true
295
- );
287
+ const command = resolveString(input.command, env, `${targetName} healthcheck command`, true);
296
288
  let cwd = resolveOptionalString(input.cwd, env, `${targetName} healthcheck cwd`, {
297
289
  allowLiteral: true,
298
290
  optionalEnv: true
@@ -304,24 +296,18 @@ function normalizeCliHealthcheck(input, env, targetName, evalFilePath) {
304
296
  cwd = path2.dirname(path2.resolve(evalFilePath));
305
297
  }
306
298
  return {
307
- type: "command",
308
- commandTemplate,
299
+ command,
309
300
  cwd,
310
301
  timeoutMs
311
302
  };
312
303
  }
313
304
  function normalizeCliTargetInput(input, env, evalFilePath) {
314
305
  const targetName = input.name;
315
- const commandTemplateSource = input.command_template ?? input.commandTemplate;
316
- if (commandTemplateSource === void 0) {
317
- throw new Error(`${targetName}: Either command_template or commandTemplate is required`);
306
+ const commandSource = input.command ?? input.command_template ?? input.commandTemplate;
307
+ if (commandSource === void 0) {
308
+ throw new Error(`${targetName}: 'command' is required`);
318
309
  }
319
- const commandTemplate = resolveString(
320
- commandTemplateSource,
321
- env,
322
- `${targetName} CLI command template`,
323
- true
324
- );
310
+ const command = resolveString(commandSource, env, `${targetName} CLI command`, true);
325
311
  const filesFormatSource = input.files_format ?? input.filesFormat ?? input.attachments_format ?? input.attachmentsFormat;
326
312
  const filesFormat = resolveOptionalLiteralString(filesFormatSource);
327
313
  const workspaceTemplateSource = input.workspace_template ?? input.workspaceTemplate;
@@ -360,7 +346,7 @@ function normalizeCliTargetInput(input, env, evalFilePath) {
360
346
  );
361
347
  const healthcheck = input.healthcheck ? normalizeCliHealthcheck(input.healthcheck, env, targetName, evalFilePath) : void 0;
362
348
  return {
363
- commandTemplate,
349
+ command,
364
350
  filesFormat,
365
351
  cwd,
366
352
  workspaceTemplate,
@@ -372,6 +358,7 @@ function normalizeCliTargetInput(input, env, evalFilePath) {
372
358
  }
373
359
  var CLI_PLACEHOLDERS = /* @__PURE__ */ new Set([
374
360
  "PROMPT",
361
+ "PROMPT_FILE",
375
362
  "GUIDELINES",
376
363
  "EVAL_ID",
377
364
  "ATTEMPT",
@@ -1086,8 +1073,8 @@ var cliErrorMap = (issue, ctx) => {
1086
1073
  if (issue.code === z.ZodIssueCode.unrecognized_keys) {
1087
1074
  return { message: `Unknown CLI provider settings: ${issue.keys.join(", ")}` };
1088
1075
  }
1089
- if (issue.code === z.ZodIssueCode.invalid_union_discriminator) {
1090
- return { message: "healthcheck type must be 'http' or 'command'" };
1076
+ if (issue.code === z.ZodIssueCode.invalid_union) {
1077
+ return { message: "healthcheck must have either 'url' (HTTP) or 'command' (command)" };
1091
1078
  }
1092
1079
  if (issue.code === z.ZodIssueCode.invalid_type && issue.expected === "string") {
1093
1080
  return { message: `${ctx.defaultError} (expected a string value)` };
@@ -1103,18 +1090,18 @@ function resolveCliConfig(target, env, evalFilePath) {
1103
1090
  throw new Error(`${prefix}${firstError?.message}`);
1104
1091
  }
1105
1092
  const normalized = normalizeCliTargetInput(parseResult.data, env, evalFilePath);
1106
- assertSupportedCliPlaceholders(normalized.commandTemplate, `${target.name} CLI command template`);
1107
- if (normalized.healthcheck?.type === "command") {
1093
+ assertSupportedCliPlaceholders(normalized.command, `${target.name} CLI command`);
1094
+ if ("command" in (normalized.healthcheck ?? {}) && normalized.healthcheck.command) {
1108
1095
  assertSupportedCliPlaceholders(
1109
- normalized.healthcheck.commandTemplate,
1110
- `${target.name} healthcheck command template`
1096
+ normalized.healthcheck.command,
1097
+ `${target.name} healthcheck command`
1111
1098
  );
1112
1099
  }
1113
1100
  return normalized;
1114
1101
  }
1115
1102
  function resolveDiscoveredProviderConfig(target, providerKind, env, evalFilePath) {
1116
- const commandTemplateSource = target.command_template ?? target.commandTemplate;
1117
- const commandTemplate = commandTemplateSource ? resolveString(commandTemplateSource, env, `${target.name} command template`, true) : `bun run .agentv/providers/${providerKind}.ts {PROMPT}`;
1103
+ const commandSource = target.command ?? target.command_template ?? target.commandTemplate;
1104
+ const command = commandSource ? resolveString(commandSource, env, `${target.name} command`, true) : `bun run .agentv/providers/${providerKind}.ts {PROMPT}`;
1118
1105
  const timeoutSeconds = target.timeout_seconds ?? target.timeoutSeconds;
1119
1106
  const timeoutMs = resolveTimeoutMs(timeoutSeconds, `${target.name} timeout`);
1120
1107
  let cwd = resolveOptionalString(target.cwd, env, `${target.name} working directory`, {
@@ -1128,7 +1115,7 @@ function resolveDiscoveredProviderConfig(target, providerKind, env, evalFilePath
1128
1115
  cwd = path2.dirname(path2.resolve(evalFilePath));
1129
1116
  }
1130
1117
  return {
1131
- commandTemplate,
1118
+ command,
1132
1119
  cwd,
1133
1120
  timeoutMs
1134
1121
  };
@@ -1400,4 +1387,4 @@ export {
1400
1387
  extractLastAssistantContent,
1401
1388
  isAgentProvider
1402
1389
  };
1403
- //# sourceMappingURL=chunk-6W5E3VR6.js.map
1390
+ //# sourceMappingURL=chunk-5SV2QC6V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/evaluation/types.ts","../src/evaluation/file-utils.ts","../src/evaluation/providers/targets.ts","../src/evaluation/providers/types.ts"],"sourcesContent":["import type { ToolTrajectoryEvaluatorConfig, TraceSummary } from './trace.js';\n\n/**\n * JSON primitive values appearing in AgentV payloads.\n */\nexport type JsonPrimitive = string | number | boolean | null;\n\n/**\n * Immutable JSON object representation for test fixtures.\n */\nexport interface JsonObject {\n readonly [key: string]: JsonValue;\n}\n\n/**\n * Recursive JSON value supporting nested structures.\n */\nexport type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];\n\nconst TEST_MESSAGE_ROLE_VALUES = ['system', 'user', 'assistant', 'tool'] as const;\n\n/**\n * Immutable list of supported message roles.\n */\nexport const TEST_MESSAGE_ROLES = TEST_MESSAGE_ROLE_VALUES;\n\n/**\n * Role literals used by test messages.\n */\nexport type TestMessageRole = (typeof TEST_MESSAGE_ROLE_VALUES)[number];\n\nconst TEST_MESSAGE_ROLE_SET: ReadonlySet<string> = new Set(TEST_MESSAGE_ROLE_VALUES);\n\n/**\n * Text or structured payload attached to a message.\n */\nexport type TestMessageContent = string | JsonObject | readonly JsonObject[];\n\n/**\n * System-authored instruction message.\n */\nexport type SystemTestMessage = {\n readonly role: 'system';\n readonly content: TestMessageContent;\n};\n\n/**\n * User-authored prompt message.\n */\nexport type UserTestMessage = {\n readonly role: 'user';\n readonly content: TestMessageContent;\n};\n\n/**\n * Assistant response message.\n */\nexport type AssistantTestMessage = {\n readonly role: 'assistant';\n readonly content: TestMessageContent;\n};\n\n/**\n * Tool invocation message.\n */\nexport type ToolTestMessage = {\n readonly role: 'tool';\n readonly content: TestMessageContent;\n};\n\n/**\n * Conversation message union with role discrimination.\n */\nexport type TestMessage =\n | SystemTestMessage\n | UserTestMessage\n | AssistantTestMessage\n | ToolTestMessage;\n\n/**\n * Guard validating supported message roles.\n */\nexport function isTestMessageRole(value: unknown): value is TestMessageRole {\n return typeof value === 'string' && TEST_MESSAGE_ROLE_SET.has(value);\n}\n\n/**\n * Guard matching AgentV JSON objects.\n */\nexport function isJsonObject(value: unknown): value is JsonObject {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return false;\n }\n return Object.values(value as Record<string, unknown>).every(isJsonValue);\n}\n\n/**\n * Guard matching AgentV JSON values.\n */\nexport function isJsonValue(value: unknown): value is JsonValue {\n if (\n value === null ||\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ) {\n return true;\n }\n if (Array.isArray(value)) {\n return value.every(isJsonValue);\n }\n if (typeof value === 'object') {\n return isJsonObject(value);\n }\n return false;\n}\n\n/**\n * Guard validating raw test messages.\n * A valid test message has:\n * - A valid role (system, user, assistant, tool)\n * - Either content (string or array of objects) OR tool_calls (for assistant messages)\n */\nexport function isTestMessage(value: unknown): value is TestMessage {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const candidate = value as { role?: unknown; content?: unknown; tool_calls?: unknown };\n if (!isTestMessageRole(candidate.role)) {\n return false;\n }\n // Check for valid content\n if (typeof candidate.content === 'string') {\n return true;\n }\n if (Array.isArray(candidate.content) && candidate.content.every(isJsonObject)) {\n return true;\n }\n // Allow messages with tool_calls but no content (for expected_output format)\n if (Array.isArray(candidate.tool_calls) && candidate.tool_calls.length > 0) {\n return true;\n }\n // Allow messages with structured content object (e.g., { recommendation: ..., summary: ... })\n if (isJsonObject(candidate.content)) {\n return true;\n }\n return false;\n}\n\nconst EVALUATOR_KIND_VALUES = [\n 'code_judge',\n 'llm_judge',\n 'rubric',\n 'composite',\n 'tool_trajectory',\n 'field_accuracy',\n 'latency',\n 'cost',\n 'token_usage',\n 'execution_metrics',\n 'agent_judge',\n 'contains',\n 'regex',\n 'is_json',\n 'equals',\n 'rubrics',\n] as const;\n\nexport type EvaluatorKind = (typeof EVALUATOR_KIND_VALUES)[number];\n\nconst EVALUATOR_KIND_SET: ReadonlySet<string> = new Set(EVALUATOR_KIND_VALUES);\n\nexport function isEvaluatorKind(value: unknown): value is EvaluatorKind {\n return typeof value === 'string' && EVALUATOR_KIND_SET.has(value);\n}\n\n/**\n * Configuration for enabling target access in code_judge evaluators.\n * When present, the runtime will start a local proxy server that allows\n * the script to invoke configured targets without direct credential access.\n */\nexport type TargetAccessConfig = {\n /** Maximum number of target invocations allowed per execution (default: 50) */\n readonly max_calls?: number;\n};\n\n/**\n * Configuration for workspace lifecycle commands (before_all, after_all, before_each, after_each).\n * Commands are executed with workspace context passed via stdin.\n */\nexport type WorkspaceScriptConfig = {\n /** Command array to execute (e.g., [\"bun\", \"run\", \"setup.ts\"]) */\n readonly command: readonly string[];\n /** @deprecated Use `command` instead */\n readonly script?: readonly string[];\n /** Optional timeout in milliseconds (default: 60000 for setup, 30000 for teardown) */\n readonly timeout_ms?: number;\n readonly timeoutMs?: number;\n /** Optional working directory for command execution */\n readonly cwd?: string;\n};\n\n/**\n * Workspace configuration for eval tests.\n * Can be specified at suite level and overridden per-case.\n * Merge strategy: template/scripts replaced, env deep-merged.\n *\n * Lifecycle hooks follow bun:test/Vitest naming:\n * - before_all: runs ONCE before first test, creates shared workspace\n * - after_all: runs ONCE after last test, final cleanup\n * - before_each: runs before each test (optional)\n * - after_each: runs after each test (e.g., reset git state)\n */\nexport type WorkspaceConfig = {\n /** Template directory or .code-workspace file. Directories are copied to temp workspace.\n * .code-workspace files are used by VS Code providers; CLI providers use the parent directory. */\n readonly template?: string;\n /** Command to run once before first test (after workspace creation, before git baseline) */\n readonly before_all?: WorkspaceScriptConfig;\n /** Command to run once after last test (before workspace cleanup) */\n readonly after_all?: WorkspaceScriptConfig;\n /** Command to run before each test */\n readonly before_each?: WorkspaceScriptConfig;\n /** Command to run after each test (e.g., git reset for workspace reuse) */\n readonly after_each?: WorkspaceScriptConfig;\n};\n\nexport type CodeEvaluatorConfig = {\n readonly name: string;\n readonly type: 'code';\n readonly command: readonly string[];\n /** @deprecated Use `command` instead */\n readonly script?: readonly string[];\n readonly resolvedScriptPath?: string;\n readonly cwd?: string;\n readonly resolvedCwd?: string;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n /** Pass-through configuration for the code_judge (any unrecognized YAML properties) */\n readonly config?: JsonObject;\n /** When present, enables target access via local proxy */\n readonly target?: TargetAccessConfig;\n};\n\n/**\n * Executable prompt template configuration.\n * Matches code_judge pattern for consistency.\n */\nexport type PromptScriptConfig = {\n /** Command array to execute (e.g., [\"bun\", \"run\", \"template.ts\"]) */\n readonly command: readonly string[];\n /** @deprecated Use `command` instead */\n readonly script?: readonly string[];\n /** Pass-through configuration for the prompt template */\n readonly config?: Record<string, unknown>;\n};\n\nexport type LlmJudgeEvaluatorConfig = {\n readonly name: string;\n readonly type: 'llm_judge';\n /** Text prompt (inline or file path) or executable script config */\n readonly prompt?: string | PromptScriptConfig;\n readonly promptPath?: string;\n /** Resolved absolute path for prompt file (used for text template prompts) */\n readonly resolvedPromptPath?: string;\n /** Resolved script array for executable prompts (matches code_judge pattern) */\n readonly resolvedPromptScript?: readonly string[];\n readonly rubrics?: readonly RubricItem[];\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n /** Pass-through configuration for custom evaluator prompts (legacy, prefer prompt.config) */\n readonly config?: Record<string, unknown>;\n};\n\n/**\n * Score range definition for analytic rubric scoring.\n * Each range maps an integer score band (0-10) to an outcome description.\n */\nexport type ScoreRange = {\n /** Inclusive integer range [min, max] within 0-10 */\n readonly score_range: readonly [number, number];\n /** Description of what this score range represents */\n readonly outcome: string;\n};\n\n/**\n * Rubric item for LLM judge evaluation.\n * Supports two modes:\n * - Checklist mode: boolean satisfied/not-satisfied with `outcome`\n * - Score-range mode: 0-10 integer scoring with `score_ranges`\n */\nexport type RubricItem = {\n readonly id: string;\n /**\n * For checklist rubrics: the outcome text (required).\n * For score-range rubrics: optional overall criterion description.\n */\n readonly outcome?: string;\n readonly weight: number;\n /**\n * Legacy boolean gating (deprecated, treated as required_min_score: 10).\n * Use required_min_score instead for finer control.\n */\n readonly required?: boolean;\n /**\n * Minimum score (0-10) required to pass this criterion.\n * If the criterion score is below this threshold, the overall verdict is 'fail'.\n */\n readonly required_min_score?: number;\n /**\n * Score range definitions for analytic rubric scoring.\n * When present, the judge outputs an integer 0-10 score per criterion.\n * Ranges must be non-overlapping and cover 0-10 inclusive.\n */\n readonly score_ranges?: readonly ScoreRange[];\n};\n\nexport type CompositeAggregatorConfig =\n | { readonly type: 'weighted_average'; readonly weights?: Record<string, number> }\n | { readonly type: 'code_judge'; readonly path: string; readonly cwd?: string }\n | {\n readonly type: 'llm_judge';\n readonly prompt?: string;\n readonly promptPath?: string;\n readonly model?: string;\n }\n | { readonly type: 'threshold'; readonly threshold: number };\n\nexport type CompositeEvaluatorConfig = {\n readonly name: string;\n readonly type: 'composite';\n readonly evaluators: readonly EvaluatorConfig[];\n readonly aggregator: CompositeAggregatorConfig;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Match type for field accuracy evaluation.\n * Note: For fuzzy string matching (Levenshtein, Jaro-Winkler, etc.), use a code_judge evaluator.\n * See examples/features/document-extraction/fuzzy_match.ts for an example.\n */\nexport type FieldMatchType = 'exact' | 'numeric_tolerance' | 'date';\n\n/**\n * Aggregation strategy for combining field scores.\n */\nexport type FieldAggregationType = 'weighted_average' | 'all_or_nothing';\n\n/**\n * Configuration for a single field to evaluate.\n */\nexport type FieldConfig = {\n /** Dot-notation path to the field (e.g., \"invoice.vendor.name\" or \"items[0].amount\") */\n readonly path: string;\n /** Match strategy for this field */\n readonly match: FieldMatchType;\n /** Whether this field is required (missing required fields count as failures) */\n readonly required?: boolean;\n /** Weight for aggregation (default: 1.0) */\n readonly weight?: number;\n /** Tolerance for numeric matching (absolute value unless relative is true) */\n readonly tolerance?: number;\n /** Whether tolerance is relative (percentage) vs absolute */\n readonly relative?: boolean;\n /** Date formats to try when parsing (default: common formats) */\n readonly formats?: readonly string[];\n};\n\n/**\n * Configuration for the field_accuracy evaluator.\n */\nexport type FieldAccuracyEvaluatorConfig = {\n readonly name: string;\n readonly type: 'field_accuracy';\n /** Fields to compare between candidate and expected */\n readonly fields: readonly FieldConfig[];\n /** Strategy for combining field scores (default: weighted_average) */\n readonly aggregation?: FieldAggregationType;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the latency evaluator.\n * Checks execution duration against a threshold.\n */\nexport type LatencyEvaluatorConfig = {\n readonly name: string;\n readonly type: 'latency';\n /** Maximum allowed duration in milliseconds */\n readonly threshold: number;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the cost evaluator.\n * Checks execution cost against a budget.\n */\nexport type CostEvaluatorConfig = {\n readonly name: string;\n readonly type: 'cost';\n /** Maximum allowed cost in USD */\n readonly budget: number;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the token_usage evaluator.\n * Checks provider-reported token usage against configured limits.\n */\nexport type TokenUsageEvaluatorConfig = {\n readonly name: string;\n readonly type: 'token_usage';\n /** Maximum allowed total tokens (input + output + cached, when present) */\n readonly max_total?: number;\n /** Maximum allowed input tokens (prompt) */\n readonly max_input?: number;\n /** Maximum allowed output tokens (completion) */\n readonly max_output?: number;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the execution_metrics evaluator.\n * Provides declarative threshold-based checks on execution metrics.\n * Only specified thresholds are checked; omitted ones are ignored.\n */\nexport type ExecutionMetricsEvaluatorConfig = {\n readonly name: string;\n readonly type: 'execution_metrics';\n /** Maximum allowed number of tool calls */\n readonly max_tool_calls?: number;\n /** Maximum allowed number of LLM calls (assistant messages) */\n readonly max_llm_calls?: number;\n /** Maximum allowed total tokens (input + output) */\n readonly max_tokens?: number;\n /** Maximum allowed cost in USD */\n readonly max_cost_usd?: number;\n /** Maximum allowed duration in milliseconds */\n readonly max_duration_ms?: number;\n /** Target exploration ratio (0-1, proportion of read-only tool calls) */\n readonly target_exploration_ratio?: number;\n /** Tolerance for exploration ratio check (default: 0.2) */\n readonly exploration_tolerance?: number;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the agent_judge evaluator.\n * Runs an agentic investigation loop to audit workspaces and verify criteria.\n * Two modes:\n * - Built-in: Uses AI SDK generateText() with sandboxed filesystem tools\n * - Judge target: Delegates to an external agent provider via Provider.invoke()\n */\nexport type AgentJudgeEvaluatorConfig = {\n readonly name: string;\n readonly type: 'agent_judge';\n /** Custom evaluation prompt (inline text or file path) */\n readonly prompt?: string;\n readonly promptPath?: string;\n /** Resolved absolute path for prompt file */\n readonly resolvedPromptPath?: string;\n /** Rubric items for structured evaluation (reuses llm_judge rubric infra) */\n readonly rubrics?: readonly RubricItem[];\n /** Maximum agent steps for built-in mode (default 10, max 50) */\n readonly max_steps?: number;\n /** Temperature for built-in mode (default 0) */\n readonly temperature?: number;\n /** Target name — delegates agent loop to this provider instead of built-in mode */\n readonly target?: string;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the contains assertion evaluator.\n * Checks whether the candidate output contains a specified substring.\n */\nexport type ContainsEvaluatorConfig = {\n readonly name: string;\n readonly type: 'contains';\n readonly value: string;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the regex assertion evaluator.\n * Checks whether the candidate output matches a regular expression pattern.\n */\nexport type RegexEvaluatorConfig = {\n readonly name: string;\n readonly type: 'regex';\n readonly value: string;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the is_json assertion evaluator.\n * Checks whether the candidate output is valid JSON.\n */\nexport type IsJsonEvaluatorConfig = {\n readonly name: string;\n readonly type: 'is_json';\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the equals assertion evaluator.\n * Checks whether the candidate output exactly equals a specified string.\n */\nexport type EqualsEvaluatorConfig = {\n readonly name: string;\n readonly type: 'equals';\n readonly value: string;\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\n/**\n * Configuration for the rubrics evaluator.\n * Evaluates candidate output against a list of rubric criteria.\n */\nexport type RubricsEvaluatorConfig = {\n readonly name: string;\n readonly type: 'rubrics';\n readonly criteria: readonly RubricItem[];\n readonly weight?: number;\n readonly required?: boolean | number;\n /** When true, inverts the evaluator score (1 - score) and swaps pass/fail verdict */\n readonly negate?: boolean;\n};\n\nexport type EvaluatorConfig =\n | CodeEvaluatorConfig\n | LlmJudgeEvaluatorConfig\n | CompositeEvaluatorConfig\n | ToolTrajectoryEvaluatorConfig\n | FieldAccuracyEvaluatorConfig\n | LatencyEvaluatorConfig\n | CostEvaluatorConfig\n | TokenUsageEvaluatorConfig\n | ExecutionMetricsEvaluatorConfig\n | AgentJudgeEvaluatorConfig\n | ContainsEvaluatorConfig\n | RegexEvaluatorConfig\n | IsJsonEvaluatorConfig\n | EqualsEvaluatorConfig\n | RubricsEvaluatorConfig;\n\n/**\n * Eval test definition sourced from AgentV specs.\n */\nexport interface EvalTest {\n readonly id: string;\n readonly dataset?: string;\n readonly conversation_id?: string;\n readonly question: string;\n readonly input: readonly TestMessage[];\n readonly input_segments: readonly JsonObject[];\n readonly expected_output: readonly JsonObject[];\n readonly reference_answer?: string;\n readonly guideline_paths: readonly string[];\n readonly guideline_patterns?: readonly string[];\n readonly file_paths: readonly string[];\n readonly criteria: string;\n readonly evaluator?: EvaluatorKind;\n readonly evaluators?: readonly EvaluatorConfig[];\n /** Workspace configuration (merged from suite-level and case-level) */\n readonly workspace?: WorkspaceConfig;\n /** Arbitrary metadata passed to workspace scripts via stdin */\n readonly metadata?: Record<string, unknown>;\n /** Per-test target override (matrix evaluation) */\n readonly targets?: readonly string[];\n}\n\n/** @deprecated Use `EvalTest` instead */\nexport type EvalCase = EvalTest;\n\n/**\n * Supported trial aggregation strategies.\n */\nexport type TrialStrategy = 'pass_at_k' | 'mean' | 'confidence_interval';\n\n/**\n * Configuration for running multiple trials per eval case.\n */\nexport interface TrialsConfig {\n readonly count: number;\n readonly strategy: TrialStrategy;\n readonly costLimitUsd?: number;\n}\n\n/**\n * Result of a single trial attempt.\n */\nexport interface TrialResult {\n readonly attempt: number;\n readonly score: number;\n readonly verdict: EvaluationVerdict;\n readonly scores?: readonly EvaluatorResult[];\n readonly error?: string;\n readonly costUsd?: number;\n}\n\n/**\n * Aggregation metadata for pass_at_k strategy.\n */\nexport interface PassAtKAggregation {\n readonly strategy: 'pass_at_k';\n readonly passedAttempts: number;\n readonly totalAttempts: number;\n}\n\n/**\n * Aggregation metadata for mean strategy.\n */\nexport interface MeanAggregation {\n readonly strategy: 'mean';\n readonly mean: number;\n readonly min: number;\n readonly max: number;\n}\n\n/**\n * Aggregation metadata for confidence_interval strategy.\n */\nexport interface ConfidenceIntervalAggregation {\n readonly strategy: 'confidence_interval';\n readonly mean: number;\n readonly ci95Lower: number;\n readonly ci95Upper: number;\n readonly stddev: number;\n}\n\n/**\n * Discriminated union of trial aggregation results.\n */\nexport type TrialAggregation = PassAtKAggregation | MeanAggregation | ConfidenceIntervalAggregation;\n\n/**\n * Evaluator scorecard for a single eval case run.\n */\nexport interface EvaluationResult {\n readonly timestamp: string;\n readonly testId: string;\n readonly dataset?: string;\n readonly conversationId?: string;\n readonly score: number;\n readonly hits: readonly string[];\n readonly misses: readonly string[];\n readonly answer: string;\n readonly target: string;\n readonly reasoning?: string;\n readonly requests?: {\n readonly agent?: JsonObject;\n readonly lm?: JsonObject;\n readonly evaluator?: JsonObject;\n };\n readonly scores?: readonly EvaluatorResult[];\n readonly error?: string;\n /** Lightweight summary of the execution trace (always included when available) */\n readonly trace?: TraceSummary;\n /** Path to the temporary workspace directory (included on failure for debugging) */\n readonly workspacePath?: string;\n /** Input messages or prompt string sent to the agent */\n readonly input?: readonly import('./providers/types.js').Message[] | string;\n /** Full output messages from agent execution (only included when --trace flag is set) */\n readonly output?: readonly import('./providers/types.js').Message[];\n /** Captured output from workspace before_all script */\n readonly beforeAllOutput?: string;\n /** Captured output from workspace before_each script */\n readonly beforeEachOutput?: string;\n /** Captured output from workspace after_all script */\n readonly afterAllOutput?: string;\n /** Captured output from workspace after_each script */\n readonly afterEachOutput?: string;\n /** Unified diff of workspace file changes (when workspace_template is configured) */\n readonly fileChanges?: string;\n /** Individual trial results (only present when trials.count > 1) */\n readonly trials?: readonly TrialResult[];\n /** Aggregation metadata describing how the final score was computed from trials */\n readonly aggregation?: TrialAggregation;\n /** Whether the trial loop was terminated early due to cost limit */\n readonly costLimited?: boolean;\n}\n\nexport type EvaluationVerdict = 'pass' | 'fail' | 'borderline';\n\nexport interface EvaluatorResult {\n readonly name: string;\n readonly type: EvaluatorKind;\n readonly score: number;\n readonly weight?: number;\n readonly verdict?: EvaluationVerdict;\n readonly hits: readonly string[];\n readonly misses: readonly string[];\n readonly reasoning?: string;\n readonly rawRequest?: JsonObject;\n readonly evaluatorProviderRequest?: JsonObject;\n readonly scores?: readonly EvaluatorResult[];\n /** Optional structured details from code judges (e.g., TP/TN/FP/FN counts). */\n readonly details?: JsonObject;\n}\n\n/**\n * Convenience accessor matching the Python hit_count property.\n */\nexport function getHitCount(result: Pick<EvaluationResult, 'hits'>): number {\n return result.hits.length;\n}\n","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 * url: http://localhost:8080/health\n * timeout_seconds: 30\n * ```\n */\nexport const CliHealthcheckHttpInputSchema = z.object({\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 * @example\n * ```yaml\n * healthcheck:\n * command: curl http://localhost:8080/health\n * cwd: /app\n * timeout_seconds: 10\n * ```\n */\nexport const CliHealthcheckCommandInputSchema = z.object({\n command: z.string().min(1, 'healthcheck command is required'),\n cwd: z.string().optional(),\n timeout_seconds: z.number().positive().optional(),\n timeoutSeconds: z.number().positive().optional(),\n});\n\n/**\n * Union for healthcheck input configuration.\n * The healthcheck type is self-describing: presence of `url` indicates HTTP,\n * presence of `command` indicates a command healthcheck.\n *\n * @see CliHealthcheckHttpInputSchema for HTTP healthcheck configuration\n * @see CliHealthcheckCommandInputSchema for command healthcheck configuration\n */\nexport const CliHealthcheckInputSchema = z.union([\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: agent run {PROMPT}\n * timeout_seconds: 120\n * healthcheck:\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 - required (accept both naming conventions)\n command: z.string().optional(),\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 // Workspace template directory - optional (mutually exclusive with cwd)\n workspace_template: z.string().optional(),\n workspaceTemplate: 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(\n (data) =>\n data.command !== undefined ||\n data.command_template !== undefined ||\n data.commandTemplate !== undefined,\n {\n message: \"'command' is required\",\n },\n );\n\n/**\n * Strict normalized schema for HTTP healthcheck configuration.\n * Rejects unknown properties.\n * This is an internal schema used as part of CliHealthcheckSchema.\n */\nconst CliHealthcheckHttpSchema = z\n .object({\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 * Rejects unknown properties.\n * This is an internal schema used as part of CliHealthcheckSchema.\n */\nconst CliHealthcheckCommandSchema = z\n .object({\n command: 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 * Union supporting HTTP and command healthchecks, distinguished by the\n * presence of `url` (HTTP) or `command` (command).\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.union([\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 * command: '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 command: z.string().min(1),\n filesFormat: z.string().optional(),\n cwd: z.string().optional(),\n workspaceTemplate: 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 ('url' in input && input.url) {\n const url = resolveString(input.url, env, `${targetName} healthcheck URL`);\n return {\n url,\n timeoutMs,\n };\n }\n\n // command healthcheck\n if (!('command' in input) || !input.command) {\n throw new Error(\n `${targetName} healthcheck: Either 'command' or 'url' is required for healthcheck`,\n );\n }\n const command = resolveString(input.command, env, `${targetName} healthcheck command`, true);\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 // 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 return {\n command,\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 * snake_case takes precedence over camelCase when both are present (matching YAML convention).\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 variants - at least one is required by schema refinement\n // Precedence: command > command_template > commandTemplate (backwards compat)\n const commandSource = input.command ?? input.command_template ?? input.commandTemplate;\n if (commandSource === undefined) {\n throw new Error(`${targetName}: 'command' is required`);\n }\n const command = resolveString(commandSource, env, `${targetName} CLI command`, true);\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 workspace template (mutually exclusive with cwd)\n const workspaceTemplateSource = input.workspace_template ?? input.workspaceTemplate;\n let workspaceTemplate = resolveOptionalString(\n workspaceTemplateSource,\n env,\n `${targetName} workspace template`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n // Resolve relative workspace template paths against eval file directory\n if (workspaceTemplate && evalFilePath && !path.isAbsolute(workspaceTemplate)) {\n workspaceTemplate = path.resolve(path.dirname(path.resolve(evalFilePath)), workspaceTemplate);\n }\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\n // Validate mutual exclusivity of cwd and workspace_template\n if (cwd && workspaceTemplate) {\n throw new Error(\n `${targetName}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`,\n );\n }\n\n // Fallback: if cwd is not set, workspace_template is not set, and we have an eval file path, use the eval directory\n if (!cwd && !workspaceTemplate && 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 command,\n filesFormat,\n cwd,\n workspaceTemplate,\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 'PROMPT_FILE',\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 model?: string;\n readonly executable: string;\n readonly args?: readonly string[];\n readonly cwd?: string;\n readonly workspaceTemplate?: string;\n readonly timeoutMs?: number;\n readonly logDir?: string;\n readonly logFormat?: 'summary' | 'json';\n readonly systemPrompt?: string;\n}\n\nexport interface CopilotCliResolvedConfig {\n readonly executable: string;\n readonly model?: string;\n readonly args?: readonly string[];\n readonly cwd?: string;\n readonly workspaceTemplate?: string;\n readonly timeoutMs?: number;\n readonly logDir?: string;\n readonly logFormat?: 'summary' | 'json';\n readonly systemPrompt?: string;\n}\n\nexport interface CopilotSdkResolvedConfig {\n readonly cliUrl?: string;\n readonly cliPath?: string;\n readonly githubToken?: string;\n readonly model?: string;\n readonly cwd?: string;\n readonly workspaceTemplate?: 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 workspaceTemplate?: string;\n readonly timeoutMs?: number;\n readonly logDir?: string;\n readonly logFormat?: 'summary' | 'json';\n readonly systemPrompt?: string;\n}\n\nexport interface PiAgentSdkResolvedConfig {\n readonly provider?: string;\n readonly model?: string;\n readonly apiKey?: string;\n readonly timeoutMs?: number;\n readonly systemPrompt?: string;\n}\n\nexport interface ClaudeResolvedConfig {\n readonly model?: string;\n readonly systemPrompt?: string;\n readonly cwd?: string;\n readonly workspaceTemplate?: string;\n readonly timeoutMs?: number;\n readonly maxTurns?: number;\n readonly maxBudgetUsd?: number;\n readonly logDir?: string;\n readonly logFormat?: 'summary' | 'json';\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 executable: string;\n readonly waitForResponse: boolean;\n readonly dryRun: boolean;\n readonly subagentRoot?: string;\n readonly workspaceTemplate?: string;\n readonly timeoutMs?: number;\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: 'copilot';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: CopilotSdkResolvedConfig;\n }\n | {\n readonly kind: 'copilot-cli';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: CopilotCliResolvedConfig;\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: 'pi-agent-sdk';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: PiAgentSdkResolvedConfig;\n }\n | {\n readonly kind: 'claude';\n readonly name: string;\n readonly judgeTarget?: string;\n readonly workers?: number;\n readonly providerBatching?: boolean;\n readonly config: ClaudeResolvedConfig;\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 workspace_template: z.string().optional(),\n workspaceTemplate: z.string().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, evalFilePath),\n };\n case 'copilot':\n case 'copilot-sdk':\n case 'copilot_sdk':\n return {\n kind: 'copilot',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveCopilotSdkConfig(parsed, env, evalFilePath),\n };\n case 'copilot-cli':\n return {\n kind: 'copilot-cli',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveCopilotCliConfig(parsed, env, evalFilePath),\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, evalFilePath),\n };\n case 'pi-agent-sdk':\n return {\n kind: 'pi-agent-sdk',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolvePiAgentSdkConfig(parsed, env),\n };\n case 'claude':\n case 'claude-code':\n case 'claude-sdk':\n return {\n kind: 'claude',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveClaudeConfig(parsed, env, evalFilePath),\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', evalFilePath),\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 // Unknown provider kind — resolve as CLI target.\n // This enables convention-based provider discovery: scripts in\n // .agentv/providers/ are registered in the ProviderRegistry under\n // their filename, and users can reference them by name directly.\n // The ProviderRegistry factory handles creating the appropriate\n // CliProvider with the discovered script path.\n return {\n kind: 'cli',\n name: parsed.name,\n judgeTarget: parsed.judge_target,\n workers: parsed.workers,\n providerBatching,\n config: resolveDiscoveredProviderConfig(parsed, provider, env, evalFilePath),\n };\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 evalFilePath?: string,\n): CodexResolvedConfig {\n const modelSource = target.model;\n const executableSource = target.executable ?? target.command ?? target.binary;\n const argsSource = target.args ?? target.arguments;\n const cwdSource = target.cwd;\n const workspaceTemplateSource = target.workspace_template ?? target.workspaceTemplate;\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 model = resolveOptionalString(modelSource, env, `${target.name} codex model`, {\n allowLiteral: true,\n optionalEnv: true,\n });\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\n let workspaceTemplate = resolveOptionalString(\n workspaceTemplateSource,\n env,\n `${target.name} codex workspace template`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n // Resolve relative workspace template paths against eval file directory\n if (workspaceTemplate && evalFilePath && !path.isAbsolute(workspaceTemplate)) {\n workspaceTemplate = path.resolve(path.dirname(path.resolve(evalFilePath)), workspaceTemplate);\n }\n\n // Validate mutual exclusivity of cwd and workspace_template\n if (cwd && workspaceTemplate) {\n throw new Error(\n `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`,\n );\n }\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 model,\n executable,\n args,\n cwd,\n workspaceTemplate,\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 resolveCopilotSdkConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n evalFilePath?: string,\n): CopilotSdkResolvedConfig {\n const cliUrlSource = target.cli_url ?? target.cliUrl;\n const cliPathSource = target.cli_path ?? target.cliPath;\n const githubTokenSource = target.github_token ?? target.githubToken;\n const modelSource = target.model;\n const cwdSource = target.cwd;\n const workspaceTemplateSource = target.workspace_template ?? target.workspaceTemplate;\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 cliUrl = resolveOptionalString(cliUrlSource, env, `${target.name} copilot-sdk cli URL`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const cliPath = resolveOptionalString(cliPathSource, env, `${target.name} copilot-sdk cli path`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const githubToken = resolveOptionalString(\n githubTokenSource,\n env,\n `${target.name} copilot-sdk github token`,\n {\n allowLiteral: false,\n optionalEnv: true,\n },\n );\n\n const model = resolveOptionalString(modelSource, env, `${target.name} copilot-sdk model`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const cwd = resolveOptionalString(cwdSource, env, `${target.name} copilot-sdk cwd`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n let workspaceTemplate = resolveOptionalString(\n workspaceTemplateSource,\n env,\n `${target.name} copilot-sdk workspace template`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n // Resolve relative workspace template paths against eval file directory\n if (workspaceTemplate && evalFilePath && !path.isAbsolute(workspaceTemplate)) {\n workspaceTemplate = path.resolve(path.dirname(path.resolve(evalFilePath)), workspaceTemplate);\n }\n\n // Validate mutual exclusivity of cwd and workspace_template\n if (cwd && workspaceTemplate) {\n throw new Error(\n `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`,\n );\n }\n\n const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} copilot-sdk timeout`);\n\n const logDir = resolveOptionalString(\n logDirSource,\n env,\n `${target.name} copilot-sdk log directory`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n const logFormat = normalizeCopilotLogFormat(logFormatSource);\n\n const systemPrompt =\n typeof systemPromptSource === 'string' && systemPromptSource.trim().length > 0\n ? systemPromptSource.trim()\n : undefined;\n\n return {\n cliUrl,\n cliPath,\n githubToken,\n model,\n cwd,\n workspaceTemplate,\n timeoutMs,\n logDir,\n logFormat,\n systemPrompt,\n };\n}\n\nfunction resolveCopilotCliConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n evalFilePath?: string,\n): CopilotCliResolvedConfig {\n const executableSource = target.executable ?? target.command ?? target.binary;\n const modelSource = target.model;\n const argsSource = target.args ?? target.arguments;\n const cwdSource = target.cwd;\n const workspaceTemplateSource = target.workspace_template ?? target.workspaceTemplate;\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} copilot-cli executable`, {\n allowLiteral: true,\n optionalEnv: true,\n }) ?? 'copilot';\n\n const model = resolveOptionalString(modelSource, env, `${target.name} copilot-cli model`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const args = resolveOptionalStringArray(argsSource, env, `${target.name} copilot-cli args`);\n\n const cwd = resolveOptionalString(cwdSource, env, `${target.name} copilot-cli cwd`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n let workspaceTemplate = resolveOptionalString(\n workspaceTemplateSource,\n env,\n `${target.name} copilot-cli workspace template`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n // Resolve relative workspace template paths against eval file directory\n if (workspaceTemplate && evalFilePath && !path.isAbsolute(workspaceTemplate)) {\n workspaceTemplate = path.resolve(path.dirname(path.resolve(evalFilePath)), workspaceTemplate);\n }\n\n // Validate mutual exclusivity of cwd and workspace_template\n if (cwd && workspaceTemplate) {\n throw new Error(\n `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`,\n );\n }\n\n const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} copilot-cli timeout`);\n\n const logDir = resolveOptionalString(\n logDirSource,\n env,\n `${target.name} copilot-cli log directory`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n const logFormat = normalizeCopilotLogFormat(logFormatSource);\n\n const systemPrompt =\n typeof systemPromptSource === 'string' && systemPromptSource.trim().length > 0\n ? systemPromptSource.trim()\n : undefined;\n\n return {\n executable,\n model,\n args,\n cwd,\n workspaceTemplate,\n timeoutMs,\n logDir,\n logFormat,\n systemPrompt,\n };\n}\n\nfunction normalizeCopilotLogFormat(value: unknown): 'summary' | 'json' | undefined {\n if (value === undefined || value === null) return undefined;\n if (typeof value !== 'string') throw new Error(\"copilot log format must be 'summary' or 'json'\");\n const normalized = value.trim().toLowerCase();\n if (normalized === 'json' || normalized === 'summary') return normalized;\n throw new Error(\"copilot log format must be 'summary' or 'json'\");\n}\n\nfunction resolvePiCodingAgentConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n evalFilePath?: string,\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 workspaceTemplateSource = target.workspace_template ?? target.workspaceTemplate;\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 let workspaceTemplate = resolveOptionalString(\n workspaceTemplateSource,\n env,\n `${target.name} pi workspace template`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n // Resolve relative workspace template paths against eval file directory\n if (workspaceTemplate && evalFilePath && !path.isAbsolute(workspaceTemplate)) {\n workspaceTemplate = path.resolve(path.dirname(path.resolve(evalFilePath)), workspaceTemplate);\n }\n\n // Validate mutual exclusivity of cwd and workspace_template\n if (cwd && workspaceTemplate) {\n throw new Error(\n `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`,\n );\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 workspaceTemplate,\n timeoutMs,\n logDir,\n logFormat,\n systemPrompt,\n };\n}\n\nfunction resolvePiAgentSdkConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n): PiAgentSdkResolvedConfig {\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 timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;\n const systemPromptSource = target.system_prompt ?? target.systemPrompt;\n\n const provider = resolveOptionalString(\n providerSource,\n env,\n `${target.name} pi-agent-sdk provider`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n const model = resolveOptionalString(modelSource, env, `${target.name} pi-agent-sdk model`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const apiKey = resolveOptionalString(apiKeySource, env, `${target.name} pi-agent-sdk api key`, {\n allowLiteral: false,\n optionalEnv: true,\n });\n\n const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} pi-agent-sdk timeout`);\n\n const systemPrompt =\n typeof systemPromptSource === 'string' && systemPromptSource.trim().length > 0\n ? systemPromptSource.trim()\n : undefined;\n\n return {\n provider,\n model,\n apiKey,\n timeoutMs,\n systemPrompt,\n };\n}\n\nfunction resolveClaudeConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n env: EnvLookup,\n evalFilePath?: string,\n): ClaudeResolvedConfig {\n const modelSource = target.model;\n const cwdSource = target.cwd;\n const workspaceTemplateSource = target.workspace_template ?? target.workspaceTemplate;\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_CLAUDE_LOG_FORMAT;\n const systemPromptSource = target.system_prompt ?? target.systemPrompt;\n\n const model = resolveOptionalString(modelSource, env, `${target.name} claude model`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const cwd = resolveOptionalString(cwdSource, env, `${target.name} claude cwd`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n let workspaceTemplate = resolveOptionalString(\n workspaceTemplateSource,\n env,\n `${target.name} claude workspace template`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n );\n\n // Resolve relative workspace template paths against eval file directory\n if (workspaceTemplate && evalFilePath && !path.isAbsolute(workspaceTemplate)) {\n workspaceTemplate = path.resolve(path.dirname(path.resolve(evalFilePath)), workspaceTemplate);\n }\n\n // Validate mutual exclusivity of cwd and workspace_template\n if (cwd && workspaceTemplate) {\n throw new Error(\n `${target.name}: 'cwd' and 'workspace_template' are mutually exclusive. Use 'cwd' to run in an existing directory, or 'workspace_template' to copy a template to a temp location.`,\n );\n }\n\n const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} claude timeout`);\n\n const logDir = resolveOptionalString(logDirSource, env, `${target.name} claude log directory`, {\n allowLiteral: true,\n optionalEnv: true,\n });\n\n const logFormat = normalizeClaudeLogFormat(logFormatSource);\n\n const systemPrompt =\n typeof systemPromptSource === 'string' && systemPromptSource.trim().length > 0\n ? systemPromptSource.trim()\n : undefined;\n\n const maxTurns =\n typeof target.max_turns === 'number'\n ? target.max_turns\n : typeof target.maxTurns === 'number'\n ? target.maxTurns\n : undefined;\n\n const maxBudgetUsd =\n typeof target.max_budget_usd === 'number'\n ? target.max_budget_usd\n : typeof target.maxBudgetUsd === 'number'\n ? target.maxBudgetUsd\n : undefined;\n\n return {\n model,\n systemPrompt,\n cwd,\n workspaceTemplate,\n timeoutMs,\n maxTurns,\n maxBudgetUsd,\n logDir,\n logFormat,\n };\n}\n\nfunction normalizeClaudeLogFormat(value: unknown): 'summary' | 'json' | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n if (typeof value !== 'string') {\n throw new Error(\"claude 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(\"claude log format must be 'summary' or 'json'\");\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 evalFilePath?: string,\n): VSCodeResolvedConfig {\n const workspaceTemplateEnvVar = resolveOptionalLiteralString(\n target.workspace_template ?? target.workspaceTemplate,\n );\n let workspaceTemplate = workspaceTemplateEnvVar\n ? resolveOptionalString(\n workspaceTemplateEnvVar,\n env,\n `${target.name} workspace template path`,\n {\n allowLiteral: true,\n optionalEnv: true,\n },\n )\n : undefined;\n\n // Resolve relative workspace template paths against eval file directory\n if (workspaceTemplate && evalFilePath && !path.isAbsolute(workspaceTemplate)) {\n workspaceTemplate = path.resolve(path.dirname(path.resolve(evalFilePath)), workspaceTemplate);\n }\n\n const executableSource = target.executable;\n const waitSource = target.wait;\n const dryRunSource = target.dry_run ?? target.dryRun;\n const subagentRootSource = target.subagent_root ?? target.subagentRoot;\n const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;\n\n const defaultCommand = insiders ? 'code-insiders' : 'code';\n const executable =\n resolveOptionalString(executableSource, env, `${target.name} vscode executable`, {\n allowLiteral: true,\n optionalEnv: true,\n }) ?? defaultCommand;\n\n const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} vscode timeout`);\n\n return {\n executable,\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 timeoutMs,\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) {\n return { message: \"healthcheck must have either 'url' (HTTP) or 'command' (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\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\n assertSupportedCliPlaceholders(normalized.command, `${target.name} CLI command`);\n\n // Validate CLI placeholders in healthcheck command if present\n if (\n 'command' in (normalized.healthcheck ?? {}) &&\n (normalized.healthcheck as { command: string }).command\n ) {\n assertSupportedCliPlaceholders(\n (normalized.healthcheck as { command: string }).command,\n `${target.name} healthcheck command`,\n );\n }\n\n return normalized;\n}\n\n/**\n * Resolves configuration for a discovered (convention-based) provider.\n *\n * When the provider kind doesn't match any built-in provider, it is assumed\n * to be a convention-based provider discovered from `.agentv/providers/`.\n * The command defaults to `bun run .agentv/providers/<kind>.ts {PROMPT}`\n * but can be overridden via `command` in the target definition.\n */\nfunction resolveDiscoveredProviderConfig(\n target: z.infer<typeof BASE_TARGET_SCHEMA>,\n providerKind: string,\n env: EnvLookup,\n evalFilePath?: string,\n): CliResolvedConfig {\n // Use explicit command if provided, otherwise derive from convention\n const commandSource = target.command ?? target.command_template ?? target.commandTemplate;\n const command = commandSource\n ? resolveString(commandSource, env, `${target.name} command`, true)\n : `bun run .agentv/providers/${providerKind}.ts {PROMPT}`;\n\n // Resolve optional fields using the same patterns as CLI providers\n const timeoutSeconds = target.timeout_seconds ?? target.timeoutSeconds;\n const timeoutMs = resolveTimeoutMs(timeoutSeconds, `${target.name} timeout`);\n\n let cwd = resolveOptionalString(target.cwd, env, `${target.name} 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\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 return {\n command,\n cwd,\n timeoutMs,\n };\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 | 'copilot'\n | 'copilot-cli'\n | 'pi-coding-agent'\n | 'pi-agent-sdk'\n | 'claude'\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 'copilot',\n 'copilot-cli',\n 'pi-coding-agent',\n 'claude',\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 'copilot',\n 'copilot-cli',\n 'pi-coding-agent',\n 'pi-agent-sdk',\n 'claude',\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 'copilot-sdk', // alias for \"copilot\"\n 'copilot_sdk', // alias for \"copilot\" (underscore variant)\n\n 'pi', // alias for \"pi-coding-agent\"\n 'claude-code', // alias for \"claude\" (legacy)\n 'claude-sdk', // alias for \"claude\"\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\n/** Callbacks for real-time observability during provider execution */\nexport interface ProviderStreamCallbacks {\n onToolCallStart?: (toolName: string, toolCallId?: string) => void;\n onToolCallEnd?: (\n toolName: string,\n input: unknown,\n output: unknown,\n durationMs: number,\n toolCallId?: string,\n ) => void;\n onLlmCallEnd?: (model: string, tokenUsage?: ProviderTokenUsage) => void;\n}\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 /** Working directory override (e.g., from workspace_template) */\n readonly cwd?: string;\n /** VS Code .code-workspace file (resolved from workspace.template) */\n readonly workspaceFile?: string;\n /** When true, AgentV captures file changes from workspace — provider should skip forced diff prompt */\n readonly captureFileChanges?: boolean;\n /** Real-time observability callbacks (optional) */\n readonly streamCallbacks?: ProviderStreamCallbacks;\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 when the tool call started */\n readonly startTime?: string;\n /** ISO 8601 timestamp when the tool call ended */\n readonly endTime?: string;\n /** Duration of the tool call in milliseconds */\n readonly durationMs?: number;\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 Message {\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 when the message started */\n readonly startTime?: string;\n /** ISO 8601 timestamp when the message ended */\n readonly endTime?: string;\n /** Duration of the message in milliseconds */\n readonly durationMs?: number;\n /** Provider-specific metadata */\n readonly metadata?: Record<string, unknown>;\n /** Per-message token usage metrics (optional) */\n readonly tokenUsage?: ProviderTokenUsage;\n}\n\n/** @deprecated Use Message instead */\nexport type OutputMessage = Message;\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 output?: readonly Message[];\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 /** ISO 8601 timestamp when execution started (optional) */\n readonly startTime?: string;\n /** ISO 8601 timestamp when execution ended (optional) */\n readonly endTime?: string;\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(messages: readonly Message[] | undefined): 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 // System prompt (codex, copilot, claude, pi-coding-agent)\n readonly system_prompt?: string | unknown | undefined;\n readonly systemPrompt?: string | unknown | undefined;\n // Claude Agent SDK fields\n readonly max_turns?: number | unknown | undefined;\n readonly maxTurns?: number | unknown | undefined;\n readonly max_budget_usd?: number | unknown | undefined;\n readonly maxBudgetUsd?: number | 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 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 (command is the canonical field; command_template/commandTemplate are deprecated aliases)\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 // Copilot SDK fields\n readonly cli_url?: string | unknown | undefined;\n readonly cliUrl?: string | unknown | undefined;\n readonly cli_path?: string | unknown | undefined;\n readonly cliPath?: string | unknown | undefined;\n readonly github_token?: string | unknown | undefined;\n readonly githubToken?: string | 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":";AAmBA,IAAM,2BAA2B,CAAC,UAAU,QAAQ,aAAa,MAAM;AAKhE,IAAM,qBAAqB;AAOlC,IAAM,wBAA6C,IAAI,IAAI,wBAAwB;AAmD5E,SAAS,kBAAkB,OAA0C;AAC1E,SAAO,OAAO,UAAU,YAAY,sBAAsB,IAAI,KAAK;AACrE;AAKO,SAAS,aAAa,OAAqC;AAChE,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG;AACvE,WAAO;AAAA,EACT;AACA,SAAO,OAAO,OAAO,KAAgC,EAAE,MAAM,WAAW;AAC1E;AAKO,SAAS,YAAY,OAAoC;AAC9D,MACE,UAAU,QACV,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU,WACjB;AACA,WAAO;AAAA,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