import type { NativeWebView } from "./native-webview.ts";
/**
 * A Chrome-backed `Bun.WebView` is usable only once a navigation has attached a CDP session to its
 * target, and Bun reports that attach through nothing but the navigation settling. On Windows a
 * freshly launched Chrome sometimes never finishes it (senpi#2353), so the service drives each view's
 * first navigation itself, to `about:blank` (no network, nothing but the launch and the attach), and
 * replies to `create` only once it settled.
 */
export interface WebViewReadinessPolicy {
    /** How long the readiness navigation may take before the launch counts as stalled. */
    readonly attachBoundMs: number;
    /** Launches per view, the first included, before the stall is reported to the cell. */
    readonly launchAttempts: number;
}
export declare const DEFAULT_READINESS: WebViewReadinessPolicy;
export declare const READINESS_URL = "about:blank";
export type ReadinessEvent = {
    readonly type: "ready";
    readonly launch: number;
    readonly attachMs: number;
} | {
    readonly type: "stalled";
    readonly phase: "cdp-target-attach";
    readonly launch: number;
};
/** Appends one line per launch outcome to the file `SENPI_WEBVIEW_READINESS_LOG` names (CI diagnostics). */
export declare function readinessLogFromEnvironment(): ((event: ReadinessEvent) => void) | undefined;
/** Appends one line per failed Chrome retirement to the same CI diagnostics file (senpi#2993). */
export declare function retireFailureLogFromEnvironment(): ((message: string) => void) | undefined;
export declare class WebViewNotReadyError extends Error {
    readonly code = "ERR_WEBVIEW_NOT_READY";
    readonly phase = "cdp-target-attach";
    constructor(launches: number, policy: WebViewReadinessPolicy);
}
/** Resolves once the readiness bound of one launch is reached; `cancel` stops it when the launch settled first. */
export interface AttachDeadline {
    readonly reached: Promise<void>;
    cancel(): void;
}
export declare function timedDeadline(boundMs: number): AttachDeadline;
/** Resolves the readiness navigation's duration once it settled, undefined when the deadline came first. */
export declare function attachedWithin(view: NativeWebView, deadline: AttachDeadline): Promise<number | undefined>;
//# sourceMappingURL=webview-readiness.d.ts.map