Skip to content

Ship bb's composer as the bundled Composer plugin - #6122

Merged
ymichael merged 4 commits into
mainfrom
bb/estimate-timeline-for-user-composable-slot-thr_ceyxptezcc
Oct 22, 2026
Merged

ymichael merged 4 commits into
mainfrom
bb/estimate-timeline-for-user-composable-slot-thr_ceyxptezcc

Conversation

@ymichael

@ymichael ymichael commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

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

@ymichael
ymichael force-pushed the bb/composer-prep-thr_ceyxptezcc branch from 8876894 to af18409 Compare October 22, 2026 18:20
@ymichael
ymichael force-pushed the bb/estimate-timeline-for-user-composable-slot-thr_ceyxptezcc branch from f880543 to 34dfb82 Compare October 22, 2026 18:20
Base automatically changed from bb/composer-prep-thr_ceyxptezcc to main October 22, 2026 18:39
@ymichael
ymichael force-pushed the bb/estimate-timeline-for-user-composable-slot-thr_ceyxptezcc branch from 34dfb82 to 4cb0002 Compare October 22, 2026 18:40
bb's composer box moves into plugins/composer (bb--composer), registered
through the new experimental_composer slot. Core renders every composer
surface through ComposerBox, which resolves the slot and hands the plugin
its input, view and host services; with no composer plugin enabled no
composer is shown. The plugin reads and writes the draft through
useComposer(), connects to bb through experimental_ComposerRoot and
experimental_useComposerContributions, and searches mentions and commands
through per-composer search hooks that take the query from the composer.

The renderer contract carries what any composer needs rather than bb's
own box's internals:

- input.submission.enter and .modifier are actions the host works out from
  the surface and the "Enter steers" setting: kind (send, queue, steer),
  requiresInput, shortcut and run(). Programmatic submit picks Enter,
  queue or steer on the host exactly as the box's shortcuts do and only
  where Enter sends.
- input.compact is { when: "always" | "narrow", placeholder }. The box
  styles its CSS-only narrow form from its own data-promptbox-collapsed
  attribute and reports the form it shows in editor.state.layout.
- The host calls editor.focusEnd() itself, and measures the menu a
  composer hands to experimental_ComposerRoot (menuRef, menuOpen) only on
  surfaces that make room for it.
- Services are grouped: threadLinks.{parse, cached, resolve},
  clipboard.{readMessage, readMessageImage}, and attachmentSrc, with bb
  releasing local previews when attachments leave the draft.
  threadLinks.resolve reports each batch as it lands so the paste
  deadline keeps the batches that finished.

The composer is a remembered page-drawing surface. The compact-layout and
composer-footer drop fixes from main move into the plugin.

Plugin SDK 0.6.71.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/estimate-timeline-for-user-composable-slot-thr_ceyxptezcc branch from 4cb0002 to af46157 Compare October 22, 2026 19:23
ymichael and others added 3 commits October 22, 2026 12:51
The page skeleton drew a solid block where the composer goes, then the
page rendered ComposerBox's own placeholder, an outlined box with a bar
and a different height, until the composer plugin loaded. The block
jumped twice on every cold load. Both now draw one ComposerLoadingSkeleton
at the real composer's size for the surface: 151px in a thread, 128px
(136px on touch phones) for a new thread, and the 50px one-line form on
a compact viewport, where the page skeleton used to show the full block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… sheet

On a compact viewport the composer plugin's send menu opened an empty
sheet: the Save draft and Send later items crashed with "MenuItem must
be used within Menu". bb draws those items with its own dropdown-menu
module, while the menu around them comes from the copy the composer
plugin bundles. Each copy created its own ResponsiveMenuContext, so bb's
items never saw the plugin's sheet and rendered as Radix items with no
Radix menu around them. The context now lives under a versioned
Symbol.for key on globalThis, the way the persistent drawer stack is
already shared across bundled copies, so every copy of dropdown-menu
reads the same one. Desktop menus were unaffected because Radix is
already shared through the plugin runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hovering one of the composer plugin's own + menu items and then an item
bb draws for another plugin left both rows highlighted: each bundled
copy of menu-item-hover kept its own last-hovered context, so bb's item
never cleared the plugin's highlight. The context now lives under a
versioned Symbol.for key on globalThis, like dropdown-menu's compact
sheet context.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 96de13e into main Oct 22, 2026
90 of 91 checks passed
@ymichael
ymichael deleted the bb/estimate-timeline-for-user-composable-slot-thr_ceyxptezcc branch October 22, 2026 21:24
alexandre-vl added a commit to alexandre-vl/bb that referenced this pull request Oct 23, 2026
Upstream get-bb#6122 moved PromptBoxInternal into the bundled Composer plugin
and renders ComposerBox from core. The suppressed send-menu test now
renders ComposerBox inside the composer test providers, the removed
dispatchThroughEditorTarget helper stays removed, and the plugin SDK
version stays at upstream's 0.6.73.
alexandre-vl added a commit to alexandre-vl/bb that referenced this pull request Oct 23, 2026
…-environment

After get-bb#6122 moved the composer into plugins/composer, the carry
merged after bb/project-default-environment through three merge bases
whose virtual base conflicts in plugins/automations/detail-view.tsx, so
Fork Sync skipped it. Merged first, its bases are main and two commits
upstream already has (get-bb#6054, get-bb#6005), and bb/project-default-environment
then arrives already included.
alexandre-vl added a commit to alexandre-vl/bb that referenced this pull request Oct 23, 2026
Regenerate the dropdown-menu registry item with build-registry.mjs from
the merged dropdown-menu.tsx, which get-bb#6122 changed.
ymichael added a commit that referenced this pull request Nov 3, 2026
## Human comments

## What was wrong

Moving the composer (#6122) and git (#6165, #6157, #6388, #6410) into
plugins left dead code and duplicate implementations in core and in
neighbouring plugins. An audit of those moves (thread thr_7hk642w2es)
found code that could be deleted with no protocol bump, no plugin SDK
change and no change in behaviour. This PR implements the audit's steps
1 (pure deletions) and 2 (consolidations). Every item was re-checked
against the current code before it was deleted; the items that turned
out to change behaviour are left out and listed below.

## What changed

Two commits. Together they remove 643 lines net. No
`HOST_DAEMON_PROTOCOL_VERSION` change, no plugin SDK change, and no CLI
or config change.

**Step 1: deletions (+42 / −423, net −381)**
- `useUpdateEnvironment` (built but never mutated) and its always-false
`isPending` read in `ThreadDetailView`.
- `isGitDiffFixedPanelTab`, `EMPTY_ORDERED_MENTION_SUGGESTIONS`, the
`useCommandSuggestions().triggers` field that only echoed its input, and
the `maxHeight` prop on `ComposerBox`, which no caller passes (the max
height comes from `ComposerMaxHeightContext`).
- client-core's uncached `composerDraftFromPromptDraft`. `ComposerBox`
now uses the cached apps/app copy. The history object is rebuilt on
every render and drafts are compared by value, so the result is the
same.
- 9 unused `@tiptap/*` dependencies of `@bb/app`. `@tiptap/core` and
`@tiptap/pm` become devDependencies because only
`PromptBoxInternal.test.tsx` uses them.
- host-workspace's porcelain v1 quoted-path parser. Its only caller is
the conflict check, which reads just the two status letters.
- host-workspace's copy of the checkout admission lock (it now reuses
the one in `locks.ts`) and its copy of `throwIfProvisionAborted`. Also a
`withGitRefMutationLock` re-export nothing imports, and `export` on
helpers only used inside their own file.
- Stale docs: `vcs-process-admission.md` now cites protocol 255.
`api_to_audit.md` now says `ComposerBox` owns `submit`. The `app.css`
comment and the `bundle-budget.json` note no longer describe the
pre-plugin composer.

**Step 2: consolidations (+299 / −561, net −262)**
- Checkout-ref, uncommitted-changes and in-progress-operation inspection
had two implementations: host-workspace (used by the daemon's
`host.inspect_git_source`) and
`plugins/environment-project-checkout/host/git.ts`. Both now use one
implementation in `createGitQueries`
(`bb-environment-provider-host/workspace-git`), and the plugin's file is
deleted. Because it goes through each side's runner, the daemon keeps
its default git priority and the plugin keeps `background`. Every caller
already confirms a work tree before calling, so the result is identical;
the daemon just runs two fewer `git rev-parse` checks per inspection.
- `plugins/git/host/workspace-reads.ts` (−85):
- The HEAD-to-empty-tree fallback is now generic over the result type,
so the record-limited tracked diff reuses it instead of keeping its own
copy.
- One `rangeGitRunner`, one lstat/ENOENT helper and `sumNumstatLines`
replace the inline copies.
  - Local copies of contract types and unused exports are gone.
- Ladle's `makeWorkspaceStatus` is now built on
`bb-plugin-bb--git/testing`, keeping the same defaults.

**Planned items left out**
- **Server-contract "unused" schemas:** not dead. They are the source of
`EnvironmentDiffViewedResponse` and `EnvironmentActionApiError`, which
the SDK and `public-api.ts` use.
- **The `ComposerPluginActions` wrapper:** it discards any props a
plugin passes at runtime. Passing `ComposerActionsSlot` directly would
start honouring them.
- **One-off migrations for the git-era ids (`diff.toggle`, Info section
ids):** these would change behaviour.
- The UI-preference transform also runs on writes (`PUT /ui-preferences`
and `bb settings`).
- The keybinding `PUT` stores any command id and returns the overrides
read back through the read-time migration.
- A one-off database migration would stop converting legacy ids written
later, for example by a cached older client.
- **A fake segment instead of the real Git segment in core banner
tests:** those tests are the only coverage of the plugin's
`ChangedFilesSegmentView` (deferred list mount, merge-base action, file
buttons). A fake would drop that coverage unless the tests move into the
plugin, which is relocation rather than deletion.
- **Lifting the small boundary copies (`commit-errors.ts`,
overflow-mode, label-class and debounce constants) into shared-ui:**
each new shared-ui entry needs a 5-line `exports` block, and the copies
are 1–3-line constants or helpers with a different shape, so this would
add lines.
- **The shared-ui workspace-status fixture:** shared-ui can't depend on
the plugin's test builders, and #6935 deletes this fixture by moving its
modules into plugins/git.

## How you verified

- `pnpm exec turbo run typecheck lint` for `@bb/app`, `@bb/client-core`,
`@bb/host-workspace`, `bb-environment-provider-host`, `@bb/host-daemon`,
`bb-plugin-bb--git`, `bb-plugin-bb--composer`,
`bb-plugin-environment-git-worktree` and
`bb-plugin-environment-project-checkout`: all pass.
- `pnpm exec turbo run test` with the same filters: every package passes
after the rebase. Two `@bb/app` tests failed under a local load average
of about 50 and are not caused by this PR:
  - `PluginSettings.test.tsx` passes when run on its own.
- `lazy-plugin-renderers.cold-load.test.tsx` fails the same way on the
base commit.
- `pnpm exec turbo run build --filter=@bb/app` plus
`check-bundle-budget.mjs`: budget OK.
- `pnpm exec turbo run prepare:bundled` for the git, git-worktree and
project-checkout plugins: the host bundles build with the shared
helpers.
- The existing `getCheckoutRef` and `getWorkspaceGitOperation` tests
(bare repo, detached, unborn, merge and rebase conflicts) now run
against the shared implementation and pass.

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 6, 2026
…audit (#7207)

## Human comments

## What was wrong

The 2026-11-06 marketplace audit (§3.3) found three drifts. I checked
each against the code and the 423 cloned marketplace repos:

- `experimental_ImageLightbox` is a public `@get-bb/plugin-sdk/app`
export, shipped in #6122. Neither doc named it. The composer entry
mentioned "the image lightbox" only in passing, and `surfaces.ts` did
not list it.
- `experimental_useSidebarThreads` was described as having no consumers.
It appears in the sources of 79 repos (bb-office among them), and 29 of
those replace the thread list.
- `experimental_newThreadPanelAction` was "deferred until an external
plugin adopts it". 16 repos register it, taskboard among them. The entry
also still compared the slot to the retired `threadPanelAction`.

A sweep of every public entry point's bundled types turned up more of
the same:

- Six more stale consumer claims: `NewThreadComposer`, `useCodeTheme`,
`usePluginId`, `useQuestionFormHost`, `VoiceInputTextarea`, and host
signals/watches. Worktree and Project checkout use host signals in-repo.
- A gap that was already fixed but still listed as open: the sidebar
draft indicator, closed by `useSidebarThreadDraft` in #4025.
- About 35 prefixed SDK members not named in `api_to_audit.md`, and
about 60 prefixed value exports missing from `surfaces.ts`.

## What changed

`docs/api_to_audit.md`
- New `experimental_ImageLightbox` entry: behavior, core callers,
outside callers and stabilization items.
- The composer entry now names each of its host components.
- Updated consumer counts in the nine entries above. The
`newThreadPanelAction` entry now says item 5 can proceed and compares
the slot against `experimental_tab`. The `useSidebarThreads` entry marks
item 5 as decided.
- Named the remaining prefixed members:
  - the provider-bridge testing kit
  - the native-roots Zod schemas
- `ExperimentalHostRpcContext.experimental_paths` / `emitSignal` /
`watch`
- test-harness members: RPC invalidation, `renderSlot`'s
`experimental_rpcContract` and `experimental_fixedTabTarget`, and the
internal tunnel fakes

`plugins/plugin-api-docs/src/surfaces.ts`
- `apiSymbols` additions:
  - the composer and host-component exports, including the lightbox
  - the provider-bridge toolkit, presentation builders and testing kit
- `experimental_makePanelController` and the unprefixed testing fixtures
  - `PLUGIN_CLI_OUTPUT_MAX_BYTES`
  - `PluginAppSlots.experimental_newThreadPanelAction`

Left out on purpose:
- The ~150 unprefixed provider-bridge wire schemas. The provider-bridge
authoring entry covers that subpath.
- `definePluginApp`, the entry point every surface uses.

No SDK source, wire or CLI changes.

## How you verified

- Rebuilt the bundled types (`turbo run build:types
--filter=@get-bb/plugin-sdk`) and walked every non-internal entry
point's exports with the TypeScript checker. Every
`experimental_`/`internal_DO_NOT_USE_` identifier in the public
declarations now appears in `api_to_audit.md`. Every prefixed value
export, and every root/app/testing value export except
`definePluginApp`, now appears in `surfaces.ts`.
- Consumer counts come from `grep -rlw` over the audit's marketplace
clones. The search excluded `node_modules`, `dist`, vendored tooling,
`.d.ts`, tests and Markdown. I spot-checked the hits for real call
sites, and analyzer string tables don't count as registrations.
- `turbo run test typecheck --filter=bb-plugin-plugin-api-docs` passed
(75 tests). The SDK's `provider-bridge-scheduled-removals` test, which
reads `api_to_audit.md`, passed. `oxfmt --check` is clean on both files.

> 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