/** The single shape of the JSON error envelope (see PROTOCOL.md). Everything that * records an error — a handler exception, a missing handler, lease expiry, a thrown * TaskError — builds it here, so the contract's fields live in one place. */ export declare function errorEnvelope(e: { type: string; code: string; message: string; retryable: boolean; details?: Record; }): Record; export declare class CairnQError extends Error { } export declare class AlreadyExists extends CairnQError { key: string; constructor(key: string); } /** wait/call did not reach a terminal status in time. The task keeps running. */ export declare class TaskTimeout extends CairnQError { taskId: string; constructor(taskId: string); } /** A waited-on task ended in `failed`. The envelope's fields are unpacked onto the * error — read `e.code` / `e.message` / `e.retryable` / `e.details` instead of * digging into `e.error` (the raw envelope stays available on `e.error`). */ export declare class TaskFailed extends CairnQError { error: unknown; readonly type: string; readonly code: string; readonly retryable: boolean; readonly details: Record; constructor(error: unknown); } export declare class TaskCanceled extends CairnQError { taskId: string; constructor(taskId: string); } /** A worker write affected 0 rows: the lease expired and was reclaimed. */ export declare class LostLease extends CairnQError { taskId: string; constructor(taskId: string); } export declare class ProtocolVersionMismatch extends CairnQError { constructor(message: string); } /** Throw inside a handler to control how the failure is recorded. Defaults to * non-retryable so deterministic errors fail fast instead of burning retries. * Any other thrown value is treated as retryable. */ export declare class TaskError extends CairnQError { code: string; retryable: boolean; type: string; details: Record; constructor(message: string, opts?: { code?: string; retryable?: boolean; type?: string; details?: Record; }); envelope(): Record; }