/**
 * Token-aware text chunker for semantic search indexing.
 *
 * Splits long text into overlapping chunks so each chunk stays within the
 * embedder's context window. Uniform code path for messages (v1) and files (v2).
 *
 * Design: docs/design/semantic-search.md §6.
 */
export interface ChunkOptions {
    /** Maximum tokens per chunk. Default 2000. */
    maxTokens?: number;
    /** Number of tokens of overlap between consecutive chunks. Default 200. */
    overlap?: number;
    /**
     * Token counter. Optional — defaults to `approxTokenCount` (~4 chars
     * per token). Tests that want deterministic sizing can inject.
     */
    countTokens?: (text: string) => number;
}
/**
 * Cheap, deterministic token counter. ~4 chars per token matches the
 * industry rule-of-thumb used when no real tokenizer is available. We
 * don't need precision here — chunk boundaries are coarse, and no
 * downstream consumer depends on the exact count.
 */
export declare function approxTokenCount(text: string): number;
export interface Chunk {
    /** Stable deterministic id: `<parentId>:chunk:<n>` (0-indexed). */
    id: string;
    /** Chunk text. */
    text: string;
    /** 0-indexed chunk position within the parent. */
    index: number;
    /** Token count of this chunk, per the injected counter. */
    tokenCount: number;
}
/**
 * Split `text` into chunks of at most `maxTokens`, with `overlap` tokens of
 * trailing context carried into the next chunk. Pure, deterministic.
 *
 * Empty / whitespace-only input → `[]`.
 * Text that fits within `maxTokens` → single chunk `<parentId>:chunk:0`.
 *
 * Approach:
 *   - Split on whitespace into words.
 *   - Greedily accumulate words until the cumulative token count would meet
 *     or exceed maxTokens; emit that chunk.
 *   - For the next chunk, back off by ~`overlap`-tokens worth of trailing
 *     words so consecutive chunks overlap.
 */
export declare function chunkText(text: string, parentId: string, opts?: ChunkOptions): Chunk[];
//# sourceMappingURL=chunker.d.ts.map