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.

chore(chat): drop the ⌘M Focus view toggle

review1535b1969619
diff --git a/src/renderer/lib/chatFocus.ts b/src/renderer/lib/chatFocus.ts
deleted file mode 100644
index 00c7fdf4a..000000000
--- a/src/renderer/lib/chatFocus.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-// The ⌘M thread's Focus view (`settings.chatFocusView`) and its todo-list rule. No React — see
-// ChatPanel.tsx for the glue and chatFocus.test.ts for the pins.
-//
-// Focus view keeps what a person reads — the prompts, the answers, the images, the cards that ask
-// something of them — and drops the agent's plumbing: tool chips (diff chips included) and thinking.
-// A plan / question card is never plumbing: it carries the answer controls of a held request, and
-// hiding it would leave the composer pointing at a card that is not there.
-import type { ChatMessage, ChatPart } from '@shared/types'
-
-/** The agent's todo-list tool (claude's `TodoWrite`). */
-export const TODO_WRITE_TOOL = 'TodoWrite'
-
-/** The index of the LAST message holding a `TodoWrite` card (a part with a `body` — the opt-in
- * `rich` read), else -1. Only that list is current: each call rewrites the whole list. */
-export function latestTodoIndex(messages: readonly ChatMessage[]): number {
- for (let i = messages.length - 1; i >= 0; i--) {
- if (messages[i].parts.some((p) => p.kind === 'tool' && p.name === TODO_WRITE_TOOL && p.body !== undefined)) return i
- }
- return -1
-}
-
-/** A `TodoWrite` part that is not in the latest todo message: a superseded list, which the thread
- * draws as the plain chip in both views (a dozen full lists in one turn is the wall Focus removes). */
-export function staleTodo(p: ChatPart, messageIndex: number, latestTodo: number): boolean {
- return p.kind === 'tool' && p.name === TODO_WRITE_TOOL && messageIndex !== latestTodo
-}
-
-/** Whether Focus view leaves this part out: thinking, a tool call without a `body` (the chip), and a
- * superseded todo list. Text, an image and every other card stay. */
-export function focusHides(p: ChatPart, messageIndex: number, latestTodo: number): boolean {
- if (p.kind === 'thinking') return true
- if (p.kind !== 'tool') return false
- return p.body === undefined || staleTodo(p, messageIndex, latestTodo)
-}
diff --git a/src/renderer/lib/chatFocus.test.ts b/src/renderer/lib/chatTodo.test.ts
similarity index 55%
rename from src/renderer/lib/chatFocus.test.ts
rename to src/renderer/lib/chatTodo.test.ts
index 888cd4465..40ace57ee 100644
--- a/src/renderer/lib/chatFocus.test.ts
+++ b/src/renderer/lib/chatTodo.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import type { ChatMessage, ChatPart } from '@shared/types'
-import { focusHides, latestTodoIndex, staleTodo } from './chatFocus'
+import { latestTodoIndex, staleTodo } from './chatTodo'
const todo = (body?: string): ChatPart => ({ kind: 'tool', name: 'TodoWrite', arg: '', ...(body ? { body } : {}) })
const msg = (...parts: ChatPart[]): ChatMessage => ({ role: 'assistant', parts })
@@ -33,26 +33,3 @@ describe('staleTodo', () => {
expect(staleTodo({ kind: 'text', text: 'TodoWrite' }, 0, 3)).toBe(false)
})
})
-
-describe('focusHides', () => {
- const LATEST = 4
- it.each<[string, ChatPart, number, boolean]>([
- ['text', { kind: 'text', text: 'answer' }, 0, false],
- ['an image', { kind: 'image', mediaType: 'image/png', data: 'AAAA' }, 0, false],
- ['thinking', { kind: 'thinking', text: 'hmm', ms: 1000 }, 0, true],
- ['a plain tool chip', { kind: 'tool', name: 'Bash', arg: 'ls', result: 'a' }, 0, true],
- [
- 'an Edit diff chip',
- { kind: 'tool', name: 'Edit', arg: '/a', diff: { filePath: '/a', oldText: 'a', newText: 'b' } },
- 0,
- true
- ],
- ['a plan card', { kind: 'tool', name: 'ExitPlanMode', arg: '', body: '# Plan' }, 0, false],
- ['a question card', { kind: 'tool', name: 'AskUserQuestion', arg: '', body: 'Q?', questions: [] }, 0, false],
- ['the latest todo card', todo('- [ ] a'), LATEST, false],
- ['an older todo card', todo('- [ ] a'), 1, true],
- ['a todo without a body', todo(), LATEST, true]
- ])('%s → %s', (_label, part, at, hidden) => {
- expect(focusHides(part, at, LATEST)).toBe(hidden)
- })
-})
diff --git a/src/renderer/lib/chatTodo.ts b/src/renderer/lib/chatTodo.ts
new file mode 100644
index 000000000..217be1ac7
--- /dev/null
+++ b/src/renderer/lib/chatTodo.ts
@@ -0,0 +1,22 @@
+// The ⌘M thread's todo-list rule: only the LATEST `TodoWrite` list is a card, every older one is
+// drawn as its plain chip (a dozen full lists in one turn is a wall). No React — see ChatPanel.tsx
+// and lib/chatToolGroups.ts for the glue and chatTodo.test.ts for the pins.
+import type { ChatMessage, ChatPart } from '@shared/types'
+
+/** The agent's todo-list tool (claude's `TodoWrite`). */
+export const TODO_WRITE_TOOL = 'TodoWrite'
+
+/** The index of the LAST message holding a `TodoWrite` card (a part with a `body` — the opt-in
+ * `rich` read), else -1. Only that list is current: each call rewrites the whole list. */
+export function latestTodoIndex(messages: readonly ChatMessage[]): number {
+ for (let i = messages.length - 1; i >= 0; i--) {
+ if (messages[i].parts.some((p) => p.kind === 'tool' && p.name === TODO_WRITE_TOOL && p.body !== undefined)) return i
+ }
+ return -1
+}
+
+/** A `TodoWrite` part that is not in the latest todo message: a superseded list, which the thread
+ * draws as the plain chip. */
+export function staleTodo(p: ChatPart, messageIndex: number, latestTodo: number): boolean {
+ return p.kind === 'tool' && p.name === TODO_WRITE_TOOL && messageIndex !== latestTodo
+}
diff --git a/src/renderer/lib/chatToolGroups.ts b/src/renderer/lib/chatToolGroups.ts
index f44bc3960..fd9b13dfc 100644
--- a/src/renderer/lib/chatToolGroups.ts
+++ b/src/renderer/lib/chatToolGroups.ts
@@ -8,7 +8,7 @@
import type { ChatMessage, ChatPart } from '@shared/types'
import { isSystemRecordMessage } from '@shared/chat-system-records'
import { isLocalCommandTool } from '@shared/chat-command'
-import { latestTodoIndex, staleTodo } from './chatFocus'
+import { latestTodoIndex, staleTodo } from './chatTodo'
/** Fewer calls than this stay as plain chips: a block holding one chip only adds a click. */
export const TOOL_GROUP_MIN = 2
@@ -64,7 +64,7 @@ export interface GroupToolCallsOptions {
/**
* A tool call the agent made, shown as a chip. Not one:
* - a plan / question / latest todo-list card (`body`): that IS the content, never folded away —
- * but a SUPERSEDED todo list (lib/chatFocus.ts) is drawn as its chip, so it folds like one;
+ * but a SUPERSEDED todo list (lib/chatTodo.ts) is drawn as its chip, so it folds like one;
* - the user's own `/command`, `!` line or command output: the person did that, not the agent;
* - a system record (a background task finishing, another agent's message): it is not the agent's
* work either, and the thread already treats it as a turn boundary.
diff --git a/src/renderer/nodes/ChatPanel.answers.test.tsx b/src/renderer/nodes/ChatPanel.answers.test.tsx
index 8ecc9e43b..7040a41fc 100644
--- a/src/renderer/nodes/ChatPanel.answers.test.tsx
+++ b/src/renderer/nodes/ChatPanel.answers.test.tsx
@@ -5,7 +5,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { ChatMessage, ChatTranscriptResult } from '@shared/types'
import type { AnswerPermissionPayload, ChatQuestion, HeldPermission } from '@shared/agents/permission-answer'
import { useAgentStatus } from '../state/agentStatus'
-import { useSettings } from '../state/settings'
/**
* Answer controls on the ⌘M Plan / Question card (pure mapping: `lib/chatAnswer.test.ts`). Pins the
@@ -321,28 +320,6 @@ describe('question card', () => {
expect(cards()[0].textContent).toContain('User answered: B')
})
- it('Focus view hides the tool calls around a held question, never the card or its controls', async () => {
- useSettings.setState((s) => ({ settings: { ...s.settings, chatFocusView: true } }))
- try {
- await hold('waiting', held(['Pick one?']))
- await mount([
- { role: 'assistant', key: 0, parts: [{ kind: 'tool', name: 'Bash', arg: 'ls' }] },
- askMsg(10, [SINGLE])
- ])
- expect(host.querySelector('details.term-chat__tool')).toBeNull()
- expect(cards()).toHaveLength(1)
- await click(radio('B'))
- await click(button(cards()[0], 'Submit'))
- expect(sent()).toEqual({
- nodeId: NODE,
- pendingId: 'n-q-1',
- answer: { kind: 'question', answers: { 'Pick one?': 'B' } }
- })
- } finally {
- useSettings.setState((s) => ({ settings: { ...s.settings, chatFocusView: false } }))
- }
- })
-
it('a read-only transcript (closed node) never shows controls', async () => {
await hold('waiting', held(['Pick one?']))
reads.messages = [askMsg(0, [SINGLE])]
diff --git a/src/renderer/nodes/ChatPanel.paging.test.tsx b/src/renderer/nodes/ChatPanel.paging.test.tsx
index 6a083cd5a..9c4d24cfd 100644
--- a/src/renderer/nodes/ChatPanel.paging.test.tsx
+++ b/src/renderer/nodes/ChatPanel.paging.test.tsx
@@ -5,7 +5,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { ChatMessage, ChatTranscriptResult } from '@shared/types'
import type { ChatTranscriptPageRequest } from '@shared/chat-page'
import { useAgentStatus } from '../state/agentStatus'
-import { useSettings } from '../state/settings'
import { CHAT_OLDER_PAGE_BYTES, CHAT_TAIL_PAGE_BYTES } from '../lib/chatPaging'
/**
@@ -126,7 +125,6 @@ beforeEach(() => {
afterEach(async () => {
await act(async () => root.unmount())
host.remove()
- useSettings.setState((s) => ({ settings: { ...s.settings, chatFocusView: false } }))
useAgentStatus.setState((s) => {
const byId = { ...s.byId }
delete byId[NODE]
@@ -372,60 +370,6 @@ describe('ChatPanel progressive loading', () => {
})
})
-// Focus view (the bar toggle) hides whole messages, so flipping it changes the thread's height with
-// no new message and no scroll event: the follow and paging checks must run on the flip itself.
-describe('ChatPanel Focus toggle re-runs follow and paging', () => {
- const think = (key: number): ChatMessage => ({ role: 'assistant', key, parts: [{ kind: 'thinking', text: 'hmm' }] })
- const focus = async (on: boolean): Promise<void> => {
- await act(async () => {
- useSettings.setState((s) => ({ settings: { ...s.settings, chatFocusView: on } }))
- })
- }
-
- it('turning Focus on pages back when the filtered thread now fits the viewport', async () => {
- geo.perMsg = 300 // three bubbles overflow the 400px viewport; one does not
- await render()
- await settle(0, { messages: [think(1000), think(1100), say(1200, 'answer')], olderCursor: 1000 })
- expect(msgs().scrollTop).toBe(500) // pinned to the bottom, far from the top: no fetch
- expect(pending).toHaveLength(1)
-
- await focus(true)
-
- expect(bubbles()).toEqual(['answer'])
- expect(pending).toHaveLength(2)
- expect(pending[1].page).toEqual({ before: 1000, maxBytes: CHAT_OLDER_PAGE_BYTES, thinking: true, rich: true })
- })
-
- it('turning Focus off while following lands at the new bottom', async () => {
- geo.perMsg = 300
- await focus(true)
- await render()
- await settle(0, { messages: [say(0, 'a'), say(10, 'b'), think(20), think(30), say(40, 'c')] })
- expect(bubbles()).toEqual(['a', 'b', 'c'])
- // Three bubbles and the "Beginning of conversation" row, scrolled to the bottom.
- expect(msgs().scrollTop).toBe(3 * 300 + ROW - 400)
-
- await focus(false)
-
- expect(host.querySelectorAll('.term-chat__msg')).toHaveLength(5)
- expect(msgs().scrollTop).toBe(5 * 300 + ROW - 400)
- expect(host.querySelector('.term-chat__to-latest')).toBeNull()
- })
-
- it('a reader scrolled up keeps their place across the flip', async () => {
- geo.perMsg = 300
- await focus(true)
- await render()
- await settle(0, { messages: [say(0, 'a'), say(10, 'b'), think(20), think(30), say(40, 'c')] })
- await scrollTo(100)
-
- await focus(false)
-
- expect(msgs().scrollTop).toBe(100)
- expect(host.querySelector('.term-chat__to-latest')).not.toBeNull()
- })
-})
-
describe('ChatPanel Page Up / Page Down', () => {
const press = async (target: Element, key: string): Promise<KeyboardEvent> => {
const e = new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true })
diff --git a/src/renderer/nodes/ChatPanel.thread.test.tsx b/src/renderer/nodes/ChatPanel.thread.test.tsx
index fc39657d1..93024a68f 100644
--- a/src/renderer/nodes/ChatPanel.thread.test.tsx
+++ b/src/renderer/nodes/ChatPanel.thread.test.tsx
@@ -4,7 +4,6 @@ import { createRoot, type Root } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { ChatMessage } from '@shared/types'
import { useAgentStatus } from '../state/agentStatus'
-import { useSettings } from '../state/settings'
/**
* The claude.ai thread look (pure half: lib/chatThread.ts). Pins the glue: the user message is a
@@ -40,13 +39,10 @@ const MIN = 60_000
let host: HTMLDivElement
let root: Root
const writeText = vi.fn()
-// The Focus toggle persists through `useSettings.update`, whose coalesced save reaches this.
-const saveSettings = vi.fn(async (_s: unknown) => undefined)
beforeEach(() => {
writeText.mockClear()
- saveSettings.mockClear()
- ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = { clipboard: { writeText }, settings: { save: saveSettings } }
+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = { clipboard: { writeText } }
useAgentStatus.setState((s) => ({ byId: { ...s.byId, [NODE]: { state: 'done' } as (typeof s.byId)[string] } }))
host = document.createElement('div')
document.body.appendChild(host)
@@ -55,7 +51,6 @@ beforeEach(() => {
afterEach(async () => {
await act(async () => root.unmount())
host.remove()
- useSettings.setState((s) => ({ settings: { ...s.settings, chatFocusView: false } }))
useAgentStatus.setState((s) => {
const byId = { ...s.byId }
delete byId[NODE]
@@ -413,16 +408,15 @@ describe('⌘M thread look', () => {
})
})
-describe('⌘M Focus view and the todo-list card', () => {
+describe('⌘M todo-list card', () => {
const todo = (key: number, body: string, result?: string): ChatMessage => ({
role: 'assistant',
parts: [{ kind: 'tool', name: 'TodoWrite', arg: '', body, ...(result ? { result } : {}) }],
key
})
const TODO_RESULT = 'Todos have been modified successfully. Ensure that you continue to use the todo list'
- const focusOn = (): void => useSettings.setState((s) => ({ settings: { ...s.settings, chatFocusView: true } }))
- it('only the latest todo list is a card; an older one is the plain chip (Focus off too)', async () => {
+ it('only the latest todo list is a card; an older one is the plain chip', async () => {
await mount([
{ role: 'user', parts: [{ kind: 'text', text: 'q' }], key: 0 },
todo(10, '- [ ] a\n- [ ] b'),
@@ -445,7 +439,6 @@ describe('⌘M Focus view and the todo-list card', () => {
const chips = [...host.querySelectorAll('details.term-chat__tool')]
expect(chips).toHaveLength(1)
expect(chips[0].querySelector('.term-chat__tool-name')?.textContent).toBe('TodoWrite')
- expect(host.querySelector('.term-chat__focus')?.getAttribute('aria-pressed')).toBe('false')
})
it('a superseded todo list folds into the tool block around it, drawn there as its chip', async () => {
@@ -464,82 +457,4 @@ describe('⌘M Focus view and the todo-list card', () => {
expect(groups[0].querySelector('.term-chat__tool-card')).toBeNull()
expect(host.querySelectorAll('.term-chat__tool-card')).toHaveLength(1)
})
-
- it('Focus hides chips, groups and thinking; keeps text, the latest todo card and a question card', async () => {
- focusOn()
- await mount([
- { role: 'user', parts: [{ kind: 'text', text: 'q' }], key: 0 },
- { role: 'assistant', parts: [{ kind: 'tool', name: 'Bash', arg: 'ls' }], key: 10 },
- { role: 'assistant', parts: [{ kind: 'tool', name: 'Read', arg: '/a' }], key: 20 },
- { role: 'assistant', parts: [{ kind: 'thinking', text: 'hmm', ms: 2000 }], key: 30 },
- { role: 'assistant', parts: [{ kind: 'text', text: 'answer' }], key: 40 },
- todo(50, '- [ ] old'),
- todo(60, '- [ ] latest'),
- {
- role: 'assistant',
- parts: [
- {
- kind: 'tool',
- name: 'AskUserQuestion',
- arg: '',
- body: 'Pick one?',
- questions: [{ question: 'Pick one?', multiSelect: false, options: [{ label: 'A' }] }]
- }
- ],
- key: 70
- }
- ])
- expect(host.querySelector('.term-chat__tool-group')).toBeNull()
- expect(host.querySelector('details.term-chat__thinking')).toBeNull()
- expect(host.querySelector('details.term-chat__tool')).toBeNull()
- const cards = [...host.querySelectorAll('.term-chat__tool-card')]
- expect(cards.map((c) => c.querySelector('.term-chat__tool-card-title')?.textContent)).toEqual(['Todo list', 'Question'])
- expect(cards[0].textContent).toContain('latest')
- // A message with nothing left to draw is not drawn at all: the answer, the todo card, the question.
- expect(host.querySelectorAll('.term-chat__msg--assistant')).toHaveLength(3)
- expect(host.querySelector('.term-chat__msg--assistant')?.textContent).toContain('answer')
- expect(host.querySelector('.term-chat__focus')?.getAttribute('aria-pressed')).toBe('true')
- })
-
- it('in Focus, a turn that ends on a hidden call keeps its action row (the folded wrapper)', async () => {
- focusOn()
- await mount([
- { role: 'user', parts: [{ kind: 'text', text: 'q' }], key: 0, at: now - 3 * MIN },
- { role: 'assistant', parts: [{ kind: 'text', text: 'ok' }], key: 10, at: now - 2 * MIN },
- { role: 'assistant', parts: [{ kind: 'tool', name: 'Bash', arg: 'ls' }], key: 20, at: now - MIN }
- ])
- const last = [...host.querySelectorAll('.term-chat__msg--assistant')].at(-1)!
- expect(last.classList.contains('term-chat__msg--folded')).toBe(true)
- expect(last.childElementCount).toBe(1)
- expect(last.querySelector('.term-chat__actions time')?.textContent).toBe('1 min ago')
- expect(host.querySelector('.term-chat__tool')).toBeNull()
- })
-
- it('the bar toggle flips the view and persists the setting', async () => {
- await mount([
- { role: 'user', parts: [{ kind: 'text', text: 'q' }], key: 0 },
- { role: 'assistant', parts: [{ kind: 'thinking', text: 'hmm' }], key: 10 },
- { role: 'assistant', parts: [{ kind: 'text', text: 'ok' }], key: 20 }
- ])
- const toggle = host.querySelector<HTMLButtonElement>('button.term-chat__focus')!
- expect(toggle.textContent).toBe('Focus')
- expect(toggle.title).toBe('Focus view: hide tool calls and thinking')
- expect(toggle.getAttribute('aria-pressed')).toBe('false')
- expect(host.querySelector('details.term-chat__thinking')).not.toBeNull()
-
- await act(async () => toggle.click())
- expect(toggle.getAttribute('aria-pressed')).toBe('true')
- expect(host.querySelector('details.term-chat__thinking')).toBeNull()
- expect(useSettings.getState().settings.chatFocusView).toBe(true)
- // The store's coalesced save (300 ms) writes it to disk.
- await act(async () => {
- await new Promise((r) => setTimeout(r, 350))
- })
- expect(saveSettings.mock.calls.at(-1)?.[0]).toMatchObject({ chatFocusView: true })
-
- await act(async () => toggle.click())
- expect(toggle.getAttribute('aria-pressed')).toBe('false')
- expect(host.querySelector('details.term-chat__thinking')).not.toBeNull()
- expect(useSettings.getState().settings.chatFocusView).toBe(false)
- })
})
diff --git a/src/renderer/nodes/ChatPanel.tsx b/src/renderer/nodes/ChatPanel.tsx
index 655d80d58..f3b9628bb 100644
--- a/src/renderer/nodes/ChatPanel.tsx
+++ b/src/renderer/nodes/ChatPanel.tsx
@@ -59,7 +59,7 @@ import { useCodeHighlight } from './CodeHighlight'
import { assistantTurnEnds, chatAbsoluteTime, chatClockTime, dayDividers } from '../lib/chatThread'
import { groupToolCalls, partPosition } from '../lib/chatToolGroups'
import { thinkingLabel } from '../lib/chatThinking'
-import { TODO_WRITE_TOOL, focusHides, latestTodoIndex, staleTodo } from '../lib/chatFocus'
+import { TODO_WRITE_TOOL, latestTodoIndex, staleTodo } from '../lib/chatTodo'
import { ChatToolGroup } from './ChatToolGroup'
import { ChatImage } from './ChatImage'
import { ChatToolDiff } from './ChatToolDiff'
@@ -273,10 +273,6 @@ export function ChatPanel({
// the same object across same-ticket events, so this selector re-renders only on a new hold.
const held = useAgentStatus((s) => s.byId[nodeId]?.held)
const customAgents = useSettings((s) => s.settings.customAgents)
- // Focus view (the bar toggle; lib/chatFocus.ts): tool chips and thinking are left out. Strict, as
- // the setting is hand-editable. Flipping it changes the thread's height with no new message, so
- // the follow and older-page checks below re-run on it.
- const focusView = useSettings((s) => s.settings.chatFocusView === true)
// Not just `working`: a TUI dialog (`waiting`/`blocked`) would be ANSWERED by sendText's Enter,
// and a pane whose CLI is gone (hibernated/paused/dropped/exited) is a SHELL that would execute it.
const refusal = chatSendRefusal(agentId, { state, hibernated, paused, dropped, sessionEnded })
@@ -784,9 +780,7 @@ export function ChatPanel({
}
justSentRef.current = false
// `activity` / `screenBlock`: a row appearing at the end grows the thread like a message does.
- // `focusView`: the Focus toggle shows or hides whole messages — a user following the bottom
- // stays there (turned off, it would leave them mid-thread); a reader scrolled up is left alone.
- }, [messages, olderState, activity, screenBlock, focusView, markFollowing])
+ }, [messages, olderState, activity, screenBlock, markFollowing])
const maybeLoadOlder = useCallback(() => {
const el = msgsRef.current
@@ -807,11 +801,10 @@ export function ChatPanel({
}, [thread.identity, thread.olderCursor, identity, olderState, loadState, tailLoading, loadOlder])
// After every thread change too, not only on scroll: a thread shorter than the viewport cannot
- // scroll, so without this its older history would be unreachable. The Focus toggle is such a
- // change: turned on, a thread can shrink below the viewport with no scroll event to page it.
+ // scroll, so without this its older history would be unreachable.
useEffect(() => {
maybeLoadOlder()
- }, [maybeLoadOlder, focusView])
+ }, [maybeLoadOlder])
// The panel's box changing size — above all a collapsed node being EXPANDED (display:none → a
// real box). Nothing else re-runs the checks then: while hidden, follow and anchor had zero
@@ -1008,21 +1001,10 @@ export function ChatPanel({
}, [])
// A divider at the first message of each local day; the same `now`, so Today rolls to Yesterday.
const days = useMemo(() => dayDividers(messages, now), [messages, now])
- // Only the latest todo list is a card, in both views (Focus: `focusView`, above).
+ // Only the latest todo list is a card (lib/chatTodo.ts).
const latestTodo = useMemo(() => latestTodoIndex(messages), [messages])
- // Whether the part at (i, j) draws anything at its own place: not when an earlier tool block holds
- // it, nor in Focus view when it is hidden — or, for a block's first member, when its every member is.
- const drawsAt = (i: number, j: number): boolean => {
- const at = partPosition(i, j)
- if (toolGroups.absorbed.has(at)) return false
- if (!focusView) return true
- const group = toolGroups.groupAt.get(at)
- if (!group) return !focusHides(messages[i].parts[j], i, latestTodo)
- return group.members.some((mb) => {
- const p = messages[mb.message]?.parts[mb.part]
- return p !== undefined && !focusHides(p, mb.message, latestTodo)
- })
- }
+ // Whether the part at (i, j) draws anything at its own place: not when an earlier tool block holds it.
+ const drawsAt = (i: number, j: number): boolean => !toolGroups.absorbed.has(partPosition(i, j))
// One part of a message, as the thread draws it. Also used for the members of a folded tool block,
// which are drawn inside the block instead of at their own place (lib/chatToolGroups.ts).
@@ -1105,15 +1087,6 @@ export function ChatPanel({
<div className="term-chat__bar">
<span>{title ?? 'Chat'}</span>
<span className="term-chat__bar-end">
- <button
- type="button"
- className="term-chat__focus"
- aria-pressed={focusView}
- onClick={() => useSettings.getState().update({ chatFocusView: !focusView })}
- title="Focus view: hide tool calls and thinking"
- >
- Focus
- </button>
<button
className="term-chat__refresh"
onClick={() => load()}
@@ -1168,10 +1141,10 @@ export function ChatPanel({
</div>
)}
{messages.map((m, i) => {
- // A message whose every part is drawn inside an earlier message's tool block (or, in Focus
- // view, hidden) has nothing of its own to draw, unless it ends a turn: then it draws that
- // turn's action row and nothing else — bar a day divider (below). (Only assistant parts
- // fold or hide, so a queued message — the user's — never does.)
+ // A message whose every part is drawn inside an earlier message's tool block has nothing
+ // of its own to draw, unless it ends a turn: then it draws that turn's action row and
+ // nothing else — bar a day divider (below). (Only assistant parts fold, so a queued
+ // message — the user's — never does.)
const folded = m.parts.length > 0 && m.parts.every((_, j) => !drawsAt(i, j))
const turnEnd = turnEnds.get(i)
// Keyed by the source line's byte offset: a prepended page does not re-key (and so does
diff --git a/src/renderer/styles.chat-view.test.ts b/src/renderer/styles.chat-view.test.ts
index ac3eb608d..8b41edc2e 100644
--- a/src/renderer/styles.chat-view.test.ts
+++ b/src/renderer/styles.chat-view.test.ts
@@ -145,11 +145,7 @@ describe('⌘M code block syntax colors', () => {
})
})
-describe('⌘M Focus view toggle and the todo-list card', () => {
- it('the pressed Focus toggle is filled, so the bar says the view is filtered', () => {
- expect(ruleBody(".term-chat__focus[aria-pressed='true']")).toMatch(/background:\s*[^;]+;/)
- })
-
+describe('⌘M todo-list card', () => {
it('a todo list drops the bullets: its checkboxes are the markers', () => {
expect(ruleBody('.term-chat__todo ul')).toMatch(/list-style:\s*none;/)
})
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index e39b90e48..3f5bb6498 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -4205,26 +4205,6 @@ body,
.term-chat__refresh:hover {
background: rgba(var(--tint-rgb), 0.1);
}
-/* The Focus toggle (ChatPanel; settings.chatFocusView): a quiet text button beside ↻ that is FILLED
- while pressed, so the bar itself says the thread is filtered. */
-.term-chat__focus {
- padding: 1px 6px;
- font-size: 11px;
- line-height: 1.3;
- color: inherit;
- background: none;
- border: 1px solid rgba(var(--tint-rgb), 0.14);
- border-radius: 4px;
- cursor: pointer;
-}
-.term-chat__focus:hover {
- background: rgba(var(--tint-rgb), 0.1);
-}
-.term-chat__focus[aria-pressed='true'] {
- color: var(--accent-text);
- background: color-mix(in srgb, var(--accent) 16%, transparent);
- border-color: var(--accent);
-}
/* The latest todo list (a TodoWrite card): its disabled checkboxes are the markers, so no bullets. */
.term-chat__todo ul {
list-style: none;
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 69cb8504a..913aa98cb 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -2001,11 +2001,6 @@ export interface Settings {
/** Body size (CSS px) of the same views; headings scale from it, code is 0.92 of it. Read
* through `resolveMarkdownFontSize`, which clamps to 8–28 and answers 13 for garbage. */
markdownFontSize: number
- /** The ⌘M chat view's Focus toggle (its bar's `Focus` button): the thread leaves out tool calls
- * and thinking, and keeps the prompts, answers, images and the cards that ask something (a plan,
- * a question — with their answer controls — and the latest todo list). Default OFF; read
- * strictly (`=== true`), since the file is hand-editable. Machine-local, like the fonts above. */
- chatFocusView: boolean
/** Default size (px) for NEW terminal/agent nodes on the canvas. Existing nodes keep
* whatever size they were saved with; other node kinds keep their own defaults. */
defaultNodeWidth: number
@@ -2535,7 +2530,6 @@ export const DEFAULT_SETTINGS: Settings = {
groupFrameBacking: 0,
markdownFontFamily: DEFAULT_MARKDOWN_FONT_FAMILY,
markdownFontSize: DEFAULT_MARKDOWN_FONT_SIZE,
- chatFocusView: false,
defaultNodeWidth: 640,
defaultNodeHeight: 440,
defaultNodeSizes: {},
@@ -3638,7 +3632,7 @@ export type ChatPart =
/** Markdown worth reading in full (an `ExitPlanMode` plan, an `AskUserQuestion` question and
* its options, and on the opt-in `rich` read a `TodoWrite` checklist — `core/chat-tool-body.ts`).
* Present = the renderer shows an expanded card instead of the collapsed chip (a superseded
- * todo list excepted: `lib/chatFocus.ts`). Capped at 64K characters. */
+ * todo list excepted: `lib/chatTodo.ts`). Capped at 64K characters. */
body?: string
/** `AskUserQuestion` only: the questions read for the answer controls (`readQuestions`) —
* the SAME reader the held request's texts come from, so a surface can match the card to the