Repository navigation
Switch servers from the sidebar footer - #7892
Merged
Merged
Conversation
bb Desktop and the mobile app keep a list of servers, but the only way to switch from inside bb was the command palette, and adding a server or signing in to bb Connect lived only in the desktop's native Server menu. The sidebar footer now has a Servers item on bb Desktop and the mobile app (hidden in a web browser, which has no server list). It opens a panel above the footer, like plugin footer panels, listing each server with its host and a check on the current one. Choosing another server switches to it. The panel also offers Add server… (desktop's Add Server dialog, or the mobile app's Add server screen) and, while desktop can't list account servers, the same bb Connect sign-in as its Server menu. - App: built-in footer items can open a disclosure, sharing the plugin disclosure host. useServerChoices carries addServer and accountSignIn. - Desktop: the server list IPC also carries the bb Connect skip reason; new add-server and sign-in-to-connect channels reuse the menu's paths. The preload keeps listServerChoices/onServerChoicesChange for older pages and adds getServerList/onServerListChange, addServer and signInToConnect. - Mobile bridge 5: open-native accepts add-server. - Plugin SDK 0.6.167: experimental_useServers() gains addServer and accountSignIn, the same implementation core uses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… choose Review follow-up for the sidebar server switcher. - Desktop: the sign-in IPC now opens bb Connect's sign-in only while the Server menu offers it. Menu, IPC and page share one predicate, bbDesktopConnectSignInLabel. Before, any registered app window could call signInToConnect while sync was healthy, and opening the sign-in clears the Connect session cookie. - Switcher: choosing a server closes the panel and then switches, as the command palette does. The pending spinner is gone, so a switch the mobile app reports as failed no longer leaves every row disabled. - Opening the panel moves focus to the current server; Escape still returns it to the footer button. - One contract table in server-choices.test.tsx runs the footer switcher and experimental_useServers against bb Desktop and the mobile app. - Plugin SDK 0.6.168 (main is at 0.6.167). Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # packages/domain/src/plugin-sdk-version.ts # packages/plugin-sdk/package.json
The footer switcher now registers through experimental_sidebarFooter like
Provider usage, instead of a core-only builtInDisclosures path. A new
experimental_hasServers() lets the plugin register it only on bb Desktop and
the mobile app; loadPluginApp takes { hasServers } to test that.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # packages/domain/src/plugin-sdk-version.ts # packages/plugin-sdk/package.json
…tplace page 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 Desktop and the mobile app keep a list of servers, and since #6532 the app reads it through
useServerChoices. The only way to switch from inside bb is the command palette, which only lists servers you already have. Adding a server, and signing in to bb Connect so account servers show up, live only in the desktop's native Server menu. On the phone, adding a server means going to the app's Settings › Servers. #3133 asks for a server selector in the app's sidebar.What changed
bb--server-switcher), off by default. Once enabled, bb Desktop and the mobile app get a Servers item in the sidebar footer. A web browser keeps no server list, so the item isn't there. It opens a panel above the footer like any plugin footer item: each server with its host and a check on the current one. Choosing another server closes the panel, then switches, in the same order as the palette. Opening the panel moves focus to the current server, and Escape returns it to the footer button. It follows the footer's order and visibility settings and opens from More like any footer item. It ships off while it gets more use on real desktop and mobile builds; existing installs follow the default until the user toggles the plugin, so turningdefaultEnabledon later reaches them. I put it in the footer rather than the header Expose the Desktop server selector in the sidebar header #3133 suggests: Add experimental_useServers to the plugin SDK #6532's Plugin Guide entry already names the footer for switching servers, the Mobile apps item sits there, and on a phone it is within thumb reach in the sidebar drawer.experimental_sidebarFooterthe way Provider usage does, so core gains no footer code of its own.experimental_hasServers()(new,@get-bb/plugin-sdk/app) is true whereexperimental_useServers()returns a value (bb Desktop and the mobile app) and false in a browser. It is fixed for the life of the page, so the plugin reads it insidedefinePluginAppand registers its footer item only on those clients. Core implements it with the samegetServerChoices()the command palette uses.loadPluginApp(source, { hasServers: true })lets plugin tests define the app the same way.openSetServerUrlDialog(true)as Server › Add Server…). In the mobile app, the shell opens Settings › Servers › Add (open-nativescreenadd-server, mobile bridge 4 → 5).@bb/desktop-contract,bbDesktopConnectSignInLabel, decides it for the menu, the page and the main-process IPC handler. The handler ignores the request otherwise, because opening the sign-in clears the Connect session cookie.getServerList,onServerListChange), plusaddServerandsignInToConnect.listServerChoices,getServerChoicesandonServerChoicesChangestay for older pages, and new pages fall back to them on older desktop releases, without the two new rows.experimental_useServers()gainsaddServerandaccountSignIn, andexperimental_hasServers()is new.docs/api_to_audit.md, the Plugin Guide's sidebar footer card,docs/configuration.mdand the bb guide are updated.HOST_DAEMON_PROTOCOL_VERSIONis unchanged.The screenshots below are from the first version of this PR, when the switcher was in core; the plugin renders the same panel.
main)How you verified
Tests added or extended:
server-choices.test.tsx(store tests, and the plugin hook against bb Desktop and the mobile app),plugins/server-switcher/app.test.tsx, desktopserver-choice-ipc(the sign-in IPC opens exactly whencreateServerMenuItemsshows the item, for no reason and all five skip reasons) andpreload-browser-api, and mobile-bridgemessages. The new store, IPC and bridge tests fail onmain(for example{"type":"open-native","screen":"add-server"}: expected false to be true).Live, in a packaged Linux desktop build of this branch under Xvfb with its own data directory and built-in server:
getServerList()returned the list withconnectServersSkipReason: "no-credential", and the panel showed This Computer, Sign in to bb Connect… and Add server…. Add server… opened the Add Server dialog, and saving a second local bb server added it and moved the window there. Choosing either server in the panel moved the window to it and back. Sign in to bb Connect… opened the desktop's bb Connect sign-in window. Enter on the footer button put focus on the current server with a visible ring, and Escape returned it to the button.The sign-in gate, offline (a local dev Connect URL with nothing listening): with a session cookie present and sync reporting
not-paired, so the menu offers no sign-in, a page call towindow.bbDesktop.signInToConnect()cleared the cookie before the gate and leaves it in place with it.Headless Chromium against isolated
pnpm start:worktreeinstances of this branch andmain, at 1440×900 and a 390×844 touch phone, light and dark. It used a stubwindow.bbDesktop(three servers, a sign-in skip reason, loading, one server, and an older desktop without the new methods) and the realbuildBridgeInjectionScriptat bridge 5. Onmainthe footer items arebuiltin:mobile,plugin:bb--provider-usage/usageandbuiltin:report-bugeverywhere. The first version of this branch added a Servers item on desktop and in the mobile shell, and nothing in a plain browser. In the mobile shell the panel postsswitch-serverandopen-nativeadd-server. A switch the shell never completes leaves the panel closed and every row choosable when reopened.pnpm exec turbo run typecheck lintfor@bb/app,@bb/desktop,@bb/mobile,@bb/mobile-bridge,@bb/desktop-contractand@get-bb/plugin-sdk. Tests: desktop 647, mobile 356, plugin SDK 444, mobile bridge 40, desktop contract 18, app 7,265 passed.oxfmt --checkon the changed files,check-plugin-sdk-version.mjs, and the@bb/appbuild withcheck-bundle-budget.mjs("Bundle budget OK").One app test also fails on
main(351cb84, unchanged):ThreadDetailPromptArea.test.tsx"dismisses a missing queued message but keeps a stale edit recoverable".Not checked: the iOS and Android apps themselves (the page side used the real bridge injection script), account servers from a signed-in bb Connect, and bb Desktop on macOS and Windows.
After moving the switcher into the plugin:
pnpm exec turbo run typecheck lint --filter='...[origin/main]'(183 tasks), and tests for the plugin (registration only withhasServers, focus on the current server, close-then-switch order, add-server and sign-in rows, a client without either),server-choices.test.tsx(the hook against bb Desktop and the mobile app, andexperimental_hasServers()matching it), the plugin SDK, Plugin Guide, templates, server built-in plugin and catalog, web marketplace, and fork checks. Live onpnpm start:worktreewith a stubwindow.bbDesktop: the panel, switching, Add server…, Sign in…, Escape and focus behave as before; a plain browser has no item; the plugin starts disabled, and enabling or disabling it adds or removes the footer item without a reload.Related: #5740 (its smaller step, letting
open-nativereach the Servers screen).Fixes #3133
🤖 Generated with Claude Code