/** * Character Validator * * Validates a character rig JSON object and returns a list of issues. * Errors = character will not work correctly. * Warnings = character may look wrong or have limited expressiveness. * * Schema constants live in characterSchema.ts (the contract). This module * enforces that contract. The Ruby mirror in app/models/artifact/character.rb * implements the same rules. */ import { MAX_TOTAL_VERTICES, type DimensionLayoutParityResult, type EmbeddedImageDetail, type HiddenPathDetail, type SvgRootUnits, type ViewBoxCheckResult, type ViewBoxFitResult } from './svgAssetAnalysis.js'; import { type SvgEditViewBoxPaddingResult } from './svgViewBox.js'; export type { ViewBoxCheckResult, ViewBoxFitResult, SvgEditViewBoxPaddingResult, DimensionLayoutParityResult }; export { CHARACTER_SCHEMA_VERSION, DEFAULT_DIMENSION_VALUES, DEFAULT_JOINT_OFFSET, DEFAULT_PIVOT_POINTS, DEFAULT_ROTATION_VALUES, DEFAULT_SELF_ROTATION_VALUES, DEFAULT_VISIBILITY, DEFAULT_Z_INDEX_VALUES, IMAGE_PATH_KEYS, JOINT_OFFSET_KEYS, LIMB_CONNECTIONS, MOUTH_SHAPE_KEYS, REQUIRED_BODY_PARTS, REQUIRED_DIMENSION_PARTS, REQUIRED_EYE_COORDS, REQUIRED_EYE_IMAGES, REQUIRED_IRIS_SIZES, REQUIRED_PIVOT_POINTS, REQUIRED_Z_INDEX_PARTS, RIGGER_LIMB_NAMES, TALKING_MOUTH_SHAPES, completeJointOffset, completePivotPoints, completeDimensionValues, completeRotationValues, completeSelfRotationValues, completeZIndexValues, normalizeRigData, } from './characterSchema.js'; export type IssueSeverity = 'error' | 'warning'; export type IssueCategory = 'parts' | 'eyes' | 'mouth' | 'pivots' | 'zIndex' | 'dimensions' | 'rigStandardization'; export interface ValidationIssue { field: string; message: string; severity: IssueSeverity; category: IssueCategory; } export interface CharacterValidationResult { /** true only when there are zero errors (warnings are allowed) */ valid: boolean; issues: ValidationIssue[]; } /** Maximum total path vertices allowed across all rig parts */ export { MAX_TOTAL_VERTICES }; export type ResolvedAsset = { kind: 'svg'; svgSource: string; } | { kind: 'raster'; }; export interface RigPartAsset { partKey: string; assetRef: string; } export interface RigStandardizationChecks { colorOutlineOnSameShape: boolean; uniformAssetFormat: boolean; pathsOnly: boolean; viewBoxMatchesVisibleContent: boolean; centeredTightViewBox: boolean; svgEditViewBoxPadding: boolean; dimensionLayoutParity: boolean; pixelUnitsOnly: boolean; preserveAspectRatioNone: boolean; totalVerticesUnder400: boolean; } export interface PartStandardizationDetail { partKey: string; assetRef: string; format: 'svg' | 'raster' | 'missing' | 'unresolved'; vertexCount: number; colorOutlineOnSameShape: boolean | null; pathsOnly: boolean | null; pixelUnitsOnly: boolean | null; preserveAspectRatioNone: boolean | null; viewBoxMatchesVisibleContent: boolean | null; centeredTightViewBox: boolean | null; svgEditViewBoxPadding: boolean | null; dimensionLayoutParity: boolean | null; viewBoxFit?: ViewBoxFitResult | null; viewBoxMetrics?: ViewBoxCheckResult | null; svgEditPadding?: SvgEditViewBoxPaddingResult | null; dimensionLayout?: DimensionLayoutParityResult | null; rootUnits?: SvgRootUnits | null; hiddenPaths?: HiddenPathDetail[]; embeddedImages?: EmbeddedImageDetail[]; failures: string[]; warnings: string[]; } export interface RigStandardizationResult { checks: RigStandardizationChecks; /** true when all standardization checks pass (warnings do not block) */ compliant: boolean; totalVertices: number; parts: PartStandardizationDetail[]; warnings: string[]; skipped?: boolean; skipReason?: string; } export interface RigStandardizationOptions { resolvedAssets?: Record; baseHost?: string; includePartSwapImages?: boolean; } export interface CharacterDiagnosticResult { structural: CharacterValidationResult; rigStandardization: RigStandardizationResult | null; } export declare function validateCharacter(data: unknown): CharacterValidationResult; /** Collect every part → asset reference mapping from a rig JSON object. */ export declare function collectRigPartAssets(data: unknown, options?: { includePartSwapImages?: boolean; }): RigPartAsset[]; /** Run rig standardization checks when assets are already resolved (sync). */ export declare function validateRigStandardization(data: unknown, options?: RigStandardizationOptions): RigStandardizationResult; /** Fetch all rig assets from the orchestrator, then run standardization checks. */ export declare function validateRigStandardizationAsync(data: unknown, options?: RigStandardizationOptions): Promise; /** Full character diagnostic: structural validation + rig standardization. */ export declare function diagnoseCharacter(data: unknown, options?: RigStandardizationOptions & { skipAssetChecks?: boolean; }): Promise; //# sourceMappingURL=characterValidator.d.ts.map