/**
 * The pure finite-state machine at the heart of the runtime.
 *
 * {@link step} takes the current immutable {@link RunSnapshot} and one incoming
 * {@link Signal}, and returns the next snapshot plus the {@link Effect}s a driver
 * must perform. It performs no I/O and never awaits; every transition derives a
 * fresh snapshot (the input is treated as frozen) and a flat list of effects.
 *
 * The agent loop is encoded as a transition table rather than nested control
 * flow:
 *
 *   submit                         → invoke_model              · phase invoking
 *   emission (text/thinking)       → fold + publish delta      · phase streaming
 *   emission (tool start/delta)    → fold + tool_started       · phase streaming
 *   emission (usage)               → accumulate usage          · (phase kept)
 *   emission (error)               → faulted                   · phase faulted
 *   stream_end · has tool calls    → run_tool × N              · phase dispatching
 *   stream_end · no tool calls     → persist + settled         · phase settled
 *   tool_settled · more pending    → (mark done, keep waiting) · phase dispatching
 *   tool_settled · all done        → append tool turn,         · phase invoking
 *                                     invoke_model (next turn)
 *   compacted                      → splice summary,           · phase invoking
 *                                     invoke_model
 *   abort                          → faulted (aborted)         · phase faulted
 *   fault                          → faulted                   · phase faulted
 *
 * Bind the machine to its static {@link AgentConfig} with {@link cadence}; the
 * returned function has the exact `(state, signal) => { state, effects }` shape.
 */
import type { AgentConfig, Effect, RunSnapshot, Signal } from "../contract";
/** The result of one transition: the next snapshot and the effects to run. */
export interface Transition {
    readonly state: RunSnapshot;
    readonly effects: Effect[];
}
/** A reducer bound to its static configuration. */
export type StepFn = (state: RunSnapshot, signal: Signal) => Transition;
/**
 * Build a clean starting snapshot for a session. Phase is `idle` until the
 * first `submit` signal arrives.
 */
export declare function initialSnapshot(sessionId: string, model: string, runId?: string): RunSnapshot;
/** A factory binding the FSM to its static config. */
export declare function cadence(config: AgentConfig): StepFn;
