import { type JSX, type ReactNode } from "react"; import { Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@tutti-os/ui-system"; import { CastIcon } from "../../app/renderer/components/icons/CastIcon"; import { cn } from "../../app/renderer/lib/utils"; import { approvalOptionDisplayLabel } from "../../shared/agentConversation/approvalOptionPresentation"; import type { AgentInteractionResponseInput } from "../../shared/agentConversation/contracts/agentConversationVM"; import type { AgentGUISessionChrome } from "./model/agentGuiNodeTypes"; import styles from "./AgentGUIChrome.styles"; interface AgentChromeNoticeProps { tone: "warning" | "danger" | "muted"; title: string; description?: string; icon?: ReactNode; role?: "alert" | "status"; testId?: string; } interface AgentSessionChromeProps { chrome: AgentGUISessionChrome; approvalDisabledReason?: string | null; isRespondingApproval: boolean; onSubmitApprovalOption: (input: AgentInteractionResponseInput) => boolean; onAuthLogin?: () => void; onRetryActivation: () => void; onContinueInNewConversation: () => void; labels: { approvalRequired: string; authLogin?: string; authRequired: string; activatingSession: string; retryActivation: string; continueInNewConversation: string; }; } function splitTrailingEllipsis(message: string): { label: string; ellipsis: string | null; } { const match = message.match(/^(.*?)(\.{3}|…)\s*$/); if (!match) { return { label: message, ellipsis: null }; } return { label: match[1] ?? message, ellipsis: match[2] ?? null }; } function LoadingEllipsis(): JSX.Element { "use memo"; return ( ); } export function AgentChromeNotice({ tone, title, description, icon, role, testId }: AgentChromeNoticeProps): JSX.Element { "use memo"; const fullMessage = description ? `${title} ${description}` : title; const toneClassName = tone === "danger" ? styles.chromeCardDanger : tone === "muted" ? styles.chromeCardMuted : styles.chromeCardWarning; return (
{title} {description ? ( {description} ) : null}
{visibleAuth.message}
{chrome.approval.title}
{visibleRecovery.kind === "activating" ||
visibleRecovery.kind === "transport-connecting" ? (
<>
{activatingMessage.label}
{activatingMessage.ellipsis ?