Repository navigation
Description
Priority: P1 | Area: ui | Labels: feat,P1,area:ui | Milestone: v0.1.0 | RFC: chrome-surface-api-candidate.md / chrome-band-contract-candidate.md | Task: CTX-1299
Goal
Make Core's Lua UI host a reusable, bounded composition toolkit that lets GUI plugins such as bar, statusline, palette, and file-manager express their own layout, visual style, and interactions without Core-specific presentation branches.
Core remains responsible for surface placement/lifecycle, validation, rendering budgets, hit-testing, event delivery, capability enforcement, safe-mode/revocation fallback, and terminal-content isolation. Plugins own component composition and visual decisions.
Scope
- Reconcile the existing Chrome Surface API and Chrome Band candidates with the implemented Plugin API v1
bitty.ui.mount/updatebridge; mark normative, accepted, candidate, and deferred behavior accurately. - Define and implement a minimal additive Lua UI vocabulary for composable layout and styling (for example spacing/alignment/size constraints, supported theme-token styles, capsule/button/badge-like composition, and explicit interaction states) using bounded declarative data only.
- Preserve backwards compatibility: existing unstyled
Text/Row/Column/Listtrees retain current rendering and behavior. - Keep click/scroll routed through registered commands; no Lua callbacks on the render/input hot path, no raw shaders/colors, no terminal text access through UI nodes, and no capability grants from presentation data.
- Bound node count/depth, text and aggregate payload, layout work, style resolution, update cadence, and per-frame rendering. Define fail-closed behavior for unknown styles/nodes and plugin failure/revocation.
- Use the bar capsule UI as a dogfood consumer when the additive API is available; keep bar-owned visual choices and workspace policy in the plugin.
- Keep the reusable extension component catalog ([0.1.0] Extension component catalog (reusable Scene building blocks) #2114) as a separate follow-up unless a small shared primitive is required to validate this API.
Acceptance criteria
- A short API/design contract is reviewed before implementation expands beyond the minimum primitive set.
- Tests cover old-tree compatibility, valid composition/style, invalid/unknown fields, resource limits, command capability validation, hit-testing, safe fallback, and unchanged terminal input/focus semantics.
- Headed validation demonstrates at least one plugin-owned capsule/pill composition without Core-owned per-plugin styling.
- Canonical terminal-platform docs are synchronized; plugin SDK/ecosystem docs record the Lua API and capability/budget boundary.
- No performance, accessibility, or cross-platform claim exceeds measured/tested evidence.
Release scope reconciliation (2026-10-17)
The 0.0.24 release retains the existing Text/Row/Column/List vocabulary and bitty.ui.mount/update surface. New widget families, general layout/style controls, and expanded band contracts are deferred. Existing-source or mock evidence does not establish headed usability. Future work must first reconcile overlay authority, layout semantics, stacking, tokens, budgets, command bindings, and exact release-host evidence. File-manager panel/filesystem contracts remain separate. CTX-1299 is design evidence; implementation remains gated.
Tracking: CTX-1305. This issue remains open; deferred scope is not implemented or release-verified.
Activity
[-][plugins] Expand bounded Lua UI composition API for 0.0.24[/-][+][plugins] Reconcile bounded Lua UI composition API and host parity[/+]Xuepoo commentedon Oct 21, 2026
Parity reconciliation note (CTX-1419, PR #2385)
Scope: audit the bounded Plugin API v1 Lua UI surface against the actual Core host, fix only well-specified parity defects, and record everything ambiguous here instead of inventing vocabulary. No node kind, property, capability, slot, or error code is added.
Parity matrix (current
main+ PR #2385)top/bottom)overlayText/Row/Column/Listfg/bgtokenboldon_click+ argson_scroll+deltadeltamerged lastregion {id, kind}region+buttoninjectedE_UI_COMPONENT_INVALIDE_UI_COMPONENT_INVALIDtooltip,width, ...)left/right/tabline/terminal)E_UI_UNAVAILABLEat mountEvidence:
crates/bitty-runtime/tests/lua_ui_parity.rs(kinds, property mutation, typed rejections, bounds, slots, click/scroll/region, no-VM, no-authority),bitty-luaui_bridgeLua-spelling probe, and the five overlay paint tests inpresent.rs.Design-note decisions (no implementation in #2191)
Column/Listin bands. A band is one row, so the band host joinsColumn/Listchildren horizontally; the overlay stacks direct children as rows. The same tree therefore has two layouts. Defining vertical band layout requires an accepted layout/thickness decision and a multi-row band host; this note does not pick one.on_click/on_scrollon overlay content are validated and retained, but the overlay host has no accepted hit-test/geometry or focus-routing contract. Inventing one here would widen the API and the input authority surface, so routing stays band-only.[a-z][a-z0-9._-]{0,31}); the host resolves exactlyforeground,background,cursor,selection,accent(ANSI 12, OSC-4-aware) and substitutes the span default for other well-formed names while counting a diagnostic. The candidatechrome-surface-apitext says an unknown token rejects the mount; narrowing to that now would break additive-minor compatibility before the theme token contract is accepted.tooltip,width,padding,styletables are ignored today; the accepted Rich Presentation RFC allows additive optional fields, so unknown-field tolerance is deliberate, not a parity hole.UI_MAX_NODES2048, bridge depth 16 (acceptedSCN-2is 32),UI_MAX_TEXT_BYTES256 KiB, 64 blocks and 2 MiB retained strings per generation. Not implemented: terminal-wideSCN-4/SCN-5aggregation andBAND_MAX_NODES_PER_FRAME. No new ceiling is introduced by this note.deltaandregion/buttonslots are reserved at parse time so dispatch never exceeds the arg cap.band_slots.rs).Docs sync lands separately in
bitty-plugins-docs(sdk/reference/ui.md),bitty-terminal-docs(specifications/chrome-surface-api-candidate.md), andbitty-manual(api/ui.md, EN + zh-CN), pinned to the merged commit from PR #2385.[CTX-1419] feat(ui): honor overlay style and pin Lua UI parity matrix (…
Xuepoo commentedon Oct 21, 2026
Guard reconciliation (hermes-planner, 2026-10-21): PR #2385 merged as
cd6b0724and delivered the well-specified half of this reconciliation — theoverlayslot now paintsfg/bg/boldthrough the same closed host token table as bands (resolve_band_token), with the unknown-token fallback counter intact, and a Lua UI parity matrix pins the accepted v1 surface (four node kinds,ui.rich+ui.overlaygating, scene bounds) plus fail-closed boundary cases.What remains open here: the ambiguous parts were deliberately recorded as a design note rather than invented vocabulary (theme-token name set is open, so the bridge validates shape only; overlay click/scroll routing is not part of the accepted contract yet). Keeping this issue open for those candidates rather than closing it on a partial delivery.
Also merged in the same window: #2360 (
b10cb9e8), which is the graphics fenced-seam half of #2163; #2163 stays open by design for the blocked Core-localkitty_decode/kitty_rasterremoval.[CTX-1419] fix(ui): give the empty overlay pill a one-cell width (#2191)
[CTX-1419] fix(ui): keep overlay pill chrome and inherit root declara…
[CTX-1419] fix(ui): give the empty overlay pill a one-cell width (#2191)
[CTX-1419] fix(ui): drop useless conversions, pin root binding propag…
[CTX-1419] fix(ui): keep overlay pill chrome and inherit root declara…
1 remaining item
Xuepoo commentedon Nov 13, 2026
Candidate landed:
panel-overlay-capability-candidate.md(bitty-plugins-docs #189, squash9b4174f8),status: draft.It proposes the plugin-facing overlay verbs this issue's reconciliation needs —
bitty.panel.overlay_show/overlay_hidein the existingbitty.panel.*prefix rather than a third meaning onbitty.ui.overlay.*(which is already theW-01capture surface) — with parameter grammar, typed denials that allocate nothing, lifetime against the three accepted overlay owners, and attribution to(panel_id, generation).Bounds are split honestly: the
4 + 1envelope (OverlayBusy), 128/256 text/tooltip, SCN-1..5 and RC-1/RC-2 are borrowed from their owning RFCs and cited by file; only OV-1 (1 live surface per(panel_id, generation)), OV-2 (2 per plugin generation), OV-3 (8 admissions/s), OV-4 (4096 cells requested, no axis > 256) are marked proposed.Two facts found while grounding it, which this issue's API reconciliation has to account for:
Overlayhas no tier field (crates/bitty-ui/src/panel.rs:239), so atierparameter would be advisory until Core changes; andpanel.overlayis still only a grant string (crates/bitty-plugin-host/src/capability.rs:217) with no host backend, so the verb is specified but not implemented.Nothing is accepted by this comment, and bitty#2476 residual 8 stays BLOCKED-ON-CONTRACT until the verb is accepted and built.
[CTX-0202] docs(ui): correct cited line numbers in the evidence table
docs(ui): reconcile Chrome Surface API candidates with the implemente…
[CTX-0203] docs(ui): correct slot-set and bridge-budget claims agains…
[CTX-0098] docs(extensibility): correct slot vocabulary and mounted-s…
Xuepoo commentedon Nov 15, 2026
Landed slice (2026-11-15, #3175 →
a64c283c)Gap established by symbol before any code was written: the bridge had slots/kinds/theme tokens/anchors/bindings, and
SceneNodeStyle/SceneNode::Styledexisted inbitty-rich+ were painted bybitty-render, but the wire key did not exist —scene_bridge.rssaid as much in its header, and the candidate record closed at "ui.richships no style key".What now ships on
ui.rich(rich/terminal-slot nodes only):style = { padding, radius, border, border_token }, closed key set, caps 32 / 16 / 16 cells·px,border_tokenfrom the six-name closed content-token set.SceneNode::Styled; a flat declaration lowers to nothing (byte-identical paint list), a wrapper costs one node and one depth level, and a tree already at the ceiling is refused by a new post-walk depth check.E_UI_COMPONENT_INVALIDpath — refused with no clamp; a refused mount mounts nothing.SCN-1..5,UI_MAX_*budgets unchanged. Presentation only: no terminal content, cursor, selection or scrollback path touched; no renderer handle, no per-frame Lua.Independent review (different agent, verdict
APPROVE, no blocking findings) proved discrimination with four mutants in a scratch copy under a separateCARGO_TARGET_DIR: over-cap validation, the new depth check, wrapper node cost, and flat-style lowering each turn a named test red.Gates:
cargo fmt/just fmt-check/ clippy--all-targets -D warnings(targeted + workspace) /cargo test -p bitty-lua -p bitty-runtime/cargo +1.85 check --tests/RUSTDOCFLAGS=-D warnings cargo docall exit 0;just ci-localnot claimed (docker image store refuses a cached blob as root, act leg left to CI, which is green on all 19 non-skipping checks).Still open on this issue
Block.borderandstyle.bordercoexist, a latent silent clamp atui_style.rs:395, the silent no-op on the band/overlay path, and two now-false docs statements.gap/spacing, cross-axis alignment, size constraints, interaction-state styling, safe-mode flattening of scene style, headed capsule dogfood.status: draftuntil the above land.Xuepoo commentedon Nov 15, 2026
Landed slice (2026-11-16, #3181 →
a8abf31c)A third slice of this issue's acceptance set landed after #3175/#3176/#3179, found and closed by symbol rather than by reading the prose.
Defect closed.
ui.statereportedpresented = falsefor a chrome band that was admitted, planned, painted and routed in a column slot (left/right). Cause:slot_state_rulestill groupedLeft | RightwithTabline | Terminal→SlotStateRule::NeverPresented, a leftover from before the vertical bands were hosted (#3165/#3177).presentedkeyed on slot identity, not content.Now at
a8abf31c:crates/bitty-runtime/src/runtime/band_slots.rs—BandVisibilitycovers both axes; the content gateband_is_visibleis the whole rule, sound on columns because thickness =column_band_width(non-empty content implies a non-zero grantable width).tabline/terminalkeepNeverPresented.crates/bitty-runtime/src/plugin_runtime/services.rs—ui_block_stateconsumes the widened rule instead of a hardcodedpresented: false, focused: false.crates/bitty-runtime/tests/band_column_presented.rs::ui_state_reports_presented_for_a_painted_column_band— mountsColumnscenes intoleft/right, assertspresented/focused, then the live mounts on a realRuntime(120×40):plugin_band_column_budget() == (7,3),visible_band_column(Left,0) == Some(0),(Right,0) == Some(113), one published origin per column edge. False cases held: contentless column/row bands, emptied-then-refilled band,RowintoleftstillE_UI_COMPONENT_INVALIDwith no stored block.band_column_presented.rs:248).Disclosed residual (unchanged by this slice).
presentedremains a content predicate, not a per-frame compositor grant: a band whose window gives it no columns/rows still readstruewhile unpainted (reproduced at 120×40 with three 30-column left bands →visible_band_column_count == 2, third bandNonebut contentful). Making it a compositor grant needs a band-geometry source shared intoPluginServices— a new surface, deliberately not taken here.Docs side.
bitty-terminal-docs[CTX-0257] Workspace ops entry: keys/ctl/tabline per DEC-0034 #433 (squasha5275b4d) — the panel generation ownership decision record closed its fourth review (B-2/B-5/B-6), independent verdict APPROVE.bitty-terminal-docsWorkspace keys easy: pin Mod+M/Mod+HJKL coverage + add Mod+Shift+HJKL resize variant #434 (squashcf08f00e) —chrome-surface-api-candidate.mdandchrome-band-contract-candidate.mdnow carry a dated landed-surface section (seven-slot closed set,style = {padding,radius,border,border_token}, one stroke per node, loud band-style drop, host bounds) plus the deferred list.bitty-terminal-docs[CTX-0258] feat(config): pin Mod+M/HJKL both mods, add Mod-aware resize variant #435 (open, docs green) — reconciles the three remaining records that still call the vertical bands unhosted (chrome-surface-contract-candidate.md,ui-runtime-candidate.md,lua-ui-composition-reconciliation.md), with four further stale sites reported for their own pass (architecture/overview.md:315,specifications/README.md:100-101,panel-gui-content-presentation-candidate.md:224, and the now-staleui.stateresidual inside the two Workspace keys easy: pin Mod+M/Mod+HJKL coverage + add Mod+Shift+HJKL resize variant #434 records).Still open against this issue's acceptance set: general layout/style controls beyond the four-key style table (spacing/alignment/size constraints), a headed capsule/pill dogfood proof, and SDK/ecosystem doc synchronization.
Xuepoo commentedon Nov 16, 2026
Landed slices (2026-11-16, guard tick)
Two slices of this issue's acceptance set landed by symbol, not by reading the prose.
Style size constraints — bitty#3186 (
9ebe5285), branchctx-1848-lua-layout.crates/bitty-lua/src/ui_style.rs—style = { min_width, max_width }added to the landed four-key table (padding,radius,border,border_token). Cells on the content box (insidepadding),0= unbounded, inclusive capUI_STYLE_MAX_WIDTH_CELLS/SCENE_STYLE_MAX_WIDTH_CELLSreusingMAX_GRID_DIM.min_width > max_width) — no block is stored.gap,align,spacing, andwidthremain loudly refused and are pinned as such.SceneNodeStyle::constrain_width→ rendermeasure/paint(including the ring-frame path). Width-only ⇒ non-flat ⇒ the existingStyledwrapper; unstyledText/Row/Column/Listtrees are unchanged (SCENE_STYLE_SCHEMA_VERSIONstays 2).crates/bitty-runtime/tests/lua_ui_style_size.rs(13), pluslua_ui_style_vocab15,scene_style_vocabulary5,bitty-render scene_style_paint20,bitty-lua --lib302,bitty-rich --lib335.lua_ui_style_size.rs:161,186,215,239; reverting the key-accepting parse set → 4 passed / 9 failed at:160,185,214,237,256,282,319,348,364. Reproduced independently by the reviewer in its own scratch copy with a separateCARGO_TARGET_DIR(verdict APPROVE on3a3beea3); gates green: fmt, clippy--all-targets -D warningsover five crates,cargo +1.85 check, Windows--tests,cargo doc -D warnings.SDK record — bitty-plugins-docs#192 (
303a5cbd). Newsdk/reference/ui-surface-bounds.md(document_type: reference,status: draft): the 7-slot grant map, the 4 v1 node kinds and 5 excluded ones, the enforced budgets as contract values with the owning RFC, the landed style table with the one-stroke rule and the loud-drop behavior, the command-binding surface (region/phase args, hover never captures input and never sets modal authority), and an explicit not-in-v1 list.extensibility/extension-component-catalog-candidate.mdnow answers its style-field open question from the landed build.Still open against this issue's acceptance set:
gap/sibling spacing and cross-axisalign(both loudly refused today;alignoverlapsUiAnchorand needs reconciliation), a headed capsule/pill dogfood proof, and the canonicalbitty-terminal-docscandidate records that still describe the pre-#3175 style vocabulary.Not claiming any criterion closed: the issue stays open on those residuals.
[CTX-1852] feat(lua,render): add style gap spacing to the bounded Lua…
[CTX-1853] feat(lua,runtime): add band root align distribution (bitty…
Xuepoo commentedon Nov 16, 2026
Landed slice (2026-11-17, guard tick)
One more slice of this issue's acceptance set landed by symbol, plus the review-round publish that had lost a race with a squash merge.
Cross-axis
align— bitty#3198 (9f407a37, branchctx-1858/lua-ui-align).crates/bitty-lua/src/ui_style.rs—style = { align = "start"|"center"|"end" }onRow/Column/List, placing the node's direct children on the axis their siblings do not advance, inside the node's own content box (declared width range after padding, clipped to the allocation). Closed set, byte cap, typedE_UI_COMPONENT_INVALIDfor a non-string, an over-cap value and an unknown spelling; no clamp.UI_STYLE_FIELDSis now eight names (padding,radius,border,border_token,min_width,max_width,gap,align). A kind that places no adjacent children refuses a non-startalign and accepts a declaredstartas the no-op.startis today:ScenePaintStyle::is_inertincludesSceneStyleAlign::Start, so an absent style and a declaredstartpaint byte-identically and cost no wrapper node; a non-startalign costs exactly one wrapper node and no retained string.saturating_sub-derived (start= 0,center= slack/2,end= slack), so alignment can never push a child past the box its ring draws. Paint-only: measure changes only through the pre-existinggappath, ring frame unchanged,SCENE_STYLE_SCHEMA_VERSIONstays 2, budgets unchanged.crates/bitty-runtime/tests/lua_ui_style_align.rs(13 cases incl. column/row placement,Listcomposing like aColumn, padding+gap composition, the never-pushed-past-the-box case,start-equals-absent, wrapper cost), plus pin updates inlua_ui_gap,lua_ui_style_size,lua_ui_style_vocab,scene_style_vocabulary.scene_style_paint.rs:710/735and six alignment assertions; removing the key from the closed set reddens 13 of 15 and fails thebitty-luabuild. Proven in a scratch copy with a separateCARGO_TARGET_DIR; the lane worktree was never mutated. Independently re-reviewed by a different agent (VERDICT: APPROVE, comment on56581999).Recovery-round publish — bitty#3197 (
d2cdd491). Not part of this issue's vocabulary, but it is the review round of #3193 that squash-merged before it was pushed; it lands one recovery intent = one attempt, the backoff window armed on every attempt, the success path handing the budget back, and deadline-fold coverage.Residual.
bitty-terminal-docsspecifications/lua-ui-composition-reconciliation.mdstill describes the style table as the four-key set (padding,radius,border,border_token) and still lists "nogap/sibling-spacing, size-constraint, or cross-axis alignment" as candidate-only. A docs sync is owed there; it is tracked separately, not by this issue's code slices.Xuepoo commentedon Nov 17, 2026
Landed slice (2026-11-17, guard tick)
Content-box height constraints — bitty#3212 (
5967c233, branchctx-1867/lua-ui-slice, task CTX-1867).crates/bitty-lua/src/ui_style.rs—style = { min_height, max_height }added to the closedUI_STYLE_FIELDStable (now ten keys): content-box cells (insidepadding),0= unbounded, inclusive capUI_STYLE_MAX_HEIGHT_CELLS= 1000, the same bound asMAX_GRID_DIMand the width cap. A bareheight/size/min_height_cellsstays refused, so one concept keeps one spelling.crates/bitty-rich/src/scene.rs(SCENE_STYLE_MAX_HEIGHT_CELLS,constrain_height),crates/bitty-runtime/src/scene_bridge.rs(scene_style_of),crates/bitty-render/src/scene.rs(measure, ring frame, and thecontent_rowscap).height/min_height_cells/size, non-integer (float/string/bool/negative/table), over-cap (… exceeds cap: 1001 > 1000), inverted range (min_height 9 > max_height 4).Independent review (verdict
VERDICT: APPROVE, head717f6391) proved discrimination by mutation on a scratch copy: dropping the measure application reds 4 integration + 1 render test (left: sibling on row 1, right: row 3), and neutering the ring cap reds 3 integration + 2 render tests (ring left 16 px, right 48/64 px;three lines paintedvsone). MSRV 1.85 and clippy-D warningsclean.Residuals carried forward (not blocking): the
bitty-terminal-docs/bitty-plugins-docscorpus does not yet namemin_height/max_height, and per-kind coverage isTextonly.Xuepoo commentedon Nov 18, 2026
Residual re-verified by symbol: "per-kind coverage is
Textonly" is not a behaviour gapGuard tick 2026-11-18 re-checked the residual carried forward from CTX-1867/PR #3212. The style range is not wired per kind, so no kind can accept the declaration and ignore it:
origin/maincrates/bitty-lua/src/ui_style.rs:279UI_STYLE_FIELDS(ten keys),:329UI_STYLE_MAX_HEIGHT_CELLS = 1000,:1056with_height_range;crates/bitty-lua/src/ui_rich.rs:350-356parsesstylebefore the kind walkcrates/bitty-lua/src/ui_rich.rs:503— any non-flat style becomesSceneNode::Styled { style, child }, whatever the child kind is;ui_style.rs:924-934(is_flat) counts both height fields, so a height-only declaration is never droppedcrates/bitty-runtime/src/scene_bridge.rs:190with_height_range(…)crates/bitty-render/src/scene.rs,SceneNode::Styledarm —style.constrain_height(inner.rows)is applied to the measured child extent for every kindcontent_rowscap (style.max_height_cells) andflow.rowsbound the child's painted rowsEmpirical probe on the shipped chain (Lua reader → bridge → admission →
consume_scene_present_at), probe tests since deleted:Text/Row/Column/List/Table/CodeBlock/Blockall honour a cap,Rule/Image/Row/List/Columnall honour a floor (the following sibling moves to the floored row), and nesting composes (Styled{floor4}{Styled{cap1}},Row{capped Table},Block{child: Styled(Row) cap1}). No cap failed to bound measured or painted rows.So the remaining gap is evidence, not behaviour:
crates/bitty-runtime/tests/lua_ui_style_height.rsexercisesText,Block,Column,Rowonly, and any added per-kind case is green at base3c588f26(no pre-fix hunk to discriminate against). This tick deliberately did not ship a tests-only slice with a non-discriminating test — recording the corrected residual instead of closing it with a green-but-tautological row. Task CTX-1888 was completed with no code change.[CTX-1889] test(runtime): per-kind height-range evidence rows for the…
[CTX-1934] feat(render): paint resolved Scene Style primitives in the…