UNPKG

route-claudecode

Version:

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

70 lines 2.34 kB
/** * Enhanced Routing Engine with Clean Pipeline Architecture * 集成了Pipeline Coordinator的增强路由引擎 * Project owner: Jason Zhang * * Architecture Flow: * Input → Preprocessing → Route → Transform → Provider → Response Transform → Output */ import { BaseRequest, BaseResponse, RoutingCategory } from '../types'; export interface RoutingResult { provider: string; model: string; preprocessedRequest: BaseRequest; transformedData: any; metadata: any; } /** * 增强路由引擎 * 结合了路由决策和流水线预处理 */ export declare class EnhancedRoutingEngine { private baseRoutingEngine; private pipelineCoordinator; constructor(routingConfig: Record<RoutingCategory, any>, port?: number); /** * 完整的路由和预处理流程 * 返回Provider可以直接使用的数据 */ routeAndPreprocess(request: BaseRequest, requestId: string): Promise<RoutingResult>; /** * 响应后处理:将Provider响应转换回统一格式 */ processProviderResponse(providerResponse: BaseResponse, routingMetadata: any): Promise<BaseResponse>; /** * 确定Provider的目标转换格式 */ private determineTargetFormat; /** * 获取路由统计信息 */ getRoutingStats(): { pipelineStats: { patchPreprocessorStats: { totalProcessed: number; totalDuration: number; byStage: { input: { count: number; duration: number; }; response: { count: number; duration: number; }; streaming: { count: number; duration: number; }; }; }; }; }; /** * 生成唯一请求ID */ private generateRequestId; } export declare function getEnhancedRoutingEngine(routingConfig: Record<RoutingCategory, any>, port?: number): EnhancedRoutingEngine; export declare function createEnhancedRoutingEngine(routingConfig: Record<RoutingCategory, any>, port?: number): EnhancedRoutingEngine; //# sourceMappingURL=enhanced-routing-engine.d.ts.map