import type { CodeIndex, CodeSymbol, FileEntry } from "../types.js";
/**
 * Save a code index atomically.
 * Writes to a temp file first, then renames to prevent partial reads.
 */
export declare function saveIndex(indexPath: string, index: CodeIndex): Promise<void>;
/**
 * Load a code index from disk.
 * Returns null if file doesn't exist, is unreadable, or has invalid shape.
 *
 * When `currentVersions` is provided, the stored `extractor_version` snapshot
 * is compared against it. A missing field or any mismatched language version
 * is treated as cache miss (returns null) — forcing callers to rebuild the
 * index. Omit the argument for read-modify-write flows (incremental updates)
 * where version enforcement would cause spurious reindexes.
 */
export declare function loadIndex(indexPath: string, currentVersions?: Record<string, string>): Promise<CodeIndex | null>;
/** Discriminated union returned by loadIndexOrStale: distinguishes a healthy
 *  load from a version-mismatch stale-index case. Tools route through this
 *  helper instead of calling loadIndex directly so stale indexes surface as
 *  structured errors via staleToMcpError (src/tools/_helpers.ts) rather than
 *  silent empty results. */
export type IndexOrStaleResult = {
    status: "ok";
    index: CodeIndex;
} | {
    status: "stale";
    reason: "extractor_version_mismatch";
    /** Language whose extractor version drifted (e.g., "typescript", "python"). */
    language: string;
    expected_version: string;
    actual_version: string;
    /** Present when multiple `currentVersions` keys drift at once — operators
     *  should not assume fixing the primary `language` alone refreshes everything. */
    mismatch_detail?: string;
};
export type ExtractorVersionMismatchRow = {
    language: string;
    expected: string;
    actual: string;
};
/** All languages whose stored `extractor_version` entry does not match
 *  `currentVersions`, applying the same tolerances as `loadIndexOrStale`
 *  (newly added keys with no files in that language are skipped). */
export declare function collectExtractorVersionMismatches(index: CodeIndex, currentVersions: Record<string, string>): ExtractorVersionMismatchRow[];
/** Load an index with version-aware stale detection.
 *
 * Returns:
 *   - `{ status: "ok", index }` when the index is present, valid, and matches
 *     the provided `currentVersions` for the language under inspection.
 *   - `{ status: "stale", reason: "extractor_version_mismatch", ... }` when
 *     the file exists and is parseable but its TypeScript extractor version
 *     differs from the current bundled version.
 *
 * The stale payload names the actual mismatching language (typescript, python,
 * php, etc.). Earlier versions hard-coded "typescript" in the message even
 * when a different language drifted; that misled anyone reading the warning
 * during a non-TS bump.
 *
 * On file-not-found, parse error, or invalid shape, this function falls back
 * to `loadIndex(...)` returning null. Callers must still handle null (no
 * structured error) for those cases. */
export declare function loadIndexOrStale(indexPath: string, currentVersions: Record<string, string>): Promise<IndexOrStaleResult | null>;
/**
 * Check whether the stored `extractor_version` snapshot matches the current
 * set of extractor versions. Returns false when any language present in BOTH
 * `currentVersions` and `index.files` is missing from the stored snapshot or
 * has a different value. Languages added to `currentVersions` after this index
 * was written are tolerated when the index has no files in that language —
 * matches the tolerance applied by `collectExtractorVersionMismatches`. A missing
 * `extractor_version` field on a fully legacy index is still treated as a
 * version miss.
 */
export declare function isExtractorVersionCurrent(index: CodeIndex, currentVersions: Record<string, string>): boolean;
/**
 * Incrementally update an index for a single changed file.
 * Removes old symbols for the file, adds new ones, and saves atomically.
 * Serialized per indexPath to prevent read-modify-write races.
 */
export declare function saveIncremental(indexPath: string, updatedFile: string, newSymbols: CodeSymbol[], fileEntry?: FileEntry): Promise<void>;
/**
 * Remove all symbols and the file entry for a deleted file.
 * Serialized per indexPath to prevent read-modify-write races.
 */
export declare function removeFileFromIndex(indexPath: string, deletedFile: string): Promise<void>;
/**
 * Derive a deterministic index file path from a repo root.
 * Uses a truncated SHA-256 hash of the root path.
 */
export declare function getIndexPath(dataDir: string, repoRoot: string): string;
//# sourceMappingURL=index-store.d.ts.map