MCPcopy Create free account
hub / github.com/block/buzz / EditAgentDialog

Function EditAgentDialog

desktop/src/features/agents/ui/EditAgentDialog.tsx:53–721  ·  view source on GitHub ↗
({
  agent,
  open,
  onOpenChange,
  onUpdated,
}: {
  agent: ManagedAgent;
  open: boolean;
  onOpenChange: (open: boolean) => void;
  onUpdated?: (agent: ManagedAgent) => void;
})

Source from the content-addressed store, hash-verified

51} from "./usePersonaModelDiscovery";
52
53export function EditAgentDialog({
54 agent,
55 open,
56 onOpenChange,
57 onUpdated,
58}: {
59 agent: ManagedAgent;
60 open: boolean;
61 onOpenChange: (open: boolean) => void;
62 onUpdated?: (agent: ManagedAgent) => void;
63}) {
64 const updateMutation = useUpdateManagedAgentMutation();
65 const runtimesQuery = useAcpRuntimesQuery({ enabled: open });
66 const runtimes = runtimesQuery.data ?? [];
67
68 const [name, setName] = React.useState(agent.name);
69 const [relayUrl, setRelayUrl] = React.useState(agent.relayUrl);
70 const [acpCommand, setAcpCommand] = React.useState(agent.acpCommand);
71 const [agentCommand, setAgentCommand] = React.useState(agent.agentCommand);
72 // Whether the harness inherits from the linked persona (no explicit pin).
73 // Only meaningful when a persona is linked; seeded from the override field
74 // so an unset override shows as "inherit" rather than re-pinning on save.
75 const [inheritHarness, setInheritHarness] = React.useState(
76 agent.personaId != null && agent.agentCommandOverride == null,
77 );
78 const [agentArgs, setAgentArgs] = React.useState(agent.agentArgs.join(","));
79 const [mcpCommand, setMcpCommand] = React.useState(agent.mcpCommand);
80 const [mcpToolsets, setMcpToolsets] = React.useState(agent.mcpToolsets ?? "");
81 const [turnTimeoutSeconds, setTurnTimeoutSeconds] = React.useState(
82 String(agent.turnTimeoutSeconds),
83 );
84 const [parallelism, setParallelism] = React.useState(
85 String(agent.parallelism),
86 );
87 const [systemPrompt, setSystemPrompt] = React.useState(
88 agent.systemPrompt ?? "",
89 );
90 const [model, setModel] = React.useState(agent.model ?? "");
91 const [isCustomModelEditing, setIsCustomModelEditing] = React.useState(false);
92 const [provider, setProvider] = React.useState(agent.provider ?? "");
93 const [isCustomProviderEditing, setIsCustomProviderEditing] =
94 React.useState(false);
95 const [envVars, setEnvVars] = React.useState<EnvVarsValue>(agent.envVars);
96 const personasQuery = usePersonasQuery();
97 const linkedPersona = React.useMemo(
98 () =>
99 agent.personaId
100 ? (personasQuery.data?.find((p) => p.id === agent.personaId) ?? null)
101 : null,
102 [agent.personaId, personasQuery.data],
103 );
104 const inheritedEnvVars = linkedPersona?.envVars ?? {};
105 const [respondTo, setRespondTo] = React.useState<RespondToMode>(
106 agent.respondTo,
107 );
108 const [respondToAllowlist, setRespondToAllowlist] = React.useState<string[]>(
109 agent.respondToAllowlist,
110 );

Callers

nothing calls this directly

Calls 12

useAcpRuntimesQueryFunction · 0.90
usePersonasQueryFunction · 0.90
sortPersonaRuntimesFunction · 0.90
formatRuntimeOptionLabelFunction · 0.90
usePersonaModelDiscoveryFunction · 0.90
pushMethod · 0.80
handleOpenChangeFunction · 0.70
handleSubmitFunction · 0.70

Tested by

no test coverage detected