Commit graph

8 commits

Author SHA1 Message Date
Sebastian Herrlinger
65797cd22f docs(specs): widgets-gpu's host side points to psychoscript-gpu's README
The batch format, canvas size, limits, host checks and the generic errors and device loss rules moved to
anomalyco/psychoscript rust/crates/psychoscript-gpu/README.md; widgets-gpu.md keeps the program side, the widget
messages, the wgsl shorthand and conformance. The mobile clients are widget-mobile (packages/widgets-rs) on
psychoscript-mobile and psychoscript-gpu.
2026-11-26 15:32:10 +01:00
OpenCode Agent
0786c7331c feat(core): widget.gpu, the WebGPU subset for live widgets, with host checks and conformance fixtures
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).
2026-11-22 23:51:45 +00:00
OpenCode Agent
cb1e19652c feat(core): one draw command check for every host, with shared fixtures
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.
2026-11-22 22:53:00 +00:00
OpenCode Agent
0f5e90b8d9 perf(core): native draw steps emit their commands instead of returning them
__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.
2026-11-22 14:08:45 +00:00
OpenCode Agent
523750c6a1 feat(core): widget protocol 2: split native step output, keys and depth rules, function rule
- __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.
2026-11-22 13:25:02 +00:00
OpenCode Agent
60732569af feat(core): native widget hosts build the view tree; the prelude hands them views as built
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.
2026-11-22 03:08:29 +00:00
OpenCode Agent
752e20b710 docs(specs): binary encoding failures follow today's invalid-output rules; standalone GPU batch kind 2026-11-22 02:01:01 +00:00
OpenCode Agent
ec09010ed4 docs(specs): binary format for widget step outputs and live posts on mobile 2026-11-22 01:52:27 +00:00