Skip to content
28 linesCodeBlameRaw
1import { Avatar } from "./ui/avatar";
2
3/**
4 * Who an agent's avatar is drawn for: g1t itself, or the author of an old
5 * message from an agent that no longer exists. Extra fields older callers
6 * pass (a face, a status) are accepted and not drawn.
7 */
8export type AgentLike = {
9 id?: string;
10 /** Its handle, or a member's name. */
11 handle?: string;
12 name?: string;
13 avatar?: string | null;
14 avatar_seed?: string | null;
15 look?: unknown;
16 builtin?: boolean;
17 status?: unknown;
18};
19
20/**
21 * An agent's avatar wherever it appears: the shared Avatar with `agent`
22 * set (components/ui/avatar.tsx), so it is g1t's pixel 1, an uploaded
23 * picture, or its initial on a tile, always with the agent marker.
24 */
25export function AgentAvatar({ agent, size = 20, ring }: { agent: AgentLike; size?: number; state?: unknown; ring?: string }) {
26 const g1t = agent.builtin || agent.handle === "g1t" || agent.name === "g1t";
27 return <Avatar name={agent.handle ?? agent.name ?? "agent"} image={agent.avatar} system={g1t} size={size} ring={ring} agent />;
28}