/**
 * Build the `RenderPerfSummary` that lands on `job.perfSummary` and
 * the `perf-summary.json` debug artifact.
 */
import type { CapturePerfSummary, SubTimelineWaitOutcome, WorkerSizing } from "@hyperframes/engine";
import type { CaptureCalibrationSample, CaptureCostEstimate } from "./captureCost.js";
import type { CaptureAttemptSummary, HdrDiagnostics, RenderJob, RenderPerfSummary } from "../renderOrchestrator.js";
import { type HdrPerfCollector } from "./hdrPerf.js";
import type { RenderObservabilitySummary } from "./observability.js";
/**
 * Worst sub-composition timeline wait outcome across sessions: script_failure
 * > timeout > ready. Shared by the success-path perf summary and the error
 * path (a fail-fast can still be followed by an unrelated downstream
 * failure, e.g. in `pollVideosReady` or encode — that render fires
 * `render_error`, not `render_complete`, and should carry this too).
 */
export declare function worstSubTimelineWaitOutcome(perfs: CapturePerfSummary[]): SubTimelineWaitOutcome | undefined;
/**
 * Append each parallel worker's static-dedup perf into the render-level sink
 * (skipping workers that reported none). Shared by the disk + streaming parallel
 * paths so the collection contract lives in one place.
 */
export declare function pushWorkerDedupPerfs(results: ReadonlyArray<{
    perf?: CapturePerfSummary;
}>, sink: CapturePerfSummary[]): void;
/**
 * Collapse per-session/per-worker static-dedup perf into one render-level
 * outcome. enabled/armed = OR across workers (they run the same gates on the
 * same composition); predicted/reused = SUM (each worker dedups its own frame
 * range); skipReason = the distinct reasons (sorted, `|`-joined) when not armed.
 */
/**
 * Collapse per-session capture perf + producer-side decisions into the
 * render-level drawElement outcome. mode/gateReason |-join distinct values
 * across workers (bounded cardinality); counters SUM.
 */
/**
 * Round a dB value to 1 decimal and clamp at 999 (an `Infinity` PSNR — a
 * bit-exact frame match — must not ship literally to telemetry). Single
 * source of truth for every dB field crossing into `RenderPerfSummary` or
 * `RenderCaptureObservability` — both must agree byte-for-byte so PostHog
 * consumers joining `render_complete` against the crash-survival
 * `render_error` mirror never see the same underlying score reported at two
 * different precisions (review finding).
 */
export declare function roundDb(value: number | undefined): number | undefined;
/** Orchestrator-supplied render-level drawElement outcome (one shape, used by
 * both the aggregate function and buildRenderPerfSummary's input). */
export interface DrawElementPerfInput {
    compileGate?: string;
    clampReason?: string;
    workerInversion?: "inverted" | "reverted";
    /** Auto-resolved worker count before the inversion pinned it to 1 (set only when the inversion fired). */
    preInversionWorkers?: number;
    /** Rough compiled-composition element count — gate variable for the short-comp inversion band. */
    compositionElementCount?: number;
    /** Provenance of the element count: "live" (probe DOM, trusted to gate) | "static" (source scan, not). */
    compositionElementCountSource?: "live" | "static";
    /** Short-comp band decision when the band was DECISIVE: "applied" (inverts once HF_DE_SHORT_BAND_ROUTE is on; counterfactual in the baseline release) | "skipped_elements" (element ceiling was the only blocker); unset when the band could not have affected this render. */
    shortBand?: "applied" | "skipped_elements" | "unmeasured";
    parallelRouter?: "routed" | "reverted";
    /** Auto-resolved worker count before the router pinned it to 3 (set only when the router fired). */
    preRouterWorkers?: number;
    selfVerifyFallback: boolean;
    fallbackReason?: string;
    /** The failing PSNR (dB) when `fallbackReason === "psnr"`; undefined for blank/oom/capture_error. */
    fallbackFailedDb?: number;
    /** Frame index the verification failure was detected at; set for both "psnr" and "blank". */
    fallbackFrameIndex?: number;
    /** The HF_DE_VERIFY_MIN_DB threshold the failing dB breached; only set alongside fallbackFailedDb. */
    fallbackThresholdDb?: number;
    drainStats?: {
        verifyChecked: number;
        verifyMinDb?: number;
        blankSuspects: number;
        blankDeterministicAccepts: number;
        blankRecaptures: number;
    };
}
export declare function buildRenderPerfSummary(input: {
    job: RenderJob;
    workerCount: number;
    /** Auto-sizing provenance; undefined when a pin (htmlInCanvas / low-memory) short-circuited sizing. */
    workerSizing?: WorkerSizing;
    enableChunkedEncode: boolean;
    chunkedEncodeSize: number;
    compositionDurationSeconds: number;
    totalFrames: number;
    outputWidth: number;
    outputHeight: number;
    videoCount: number;
    audioCount: number;
    totalElapsedMs: number;
    perfStages: Record<string, number>;
    videoExtractBreakdown: RenderPerfSummary["videoExtractBreakdown"];
    tmpPeakBytes: number;
    captureCalibration?: {
        estimate: CaptureCostEstimate;
        samples: CaptureCalibrationSample[];
    };
    captureAttempts: CaptureAttemptSummary[];
    hdrDiagnostics: HdrDiagnostics;
    hdrPerf?: HdrPerfCollector;
    observability?: RenderObservabilitySummary;
    peakRssBytes: number;
    peakHeapUsedBytes: number;
    /** Per-session/per-worker static-dedup perf; aggregated into `staticDedup`. */
    dedupPerfs: CapturePerfSummary[];
    drawElement?: DrawElementPerfInput;
}): RenderPerfSummary;
//# sourceMappingURL=perfSummary.d.ts.map