/** * Syntax-aware utilities for smart truncation and chunking */ export interface ChunkResult { chunks: string[]; metadata: ChunkMetadata[]; totalSize: number; } export interface ChunkMetadata { index: number; startLine: number; endLine: number; size: number; type: 'code' | 'comment' | 'import' | 'export' | 'function' | 'class' | 'other'; } export interface TruncationResult { truncated: string; original: string; removed: number; kept: number; compressionRatio: number; } /** * Detect file type from extension */ export declare function detectFileType(filePath: string): string; /** * SIZES ARE UTF-8 BYTES. `maxSize` is documented as a byte limit, and a * JavaScript string's length counts UTF-16 units: a line of CJK text or emoji * is up to twice as many bytes as its length says, so a reply sized by length * could exceed the budget it claimed to honour (#490 review). These measure * and cut in bytes, and only ever at a code-point boundary, so what they * return is always valid text. */ export declare function utf8Length(text: string): number; /** The longest prefix of `text` within `maxBytes` UTF-8 bytes. */ export declare function prefixWithinBytes(text: string, maxBytes: number): string; /** The longest suffix of `text` within `maxBytes` UTF-8 bytes. */ export declare function suffixWithinBytes(text: string, maxBytes: number): string; /** * Split content into chunks of at most `maxChunkSize` UTF-8 bytes, at line * boundaries where a line fits. * * THE CHUNKS ARE THE FILE, CONCATENATED. Each line carries its own newline into * the chunk it ends in, counted in that chunk's size, so joining every chunk * gives back the file byte for byte -- a caller paging through it loses no * separator at a page boundary. Lines used to be joined inside a chunk and the * newline between two chunks was dropped, so `ABCD\nz` paged at 2 read back as * `ABCDz` (#489 review). * * A LINE LONGER THAN A CHUNK IS SPLIT ACROSS CHUNKS. One minified line used to * be a single chunk of any size: over the caller's limit, or -- once cut down * to it -- a "chunk 1 of 1" whose remaining bytes no chunkIndex could reach. * `lineOf` keeps the metadata's line numbers those of the file. */ export declare function chunkBySyntax(content: string, maxChunkSize?: number): ChunkResult; /** * Truncate file content intelligently, keeping important parts */ export declare function truncateContent(content: string, maxSize: number, options?: { keepTop?: number; keepBottom?: number; preserveStructure?: boolean; }): TruncationResult; /** * Extract only changed sections from content */ export declare function extractChangedSections(content: string, lineNumbers: number[]): string; /** * Check if content is minified/compressed */ export declare function isMinified(content: string): boolean; //# sourceMappingURL=syntax-utils.d.ts.map