/** * Code Compressor * * Semantic compression for source code * Strategy: Keep structure, remove implementation details */ import { ICompressor } from '@massa-th0th/shared'; import { CompressedContent, CompressionStrategy } from '@massa-th0th/shared'; import { type LlmResult } from '../memory/llm-client.js'; /** * Injectable LLM-complete surface (mirrors the real `llmComplete` signature). * Tests inject a fake; production uses the default export. */ export type CompressLlmComplete = (prompt: string, opts?: { system?: string; timeoutMs?: number; modelRole?: "instruct" | "code"; }) => Promise>; export declare class CodeCompressor implements ICompressor { private strategy; private languageCache; private readonly llmCompleteFn; /** * @param llmCompleteFn Optional injectable LLM-complete surface for tests. * Production callers omit it; the real `llmComplete` is used. The LLM path * is gated on `config.get("llm").enabled` and silent-degrades to the regex * path on LLM off / {ok:false} / throw / over-long / empty output. */ constructor(llmCompleteFn?: CompressLlmComplete); /** * Compress source code */ compress(content: string, strategy?: CompressionStrategy): Promise; /** * Decompress (return original) */ decompress(compressed: CompressedContent): Promise; /** * Estimate compression ratio */ estimateCompression(content: string): Promise; getStrategy(): CompressionStrategy; /** * Compress by extracting structure only */ private compressStructure; /** * Extract code structure (signatures only) */ private extractStructure; /** * Check if line is a function declaration */ private isFunctionDeclaration; /** * Extract signature from line (remove implementation) */ private extractSignature; /** * Convert structure to compressed text */ private structureToText; /** * Remove semantically duplicate code */ private deduplicateSemantics; /** * Detect programming language from content */ private detectLanguage; /** * Get cached language detection */ private getCachedLanguage; } //# sourceMappingURL=code-compressor.d.ts.map