import type * as http from 'http'; /** * A marker the creator (or their agent) drops to hold every reload — the file watcher's and * `bitmagic reload`'s alike — for as long as it exists. Relative to the project root. * * It exists for one situation: a multiplayer room that must survive an agent's turn. Every reload * re-creates the game in every connected page, phones included, and a networked game re-created * is a new player id in a new room. Held reloads are dropped, not deferred: the next reload after * the marker goes shows the current build, and nothing fires by itself when it is removed. */ export declare const HOLD_RELOAD_FILE: string; export declare function holdReloadPath(root: string): string; export type BuildStatus = 'building' | 'ok' | 'failed'; export type SubscriberKind = 'shell' | 'phone'; export declare class ReloadBus { private readonly clients; private readonly keepalive; /** Absolute path of the hold marker, or null when this bus never holds (tests, embedding). */ private readonly holdFile; /** One per process: the shell compares it across reconnects to notice a restarted `dev`. */ readonly session: string; /** Fired on every 0→1 transition of the shell count — "a tab is watching this server". */ onShellAttached: (() => void) | null; /** A reload was asked for and dropped because the hold marker exists. For the dev console. */ onHeld: ((reason: string) => void) | null; constructor(options?: { session?: string; holdFile?: string; }); get clientCount(): number; /** Browser tabs on the dev view, phones excluded. */ get shellClientCount(): number; /** * Take over a request as an SSE stream. Never ends the response — it stays open until the browser * navigates away or the server closes. */ subscribe(req: http.IncomingMessage, res: http.ServerResponse, kind?: SubscriberKind): void; send(event: string, data: unknown): void; /** Is the hold marker in place right now? Checked per reload, so it needs no watcher. */ get held(): boolean; /** Push a reload to every subscriber — unless held, in which case nothing goes out. */ reload(reason: string): boolean; build(status: BuildStatus, message?: string): void; close(): void; }