Update streamNormalInput to handle multiple tool calls

- Changed from selectCurrentToolCall to selectCurrentToolCalls selector
- Added loop to iterate over all tool calls in a response
- Each tool call is marked as "generated" with setToolGenerated
- Auto-execute tools with "allowedWithoutPermission" policy
- Tools with "allowedWithPermission" require manual approval
- Maintains backward compatibility with single tool calls
- TypeScript compilation passes, core functionality verified

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Patrick Erichsen 2025-07-08 13:15:06 -07:00
parent 7cb78fe209
commit aa50f54999

View file

@ -3,7 +3,7 @@ import { LLMFullCompletionOptions } from "core";
import { modelSupportsTools } from "core/llm/autodetect";
import { ToCoreProtocol } from "core/protocol";
import { selectActiveTools } from "../selectors/selectActiveTools";
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
import { selectCurrentToolCalls } from "../selectors/selectCurrentToolCall";
import { selectSelectedChatModel } from "../slices/configSlice";
import {
abortStream,
@ -144,11 +144,12 @@ export const streamNormalInput = createAsyncThunk<
}
}
// If it's a tool call that is automatically accepted, we should call it
// Handle multiple tool calls that may be automatically accepted
const newState = getState();
const toolSettings = newState.ui.toolSettings;
const toolCallState = selectCurrentToolCall(newState);
if (toolCallState) {
const toolCallStates = selectCurrentToolCalls(newState);
for (const toolCallState of toolCallStates) {
dispatch(
setToolGenerated({
toolCallId: toolCallState.toolCallId,