"use client"; import { CheckCircle, ChevronDown, Sparkles, Circle, Check, } from "lucide-react"; import { useState } from "react"; import { cn } from "@/lib/utils"; import { Button } from "../ui/button"; import { Badge } from "../ui/badge"; import { HumanResponse } from "@langchain/langgraph/prebuilt"; import { TaskPlan } from "@openswe/shared/open-swe/types"; import { getActivePlanItems } from "@openswe/shared/open-swe/tasks"; import { InlineMarkdownText } from "../thread/markdown-text"; type PlanItem = { index: number; plan: string; completed: boolean; }; type AcceptedPlanStepProps = { taskPlan?: TaskPlan; planTitle?: string; planItems?: PlanItem[]; interruptType?: HumanResponse["type"]; collapse?: boolean; }; export function AcceptedPlanStep({ taskPlan, planTitle, planItems = [], interruptType, collapse: collapseProp = true, }: AcceptedPlanStepProps) { const [collapsed, setCollapsed] = useState(collapseProp); const activeTaskPlan = taskPlan ? getActivePlanItems(taskPlan) : planItems; const getStatusText = () => { if (interruptType === "edit") { return "Plan revised and approved"; } return "Plan approved and ready"; }; const getStatusBadge = () => { return ( Approved ); }; const getPlanItemIcon = (item: PlanItem) => { if (item.completed) { return (
); } return (
); }; const totalCount = activeTaskPlan.length; return (
{/* Header */}

{getStatusText()}

{getStatusBadge()}
{totalCount > 0 && (

{totalCount} step{totalCount === 1 ? "" : "s"}

)}
{/* Content */}
{planTitle && (

Plan Overview

{planTitle}

)} {activeTaskPlan.length > 0 && (

Execution Steps {totalCount}

{activeTaskPlan .sort((a, b) => a.index - b.index) .map((item, idx) => (
{getPlanItemIcon(item)}
{item.plan} {idx + 1}
))}
)}
); }