Repository navigation
Conversation
toCompose({ initialPrompt }) and NewThreadComposer's initialPrompt now
accept ComposerInsertPart[] as well as a string. Parts convert through
composerDraftFromInsertParts, the same function useComposer().insert()
uses, so path, attachment and the plugin's own mentions arrive as pills.
Core's plugin and skill "Edit ... at <path>" hand-offs now seed the path
as a path mention pill through the same conversion and location state.
Fixes #8014
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…slot The Edit plugin/skill prompts and the @/path token reader now build path mentions through one client-core pathMentionResource helper, next to the serializer it inverts. The prompt builders move from shared-ui into apps/app/src/lib, where their only callers and test already live. NewThreadComposer no longer throws during render for parts insert() would reject: it logs a [plugin:<id>] warning and opens with an empty draft, as its other props fall back on bad input. toCompose and insert() still throw to the caller, and now also reject an empty item id, which the server would otherwise refuse only at send time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/8014-tocompose-newthreadcomposer-seed-the-draft-thr_y5dbemr88r
branch
from
November 23, 2026 20:45
3e95651 to
e102385
Compare
ymichael
deleted the
bb/8014-tocompose-newthreadcomposer-seed-the-draft-thr_y5dbemr88r
branch
November 23, 2026 20:55
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
toCompose({ initialPrompt })andNewThreadComposer'sinitialPromptonly took a string. The seed path recognized only serialized@thread:,@project:and@section:tokens. Path, attachment and plugin mentions have no serialized form, so a hand-off could only add them as plain text. A mounted composer'suseComposer().insert()already acceptedComposerInsertPart[]; the hand-off path had no equivalent. Core had the same gap: its "Edit the bb plugin/skill … at " hand-offs put the path into the prompt as text.What changed
app-contract.ts):NewThreadComposerProps.initialPromptandBbNavigate.toCompose'sinitialPromptare nowstring | readonly ComposerInsertPart[]. The empty-draft-only seed semantics are unchanged, and the JSDoc now describes the parts form. SDK bumped to 0.6.184.internal/composer-handle.ts):insert()'s privateinsertValueis now the exportedcomposerDraftFromInsertParts(parts, { pluginId, mentionText }).insert()and both seed surfaces call it. A part withoutkindresolves to the calling plugin. If there is no plugin (core,pluginId: null), it throws.initialPromptSeedFromComposer(lib/plugin-composer-handle.ts) turns a string or parts into anInitialPromptSeed, which is either a string or{ text, mentions: PromptTextMention[] }.toComposeconverts before it navigates, so an invalid provider throws to the caller the same wayinsert()does.PluginNewThreadComposerconverts with its plugin id.RootComposeViewreadslocation.state.initialPromptwith a zod schema (initialPromptSeedSchema, built onpromptTextMentionSchema) and memoizes the result onlocation.state.useInitialPromptDrafttakes either form. Structured seeds skip serialized-token parsing and thread-title resolution, so mentions are recreated exactly asinsert()would. They still go through the same query so the draft stays structurally stable across re-renders.shared-ui/resource-edit-prompt.ts,ToolsView,SkillsLibrary):buildPluginEditThreadPrompt/buildSkillEditThreadPromptnow returnComposerInsertPart[]with apathmention (a directory for plugins, a file for skills, labelled with the basename). The callers pass these throughinitialPromptSeedFromComposer, the same path plugins use. The sent prompt text now reads… at @/path/to/plugin/. I want to, which is what the user would get by picking the path from@.TestNewThreadComposerrenders a parts seed's text.NewThreadComposerandtoComposedescribe the parts form.No server/daemon wire change.
How you verified
pnpm exec turbo run typecheck --filter=@bb/app --filter=@get-bb/plugin-sdk --filter=@bb/shared-uipasses.pnpm exec turbo run lintpasses for the same packages.resource-edit-prompt,RootComposeView,initial-prompt-draft,PluginNewThreadComposer,plugin-composer-handle,SkillsViewandplugin-slot-mountsinapps/app, plus the plugin-sdkapp-harnesstest.PluginNewThreadComposer.test.tsx: core's plugin-edit hand-off goes throughRootComposeViewlocation state and seeds the root draft with apathmention at the right range. A plugin's[text, { provider, id, label }]seed submits apluginmention resolved to that plugin (itemId: "notes:…").resource-edit-prompt.test.ts: plugin and skill hand-offs produce the expected text and path-mention ranges. A part withoutkindthrows when core seeds the draft.RootComposeView.test.ts: a structured location-state seed parses, and one with a malformed mention is rejected.Fixes #8014
🤖 Generated with Claude Code