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(chat): claude.ai thread look — user bubble, unbubbled assistant, turn action row

review719e33aaa839
diff --git a/CLAUDE.md b/CLAUDE.md
index 44248f2b6..4c9b7a38e 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -2543,6 +2543,17 @@ command-bearing opens; this does not add a human-confirm dialog or change mobile
`readQuestions`), and only while the pane is in a dialog state. They send a `PermissionAnswer`
through `answerPermission`; a refusal is a quiet retryable error pointing at the terminal. Plan's
default button is `restore` — never auto. See docs/hook-reply-approvals.md.
+ **The thread look (2026-09-26, claude.ai-style)**: the user's message is a neutral rounded bubble
+ on the right (`term-chat__bubble`, a tint lift — never the blue accent), the assistant's is plain
+ full-width text with no bubble. One quiet action row per assistant TURN (`lib/chatThread.ts`
+ `assistantTurnEnds` — a turn is a run of consecutive assistant lines, so a tool-heavy turn gets one
+ row, not one per tool call), hidden until hover/focus and always shown on the latest turn: Copy (the
+ turn's TEXT parts as markdown source, through `window.nodeTerminal.clipboard` — the app channel,
+ which never rejects and bridges to execCommand in the browser) and a relative time from the new
+ optional `ChatMessage.at` (epoch ms from claude's ISO `timestamp`, set by the core parser on BOTH
+ the legacy and paged paths; absent when the line states none — never a made-up time). One
+ 60-second `now` tick in ChatPanel drives every row's label. No thumbs / read-aloud / retry (no
+ terminal equivalent). `.term-chat__text` stays the markdown sink the link guard scopes to.
**The composer (2026-09-26, claude.ai-style)** is one rounded box — textarea on top, a toolbar
under it: "+" attach on the left; model label, muted effort label and a mic on the right (pure
decisions in `lib/chatComposer.ts`). Four rules: (1) **attach = paths in the DRAFT, resolved the
diff --git a/src/core/transcript-reader.test.ts b/src/core/transcript-reader.test.ts
index 4166bb61c..0e85ad8a6 100644
--- a/src/core/transcript-reader.test.ts
+++ b/src/core/transcript-reader.test.ts
@@ -245,6 +245,35 @@ describe('parseChatWindow — pure window parsing', () => {
})
})
+describe('message time (`at`, from the line\'s ISO `timestamp`)', () => {
+ const stamped = (role: 'user' | 'assistant', text: string, timestamp: unknown): string =>
+ role === 'user'
+ ? jl({ type: 'user', timestamp, message: { content: text } })
+ : jl({ type: 'assistant', timestamp, message: { content: [{ type: 'text', text }] } })
+ const iso = '2026-09-25T19:37:29.097Z'
+ const ms = Date.parse(iso)
+
+ it('the paged path carries it on user and assistant messages', () => {
+ const r = parseChatWindow(Buffer.from(stamped('user', 'q', iso) + stamped('assistant', 'a', iso)), 0)
+ expect(r.messages.map((m) => m.at)).toEqual([ms, ms])
+ })
+
+ it('the legacy path carries it too (additive: nothing else changes)', () => {
+ const msgs = parseChatMessages((stamped('user', 'q', iso) + stamped('assistant', 'a', iso)).split('\n'))
+ expect(msgs).toEqual([
+ { role: 'user', parts: [{ kind: 'text', text: 'q' }], at: ms },
+ { role: 'assistant', parts: [{ kind: 'text', text: 'a' }], at: ms }
+ ])
+ })
+
+ it('omits it when the line has none, or one that is not a date (never a made-up time)', () => {
+ const msgs = parseChatMessages(
+ (said('user', 'none') + stamped('user', 'bad', 'yesterday') + stamped('user', 'num', 12345)).split('\n')
+ )
+ expect(msgs.map((m) => 'at' in m)).toEqual([false, false, false])
+ })
+})
+
describe('readChatWindow — byte windows read from a real file', () => {
let dir: string
afterEach(() => {
diff --git a/src/core/transcript-reader.ts b/src/core/transcript-reader.ts
index e453a27e4..b645d9075 100644
--- a/src/core/transcript-reader.ts
+++ b/src/core/transcript-reader.ts
@@ -135,13 +135,20 @@ export async function readTranscriptLines(filePath: string): Promise<TranscriptL
// correlated back onto its tool part by tool_use_id. User lines that carry only tool_results
// (no prose) are NOT rendered as bubbles — they're tool output, attached to the tool instead.
//
-// `paged` switches on the three things only a paged read needs (and the legacy result must NOT
-// grow, byte for byte): a `key` per message (its line's absolute byte offset), the `tool_use` id on
+// `paged` switches on the three things only a paged read needs (the legacy result grows only by
+// the optional `at` both paths carry): a `key` per message (its line's absolute byte offset), the `tool_use` id on
// each tool part, and the list of results whose tool was not among these lines.
interface ChatRecordsOut {
messages: ChatMessage[]
unmatched: Map<string, string>
}
+/** A transcript line's ISO `timestamp` as epoch ms; undefined when absent or not a date string. */
+function lineTime(v: unknown): number | undefined {
+ if (typeof v !== 'string' || !v) return undefined
+ const t = Date.parse(v)
+ return Number.isFinite(t) ? t : undefined
+}
+
function parseChatRecords(
records: Iterable<{ raw: string; offset: number }>,
paged: boolean
@@ -149,17 +156,22 @@ function parseChatRecords(
const messages: ChatMessage[] = []
const unmatched = new Map<string, string>()
const toolById = new Map<string, Extract<ChatPart, { kind: 'tool' }>>()
+ let at: number | undefined
const push = (m: ChatMessage, offset: number): void => {
- messages.push(paged ? { ...m, key: offset } : m)
+ // `at` rides BOTH paths (additive): the time the line was written, for the thread's relative
+ // timestamp. Absent when the line states none — never a made-up time.
+ const withAt = at === undefined ? m : { ...m, at }
+ messages.push(paged ? { ...withAt, key: offset } : withAt)
}
for (const { raw, offset } of records) {
if (!raw.trim()) continue
- let o: { type?: string; message?: { content?: unknown } }
+ let o: { type?: string; timestamp?: unknown; message?: { content?: unknown } }
try {
o = JSON.parse(raw)
} catch {
continue
}
+ at = lineTime(o.timestamp)
const content = o.message?.content
if (o.type === 'assistant' && Array.isArray(content)) {
const parts: ChatPart[] = []
diff --git a/src/renderer/components/icons.tsx b/src/renderer/components/icons.tsx
index 5be179e3f..d047d1897 100644
--- a/src/renderer/components/icons.tsx
+++ b/src/renderer/components/icons.tsx
@@ -426,6 +426,14 @@ export const IconMoreVertical = () => (
</svg>
)
+/** Two overlapping sheets: copy to the clipboard (the ⌘M thread's per-turn Copy). */
+export const IconCopy = () => (
+ <svg {...S}>
+ <rect x="9" y="9" width="11" height="11" rx="2" />
+ <path d="M5 15V6a2 2 0 0 1 2-2h9" />
+ </svg>
+)
+
/** Bare checkmark. IconCircleCheck is the badged variant and means something else: a completed
* thing, not a selected one. */
export const IconCheck = () => (
diff --git a/src/renderer/lib/chatThread.test.ts b/src/renderer/lib/chatThread.test.ts
new file mode 100644
index 000000000..114beb033
--- /dev/null
+++ b/src/renderer/lib/chatThread.test.ts
@@ -0,0 +1,72 @@
+import { describe, expect, it } from 'vitest'
+import type { ChatMessage } from '@shared/types'
+import { assistantTurnEnds, chatRelativeTime } from './chatThread'
+
+const NOW = Date.parse('2026-09-26T12:00:00Z')
+const MIN = 60_000
+
+describe('chatRelativeTime', () => {
+ it('says "just now" under a minute, and for a stamp in the future (clock skew)', () => {
+ expect(chatRelativeTime(NOW - 20_000, NOW)).toBe('just now')
+ expect(chatRelativeTime(NOW + 5 * MIN, NOW)).toBe('just now')
+ })
+
+ it('counts minutes, hours and days in words', () => {
+ expect(chatRelativeTime(NOW - 1 * MIN, NOW)).toBe('1 min ago')
+ expect(chatRelativeTime(NOW - 2 * MIN, NOW)).toBe('2 min ago')
+ expect(chatRelativeTime(NOW - 59 * MIN, NOW)).toBe('59 min ago')
+ expect(chatRelativeTime(NOW - 60 * MIN, NOW)).toBe('1 hour ago')
+ expect(chatRelativeTime(NOW - 5 * 60 * MIN, NOW)).toBe('5 hours ago')
+ expect(chatRelativeTime(NOW - 24 * 60 * MIN, NOW)).toBe('1 day ago')
+ expect(chatRelativeTime(NOW - 2 * 24 * 60 * MIN, NOW)).toBe('2 days ago')
+ expect(chatRelativeTime(NOW - 29 * 24 * 60 * MIN, NOW)).toBe('29 days ago')
+ })
+
+ it('falls back to a short date past a month, where "43 days ago" stops meaning anything', () => {
+ const label = chatRelativeTime(NOW - 45 * 24 * 60 * MIN, NOW)
+ expect(label).not.toMatch(/ago/)
+ expect(label).toMatch(/\d/)
+ })
+})
+
+const say = (role: 'user' | 'assistant', text: string, at?: number): ChatMessage => ({
+ role,
+ parts: [{ kind: 'text', text }],
+ ...(at !== undefined ? { at } : {})
+})
+const tool = (at?: number): ChatMessage => ({
+ role: 'assistant',
+ parts: [{ kind: 'tool', name: 'Bash', arg: 'ls' }],
+ ...(at !== undefined ? { at } : {})
+})
+
+describe('assistantTurnEnds (one action row per assistant turn)', () => {
+ it('puts the row on the LAST message of each run of assistant messages', () => {
+ const msgs = [say('user', 'q'), say('assistant', 'a1', 1), tool(2), say('assistant', 'a2', 3), say('user', 'q2'), say('assistant', 'b', 4)]
+ const ends = assistantTurnEnds(msgs)
+ expect([...ends.keys()]).toEqual([3, 5])
+ })
+
+ it('copies the TEXT parts of the whole turn as markdown source, in order, and nothing else', () => {
+ const msgs: ChatMessage[] = [
+ say('assistant', 'First **para**.'),
+ { role: 'assistant', parts: [{ kind: 'thinking', text: 'hidden' }, { kind: 'tool', name: 'Bash', arg: 'ls', result: 'x' }] },
+ say('assistant', 'Second.')
+ ]
+ expect(assistantTurnEnds(msgs).get(2)?.copyText).toBe('First **para**.\n\nSecond.')
+ })
+
+ it('times the turn by its last stamped message', () => {
+ const ends = assistantTurnEnds([say('assistant', 'a', 10), tool(20), tool()])
+ expect(ends.get(2)?.at).toBe(20)
+ })
+
+ it('has no copy text for a turn of tool calls only, and no time when nothing is stamped', () => {
+ const ends = assistantTurnEnds([tool()])
+ expect(ends.get(0)).toEqual({ copyText: '', at: undefined })
+ })
+
+ it('a user message is never a turn end', () => {
+ expect(assistantTurnEnds([say('user', 'q', 1)]).size).toBe(0)
+ })
+})
diff --git a/src/renderer/lib/chatThread.ts b/src/renderer/lib/chatThread.ts
new file mode 100644
index 000000000..8f6152a75
--- /dev/null
+++ b/src/renderer/lib/chatThread.ts
@@ -0,0 +1,65 @@
+// Pure decisions behind the ⌘M thread's claude.ai look (ChatPanel): where an assistant turn's
+// action row goes, what its Copy copies, and how its time reads. No React — see ChatPanel.tsx for
+// the glue and chatThread.test.ts for the pins.
+import type { ChatMessage } from '@shared/types'
+
+const MIN = 60_000
+const HOUR = 60 * MIN
+const DAY = 24 * HOUR
+
+const plural = (n: number, unit: string): string => `${n} ${unit}${n === 1 ? '' : 's'} ago`
+
+/**
+ * "just now" / "2 min ago" / "5 hours ago" / "2 days ago", then a short date past a month (where a
+ * count of days stops meaning anything). A stamp in the future — this machine's clock behind the
+ * one that wrote the transcript, e.g. an SSH host — reads "just now", never a negative age.
+ */
+export function chatRelativeTime(at: number, now: number): string {
+ const diff = now - at
+ if (diff < MIN) return 'just now'
+ if (diff < HOUR) return `${Math.floor(diff / MIN)} min ago`
+ if (diff < DAY) return plural(Math.floor(diff / HOUR), 'hour')
+ if (diff < 30 * DAY) return plural(Math.floor(diff / DAY), 'day')
+ return new Date(at).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' })
+}
+
+/** The tooltip: the absolute time, in the viewer's locale. */
+export function chatAbsoluteTime(at: number): string {
+ return new Date(at).toLocaleString()
+}
+
+export interface TurnEnd {
+ /** The turn's text parts as markdown source, joined by a blank line; '' = nothing to copy. */
+ copyText: string
+ /** The last stamped message's time in the turn; undefined = no line stated one. */
+ at?: number
+}
+
+/**
+ * One action row per assistant TURN, keyed by the index of the turn's last message. A transcript
+ * writes an assistant turn as many lines (text, each tool call, more text), and the thread renders
+ * one message per line — a row under every one of them would be a row per tool call. A turn is a
+ * maximal run of consecutive assistant messages. Copy takes only its TEXT parts (the answer as
+ * markdown source), never thinking or tool plumbing.
+ */
+export function assistantTurnEnds(messages: readonly ChatMessage[]): Map<number, TurnEnd> {
+ const ends = new Map<number, TurnEnd>()
+ let texts: string[] = []
+ let at: number | undefined
+ messages.forEach((m, i) => {
+ if (m.role !== 'assistant') {
+ texts = []
+ at = undefined
+ return
+ }
+ for (const p of m.parts) if (p.kind === 'text' && p.text) texts.push(p.text)
+ if (typeof m.at === 'number') at = m.at
+ const next = messages[i + 1]
+ if (!next || next.role !== 'assistant') {
+ ends.set(i, { copyText: texts.join('\n\n'), at })
+ texts = []
+ at = undefined
+ }
+ })
+ return ends
+}
diff --git a/src/renderer/nodes/ChatPanel.thread.test.tsx b/src/renderer/nodes/ChatPanel.thread.test.tsx
new file mode 100644
index 000000000..643d344f8
--- /dev/null
+++ b/src/renderer/nodes/ChatPanel.thread.test.tsx
@@ -0,0 +1,121 @@
+// @vitest-environment jsdom
+import { act } from 'react'
+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'
+
+/**
+ * The claude.ai thread look (pure half: lib/chatThread.ts). Pins the glue: the user message is a
+ * bubble and the assistant's is not, one quiet action row per assistant turn with Copy (the app's
+ * clipboard channel + "Copied") and a relative time from the transcript's `at`.
+ */
+
+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
+
+const { session, reads } = vi.hoisted(() => {
+ const reads: { messages: unknown[] } = { messages: [] }
+ const session = {
+ api: {
+ chat: {
+ readTranscript: async () => ({ messages: reads.messages, found: true, olderCursor: null, unmatchedResults: [] })
+ },
+ pty: { sendText: vi.fn(async () => true as const) }
+ }
+ }
+ return { session, reads }
+})
+vi.mock('../session/session', () => ({ useSession: () => session }))
+
+import { ChatPanel } from './ChatPanel'
+
+const NODE = 'n-thread'
+const MIN = 60_000
+let host: HTMLDivElement
+let root: Root
+const writeText = vi.fn()
+
+beforeEach(() => {
+ writeText.mockClear()
+ ;(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)
+ root = createRoot(host)
+})
+afterEach(async () => {
+ await act(async () => root.unmount())
+ host.remove()
+ useAgentStatus.setState((s) => {
+ const byId = { ...s.byId }
+ delete byId[NODE]
+ return { byId }
+ })
+})
+
+async function mount(messages: ChatMessage[]): Promise<void> {
+ reads.messages = messages
+ await act(async () => {
+ root.render(<ChatPanel nodeId={NODE} sessionId="s1" agentId="claude" />)
+ })
+ await act(async () => {
+ await new Promise((r) => setTimeout(r, 0))
+ })
+}
+
+const now = Date.now()
+const thread: ChatMessage[] = [
+ { role: 'user', parts: [{ kind: 'text', text: 'fix it' }], key: 0, at: now - 10 * MIN },
+ { role: 'assistant', parts: [{ kind: 'text', text: 'Looking **now**.' }], key: 10, at: now - 9 * MIN },
+ { role: 'assistant', parts: [{ kind: 'tool', name: 'Bash', arg: 'ls' }], key: 20, at: now - 8 * MIN },
+ { role: 'assistant', parts: [{ kind: 'text', text: 'Done.' }], key: 30, at: now - 5 * MIN },
+ { role: 'user', parts: [{ kind: 'text', text: 'thanks' }], key: 40, at: now - 3 * MIN },
+ { role: 'assistant', parts: [{ kind: 'text', text: 'Anytime.' }], key: 50, at: now - 2 * MIN }
+]
+
+describe('⌘M thread look', () => {
+ it('a user message is a bubble; an assistant message is not', async () => {
+ await mount(thread)
+ const user = host.querySelector('.term-chat__msg--user')!
+ const assistant = host.querySelector('.term-chat__msg--assistant')!
+ expect(user.classList.contains('term-chat__bubble')).toBe(true)
+ expect(assistant.classList.contains('term-chat__bubble')).toBe(false)
+ // The link guard's sink is unchanged: markdown still renders into `.term-chat__text`.
+ expect(assistant.querySelector('.term-chat__text strong')?.textContent).toBe('now')
+ })
+
+ it('one action row per assistant TURN (not per tool line), the latest always shown', async () => {
+ await mount(thread)
+ const rows = [...host.querySelectorAll('.term-chat__actions')]
+ expect(rows).toHaveLength(2)
+ expect(rows[0].closest('.term-chat__msg')?.textContent).toContain('Done.')
+ expect(rows[0].classList.contains('term-chat__actions--latest')).toBe(false)
+ expect(rows[1].classList.contains('term-chat__actions--latest')).toBe(true)
+ })
+
+ it('Copy writes the turn\'s markdown source through the app clipboard and says so', async () => {
+ await mount(thread)
+ const copy = host.querySelectorAll<HTMLButtonElement>('button[aria-label="Copy message"]')[0]
+ expect(copy.tabIndex).not.toBe(-1)
+ await act(async () => copy.click())
+ expect(writeText).toHaveBeenCalledWith('Looking **now**.\n\nDone.')
+ expect(copy.closest('.term-chat__actions')?.textContent).toMatch(/Copied/)
+ })
+
+ it('shows the relative time from `at`, the absolute one in the tooltip', async () => {
+ await mount(thread)
+ const times = [...host.querySelectorAll('.term-chat__actions time')]
+ expect(times.map((t) => t.textContent)).toEqual(['5 min ago', '2 min ago'])
+ expect(times[1].getAttribute('dateTime')).toBe(new Date(now - 2 * MIN).toISOString())
+ expect(times[1].getAttribute('title')).toBeTruthy()
+ })
+
+ it('no time when the transcript stated none, and no Copy for a turn of tool calls only', async () => {
+ await mount([
+ { role: 'user', parts: [{ kind: 'text', text: 'q' }], key: 0 },
+ { role: 'assistant', parts: [{ kind: 'tool', name: 'Bash', arg: 'ls' }], key: 10 }
+ ])
+ expect(host.querySelector('.term-chat__actions time')).toBeNull()
+ expect(host.querySelector('button[aria-label="Copy message"]')).toBeNull()
+ })
+})
diff --git a/src/renderer/nodes/ChatPanel.tsx b/src/renderer/nodes/ChatPanel.tsx
index 60efe97ac..1baf63025 100644
--- a/src/renderer/nodes/ChatPanel.tsx
+++ b/src/renderer/nodes/ChatPanel.tsx
@@ -25,6 +25,8 @@ import { activeAnswerCard } from '../lib/chatAnswer'
import { PlanAnswerControls, QuestionAnswerControls } from './ChatAnswerControls'
import type { PermissionAnswer } from '@shared/agents/permission-answer'
import { ChatComposer } from './ChatComposer'
+import { ChatTurnActions } from './ChatTurnActions'
+import { assistantTurnEnds } from '../lib/chatThread'
// Memoized bubble: marked+DOMPurify re-ran for EVERY message on each ChatPanel render (each
// turn-finish reload, each keystroke re-render). Text is stable per message, so cache per text.
@@ -537,6 +539,17 @@ export function ChatPanel({
// the action instead of promising a chord that never fires.
const mdChip = chipFor('node.toggleMarkdown')
+ // The thread's claude.ai look (lib/chatThread.ts): one action row per assistant TURN, keyed by
+ // the turn's last message. `now` is ONE clock for every row's relative time, ticked once a minute
+ // (a per-row timer would be a timer per turn for a label that changes once a minute).
+ const turnEnds = useMemo(() => assistantTurnEnds(messages), [messages])
+ const latestTurnEnd = useMemo(() => Math.max(-1, ...turnEnds.keys()), [turnEnds])
+ const [now, setNow] = useState(() => Date.now())
+ useEffect(() => {
+ const t = setInterval(() => setNow(Date.now()), 60_000)
+ return () => clearInterval(t)
+ }, [])
+
// A tail that yielded no message but has history behind it (all-metadata records, or a window a
// single huge record filled) is STILL LOADING — the panel pages back by itself from here. Saying
// "No conversation yet." there, until the older page landed, told the user a session with a
@@ -603,7 +616,10 @@ export function ChatPanel({
// Keyed by the source line's byte offset: a prepended page does not re-key (and so does
// not re-render) a single existing bubble. Unkeyed ones (grok, the optimistic sent
// bubble) fall back to their position.
- <div key={m.key !== undefined ? `k${m.key}` : `i${i}`} className={`term-chat__msg term-chat__msg--${m.role}`}>
+ <div
+ key={m.key !== undefined ? `k${m.key}` : `i${i}`}
+ className={`term-chat__msg term-chat__msg--${m.role}${m.role === 'user' ? ' term-chat__bubble' : ''}`}
+ >
{m.parts.map((p, j) =>
p.kind === 'text' ? (
<MarkdownText key={j} text={p.text} />
@@ -650,6 +666,14 @@ export function ChatPanel({
</details>
)
)}
+ {turnEnds.has(i) && (
+ <ChatTurnActions
+ copyText={turnEnds.get(i)!.copyText}
+ at={turnEnds.get(i)!.at}
+ now={now}
+ latest={i === latestTurnEnd}
+ />
+ )}
</div>
))}
{activity && (
diff --git a/src/renderer/nodes/ChatTurnActions.tsx b/src/renderer/nodes/ChatTurnActions.tsx
new file mode 100644
index 000000000..8b0762480
--- /dev/null
+++ b/src/renderer/nodes/ChatTurnActions.tsx
@@ -0,0 +1,57 @@
+import { useEffect, useState } from 'react'
+import { IconCheck, IconCopy } from '../components/icons'
+import { chatAbsoluteTime, chatRelativeTime } from '../lib/chatThread'
+
+/**
+ * The quiet row under an assistant turn in the ⌘M thread (claude.ai look): Copy + relative time.
+ * Hidden until the message is hovered or the row takes keyboard focus, and always shown on the
+ * latest turn (CSS: `.term-chat__actions--latest`). No thumbs / read-aloud / retry: none of them has
+ * a terminal equivalent.
+ */
+export function ChatTurnActions({
+ copyText,
+ at,
+ now,
+ latest
+}: {
+ /** The turn's text parts as markdown source; '' = no Copy (a turn of tool calls only). */
+ copyText: string
+ at?: number
+ /** The clock the relative time is read against; ChatPanel ticks it, not each row. */
+ now: number
+ latest: boolean
+}) {
+ const [copied, setCopied] = useState(false)
+ useEffect(() => {
+ if (!copied) return
+ const t = setTimeout(() => setCopied(false), 1500)
+ return () => clearTimeout(t)
+ }, [copied])
+ if (!copyText && at === undefined) return null
+ return (
+ <div className={`term-chat__actions${latest ? ' term-chat__actions--latest' : ''}`}>
+ {copyText && (
+ <button
+ type="button"
+ className="term-chat__action"
+ aria-label="Copy message"
+ title={copied ? 'Copied' : 'Copy message (markdown)'}
+ onClick={() => {
+ // The app's own clipboard channel, not `navigator.clipboard`: it never rejects, and the
+ // Server Edition bridge falls back to execCommand and raises its own banner on failure.
+ window.nodeTerminal.clipboard.writeText(copyText)
+ setCopied(true)
+ }}
+ >
+ {copied ? <IconCheck /> : <IconCopy />}
+ {copied && <span className="term-chat__action-note">Copied</span>}
+ </button>
+ )}
+ {at !== undefined && (
+ <time className="term-chat__time" dateTime={new Date(at).toISOString()} title={chatAbsoluteTime(at)}>
+ {chatRelativeTime(at, now)}
+ </time>
+ )}
+ </div>
+ )
+}
diff --git a/src/renderer/styles.chat-view.test.ts b/src/renderer/styles.chat-view.test.ts
index b7b5335e2..6ad9fc04f 100644
--- a/src/renderer/styles.chat-view.test.ts
+++ b/src/renderer/styles.chat-view.test.ts
@@ -54,3 +54,26 @@ describe('nt-spinner', () => {
expect(mine).not.toMatch(/\.nt-spinner\s*{[^}]*(display:\s*none|visibility:\s*hidden|opacity:\s*0;)/)
})
})
+
+describe('⌘M thread: claude.ai look', () => {
+ it('the user message is a neutral rounded bubble on the right — not the blue accent', () => {
+ const user = ruleBody('.term-chat__msg--user')
+ expect(user).toMatch(/align-self:\s*flex-end;/)
+ expect(user).not.toMatch(/--accent/)
+ expect(user).toMatch(/max-width:\s*80%;/)
+ expect(user).toMatch(/border-radius:\s*\d+px;/)
+ expect(user).toMatch(/background:/)
+ })
+
+ it('the assistant message has no bubble: full width, no fill, roomy line height', () => {
+ const a = ruleBody('.term-chat__msg--assistant')
+ expect(a).toMatch(/max-width:\s*none;/)
+ expect(a).toMatch(/background:\s*none;/)
+ expect(a).toMatch(/line-height:\s*1\.6/)
+ })
+
+ it('the action row is hidden until hover/focus, and always shown on the latest turn', () => {
+ expect(ruleBody('.term-chat__actions')).toMatch(/opacity:\s*0;/)
+ expect(CSS).toMatch(/\.term-chat__msg:hover \.term-chat__actions,\s*\n?\s*\.term-chat__actions:focus-within,\s*\n?\s*\.term-chat__actions--latest\s*{[^}]*opacity:\s*1;/)
+ })
+})
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index afa4b462f..a154ed009 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -3131,10 +3131,10 @@ body,
.term-chat__msgs {
flex: 1 1 auto;
overflow-y: auto;
- padding: 10px;
+ padding: 12px 14px;
display: flex;
flex-direction: column;
- gap: 10px;
+ gap: 14px;
/* Allow text selection / Cmd+C (React Flow nodes are non-selectable by default). */
user-select: text;
-webkit-user-select: text;
@@ -3188,23 +3188,84 @@ body,
.term-chat__older--start {
color: rgba(var(--tint-rgb), 0.22);
}
+/* The thread, claude.ai-style: the USER's message is a neutral rounded bubble on the right (a lift
+ of whatever the panel sits on, so it reads on every terminal theme — never the blue accent); the
+ ASSISTANT's is plain full-width text on the panel with no bubble, roomy line height and paragraph
+ spacing, and a quiet action row under each turn (ChatTurnActions). */
.term-chat__msg {
- max-width: 92%;
- padding: 8px 10px;
- border-radius: 10px;
font-size: 13px;
line-height: 1.5;
word-break: break-word;
+ min-width: 0;
}
.term-chat__msg--user {
align-self: flex-end;
- background: var(--accent);
- color: #fff;
+ max-width: 80%;
+ padding: 8px 12px;
+ border-radius: 14px;
+ background: rgba(var(--tint-rgb), 0.09);
+ color: var(--text-strong);
}
.term-chat__msg--assistant {
- align-self: flex-start;
- background: rgba(var(--tint-rgb), 0.06);
+ align-self: stretch;
+ max-width: none;
+ padding: 0 2px;
+ background: none;
color: rgba(var(--tint-rgb), 0.92);
+ line-height: 1.6;
+}
+.term-chat__msg--assistant .term-chat__text p {
+ margin: 0 0 0.75em;
+}
+/* Consecutive lines of one assistant turn (text, each tool call, more text) sit close together:
+ they are one answer, and the thread's gap is for the space BETWEEN turns. */
+.term-chat__msg--assistant + .term-chat__msg--assistant {
+ margin-top: -8px;
+}
+.term-chat__actions {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ margin-top: 6px;
+ min-height: 22px;
+ font-size: 11px;
+ color: var(--muted);
+ opacity: 0;
+ transition: opacity 0.12s ease;
+}
+.term-chat__msg:hover .term-chat__actions,
+.term-chat__actions:focus-within,
+.term-chat__actions--latest {
+ opacity: 1;
+}
+.term-chat__action {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ height: 22px;
+ min-width: 22px;
+ padding: 0 4px;
+ color: inherit;
+ background: none;
+ border: none;
+ border-radius: 5px;
+ cursor: pointer;
+}
+.term-chat__action svg {
+ width: 14px;
+ height: 14px;
+}
+.term-chat__action:hover {
+ color: var(--text-strong);
+ background: rgba(var(--tint-rgb), 0.08);
+}
+.term-chat__action:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 1px;
+}
+.term-chat__time {
+ padding: 0 4px;
+ white-space: nowrap;
}
.term-chat__text > :first-child {
margin-top: 0;
@@ -3219,15 +3280,19 @@ body,
overflow-x: auto;
}
.term-chat__text a {
- color: inherit;
+ color: var(--accent);
text-decoration: underline;
+ text-underline-offset: 2px;
}
+/* A tool call in the unbubbled assistant flow: a quiet chip on the panel itself (a light tint and a
+ hairline), not a dark box nested in a bubble that is no longer there. */
.term-chat__tool {
margin: 4px 0;
- padding: 4px 6px;
+ padding: 4px 8px;
font-size: 12px;
- background: rgba(0, 0, 0, 0.25);
- border-radius: 6px;
+ background: rgba(var(--tint-rgb), 0.04);
+ border: 1px solid rgba(var(--tint-rgb), 0.08);
+ border-radius: 8px;
}
.term-chat__tool summary {
display: flex;
@@ -3269,10 +3334,11 @@ body,
but open and full-width; no max-height, so a long plan scrolls with the thread. */
.term-chat__tool-card {
margin: 6px 0;
- padding: 8px 10px;
- background: rgba(0, 0, 0, 0.25);
+ padding: 10px 12px;
+ background: rgba(var(--tint-rgb), 0.04);
+ border: 1px solid rgba(var(--tint-rgb), 0.08);
border-left: 2px solid var(--accent);
- border-radius: 6px;
+ border-radius: 8px;
min-width: 0;
}
.term-chat__tool-card-title {
diff --git a/src/shared/types.ts b/src/shared/types.ts
index e734d6f07..725455e9c 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -2830,6 +2830,12 @@ export interface ChatMessage {
* the legacy read and on grok (whose reader does not page).
*/
key?: number
+ /**
+ * When the transcript line was written (epoch ms, from claude's ISO `timestamp`). Set on BOTH
+ * read paths; absent when the line states none (grok, older records). The ⌘M thread shows it as a
+ * relative time under an assistant message.
+ */
+ at?: number
}
/** A `tool_result` whose `tool_use` was not in the same page (it lives in an OLDER one). */