import { useState } from "react"; import type { Item } from "../types"; import { Icon } from "./Icon"; import { Markdown } from "./Markdown"; type PlanItem = Extract; // The agent (in read-only plan mode) proposed a plan via propose_plan. The user approves it — // choosing whether execution should keep asking per action or run with full access — or sends // it back with feedback. Mirrors the directory-request card, shown in the composer head. export function PlanCard({ item, onRespond, }: { item: PlanItem; onRespond: (approved: boolean, mode?: string, feedback?: string) => void; }) { const [rejecting, setRejecting] = useState(false); const [feedback, setFeedback] = useState(""); return (
The agent proposed a plan
{rejecting ? (
setFeedback(e.target.value)} onKeyDown={(e) => { if (e.key === "Enter" && feedback.trim()) onRespond(false, undefined, feedback.trim()); }} />
) : (
)}
); }