UNPKG

route-claudecode

Version:

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

92 lines 2.21 kB
/** * HTTP Server for Claude Code Router * Handles incoming requests and routes them through the pipeline */ import { RouterConfig } from './types'; export declare class RouterServer { private fastify; private config; private inputProcessor; private routingEngine; private outputProcessor; private providers; private providerExpansion?; private logger; private requestTracker; private errorTracker; private unifiedPreprocessor; constructor(config: RouterConfig, serverType?: string); /** * Initialize providers from expanded configuration */ private initializeProviders; /** * 动态查找提供者:支持原始名称和多密钥轮询 */ private findProvider; /** * 从提供者池中选择一个提供者(简单轮询) */ private selectProviderFromPool; /** * 生成健康建议 */ private generateHealthRecommendations; /** * Setup HTTP routes */ private setupRoutes; /** * Setup debugging hooks */ private setupHooks; /** * Handle messages endpoint requests */ private handleMessagesRequest; /** * Handle token counting requests */ private handleCountTokensRequest; /** * Handle streaming requests */ private handleStreamingRequest; /** * Send Server-Sent Event */ private sendSSEEvent; /** * Get health status of all providers */ private getHealthStatus; /** * Start the server */ start(): Promise<void>; /** * Stop the server */ stop(): Promise<void>; /** * Update configuration */ updateConfig(config: RouterConfig): void; /** * 对错误进行分类,用于失败日志 */ private categorizeError; /** * 获取提供商类型 */ private getProviderType; /** * 根据Provider类型应用请求转换 - 实现四层架构分离 */ private applyRequestTransformation; /** * 根据Provider类型应用响应转换 - 实现四层架构分离 */ private applyResponseTransformation; } //# sourceMappingURL=server.d.ts.map