import type { CodebaseIndex } from './types.js';
export declare const DEFAULT_FILE_TOKEN_COUNT_CACHE_ENTRIES = 10000;
export interface FileTokenCountRow {
    tokenizer: string;
    sha256: string;
    count: number;
}
export interface FileTokenCountCacheOptions {
    maxEntries?: number;
    initialRows?: readonly FileTokenCountRow[];
    /** Persist one newly measured row. Failures never change the measured answer. */
    persist?: (row: FileTokenCountRow) => Promise<void> | void;
}
export interface FileTokenCountCache {
    count(content: string, tokenizer: string, countTokens: (text: string) => number): number;
    load(rows: readonly FileTokenCountRow[]): void;
    entries(): FileTokenCountRow[];
    /** Wait for best-effort persistence already queued by count misses. */
    flush(): Promise<void>;
    clear(): void;
    readonly size: number;
}
export declare function isFileTokenCountRow(value: unknown): value is FileTokenCountRow;
export declare function attachFileTokenCountCache(index: CodebaseIndex, cache: FileTokenCountCache): void;
export declare function getFileTokenCountCache(index: CodebaseIndex): FileTokenCountCache | undefined;
export declare function flushFileTokenCountCache(index: CodebaseIndex): Promise<void>;
/**
 * Cache whole-file token counts by content rather than by path.
 *
 * A rename stays hot, two identical generated files share one count, and an
 * edit cannot reuse a stale value because it necessarily changes the digest.
 * The tokenizer is part of the key because BPE encodings do not agree.
 */
export declare function createFileTokenCountCache(options?: number | FileTokenCountCacheOptions): FileTokenCountCache;
