import React, { useState } from "react"; import { LLMContent } from "../types"; interface ChangeDirToolProps { // For tool_use (pending state) toolInput?: unknown; // { path: string } isRunning?: boolean; // For tool_result (completed state) toolResult?: LLMContent[]; hasError?: boolean; executionTime?: string; } function ChangeDirTool({ toolInput, isRunning, toolResult, hasError, executionTime, }: ChangeDirToolProps) { const [isExpanded, setIsExpanded] = useState(false); // Extract path from toolInput const path = typeof toolInput === "object" && toolInput !== null && "path" in toolInput && typeof (toolInput as { path: unknown }).path === "string" ? (toolInput as { path: string }).path : ""; // Get result text const resultText = toolResult ?.map((r) => r.Text) .filter(Boolean) .join("") || ""; const isComplete = !isRunning && toolResult !== undefined; return (