Skip to content

The agent that grows with you

Merge origin/main into bb/toggle-terminal-persist

Brooklyn Nicholsonfeaa32503353
diff --cc apps/desktop/src/app/contrib/controller.tsx
index b9dc972c15c,3c4d1d3e98d..da4ff828cb8
--- a/apps/desktop/src/app/contrib/controller.tsx
+++ b/apps/desktop/src/app/contrib/controller.tsx
@@@ -19,14 -17,17 +19,17 @@@ import
declareDefaultTree,
dismissTreePane,
dockPaneBeside,
+ isPaneVisible,
+ markCollapsePane,
mirrorLayoutTree,
paneRootSide,
registerLayoutResetHandler,
registerPaneCloser,
+ registerPaneOpener,
+ removeTreePane,
resetLayoutTree,
revealTreePane,
- setPaneCollapsed,
- setTreePaneHidden,
+ togglePaneVisible,
watchContributedPanes
} from '@/components/pane-shell/tree/store'
import { SidebarProvider } from '@/components/ui/sidebar'
@@@ -558,6 -568,19 +548,22 @@@ bindToolPaneCollapse
() => setTerminalTakeover(false),
() => setTerminalTakeover(true)
)
-// ⌘K door onto the same store the keybind and statusbar pill flip — was a
++// ⌘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
++// behind a stacked sibling tab or a minimized zone, which would light the row
++// "on" for a terminal that isn't on screen.
+ registry.register(
+ paletteToggle({
+ id: 'view.showTerminal',
+ label: 'Toggle terminal',
+ action: 'view.showTerminal',
+ icon: Terminal,
+ keywords: ['terminal', 'shell', 'console', 'pty'],
- get: () => $terminalTakeover.get(),
- set: setTerminalTakeover
++ get: () => isPaneVisible('terminal'),
++ set: () => togglePaneVisible('terminal')
+ })
+ )
// Preview EXISTS only while something is previewed (old-shell semantics:
// closing the last preview tab closes the pane; a new target opens + fronts
@@@ -567,25 -590,68 +573,74 @@@ const $previewVisible = computed($previ
bindPaneVisibility('preview', $previewVisible, closeRightRail)
- // Logs are optional chrome: off by default, toggled from ⌘K, persisted.
- const $logsOpen = persistentAtom('hermes.desktop.logsOpen', false, Codecs.bool)
+ // Logs are ⌘K-ONLY chrome: the pane contribution EXISTS only while $logsOpen
+ // is on. Off (the default) keeps logs out of the registry and the tree
+ // entirely — no secondary tab riding the terminal strip, no preset or
+ // adoption path that resurrects it. Session-only on purpose (not persisted):
+ // a fresh boot never re-opens logs automatically. The palette toggle is the
+ // single door in; tab ✕ / ⌘W / the toggle itself remove it again.
+ const $logsOpen = atom(false)
+
+ let unregisterLogsPane: (() => void) | null = null
+
+ const syncLogsPane = (open: boolean) => {
+ if (open) {
+ unregisterLogsPane ??= registry.register({
+ id: 'logs',
+ area: 'panes',
+ title: 'logs',
- // Same tool-panel sizing rule as the terminal above. dock: its OWN zone
- // beside the terminal — never a tab in the terminal's strip.
++ // Same tool-panel sizing rule as the terminal above — no minHeight, so
++ // the sash floors it at COLLAPSED_ZONE_PX and folds the zone to its rail
++ // rather than leaving a sliver. dock: its OWN zone beside the terminal —
++ // never a tab in the terminal's strip.
+ data: {
+ placement: 'bottom',
+ dock: { pane: 'terminal', pos: 'right' },
+ height: '20vh',
- minHeight: '7.5rem',
+ maxHeight: '80vh'
+ },
+ render: () => idle(<LogsPane />)
+ })
+ // Summoning logs is explicit intent — front it (un-dismisses if a ✕ close
+ // left a dismissal record behind).
+ revealTreePane('logs')
+ } else {
+ unregisterLogsPane?.()
+ unregisterLogsPane = null
+
+ // No dismissal record — the next toggle-on must re-adopt cleanly. Also
+ // sweeps 'logs' out of persisted trees from before it was summon-only.
+ // Guarded: removePane rebuilds the tree even for an absent pane, and a
+ // no-op boot sweep would commit (and persist) a fresh identical tree.
+ const tree = $layoutTree.get()
+
+ if (tree && allPaneIds(tree).includes('logs')) {
+ removeTreePane('logs')
+ }
+ }
+ }
+
+ // Tool-panel tab semantics (✕ / ⌘W route through the store) so the palette
+ // toggle stays truthful either way.
+ markCollapsePane('logs')
+ registerPaneCloser('logs', () => $logsOpen.set(false))
+ registerPaneOpener('logs', () => $logsOpen.set(true))
+ syncLogsPane($logsOpen.get())
+ $logsOpen.listen(syncLogsPane)
- bindToolPaneCollapse(
- 'logs',
- $logsOpen,
- () => $logsOpen.set(false),
- () => $logsOpen.set(true)
- )
registry.register(
paletteToggle({
id: 'logs.toggle',
label: 'Toggle logs',
icon: FileText,
keywords: ['logs', 'agent log', 'tail', 'debug'],
- // On-screen, not the store's boolean: logs stacks with the terminal, and
- // behind its sibling's tab `$logsOpen` stays true while nothing is visible.
- get: () => $logsOpen.get(),
- set: enabled => $logsOpen.set(enabled)
++ // On-screen, not the store's boolean. Summon-only keeps the two in step
++ // while logs sits in its own zone, but the user can still drag it into the
++ // terminal's strip or minimize its zone — and then `$logsOpen` reads true
++ // with nothing visible, so the row would show "on" and its press would
++ // spend itself re-asserting a value it already held.
+ get: () => isPaneVisible('logs'),
+ set: () => togglePaneVisible('logs')
})
)