import { useId, useState } from "react"; import { ChevronIcon } from "@chopin/icons"; import { MotionDisclosure, MotionDisclosureIcon } from "@chopin/editor"; import { duration, summarize, toolCopy, workPhase } from "./model"; import { motionContract } from "../motion-contract"; import { motionImmediately } from "../motion-input"; import type { Chat } from "@chopin/protocol"; function ToolCall( { active, disconnected, tool }: { active: boolean; disconnected: boolean; tool: Chat.Activity }, ) { let [open, setOpen] = useState(false); let contentId = useId(); let hasDetails = tool.args !== undefined || tool.result !== undefined; let status = tool.status === "running" ? disconnected ? "Last seen running" : active ? "Running" : "Interrupted" : tool.status === "failed" ? "Failed" : "Done"; let row = ( <> {hasDetails && (