/** * [WHO]: ContextWindowController commits model-authored handoffs at safe request boundaries * [FROM]: Depends on session compaction preparation, session entry contracts, and agent message types * [TO]: Consumed by AgentSession and context-window regression tests * [HERE]: core/runtime/context-window-controller.ts - persisted working-window transitions */ import type { AgentMessage } from "@catui/agent-core"; import type { SessionContext, SessionEntry } from "../session/session-manager.js"; interface ContextWindowCapabilities { getSessionId(): string; getBranch(): SessionEntry[]; getContextWindow(): number; getPromptTokens(): number; appendCheckpoint(summary: string, firstKeptEntryId: string, tokensBefore: number, details: unknown): void; rebuildContext(): SessionContext; } export declare class ContextWindowController { private readonly ctx; private pending?; constructor(ctx: ContextWindowCapabilities); /** Queue only; tool execution must finish before the checkpoint is committed. */ request(handoff: string): boolean; cancel(): void; /** A no-op until all loop messages have reached the session journal. */ prepare(messages: AgentMessage[]): AgentMessage[]; } export {};