/** * Snapshot store with in-memory + on-disk tiers. * * Rationale: an MCP server runs as a long-lived process, so in-memory * is enough for normal use. But during dogfooding + CLI shim usage, * each invocation is a new process and needs to read snapshots written * by a prior invocation. The disk tier handles that case. * * Disk path: `$LOG10X_ADVISOR_STATE_DIR` or `$TMPDIR/log10x-advisor-snapshots`. * Files are `disc-.json`. Snapshots older than the TTL are * removed on every put. */ import type { DiscoverySnapshot, WizardSession } from './types.js'; /** Generate a fresh snapshot id. Exported for the probe orchestrator. */ export declare function newSnapshotId(): string; /** Put a finished snapshot in memory AND on disk. */ export declare function putSnapshot(snapshot: DiscoverySnapshot): string; /** Retrieve a snapshot, preferring memory. Falls through to disk on miss. */ export declare function getSnapshot(id: string): DiscoverySnapshot | undefined; /** * Get the wizard session attached to a snapshot, or undefined if no * session has been started yet. The session shares the snapshot's TTL. */ export declare function getWizardSession(id: string): WizardSession | undefined; /** * Merge a partial answer into the wizard session for a snapshot. Creates * the session on first call. Returns the merged session, or undefined if * the snapshot is missing/expired (caller should re-run discovery). * * Merge semantics: shallow per-key. Keys whose value is `undefined` in * `partial` are SKIPPED (they do not clear the existing value) — the * wizard's `next_question` actions carry only the field being answered * this turn, with every other field implicitly absent; a naive spread * would wipe previously-collected answers and trap the wizard in a loop * re-asking Q1. */ export declare function updateWizardSession(snapshotId: string, partial: Partial>): WizardSession | undefined; /** * Return the most recent non-expired snapshot from the in-memory store, * or undefined when the store is empty or all entries have expired. * * Used by tools that can benefit from a cached discover_env result without * requiring the caller to thread a snapshot_id explicitly. * * @param maxAgeSeconds - upper bound on snapshot age; defaults to 1800 (30 min, * matching TTL_MS). Callers that need fresher data can pass a smaller value. */ export declare function getMostRecentSnapshot(maxAgeSeconds?: number): DiscoverySnapshot | undefined; /** For tests. Does NOT wipe the disk tier — tests use process.env to redirect it. */ export declare function _clearSnapshotStore(): void;