From 2d62d9903830c4f54702e0ce36c29f72ca8ff795 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Wed, 14 Oct 2026 16:02:24 +0800 Subject: [PATCH] fix(webui): restore and synchronize live activity sheen --- .../thread/activity/ActivityStep.tsx | 30 +++++++++------- .../activity/ThinkingReasoningShell.tsx | 2 ++ .../components/ui/streaming-label-sheen.tsx | 2 +- webui/src/globals.css | 17 +++++---- webui/src/tests/activity-step.test.tsx | 12 +++++++ .../src/tests/agent-activity-cluster.test.tsx | 35 +++++++++++++++++++ .../tests/thinking-reasoning-shell.test.tsx | 5 +++ 7 files changed, 83 insertions(+), 20 deletions(-) diff --git a/webui/src/components/thread/activity/ActivityStep.tsx b/webui/src/components/thread/activity/ActivityStep.tsx index 6db1d23a2..8933cfa6b 100644 --- a/webui/src/components/thread/activity/ActivityStep.tsx +++ b/webui/src/components/thread/activity/ActivityStep.tsx @@ -59,21 +59,25 @@ export function ActivityStep({ formControlFocusClassName, )} > - + + + {label} + {detail ? ( - - {label}{" "} + <> + {" "} {detail} - - ) : label} - + + ) : null} + ); diff --git a/webui/src/components/thread/activity/ThinkingReasoningShell.tsx b/webui/src/components/thread/activity/ThinkingReasoningShell.tsx index 993f0194a..ca5cba40a 100644 --- a/webui/src/components/thread/activity/ThinkingReasoningShell.tsx +++ b/webui/src/components/thread/activity/ThinkingReasoningShell.tsx @@ -39,8 +39,10 @@ export function ThinkingReasoningShell({ {active ? : null} {label} diff --git a/webui/src/components/ui/streaming-label-sheen.tsx b/webui/src/components/ui/streaming-label-sheen.tsx index cc08e561a..707bd0203 100644 --- a/webui/src/components/ui/streaming-label-sheen.tsx +++ b/webui/src/components/ui/streaming-label-sheen.tsx @@ -22,7 +22,7 @@ export function StreamingLabelSheen({ data-sheen-text={active ? sheenText : undefined} className={cn( "block w-fit max-w-full truncate pr-0.5 font-medium leading-normal", - active ? "streaming-text-sheen after:pr-0.5" : "text-muted-foreground", + active ? "streaming-text-sheen" : "text-muted-foreground", )} > {children} diff --git a/webui/src/globals.css b/webui/src/globals.css index a9102543b..04ed4cc99 100644 --- a/webui/src/globals.css +++ b/webui/src/globals.css @@ -402,6 +402,11 @@ text-wrap: balance; } + .activity-current, + .streaming-text-sheen { + --activity-animation: 2.8s ease-in-out infinite; + } + /* L→R sheen clipped to live activity labels. The highlight lives inside the glyphs, not in the row background, so dark mode stays quiet. */ @keyframes streaming-text-sheen-ltr { @@ -420,7 +425,7 @@ color: inherit; } .streaming-text-sheen::after { - content: attr(data-sheen-text); + content: attr(data-sheen-text) / ""; position: absolute; inset: 0; display: block; @@ -428,6 +433,7 @@ white-space: nowrap; text-overflow: ellipsis; pointer-events: none; + padding-right: inherit; color: transparent; background: linear-gradient( 90deg, @@ -443,7 +449,7 @@ background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; - animation: streaming-text-sheen-ltr 2.8s ease-in-out infinite; + animation: streaming-text-sheen-ltr var(--activity-animation); } .dark .streaming-text-sheen::after { background-image: linear-gradient( @@ -1467,14 +1473,13 @@ .activity-current-trace { display: block; stroke-dasharray: 16 84; - animation: activity-current-flow 1800ms linear infinite; + animation: activity-current-flow var(--activity-animation); } } @keyframes activity-current-flow { 0% { stroke-dashoffset: 16; opacity: 0; } - 10% { opacity: 1; } - 65% { stroke-dashoffset: 116; opacity: 1; } - 75%, 100% { stroke-dashoffset: 116; opacity: 0; } + 50% { opacity: 1; } + 100% { stroke-dashoffset: 116; opacity: 0; } } .quiet-control, .settings-hover { --control-hover-fill: hsl(var(--foreground) / 0.045); diff --git a/webui/src/tests/activity-step.test.tsx b/webui/src/tests/activity-step.test.tsx index b94c902ab..930d27cc6 100644 --- a/webui/src/tests/activity-step.test.tsx +++ b/webui/src/tests/activity-step.test.tsx @@ -6,6 +6,18 @@ import { ActivityStep } from "@/components/thread/activity/ActivityStep"; afterEach(cleanup); +it("animates a running label with details and keeps the completed activity readable", () => { + const { rerender } = render(); + + expect(screen.getByText("Running Blender")).toHaveAttribute("data-sheen-text", "Running Blender"); + expect(screen.getByLabelText("Running Blender, --json project new")).toHaveTextContent("--json project new"); + + rerender(); + + expect(screen.getByText("Used Blender")).toHaveClass("text-muted-foreground"); + expect(screen.getByLabelText("Used Blender, --json project new")).toHaveTextContent("Used Blender"); +}); + it("keeps truncated activity details available on keyboard focus", async () => { render(); const detail = screen.getByText("--json project new"); diff --git a/webui/src/tests/agent-activity-cluster.test.tsx b/webui/src/tests/agent-activity-cluster.test.tsx index fcfa8657a..453990445 100644 --- a/webui/src/tests/agent-activity-cluster.test.tsx +++ b/webui/src/tests/agent-activity-cluster.test.tsx @@ -1580,6 +1580,41 @@ describe("AgentActivityCluster", () => { expect(document.querySelector("details")).not.toBeInTheDocument(); }); + it("keeps the working header animated while waiting after a tool completes", () => { + const args = { path: "skills/weather/SKILL.md" }; + const line = `read_file(${JSON.stringify(args)})`; + const messages: UIMessage[] = [{ + id: "t-read-weather-skill", + role: "tool", + kind: "trace", + content: line, + traces: [line], + toolEvents: [{ + phase: "end", + call_id: "call-read-weather-skill", + name: "read_file", + arguments: args, + result: "Weather skill instructions", + }], + createdAt: Date.now(), + }]; + const view = render( + , + ); + const header = screen.getByText(/^Working for /); + expect(header).toHaveAttribute("data-sheen-text", header.textContent); + const tool = screen.getByText("Read file skills/weather/SKILL.md"); + expect(tool).toHaveClass("text-muted-foreground"); + expect(tool).not.toHaveAttribute("data-sheen-text"); + + view.rerender( + , + ); + expect(screen.getByText(/^Worked/)).toBe(header); + expect(header).toHaveClass("text-muted-foreground/65"); + expect(header).not.toHaveAttribute("data-sheen-text"); + }); + it("groups repeated searches over internal tool results without exposing raw paths", () => { const pattern = "Jul (1[0-7]), 2026|July (1[0-7]), 2026|2026-07-(1[0-7])"; const secondPattern = "Anthropic|OpenAI|DeepMind"; diff --git a/webui/src/tests/thinking-reasoning-shell.test.tsx b/webui/src/tests/thinking-reasoning-shell.test.tsx index 46eba9809..10d50b4f8 100644 --- a/webui/src/tests/thinking-reasoning-shell.test.tsx +++ b/webui/src/tests/thinking-reasoning-shell.test.tsx @@ -51,11 +51,14 @@ describe("ThinkingReasoningShell", () => { const headerClass = button.className; const contentClass = content.className; expect(button.querySelector("svg")).toHaveClass("lucide-activity"); + expect(screen.getByText("Working")).toHaveAttribute("data-sheen-text", "Working"); expect(view.container.querySelector("[data-contextual-activity-guide]")).toBeInTheDocument(); view.rerender(shell(false)); expect(screen.getByRole("button", { name: "Worked, Collapse activity details" })).toBe(button); + expect(screen.getByText("Worked")).toHaveClass("text-muted-foreground/65"); + expect(screen.getByText("Worked")).not.toHaveAttribute("data-sheen-text"); expect(button.className).toBe(headerClass); expect(screen.getByTestId("agent-activity-content")).toBe(content); expect(content.className).toBe(contentClass); @@ -70,10 +73,12 @@ describe("ThinkingReasoningShell", () => { const status = screen.getByRole("status", { name: "Working" }); expect(status).toHaveClass("touch-target", "h-7", "px-1.5"); expect(status.querySelector("svg")).toHaveClass("lucide-activity"); + expect(screen.getByText("Working")).toHaveAttribute("data-sheen-text", "Working"); expect(screen.queryByRole("button")).not.toBeInTheDocument(); view.rerender(shell(true)); expect(screen.getByRole("button", { name: "Working" })).toHaveClass(...status.classList); + expect(screen.getByText("Working")).toHaveAttribute("data-sheen-text", "Working"); }); it("mounts details on first expansion and preserves their state across folding", () => {