From 304a6dda3ace10e940af7cc77039e950acf23231 Mon Sep 17 00:00:00 2001 From: Noah Date: Thu, 10 Sep 2026 11:55:03 +0200 Subject: [PATCH] fix(app): render terminal-profile icons instead of the generic Bot --- .../app/src/components/provider-icons.test.ts | 23 +++++++++++++++++++ packages/app/src/components/provider-icons.ts | 11 ++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/app/src/components/provider-icons.test.ts b/packages/app/src/components/provider-icons.test.ts index 5235218875..81ea04ebd0 100644 --- a/packages/app/src/components/provider-icons.test.ts +++ b/packages/app/src/components/provider-icons.test.ts @@ -1,5 +1,6 @@ import { Bot } from "lucide-react-native"; import { SvgXml } from "react-native-svg"; +import { TERMINAL_PROFILE_ICON_NAMES } from "@getpaseo/protocol/provider-icon-names"; import { describe, expect, it } from "vitest"; import { replaceProviderSnapshotIcons } from "./provider-icon-name"; import { getProviderIcon, type ProviderIconComponent } from "./provider-icons"; @@ -30,4 +31,26 @@ describe("getProviderIcon", () => { expect(getProviderIcon("plain-provider", "server-1")).toBe(Bot); }); + + it("renders the shipped SVG for the agy terminal-profile icon instead of the Bot", () => { + const icon = getProviderIcon("agy"); + expect(icon).not.toBe(Bot); + expect(icon.displayName).toBe("SvgProviderIcon(agy)"); + }); + + it("resolves every registered terminal-profile icon to its shipped SVG, not the Bot", () => { + for (const name of TERMINAL_PROFILE_ICON_NAMES) { + const icon = getProviderIcon(name); + expect(icon, `terminal-profile icon "${name}" fell back to Bot`).not.toBe(Bot); + expect(icon.displayName).toBe(`SvgProviderIcon(${name})`); + } + }); + + it("still resolves ACP catalog icons to their SVG (the seeded map is shared)", () => { + expect(getProviderIcon("cursor")).not.toBe(Bot); + }); + + it("falls back to the Bot for an unknown icon id", () => { + expect(getProviderIcon("definitely-not-a-real-icon")).toBe(Bot); + }); }); diff --git a/packages/app/src/components/provider-icons.ts b/packages/app/src/components/provider-icons.ts index 6671c95d4d..65ef61acbd 100644 --- a/packages/app/src/components/provider-icons.ts +++ b/packages/app/src/components/provider-icons.ts @@ -1,6 +1,7 @@ import { Bot, PackagePlus } from "lucide-react-native"; import { createElement, type ComponentType } from "react"; import { SvgXml } from "react-native-svg"; +import { TERMINAL_PROFILE_ICON_NAMES } from "@getpaseo/protocol/provider-icon-names"; import { ClaudeIcon } from "@/components/icons/claude-icon"; import { CodexIcon } from "@/components/icons/codex-icon"; import { CopilotIcon } from "@/components/icons/copilot-icon"; @@ -8,6 +9,7 @@ import { MiniMaxIcon } from "@/components/icons/minimax-icon"; import { OpenCodeIcon } from "@/components/icons/opencode-icon"; import { OmpIcon } from "@/components/icons/omp-icon"; import { PiIcon } from "@/components/icons/pi-icon"; +import { ACP_PROVIDER_ICON_SVGS } from "@/assets/acp-provider-icons"; import { ACP_PROVIDER_CATALOG } from "@/data/acp-provider-catalog"; import { resolveProviderIconName } from "@/components/provider-icon-name"; @@ -29,10 +31,17 @@ const BUILTIN_PROVIDER_ICONS: Record = { pi: PiIcon as unknown as ProviderIconComponent, }; -const CATALOG_ICON_SVGS = new Map( +const CATALOG_ICON_SVGS = new Map( ACP_PROVIDER_CATALOG.flatMap((entry) => (entry.iconSvg ? [[entry.id, entry.iconSvg]] : [])), ); +for (const name of TERMINAL_PROFILE_ICON_NAMES) { + const iconSvg = (ACP_PROVIDER_ICON_SVGS as Record)[name]; + if (iconSvg) { + CATALOG_ICON_SVGS.set(name, iconSvg); + } +} + const catalogIconComponents = new Map(); const snapshotIconComponents = new Map();