Repository navigation
Expose bb's public API client to plugin frontends as useSdk() - #4027
Merged
SawyerHood merged 2 commits intoSep 22, 2026
Merged
Conversation
SawyerHood
force-pushed
the
thread-list/1g-use-sdk
branch
from
September 21, 2026 23:37
81e175e to
5ab2abc
Compare
SawyerHood
force-pushed
the
thread-list/1g-use-sdk
branch
from
September 21, 2026 23:57
5ab2abc to
9d02dbc
Compare
Plugin frontends could already reach the public API over same-origin fetch, but had no typed client. Bind the app's browser SDK per plugin, mirroring the backend bb.sdk narrowing (spawn and fork stamp the plugin origin, the metadata calls default pluginId), and hand it out through useSdk(). The bundled app declarations now carry the SDK areas on purpose; the guard that kept them out is updated to assert the bound client instead. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
SawyerHood
force-pushed
the
thread-list/1g-use-sdk
branch
from
September 22, 2026 00:08
9d02dbc to
267cdcf
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
…ole split layout (#4029) ## Human comments ## What was wrong Four more things bb's own list reads that a plugin could not: the pin timestamp that breaks ties in pinned order, the archive timestamp, an app-relative URL per thread and per project so rows can be real anchors (the host already routes plugin-root anchor clicks in place), and two whole-list reads for collapsed-group rollups, every row status by thread id and the whole split layout with the thread each pane shows. ## What changed - `PluginSidebarThread` gains `pinnedAt`, `archivedAt`, `href`; `PluginSidebarProject` gains `href` and `settingsHref`. - `useSidebarThreadRowStatuses()` over a new cached snapshot in `plugin-thread-row-status.ts`, invalidated on every notify and identity-stable while unchanged. - `useSidebarSplitLayout()` over `splitLayoutAtom`, null on compact viewports and single-pane layouts, via a pure `toPluginSidebarSplitLayout`. - Harness fakes (`sidebarSplitLayout` option), guide, API index, and surfaces updated. Prerequisite: #4027. ## How you verified Mapper test for the timestamps and href; hook tests for project hrefs (personal project resolves to `/`), row-status snapshot identity, and a pure split-layout test. Same typecheck/test filters as the lower PRs plus `build:types`. 🤖 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
Plugin frontends run on the app origin and can already reach the public API with same-origin fetch (plugin-api-docs and inline-vis do), but there was no typed client.
@bb/sdkis workspace-only and not shimmed, so a third party would hand-roll requests, and the guide steered authors toward a server-side RPC proxy for every write. The sidebar-as-plugin work needs section CRUD, thread moves, pins, and unarchive from the frontend.What changed
useSdk(): PluginBrowserBbSdkon@get-bb/plugin-sdk/app. The host binds its browser SDK instance per plugin inapps/app/src/lib/plugin-bound-sdk.ts, mirroring the backendbb.sdknarrowing:spawnandforkstamporigin: "plugin"andoriginPluginId, and the metadata calls defaultpluginId. One stable client per plugin, so it is safe in dependency lists.PluginBoundThreadsAreaandPluginBrowserBbSdktypes, inlined into the bundled app declarations the same way the backend contract inlinesBbSdk. No npm publish of@bb/sdkis needed.@bb/imports.sdkoption with per-area partial fakes,inspection.sdkCalls, and a loud error for an unfaked method.frontend-hooks-and-ui.md, registration example), API indexes, and surfaces updated.Prerequisite: #4026.
How you verified
Binding tests for attribution rules, explicit origins, metadata defaulting, passthrough, and identity caching. A harness test that serves a faked
threadSections.create, records calls, and throws forthreads.pin.pnpm exec turbo run test build:types --filter=@get-bb/plugin-sdk, app typecheck and hook suites, guide parity suite.🤖 Generated with Claude Code