import type { CompanionErrorCode, ControlErrorCode } from './protocol.js'; /** Codes the SDK itself synthesizes (status 0 — never sent by the server). * Runtime array so the drift test can assert every `new CompanionError(...)` * call site uses a declared code; APPEND-ONLY like the server vocabulary. */ export declare const SDK_SYNTHESIZED_ERROR_CODES: readonly ["reply_timeout", "needs_event_stream", "not_connected", "missing_option", "not_representative", "call_unsupported", "call_connect_failed", "call_dependency_missing", "aborted", "queued_offline", "request_timeout", "invalid_option", "reply_unavailable", "bad_response", "stream_incomplete", "call_dropped", "call_provider_error"]; export type SdkSynthesizedErrorCode = (typeof SDK_SYNTHESIZED_ERROR_CODES)[number]; /** `control.error` STREAM codes the SDK itself synthesizes (never sent by the * server) — the stream-plane sibling of SDK_SYNTHESIZED_ERROR_CODES above. * Runtime array so the drift test can assert every locally-emitted * `control.error` envelope uses a declared code; APPEND-ONLY. */ export declare const SDK_STREAM_ERROR_CODES: readonly ["stream_unauthorized", "stream_rejected"]; export type SdkStreamErrorCode = (typeof SDK_STREAM_ERROR_CODES)[number]; /** `control.error` `code` values a consumer can switch on (0.30.0): the server * vocabulary (CONTROL_ERROR_CODES, drift-tested against the server list) plus * the SDK-synthesized stream codes — DERIVED from the runtime lists rather * than hand-retyped, same doctrine as CompanionErrorCodeValue below. The * `(string & {})` arm keeps the type open for codes newer than this SDK build * while preserving autocomplete. */ export type ControlErrorCodeValue = ControlErrorCode | SdkStreamErrorCode | (string & {}); /** Thrown by every helper on an HTTP or client-side failure. `status` is the * HTTP status (0 for client-synthesized failures — timeouts, unsupported * environments, missing optional deps); `code` is machine-switchable when * the server (or the SDK itself) names a cause. On a `rate_limited` (429) * failure, `retryAfter` carries the server's Retry-After in SECONDS so a * consumer can back off precisely instead of guessing. */ /** `CompanionError.code` values: the server vocabulary (COMPANION_ERROR_CODES, * drift-tested against api-error.ts) plus the SDK-synthesized ones — DERIVED * from those runtime lists rather than hand-retyped, so a new code can never * silently miss this union again (the old copy had drifted 5 codes behind). * The `(string & {})` arm keeps the type open for codes newer than this SDK * build while preserving autocomplete. */ export type CompanionErrorCodeValue = CompanionErrorCode | SdkSynthesizedErrorCode | (string & {}); export declare class CompanionError extends Error { status: number; code?: CompanionErrorCodeValue; retryAfter?: number; /** The server's error reference (`err_…`) on a persisted 5xx — the id a * `server_errors` row is keyed by, and the thing to quote to support. * Present only when the server minted one (a real server fault; never on a * 4xx or a transport failure). 0.56.0. */ errorId?: string; /** Why a refusal came from a DEGRADED rung rather than the ordinary limit * (CR-1040). Today one value: `'limiter_unreachable'` — the rate limiter * is down and the conversation is being served at a temporary half * budget, so a `rate_limited` 429 carrying it is NOT your permanent quota: * back off for `retryAfter` and expect the full budget back. Absent on * every ordinary failure. */ degraded?: string; constructor(message: string, status: number, code?: string, retryAfter?: number, errorId?: string, degraded?: string); } //# sourceMappingURL=errors.d.ts.map