/** * Response schema evolution tracking. * * Tracks response schema consistency across runs and detects when tools * return different field structures, enabling schema evolution analysis * for drift detection. */ import type { InferredSchema } from './response-fingerprint.js'; /** * Response schema evolution record. * Tracks schema stability and inconsistencies across samples. */ export interface ResponseSchemaEvolution { /** Current schema hash */ currentHash: string; /** Historical schema hashes (most recent first) */ history: SchemaVersion[]; /** Whether schema has been stable across all samples */ isStable: boolean; /** Confidence in schema stability (0-1) */ stabilityConfidence: number; /** Fields that appear inconsistently */ inconsistentFields: string[]; /** Total number of samples analyzed */ sampleCount: number; } /** * A historical schema version. */ export interface SchemaVersion { /** Schema hash */ hash: string; /** The schema at this version */ schema: InferredSchema; /** When this version was observed */ observedAt: Date; /** Number of samples with this version */ sampleCount: number; } /** * Schema comparison result for evolution detection. */ export interface SchemaEvolutionDiff { /** Whether schema structure changed */ structureChanged: boolean; /** Fields added in new schema */ fieldsAdded: string[]; /** Fields removed from schema */ fieldsRemoved: string[]; /** Fields with type changes */ typeChanges: SchemaTypeChange[]; /** Fields that became required */ newRequired: string[]; /** Fields that became optional */ newOptional: string[]; /** Backward compatibility assessment */ backwardCompatible: boolean; /** Whether the change is breaking for consumers */ isBreaking: boolean; /** Human-readable summary of changes */ summary: string; } /** * A type change for a field. */ export interface SchemaTypeChange { /** Field path (dot notation for nested fields) */ field: string; /** Previous type */ previousType: string; /** Current type */ currentType: string; /** Whether this change is backward compatible */ backwardCompatible: boolean; } /** * Compare two inferred schemas for evolution. * * @param previous - Previous schema (or undefined if new) * @param current - Current schema (or undefined if removed) * @returns Detailed comparison result */ export declare function compareInferredSchemas(previous: InferredSchema | undefined, current: InferredSchema | undefined): SchemaEvolutionDiff; /** * Build response schema evolution from multiple samples. * * @param schemas - Array of inferred schemas from samples * @returns Schema evolution record */ export declare function buildSchemaEvolution(schemas: InferredSchema[]): ResponseSchemaEvolution; /** * Compare schema evolution records between baselines. * * @param previous - Previous schema evolution * @param current - Current schema evolution * @returns Evolution comparison result */ export declare function compareSchemaEvolution(previous: ResponseSchemaEvolution | undefined, current: ResponseSchemaEvolution | undefined): SchemaEvolutionDiff; /** * Format schema evolution for display. * * @param evolution - Schema evolution record * @returns Formatted string representation */ export declare function formatSchemaEvolution(evolution: ResponseSchemaEvolution): string; /** * Format schema evolution diff for display. * * @param diff - Schema evolution diff * @param useColors - Whether to use ANSI colors * @returns Formatted string representation */ export declare function formatSchemaEvolutionDiff(diff: SchemaEvolutionDiff, useColors?: boolean): string[]; /** * Determine if schema evolution indicates breaking changes. * * @param evolution - Schema evolution record * @param threshold - Confidence threshold for stability * @returns Whether the schema evolution indicates issues */ export declare function hasSchemaEvolutionIssues(evolution: ResponseSchemaEvolution, threshold?: number): boolean; /** * Get schema evolution stability grade. * * @param evolution - Schema evolution record * @returns Grade from A-F */ export declare function getSchemaStabilityGrade(evolution: ResponseSchemaEvolution): 'A' | 'B' | 'C' | 'D' | 'F' | 'N/A'; //# sourceMappingURL=response-schema-tracker.d.ts.map