package agent import ( "context" "ollie/backend" ) // ResultTier classifies how long a tool result stays in the hot message list. type ResultTier int const ( TierHot ResultTier = iota // stays verbatim in messages (default) TierWarm // summarized on next compaction pass TierCold // immediately summarized at update time ) // toolResult holds the output of a single tool call. type toolResult struct { ToolCallID string // may be empty (Ollama does not always set this) Name string Content string ContentBlocks []backend.ContentBlock // image blocks extracted from tool output IsError bool Tier ResultTier // default TierHot; tools may self-classify } // state is the interface both ephemeral and bead-backed state must satisfy. // The loop reads from it on Observe, writes to it on Update. type state interface { // History returns the full conversation history for the current session. // The first entry is always the initial user message containing the goal. history() []backend.Message // taskState returns the current structured task state, or nil if not set. taskState() *TaskState // updateTaskState replaces the current task state. updateTaskState(ts TaskState) // Update appends the assistant's reply and any tool results to the history. // Called once per loop iteration after Act completes. update(assistant backend.Message, results []toolResult) // estimateTokens returns a rough token count of the current history. estimateTokens() int // stripCold summarizes large tool-result messages outside the hot tail to reduce context size. stripCold(ctx context.Context, b backend.Backend) }