summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useGeminiStream.ts
diff options
context:
space:
mode:
authorBrandon Keiji <[email protected]>2025-05-22 09:51:07 +0000
committerGitHub <[email protected]>2025-05-22 02:51:07 -0700
commita8bfdf2d5603e9e2fb01e12d6c5499662dccaa85 (patch)
tree5c191574d4d1ae3d2ebc7a75139ca47e7f96b915 /packages/cli/src/ui/hooks/useGeminiStream.ts
parent174fdce7d8230a12f879874cf7121698d91e678c (diff)
fix: synchronization between executed tools and turn loops (#488)
Diffstat (limited to 'packages/cli/src/ui/hooks/useGeminiStream.ts')
-rw-r--r--packages/cli/src/ui/hooks/useGeminiStream.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts
index 324a4ffa..d3ecad95 100644
--- a/packages/cli/src/ui/hooks/useGeminiStream.ts
+++ b/packages/cli/src/ui/hooks/useGeminiStream.ts
@@ -383,6 +383,7 @@ export const useGeminiStream = (
toolCallRequests.push(event.value);
} else if (event.type === ServerGeminiEventType.UserCancelled) {
handleUserCancelledEvent(userMessageTimestamp);
+ cancel();
return StreamProcessingStatus.UserCancelled;
} else if (event.type === ServerGeminiEventType.Error) {
handleErrorEvent(event.value, userMessageTimestamp);
@@ -393,12 +394,9 @@ export const useGeminiStream = (
return StreamProcessingStatus.Completed;
};
- const streamingState: StreamingState = isResponding
- ? StreamingState.Responding
- : pendingToolCalls?.tools.some(
- (t) => t.status === ToolCallStatus.Confirming,
- )
- ? StreamingState.WaitingForConfirmation
+ const streamingState: StreamingState =
+ isResponding || toolCalls.some((t) => t.status === 'awaiting_approval')
+ ? StreamingState.Responding
: StreamingState.Idle;
const submitQuery = useCallback(