import { useState } from "react"; import type React from "react"; import type { AgentProfile, AgentPrototype, ReasoningEffort } from "../types"; import { AgentProfileModal } from "./AgentProfileModal"; import { GlobalDefaultPersonaEditor } from "./GlobalDefaultPersonaEditor"; import { modalOverlayStyle, modalPanelStyle } from "./modalStyles"; import { ENABLE_PROFILE_CREATE } from "../featureFlags"; const DEFAULT_PROFILE_KEY = "__default__"; const REASONING_OPTIONS: { value: ReasoningEffort; label: string }[] = [ { value: "none", label: "off" }, { value: "low", label: "low" }, { value: "medium", label: "med" }, { value: "high", label: "high" }, ]; type Tab = "modify" | "create"; interface Props { agents: AgentProfile[]; prototypes: AgentPrototype[]; defaultAgentId?: string; verbose: boolean; reasoningEffort: ReasoningEffort; onVerboseToggle: () => void; onReasoningChange: (v: ReasoningEffort) => void; onClose: () => void; onSaved: () => void; } export function DeskAgentCustomizeModal({ agents, prototypes, defaultAgentId, verbose, reasoningEffort, onVerboseToggle, onReasoningChange, onClose, onSaved, }: Props) { const [tab, setTab] = useState("modify"); const initialModifyId = !defaultAgentId ? DEFAULT_PROFILE_KEY : agents.some((a) => a.id === defaultAgentId) ? defaultAgentId : DEFAULT_PROFILE_KEY; const [modifyAgentId, setModifyAgentId] = useState(initialModifyId); const modifyAgent = modifyAgentId === DEFAULT_PROFILE_KEY ? null : agents.find((a) => a.id === modifyAgentId) ?? null; const btnStyle: React.CSSProperties = { padding: "3px 7px", fontSize: 9, fontWeight: 500, cursor: "pointer", borderRadius: 5, border: "1px solid #2a3558", }; return (
{ if (e.target === e.currentTarget) onClose(); }} >
{(ENABLE_PROFILE_CREATE ? (["modify", "create"] as Tab[]) : (["modify"] as Tab[])).map((id) => ( ))}
Worker preferences
Verbose {verbose ? "high" : "low"}
Reasoning {REASONING_OPTIONS.map(({ value, label }) => ( ))}
{tab === "modify" ? ( <> {modifyAgentId === DEFAULT_PROFILE_KEY ? ( ) : modifyAgent ? ( ) : (
No agent profiles available. Switch to Create new.
)} ) : ( )}
); } const sectionStyle: React.CSSProperties = { marginBottom: 16, padding: "12px 14px", borderRadius: 8, background: "#0e1424", border: "1px solid #2a3558", }; const sectionTitleStyle: React.CSSProperties = { fontSize: 10, fontWeight: 700, letterSpacing: 0.6, textTransform: "uppercase", color: "var(--text-dim)", marginBottom: 8, }; const selectStyle: React.CSSProperties = { fontSize: 12, padding: "6px 10px", borderRadius: 6, background: "#121828", border: "1px solid #2a3558", color: "var(--text)", }; const ghostBtn: React.CSSProperties = { background: "transparent", border: "none", color: "var(--text-dim)", cursor: "pointer", fontSize: 14, };