You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
An embedding API so another runtime can drive a Rune tree (wasm and desktop) #2555
Problem. Rune can only be driven from Rust. A UI runtime written in JavaScript, such as Effect UI (Effect-TS/ui), cannot render through Rune without its own glue. To try it, we wrote a small wasm-bindgen crate that exposes mount, send(tree), want_rects and unmount, takes the element tree as JSON each commit, and returns press, input (with a seq counter), submit, focus and layout-rect events. On desktop we did the same over stdio with a child process. Both work: a JS app with a counter, a keyed list of 1,000 rows and a controlled input rendered and handled events through Rune.
Ask. A small, supported embedding API for other runtimes, on the web (wasm) and on desktop:
create an app into a given canvas (or window) and get a handle;
replace or patch the element tree from outside (a patch format would avoid sending the whole tree each commit: 7 ms of JSON at 1,000 rows, 20 ms at 3,000);
receive input events and layout rects with stable element keys;
destroy the handle.
Why here. Each outside runtime will otherwise write and maintain its own unofficial bridge against internal APIs that change daily. Related: several apps per page (#2553).
checked crates/rune/src/app.rs, crates/rune/src/app/web.rs, crates/rune/src/platform/web/page.rs, crates/rune/src/platform/embed.rs, crates/rune/src/runtime/commit.rs, crates/rune/src/memo.rs, and crates/rune-luau/. today rune only drives views from rust (AppSpec<S> returning El, with memo / virtual_rows for subtree reuse and embed::LayerHost limited to apple CAMetalLayer); crates/rune-luau is the only non-rust ui layer, and web is still one app per page (#2553). PLAN.md (§3, §6c) leaves a serializable patch/command boundary as future work, so adding a supported external-runtime embedding api needs two design calls first:
packaging and desktop transport: should this live in a new companion crate (like rune-luau) exposing a rust retained-tree host plus wasm-bindgen bindings on web, and on desktop should rune support a c abi, a stdio/ipc host binary, or just the rust host crate for runtimes to wrap?
patch protocol and v1 surface: should v1 use an incremental flat-id op/patch format (create/update/move/remove, avoiding full-tree json) over a minimal core set of nodes and events (boxes, text, controlled text input with seq, press/focus/submit/layout rects), or align its node/prop vocabulary with rune-luau's @rune/ui schema?
Activity
opencodejr commentedon Nov 27, 2026
checked
crates/rune/src/app.rs,crates/rune/src/app/web.rs,crates/rune/src/platform/web/page.rs,crates/rune/src/platform/embed.rs,crates/rune/src/runtime/commit.rs,crates/rune/src/memo.rs, andcrates/rune-luau/. today rune only drives views from rust (AppSpec<S>returningEl, withmemo/virtual_rowsfor subtree reuse andembed::LayerHostlimited to appleCAMetalLayer);crates/rune-luauis the only non-rust ui layer, and web is still one app per page (#2553).PLAN.md(§3, §6c) leaves a serializable patch/command boundary as future work, so adding a supported external-runtime embedding api needs two design calls first:rune-luau) exposing a rust retained-tree host pluswasm-bindgenbindings on web, and on desktop should rune support a c abi, a stdio/ipc host binary, or just the rust host crate for runtimes to wrap?seq, press/focus/submit/layout rects), or align its node/prop vocabulary withrune-luau's@rune/uischema?