import { Box } from "ink"; import Link from "ink-link"; import { memo, useMemo } from "react"; import { DEFAULT_AGENT_NAME } from "../../constants"; import { settingsManager } from "../../settings-manager"; import { getVersion } from "../../version"; import { colors } from "./colors"; import { Text } from "./Text"; interface AgentInfoBarProps { agentId?: string; agentName?: string | null; serverUrl?: string; conversationId?: string; } /** * Shows agent info bar with current agent details and useful links. */ export const AgentInfoBar = memo(function AgentInfoBar({ agentId, agentName, serverUrl, conversationId, }: AgentInfoBarProps) { const isTmux = Boolean(process.env.TMUX); // Check if current agent is pinned const isPinned = useMemo(() => { if (!agentId) return false; const localPinned = settingsManager.getLocalPinnedAgents(); const globalPinned = settingsManager.getGlobalPinnedAgents(); return localPinned.includes(agentId) || globalPinned.includes(agentId); }, [agentId]); const isCloudUser = serverUrl?.includes("api.letta.com"); const adeUrl = agentId && agentId !== "loading" ? `https://app.letta.com/agents/${agentId}${conversationId && conversationId !== "default" ? `?conversation=${conversationId}` : ""}` : ""; const showBottomBar = agentId && agentId !== "loading"; if (!showBottomBar) { return null; } // Alien ASCII art lines (4 lines tall, with 2-char indent + extra space before text) const alienLines = [" ▗▖▗▖ ", " ▙█▜▛█▟ ", " ▝▜▛▜▛▘ ", " "]; return ( {/* Blank line after commands */} {/* Version and Discord/feedback info */} {" "}Letta Code v{getVersion()} · Report bugs with /feedback or{" "} on Discord ↗ {/* Blank line before agent info */} {/* Alien + Agent name */} {alienLines[0]} {agentName || "Unnamed"} {isPinned ? ( (pinned ✓) ) : agentName === DEFAULT_AGENT_NAME || !agentName ? ( (type /pin to give your agent a real name!) ) : ( (type /pin to pin agent) )} {/* Alien + Links */} {alienLines[1]} {isCloudUser && adeUrl && !isTmux && ( <> Open in ADE ↗ · )} {isCloudUser && adeUrl && isTmux && ( Open in ADE: {adeUrl} · )} {isCloudUser && ( View usage ↗ )} {!isCloudUser && {serverUrl}} {/* Alien + Agent ID */} {alienLines[2]} {agentId} {/* Phantom alien row + Conversation ID */} {alienLines[3]} {conversationId && conversationId !== "default" ? ( {conversationId} ) : ( default conversation )} ); });