import type { TLocalizedValidationError } from "typebox/error"; export type FindingPath = readonly (string | number)[]; export type FindingSeverity = "error" | "warning"; /** A recorded acceptance of one advisory. Only ever set on a warning. */ export interface FindingDisposition { readonly reason: string; readonly authority: string; readonly at: string; } interface FindingBase { code: C; severity: S; path: FindingPath; /** * Present when the spec records an accepted reason for this advisory. The finding * is still reported: an accepted advisory is annotated, never removed, so a reader * sees both the concern and who accepted it. */ disposition?: FindingDisposition | undefined; } export type SchemaFinding = (FindingBase<"error", "schema-required"> & { keyword: "required"; property: string; params: Record; }) | (FindingBase<"error", "schema-additional-properties"> & { keyword: "additionalProperties"; properties: string[]; params: Record; }) | (FindingBase<"error", "schema-invalid"> & { keyword: string; params: Record; message?: string; }); export type PathInputFinding = FindingBase<"error", "absolute-path"> & { message: string; suppliedPath: string; }; export type YamlFinding = (FindingBase<"error", "read-error"> & { message: string; }) | (FindingBase<"error", "yaml-syntax"> & { message: string; }) | (FindingBase<"error", "yaml-unknown-tag"> & { tag: string; }) | (FindingBase<"error", "yaml-tag-style"> & { tag: string; style: string; }) | (FindingBase<"error", "yaml-multiple-documents"> & { count: number; }); export type SemanticFinding = (FindingBase<"error", "duplicate-node-id"> & { id: string; relatedPaths: FindingPath[]; }) | (FindingBase<"error", "duplicate-criterion-id"> & { id: string; relatedPaths: FindingPath[]; }) | (FindingBase<"error", "dependency-unresolved"> & { dependency: string; }) | (FindingBase<"error", "dependency-self"> & { dependency: string; }) | (FindingBase<"error", "dependency-cycle"> & { members: string[]; relatedPaths: FindingPath[]; }); export type CriterionLineageFinding = (FindingBase<"error", "criterion-draft-unavailable"> & { draftPath?: string; message: string; }) | (FindingBase<"error", "criterion-draft-invalid"> & { draftPath: string; message: string; }) | (FindingBase<"error", "criterion-draft-criterion-missing"> & { criterionId: string; draftPath: string; message: string; }) | (FindingBase<"error", "criterion-draft-criterion-unassigned"> & { criterionId: string; draftPath: string; message: string; }) | (FindingBase<"error", "criterion-text-unrecorded"> & { criterionId: string; message: string; }) | (FindingBase<"error", "criterion-amendment-root-mismatch"> & { criterionId: string; message: string; }) | (FindingBase<"error", "criterion-amendment-id-mismatch"> & { criterionId: string; actualId: string; message: string; }) | (FindingBase<"error", "criterion-amendment-discontinuous"> & { criterionId: string; message: string; }) | (FindingBase<"error", "criterion-amendment-endpoint-mismatch"> & { criterionId: string; message: string; }) | (FindingBase<"error", "criterion-amendment-noop"> & { criterionId: string; message: string; }); export type LintFinding = (FindingBase<"warning", "touches-concentration"> & { target: string; nodeIds: string[]; count: number; threshold: number; relatedPaths: FindingPath[]; }) | (FindingBase<"warning", "description-too-long"> & { length: number; threshold: number; }) | (FindingBase<"warning", "intent-description-duplicate"> & { score: number; threshold: number; relatedPaths: FindingPath[]; }); /** Findings about the disposition records themselves, never about what they accept. */ export type DispositionFinding = (FindingBase<"error", "duplicate-advisory-disposition"> & { dispositionCode: string; target: string; relatedPaths: FindingPath[]; message: string; }) | (FindingBase<"error", "disposition-targets-error"> & { dispositionCode: string; target: string; message: string; }) | (FindingBase<"warning", "disposition-unmatched"> & { dispositionCode: string; target: string; message: string; }); export type Finding = SchemaFinding | YamlFinding | SemanticFinding | CriterionLineageFinding | LintFinding | PathInputFinding | DispositionFinding; export type WorkFinding = Finding; export interface TaggedScalar { path: FindingPath; tag: string; style: "literal" | "folded"; } export interface StructurallyInvalidResult { structuralValid: false; valid: false; findings: Finding[]; value?: unknown; source: string; tags: TaggedScalar[]; } export interface StructurallyValidResult { structuralValid: true; valid: boolean; findings: Finding[]; value: T; spec: T; source: string; tags: TaggedScalar[]; } /** Structural validity is independent from semantic validity and warnings. */ export type ValidationResult = StructurallyInvalidResult | StructurallyValidResult; /** Decode a JSON Pointer path emitted by TypeBox into the public path form. */ export declare function decodeJsonPointer(pointer: string): FindingPath; /** Convert TypeBox's structured validation errors into stable, path-aware findings. */ export declare function typeboxFindings(errors: readonly TLocalizedValidationError[]): SchemaFinding[]; export declare function deduplicateFindings(findings: readonly T[]): T[]; export declare function formatFindingPath(pathSegments: FindingPath): string; export declare function renderFinding(finding: Finding): string; export declare function errorCount(findings: readonly Finding[]): number; export declare function warningCount(findings: readonly Finding[]): number; export {};