/**
 * Atomic, versioned, per-session sidecar store for `/loop` state.
 *
 * Persistence (temp file + rename, per-file mutation serialization, envelope
 * version/session checks) lives in the shared session sidecar primitive. This
 * module supplies the loop domain parser and keeps the historical exported
 * surface so callers continue to catch {@link InvalidLoopStoreError} /
 * {@link UnsupportedLoopStoreVersionError} by name.
 *
 * Session custom entries are deliberately NOT the authoritative store: they are branch
 * nodes, so a globally scanned "latest" entry can come from an abandoned branch, while
 * loop schedules are session-scoped.
 */
import { InvalidSidecarStoreError, UnsupportedSidecarStoreVersionError } from "../../../session-sidecar-store.ts";
import { type LoopState, type LoopStoreRef } from "./types.ts";
export declare class InvalidLoopStoreError extends InvalidSidecarStoreError {
    constructor(message: string, options?: {
        cause?: unknown;
    });
}
export declare class UnsupportedLoopStoreVersionError extends UnsupportedSidecarStoreVersionError {
    constructor(message: string);
}
/** Mutation callback. May be async; its result becomes the next persisted state. */
export type LoopStateMutation = (current: LoopState) => LoopState | Promise<LoopState>;
export declare function encodedSessionId(ref: LoopStoreRef): string;
export declare function loopStateFilePath(ref: LoopStoreRef): string;
export declare function emptyLoopState(sessionId: string): LoopState;
/**
 * Reads persisted state, or null when this session has never persisted any loop.
 * Throws {@link InvalidLoopStoreError} / {@link UnsupportedLoopStoreVersionError} on
 * unusable state so callers fail closed rather than resetting a user's schedule.
 */
export declare function readLoopState(ref: LoopStoreRef): Promise<LoopState | null>;
/** Like {@link readLoopState}, but returns an empty state when nothing is persisted. */
export declare function loadLoopState(ref: LoopStoreRef): Promise<LoopState>;
/**
 * Last successfully loaded or written state for this ref, for synchronous consumers
 * (status line, tick attribution). Undefined until the store has been touched.
 */
export declare function snapshotLoopState(ref: LoopStoreRef): LoopState | undefined;
/**
 * Serializes read-modify-write cycles through a per-file promise tail so command,
 * timer, tool, and lifecycle writes cannot interleave and lose an update.
 */
export declare function mutateLoopState(ref: LoopStoreRef, mutation: LoopStateMutation): Promise<LoopState>;
/** Persists a complete state atomically. Prefer {@link mutateLoopState} for updates. */
export declare function writeLoopState(ref: LoopStoreRef, state: LoopState): Promise<void>;
/** Drops cached snapshots; used when a session ends or tests reset global state. */
export declare function clearLoopStateSnapshot(ref: LoopStoreRef): void;
//# sourceMappingURL=store.d.ts.map