/** * Enhanced schema comparison for baseline drift detection. * * Improvements over basic comparison: * - Hash argument types, not just keys * - Detect constraint changes (min/max, patterns, enums) * - Compare across multiple interactions * - Visualize schema differences * - Circular reference protection * - Unicode normalization for consistent property comparison */ /** * JSON Schema property type. */ interface SchemaProperty { type?: string | string[]; format?: string; description?: string; enum?: unknown[]; minimum?: number; maximum?: number; minLength?: number; maxLength?: number; pattern?: string; default?: unknown; items?: SchemaProperty; properties?: Record; patternProperties?: Record; dependentRequired?: Record; if?: SchemaProperty; then?: SchemaProperty; else?: SchemaProperty; oneOf?: SchemaProperty[]; anyOf?: SchemaProperty[]; allOf?: SchemaProperty[]; required?: string[]; additionalProperties?: boolean | SchemaProperty; $ref?: string; minProperties?: number; maxProperties?: number; } /** * Input schema for a tool. */ interface InputSchema { type?: string; properties?: Record; patternProperties?: Record; dependentRequired?: Record; if?: SchemaProperty; then?: SchemaProperty; else?: SchemaProperty; oneOf?: SchemaProperty[]; anyOf?: SchemaProperty[]; allOf?: SchemaProperty[]; required?: string[]; additionalProperties?: boolean | SchemaProperty; $ref?: string; minProperties?: number; maxProperties?: number; } /** * Schema change type. */ export type SchemaChangeType = 'property_added' | 'property_removed' | 'type_changed' | 'constraint_changed' | 'required_changed' | 'enum_changed' | 'description_changed' | 'format_changed'; /** * Individual schema change. */ export interface SchemaChange { path: string; changeType: SchemaChangeType; before: unknown; after: unknown; breaking: boolean; description: string; } /** * Schema comparison result. */ export interface SchemaComparisonResult { identical: boolean; changes: SchemaChange[]; previousHash: string; currentHash: string; visualDiff: string; } /** * Compute a comprehensive schema hash that includes types and constraints. * Protected against circular references and excessively deep schemas. */ export declare function computeSchemaHash(schema: InputSchema | undefined): string; /** * Compare two schemas and return detailed differences. */ export declare function compareSchemas(previous: InputSchema | undefined, current: InputSchema | undefined): SchemaComparisonResult; /** * Compute schema hash from multiple interactions (not just first). * Returns the most common schema hash if schemas vary. */ export declare function computeConsensusSchemaHash(interactions: Array<{ args: Record; }>): { hash: string; consistency: number; variations: number; }; export {}; //# sourceMappingURL=schema-compare.d.ts.map