diff --git a/src/renderer/components/team/ToolApprovalSheet.tsx b/src/renderer/components/team/ToolApprovalSheet.tsx index a5d9c15e..15705861 100644 --- a/src/renderer/components/team/ToolApprovalSheet.tsx +++ b/src/renderer/components/team/ToolApprovalSheet.tsx @@ -22,6 +22,30 @@ import type { ToolApprovalRequest } from '@shared/types'; // Tool icon mapping // --------------------------------------------------------------------------- +/** Human-readable tool name for the approval header */ +function getToolDisplayName(toolName: string): string { + switch (toolName) { + case 'AskUserQuestion': + return 'Question'; + case 'Bash': + return 'Terminal'; + case 'Read': + return 'Read File'; + case 'Edit': + return 'Edit File'; + case 'Write': + return 'Write File'; + case 'NotebookEdit': + return 'Edit Notebook'; + case 'Grep': + return 'Search Content'; + case 'Glob': + return 'Find Files'; + default: + return toolName; + } +} + function getToolIcon(toolName: string): React.JSX.Element { const cls = 'size-4 shrink-0'; switch (toolName) { @@ -132,10 +156,12 @@ export const ToolApprovalSheet: React.FC = () => { const [error, setError] = useState(null); const [diffExpanded, setDiffExpanded] = useState(false); const [settingsExpanded, setSettingsExpanded] = useState(false); + const [selectedOptions, setSelectedOptions] = useState>(new Set()); - // Clear error when current approval changes + // Clear error + selection when current approval changes useEffect(() => { setError(null); + setSelectedOptions(new Set()); }, [current?.requestId]); const handleRespond = useCallback( @@ -167,6 +193,21 @@ export const ToolApprovalSheet: React.FC = () => { [current, disabled, respondToToolApproval] ); + const isAskQuestion = current?.toolName === 'AskUserQuestion'; + const hasSelection = selectedOptions.size > 0; + + const handleOptionSelect = useCallback((label: string, multiSelect: boolean) => { + setSelectedOptions((prev) => { + const next = multiSelect ? new Set(prev) : new Set(); + if (next.has(label)) { + next.delete(label); + } else { + next.add(label); + } + return next; + }); + }, []); + useEffect(() => { const handleKeyDown = (e: KeyboardEvent): void => { const tag = document.activeElement?.tagName; @@ -222,7 +263,7 @@ export const ToolApprovalSheet: React.FC = () => { )} {getToolIcon(current.toolName)} - {current.toolName} + {getToolDisplayName(current.toolName)}
@@ -247,6 +288,8 @@ export const ToolApprovalSheet: React.FC = () => { toolName={current.toolName} toolInput={current.toolInput} projectPath={selectedTeamData?.config?.projectPath} + selectedOptions={isAskQuestion ? selectedOptions : undefined} + onOptionSelect={isAskQuestion ? handleOptionSelect : undefined} /> {/* Diff preview (Write/Edit/NotebookEdit only) */} @@ -280,19 +323,30 @@ export const ToolApprovalSheet: React.FC = () => {
- ))} + {opt.label} + + {opt.description && ( +

+ {opt.description} +

+ )} +
+ + ); + })} )}