Repository navigation
Scaffold the thread-list plugin with synced layout preferences - #4031
Merged
SawyerHood merged 2 commits intoSep 22, 2026
Merged
Conversation
SawyerHood
force-pushed
the
thread-list/2-plugin-scaffold
branch
from
September 21, 2026 23:37
5f5a44c to
9d4a254
Compare
SawyerHood
force-pushed
the
thread-list/2-plugin-scaffold
branch
from
September 21, 2026 23:57
9d4a254 to
e3dd0f9
Compare
A bundled plugin that registers the thread-list slot and, for now, renders bb's list through Original while it stands up its own state: the sidebar's organization, sort, section-order, hidden-group, and collapsed-group preferences move into the plugin's KV storage, reached over RPC, pushed to every window over realtime, mirrored to localStorage for first paint, and written back debounced. A one-time migration copies non-default sidebar.* values from bb settings. bb thread-list prefs keeps them scriptable. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
SawyerHood
force-pushed
the
thread-list/2-plugin-scaffold
branch
from
September 22, 2026 00:08
e3dd0f9 to
671936c
Compare
SawyerHood
marked this pull request as ready for review
September 22, 2026 00:15
SawyerHood
added a commit
that referenced
this pull request
Sep 22, 2026
## Human comments
## What was wrong
`useSdk()` should not ship with a single consumer. Two first-party
frontends reached the public API by other means: plugin-api-docs
hand-rolled `fetch("/api/v1/plugins")` and the catalog search with
ad-hoc JSON parsing, and side-chat's `sendToMain` RPC was a pure
pass-through to `bb.sdk.threads.queuedMessages.create`.
## What changed
- plugin-api-docs: `loadPluginReferences(sdk, signal)` over
`sdk.plugins.list()` and `sdk.plugins.catalog.search({ query: "" })`,
with a Vitest setup and first tests for the plugin.
- side-chat: the message action calls
`sdk.threads.queuedMessages.create` directly; the `sendToMain` RPC, its
contract entry, and its server test are deleted.
- Testing harness: `sdk` fakes are now nested (`{ threads: {
queuedMessages: { create } } }`) through a recursive proxy; unfaked
methods still throw with the dot-path.
- Guide: the new-thread composer example spawns from the frontend.
theme-preview's RPCs were reviewed and left alone: they enrich the
catalog and re-apply on disk changes, which is real server work.
Prerequisite: #4031.
## How you verified
side-chat app and server suites, plugin-api-docs suite, plugin SDK
harness suite (nested fake case added), bundled types build, guide
parity suite.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
> AGENT GENERATED
Co-authored-by: Claude Fable 5.1 <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Sep 22, 2026
## Human comments ## What was wrong The thread-list plugin (#4031) had state but no rendering. The built-in sidebar's row layer reaches into about twenty host modules (`@/components/ui/sidebar`, `ThreadActionsProvider`, `ThreadTitleMentions`, split-layout atoms, react-router, prompt-draft storage, the shortcut context) that a plugin cannot import. ## What changed Everything under `plugins/thread-list/app/`, all importing only `@get-bb/plugin-sdk/app`, `@bb/shared-ui`, `@bb/client-core`, `@bb/core-ui`, `@bb/domain` types, and npm packages (verified by grep for `@/`, `react-router-dom`, `@tanstack/react-query`, `@bb/sdk`): - `model/`: an adapter from `PluginSidebarThread` to the internal `ThreadListEntry` shape, cached per DTO identity, so every `@bb/client-core` builder and comparator runs unchanged; `useSidebarData()` regroups threads by project the way the bootstrap payload does. - `ui/`: ports of the sticky-stack primitives, hover-action classes, drag-click suppression, reorder DnD, action-menu items, the compact long-press menu, the shortcut pill, clipboard with `sonner` toasts, dialog state, the confirm-delete dialog, the empty state, and the environment display helpers. - `rows/`: row classes, item keys, sortable motion, droppable types, row controls, the child chevron, the split mini-map (from `useSidebarSplitLayout()`), inline rename with duck-typed error mapping, the status glyph, the section-move provider, the thread actions menu, and `ThreadRow`. The row's link is a plain anchor on `thread.href` (the host routes it); cmd-click calls `open(id, { split: true })`; drafts, row status, and shortcuts come from the per-row hooks; the title renders `ThreadTitle`; moves and unarchive go through `useSdk()`. - New plugin dependencies: `@dnd-kit/*`, `@radix-ui/react-slot`, `@radix-ui/react-compose-refs`, `@bb/core-ui`, `@bb/domain`. Nothing is wired into a list yet; `app.tsx` still renders `Original`. The next layer assembles sections, projects, and machines. Prerequisite: #4035. ## How you verified 124 plugin tests (112 new): 93 `ThreadRow` cases covering open, split, rename via double-click and menu, every menu item's action or SDK call including move-to-section and pinned-move sequencing, copy link, unarchive pending state, drag-click suppression, chevron toggles, glyph precedence, plugin status, the shortcut pill, and the cross-project glyph; 11 inline-rename cases including error duck-typing; 2 mini-map cases; 6 adapter and grouping cases. `pnpm exec turbo run typecheck test --filter=bb-plugin-thread-list`, `prepare:bundled` builds (1.8 MB dev bundle). 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED --------- Co-authored-by: Claude Fable 5.1 <[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
The sidebar's layout state (organization mode, sort, section orders, hidden groups, six collapsed-id lists) lives in a closed enum of
sidebar.*UI preferences that only the host can read or write. A thread list that is a plugin needs to own that state. This layer stands the plugin up with its state before any rendering moves.What changed
plugins/thread-list(bb.branding.icon: ListView, registered in the builtin registry, bundled-plugins package, official catalog, and the marketplace snapshot). Itsexperimental_threadListregistration rendersOriginalfor now, so enabling it changes nothing visible.server.ts: preference store onbb.storage.kvvalidated by the plugin's own zod schemas (shared/preferences.ts),listPreferences/setPreference/resetPreferenceRPC,preferencesrealtime channel,bb thread-list prefs list|get|set|reset, and a one-time migration copying non-defaultsidebar.*values frombb.sdk.system.uiPreferences.app/preferences/: jotai atoms with the samecreateSyncedPreferenceAtom(key)shape the host uses (so later slices port by changing an import), hydrated from a localStorage mirror then RPC, patched by realtime unless a local write is pending, written back debounced and coalesced.plugins/thread-list/skills/thread-list/SKILL.mdand the bb-guide customization template mention the command.Prerequisite: #4029.
How you verified
Server tests: defaults, valid write with realtime fan-out, schema rejection leaves storage alone, hidden-group dedupe and reset, invalid stored value falls back, migration copies once and never overwrites, migration skipped without marking done when bb is unreachable, CLI list/get/set/reset with bad key and bad value. Frontend tests: hydrate and mirror, mirror-first paint with junk ignored, coalesced debounced writes, remote signal precedence, no write for an unchanged value. Bundled-plugin, catalog generator, and guide parity suites pass;
prepare:bundledbuilds.🤖 Generated with Claude Code