import { z } from 'zod';
import type { OccEntityFreshness, OccEntityRef } from './api-types.js';
import type { LiveEntity, LiveEntityIndex } from './resolve.js';
import type { EntityIndex } from './store.js';
import type { EntityDiagnostic } from './types.js';
import type { EntityEvidenceGapSummary } from './evidence.js';
export declare const ENTITY_DRIFT_DEFAULT_DIRS: readonly ["docs", "README.md"];
export declare const EntityDriftOptionsSchema: z.ZodObject<{
    dirs: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
export type EntityDriftOptions = z.infer<typeof EntityDriftOptionsSchema>;
export interface EntityDriftRuntimeOptions extends EntityDriftOptions {
    signal?: AbortSignal;
}
export type EntityDriftEvidence = 'cst-proved' | 'body-hash' | 'unknown';
export interface EntityDriftRow {
    docPath: string;
    docSpan: {
        startLine: number;
        endLine: number;
    };
    entityRef: OccEntityRef;
    docLastTouch: {
        commit: string;
        commitOrder: number;
        committedAt: string;
    };
    changesSince: {
        count: number;
        strongestEvidence: EntityDriftEvidence;
    };
}
export type EntityDriftDiagnosticCode = 'link-not-found' | 'link-ambiguous' | 'doc-history-unavailable';
export interface EntityDriftDiagnostic {
    code: EntityDriftDiagnosticCode;
    message: string;
    docPath: string;
    docSpan: {
        startLine: number;
        endLine: number;
    };
    line: number;
    reference: string;
    candidates?: OccEntityRef[];
}
export interface EntityDriftHonesty {
    freshness: {
        fresh: boolean;
        reasons: OccEntityFreshness['reasons'];
        workingTreeMeasured: boolean;
    };
    truncation: {
        truncated: boolean;
        reasons: EntityDiagnostic[];
        omitted: number;
    };
    coverage: {
        documentsConsidered: number;
        documentsWithCandidates: number;
        documentsAllLinksRefused: number;
        allRefusedDocuments: string[];
        allRefusedDocumentsOmitted: number;
        linksExtracted: number;
        linksResolved: number;
        linksRefused: number;
        linksAmbiguous: number;
        linksNotFound: number;
        linksWithoutDocHistory: number;
        rowsEmitted: number;
        eligibleCodeTargets: number;
        diagnosticsOmitted: number;
    };
    ambiguityCount: number;
    evidenceGaps: EntityEvidenceGapSummary;
}
export type EntityDriftResult = {
    status: 'resolved';
    dirs: string[];
    rows: EntityDriftRow[];
    diagnostics: EntityDriftDiagnostic[];
    honesty: EntityDriftHonesty;
} | {
    status: 'error';
    code: 'invalid-options';
    message: string;
};
export interface EntityDriftContext {
    /** Working-tree format bytes held by the entity session's source path. */
    formatFiles: ReadonlyMap<string, string>;
    entityIndex: EntityIndex;
    live: LiveEntityIndex;
    freshness: OccEntityFreshness;
}
export interface DriftDocumentSection<T> {
    key: string;
    startLine: number;
    endLine: number;
    value: T;
}
export interface DriftDocumentLink<T> {
    section: DriftDocumentSection<T>;
    line: number;
    raw: string;
    name: string;
    relativePath?: string;
}
export declare function filteredDriftLiveIndex(live: LiveEntityIndex, predicate: (entity: LiveEntity) => boolean): LiveEntityIndex;
export declare function isDriftDeclarationTarget(entity: LiveEntity): boolean;
/**
 * Scan one Markdown document with the exact reference grammar used by
 * repository drift. Callers supply section spans, which lets generated
 * documents share this scanner without pretending they are repository
 * entities.
 */
export declare function scanDriftDocumentLinks<T>(content: string, sections: readonly DriftDocumentSection<T>[]): DriftDocumentLink<T>[];
export declare function strongestDriftEvidence(events: readonly EntityIndex['events'][number][]): EntityDriftEvidence;
export declare function compareDriftCandidateRefs(a: OccEntityRef, b: OccEntityRef): number;
/**
 * Join Markdown section references to current declarations, then compare their
 * commit order. Every uncertain name is counted and refused; this function
 * never chooses a candidate by iteration order.
 */
export declare function entityDrift(options: EntityDriftRuntimeOptions, context: EntityDriftContext): EntityDriftResult;
