Repository navigation
Move bb's thread outline onto a public rail slot plugins can replace - #8089
Merged
Merged
Conversation
ymichael
force-pushed
the
bb/thread-outline-public-api
branch
from
November 24, 2026 06:00
89aa32f to
fdf968a
Compare
bb's thread outline read private timeline rows, the scroll element and the
DOM, and revealed messages through a pane-local request plugins could not
use. Community outlines rebuilt it from the DOM and hid bb's with CSS.
- app.slots.experimental_threadRailOutline (exclusive, pick
threadRail.outlineProvider) and app.slots.experimental_threadRail
(additive), rendered by PluginThreadRail beside the conversation, mirroring
threadHeaderTitle and threadHeaderRow.
- experimental_useConversationOutline: a thread's prompts or replies across
the whole thread, with the pane's loaded rows laid over the public outline
route.
- experimental_useTimelineViewport: the messages a pane shows, from one
shared observer per pane.
- toThread(threadId, { messageSeq }) reveals in place and replaces the
history entry when the route already shows the thread.
- bb's outline moves to core-contributions/thread-outline.tsx on public SDK
members and registry items only; the private messageRevealRequest path and
components/thread/toc are deleted; useScrollOverflowState becomes the
use-scroll-overflow-state registry item.
- Plugin SDK 0.6.191, api_to_audit entries, Plugin Guide card, authoring
reference, configuration docs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n thread
toThread(threadId, { messageSeq }) replaced the history entry only when the
route already showed the thread. Clicking the outline in an unfocused split
pane focuses that pane by replacing the route, but toThread read the route
from the last render, so it pushed an entry and Back appeared to do nothing.
It now also replaces when the thread pane the caller renders in shows the
thread.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/thread-outline-public-api
branch
from
November 24, 2026 20:01
fdf968a to
85ffe31
Compare
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
bb's thread outline (
ThreadTableOfContents) was core-only. It read the pane's private timeline rows and the bottom-anchored scroll element, scanned[data-timeline-row-id]in the DOM to find the prompt in view, and revealed messages through a private, pane-localmessageRevealRequestinstead of the publicnavigate.toThread(threadId, { messageSeq }). Plugins had none of these. In the community corpus, sticky-prompt, threadline, minimap, pinned-turns, bookmarks, chat-search, quick-reply and others rebuild the outline from the DOM: they scroll-probe to reach rows windowing has not drawn, send synthetic wheel events so bb does not snap back to the bottom, forgesearchMessageSeqrouter state, or hide[data-thread-toc]with CSS to replace bb's outline. Design and kill-tests:thr_kr2zhuzxnn(DESIGN.md).What changed
app.slots.experimental_threadRailOutline(exclusive) andapp.slots.experimental_threadRail(additive). These mirrorthreadHeaderTitleandthreadHeaderRow.PluginThreadRailrenders a column at the conversation's right edge in thread pages and split panes. The outline goes at the top, chosen by the shared exclusive-slot rule from the new synced pickthreadRail.outlineProvider(__builtin__= bb's outline). It is set in Settings > Appearance > Interface > Thread outline, or withbb settings ui set threadRail.outlineProvider <pick>. Rail items stack below it byorder. A crashing plugin outline falls back to bb's for that thread. While the pane is narrower than 56rem, the rail stays mounted, hidden and inert, and components getvisible: false.visibleis a prop because the sibling slot props pass host layout state that way (isCompactViewport).experimental_useConversationOutline(threadId, role, { enabled? })returns a thread's user prompts or assistant replies across the whole thread. It is the public conversation-outline route with the pane's loaded rows laid over it. Previews have the sender envelope stripped, andsenderThreadIdis set from it. Items keep their identity until an item changes.experimental_useTimelineViewport()returns{ visibleMessageIds, atLatest }for the pane the component renders in. It uses one shared, lazily attached observer per pane (TimelineViewportProviderinThreadScreen) and updates once scrolling settles.toThread(threadId, { messageSeq })now reveals in place and replaces the history entry when the route, or the thread pane the caller renders in, already shows that thread. The pane case covers clicking the outline of an unfocused split pane: pane focus replaces the route, buttoThreadreads the route from the last render, so it used to push an entry there. Before, it pushed one entry per call, so Back stepped through reveals that did not move the view. This is documented in the JSDoc and in the audit entry.apps/app/src/core-contributions/thread-outline.tsx.experimental_threadRailOutlineand imports only public SDK members and registry items;bb/core-contribution-importspasses.BUILT_IN_THREAD_RAIL_OUTLINE), not as a claimant.experimental_useThread, so a sender thread the sidebar does not hold (an archived one, for example) shows its title instead of "Agent".experimental_use*imports are aliased touse*names, so the React Compiler treats them as hooks. The rail tests caught this.components/thread/toc/and the privatemessageRevealRequestpath (ThreadScreenstate, theThreadTimelineSurface/ThreadTimelineRowsprops, and the request ordering inSearchMessageLocationProvider).useScrollOverflowStatemoved to@bb/shared-ui/use-scroll-overflow-stateas a registry item (use-scroll-overflow-state), so core's outline and plugins import the same hook. Seven app callers switched imports. The registryr/output was regenerated.lib/core-plugin-sdk-app.ts) now re-exportsuseBbNavigate,experimental_useThread,experimental_useConversationOutline,experimental_useTimelineViewport,experimental_PromptMentionIconandexperimental_describePromptMention, from the same implementations plugins get.conversationOutlinesandtimelineViewportoptions and capturesthreadRails/threadRailOutlines.docs/api_to_audit.md: three entries naming the core callers, plus thetoThreadchange.thread-rail, with its anatomy entry and wireframe mark.references/frontend-thread-rail.md,exclusive-slots.mdand SKILL.md.docs/configuration.mdgets the new pick key; the demo server gets the new preference entry.How you verified
Tests (each fails on main):
PluginThreadRail.test.tsx: bb's outline reveals a clicked prompt in place with REPLACE, hides below three prompts, and stays hidden and inert without reading while the pane is narrow (items getvisible: false). It reads Agent replies only once that tab is chosen, names an archived sender thread, marks the first prompt in view or the last one at the latest message, and caps the rail at twenty ticks. A plugin outline replaces bb's under Automatic with rail items below it,__builtin__keeps bb's, and a crashing outline falls back to bb's.conversation-outline.test.tsx: merge and append, nested rows, the context boundary, waiting for the first timeline page andenabled: false, and identity while a reply streams.timeline-viewport.test.tsx: visible ids,atLatest, logarithmic measurement, settle timing and render count, and null outside a pane.plugin-navigation-hooks.test.tsx: REPLACE while the route or the calling pane shows the thread, PUSH otherwise.ThreadTimelineRows.windowing.test.tsx: a windowed-out message link is drawn and revealed, and revealed again on a replace.pinned-replacement-surfaces,exclusive-pick-first-paint), settings search, and registration tests.Live, on a
pnpm start:worktreebuild with a dev copy of a real 143-turn thread (121 prompts, 5318 events), in headless Chrome at 1600×1000. The machine's load average was 100–300 throughout, so the timings are noisy. Scripts and JSON are in the design thread's storage (thr_kr2zhuzxnn/evidence).history.lengthstays flat across every click, and the URL gains#msg=<seq>.TimelineViewportScrollSource.conversation-outline?role=userafter it, and no assistant request.experimental_useConversationOutline,experimental_useTimelineViewportandtoThread:bb settings ui set threadRail.outlineProvider <plugin>/fixture-outline: the plugin outline (121 items,ready) replaces bb's, and its rail item stacks below.__automatic__picks the installed plugin, and__builtin__restores bb's.Commands:
turbo run typecheck lint lint:type-aware --filter='...[origin/main]'(270 tasks). It found three issues, all fixed: a fixture type, the demo server's preference table, and two floatingactpromises.turbo run typecheck lint lint:type-aware testfor@bb/app,@get-bb/plugin-sdk,@bb/shared-ui,@bb/domain,@bb/plugin-registry,bb-plugin-plugin-api-docs,bb-plugin-theme-previewand@bb/demo-server: typecheck and both lints are green.@bb/appcases, which time out under the machine's load (average 70–300):exclusive-pick-first-paint(first dynamic import over 15 s).LazyQueuedMessagesList(a 40 s lazy import).origin/maincheckout run at the same time....[origin/main]test run also timed out ininstall-machine-script,process-utils,environment-provider-hostand the integration suite. These are load-sensitive suites this change does not touch; CI is the clean signal for them.node .github/workflows/check-plugin-sdk-version.mjspasses, at SDK 0.6.196.ThreadTableOfContents.stories.tsxis deleted with no replacement story. The rail has no Ladle story yet.Found, not fixed
messageSeqis the seq of its latest update. It becomes theitem/completedseq once the reply finishes (in the design kill-tests: 208 → 307). A message link copied mid-stream therefore carries an intermediate seq, and after completionfindMessageSeqRowPath(useScrollToSearchedMessage.ts) matches only the completion seq, so the link should toast "Message not found". This is out of scope here.🤖 Generated with Claude Code