import { type MainDialog } from './dialog';
export type DriveTriggerEvent = Readonly<{
    type: 'drive_trigger_evt';
    action: 'queue_root_drive' | 'clear_root_drive_queue' | 'active_run_cleared';
    rootId: string;
    entryFound: boolean;
    previousDriveQueued: boolean | null;
    nextDriveQueued: boolean;
    source: string;
    reason: string;
    emittedAtMs: number;
}>;
export type DriveTriggerMeta = Readonly<{
    source: string;
    reason: string;
}>;
declare class GlobalDialogRegistry {
    private static instance;
    /**
     * Runtime-owned roots keyed by rootId.
     *
     * Do not add an API that enumerates this map for backend driving. A dialog becomes driveable only
     * through an explicit business/runtime scheduling event (`queueRootDrive`, result arrival,
     * active-run clear, etc.).
     * Reintroducing "scan every loaded root and see what happens" makes hidden polling loops easy to
     * create and obscures the business event that should own the next action.
     */
    private readonly entries;
    private readonly queuedRootIds;
    private readonly queuedRootIdSet;
    private queuedRootIdReadIndex;
    private readonly lastDriveTriggerByRootId;
    private readonly driveTriggerPubChan;
    private driveTriggerSubChan;
    static getInstance(): GlobalDialogRegistry;
    get(rootId: string): MainDialog | undefined;
    register(mainDialog: MainDialog): void;
    unregister(rootId: string): void;
    private enqueueRoot;
    private compactQueuedRootsIfNeeded;
    private compactSparseQueuedRootsIfNeeded;
    private publishDriveTrigger;
    waitForDriveTrigger(): Promise<DriveTriggerEvent>;
    queueRootDrive(rootId: string, meta?: DriveTriggerMeta): void;
    clearRootDriveQueue(rootId: string, meta?: DriveTriggerMeta): void;
    notifyActiveRunCleared(rootId: string, meta?: DriveTriggerMeta): void;
    noteActiveRunBlockedQueuedDrive(rootId: string): void;
    hasPendingActiveRunClearedDrive(rootId: string): boolean;
    isRootDriveQueued(rootId: string): boolean;
    getLastDriveTrigger(rootId: string): DriveTriggerEvent | undefined;
    consumeQueuedMainDialogs(): MainDialog[];
    get size(): number;
}
export declare const globalDialogRegistry: GlobalDialogRegistry;
export {};
