/**
 * The ONE restore digest a generation sends after a restart: a single sentence naming every
 * monitor and background session, structured details for the TUI renderer, and a pending slot
 * so a digest decided before a model is bound is delivered later instead of dropped.
 */
import type { ExtensionAPI, MessageRenderer } from "../../types.ts";
import type { BackgroundRestoreResult, MonitorRestoreResult, RestoreDigest } from "./restore.ts";
export declare const RESTORE_DIGEST_CUSTOM_TYPE = "senpi-terminal:restore-digest";
export type RestoreDigestOutcome = "decided" | "deferred" | "corrupt";
export interface RestoreDigestDetails {
    readonly generation: number;
    readonly outcome: RestoreDigestOutcome;
    readonly downtimeMs: number;
    readonly downtimeIsUpperBound: true;
    readonly holder?: {
        readonly pid: number;
    };
    readonly actionable: boolean;
    readonly monitors: readonly MonitorRestoreResult[];
    readonly backgroundSessions: readonly BackgroundRestoreResult[];
}
export interface RestoreDigestMessage {
    readonly customType: typeof RESTORE_DIGEST_CUSTOM_TYPE;
    readonly content: string;
    readonly display: true;
    readonly details: RestoreDigestDetails;
}
/** The slice of `ExtensionContext` delivery needs; `ExtensionContext` satisfies it. */
export interface RestoreDigestContext {
    readonly model: unknown;
    readonly ui?: {
        notify(message: string, type?: "info" | "warning" | "error"): void;
    };
}
export interface DigestSlot {
    set(message: RestoreDigestMessage): void;
    pending(): RestoreDigestMessage | undefined;
    /** Deliver the pending message; `deliver` returning false keeps it pending for a later flush. */
    flush(deliver: (message: RestoreDigestMessage) => boolean): boolean;
}
/** Wake the agent only when something needs a decision: a lost watch, an orphan, a live background job. */
export declare function isActionable(digest: Pick<RestoreDigest, "results" | "backgroundSessions">): boolean;
export declare function buildRestoreDigest(digest: RestoreDigest, meta: {
    readonly generation: number;
    readonly outcome: RestoreDigestOutcome;
    readonly holderPid?: number;
}): RestoreDigestMessage;
export declare function createDigestSlot(): DigestSlot;
/** Returns false (message stays pending) while no model is bound: a turn without one cannot run. */
export declare function deliverRestoreDigest(pi: Pick<ExtensionAPI, "sendMessage">, ctx: RestoreDigestContext | undefined, message: RestoreDigestMessage): boolean;
export declare function registerRestoreDigestRenderer(pi: {
    registerMessageRenderer(customType: string, renderer: MessageRenderer<RestoreDigestDetails>): void;
}): void;
//# sourceMappingURL=restore-digest.d.ts.map