Docs: the host is MoonBit; drop the plan's Rust host recommendation

ARCHITECTURE.md's host strategy and open questions still recommended a Rust + wasmtime host;
they now record the decision (MoonBit on the wasmtime C API, no Rust in the tree). TOOLCHAIN.md
names wasmhost as the embedder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Opus 5.5 committed 2026-11-30 12:24:24 -08:00
1 parent 44bb77871d
commit cb81a973f8
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -210,7 +210,7 @@ WASI-style, deny-by-default:
| Option | What it is | Time-to-pixels | Fits the "everything is a component" goal | Main risks | | Option | What it is | Time-to-pixels | Fits the "everything is a component" goal | Main risks |
|---|---|---|---|---| |---|---|---|---|---|
| **(a) Browser/Node host with jco** | components transpiled to JS+core wasm; host in JS; Canvas2D now, WebGPU later | **hours — done in M0** | components yes; host = JS runtime (large TCB: browser) | no real windows/devices; JS can't pre-empt a looping component; browser is not a desktop session | | **(a) Browser/Node host with jco** | components transpiled to JS+core wasm; host in JS; Canvas2D now, WebGPU later | **hours — done in M0** | components yes; host = JS runtime (large TCB: browser) | no real windows/devices; JS can't pre-empt a looping component; browser is not a desktop session |
| **(b) Native host embedding wasmtime** | Rust host using `wasmtime::component` + `bindgen!`; software/GPU rendering into a window (winit/SDL) or DRM | days–weeks | best: small native TCB, fuel/epoch limits, real FS/net/devices | host is Rust, not MoonBit; wasmtime's C API cannot instantiate components with host imports as conveniently, so a MoonBit-native host via FFI is **unverified** and probably not worth it | | **(b) Native host embedding wasmtime** | MoonBit host (`wasmhost/`) linking the prebuilt wasmtime C API; software rendering into a window or DRM | days–weeks | best: small native TCB, fuel/epoch limits, real FS/net/devices | the C API has no bindgen: imports are hand-written handlers over dynamic values (done; a first Rust host on the wasmtime crate was dropped as slow to build and heavy on CPU) |
| **(c) Nested compositor in an existing session** | (b) running as a window/Wayland client first, later a real compositor (smithay) hosting foreign Wayland apps | weeks–months | needed to run real apps | scope; Wayland/EGL/input details | | **(c) Nested compositor in an existing session** | (b) running as a window/Wayland client first, later a real compositor (smithay) hosting foreign Wayland apps | weeks–months | needed to run real apps | scope; Wayland/EGL/input details |
**Recommendation:** (a) for M0–M2 (done: it is the fastest way to prove the WIT **Recommendation:** (a) for M0–M2 (done: it is the fastest way to prove the WIT
@@ -265,7 +265,7 @@ Designed next (no WIT yet): `window-registry`/`wm-policy`/`decoration`, `search-
| **M0** | Toolchain proof, WIT v0.1 (`widget`/`panel`/`shell`), host (Node+browser), 4 components, tests, CI, swap/theme/permission demos | **done (this PR)** | | **M0** | Toolchain proof, WIT v0.1 (`widget`/`panel`/`shell`), host (Node+browser), 4 components, tests, CI, swap/theme/permission demos | **done (this PR)** |
| M1 | `config-store` + `theme-provider` component; persisted settings; hot reload of `.wasm` on change; `text` interface (measure/fonts) and icon theme | next | | M1 | `config-store` + `theme-provider` component; persisted settings; hot reload of `.wasm` on change; `text` interface (measure/fonts) and icon theme | next |
| M2 | Move input routing + focus policy into the shell/WM component; more widgets (task manager stub, system tray, notifications toasts); `search-provider` + KRunner component | | | M2 | Move input routing + focus policy into the shell/WM component; more widgets (task manager stub, system tray, notifications toasts); `search-provider` + KRunner component | |
| M3 | Native reference host: Rust + wasmtime (`bindgen!`), software rasteriser into a winit window, fuel/epoch limits, restart supervision; CI runs the *same* integration tests against both hosts | | | M3 | Native reference host: MoonBit + the wasmtime C API (`wasmhost/`), software rasteriser into a window, fuel/epoch limits, restart supervision; CI runs the *same* integration tests against both hosts | |
| M4 | Window-manager world with synthetic windows (no real apps yet): stacking/tiling policies as swappable components, decorations, virtual desktops, activities | | | M4 | Window-manager world with synthetic windows (no real apps yet): stacking/tiling policies as swappable components, decorations, virtual desktops, activities | |
| M5 | Nested compositor (smithay) hosting real Wayland clients; `buffer-surface` resource; GPU rasteriser | | | M5 | Nested compositor (smithay) hosting real Wayland clients; `buffer-surface` resource; GPU rasteriser | |
| M6 | Settings (KCM-style) framework, notifications daemon bridge (D-Bus portal), tray (SNI bridge), clipboard, power/session | | | M6 | Settings (KCM-style) framework, notifications daemon bridge (D-Bus portal), tray (SNI bridge), clipboard, power/session | |
@@ -274,7 +274,7 @@ Designed next (no WIT yet): `window-registry`/`wm-policy`/`decoration`, `search-
## 12. Open design questions (with recommendations) ## 12. Open design questions (with recommendations)
1. **Host language/long-term host** — Rust+wasmtime native host vs trying to keep even the host in MoonBit. *Recommend Rust+wasmtime for M3; revisit MoonBit-native host only if wasmtime's C API gains full component embedding.* Resolved: the host is MoonBit (`wasmhost/`) on the wasmtime C API, whose component model support turned out to be enough; the Rust host was removed on 2026-11-26. 1. **Host language/long-term host** — *Decided: MoonBit (`wasmhost/`) on the wasmtime C API, which does embed components. No Rust in the tree.*
2. **Render-list vs textures** — *Recommend render-list as the default, `buffer-surface` resource only for non-vector content (§4).* 2. **Render-list vs textures** — *Recommend render-list as the default, `buffer-surface` resource only for non-vector content (§4).*
3. **UI toolkit inside components** — adopt `moon-gpui` or a tiny immediate-mode helper (`lib/ui`)? *Recommend `lib/ui` until moon-gpui has a stable scene package and a flatten-to-draw-op adapter, then migrate widget internals; keep the WIT draw-op vocabulary as the stable boundary.* 3. **UI toolkit inside components** — adopt `moon-gpui` or a tiny immediate-mode helper (`lib/ui`)? *Recommend `lib/ui` until moon-gpui has a stable scene package and a flatten-to-draw-op adapter, then migrate widget internals; keep the WIT draw-op vocabulary as the stable boundary.*
4. **Text and fonts** — host-provided shaping (`text` interface) vs components bundling a shaper. *Recommend host-provided: layout needs metrics from the same engine that rasterises.* 4. **Text and fonts** — host-provided shaping (`text` interface) vs components bundling a shaper. *Recommend host-provided: layout needs metrics from the same engine that rasterises.*
+1 -1
View File
@@ -25,7 +25,7 @@ and `wasm-tools` wraps it into a component.
| `wasm-tools component embed/new` (1.263.0) | works | `--encoding utf16` (MoonBit strings are UTF-16). | | `wasm-tools component embed/new` (1.263.0) | works | `--encoding utf16` (MoonBit strings are UTF-16). |
| `wasm-tools component targets` | works | Used as a **WIT conformance test**: asserts each component implements its declared world. | | `wasm-tools component targets` | works | Used as a **WIT conformance test**: asserts each component implements its declared world. |
| `jco transpile` (1.42.0) | works | Component → JS + core wasm. Used for the M0 host. `--instantiation async` lets the host pass a *per-instance* import object, which is how capability grants work. | | `jco transpile` (1.42.0) | works | Component → JS + core wasm. Used for the M0 host. `--instantiation async` lets the host pass a *per-instance* import object, which is how capability grants work. |
| `wasmtime` (51.0.0) | validates/compiles | `wasmtime compile` accepts every component. We do **not** run them under wasmtime yet: a component with host imports needs an embedder (Rust/C-API) to supply them — `wasmtime run` cannot. That is M4. | | `wasmtime` (51.0.0) | validates/compiles | `wasmtime compile` accepts every component. We do **not** run them under wasmtime yet: a component with host imports needs an embedder (now `wasmhost/`, MoonBit on the C API) to supply them — `wasmtime run` cannot. |
| mooncakes packages | see below | Nothing needed at M0. | | mooncakes packages | see below | Nothing needed at M0. |
### Pipeline ### Pipeline