Skip to content

Resolve the active composer once for core commands, context.composer and experimental_useActiveComposer - #7960

Merged
ymichael merged 2 commits into
mainfrom
bb/implement-composer-plugin-api-gap-3-thr_upewhet4rn
Nov 21, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/implement-composer-plugin-api-gap-3-thr_upewhet4rn

Conversation

@ymichael

@ymichael ymichael commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Plugins had no way to ask which composer the user is in. Callbacks (commands, footer and panel actions) got no composer at all, and app-wide components rebuilt the answer from DOM guesses. brsbl desktop keeps a module-global target list with focusin/pointerdown closeness scoring. smsunarto vimium rebuilds "the focused pane's composer" in a renderless overlay. floating-terminal guesses in a module-level pick(). bb's own Conductor matched useComposers() handles with composer.key.includes(draftKey). That never matches, because the handle key URI-encodes conductor-new-chat:<env> to conductor-new-chat%3A<env>, so it always fell back to .at(-1). Core answered the same question privately, with a per-composer DOM check at keydown (composer-command-ownership.ts), so plugins could not use core's rule.

What changed

One resolver (apps/app/src/lib/active-composer.ts):

  • The active composer is the one holding the caret. Focus that moves into an app-wide layer does not count as leaving it. Failing that, it is the focused surface's first primary composer (data-app-composer-role); failing that, null.
  • An app-wide layer is anything outside the app shell. The only marker is the new data-app-shell attribute on AppLayout's SidebarProvider root. The palette, dialogs, popovers (portaled to body), plugin overlays (siblings of the shell) and content-script layers all fall outside it, without a selector list.
  • Focus landing in a composer always moves the caret there, even inside a layer, so composers in overlays still work.
  • Keyboard and palette dispatch pass their event target, which the resolver reads in place of tracked focus. The palette passes the target captured when it opened.
  • Composers register through ComposerRoot with their surface. AppNavigationSurfaceProvider now has a stable id, and getFocusedAppNavigationSurfaceId exposes the focused one.

Core on the same path:

  • ComposerRoot's ownership for composer.focus and plugin composer commands goes through the resolver.
  • ModelReasoningPicker's toggle and cycle chords go through it too. Its own extra rules stay: an open picker, split panes, and not stealing keys from other editable fields.
  • composer-command-ownership.ts is deleted.

API (SDK 0.6.177):

  • ExperimentalPluginActionContext.composer: PluginComposerApi | null is the composer the callback acts on. That is the handling composer for composer commands and menu rows (ExperimentalComposerActionContext narrows it to non-null), the message thread's composer for message actions (PluginMessageActionContext is unchanged), and the focused surface's active composer, or null, for everything else.
  • experimental_useActiveComposer(): PluginComposerApi | null gives app-wide components the same value. It returns a detached handle like useComposers()'s that names the same composer by key, and it re-renders when the active composer or its draft changes.
  • The testing harness implements the hook.

Conductor: findComposer is deleted. The New chat transcript chips use experimental_useActiveComposer(), and the engines range moves to >=0.6.177.

Docs:

  • docs/api_to_audit.md has a new entry.
  • The Plugin Guide's composer-state card has the new symbols.
  • The bb-plugin-authoring skill gets an "Active composer" section in frontend-renderer-slots.md, linked from the hook list and "Callback context" in frontend-hooks-and-ui.md.

Callers that can migrate (community, not edited here):

  • brsbl desktop library-bridge.tsx. It needs two changes on its side: Paint's and notes pads' Send buttons should keep focus (preventDefault on mousedown), and raising a thread window should focus that window's composer. Its notes pads render in a body-level createRoot outside bb's tree, so they can't call the hook.
  • smsunarto vimium NavigationBridge, which can become run: ({ composer }) => ….
  • vburojevic floating-terminal pick().

Behaviour changes:

  • With the caret in a composer, a shortcut pressed while focus sits in a non-modal app-wide layer (a popover, a plugin overlay) now acts on that composer. Before, it acted on the pane's primary composer.
  • When one surface has several primary composers, the first in document order wins. Before, every primary owned the command and the last handler registered won.

How you verified

Kill-tests (design gap 3):

  • 3.1 replay in headless Chrome before building: killtest/RESULTS.md in thr_upewhet4rn storage.
  • 3.3 live: Conductor's page has one primary composer, and the stored draft key is %3A-encoded.
  • 3.2 and 3.4 re-run live on this branch with pnpm start:worktree and a probe plugin. Its appOverlay records the hook, and an app.commands command records context.composer, invoked from the palette and from the keyboard.
Case Hook Hook while palette open context.composer
Thread, caret in composer thread thread thread
Thread, focus on body thread thread thread
New thread screen, with or without caret new-thread new-thread new-thread
Split, caret left / caret right left / right left / right left / right
Plugin page without composer null null null
Conductor page, first mount with no focus page composer page composer page composer
Side ThreadChat, caret in it side side side
Side ThreadChat caret, then click main timeline main main main
  • composer.focus live: with the caret in the side ThreadChat it acts on the side composer, and after clicking the main timeline it focuses the main composer.
  • Conductor live: clicking a transcript chip inserts the thread mention into the page composer and focuses it.
  • Side chat itself needs a thread with a provider session, which the dev instance didn't have. I used a thread-panel ThreadChat, which is what side chat renders, instead.

Tests:

  • New apps/app/src/lib/active-composer.test.tsx (real ComposerBoxes, surfaces, the action-context binder the palette uses, and keyboard dispatch) covers four things:
    • the hook, context.composer and composer.focus agree;
    • the caret is kept through the palette and an overlay;
    • the active composer follows surface focus and is null on a surface without a composer;
    • it falls back to the primary on unmount.
  • The new test fails on main (the hook doesn't exist there). With the app-layer rule disabled, the overlay case fails.
  • composer-commands.test.tsx passes unchanged.
  • ModelReasoningPicker.test.tsx assertions are unchanged. Its harness now registers its bare data-app-composer div as a composer.
  • modelPickerToggle.test.ts is updated to the new input shape. Each case keeps its intent.
  • Tests that build callback contexts by hand (SDK, drafts, git, push-notifications, thread-list) gained composer: null.
  • pnpm exec turbo run typecheck lint test --filter=@bb/app --filter=@get-bb/plugin-sdk --filter=bb-plugin-conductor --filter=bb-plugin-plugin-api-docs --filter=bb-plugin-bb-guide --filter=@bb/domain plus drafts and side-chat: all green. @bb/app ran 700 test files.

AGENT GENERATED

🤖 Generated with Claude Code

ymichael and others added 2 commits November 20, 2026 17:00
…and experimental_useActiveComposer

One resolver (apps/app/src/lib/active-composer.ts) decides which composer
the user is in: the one holding the caret, where focus moving into an
app-wide layer (anything outside the app shell: palette, dialogs, popovers,
plugin overlays, content-script layers) does not count as leaving it;
else the focused surface's primary; else null. composer.focus, plugin
composer commands and the model picker chords use it in place of the
per-composer DOM check, ExperimentalPluginActionContext.composer reads it,
and experimental_useActiveComposer() exposes it to app-wide components.
Conductor's New chat chips move to the hook; its useComposers() key match
never matched the URI-encoded key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g reference under its line cap

The git, push-notifications and thread-list tests build thread-action and
command contexts by hand and now pass composer. The active-composer docs
move to frontend-renderer-slots.md so frontend-hooks-and-ui.md stays at
the 500-line limit the shipped-skills test enforces.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit b0db979 into main Nov 21, 2026
53 checks passed
@ymichael
ymichael deleted the bb/implement-composer-plugin-api-gap-3-thr_upewhet4rn branch November 21, 2026 04:25
ymichael added a commit that referenced this pull request Nov 21, 2026
ExperimentalPluginActionContext held sdk, navigate, panel and composer as
handles, and spread requestArchive/requestDelete beside them as top-level
verbs. Nest them as one threadRequests handle, the same object
experimental_useThreadRequests() returns, so later core flows join a handle
instead of growing the context. The hook now binds straight to the store.
SDK 0.6.178, since 0.6.177 shipped with #7960.

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

## What was wrong

Main-area split panes became active only on `pointerdown`
(`SplitThreadArea`'s pane wrapper). When the caret reached another
pane's composer without a click (Tab across panes, or a plugin calling
`composer.focus()` on a `useComposers()` handle there), the active pane
stayed behind. #7960's active-composer rule only accepts a caret
composer on the focused surface, so ⇧⌘M opened the other pane's model
picker and ⇧⌘C pulled the caret over to the other pane. Before #7960
both shortcuts did nothing in that state. The side-panel split
(`SidebarSplitContainer`) already follows focus with `onFocusCapture`.

## What changed

- `SplitThreadArea.tsx`: the pane wrapper also becomes active on focus
capture, through a new `onFocusWithinPane` that calls `focusPane` only.
The pointer handler still also clears a pending keyboard focus request.
Focus capture must not clear it, because `pane.focus.*` focuses the pane
root while its composer is not ready. A pane hidden behind a maximized
pane doesn't take focus this way.
- `ComposerBox.tsx`: a composer that mounts in an unfocused split pane
gets `autoFocus: false`. Every composer autofocuses on mount
(`PromptBoxInternal` defaults `autoFocus` to true), so on reload
whichever pane's editor was ready last took the caret. On main that left
the caret in an inactive pane. With focus following, it would also have
switched the active pane and the URL. The check uses the pane state at
mount, so making a pane active later doesn't pull the caret into its
composer.

## How you verified

- New `SplitThreadArea.test.tsx` case: focusing a textarea in the other
pane makes that pane active and moves the URL, and focus inside a pane
hidden by maximize changes nothing. It fails without the
`onFocusCapture` handler.
- New `PromptBoxInternal.test.tsx` case: a composer mounted in an
unfocused split pane doesn't take the caret, even after its pane becomes
focused. It fails without the `ComposerBox` change.
- The existing "handles a late composer and cancels pending focus on
pointer activity" case caught a first version that reused the pointer
handler. It passes now.
- `pnpm exec turbo run typecheck lint test --filter=@bb/app`: 700 test
files, 7336 tests passed.
- Live on `pnpm start:worktree`, with a thread split beside New thread:
- Click the right composer, then move the caret into the left composer
without a click. The left pane becomes active and ⇧⌘M opens the left
picker. Before this change, the right picker opened.
- 5 reloads with the left pane active and 5 with the right pane active:
the active pane, URL and caret stayed put every time. A first version
without the `ComposerBox` change flipped to the New thread pane on
reload.
- Clicking into either composer and pressing ⇧⌘M opens that pane's
picker.
- Dragging New thread into a split still makes the new pane active and
puts the caret there.

> AGENT GENERATED

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

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 23, 2026
## Human comments

## What was wrong

A new worktree thread on this repo waits ~24–33 s before its first turn,
for `git fetch`, `git worktree add`, `.worktreeinclude` and
`.bb-env-setup.sh` (mostly `pnpm install`). #7863 lets environments
exist before threads and lets a provider call core's steps, but nothing
yet prepares a worktree ahead of time and hands it to a thread.

Builds on #7863, now merged. Size: 42 files, +3633 / −75.

## What changed

**Core: plugin holds and `ctx.adopt`**
- `hold: "plugin"` on `bb.sdk.environments.experimental_create`. Inside
a plugin it always means the calling plugin; the plugin-facing type has
no `pluginId`.
- Threads cannot join a plugin-held environment: thread placement and
directory changes refuse with `409 environment_held`.
- Disabling or uninstalling a plugin releases its holds on environments
no thread owns (on the same unregister signal that clears its queue
waits), so they retire like any unused environment once their provider
is available.
- `ctx.adopt(environmentId, resource)` on version-2 create contexts. It
hands an environment that the calling plugin holds (ready, same project
and machine) to the thread being created: in one transaction it moves
the thread's reservation onto that environment and records the resource
the provider passes. A refused adopt changes nothing.
- The plugin's hold stays until create returns. Then core clears it and
records the resource create returns (for Worktree, the thread's named
branch). While the hold is on, no other thread can join the environment,
and core can tell after a restart that a handover was unfinished.
- A provider may call `ctx.setup(path)` after `adopt`; setup runs again
on the adopted environment before the thread starts. Without that call,
setup does not run again.
- A create that fails after `adopt` (wrong path returned, abort, bad
result) fails the thread without starting it: the adopted environment
goes to `error`, the hold and `create_pending` are cleared, and normal
retirement removes it.
- A restart between `adopt` and create returning, or a stop of the
thread in that window, discards the adopted environment and resets the
thread's provisioning to ask its provider for a new one. The thread then
gets another warm worktree or a cold one. Before, the restart sweep
finished the create from what `adopt` had recorded, which could start a
thread before its fast-forward or setup had run.
- Steps the provider reports after `adopt` land on the adopted
environment and the thread's provisioning log. `adopt` drops the held
environment's unflushed log from before the thread existed.

**Worktree plugin: the warm pool**
- Setting: per-project size 0–4, off by default. `bb worktree pool
status|set`, a settings section and the `worktree` skill. Changing a
size saves it and replies at once; the reconcile it starts runs in the
background, and settings refresh from the pool's change signal.
- Refill: `experimental_create({ hold: "plugin" })` at the default base,
unnamed, so the member sits on placeholder branch `<prefix><envId>`.
Core runs creation and setup durably. One refill at a time per machine,
debounced (5 s after start, 10 s after a handoff, then every 2 min),
with a 10-minute backoff after a failure. After a refill, the pool
checks the new member every 2 s until its setup settles, then reconciles
at once, so settings show it as ready and the next refill starts without
waiting for the 2-minute tick.
- Handoff, only for a default-base create. It follows a cold create's
order: worktree first, setup next, branch name last, so the title wait
overlaps the rest.
1. Reserve the oldest ready member under a lock scoped to the project
and machine.
2. Read the remote's default base with `git ls-remote`, and fetch that
commit if it is not local yet.
3. Under the git ref lock, check that the member is still on its
placeholder branch and at that commit or behind it. A member that is not
(the base was rewritten, or the checkout was used) is deleted and the
next one is tried.
  4. `ctx.adopt(member)`, recording the placeholder as the owned branch.
5. If the member is behind: `git merge --ff-only` to the remote commit,
then `ctx.setup(path)` again. Both run while the title is still being
generated.
6. Await `branchName()`. Under the git ref lock, write the name to the
worktree's completion file, then rename the placeholder to it.
  7. Return the named branch as the resource.
If the remote can't be reached, the check uses the last fetched base, as
a cold create's fetch fallback does, and the log says the worktree may
be out of date. If the base can't be read at all, the member is kept and
the thread gets a cold worktree. A refused adopt tries the next member,
or a cold worktree; nothing on disk changed yet.
- Settings and `bb worktree pool status` show, per checkout, how many
warm worktrees are ready or being set up, and any problem as a plain
sentence on its own line: a missing project folder (reported by the host
as its own result), a failed check for updates, a failed setup, or a
failed create, each saying when it retries. The raw error goes to the
plugin log. A problem clears once a later check succeeds outside a retry
backoff.
- Removal deletes the recorded branch and the branch named in the
completion file, so a worktree renamed just before a restart does not
leak its branch.
- Freshness: while a pool exists, each reconcile fetches the default
base and deletes members that are no longer on it (base rewritten),
failed, older than 8 h, or over the size. Members that are only behind
are kept and moved forward at handoff. Turning a pool off deletes its
members.
- `bb.sdk.environments.list` now takes a page size (#7932); the pool
pages through its members 500 at a time.
- `scripts/check-branch-ref-owner.mjs` allowlists `host/handoff.ts`: its
`merge-base --is-ancestor` compares a member's commit with the remote
base commit and chooses no branch.

**Versions**: plugin SDK 0.6.179 (one above main's 0.6.178). No
migration: the PR uses the `held_by` and `create_pending` columns from
#7863's 0161. `HOST_DAEMON_PROTOCOL_VERSION` is unchanged: the new host
calls (`checkPoolMember`, `fastForward`, `nameHandedOffBranch`,
`refreshPoolBase`) belong to the Worktree plugin's own host contract,
which ships with the plugin.

**Docs**: `docs/worktrees.md` (warm worktrees), `docs/configuration.md`,
`docs/api_to_audit.md` (plugin holds, `adopt`), the bb-guide
environments template, `backend-machines.md`, the Plugin SDK `adopt`
comment, the Plugin Guide surface, the plugin README and the `worktree`
skill.

### What a warm hit waits for

T is the title, F is fetching and creating the worktree, S is setup.

| Path | Wait before the agent starts |
|---|---|
| Cold (unchanged from #7863) | max(T, F + S) |
| Warm hit, member current | max(T, ~0.3 s) |
| Warm hit, member behind | max(T, S), plus a fast-forward; setup is
usually quick when its inputs did not change |

The first version of this PR replaced members whenever the default base
moved. On this repo `main` moves 22.5 times a day (median gap 5.6 min),
so a replay of 517 real thread starts gave hit rates of 41–63%. Members
that are behind are now moved forward instead, so the remaining misses
are an empty pool (bursts of threads faster than one-at-a-time refills),
a rewritten base, or a busy git lock. I have not re-run the replay with
this rule. A miss falls back to the cold path, so it is never slower
than without a pool, and the handoff checks the remote, so a thread
never starts on older code than a cold create would.

## How you verified

Rebased onto main at a71ea2a. The live runs below used this handoff
code on an earlier base (before #7932, #7957, #7944, #7960 and #7961),
on a `pnpm start:worktree` server with a tiny local repo, a bare remote,
a pushing clone, pool size 1, and an idempotent `.bb-env-setup.sh` that
takes 15 s when `deps.txt` changes and returns at once otherwise. Times
are from thread creation.

| Run | Result |
|---|---|
| Warm hit, member current | provisioning completed +416 ms |
| Warm hit, member behind by a commit that leaves `deps.txt` alone |
fast-forwarded to the new commit; setup ran again and returned at once;
provisioning completed +1.18 s |
| Warm hit, member behind by a commit that changes `deps.txt` |
fast-forward, then setup started 1 s later, while the title was still
pending; the branch was renamed when the title arrived 1 s after that
(reflog); `turn/started` +16.5 s for a 15 s setup |
| `kill -9` of the server 0.6 s after spawn (adopted, setup running,
branch still the placeholder) | after the automatic restart the member
was destroyed (hold released, directory and placeholder branch deleted);
the thread got a fresh worktree on the current commit, `turn/started`
+27.6 s including ~12 s of restart; no leftover branches |
| `kill -9` after the rename, before create returned (`thr_2skjwjn82w`;
a temporary, uncommitted 20 s pause after the rename held the window
open) | at the kill, the worktree was on
`bb/rename-crash-test-thr_2skjwjn82w` with that name in its completion
file, while the database still recorded the placeholder; after the
restart the member was destroyed and its directory and both branches
deleted (the thread's branch reflog starts fresh at the new create); the
thread got a cold worktree and finished its turn at +31.1 s |
| Two creates at once with one member | one takes the member, the other
builds a cold worktree |
| Pool of 1 grown to 3 | second member created 20:42:49 and ready
20:43:04; third created 20:43:05 (it used to wait for the next 2-minute
tick) |
| Project whose folder was deleted | settings and `bb worktree pool
status` show "The project folder … is missing or is not a git
repository." (clearing after a later successful check is covered by
`warm-pools.test.ts`) |
| `bb worktree pool set` with 4 projects keeping pools, one fetching
from GitHub | 0.66–0.88 s, the same as a read-only `pool status` (was
~2.1 s while it waited for every pool to fetch its remote); a shrink
from 2 to 1 and back still deleted and refilled a member in the
background |
| Settings open on a phone-width page while a pool grows from 1 to 2 |
"1 preparing" after 3.3 s and "2 ready" after 14.7 s, without a reload;
long status lines wrap |

**Tests**
- `apps/server/test/environments/environment-holds.test.ts`:
- threads joining a plugin-held environment are refused, including
during a handover, until create returns;
- a provider's `adopt` hands its plugin's held environment to the
thread, and another plugin's hold is kept;
- setup runs again, before the thread starts, when the provider calls
setup after adopt;
- a restart before create returned discards the adopted environment and
gives the thread a new one;
- stopping the thread before create returned discards the adopted
environment;
- create returning a different path than it adopted fails the thread
without starting it;
  - steps reported after adopt show on the thread and the environment;
  - disabling a plugin releases its holds.
- `plugins/environment-git-worktree/host.test.ts` (real git):
- a member is checked, then its placeholder renamed in place without
moving the checkout;
- a remote commit that has not been fetched is fetched, and a member
behind it is fast-forwarded;
- a member is refused after the base was rewritten, or when it is on
another branch;
- removal deletes the renamed branch when the record still names the
placeholder;
- a used checkout gets its placeholder back, and a held ref lock answers
busy quickly;
  - an unreachable remote falls back to the last fetched base.
- `plugins/environment-git-worktree/warm-pools.test.ts`:
- adopt happens on the placeholder, then the branch is renamed once the
title arrives;
  - fast-forward and setup run before the title settles;
- a refused, busy or timed-out member falls back, and a refused adopt
leaves the branch alone;
- another create can take the next member while one waits for its title;
  - one member goes to only one of two simultaneous creates;
- reconcile keeps members that are behind and deletes those no longer on
the base, failed, too old or over the size; turning a pool off deletes
its members;
- a size change replies while a pool's remote check is still running (it
hangs on the previous code).
- turbo typecheck and lint over `...[origin/main]` (167/167 tasks).
turbo test plus `check:query-costs` over the 12 changed packages (23/23
tasks): `@bb/server` 4438 passed, 3 skipped; Worktree 191; `@bb/db` 756;
`@bb/cli` 1412 passed, 1 skipped; `@get-bb/plugin-sdk` 445. Plugin SDK
version guard passes.

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Dec 1, 2026
…8507)

## Human comments

## What was wrong

Boot JavaScript grew from 393.2 KB to 418.9 KB brotli between #7744 (Nov
18) and main, leaving 0.2 KB under the 419.1 KB limit. Two of the
largest steps were static edges from the boot path into page-only code:

- #8089: `plugin-navigation-hooks` imports `useTimelinePaneThreadId`
from `timeline-viewport.tsx`, which also defined
`TimelineViewportScrollSource`. That put `bottom-anchored-scroll-body`
and `scroll-position-keeper` on boot.
- #7960: `active-composer.ts` built the active composer's plugin handle
itself, so the action-context binder (on boot) pulled in
`plugin-composer-handle`, the SDK's `composer-handle` and
`composer-draft-actions`, `plugin-composer-host` and
`composer-editor-registry`. #8050 added a second path to the same
modules: plugin navigation converts `initialPrompt` parts through
`plugin-composer-handle.ts`.

#7962's boot growth (~1 KB brotli) is the exclusive-pick logic the
sidebar thread list and navigation need before they paint, so it stays.

## What changed

- `TimelineViewportScrollSource` moved to
`apps/app/src/lib/timeline-viewport-scroll-source.tsx`;
`timeline-viewport.tsx` exports `useTimelineViewportStore` for it.
- `ActiveComposerCandidate` gained `handle(pluginId)`. `composer-root`
registers a factory built by the new `active-composer-handle.ts`, and
`getActiveComposerHandle` calls it, so `active-composer.ts` no longer
imports the handle code. `experimental_useActiveComposer` uses the same
builder.
- `initialPromptSeedFromComposer` and `mentionText` moved to
`apps/app/src/lib/initial-prompt-seed.ts`. It imports
`composerDraftFromInsertParts` from a new SDK internal subpath,
`@get-bb/plugin-sdk/internal/composer-draft-transforms`, where that
function now lives. A re-export through `internal/composer-handle` still
kept the whole module on boot.
- Plugin SDK 0.6.216 for the new subpath.
- `bundle-budget.json`: `splitBoundaries` boot guards for
`bottom-anchored-scroll-body.tsx`, `active-composer-handle.ts` and
`plugin-composer-handle.ts`, plus a dated `$comment` entry. Limits
unchanged.

## How you verified

Real builds of main (e0c49e2) and this branch, brotli bytes from the
`.br` files `check-bundle-budget.mjs` counts:

| Closure | main | branch | Δ |
|---|---|---|---|
| boot | 428,920 | 419,163 | −9,757 |
| ThreadPage | 498,511 | 507,873 | +9,362 |
| NewThreadPage | 268,226 | 277,858 | +9,632 |
| PluginFrontend | 219,813 | 229,475 | +9,662 |
| boot + each page | | | −95 to −395 |

Raw boot: 1,708,056 → 1,668,548. Every page shell uses the scroll body
(`page-shell.tsx`) and every page loads the plugin runtime that needs
the composer handle, so the code moved into the shared page chunks. The
shell's critical path shrinks, the total before page content is
unchanged, and boot is back to 2.3% headroom. I didn't measure paint
timings.

- Negative control: re-adding the `timeline-viewport` → scroll-body
import and a `plugin-navigation-hooks` → `plugin-composer-handle` import
fails the check with both new guards, and boot returns to 418.6 KB.
- `pnpm exec turbo run test --filter=@bb/app
--filter=@get-bb/plugin-sdk`: 709 + 47 test files pass.
- `pnpm exec turbo run typecheck lint --filter=@bb/app
--filter=@get-bb/plugin-sdk`, `node
apps/app/scripts/check-bundle-budget.mjs`, `oxfmt --check`.
- Live `pnpm start:worktree` with a real Claude Code thread, driven in
headless Chrome: no console errors, scroll-to-latest works, the outline
rail's active tick follows scrolling, and typing in the composer works.

> 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