import { type SessionTreeEntry } from "@earendil-works/pi-agent-core"; import { type Message, type Tool } from "@earendil-works/pi-ai"; export interface SessionStaticContext { systemPrompt?: string; tools?: Tool[]; } export interface SessionState { sessionId: string; staticContext: SessionStaticContext | undefined; staticContextHash: string; entries: SessionTreeEntry[]; leafId: string | null; treeHash: string; prefixHashes: string[]; messages: Message[]; revision: number; createdAt: number; updatedAt: number; persistenceChange: SessionPersistenceChange | undefined; } export interface SessionSummary { sessionId: string; staticContextHash: string; treeHash: string; messageCount: number; entryCount: number; leafId: string | null; revision: number; createdAt: number; updatedAt: number; } export interface PersistedSessionState { sessionId: string; staticContext: SessionStaticContext | undefined; entries: SessionTreeEntry[]; leafId: string | null; revision: number; createdAt: number; updatedAt: number; } export type SessionPersistenceChange = { kind: "snapshot"; } | { kind: "wal"; entries: SessionTreeEntry[]; }; export declare function getOrCreateSession(sessionId: string): SessionState; export declare function getSession(sessionId: string): SessionState | undefined; export declare function hashSessionEntries(entries: SessionTreeEntry[]): string; export declare function listSessions(): SessionSummary[]; export declare function exportSessionState(session: SessionState): PersistedSessionState; export declare function restoreSessionState(persisted: PersistedSessionState): SessionState; export declare function setStaticContext(sessionId: string, context: SessionStaticContext): SessionState; export declare function getSessionBranch(session: SessionState): SessionTreeEntry[]; export declare function replaceSessionTree(sessionId: string, entries: SessionTreeEntry[], leafId: string | null): SessionState; export declare function appendSessionEntries(sessionId: string, entries: SessionTreeEntry[], leafId: string | null): SessionState; export declare function switchSessionLeaf(sessionId: string, leafId: string | null): SessionState; export declare function appendCompactionEntry(sessionId: string, compaction: { summary: string; firstKeptEntryId: string; tokensBefore: number; details?: unknown; }): { session: SessionState; entry: SessionTreeEntry; }; export declare function appendMessages(sessionId: string, delta: Message[]): SessionState; export declare function replaceMessages(sessionId: string, messages: Message[]): SessionState; export declare function deleteSession(sessionId: string): boolean; export declare function clearAllSessions(): void; export declare function markSessionPersisted(session: SessionState): void; //# sourceMappingURL=session-store.d.ts.map