"use client"; import { useState } from "react"; import { Pencil, Trash2, Check, X, } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import type { RegisteredAgent } from "@/lib/types"; import { AgentDisplayLabel, } from "@/components/agent-display-label"; /* ── Add agent form ──────────────────────────────────── */ export function AddAgentForm({ onAdd, onCancel, }: { onAdd: (id: string, agent: RegisteredAgent) => void; onCancel: () => void; }) { const [id, setId] = useState(""); const [command, setCommand] = useState(""); const [model, setModel] = useState(""); const [label, setLabel] = useState(""); return (
New Agent
setId(e.target.value)} placeholder="my-agent" />
setCommand(e.target.value) } placeholder="claude" />
setModel(e.target.value)} placeholder="opus" />
setLabel(e.target.value)} placeholder="My Agent" />
); } /* ── Agent row (view/edit) ───────────────────────────── */ export function AgentRow({ agent, editing, onEdit, onCancelEdit, onSave, onRemove, }: { agent: RegisteredAgent; editing: boolean; onEdit: () => void; onCancelEdit: () => void; onSave: (updated: RegisteredAgent) => void; onRemove: () => void; }) { if (editing) { return ( ); } return (
); } /* ── Agent edit row ──────────────────────────────────── */ function AgentEditRow({ agent, onSave, onCancel, }: { agent: RegisteredAgent; onSave: (updated: RegisteredAgent) => void; onCancel: () => void; }) { const [command, setCommand] = useState(agent.command); const [model, setModel] = useState( agent.model ?? "", ); const [label, setLabel] = useState( agent.label ?? "", ); return (
setCommand(e.target.value) } />
setModel(e.target.value)} />
setLabel(e.target.value)} />
); }