UNPKG

route-claudecode

Version:

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

85 lines 2.24 kB
/** * CodeWhisperer Request Converter - 重构优化版本 * 基于demo2兼容性设计,消除硬编码和优化性能 * 项目所有者: Jason Zhang */ import { AnthropicRequest, CodeWhispererRequest, CodeWhispererConfig, RequestValidationResult } from './types'; export declare class CodeWhispererConverter { private readonly config; private readonly fallbackContent; constructor(config?: CodeWhispererConfig); /** * 提取消息文本内容 - 优化版本 */ private extractMessageContent; /** * 处理内容块数组 */ private processContentBlocks; /** * 验证内容块有效性 */ private isValidContentBlock; /** * 从内容块提取文本 */ private extractTextFromBlock; /** * 处理未知内容类型 */ private handleUnknownContent; /** * 构建CodeWhisperer请求 - 重构优化版本 */ buildCodeWhispererRequest(anthropicReq: AnthropicRequest, profileArn: string, authMethod?: string): Promise<CodeWhispererRequest>; /** * 转换工具定义到 CodeWhisperer 格式 * 基于 demo3 的工具转换策略,添加默认值处理 */ private convertTools; /** * 创建调试信息 */ private createDebugInfo; /** * 判断是否需要构建历史消息 */ private shouldBuildHistory; /** * 构建消息历史 */ private buildMessageHistory; /** * 处理系统消息 */ private processSystemMessages; /** * 处理常规消息历史 */ private processRegularMessages; /** * 创建构建结果信息 */ private createBuildResult; /** * 验证请求格式 - 重构优化版本 */ validateRequest(cwReq: CodeWhispererRequest): RequestValidationResult; /** * 验证基本字段 */ private validateBasicFields; /** * 验证对话状态 */ private validateConversationState; /** * 验证用户输入消息 */ private validateUserInputMessage; /** * 简化的验证方法(向后兼容) */ validateRequestLegacy(cwReq: CodeWhispererRequest): boolean; } //# sourceMappingURL=converter.d.ts.map