/** * MemoryManager class for managing conversation history and building prompts * Maintains context across agent steps with history tracking and truncation */ import { LLMMessage, ScreenState, AgentOutput, ActionResult, HistoryItem, MemoryState, AgentSettings } from '../types'; import { FileSystem } from './FileSystem'; export declare class MemoryManager { private fileSystem; private promptBuilder; private settings; private state; private currentTask; constructor(fileSystem: FileSystem, settings: AgentSettings); /** * Initialize a new task * Resets history and creates system message */ addNewTask(task: string): void; /** * Create state message for current step * Builds user message with all context and updates history */ createStateMessage(modelOutput: AgentOutput | null, result: ActionResult[] | null, stepInfo: { stepNumber: number; maxSteps: number; }, screenState: ScreenState): Promise; /** * Update history after a step completes * Tracks model output, results, and any errors */ updateHistory(stepNumber: number, modelOutput: AgentOutput | null, result: ActionResult[] | null, error?: string): void; /** * Add a context message (for errors, corrections, user input) */ addContextMessage(message: string): void; /** * Add a system message to history items */ addSystemMessageToHistory(stepNumber: number, message: string): void; /** * Get all messages for LLM * Returns array of messages in order: system, context, state */ getMessages(): LLMMessage[]; /** * Get agent history items */ getAgentHistory(): HistoryItem[]; /** * Get current memory state */ getMemoryState(): MemoryState; /** * Clear context messages (useful after LLM processes them) */ clearContextMessages(): void; /** * Add content to one-time read state * This content will be included once and then cleared */ addToReadState(content: string): void; /** * Get current task */ getCurrentTask(): string; /** * Get file system instance */ getFileSystem(): FileSystem; /** * Format action results for history tracking */ private formatActionResultsForHistory; /** * Truncate history to max items * Keeps most recent items within the limit */ private truncateHistory; } //# sourceMappingURL=MemoryManager.d.ts.map