import { Context, Session } from "koishi"; import { ToolCallResult } from "../extensions"; import { MessageContext, Middleware, MiddlewareManager } from "./base"; import { ScenarioManager } from "../services/scenario/ScenarioManager"; export declare class ResponseHandlingMiddleware extends Middleware { protected ctx: Context; protected services: { readonly scenarioManager: ScenarioManager; readonly middlewareManager: MiddlewareManager; }; protected config: { maxRetry: number; life: number; maxHeartbeat?: number; }; constructor(ctx: Context, services: { readonly scenarioManager: ScenarioManager; readonly middlewareManager: MiddlewareManager; }, config: { maxRetry: number; life: number; maxHeartbeat?: number; }); execute(ctx: MessageContext, next: () => Promise): Promise; private parseResponse; executeToolCall(koishiContext: Context, koishiSession: Session, functionName: string, params: Record, maxRetry: number): Promise; /** * 记录工具调用。 * @param koishiContext Koishi Context * @param koishiSession Koishi Session * @param functionName 工具函数名称 * @param params 调用参数 */ private recordToolCall; /** * 记录工具执行结果。 * @param koishiContext Koishi Context * @param koishiSession Koishi Session * @param functionName 工具函数名称 * @param result 工具执行结果 */ private recordToolResult; }