import { type BranchReader, type Message, type PersistencePage, type SessionBranchRead, type SessionEntry, type SessionSearchHit, type SessionSearchQuery, type SessionStore } from "./contracts.js"; export interface CreateSessionEntryOptions extends Omit { readonly id?: string; readonly timestamp?: string; readonly createId?: () => string; readonly now?: () => Date; } export interface SessionBranchOptions { readonly leafId?: string; } export interface SessionBranch { readonly leafId: string; readonly entries: readonly SessionEntry[]; } export interface SessionContextSnapshot { readonly leafId?: string; readonly entries: readonly SessionEntry[]; readonly messages: readonly Message[]; readonly summaries: readonly string[]; } export declare function createSessionEntry(options: CreateSessionEntryOptions): SessionEntry; export declare function getSessionBranchEntries(reader: BranchReader, query: SessionBranchRead): Promise; export declare function getSessionBranchEntries(entries: readonly SessionEntry[], options?: SessionBranchOptions): readonly SessionEntry[]; export declare function listSessionBranches(entries: readonly SessionEntry[]): readonly SessionBranch[]; export declare function rebuildSessionContext(reader: BranchReader, query: SessionBranchRead): Promise; export declare function rebuildSessionContext(entries: readonly SessionEntry[], options?: SessionBranchOptions): SessionContextSnapshot; export type MemorySessionSearchMode = "linear" | "unsupported"; export interface CreateMemorySessionStoreOptions { /** Default `"linear"`: capped in-process scan. `"unsupported"`: typed throw. */ readonly sessionSearchMode?: MemorySessionSearchMode; /** * Optional overrides for the capped in-process scan. Hosts with a small session set can * raise the caps (bounded by the contract `HARD_MAX_SESSION_SEARCH_LINEAR_*` values); * defaults are the contract `DEFAULT_MAX_SESSION_SEARCH_LINEAR_*` caps. Values below 1 * or above the hard cap fail store construction closed with a `TypeError`. */ readonly search?: { readonly maxLinearSessions?: number; readonly maxLinearEntries?: number; readonly maxLinearBytes?: number; }; } /** Resolved bounds for the capped linear session scan. */ export interface LinearSearchCaps { readonly sessions: number; readonly entries: number; readonly bytes: number; } export declare function createMemorySessionStore(initialEntries?: readonly SessionEntry[], options?: CreateMemorySessionStoreOptions): SessionStore; /** * Shared linear (unindexed) session search over already-grouped entries: the memory store's default * mode and the JSONL store's implementation. `caps` defaults to the contract linear caps. */ export declare function searchLinearSessions(bySession: Map, leafBySession: Map, query: SessionSearchQuery, caps?: LinearSearchCaps): PersistencePage;