import { useState, type JSX } from "react"; import type { AgentToolCallCardProps } from "./AgentToolCallCard"; import { AgentToolCallHeader } from "./AgentToolCallHeader"; import { CollapsibleReveal } from "./CollapsibleReveal"; import { AgentExpandedToolContent } from "./tool-renderers/AgentExpandedToolContent"; import { hasAgentToolContent } from "./tool-renderers/agentToolContentShared"; export function AgentAskUserQuestionCard({ call, onLinkClick, defaultExpanded, nonCollapsible }: AgentToolCallCardProps): JSX.Element { "use memo"; const waitingInput = (call.askUserQuestion?.status ?? call.status ?? "").trim().toLowerCase() === "waiting_input"; const hasDetail = hasAgentToolContent(call); const pinned = nonCollapsible ?? waitingInput; const [expanded, setExpanded] = useState(defaultExpanded ?? waitingInput); return (
{hasDetail && !pinned ? ( ) : (
)} {!hasDetail && call.summary ? (
{call.summary}
) : null} {hasDetail && pinned ? ( ) : null} {hasDetail && !pinned ? ( ) : null}
); }