/**
 * T-PACK-FSM-STANDARDIZATION slice A — the generic total-transition FSM engine.
 *
 * The capstone thesis is that a pack's lifecycle is an EXPLICIT TOTAL-TRANSITION
 * FSM. Today the only "FSM" (`chain_state.ts`) is a single global stage tracker
 * whose `transitionChainStage` accepts ANY target with no legality matrix — it
 * is NOT total and cannot loop back. This module is the generic engine that
 * replaces that: a pure, pack-declarable FSM with validated transitions.
 *
 * Two pure pieces:
 *   - `validateFsm(fsm)` — load-time checks: `initial` and every transition's
 *     `from`/`to` reference a declared state; no transition targets an
 *     undefined state. Returns the list of errors (empty = valid). This is what
 *     makes the machine TOTAL-by-construction: every reachable transition lands
 *     on a real state, and the runner defines an outcome for EVERY (state,event)
 *     pair (a matching transition, else an explicit stay).
 *   - `step(fsm, current, event, evalWhen?)` — the transition function. Total:
 *     returns a defined next-state for every input. No I/O; the optional
 *     `when` guard is evaluated through an injected `evalWhen` (the caller wires
 *     the expression engine) so this module stays pure + testable.
 *
 * Unlike `chain_state`, transitions here are DECLARED data, support `*` (any
 * source) and a `when` guard, and can LOOP BACK (e.g. `researching --guess-->
 * researching`) — the edge the scope guess-prevention gate (slice C) needs.
 *
 * Imports: zod only. Imported by: slice A2 (runtime integration), slice C
 * (scope FSM), tests.
 */
import { z } from 'zod';
/** A wildcard `from` matching any current state. */
export declare const ANY_STATE: "*";
export declare const Transition: z.ZodObject<{
    /** Source state name, or `*` to match any current state. */
    from: z.ZodString;
    /** Event name that fires this transition. */
    on: z.ZodString;
    /** Target state — MUST be a declared state (validateFsm enforces). */
    to: z.ZodString;
    /** Optional `if:`-expression guard; evaluated via the injected evalWhen. */
    when: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
    from: string;
    to: string;
    on: string;
    when?: string | undefined;
}, {
    from: string;
    to: string;
    on: string;
    when?: string | undefined;
}>;
export type Transition = z.infer<typeof Transition>;
export declare const Fsm: z.ZodObject<{
    initial: z.ZodString;
    states: z.ZodArray<z.ZodString, "many">;
    transitions: z.ZodDefault<z.ZodArray<z.ZodObject<{
        /** Source state name, or `*` to match any current state. */
        from: z.ZodString;
        /** Event name that fires this transition. */
        on: z.ZodString;
        /** Target state — MUST be a declared state (validateFsm enforces). */
        to: z.ZodString;
        /** Optional `if:`-expression guard; evaluated via the injected evalWhen. */
        when: z.ZodOptional<z.ZodString>;
    }, "strict", z.ZodTypeAny, {
        from: string;
        to: string;
        on: string;
        when?: string | undefined;
    }, {
        from: string;
        to: string;
        on: string;
        when?: string | undefined;
    }>, "many">>;
}, "strict", z.ZodTypeAny, {
    initial: string;
    states: string[];
    transitions: {
        from: string;
        to: string;
        on: string;
        when?: string | undefined;
    }[];
}, {
    initial: string;
    states: string[];
    transitions?: {
        from: string;
        to: string;
        on: string;
        when?: string | undefined;
    }[] | undefined;
}>;
export type Fsm = z.infer<typeof Fsm>;
/**
 * Load-time validation. Returns a (possibly empty) list of human-readable
 * errors. The machine is TOTAL by construction once these pass: the runner
 * defines an outcome for every (state, event), and every declared transition
 * lands on a real state.
 */
export declare function validateFsm(fsm: Fsm): string[];
export interface StepResult {
    /** The next state (== current when no transition matched — total/explicit stay). */
    next: string;
    /** True iff a transition actually moved to a different state. */
    transitioned: boolean;
    /** The id (index) of the transition taken, or null for the stay default. */
    via: number | null;
}
/**
 * The transition function — TOTAL: returns a defined next-state for every
 * (current, event). Finds the FIRST transition whose `from` matches (exact or
 * `*`), whose `on` equals `event`, and whose `when` guard (if any) holds.
 * No match → stay in `current` (the explicit default — no implicit/undefined
 * state). `evalWhen` evaluates a guard expression; omitted → guards are treated
 * as satisfied (caller opted out of guard evaluation).
 */
export declare function step(fsm: Fsm, current: string, event: string, evalWhen?: (expr: string) => boolean): StepResult;
//# sourceMappingURL=fsm.d.ts.map