Skip to content

The agent that grows with you

fix(desktop): keep multi-gateway navigation available in Simple mode

brooklyn!7eb0ae1a602d
diff --git a/apps/desktop/src/app/contrib/controller.tsx b/apps/desktop/src/app/contrib/controller.tsx
index 0c24c06015d..48e56573a92 100644
--- a/apps/desktop/src/app/contrib/controller.tsx
+++ b/apps/desktop/src/app/contrib/controller.tsx
@@ -58,6 +58,7 @@ import { type KeybindContribution, KEYBINDS_AREA } from '@/lib/keybinds/actions'
import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
import { TRANSCRIPT_DIRECTIVE_AREA, type TranscriptDirectiveContribution } from '@/lib/transcript-directives'
import { setYoloEnabled } from '@/lib/yolo-session'
+import { $connectionsRegistry } from '@/store/connection-registry-state'
import { $interfaceMode, $showsAdvancedChrome, setModeContext, toggleSimpleMode } from '@/store/interface-mode'
import {
$fileBrowserOpen,
@@ -593,9 +594,9 @@ bindToolPaneCollapse(
() => setTerminalTakeover(true),
$showsAdvancedChrome
)
-// Policies may consult the install: the profile rail stays in Simple when a
-// second profile makes it the only remaining way to switch.
+// Without the statusbar, the rail is the only way to switch profiles or gateways.
$profiles.subscribe(profiles => setModeContext({ profileCount: profiles.length }))
+$connectionsRegistry.subscribe(registry => setModeContext({ connectionCount: registry?.connections.length ?? 0 }))
// ⌘K door onto the same pane the keybind and statusbar pill flip — was a
// one-way "open" row under Go to, so it never showed on/off and couldn't hide.
// Reads the TREE like every other pane toggle: `$terminalTakeover` stays true
diff --git a/apps/desktop/src/store/interface-mode.test.ts b/apps/desktop/src/store/interface-mode.test.ts
index 97c0324d8a6..90014447747 100644
--- a/apps/desktop/src/store/interface-mode.test.ts
+++ b/apps/desktop/src/store/interface-mode.test.ts
@@ -123,7 +123,7 @@ describe('modeBound resolver', () => {
expect($bound.get()).toBe('technical')
})
- it('keeps the profile door open in Simple when there is a second profile to walk through', async () => {
+ it('keeps the profile rail available in Simple for multiple profiles or gateways', async () => {
const { modeBound, setInterfaceMode, setModeContext } = await loadStore()
const $pref = atom(true)
const $bound = modeBound('profileRailVisible', $pref, value => $pref.set(value))
@@ -136,6 +136,12 @@ describe('modeBound resolver', () => {
setModeContext({ profileCount: 1 })
expect($bound.get()).toBe(false)
+
+ setModeContext({ connectionCount: 2 })
+ expect($bound.get()).toBe(true)
+
+ setModeContext({ connectionCount: 1 })
+ expect($bound.get()).toBe(false)
})
})
diff --git a/apps/desktop/src/store/interface-mode.ts b/apps/desktop/src/store/interface-mode.ts
index df59f03e3f2..cba772523dd 100644
--- a/apps/desktop/src/store/interface-mode.ts
+++ b/apps/desktop/src/store/interface-mode.ts
@@ -76,6 +76,7 @@ export function toggleSimpleMode() {
/** What a policy may look at when its answer depends on the install. */
export interface ModeContext {
+ connectionCount: number
profileCount: number
}
@@ -102,10 +103,9 @@ const SIMPLE_POLICY: PolicyTable = {
fileBrowserOpen: false,
// Inline diffs are the review pane's job; the changed-files summary stays.
hideCodeDiffs: true,
- // Hide a door only when there is somewhere else to go: with the statusbar
- // (and its fallback profile dropdown) gone, a second profile makes the rail
- // the only way to switch, so it stays for multi-profile installs.
- profileRailVisible: context => context.profileCount > 1,
+ // Without the statusbar, multi-gateway installs still need the rail even
+ // when the active gateway has only one profile.
+ profileRailVisible: context => context.profileCount > 1 || context.connectionCount > 1,
// A quiet "Thought for Ns" row instead of a live reasoning stream.
reasoningCollapsedByDefault: true,
reviewOpen: false,
@@ -127,10 +127,10 @@ const POLICY: Record<InterfaceMode, PolicyTable> = {
/** Does this mode have an opinion about the surface at all? */
const shadows = (key: ModePolicyKey, mode: InterfaceMode) => key in POLICY[mode]
-// The install facts a policy may consult. Fed by the app shell (profile roster),
+// The install facts a policy may consult. Fed by the app shell (profiles and gateways),
// kept off this module's imports so preference stores can depend on it without
// dragging the session graph in.
-export const $modeContext = atom<ModeContext>({ profileCount: 1 })
+export const $modeContext = atom<ModeContext>({ connectionCount: 1, profileCount: 1 })
export function setModeContext(patch: Partial<ModeContext>) {
$modeContext.set({ ...$modeContext.get(), ...patch })
diff --git a/website/docs/user-guide/multi-connection-desktop.md b/website/docs/user-guide/multi-connection-desktop.md
index d1c465309f7..d636f78e6de 100644
--- a/website/docs/user-guide/multi-connection-desktop.md
+++ b/website/docs/user-guide/multi-connection-desktop.md
@@ -251,9 +251,12 @@ that live on one gateway.
are all scoped to the active `(gateway, profile)`. Switching from a Telegram
gateway to a Signal gateway cannot leave the previous gateway's channel groups
or sessions in the sidebar.
-- Merely displaying the switcher reads Electron's local connection registry.
- Remote gateways are opened only when selected; there is no periodic fleet
- polling.
+- Desktop loads the local connection registry at startup, even with the status
+ bar hidden, and keeps it current when gateways are saved or removed. Opening
+ Settings is not required. In Simple mode, the profile rail stays available
+ when more than one gateway is registered, even with only a default profile.
+ Loading the registry does not connect every gateway; there is no periodic
+ fleet polling.
- Hovering an agent pre-warms its backend so the switch doesn't pay a cold
boot. SSH agents are the exception: hovering never dials the tunnel or
starts a remote backend — only opening one does.