import { ModalityLogger } from './util_logger.js'; import { ErrorCode } from './ErrorCode'; export interface CompressionConfig { maxTokens: number; compressionLevel: "light" | "moderate" | "aggressive"; preserveCodeBlocks: boolean; autoDetectLanguage: boolean; enableLogging: boolean; maxSentencesForAnalysis: number; fastModeMaxSentences: number; } export declare const DEFAULT_CONFIG: CompressionConfig; export interface CompressionOptions { maxTokens?: number; compressionLevel?: "light" | "moderate" | "aggressive"; preserveCodeBlocks?: boolean; autoDetectLanguage?: boolean; locale?: string; prioritizeFirst?: boolean; prioritizeLast?: boolean; preserveStructure?: boolean; bufferPercentage?: number; maxSentences?: number; fastMode?: boolean; enableLogging?: boolean; sentenceSplitPattern?: RegExp; importanceWeights?: ImportanceWeights; tokenizationMethod?: "simple" | "advanced"; } export interface ImportanceWeights { position: number; length: number; wordRarity: number; codeElements: number; } export interface CompressionResult { compressedText: string; originalLength: number; compressedLength: number; compressionRatio: number; tokensEstimate: number; detectedLanguage?: string; importanceScores?: Array<{ text: string; score: number; reasons: string[]; }>; processingTime?: number; errors?: string[]; warnings?: string[]; } export interface LanguageDetectionResult { code: string; locale: string; confidence: number; script?: string; region?: string; } export declare class CompressionError extends ErrorCode { readonly code: string; details?: any; constructor(message: string, code: string, details?: any, originalError?: unknown); } export declare class LanguageDetectionError extends ErrorCode { readonly code: string; fallbackLanguage: string; constructor(message: string, fallbackLanguage: string, originalError?: unknown); } export declare class UniversalLanguageDetector { private logger; private cache; constructor(logger: ModalityLogger); detectLanguage(text: string): Promise; private performDetection; private analyzeUnicodeRanges; private prioritizeLocalesBasedOnUnicode; private getAvailableTestLocales; private getUnicodeRelevanceScore; private getUnicodeBoost; private testLocaleWithIntlAPIs; } export declare class IntelligentImportanceAnalyzer { private wordFrequencyCache; private logger; private config; constructor(logger: ModalityLogger, config: CompressionConfig); analyzeImportance(text: string, detectedLanguage?: string): Promise>; fastAnalyzeImportance(text: string, detectedLanguage?: string): Promise>; private segmentSentences; private analyzePosition; private analyzeLengthDeviation; private analyzeWordRarity; private calculateWordFrequencies; } export declare class TextCompressionUtility { private languageDetector; private importanceAnalyzer; private logger; private config; constructor(config?: Partial); compress(text: string, options?: CompressionOptions): Promise; private extractCodeElements; private applyUserPriorities; private applyCompression; private getCompressionThreshold; private segmentSentences; private trimToTokenLimit; private estimateTokens; } export declare function compressUserInput(text: string, maxTokens?: number): Promise; export declare function compressConversationHistory(messages: Array<{ role: string; content: string; }>, maxTokens: number): Promise>; export declare function analyzeTextImportance(text: string): Promise>; export declare function compressText(text: string, options?: CompressionOptions): Promise; export declare function fastCompressText(text: string, maxTokens?: number): Promise; export declare function compressWithLanguageDetection(text: string, maxTokens?: number): Promise;