/* Copyright 2026 Marimo. All rights reserved. */ import { useAtomValue } from "jotai"; import { TerminalIcon, TerminalSquareIcon } from "lucide-react"; import { memo } from "react"; import { AiProviderIcon } from "@/components/ai/ai-provider-icon"; import { CopyClipboardIcon } from "@/components/icons/copy-icon"; import { useTerminalCommands } from "@/components/terminal/hooks"; import { Button } from "@/components/ui/button"; import { Tooltip } from "@/components/ui/tooltip"; import { capabilitiesAtom } from "@/core/config/capabilities"; import { cn } from "@/utils/cn"; import { type ExternalAgentId, getAgentConnectionCommand, getAgentDisplayName, getAllAgentIds, } from "./state"; // Opencode currently edits files without requesting for permission const BETA_AGENTS = new Set(["opencode"]); interface AgentDocItemProps { agentId: ExternalAgentId; showCopy?: boolean; className?: string; } const AgentDocItem = memo( ({ agentId, showCopy = true, className }) => { const command = getAgentConnectionCommand(agentId); const displayName = getAgentDisplayName(agentId); const capabilities = useAtomValue(capabilitiesAtom); const { sendCommand } = useTerminalCommands(); const handleSendToTerminal = () => { sendCommand(command); }; return (
{displayName} {BETA_AGENTS.has(agentId) && ( (beta) )}
{command}
{showCopy && ( )} {capabilities.terminal && ( )}
); }, ); AgentDocItem.displayName = "AgentDocItem"; interface AgentDocsProps { title?: string; description?: React.ReactNode; agents?: ExternalAgentId[]; showCopy?: boolean; className?: string; } export const AgentDocs = memo( ({ title, description, agents = getAllAgentIds(), showCopy = true, className, }) => (

{title}

{description}

{agents.map((agentId) => ( ))}
), ); AgentDocs.displayName = "AgentDocs";