Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(settings): hideable-row inventory and visibility predicate

enes8860a7ab0558
diff --git a/src/renderer/lib/ui-visibility.test.ts b/src/renderer/lib/ui-visibility.test.ts
new file mode 100644
index 000000000..45b6a528c
--- /dev/null
+++ b/src/renderer/lib/ui-visibility.test.ts
@@ -0,0 +1,35 @@
+import { describe, expect, it } from 'vitest'
+import { HIDEABLE_HEADER_BUTTONS, HIDEABLE_MENU_ITEMS, isHidden } from './ui-visibility'
+
+describe('isHidden', () => {
+ it('hides a hideable id that is listed', () => {
+ expect(isHidden('duplicate', ['duplicate'])).toBe(true)
+ expect(isHidden('mic', ['mic', 'comments'])).toBe(true)
+ })
+ it('shows everything when nothing is listed', () => {
+ for (const { id } of [...HIDEABLE_MENU_ITEMS, ...HIDEABLE_HEADER_BUTTONS])
+ expect(isHidden(id, [])).toBe(false)
+ })
+ it('never hides an id outside the hideable inventory, however the list got there', () => {
+ for (const id of ['delete', 'restart-agent', 'search', 'close', 'branch'])
+ expect(isHidden(id, [id])).toBe(false)
+ })
+ it('ignores unknown ids in the list', () => {
+ expect(isHidden('duplicate', ['nonsense', 'duplicate'])).toBe(true)
+ expect(isHidden('nonsense', ['nonsense'])).toBe(false)
+ })
+})
+
+describe('hideable inventories', () => {
+ it('list the agreed ids and nothing destructive', () => {
+ expect(HIDEABLE_MENU_ITEMS.map((r) => r.id)).toEqual([
+ 'group', 'remove-from-group', 'colors', 'duplicate', 'align-grid', 'collapse',
+ 'markdown-view', 'refresh-terminal'
+ ])
+ expect(HIDEABLE_HEADER_BUTTONS.map((r) => r.id)).toEqual(['refresh', 'mic', 'ai-name', 'comments'])
+ })
+ it('gives every entry a user-facing label', () => {
+ for (const { label } of [...HIDEABLE_MENU_ITEMS, ...HIDEABLE_HEADER_BUTTONS])
+ expect(label.length).toBeGreaterThan(0)
+ })
+})
diff --git a/src/renderer/lib/ui-visibility.ts b/src/renderer/lib/ui-visibility.ts
new file mode 100644
index 000000000..4dc1d912d
--- /dev/null
+++ b/src/renderer/lib/ui-visibility.ts
@@ -0,0 +1,51 @@
+// Which rows of the node right-click menu and the terminal node header the user is allowed to
+// hide (Settings → the visibility toggles), plus the predicate both call sites share.
+//
+// Hiding is stored as a HIDDEN list rather than a visible one: an empty array means everything
+// shows, so existing users see no change and any row added in a later release appears by default
+// instead of silently staying hidden.
+//
+// The inventories are the whole safety story. Destructive and recovery actions — Delete, Restart
+// agent, Branch/Transfer conversation, the terminal Search button, Close — are simply not in them,
+// and `isHidden` checks membership rather than trusting the saved list, so a stale or hand-edited
+// settings.json can never take Delete off the menu.
+
+export interface HideableRow {
+ /** Stable id, persisted in settings — renaming one un-hides that row for existing users. */
+ id: string
+ /** User-facing label, shown in the Settings toggles. Matches the menu/header wording. */
+ label: string
+}
+
+/** Hideable node right-click menu entries, in menu order. */
+export const HIDEABLE_MENU_ITEMS: readonly HideableRow[] = [
+ { id: 'group', label: 'Group' },
+ { id: 'remove-from-group', label: 'Remove from group' },
+ { id: 'colors', label: 'Colors' },
+ { id: 'duplicate', label: 'Duplicate' },
+ { id: 'align-grid', label: 'Align to grid' },
+ { id: 'collapse', label: 'Collapse' },
+ { id: 'markdown-view', label: 'Markdown view' },
+ { id: 'refresh-terminal', label: 'Refresh terminal' }
+]
+
+/** Hideable terminal node header buttons, in header order. */
+export const HIDEABLE_HEADER_BUTTONS: readonly HideableRow[] = [
+ { id: 'refresh', label: 'Refresh' },
+ { id: 'mic', label: 'Dictate' },
+ { id: 'ai-name', label: 'Name with AI' },
+ { id: 'comments', label: 'Comments' }
+]
+
+/** Every id the user may hide — the guard that makes everything else unhideable. */
+const HIDEABLE_IDS = new Set<string>(
+ [...HIDEABLE_MENU_ITEMS, ...HIDEABLE_HEADER_BUTTONS].map((r) => r.id)
+)
+
+/**
+ * True only when `id` is BOTH hideable and present in the saved list. Unknown ids in the list are
+ * ignored, and an id outside the inventory stays visible no matter what the list says.
+ */
+export function isHidden(id: string, hidden: readonly string[]): boolean {
+ return HIDEABLE_IDS.has(id) && hidden.includes(id)
+}
diff --git a/src/shared/types.ts b/src/shared/types.ts
index d11e990c3..ac2035563 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -655,6 +655,13 @@ export interface Settings {
/** Usage providers hidden from the pill + popover (Settings → Usage toggles). Hiding is a
* DISPLAY choice — credentials and fetchers are untouched, so re-enabling is instant. */
hiddenUsageProviders: string[]
+ /** Ids of node right-click menu rows the user has hidden; empty = everything visible. Only ids
+ * in HIDEABLE_MENU_ITEMS (renderer/lib/ui-visibility.ts) can hide — Delete and the other
+ * recovery actions stay put whatever this array says. */
+ hiddenNodeMenuItems: string[]
+ /** Ids of terminal node header buttons the user has hidden; empty = everything visible. Gated by
+ * HIDEABLE_HEADER_BUTTONS the same way. */
+ hiddenHeaderButtons: string[]
/** Whether usage percentages render as consumed ("32% used") or remaining ("68% left").
* 'remaining' is the historical default; orca users tend to expect 'used'. */
usagePercentMode: 'used' | 'remaining'
@@ -746,6 +753,9 @@ export const DEFAULT_SETTINGS: Settings = {
// Existing users keep whatever they've saved (their persisted disabledAgents overrides this).
disabledAgents: [],
hiddenUsageProviders: [],
+ // Nothing hidden out of the box, so existing users see the menu and header they already know.
+ hiddenNodeMenuItems: [],
+ hiddenHeaderButtons: [],
usagePercentMode: 'remaining',
defaultAgent: 'claude',
// Sessions start in auto mode out of the box. Existing users pick this up on hydrate