import { ImagePart, TextPart } from "@xsai/shared-chat"; import { Context } from "koishi"; import { ChatModelSwitcher } from "../services/model"; import { AgentStimulus, WorldState } from "../services/worldstate"; import { Config } from "../config"; /** * @description 负责为 Agent 的单次心跳构建完整的提示词上下文。 * 它聚合了世界状态、记忆、工具定义,并处理复杂的多模态(图片)内容筛选。 */ export declare class PromptContextBuilder { private readonly ctx; private readonly config; private readonly modelSwitcher; private readonly logger; private readonly assetService; private readonly memoryService; private readonly toolService; private readonly worldStateService; private imageLifecycleTracker; constructor(ctx: Context, config: Config, modelSwitcher: ChatModelSwitcher); /** * 构建完整的上下文对象,用于渲染提示词模板。 */ build(stimulus: AgentStimulus): Promise<{ toolSchemas: import("../services/extension").ToolSchema[]; memoryBlocks: import("../services/memory").MemoryBlockData[]; worldState: WorldState; }>; /** * 构建多模态消息内容,如果模型和配置支持。 * @returns 包含图片和文本的消息内容数组,或纯文本字符串。 */ buildMultimodalUserMessage(userPromptText: string, worldState: WorldState): Promise; /** * @description 构建多模态上下文。 * 采用更声明式的方法来智能筛选图片,提高可读性和可维护性。 * @param worldState 当前的世界状态 * @returns 包含筛选后的图片内容的对象 */ private buildMultimodalImages; }