import type { AgentMessage } from "@earendil-works/pi-agent-core"; import type { VerbatimCompactionDetails } from "./compaction/compaction-types.js"; import type { CompactionEntry, ContextEditEntry, FileEntry, SessionContext, SessionEntry, SessionProjection, SessionTreeNode } from "./session-manager-types.ts"; /** Index the latest context edit per target among the given entries. */ export declare function collectContextEdits(entries: readonly SessionEntry[]): Map; /** Apply one append-only context edit to the messages an entry contributes. */ export declare function applyContextEdit(messages: AgentMessage[], edit: ContextEditEntry): AgentMessage[]; export declare function getLatestCompactionBoundaryEntry(entries: SessionEntry[]): CompactionEntry | null; /** Convert one durable session entry into the messages it contributes to model context. */ export declare function sessionEntryToContextMessages(entry: SessionEntry): AgentMessage[]; /** Return the active branch entries after applying the latest compaction boundary. */ export declare function buildContextEntries(entries: SessionEntry[], leafId?: string | null, byId?: Map): SessionEntry[]; /** * Build provenance-preserving, compaction-aware model context. * * Every entry on the active branch after the latest compaction boundary is projected * to the messages it contributes after context edits. The latest verbatim compaction * boundary is emitted as one custom-role text message: the compacted string with the * kept tail (edits applied) serialized and appended to its end, rather than the tail * being replayed as separate structured messages. Kept-tail entries therefore project * to no standalone messages of their own. */ export declare function buildSessionProjection(entries: SessionEntry[], leafId?: string | null, byId?: Map): SessionProjection; /** * Build the session context from entries using tree traversal. * If leafId is provided, walks from that entry to root. * Emits the latest verbatim compaction boundary as one custom-role text message: the * compacted string with the kept tail serialized and appended to its end, rather than * the tail being replayed as separate structured messages. */ export declare function buildSessionContext(entries: SessionEntry[], leafId?: string | null, byId?: Map): SessionContext; export interface SessionIndex { byId: Map; labelsById: Map; labelTimestampsById: Map; leafId: string | null; } export declare function buildSessionIndex(fileEntries: FileEntry[]): SessionIndex; export declare function getBranchPath(fromId: string | null | undefined, byId: Map): SessionEntry[]; export declare function buildSessionTree(entries: SessionEntry[], labelsById: ReadonlyMap, labelTimestampsById: ReadonlyMap): SessionTreeNode[]; //# sourceMappingURL=session-manager-history.d.ts.map