diff options
| author | Abhi <[email protected]> | 2025-07-07 16:45:44 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-07 20:45:44 +0000 |
| commit | aa10ccba713d49bef6bf474bfd72c0852e3da611 (patch) | |
| tree | 92f1de8bec31cdb10a02fe8ddac1fbde41b75e7f /packages/cli/src/ui/hooks/useGeminiStream.ts | |
| parent | 6eccb474c77e41aa88d1d1d4ea7eada3e85e746c (diff) | |
feature(commands) - Refactor Slash Command + Vision For the Future (#3175)
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)) { |
