Repository navigation
feat(plugins): composer actions can need a draft and insert their result - #201898
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesComposer actions can resolve against the current draft and optionally insert a proposed result immediately with Undo. Example: A rewrite action transforms “first draft” into “A rewritten draft.”
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds useful composer capabilities through the existing owner, with inspected live screenshots and no concrete correctness finding. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherControl UI plugin actions receive pane context, invoke the pane's composer task owner, and produce editor replacements or proposal cards with an Undo receipt. flowchart LR
A[Pane draft] --> B[Action resolver]
B --> C[Plugin action]
C --> D[Composer task owner]
D --> E[Writable editor]
D --> F[Proposal card]
E --> G[Undo receipt]
F --> E
Technical reviewBest possible solution: Retain the optional SDK additions and shared task-owner insertion path while preserving existing proposal defaults and Undo. Do we have a high-confidence way to reproduce the issue? This is an additive feature request; current-main source confirms that resolve lacks draft context and proposals always await acceptance. Is this the best way to solve the issue? The implementation is appropriately small: reactive draft context reaches the existing resolver, and immediate insertion shares the existing acceptance operation without another state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 44267df6c5ea. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +42, Tests +32, Docs +5. Total +79 across 9 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 19, 2026, 10:13 AM ET / 15:13 UTC. |
|
Landed in 5aed410. Composer actions can now stay disabled until there is a draft ( |
…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]>



What Problem This Solves
A composer action that rewrites the draft, like Better, has two rough edges with the task card from #201695:
resolveno way to see the draft.User Impact
resolvereceives the pane's currentdraft, 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 })(andcomposer.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
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.draft, so a disabled state follows typing without a new subscription; the runner passes the same draft toresolvebefore running, so a stale click on a disabled action is refused.Evidence
ui/src/e2e/native-plugin-composer.e2e.test.ts: an icon action withresolve: ({ draft }) => ({ disabled: !draft?.trim() })is disabled on an empty composer and enabled after typing; itsinsert: trueresult replaces the draft with no proposal card, resolves"accepted", Undo restores the draft, zerochat.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.SDK impact. Additive: optional
draftin a composer action'sresolvecontext, optionalinsertonControlUiDraftProposal.ControlUiActionhas no ClawHub or bundled consumers besides Better (checked for #201695).