/** * TokenOptimizer: Core optimization logic using Toonify */ import type { OptimizationResult, ToolMetadata, OptimizationConfig } from './types.js'; import { CacheOptimizer, LRUCache } from './caching/index.js'; export declare class TokenOptimizer { private config; private tokenEncoder; private cacheOptimizer; private resultCache; constructor(config?: Partial); /** * Main optimization method */ optimize(content: string, metadata?: ToolMetadata): Promise; /** * Detect if content is structured data (JSON/CSV/YAML) */ private detectStructuredData; /** * Simple CSV detection heuristic */ private looksLikeCSV; /** * Parse simple CSV to array of objects */ private parseSimpleCSV; /** * Count tokens in text with language awareness */ private countTokens; /** * Check if tool should be skipped */ private shouldSkipTool; /** * Generate cache key from content and metadata * Includes toolName to prevent false cache hits across different tools */ private generateCacheKey; /** * Validate resultCache configuration * Throws error if configuration is invalid */ private validateResultCacheConfig; /** * Get cache optimizer instance for external access */ getCacheOptimizer(): CacheOptimizer; /** * v0.4.0: Get LRU cache instance for external access */ getResultCache(): LRUCache; /** * v0.4.0: Clear optimization result cache */ clearResultCache(): void; /** * v0.4.0: Clean up expired cache entries */ cleanupExpiredCache(): number; /** * v0.4.0: Get combined cache statistics */ getCacheStats(): { resultCache: import('./caching/cache-types.js').LRUCacheStats; promptCache: import('./caching/cache-types.js').CacheMetrics; }; } //# sourceMappingURL=token-optimizer.d.ts.map