Repository navigation
Run Schist in the browser - #90
Merged
Merged
Conversation
Schist now compiles to wasm32-unknown-unknown and runs as a static web page, on the gpui fork's new WebGPU backend (rev 75e6ffb). `make web` assembles dist/web/; docs/web.md documents the deployment, what works and what does not. The wasm carries no assets. The loading page (web/index.html + web/loader.js) fetches the module -- split into 4 MiB chunks for parallel downloads and a byte-accurate progress bar -- alongside the icons and the UI font, parks the bytes on window.__schist_boot, and instantiates; the Rust side reads the payload synchronously, so startup never grows an async asset path. The app's panic hook turns the loading page into an error card, so a crash during boot never reads as "still loading". The neural models moved from include_bytes! to files served under assets/models/, fetched on demand (streamed, with progress) into an in-memory store; the externally-hosted models are labelled unavailable, since their GitHub URLs redirect through a host that sends no CORS headers. Every neural filter already falls back to its classical path when a model is absent. Files keep their path-shaped flows over an in-memory map: Open raises a real file picker and stores the bytes under an invented path; Save and Export run the codec and leave as downloads, the browser's own prompt choosing the name (whose extension picks the format). Preferences persist in localStorage. Compositing runs on the CPU reference backend -- the GPU compositor's second wgpu device sits behind a blocking wait the browser's single thread cannot service -- and rayon degrades to sequential execution. Compiled out on wasm32, each for want of an OS facility: the AI sidebar (spawns agent CLIs), both plug-in hosts (helper subprocesses and dlopen; wasmtime is a JIT), HEIC (dlopen'd libheif), the self-updater, Sentry, and font downloads (the catalogue trick needs a spoofed legacy user agent to be served TTFs). Their menu entries are filtered out rather than left to fail. Two stubs (ai_stub.rs, update_stub.rs) keep the shared UI compiling; everything is cfg(target_arch), no feature matrix. Two latent wasm panics fixed on the way: codec-affinity's creation stamp used std's SystemTime::now(), which panics on this target (web-time now), and tract's getrandom needed the wasm_js backend. tools/web-build.sh pins wasm-bindgen-cli to Cargo.lock's version and refuses binaryen older than 116: Ubuntu's packaged 108 silently mangles the externref table rustc now emits, and the module then dies at init with "Table.grow(): failed to grow table". Verified: native cargo test --workspace, clippy and fmt all clean; the wasm target compiles warning-free; in headless Chromium the full boot path works end to end (chunked fetch, instantiation, all 13 first-party plugins, window open, overlay handoff, clean console at 60fps). This box only has SwiftShader WebGPU, which presents no pixels for gpui's own hello_web either, so the first rendered frame in a real browser is still owed. Co-Authored-By: Claude Fable 5 <[email protected]>
Two macOS failures in one script. `WASM_OPT_VER=$(wasm-opt --version …)` under `set -e` kills the whole build with a bare exit 127 when binaryen isn't installed at all — the probe now sits behind `command -v`, and a missing wasm-opt skips optimization with the same pointer at the binaryen releases page the too-old case prints. And BSD split has no `-d`, so the chunks now take alphabetic suffixes (.aaa, .aab, …), which sort exactly the same everywhere the manifest and loader care. Co-Authored-By: Claude Fable 5 <[email protected]>
On a first visit the loading page shows a card saying the web version is the lighter build (CPU compositing, no plug-ins/AI panel/HEIC/font downloads, saves are downloads) and links the desktop releases. OK records the acceptance in localStorage (schist.desktop-notice-accepted, an ISO timestamp) and the notice never shows again; a browser whose storage throws just sees it each visit. Pure loading-page DOM, so it is readable while the chunks are still downloading and costs the app nothing. Co-Authored-By: Claude Fable 5 <[email protected]>
A new Web workflow builds dist/web/ on every push to main and on PRs that could change it, uploading the result as an artifact either way; pushes to main then deploy it to Cloudflare Workers as an assets-only Worker. wrangler.jsonc names the Worker (schist-try) and binds the try.schist.app custom domain, so wrangler manages the DNS record and certificate itself. The build installs wasm-bindgen-cli at exactly the version Cargo.lock records (read from the lock, not pinned twice) and a known-good binaryen release, since Ubuntu's packaged 108 is the one tools/web-build.sh refuses. The deploy step is gated on the CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID secrets and skips itself politely where they don't exist, so forks and the pre-secret repository still get the full build and artifact. Verified locally: the workflow parses, both release downloads extract as written, and `wrangler deploy --dry-run` reads all 105 asset files without complaint. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Schist now compiles to
wasm32-unknown-unknownand runs as a static web page on the gpui fork's new WebGPU backend (rev75e6ffb).make webassembles the deployment intodist/web/; CI builds it on every push/PR and publishes main to try.schist.app via Cloudflare Workers. docs/web.md is the full write-up.How it loads
window.__schist_boot, and only then instantiates; the Rust side reads the payload synchronously, so startup never grows an async asset path.What works in a tab
Everything the kernel does: all tools, filters, adjustments, PSD/PSB/Affinity/PNG/JPEG/WebP/TIFF, text (fonts injected into both text systems), CPU compositing. Open raises a real file picker into an in-memory map behind the existing path-shaped flows; Save/Export leave as downloads with the browser prompt choosing the name (extension picks the format). Preferences live in localStorage. Neural models moved from
include_bytes!(11 MB) to files fetched on demand into an in-memory store, through the existing Manage Models dialog; the externally-hosted ones are labelled unavailable (their GitHub URLs redirect through a host that sends no CORS headers) and every neural filter already falls back to its classical path.What's compiled out, and why
AI sidebar (spawns agent CLIs), both plug-in hosts (subprocesses/dlopen; wasmtime is a JIT), HEIC (dlopen'd libheif), the self-updater, Sentry, font downloads (the catalogue trick needs a spoofed legacy UA to be served TTFs). Menu entries are filtered out rather than left to fail. Everything is
cfg(target_arch)— no feature matrix — with two small stubs keeping shared UI compiling.Build pipeline
tools/web-build.sh: a new[profile.web](release minus debuginfo — DWARF was a third of the bytes), wasm-bindgen pinned to Cargo.lock's exact version, wasm-opt behind a version gate — binaryen ≤108 (Ubuntu's package) silently corrupts the externref table rustc now emits and the module dies at init, so the script refuses anything older than 116 (123 verified: 45→28 MB) — then chunking and a manifest. Portable to macOS (BSD split, missing wasm-opt handled).Also fixed on the way: codec-affinity's export stamp used
SystemTime::now(), which panics on wasm (nowweb-time), and tract's getrandom needed thewasm_jsbackend.Verification
cargo test --workspace, clippy-D warnings-clean, fmt clean; wasm target compiles warning-free.hello_web, so rendered-frame verification happened on a real browser separately.wrangler deploy --dry-runvalidates the config; the deploy step skips itself politely until theCLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_IDsecrets exist.🤖 Generated with Claude Code