import { XPEvent } from '../events'; import { FlagValue } from '../scenario/types'; import { ConditionTrace } from '../scenario/trace'; /** A named beat and the tape index that reaches it. */ export interface RehearsalBeat { beat: string; index: number; } /** The rehearsal cursor as the seek bar renders it. */ export interface RehearsalState { /** Whether a rehearsal is in progress (the live save is being previewed). */ active: boolean; /** Current tape index (−1 = before the first step / pristine start). */ index: number; /** Total number of steps on the tape. */ length: number; /** Named beats in tape order (seek targets). */ beats: RehearsalBeat[]; } /** One trigger's current authoring/debug state, independent of a matching event. */ export interface ScenarioTriggerState { id: string; index: number; on: string | string[]; fireCount: number; budgetAvailable: boolean; when: ConditionTrace; } /** Serializable runtime state exposed to authoring tools through XPHandle. */ export interface ScenarioDebugState { scenarioId: string | null; flags: Record; fires: Record; journalLength: number; lastEvent?: XPEvent; pending: string[]; rehearsal: RehearsalState; triggers: ScenarioTriggerState[]; } /** The imperative surface the ScenarioRunner exposes to seek-bar consumers. */ export interface RehearsalController { /** Jump to a named beat's state; returns false if the beat is unknown. */ seekTo: (beat: string) => boolean; /** Jump to a tape index (clamped; −1 = pristine start). */ seekToIndex: (index: number) => void; /** Step one beat back (re-solve the shorter prefix). */ stepBack: () => void; /** Step one beat forward. */ stepForward: () => void; /** Leave rehearsal and restore the pre-rehearsal live save. */ exitRehearsal: () => void; /** The current cursor (for a consumer that mounts mid-session). */ getState: () => RehearsalState; /** Set one authoring flag and emit the same flag:change event as scenario actions. */ setFlag: (flag: string, value: FlagValue) => boolean; /** Inspect flags, fire budgets, and condition traces without touching runtime state. */ getDebugState: () => ScenarioDebugState; } /** Register the runner's controller for `prefix`; returns an unregister fn. */ export declare const registerRehearsalController: (prefix: string, controller: RehearsalController) => (() => void); /** The controller registered on `prefix`, or null (no scenario / not mounted). */ export declare const getRehearsalController: (prefix: string) => RehearsalController | null; /** Publish the current rehearsal state to everyone listening on `prefix`. */ export declare const publishRehearsalState: (prefix: string, state: RehearsalState) => void; /** Subscribe to rehearsal-state updates on `prefix`; returns an unsubscribe fn. */ export declare const subscribeRehearsalState: (prefix: string, fn: (state: RehearsalState) => void) => (() => void);