UNPKG

route-claudecode

Version:

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

68 lines 1.93 kB
/** * Finish Reason一致性验证器 * 在输出前进行最终的finish reason与工具调用一致性检查和修复 */ import { AnthropicResponse } from '../../types'; interface ValidationResult { consistent: boolean; fixed: boolean; originalStopReason: string; finalStopReason: string; toolCount: number; issues: string[]; } export declare class FinishReasonConsistencyValidator { private logger; constructor(port?: number); /** * 🎯 验证并修复stop_reason一致性 * 如果有工具调用,不能是end_turn,必须是tool_use */ validateAndFix(response: AnthropicResponse, requestId?: string): { response: AnthropicResponse; result: ValidationResult; }; /** * 统计tool_use块的数量 */ private countToolUseBlocks; /** * 获取工具调用详情 */ getToolDetails(response: AnthropicResponse): Array<{ id: string; name: string; hasInput: boolean; }>; /** * 批量验证多个响应 */ validateBatch(responses: AnthropicResponse[], requestId?: string): { responses: AnthropicResponse[]; summary: { total: number; consistent: number; fixed: number; totalTools: number; totalIssues: number; }; }; /** * 检查是否需要验证 */ shouldValidate(response: AnthropicResponse): boolean; /** * 生成验证报告 */ generateValidationReport(result: ValidationResult): string; } /** * 获取或创建一致性验证器实例 */ export declare function getConsistencyValidator(port?: number): FinishReasonConsistencyValidator; /** * 创建新的一致性验证器实例 */ export declare function createConsistencyValidator(port?: number): FinishReasonConsistencyValidator; export {}; //# sourceMappingURL=consistency-validator.d.ts.map