Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

9.8 KB
Raw Blame
"use client";

import { type ComponentType, type SVGProps, useId } from "react";

/**
 * Brand glyphs for connected-agent backends. The real marks (Claude's sunburst,
 * Codex's gradient app icon) so a connected agent reads as itself everywhere it
 * appears — selector chip, cards, message references. Rendered in brand colours
 * (not `currentColor`) so they look authentic rather than tinted. Resolve a
 * backend kind to its glyph with `agentGlyph(kind)`; unknown kinds return null
 * and callers fall back to a generic icon.
 */

type GlyphProps = { size?: number } & Omit<
  SVGProps<SVGSVGElement>,
  "width" | "height"
>;

// Claude / Anthropic sunburst, in the brand clay.
export function ClaudeGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <svg
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="#D97757"
      aria-hidden
      {...props}
    >
      <path d="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z" />
    </svg>
  );
}

// Official Codex app icon (white tile + blue→purple gradient cloud with a
// terminal prompt). Gradient id is per-instance (useId) so multiple icons on a
// page don't collide.
export function CodexGlyph({ size = 16, ...props }: GlyphProps) {
  const gradientId = useId();
  return (
    <svg
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="none"
      aria-hidden
      {...props}
    >
      <path
        d="M19.503 0H4.496A4.496 4.496 0 000 4.496v15.007A4.496 4.496 0 004.496 24h15.007A4.496 4.496 0 0024 19.503V4.496A4.496 4.496 0 0019.503 0z"
        fill="#fff"
      />
      <path
        d="M9.064 3.344a4.578 4.578 0 012.285-.312c1 .115 1.891.54 2.673 1.275.01.01.024.017.037.021a.09.09 0 00.043 0 4.55 4.55 0 013.046.275l.047.022.116.057a4.581 4.581 0 012.188 2.399c.209.51.313 1.041.315 1.595a4.24 4.24 0 01-.134 1.223.123.123 0 00.03.115c.594.607.988 1.33 1.183 2.17.289 1.425-.007 2.71-.887 3.854l-.136.166a4.548 4.548 0 01-2.201 1.388.123.123 0 00-.081.076c-.191.551-.383 1.023-.74 1.494-.9 1.187-2.222 1.846-3.711 1.838-1.187-.006-2.239-.44-3.157-1.302a.107.107 0 00-.105-.024c-.388.125-.78.143-1.204.138a4.441 4.441 0 01-1.945-.466 4.544 4.544 0 01-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81 5.81 0 01-.37-.961 4.582 4.582 0 01-.014-2.298.124.124 0 00.006-.056.085.085 0 00-.027-.048 4.467 4.467 0 01-1.034-1.651 3.896 3.896 0 01-.251-1.192 5.189 5.189 0 01.141-1.6c.337-1.112.982-1.985 1.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098 0 00.065-.066 4.51 4.51 0 01.829-1.615 4.535 4.535 0 011.837-1.388zm3.482 10.565a.637.637 0 000 1.272h3.636a.637.637 0 100-1.272h-3.636zM8.462 9.23a.637.637 0 00-1.106.631l1.272 2.224-1.266 2.136a.636.636 0 101.095.649l1.454-2.455a.636.636 0 00.005-.64L8.462 9.23z"
        fill={`url(#${gradientId})`}
      />
      <defs>
        <linearGradient
          gradientUnits="userSpaceOnUse"
          id={gradientId}
          x1="12"
          x2="12"
          y1="3"
          y2="21"
        >
          <stop stopColor="#B1A7FF" />
          <stop offset=".5" stopColor="#7A9DFF" />
          <stop offset="1" stopColor="#3941FF" />
        </linearGradient>
      </defs>
    </svg>
  );
}

// A neutral terminal glyph for Grok CLI, not an unofficial reproduction of a
// brand mark. It stays readable in both light and dark agent menus.
export function GrokGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <svg
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.8"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden
      {...props}
    >
      <rect x="2" y="3" width="20" height="18" rx="4" />
      <path d="m7 8 4 4-4 4m7 0h3" />
    </svg>
  );
}

// Gemini's four-point spark, in the brand blue→violet gradient.
export function GeminiGlyph({ size = 16, ...props }: GlyphProps) {
  const gradientId = useId();
  return (
    <svg
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="none"
      aria-hidden
      {...props}
    >
      <path
        d="M12 24A14.3 14.3 0 0 0 0 12 14.3 14.3 0 0 0 12 0a14.3 14.3 0 0 0 12 12 14.3 14.3 0 0 0-12 12z"
        fill={`url(#${gradientId})`}
      />
      <defs>
        <linearGradient
          gradientUnits="userSpaceOnUse"
          id={gradientId}
          x1="0"
          x2="24"
          y1="24"
          y2="0"
        >
          <stop stopColor="#217BFE" />
          <stop offset="1" stopColor="#AC87EB" />
        </linearGradient>
      </defs>
    </svg>
  );
}

// Exact upstream brand assets, kept as local files so agent menus also work
// offline. Sources are documented in public/agent-icons/README.md.
export function KimiGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <OfficialAssetGlyph src="/agent-icons/kimi.svg" size={size} {...props} />
  );
}

export function OpencodeGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <OfficialAssetGlyph
      src="/agent-icons/opencode.svg"
      size={size}
      {...props}
    />
  );
}

export function MimoGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <OfficialAssetGlyph
      src="/agent-icons/mimo-code.svg"
      size={size}
      {...props}
    />
  );
}

function OfficialAssetGlyph({
  src,
  size = 16,
  ...props
}: GlyphProps & { src: string }) {
  return (
    <svg
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="none"
      aria-hidden
      {...props}
    >
      <image
        href={src}
        width="24"
        height="24"
        preserveAspectRatio="xMidYMid meet"
      />
    </svg>
  );
}

export function HermesGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <OfficialAssetGlyph src="/agent-icons/hermes.svg" size={size} {...props} />
  );
}

export function OpenClawGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <OfficialAssetGlyph
      src="/agent-icons/openclaw.svg"
      size={size}
      {...props}
    />
  );
}

export function DeepSeekGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <OfficialAssetGlyph
      src="/agent-icons/deepseek-harness.svg"
      size={size}
      {...props}
    />
  );
}

// A connected partner: a filled heart in the Partners accent, so a consulted
// partner reads as a companion (not a CLI) everywhere a connected agent appears.
export function PartnerGlyph({ size = 16, ...props }: GlyphProps) {
  return (
    <svg
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="#7C6FF0"
      aria-hidden
      {...props}
    >
      <path d="M12 21s-7.5-4.35-10-9.16C.61 9.06 1.6 5.6 4.6 4.66c1.9-.6 3.86.18 5 1.74L12 9l.4-.6c.14-.96 1.1-1.74 2-2.34 1.74-1.16 4.1-.78 5.4.9 1.6 2.06 1 5.34-1.4 7.88C19.5 16.65 12 21 12 21z" />
    </svg>
  );
}

export type AgentGlyph = ComponentType<GlyphProps>;

export function agentGlyph(kind: string | undefined): AgentGlyph | null {
  if (kind === "claude_code") return ClaudeGlyph;
  if (kind === "codex") return CodexGlyph;
  if (kind === "grok") return GrokGlyph;
  // Antigravity uses Google's Gemini mark, but Gemini CLI itself is retired.
  if (kind === "antigravity") return GeminiGlyph;
  if (kind === "kimi") return KimiGlyph;
  if (kind === "opencode") return OpencodeGlyph;
  if (kind === "mimo") return MimoGlyph;
  if (kind === "hermes") return HermesGlyph;
  if (kind === "hermes_remote") return HermesGlyph;
  if (kind === "openclaw") return OpenClawGlyph;
  if (kind === "deepseek_harness") return DeepSeekGlyph;
  if (kind === "partner") return PartnerGlyph;
  return null;
}

/** A connected agent's backend, as people call it. */
export function agentKindLabel(kind: string | undefined): string {
  if (kind === "claude_code") return "Claude Code";
  if (kind === "codex") return "Codex";
  if (kind === "grok") return "Grok CLI";
  if (kind === "antigravity") return "Antigravity CLI";
  if (kind === "kimi") return "Kimi CLI";
  if (kind === "opencode") return "opencode";
  if (kind === "mimo") return "MiMo Code";
  if (kind === "hermes") return "Hermes Agent";
  if (kind === "hermes_remote") return "Hermes Agent (remote)";
  if (kind === "openclaw") return "OpenClaw";
  if (kind === "deepseek_harness") return "DeepSeek Harness";
  return kind ?? "";
}