The host passes the template's lines to the run (programLines), reports a fetch rejection the program let escape in phase fetch (by the run's error's kind), and reports a GPU batch's errors at its post's line and column (the frame request that carried it). scripts/report-check.ts checks the six cases' reports in headless Chromium. |
||
|---|---|---|
| .. | ||
| .cargo | ||
| crates | ||
| web | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| README.md | ||
| rust-toolchain.toml | ||
widgets-rs
OpenCode widgets' Rust hosts, as one Cargo workspace on PsychoScript's crates (anomalyco/psychoscript, rust/):
crates/widget-wire: the widget binary wire format (specs/v2/widgets-binary.md: the encoder from PsychoScript values and a bounds-checked decoder) and thewgslshorthand (shorthand:Shorthand,Uniforms,HEADER,SLOW_*) on psychoscript-gpu. GPU batches are psychoscript-gpu'sArgandBatch.crates/widget-mobile: the one native library each app ships (libwidget_mobile), psychoscript-mobile's UniFFI API plus the widget encoder andShaderCanvas(itsREADME.md).crates/widget-webandweb/: the browser host (itsREADME.md).
PsychoScript's crates
psychoscript, psychoscript-gpu and psychoscript-mobile come from crates.io ("0.1"; [workspace.dependencies] in
Cargo.toml and the crates' own manifests); bump them with cargo update -p <crate> and commit Cargo.lock. A
published crate can't carry PsychoScript's vendored wgpu-hal (wgpu-hal 30.0.2 plus the Metal fix of
gfx-rs/wgpu#10875: any command buffer that fails loses the device), so this workspace patches wgpu-hal to it
([patch.crates-io], by git at a commit of PsychoScript's dev) until a wgpu release has the fix.
Commands
Run from packages/widgets-rs, with the toolchain in rust-toolchain.toml (1.99.1):
cargo fmt --check
cargo clippy --locked --workspace --all-targets -- -D warnings
cargo test --locked --workspace # on a Mac: --features widget-wire/metal
The shorthand's tests (widget-wire/tests/shorthand.rs) run on Vulkan (lavapipe on a machine without a GPU, or a real
one), or on Metal with --features widget-wire/metal. widget-wire's tests read packages/widget/test/fixtures/wire
(the 58 native-host fixtures) and draw.json in place; widget-mobile's are in its README.md, Tests.
The apps' libraries are built by crates/widget-mobile/scripts/build-ios.sh and build-android.sh
(crates/widget-mobile/README.md, Building).