/** * State persistence utilities for CLI state machines * * Enables saving and loading machine snapshots for resume functionality. */ import type { AnyStateMachine, SnapshotFrom } from 'xstate'; /** * Persisted state structure */ export interface PersistedState { /** Machine ID this state belongs to */ machineId: string; /** Version for migration support */ version: number; /** Timestamp when state was saved */ savedAt: number; /** The actual snapshot data */ snapshot: T; } /** * Get the persistence file path for a project */ export declare const getPersistPath: (projectRoot: string) => string; /** * Save a machine snapshot to disk */ export declare const saveSnapshot: (snapshot: SnapshotFrom, machineId: string, persistPath: string) => Promise; /** * Load a machine snapshot from disk * * @returns The snapshot if found and valid, null otherwise */ /** * Clear a persisted snapshot */ export declare const clearSnapshot: (persistPath: string) => Promise; export declare const loadSnapshot: (persistPath: string, machineId: string) => Promise; /** * Check if a persisted state exists */ export declare const hasPersistedState: (persistPath: string) => Promise; /** * Get metadata about persisted state without loading full snapshot */ export declare const getPersistedStateInfo: (persistPath: string) => Promise<{ machineId: string; savedAt: Date; } | null>; /** * Snapshot type for persistence subscriber */ interface PersistableSnapshot { value: unknown; } /** * Create a persistence middleware that auto-saves on state transitions */ export declare const createPersistenceSubscriber: (machineId: string, persistPath: string, options?: { /** States to persist (if not provided, persist all states) */ persistStates?: string[]; /** States to skip persisting */ skipStates?: string[]; }) => ((snapshot: PersistableSnapshot) => void) & { flush: () => Promise; }; /** Reattaches runtime services to restored machine context and invoked actor inputs. */ export declare const rehydrateSnapshot: (snapshot: unknown, cliContext: unknown) => void; export {};