Status: asked for by the owner on 2026-11-28. This note replaces the hand-written widget list of
RFC 0015 section 1 with a vocabulary generated from the UI
kit itself. The rest of RFC 0015 stays: data binding with set-data, repeat and update-layout
(section 1a), docking, the plugin badge, plugin places only, and "data in, commands out".
A plugin panel should look and behave exactly like a built-in one. Today the widget kinds are a
second, hand-written list (craft_plugin::ui::Widget) with its own mapping onto kit calls in
crates/ui-egui/src/panel_runtime/plugin.rs. Each new plugin need grows that list, or a JSON
Schema annotation (x-solidcraft-choice, #23421, since reverted), one widget at a time. Each is a contract
we keep forever, and each drifts a little from the kit control it imitates.
So the kit becomes the vocabulary. A plugin names the kit control it wants and gives its props. The host draws it with the same kit function the built-in dialogs call. Which controls a plugin may use is one list in the kit that grows only in review.
A plugin sends a declarative tree of nodes. Each node has:
| Field | Meaning |
|---|---|
control |
A control of the vocabulary: button, checkbox, slider, label, column, line, repeat, ... |
id |
A stable id: lowercase letters, digits and dashes, at most 64 bytes, no leading or trailing dash (the rule plugin and panel ids already use). Unique in its panel, or within its template inside a repeat. It is RFC 0015 section 1a's node key. |
| props | The control's own props, typed by its marker (below). JSON keys are snake_case, like the rest of the manifest. |
children |
Child nodes, for the controls that hold others (column, line, section, tabs). |
- The host draws the tree every frame with the kit, in egui immediate mode. No plugin code runs while the host draws.
- The host owns layout, theme, spacing, focus, scroll and the text cursor. That state is keyed
by plugin, panel and node
id(inside arepeat, also the section 1a row chain, so each row keeps its own), so it survives when the plugin sends the tree again. - Values belong to the plugin. A control shows the value in its props or at its bound data path. While the user edits, the host keeps a draft: a text field until Enter or leaving it, a slider while it is held, a checkbox for the click. Then it sends one event. The draft ends when that event's entry finishes, whether it succeeds or fails, and the control shows the panel's data as it is then. A failed entry rolls its data back (RFC 0015 section 1a), so the control shows the old value again. This is how built-in dialogs work: the command's state is the truth.
- Events are sent once per user action, never per frame. A slider sends
changewhen it is let go (or on each keyboard step), a text field on Enter or leaving it, a button on press. That keeps journaled, undoable commands to one per action and within the host's action queue. - Events go back by node id. A control's event props name a manifest entry (
on_press,on_change). The event is RFC 0015'sui-event: the panel, the kind,pathset to the nodeid(or, inside arepeat, the item's data path such as/ops/3/depth), thekeyand row chain of section 1a, therowselected in the panel's list or table (as v1 button presses carry today), and the new value. The host resolves the entry from its own copy of the tree, never from the event. Entries run as ordinary commands, with theirreadorediteffect, so an agent can do over MCP anything a person does in the panel. - The plugin re-sends the tree, or a diff, when its own state changes: the whole tree, a
set-datafor bound values, orupdate-layoutoperations keyed by node id (section 1a), at the section 1a rate. - No styling hooks of any kind. No colours, sizes, fonts, margins, padding, alignment, classes
or custom drawing. The only choices are the semantic ones the kit itself offers: a button is
normalorprimary, a label'sroleisnote,hintorheading, a colour is a role (accent,warn,series-3). There is no prop kind for styling, so one can't be added by accident. - Plugin text stays the plugin's. The host never runs plugin labels through its own message
catalogues, and text is never a link. Every control publishes a plugin-scoped handle,
plugin-panel:<plugin>:<panel>:<id>, for UI scenarios and the control channel, so two plugins (or a plugin and a host dialog) never share one. - Typed refusals. A tree is refused with
ui.unknown-control {control, ui_version, host_ui_version},ui.unknown-prop {control, prop},ui.unknown-value {control, prop, value},ui.bad-value {id, prop, expected},ui.missing-prop {id, prop}orlimit-exceeded. When and where is in "Versions" below. - Caps for UI version 2 trees. 512 nodes per panel, counting every repeated row as drawn.
Depth 16. 32 props per node. Text props at most 4 KiB and printable. 64 operations per
update-layout. The tree counts towards the 1 MiB cap on a plugin's declarations, and a layout file towards #23337's 256 KiB per file; RFC 0015's 1 MiB of data per panel is unchanged. Over a cap islimit-exceeded, and the panel keeps what it had. Translated v1 layouts keep v1's limits.
JSON, in the manifest and in layout files, is the nested tree. WIT, for a wasm plugin sending a tree at run time, has no recursive types, so it is flat, and generic: the vocabulary is data, so the WIT never changes when a control is added.
interface ui {
variant prop-value {
flag(bool),
number(f64),
text(string),
/// A slash path into the panel's data: `{"bind": "/path"}` in JSON.
bind(string),
}
record prop { name: string, value: prop-value }
record control-node {
control: string,
id: string,
props: list<prop>,
/// Indexes into `control-tree.nodes`.
children: list<u32>,
}
record control-tree { root: u32, nodes: list<control-node> }
/// Replace a `controls` panel's tree. Checked like a layout; applied with its data.
set-controls: func(panel: string, tree: control-tree) -> result<_, plugin-error>;
}There are no list-valued props. Where a control needs several items (a choice's options, tabs),
they are child nodes (option, tab), which keeps every form a plain tree.
The manifest stays JSON, and is unchanged. plugin.json (metadata, permissions,
capabilities, entries and their input schemas) is out of scope for this note.
One primary authoring path: the JSON tree. A panel is written as the same JSON the host reads,
inline in the manifest or in its own layout file (#23337). The generated JSON Schema (below) gives
editors completion, hover docs and red squiggles for an unknown control, prop or value, so the file
is pleasant to write by hand. One format means the docs, the install screen, the approval hash,
plugin test, a reviewer and an agent all read exactly the text the plugin ships, with no second
grammar to learn, parse or keep 1:1. Values with a unit are stored in millimetres or degrees, as
all panel data is (RFC 0015 section 1), and shown in the user's units.
{"control": "column", "id": "drill", "children": [
{"control": "label", "id": "title", "text": "Peck drilling", "role": "heading"},
{"control": "line", "id": "mode", "children": [
{"control": "checkbox", "id": "peck", "label": "Peck", "value": {"bind": "/peck"}, "on_change": "set-peck"},
{"control": "checkbox", "id": "coolant", "label": "Coolant", "value": {"bind": "/coolant"}, "on_change": "set-coolant"}
]},
{"control": "slider", "id": "depth", "label": "Peck depth", "unit": "length", "min": 0.5, "max": 10, "step": 0.5,
"value": {"bind": "/depth"}, "on_change": "set-depth"},
{"control": "label", "id": "hint", "text": "Retracts fully after each peck.", "role": "hint"},
{"control": "line", "id": "actions", "children": [
{"control": "button", "id": "preview", "label": "Preview", "on_press": "preview"},
{"control": "button", "id": "post", "label": "Post", "tone": "primary", "on_press": "post"}
]}
]}A list that follows data is a repeat, with one template child per kind of item. Inside a
template a bind is relative to the item, and an event's path names the item's field
(/ops/3/depth):
{"control": "repeat", "id": "ops", "bind": "/ops", "kind_field": "kind", "children": [
{"control": "template", "id": "pocket", "kind": "pocket", "children": [
{"control": "slider", "id": "depth", "label": "Depth", "unit": "length", "min": 0, "max": 50,
"value": {"bind": "depth"}, "on_change": "op-edit"}
]},
{"control": "template", "id": "drill", "kind": "drill", "children": [
{"control": "checkbox", "id": "peck", "label": "Peck", "value": {"bind": "peck"}, "on_change": "op-edit"}
]}
]}Thin typed layers, generated from the same markers, that only ever produce that JSON:
-
Rust (wasm plugins): a
panel!macro, in the style of maud, over generated builder types. Control names and prop names are checked by the compiler, because the macro's rules and the builders are generated from the vocabulary: a control or prop the kit doesn't expose doesn't compile. Values (a choice's options, ranges) are checked by the same validator as any JSON.let tree = panel! { column(id = "gear") { label(id = "title", text = "Gear", role = "heading") slider(id = "teeth", label = "Teeth", min = 6, max = 120, step = 1, value = Bind("/teeth"), on_change = "set-teeth") button(id = "make", label = "Make gear", tone = "primary", on_press = "make") } }; // `tree` is a serde_json::Value: exactly the JSON above, ready for `set-controls`.
-
Rhai, only if #23175 lands: the same generated builders exposed to scripts. It is optional; nothing here depends on it.
Why not a separate readable syntax (KDL, TOML, YAML): each adds a second grammar and parser that must stay exactly 1:1 with the JSON, and the review, hash and agent paths would still read the JSON underneath. With a schema, JSON is readable enough by hand, and Rust authors get a nicer form still through the macro, checked at compile time.
Each kit control opts in with a marker. The markers are one list in the kit,
crates/ui-kit/src/plugin_ui/controls.rs. Each entry names the plugin-facing control, its props
and events, and a few lines that call exactly one kit function:
Control {
name: "button",
since: 2,
summary: "A push button. Runs its entry when pressed.",
children: false,
props: &[
Prop::text("label", "What the button says.").required(),
Prop::choice("tone", &["normal", "primary"], "`primary` for the panel's main action."),
Prop::flag("enabled", "Off greys the button out.").or(true),
],
events: &[Event::PRESS],
draw: |ui, node, out| {
let options = if node.choice("tone") == "primary" { Button::Primary } else { Button::Normal };
let response = ui.add_enabled_ui(node.flag("enabled"), |ui| button(ui, node.text("label"), options)).inner;
out.publish(node, &response);
if response.clicked() {
out.press(node);
}
},
}A control that isn't on the list can't be named by a plugin, so any growth in plugin UI is a diff to
that one file. A new entry goes to the owner or Nate with 1280x720 pictures, once, as RFC 0015's
shared rules already say for widget kinds. I chose a list over an attribute macro on each kit
function: kit functions take very different arguments (&mut T, option enums, ranges), so the few
lines that turn props into the call are hand-written either way, and one list is easier to review
than markers spread over the kit.
The plugin-facing name and props are frozen once released. If the kit renames, merges or
restyles a function, only that entry's draw changes, and plugins follow the kit's look, as
built-in dialogs do.
Layering. ui-kit reads the tree as plain serde_json data through a small node view (props,
bound values, the node's id), and gets a draw context from the host: the user's units, the plugin
and panel ids for handles, and the drafts. craft-plugin keeps the tree as that same data and
checks only what every app shares (ids, depth, size, printable text, and that each on_* prop
names a declared command entry). Neither crate depends on the other.
One validator, used everywhere. cargo xtask plugin-ui writes the data half of the markers
(controls, props, kinds, choices, ranges, defaults, since) as a plain table into a small crate
with no dependencies but serde_json, together with the one Rust function that checks a tree
against it. The engine uses it at install, in plugin test and on every set-controls, headless;
the app uses the same function before it draws. A kit test fails when a marker and the table
disagree. So the CLI and the app refuse exactly the same trees.
From the same table, the xtask also writes the kit crate's plugin-ui/ folder (inside the crate, so it builds on its own):
solidcraft-ui.v<N>.schema.json, a JSON Schema per version, for editors and authors. It describes shapes and values; the rules a schema can't express (unique ids, caps, declared entries) are the validator's.solidcraft_ui.rs: Rust builders with thepanel!macro (Button::new("post").label("Post").tone("primary").on_press("post")). A kit test compiles the Rust file.controls.md, the reference page: each control with its summary, props, defaults, events, the version it arrived in, and its JSON andpanel!forms.
The host's dispatch (control name to draw) comes from the list at compile time, so it can't
drift. CI fails with "run cargo xtask plugin-ui" when a generated file is stale, as the client-binding
and catalogue checks do. The xtask also refuses a prop named like styling (color, colour, size,
font, margin, padding, width, height, style, class); that is a lint, and the review is
the real gate.
- One number,
ui_version, with the capability to match. Version 2 is RFC 0015 section 1a (repeat, keys,update-layout) together with thecontrolswidget and this vocabulary, under theui@0.2capability. From then on, each vocabulary change bumpsui_version, and eachui@0.xcapability names the highest version it covers. Every control, prop, choice value and event in a marker carriessince. - A plugin declares the version it targets (
"ui_version": 2). At install and inplugin test, a tree using anything newer than its own declared version is refused, so a plugin can't depend on a prop by accident. - A newer host draws every older version. The panel draw today checks
ui_version != UI_VERSION; that becomes "newer than the host", so v1 panels keep drawing. - An older host never refuses a plugin for its version. A plugin built for a newer version
installs and loads. Each part of a tree the host doesn't know is drawn as the "needs a newer
SolidCraft" placeholder, with
ui.unknown-control(naming the plugin's and the host's versions) in the log; the rest of the panel works. A host can't know which version brought a control it has never seen, so it reports the two numbers, not a guess. - A tree that claims a version the host has, yet names something unknown (a typo, or a
control that never existed) is refused at install and on
set-controls, with the panel keeping what it had. - A control gains a prop: the prop must be optional with a default that keeps the old look and
behaviour, and
ui_versiongoes up by one. Adding a required prop, changing a prop's kind, or narrowing its range is not allowed. - A choice gains a value: as a new prop. An older host reports
ui.unknown-value. - A prop is renamed or retired: the old name is marked
deprecatedwith its version, is still accepted, and maps onto its replacement in the marker. Giving both isui.bad-value. The reference page lists it as deprecated. It is dropped only when the package goes tocraft:plugin@1.0.0(RFC 0015 open question 4), and that host still reads older trees through the mapping.
#23337, layouts in their own file, is the first user. Its file mechanism (path rules, the per-file and per-plugin budgets, reading at manifest load so install review and the approval hash see the whole layout) is how a control tree reaches the host:
- #23337 lands as it is, for JSON layout files.
- The prototype (below) adds
controlspanels behind the plugin-panel path. - A layout file may then hold a control tree, as may an inline layout. The job-list book example moves to one.
ui_version: 1 panels keep working, through one renderer. At load the host translates each v1
widget into the tree, with ids v1-<node index> (v1 nodes have none), and keeps v1's own limits
for it. Some controls are new kit-backed entries; the table names the kit function each one calls:
| v1 widget | Control | Kit function |
|---|---|---|
group |
column |
host layout |
tabs |
tabs |
segmented above the selected child |
split |
split (new) |
host layout |
toolbar, button |
line of button with an icon prop |
icon_label_action |
form fields |
number, length, angle, text, checkbox, choice, selection |
number_field, length_field, text_field, checkbox, choice_row, selection_field in row |
item-list |
list |
list_picker |
item-tree |
tree (new) |
tree_row |
table |
table |
table_custom |
text |
label |
text |
empty-state |
empty_state |
empty_box |
progress |
progress |
progress |
chart |
chart (new; v1 draws a placeholder today) |
to be added to the kit first |
Plugin dialogs (the JSON Schema forms of entries) stay as they are for authors: an entry's
input_schema still makes its dialog. Underneath, the host builds the dialog as a control tree from
the schema (a number property is a number, a string oneOf a choice, and so on), so dialogs
and panels share one vocabulary and one renderer. A row of icon buttons for a choice is a
presentation of the kit's own choice control, not a schema annotation (x-solidcraft-choice,
#23421, was reverted before it shipped). New
presentations are chosen by naming a control, never by a new x-solidcraft-* annotation. Later an
entry may ship an optional dialog layout (a control tree bound to its schema's properties) for a
dialog that wants sections or another order.
Blender add-ons draw panels by calling layout.row(), layout.prop(obj, "name") and
layout.operator("mesh.foo") in a draw() method that Blender re-runs on every redraw. The result
is drawn with Blender's own widgets and theme, so add-ons look native and get every theme and DPI
change for free. That is the model here, with one difference: Blender runs the add-on's Python in
process on each redraw, and we can't run sandboxed plugin code per frame, so the plugin sends the
tree as data and the host does the per-frame part. VS Code offers both paths. Contributed views
(tree views, welcome views, settings) use a fixed vocabulary and look native, but can do little.
Webviews are HTML pages in an iframe that can do anything, but look foreign, theme themselves by
hand, miss the editor's keyboard and screen-reader conventions, and are a large security surface. A
fixed native vocabulary is right for us. The panels match the app, follow the theme and the
colour-vision setting, keep the shared keyboard and focus rules, publish handles to UI scenarios
and the control channel, draw in the web build, and stay drivable by agents. HTML would mean
shipping and sandboxing a browser engine, and every plugin panel would differ a little from ours.
Stacked on this note, behind the plugin-panel path:
- Four kit controls opt in:
label(ui_kit::text),button(ui_kit::button),checkbox(ui_kit::checkbox) andslider(ui_kit::sliderinui_kit::row), plus thecolumnandlinecontainers. cargo xtask plugin-uigenerates the JSON Schema, the Rust builders with thepanel!macro, and the reference page for them, and a kit test fails when they are stale.- A
controlspanel widget (manifest JSON,ui_version2) holds a tree.craft-pluginchecks its shape and entries at install; the kit checks it against the vocabulary and draws it; press and change events go by node id to the named entries, and the host resolves them from the declared tree. - An example plugin panel draws from a tree and receives the events, in a test.
Not in the prototype: repeat, the WIT form and set-controls, the shared headless validator
crate, units on sliders, the v1 translation, and the dialog migration. They follow once the note is
merged.
- TypeScript types for the tree, generated from the same table, for tools and agents that build panels. Not yet.