/** * Smart Config Read Tool - 83% token reduction through schema-aware configuration parsing * * Features: * - Schema-aware JSON, YAML, TOML parsing * - Intelligent config diffing on changes * - Schema inference and validation * - Error detection and improvement suggestions * - Cache integration with file hash invalidation * - 7-day TTL with change detection */ import { CacheEngine } from '../../core/cache-engine.js'; import { TokenCounter } from '../../core/token-counter.js'; import { MetricsCollector } from '../../core/metrics.js'; export type ConfigFormat = 'json' | 'yaml' | 'yml' | 'toml' | 'auto'; export interface SmartConfigReadOptions { enableCache?: boolean; ttl?: number; format?: ConfigFormat; validateSchema?: boolean; inferSchema?: boolean; diffMode?: boolean; includeMetadata?: boolean; includeSuggestions?: boolean; validateOnly?: boolean; schema?: Record; strictMode?: boolean; } export interface ConfigSchema { type: string; properties: Record; required?: string[]; additionalProperties?: boolean; } export interface ConfigSchemaProperty { type: string | string[]; description?: string; default?: unknown; enum?: unknown[]; properties?: Record; items?: ConfigSchemaProperty; required?: string[]; } export interface ConfigValidationError { path: string; message: string; severity: 'error' | 'warning' | 'info'; suggestion?: string; } export interface ConfigDiff { added: Record; removed: Record; modified: Array<{ path: string; oldValue: unknown; newValue: unknown; }>; unchanged: number; } export interface SmartConfigReadResult { config: Record; metadata: { path: string; format: ConfigFormat; size: number; hash: string; fromCache: boolean; isDiff: boolean; tokensSaved: number; tokenCount: number; originalTokenCount: number; compressionRatio: number; parseTime: number; }; schema?: ConfigSchema; diff?: ConfigDiff; errors?: ConfigValidationError[]; suggestions?: string[]; } export declare class SmartConfigReadTool { private cache; private tokenCounter; private metrics; constructor(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector); /** * Smart config read with schema-aware parsing and caching */ read(filePath: string, options?: SmartConfigReadOptions): Promise; private detectFormat; private parseConfig; private inferSchema; private inferPropertySchema; private validateConfig; private validatePropertyType; private schemasMatch; private calculateDiff; private deepEqual; private hasMeaningfulChanges; private transformOutput; private generateSuggestions; } /** * Factory Function for Shared Resources (e.g., benchmarks) */ export declare function getSmartConfigReadTool(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector): SmartConfigReadTool; /** * CLI Function - Creates Resources Locally */ export declare function runSmartConfigRead(filePath: string, options?: SmartConfigReadOptions): Promise; export declare const SMART_CONFIG_READ_TOOL_DEFINITION: { name: string; description: string; inputSchema: { type: string; properties: { path: { type: string; description: string; }; format: { type: string; enum: string[]; description: string; default: string; }; diffMode: { type: string; description: string; default: boolean; }; validateSchema: { type: string; description: string; default: boolean; }; inferSchema: { type: string; description: string; default: boolean; }; includeSuggestions: { type: string; description: string; default: boolean; }; validateOnly: { type: string; description: string; default: boolean; }; schema: { type: string; description: string; }; strictMode: { type: string; description: string; default: boolean; }; ttl: { type: string; description: string; default: number; }; }; required: string[]; }; }; //# sourceMappingURL=smart-config-read.d.ts.map