Skip to content

[CTX-0108] docs(sdk): author reference for the bitty.ui.panel presentation surface - #202

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-0108/docs-ui-panel
Nov 21, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-0108/docs-ui-panel

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

What this adds

Docs-only PR for bitty#2388 residue item 4 (the author-guide half): a new
companion reference page sdk/reference/ui-panel.md documenting the
plugin-facing panel-content presentation surface, plus the two index edits
in sdk/reference/README.md (covering-test row extension and the
companion-page paragraph; prettier realigned the namespace table, so the
index diff re-pads rows this change did not edit — required by the gate, not
a rewrite).

The gap was real: before this change the corpus had zero coverage of
bitty.ui.panel.* / panel.content.* (rg 'bitty\.ui\.panel|panel\.content'
over all *.md in this repo returned no hits), while the surface is fully
landed in bitty main.

Documented surface (all verified against bitty main @ 944a4b1f, 2026-11-22)

  • The verbs — bitty.ui.panel.present/update/release/poll (bitty#3267,
    CTX-1909): two-value refusal returns (handle, err), host-derived handle,
    the closed two-field spec table (placement hint-only, restore = "previous" only, unknown keys refused typed), closed release reasons
    (released/cancelled). Evidence:
    crates/bitty-lua/src/ui_panel.rs:35/38/41/50/53/60/75/109/115/127/134,
    crates/bitty-lua/src/host.rs:7430/7472/7524/7577/7579.
  • Capability requirements — own head ui.panel (in
    crates/bitty-package/src/manifest.rs:375 CLOSED_CAPABILITY_HEADS so a
    manifest naming it validates); present/update check ui.rich then
    ui.panel each by name, then safe mode, then backend presence;
    release/poll need ui.panel only; backend shared only with granted
    generations. Evidence:
    crates/bitty-runtime/src/plugin_runtime/services.rs:8136 (ui_panel_present),
    :8155 (safe mode), :8290 (panel_set_presentation fails closed
    E_NOT_IMPLEMENTED); crates/bitty-runtime/src/plugin_runtime/mod.rs:3371,
    :3631.
  • Typed refusals — E_UI_PANEL_BUSY (host.rs:1001),
    E_UI_PANEL_NESTED (:1010), E_UI_PANEL_UNAVAILABLE (:1019),
    E_UI_UNAVAILABLE, E_UI_NOT_OWNER (owner+generation fence),
    E_UI_COMPONENT_INVALID; one layer per panel, one per generation.
  • The bounded input queue and poll (bitty#3268, CTX-1911) — 256 events
    per layer AND 256 KiB held text, per-event 4096-byte truncation cap, drop
    oldest + counted + sticky overflowed; the byte budget is charged against
    RC-5 (PerPlugin 1024 events / 256 KiB aggregate) of
    runtime/isolation-resource-rfc.md in THIS corpus
    — the owning RFC is
    cited, no free-floating constant. Poll result { status, seq, events, dropped, overflowed, reason } (crates/bitty-lua/src/host.rs:1172
    PanelPoll, :3501 panel_poll_value).
  • The events — panel.content.released { owner, handle, reason } and
    panel.content.input-available { owner, handle, queued }
    (crates/bitty-plugin-host/src/event.rs:265/266), observation-only,
    bounded 64-deep buffer with counted drops
    (crates/bitty-runtime/src/runtime/ui_panel.rs:116).
  • Close-path restore of the displaced PTY (bitty#3269, CTX-1912) —
    close_view releases first and does not close (refused release blocks
    the close); plugin panel close releases by panel identity; workspace close
    sweeps before teardown (crates/bitty-terminal/src/chrome_keys.rs:1604,
    crates/bitty-runtime/src/runtime/workspaces.rs:2782,
    runtime/panel_content.rs:403).
  • The producer wire and tick pump (CTX-1929 = bitty#3299) — the
    RuntimePanelContentBackend installed at the composition root before
    activation (crates/bitty-terminal/src/plugin_runtime.rs:2155) and pumped
    on the app cold tick right after the plugin-timer pump
    (crates/bitty-terminal/src/terminal_app.rs:2620, :3254).
  • Mode moves under a presented layer (bitty#3302, CTX-1931) — tiled and
    floating are the answerable modes; the layer's identity, attachment,
    token, content, and the displaced terminal's winsize survive the move; no
    SIGWINCH; fullscreen and scratchpad parse but are refused typed at the
    single gate (PanelError::ContentPresentationUnsupported,
    crates/bitty-runtime/src/runtime/panel_content.rs:1022) before any state
    moves. The user drivers (bitty ctl panel mode p:N tiled|floating [TOKEN],
    crates/bitty-terminal/src/ctl/request.rs:544; ctrl+alt+a
    toggle_panel_mode, crates/bitty-config/src/keymap.rs:1048) route
    through the same gate and changed no plugin surface.

Accuracy notes

  • The design contract source is bitty-terminal-docs
    specifications/panel-gui-content-presentation-candidate.md — a draft
    candidate
    . The page labels it as such everywhere and never describes it
    as accepted; the accepted Plugin API v1 Lua Surface RFC does not name
    ui.panel and is not amended by this PR (same rule as the ui.present
    section of sdk/reference/ui.md).
  • Every budget constant is cited with its owning RFC from this corpus
    (RC-5 in runtime/isolation-resource-rfc.md); scene budgets are
    cross-linked to the existing reference pages instead of restated.
  • Covering tests: crates/bitty-runtime/tests/ui_panel_api.rs (15 contract
    rows), panel_content_presentation.rs (close-path restore),
    panel_content_presentation_modes.rs (8 mode rows) — added to the
    bitty.ui row of the reference index, pinned to bitty@944a4b1f.

Gates

just check green from the worktree (prettier 3.9.6 fmt-check, markdownlint
0.23.1 — 0 issues in 114 files, links, metadata, language, agents, hygiene,
svg, actionlint), plus act -n --action-offline-mode -W .github/workflows/ci.yml dry-run success. The first bun on the default
PATH segfaults in this environment; the real bun at
~/.local/share/bun/bin ran every pinned tool unchanged.

Related bitty-terminal/bitty#2388

…ation surface

Add sdk/reference/ui-panel.md, a companion reference page for the
plugin-facing panel-content presentation surface landed under bitty#2388
(residue item 4, author-guide half): present/update/release with the closed
spec table, poll with the bounded Core-owned input queue, the
panel.content.* events, the close-path restore of the displaced PTY
(bitty#3269), the app producer wire and cold-tick pump (bitty#3299), and
the mode-move matrix with the fullscreen/scratchpad typed refusals at the
single gate (bitty#3302). Every behavior claim is pinned to bitty@944a4b1f
with file:line evidence; the queue's byte budget is tied to RC-5 of
runtime/isolation-resource-rfc.md, and the contract source stays labeled a
draft candidate, never accepted.

Index: extend the bitty.ui row's covering tests and add the companion-page
paragraph in sdk/reference/README.md; prettier realigned the namespace
table, so the diff re-pads rows this change did not edit.

Related bitty-terminal/bitty#2388
@Xuepoo Xuepoo added docs Documentation P2 Priority: medium area:docs Documentation area area:plugins labels Nov 21, 2026
@Xuepoo Xuepoo added this to the v0.1.0 milestone Nov 21, 2026
@Xuepoo
Xuepoo merged commit 08170b4 into main Nov 21, 2026
4 checks passed
@Xuepoo
Xuepoo deleted the ctx-0108/docs-ui-panel branch November 21, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation area area:plugins docs Documentation P2 Priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant