/**
 * BisectService — binary search over WARP graph history.
 *
 * Given a known-good commit SHA and a known-bad commit SHA on a writer's
 * patch chain, finds the first bad patch via binary search, calling a
 * user-supplied test function at each midpoint.
 *
 * @module domain/services/BisectService
 */
import type SnapshotWarpState from './snapshot/SnapshotWarpState.ts';
type PatchEntry = {
    readonly patch: {
        readonly lamport: number;
    };
    readonly sha: string;
};
/** Port for the graph operations bisect needs. */
type BisectGraph = {
    readonly getWriterPatches: (writerId: string) => Promise<PatchEntry[]>;
    readonly materialize: (opts: {
        ceiling: number;
    }) => Promise<SnapshotWarpState>;
};
type BisectFound = {
    readonly result: 'found';
    readonly firstBadPatch: string;
    readonly writerId: string;
    readonly lamport: number;
    readonly steps: number;
    readonly totalCandidates: number;
};
type BisectRangeError = {
    readonly result: 'range-error';
    readonly message: string;
};
type BisectResult = BisectFound | BisectRangeError;
type BisectTestFn = (state: SnapshotWarpState, sha: string) => Promise<boolean>;
type BisectRunOptions = {
    readonly good: string;
    readonly bad: string;
    readonly writerId: string;
    readonly testFn: BisectTestFn;
};
export default class BisectService {
    private readonly _graph;
    constructor(deps: {
        graph: BisectGraph;
    });
    /**
     * Runs bisect on a single writer's patch chain.
     *
     * Returns 'found' with the first bad patch, or 'range-error'
     * if the good/bad range is invalid.
     */
    run(opts: BisectRunOptions): Promise<BisectResult>;
    private _binarySearch;
}
export type { BisectResult, BisectFound, BisectRangeError, BisectGraph, BisectTestFn, PatchEntry };
