import { type Step } from "./engine.ts"; import type { Event, Run, ScenarioInfo, Spec, World } from "./spec.ts"; /** Most events one settle runs: left alone, a retry loop never ends by itself. */ export declare const SETTLE_LIMIT = 200; export declare class Runner { readonly spec: Spec; readonly seed: number; readonly events: Event[]; readonly worlds: World[]; readonly initial: World; private current; constructor(spec: Spec, seed?: number, /** Where to start; by default the spec's start, where the singletons exist, in their initial state. */ initial?: World); get world(): World; apply(step: Step): Event; spawn(actor: string, label: string): Event; act(instance: string, key: string, inputs?: Record): Event; /** What the system does next left alone: a fair guarded transition that holds, else the next message, else the next timer. A step with `fair: false`, such as a fault, waits to be asked for. */ next(): Event | null; /** Leave the system alone until nothing is pending, or for SETTLE_LIMIT events. */ settle(): void; /** Leave the system alone until `until` holds; an error if it settles, or runs SETTLE_LIMIT events, first. */ settleUntil(until: (world: World) => boolean): void; /** Fire an instance's timer now, ahead of anything in flight. */ fireTimer(instance: string, timer: string): Event; /** A message in flight to `instance`: the oldest named `message`, or the oldest carrying `payload`. */ inFlight(instance: string, message: string, payload?: unknown): number; deliver(instance: string, message: string, payload?: unknown): Event; /** One of an instance's steps, by name: on a message, it takes the oldest it is on in flight; else a guard. */ step(instance: string, name: string, payload?: unknown): Event; guard(instance: string, transition: string): Event; run(): Run; } /** Run a scenario, from the world its setup sets, or from the spec's start. */ export declare function runScenario(spec: Spec, scenario: ScenarioInfo, seed?: number): Run & { error?: string; }; /** The world a scenario starts in: the spec's start, with the scenario's setup applied. */ export declare function scenarioStart(spec: Spec, scenario: ScenarioInfo, seed?: number): World;