UNPKG

route-claudecode

Version:

Advanced routing and transformation system for Claude Code outputs to multiple AI providers

59 lines 1.55 kB
/** * CodeWhisperer 智能重试管理器 * 基于 AIClient-2-API 的指数退避和错误分类重试策略 * 项目所有者: Jason Zhang */ import { RetryConfig } from './enhanced-auth-config'; export interface RetryContext { attempt: number; maxRetries: number; lastError?: Error; startTime: number; } export interface RetryableError extends Error { statusCode?: number; isRetryable?: boolean; retryAfter?: number; } export declare class RetryManager { private config; private logger?; constructor(config?: Partial<RetryConfig>, logger?: any); /** * 执行带重试的异步操作 */ executeWithRetry<T>(operation: () => Promise<T>, context?: Partial<RetryContext>): Promise<T>; /** * 尝试执行操作 */ private attemptOperation; /** * 判断是否应该重试 */ private shouldRetry; /** * 计算延迟时间 */ private calculateDelay; /** * 睡眠指定毫秒数 */ private sleep; /** * 创建带重试信息的错误 */ static createRetryableError(message: string, statusCode?: number, isRetryable?: boolean, retryAfter?: number): RetryableError; /** * 从 HTTP 响应创建重试错误 */ static createRetryableErrorFromResponse(error: any, defaultMessage?: string): RetryableError; /** * 解析 Retry-After 头 */ private static parseRetryAfter; /** * 日志输出方法 */ private log; } //# sourceMappingURL=retry-manager.d.ts.map