Skip to content

The agent that grows with you

feat(desktop): picking Elite opens its terminal and file tree

alt-glitche3dd8a80bc81
diff --git a/apps/desktop/src/components/assistant-ui/theme-picker/layout-picker-card.tsx b/apps/desktop/src/components/assistant-ui/theme-picker/layout-picker-card.tsx
index 983f8347b05..b415a5a7bc3 100644
--- a/apps/desktop/src/components/assistant-ui/theme-picker/layout-picker-card.tsx
+++ b/apps/desktop/src/components/assistant-ui/theme-picker/layout-picker-card.tsx
@@ -11,6 +11,7 @@ import { useContributions } from '@/contrib/react/use-contributions'
import { useI18n } from '@/i18n'
import { selectableCardClass } from '@/lib/selectable-card'
import { cn } from '@/lib/utils'
+import { layoutPickOpens } from '@/store/pane-focus'
import { CARD_ACTION_CLASS, CARD_DETAIL_CLASS, CARD_OPTION_CLASS } from '../setup-beat/card-type'
@@ -27,6 +28,13 @@ export const FIRST_RUN_LAYOUTS = [
{ id: 'terminal-deck', name: 'elite', detail: 'eliteDetail' }
] as const
+/** A thumbnail draws the panes a pick opens as open, so Elite's terminal and files show. */
+function pickResting(id: string): ReadonlySet<string> {
+ const opens = layoutPickOpens(id)
+
+ return new Set([...layoutPresetResting(id)].filter(pane => !opens.includes(pane)))
+}
+
/** The two first-run layouts as the layout picker's own preset cards; a click previews the layout, Continue answers with it. */
export function LayoutPickerCard({ onContinue }: LayoutPickerCardProps) {
const { t } = useI18n()
@@ -52,7 +60,7 @@ export function LayoutPickerCard({ onContinue }: LayoutPickerCardProps) {
type="button"
>
<span className="flex aspect-[10/7] w-full">
- {isLayoutNode(tree) && <TreeThumbnail node={tree} resting={layoutPresetResting(choice.id)} />}
+ {isLayoutNode(tree) && <TreeThumbnail node={tree} resting={pickResting(choice.id)} />}
</span>
<span className="flex flex-col gap-0.5">
<span
diff --git a/apps/desktop/src/components/assistant-ui/theme-picker/theme-tool.test.tsx b/apps/desktop/src/components/assistant-ui/theme-picker/theme-tool.test.tsx
index 045ad167de7..ac1f39ef209 100644
--- a/apps/desktop/src/components/assistant-ui/theme-picker/theme-tool.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/theme-picker/theme-tool.test.tsx
@@ -6,7 +6,9 @@ import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest'
import { PRIMARY_SESSION_VIEW, type SessionView, SessionViewProvider } from '@/app/chat/session-view'
import { registerLayoutPresets } from '@/app/contrib/layout-presets'
+import { $terminalTakeover } from '@/app/right-sidebar/store'
import { I18nProvider } from '@/i18n'
+import { $fileBrowserOpen } from '@/store/layout'
import { rememberServerRequest, resetServerRequestsForTests } from '@/store/server-requests'
import { $themePicks, parkThemePick } from '@/store/theme-pick'
import { $accentOverride } from '@/themes/accent-override'
@@ -55,6 +57,8 @@ describe('ThemeTool', () => {
cleanup()
$themePicks.set({})
$accentOverride.set(null)
+ $terminalTakeover.set(false)
+ $fileBrowserOpen.set(false)
resetServerRequestsForTests()
})
@@ -117,4 +121,20 @@ describe('ThemeTool', () => {
expect(respond).toHaveBeenCalledWith({ picked: { layout: 'terminal-deck' } })
})
+
+ it('opens the terminal and files for Elite, and a cancelled preview closes them again', async () => {
+ park('layout')
+
+ const { rerender } = renderRow({ args: { picker: 'layout' } })
+
+ fireEvent.click(screen.getByRole('button', { name: /Elite/ }))
+
+ expect($terminalTakeover.get()).toBe(true)
+ expect($fileBrowserOpen.get()).toBe(true)
+
+ rerender(row({ args: { picker: 'layout' }, result: { cancelled: true } }))
+
+ await waitFor(() => expect($terminalTakeover.get()).toBe(false))
+ expect($fileBrowserOpen.get()).toBe(false)
+ })
})
diff --git a/apps/desktop/src/store/appearance-apply.ts b/apps/desktop/src/store/appearance-apply.ts
index 836c56f0d72..4bf510f53ef 100644
--- a/apps/desktop/src/store/appearance-apply.ts
+++ b/apps/desktop/src/store/appearance-apply.ts
@@ -19,7 +19,7 @@ import { persistAccent } from '@/themes/persist-accent'
import { requestMode } from '@/themes/request'
import { $interfaceMode, setInterfaceMode } from './interface-mode'
-import { applyDesktopLayoutPreset } from './pane-focus'
+import { applyDesktopLayoutPreset, openLayoutPickPanes } from './pane-focus'
export const THEME_MODES: readonly ThemeMode[] = ['light', 'dark', 'system']
@@ -73,7 +73,9 @@ function applyLayout(id: string): void {
setInterfaceMode(mode)
}
- applyDesktopLayoutPreset(id)
+ if (applyDesktopLayoutPreset(id)) {
+ openLayoutPickPanes(id)
+ }
}
export function applyAppearance(values: AppearanceValues): AppearanceAnswer {
diff --git a/apps/desktop/src/store/pane-focus.ts b/apps/desktop/src/store/pane-focus.ts
index a1a10801bc7..142938b306c 100644
--- a/apps/desktop/src/store/pane-focus.ts
+++ b/apps/desktop/src/store/pane-focus.ts
@@ -49,6 +49,20 @@ export function revealDesktopPane(pane: string): boolean {
return true
}
+// Elite is the terminal deck with the tools its card names open. The preset itself rests them, so the
+// same deck picked in Settings stays quiet; a pick from the layout card or set_theme shows the difference.
+const PICK_OPENS: Readonly<Record<string, readonly string[]>> = { 'terminal-deck': ['terminal', 'files'] }
+
+/** The panes a layout pick opens beyond its preset's resting set. */
+export const layoutPickOpens = (preset: string): readonly string[] => PICK_OPENS[preset] ?? []
+
+/** Open the panes `layoutPickOpens` names for `preset`. */
+export function openLayoutPickPanes(preset: string): void {
+ for (const pane of layoutPickOpens(preset)) {
+ revealDesktopPane(pane)
+ }
+}
+
/** Apply a layout preset by id, resolved against the layouts contribution
* registry — the SAME list the layout picker renders, so core presets
* (default/focus/terminal-deck/quad), plugin presets, and user-saved presets