Skip to main content

Module dashboard_host

Module dashboard_host 

Source
Expand description

CR.4: the dashboard guest→host section seam. The dashboard guest→host section seam (CR.4).

Design: contributable-registries.md §3.2, and the dashboard WIT interface.

A plugin implementing dashboard-plugin declares its section ids once at load (register-dashboard-sections) and renders them on demand (render-section). The host wraps each declared id in a [WasmDashboardSection], which IS a lattice_dashboard::DashboardSection — so the registry’s ordering, the dashboard.sections selection and the compositor treat a plugin section and a built-in identically, which is what the trait was written for.

§Sync, and holding a live Store

Unlike help — which crosses its data once and drops the guest — a section is a function of a DashboardCtx the guest cannot know at load, so the instance stays alive for the editor’s lifetime. render takes &self (the trait’s shape, because the registry shares sections behind Arc), and a Store needs &mut, so the store sits behind a Mutex. Contention is nil in practice: composition happens on the actor thread, one section at a time.

§Guest output is untrusted

Every row is validated host-side and dropped on failure, never trapped on. A trap poisons the section — it renders nothing further this session — and the rest of the page still composes, the WasmErrorParser contract verbatim. A plugin that breaks must cost its own block, not the launch page.

Structs§

DashboardSectionSpec
What a guest declared during register-dashboard-sections.
WasmDashboardSection
A plugin-backed dashboard section.

Functions§

fragment_from_wit
Convert a guest fragment to the native one, dropping what does not survive validation.
validate_section
Validate a declaration, or reject it.