/** * Smart text chunker for logosdb-mcp-server. * * Three strategies, selected by `mode` (or auto-detected from `filePath`): * * "auto" — (default) picks the best strategy per file extension: * · code files (.ts .py .go .rs .java .c .cpp …) → "line" * · docs (.md .rst) → "section" * · config/data (.json .yaml .toml .txt …) → "legacy" * * "line" — sliding line-window (code files). * Target ~50 lines per chunk, ~10-line overlap. * Prefers blank-line boundaries at window edges to avoid * splitting mid-function. Best for retrieval precision on code. * * "section" — heading-aware (Markdown / RST). * Splits on ATX headings (# … ###### …) and Setext underlines * (=== / ---). Small consecutive sections are merged up to * `targetChars`. Large single sections are sub-split with the * paragraph chunker. Best for docs and README-style files. * * "legacy" — original paragraph / character merge (any file type). * Splits on blank lines, merges short paragraphs up to * `targetChars` (default 800), carries `overlapChars` (default * 100) into the next chunk. Long single paragraphs are sub-split * into character-window slices. Use this mode when you want the * old behaviour for A/B testing, compatibility with an existing * namespace, or for dense config/data files where paragraph merge * is appropriate. Enable globally with `LOGOSDB_CHUNK_MODE=legacy` * or per-call with `chunking: "legacy"` on `logosdb_index_file`. * * Related: GitHub issue #98. */ export interface Chunk { text: string; /** approximate character offset in original text */ offset: number; } export type ChunkMode = 'auto' | 'line' | 'section' | 'legacy'; export interface ChunkOptions { /** Target character count per chunk (legacy / section modes). Default: 800. */ targetChars?: number; /** Character overlap carried into the next chunk (legacy mode). Default: 100. */ overlapChars?: number; /** Chunking strategy. Default: "auto". */ mode?: ChunkMode; /** * Absolute or relative file path — used by "auto" to pick the right strategy. * Ignored unless mode is "auto". */ filePath?: string; /** Lines per chunk (line mode). Default: 50. */ linesPerChunk?: number; /** Lines of overlap between consecutive line-window chunks. Default: 10. */ lineOverlap?: number; } /** * Chunk `text` according to `opts`. * The old two-argument signature `chunk(text, targetChars, overlapChars)` is * preserved for callers that have not yet migrated. */ export declare function chunk(text: string, opts?: ChunkOptions | number, _legacyOverlap?: number): Chunk[]; //# sourceMappingURL=chunker.d.ts.map