/**
 * Module: dialog-display-state
 *
 * Owns the persisted/broadcast display-state projection for dialogs, plus best-effort
 * cancellation for in-flight dialog drives.
 *
 * Design constraints:
 * - `displayState` is a UI/diagnostic projection, not a business source of truth.
 * - Primary control flow must rely on underlying facts (active runs, stop requests,
 *   pending Q4H, active callee dispatches, queued prompts, persisted status, explicit
 *   interruption/death markers).
 * - The projection is persisted to latest.yaml (`DialogLatestFile.displayState`) so it survives
 *   restarts and multi-tab views can converge quickly.
 * - "Stop" is best-effort: it aborts in-flight LLM streaming and lets the driver unwind.
 * - Broadcasting is optional: when configured, display-state updates are pushed to all WS clients
 *   so multi-tab views converge without polling.
 */
import type { DialogDisplayState, DialogInterruptionReason } from '@longrun-ai/kernel/types/display-state';
import type { DialogExecutionMarker, DialogLatestFile } from '@longrun-ai/kernel/types/storage';
import type { RunControlCountsMessage, WebSocketMessage } from '@longrun-ai/kernel/types/wire';
import { DialogID, type Dialog } from './dialog';
type StopRequestedReason = 'user_stop' | 'emergency_stop';
export type RunControlCountsSnapshot = {
    proceeding: number;
    resumable: number;
};
export declare function getRunControlCountsSnapshotEpoch(): string;
export declare function setDisplayStateBroadcaster(fn: ((msg: WebSocketMessage) => void) | null): void;
export declare function isStoppedReasonResumable(reason: DialogInterruptionReason): boolean;
export declare function isDisplayStateResumable(state: DialogDisplayState | undefined): boolean;
export declare function isExecutionMarkerResumable(executionMarker: DialogExecutionMarker | undefined): boolean;
export declare function isDialogLatestResumable(latest: DialogLatestFile | null | undefined): boolean;
export declare function getRunControlCountsSnapshot(): Promise<RunControlCountsSnapshot>;
export declare function createRunControlCountsMessage(): Promise<RunControlCountsMessage>;
export declare function broadcastRunControlCountsSnapshot(): Promise<void>;
export declare function hasActiveRun(dialogId: DialogID): boolean;
export declare function getActiveRunSignal(dialogId: DialogID): AbortSignal | undefined;
export declare function createActiveRun(dialogId: DialogID): AbortSignal;
export declare function clearActiveRun(dialogId: DialogID, options?: Readonly<{
    notifyBackendLoop?: boolean;
}>): void;
export declare function clearMainDialogQuarantiningIfIdle(mainDialogId: DialogID): void;
export declare function markMainDialogQuarantining(mainDialogId: DialogID): void;
export declare function clearMainDialogQuarantining(mainDialogId: DialogID): void;
export declare function forceStopActiveRunsForMainDialog(mainDialogId: DialogID): Promise<void>;
export declare function getStopRequestedReason(dialogId: DialogID): StopRequestedReason | undefined;
export declare function loadDialogExecutionMarker(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<DialogExecutionMarker | undefined>;
export declare function setDialogExecutionMarker(dialogId: DialogID, executionMarker: DialogExecutionMarker | undefined, status?: 'running' | 'completed' | 'archived'): Promise<void>;
export declare function clearDialogInterruptedExecutionMarker(dialogId: DialogID, status?: 'running' | 'completed' | 'archived'): Promise<void>;
export declare function setDialogDisplayState(dialogId: DialogID, displayState: DialogDisplayState, status?: 'running' | 'completed' | 'archived'): Promise<void>;
export declare function broadcastDisplayStateMarker(dialogId: DialogID, marker: {
    kind: 'interrupted' | 'resumed';
    reason?: DialogInterruptionReason;
}): void;
export declare function computeIdleDisplayState(dlg: Dialog): Promise<DialogDisplayState>;
export declare function refreshRunControlProjectionFromPersistenceFacts(dialogId: DialogID, trigger: 'resume_dialog' | 'resume_all' | 'run_control_snapshot' | 'active_callee_dispatches_changed' | 'q4h_changed' | 'restart_reconciliation'): Promise<DialogLatestFile | null>;
export declare function reconcileDisplayStatesAfterRestart(): Promise<void>;
export declare function requestInterruptDialog(dialogId: DialogID, reason: StopRequestedReason): Promise<{
    applied: boolean;
}>;
export declare function requestEmergencyStopAll(): Promise<{
    interrupted: number;
}>;
export {};
