import type { RenderQueueStore } from "./store.js";
import type { RenderJob, RenderStage } from "./job.js";
export declare function aggregateProgress(stage: RenderStage, pct: number): number;
export interface WorkerProgressEvent {
    at: string;
    status: RenderJob["status"];
    progress: number;
    stage?: RenderStage;
    log?: {
        at: string;
        level: "info" | "warn" | "error";
        msg: string;
    };
    /** R43 — emitted on the terminal "done" event so the client modal
     *  can show "open output" without polling the REST endpoint. */
    outputPath?: string;
}
export interface RunRenderPipelineLike {
    (opts: {
        comp: any;
        outDir: string;
        burnSubtitles?: boolean;
        loudnessTargetLufs?: number;
        proxy?: boolean;
        signal?: AbortSignal;
        onProgress?: (stage: RenderStage, pct: number) => void;
        captionTracks?: {
            burnTrackId?: string | null;
            sidecarTrackIds?: string[];
        };
    }): Promise<string>;
}
export interface JobExtras {
    burnSubtitles?: boolean;
    loudnessTargetLufs?: number;
    captionTracks?: {
        burnTrackId?: string | null;
        sidecarTrackIds?: string[];
    };
}
export interface WorkerDeps {
    store: RenderQueueStore;
    runRenderPipeline: RunRenderPipelineLike;
    loadComposition: (workId: string) => Promise<any>;
    outDirFor: (workId: string) => string;
    /** D3 — defaults to 1. Configurable via AUTOVIRAL_RENDER_CONCURRENCY env var (handled by caller). */
    concurrency?: number;
    /** Phase H (#35) — pull runtime-only options (captionTracks, etc.) that
     *  weren't persisted with the job row. Returns undefined for legacy jobs. */
    extrasFor?: (jobId: string) => JobExtras | undefined;
    /** Phase H (#35) — invoked once a job reaches a terminal status so the
     *  caller can release whatever held the extras (memory map, weak ref, etc). */
    clearExtras?: (jobId: string) => void;
}
export declare class RenderQueueWorker {
    private readonly deps;
    private readonly emitter;
    private readonly inflight;
    private readonly concurrency;
    private started;
    private draining;
    private wakeup;
    constructor(deps: WorkerDeps);
    start(): void;
    stop(): void;
    private stopped;
    on(jobId: string, fn: (ev: WorkerProgressEvent) => void): () => void;
    /** Wake the drain loop after enqueue. */
    notify(): void;
    cancel(jobId: string): void;
    private emit;
    private drain;
    private runOne;
}
//# sourceMappingURL=worker.d.ts.map