import type { SessionReuseStore } from "./run-contracts.js"; /** * The construction options for a reuse store. The public `SessionReuseStore` * surface stays generic; these options carry the per-lane behavior the store * needs but the interface does not name: the backing map, the clock, the idle * bound, how to read an entry's last-used time and per-entry timer, how to * release an entry, whether to arm a per-entry timer, and the optional eviction * lease. */ export interface SessionReuseStoreConfig { /** * The map the store reads and writes. The caller owns it, so a caller that * inspects the map still reads the same entries. The map persists across runs. */ readonly entries: Map; /** The clock. The store reads it for the idle deadline and the sweep. */ readonly now: () => number; /** * The idle bound, in milliseconds. When it is `0` or less, the store arms no * per-entry timer and the sweep evicts nothing. */ readonly idleMs: number; /** Read an entry's last-used time. The store compares it to the idle bound. */ readonly lastUsedAt: (entry: T) => number; /** * Release an entry's resources. The store calls it once per entry on a * discard, on a per-entry timer fire, or on an idle sweep. The store guards * every release with a map-identity check, so a discarded entry never * releases twice. */ readonly release: (entry: T) => void | Promise; /** * Read an entry's per-entry idle timer, or `undefined` when it holds none. * The host lane supplies this; the sandbox lane omits it and arms no timer. */ readonly getTimer?: (entry: T) => ReturnType | undefined; /** * Write (or clear with `undefined`) an entry's per-entry idle timer. The host * lane supplies this; the sandbox lane omits it. */ readonly setTimer?: (entry: T, timer: ReturnType | undefined) => void; /** * Arm a per-entry idle timer on `save`. The host lane sets it true. The * sandbox lane leaves it false and relies on the run-start sweep only. */ readonly perEntryTimer?: boolean; /** * Run each eviction critical section under a per-key lease. The sandbox lane * supplies its per-key staging lease so the sweep re-checks the entry inside * the lease. The host lane omits it and the sweep runs the critical section * directly. */ readonly withEvictLease?: (key: string, critical: () => Promise) => Promise; } /** * Create a generic per-session reuse store over the caller-provided map. The * store holds at most one entry per session key. Each entry carries its saved * value, its last-used time, and an optional per-entry idle timer, all read * through the config accessors. */ export declare function createSessionReuseStore(config: SessionReuseStoreConfig): SessionReuseStore; //# sourceMappingURL=session-reuse-store.d.ts.map