/** * Semantic Sub-Chunker * Intelligently splits large code chunks while preserving semantic structure, * imports/exports, symbols, and maintaining searchable context. */ export interface CodeChunk { id: string; content: string; filePath: string; relativePath: string; startLine: number; endLine: number; language: string; symbols: Array<{ name: string; type: 'function' | 'class' | 'interface' | 'type' | 'variable' | 'constant'; line: number; scope?: string; }>; imports: Array<{ module: string; symbols: string[]; line: number; }>; } export interface SubChunkContext { fileHeader: string; globalContext: string; localContext: string; } export interface SemanticSection { content: string; type: 'header' | 'import' | 'export' | 'class' | 'function' | 'interface' | 'comment' | 'other'; startLine: number; endLine: number; symbols: Array<{ name: string; type: 'function' | 'class' | 'interface' | 'type' | 'variable' | 'constant'; line: number; scope?: string; }>; dependencies: string[]; priority: number; } export declare class SemanticSubChunker { private logger; private readonly MAX_CHUNK_SIZE; private readonly MIN_OVERLAP_SIZE; private readonly CONTEXT_WINDOW; constructor(); /** * Main entry point: Split a large chunk into semantic sub-chunks */ splitLargeChunk(chunk: CodeChunk): Promise; /** * Parse content into semantic sections with metadata */ private parseSemanticSections; /** * Detect what type of semantic section a line represents */ private detectSectionType; /** * Check if this is a natural boundary for section splitting */ private isNaturalBoundary; /** * Create a semantic section with metadata */ private createSemanticSection; /** * Assign priority scores to different section types */ private getSectionPriority; /** * Extract dependencies from content (imports, function calls, etc.) */ private extractDependencies; /** * Extract global context that should be preserved across all sub-chunks */ private extractGlobalContext; /** * Create sub-chunks with preserved context and semantic integrity */ private createSubChunksWithContext; /** * Create overlap context to maintain semantic continuity */ private createOverlapContext; /** * Create a single sub-chunk with full context */ private createSubChunk; /** * Validate that sub-chunks maintain semantic quality */ validateSubChunks(subChunks: CodeChunk[]): Promise<{ isValid: boolean; issues: string[]; metrics: { totalSymbols: number; averageSize: number; contextPreservation: number; }; }>; } //# sourceMappingURL=SemanticSubChunker.d.ts.map