/** * LLM Provider Error Classes * Structured error handling for all LLM providers */ import type { LLMError } from './types.js'; export declare class LLMProviderError extends Error implements LLMError { code: string; provider: string; retryable: boolean; statusCode?: number; rateLimited?: boolean; quotaExceeded?: boolean; constructor(message: string, code: string, provider: string, retryable?: boolean, statusCode?: number); } export declare class RateLimitError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class QuotaExceededError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class AuthenticationError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class InvalidRequestError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class ModelNotFoundError extends LLMProviderError { constructor(provider: string, model: string); } export declare class TimeoutError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class NetworkError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class ServerError extends LLMProviderError { constructor(provider: string, message?: string, statusCode?: number); } export declare class ContentFilterError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class TokenLimitError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class ConfigurationError extends LLMProviderError { constructor(provider: string, message: string); } export declare class CircuitBreakerOpenError extends LLMProviderError { retryAfterSec: number; consecutiveFailures: number; constructor(provider: string, retryAfterSec?: number, consecutiveFailures?: number); } export declare class ToolLoopLimitError extends LLMProviderError { constructor(provider: string, message?: string); } export declare class ToolLoopAbortedError extends LLMProviderError { constructor(provider: string, message?: string); } /** * Thrown when a provider's response envelope fails runtime schema validation. * * Indicates the upstream API silently changed shape - a field was renamed, * removed, or had its type changed. Non-retryable: retrying hits the same * broken shape. The factory treats this as fallback-eligible so traffic * routes to a healthy provider while the drift is investigated. */ export declare class SchemaDriftError extends LLMProviderError { path: string; expected: string; actual: string; constructor(provider: string, path: string, expected: string, actual: string); } /** * Error factory for creating provider-specific errors from HTTP responses */ /** Shape of error response bodies across all LLM providers. */ interface ErrorResponseBody { message?: string; error?: { message?: string; code?: string; type?: string; param?: string; }; } export declare class LLMErrorFactory { static fromHttpResponse(provider: string, statusCode: number, responseBody?: ErrorResponseBody, message?: string): LLMProviderError; /** * Create error from fetch response */ static fromFetchResponse(provider: string, response: Response): Promise; /** * Check if error is retryable */ static isRetryable(error: Error): boolean; /** * Check if error indicates rate limiting */ static isRateLimited(error: Error): boolean; /** * Check if error indicates quota exceeded */ static isQuotaExceeded(error: Error): boolean; /** * Get retry delay from rate limit error */ static getRetryDelay(error: Error): number; } export {}; //# sourceMappingURL=errors.d.ts.map