ReviewOS

home-lang/home-os

ADR-MC4: UI stack — stx authored, compiled ahead-of-time to Craft/Home; zero JavaScript on the device; zig-js reserved for post-v1 plugins

#46
Open chris opened this 9 days ago ·
9 days ago

Epic: #113 · Milestone: MC0 — Product & decisions

Why

"Use our own tech (stx, etc.)" plus "seamless, performant, resource cheap" on a Pi 5 constrains the UI runtime hard. Facts:

  • ~/Code/Tools/stx is TypeScript on Bun. It has no renderer of its own: output is HTML strings, Web Components, or — via packages/stx/src/craft-compiler.ts (1,422 lines) — a Craft native component tree with CompilationFormat = 'zig' | 'typescript' | 'json' | 'binary'.
  • ~/Code/Tools/crosswind (= ts-css) is a CSS generator with a parser/minifier and no layout or paint engine.
  • ~/Code/Tools/craft (Zig) renders through a WebView (webkit2gtk on Linux) — not available on a bare-metal HomeOS and against the no-Linux-userland rule.
  • HomeOS has its own Craft in Home: spec docs/design/craft.md v0.3, kernel/src/lib/craft_lib.home, kernel/src/gui/craft_integration.home, apps/desktop/craft_bridge.home, plus HIG tokens in docs/design/hig-tokens.home. It is retained-mode draw-lists into the compositor — exactly what a 10-foot UI needs.
  • ~/Code/Libraries/zig-js is a complete JS engine (test262 100 %) with a pinned Home ABI — a viable runtime but a large one for an idle-at-128 MB budget.
  1. Author every TV screen as .stx single-file components (templates, props, signals, directives, Iconify icons).
  2. Compile ahead of time on the developer machine: a new home output format in stx's craft-compiler emits .home source that builds Craft component trees + signal bindings (#89). The emitted code is checked in under apps/tv/generated/ (reviewable, diffable, agent-legible).
  3. Style with crosswind's utility vocabulary, but the emitter resolves every class to HIG tokens at compile time (#90). No CSS parser on device.
  4. Run as one long-running Craft process (apps/tv/), the same architecture MASTER_PLAN §9 chose for the desktop shell. No JS engine ships in v1.
  5. Post-v1: zig-js for third-party plugins/apps, sandboxed; not on the critical path.

Tasks

  • docs/adr/ADR-MC4-ui-stack.md with the option table (WebView / zig-js runtime / AOT) and memory + latency estimates for each.
  • Decide the stx feature subset the emitter must support for v1 (list directives, signals, slots, i18n) and document unsupported ones as compile errors.

Size: S · Depends on: — · Blocks: #89, #90, #91

Sign in to comment on this issue.