Skip to content

Prepare core for moving the composer into a plugin - #6121

Merged
ymichael merged 5 commits into
mainfrom
bb/composer-prep-thr_ceyxptezcc
Oct 22, 2026
Merged

ymichael merged 5 commits into
mainfrom
bb/composer-prep-thr_ceyxptezcc

Conversation

@ymichael

@ymichael ymichael commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Moving bb's composer into a bundled plugin (the stacked PR) needs a few core changes that have nothing to do with plugins. The thread-link parser was buried in the paste code. The composer handle carried four loose voice methods. Split panes and the phone home screen reached into the composer's DOM to focus it and size it. And the command menu still had "load more" code that could never run, because useCommandSuggestions always returned hasMore: false. Landing these first keeps the composer PR down to the plugin move.

What changed

Five commits, no intended behaviour change:

  1. Remove the composer's unused header option. No caller sets it. Also formats four files main had left unformatted.
  2. Remove the composer's command list paging that never pages. Drops hasMore/isLoadingMore/loadMore from the hook and the typeahead config, along with the prefetch effect, the ArrowDown hold at the last command, the menu's scroll handler and mention-menu-scroll.
  3. Parse thread links in lib/thread-links. parseThreadLink sits next to the batched resolver, and the paste code takes a parser function instead of an origin. A link without a project names the personal project instead of null, which matches the same threads as before.
  4. Group the prompt box handle's voice methods into voice.{textBeforeCursor, deliverTranscript, playCompletionTransition}.
  5. Stop pane focus and the compact home from reaching into composer DOM. The composer registers its root for pane focus, focusPaneComposer reports whether a pane's composer took focus, and the compact home passes the available height through ComposerMaxHeightContext for the composer to cap its own editor. The formula is the same as before.

How you verified

  • pnpm exec turbo run typecheck lint --filter='...[origin/main]' and the affected @bb/app tests at each commit; @bb/app and @bb/client-core suites on the head.
  • Live, on a start:worktree server running the stack:
    • a pasted thread link becomes a pill;
    • the slash menu wraps from the last command (73rd ArrowDown) back to the first;
    • "Focus previous/next chat pane" puts the caret in that pane's composer;
    • on a 390×380 phone viewport the composer's available height (208px) caps the editor and the composer sits at the chrome row (top 56px).

AGENT GENERATED

🤖 Generated with Claude Code

ymichael and others added 5 commits October 22, 2026 11:15
NewThreadComposer, NewThreadPromptBox and PromptBoxInternal passed a
header slot that no caller sets. Also formats four files main had left
unformatted. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
useCommandSuggestions always returned hasMore false, isLoadingMore false
and a no-op loadMore, so the composer's prefetch effect, the ArrowDown
hold at the last command, and the mention menu's scroll-to-load handler
could never run. Drops the fields from the hook and the typeahead config
along with mention-menu-scroll and its test. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
parseThreadLink moves out of the paste candidate finder into
lib/thread-links, next to the batched resolver, and names the personal
project for a link without one instead of null. The finder and the paste
extension take a parseLink function instead of an origin, and the
rejection cases move to a thread-links test. No behaviour change: a
projectless link still only converts for a personal-project thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
PromptBoxHandle's four voice methods become one voice object:
textBeforeCursor, deliverTranscript(text, delivery) and
playCompletionTransition. Voice delivery passes its insert-or-send
choice through instead of picking a method. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SplitThreadArea no longer queries [data-promptbox] for a contenteditable
and RootComposeCompactHome no longer measures [data-promptbox-editor-scroll]
and writes the editor's CSS height variable. The composer registers its
root element for pane focus, focusPaneComposer finds the registered
roots inside a pane and reports whether one took focus, and the compact
home passes the composer's available height through
ComposerMaxHeightContext for the composer to cap its own editor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/composer-prep-thr_ceyxptezcc branch from 8876894 to af18409 Compare October 22, 2026 18:20
@ymichael
ymichael merged commit cf2018d into main Oct 22, 2026
49 checks passed
@ymichael
ymichael deleted the bb/composer-prep-thr_ceyxptezcc branch October 22, 2026 18:39
ymichael added a commit that referenced this pull request Oct 22, 2026
## Human comments

## What was wrong

bb's composer was core code, so the only way to change how the prompt
box looks or edits was to change bb itself. The thread list is already a
bundled plugin that a fork can replace. The composer had no such slot:
plugins could add actions, popups and decorations to it, but couldn't
draw it.

## What changed

Builds on #6121.

- **The composer is now the bundled Composer plugin**
(`plugins/composer`, `bb--composer`). It registers through a new
`app.slots.experimental_composer` slot.
- Core renders every composer surface through `ComposerBox`: follow-up,
new thread, queued and sent message editors, side chat, embedded chat.
- `ComposerBox` resolves the slot and hands the plugin its input, view
and host services.
- With no composer plugin enabled, no composer is shown, the same rule
as the thread list.
- Appearance gets a Composer picker; the preference is
`composer.provider`.
- **How the plugin talks to bb:**
  - it reads and writes the draft through `useComposer()`;
- it connects through `experimental_ComposerRoot` and
`experimental_useComposerContributions()`;
- it searches mentions and commands through
`experimental_useComposerMentionSearch` / `CommandSearch`, which take
the query from the composer.
- **The renderer contract is shaped for any composer, not bb's own
box:**
- `submission.enter` / `.modifier` are actions the host works out from
the surface and the "Enter steers" setting (kind send/queue/steer,
`requiresInput`, shortcut, `run()`). Programmatic `submit()` uses the
same choice, only where Enter sends.
  - `compact` is `{ when: "always" | "narrow", placeholder }`.
- The host calls `editor.focusEnd()` itself and measures the menu the
composer hands to `ComposerRoot`.
- Services are grouped: `threadLinks.{parse, cached, resolve}`,
`clipboard.{readMessage, readMessageImage}`, `attachmentSrc`. bb
releases local previews when attachments leave the draft.
- The composer is a remembered page-drawing surface, so it loads with
the first plugins. Composer CSS moves from `app.css` into
`plugins/composer/src/composer.css`.
- Plugin Guide card, `docs/api_to_audit.md` entries and bb-guide
references are added. `@bb/app` lists the composer plugin as a workspace
dependency, as it does thread-list, so CI's filtered install includes
it. Plugin SDK 0.6.71.

- While the composer plugin loads, the page skeleton and `ComposerBox`
draw the same loading block at the composer's real size, so it doesn't
jump between two skeletons. On a phone thread the page skeleton now
draws the one-line composer, fixing a jump main also has.

- `dropdown-menu`'s compact-sheet context and `menu-item-hover`'s
last-hovered context are shared across bundled copies (`Symbol.for` on
`globalThis`, like the persistent drawer stack). bb's send and `+` menu
items for other plugins now render inside the composer plugin's phone
sheet instead of crashing, and hovering between the plugin's items and
bb's leaves one row highlighted.

Known deviation: a plugin's `submit()` on a sent-message editor rejects,
matching #6104.

## How you verified

- `pnpm exec turbo run typecheck lint --filter='...[origin/main]'`
(160/160).
- Tests pass for `@bb/app`, `@bb/server`, the composer plugin,
`@get-bb/plugin-sdk`, plugin-api-docs, bb-guide, `@bb/web`,
`@bb/client-core` and `@bb/scripts`.
- `composer-contract.test.tsx` runs bb's composer and a minimal textarea
composer against every surface.
- Live on a `start:worktree` server:
- the composer renders from the plugin, and @mention, pasted-thread-link
pills, the slash menu and attachments work;
- Enter sends while idle; while a turn runs, Enter steers and Cmd+Enter
queues;
  - the send menu shows Queue / Save draft / Send later;
- at phone width a blurred editor collapses to the one-line form, and a
short desktop pane uses the narrow CSS form.

> 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