import { type Fsm, type StepResult } from './fsm.js';
export interface FsmHistoryEntry {
    state: string;
    /** ISO-8601 timestamp the machine ENTERED this state. */
    at: string;
}
export interface FsmStateFile {
    state: string;
    /** ISO timestamp the machine entered the CURRENT state. */
    started_at: string;
    /** Append-only audit trail of every state entered. */
    history: FsmHistoryEntry[];
}
/**
 * Read the persisted current state for `(session, pack)`. Defaults to
 * `fsm.initial` when absent/unreadable/malformed, OR when the persisted state
 * is no longer a declared state (the pack's FSM changed) — a self-healing
 * no-throw read matching `readChainStage`.
 */
export declare function readFsmState(sessionId: string, packName: string, fsm: Fsm): Promise<string>;
/**
 * Advance `(session, pack)`'s FSM on `event`. Reads the current state, runs the
 * total `step`, and — ONLY when the state actually transitions — persists the
 * new state + appends to history. A no-op event (no matching transition, or a
 * guard that fails) leaves the file untouched and returns `transitioned:false`.
 * Returns the full `StepResult` so the caller can react to `via`/`transitioned`.
 *
 * `now` (ISO string) is supplied by the caller for determinism; `evalWhen`
 * evaluates a transition's `when` guard (caller wires the expression engine).
 */
export declare function advanceFsmState(sessionId: string, packName: string, fsm: Fsm, event: string, now: string, evalWhen?: (expr: string) => boolean): Promise<StepResult>;
/**
 * Read the persisted state string for `(session, pack)` WITHOUT needing the
 * pack's FSM definition — for CROSS-PACK reads where one pack's rule queries
 * another pack's lifecycle state (e.g. a pack gating on the workflow stage).
 * Returns null when the machine hasn't started (file absent) or is unreadable,
 * so the caller distinguishes "no state yet" from any concrete state.
 */
export declare function readFsmStateRaw(sessionId: string, packName: string): Promise<string | null>;
/** Remove a pack's FSM-state file (SessionEnd cleanup). ENOENT swallowed. */
export declare function clearFsmState(sessionId: string, packName: string): Promise<void>;
//# sourceMappingURL=fsm_state.d.ts.map