import type { AgentMessage } from "@earendil-works/pi-agent-core"; import { type CustomEntry, type ExtensionContext, type SessionEntry } from "@earendil-works/pi-coding-agent"; import type { SessionReader } from "../session-reader.js"; export type WindowMarker = CustomEntry<{ windowId: string; }> & { data: { windowId: string; }; }; export declare function isWindowMarker(entry: SessionEntry): entry is WindowMarker; /** Only the active branch can supply a window boundary. */ export declare function currentReset(ctx: SessionReader): WindowMarker | undefined; /** A reset is checkpoint-backed only when its marker directly follows a native compaction. */ export declare function isCheckpointBackedReset(ctx: SessionReader, marker?: WindowMarker | undefined): boolean; /** Mint the durable identity of a session's root history window. */ export declare function rootWindowId(sessionId: string): string; /** Persisted messages in the active window, excluding earlier windows on this branch. */ export declare function hasWindowMessage(ctx: SessionReader, customType: string): boolean; /** The root or latest durable marker on the active branch. */ export declare function currentWindowId(ctx: SessionReader): string; /** The durable window active just before the marker: the last earlier marker, else the root window. */ export declare function previousWindowId(ctx: SessionReader, markerId: string): string; /** Match a provider-facing boot message, optionally by window identity. */ export declare function isWindowBoot(message: AgentMessage, windowId?: string): boolean; /** Match a persisted boot entry by raw identity, even when a later edit hides it from projection. */ export declare function isWindowBootEntry(entry: SessionEntry, windowId: string): boolean; /** * The durable marker selects a boot message by identity, never by wall-clock time. * The boot is the first conversation message of the window. Folding only its prefix * preserves later prompt/tool patches in place, including their cacheable ordering. */ export declare function projectWindow(messages: AgentMessage[], windowId: string): AgentMessage[]; /** * Root windows are not reset boundaries. A forked session can copy a root boot whose * details name the source session; refresh that boot in-place in the provider projection * while retaining every user/assistant/tool message from the copied root transcript. */ export declare function projectRootWindow(messages: AgentMessage[], windowId: string): AgentMessage[]; /** Usage for the selected window, excluding provider usage recorded before its marker. */ export declare function windowUsage(ctx: Pick): import("@earendil-works/pi-coding-agent").ContextUsage | undefined;