/** * The host half of the screen engine: one sealed VM, one running screen. * * A generated screen is a React component. This runs it — really runs it, real * Preact, real hooks, real re-renders — inside a QuickJS WebAssembly VM, and * hands back DATA: the tree it painted and the tool calls its handlers asked * for. The screen has no DOM, no network, no clock and no host object, because * none of them exist in there. It is the same seal `$expr` keeps (../expr.ts) * with the same variant and the same discipline; this is its sibling, sized for * a component instead of an expression. * * THE SHAPE OF A TURN. Everything is synchronous, and every turn is the same * three steps: push something in (mount, an event, a tool's answer), drain * everything the screen scheduled off the back of it, read the paint out. The * drain is where Preact's state updates and passive effects run — pointed at an * in-VM queue this file pumps (./vm-program.ts), so a `setState` inside a * handler has already landed by the time `fire` returns. * * THE BUDGET IS THE VENUE'S TO CHOOSE. A deadline is the question actually * being asked — until the venue is one that freezes the clock while a screen * burns, where it is a question that can only be answered "not yet". So the * limit arrives as a {@link ScreenBudget} (./budget.ts): wall-clock by default, * interrupt counts where the clock does not move. * * A THROW LEAVES THE SCREEN STANDING. A handler that throws, or that never * finishes, raises a {@link ScreenError} out of `fire` — and the instance stays * usable, still showing the tree it last painted. That is the honest answer for * a surface: one broken button does not take the screen down. The exception is * `kind: "vm"`, where the VM itself failed and nothing in it can be trusted. */ import { newQuickJSWASMModuleFromVariant } from "quickjs-emscripten-core"; import { type BootScreenOptions, type ScreenInstance } from "./types.js"; /** Which QuickJS build the engine runs on — the argument the module factory * takes, so a host may hand over a variant it loaded its own way. */ export type ScreenEngineVariant = Parameters[0]; /** * Load the WebAssembly. Running a screen is synchronous — this one-time load is * not, so a caller awaits it once before the first {@link bootScreen}. * * The default variant is the WASMFILE build with the WebAssembly handed in as * bytes — ../variant.ts holds it and says why the bytes may not ride inside the * JavaScript. * * A venue that cannot run that build passes its own, and it STICKS: every later * default warm is a no-op, and a default already in flight lands nowhere. That * is what a venue with no network and no asset URL needs — genbench's offline * single-bundle page, workerd's deploy-time module — because the host warms * once and every library-side warm after it must honour that, not race it. * * The memo is keyed on the variant itself, so warming one twice loads it once. * `stock` is held for the same reason: the default needs one stable key, not a * fresh variant per call. */ export declare function warmScreenEngine(variant?: ScreenEngineVariant): Promise; /** * Boot one screen. Synchronous, and long-lived: the VM, the component and its * hook state stay alive until {@link ScreenInstance.dispose}, because a screen * that reboots between clicks has no state and therefore no dialogs, no * selections and no drafts. */ export declare function bootScreen(options: BootScreenOptions): ScreenInstance; //# sourceMappingURL=boot.d.ts.map