Skip to content

Your lightweight open-source personal agent.

fix(webui): remove extra frames from activity logos

Xubin Rene7e94bda1cc1
diff --git a/webui/browser/activity-logos-fixture.tsx b/webui/browser/activity-logos-fixture.tsx
new file mode 100644
index 000000000..b22273802
--- /dev/null
+++ b/webui/browser/activity-logos-fixture.tsx
@@ -0,0 +1,52 @@
+import { useEffect, useState } from "react";
+import { AgentActivityCluster } from "@/components/thread/AgentActivityCluster";
+import { formatToolCallTrace } from "@/lib/tool-traces";
+import type { CliAppInfo, McpPresetInfo, UIMessage } from "@/lib/types";
+
+const cliApp: CliAppInfo = {
+ name: "blender", display_name: "Blender", category: "3d", description: "Preview app",
+ requires: "", source: "harness", entry_point: "cli-anything-blender",
+ install_supported: true, installed: true, available: true, status: "installed",
+ logo_url: "https://cdn.simpleicons.org/blender", brand_color: "#E87D0D", skill_installed: true,
+};
+const preset: McpPresetInfo = {
+ name: "linear", display_name: "Linear", category: "productivity", description: "Preview app",
+ docs_url: "https://linear.app", transport: "streamableHttp", requires: "", note: "",
+ install_supported: true, installed: true, configured: true, available: true, status: "configured",
+ logo_url: "https://icons.duckduckgo.com/ip3/linear.app.ico", brand_color: "#6D5DF6",
+ required_fields: [], connection_summary: "Preview only",
+};
+
+function messages(phase: "start" | "end" | "error"): UIMessage[] {
+ const toolEvents = [
+ { name: "mcp_linear_get_workspace", args: {} },
+ { name: "run_cli_app", args: { name: "blender", args: ["--background", "scene.blend"], json: true } },
+ ].map(({ name, args }) => ({ phase, call_id: `${phase}-${name}`, name, arguments: args,
+ ...(phase === "error" ? { error: "Preview failure" } : {}) }));
+ const traces = toolEvents.map(event => formatToolCallTrace(event)!);
+ return [{
+ id: `${phase}-tools`, role: "tool", kind: "trace", createdAt: 1,
+ content: traces.join("\n"), traces, toolEvents,
+ }];
+}
+
+export function ActivityLogosFixture({ parameters }: { parameters: URLSearchParams }) {
+ const [dark, setDark] = useState(parameters.has("dark"));
+ useEffect(() => { document.documentElement.classList.toggle("dark", dark); }, [dark]);
+ const fallback = parameters.has("fallback");
+ return <main className="mx-auto max-w-2xl space-y-6 p-6">
+ <header className="flex items-center justify-between gap-4 text-sm">
+ <h1>Activity logo preview</h1>
+ <button onClick={() => setDark(value => !value)}>Toggle theme</button>
+ </header>
+ {(["end", "start", "error"] as const).map((phase) => (
+ <section key={phase} aria-label={phase} className="space-y-2">
+ <h2 className="text-xs text-muted-foreground">{phase === "start" ? "Running" : phase === "end" ? "Completed" : "Failed"}</h2>
+ <AgentActivityCluster messages={messages(phase)} isTurnStreaming={phase === "start"}
+ hasBodyBelow={false} expanded
+ cliApps={[fallback ? { ...cliApp, logo_url: null } : cliApp]}
+ mcpPresets={[fallback ? { ...preset, logo_url: "/browser/missing-activity-logo.svg" } : preset]} />
+ </section>
+ ))}
+ </main>;
+}
diff --git a/webui/browser/activity-logos.spec.ts b/webui/browser/activity-logos.spec.ts
new file mode 100644
index 000000000..09a562ca8
--- /dev/null
+++ b/webui/browser/activity-logos.spec.ts
@@ -0,0 +1,68 @@
+import { expect, test } from "@playwright/test";
+
+// Opaque and transparent artwork exercise both common brand-image layouts offline.
+const tile = '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><rect width="32" height="32" fill="#171717"/><circle cx="16" cy="16" r="10" fill="white"/></svg>';
+const mark = '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="12" fill="#E87D0D"/></svg>';
+
+test.beforeEach(async ({ page }) => {
+ await page.addInitScript(() => localStorage.setItem("nanobot.locale", "en"));
+ await page.route("https://icons.duckduckgo.com/ip3/linear.app.ico", route => route.fulfill({ contentType: "image/svg+xml", body: tile }));
+ await page.route("https://cdn.simpleicons.org/blender", route => route.fulfill({ contentType: "image/svg+xml", body: mark }));
+ await page.route("**/api/**", route => route.fulfill({ json: {} }));
+});
+
+for (const width of [1280, 360]) {
+ for (const dark of [false, true]) {
+ test.describe(`${width}px ${dark ? "dark" : "light"} activity logos`, () => {
+ test.use({ viewport: { width, height: 700 } });
+ test("fits brand images directly to the rounded mark while preserving status and alignment", async ({ page }, testInfo) => {
+ await page.goto(`/browser/fixture.html?case=activity-logos${dark ? "&dark" : ""}`);
+ for (const phase of ["end", "start", "error"]) {
+ const section = page.getByRole("region", { name: phase, exact: true });
+ const positions: number[] = [];
+ for (const id of ["activity-mcp-logo-linear", "activity-cli-logo-blender"]) {
+ const logo = section.getByTestId(id);
+ const image = logo.locator("img");
+ await expect(image).toBeVisible();
+ await expect.poll(() => image.evaluate(node => (node as HTMLImageElement).naturalWidth)).toBe(32);
+ const imageBox = (await image.boundingBox())!;
+ const frame = (await logo.boundingBox())!;
+ expect(frame.width).toBe(16);
+ expect(frame.height).toBe(16);
+ expect(imageBox).toEqual(frame);
+ await expect(logo).toHaveCSS("background-color", "rgba(0, 0, 0, 0)");
+ await expect(logo).toHaveCSS("border-top-width", "0px");
+ await expect(logo).toHaveCSS("box-shadow", "none");
+ await expect(logo).toHaveCSS("animation-name", phase === "start" ? "pulse" : "none");
+ expect(await logo.evaluate(node => parseFloat(getComputedStyle(node).borderRadius))).toBeGreaterThan(0);
+ positions.push(frame.x);
+ }
+ expect(positions[0]).toBe(positions[1]);
+ }
+ await expect(page.getByRole("region", { name: "end", exact: true })).toContainText("Used Blender");
+ await expect(page.getByRole("region", { name: "start", exact: true })).toContainText("Using Blender");
+ await expect(page.getByRole("region", { name: "error", exact: true })).toContainText("Could not use Blender");
+ expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBe(width);
+ await page.locator("main").screenshot({ path: testInfo.outputPath("activity-logos.png") });
+ });
+ });
+ }
+}
+
+test("keeps missing and failed logos identifiable in both themes", async ({ page }) => {
+ await page.route("**/browser/missing-activity-logo.svg", route => route.fulfill({ status: 404, body: "" }));
+ await page.goto("/browser/fixture.html?case=activity-logos&fallback");
+ for (const dark of [false, true]) {
+ if (dark) await page.getByRole("button", { name: "Toggle theme" }).click();
+ for (const phase of ["end", "start", "error"]) {
+ const section = page.getByRole("region", { name: phase, exact: true });
+ await expect(section.getByTestId("activity-mcp-logo-linear")).toHaveText("L");
+ await expect(section.getByTestId("activity-cli-logo-blender")).toHaveText("B");
+ for (const logo of [section.getByTestId("activity-mcp-logo-linear"), section.getByTestId("activity-cli-logo-blender")]) {
+ await expect(logo).toHaveCSS("width", "16px");
+ await expect(logo).toHaveCSS("color", "rgb(255, 255, 255)");
+ expect(await logo.evaluate(node => getComputedStyle(node).backgroundColor)).not.toBe("rgba(0, 0, 0, 0)");
+ }
+ }
+ }
+});
diff --git a/webui/browser/fixture.tsx b/webui/browser/fixture.tsx
index 41f38ed71..ce5bc7d66 100644
--- a/webui/browser/fixture.tsx
+++ b/webui/browser/fixture.tsx
@@ -29,6 +29,7 @@ import { ChatFailureFixture } from "./chat-failure-fixture";
import { ThreadLoadingFixture } from "./thread-loading-fixture";
import { AnswerOrderFixture } from "./answer-order-fixture";
import { SidebarActivityFixture } from "./sidebar-activity-fixture";
+import { ActivityLogosFixture } from "./activity-logos-fixture";
import { HistoryHydrationFixture } from "./history-hydration-fixture";
import { IdleCompactionFixture, installIdleCompactionApi } from "./idle-compaction-fixture";
import { FileEditPathFixture } from "./file-edit-path-fixture";
@@ -225,6 +226,8 @@ createRoot(document.getElementById("root")!).render(<TooltipProvider>
? <FileEditPathFixture />
: parameters.get("case") === "answer-order"
? <AnswerOrderFixture />
+ : parameters.get("case") === "activity-logos"
+ ? <ActivityLogosFixture parameters={parameters} />
: parameters.get("case") === "sidebar-activity"
? <SidebarActivityFixture />
: parameters.get("case") === "chat-failure"
diff --git a/webui/src/components/thread/AgentActivityCluster.tsx b/webui/src/components/thread/AgentActivityCluster.tsx
index 429022a8b..232e87831 100644
--- a/webui/src/components/thread/AgentActivityCluster.tsx
+++ b/webui/src/components/thread/AgentActivityCluster.tsx
@@ -1268,14 +1268,10 @@ function CliRunRow({ run, active, app }: { run: CliRunSummary; active: boolean;
<span
data-testid={`activity-cli-logo-${run.name.toLowerCase()}`}
className={cn(
- "grid h-4 w-4 shrink-0 place-items-center overflow-hidden rounded-mark border text-[6.5px] font-semibold text-white",
+ "grid h-4 w-4 shrink-0 place-items-center overflow-hidden rounded-mark text-[6.5px] font-semibold text-white",
rowActive && "animate-pulse",
)}
- style={{
- borderColor: alphaColor(color, 22),
- backgroundColor: logoUrl ? "hsl(var(--background))" : color,
- boxShadow: rowActive ? `0 0 0 3px ${alphaColor(color, 9)}` : undefined,
- }}
+ style={{ backgroundColor: logoUrl ? "transparent" : color }}
aria-hidden
>
{logoUrl ? (
@@ -1284,7 +1280,7 @@ function CliRunRow({ run, active, app }: { run: CliRunSummary; active: boolean;
alt=""
decoding="async"
loading="lazy"
- className="h-[78%] w-[78%] object-contain"
+ className="h-full w-full object-contain"
onLoad={onLogoLoad}
onError={onLogoError}
/>
@@ -1349,14 +1345,10 @@ function McpRunRow({ run, active, preset }: { run: McpRunSummary; active: boolea
<span
data-testid={`activity-mcp-logo-${run.presetName.toLowerCase()}`}
className={cn(
- "grid h-4 w-4 shrink-0 place-items-center overflow-hidden rounded-mark border text-[6.5px] font-semibold text-white",
+ "grid h-4 w-4 shrink-0 place-items-center overflow-hidden rounded-mark text-[6.5px] font-semibold text-white",
rowActive && "animate-pulse",
)}
- style={{
- borderColor: alphaColor(color, 22),
- backgroundColor: logoUrl ? "hsl(var(--background))" : color,
- boxShadow: rowActive ? `0 0 0 3px ${alphaColor(color, 9)}` : undefined,
- }}
+ style={{ backgroundColor: logoUrl ? "transparent" : color }}
aria-hidden
>
{logoUrl ? (
@@ -1365,7 +1357,7 @@ function McpRunRow({ run, active, preset }: { run: McpRunSummary; active: boolea
alt=""
decoding="async"
loading="lazy"
- className="h-[78%] w-[78%] object-contain"
+ className="h-full w-full object-contain"
onLoad={onLogoLoad}
onError={onLogoError}
/>
@@ -1379,13 +1371,3 @@ function McpRunRow({ run, active, preset }: { run: McpRunSummary; active: boolea
/>
);
}
-
-function alphaColor(color: string, percent: number): string {
- if (/^#[0-9a-f]{6}$/i.test(color)) {
- const alpha = Math.round((percent / 100) * 255)
- .toString(16)
- .padStart(2, "0");
- return `${color}${alpha}`;
- }
- return `color-mix(in srgb, ${color} ${percent}%, transparent)`;
-}