/**
 * `Indexer` — orchestrates the flow from `Indexable`s to FlexSearch
 * documents.
 *
 * Responsibilities (design §3, §9, §13):
 *   - Incremental upsert: dedup by `contentHash`, chunk long text, push
 *     to the store.
 *   - Backlog counter + debounced `index:progress` emission.
 *   - Full rebuild from a set of `IndexSource`s: clear the store,
 *     drain each source, write meta.
 *
 * This module is store-agnostic in spirit — it talks to `FlexSearchStore`
 * through a narrow surface (`upsert` / `deleteByIds` / `deleteWhere` /
 * `clear` / `getHashForEntry` / `writeMeta`). Source iteration lives in
 * `sources/*.ts`.
 *
 * Design reference: docs/design/portable-search.md §3, §6, §13.
 */
import type { Indexable, IndexSource, IndexSourceContext } from "./types.js";
import { FlexSearchStore, type FlexDoc } from "./flex-store.js";
import type { ProgressBus } from "./progress-bus.js";
export interface IndexerOptions {
    store: FlexSearchStore;
    progressBus: ProgressBus;
    projectId: string;
    /** Override debounce window for tests. Defaults to 500ms. */
    progressDebounceMs?: number;
    /** Override max tokens per chunk. Defaults to 2000. */
    maxTokens?: number;
    /** Override chunk overlap tokens. Defaults to 200. */
    chunkOverlap?: number;
}
export declare class Indexer {
    readonly projectId: string;
    private readonly store;
    private readonly progressBus;
    private readonly progressDebounceMs;
    private readonly maxTokens;
    private readonly chunkOverlap;
    private _backlog;
    private _lastProgressEmit;
    private _progressTimer;
    private _pendingPhase;
    private _pendingTotal;
    private _pendingCompleted;
    constructor(opts: IndexerOptions);
    get backlog(): number;
    upsertEntries(entries: Indexable[]): Promise<void>;
    removeEntries(ids: string[]): Promise<void>;
    /**
     * Back-compat shim for the legacy SQL-filter API. The only call-site
     * today is `removeMessagesForSession` which passes
     * `session_id = '<sid>' AND source_id = 'messages'`. Parse that
     * narrow shape; throw for anything else.
     */
    removeByFilter(filter: string | {
        session_id?: string;
        source_id?: Indexable["sourceId"];
    }): Promise<void>;
    rebuildFromSources(sources: IndexSource[], ctx: IndexSourceContext): Promise<void>;
    private _filterUnchanged;
    private _expandWithChunks;
    private _scheduleProgress;
    private _flushProgress;
}
export declare function indexableToDoc(e: Indexable, text: string, parentId: string | null): FlexDoc;
//# sourceMappingURL=indexer.d.ts.map