import type { TerminalMonitorStateEvent } from "../monitor-state-event.ts";
/** How the user must act on a block, as OSC 7501 names it: a permission approval or a typed answer. */
export type HerdrBlockedKind = "permission" | "question";
export interface HerdrBlock {
    readonly label?: string;
    readonly kind?: HerdrBlockedKind;
}
export interface HerdrState {
    readonly blocked: ReadonlyMap<string, HerdrBlock>;
    readonly turnActive: boolean;
    readonly childCount: number;
    readonly monitorCount: number;
    /** Live monitors with no deadline (persistent watches, or watches without a timeout): they may never fire. */
    readonly openEndedMonitorCount: number;
    readonly wakeSources: ReadonlyMap<string, number>;
}
export type HerdrStateEvent = {
    type: "blocked";
    active: boolean;
    id: string;
    label?: string;
    kind?: HerdrBlockedKind;
} | {
    type: "turn";
    active: boolean;
} | {
    type: "children";
    count: number;
} | {
    type: "monitors";
    count: number;
    openEnded: number;
} | {
    type: "wake-source";
    source: string;
    count: number;
};
export interface HerdrReport {
    state: "blocked" | "working" | "idle";
    message?: string;
}
/**
 * How many of the broadcast watches have no deadline: a persistent watch, or one with no timeout. A one-shot watch
 * with a deadline either fires or times out, and both wake the session, so it is bounded. A payload without per-watch
 * detail counts none as open-ended, keeping the pane working as before the split.
 */
export declare function openEndedMonitors(event: TerminalMonitorStateEvent): number;
export declare function initialHerdrState(): HerdrState;
export declare function reduceHerdrState(state: HerdrState, event: HerdrStateEvent): HerdrState;
export declare function selectHerdrReport(state: HerdrState): HerdrReport;
/** The kind of the block the report shows, the oldest open one, matching `selectHerdrReport`'s message. */
export declare function selectHerdrBlockedKind(state: HerdrState): HerdrBlockedKind | undefined;
export declare function isHerdrBlockedEvent(data: unknown): data is {
    active: boolean;
    id: string;
    label?: string;
    kind?: HerdrBlockedKind;
};
//# sourceMappingURL=herdr-state.d.ts.map