/** * Document chunking — turning a document's extracted text into the enriched * chunks that get embedded and stored. * * Two passes, in this order: * 1. CHUNK — split on heading/paragraph boundaries (shared `@monoes/memory` * chunker, with an inline fallback kept byte-identical to it). * 2. ENRICH — replace each chunk's leaf-heading prefix with a situating blurb * (doc title + full heading path + summary) so the embedding model can tell * two identically-titled sections of different documents apart. * * Split out of document-pipeline.ts. Pure string work: no fs, no network, no * store access — which is what makes chunk spans reproducible at citation time * (`chunkSpans`) without re-reading anything. * * @module v1/cli/knowledge/document-chunking */ import type { ChunkSpan } from './citation.js'; export interface TextChunk { chunkId: string; docId: string; text: string; startChar: number; endChar: number; chunkIndex: number; } export declare function chunkDocument(docId: string, text: string): Promise; /** * Replace each chunk's `§ heading` prefix with a richer situating blurb: * § · * * * First chunks that start with their own heading are left untouched (the * heading IS the context). The summary line is omitted for the first * chunk since it is adjacent to the summary text anyway. */ export declare function enrichChunks(chunks: TextChunk[], fullText: string, filePath: string): TextChunk[]; /** Chunk spans for a text, using the SAME chunker the ingest used — this is * what makes a chunk index resolvable back to a character range without * storing the text twice. */ export declare function chunkSpans(text: string): Promise; //# sourceMappingURL=document-chunking.d.ts.map