Without capture the wheel scrolls the page or transcript and is never delivered; under capture it
is { kind: "wheel", dx, dy }, where captured moves go, summed per frame. The Wheel type and the
wheel wire fixture lose x and y; the prelude is unchanged.
widgets-input.md specifies { kind: "wheel", x, y, dx, dy } in logical pixels (lines 40 px, pages
the canvas's size), summed per frame, delivered as move is, and { kind, dx, dy } under capture.
The prelude passes it to onPointer and leaves widget.pointer alone. Two wire fixtures (wheel,
wheel-captured) take the TypeScript host's outcome, as protocol 1's prelude doesn't know the event;
four fixtures' prelude line numbers move by 5.
A loss is a strike only if the run's GPU work finished on a device since its previous strike (or
its start): a recovery that discards each new device's first work lost Rune's device four times
and stopped an innocent widget. LiveWidget.loseDevice takes { inFlight, finished }; fixture loss
inputs carry finished; hang-one-reset-several-losses shows three losses in one reset stop nothing.
widgets-gpu.md drops the 30 ms aborted-work and 250 ms-at-loss rules, keeps the 250 ms unfinished
rule, and adds strikes: a device loss while a run has GPU work in flight is a strike, and two 30 s
apart or less stop every GPU canvas of the run ('the GPU work hung; the canvas is stopped').
LiveWidget.loseDevice takes inFlight and applies it; fixture loss inputs carry inFlight, and two
new fixtures show a stop and a loss with no work in flight being no strike.
Its 20,000 generated ops aren't recorded: "batches": "from-source" tells drivers to run the
source for them, as they run raw programs. The GPU fixtures go from 668,839 to 147,200 bytes.
As separate WebGPU calls would: resources made, writes and submits before it take effect; an
encoder or pass still open at op i is dropped. The host checks' handle state already does this;
error-keeps-the-ops-before-it shows a later batch using a handle the failed batch made.
Tests that don't prove the 250 ms step timeout or the 50 ms live slice run with limits no test
comes near (test/limits.ts); those that prove them set them. The post-rate test waits until all
30 renders are posted (a send marks it) instead of assuming the loop ends within a few turns.
20 full runs under load, all green.
widgets.md: a host never submits a shader frame while the previous one draws; one still
unfinished 50 ms after its submit three frames in a row stops on its last frame, a client error
'the shader took over 50 ms a frame, three frames in a row'.
Drag to look and hold still to walk, beside WASD and mouse-look; it starts facing the open
corridor. widgets-input.md says touch never grants pointer capture: touches stay absolute drags.
error-nan-rows-per-image (writeTexture rowsPerImage NaN) and error-infinite-depth-clear-value
(depthClearValue Infinity) fail where null would pass. Recorded batches write a number JSON can't
hold as { "$num": "NaN" | "Infinity" | "-Infinity" }, only there.
gpu.ts reads a batch's ops as native and web hosts do: an undefined list item is null, an undefined
member absent (copying only what changes). widgets-gpu.md says so in Transport and Host checks, and
defines a run restored from a snapshot as a device loss that keeps the greatest handle and the
stopped canvases. Two new raw GPU fixtures.
raw-bytes-not-an-array-buffer posts valid ops into scene with a Uint8Array for bytes (stops
["scene"]); raw-ops-not-a-list posts a string for ops (stops all). Raw fixtures of the wrong shape
keep their batches, with bytes null when they aren't an ArrayBuffer and ops as posted.
A copy from or into a canvas's texture, a write into it or a binding of a view of it fails
'<path> uses canvas "<key>"'s texture, which can only be rendered into' on every host, so the
web (RENDER_ATTACHMENT alone) and native hosts agree. configure's usage is ignored: the program's
canvas texture has usage RENDER_ATTACHMENT. Four new GPU fixtures.
batches now has each bare frame request in its place as { frame: true, ops: [], bytes: "" }, so a
driver replaying them ends each frame, and resets the per-frame counts, where the program did.
Only frame-counts-reset-at-a-bare-frame gains an entry.
widgets-gpu.md: a pass renders into a canvas through its resolveTarget too; a batch from before
the program learned of a device loss is dropped quietly; canvases are clamped to 4096 with their
aspect ratio kept; per-frame counts reset at every frame request; a canvas is cleared once per
frame; batch-shape checks may come from the host's conversion; a canvas an error stopped stays
stopped for the run and a new device doesn't restart it; validation messages are the GPU
implementation's own.
gpu.ts and LiveWidget follow, with five new GPU fixtures and a test for stopped canvases.
The widget packages pin psychoscript to rust b30b1c2, where typed arrays are opt-in; steps, draws,
live runs and compiles turn them on, and widgets.md lists the globals. The GPU and wire fixtures
regenerate unchanged; without the opt-in the GPU ones fail.
prelude-live.js holds widget (with widget.gpu) and __widget_live; a step widget template's program
is prelude + "\n" + source, a live one's prelude + "\n" + livePrelude + "\n" + source, and
versions hash the program as served. Lint reserves both preludes' names; positions stay
source-relative per mode. Steps compile and run faster than before widget.gpu.
Also lands the widgets-gpu.md changes 0786c7331 described but didn't carry: the live input's gpu,
the flag globals, the normalised op shapes, error ops, which canvases an error stops, Host checks
and Conformance; and widgets-live.md's rule that GPU batches never overtake waiting posts.
The prelude records WebGPU's API (devices, contexts by canvas key, resources, pipelines, bind
groups, command encoders and passes) into batches of ops and bytes with prelude-assigned handles
and every default filled in; batches ride frame requests, or go before other waits and at the
end. device.lost, unavailable GPUs and encoder misuse (error ops) are handled.
The TypeScript host (LiveWidget) passes { available, format } in the live input and checks
batches without a GPU: op shapes, handles and limits, with exact messages; an error stops the
canvases its batch renders into, else all. GPU batches never overtake waiting renders or draws.
widgets-gpu.md gains the normalised op shapes, the host checks and the conformance driver;
test/fixtures/gpu holds 34 fixtures, among them four example widget templates (a lit cube, a
textured quad, post-processing, a first-person maze).
widgets.md (Canvas, Draw command checks) states the rules: lengths before arguments, finite
numbers, alpha and stop offsets clamped to 0..1, text size to 1..512, a negative stroke width 0,
only the spec's weights, aligns and caps, a string text, an optional text style, null object
fields failing, extra elements failing, and the exact messages (draw command <i>: <reason>).
The TypeScript host checks with src/draw.ts instead of its schema and gives normalised commands;
test/fixtures/draw.json holds 89 cases, checked alone, through a draw step and a live draw.
One rule for every host: render and draw posts take tokens from a bucket of 8 refilled at 240 a
second; over it they wait, the latest render and the latest draw per canvas key replacing earlier
ones, and go out as tokens come, or all at once when the run ends (not on a client stop). Frame
requests are idempotent and never counted or dropped, so a 120 Hz game doesn't freeze; submit,
dismiss, capture and GPU batches aren't counted, and the post rate is no longer a program error.
A draw post without a string key is an invalid post; the TypeScript host's by-id draw path is gone.
Widget packages pin psychoscript to rust 7b09bac (limits.maxValueDepth); the TypeScript host runs
steps and live programs at 202, the depth of a 100-level view. Fixtures add 100-level views (one
with the deepest prop) and a 150-level one, and 101 now fails in the host's walk.
__widget_native_step hands a draw's commands to __widget_emit and returns nothing, so hosts skip
the result conversion; they read the commands as JSON would and check them as a draw output, with
the same failures. Tests hold draws of every built-in and edge cases to the last prelude's results.
The prelude keeps only protocol 2: __widget_native_step and the native live path, with handlers
found by path. The tree building, handler table and __widget_step go; tests hold the hosts to the
last prelude that had them (test/fixtures/scripted-prelude.js) and to the closure reference walk.
The spec keeps protocol 1 as history only, and says clients show protocol errors without a retry.
- __widget_native_step(__input()) hands the view to the host global __widget_emit and returns the
rest of the step output as the run's result, under its JSON rules; the TypeScript host uses it.
- The prelude's first line declares __widget_protocol = 2; hosts refuse older programs as a program
error (ask the agent to post it again) and newer ones as a client error.
- Keys are strings, numbers or booleans, and views nest at most 100 levels; both are program errors
in phase view, in the prelude's tree building and in native hosts. The boundary depth for 100
levels is 202.
- A function in a host call's argument anywhere but a node's handler props fails the call with the
runtime's TypeError, the view's included.
- Wire fixtures gain the run's result, failures, keys, depth and JSON edge cases.
step, draw and LiveWidget run programs from a bounded cache of compiled programs (Runtime.compile,
the 32 last used). LiveWidget's host functions throw through psychoscript/effect defects, so an
error for posting a function (or an unknown canvas key) reports the call's line and column, as the
interpreter's own argument errors do.
step, WidgetSession and LiveWidget run programs under translate.functions "mark" with the native
entry, build the tree in src/tree.ts (byte-identical to the wire fixtures), map live draw keys to
canvas ids, return from a render post whether its view has handlers, and fail functions where
none may go as the interpreter did. Widget packages pin psychoscript to rust c630d87.
A host that passes true to __widget_step / __widget_live gets views with handler functions as
psychoscript function markers, assigns path ids itself and returns from a render post whether the
view has handlers; the prelude finds handlers by following an id's path, and live draws post the
canvas key. Without true the prelude builds the tree as before, so wire views are unchanged.
The spec defines the algorithm; the wire fixtures gain the view as built and edge cases, and
tests check both modes against them.
pie, scatter, histogram, area, heatmap, treemap, sankey, graph, tree,
timeline, funnel, radar, gauge, boxplot, flowchart, sequence and table:
canvas templates with JSON Schemas, alt summaries, theme colors, an
animated intro, tap selection and an optional Choose button. Layouts
that don't depend on the canvas size (force layout, Sankey, layered
flowchart, bins, quartiles) are computed once in init.