The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(chat): tool rows say what they did, in words (CA U1)
purplef6738f094b80
diff --git a/e2e/coding-agent.spec.ts b/e2e/coding-agent.spec.tsindex 626dd275..8ff5b64d 100644--- a/e2e/coding-agent.spec.ts+++ b/e2e/coding-agent.spec.ts@@ -237,7 +237,8 @@ test('file_read pages a large file instead of dumping it whole', async ({ page }await expect(page.getByRole('main').getByText('Read lines 100 to 104.')).toBeVisible({ timeout: 30_000 })// Open the tool block and read what the window actually returned.- await page.getByRole('main').getByText('file_read').first().click()+ // CA U1: the row says "Read src/big.ts"; the tool's own name is its tooltip.+ await page.getByRole('main').getByTitle('file_read').first().click()const block = page.getByRole('main')await expect(block.getByText(/\[lines 100-104 of 200\]/)).toBeVisible({ timeout: 10_000 })await expect(block.getByText(/call file_read again with offset: 105/)).toBeVisible()diff --git a/src/components/chat/ToolCallBlock.tsx b/src/components/chat/ToolCallBlock.tsxindex 158730bf..457a0305 100644--- a/src/components/chat/ToolCallBlock.tsx+++ b/src/components/chat/ToolCallBlock.tsx@@ -28,6 +28,8 @@ import { isSelfControlToolName } from '../../lib/settings-tool-names'import { useChatStore } from '../../stores/chatStore'import { useCommandRulesStore } from '../../stores/commandRulesStore'import { suggestRuleFor } from '../../lib/agent-core/command-rules'+import { toolCallTitle, diffStat, shellExitCode, hasToolTitle, stripAnsi } from '../../lib/tool-call-title'+import { toolRegistry } from '../../api/mcp/tool-registry'import { commandIcon } from '../../lib/shell-command-classify'import { requestGenerationCancel } from '../../api/vram-handoff'import { cancelBackgroundJob } from '../../lib/background-cancels'@@ -284,6 +286,13 @@ function ToolCallBlockImpl({ toolCall, onApprove, onReject }: Props) {const isRunning = toolCall.status === 'running'const isPending = toolCall.status === 'pending_approval'const isFailed = toolCall.status === 'failed' || toolCall.status === 'rejected'+ const title = toolCallTitle(toolCall.toolName, toolCall.args, toolCall.status, toolRegistry.displayName(toolCall.toolName))+ const stat = diffStat(toolCall.diff)+ const isShell = toolCall.toolName === 'shell_execute'+ const exitCode = isShell ? shellExitCode(toolCall.result) : null+ // The raw arguments where the title cannot say what the call does, and on+ // every call that waits for a yes: what it would write is part of the question.+ const knownTool = hasToolTitle(toolCall.toolName) && !(isPending && !isShell)// CA K4: "Always allow `npm test` here", for a waiting shell call that knows its folder.const alwaysRule = isPending && toolCall.toolName === 'shell_execute' && toolCall.ruleScope && typeof toolCall.args?.command === 'string'? suggestRuleFor(toolCall.args.command)@@ -381,10 +390,29 @@ function ToolCallBlockImpl({ toolCall, onApprove, onReject }: Props) {<div className="flex items-center gap-1"><buttononClick={() => setOpen(!open)}- className="flex items-center gap-1.5 py-0.5 text-left hover:opacity-80 transition-opacity flex-1 min-w-0"+ className="flex items-center gap-2 py-1 text-left hover:opacity-80 transition-opacity flex-1 min-w-0"+ title={toolCall.toolName}>- <ToolIcon size={10} className="text-gray-500 dark:text-gray-500 shrink-0" />- <span className={`t-micro italic pr-0.5 ${isRunning ? 'lu-tool-shimmer' : 'text-gray-600 dark:text-gray-400'}`}>{toolCall.toolName}</span>+ <ToolIcon size={13} className="text-gray-400 dark:text-gray-500 shrink-0" />+ {/* CA U1: what the call did, in words; the internal name is the tooltip. */}+ <span data-testid="tool-title" className={`t-control truncate min-w-0 ${isRunning ? 'lu-tool-shimmer' : 'text-gray-600 dark:text-gray-400'}`}>+ {title.verb}+ {title.target && (+ <>+ {' '}+ <span className={title.mono ? 'font-mono text-gray-800 dark:text-gray-200' : 'text-gray-800 dark:text-gray-200'}>{title.target}</span>+ </>+ )}+ </span>+ {stat && (+ <span className="t-mono shrink-0" data-testid="tool-diffstat">+ <span className="text-emerald-600 dark:text-emerald-400">+{stat.added}</span>{' '}+ <span className="text-red-500 dark:text-red-400">−{stat.removed}</span>+ </span>+ )}+ {exitCode !== null && (+ <span className="t-micro shrink-0 text-red-500 dark:text-red-400" data-testid="tool-exit">exit {exitCode}</span>+ )}{isRunning && (<span className="flex items-center gap-[3px] shrink-0" aria-hidden>{[0, 1, 2].map((i) => (@@ -402,14 +430,14 @@ function ToolCallBlockImpl({ toolCall, onApprove, onReject }: Props) {offener Werkzeugaufruf ein halber Absturz. Gesehen wird er ueberdie Uhr, ueber Approve/Reject darunter und ueber die Rueckfrageam Eingabefeld, nicht ueber die Farbe. */}- <StatusIcon size={9} className={`shrink-0 ${+ <StatusIcon size={11} className={`shrink-0 ${toolCall.status === 'completed' ? 'text-gray-400 dark:text-gray-500' :isFailed ? 'text-red-400/60' :isPending ? HINWEIS_TEXT.ruhig :'text-gray-500'} ${isRunning ? 'animate-spin' : ''}`} />{toolCall.duration != null && (- <span className="text-[0.5rem] text-gray-500 dark:text-gray-600">+ <span className="t-micro text-gray-500 dark:text-gray-500">{toolCall.duration < 1000 ? `${toolCall.duration}ms` : `${(toolCall.duration / 1000).toFixed(1)}s`}</span>)}@@ -592,10 +620,13 @@ A user 2026-06-07 fix this lived inside the collapsed details, so aclassName="overflow-hidden"><div className="pl-5 pb-1.5 space-y-1">- {/* Arguments */}- <pre className="text-[0.55rem] leading-relaxed text-gray-500 dark:text-gray-500 bg-gray-50 dark:bg-white/[0.02] rounded px-2 py-1 overflow-x-auto scrollbar-thin">- {JSON.stringify(toolCall.args, null, 2)}- </pre>+ {/* Arguments: only where the title does not already say them, and+ for a shell call as the terminal block below. */}+ {!knownTool && (+ <pre className="t-mono leading-relaxed text-gray-500 dark:text-gray-500 bg-gray-50 dark:bg-white/[0.02] rounded px-2 py-1 overflow-x-auto scrollbar-thin">+ {JSON.stringify(toolCall.args, null, 2)}+ </pre>+ )}{/* Diff for the write tools (audit D5): a change view where achange happened, not raw result text. */}@@ -607,8 +638,14 @@ A user 2026-06-07 fix this lived inside the collapsed details, so a{/* Result (raw text). The inline media preview now rendersalways-visible above the collapsible (a user 2026-06-07). */}- {toolCall.result && !toolCall.diff && (- <pre className="text-[0.55rem] leading-relaxed text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-white/[0.02] rounded px-2 py-1 overflow-auto scrollbar-thin max-h-[300px]">+ {isShell && (+ <pre data-testid="tool-terminal" className="t-mono leading-relaxed rounded-md bg-gray-950 dark:bg-black/50 text-gray-100 px-3 py-2 overflow-auto scrollbar-thin max-h-[300px] whitespace-pre-wrap break-words">+ <span className="select-none text-gray-500">$ </span>{typeof toolCall.args?.command === 'string' ? toolCall.args.command : ''}+ {toolCall.result ? `\n${stripAnsi(toolCall.result)}` : ''}+ </pre>+ )}+ {toolCall.result && !toolCall.diff && !isShell && (+ <pre className="t-mono leading-relaxed text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-white/[0.02] rounded px-2 py-1 overflow-auto scrollbar-thin max-h-[300px] whitespace-pre-wrap break-words">{isWebTool ? stripSourcesMarker(toolCall.result) : toolCall.result}</pre>)}@@ -617,7 +654,7 @@ A user 2026-06-07 fix this lived inside the collapsed details, so apath showed "Path escapes the allowed workspace" twice(3.0.4 box run). */}{toolCall.error && !(toolCall.result ?? '').includes(toolCall.error.trim()) && (- <pre className="text-[0.55rem] leading-relaxed text-gray-500 dark:text-gray-500 bg-gray-50 dark:bg-white/[0.02] rounded px-2 py-1">+ <pre className="t-mono leading-relaxed text-gray-500 dark:text-gray-500 bg-gray-50 dark:bg-white/[0.02] rounded px-2 py-1 whitespace-pre-wrap break-words">{toolCall.error}</pre>)}@@ -656,7 +693,7 @@ A user 2026-06-07 fix this lived inside the collapsed details, so a><X size={10} /> Reject</button>- <span className="ml-1 text-[0.5rem] text-gray-400 dark:text-gray-600 font-mono">⏎ / Esc</span>+ <span className="ml-1 t-micro text-gray-400 dark:text-gray-600 font-mono">⏎ / Esc</span></div>)}</div>diff --git a/src/components/chat/__tests__/a-refused-path-says-it-once.test.tsx b/src/components/chat/__tests__/a-refused-path-says-it-once.test.tsxindex 0d66d0c1..228eccef 100644--- a/src/components/chat/__tests__/a-refused-path-says-it-once.test.tsx+++ b/src/components/chat/__tests__/a-refused-path-says-it-once.test.tsx@@ -14,7 +14,8 @@ afterEach(() => cleanup())const open = (toolCall: AgentToolCall) => {const view = render(createElement(ToolCallBlock, { toolCall }))- fireEvent.click(view.getByText(toolCall.toolName))+ // CA U1: the row reads as words; the tool's own name is its tooltip.+ fireEvent.click(view.getByTitle(toolCall.toolName))return view.container.textContent ?? ''}const count = (text: string, needle: string) => text.split(needle).length - 1diff --git a/src/components/voice/__tests__/voice-panels.test.tsx b/src/components/voice/__tests__/voice-panels.test.tsxindex 40533edc..a01c6e8d 100644--- a/src/components/voice/__tests__/voice-panels.test.tsx+++ b/src/components/voice/__tests__/voice-panels.test.tsx@@ -307,8 +307,10 @@ describe('VoiceSessionPanel', () => {expect(view.getByTestId('voice-status').textContent).toBe('Searching')const block = () => view.getByRole('group', { name: 'Tools' }).querySelector('[data-tool="web_search"]') as HTMLElementexpect(block().getAttribute('data-status')).toBe('running')- // The look of the chat: the name in the shimmer, the three dots.- expect(block().querySelector('.lu-tool-shimmer')?.textContent).toBe('web_search')+ // The look of the chat: what it does in the shimmer (CA U1: words, the+ // internal name is the tooltip), the three dots.+ expect(block().querySelector('.lu-tool-shimmer')?.textContent).toBe('Searching the web for')+ expect(block().querySelector('[title="web_search"]')).not.toBeNull()expect(block().querySelectorAll('.lu-band-dot')).toHaveLength(3)send({ type: 'tool-done', id: 'call-1', status: 'failed', result: 'No connection.', durationMs: 1200 })expect(block().getAttribute('data-status')).toBe('failed')diff --git a/src/lib/__tests__/tool-call-title.test.ts b/src/lib/__tests__/tool-call-title.test.tsnew file mode 100644index 00000000..9b005329--- /dev/null+++ b/src/lib/__tests__/tool-call-title.test.ts@@ -0,0 +1,45 @@+import { describe, expect, it } from 'vitest'+import { diffStat, hasToolTitle, shellExitCode, stripAnsi, toolCallTitle } from '../tool-call-title'++describe('what a tool row says (CA U1)', () => {+ it('reads as a sentence, with the target in monospace', () => {+ expect(toolCallTitle('shell_execute', { command: 'npm test -- math' }, 'completed')).toEqual({ verb: 'Ran', target: 'npm test -- math', mono: true })+ expect(toolCallTitle('file_edit', { path: 'src/math.ts' }, 'running')).toEqual({ verb: 'Editing', target: 'src/math.ts', mono: true })+ expect(toolCallTitle('file_read', { path: 'a.ts' }, 'pending_approval').verb).toBe('Wants to read')+ expect(toolCallTitle('web_search', { query: 'vitest median' }, 'completed')).toEqual({ verb: 'Searched the web for', target: 'vitest median' })+ expect(toolCallTitle('web_fetch', { url: 'https://example.com/docs/a' }, 'completed').target).toBe('example.com/docs/a')+ expect(toolCallTitle('todo_write', { todos: [] }, 'completed')).toEqual({ verb: 'Updated the plan' })+ })++ it('says when the user declined', () => {+ expect(toolCallTitle('shell_execute', { command: 'rm x' }, 'rejected').verb).toBe('Declined: run')+ })++ it('never shows the internal name for an unknown tool, and keeps a server name', () => {+ expect(toolCallTitle('git_status', {}, 'completed').verb).toBe('Git status')+ expect(toolCallTitle('search_issues', {}, 'completed', 'github: search_issues').verb).toBe('github: search_issues')+ expect(toolCallTitle('Step 2 of 6: Upscale', {}, 'running').verb).toBe('Step 2 of 6: Upscale')+ })++ it('cuts a long or multi-line command to one line', () => {+ const t = toolCallTitle('shell_execute', { command: 'python3 -\nprint(1)' }, 'completed').target!+ expect(t).toBe('python3 - …')+ expect(toolCallTitle('shell_execute', { command: 'x'.repeat(200) }, 'completed').target!.length).toBeLessThanOrEqual(90)+ })++ it('counts a diff and reads an exit code', () => {+ expect(diffStat('--- a\n+++ b\n@@ -1 +1,2 @@\n-a\n+b\n+c')).toEqual({ added: 2, removed: 1 })+ expect(diffStat(undefined)).toBeNull()+ expect(shellExitCode('Error (2):\nboom')).toBe(2)+ expect(shellExitCode('ok')).toBeNull()+ })++ it('strips terminal colour codes', () => {+ expect(stripAnsi('\u001b[32m✓\u001b[0m 3 passed')).toBe('✓ 3 passed')+ })++ it('knows which tools need no raw-args block', () => {+ expect(hasToolTitle('shell_execute')).toBe(true)+ expect(hasToolTitle('some_mcp_tool')).toBe(false)+ })+})diff --git a/src/lib/tool-call-title.ts b/src/lib/tool-call-title.tsnew file mode 100644index 00000000..1e8a2e15--- /dev/null+++ b/src/lib/tool-call-title.ts@@ -0,0 +1,177 @@+/**+ * What a tool call row says, in words (CA U1).+ *+ * The row used to print the tool's internal name in 9 px italics+ * (`shell_execute`, `file_edit`) and hide what it did behind a click. The large+ * coding tools all show a short sentence instead: "Ran `npm test`", "Edited+ * `src/math.ts`", "Read 3 files". The internal name stays in the row's+ * tooltip and `data-tool`, for support and for tests.+ *+ * Pure: (name, args, status) → title parts. The row decides how to draw them.+ */+import type { ToolCallStatus } from '../types/agent-mode'++export interface ToolCallTitle {+ /** "Ran", "Running", "Wants to run". */+ verb: string+ /** What it acted on: a path, a command, a query. Drawn in monospace when `mono`. */+ target?: string+ mono?: boolean+}++interface Verbs { past: string; now: string; ask: string }++const V = (past: string, now: string, ask: string): Verbs => ({ past, now, ask })++const VERBS: Record<string, Verbs> = {+ file_read: V('Read', 'Reading', 'Wants to read'),+ file_write: V('Wrote', 'Writing', 'Wants to write'),+ file_edit: V('Edited', 'Editing', 'Wants to edit'),+ file_list: V('Listed', 'Listing', 'Wants to list'),+ file_search: V('Searched for', 'Searching for', 'Wants to search for'),+ shell_execute: V('Ran', 'Running', 'Wants to run'),+ code_execute: V('Ran code', 'Running code', 'Wants to run code'),+ web_search: V('Searched the web for', 'Searching the web for', 'Wants to search the web for'),+ web_research: V('Researched', 'Researching', 'Wants to research'),+ web_fetch: V('Opened', 'Opening', 'Wants to open'),+ browser_open: V('Opened', 'Opening', 'Wants to open'),+ todo_write: V('Updated the plan', 'Updating the plan', 'Wants to update the plan'),+ delegate_task: V('Handed off', 'Handing off', 'Wants to hand off'),+ check_tasks: V('Checked the helpers', 'Checking the helpers', 'Wants to check the helpers'),+ message_agent: V('Messaged a helper', 'Messaging a helper', 'Wants to message a helper'),+ image_generate: V('Made a picture', 'Making a picture', 'Wants to make a picture'),+ video_generate: V('Made a video', 'Making a video', 'Wants to make a video'),+ screenshot: V('Took a screenshot', 'Taking a screenshot', 'Wants to take a screenshot'),+ tool_search: V('Looked for a tool', 'Looking for a tool', 'Wants to look for a tool'),+ memory: V('Memory', 'Memory', 'Wants to change memory'),+ session_search: V('Searched earlier chats for', 'Searching earlier chats for', 'Wants to search earlier chats for'),+ skill_view: V('Read the skill', 'Reading the skill', 'Wants to read the skill'),+ pr_resume: V('Looked at the pull request', 'Looking at the pull request', 'Wants to look at the pull request'),+ run_workflow: V('Ran a workflow', 'Running a workflow', 'Wants to run a workflow'),+}++const MAX_TARGET = 90++function str(v: unknown): string {+ return typeof v === 'string' ? v.trim() : ''+}++function clip(s: string): string {+ const line = s.split('\n')[0]+ const more = s.includes('\n') ? ' …' : ''+ return line.length > MAX_TARGET ? `${line.slice(0, MAX_TARGET - 1)}…` : line + more+}++function urlTarget(u: string): string {+ try {+ const url = new URL(u)+ return clip(url.host + (url.pathname === '/' ? '' : url.pathname))+ } catch {+ return clip(u)+ }+}++/** `git_status` → "Git status"; `mcp-server: tool_name` keeps its server. */+function humanName(name: string): string {+ const s = name.replace(/_/g, ' ').trim()+ return s ? s[0].toUpperCase() + s.slice(1) : name+}++function targetOf(name: string, args: Record<string, unknown>): { target?: string; mono?: boolean } {+ switch (name) {+ case 'file_read': case 'file_write': case 'file_edit': case 'file_list': {+ const p = str(args.path) || (name === 'file_list' ? '.' : '')+ return p ? { target: clip(p), mono: true } : {}+ }+ case 'file_search': {+ const q = str(args.pattern) || str(args.query) || str(args.regex)+ return q ? { target: clip(q), mono: true } : {}+ }+ case 'shell_execute': {+ const c = str(args.command)+ if (str(args.task)) return { target: `task ${str(args.task)}${str(args.id) ? ` ${str(args.id)}` : ''}`, mono: true }+ return c ? { target: clip(c), mono: true } : {}+ }+ case 'web_search': case 'web_research': case 'session_search': case 'tool_search': {+ const q = str(args.query) || str(args.q)+ return q ? { target: clip(q) } : {}+ }+ case 'web_fetch': case 'browser_open': {+ const u = str(args.url)+ return u ? { target: urlTarget(u), mono: true } : {}+ }+ case 'delegate_task': {+ const g = str(args.goal)+ return g ? { target: clip(g) } : {}+ }+ case 'image_generate': case 'video_generate': {+ const p = str(args.prompt)+ return p ? { target: clip(p) } : {}+ }+ case 'memory': {+ const a = str(args.action)+ return a ? { target: a } : {}+ }+ case 'skill_view': {+ const n = str(args.name)+ return n ? { target: n, mono: true } : {}+ }+ default:+ return {}+ }+}++export function toolCallTitle(+ name: string,+ args: Record<string, unknown> | undefined,+ status: ToolCallStatus,+ displayName?: string,+): ToolCallTitle {+ // A workflow step carries its own label as its name ("Step 2 of 6: …").+ if (name.startsWith('Step ') || name.startsWith('Workflow')) return { verb: name }+ const a = args ?? {}+ const verbs = VERBS[name]+ if (!verbs) {+ // External (MCP) tools keep "<server>: <tool>"; everything else reads as words.+ const label = displayName && displayName !== name ? displayName : humanName(name)+ return { verb: status === 'pending_approval' ? `Wants to use ${label}` : label }+ }+ const verb = status === 'pending_approval'+ ? verbs.ask+ : status === 'running'+ ? verbs.now+ : status === 'rejected'+ ? `Declined: ${verbs.ask.replace(/^Wants to /, '')}`+ : verbs.past+ return { verb, ...targetOf(name, a) }+}++/** "+3 −1" from a unified diff, or null. */+export function diffStat(diff: string | undefined): { added: number; removed: number } | null {+ if (!diff) return null+ let added = 0+ let removed = 0+ for (const line of diff.split('\n')) {+ if (line.startsWith('+++') || line.startsWith('---')) continue+ if (line.startsWith('+')) added+++ else if (line.startsWith('-')) removed+++ }+ return added || removed ? { added, removed } : null+}++/** The exit code of a shell result ("Error (2):" first line), or null for success/unknown. */+export function shellExitCode(result: string | undefined): number | null {+ const m = /^Error \((-?\d+)\):/.exec(result ?? '')+ return m ? Number(m[1]) : null+}++/** True when the title already says what the call does (no raw-args block needed). */+export function hasToolTitle(name: string): boolean {+ return name in VERBS+}++/** Terminal colour codes out of shell output (they show as `[32m` otherwise). */+export function stripAnsi(text: string): string {+ // eslint-disable-next-line no-control-regex+ return text.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, '').replace(/\u001b\][^\u0007]*\u0007/g, '')+}