Skip to content

Switch servers from the sidebar footer - #7892

Merged
ymichael merged 7 commits into
get-bb:mainfrom
salemsayed:sidebar-server-switcher
Nov 21, 2026
Merged

ymichael merged 7 commits into
get-bb:mainfrom
salemsayed:sidebar-server-switcher

Conversation

@salemsayed

@salemsayed salemsayed commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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

  • A bundled Server switcher plugin (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 turning defaultEnabled on 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.
  • The plugin uses the existing footer API. It registers through experimental_sidebarFooter the way Provider usage does, so core gains no footer code of its own.
  • experimental_hasServers() (new, @get-bb/plugin-sdk/app) is true where experimental_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 inside definePluginApp and registers its footer item only on those clients. Core implements it with the same getServerChoices() the command palette uses. loadPluginApp(source, { hasServers: true }) lets plugin tests define the app the same way.
  • Add server… opens the desktop's own Add Server dialog (the same openSetServerUrlDialog(true) as Server › Add Server…). In the mobile app, the shell opens Settings › Servers › Add (open-native screen add-server, mobile bridge 4 → 5).
  • Sign in to bb Connect… appears exactly when the Server menu shows its sign-in item. One predicate in @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.
  • Desktop contract and preload. The server list IPC also carries the Connect sync skip reason (getServerList, onServerListChange), plus addServer and signInToConnect. listServerChoices, getServerChoices and onServerChoicesChange stay for older pages, and new pages fall back to them on older desktop releases, without the two new rows.
  • Plugin SDK 0.6.175. experimental_useServers() gains addServer and accountSignIn, and experimental_hasServers() is new. docs/api_to_audit.md, the Plugin Guide's sidebar footer card, docs/configuration.md and the bb guide are updated.
  • No server or daemon wire changes, so HOST_DAEMON_PROTOCOL_VERSION is unchanged.

The screenshots below are from the first version of this PR, when the switcher was in core; the plugin renders the same panel.

Before (main) After
Desktop Desktop sidebar footer on main: Mobile apps, Provider usage, Report a bug Servers panel above the footer: three servers, Sign in to bb Connect, Add server
Phone (390 px, touch) Phone sidebar footer on main Servers panel in the phone sidebar
Dark, opened with the keyboard bb Desktop (packaged Linux build), after adding a server Add server… in bb Desktop
Dark theme, focus on the current server Real desktop app: This Computer and a custom server, sign-in and Add server rows The desktop's Add Server dialog opened from the panel

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, desktop server-choice-ipc (the sign-in IPC opens exactly when createServerMenuItems shows the item, for no reason and all five skip reasons) and preload-browser-api, and mobile-bridge messages. The new store, IPC and bridge tests fail on main (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 with connectServersSkipReason: "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 to window.bbDesktop.signInToConnect() cleared the cookie before the gate and leaves it in place with it.

  • Headless Chromium against isolated pnpm start:worktree instances of this branch and main, at 1440×900 and a 390×844 touch phone, light and dark. It used a stub window.bbDesktop (three servers, a sign-in skip reason, loading, one server, and an older desktop without the new methods) and the real buildBridgeInjectionScript at bridge 5. On main the footer items are builtin:mobile, plugin:bb--provider-usage/usage and builtin:report-bug everywhere. 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 posts switch-server and open-native add-server. A switch the shell never completes leaves the panel closed and every row choosable when reopened.

  • pnpm exec turbo run typecheck lint for @bb/app, @bb/desktop, @bb/mobile, @bb/mobile-bridge, @bb/desktop-contract and @get-bb/plugin-sdk. Tests: desktop 647, mobile 356, plugin SDK 444, mobile bridge 40, desktop contract 18, app 7,265 passed. oxfmt --check on the changed files, check-plugin-sdk-version.mjs, and the @bb/app build with check-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 with hasServers, 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, and experimental_hasServers() matching it), the plugin SDK, Plugin Guide, templates, server built-in plugin and catalog, web marketplace, and fork checks. Live on pnpm start:worktree with a stub window.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-native reach the Servers screen).

Fixes #3133

AGENT GENERATED

🤖 Generated with Claude Code

salemsayed and others added 7 commits November 20, 2026 06:18
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]>
# Conflicts:
#	packages/domain/src/plugin-sdk-version.ts
#	packages/plugin-sdk/package.json
@ymichael
ymichael merged commit 763d2a2 into get-bb:main Nov 21, 2026
50 checks passed
salemsayed added a commit to salemsayed/salemsayed that referenced this pull request Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose the Desktop server selector in the sidebar header

2 participants