/** * AppLifecycle — XState v5 machine modelling the Remix IDE boot sequence. * * The machine tracks which boot phase we're in and maintains a context with * the set of activated plugins, fired events, and failure info. * * The EventGuard system (event-guard.ts) sits alongside this machine and * provides the combinator-based prerequisite API (all/any/sequence/when/waitFor). * The machine drives phase transitions; the EventGuard drives fine-grained * prerequisite callbacks. */ import { EventGuard } from './event-guard'; import type { LifecycleEvent } from './types'; /** * High-level facade that bundles the XState machine (phase tracking) * with the EventGuard (prerequisite combinators). * * Usage: * const lifecycle = new AppLifecycle() * lifecycle.when(all('EDITOR_MOUNTED', 'WORKSPACE_INITIALIZED'), () => { ... }) * lifecycle.send({ type: 'PLUGIN_ACTIVATED', name: 'editor' }) * await lifecycle.waitFor(all('EDITOR_MOUNTED')) */ export declare class AppLifecycle { private actor; private guard; private listeners; private debug; constructor(options?: { debug?: boolean; }); /** * Send an event to both the XState machine and the EventGuard. * This is the single entry point for all lifecycle events. */ send(event: LifecycleEvent): void; /** Register a callback when condition is met. Returns unsubscribe fn. */ when(...args: Parameters): ReturnType; /** Promise that resolves when condition is met */ waitFor(...args: Parameters): ReturnType; /** Synchronous check if a specific event has fired */ has(eventId: string): boolean; /** Get all fired event IDs */ getFiredEvents(): string[]; /** Get the current boot phase */ getPhase(): string; /** Get the full XState state value */ getStateValue(): string; /** Get the set of activated plugin names */ getActivatedPlugins(): string[]; /** Get plugins that failed to activate */ getFailedPlugins(): Record; /** Subscribe to phase changes */ onPhaseChange(listener: (phase: string) => void): () => void; /** Stop the machine (cleanup) */ stop(): void; }