/** * Output Compression Service * * RTK-style content-aware compression for terminal command output. * Applies per-command intelligent filters to reduce token consumption * while preserving the most useful information for the LLM. * * Design: * - ANSI codes are always stripped (zero semantic value, 5-15% overhead) * - Short outputs (< OUTPUT_COMPRESSION_THRESHOLD) pass through unchanged * - Per-command filters reduce structure-specific noise (git metadata, pass * suites, progress spinners, duplicate type errors, etc.) * - truncateTerminalOutput() acts as a safety net after compression; it is * never skipped so the MAX_TERMINAL_OUTPUT_CHARS cap always holds */ export type CompressionStrategy = (output: string, command: string) => string; export declare function getStrategy(tool: string): CompressionStrategy | undefined; export declare function registerStrategy(tool: string, fn: CompressionStrategy): void; export declare function resetRegistry(): void; interface CompressionStats { calls: number; inputChars: number; outputChars: number; } /** * Returns a snapshot of terminal output compression statistics for the current * process lifetime. Counts only calls that triggered actual compression * (outputs above OUTPUT_COMPRESSION_THRESHOLD). */ export declare function getCompressionStats(): Readonly; /** * Reset compression statistics. Called by session cleanup and tests. */ export declare function resetCompressionStats(): void; /** * Strip ANSI escape sequences from text. * Safe to call on any string — no-op when no escape codes are present. */ export declare function stripAnsiCodes(text: string): string; /** * Truncate output to MAX_TERMINAL_OUTPUT_CHARS using head+tail strategy. * When the omitted middle contains priority lines (errors, failures), up to * 2 000 chars of those lines are surfaced before the omission notice. */ export declare function truncateTerminalOutput(output: string): string; /** * Compress terminal command output using content-aware per-command filters. * * Steps: * 1. Strip ANSI codes unconditionally. * 2. Return unchanged if output is below OUTPUT_COMPRESSION_THRESHOLD. * 3. Apply a per-command filter keyed on the first token of `command`. * Unknown commands pass through without transformation. * 4. Apply head+tail truncation as a final safety net. */ export declare function compressTerminalOutput(command: string, output: string): string; export {}; //# sourceMappingURL=output-compression.service.d.ts.map