Skip to content

Add R/WebAssembly#37

Open
bbbruce wants to merge 5 commits into
mainfrom
bbb-add-rwasm
Open

Add R/WebAssembly#37
bbbruce wants to merge 5 commits into
mainfrom
bbb-add-rwasm

Conversation

@bbbruce

@bbbruce bbbruce commented May 1, 2026

Copy link
Copy Markdown

Summary

Adds R/rwasm to existing Python/Pyodide and Rust/WASM flows.

Changes

  • Adds @cfasim-ui/rwasm runtime support for loading R models in the browser.
  • Adds the shared cfasim R helper package for model output construction.
  • Adds cfasim init --template R with a minimal R package model and interactive Vue app.
  • Adds an R example to the models app with Playwright coverage.
  • Adds R/rwasm docs.

Validation

  • Pre-commit and vitest suite passed.
  • Scaffold/render Playwright coverage passed locally.

@bbbruce bbbruce requested a review from k88hudson-cfa May 1, 2026 18:06
@bbbruce bbbruce self-assigned this May 1, 2026
@bbbruce bbbruce force-pushed the bbb-add-rwasm branch 9 times, most recently from bb64fdc to 40c6a37 Compare June 9, 2026 12:30
@bbbruce bbbruce force-pushed the bbb-add-rwasm branch 5 times, most recently from cceddce to 149d466 Compare June 26, 2026 13:28
@bbbruce

bbbruce commented Jun 26, 2026

Copy link
Copy Markdown
Author

@k88hudson-cfa - this should be ready for your review again - there are 5 staged commits that I hope will ease review. The largest commit, feat(rwasm): add R browser runtime package, adds the core browser runtime for R models. It introduces @cfasim-ui/rwasm, modeled after the existing Pyodide/WASM runtime package shape: public runtime exports, a worker API, a Vue useModel hook, and a Vite plugin.

The Vite plugin builds a static webR bundle: it copies the R model source, builds the bundled cfasim R helper package plus the user model/external R packages into a webR-compatible repository via Docker/rwasm, writes a manifest under public/rwasm/{name}, and hosts matching webR runtime assets locally. It also detects R package metadata from DESCRIPTION, supports multiline Imports/Depends, and caches Docker package builds using content hashes so expensive packages are not rebuilt when inputs have not changed.

The worker mirrors the Pyodide request/response pattern: each request has an id, responses are routed back to the correct promise, model/session loads are cached, worker crashes drain pending requests through deadError, and there are no hard runtime timeouts. R model outputs are converted into the shared ModelOutput transfer format used by Python and Rust. The commit also wires the new runtime into the unified cfasim-ui package, docs generation, and package metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant