Skip to content

Make composer selection reactive and move Automation/Plugin rows into plugins - #4502

Merged
ymichael merged 10 commits into
mainfrom
bb/expose-reactive-composer-selection-thr_p2z4un62de
Sep 29, 2026
Merged

ymichael merged 10 commits into
mainfrom
bb/expose-reactive-composer-selection-thr_p2z4un62de

Conversation

@ymichael

@ymichael ymichael commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

After #4474, plugins could write composer picker settings but could not reactively read them. The Automation and Plugin creation rows were also hard-coded in the core + menu, so the plugins that own those features could not contribute them. The menu's command rows edited the draft relative to the cursor (replacing a preceding action or a half-typed command, skipping duplicates), which plugins cannot reproduce because they cannot see the cursor.

What changed

  • Added composer.selection: ComposerSelection | null, with stable snapshots and subscriptions in useComposer and useComposers. It reports the thread (including handoff) and new-thread pickers, and the read-only pickers of queued-message and sent-message editors: the thread's provider with the queued message's or the thread composer's settings. Composers without pickers return null. setSelection retains partial updates.
  • Plan, Goal, Automation, and Plugin rows now put their command or prompt at the start of the draft, replacing a leading command pill; clicking the same row again changes nothing. Commands work anywhere in a message, but Automation and Plugin are sentence starters and /goal is passed to Codex as text, so the start is the only position that matters. This removes the cursor-based replacement and duplicate logic from [codex] Replace prompt plus menu PR #194; a half-typed /pl is no longer replaced. Skills still inserts its trigger at the cursor because it opens the skills picker.
  • Moved the Automation row into the Automations plugin and Plugin creation into default-enabled BB Guide. Both insert their sentence ("Create a new bb automation to" / "Create a new bb plugin that") with the existing composer.replace; there is no new composer method. Core applies the same rule to its provider-declared Plan/Goal rows. Explicit menu-row icons now take precedence over plugin branding, so both rows keep their original icons.
  • Both rows appear in the same composers as on main, including the sent-message editor: plugin + menu rows are exempt from its customization suppression, while actions, banners, send-menu rows, and rich text remain suppressed there.
  • Removed the /automation macro from core: it is no longer offered in slash autocomplete, converted on paste, or expanded to the automation sentence on send (along with the legacy /loop alias). Core no longer knows about Automations. An unsent local draft that already holds an /automation pill now sends it as literal text.
  • Bumped the SDK to 0.6.2 for selection. Automations and BB Guide require SDK 0.6.0 for replace. Updated the Plugin Guide, authoring references, and API audit. These are client-local changes; no database, server/daemon wire, or CLI changes.

How you verified

  • pnpm exec turbo run test --filter=@bb/app on the promptbox, plugin, embedded-chat, thread-detail, and lib suites plus useCommandSuggestions: 1931 passed. Covers the prefix rule (existing text, later pills shifting, replacing a leading command, repeated clicks), core/plugin row order and icons in new-thread, thread, and queued-message composers, menu rows re-rendering on selection changes, queued and sent-message selections (including a bottom handoff), and plus-menu rows under suppression.
  • Turbo tests for client-core (277), the SDK (361), Plugin Guide (82), Automations (135), and BB Guide (7) passed, including new unit tests for the two plugins' draft transforms.
  • Turbo lint/typecheck for the app, client-core, SDK, Automations, BB Guide, and Plugin Guide passed with no errors. The SDK version check passes.
  • Embedded chat's queued host has no test harness and is covered by typecheck only. This version has not yet been checked in the app.

🤖 Generated with Claude Code

AGENT GENERATED

@ymichael ymichael changed the title Expose reactive composer selection snapshots Make composer selection reactive and move menu actions into plugins Sep 29, 2026
@ymichael
ymichael force-pushed the bb/expose-reactive-composer-selection-thr_p2z4un62de branch from 2b30fd3 to 4e3b595 Compare September 29, 2026 19:14
ymichael and others added 4 commits September 29, 2026 12:16
Queued-message and sent-message editors now report their picker values as
composer.selection, provider rows apply to every composer kind, and plugin
plus-menu rows are no longer hidden by the sent-message editor's customization
suppression. This restores main's Plan/Goal/Automation/Plugin placement.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ymichael
ymichael marked this pull request as ready for review September 29, 2026 21:50
Drop the visible menu-row field, and return Plan/Goal to core rows driven by
the provider's composerActions declaration as on main. Codex and Claude Code
no longer ship app entries, and the artifact-test staging change they needed
is reverted. Automation and Plugin stay plugin-owned.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ymichael ymichael changed the title Make composer selection reactive and move menu actions into plugins Make composer selection reactive and move Automation/Plugin rows into plugins Sep 29, 2026
ymichael and others added 2 commits September 29, 2026 15:22
Plan, Goal, Automation, and Plugin rows now put their command or prompt at
the start of the draft, replacing a leading command pill. Core applies the
rule to Plan/Goal; Automations and BB Guide apply it with composer.replace.
This removes experimental_applyCommand, the Plugin prompt action in core,
and the cursor-based replacement and dedupe logic from #194.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The Automation row now starts the draft with "Create a new bb automation to"
like the Plugin row. Core no longer offers /automation in autocomplete,
converts it on paste, or expands /automation and /loop pills on send, so the
prompt-action helper, the automation action kind, and client-core's
automation-prompt module are removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ymichael
ymichael merged commit 6c73106 into main Sep 29, 2026
20 checks passed
@ymichael
ymichael deleted the bb/expose-reactive-composer-selection-thr_p2z4un62de branch September 29, 2026 22:41
ymichael added a commit that referenced this pull request Nov 20, 2026
)

## Human comments

## What was wrong

Two plugin surfaces rendered contributions that then didn't behave as
the types and docs say.

- **Sent-message editor.** `ComposerBox` resolved plugin `+` rows with
the composer's scope. It resolved popups, send rows, rich-text effects
and draft observers with a null scope when customizations were
suppressed, and it turned composer commands off. So the sent-message
editor showed Prompt Library's "Prompts…" row, and clicking it did
nothing: the editor had no popups, so `openPopupForPlugin` returned
false. Ctrl+R did nothing there either.
- **Header thread actions.** The desktop header button for `placement:
"header"` thread actions read only `label`, `disabled` and `run`. It
dropped `icon`, `detail` and `variant`. The same actions showed all
three once they folded into the compact thread menu.

## What changed

**One rule for composer contributions.** `ComposerBox` now resolves
every contribution kind through one hook,
`useResolvedComposerContributions(scopeKind,
mountsScopedContributions)`, which replaces four separate hooks. The
rule:
- **What the user invokes on a composer runs in every composer:** `+`
rows, the popups they open, and composer commands.
- **What mounts by scope mounts only where plugin customizations are
allowed:** actions, banners, send rows, rich-text effects and draft
observers.

`+` rows were already exempt on purpose (#4502), so bb's own Automation
and Plugin rows keep working in the sent editor. Send rows stay out
because "Send later" would schedule a new message instead of saving the
edit.

**Header actions match the menu.** The desktop header now draws what the
compact menu draws:
- **Main button:** the action's icon and label. `detail` is its tooltip,
and destructive actions get red text.
- **Split-button menu rows:** drawn like thread-menu rows (icon, a muted
detail line, destructive styling). `SplitButton` gained an optional
`variant`.
- **bb's own buttons:** the Commit button now shows its GitBranch icon,
in line with the icon-led Open button.

I didn't narrow the type instead, because all 21 community header-action
plugins return an `icon`. `experimental_bulkItem` was never used for
header actions, which selection menus leave out; that is now documented.

**Docs.**
- Plugin SDK JSDoc updated on `PluginThreadActionPlacement`,
`experimental_bulkItem` and `ComposerCustomization.scopes`.
- Also updated: the bb-guide authoring references, the Plugin Guide
thread-header card and `docs/api_to_audit.md`.
- Plugin SDK bumped to 0.6.167.

**Known limitation, not changed here.** Composer popups and the `@`
mention menu open above an inline editor. When the message being edited
is near the top of the timeline, as the first message of a short thread
is, they render off-screen. The same happens on main.

## How you verified

Each new test fails on main and passes with this change:
- **`composer-contract.test.tsx`:** new rows on all six composer
surfaces, using bb's composer:
  - Other plugins' `+` rows each open their popup in that composer.
  - Send rows, banners and actions mount only on customizable surfaces.
  - `scopes` filters every kind.

On main, only the sent-message editor row fails: the popup never opens.
- **`composer-commands.test.tsx`:** a plugin composer command runs in a
composer with customizations suppressed.
- **`ThreadDetailHeader.test.tsx`:** three cases (a single button, a
split button, a destructive main action) check the icon, the detail
tooltip, destructive styling, and the menu rows' text, icon and variant.

Commands run:
- `pnpm exec turbo run typecheck lint --filter=@bb/app
--filter=@get-bb/plugin-sdk --filter=bb-plugin-plugin-api-docs`: passed.
- `pnpm exec turbo run test --filter=@bb/app
--filter=bb-plugin-plugin-api-docs --filter=bb-plugin-bb--composer
--filter=bb-plugin-bb-guide`: passed (@bb/app: 7259 passed).

Live check with `pnpm start:worktree` in headless Chrome:
- **Sent-message editor:** on a main build, clicking `+` → "Prompts…" in
the sent-message editor opened nothing. With this change, the Prompt
Library popup opens.
- **Desktop header:** with a probe plugin, the desktop header showed a
plain "Review" / "Block merge" split button on main. With this change it
shows the icon, the detail tooltip and a red row with its detail line,
matching the compact menu. bb's Commit button now shows its icon.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant