import type { ControlPlaneOperation, ControlPlaneStore, JsonValue, OperationState } from '../control-plane';
import type { EnqueueOperationInput, OperationJob, OperationLogEntry, QueueConcurrencyLimits, QueueLogInput, QueueOperationHandler, QueueOperationView, QueueRecoveryResult, QueueRunResult } from './types';
export declare class DurableOperationQueue {
    readonly controlPlane: ControlPlaneStore;
    private readonly nowFn;
    private readonly idFn;
    private readonly workerId;
    private readonly leaseMs;
    readonly limits: QueueConcurrencyLimits;
    constructor(controlPlane: ControlPlaneStore, options?: {
        workerId?: string;
        leaseMs?: number;
        limits?: Partial<QueueConcurrencyLimits>;
        now?: () => Date;
        id?: () => string;
    });
    private now;
    private leaseExpiry;
    enqueue(input: EnqueueOperationInput): QueueOperationView;
    getJob(operationId: string): OperationJob | undefined;
    view(operationId: string): QueueOperationView | undefined;
    list(input?: {
        projectId?: string;
        state?: OperationState;
        limit?: number;
    }): QueueOperationView[];
    configureConcurrency(limits: Partial<QueueConcurrencyLimits>, input?: {
        organizationId?: string;
        actorId?: string;
    }): QueueConcurrencyLimits;
    private runningCount;
    private blockReason;
    claim(operationId: string): QueueOperationView | undefined;
    claimNext(kinds?: readonly string[]): QueueOperationView | undefined;
    heartbeat(operationId: string, step?: string): void;
    appendLog(operationId: string, message: string, input?: QueueLogInput): OperationLogEntry;
    logs(operationId: string, input?: {
        after?: number;
        limit?: number;
    }): OperationLogEntry[];
    requestCancellation(operationId: string, actorId?: string): ControlPlaneOperation;
    retry(operationId: string, errorClass: string, input?: {
        delayMs?: number;
        actorId?: string;
    }): ControlPlaneOperation;
    private release;
    private finish;
    complete(operationId: string, output?: JsonValue): ControlPlaneOperation;
    fail(operationId: string, error: string, output?: JsonValue): ControlPlaneOperation;
    runOne(handlers: Record<string, QueueOperationHandler>): Promise<QueueRunResult>;
    recoverExpired(): QueueRecoveryResult;
    clearCompleted(input?: {
        before?: string;
        actorId?: string;
        projectId?: string;
    }): number;
}
