import type { ProducerLogger } from "../../logger.js";
export type RenderObservationStatus = "start" | "end" | "error" | "checkpoint";
export type RenderObservationValue = string | number | boolean | null;
export type RenderObservationData = Record<string, RenderObservationValue>;
export interface RenderObservationEvent {
    renderJobId?: string;
    phase: string;
    status: RenderObservationStatus;
    elapsedMs: number;
    durationMs?: number;
    message?: string;
    data?: RenderObservationData;
}
export interface BrowserDiagnosticSummary {
    total: number;
    /** Generic browser error lines after page/request/navigation/console-specific diagnostics are classified. */
    errors: number;
    pageErrors: number;
    requestFailed: number;
    httpErrors: number;
    navigationStarts: number;
    navigationFailures: number;
    consoleErrors: number;
    consoleWarnings: number;
}
export interface RenderCaptureObservability {
    forceScreenshot: boolean;
    captureMode: "screenshot" | "beginframe";
    workerCount?: number;
    useStreamingEncode?: boolean;
    useLayeredComposite?: boolean;
    usePageSideCompositing?: boolean;
    hasHdrContent?: boolean;
    browserGpuMode?: string;
    protocolTimeoutMs?: number;
    pageNavigationTimeoutMs?: number;
    playerReadyTimeoutMs?: number;
}
export interface RenderExtractionObservability {
    videoCount: number;
    extractedVideoCount: number;
    totalFramesExtracted: number;
    maxFramesPerVideo: number;
    avgFramesPerExtractedVideo?: number;
    vfrProbeMs?: number;
    vfrPreflightMs?: number;
    vfrPreflightCount?: number;
    cacheHits?: number;
    cacheMisses?: number;
}
export interface RenderInitObservability {
    initDurationMs?: number;
    tweenCount?: number;
}
export interface RenderObservabilitySummary {
    renderJobId?: string;
    compositionHash?: string;
    events: RenderObservationEvent[];
    eventCount: number;
    lastEvent?: RenderObservationEvent;
    failedPhase?: string;
    browserDiagnostics: BrowserDiagnosticSummary;
    capture: RenderCaptureObservability;
    extraction?: RenderExtractionObservability;
    init?: RenderInitObservability;
}
export declare function sanitizeObservationMessage(value: string): string;
export declare function computeCompositionObservabilityHash(compiledHtml: string): string;
export declare function summarizeBrowserDiagnostics(lines: string[]): BrowserDiagnosticSummary;
export declare class RenderObservabilityRecorder {
    private readonly input;
    private readonly events;
    private eventCount;
    private failedPhase;
    constructor(input: {
        pipelineStartMs: number;
        log: ProducerLogger;
        renderJobId?: string;
    });
    checkpoint(phase: string, message: string, data?: RenderObservationData): RenderObservationEvent;
    stageStart(phase: string, data?: RenderObservationData): number;
    stageEnd(phase: string, startedAtMs: number, data?: RenderObservationData): void;
    stageError(phase: string, startedAtMs: number, error: unknown, data?: RenderObservationData): void;
    summary(input: {
        lastBrowserConsole: string[];
        capture: RenderCaptureObservability;
        extraction?: RenderExtractionObservability;
        compositionHash?: string;
    }): RenderObservabilitySummary;
    hasFailure(): boolean;
    private record;
}
export declare function observeRenderStage<T>(recorder: RenderObservabilityRecorder, phase: string, data: RenderObservationData | undefined, fn: () => Promise<T>): Promise<T>;
//# sourceMappingURL=observability.d.ts.map