export type JobTrackingStatus = 'pending' | 'active' | 'enqueued' | 'completed' | 'failed' | 'stalled' | 'timeout' | 'pending_recovery' | 'dead_letter' | 'manual_review' | 'delayed';
export type JobTrackingRecord = {
    jobId: string;
    queueName: string;
    status: JobTrackingStatus;
    attempts: number;
    maxAttempts?: number;
    payload?: unknown;
    result?: unknown;
    lastError?: string;
    lastErrorCode?: string;
    retryAt?: string;
    timeoutAt?: string;
    heartbeatAt?: string;
    expectedCompletionAt?: string;
    workerName?: string;
    workerInstanceId?: string;
    workerRegion?: string;
    workerVersion?: string;
    recoveredAt?: string;
    idempotencyKey?: string;
    createdAt: string;
    startedAt?: string;
    completedAt?: string;
    updatedAt: string;
};
export type JobTrackingTransition = {
    jobId: string;
    queueName: string;
    fromStatus: JobTrackingStatus | null;
    toStatus: JobTrackingStatus;
    reason: string;
    timestamp: string;
    attempts?: number;
    error?: string;
};
export interface JobStateTrackerPersistenceAdapter {
    upsertJob(record: JobTrackingRecord): Promise<void>;
    insertTransition(transition: JobTrackingTransition): Promise<void>;
}
export declare const JobStateTracker: Readonly<{
    isEnabled(): boolean;
    enqueued(input: {
        queueName: string;
        jobId: string;
        payload?: unknown;
        attempts?: number;
        maxAttempts?: number;
        expectedCompletionAt?: string;
        idempotencyKey?: string;
    }): Promise<void>;
    started(input: {
        queueName: string;
        jobId: string;
        attempts?: number;
        timeoutMs?: number;
        workerName?: string;
        workerInstanceId?: string;
        workerRegion?: string;
        workerVersion?: string;
    }): Promise<void>;
    completed(input: {
        queueName: string;
        jobId: string;
        processingTimeMs?: number;
        result?: unknown;
    }): Promise<void>;
    failed(input: {
        queueName: string;
        jobId: string;
        attempts?: number;
        isFinal: boolean;
        retryAt?: string;
        error?: unknown;
    }): Promise<void>;
    heartbeat(input: {
        queueName: string;
        jobId: string;
        workerInstanceId?: string;
    }): Promise<void>;
    timedOut(input: {
        queueName: string;
        jobId: string;
        reason?: string;
        error?: unknown;
    }): Promise<void>;
    stalled(input: {
        queueName: string;
        jobId: string;
        reason?: string;
    }): Promise<void>;
    pendingRecovery(input: {
        queueName: string;
        jobId: string;
        attempts?: number;
        maxAttempts?: number;
        retryAt?: string;
        reason?: string;
        error?: unknown;
    }): Promise<void>;
    markedRecovered(input: {
        queueName: string;
        jobId: string;
        reason?: string;
        retryAt?: string;
    }): Promise<void>;
    handedOffToQueue(input: {
        queueName: string;
        jobId: string;
        reason?: string;
    }): Promise<void>;
    setTerminalStatus(input: {
        queueName: string;
        jobId: string;
        status: "dead_letter" | "manual_review" | "failed" | "completed";
        reason: string;
        error?: unknown;
    }): Promise<void>;
    registerPersistenceAdapter(adapter: JobStateTrackerPersistenceAdapter): void;
    clearPersistenceAdapter(): void;
    get(queueName: string, jobId: string): JobTrackingRecord | undefined;
    list(options?: {
        queueName?: string;
        status?: JobTrackingStatus;
        limit?: number;
    }): JobTrackingRecord[];
    getTransitions(options?: {
        queueName?: string;
        jobId?: string;
        limit?: number;
    }): JobTrackingTransition[];
    listActiveOlderThan(maxAgeMs: number, queueName?: string): JobTrackingRecord[];
    listPendingOlderThan(maxAgeMs: number, queueName?: string): JobTrackingRecord[];
    listRecoverable(maxAgeMs: number, queueName?: string): JobTrackingRecord[];
    listHeartbeatExpired(maxSilenceMs: number, queueName?: string): JobTrackingRecord[];
    getSummary(queueName?: string): Record<string, number>;
    reset(): void;
}>;
export default JobStateTracker;
//# sourceMappingURL=JobStateTracker.d.ts.map