Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🎬 feat: Animate Background Tasks and Add Tool Navigation (#16959)
Marco Beretta100b12711173
diff --git a/client/src/components/Chat/BackgroundTasks/Button.tsx b/client/src/components/Chat/BackgroundTasks/Button.tsxindex 472f9433ac..ace336d4ee 100644--- a/client/src/components/Chat/BackgroundTasks/Button.tsx+++ b/client/src/components/Chat/BackgroundTasks/Button.tsx@@ -1,7 +1,8 @@import { memo, useEffect, useRef, useState } from 'react';import * as Ariakit from '@ariakit/react';-import { TooltipAnchor } from '@librechat/client';+import { Button, IconButton, TooltipAnchor } from '@librechat/client';import { ListTodo, Maximize2, Minimize2, Square, X } from 'lucide-react';+import type { TaskRow } from './rows';import { RECENT_SUBAGENT_WINDOW_MS } from './rows';import useBackgroundTasks from './useTasks';import { useLocalize } from '~/hooks';@@ -12,7 +13,7 @@ import { cn } from '~/utils';const TICK_MS = 1_000;const iconButtonClass =- 'flex size-7 shrink-0 items-center justify-center rounded-md text-text-secondary hover:bg-surface-hover hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring-primary disabled:pointer-events-none disabled:opacity-50';+ 'flex size-7 shrink-0 items-center justify-center rounded-md text-text-secondary hover:bg-surface-hover hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-control disabled:pointer-events-none disabled:opacity-50';/** Header control listing the conversation's background tools and subagents. */function BackgroundTasksButton({@@ -26,6 +27,7 @@ function BackgroundTasksButton({const popover = Ariakit.usePopoverStore({ placement: 'bottom-end' });const open = Ariakit.useStoreState(popover, 'open');const disclosureRef = useRef<HTMLButtonElement>(null);+ const finalFocusRef = useRef<HTMLElement | null>(null);const [now, setNow] = useState(() => Date.now());const [wide, setWide] = useState(false);const [popoverElement, setPopoverElement] = useState<HTMLDivElement | null>(null);@@ -34,6 +36,7 @@ function BackgroundTasksButton({useEffect(() => {setNow(Date.now());+ if (open) finalFocusRef.current = disclosureRef.current;if (!open || activeCount === 0) return;const timer = setInterval(() => setNow(Date.now()), TICK_MS);return () => clearInterval(timer);@@ -81,6 +84,86 @@ function BackgroundTasksButton({} else if (partiallyStoppable) {stopAllLabel = localize('com_ui_background_tasks_stop_available');}+ const jumpToTool = (row: TaskRow): boolean => {+ if (row.eventOrigin && row.threadId != null) {+ const events = Array.from(+ document.querySelectorAll<HTMLElement>(+ '[data-event-subagent-conversation] [data-subagent-thread]',+ ),+ ).filter(+ (element) =>+ element.dataset.subagentThread === row.threadId &&+ element.dataset.subagentParentMessage === row.messageId &&+ element.closest<HTMLElement>('[data-event-subagent-conversation]')?.dataset+ .eventSubagentConversation === conversationId,+ );+ if (events.length !== 1) return false;+ const target = events[0];+ if (target.matches(':disabled')) return false;+ const group = target.closest('[data-event-subagent-conversation]');+ group?.querySelector<HTMLButtonElement>('button[aria-expanded="false"]')?.click();+ finalFocusRef.current = null;+ popover.hide();+ window.requestAnimationFrame(() => {+ if (!target.isConnected || popover.getState().open) return;+ target.focus({ preventScroll: true });+ target.scrollIntoView?.({+ block: 'center',+ behavior: window.matchMedia?.('(prefers-reduced-motion: reduce)').matches+ ? 'instant'+ : 'smooth',+ });+ });+ return true;+ }+ if (row.messageId == null) return false;+ const message = document.getElementById(row.messageId);+ if (message == null) return false;+ const scope = message;+ const destinations = Array.from(+ scope.querySelectorAll<HTMLElement>('[data-task-tool-call]'),+ ).filter(+ (element) =>+ element.dataset.taskToolCall === row.toolCallId &&+ (row.stepId == null || element.dataset.taskStep === row.stepId),+ );+ const targets = Array.from(+ scope.querySelectorAll<HTMLElement>(+ '[data-tool-call-id], [data-subagent-tool-call], [data-subagent-thread]',+ ),+ ).filter(+ (element) =>+ (row.threadId != null && element.dataset.subagentThread === row.threadId) ||+ (row.toolCallId != null &&+ (element.dataset.toolCallId === row.toolCallId ||+ element.dataset.subagentToolCall === row.toolCallId)),+ );+ // Legacy call ids are only usable when they identify one rendered call.+ const threads =+ row.threadId == null+ ? []+ : targets.filter((element) => element.dataset.subagentThread === row.threadId);+ let target = message;+ if (threads.length === 1) target = threads[0];+ else if (destinations.length === 1) target = destinations[0];+ else if (destinations.length === 0 && targets.length === 1) target = targets[0];+ if (target == null || target.closest('[inert], [hidden], [aria-hidden="true"]') != null)+ return false;+ if (!target.hasAttribute('tabindex') && !target.matches('button')) {+ target.tabIndex = -1;+ target.addEventListener('blur', () => target.removeAttribute('tabindex'), { once: true });+ }+ finalFocusRef.current = null;+ target.focus({ preventScroll: true });+ popover.hide();+ target.scrollIntoView?.({+ block: 'center',+ behavior: window.matchMedia?.('(prefers-reduced-motion: reduce)').matches+ ? 'instant'+ : 'smooth',+ });+ return true;+ };const card = (row: (typeof rows)[number]) => (<TaskCardkey={row.id}@@ -90,6 +173,7 @@ function BackgroundTasksButton({isStopping={view.isStopping}onStop={view.stop}portalElement={popoverElement}+ onJump={jumpToTool}/>);@@ -126,30 +210,35 @@ function BackgroundTasksButton({gutter={8}portalunmountOnHide- finalFocus={disclosureRef}+ finalFocus={finalFocusRef}+ autoFocusOnHide={() => finalFocusRef.current != null}aria-label={title}className={cn(- 'border-border-medium bg-surface-secondary text-text-primary rounded-theme-menu-panel z-[200] flex max-h-[min(36rem,calc(100vh-5rem))] max-w-[calc(100vw-2rem)] flex-col border shadow-lg focus:outline-none',- wide ? 'w-[36rem]' : 'w-80',+ 'animate-composer-popover border-border-medium bg-surface-secondary text-text-primary rounded-theme-menu-panel animate-composer-popover-resize z-[200] flex max-w-[calc(100vw-2rem)] flex-col border shadow-lg focus:outline-none motion-reduce:transition-none',+ wide+ ? 'max-h-[calc(100dvh-5rem)] w-[min(56rem,calc(100vw-2rem))]'+ : 'max-h-[min(36rem,calc(100dvh-5rem))] w-80',)}><div className="flex items-center gap-1 px-3 pt-3 pb-2"><Ariakit.PopoverHeading className="flex-1 text-sm font-semibold">{title}</Ariakit.PopoverHeading>- <button+ <Button+ variant="quiet"+ size="icon-xs"type="button"aria-label={localize(wide ? 'com_ui_collapse' : 'com_ui_expand')}aria-pressed={wide}onClick={() => setWide((value) => !value)}- className={cn(iconButtonClass, 'max-sm:hidden')}+ className="max-sm:hidden">{wide ? (<Minimize2 className="size-4" aria-hidden="true" />) : (<Maximize2 className="size-4" aria-hidden="true" />)}- </button>+ </Button><Ariakit.PopoverDismiss aria-label={localize('com_ui_close')} className={iconButtonClass}><X className="size-4" aria-hidden="true" /></Ariakit.PopoverDismiss>@@ -165,7 +254,7 @@ function BackgroundTasksButton({<p>{localize('com_ui_background_tasks_load_failed')}</p><buttontype="button"- className="text-text-primary focus-visible:ring-ring-primary rounded px-2 py-1 underline focus-visible:ring-2"+ className="text-text-primary focus-visible:ring-focus-control rounded px-2 py-1 underline focus-visible:ring-2"onClick={() => void view.retry()}>{localize('com_ui_retry')}@@ -187,16 +276,18 @@ function BackgroundTasksButton({tabIndex={!anyStoppable ? 0 : undefined}className="inline-flex">- <button+ <IconButtontype="button"- aria-label={stopAllLabel}+ variant="primary"+ size="sm"+ shape="inset"+ label={stopAllLabel}disabled={!anyStoppable || view.isStopping}onClick={() => void view.stopAll()}data-testid="background-tasks-stop-all"- className={cn(iconButtonClass, 'border-border-medium border')}><Square className="size-3 fill-current" aria-hidden="true" />- </button>+ </IconButton></span>}/>diff --git a/client/src/components/Chat/BackgroundTasks/Card.tsx b/client/src/components/Chat/BackgroundTasks/Card.tsxindex 65ed9fadd0..4987da9641 100644--- a/client/src/components/Chat/BackgroundTasks/Card.tsx+++ b/client/src/components/Chat/BackgroundTasks/Card.tsx@@ -1,10 +1,11 @@import { memo, useId, useState } from 'react';import { useTranslation } from 'react-i18next';-import { ChevronDown, Square } from 'lucide-react';-import { Spinner, TooltipAnchor } from '@librechat/client';+import { ArrowUpRight, ChevronDown, Square } from 'lucide-react';+import { IconButton, Spinner, TooltipAnchor } from '@librechat/client';import type { TaskRow, TaskRowDelivery, TaskRowStatus } from './rows';import type { TranslationKeys } from '~/hooks/useLocalize';import { getRunStepDurationLabels, getToolDisplayLabel, cn } from '~/utils';+import { Collapse } from '~/components/ui';import { useLocalize } from '~/hooks';const STATUS_KEYS: Record<TaskRowStatus, TranslationKeys> = {@@ -36,6 +37,7 @@ function TaskCard({isStopping,onStop,portalElement,+ onJump,}: {row: TaskRow;now: number;@@ -43,11 +45,14 @@ function TaskCard({isStopping: boolean;onStop: (row: TaskRow) => void;portalElement: HTMLElement | null;+ onJump: (row: TaskRow) => boolean;}) {const localize = useLocalize();const { i18n } = useTranslation();const detailId = useId();const [open, setOpen] = useState(false);+ const [visited, setVisited] = useState(false);+ const [jumpUnavailable, setJumpUnavailable] = useState(false);const active = row.status === 'running' || row.status === 'stopping';const kindLabel =row.kind === 'subagent'@@ -71,10 +76,15 @@ function TaskCard({type="button"aria-expanded={open}aria-controls={detailId}- onClick={() => setOpen((value) => !value)}- className="text-text-primary focus-visible:ring-ring-primary flex max-w-full items-start gap-1 rounded text-left text-sm focus-visible:ring-2 focus-visible:outline-none"+ onClick={() => {+ setVisited(true);+ setOpen((value) => !value);+ }}+ className="text-text-primary focus-visible:ring-focus-control flex max-w-full items-start gap-1 rounded text-left text-sm focus-visible:ring-2 focus-visible:outline-none">- <span className="line-clamp-2 break-words">{title}</span>+ <span className="line-clamp-2 break-words">+ <span className={cn(active && 'shimmer')}>{title}</span>+ </span><ChevronDownaria-hidden="true"className={cn(@@ -84,7 +94,9 @@ function TaskCard({/></button>) : (- <p className="text-text-primary line-clamp-2 text-sm break-words">{title}</p>+ <p className="text-text-primary line-clamp-2 text-sm break-words">+ <span className={cn(active && 'shimmer')}>{title}</span>+ </p>)}<p className="text-text-secondary mt-0.5 flex items-center gap-2 text-xs">{title !== kindLabel && <span className="font-medium">{kindLabel}</span>}@@ -112,32 +124,58 @@ function TaskCard({)}</p></div>+ <TooltipAnchor+ description={localize('com_ui_background_tasks_go_to_tool')}+ portalElement={portalElement}+ render={+ <IconButton+ variant="ghost"+ size="xs"+ shape="inset"+ label={`${localize('com_ui_background_tasks_go_to_tool')}: ${title}`}+ onClick={() => setJumpUnavailable(!onJump(row))}+ >+ <ArrowUpRight className="size-3.5" aria-hidden="true" />+ </IconButton>+ }+ />{row.status === 'running' && canStop && (<TooltipAnchordescription={stopLabel}portalElement={portalElement}render={- <button+ <IconButtontype="button"- aria-label={`${stopLabel}: ${title}`}+ variant="primary"+ size="xs"+ shape="inset"+ label={`${stopLabel}: ${title}`}disabled={isStopping}onClick={() => onStop(row)}- className="border-border-medium text-text-primary hover:bg-surface-hover focus-visible:ring-ring-primary flex size-7 shrink-0 items-center justify-center rounded-md border focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50">- <Square className="size-3" aria-hidden="true" />- </button>+ <Square className="size-3 fill-current" aria-hidden="true" />+ </IconButton>}/>)}{row.status === 'stopping' && <Spinner className="size-4 shrink-0" />}</div>- {expandable && open && (- <pre- id={detailId}- className="bg-surface-primary text-text-primary mt-2 max-h-48 overflow-auto rounded-md p-2 font-mono text-xs break-words whitespace-pre-wrap"- >- {row.detail}- </pre>+ {expandable && (+ <Collapse open={open}>+ {visited && (+ <pre+ id={detailId}+ className="bg-surface-primary text-text-primary mt-2 max-h-48 overflow-auto rounded-md p-2 font-mono text-xs break-words whitespace-pre-wrap"+ >+ {row.detail}+ </pre>+ )}+ </Collapse>+ )}+ {jumpUnavailable && (+ <p role="status" className="text-text-secondary mt-1 text-xs">+ {localize('com_ui_background_tasks_tool_unavailable')}+ </p>)}</li>);diff --git a/client/src/components/Chat/BackgroundTasks/Section.tsx b/client/src/components/Chat/BackgroundTasks/Section.tsxindex 453e7c9269..893dba443c 100644--- a/client/src/components/Chat/BackgroundTasks/Section.tsx+++ b/client/src/components/Chat/BackgroundTasks/Section.tsx@@ -1,5 +1,6 @@import { useId, useState } from 'react';import { ChevronDown } from 'lucide-react';+import { Collapse } from '~/components/ui';import { cn } from '~/utils';/** A labelled, collapsible group; `action` stays reachable while collapsed. */@@ -19,14 +20,14 @@ export default function Section({const listId = useId();const [open, setOpen] = useState(defaultOpen);return (- <section className="space-y-2">+ <section><div className="flex items-center gap-2"><buttontype="button"aria-expanded={open}aria-controls={listId}onClick={() => setOpen((value) => !value)}- className="text-text-secondary hover:text-text-primary focus-visible:ring-ring-primary flex min-w-0 flex-1 items-center gap-1 rounded text-sm focus-visible:ring-2 focus-visible:outline-none"+ className="text-text-secondary hover:text-text-primary focus-visible:ring-focus-control flex min-w-0 flex-1 items-center gap-1 rounded text-sm focus-visible:ring-2 focus-visible:outline-none"><span>{label}</span><span className="tabular-nums">{count}</span>@@ -40,11 +41,11 @@ export default function Section({</button>{action}</div>- {open && (- <ul id={listId} className="space-y-2">+ <Collapse open={open}>+ <ul id={listId} className="space-y-2 pt-2">{children}</ul>- )}+ </Collapse></section>);}diff --git a/client/src/components/Chat/BackgroundTasks/__tests__/Button.test.tsx b/client/src/components/Chat/BackgroundTasks/__tests__/Button.test.tsxindex 715353bf44..6a3e8afacc 100644--- a/client/src/components/Chat/BackgroundTasks/__tests__/Button.test.tsx+++ b/client/src/components/Chat/BackgroundTasks/__tests__/Button.test.tsx@@ -371,6 +371,319 @@ describe('BackgroundTasksButton', () => {expect(container).toBeEmptyDOMElement();});+ it('does not mount command payloads until first expansion', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ expect(screen.queryByText('npx jest tasks.spec.ts')).toBeNull();+ });++ it('keeps shimmer inside the two-line clamp', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ expect(screen.getByText('Rerun the focused specs').parentElement).toHaveClass('line-clamp-2');+ });++ it('names navigation with the task title', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ expect(+ screen.getByRole('button', {+ name: 'com_ui_background_tasks_go_to_tool: Rerun the focused specs',+ }),+ ).toBeInTheDocument();+ });++ it('animates running tool titles with the shared shimmer', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ expect(screen.getByText('Rerun the focused specs')).toHaveClass('shimmer');+ });++ it('uses the solid composer stop surface for stop-all', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ expect(screen.getByTestId('background-tasks-stop-all')).toHaveClass('bg-surface-inverted');+ });++ it('keeps collapsed command content mounted and inert for the closing animation', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ const title = screen.getByRole('button', { name: 'Rerun the focused specs' });+ await userEvent.click(title);+ await userEvent.click(title);+ expect(screen.getByText('npx jest tasks.spec.ts').closest('[inert]')).not.toBeNull();+ });++ it('provides a tool destination action on every task', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton([runningChild]);+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ expect(+ await screen.findAllByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ }),+ ).toHaveLength(3);+ });++ it('renders tool navigation as an icon without visible button text', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ const action = screen.getAllByRole('button', {+ name: /^com_ui_background_tasks_go_to_tool:/,+ })[0];+ expect(action.textContent).toBe('');+ });++ it('does not navigate to another message when the recorded message is unloaded', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(+ index({+ tasks: [{ ...index().tasks[0], messageId: 'unloaded' }],+ }),+ );+ renderButton();+ const other = document.createElement('button');+ other.dataset.toolCallId = 'call-running';+ document.body.append(other);+ try {+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ await userEvent.click(+ screen.getByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ }),+ );+ expect(screen.getByRole('status')).toHaveTextContent(+ 'com_ui_background_tasks_tool_unavailable',+ );+ } finally {+ other.remove();+ }+ });++ it('mounts the empty closed reveal shell before first expansion', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ const row = screen.getByText('Rerun the focused specs').closest('li')!;+ expect(row.querySelector('[inert]')).not.toBeNull();+ });++ it('prioritizes the exact subagent thread over a reused call id', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index({ tasks: [] }));+ renderButton([runningChild]);+ const message = document.createElement('section');+ message.id = 'parent-message';+ const targets = ['thread-1', 'other-thread'].map((thread) => {+ const wrapper = document.createElement('div');+ wrapper.dataset.taskToolCall = 'call-subagent';+ const target = document.createElement('button');+ target.dataset.subagentThread = thread;+ target.dataset.subagentToolCall = 'call-subagent';+ target.scrollIntoView = jest.fn();+ wrapper.append(target);+ message.append(wrapper);+ return target;+ });+ document.body.append(message);+ try {+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ await userEvent.click(+ await screen.findByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ }),+ );+ expect(targets[0].scrollIntoView).toHaveBeenCalled();+ } finally {+ message.remove();+ }+ });++ it('rejects identity-less durable completions even when a visible call id matches', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ const other = document.createElement('button');+ other.dataset.toolCallId = 'call-running';+ document.body.append(other);+ try {+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ await userEvent.click(+ screen.getAllByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ })[0],+ );+ expect(screen.getByRole('status')).toHaveTextContent(+ 'com_ui_background_tasks_tool_unavailable',+ );+ } finally {+ other.remove();+ }+ });++ it('reveals an event activity destination outside its parent message', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index({ tasks: [] }));+ renderButton([{ ...runningChild, origin: 'event', parentToolCallId: undefined }]);+ const group = document.createElement('section');+ group.dataset.eventSubagentConversation = conversationId;+ const header = document.createElement('button');+ header.setAttribute('aria-expanded', 'false');+ const target = document.createElement('button');+ target.dataset.subagentThread = 'thread-1';+ target.dataset.subagentParentMessage = 'parent-message';+ target.scrollIntoView = jest.fn();+ header.onclick = () => header.setAttribute('aria-expanded', 'true');+ group.append(header, target);+ document.body.append(group);+ try {+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ await userEvent.click(+ await screen.findByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ }),+ );+ expect(header).toHaveAttribute('aria-expanded', 'true');+ await waitFor(() => expect(target.scrollIntoView).toHaveBeenCalled());+ } finally {+ group.remove();+ }+ });++ it('keeps the panel open when its exact destination is inert', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(+ index({+ tasks: [{ ...index().tasks[0], messageId: 'inert-message' }],+ }),+ );+ renderButton();+ const message = document.createElement('section');+ message.id = 'inert-message';+ message.setAttribute('inert', '');+ document.body.append(message);+ try {+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ await userEvent.click(+ screen.getByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ }),+ );+ expect(screen.getByRole('status')).toHaveTextContent(+ 'com_ui_background_tasks_tool_unavailable',+ );+ } finally {+ message.remove();+ }+ });++ it('selects the requested step when call ids repeat', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(+ index({+ tasks: [{ ...index().tasks[0], messageId: 'step-message', stepId: 'second' }],+ }),+ );+ renderButton();+ const message = document.createElement('section');+ message.id = 'step-message';+ const targets = ['first', 'second'].map((step) => {+ const target = document.createElement('div');+ target.dataset.taskToolCall = 'call-running';+ target.dataset.taskStep = step;+ target.scrollIntoView = jest.fn();+ message.append(target);+ return target;+ });+ document.body.append(message);+ try {+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ await userEvent.click(+ screen.getByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ }),+ );+ expect(targets[1].scrollIntoView).toHaveBeenCalled();+ } finally {+ message.remove();+ }+ });++ it('scrolls to the matching tool and dismisses the panel', async () => {+ jest+ .spyOn(dataService, 'getBackgroundTasks')+ .mockResolvedValue(index({ tasks: [{ ...index().tasks[0], messageId: 'message-target' }] }));+ renderButton();+ const target = document.createElement('button');+ target.id = 'message-target';+ target.dataset.toolCallId = 'call-running';+ target.scrollIntoView = jest.fn();+ document.body.append(target);+ try {+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ const row = screen.getAllByTestId('background-task-row')[0];+ await userEvent.click(+ within(row).getByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ }),+ );+ expect(target.scrollIntoView).toHaveBeenCalledWith({ block: 'center', behavior: 'smooth' });+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());+ } finally {+ target.remove();+ }+ });++ it('makes the parent message focusable when its call is not rendered', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(+ index({+ tasks: [{ ...index().tasks[0], messageId: 'parent-message' }],+ }),+ );+ renderButton();+ const message = document.createElement('section');+ message.id = 'parent-message';+ message.append(document.createElement('button'));+ document.body.append(message);+ try {+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ await userEvent.click(+ screen.getByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ }),+ );+ expect(message).toHaveAttribute('tabindex', '-1');+ } finally {+ message.remove();+ }+ });++ it('explains when the destination is not loaded instead of silently doing nothing', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ await userEvent.click(+ screen.getAllByRole('button', { name: /^com_ui_background_tasks_go_to_tool:/ })[0],+ );+ expect(screen.getByRole('status')).toHaveTextContent(+ 'com_ui_background_tasks_tool_unavailable',+ );+ });++ it('uses tighter inset corners for Stop all', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton();+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ expect(screen.getByTestId('background-tasks-stop-all')).toHaveClass('rounded-md');+ });++ it('uses compact inset Stop controls for tool and subagent items', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton([runningChild]);+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ const stops = await screen.findAllByRole('button', { name: /com_ui_background_tasks_stop:/ });+ for (const stop of stops) expect(stop).toHaveClass('size-6', 'rounded-md');+ });++ it('uses the solid stop surface for both tool and subagent rows', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton([runningChild]);+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ const stops = await screen.findAllByRole('button', { name: /com_ui_background_tasks_stop:/ });+ expect(stops).toHaveLength(2);+ for (const stop of stops) expect(stop).toHaveClass('bg-surface-inverted');+ });++ it('shimmers a running subagent title too', async () => {+ jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());+ renderButton([runningChild]);+ await userEvent.click(await screen.findByTestId('header-background-tasks-button'));+ expect(await screen.findByText('Research the API')).toHaveClass('shimmer');+ });+it('groups running and finished tasks and reveals the command on demand', async () => {jest.spyOn(dataService, 'getBackgroundTasks').mockResolvedValue(index());renderButton();@@ -391,7 +704,11 @@ describe('BackgroundTasksButton', () => {});await user.click(finished);expect(finished).toHaveAttribute('aria-expanded', 'false');- expect(within(dialog).getAllByTestId('background-task-row')).toHaveLength(1);+ expect(+ within(dialog)+ .getAllByTestId('background-task-row')+ .filter((row) => !row.closest('[inert]')),+ ).toHaveLength(1);});it('stops every running tool and subagent from the running row, even when collapsed', async () => {diff --git a/client/src/components/Chat/BackgroundTasks/rows.ts b/client/src/components/Chat/BackgroundTasks/rows.tsindex 2e0c55ff55..bedf32706c 100644--- a/client/src/components/Chat/BackgroundTasks/rows.ts+++ b/client/src/components/Chat/BackgroundTasks/rows.ts@@ -23,6 +23,11 @@ export type TaskRow = {detail?: string;/** Tool cancel target. */taskId?: string;+ messageId?: string;+ toolCallId?: string;+ stepId?: string;+ threadId?: string;+ eventOrigin?: boolean;status: TaskRowStatus;startedAt?: number;settledAt?: number;@@ -107,6 +112,9 @@ const toolRow = (kind: 'tool',name: task.toolName,taskId: task.taskId,+ messageId: task.messageId,+ toolCallId: task.toolCallId,+ stepId: task.stepId,...described,status: task.status === 'running' && task.cancellationRequested ? 'stopping' : task.status,startedAt: time(task.startedAt),@@ -123,6 +131,10 @@ const subagentRow = (child: ParentSubagentSummary, stopping: ReadonlySet<string>id: `subagent:${subagentTaskKey(child.threadId, taskId)}`,kind: 'subagent',name: child.title,+ messageId: child.parentMessageId,+ toolCallId: child.parentToolCallId,+ threadId: child.threadId,+ eventOrigin: child.origin === 'event',status: running && stopping.has(subagentTaskKey(child.threadId, taskId)) ? 'stopping' : status,startedAt: time(child.tasks.find((task) => task.taskId === taskId)?.createdAt),settledAt: running ? undefined : time(child.updatedAt),diff --git a/client/src/components/Chat/Messages/Content/Part.tsx b/client/src/components/Chat/Messages/Content/Part.tsxindex 28eff1c687..d1b057d3e4 100644--- a/client/src/components/Chat/Messages/Content/Part.tsx+++ b/client/src/components/Chat/Messages/Content/Part.tsx@@ -222,6 +222,7 @@ const Part = memo(function Part({if (isBashProgrammaticToolCall(toolCall.name, toolCall.args)) {return (<BashCall+ stepId={toolCall.stepId}args={toolCall.args}output={toolCall.output ?? ''}initialProgress={toolCall.progress ?? 0.1}@@ -244,6 +245,7 @@ const Part = memo(function Part({) {return (<ExecuteCode+ stepId={toolCall.stepId}attachments={attachments}isSubmitting={isSubmitting}runStepStatus={toolCall.runStepStatus}@@ -266,6 +268,7 @@ const Part = memo(function Part({if (isFailedImageCall(toolCall.output, toolCall.runStepStatus)) {return (<ToolCall+ stepId={toolCall.stepId}name={toolCall.name}args={toolCall.args ?? ''}output={toolCall.output}@@ -388,6 +391,8 @@ const Part = memo(function Part({} else if (toolCall.name === 'read_file') {return (<ReadFileCall+ toolCallId={toolCallId}+ stepId={toolCall.stepId}args={toolCall.args}output={toolCall.output ?? ''}initialProgress={toolCall.progress ?? 0.1}@@ -417,6 +422,7 @@ const Part = memo(function Part({} else if (toolCall.name === Tools.bash_tool) {return (<BashCall+ stepId={toolCall.stepId}args={toolCall.args}output={toolCall.output ?? ''}initialProgress={toolCall.progress ?? 0.1}@@ -464,6 +470,7 @@ const Part = memo(function Part({}return (<ToolCall+ stepId={toolCall.stepId}args={toolCall.args ?? ''}name={toolCall.name || ''}toolCallId={toolCallId}diff --git a/client/src/components/Chat/Messages/Content/Parts/BashCall.tsx b/client/src/components/Chat/Messages/Content/Parts/BashCall.tsxindex 5660c45964..08d722669b 100644--- a/client/src/components/Chat/Messages/Content/Parts/BashCall.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/BashCall.tsx@@ -41,6 +41,7 @@ export default function BashCall({hideAttachments = false,onExpand,toolCallId,+ stepId,}: {initialProgress: number;isSubmitting: boolean;@@ -56,6 +57,7 @@ export default function BashCall({hideAttachments?: boolean;onExpand?: () => void;toolCallId?: string;+ stepId?: string;}) {const localize = useLocalize();const [showTimeoutDetails, setShowTimeoutDetails] = useState(false);@@ -189,7 +191,12 @@ export default function BashCall({<><BareStatus active={bare} text={finishedText} />{!bare && (- <div className={TOOL_ROW_CLASSES} ref={rowRef}>+ <div+ className={TOOL_ROW_CLASSES}+ ref={rowRef}+ data-task-tool-call={toolCallId}+ data-task-step={stepId}+ ><ProgressTextphase={phase}onClick={toggleCode}diff --git a/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx b/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsxindex e5c8483440..081cdad0d3 100644--- a/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx@@ -71,6 +71,7 @@ export default function ExecuteCode({hideAttachments = false,onExpand,toolCallId,+ stepId,}: {initialProgress: number;isSubmitting: boolean;@@ -84,6 +85,7 @@ export default function ExecuteCode({hideAttachments?: boolean;onExpand?: () => void;toolCallId?: string;+ stepId?: string;}) {const localize = useLocalize();const { lang = 'py', code } = useParseArgs(args) ?? ({} as ParsedArgs);@@ -147,7 +149,12 @@ export default function ExecuteCode({<><BareStatus active={bare} text={finishedText} />{!bare && (- <div className={TOOL_ROW_CLASSES} ref={rowRef}>+ <div+ className={TOOL_ROW_CLASSES}+ ref={rowRef}+ data-task-tool-call={toolCallId}+ data-task-step={stepId}+ ><ProgressTextphase={phase}onClick={toggleCode}diff --git a/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx b/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsxindex 7246391179..1380754c82 100644--- a/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx@@ -66,6 +66,8 @@ export function langFromPath(filePath: string): string {}export default function ReadFileCall({+ toolCallId,+ stepId,isSubmitting,runStepStatus,runStepDurationMs,@@ -76,6 +78,8 @@ export default function ReadFileCall({hideAttachments = false,onExpand,}: {+ toolCallId?: string;+ stepId?: string;initialProgress: number;isSubmitting: boolean;runStepStatus?: PartMetadata['runStepStatus'];@@ -118,7 +122,12 @@ export default function ReadFileCall({<><BareStatus active={bare} text={finishedText} />{!bare && (- <div className={TOOL_ROW_CLASSES} ref={rowRef}>+ <div+ className={TOOL_ROW_CLASSES}+ ref={rowRef}+ data-task-tool-call={toolCallId}+ data-task-step={stepId}+ ><ProgressTextphase={phase}onClick={toggleCode}diff --git a/client/src/components/Chat/Messages/Content/ToolCall.tsx b/client/src/components/Chat/Messages/Content/ToolCall.tsxindex e295b77c6e..58c6524287 100644--- a/client/src/components/Chat/Messages/Content/ToolCall.tsx+++ b/client/src/components/Chat/Messages/Content/ToolCall.tsx@@ -36,6 +36,7 @@ export default function ToolCall({isLast = false,isSubmitting,toolCallId,+ stepId,name,args: _args = '',output,@@ -54,6 +55,7 @@ export default function ToolCall({isLast?: boolean;isSubmitting: boolean;toolCallId?: string;+ stepId?: string;name: string;args: string | Record<string, unknown>;output?: string | null;@@ -434,6 +436,8 @@ export default function ToolCall({ref={rowRef}data-testid="tool-call"data-tool-call-id={toolCallId}+ data-task-tool-call={toolCallId}+ data-task-step={stepId}><ProgressTextphase={phase}diff --git a/client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx b/client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsxindex ba3ee31f79..a64a3a5123 100644--- a/client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx+++ b/client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx@@ -148,9 +148,10 @@ function EventSubagentRows({/** `text-text-primary` on the root, like `SubagentActivity` and* `SubagentThreadPanel`: the child rows are raw buttons that inherit* their label color, and without a themed ancestor they bottom out at- * the unthemed black body color — invisible on the dark surface. */+ * the unthemed black body color, invisible on the dark surface. */className="border-border-light bg-surface-secondary/40 text-text-primary my-2 overflow-hidden rounded-lg border"data-event-subagent-group={eventChildren[0]?.parentMessageId}+ data-event-subagent-conversation={conversationId}><Buttonvariant="quiet"@@ -184,6 +185,7 @@ function EventSubagentRows({type="button"disabled={!canOpen}onClick={() => openChild(child)}+ data-subagent-thread={child.threadId}data-subagent-tool-call={`event-thread:${child.threadId}`}data-subagent-parent-message={child.parentMessageId}data-subagent-part-index="0"diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.jsonindex 031fa4641c..b0ae4acdf7 100644--- a/client/src/locales/en/translation.json+++ b/client/src/locales/en/translation.json@@ -23,6 +23,8 @@"com_ui_private_text_unavailable": "Original unavailable. Showing the filtered message.","com_ui_attachments": "Attachments","com_ui_no_schedules_match": "No schedules match your search",+ "com_ui_background_tasks_go_to_tool": "Take me to that tool",+ "com_ui_background_tasks_tool_unavailable": "This tool is not in the loaded messages. Load earlier messages to find it.","com_ui_background_tasks": "Background tasks","com_ui_background_tasks_cancel_disabled": "Stopping background tools is not enabled on this server","com_ui_background_tasks_checked": "Checked background tasks",diff --git a/client/src/style.css b/client/src/style.cssindex 0de2e518c1..a4efa6f39e 100644--- a/client/src/style.css+++ b/client/src/style.css@@ -2108,6 +2108,10 @@ html[data-input-modality='keyboard']transform 260ms cubic-bezier(0.32, 0.72, 0, 1);will-change: transform, opacity;}+/* Resizable anchored panels share the composer entrance and exit clock. */+.animate-composer-popover-resize {+ transition-property: opacity, transform, width, max-height;+}.animate-composer-popover[data-enter] {opacity: 1;transform: scale(1);diff --git a/eslint-suppressions.json b/eslint-suppressions.jsonindex 4ede20e964..db8ac1437f 100644--- a/eslint-suppressions.json+++ b/eslint-suppressions.json@@ -55,11 +55,6 @@"count": 1}},- "client/src/components/Chat/BackgroundTasks/Card.tsx": {- "design/disabled-recipe": {- "count": 1- }- },"client/src/components/Chat/ChatView.tsx": {"shadcn/no-restyle": {"count": 1diff --git a/packages/client/src/components/IconButton.tsx b/packages/client/src/components/IconButton.tsxindex 484625741d..81f4745bb8 100644--- a/packages/client/src/components/IconButton.tsx+++ b/packages/client/src/components/IconButton.tsx@@ -16,7 +16,7 @@ type IconButtonVariantProps = {| 'submit'| null;size?: 'xs' | 'sm' | 'md' | 'lg' | 'theme' | null;- shape?: 'round' | 'square' | 'control' | 'theme' | 'composer' | null;+ shape?: 'round' | 'square' | 'control' | 'theme' | 'composer' | 'inset' | null;};const iconButtonVariants: (props?: IconButtonVariantProps & ClassProp) => string = cva(@@ -54,6 +54,8 @@ const iconButtonVariants: (props?: IconButtonVariantProps & ClassProp) => stringshape: {round: 'rounded-full',square: 'rounded-lg',+ /** A compact control inset inside a rounded card, with a tighter inner corner. */+ inset: 'rounded-md',/** The theme's control corner: softer than `square`, short of the full circle of `round`. */control: 'rounded-theme-control',theme: 'rounded-theme-control-round',