/**
 * Service for DAG topology operations: topological sort and
 * common ancestor finding.
 *
 * @module domain/services/dag/DagTopology
 */
import type LoggerPort from '../../../ports/LoggerPort.ts';
import type DagTraversal from './DagTraversal.ts';
import type { TraversalDirection, DagIndexReader } from './DagTraversal.ts';
export default class DagTopology {
    private readonly _indexReader;
    private readonly _logger;
    private readonly _traversal;
    constructor(deps: {
        indexReader: DagIndexReader;
        logger?: LoggerPort;
        traversal?: DagTraversal;
    });
    private _getNeighbors;
    /**
     * Finds common ancestors of multiple nodes.
     *
     * An ancestor is "common" if it can be reached by following parent
     * edges from ALL of the input nodes.
     */
    commonAncestors(opts: {
        shas: string[];
        maxResults?: number;
        maxDepth?: number;
        signal?: AbortSignal;
    }): Promise<string[]>;
    /**
     * Yields nodes in topological order using Kahn's algorithm.
     *
     * Topological order ensures that for every directed edge A -> B,
     * node A is yielded before node B.
     */
    topologicalSort(opts: {
        start: string;
        maxNodes?: number;
        direction?: TraversalDirection;
        throwOnCycle?: boolean;
        signal?: AbortSignal;
    }): AsyncGenerator<{
        sha: string;
        depth: number;
        parent: null;
    }>;
}
