import type { OperationStatus } from '../types/operations.js'; /** Base class for durable-operation errors, each with a stable `code`. */ export declare class OperationError extends Error { /** Stable code, such as `OPERATION_CANCELLED`. */ readonly code: string; /** The underlying error. */ readonly cause?: unknown | undefined; constructor(message: string, /** Stable code, such as `OPERATION_CANCELLED`. */ code: string, /** The underlying error. */ cause?: unknown | undefined); } /** Raised when work is attempted on a cancelled operation. */ export declare class OperationCancelledError extends OperationError { /** The operation. */ readonly operationId: string; /** Why it was cancelled. */ readonly reason?: string | undefined; constructor( /** The operation. */ operationId: string, /** Why it was cancelled. */ reason?: string | undefined); } /** Raised when an operation passes its expiry before completing. */ export declare class OperationExpiredError extends OperationError { /** The operation. */ readonly operationId: string; /** ISO-8601 time it expired. */ readonly expiresAt?: string | undefined; constructor( /** The operation. */ operationId: string, /** ISO-8601 time it expired. */ expiresAt?: string | undefined); } /** * Raised when a transition would leave the lifecycle in an impossible state. * * This is a programming error in a runner or a custom store, never something a provider can cause, * so it is deliberately loud rather than tolerated. */ export declare class OperationTransitionError extends OperationError { /** The status it was in. */ readonly from: OperationStatus; /** The status it was asked to move to. */ readonly to: OperationStatus; constructor( /** The status it was in. */ from: OperationStatus, /** The status it was asked to move to. */ to: OperationStatus, operationId?: string); } /** * Raised when a compare-and-set update loses to another worker. * * The losing worker must reload the record rather than retry its write, because the winner may * have cancelled or completed the operation. */ export declare class OperationConflictError extends OperationError { /** The operation. */ readonly operationId: string; /** The sequence the losing write expected. */ readonly expectedSequence: number; constructor( /** The operation. */ operationId: string, /** The sequence the losing write expected. */ expectedSequence: number); } /** Raised when a worker's lease on an operation was taken over by another worker. */ export declare class OperationLeaseLostError extends OperationError { /** The operation. */ readonly operationId: string; /** The worker whose lease was lost. */ readonly owner: string; constructor( /** The operation. */ operationId: string, /** The worker whose lease was lost. */ owner: string); } /** * Raised by a store that enforces unique idempotency keys when a second record claims one. * * Two workers can both find no record for a key and both try to create one; a store that can say * which one lost lets the runner attach the loser to the winner's operation instead of running the * work twice. */ export declare class OperationDuplicateError extends OperationError { /** The key already claimed. */ readonly idempotencyKey: string; constructor( /** The key already claimed. */ idempotencyKey: string); } /** Raised when an operation id is not in the store. */ export declare class OperationNotFoundError extends OperationError { /** The id looked up. */ readonly operationId: string; constructor( /** The id looked up. */ operationId: string); } /** * Raised when a result carrying raw bytes is about to be persisted. * * Binary media must be stored as an asset reference, not serialized into the operation record: a * base64 round trip inflates the payload by a third, and a queue backend usually caps job size well * below one image. */ export declare class OperationSerializationError extends OperationError { /** The operation. */ readonly operationId: string; /** Where in the result the bytes were found. */ readonly path: string; constructor( /** The operation. */ operationId: string, /** Where in the result the bytes were found. */ path: string); }