/** * Structured error hierarchy for recursive-llm-ts. * * All library errors extend {@link RLMError}, which adds: * - `code` – machine-readable error identifier * - `retryable` – whether the caller should retry * - `suggestion` – human-readable remediation hint */ export declare class RLMError extends Error { /** Machine-readable error code (e.g. "RATE_LIMIT", "VALIDATION") */ readonly code: string; /** Whether this error is likely to succeed on retry */ readonly retryable: boolean; /** Human-readable suggestion for resolving the error */ readonly suggestion?: string; constructor(message: string, opts: { code: string; retryable?: boolean; suggestion?: string; }); } /** Thrown when a structured output fails schema validation. */ export declare class RLMValidationError extends RLMError { readonly expected: unknown; readonly received: unknown; readonly zodErrors?: unknown; constructor(opts: { message: string; expected: unknown; received: unknown; zodErrors?: unknown; }); } /** Thrown when the LLM provider returns a 429 rate limit response. */ export declare class RLMRateLimitError extends RLMError { readonly retryAfter?: number; constructor(opts: { message: string; retryAfter?: number; }); } /** Thrown when an operation exceeds its time limit. */ export declare class RLMTimeoutError extends RLMError { readonly elapsed: number; readonly limit: number; constructor(opts: { message: string; elapsed: number; limit: number; }); } /** Thrown when the LLM provider returns an HTTP error. */ export declare class RLMProviderError extends RLMError { readonly statusCode: number; readonly provider: string; readonly responseBody?: string; constructor(opts: { message: string; statusCode: number; provider: string; responseBody?: string; }); } /** Thrown when the Go binary cannot be found or fails to start. */ export declare class RLMBinaryError extends RLMError { readonly binaryPath: string; constructor(opts: { message: string; binaryPath: string; }); } /** Thrown when the RLM configuration is invalid. */ export declare class RLMConfigError extends RLMError { readonly field: string; readonly value: unknown; constructor(opts: { message: string; field: string; value: unknown; }); } /** Thrown when a JSON Schema is malformed or unsupported. */ export declare class RLMSchemaError extends RLMError { readonly path: string; readonly constraint: string; constructor(opts: { message: string; path: string; constraint: string; }); } /** Thrown when the request exceeds the model's context window. */ export declare class RLMContextOverflowError extends RLMError { readonly modelLimit: number; readonly requestTokens: number; constructor(opts: { message: string; modelLimit: number; requestTokens: number; }); } /** Thrown when an operation is aborted via AbortController. */ export declare class RLMAbortError extends RLMError { constructor(message?: string); } /** * Classify a raw Error into the appropriate RLM error type. * Used internally by the bridge layer to wrap Go binary errors. */ export declare function classifyError(err: Error | string, context?: { binaryPath?: string; provider?: string; }): RLMError;