@agentv/core 0.2.3

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/evaluation/validation/index.ts","../../../src/evaluation/validation/file-type.ts","../../../src/evaluation/validation/eval-validator.ts","../../../src/evaluation/validation/targets-validator.ts","../../../src/evaluation/validation/file-reference-validator.ts","../../../src/evaluation/file-utils.ts"],"sourcesContent":["/**\r\n * Validation module for AgentV eval and targets files.\r\n */\r\n\r\nexport { detectFileType, isValidSchema, getExpectedSchema } from \"./file-type.js\";\r\nexport { validateEvalFile } from \"./eval-validator.js\";\r\nexport { validateTargetsFile } from \"./targets-validator.js\";\r\nexport { validateFileReferences } from \"./file-reference-validator.js\";\r\nexport type {\r\n FileType,\r\n ValidationSeverity,\r\n ValidationError,\r\n ValidationResult,\r\n ValidationSummary,\r\n} from \"./types.js\";\r\n","import { readFile } from \"node:fs/promises\";\r\nimport { parse } from \"yaml\";\r\n\r\nimport type { FileType } from \"./types.js\";\r\n\r\nconst SCHEMA_EVAL_V2 = \"agentv-eval-v2\";\r\nconst SCHEMA_TARGETS_V2 = \"agentv-targets-v2\";\r\n\r\n/**\r\n * Detect file type by reading $schema field from YAML file.\r\n * Returns \"unknown\" if file cannot be read or $schema is missing/invalid.\r\n */\r\nexport async function detectFileType(filePath: string): Promise<FileType> {\r\n try {\r\n const content = await readFile(filePath, \"utf8\");\r\n const parsed = parse(content) as unknown;\r\n\r\n if (typeof parsed !== \"object\" || parsed === null) {\r\n return \"unknown\";\r\n }\r\n\r\n const record = parsed as Record<string, unknown>;\r\n const schema = record[\"$schema\"];\r\n\r\n if (typeof schema !== \"string\") {\r\n return \"unknown\";\r\n }\r\n\r\n switch (schema) {\r\n case SCHEMA_EVAL_V2:\r\n return \"eval\";\r\n case SCHEMA_TARGETS_V2:\r\n return \"targets\";\r\n default:\r\n return \"unknown\";\r\n }\r\n } catch {\r\n return \"unknown\";\r\n }\r\n}\r\n\r\n/**\r\n * Check if a schema value is a valid AgentV schema identifier.\r\n */\r\nexport function isValidSchema(schema: unknown): boolean {\r\n return schema === SCHEMA_EVAL_V2 || schema === SCHEMA_TARGETS_V2;\r\n}\r\n\r\n/**\r\n * Get the expected schema for a file type.\r\n */\r\nexport function getExpectedSchema(fileType: FileType): string | undefined {\r\n switch (fileType) {\r\n case \"eval\":\r\n return SCHEMA_EVAL_V2;\r\n case \"targets\":\r\n return SCHEMA_TARGETS_V2;\r\n default:\r\n return undefined;\r\n }\r\n}\r\n","import { readFile } from \"node:fs/promises\";\r\nimport path from \"node:path\";\r\nimport { parse } from \"yaml\";\r\n\r\nimport type { ValidationError, ValidationResult } from \"./types.js\";\r\n\r\nconst SCHEMA_EVAL_V2 = \"agentv-eval-v2\";\r\n\r\ntype JsonValue = string | number | boolean | null | JsonObject | JsonArray;\r\ntype JsonObject = { readonly [key: string]: JsonValue };\r\ntype JsonArray = readonly JsonValue[];\r\n\r\nfunction isObject(value: unknown): value is JsonObject {\r\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\r\n}\r\n\r\n/**\r\n * Validate an eval file (agentv-eval-v2 schema).\r\n */\r\nexport async function validateEvalFile(\r\n filePath: string,\r\n): Promise<ValidationResult> {\r\n const errors: ValidationError[] = [];\r\n const absolutePath = path.resolve(filePath);\r\n\r\n let parsed: unknown;\r\n try {\r\n const content = await readFile(absolutePath, \"utf8\");\r\n parsed = parse(content);\r\n } catch (error) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n message: `Failed to parse YAML: ${(error as Error).message}`,\r\n });\r\n return {\r\n valid: false,\r\n filePath: absolutePath,\r\n fileType: \"eval\",\r\n errors,\r\n };\r\n }\r\n\r\n if (!isObject(parsed)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n message: \"File must contain a YAML object\",\r\n });\r\n return {\r\n valid: false,\r\n filePath: absolutePath,\r\n fileType: \"eval\",\r\n errors,\r\n };\r\n }\r\n\r\n // Validate $schema field\r\n const schema = parsed[\"$schema\"];\r\n if (schema !== SCHEMA_EVAL_V2) {\r\n const message =\r\n typeof schema === \"string\"\r\n ? `Invalid $schema value '${schema}'. Expected '${SCHEMA_EVAL_V2}'`\r\n : `Missing required field '$schema'. Expected '${SCHEMA_EVAL_V2}'`;\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: \"$schema\",\r\n message,\r\n });\r\n }\r\n\r\n // Validate evalcases array\r\n const evalcases = parsed[\"evalcases\"];\r\n if (!Array.isArray(evalcases)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: \"evalcases\",\r\n message: \"Missing or invalid 'evalcases' field (must be an array)\",\r\n });\r\n return {\r\n valid: errors.length === 0,\r\n filePath: absolutePath,\r\n fileType: \"eval\",\r\n errors,\r\n };\r\n }\r\n\r\n // Validate each eval case\r\n for (let i = 0; i < evalcases.length; i++) {\r\n const evalCase = evalcases[i];\r\n const location = `evalcases[${i}]`;\r\n\r\n if (!isObject(evalCase)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location,\r\n message: \"Eval case must be an object\",\r\n });\r\n continue;\r\n }\r\n\r\n // Required fields: id, outcome, input_messages, expected_messages\r\n const id = evalCase[\"id\"];\r\n if (typeof id !== \"string\" || id.trim().length === 0) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: `${location}.id`,\r\n message: \"Missing or invalid 'id' field (must be a non-empty string)\",\r\n });\r\n }\r\n\r\n const outcome = evalCase[\"outcome\"];\r\n if (typeof outcome !== \"string\" || outcome.trim().length === 0) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: `${location}.outcome`,\r\n message: \"Missing or invalid 'outcome' field (must be a non-empty string)\",\r\n });\r\n }\r\n\r\n const inputMessages = evalCase[\"input_messages\"];\r\n if (!Array.isArray(inputMessages)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: `${location}.input_messages`,\r\n message: \"Missing or invalid 'input_messages' field (must be an array)\",\r\n });\r\n } else {\r\n validateMessages(inputMessages, `${location}.input_messages`, absolutePath, errors);\r\n }\r\n\r\n const expectedMessages = evalCase[\"expected_messages\"];\r\n if (!Array.isArray(expectedMessages)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: `${location}.expected_messages`,\r\n message: \"Missing or invalid 'expected_messages' field (must be an array)\",\r\n });\r\n } else {\r\n validateMessages(expectedMessages, `${location}.expected_messages`, absolutePath, errors);\r\n }\r\n }\r\n\r\n return {\r\n valid: errors.length === 0,\r\n filePath: absolutePath,\r\n fileType: \"eval\",\r\n errors,\r\n };\r\n}\r\n\r\nfunction validateMessages(\r\n messages: JsonArray,\r\n location: string,\r\n filePath: string,\r\n errors: ValidationError[],\r\n): void {\r\n for (let i = 0; i < messages.length; i++) {\r\n const message = messages[i];\r\n const msgLocation = `${location}[${i}]`;\r\n\r\n if (!isObject(message)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: msgLocation,\r\n message: \"Message must be an object\",\r\n });\r\n continue;\r\n }\r\n\r\n // Validate role field\r\n const role = message[\"role\"];\r\n const validRoles = [\"system\", \"user\", \"assistant\"];\r\n if (!validRoles.includes(role as string)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: `${msgLocation}.role`,\r\n message: `Invalid role '${role}'. Must be one of: ${validRoles.join(\", \")}`,\r\n });\r\n }\r\n\r\n // Validate content field (can be string or array)\r\n const content = message[\"content\"];\r\n if (typeof content === \"string\") {\r\n // String content is valid\r\n } else if (Array.isArray(content)) {\r\n // Array content - validate each element\r\n for (let j = 0; j < content.length; j++) {\r\n const contentItem = content[j];\r\n const contentLocation = `${msgLocation}.content[${j}]`;\r\n\r\n if (typeof contentItem === \"string\") {\r\n // String in array is valid\r\n } else if (isObject(contentItem)) {\r\n const type = contentItem[\"type\"];\r\n if (typeof type !== \"string\") {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: `${contentLocation}.type`,\r\n message: \"Content object must have a 'type' field\",\r\n });\r\n }\r\n\r\n // For 'file' type, we'll validate existence later in file-reference-validator\r\n // For 'text' type, require 'value' field\r\n if (type === \"text\") {\r\n const value = contentItem[\"value\"];\r\n if (typeof value !== \"string\") {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: `${contentLocation}.value`,\r\n message: \"Content with type 'text' must have a 'value' field\",\r\n });\r\n }\r\n }\r\n } else {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: contentLocation,\r\n message: \"Content array items must be strings or objects\",\r\n });\r\n }\r\n }\r\n } else {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: `${msgLocation}.content`,\r\n message: \"Missing or invalid 'content' field (must be a string or array)\",\r\n });\r\n }\r\n }\r\n}\r\n","import { readFile } from \"node:fs/promises\";\r\nimport path from \"node:path\";\r\nimport { parse } from \"yaml\";\r\n\r\nimport type { ValidationError, ValidationResult } from \"./types.js\";\r\n\r\nconst SCHEMA_TARGETS_V2 = \"agentv-targets-v2\";\r\n\r\ntype JsonValue = string | number | boolean | null | JsonObject | JsonArray;\r\ntype JsonObject = { readonly [key: string]: JsonValue };\r\ntype JsonArray = readonly JsonValue[];\r\n\r\nfunction isObject(value: unknown): value is JsonObject {\r\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\r\n}\r\n\r\n/**\r\n * Validate a targets file (agentv-targets-v2 schema).\r\n */\r\nexport async function validateTargetsFile(\r\n filePath: string,\r\n): Promise<ValidationResult> {\r\n const errors: ValidationError[] = [];\r\n const absolutePath = path.resolve(filePath);\r\n\r\n let parsed: unknown;\r\n try {\r\n const content = await readFile(absolutePath, \"utf8\");\r\n parsed = parse(content);\r\n } catch (error) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n message: `Failed to parse YAML: ${(error as Error).message}`,\r\n });\r\n return {\r\n valid: false,\r\n filePath: absolutePath,\r\n fileType: \"targets\",\r\n errors,\r\n };\r\n }\r\n\r\n if (!isObject(parsed)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n message: \"File must contain a YAML object\",\r\n });\r\n return {\r\n valid: false,\r\n filePath: absolutePath,\r\n fileType: \"targets\",\r\n errors,\r\n };\r\n }\r\n\r\n // Validate $schema field\r\n const schema = parsed[\"$schema\"];\r\n if (schema !== SCHEMA_TARGETS_V2) {\r\n const message =\r\n typeof schema === \"string\"\r\n ? `Invalid $schema value '${schema}'. Expected '${SCHEMA_TARGETS_V2}'`\r\n : `Missing required field '$schema'. Expected '${SCHEMA_TARGETS_V2}'`;\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: \"$schema\",\r\n message,\r\n });\r\n }\r\n\r\n // Validate targets array\r\n const targets = parsed[\"targets\"];\r\n if (!Array.isArray(targets)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: \"targets\",\r\n message: \"Missing or invalid 'targets' field (must be an array)\",\r\n });\r\n return {\r\n valid: errors.length === 0,\r\n filePath: absolutePath,\r\n fileType: \"targets\",\r\n errors,\r\n };\r\n }\r\n\r\n // Validate each target definition\r\n const knownProviders = [\"azure\", \"openai\", \"anthropic\", \"bedrock\", \"vertex\"];\r\n \r\n for (let i = 0; i < targets.length; i++) {\r\n const target = targets[i];\r\n const location = `targets[${i}]`;\r\n\r\n if (!isObject(target)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location,\r\n message: \"Target must be an object\",\r\n });\r\n continue;\r\n }\r\n\r\n // Required field: name\r\n const name = target[\"name\"];\r\n if (typeof name !== \"string\" || name.trim().length === 0) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: `${location}.name`,\r\n message: \"Missing or invalid 'name' field (must be a non-empty string)\",\r\n });\r\n }\r\n\r\n // Required field: provider\r\n const provider = target[\"provider\"];\r\n if (typeof provider !== \"string\" || provider.trim().length === 0) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: `${location}.provider`,\r\n message: \"Missing or invalid 'provider' field (must be a non-empty string)\",\r\n });\r\n } else if (!knownProviders.includes(provider)) {\r\n // Warning for unknown providers (non-fatal)\r\n errors.push({\r\n severity: \"warning\",\r\n filePath: absolutePath,\r\n location: `${location}.provider`,\r\n message: `Unknown provider '${provider}'. Known providers: ${knownProviders.join(\", \")}`,\r\n });\r\n }\r\n\r\n // Optional field: settings (must be object if present)\r\n const settings = target[\"settings\"];\r\n if (settings !== undefined && !isObject(settings)) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: `${location}.settings`,\r\n message: \"Invalid 'settings' field (must be an object)\",\r\n });\r\n }\r\n\r\n // Optional field: judge_target (must be string if present)\r\n const judgeTarget = target[\"judge_target\"];\r\n if (judgeTarget !== undefined && typeof judgeTarget !== \"string\") {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n location: `${location}.judge_target`,\r\n message: \"Invalid 'judge_target' field (must be a string)\",\r\n });\r\n }\r\n }\r\n\r\n return {\r\n valid: errors.filter((e) => e.severity === \"error\").length === 0,\r\n filePath: absolutePath,\r\n fileType: \"targets\",\r\n errors,\r\n };\r\n}\r\n","import { readFile } from \"node:fs/promises\";\r\nimport path from \"node:path\";\r\nimport { parse } from \"yaml\";\r\n\r\nimport { buildSearchRoots, findGitRoot, resolveFileReference } from \"../file-utils.js\";\r\nimport type { ValidationError } from \"./types.js\";\r\n\r\ntype JsonValue = string | number | boolean | null | JsonObject | JsonArray;\r\ntype JsonObject = { readonly [key: string]: JsonValue };\r\ntype JsonArray = readonly JsonValue[];\r\n\r\nfunction isObject(value: unknown): value is JsonObject {\r\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\r\n}\r\n\r\n/**\r\n * Validate that file references in eval file content exist.\r\n * Checks content blocks with type: \"file\" and validates the referenced file exists.\r\n * Also checks that referenced files are not empty.\r\n */\r\nexport async function validateFileReferences(\r\n evalFilePath: string,\r\n): Promise<readonly ValidationError[]> {\r\n const errors: ValidationError[] = [];\r\n const absolutePath = path.resolve(evalFilePath);\r\n\r\n // Find git root and build search roots (same as yaml-parser does at runtime)\r\n const gitRoot = await findGitRoot(absolutePath);\r\n if (!gitRoot) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath: absolutePath,\r\n message: \"Cannot validate file references: git repository root not found\",\r\n });\r\n return errors;\r\n }\r\n\r\n const searchRoots = buildSearchRoots(absolutePath, gitRoot);\r\n\r\n let parsed: unknown;\r\n try {\r\n const content = await readFile(absolutePath, \"utf8\");\r\n parsed = parse(content);\r\n } catch {\r\n // Parse errors are already caught by eval-validator\r\n return errors;\r\n }\r\n\r\n if (!isObject(parsed)) {\r\n return errors;\r\n }\r\n\r\n const evalcases = parsed[\"evalcases\"];\r\n if (!Array.isArray(evalcases)) {\r\n return errors;\r\n }\r\n\r\n for (let i = 0; i < evalcases.length; i++) {\r\n const evalCase = evalcases[i];\r\n if (!isObject(evalCase)) {\r\n continue;\r\n }\r\n\r\n // Check input_messages\r\n const inputMessages = evalCase[\"input_messages\"];\r\n if (Array.isArray(inputMessages)) {\r\n await validateMessagesFileRefs(inputMessages, `evalcases[${i}].input_messages`, searchRoots, absolutePath, errors);\r\n }\r\n\r\n // Check expected_messages\r\n const expectedMessages = evalCase[\"expected_messages\"];\r\n if (Array.isArray(expectedMessages)) {\r\n await validateMessagesFileRefs(expectedMessages, `evalcases[${i}].expected_messages`, searchRoots, absolutePath, errors);\r\n }\r\n }\r\n\r\n return errors;\r\n}\r\n\r\nasync function validateMessagesFileRefs(\r\n messages: JsonArray,\r\n location: string,\r\n searchRoots: readonly string[],\r\n filePath: string,\r\n errors: ValidationError[],\r\n): Promise<void> {\r\n for (let i = 0; i < messages.length; i++) {\r\n const message = messages[i];\r\n if (!isObject(message)) {\r\n continue;\r\n }\r\n\r\n const content = message[\"content\"];\r\n if (typeof content === \"string\") {\r\n continue;\r\n }\r\n\r\n if (!Array.isArray(content)) {\r\n continue;\r\n }\r\n\r\n for (let j = 0; j < content.length; j++) {\r\n const contentItem = content[j];\r\n if (!isObject(contentItem)) {\r\n continue;\r\n }\r\n\r\n const type = contentItem[\"type\"];\r\n if (type !== \"file\") {\r\n continue;\r\n }\r\n\r\n const value = contentItem[\"value\"];\r\n if (typeof value !== \"string\") {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: `${location}[${i}].content[${j}].value`,\r\n message: \"File reference must have a 'value' field with the file path\",\r\n });\r\n continue;\r\n }\r\n\r\n // Use the same file resolution logic as yaml-parser at runtime\r\n const { resolvedPath } = await resolveFileReference(value, searchRoots);\r\n\r\n if (!resolvedPath) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: `${location}[${i}].content[${j}]`,\r\n message: `Referenced file not found: ${value}`,\r\n });\r\n } else {\r\n // Check that file is not empty\r\n try {\r\n const fileContent = await readFile(resolvedPath, \"utf8\");\r\n if (fileContent.trim().length === 0) {\r\n errors.push({\r\n severity: \"warning\",\r\n filePath,\r\n location: `${location}[${i}].content[${j}]`,\r\n message: `Referenced file is empty: ${value}`,\r\n });\r\n }\r\n } catch (error) {\r\n errors.push({\r\n severity: \"error\",\r\n filePath,\r\n location: `${location}[${i}].content[${j}]`,\r\n message: `Cannot read referenced file: ${value} (${(error as Error).message})`,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","import { constants } from \"node:fs\";\r\nimport { access } from \"node:fs/promises\";\r\nimport path from \"node:path\";\r\n\r\nexport async function fileExists(filePath: string): Promise<boolean> {\r\n try {\r\n await access(filePath, constants.F_OK);\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Find git repository root by walking up the directory tree.\r\n */\r\nexport async function findGitRoot(startPath: string): Promise<string | null> {\r\n let currentDir = path.dirname(path.resolve(startPath));\r\n const root = path.parse(currentDir).root;\r\n\r\n while (currentDir !== root) {\r\n const gitPath = path.join(currentDir, \".git\");\r\n if (await fileExists(gitPath)) {\r\n return currentDir;\r\n }\r\n\r\n const parentDir = path.dirname(currentDir);\r\n if (parentDir === currentDir) {\r\n break;\r\n }\r\n currentDir = parentDir;\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Build search roots for file resolution, matching yaml-parser behavior.\r\n * Searches from eval file directory up to repo root.\r\n */\r\nexport function buildSearchRoots(evalPath: string, repoRoot: string): readonly string[] {\r\n const uniqueRoots: string[] = [];\r\n const addRoot = (root: string): void => {\r\n const normalized = path.resolve(root);\r\n if (!uniqueRoots.includes(normalized)) {\r\n uniqueRoots.push(normalized);\r\n }\r\n };\r\n\r\n let currentDir = path.dirname(evalPath);\r\n let reachedBoundary = false;\r\n while (!reachedBoundary) {\r\n addRoot(currentDir);\r\n const parentDir = path.dirname(currentDir);\r\n if (currentDir === repoRoot || parentDir === currentDir) {\r\n reachedBoundary = true;\r\n } else {\r\n currentDir = parentDir;\r\n }\r\n }\r\n\r\n addRoot(repoRoot);\r\n addRoot(process.cwd());\r\n return uniqueRoots;\r\n}\r\n\r\n/**\r\n * Trim leading path separators for display.\r\n */\r\nfunction trimLeadingSeparators(value: string): string {\r\n const trimmed = value.replace(/^[/\\\\]+/, \"\");\r\n return trimmed.length > 0 ? trimmed : value;\r\n}\r\n\r\n/**\r\n * Resolve a file reference using search roots, matching yaml-parser behavior.\r\n */\r\nexport async function resolveFileReference(\r\n rawValue: string,\r\n searchRoots: readonly string[],\r\n): Promise<{\r\n readonly displayPath: string;\r\n readonly resolvedPath?: string;\r\n readonly attempted: readonly string[];\r\n}> {\r\n const displayPath = trimLeadingSeparators(rawValue);\r\n const potentialPaths: string[] = [];\r\n\r\n if (path.isAbsolute(rawValue)) {\r\n potentialPaths.push(path.normalize(rawValue));\r\n }\r\n\r\n for (const base of searchRoots) {\r\n potentialPaths.push(path.resolve(base, displayPath));\r\n }\r\n\r\n const attempted: string[] = [];\r\n const seen = new Set<string>();\r\n for (const candidate of potentialPaths) {\r\n const absoluteCandidate = path.resolve(candidate);\r\n if (seen.has(absoluteCandidate)) {\r\n continue;\r\n }\r\n seen.add(absoluteCandidate);\r\n attempted.push(absoluteCandidate);\r\n if (await fileExists(absoluteCandidate)) {\r\n return { displayPath, resolvedPath: absoluteCandidate, attempted };\r\n }\r\n }\r\n\r\n return { displayPath, attempted };\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAyB;AACzB,kBAAsB;AAItB,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;AAM1B,eAAsB,eAAe,UAAqC;AACxE,MAAI;AACF,UAAM,UAAU,UAAM,0BAAS,UAAU,MAAM;AAC/C,UAAM,aAAS,mBAAM,OAAO;AAE5B,QAAI,OAAO,WAAW,YAAY,WAAW,MAAM;AACjD,aAAO;AAAA,IACT;AAEA,UAAM,SAAS;AACf,UAAM,SAAS,OAAO,SAAS;AAE/B,QAAI,OAAO,WAAW,UAAU;AAC9B,aAAO;AAAA,IACT;AAEA,YAAQ,QAAQ;AAAA,MACd,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKO,SAAS,cAAc,QAA0B;AACtD,SAAO,WAAW,kBAAkB,WAAW;AACjD;AAKO,SAAS,kBAAkB,UAAwC;AACxE,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;;;AC5DA,IAAAA,mBAAyB;AACzB,uBAAiB;AACjB,IAAAC,eAAsB;AAItB,IAAMC,kBAAiB;AAMvB,SAAS,SAAS,OAAqC;AACrD,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAKA,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ACjB,eAAO,KAAK;AAAA,UACV,UAAU;AAAA,UACV;AAAA,UACA,UAAU,GAAG,QAAQ,IAAI,CAAC,aAAa,CAAC;AAAA,UACxC,SAAS,8BAA8B,KAAK;AAAA,QAC9C,CAAC;AAAA,MACH,OAAO;AAEL,YAAI;AACF,gBAAM,cAAc,UAAM,2BAAS,cAAc,MAAM;AACvD,cAAI,YAAY,KAAK,EAAE,WAAW,GAAG;AACnC,mBAAO,KAAK;AAAA,cACV,UAAU;AAAA,cACV;AAAA,cACA,UAAU,GAAG,QAAQ,IAAI,CAAC,aAAa,CAAC;AAAA,cACxC,SAAS,6BAA6B,KAAK;AAAA,YAC7C,CAAC;AAAA,UACH;AAAA,QACF,SAAS,OAAO;AACd,iBAAO,KAAK;AAAA,YACV,UAAU;AAAA,YACV;AAAA,YACA,UAAU,GAAG,QAAQ,IAAI,CAAC,aAAa,CAAC;AAAA,YACxC,SAAS,gCAAgC,KAAK,KAAM,MAAgB,OAAO;AAAA,UAC7E,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["import_promises","import_yaml","SCHEMA_EVAL_V2","path","import_promises","import_node_path","import_yaml","SCHEMA_TARGETS_V2","isObject","path","import_promises","import_node_path","import_yaml","import_promises","import_node_path","path","isObject","path"]}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Validation result types for AgentV file validation.
3
+ */
4
+ type FileType = "eval" | "targets" | "unknown";
5
+ type ValidationSeverity = "error" | "warning";
6
+ interface ValidationError {
7
+ readonly severity: ValidationSeverity;
8
+ readonly filePath: string;
9
+ readonly location?: string;
10
+ readonly message: string;
11
+ }
12
+ interface ValidationResult {
13
+ readonly valid: boolean;
14
+ readonly filePath: string;
15
+ readonly fileType: FileType;
16
+ readonly errors: readonly ValidationError[];
17
+ }
18
+ interface ValidationSummary {
19
+ readonly totalFiles: number;
20
+ readonly validFiles: number;
21
+ readonly invalidFiles: number;
22
+ readonly results: readonly ValidationResult[];
23
+ }
24
+
25
+ /**
26
+ * Detect file type by reading $schema field from YAML file.
27
+ * Returns "unknown" if file cannot be read or $schema is missing/invalid.
28
+ */
29
+ declare function detectFileType(filePath: string): Promise<FileType>;
30
+ /**
31
+ * Check if a schema value is a valid AgentV schema identifier.
32
+ */
33
+ declare function isValidSchema(schema: unknown): boolean;
34
+ /**
35
+ * Get the expected schema for a file type.
36
+ */
37
+ declare function getExpectedSchema(fileType: FileType): string | undefined;
38
+
39
+ /**
40
+ * Validate an eval file (agentv-eval-v2 schema).
41
+ */
42
+ declare function validateEvalFile(filePath: string): Promise<ValidationResult>;
43
+
44
+ /**
45
+ * Validate a targets file (agentv-targets-v2 schema).
46
+ */
47
+ declare function validateTargetsFile(filePath: string): Promise<ValidationResult>;
48
+
49
+ /**
50
+ * Validate that file references in eval file content exist.
51
+ * Checks content blocks with type: "file" and validates the referenced file exists.
52
+ * Also checks that referenced files are not empty.
53
+ */
54
+ declare function validateFileReferences(evalFilePath: string): Promise<readonly ValidationError[]>;
55
+
56
+ export { type FileType, type ValidationError, type ValidationResult, type ValidationSeverity, type ValidationSummary, detectFileType, getExpectedSchema, isValidSchema, validateEvalFile, validateFileReferences, validateTargetsFile };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Validation result types for AgentV file validation.
3
+ */
4
+ type FileType = "eval" | "targets" | "unknown";
5
+ type ValidationSeverity = "error" | "warning";
6
+ interface ValidationError {
7
+ readonly severity: ValidationSeverity;
8
+ readonly filePath: string;
9
+ readonly location?: string;
10
+ readonly message: string;
11
+ }
12
+ interface ValidationResult {
13
+ readonly valid: boolean;
14
+ readonly filePath: string;
15
+ readonly fileType: FileType;
16
+ readonly errors: readonly ValidationError[];
17
+ }
18
+ interface ValidationSummary {
19
+ readonly totalFiles: number;
20
+ readonly validFiles: number;
21
+ readonly invalidFiles: number;
22
+ readonly results: readonly ValidationResult[];
23
+ }
24
+
25
+ /**
26
+ * Detect file type by reading $schema field from YAML file.
27
+ * Returns "unknown" if file cannot be read or $schema is missing/invalid.
28
+ */
29
+ declare function detectFileType(filePath: string): Promise<FileType>;
30
+ /**
31
+ * Check if a schema value is a valid AgentV schema identifier.
32
+ */
33
+ declare function isValidSchema(schema: unknown): boolean;
34
+ /**
35
+ * Get the expected schema for a file type.
36
+ */
37
+ declare function getExpectedSchema(fileType: FileType): string | undefined;
38
+
39
+ /**
40
+ * Validate an eval file (agentv-eval-v2 schema).
41
+ */
42
+ declare function validateEvalFile(filePath: string): Promise<ValidationResult>;
43
+
44
+ /**
45
+ * Validate a targets file (agentv-targets-v2 schema).
46
+ */
47
+ declare function validateTargetsFile(filePath: string): Promise<ValidationResult>;
48
+
49
+ /**
50
+ * Validate that file references in eval file content exist.
51
+ * Checks content blocks with type: "file" and validates the referenced file exists.
52
+ * Also checks that referenced files are not empty.
53
+ */
54
+ declare function validateFileReferences(evalFilePath: string): Promise<readonly ValidationError[]>;
55
+
56
+ export { type FileType, type ValidationError, type ValidationResult, type ValidationSeverity, type ValidationSummary, detectFileType, getExpectedSchema, isValidSchema, validateEvalFile, validateFileReferences, validateTargetsFile };