/**
 * Token-budgeted, importance-ranked repo map / pack.
 *
 * `buildRepoMap` ranks the graph (see `rank.ts`), then greedily admits the
 * highest-ranked files until a token budget is hit — shedding low-rank symbols
 * or shrinking content (partial admission) rather than dropping a whole file
 * when it nearly fits. Two modes:
 *   - `map`  — Aider-style: top symbol signatures per file (cheap context).
 *   - `pack` — Repomix-style: file content, optionally compressed to the
 *              architecturally-significant section via `extractKeySection`.
 *
 * Token counting is injected (`countTokens`) so a real BPE tokenizer can
 * enforce an exact budget; it defaults to the language-aware heuristic.
 */
import { z } from 'zod';
import type { CodebaseIndex } from './types.js';
export declare const RepoMapFormatSchema: z.ZodEnum<{
    json: "json";
    markdown: "markdown";
    xml: "xml";
    plain: "plain";
}>;
export type RepoMapFormat = z.infer<typeof RepoMapFormatSchema>;
export declare const RepoMapModeSchema: z.ZodEnum<{
    map: "map";
    pack: "pack";
}>;
export type RepoMapMode = z.infer<typeof RepoMapModeSchema>;
/**
 * Presentation layout. `ranked` is today's output, byte-for-byte. `stable`
 * changes presentation only — rank still decides what is admitted — so the
 * document is worth placing in a cached prompt layer: entries are path-ordered,
 * per-entry rank scores are not rendered (one edit anywhere perturbs the whole
 * eigenvector and would rewrite every heading), and volatile aggregates move to
 * a constant-position tail block. Guarantee: byte-identical output for an
 * identical index + identical options + same OCC version, including across
 * cache cold/warm runs; on code change, unchanged files render byte-identical
 * blocks in unchanged relative order. It is not stable across OCC versions,
 * tokenizer changes, or option changes, and at the same numeric budget stable
 * prices its own score-less serialization, so it may admit more files than
 * ranked — rank fixes the admission order, not the cross-layout boundary.
 */
export declare const RepoMapLayoutSchema: z.ZodEnum<{
    ranked: "ranked";
    stable: "stable";
}>;
export type RepoMapLayout = z.infer<typeof RepoMapLayoutSchema>;
/** Opt-in query/path focus. Absent or empty → global structural rank only (no behavior change). */
export declare const RepoMapFocusSchema: z.ZodObject<{
    query: z.ZodOptional<z.ZodString>;
    paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
    graphDepth: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
export type RepoMapFocus = z.infer<typeof RepoMapFocusSchema>;
export declare const RepoMapOptionsSchema: z.ZodObject<{
    tokenBudget: z.ZodNumber;
    mode: z.ZodOptional<z.ZodEnum<{
        map: "map";
        pack: "pack";
    }>>;
    format: z.ZodOptional<z.ZodEnum<{
        json: "json";
        markdown: "markdown";
        xml: "xml";
        plain: "plain";
    }>>;
    layout: z.ZodOptional<z.ZodEnum<{
        ranked: "ranked";
        stable: "stable";
    }>>;
    tokenizer: z.ZodOptional<z.ZodString>;
    pretty: z.ZodOptional<z.ZodBoolean>;
    compress: z.ZodOptional<z.ZodBoolean>;
    maxSymbolsPerFile: z.ZodOptional<z.ZodNumber>;
    rank: z.ZodOptional<z.ZodObject<{
        damping: z.ZodOptional<z.ZodNumber>;
        maxIterations: z.ZodOptional<z.ZodNumber>;
        epsilon: z.ZodOptional<z.ZodNumber>;
        edgeWeights: z.ZodOptional<z.ZodObject<{
            imports: z.ZodOptional<z.ZodNumber>;
            calls: z.ZodOptional<z.ZodNumber>;
            uses: z.ZodOptional<z.ZodNumber>;
            inherits: z.ZodOptional<z.ZodNumber>;
        }, z.core.$strip>>;
        biasExports: z.ZodOptional<z.ZodBoolean>;
        includeExternal: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>>;
    focus: z.ZodOptional<z.ZodObject<{
        query: z.ZodOptional<z.ZodString>;
        paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
        graphDepth: z.ZodOptional<z.ZodNumber>;
    }, z.core.$strip>>;
    meta: z.ZodOptional<z.ZodObject<{
        loadSource: z.ZodEnum<{
            build: "build";
            cache: "cache";
        }>;
    }, z.core.$strip>>;
}, z.core.$strip>;
type RepoMapSerializableOptions = z.infer<typeof RepoMapOptionsSchema>;
/** Runtime options. `countTokens` is a function, so it lives here, off the Zod schema. */
export interface RepoMapOptions extends RepoMapSerializableOptions {
    countTokens?: (text: string) => number;
}
export declare const RepoMapSymbolSchema: z.ZodObject<{
    nodeId: z.ZodString;
    name: z.ZodString;
    kind: z.ZodString;
    signature: z.ZodString;
    line: z.ZodOptional<z.ZodNumber>;
    endLine: z.ZodOptional<z.ZodNumber>;
    containerName: z.ZodOptional<z.ZodString>;
    exported: z.ZodBoolean;
    jsdoc: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type RepoMapSymbol = z.infer<typeof RepoMapSymbolSchema>;
export declare const RepoMapEntrySchema: z.ZodObject<{
    relativePath: z.ZodString;
    path: z.ZodString;
    language: z.ZodString;
    score: z.ZodNumber;
    normalizedScore: z.ZodNumber;
    symbols: z.ZodArray<z.ZodObject<{
        nodeId: z.ZodString;
        name: z.ZodString;
        kind: z.ZodString;
        signature: z.ZodString;
        line: z.ZodOptional<z.ZodNumber>;
        endLine: z.ZodOptional<z.ZodNumber>;
        containerName: z.ZodOptional<z.ZodString>;
        exported: z.ZodBoolean;
        jsdoc: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
    content: z.ZodOptional<z.ZodString>;
    contentReason: z.ZodOptional<z.ZodString>;
    tokens: z.ZodNumber;
    droppedSymbols: z.ZodNumber;
    focusScore: z.ZodOptional<z.ZodNumber>;
    focusReasons: z.ZodOptional<z.ZodArray<z.ZodString>>;
    changed: z.ZodOptional<z.ZodBoolean>;
    churn: z.ZodOptional<z.ZodObject<{
        added: z.ZodNumber;
        deleted: z.ZodNumber;
        binary: z.ZodBoolean;
    }, z.core.$strip>>;
}, z.core.$strip>;
export type RepoMapEntry = z.infer<typeof RepoMapEntrySchema>;
/** Echoed focus selector plus how many files the focus touched. */
export declare const RepoMapFocusResultSchema: z.ZodObject<{
    query: z.ZodOptional<z.ZodString>;
    paths: z.ZodArray<z.ZodString>;
    matchedFiles: z.ZodNumber;
}, z.core.$strip>;
export type RepoMapFocusResult = z.infer<typeof RepoMapFocusResultSchema>;
export declare const RepoMapResultSchema: z.ZodObject<{
    mode: z.ZodEnum<{
        map: "map";
        pack: "pack";
    }>;
    format: z.ZodEnum<{
        json: "json";
        markdown: "markdown";
        xml: "xml";
        plain: "plain";
    }>;
    layout: z.ZodOptional<z.ZodLiteral<"stable">>;
    meta: z.ZodOptional<z.ZodObject<{
        loadSource: z.ZodEnum<{
            build: "build";
            cache: "cache";
        }>;
    }, z.core.$strip>>;
    tokenizer: z.ZodOptional<z.ZodString>;
    tokenBudget: z.ZodNumber;
    tokensUsed: z.ZodNumber;
    totalFiles: z.ZodNumber;
    entries: z.ZodArray<z.ZodObject<{
        relativePath: z.ZodString;
        path: z.ZodString;
        language: z.ZodString;
        score: z.ZodNumber;
        normalizedScore: z.ZodNumber;
        symbols: z.ZodArray<z.ZodObject<{
            nodeId: z.ZodString;
            name: z.ZodString;
            kind: z.ZodString;
            signature: z.ZodString;
            line: z.ZodOptional<z.ZodNumber>;
            endLine: z.ZodOptional<z.ZodNumber>;
            containerName: z.ZodOptional<z.ZodString>;
            exported: z.ZodBoolean;
            jsdoc: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>;
        content: z.ZodOptional<z.ZodString>;
        contentReason: z.ZodOptional<z.ZodString>;
        tokens: z.ZodNumber;
        droppedSymbols: z.ZodNumber;
        focusScore: z.ZodOptional<z.ZodNumber>;
        focusReasons: z.ZodOptional<z.ZodArray<z.ZodString>>;
        changed: z.ZodOptional<z.ZodBoolean>;
        churn: z.ZodOptional<z.ZodObject<{
            added: z.ZodNumber;
            deleted: z.ZodNumber;
            binary: z.ZodBoolean;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    droppedFiles: z.ZodNumber;
    droppedSymbols: z.ZodNumber;
    truncated: z.ZodBoolean;
    rankIterations: z.ZodNumber;
    rankConverged: z.ZodBoolean;
    focus: z.ZodOptional<z.ZodObject<{
        query: z.ZodOptional<z.ZodString>;
        paths: z.ZodArray<z.ZodString>;
        matchedFiles: z.ZodNumber;
    }, z.core.$strip>>;
}, z.core.$strip>;
export type RepoMapResult = z.infer<typeof RepoMapResultSchema>;
/**
 * Render one symbol as a readable declaration line. The stored `signature` is
 * the nameless callable form (`(params) => Return`), so we re-attach the name
 * and a kind keyword to produce e.g. `export function foo(a: number): void`.
 */
export declare function repoMapSignatureLine(symbol: RepoMapSymbol): string;
/**
 * Markdown serialization of a single entry. Shared between token measurement
 * (here) and the markdown renderer in `output.ts`, so the enforced budget
 * matches the emitted document exactly.
 */
export declare function repoMapEntryToMarkdown(entry: RepoMapEntry, mode: RepoMapMode, layout?: RepoMapLayout): string;
/** Plain-text serialization of one entry, excluding the document separator. */
export declare function repoMapEntryToPlain(entry: RepoMapEntry, mode: RepoMapMode, layout?: RepoMapLayout): string;
/** XML serialization of one entry, excluding the document separator. */
export declare function repoMapEntryToXml(entry: RepoMapEntry, mode: RepoMapMode, layout?: RepoMapLayout): string;
/** JSON serialization of one entry as it appears inside the document array. */
export declare function repoMapEntryToJson(entry: RepoMapEntry, pretty?: boolean, layout?: RepoMapLayout): string;
export declare function formatRepoMapMarkdown(result: RepoMapResult): string;
export declare function formatRepoMapPlain(result: RepoMapResult): string;
export declare function formatRepoMapXml(result: RepoMapResult): string;
export declare const RepoMapStableEntrySchema: z.ZodObject<{
    churn: z.ZodOptional<z.ZodObject<{
        added: z.ZodNumber;
        deleted: z.ZodNumber;
        binary: z.ZodBoolean;
    }, z.core.$strip>>;
    relativePath: z.ZodString;
    content: z.ZodOptional<z.ZodString>;
    language: z.ZodString;
    symbols: z.ZodArray<z.ZodObject<{
        nodeId: z.ZodString;
        name: z.ZodString;
        kind: z.ZodString;
        signature: z.ZodString;
        line: z.ZodOptional<z.ZodNumber>;
        endLine: z.ZodOptional<z.ZodNumber>;
        containerName: z.ZodOptional<z.ZodString>;
        exported: z.ZodBoolean;
        jsdoc: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
    tokens: z.ZodNumber;
    contentReason: z.ZodOptional<z.ZodString>;
    droppedSymbols: z.ZodNumber;
    focusScore: z.ZodOptional<z.ZodNumber>;
    focusReasons: z.ZodOptional<z.ZodArray<z.ZodString>>;
    changed: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
export type RepoMapStableEntry = z.infer<typeof RepoMapStableEntrySchema>;
/**
 * The documented wire shape of a stable-layout JSON map. A projection built at
 * render time — the in-memory {@link RepoMapResult} keeps `meta` and scores
 * for library callers; the wire omits `meta` entirely (its `loadSource` flips
 * between the first and second run, which is exactly the cold/warm byte leak
 * this layout exists to close) and puts every volatile aggregate last.
 */
export declare const RepoMapStableDocumentSchema: z.ZodObject<{
    layout: z.ZodLiteral<"stable">;
    mode: z.ZodEnum<{
        map: "map";
        pack: "pack";
    }>;
    format: z.ZodEnum<{
        json: "json";
        markdown: "markdown";
        xml: "xml";
        plain: "plain";
    }>;
    tokenizer: z.ZodOptional<z.ZodString>;
    tokenBudget: z.ZodNumber;
    entries: z.ZodArray<z.ZodObject<{
        churn: z.ZodOptional<z.ZodObject<{
            added: z.ZodNumber;
            deleted: z.ZodNumber;
            binary: z.ZodBoolean;
        }, z.core.$strip>>;
        relativePath: z.ZodString;
        content: z.ZodOptional<z.ZodString>;
        language: z.ZodString;
        symbols: z.ZodArray<z.ZodObject<{
            nodeId: z.ZodString;
            name: z.ZodString;
            kind: z.ZodString;
            signature: z.ZodString;
            line: z.ZodOptional<z.ZodNumber>;
            endLine: z.ZodOptional<z.ZodNumber>;
            containerName: z.ZodOptional<z.ZodString>;
            exported: z.ZodBoolean;
            jsdoc: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>;
        tokens: z.ZodNumber;
        contentReason: z.ZodOptional<z.ZodString>;
        droppedSymbols: z.ZodNumber;
        focusScore: z.ZodOptional<z.ZodNumber>;
        focusReasons: z.ZodOptional<z.ZodArray<z.ZodString>>;
        changed: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>>;
    tail: z.ZodObject<{
        tokensUsed: z.ZodNumber;
        totalFiles: z.ZodNumber;
        droppedFiles: z.ZodNumber;
        droppedSymbols: z.ZodNumber;
        truncated: z.ZodBoolean;
        rankIterations: z.ZodNumber;
        rankConverged: z.ZodBoolean;
        focus: z.ZodOptional<z.ZodObject<{
            query: z.ZodOptional<z.ZodString>;
            paths: z.ZodArray<z.ZodString>;
            matchedFiles: z.ZodNumber;
        }, z.core.$strip>>;
    }, z.core.$strip>;
}, z.core.$strip>;
export type RepoMapStableDocument = z.infer<typeof RepoMapStableDocumentSchema>;
/** Serialize exactly the format whose bytes are charged to `tokenBudget`. */
export declare function renderRepoMap(result: RepoMapResult, pretty?: boolean): string;
/**
 * Re-measure and, if needed, shed whole tail entries/symbols until emitted
 * bytes fit. Stable-layout shedding relies on the admission identity recorded
 * on the entry objects `buildRepoMap` produced; a result reconstructed from
 * serialized data falls back to the lowest-scored entry.
 */
export declare function rebudgetRepoMapResult(result: RepoMapResult, countTokens?: (text: string) => number, pretty?: boolean): RepoMapResult;
/**
 * Build a token-budgeted, importance-ranked repo map (or pack) from an index.
 *
 * The index should be treated as immutable after construction: the underlying
 * ranking is memoized per index object (see `rankNodesCached`) with only a
 * `files`/`nodes`/`edges` length fingerprint, so in-place mutations that keep
 * those lengths constant are not detected and reuse the cached ranking.
 *
 * @throws {TokenBudgetRefusalError} When the selected renderer's empty,
 * honesty-marked envelope cannot fit the requested budget.
 */
export declare function buildRepoMap(index: CodebaseIndex, options: RepoMapOptions): RepoMapResult;
export declare const ChangedRepoMapRangeSchema: z.ZodObject<{
    base: z.ZodOptional<z.ZodString>;
    head: z.ZodOptional<z.ZodString>;
    staged: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
export type ChangedRepoMapRange = z.infer<typeof ChangedRepoMapRangeSchema>;
export interface ChangedRepoMapOptions extends RepoMapOptions {
    changed: ChangedRepoMapRange;
}
export interface RepoMapChangeContext {
    /** Absolute paths of changed (non-deleted) files, for focus merging. */
    focusPaths: string[];
    /** Absolute path → churn for stamping admitted entries. */
    churnByPath: Map<string, {
        added: number;
        deleted: number;
        binary: boolean;
    }>;
}
/**
 * Resolve a git change range into repo-map focus inputs. Split out from
 * {@link buildChangedRepoMap} so callers holding a diff summary (or a CLI
 * that already fetched one) can reuse the same merge/stamp semantics.
 */
export declare function toRepoMapChangeContext(repoRoot: string, summary: {
    files: Array<{
        path: string;
        status?: string;
        binary?: boolean;
    }>;
    numstat: Array<{
        path: string;
        added: number | null;
        deleted: number | null;
        binary?: boolean;
    }>;
}): RepoMapChangeContext;
/** Stamp changed/churn metadata onto admitted entries (idempotent). */
export declare function stampRepoMapChanges(result: RepoMapResult, context: RepoMapChangeContext, countTokens?: (text: string) => number, pretty?: boolean): RepoMapResult;
/**
 * {@link buildRepoMap} focused on a git change range: files changed in the
 * range are added to the focus set (merged with any caller-provided focus),
 * and admitted entries carry `changed`/`churn` metadata. Async because it
 * shells out to git for the diff summary; the map itself builds like any
 * other repo map, so token budgeting is unchanged.
 */
export declare function buildChangedRepoMap(index: CodebaseIndex, options: ChangedRepoMapOptions): Promise<RepoMapResult>;
export {};
