/** * Mode State I/O Layer * * Canonical read/write/clear operations for mode state files. * Centralises path resolution, ghost-legacy cleanup, directory creation, * and file permissions so that individual mode modules don't duplicate this logic. */ export declare function getStateSessionOwner(state: Record | null | undefined): string | undefined; export declare function canClearStateForSession(state: Record | null | undefined, sessionId: string): boolean; /** * Write mode state to disk. * * - Ensures parent directories exist. * - Writes with mode 0o600 (owner-only) for security. * - Adds `_meta` envelope with write timestamp. * * @returns true on success, false on failure */ export declare function writeModeState(mode: string, state: Record, directory?: string, sessionId?: string): boolean; /** * Read mode state from disk. * * When sessionId is provided, ONLY reads the session-scoped file (no legacy fallback) * to prevent cross-session state leakage. * * Strips the `_meta` envelope so callers get the original state shape. * Handles files written before _meta was introduced (no-op strip). * * @returns The parsed state (without _meta) or null if not found / unreadable. */ export declare function readModeState>(mode: string, directory?: string, sessionId?: string): T | null; /** * Clear (delete) a mode state file from disk. * * When sessionId is provided: * 1. Deletes the session-scoped file. * 2. Ghost-legacy cleanup: also removes the legacy file if it belongs to * this session or has no session_id (orphaned). * * @returns true on success (or file already absent), false on failure. */ export declare function clearModeStateFile(mode: string, directory?: string, sessionId?: string): boolean; //# sourceMappingURL=mode-state-io.d.ts.map