/** * GUI-specific context management. GUI transcripts have an unusual shape: observations * are large and perishable (a viewport listing or screenshot is stale the moment the * screen changes), while actions are small and precious (the action log is what * prevents repeated side effects). So instead of summarizing (which burns the precise * action ledger), we structurally prune per the toolset's ContextPolicy: * - keep the last `keepRecentObservations` gui tool results verbatim; * - older gui tool results keep only their first line (the action/title line) plus * a stale marker; * - keep at most `keepImages` recent images; older ones become one-line placeholders. * Deliberately additive-free: we never inject summaries or reminders — measured in * gui-use, per-turn added guidance made the model over-cautious and cost more than * it saved. */ import type { AgentMessage } from "@earendil-works/pi-agent-core"; import { type ContextPolicy } from "../platform/types.ts"; export declare function pruneContext(messages: AgentMessage[], policy: ContextPolicy): AgentMessage[];