fix(webui): restore and synchronize live activity sheen
This commit is contained in:
1 parent
2732e2b3ce
commit
2d62d99038
7 files changed
+83
-20
No files matched your search
@@ -59,21 +59,25 @@ export function ActivityStep({
|
|||||||
formControlFocusClassName,
|
formControlFocusClassName,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<StreamingLabelSheen
|
<span className={cn("flex min-w-0 flex-1 items-baseline", detail && "gap-2")}>
|
||||||
active={active && animateLabel}
|
<StreamingLabelSheen
|
||||||
className={cn(
|
active={active && animateLabel}
|
||||||
"min-w-0 flex-1 truncate font-medium",
|
className={cn(
|
||||||
tone === "error" ? "text-destructive/[0.78]" : "text-muted-foreground",
|
"min-w-0 truncate font-medium",
|
||||||
labelClassName,
|
detail ? "max-w-[70%] shrink-0" : "flex-1",
|
||||||
)}
|
tone === "error" ? "text-destructive/[0.78]" : "text-muted-foreground",
|
||||||
>
|
labelClassName,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</StreamingLabelSheen>
|
||||||
{detail ? (
|
{detail ? (
|
||||||
<span className="flex min-w-0 items-baseline gap-2">
|
<>
|
||||||
<span className="max-w-[70%] shrink-0 truncate">{label}</span>{" "}
|
{" "}
|
||||||
<span className={cn("min-w-0 flex-1 truncate font-normal text-muted-foreground", detailClassName)}>{detail}</span>
|
<span className={cn("min-w-0 flex-1 truncate font-normal text-muted-foreground", detailClassName)}>{detail}</span>
|
||||||
</span>
|
</>
|
||||||
) : label}
|
) : null}
|
||||||
</StreamingLabelSheen>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ export function ThinkingReasoningShell({
|
|||||||
{active ? <path className="activity-current-trace" pathLength={100} d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" /> : null}
|
{active ? <path className="activity-current-trace" pathLength={100} d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" /> : null}
|
||||||
</Activity>
|
</Activity>
|
||||||
<span
|
<span
|
||||||
|
data-sheen-text={active ? label : undefined}
|
||||||
className={cn(
|
className={cn(
|
||||||
"min-w-0 truncate text-[12px] font-normal leading-4 text-muted-foreground/65",
|
"min-w-0 truncate text-[12px] font-normal leading-4 text-muted-foreground/65",
|
||||||
|
active && "streaming-text-sheen",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export function StreamingLabelSheen({
|
|||||||
data-sheen-text={active ? sheenText : undefined}
|
data-sheen-text={active ? sheenText : undefined}
|
||||||
className={cn(
|
className={cn(
|
||||||
"block w-fit max-w-full truncate pr-0.5 font-medium leading-normal",
|
"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}
|
{children}
|
||||||
|
|||||||
+11
-6
@@ -402,6 +402,11 @@
|
|||||||
text-wrap: balance;
|
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
|
/* L→R sheen clipped to live activity labels. The highlight lives inside
|
||||||
the glyphs, not in the row background, so dark mode stays quiet. */
|
the glyphs, not in the row background, so dark mode stays quiet. */
|
||||||
@keyframes streaming-text-sheen-ltr {
|
@keyframes streaming-text-sheen-ltr {
|
||||||
@@ -420,7 +425,7 @@
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
.streaming-text-sheen::after {
|
.streaming-text-sheen::after {
|
||||||
content: attr(data-sheen-text);
|
content: attr(data-sheen-text) / "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
display: block;
|
display: block;
|
||||||
@@ -428,6 +433,7 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
padding-right: inherit;
|
||||||
color: transparent;
|
color: transparent;
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
90deg,
|
90deg,
|
||||||
@@ -443,7 +449,7 @@
|
|||||||
background-clip: text;
|
background-clip: text;
|
||||||
-webkit-background-clip: text;
|
-webkit-background-clip: text;
|
||||||
-webkit-text-fill-color: transparent;
|
-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 {
|
.dark .streaming-text-sheen::after {
|
||||||
background-image: linear-gradient(
|
background-image: linear-gradient(
|
||||||
@@ -1467,14 +1473,13 @@
|
|||||||
.activity-current-trace {
|
.activity-current-trace {
|
||||||
display: block;
|
display: block;
|
||||||
stroke-dasharray: 16 84;
|
stroke-dasharray: 16 84;
|
||||||
animation: activity-current-flow 1800ms linear infinite;
|
animation: activity-current-flow var(--activity-animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@keyframes activity-current-flow {
|
@keyframes activity-current-flow {
|
||||||
0% { stroke-dashoffset: 16; opacity: 0; }
|
0% { stroke-dashoffset: 16; opacity: 0; }
|
||||||
10% { opacity: 1; }
|
50% { opacity: 1; }
|
||||||
65% { stroke-dashoffset: 116; opacity: 1; }
|
100% { stroke-dashoffset: 116; opacity: 0; }
|
||||||
75%, 100% { stroke-dashoffset: 116; opacity: 0; }
|
|
||||||
}
|
}
|
||||||
.quiet-control, .settings-hover {
|
.quiet-control, .settings-hover {
|
||||||
--control-hover-fill: hsl(var(--foreground) / 0.045);
|
--control-hover-fill: hsl(var(--foreground) / 0.045);
|
||||||
|
|||||||
@@ -6,6 +6,18 @@ import { ActivityStep } from "@/components/thread/activity/ActivityStep";
|
|||||||
|
|
||||||
afterEach(cleanup);
|
afterEach(cleanup);
|
||||||
|
|
||||||
|
it("animates a running label with details and keeps the completed activity readable", () => {
|
||||||
|
const { rerender } = render(<ActivityStep label="Running Blender" detail="--json project new" active />);
|
||||||
|
|
||||||
|
expect(screen.getByText("Running Blender")).toHaveAttribute("data-sheen-text", "Running Blender");
|
||||||
|
expect(screen.getByLabelText("Running Blender, --json project new")).toHaveTextContent("--json project new");
|
||||||
|
|
||||||
|
rerender(<ActivityStep label="Used Blender" detail="--json project new" />);
|
||||||
|
|
||||||
|
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 () => {
|
it("keeps truncated activity details available on keyboard focus", async () => {
|
||||||
render(<ActivityStep label="Used Blender" detail="--json project new" />);
|
render(<ActivityStep label="Used Blender" detail="--json project new" />);
|
||||||
const detail = screen.getByText("--json project new");
|
const detail = screen.getByText("--json project new");
|
||||||
|
|||||||
@@ -1580,6 +1580,41 @@ describe("AgentActivityCluster", () => {
|
|||||||
expect(document.querySelector("details")).not.toBeInTheDocument();
|
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(
|
||||||
|
<AgentActivityCluster messages={messages} isTurnStreaming hasBodyBelow={false} />,
|
||||||
|
);
|
||||||
|
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(
|
||||||
|
<AgentActivityCluster messages={messages} isTurnStreaming={false} hasBodyBelow={false} />,
|
||||||
|
);
|
||||||
|
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", () => {
|
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 pattern = "Jul (1[0-7]), 2026|July (1[0-7]), 2026|2026-07-(1[0-7])";
|
||||||
const secondPattern = "Anthropic|OpenAI|DeepMind";
|
const secondPattern = "Anthropic|OpenAI|DeepMind";
|
||||||
|
|||||||
@@ -51,11 +51,14 @@ describe("ThinkingReasoningShell", () => {
|
|||||||
const headerClass = button.className;
|
const headerClass = button.className;
|
||||||
const contentClass = content.className;
|
const contentClass = content.className;
|
||||||
expect(button.querySelector("svg")).toHaveClass("lucide-activity");
|
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();
|
expect(view.container.querySelector("[data-contextual-activity-guide]")).toBeInTheDocument();
|
||||||
|
|
||||||
view.rerender(shell(false));
|
view.rerender(shell(false));
|
||||||
|
|
||||||
expect(screen.getByRole("button", { name: "Worked, Collapse activity details" })).toBe(button);
|
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(button.className).toBe(headerClass);
|
||||||
expect(screen.getByTestId("agent-activity-content")).toBe(content);
|
expect(screen.getByTestId("agent-activity-content")).toBe(content);
|
||||||
expect(content.className).toBe(contentClass);
|
expect(content.className).toBe(contentClass);
|
||||||
@@ -70,10 +73,12 @@ describe("ThinkingReasoningShell", () => {
|
|||||||
const status = screen.getByRole("status", { name: "Working" });
|
const status = screen.getByRole("status", { name: "Working" });
|
||||||
expect(status).toHaveClass("touch-target", "h-7", "px-1.5");
|
expect(status).toHaveClass("touch-target", "h-7", "px-1.5");
|
||||||
expect(status.querySelector("svg")).toHaveClass("lucide-activity");
|
expect(status.querySelector("svg")).toHaveClass("lucide-activity");
|
||||||
|
expect(screen.getByText("Working")).toHaveAttribute("data-sheen-text", "Working");
|
||||||
expect(screen.queryByRole("button")).not.toBeInTheDocument();
|
expect(screen.queryByRole("button")).not.toBeInTheDocument();
|
||||||
|
|
||||||
view.rerender(shell(true));
|
view.rerender(shell(true));
|
||||||
expect(screen.getByRole("button", { name: "Working" })).toHaveClass(...status.classList);
|
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", () => {
|
it("mounts details on first expansion and preserves their state across folding", () => {
|
||||||
|
|||||||
Reference in new issue
Block a user