Skip to content

feat(plugins): compact composer actions and host-rendered composer tasks - #201695

Merged
obviyus merged 17 commits into
mainfrom
better-composer-ui
Nov 19, 2026
Merged

obviyus merged 17 commits into
mainfrom
better-composer-ui

Conversation

@obviyus

@obviyus obviyus commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

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 lives in the pane's retained composer state and 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).
  • 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.

Evidence

  • New e2e ui/src/e2e/native-plugin-composer.e2e.test.ts (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; 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: 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 (attached below).
  • 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.

…aft proposals

Composer actions with an icon render in the composer toolbar with a pressed state. Accessories can attach above the composer input. composer.propose offers a replacement draft the user accepts (Tab) or dismisses (Escape); accepting is one undoable edit and nothing is sent.
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: L labels Nov 19, 2026
@obviyus

obviyus commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

Real run, source Gateway from this branch, real Anthropic model, linked @obviyus/better-prompt (not bundled): click → progress card in the composer float → text typed during the run is kept → proposal → Tab replaces the draft (2,396 chars) → Undo restores the exact draft. 5 model requests, 37 s, zero chat.send.

Running: icon pressed, progress card in the composer float

Proposal: Use (Tab) / Dismiss (Esc); draft untouched

After Use: one-row receipt with Undo

better-real-run.mp4

Before (Peanutto today) / after

@obviyus
obviyus marked this pull request as draft November 19, 2026 07:32
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 19, 2026
…ssories

composer.startTask shows one card above the input that changes in place from working (steps, clock, Cancel) to a proposal or a failure (Try again). The invoking action shows pressed while it works. Undo uses the editor's history so mentions survive. Drops the composer accessory placement and the pressed resolve field.
@obviyus obviyus changed the title feat(plugins): compact composer actions, composer accessories, and draft proposals feat(plugins): compact composer actions and host-rendered composer tasks Nov 19, 2026
@obviyus

obviyus commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

Real run on the rebuilt API (head a6d6af8): source Gateway from this branch, real Anthropic model, @obviyus/better-prompt using only composer.startTask (no plugin card or CSS). Host card: working with steps (incl. a real failed tool) → proposal → Tab replaces the draft (1,990 chars) → Undo restores the exact draft. Text typed during the run was kept; zero chat.send; 5 model requests.

Working: host task card with steps, clock, Cancel; icon pressed

Proposal in the same card: Use (Tab) / Dismiss (Esc)

After Use: receipt with Undo

better-task-run.mp4

@obviyus
obviyus marked this pull request as ready for review November 19, 2026 07:54
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

Adds compact plugin composer buttons and host-rendered task cards with progress, cancellation, draft proposals, and undo.

Example: A Rewrite action transforms “first draft” into “A rewritten draft.”

  • Before: The plugin must render its own progress UI and replace the draft directly.
  • After: The host displays progress and a proposal; Tab accepts it, and Undo restores “first draft” without sending.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful direction with sufficient shipped-UI evidence, but a keyboard-access defect and attributable required-check failures prevent readiness.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after imagery and current-head working, proposal, and receipt screenshots, supported by the author's source-Gateway/real-model run report covering preserved typing, Tab acceptance, Undo, and zero chat.send; video inspection was unavailable because the prepared manifest records ffprobe ENOENT, so no video-only result is claimed.
Patch quality 🦪 silver shellfish (2/6) 4 actionable review findings remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Plugins must build their own progress and result UI or overwrite the user's draft directly.
Reason: The maintainer-authored direction adds a reusable capability demonstrated by a real plugin, while preserving existing actions and replacement composers.

Merge readiness

⛔ Needs changes before merge - 4 items remain

Keep open: this maintainer-authored PR adds a useful plugin capability, but keyboard access to complete proposals and diff-caused CI failures need repair.

Priority: P2
Reviewed head: a6d6af859fd2e314d326a4aaa110ea0a5e028652

Before merge

  • [P2] Make full proposal expansion reachable by keyboard (P2) - A long rewrite is clamped to two lines, but the only way to reveal the rest is clicking this paragraph. It has no focus target or keyboard activation, so a keyboard-only user cannot inspect the complete proposed replacement before accepting it. Provide a native disclosure or button that expands the existing card.
  • [P2] Keep the task UI within the enforced asset budgets (P2) - The eager task renderer and added styles produce a diff-attributable performance-gate failure. The paired check reports Chat boot JS at 1302.8 KiB against 1301.1 KiB, raw CSS growth of 3776 bytes, and gzip CSS growth of 606 bytes; the already-over-budget CSS base permits only 64 bytes of variance. Reduce or defer the optional task implementation and reuse existing styles so the required comparison passes.
  • [P2] Use the canonical monospace theme token (P2) - The host defines --mono, while --font-mono is an explicitly rejected undefined alias. This declaration uses generic fallback typography instead of the host font and causes base-theme-tokens.node.test.ts to fail on the reviewed head. Replace the alias with --mono without changing the existing test.
  • [P2] Preserve the action cursor contract for proposal expansion (P2) - This pointer cursor is attached to a state-changing expansion control. The UI guide requires the default action cursor for this operation, and cursor-policy.node.test.ts now fails specifically on this selector. Use the existing action cursor rather than adding an exception to the contract test.

Findings

  • [P2] [P2] Make full proposal expansion reachable by keyboard — ui/src/pages/chat/components/chat-composer-task-card.tsx:161-164
  • [P2] [P2] Keep the task UI within the enforced asset budgets — ui/src/pages/chat/components/chat-composer-view.tsx:39
  • [P2] [P2] Use the canonical monospace theme token — ui/src/styles/chat/composer-progress.css:832
Agent review details

How this fits together

Control UI plugin actions receive a pane-scoped composer handle; the pane presents task progress and proposals, while the existing input and editor history own accepted draft edits.

flowchart LR
  Plugin[Plugin composer action] --> Handle[Scoped composer handle]
  Handle --> Tasks[Pane task owner]
  Tasks --> Card[Host task card]
  Card --> Choice[User accepts or dismisses]
  Choice --> Editor[Composer input and history]
Loading

Technical review

Best possible solution:

Retain the pane task owner and existing editor history, make proposal expansion keyboard-accessible, and repair stylesheet contracts and asset growth.

Do we have a high-confidence way to reproduce the issue?

Source inspection establishes the keyboard-only expansion failure, and exact-head GitHub annotations independently establish the stylesheet and asset-budget failures; no local execution was performed.

Is this the best way to solve the issue?

A generic host-owned task card addresses the missing capability coherently, preserves scoped action execution, and reuses editor history rather than introducing a separate draft or undo owner.

Full review comments:

  • [P2] [P2] Make full proposal expansion reachable by keyboard — ui/src/pages/chat/components/chat-composer-task-card.tsx:161-164
    A long rewrite is clamped to two lines, but the only way to reveal the rest is clicking this paragraph. It has no focus target or keyboard activation, so a keyboard-only user cannot inspect the complete proposed replacement before accepting it. Provide a native disclosure or button that expands the existing card.
    Confidence: 0.99
  • [P2] [P2] Keep the task UI within the enforced asset budgets — ui/src/pages/chat/components/chat-composer-view.tsx:39
    The eager task renderer and added styles produce a diff-attributable performance-gate failure. The paired check reports Chat boot JS at 1302.8 KiB against 1301.1 KiB, raw CSS growth of 3776 bytes, and gzip CSS growth of 606 bytes; the already-over-budget CSS base permits only 64 bytes of variance. Reduce or defer the optional task implementation and reuse existing styles so the required comparison passes.
    Confidence: 0.98
  • [P2] [P2] Use the canonical monospace theme token — ui/src/styles/chat/composer-progress.css:832
    The host defines --mono, while --font-mono is an explicitly rejected undefined alias. This declaration uses generic fallback typography instead of the host font and causes base-theme-tokens.node.test.ts to fail on the reviewed head. Replace the alias with --mono without changing the existing test.
    Confidence: 1
  • [P2] [P2] Preserve the action cursor contract for proposal expansion — ui/src/styles/chat/composer-progress.css:783
    This pointer cursor is attached to a state-changing expansion control. The UI guide requires the default action cursor for this operation, and cursor-policy.node.test.ts now fails specifically on this selector. Use the existing action cursor rather than adding an exception to the contract test.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7db69bedeab6.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/styles/base-theme-tokens.node.test.ts ui/src/styles/cursor-policy.node.test.ts
  • pnpm exec vitest run --config test/vitest/vitest.ui-e2e.config.ts ui/src/e2e/native-plugin-composer.e2e.test.ts
  • pnpm ui:check-performance:base 7f6b6d7
  • pnpm tsgo:ui
  • pnpm check:control-ui-controllers

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit f1d40db adds ui/src/plugins/control-ui-actions.ts:118 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f1d40db4d99b; files: ui/src/plugins/control-ui-actions.ts)
  • Peter Steinberger: Raw commit 8638483 adds ui/src/plugins/control-ui-contributions.solid.tsx:30 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8638483c96e9; files: ui/src/plugins/control-ui-contributions.solid.tsx)

PR surface

Source +945, Tests +267, Docs +44. Total +1256 across 22 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 18 1021 76 +945
Tests 3 271 4 +267
Docs 1 44 0 +44
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 1336 80 +1256

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Useful optional plugin functionality with localized accessibility and validation defects; no urgent production outage is established.
  • add merge-risk: 🚨 compatibility: The PR extends the public composer handle and changes placement for icon-bearing actions; its maintainer-authored direction, preserved setDraft behavior, replacement-composer fallback, and documented SDK impact make this an accepted additive contract change.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Useful optional plugin functionality with localized accessibility and validation defects; no urgent production outage is established.
  • merge-risk: 🚨 compatibility: The PR extends the public composer handle and changes placement for icon-bearing actions; its maintainer-authored direction, preserved setDraft behavior, replacement-composer fallback, and documented SDK impact make this an accepted additive contract change.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 19, 2026, 3:11 AM ET / 08:11 UTC.

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 19, 2026
@obviyus

obviyus commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

Final head ffc0c06: real run with a real model on a source Gateway (Better proposal, then Use with the Undo receipt), plus the 360 px layout with a long title.

Better proposal from a real model above the composer

Draft replaced with Undo receipt, nothing sent

360 px proposal: long title truncates, Dismiss and Use stay inside

360 px receipt: Undo stays inside

@obviyus
obviyus merged commit a3d7e40 into main Nov 19, 2026
125 checks passed
@obviyus
obviyus deleted the better-composer-ui branch November 19, 2026 11:39
@obviyus

obviyus commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in a3d7e40.

What it adds: plugins can put a composer feature in the composer toolbar as an icon, and run it as a host-drawn task card: working with steps and Cancel, then a proposal with Use (Tab) / Dismiss (Esc), or a failure with Try again. Use replaces the draft as one undoable edit; nothing is sent until the user presses Enter.

Proof on the merged head:

  • 9 new composer-task e2e tests plus the 6 existing native plugin UI e2e tests, and the unit tests, all green.
  • A real run with a real model through a source Gateway: the proposal arrived, the draft stayed until Use, Use inserted the rewrite, Undo restored the original (screenshots above).
  • Clean local review and green CI on ffc0c06. Chat boot JS grows +849 B gzip with an approved limit; the card and task owner load only on first use.

obviyus added a commit that referenced this pull request Nov 19, 2026
…ult (#201898)

## What Problem This Solves

A composer action that rewrites the draft, like Better, has two rough edges with the task card from #201695:

- It can be clicked with an empty composer, though it only works on text the user typed. The SDK gave `resolve` no way to see the draft.
- Its result always waits behind **Use**. For an action whose result the user asked for and nearly always takes, that extra step is friction: they already pressed the button.

## User Impact

- A composer action's `resolve` receives the pane's current `draft`, and the host re-resolves as the user types. An action can return `{ disabled: !draft.trim() }` and stay disabled until there is text, like the send button.
- `task.propose(text, { title, insert: true })` (and `composer.propose`) replaces the draft at once: the same single editor undo step and **Draft replaced · not sent · Undo** receipt as **Use**, never sent. While dictation or a pending goal locks the editor, or during IME composition, it falls back to the proposal card so **Use** writes it once the editor is writable.

Both are optional and additive; existing actions behave as before.

## Why This Change Was Made

- **One owner:** the pane's task owner does the insert through the same path as **Use** (`apply`: settle as accepted, one editor replacement, receipt). It reads the editor through an accessor that returns nothing mid-composition, so the lock rule stays the same as **Use**.
- **Resolve sees the draft where it already runs:** the contributions renderer reads the handle's reactive `draft`, so a disabled state follows typing without a new subscription; the runner passes the same draft to `resolve` before running, so a stale click on a disabled action is refused.

## Evidence

- **New e2e** in `ui/src/e2e/native-plugin-composer.e2e.test.ts`: an icon action with `resolve: ({ draft }) => ({ disabled: !draft?.trim() })` is disabled on an empty composer and enabled after typing; its `insert: true` result replaces the draft with no proposal card, resolves `"accepted"`, Undo restores the draft, zero `chat.send`. All 10 composer-task e2e tests and the unit tests pass.
- `tsgo:ui`, `tsgo:core`, oxlint, oxfmt, `check:control-ui-controllers`, line-cap and test-lines ratchets.
- Real run with a real model on a source Gateway from this branch with the Better plugin: screenshots in the comments.
- Chat boot JS is unchanged against main (the task owner reads the pane state itself, so no new wiring loads with a chat).

**SDK impact.** Additive: optional `draft` in a composer action's `resolve` context, optional `insert` on `ControlUiDraftProposal`. `ControlUiAction` has no ClawHub or bundled consumers besides Better (checked for #201695).

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 19, 2026
…201939)

## What Problem This Solves

On a phone, an empty composer the user is not typing in rests as one line: **+**, the placeholder, microphone and send. Its stylesheet hides every other control. A plugin composer action with an icon (#201695), such as Better, still showed: it dropped to its own row under the one-line composer and made it taller.

## Cause

The contributions element set `host.style.display = "contents"` inline. The resting layout hides the lead's other controls with a stylesheet `display: none`, which an inline style outranks, so the plugin's toolbar slot stayed visible. `base.css` already gives `openclaw-plugin-contributions` `display: contents`, so the inline style was redundant.

## Fix

Remove the inline style. The resting phone composer hides toolbar actions like its other controls; typing or focusing the composer shows the full toolbar again, including the action. An action like Better is disabled on an empty draft anyway.

## Evidence

- New e2e (`native-plugin-composer.e2e.test.ts`, 390px phone): the resting composer hides the icon action, and typing shows it. Red on main (`expected true to be false`), green with the fix.
- All composer-task and native plugin UI e2e (17) and `control-ui-contributions` unit tests pass; `tsgo:ui`, oxlint.
- `chat-composer-size.e2e.test.ts` 360/375px active-run cases fail identically on unmodified main; unrelated.
- Before/after phone screenshots in the comments.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
…sks (openclaw#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 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
…ult (openclaw#201898)

## What Problem This Solves

A composer action that rewrites the draft, like Better, has two rough edges with the task card from openclaw#201695:

- It can be clicked with an empty composer, though it only works on text the user typed. The SDK gave `resolve` no way to see the draft.
- Its result always waits behind **Use**. For an action whose result the user asked for and nearly always takes, that extra step is friction: they already pressed the button.

## User Impact

- A composer action's `resolve` receives the pane's current `draft`, and the host re-resolves as the user types. An action can return `{ disabled: !draft.trim() }` and stay disabled until there is text, like the send button.
- `task.propose(text, { title, insert: true })` (and `composer.propose`) replaces the draft at once: the same single editor undo step and **Draft replaced · not sent · Undo** receipt as **Use**, never sent. While dictation or a pending goal locks the editor, or during IME composition, it falls back to the proposal card so **Use** writes it once the editor is writable.

Both are optional and additive; existing actions behave as before.

## Why This Change Was Made

- **One owner:** the pane's task owner does the insert through the same path as **Use** (`apply`: settle as accepted, one editor replacement, receipt). It reads the editor through an accessor that returns nothing mid-composition, so the lock rule stays the same as **Use**.
- **Resolve sees the draft where it already runs:** the contributions renderer reads the handle's reactive `draft`, so a disabled state follows typing without a new subscription; the runner passes the same draft to `resolve` before running, so a stale click on a disabled action is refused.

## Evidence

- **New e2e** in `ui/src/e2e/native-plugin-composer.e2e.test.ts`: an icon action with `resolve: ({ draft }) => ({ disabled: !draft?.trim() })` is disabled on an empty composer and enabled after typing; its `insert: true` result replaces the draft with no proposal card, resolves `"accepted"`, Undo restores the draft, zero `chat.send`. All 10 composer-task e2e tests and the unit tests pass.
- `tsgo:ui`, `tsgo:core`, oxlint, oxfmt, `check:control-ui-controllers`, line-cap and test-lines ratchets.
- Real run with a real model on a source Gateway from this branch with the Better plugin: screenshots in the comments.
- Chat boot JS is unchanged against main (the task owner reads the pane state itself, so no new wiring loads with a chat).

**SDK impact.** Additive: optional `draft` in a composer action's `resolve` context, optional `insert` on `ControlUiDraftProposal`. `ControlUiAction` has no ClawHub or bundled consumers besides Better (checked for openclaw#201695).

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
…penclaw#201939)

## What Problem This Solves

On a phone, an empty composer the user is not typing in rests as one line: **+**, the placeholder, microphone and send. Its stylesheet hides every other control. A plugin composer action with an icon (openclaw#201695), such as Better, still showed: it dropped to its own row under the one-line composer and made it taller.

## Cause

The contributions element set `host.style.display = "contents"` inline. The resting layout hides the lead's other controls with a stylesheet `display: none`, which an inline style outranks, so the plugin's toolbar slot stayed visible. `base.css` already gives `openclaw-plugin-contributions` `display: contents`, so the inline style was redundant.

## Fix

Remove the inline style. The resting phone composer hides toolbar actions like its other controls; typing or focusing the composer shows the full toolbar again, including the action. An action like Better is disabled on an empty draft anyway.

## Evidence

- New e2e (`native-plugin-composer.e2e.test.ts`, 390px phone): the resting composer hides the icon action, and typing shows it. Red on main (`expected true to be false`), green with the fix.
- All composer-task and native plugin UI e2e (17) and `control-ui-contributions` unit tests pass; `tsgo:ui`, oxlint.
- `chat-composer-size.e2e.test.ts` 360/375px active-run cases fail identically on unmodified main; unrelated.
- Before/after phone screenshots in the comments.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 20, 2026
…eturning chat (#202243)

## What Problem This Solves

Two gaps in composer tasks (#201695), found while using the Better plugin:

- **No send.** An action whose result the user wants sent right away ("rewrite and send") had to insert it and leave the user to press Enter.
- **Work is dropped on a chat switch.** Leaving the chat retires the action, so its card disappears while the work it started (a Gateway run) keeps going. Coming back shows nothing, the work is unreachable, and the plugin cannot even stop it because its UI handle has ended. In Better this surfaced as "already running; Cancel stops it" with no card and no Cancel.

## User Impact

- `task.propose(text, { title, send: true })` inserts the text and then sends it through the composer's own send, as Enter would: same admission, follow-up queueing, connection, dictation, goal and pending-attachment checks. When the composer cannot send yet, the inserted draft stays unsent with its Undo receipt; a locked editor keeps the proposal for Use, as with `insert`.
- A composer action can declare `attach`. The host calls it, with the same context as `run`, each time a built-in composer shows the chat (mount, chat switch, return from another page), so the action can start a task again and follow its earlier work. `startTask({ startedAt })` keeps the original elapsed clock. Leaving still aborts the action's `signal` and retires the card; the action keeps its work going and stops it only when the task's signal aborts while `signal` has not (the user's Cancel).

Both are optional and additive.

## Why This Change Was Made

- **Send goes through the existing owner.** The mounted composer publishes its send beside its Escape stop policy (`state.sendDraft`, cleared on unmount), and `submitDraft` now reports whether it submitted. The task owner calls it after inserting; no second send path.
- **Attach is a presentation event, not a retained handle.** Composer handles still retire on chat switch, so a retained handle never touches another chat's draft. `attach` gets a fresh handle bound to the chat being shown, once per presentation lifetime, after the render settles. The work's own owner (the plugin's Gateway run) decides whether there is anything to show.

## Evidence

- New e2e in `native-plugin-composer.e2e.test.ts`: `send: true` produces exactly one `chat.send` with the rewritten text and clears the composer (red without the send: 0 sends); a running task leaves with its chat and returns with the original clock (`1m 0Xs`) when the chat is shown again, then inserts its result there.
- All composer-task and native plugin UI e2e (19) and unit tests pass; `tsgo:ui`, `tsgo:core`, oxlint, controller guard, line-cap and test-lines ratchets.
- Chat boot JS +73 B gzip vs the merge base, within the limit.

**SDK impact.** Additive: optional `send` on `ControlUiDraftProposal`, optional `attach` on `ControlUiAction`, optional `startedAt` on `startTask`. The only consumer is the Better plugin.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 21, 2026
…eturning chat (openclaw#202243)

## What Problem This Solves

Two gaps in composer tasks (openclaw#201695), found while using the Better plugin:

- **No send.** An action whose result the user wants sent right away ("rewrite and send") had to insert it and leave the user to press Enter.
- **Work is dropped on a chat switch.** Leaving the chat retires the action, so its card disappears while the work it started (a Gateway run) keeps going. Coming back shows nothing, the work is unreachable, and the plugin cannot even stop it because its UI handle has ended. In Better this surfaced as "already running; Cancel stops it" with no card and no Cancel.

## User Impact

- `task.propose(text, { title, send: true })` inserts the text and then sends it through the composer's own send, as Enter would: same admission, follow-up queueing, connection, dictation, goal and pending-attachment checks. When the composer cannot send yet, the inserted draft stays unsent with its Undo receipt; a locked editor keeps the proposal for Use, as with `insert`.
- A composer action can declare `attach`. The host calls it, with the same context as `run`, each time a built-in composer shows the chat (mount, chat switch, return from another page), so the action can start a task again and follow its earlier work. `startTask({ startedAt })` keeps the original elapsed clock. Leaving still aborts the action's `signal` and retires the card; the action keeps its work going and stops it only when the task's signal aborts while `signal` has not (the user's Cancel).

Both are optional and additive.

## Why This Change Was Made

- **Send goes through the existing owner.** The mounted composer publishes its send beside its Escape stop policy (`state.sendDraft`, cleared on unmount), and `submitDraft` now reports whether it submitted. The task owner calls it after inserting; no second send path.
- **Attach is a presentation event, not a retained handle.** Composer handles still retire on chat switch, so a retained handle never touches another chat's draft. `attach` gets a fresh handle bound to the chat being shown, once per presentation lifetime, after the render settles. The work's own owner (the plugin's Gateway run) decides whether there is anything to show.

## Evidence

- New e2e in `native-plugin-composer.e2e.test.ts`: `send: true` produces exactly one `chat.send` with the rewritten text and clears the composer (red without the send: 0 sends); a running task leaves with its chat and returns with the original clock (`1m 0Xs`) when the chat is shown again, then inserts its result there.
- All composer-task and native plugin UI e2e (19) and unit tests pass; `tsgo:ui`, `tsgo:core`, oxlint, controller guard, line-cap and test-lines ratchets.
- Chat boot JS +73 B gzip vs the merge base, within the limit.

**SDK impact.** Additive: optional `send` on `ControlUiDraftProposal`, optional `attach` on `ControlUiAction`, optional `startedAt` on `startTask`. The only consumer is the Better plugin.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant