import { AgentEventStream, ToolCallEngine, Tool, ChatCompletionMessageParam } from '@multimodal/agent-interface'; /** * MessageHistory - Converts event stream to message history * This separates the concerns of event storage from message history formatting * * Features: * - Handles multimodal content including text and images * - Limits images to prevent context window overflow * - Maintains conversation structure for LLM context * - Supports environment inputs as part of the conversation */ export declare class MessageHistory { private eventStream; private maxImagesCount?; private logger; /** * Creates a new MessageHistory instance * * @param eventStream - The event stream to convert to message history * @param maxImagesCount - Optional maximum number of images to include in the context. * When specified, limits the total number of images in the conversation history * to prevent context window overflow. Images beyond this limit will be * replaced with text placeholders to preserve context while reducing token usage. */ constructor(eventStream: AgentEventStream.Processor, maxImagesCount?: number | undefined); /** * Convert events to message history format for LLM context * This method uses the provided toolCallEngine to format messages * according to the specific requirements of the underlying LLM * * @param toolCallEngine The tool call engine to use for message formatting * @param systemPrompt The base system prompt to include * @param tools Available tools to enhance the system prompt */ toMessageHistory(toolCallEngine: ToolCallEngine, customSystemPrompt: string, tools?: Tool[]): ChatCompletionMessageParam[]; /** * Process all events in a single unified path with optional image limiting */ private processEvents; /** * Process plan update event * Adds plan information as a system message to guide the agent */ private processPlanUpdate; /** * Process all images in all events */ private countAllImagesInEvents; /** * Get a set of image references that should be omitted based on the sliding window */ private getImagesToOmit; /** * Collect all image references from events, ordered from newest to oldest */ private collectAllImageReferences; /** * Process a user message */ private processUserMessage; /** * Process content, replacing omitted images with placeholder text */ private processContent; /** * Process an assistant message and its tool calls */ private processAssistantMessage; /** * Process tool calls and their results */ private processToolCalls; /** * Helper method to find all tool results associated with an assistant message's tool calls */ private findToolResultsForAssistantMessage; /** * Count the number of images in multimodal content */ private countImagesInContent; /** * Generate the system prompt with current time */ getSystemPromptWithTime(instructions: string): string; /** * Process environment input event * Adds environment context as a user-like message but with a specific role */ private processEnvironmentInput; } //# sourceMappingURL=message-history.d.ts.map