export type ErrorCode = "invalidOrigin" | "iframeError" | "timeout" | "internal"; export type ErrorSeverity = "debug" | "info" | "warn" | "error"; export interface WidgetError { code?: ErrorCode; retryable?: boolean; severity?: ErrorSeverity; cause?: unknown; context?: Record; } export declare const isErrorCode: (value: unknown) => value is ErrorCode; export declare const readErrorCode: (value: unknown) => ErrorCode | undefined; export declare const isWidgetError: (value: unknown) => value is WidgetError; /** * Wrap any error into a lightweight WidgetError with optional code and context. * - Preserves the original error in `cause` * - Adds `context` for observability (e.g., { domain, op }) * - Derives `retryable` for timeouts by default */ export declare function wrapError(err: unknown, context: Record, options?: { code?: ErrorCode; retryable?: boolean; severity?: ErrorSeverity; }): WidgetError; /** * Classify an unknown error into the public failure shape used by the protocol. */ export declare function classifyError(err: unknown): { code: ErrorCode; detail: unknown; }; //# sourceMappingURL=widget-error.d.ts.map