From 882fbcb74c4155b23581d465b5cac100f69a303f Mon Sep 17 00:00:00 2001 From: Bhavik Patel Date: Wed, 4 Mar 2026 14:00:25 +0400 Subject: [PATCH] fix: enable editing identity, sandbox, and tools in agent config UI (#148) * fix(#140): enable editing of identity, sandbox, and tools in agent config UI The ConfigTab's structured view only showed read-only displays for Identity, Sandbox, and Tools sections even when in edit mode. Added inline editing controls: - Identity: emoji, name, theme/role inputs + identity content textarea - Sandbox: mode/workspace dropdowns + network input - Tools: allow/deny lists with add/remove buttons and Enter key support Also added helper functions (updateIdentityField, updateSandboxField, addTool, removeTool) and state for new tool entries. Fixes #140 * fix: align sandbox edit values with agent schema --------- Co-authored-by: Nyk <0xnykcd@googlemail.com> --- src/components/panels/agent-detail-tabs.tsx | 261 +++++++++++++++++--- 1 file changed, 221 insertions(+), 40 deletions(-) diff --git a/src/components/panels/agent-detail-tabs.tsx b/src/components/panels/agent-detail-tabs.tsx index 7f95ed2..c09be4d 100644 --- a/src/components/panels/agent-detail-tabs.tsx +++ b/src/components/panels/agent-detail-tabs.tsx @@ -1241,6 +1241,8 @@ export function ConfigTab({ const [jsonInput, setJsonInput] = useState('') const [availableModels, setAvailableModels] = useState([]) const [newFallbackModel, setNewFallbackModel] = useState('') + const [newAllowTool, setNewAllowTool] = useState('') + const [newDenyTool, setNewDenyTool] = useState('') useEffect(() => { setConfig(agent.config || {}) @@ -1289,6 +1291,40 @@ export function ConfigTab({ setNewFallbackModel('') } + const updateIdentityField = (field: string, value: string) => { + setConfig((prev: any) => ({ + ...prev, + identity: { ...(prev.identity || {}), [field]: value }, + })) + } + + const updateSandboxField = (field: string, value: string) => { + setConfig((prev: any) => ({ + ...prev, + sandbox: { ...(prev.sandbox || {}), [field]: value }, + })) + } + + const addTool = (list: 'allow' | 'deny', value: string) => { + const trimmed = value.trim() + if (!trimmed) return + setConfig((prev: any) => { + const tools = prev.tools || {} + const existing = Array.isArray(tools[list]) ? tools[list] : [] + if (existing.includes(trimmed)) return prev + return { ...prev, tools: { ...tools, [list]: [...existing, trimmed] } } + }) + } + + const removeTool = (list: 'allow' | 'deny', index: number) => { + setConfig((prev: any) => { + const tools = prev.tools || {} + const existing = Array.isArray(tools[list]) ? [...tools[list]] : [] + existing.splice(index, 1) + return { ...prev, tools: { ...tools, [list]: existing } } + }) + } + const handleSave = async (writeToGateway: boolean = false) => { setSaving(true) setError(null) @@ -1476,60 +1512,205 @@ export function ConfigTab({ {/* Identity */}
Identity
-
- {identityEmoji} -
-
{identityName}
-
{identityTheme}
+ {editing ? ( +
+
+
+ + updateIdentityField('emoji', e.target.value)} + className="w-full bg-surface-1 text-foreground rounded px-3 py-2 text-sm text-center focus:outline-none focus:ring-1 focus:ring-primary/50" + placeholder="🤖" + /> +
+
+ + updateIdentityField('name', e.target.value)} + className="w-full bg-surface-1 text-foreground rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary/50" + placeholder="Agent name" + /> +
+
+ + updateIdentityField('theme', e.target.value)} + className="w-full bg-surface-1 text-foreground rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary/50" + placeholder="e.g. backend engineer" + /> +
+
+
+ +