import type { IRNode } from '../types.js'; import type { KernValue } from './index.js'; export type CoreShapeDiagnosticCode = 'shape-extends-cycle' | 'shape-extends-unknown' | 'shape-field-conflict' | 'shape-field-duplicate' | 'shape-field-missing' | 'shape-field-type' | 'shape-generic-unsupported' | 'shape-indexer-key-unsupported' | 'shape-interface-duplicate' | 'shape-interface-not-found' | 'shape-object-expected' | 'shape-type-reference-unknown' | 'shape-type-unsupported' | 'shape-unexpected-field' | 'shape-value-cycle'; export interface CoreShapeDiagnostic { readonly code: CoreShapeDiagnosticCode; readonly message: string; readonly interfaceName?: string; readonly fieldName?: string; readonly path?: string; readonly expected?: string; readonly actual?: string; } export interface CoreShapeFieldFact { readonly name: string; readonly type?: string; readonly optional: boolean; readonly inheritedFrom?: string; } export interface CoreShapeIndexerFact { readonly keyName: string; readonly keyType: string; readonly type: string; readonly readonly: boolean; } export interface CoreShapeInterfaceFact { readonly name: string; readonly extends: readonly string[]; readonly fields: readonly CoreShapeFieldFact[]; readonly indexers: readonly CoreShapeIndexerFact[]; readonly generic: boolean; readonly validatorAvailable: boolean; readonly unsupportedReasons: readonly string[]; } export interface CoreShapeFacts { readonly interfaces: readonly CoreShapeInterfaceFact[]; readonly extendsEdges: readonly { readonly from: string; readonly to: string; readonly resolved: boolean; }[]; readonly validationDiagnostics: readonly CoreShapeDiagnostic[]; } export interface CoreShapeValidationResult { readonly passed: boolean; readonly interfaceName: string; readonly diagnostics: readonly CoreShapeDiagnostic[]; } /** * Validate a runtime record or class instance against a declared interface shape. * V1 supports primitives, arrays, nested interfaces, extends, and indexers. * Class instances are checked against initialized fields only; getters and * methods are not invoked during validation. */ export declare function validateCoreShape(value: KernValue, interfaceName: string, rootOrNodes: IRNode | readonly IRNode[]): CoreShapeValidationResult; export declare function assertCoreShape(value: KernValue, interfaceName: string, rootOrNodes: IRNode | readonly IRNode[]): void; /** * Collect review/substrate facts for declared interface shapes without * changing runtime behavior. The facts include effective inherited fields and * indexers plus diagnostics for unsupported v1 contracts. */ export declare function collectCoreShapeFacts(rootOrNodes: IRNode | readonly IRNode[]): CoreShapeFacts;