From e3d6d166b402b24f8949f7e46bad14c834a416aa Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 8 Jul 2025 13:19:49 -0700 Subject: [PATCH] Update PendingToolCallToolbar for parallel tool calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed from selectCurrentToolCall to selectCurrentToolCallsByStatus - Show individual UI for each tool call requiring approval - Display dynamic text: "1 pending tool call" vs "X pending tool calls" - Individual approve/reject buttons for each tool call - Added test IDs with toolCallId for specific tool testing - Used only Tailwind classes, no styled components - Returns null when no pending tool calls exist 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../LumpToolbar/PendingToolCallToolbar.tsx | 86 +++++++++++-------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/gui/src/components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar.tsx b/gui/src/components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar.tsx index c67b32fff..72421c7d1 100644 --- a/gui/src/components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar.tsx +++ b/gui/src/components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar.tsx @@ -1,6 +1,6 @@ import styled from "styled-components"; import { useAppDispatch, useAppSelector } from "../../../../redux/hooks"; -import { selectCurrentToolCall } from "../../../../redux/selectors/selectCurrentToolCall"; +import { selectCurrentToolCallsByStatus } from "../../../../redux/selectors/selectCurrentToolCall"; import { cancelToolCall } from "../../../../redux/slices/sessionSlice"; import { callToolById } from "../../../../redux/thunks/callToolById"; import { @@ -28,45 +28,63 @@ const StopButton = styled.div` export function PendingToolCallToolbar() { const dispatch = useAppDispatch(); const jetbrains = isJetBrains(); - const currentToolCall = useAppSelector(selectCurrentToolCall); + const pendingToolCalls = useAppSelector((state) => + selectCurrentToolCallsByStatus(state, "generated") + ); + + if (pendingToolCalls.length === 0) { + return null; + } + + const handleAccept = (toolCallId: string) => { + dispatch(callToolById({ toolCallId })); + }; + + const handleReject = (toolCallId: string) => { + dispatch(cancelToolCall({ toolCallId })); + }; return (
- Pending tool call + + {pendingToolCalls.length === 1 + ? "Pending tool call" + : `${pendingToolCalls.length} pending tool calls` + } +
-
- { - dispatch( - cancelToolCall({ - toolCallId: currentToolCall.toolCallId, - }), - ); - } - : undefined - } - data-testid="reject-tool-call-button" - > - {/* JetBrains overrides cmd+backspace, so we have to use another shortcut */} - {jetbrains ? getAltKeyLabel() : getMetaKeyLabel()} ⌫ Cancel - - - currentToolCall && dispatch( - callToolById({ toolCallId: currentToolCall.toolCallId }) - ) - } - data-testid="accept-tool-call-button" - > - {getMetaKeyLabel()} ⏎ Continue - +
+ {pendingToolCalls.map((toolCall) => ( +
+ + {toolCall.toolCall.function.name} + + +
+ handleReject(toolCall.toolCallId)} + data-testid={`reject-tool-call-button-${toolCall.toolCallId}`} + > + {jetbrains ? getAltKeyLabel() : getMetaKeyLabel()} ⌫ Cancel + + + handleAccept(toolCall.toolCallId)} + data-testid={`accept-tool-call-button-${toolCall.toolCallId}`} + > + {getMetaKeyLabel()} ⏎ Continue + +
+
+ ))}
);