feat(plugins): compact composer actions and host-rendered composer tasks (#201695)
## What Problem This Solves
A plugin that adds a composer feature (rewrite, translate, shorten, fill a template) could only add a full-width text button above the composer and write over the user's draft with `setDraft`. To show progress or offer a result, each plugin would have to draw its own card, copy the host's card styles, track its running state, and handle Cancel, chat switches, undo and screen readers itself.
## User Impact
Composer features from plugins can look and behave like the composer's own controls:
- **Compact actions:** a composer action with a host `icon` renders as a toolbar button after the attachment menu, with its label as tooltip and accessible name. Without an icon, or beside a replacement composer, it keeps the text button above the composer.
- **Composer tasks:** `composer.startTask({ title })` shows one card above the input that changes in place, so the composer never moves:
- **Working:** title, elapsed clock, **Cancel**, and the steps the plugin reports with `task.update({ steps, summary })`. The invoking action shows pressed; clicking it again cancels. Cancel, a chat switch, or the action retiring aborts `task.signal`.
- **Proposal:** `task.propose(text, { title })` offers the text with **Use** (Tab) and **Dismiss** (Escape), like composer predictions. Nothing changes and nothing is sent until the user accepts. Use replaces the draft as one editor history step; ⌘Z or the receipt's **Undo** restores the previous draft, mentions included.
- **Failure:** `task.fail(message)` shows the message with **Dismiss** and **Try again** (runs the action again).
- `composer.propose(text, { title })` offers a draft without a working phase.
`setDraft`, composer actions without an icon, and `session-header` accessories are unchanged.
## Why This Change Was Made
Working backwards from the final UI of a real plugin (`@obviyus/better-prompt`, not bundled) showed that lower-level seams (a composer accessory slot plus a separate proposal) push every plugin into duplicating the same card, layout coordination and lifecycle. The host now owns that once:
- **One owner per pane:** `createComposerTasks` (`ui/src/lib/chat/composer-tasks.runtime.ts`) owns the task card, its outcome, the accept/undo receipt, and whether the pane can show tasks (a mounted card; a replacement composer has none, so `startTask` throws and `propose` rejects there). It loads with the first plugin composer action, so idle chats never fetch it; a failed fetch retries on the next action, and concurrent first loads share one owner.
- **Edge cases the owner settles:** a newer task aborts the previous one at once; an action that rejects fails its own latest task, and a rejection after the task settled reaches the inline alert (an Undo receipt stays); a failure never takes over another action's card; Use and Undo wait while dictation or a pending goal locks the editor; the receipt retires when its editor unmounts.
- **Host patterns and tokens:** the toolbar button uses `agent-chat__input-btn`; the card uses the attached-card tokens of the task-progress card; proposals follow the prediction's Tab/Escape keys and live region; motion uses host tokens and stops under reduced motion.
- **Undo through the editor:** the editor bridge gains `replaceAll` (one isolated history step) and `undo`, so Undo restores mention identities; any later draft change retires the receipt, so Undo never steps over newer text.
- **Contributions renderer:** composer actions run through one shared path for text and icon buttons; pressed state comes from the pane's running task. Long proposal titles truncate so Use, Dismiss and Undo stay inside the card on mobile.
- **Budget:** chat boot JS grows +849 B gzip (the toolbar runner, keys and wiring; the card and owner load lazily). The limit records that measurement plus 64 B, approved by Ayaan. Total CSS grows +56 B, within the allowed build variance.
## Evidence
- **New e2e** `ui/src/e2e/native-plugin-composer.e2e.test.ts` (9, inline fixture plugin): working card in `agent-chat__composer-float` with steps, pressed icon cancels and aborts the task signal; failure shows in place and Try again reruns the action; a failed toolbar action reports without resizing the composer; a replaced task aborts at once and the latest one fails on rejection; a rejection after settling reports without dropping the Undo receipt; a late failure leaves another action's task alone; Tab accepts as one edit and Undo restores the draft, with zero `chat.send`; the receipt retires after an external `setDraft` and stays retired; Escape and a chat switch dismiss.
- **Existing e2e** `native-plugin-ui.e2e.test.ts` (6) green.
- **Unit:** `composer-tasks.runtime` (proposal and Undo wait while the editor is locked), `control-ui-contributions` (13, including icon actions above a replacement composer), `chat-pane-lifecycle`.
- **A real plugin on this API**, against mocked Gateway traffic and the real built bundle: zero `chat.send`, text typed during the run kept, Cancel restores idle, layout shift 0 with no composer resize from click to proposal; light, dark, reduced-motion and mobile frames. Plus a real run with a real model on a source Gateway from this branch (screenshots in the PR comments).
- `tsgo:core`, `tsgo:ui`, `tsgo:core:test`, oxlint, `check:control-ui-controllers`, `ui:i18n:verify`. New strings are English; the locale refresh workflow translates after merge.
**SDK impact.** Additive: optional `icon` on `ControlUiAction`; `startTask` and `propose` on the composer handle, with `ControlUiComposerTask`, `ControlUiComposerTaskStep`, `ControlUiDraftProposal`, `ControlUiDraftProposalOutcome` types. Static usage (ClawHub 2,675 plugins, bundled 187): `ControlUiAction` 0 consumers; `ControlUiAccessory` 1 (Workboard, `session-header`, unchanged). Coverage gaps: ClawHub 423 partial, bundled 11 partial and 6 failed.
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Current
·
C2
·2026-11
feat(plugins): compact composer actions and host-rendered composer ta…
Find Your Interest
- Introducing Multirange: A tiny polyfill for HTML5.1 two-handle sliders
- HTML APIs: What they are and how to design a good one
- 5 storylines to watch in Jaguars vs. Giants in Week 11
- Is the cold email dead?
- A look at web components
- Markapp: A list of HTML libraries
- I’m going to MIT!!
- I Let My AI Agent Take Over My Life. Then It Started Making Decisions for Me
- We have a Slopware Factory
- Building a bike computer from scratch
Current
·
C2
·2026-11






