@qwen-code/qwen-code 0.0.2 → 0.0.4-nightly.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +6 -4
- package/dist/qwen-code-qwen-code-0.0.3.tgz +0 -0
- package/dist/src/acp/acp.d.ts +208 -0
- package/dist/src/acp/acp.js +193 -0
- package/dist/src/acp/acp.js.map +1 -0
- package/dist/src/acp/acpPeer.d.ts +8 -0
- package/dist/src/acp/acpPeer.js +537 -0
- package/dist/src/acp/acpPeer.js.map +1 -0
- package/dist/src/config/config.d.ts +5 -2
- package/dist/src/config/config.js +70 -28
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/extension.d.ts +2 -2
- package/dist/src/config/extension.js +21 -16
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/settings.d.ts +22 -15
- package/dist/src/config/settings.js +25 -10
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/gemini.d.ts +1 -0
- package/dist/src/gemini.js +31 -49
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/nonInteractiveCli.js +0 -67
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/patches/is-in-ci.d.ts +7 -0
- package/dist/src/patches/is-in-ci.js +15 -0
- package/dist/src/patches/is-in-ci.js.map +1 -0
- package/dist/src/services/BuiltinCommandLoader.d.ts +24 -0
- package/dist/src/services/BuiltinCommandLoader.js +72 -0
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -0
- package/dist/src/services/CommandService.d.ts +43 -5
- package/dist/src/services/CommandService.js +61 -25
- package/dist/src/services/CommandService.js.map +1 -1
- package/dist/src/services/FileCommandLoader.d.ts +37 -0
- package/dist/src/services/FileCommandLoader.js +179 -0
- package/dist/src/services/FileCommandLoader.js.map +1 -0
- package/dist/src/services/McpPromptLoader.d.ts +25 -0
- package/dist/src/services/McpPromptLoader.js +192 -0
- package/dist/src/services/McpPromptLoader.js.map +1 -0
- package/dist/src/services/prompt-processors/argumentProcessor.d.ts +21 -0
- package/dist/src/services/prompt-processors/argumentProcessor.js +28 -0
- package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/shellProcessor.d.ts +32 -0
- package/dist/src/services/prompt-processors/shellProcessor.js +77 -0
- package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/types.d.ts +38 -0
- package/dist/src/services/prompt-processors/types.js +14 -0
- package/dist/src/services/prompt-processors/types.js.map +1 -0
- package/dist/src/services/types.d.ts +22 -0
- package/dist/src/services/types.js +7 -0
- package/dist/src/services/types.js.map +1 -0
- package/dist/src/ui/App.js +130 -101
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/colors.js +6 -0
- package/dist/src/ui/colors.js.map +1 -1
- package/dist/src/ui/commands/aboutCommand.js +2 -0
- package/dist/src/ui/commands/aboutCommand.js.map +1 -1
- package/dist/src/ui/commands/authCommand.js +2 -0
- package/dist/src/ui/commands/authCommand.js.map +1 -1
- package/dist/src/ui/commands/bugCommand.d.ts +7 -0
- package/dist/src/ui/commands/bugCommand.js +63 -0
- package/dist/src/ui/commands/bugCommand.js.map +1 -0
- package/dist/src/ui/commands/chatCommand.d.ts +7 -0
- package/dist/src/ui/commands/chatCommand.js +179 -0
- package/dist/src/ui/commands/chatCommand.js.map +1 -0
- package/dist/src/ui/commands/clearCommand.js +14 -2
- package/dist/src/ui/commands/clearCommand.js.map +1 -1
- package/dist/src/ui/commands/compressCommand.d.ts +7 -0
- package/dist/src/ui/commands/compressCommand.js +64 -0
- package/dist/src/ui/commands/compressCommand.js.map +1 -0
- package/dist/src/ui/commands/copyCommand.d.ts +7 -0
- package/dist/src/ui/commands/copyCommand.js +59 -0
- package/dist/src/ui/commands/copyCommand.js.map +1 -0
- package/dist/src/ui/commands/corgiCommand.d.ts +7 -0
- package/dist/src/ui/commands/corgiCommand.js +15 -0
- package/dist/src/ui/commands/corgiCommand.js.map +1 -0
- package/dist/src/ui/commands/docsCommand.d.ts +7 -0
- package/dist/src/ui/commands/docsCommand.js +31 -0
- package/dist/src/ui/commands/docsCommand.js.map +1 -0
- package/dist/src/ui/commands/editorCommand.d.ts +7 -0
- package/dist/src/ui/commands/editorCommand.js +16 -0
- package/dist/src/ui/commands/editorCommand.js.map +1 -0
- package/dist/src/ui/commands/extensionsCommand.d.ts +7 -0
- package/dist/src/ui/commands/extensionsCommand.js +31 -0
- package/dist/src/ui/commands/extensionsCommand.js.map +1 -0
- package/dist/src/ui/commands/helpCommand.js +4 -2
- package/dist/src/ui/commands/helpCommand.js.map +1 -1
- package/dist/src/ui/commands/ideCommand.d.ts +8 -0
- package/dist/src/ui/commands/ideCommand.js +121 -0
- package/dist/src/ui/commands/ideCommand.js.map +1 -0
- package/dist/src/ui/commands/mcpCommand.d.ts +7 -0
- package/dist/src/ui/commands/mcpCommand.js +425 -0
- package/dist/src/ui/commands/mcpCommand.js.map +1 -0
- package/dist/src/ui/commands/memoryCommand.js +11 -4
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/privacyCommand.js +2 -0
- package/dist/src/ui/commands/privacyCommand.js.map +1 -1
- package/dist/src/ui/commands/quitCommand.d.ts +7 -0
- package/dist/src/ui/commands/quitCommand.js +34 -0
- package/dist/src/ui/commands/quitCommand.js.map +1 -0
- package/dist/src/ui/commands/restoreCommand.d.ts +8 -0
- package/dist/src/ui/commands/restoreCommand.js +128 -0
- package/dist/src/ui/commands/restoreCommand.js.map +1 -0
- package/dist/src/ui/commands/statsCommand.d.ts +7 -0
- package/dist/src/ui/commands/statsCommand.js +54 -0
- package/dist/src/ui/commands/statsCommand.js.map +1 -0
- package/dist/src/ui/commands/themeCommand.js +2 -0
- package/dist/src/ui/commands/themeCommand.js.map +1 -1
- package/dist/src/ui/commands/toolsCommand.d.ts +7 -0
- package/dist/src/ui/commands/toolsCommand.js +56 -0
- package/dist/src/ui/commands/toolsCommand.js.map +1 -0
- package/dist/src/ui/commands/types.d.ts +76 -4
- package/dist/src/ui/commands/types.js +6 -1
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/commands/vimCommand.d.ts +7 -0
- package/dist/src/ui/commands/vimCommand.js +23 -0
- package/dist/src/ui/commands/vimCommand.js.map +1 -0
- package/dist/src/ui/components/AuthDialog.js +0 -1
- package/dist/src/ui/components/AuthDialog.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.d.ts +6 -1
- package/dist/src/ui/components/ContextSummaryDisplay.js +46 -19
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/Footer.d.ts +1 -0
- package/dist/src/ui/components/Footer.js +2 -2
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Header.js +1 -1
- package/dist/src/ui/components/Header.js.map +1 -1
- package/dist/src/ui/components/Help.d.ts +1 -1
- package/dist/src/ui/components/IDEContextDetailDisplay.d.ts +11 -0
- package/dist/src/ui/components/IDEContextDetailDisplay.js +19 -0
- package/dist/src/ui/components/IDEContextDetailDisplay.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.d.ts +3 -1
- package/dist/src/ui/components/InputPrompt.js +86 -123
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.d.ts +15 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js +44 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -0
- package/dist/src/ui/components/ThemeDialog.js +51 -25
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/components/Tips.js +1 -1
- package/dist/src/ui/components/Tips.js.map +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.d.ts +1 -0
- package/dist/src/ui/components/messages/DiffRenderer.js +12 -11
- package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +5 -4
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.js +3 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
- package/dist/src/ui/components/shared/MaxSizedBox.js +69 -2
- package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -1
- package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +3 -1
- package/dist/src/ui/components/shared/RadioButtonSelect.js +69 -50
- package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.d.ts +273 -3
- package/dist/src/ui/components/shared/text-buffer.js +426 -80
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +72 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js +565 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -0
- package/dist/src/ui/constants.d.ts +1 -0
- package/dist/src/ui/constants.js +1 -0
- package/dist/src/ui/constants.js.map +1 -1
- package/dist/src/ui/contexts/VimModeContext.d.ts +19 -0
- package/dist/src/ui/contexts/VimModeContext.js +48 -0
- package/dist/src/ui/contexts/VimModeContext.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.js +54 -15
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.d.ts +2 -1
- package/dist/src/ui/hooks/shellCommandProcessor.js +154 -177
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +9 -12
- package/dist/src/ui/hooks/slashCommandProcessor.js +203 -880
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useAuthCommand.js +2 -1
- package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
- package/dist/src/ui/hooks/useCompletion.d.ts +4 -1
- package/dist/src/ui/hooks/useCompletion.js +137 -24
- package/dist/src/ui/hooks/useCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.js +53 -37
- package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -1
- package/dist/src/ui/hooks/useFocus.d.ts +6 -0
- package/dist/src/ui/hooks/useFocus.js +41 -0
- package/dist/src/ui/hooks/useFocus.js.map +1 -0
- package/dist/src/ui/hooks/useGeminiStream.js +57 -11
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useInputHistory.d.ts +1 -1
- package/dist/src/ui/hooks/useKeypress.js +5 -2
- package/dist/src/ui/hooks/useKeypress.js.map +1 -1
- package/dist/src/ui/hooks/usePrivacySettings.js +5 -5
- package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -1
- package/dist/src/ui/hooks/useShellHistory.d.ts +3 -2
- package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
- package/dist/src/ui/hooks/useThemeCommand.js +24 -23
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
- package/dist/src/ui/hooks/vim.d.ts +28 -0
- package/dist/src/ui/hooks/vim.js +630 -0
- package/dist/src/ui/hooks/vim.js.map +1 -0
- package/dist/src/ui/themes/ansi-light.js +3 -1
- package/dist/src/ui/themes/ansi-light.js.map +1 -1
- package/dist/src/ui/themes/ansi.js +2 -0
- package/dist/src/ui/themes/ansi.js.map +1 -1
- package/dist/src/ui/themes/atom-one-dark.js +2 -0
- package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
- package/dist/src/ui/themes/ayu-light.js +3 -1
- package/dist/src/ui/themes/ayu-light.js.map +1 -1
- package/dist/src/ui/themes/ayu.js +3 -1
- package/dist/src/ui/themes/ayu.js.map +1 -1
- package/dist/src/ui/themes/color-utils.d.ts +21 -0
- package/dist/src/ui/themes/color-utils.js +221 -0
- package/dist/src/ui/themes/color-utils.js.map +1 -0
- package/dist/src/ui/themes/dracula.js +2 -0
- package/dist/src/ui/themes/dracula.js.map +1 -1
- package/dist/src/ui/themes/github-dark.js +2 -0
- package/dist/src/ui/themes/github-dark.js.map +1 -1
- package/dist/src/ui/themes/github-light.js +2 -0
- package/dist/src/ui/themes/github-light.js.map +1 -1
- package/dist/src/ui/themes/googlecode.js +3 -1
- package/dist/src/ui/themes/googlecode.js.map +1 -1
- package/dist/src/ui/themes/no-color.js +3 -1
- package/dist/src/ui/themes/no-color.js.map +1 -1
- package/dist/src/ui/themes/qwen-dark.js +2 -0
- package/dist/src/ui/themes/qwen-dark.js.map +1 -1
- package/dist/src/ui/themes/qwen-light.js +2 -0
- package/dist/src/ui/themes/qwen-light.js.map +1 -1
- package/dist/src/ui/themes/shades-of-purple.d.ts +1 -1
- package/dist/src/ui/themes/shades-of-purple.js +3 -1
- package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
- package/dist/src/ui/themes/theme-manager.d.ts +31 -6
- package/dist/src/ui/themes/theme-manager.js +114 -37
- package/dist/src/ui/themes/theme-manager.js.map +1 -1
- package/dist/src/ui/themes/theme.d.ts +23 -3
- package/dist/src/ui/themes/theme.js +244 -182
- package/dist/src/ui/themes/theme.js.map +1 -1
- package/dist/src/ui/themes/xcode.js +3 -1
- package/dist/src/ui/themes/xcode.js.map +1 -1
- package/dist/src/ui/types.d.ts +9 -1
- package/dist/src/ui/utils/CodeColorizer.d.ts +3 -1
- package/dist/src/ui/utils/CodeColorizer.js +23 -11
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
- package/dist/src/ui/utils/commandUtils.d.ts +1 -0
- package/dist/src/ui/utils/commandUtils.js +47 -0
- package/dist/src/ui/utils/commandUtils.js.map +1 -1
- package/dist/src/ui/utils/errorParsing.js.map +1 -1
- package/dist/src/ui/utils/markdownUtilities.js +1 -1
- package/dist/src/ui/utils/textUtils.d.ts +0 -8
- package/dist/src/ui/utils/textUtils.js +0 -22
- package/dist/src/ui/utils/textUtils.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.js +5 -1
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/utils/events.d.ts +11 -0
- package/dist/src/utils/events.js +13 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/sandbox.js +7 -3
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/userStartupWarnings.js +16 -10
- package/dist/src/utils/userStartupWarnings.js.map +1 -1
- package/dist/src/validateNonInterActiveAuth.d.ts +7 -0
- package/dist/src/validateNonInterActiveAuth.js +38 -0
- package/dist/src/validateNonInterActiveAuth.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CommandContext } from '../../ui/commands/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Defines the interface for a prompt processor, a module that can transform
|
|
9
|
+
* a prompt string before it is sent to the model. Processors are chained
|
|
10
|
+
* together to create a processing pipeline.
|
|
11
|
+
*/
|
|
12
|
+
export interface IPromptProcessor {
|
|
13
|
+
/**
|
|
14
|
+
* Processes a prompt string, applying a specific transformation as part of a pipeline.
|
|
15
|
+
*
|
|
16
|
+
* Each processor in a command's pipeline receives the output of the previous
|
|
17
|
+
* processor. This method provides the full command context, allowing for
|
|
18
|
+
* complex transformations that may require access to invocation details,
|
|
19
|
+
* application services, or UI state.
|
|
20
|
+
*
|
|
21
|
+
* @param prompt The current state of the prompt string. This may have been
|
|
22
|
+
* modified by previous processors in the pipeline.
|
|
23
|
+
* @param context The full command context, providing access to invocation
|
|
24
|
+
* details (like `context.invocation.raw` and `context.invocation.args`),
|
|
25
|
+
* application services, and UI handlers.
|
|
26
|
+
* @returns A promise that resolves to the transformed prompt string, which
|
|
27
|
+
* will be passed to the next processor or, if it's the last one, sent to the model.
|
|
28
|
+
*/
|
|
29
|
+
process(prompt: string, context: CommandContext): Promise<string>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The placeholder string for shorthand argument injection in custom commands.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SHORTHAND_ARGS_PLACEHOLDER = "{{args}}";
|
|
35
|
+
/**
|
|
36
|
+
* The trigger string for shell command injection in custom commands.
|
|
37
|
+
*/
|
|
38
|
+
export declare const SHELL_INJECTION_TRIGGER = "!{";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The placeholder string for shorthand argument injection in custom commands.
|
|
8
|
+
*/
|
|
9
|
+
export const SHORTHAND_ARGS_PLACEHOLDER = '{{args}}';
|
|
10
|
+
/**
|
|
11
|
+
* The trigger string for shell command injection in custom commands.
|
|
12
|
+
*/
|
|
13
|
+
export const SHELL_INJECTION_TRIGGER = '!{';
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6BH;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { SlashCommand } from '../ui/commands/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Defines the contract for any class that can load and provide slash commands.
|
|
9
|
+
* This allows the CommandService to be extended with new command sources
|
|
10
|
+
* (e.g., file-based, remote APIs) without modification.
|
|
11
|
+
*
|
|
12
|
+
* Loaders should receive any necessary dependencies (like Config) via their
|
|
13
|
+
* constructor.
|
|
14
|
+
*/
|
|
15
|
+
export interface ICommandLoader {
|
|
16
|
+
/**
|
|
17
|
+
* Discovers and returns a list of slash commands from the loader's source.
|
|
18
|
+
* @param signal An AbortSignal to allow cancellation.
|
|
19
|
+
* @returns A promise that resolves to an array of SlashCommand objects.
|
|
20
|
+
*/
|
|
21
|
+
loadCommands(signal: AbortSignal): Promise<SlashCommand[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/src/ui/App.js
CHANGED
|
@@ -26,6 +26,7 @@ import { ThemeDialog } from './components/ThemeDialog.js';
|
|
|
26
26
|
import { AuthDialog } from './components/AuthDialog.js';
|
|
27
27
|
import { AuthInProgress } from './components/AuthInProgress.js';
|
|
28
28
|
import { EditorSettingsDialog } from './components/EditorSettingsDialog.js';
|
|
29
|
+
import { ShellConfirmationDialog } from './components/ShellConfirmationDialog.js';
|
|
29
30
|
import { Colors } from './colors.js';
|
|
30
31
|
import { Help } from './components/Help.js';
|
|
31
32
|
import { loadHierarchicalGeminiMemory } from '../config/config.js';
|
|
@@ -35,16 +36,20 @@ import { registerCleanup } from '../utils/cleanup.js';
|
|
|
35
36
|
import { DetailedMessagesDisplay } from './components/DetailedMessagesDisplay.js';
|
|
36
37
|
import { HistoryItemDisplay } from './components/HistoryItemDisplay.js';
|
|
37
38
|
import { ContextSummaryDisplay } from './components/ContextSummaryDisplay.js';
|
|
39
|
+
import { IDEContextDetailDisplay } from './components/IDEContextDetailDisplay.js';
|
|
38
40
|
import { useHistory } from './hooks/useHistoryManager.js';
|
|
39
41
|
import process from 'node:process';
|
|
40
|
-
import { getErrorMessage, getAllGeminiMdFilenames, ApprovalMode, isEditorAvailable, FlashFallbackEvent, logFlashFallback, } from '@qwen-code/qwen-code-core';
|
|
42
|
+
import { getErrorMessage, getAllGeminiMdFilenames, ApprovalMode, isEditorAvailable, FlashFallbackEvent, logFlashFallback, AuthType, ideContext, } from '@qwen-code/qwen-code-core';
|
|
41
43
|
import { validateAuthMethod } from '../config/auth.js';
|
|
42
44
|
import { useLogger } from './hooks/useLogger.js';
|
|
43
45
|
import { StreamingContext } from './contexts/StreamingContext.js';
|
|
44
46
|
import { SessionStatsProvider, useSessionStats, } from './contexts/SessionContext.js';
|
|
45
47
|
import { useGitBranchName } from './hooks/useGitBranchName.js';
|
|
48
|
+
import { useFocus } from './hooks/useFocus.js';
|
|
46
49
|
import { useBracketedPaste } from './hooks/useBracketedPaste.js';
|
|
47
50
|
import { useTextBuffer } from './components/shared/text-buffer.js';
|
|
51
|
+
import { useVimMode, VimModeProvider } from './contexts/VimModeContext.js';
|
|
52
|
+
import { useVim } from './hooks/vim.js';
|
|
48
53
|
import * as fs from 'fs';
|
|
49
54
|
import { UpdateNotification } from './components/UpdateNotification.js';
|
|
50
55
|
import { isProQuotaExceededError, isGenericQuotaExceededError, UserTierId, } from '@qwen-code/qwen-code-core';
|
|
@@ -53,9 +58,11 @@ import ansiEscapes from 'ansi-escapes';
|
|
|
53
58
|
import { OverflowProvider } from './contexts/OverflowContext.js';
|
|
54
59
|
import { ShowMoreLines } from './components/ShowMoreLines.js';
|
|
55
60
|
import { PrivacyNotice } from './privacy/PrivacyNotice.js';
|
|
61
|
+
import { appEvents, AppEvent } from '../utils/events.js';
|
|
56
62
|
const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
|
|
57
|
-
export const AppWrapper = (props) => (_jsx(SessionStatsProvider, { children: _jsx(App, { ...props }) }));
|
|
63
|
+
export const AppWrapper = (props) => (_jsx(SessionStatsProvider, { children: _jsx(VimModeProvider, { settings: props.settings, children: _jsx(App, { ...props }) }) }));
|
|
58
64
|
const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
65
|
+
const isFocused = useFocus();
|
|
59
66
|
useBracketedPaste();
|
|
60
67
|
const [updateMessage, setUpdateMessage] = useState(null);
|
|
61
68
|
const { stdout } = useStdout();
|
|
@@ -92,6 +99,7 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
92
99
|
const [shellModeActive, setShellModeActive] = useState(false);
|
|
93
100
|
const [showErrorDetails, setShowErrorDetails] = useState(false);
|
|
94
101
|
const [showToolDescriptions, setShowToolDescriptions] = useState(false);
|
|
102
|
+
const [showIDEContextDetail, setShowIDEContextDetail] = useState(false);
|
|
95
103
|
const [ctrlCPressedOnce, setCtrlCPressedOnce] = useState(false);
|
|
96
104
|
const [quittingMessages, setQuittingMessages] = useState(null);
|
|
97
105
|
const ctrlCTimerRef = useRef(null);
|
|
@@ -101,11 +109,40 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
101
109
|
const [showPrivacyNotice, setShowPrivacyNotice] = useState(false);
|
|
102
110
|
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = useState(false);
|
|
103
111
|
const [userTier, setUserTier] = useState(undefined);
|
|
112
|
+
const [openFiles, setOpenFiles] = useState();
|
|
113
|
+
const [isProcessing, setIsProcessing] = useState(false);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
const unsubscribe = ideContext.subscribeToOpenFiles(setOpenFiles);
|
|
116
|
+
// Set the initial value
|
|
117
|
+
setOpenFiles(ideContext.getOpenFilesContext());
|
|
118
|
+
return unsubscribe;
|
|
119
|
+
}, []);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
const openDebugConsole = () => {
|
|
122
|
+
setShowErrorDetails(true);
|
|
123
|
+
setConstrainHeight(false); // Make sure the user sees the full message.
|
|
124
|
+
};
|
|
125
|
+
appEvents.on(AppEvent.OpenDebugConsole, openDebugConsole);
|
|
126
|
+
const logErrorHandler = (errorMessage) => {
|
|
127
|
+
handleNewMessage({
|
|
128
|
+
type: 'error',
|
|
129
|
+
content: String(errorMessage),
|
|
130
|
+
count: 1,
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
appEvents.on(AppEvent.LogError, logErrorHandler);
|
|
134
|
+
return () => {
|
|
135
|
+
appEvents.off(AppEvent.OpenDebugConsole, openDebugConsole);
|
|
136
|
+
appEvents.off(AppEvent.LogError, logErrorHandler);
|
|
137
|
+
};
|
|
138
|
+
}, [handleNewMessage]);
|
|
104
139
|
const openPrivacyNotice = useCallback(() => {
|
|
105
140
|
setShowPrivacyNotice(true);
|
|
106
141
|
}, []);
|
|
107
142
|
const initialPromptSubmitted = useRef(false);
|
|
108
|
-
const errorCount = useMemo(() => consoleMessages
|
|
143
|
+
const errorCount = useMemo(() => consoleMessages
|
|
144
|
+
.filter((msg) => msg.type === 'error')
|
|
145
|
+
.reduce((total, msg) => total + msg.count, 0), [consoleMessages]);
|
|
109
146
|
const { isThemeDialogOpen, openThemeDialog, handleThemeSelect, handleThemeHighlight, } = useThemeCommand(settings, setThemeError, addItem);
|
|
110
147
|
const { isAuthDialogOpen, openAuthDialog, handleAuthSelect, isAuthenticating, cancelAuthentication, } = useAuthCommand(settings, setAuthError, config);
|
|
111
148
|
useEffect(() => {
|
|
@@ -119,26 +156,11 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
119
156
|
}, [settings.merged.selectedAuthType, openAuthDialog, setAuthError]);
|
|
120
157
|
// Sync user tier from config when authentication changes
|
|
121
158
|
useEffect(() => {
|
|
122
|
-
const syncUserTier = async () => {
|
|
123
|
-
try {
|
|
124
|
-
const configUserTier = await config.getUserTier();
|
|
125
|
-
if (configUserTier !== userTier) {
|
|
126
|
-
setUserTier(configUserTier);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
// Silently fail - this is not critical functionality
|
|
131
|
-
// Only log in debug mode to avoid cluttering the console
|
|
132
|
-
if (config.getDebugMode()) {
|
|
133
|
-
console.debug('Failed to sync user tier:', error);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
159
|
// Only sync when not currently authenticating
|
|
138
160
|
if (!isAuthenticating) {
|
|
139
|
-
|
|
161
|
+
setUserTier(config.getGeminiClient()?.getUserTier());
|
|
140
162
|
}
|
|
141
|
-
}, [config,
|
|
163
|
+
}, [config, isAuthenticating]);
|
|
142
164
|
const { isEditorDialogOpen, openEditorDialog, handleEditorSelect, exitEditorDialog, } = useEditorSettings(settings, setEditorError, addItem);
|
|
143
165
|
const toggleCorgiMode = useCallback(() => {
|
|
144
166
|
setCorgiMode((prev) => !prev);
|
|
@@ -149,7 +171,7 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
149
171
|
text: 'Refreshing hierarchical memory (QWEN.md or other context files)...',
|
|
150
172
|
}, Date.now());
|
|
151
173
|
try {
|
|
152
|
-
const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory(process.cwd(), config.getDebugMode(), config.getFileService(), config.getExtensionContextFilePaths());
|
|
174
|
+
const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory(process.cwd(), config.getDebugMode(), config.getFileService(), settings.merged, config.getExtensionContextFilePaths(), config.getFileFilteringOptions());
|
|
153
175
|
config.setUserMemory(memoryContent);
|
|
154
176
|
config.setGeminiMdFileCount(fileCount);
|
|
155
177
|
setGeminiMdFileCount(fileCount);
|
|
@@ -169,7 +191,7 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
169
191
|
}, Date.now());
|
|
170
192
|
console.error('Error refreshing memory:', error);
|
|
171
193
|
}
|
|
172
|
-
}, [config, addItem]);
|
|
194
|
+
}, [config, addItem, settings.merged]);
|
|
173
195
|
// Watch for model changes (e.g., from Flash fallback)
|
|
174
196
|
useEffect(() => {
|
|
175
197
|
const checkModelChange = () => {
|
|
@@ -187,62 +209,65 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
187
209
|
useEffect(() => {
|
|
188
210
|
const flashFallbackHandler = async (currentModel, fallbackModel, error) => {
|
|
189
211
|
let message;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if
|
|
195
|
-
|
|
212
|
+
if (config.getContentGeneratorConfig().authType ===
|
|
213
|
+
AuthType.LOGIN_WITH_GOOGLE) {
|
|
214
|
+
// Use actual user tier if available; otherwise, default to FREE tier behavior (safe default)
|
|
215
|
+
const isPaidTier = userTier === UserTierId.LEGACY || userTier === UserTierId.STANDARD;
|
|
216
|
+
// Check if this is a Pro quota exceeded error
|
|
217
|
+
if (error && isProQuotaExceededError(error)) {
|
|
218
|
+
if (isPaidTier) {
|
|
219
|
+
message = `⚡ You have reached your daily ${currentModel} quota limit.
|
|
196
220
|
⚡ Automatically switching from ${currentModel} to ${fallbackModel} for the remainder of this session.
|
|
197
221
|
⚡ To continue accessing the ${currentModel} model today, consider using /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
message = `⚡ You have reached your daily ${currentModel} quota limit.
|
|
201
225
|
⚡ Automatically switching from ${currentModel} to ${fallbackModel} for the remainder of this session.
|
|
202
226
|
⚡ To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist
|
|
203
227
|
⚡ Or you can utilize a Gemini API Key. See: https://goo.gle/gemini-cli-docs-auth#gemini-api-key
|
|
204
228
|
⚡ You can switch authentication methods by typing /auth`;
|
|
229
|
+
}
|
|
205
230
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
message = `⚡ You have reached your daily quota limit.
|
|
231
|
+
else if (error && isGenericQuotaExceededError(error)) {
|
|
232
|
+
if (isPaidTier) {
|
|
233
|
+
message = `⚡ You have reached your daily quota limit.
|
|
210
234
|
⚡ Automatically switching from ${currentModel} to ${fallbackModel} for the remainder of this session.
|
|
211
235
|
⚡ To continue accessing the ${currentModel} model today, consider using /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
message = `⚡ You have reached your daily quota limit.
|
|
215
239
|
⚡ Automatically switching from ${currentModel} to ${fallbackModel} for the remainder of this session.
|
|
216
240
|
⚡ To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist
|
|
217
241
|
⚡ Or you can utilize a Gemini API Key. See: https://goo.gle/gemini-cli-docs-auth#gemini-api-key
|
|
218
242
|
⚡ You can switch authentication methods by typing /auth`;
|
|
243
|
+
}
|
|
219
244
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
message = `⚡ Automatically switching from ${currentModel} to ${fallbackModel} for faster responses for the remainder of this session.
|
|
245
|
+
else {
|
|
246
|
+
if (isPaidTier) {
|
|
247
|
+
// Default fallback message for other cases (like consecutive 429s)
|
|
248
|
+
message = `⚡ Automatically switching from ${currentModel} to ${fallbackModel} for faster responses for the remainder of this session.
|
|
225
249
|
⚡ Possible reasons for this are that you have received multiple consecutive capacity errors or you have reached your daily ${currentModel} quota limit
|
|
226
250
|
⚡ To continue accessing the ${currentModel} model today, consider using /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
// Default fallback message for other cases (like consecutive 429s)
|
|
254
|
+
message = `⚡ Automatically switching from ${currentModel} to ${fallbackModel} for faster responses for the remainder of this session.
|
|
231
255
|
⚡ Possible reasons for this are that you have received multiple consecutive capacity errors or you have reached your daily ${currentModel} quota limit
|
|
232
256
|
⚡ To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist
|
|
233
257
|
⚡ Or you can utilize a Gemini API Key. See: https://goo.gle/gemini-cli-docs-auth#gemini-api-key
|
|
234
258
|
⚡ You can switch authentication methods by typing /auth`;
|
|
259
|
+
}
|
|
235
260
|
}
|
|
261
|
+
// Add message to UI history
|
|
262
|
+
addItem({
|
|
263
|
+
type: MessageType.INFO,
|
|
264
|
+
text: message,
|
|
265
|
+
}, Date.now());
|
|
266
|
+
// Set the flag to prevent tool continuation
|
|
267
|
+
setModelSwitchedFromQuotaError(true);
|
|
268
|
+
// Set global quota error flag to prevent Flash model calls
|
|
269
|
+
config.setQuotaErrorOccurred(true);
|
|
236
270
|
}
|
|
237
|
-
// Add message to UI history
|
|
238
|
-
addItem({
|
|
239
|
-
type: MessageType.INFO,
|
|
240
|
-
text: message,
|
|
241
|
-
}, Date.now());
|
|
242
|
-
// Set the flag to prevent tool continuation
|
|
243
|
-
setModelSwitchedFromQuotaError(true);
|
|
244
|
-
// Set global quota error flag to prevent Flash model calls
|
|
245
|
-
config.setQuotaErrorOccurred(true);
|
|
246
271
|
// Switch model for future use but return false to stop current retry
|
|
247
272
|
config.setModel(fallbackModel);
|
|
248
273
|
logFlashFallback(config, new FlashFallbackEvent(config.getContentGeneratorConfig().authType));
|
|
@@ -250,11 +275,14 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
250
275
|
};
|
|
251
276
|
config.setFlashFallbackHandler(flashFallbackHandler);
|
|
252
277
|
}, [config, addItem, userTier]);
|
|
253
|
-
|
|
254
|
-
const pendingHistoryItems = [...pendingSlashCommandHistoryItems];
|
|
278
|
+
// Terminal and UI setup
|
|
255
279
|
const { rows: terminalHeight, columns: terminalWidth } = useTerminalSize();
|
|
256
|
-
const isInitialMount = useRef(true);
|
|
257
280
|
const { stdin, setRawMode } = useStdin();
|
|
281
|
+
const isInitialMount = useRef(true);
|
|
282
|
+
const widthFraction = 0.9;
|
|
283
|
+
const inputWidth = Math.max(20, Math.floor(terminalWidth * widthFraction) - 3);
|
|
284
|
+
const suggestionsWidth = Math.max(60, Math.floor(terminalWidth * 0.8));
|
|
285
|
+
// Utility callbacks
|
|
258
286
|
const isValidPath = useCallback((filePath) => {
|
|
259
287
|
try {
|
|
260
288
|
return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
|
|
@@ -263,9 +291,30 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
263
291
|
return false;
|
|
264
292
|
}
|
|
265
293
|
}, []);
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
294
|
+
const getPreferredEditor = useCallback(() => {
|
|
295
|
+
const editorType = settings.merged.preferredEditor;
|
|
296
|
+
const isValidEditor = isEditorAvailable(editorType);
|
|
297
|
+
if (!isValidEditor) {
|
|
298
|
+
openEditorDialog();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
return editorType;
|
|
302
|
+
}, [settings, openEditorDialog]);
|
|
303
|
+
const onAuthError = useCallback(() => {
|
|
304
|
+
setAuthError('reauth required');
|
|
305
|
+
openAuthDialog();
|
|
306
|
+
}, [openAuthDialog, setAuthError]);
|
|
307
|
+
// Core hooks and processors
|
|
308
|
+
const { vimEnabled: vimModeEnabled, vimMode, toggleVimEnabled, } = useVimMode();
|
|
309
|
+
const { handleSlashCommand, slashCommands, pendingHistoryItems: pendingSlashCommandHistoryItems, commandContext, shellConfirmationRequest, } = useSlashCommandProcessor(config, settings, addItem, clearItems, loadHistory, refreshStatic, setShowHelp, setDebugMessage, openThemeDialog, openAuthDialog, openEditorDialog, toggleCorgiMode, setQuittingMessages, openPrivacyNotice, toggleVimEnabled, setIsProcessing);
|
|
310
|
+
const { streamingState, submitQuery, initError, pendingHistoryItems: pendingGeminiHistoryItems, thought, } = useGeminiStream(config.getGeminiClient(), history, addItem, setShowHelp, config, setDebugMessage, handleSlashCommand, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError);
|
|
311
|
+
// Input handling
|
|
312
|
+
const handleFinalSubmit = useCallback((submittedValue) => {
|
|
313
|
+
const trimmedValue = submittedValue.trim();
|
|
314
|
+
if (trimmedValue.length > 0) {
|
|
315
|
+
submitQuery(trimmedValue);
|
|
316
|
+
}
|
|
317
|
+
}, [submitQuery]);
|
|
269
318
|
const buffer = useTextBuffer({
|
|
270
319
|
initialText: '',
|
|
271
320
|
viewport: { height: 10, width: inputWidth },
|
|
@@ -274,19 +323,18 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
274
323
|
isValidPath,
|
|
275
324
|
shellModeActive,
|
|
276
325
|
});
|
|
326
|
+
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
327
|
+
const pendingHistoryItems = [...pendingSlashCommandHistoryItems];
|
|
328
|
+
pendingHistoryItems.push(...pendingGeminiHistoryItems);
|
|
329
|
+
const { elapsedTime, currentLoadingPhrase } = useLoadingIndicator(streamingState);
|
|
330
|
+
const showAutoAcceptIndicator = useAutoAcceptIndicator({ config });
|
|
277
331
|
const handleExit = useCallback((pressedOnce, setPressedOnce, timerRef) => {
|
|
278
332
|
if (pressedOnce) {
|
|
279
333
|
if (timerRef.current) {
|
|
280
334
|
clearTimeout(timerRef.current);
|
|
281
335
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
quitCommand.action(commandContext, '');
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
// This is unlikely to be needed but added for an additional fallback.
|
|
288
|
-
process.exit(0);
|
|
289
|
-
}
|
|
336
|
+
// Directly invoke the central command handler.
|
|
337
|
+
handleSlashCommand('/quit');
|
|
290
338
|
}
|
|
291
339
|
else {
|
|
292
340
|
setPressedOnce(true);
|
|
@@ -295,9 +343,7 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
295
343
|
timerRef.current = null;
|
|
296
344
|
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
297
345
|
}
|
|
298
|
-
},
|
|
299
|
-
// Add commandContext to the dependency array here!
|
|
300
|
-
[slashCommands, commandContext]);
|
|
346
|
+
}, [handleSlashCommand]);
|
|
301
347
|
useInput((input, key) => {
|
|
302
348
|
let enteringConstrainHeightMode = false;
|
|
303
349
|
if (!constrainHeight) {
|
|
@@ -319,6 +365,9 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
319
365
|
handleSlashCommand(newValue ? '/mcp desc' : '/mcp nodesc');
|
|
320
366
|
}
|
|
321
367
|
}
|
|
368
|
+
else if (key.ctrl && input === 'e' && ideContext) {
|
|
369
|
+
setShowIDEContextDetail((prev) => !prev);
|
|
370
|
+
}
|
|
322
371
|
else if (key.ctrl && (input === 'c' || input === 'C')) {
|
|
323
372
|
handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef);
|
|
324
373
|
}
|
|
@@ -338,29 +387,6 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
338
387
|
setGeminiMdFileCount(config.getGeminiMdFileCount());
|
|
339
388
|
}
|
|
340
389
|
}, [config]);
|
|
341
|
-
const getPreferredEditor = useCallback(() => {
|
|
342
|
-
const editorType = settings.merged.preferredEditor;
|
|
343
|
-
const isValidEditor = isEditorAvailable(editorType);
|
|
344
|
-
if (!isValidEditor) {
|
|
345
|
-
openEditorDialog();
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
return editorType;
|
|
349
|
-
}, [settings, openEditorDialog]);
|
|
350
|
-
const onAuthError = useCallback(() => {
|
|
351
|
-
setAuthError('reauth required');
|
|
352
|
-
openAuthDialog();
|
|
353
|
-
}, [openAuthDialog, setAuthError]);
|
|
354
|
-
const { streamingState, submitQuery, initError, pendingHistoryItems: pendingGeminiHistoryItems, thought, } = useGeminiStream(config.getGeminiClient(), history, addItem, setShowHelp, config, setDebugMessage, handleSlashCommand, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError);
|
|
355
|
-
pendingHistoryItems.push(...pendingGeminiHistoryItems);
|
|
356
|
-
const { elapsedTime, currentLoadingPhrase } = useLoadingIndicator(streamingState);
|
|
357
|
-
const showAutoAcceptIndicator = useAutoAcceptIndicator({ config });
|
|
358
|
-
const handleFinalSubmit = useCallback((submittedValue) => {
|
|
359
|
-
const trimmedValue = submittedValue.trim();
|
|
360
|
-
if (trimmedValue.length > 0) {
|
|
361
|
-
submitQuery(trimmedValue);
|
|
362
|
-
}
|
|
363
|
-
}, [submitQuery]);
|
|
364
390
|
const logger = useLogger();
|
|
365
391
|
const [userMessages, setUserMessages] = useState([]);
|
|
366
392
|
useEffect(() => {
|
|
@@ -392,7 +418,7 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
392
418
|
};
|
|
393
419
|
fetchUserMessages();
|
|
394
420
|
}, [history, logger]);
|
|
395
|
-
const isInputActive = streamingState === StreamingState.Idle && !initError;
|
|
421
|
+
const isInputActive = streamingState === StreamingState.Idle && !initError && !isProcessing;
|
|
396
422
|
const handleClearScreen = useCallback(() => {
|
|
397
423
|
clearItems();
|
|
398
424
|
clearConsoleMessagesState();
|
|
@@ -476,13 +502,16 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
476
502
|
// Arbitrary threshold to ensure that items in the static area are large
|
|
477
503
|
// enough but not too large to make the terminal hard to use.
|
|
478
504
|
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
|
|
479
|
-
|
|
505
|
+
const placeholder = vimModeEnabled
|
|
506
|
+
? " Press 'i' for INSERT mode and 'Esc' for NORMAL mode."
|
|
507
|
+
: ' Type your message or @path/to/file';
|
|
508
|
+
return (_jsx(StreamingContext.Provider, { value: streamingState, children: _jsxs(Box, { flexDirection: "column", width: "90%", children: [updateMessage && _jsx(UpdateNotification, { message: updateMessage }), _jsx(Static, { items: [
|
|
480
509
|
_jsxs(Box, { flexDirection: "column", children: [!settings.merged.hideBanner && (_jsx(Header, { terminalWidth: terminalWidth, version: version, nightly: nightly })), !settings.merged.hideTips && _jsx(Tips, { config: config })] }, "header"),
|
|
481
510
|
...history.map((h) => (_jsx(HistoryItemDisplay, { terminalWidth: mainAreaWidth, availableTerminalHeight: staticAreaMaxItemHeight, item: h, isPending: false, config: config }, h.id))),
|
|
482
511
|
], children: (item) => item }, staticKey), _jsx(OverflowProvider, { children: _jsxs(Box, { ref: pendingHistoryItemRef, flexDirection: "column", children: [pendingHistoryItems.map((item, i) => (_jsx(HistoryItemDisplay, { availableTerminalHeight: constrainHeight ? availableTerminalHeight : undefined, terminalWidth: mainAreaWidth,
|
|
483
512
|
// TODO(taehykim): It seems like references to ids aren't necessary in
|
|
484
513
|
// HistoryItemDisplay. Refactor later. Use a fake id for now.
|
|
485
|
-
item: { ...item, id: 0 }, isPending: true, config: config, isFocused: !isEditorDialogOpen }, i))), _jsx(ShowMoreLines, { constrainHeight: constrainHeight })] }) }), showHelp && _jsx(Help, { commands: slashCommands }), _jsxs(Box, { flexDirection: "column", ref: mainControlsRef, children: [startupWarnings.length > 0 && (_jsx(Box, { borderStyle: "round", borderColor: Colors.AccentYellow, paddingX: 1, marginY: 1, flexDirection: "column", children: startupWarnings.map((warning, index) => (_jsx(Text, { color: Colors.AccentYellow, children: warning }, index))) })), isThemeDialogOpen ? (_jsxs(Box, { flexDirection: "column", children: [themeError && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: Colors.AccentRed, children: themeError }) })), _jsx(ThemeDialog, { onSelect: handleThemeSelect, onHighlight: handleThemeHighlight, settings: settings, availableTerminalHeight: constrainHeight
|
|
514
|
+
item: { ...item, id: 0 }, isPending: true, config: config, isFocused: !isEditorDialogOpen }, i))), _jsx(ShowMoreLines, { constrainHeight: constrainHeight })] }) }), showHelp && _jsx(Help, { commands: slashCommands }), _jsxs(Box, { flexDirection: "column", ref: mainControlsRef, children: [startupWarnings.length > 0 && (_jsx(Box, { borderStyle: "round", borderColor: Colors.AccentYellow, paddingX: 1, marginY: 1, flexDirection: "column", children: startupWarnings.map((warning, index) => (_jsx(Text, { color: Colors.AccentYellow, children: warning }, index))) })), shellConfirmationRequest ? (_jsx(ShellConfirmationDialog, { request: shellConfirmationRequest })) : isThemeDialogOpen ? (_jsxs(Box, { flexDirection: "column", children: [themeError && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: Colors.AccentRed, children: themeError }) })), _jsx(ThemeDialog, { onSelect: handleThemeSelect, onHighlight: handleThemeHighlight, settings: settings, availableTerminalHeight: constrainHeight
|
|
486
515
|
? terminalHeight - staticExtraHeight
|
|
487
516
|
: undefined, terminalWidth: mainAreaWidth })] })) : isAuthenticating ? (_jsxs(_Fragment, { children: [_jsx(AuthInProgress, { onTimeout: () => {
|
|
488
517
|
setAuthError('Authentication timed out. Please try again.');
|
|
@@ -493,7 +522,7 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
493
522
|
? undefined
|
|
494
523
|
: thought, currentLoadingPhrase: config.getAccessibility()?.disableLoadingPhrases
|
|
495
524
|
? undefined
|
|
496
|
-
: currentLoadingPhrase, elapsedTime: elapsedTime }), _jsxs(Box, { marginTop: 1, display: "flex", justifyContent: "space-between", width: "100%", children: [_jsxs(Box, { children: [process.env.GEMINI_SYSTEM_MD && (_jsx(Text, { color: Colors.AccentRed, children: "|\u2310\u25A0_\u25A0| " })), ctrlCPressedOnce ? (_jsx(Text, { color: Colors.AccentYellow, children: "Press Ctrl+C again to exit." })) : ctrlDPressedOnce ? (_jsx(Text, { color: Colors.AccentYellow, children: "Press Ctrl+D again to exit." })) : (_jsx(ContextSummaryDisplay, { geminiMdFileCount: geminiMdFileCount, contextFileNames: contextFileNames, mcpServers: config.getMcpServers(), showToolDescriptions: showToolDescriptions }))] }), _jsxs(Box, { children: [showAutoAcceptIndicator !== ApprovalMode.DEFAULT &&
|
|
497
|
-
!shellModeActive && (_jsx(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator })), shellModeActive && _jsx(ShellModeIndicator, {})] })] }), showErrorDetails && (_jsx(OverflowProvider, { children: _jsxs(Box, { flexDirection: "column", children: [_jsx(DetailedMessagesDisplay, { messages: filteredConsoleMessages, maxHeight: constrainHeight ? debugConsoleMaxHeight : undefined, width: inputWidth }), _jsx(ShowMoreLines, { constrainHeight: constrainHeight })] }) })), isInputActive && (_jsx(InputPrompt, { buffer: buffer, inputWidth: inputWidth, suggestionsWidth: suggestionsWidth, onSubmit: handleFinalSubmit, userMessages: userMessages, onClearScreen: handleClearScreen, config: config, slashCommands: slashCommands, commandContext: commandContext, shellModeActive: shellModeActive, setShellModeActive: setShellModeActive }))] })), initError && streamingState !== StreamingState.Responding && (_jsx(Box, { borderStyle: "round", borderColor: Colors.AccentRed, paddingX: 1, marginBottom: 1, children: history.find((item) => item.type === 'error' && item.text?.includes(initError))?.text ? (_jsx(Text, { color: Colors.AccentRed, children: history.find((item) => item.type === 'error' && item.text?.includes(initError))?.text })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { color: Colors.AccentRed, children: ["Initialization Error: ", initError] }), _jsxs(Text, { color: Colors.AccentRed, children: [' ', "Please check API key and configuration."] })] })) })), _jsx(Footer, { model: currentModel, targetDir: config.getTargetDir(), debugMode: config.getDebugMode(), branchName: branchName, debugMessage: debugMessage, corgiMode: corgiMode, errorCount: errorCount, showErrorDetails: showErrorDetails, showMemoryUsage: config.getDebugMode() || config.getShowMemoryUsage(), promptTokenCount: sessionStats.lastPromptTokenCount, nightly: nightly })] })] }) }));
|
|
525
|
+
: currentLoadingPhrase, elapsedTime: elapsedTime }), _jsxs(Box, { marginTop: 1, display: "flex", justifyContent: "space-between", width: "100%", children: [_jsxs(Box, { children: [process.env.GEMINI_SYSTEM_MD && (_jsx(Text, { color: Colors.AccentRed, children: "|\u2310\u25A0_\u25A0| " })), ctrlCPressedOnce ? (_jsx(Text, { color: Colors.AccentYellow, children: "Press Ctrl+C again to exit." })) : ctrlDPressedOnce ? (_jsx(Text, { color: Colors.AccentYellow, children: "Press Ctrl+D again to exit." })) : (_jsx(ContextSummaryDisplay, { openFiles: openFiles, geminiMdFileCount: geminiMdFileCount, contextFileNames: contextFileNames, mcpServers: config.getMcpServers(), blockedMcpServers: config.getBlockedMcpServers(), showToolDescriptions: showToolDescriptions }))] }), _jsxs(Box, { children: [showAutoAcceptIndicator !== ApprovalMode.DEFAULT &&
|
|
526
|
+
!shellModeActive && (_jsx(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator })), shellModeActive && _jsx(ShellModeIndicator, {})] })] }), showIDEContextDetail && (_jsx(IDEContextDetailDisplay, { openFiles: openFiles })), showErrorDetails && (_jsx(OverflowProvider, { children: _jsxs(Box, { flexDirection: "column", children: [_jsx(DetailedMessagesDisplay, { messages: filteredConsoleMessages, maxHeight: constrainHeight ? debugConsoleMaxHeight : undefined, width: inputWidth }), _jsx(ShowMoreLines, { constrainHeight: constrainHeight })] }) })), isInputActive && (_jsx(InputPrompt, { buffer: buffer, inputWidth: inputWidth, suggestionsWidth: suggestionsWidth, onSubmit: handleFinalSubmit, userMessages: userMessages, onClearScreen: handleClearScreen, config: config, slashCommands: slashCommands, commandContext: commandContext, shellModeActive: shellModeActive, setShellModeActive: setShellModeActive, focus: isFocused, vimHandleInput: vimHandleInput, placeholder: placeholder }))] })), initError && streamingState !== StreamingState.Responding && (_jsx(Box, { borderStyle: "round", borderColor: Colors.AccentRed, paddingX: 1, marginBottom: 1, children: history.find((item) => item.type === 'error' && item.text?.includes(initError))?.text ? (_jsx(Text, { color: Colors.AccentRed, children: history.find((item) => item.type === 'error' && item.text?.includes(initError))?.text })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { color: Colors.AccentRed, children: ["Initialization Error: ", initError] }), _jsxs(Text, { color: Colors.AccentRed, children: [' ', "Please check API key and configuration."] })] })) })), _jsx(Footer, { model: currentModel, targetDir: config.getTargetDir(), debugMode: config.getDebugMode(), branchName: branchName, debugMessage: debugMessage, corgiMode: corgiMode, errorCount: errorCount, showErrorDetails: showErrorDetails, showMemoryUsage: config.getDebugMode() || config.getShowMemoryUsage(), promptTokenCount: sessionStats.lastPromptTokenCount, nightly: nightly, vimMode: vimModeEnabled ? vimMode : undefined })] })] }) }));
|
|
498
527
|
};
|
|
499
528
|
//# sourceMappingURL=App.js.map
|