diff options
Diffstat (limited to 'packages/cli/src/ui/hooks/useGeminiStream.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useGeminiStream.ts | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index bba01bc9..b4acdb9a 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -32,6 +32,7 @@ import { HistoryItemWithoutId, HistoryItemToolGroup, MessageType, + SlashCommandProcessorResult, ToolCallStatus, } from '../types.js'; import { isAtCommand } from '../utils/commandUtils.js'; @@ -83,9 +84,7 @@ export const useGeminiStream = ( onDebugMessage: (message: string) => void, handleSlashCommand: ( cmd: PartListUnion, - ) => Promise< - import('./slashCommandProcessor.js').SlashCommandActionReturn | boolean - >, + ) => Promise<SlashCommandProcessorResult | false>, shellModeActive: boolean, getPreferredEditor: () => EditorType | undefined, onAuthError: () => void, @@ -225,16 +224,10 @@ export const useGeminiStream = ( // Handle UI-only commands first const slashCommandResult = await handleSlashCommand(trimmedQuery); - if (typeof slashCommandResult === 'boolean' && slashCommandResult) { - // Command was handled, and it doesn't require a tool call from here - return { queryToSend: null, shouldProceed: false }; - } else if ( - typeof slashCommandResult === 'object' && - slashCommandResult.shouldScheduleTool - ) { - // Slash command wants to schedule a tool call (e.g., /memory add) - const { toolName, toolArgs } = slashCommandResult; - if (toolName && toolArgs) { + + if (slashCommandResult) { + if (slashCommandResult.type === 'schedule_tool') { + const { toolName, toolArgs } = slashCommandResult; const toolCallRequest: ToolCallRequestInfo = { callId: `${toolName}-${Date.now()}-${Math.random().toString(16).slice(2)}`, name: toolName, @@ -243,7 +236,8 @@ export const useGeminiStream = ( }; scheduleToolCalls([toolCallRequest], abortSignal); } - return { queryToSend: null, shouldProceed: false }; // Handled by scheduling the tool + + return { queryToSend: null, shouldProceed: false }; } if (shellModeActive && handleShellCommand(trimmedQuery, abortSignal)) { |
