Skip to content

Honour plugin composer and header contributions where they render - #7873

Merged
ymichael merged 3 commits into
mainfrom
bb/sent-editor-header-thread-actions-honour-plugin-thr_gzhwb84v53
Nov 20, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/sent-editor-header-thread-actions-honour-plugin-thr_gzhwb84v53

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

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

@ymichael
ymichael force-pushed the bb/sent-editor-header-thread-actions-honour-plugin-thr_gzhwb84v53 branch from f4dfa10 to c3f6a0a Compare November 20, 2026 04:25
ymichael and others added 3 commits November 20, 2026 01:14
The sent-message editor showed other plugins' + rows but resolved popups,
send rows, effects and observers with a null scope and skipped composer
commands, so Prompt Library's "Prompts…" row did nothing there. ComposerBox
now resolves every contribution kind through one hook with one rule: what a
user invokes on a composer (+ rows, the popups they open, composer
commands) runs in every composer; what mounts by scope (actions, banners,
send rows, rich-text effects, draft observers) mounts only where plugin
customizations are allowed.

Desktop header thread actions read only label, disabled and run, while the
same actions folded into the compact menu showed icon, detail and the
destructive variant. The header button and split-button rows now draw the
icon, detail (tooltip on the button, second line in the menu) and variant
as the menu rows do; bb's own Commit gains its GitBranch icon.

Contract tests cover + rows opening popups, send rows, banners, actions and
scopes on every composer surface, plugin commands in a suppressed composer,
and header action presentation; each fails on main. Plugin SDK 0.6.167
documents both rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/sent-editor-header-thread-actions-honour-plugin-thr_gzhwb84v53 branch from c3f6a0a to fc14800 Compare November 20, 2026 09:16
@ymichael
ymichael merged commit 9d5a681 into main Nov 20, 2026
52 checks passed
@ymichael
ymichael deleted the bb/sent-editor-header-thread-actions-honour-plugin-thr_gzhwb84v53 branch November 20, 2026 19:01
ymichael added a commit that referenced this pull request Nov 20, 2026
#7873 left frontend-hooks-and-ui.md at 501 lines, failing the shipped
skills quality test on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 20, 2026
#7871)

## Human comments

## What was wrong

Three plugin slot props did not match their types and JSDoc.

- `homepageSection` read `projectId` from route state. The New thread
screen always lives at `/`, because `/projects/:id` redirects there, so
plugins always got `null`.
- `experimental_browserToolbarAction`'s `threadId` was documented as
"Thread that owns the Browser tab". On the New thread screen it is
`"root-compose"`, and on plugin pages it is a panel key such as
`plugin-panel:automations:automations:pane-1`. It is really the desktop
browser's owner key, which `sdk.experimental_desktopBrowsers` also takes
under the name `threadId`.
- `experimental_threadList`'s required `searchQuery` has always been
`""` since the sidebar search field was removed.

## What changed

- **homepageSection:** `RootComposeView` computes the composer's project
once (`surfaceProjectId`, null for "No project"). It passes it through
`RootComposeSecondaryContent` to `PluginHomepageSections`, which no
longer reads route state. The New thread panel actions use the same
value.
- **browserToolbarAction:** the runtime value is unchanged and the docs
now say what it is:
- a thread id in a thread's panel, an opaque panel key elsewhere, to be
passed with `tabId` to `sdk.experimental_desktopBrowsers`
- updated in the JSDoc, the authoring reference and
`docs/api_to_audit.md`
- the audit entry records the owner-key rename and whether to add a
nullable thread id

Making it `string | null` would break 3 of the 10 community plugins that
register the slot, because they pass it to
`experimental_desktopBrowsers`: better-browser (cookie sync and
handoff), rebryk annotate (notes on New thread) and doc-review
(capture).
- **threadList `searchQuery`:** marked `@internal`, like the existing
retired members, so published declarations drop it. The host still
passes `""` because 11 community lists read it at runtime, most of them
as `searchQuery.trim()`. I removed the open audit item and added it to
Scheduled removals. The bundled thread-list tests no longer pass it.
- Plugin SDK bumped to 0.6.170.
- `frontend-hooks-and-ui.md` trimmed back to the 500-line reference
limit; #7873 left it at 501, failing `shipped-skills-quality.test.ts` on
main.

No server or daemon wire changes, and no CLI changes.

## How you verified

- **Live, `pnpm desktop:worktree`, with a probe plugin that prints its
props:**

  | Prop | Before (main) | After |
  | --- | --- | --- |
| homepageSection `projectId`, project "QA Alpha" | `null` | `"proj_…"`
|
| homepageSection, picker set to "Don't work in a project" | – | `null`
|
  | homepageSection, picker set back to QA Alpha | – | `"proj_…"` |
| toolbar `threadId` | `"root-compose"`, plugin-page key, real thread id
| unchanged |
  | threadList `searchQuery` | `""` | `""` |

- **Tests that fail before and pass after:**
- `RootComposeView.contract.test.tsx` checks that homepage sections
receive the composer's project for a known, an unset and a deleted
project. Against main's source the known-project case fails: expected
`proj_alpha`, got "no project".
- `bundled-types.test.ts` checks that the published
`PluginThreadListProps` declares no `searchQuery`.
- The existing `PluginThreadList.test.tsx` still covers the runtime
`""`.
- **Commands:**
- `pnpm exec turbo run typecheck --filter='./plugins/*' --filter=@bb/app
--filter=@get-bb/plugin-sdk`
- `turbo run test` for `@get-bb/plugin-sdk`, `bb-plugin-thread-list`,
`bb-plugin-bb-guide` and `bb-plugin-plugin-api-docs`
  - vitest for the affected `@bb/app` files
  - `turbo run lint` and `oxfmt`

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

> AGENT GENERATED

---------

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