Genhub gen dolt wasm - #219
Open
bobvh wants to merge 12 commits into
Open
Conversation
bobvh
force-pushed
the
genhub-gen-dolt-wasm
branch
from
July 22, 2026 17:56
acdf7a4 to
098f19f
Compare
bobvh
force-pushed
the
genhub-gen-dolt-wasm
branch
from
July 29, 2026 02:31
2842d75 to
415b952
Compare
Compile out opendal/tokio thread-spawning and other host-only dependencies for wasm32-unknown-emscripten, and fix the indicatif steady-tick thread spawn and LocalFsLocation::checksum return type mismatch that surfaced under that target.
Point rusqdoltlite at bobvh/rusqdoltlite, which carries the Emscripten Fetch transport and an fcntl fix needed for the wasm target, ending on the 0.40.14 version-bumped rev.
Add a browser HTTP transport built on Emscripten Fetch alongside the existing native transport, an emscripten-http-test command to exercise it directly, and wire remote::client/operations onto the new transport. Move normalized_origin into utils so it is available without depending on the native-only client module.
Add the browser login flow (popup + Cockle host bridge callback, falling back to a clickable link if the popup is blocked) alongside the existing native localhost-callback flow, and drop the emscripten stubs that returned "not supported in this build" for clone/push/pull now that the browser HTTP transport carries real dolt data transfer.
Add a crossterm event-type shim and select()-based input handling where the native terminal/TTY APIs are unavailable, and route inline/full-screen gen view, view-diff, and operations --interactive through the emscripten backend. Unregister stale service workers on protocol version mismatch so a rebuilt wasm-cli page doesn't get served stale assets.
Persist uploaded files to IndexedDB via a DriveFS-backed coincident worker bridge so they survive across terminal sessions, instead of living only in the in-memory MEMFS the emscripten build starts with.
Add the wasm32-unknown-emscripten build (make wasm/wasm-test), pull in cockle's coreutils/grep/less/sed/cockle_fs wasm packages through micromamba on the emsdk toolchain, and wire the resulting bundle into a static wasm-cli/ page.
Bundle JetBrains Mono and a WebGL renderer, add Catppuccin light/dark theming with a toggle, a PIN entry prompt, and polish the intro copy and prompt colorization.
Spell out the shim re-export list instead of a wildcard, move the native-only reqwest import to module scope behind its target cfg instead of importing it inside the function body, bring serde_json's free functions into scope instead of calling them qualified, prefer core:: over std:: for error::Error and str::FromStr, and fix expect() messages to start with "should".
bobvh
force-pushed
the
genhub-gen-dolt-wasm
branch
from
August 4, 2026 19:43
415b952 to
faf677f
Compare
cockle joins wasmBaseUrl with asset filenames via plain string concatenation, not URL resolution, so passing the raw page href broke whenever the terminal was reached via an explicit filename (e.g. ".../demo/index.html") rather than a directory URL. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KbS8hvkPMejvt8LaJVDshu
…ands The intro copy explaining what the terminal is lives with whoever embeds it (e.g. GenHub's /terminal page), not this page, so it had no business hardcoding a single "gen --help" link. Generalizes the postMessage bridge to run any list of commands (gen-wasm-cli:run-commands) and adds a gen-wasm-cli:ready message so an embedder can also run commands automatically once the terminal loads, not just on click. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KbS8hvkPMejvt8LaJVDshu
The terminal is now embedded as a React component in GenHub, which has its own light/dark setting -- a second, independent toggle inside the iframe was redundant and could disagree with it. selectThemeMode now reads an initial ?theme=light|dark query param (falling back to prefers-color-scheme when opened standalone, e.g. make wasm-test), and a new gen-wasm-cli:set-theme postMessage lets the embedding page switch it live. applyThemeBackground now just toggles a data-theme attribute that style/demo.css's CSS variables already key off of, rather than hardcoding a handful of element ids -- which also fixes the upload bar not picking up theme changes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KbS8hvkPMejvt8LaJVDshu
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.
End product is gen running in the browser, all commands including views, and dolt clone/push/pull working against a live server. Build target is wasm32-unknown-emscripten, which gives you a POSIX-ish environment (threads, a filesystem, subprocess-like semantics) rather than wasm32-unknown-unknown target from earlier experiments and potential future work with Pyodide.
Everything that had to change fell into these buckets:
Dependency graph. A number of crates in gen's dependency tree assume things like real threads, real sockets, an async I/O reactor that don't exist in the browser's single-threaded WASM sandbox. Anything transitively depending on this had no emscripten backend at all and had to be conditionally excluded from the browser build, with slimmed-down or alternate implementations swapped in only where the browser build actually needed the functionality (e.g., a different source of randomness, a different SQLite journaling mode that doesn't rely on memory-mapped lock files).
The C backend from Dolt is compiled as part of the build. Patches were needed to get it to compile at all under emscripten's C library (subtle POSIX header differences caused build failures), and separately, once it compiled, its networking code didn't work in a browser -> see bucket 3.
Transport. Two independent pieces of gen talk over HTTP: gen's own Rust-level control-plane traffic (login, authorization, asset transfer) and the C backend's data-plane traffic (the actual database chunk protocol used by clone/push/pull). Both used networking mechanisms (an HTTP client library and raw sockets with TLS) that were replaced by the browser's native fetch mechanism instead.
Ratatui. Keyboard/mouse input handling without OS-level event-polling (and other things provided by crossterm). I abstracted most of this away into tui-runtime.rs.