UNPKG

route-claudecode

Version:

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

75 lines 2.18 kB
/** * CodeWhisperer 增强客户端 * 集成增强认证管理器和智能重试机制的完整实现 * 基于 AIClient-2-API 的优秀架构设计,完全符合demo3标准 * 项目所有者: Jason Zhang */ import { AnthropicRequest } from './types'; import { ICodeWhispererClient } from './client-interface'; import { KiroAuthConfig } from './enhanced-auth-config'; export declare class EnhancedCodeWhispererClient implements ICodeWhispererClient { private auth; private retryManager; private httpClient; private config; private parser; private requestCount; constructor(config?: Partial<KiroAuthConfig>); /** * 创建配置化的 HTTP 客户端 - 完全符合demo3 header标准 */ private createHttpClient; /** * 构建 API URL */ private buildApiUrl; /** * 处理流式请求 - 完整的错误处理和重试机制 */ handleStreamRequest(anthropicReq: AnthropicRequest, writeSSE: (event: string, data: any) => void, onError: (message: string, error: Error) => void): Promise<void>; /** * 执行实际的流式请求 - 集成响应流水线处理 */ private executeStreamRequest; /** * 处理非流式请求 */ handleNonStreamRequest(anthropicReq: AnthropicRequest): Promise<any>; /** * 执行实际的非流式请求 - 集成响应流水线处理 */ private executeNonStreamRequest; /** * 转换 Anthropic 请求为 CodeWhisperer 格式 */ private transformAnthropicToCodeWhisperer; /** * 解析流式数据行 - 返回解析后的数据供流水线处理 */ private parseStreamLine; /** * 健康检查 */ healthCheck(): Promise<{ healthy: boolean; type: string; message?: string; }>; /** * 获取客户端类型 */ getClientType(): 'buffered' | 'realtime'; /** * 获取当前配置 */ getConfig(): KiroAuthConfig; /** * 更新配置 */ updateConfig(newConfig: Partial<KiroAuthConfig>): void; /** * 日志输出方法 */ private log; } //# sourceMappingURL=enhanced-client.d.ts.map