@google/gemini-cli 0.1.1 → 0.1.3-rc.0
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/README.md +7 -6
- package/dist/.last_build +0 -0
- package/dist/google-gemini-cli-0.1.3.tgz +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +77 -0
- package/dist/src/config/auth.d.ts +6 -0
- package/dist/src/config/auth.js +38 -0
- package/dist/src/config/auth.js.map +1 -0
- package/dist/src/config/config.d.ts +14 -0
- package/dist/src/config/config.js +225 -0
- package/dist/src/config/config.js.map +1 -0
- package/dist/src/config/extension.d.ts +19 -0
- package/dist/src/config/extension.js +81 -0
- package/dist/src/config/extension.js.map +1 -0
- package/dist/src/config/sandboxConfig.d.ts +13 -0
- package/dist/src/config/sandboxConfig.js +75 -0
- package/dist/src/config/sandboxConfig.js.map +1 -0
- package/dist/src/config/settings.d.ts +69 -0
- package/dist/src/config/settings.js +165 -0
- package/dist/src/config/settings.js.map +1 -0
- package/dist/src/gemini.d.ts +6 -0
- package/dist/src/gemini.js +212 -0
- package/dist/src/gemini.js.map +1 -0
- package/dist/src/gemini.test.d.ts +6 -0
- package/dist/src/gemini.test.js +122 -0
- package/dist/src/gemini.test.js.map +1 -0
- package/dist/src/generated/git-commit.d.ts +6 -0
- package/dist/src/generated/git-commit.js +9 -0
- package/dist/src/generated/git-commit.js.map +1 -0
- package/dist/src/nonInteractiveCli.d.ts +7 -0
- package/dist/src/nonInteractiveCli.js +112 -0
- package/dist/src/nonInteractiveCli.js.map +1 -0
- package/dist/src/ui/App.d.ts +14 -0
- package/dist/src/ui/App.js +398 -0
- package/dist/src/ui/App.js.map +1 -0
- package/dist/src/ui/App.test.d.ts +6 -0
- package/dist/src/ui/App.test.js +280 -0
- package/dist/src/ui/App.test.js.map +1 -0
- package/dist/src/ui/colors.d.ts +7 -0
- package/dist/src/ui/colors.js +48 -0
- package/dist/src/ui/colors.js.map +1 -0
- package/dist/src/ui/components/AboutBox.d.ts +14 -0
- package/dist/src/ui/components/AboutBox.js +6 -0
- package/dist/src/ui/components/AboutBox.js.map +1 -0
- package/dist/src/ui/components/AsciiArt.d.ts +7 -0
- package/dist/src/ui/components/AsciiArt.js +26 -0
- package/dist/src/ui/components/AsciiArt.js.map +1 -0
- package/dist/src/ui/components/AuthDialog.d.ts +15 -0
- package/dist/src/ui/components/AuthDialog.js +67 -0
- package/dist/src/ui/components/AuthDialog.js.map +1 -0
- package/dist/src/ui/components/AuthDialog.test.d.ts +6 -0
- package/dist/src/ui/components/AuthDialog.test.js +69 -0
- package/dist/src/ui/components/AuthDialog.test.js.map +1 -0
- package/dist/src/ui/components/AuthInProgress.d.ts +11 -0
- package/dist/src/ui/components/AuthInProgress.js +27 -0
- package/dist/src/ui/components/AuthInProgress.js.map +1 -0
- package/dist/src/ui/components/AutoAcceptIndicator.d.ts +12 -0
- package/dist/src/ui/components/AutoAcceptIndicator.js +26 -0
- package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -0
- package/dist/src/ui/components/ConsolePatcher.d.ts +12 -0
- package/dist/src/ui/components/ConsolePatcher.js +40 -0
- package/dist/src/ui/components/ConsolePatcher.js.map +1 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +11 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.js +11 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -0
- package/dist/src/ui/components/ContextSummaryDisplay.d.ts +15 -0
- package/dist/src/ui/components/ContextSummaryDisplay.js +41 -0
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -0
- package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +14 -0
- package/dist/src/ui/components/DetailedMessagesDisplay.js +34 -0
- package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -0
- package/dist/src/ui/components/EditorSettingsDialog.d.ts +15 -0
- package/dist/src/ui/components/EditorSettingsDialog.js +73 -0
- package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -0
- package/dist/src/ui/components/Footer.d.ts +22 -0
- package/dist/src/ui/components/Footer.js +13 -0
- package/dist/src/ui/components/Footer.js.map +1 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +17 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.js +16 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -0
- package/dist/src/ui/components/Header.d.ts +12 -0
- package/dist/src/ui/components/Header.js +20 -0
- package/dist/src/ui/components/Header.js.map +1 -0
- package/dist/src/ui/components/Help.d.ts +12 -0
- package/dist/src/ui/components/Help.js +7 -0
- package/dist/src/ui/components/Help.js.map +1 -0
- package/dist/src/ui/components/HistoryItemDisplay.d.ts +18 -0
- package/dist/src/ui/components/HistoryItemDisplay.js +15 -0
- package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -0
- package/dist/src/ui/components/HistoryItemDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/HistoryItemDisplay.test.js +85 -0
- package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.d.ts +24 -0
- package/dist/src/ui/components/InputPrompt.js +313 -0
- package/dist/src/ui/components/InputPrompt.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.test.d.ts +6 -0
- package/dist/src/ui/components/InputPrompt.test.js +154 -0
- package/dist/src/ui/components/InputPrompt.test.js.map +1 -0
- package/dist/src/ui/components/LoadingIndicator.d.ts +15 -0
- package/dist/src/ui/components/LoadingIndicator.js +19 -0
- package/dist/src/ui/components/LoadingIndicator.js.map +1 -0
- package/dist/src/ui/components/LoadingIndicator.test.d.ts +6 -0
- package/dist/src/ui/components/LoadingIndicator.test.js +141 -0
- package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -0
- package/dist/src/ui/components/MemoryUsageDisplay.d.ts +7 -0
- package/dist/src/ui/components/MemoryUsageDisplay.js +27 -0
- package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -0
- package/dist/src/ui/components/SessionSummaryDisplay.d.ts +13 -0
- package/dist/src/ui/components/SessionSummaryDisplay.js +20 -0
- package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.js +41 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +1 -0
- package/dist/src/ui/components/ShellModeIndicator.d.ts +7 -0
- package/dist/src/ui/components/ShellModeIndicator.js +5 -0
- package/dist/src/ui/components/ShellModeIndicator.js.map +1 -0
- package/dist/src/ui/components/ShowMoreLines.d.ts +10 -0
- package/dist/src/ui/components/ShowMoreLines.js +24 -0
- package/dist/src/ui/components/ShowMoreLines.js.map +1 -0
- package/dist/src/ui/components/Stats.d.ts +39 -0
- package/dist/src/ui/components/Stats.js +23 -0
- package/dist/src/ui/components/Stats.js.map +1 -0
- package/dist/src/ui/components/Stats.test.d.ts +6 -0
- package/dist/src/ui/components/Stats.test.js +57 -0
- package/dist/src/ui/components/Stats.test.js.map +1 -0
- package/dist/src/ui/components/StatsDisplay.d.ts +14 -0
- package/dist/src/ui/components/StatsDisplay.js +28 -0
- package/dist/src/ui/components/StatsDisplay.js.map +1 -0
- package/dist/src/ui/components/StatsDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/StatsDisplay.test.js +51 -0
- package/dist/src/ui/components/StatsDisplay.test.js.map +1 -0
- package/dist/src/ui/components/SuggestionsDisplay.d.ts +21 -0
- package/dist/src/ui/components/SuggestionsDisplay.js +32 -0
- package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -0
- package/dist/src/ui/components/ThemeDialog.d.ts +19 -0
- package/dist/src/ui/components/ThemeDialog.js +126 -0
- package/dist/src/ui/components/ThemeDialog.js.map +1 -0
- package/dist/src/ui/components/Tips.d.ts +12 -0
- package/dist/src/ui/components/Tips.js +8 -0
- package/dist/src/ui/components/Tips.js.map +1 -0
- package/dist/src/ui/components/UpdateNotification.d.ts +10 -0
- package/dist/src/ui/components/UpdateNotification.js +10 -0
- package/dist/src/ui/components/UpdateNotification.js.map +1 -0
- package/dist/src/ui/components/messages/CompressionMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/CompressionMessage.js +16 -0
- package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -0
- package/dist/src/ui/components/messages/DiffRenderer.d.ts +15 -0
- package/dist/src/ui/components/messages/DiffRenderer.js +212 -0
- package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -0
- package/dist/src/ui/components/messages/DiffRenderer.test.d.ts +6 -0
- package/dist/src/ui/components/messages/DiffRenderer.test.js +239 -0
- package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -0
- package/dist/src/ui/components/messages/ErrorMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/ErrorMessage.js +9 -0
- package/dist/src/ui/components/messages/ErrorMessage.js.map +1 -0
- package/dist/src/ui/components/messages/GeminiMessage.d.ts +14 -0
- package/dist/src/ui/components/messages/GeminiMessage.js +10 -0
- package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -0
- package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +14 -0
- package/dist/src/ui/components/messages/GeminiMessageContent.js +15 -0
- package/dist/src/ui/components/messages/GeminiMessageContent.js.map +1 -0
- package/dist/src/ui/components/messages/InfoMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/InfoMessage.js +9 -0
- package/dist/src/ui/components/messages/InfoMessage.js.map +1 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +15 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +111 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +37 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +18 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.js +53 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -0
- package/dist/src/ui/components/messages/ToolMessage.d.ts +15 -0
- package/dist/src/ui/components/messages/ToolMessage.js +61 -0
- package/dist/src/ui/components/messages/ToolMessage.js.map +1 -0
- package/dist/src/ui/components/messages/ToolMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolMessage.test.js +116 -0
- package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/UserMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/UserMessage.js +9 -0
- package/dist/src/ui/components/messages/UserMessage.js.map +1 -0
- package/dist/src/ui/components/messages/UserShellMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/UserShellMessage.js +9 -0
- package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -0
- package/dist/src/ui/components/shared/MaxSizedBox.d.ts +61 -0
- package/dist/src/ui/components/shared/MaxSizedBox.js +383 -0
- package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -0
- package/dist/src/ui/components/shared/MaxSizedBox.test.d.ts +6 -0
- package/dist/src/ui/components/shared/MaxSizedBox.test.js +134 -0
- package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +41 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.js +52 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -0
- package/dist/src/ui/components/shared/text-buffer.d.ts +121 -0
- package/dist/src/ui/components/shared/text-buffer.js +1147 -0
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -0
- package/dist/src/ui/constants.d.ts +8 -0
- package/dist/src/ui/constants.js +12 -0
- package/dist/src/ui/constants.js.map +1 -0
- package/dist/src/ui/contexts/OverflowContext.d.ts +19 -0
- package/dist/src/ui/contexts/OverflowContext.js +43 -0
- package/dist/src/ui/contexts/OverflowContext.js.map +1 -0
- package/dist/src/ui/contexts/SessionContext.d.ts +35 -0
- package/dist/src/ui/contexts/SessionContext.js +132 -0
- package/dist/src/ui/contexts/SessionContext.js.map +1 -0
- package/dist/src/ui/contexts/SessionContext.test.d.ts +6 -0
- package/dist/src/ui/contexts/SessionContext.test.js +151 -0
- package/dist/src/ui/contexts/SessionContext.test.js.map +1 -0
- package/dist/src/ui/contexts/StreamingContext.d.ts +9 -0
- package/dist/src/ui/contexts/StreamingContext.js +15 -0
- package/dist/src/ui/contexts/StreamingContext.js.map +1 -0
- package/dist/src/ui/editors/editorSettingsManager.d.ts +19 -0
- package/dist/src/ui/editors/editorSettingsManager.js +50 -0
- package/dist/src/ui/editors/editorSettingsManager.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.d.ts +31 -0
- package/dist/src/ui/hooks/atCommandProcessor.js +312 -0
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.d.ts +16 -0
- package/dist/src/ui/hooks/shellCommandProcessor.js +261 -0
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -0
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +31 -0
- package/dist/src/ui/hooks/slashCommandProcessor.js +922 -0
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -0
- package/dist/src/ui/hooks/useAuthCommand.d.ts +15 -0
- package/dist/src/ui/hooks/useAuthCommand.js +65 -0
- package/dist/src/ui/hooks/useAuthCommand.js.map +1 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +10 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js +37 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -0
- package/dist/src/ui/hooks/useCompletion.d.ts +21 -0
- package/dist/src/ui/hooks/useCompletion.js +321 -0
- package/dist/src/ui/hooks/useCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useConsoleMessages.d.ts +12 -0
- package/dist/src/ui/hooks/useConsoleMessages.js +59 -0
- package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -0
- package/dist/src/ui/hooks/useEditorSettings.d.ts +16 -0
- package/dist/src/ui/hooks/useEditorSettings.js +43 -0
- package/dist/src/ui/hooks/useEditorSettings.js.map +1 -0
- package/dist/src/ui/hooks/useGeminiStream.d.ts +23 -0
- package/dist/src/ui/hooks/useGeminiStream.js +552 -0
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -0
- package/dist/src/ui/hooks/useGeminiStream.test.d.ts +6 -0
- package/dist/src/ui/hooks/useGeminiStream.test.js +823 -0
- package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -0
- package/dist/src/ui/hooks/useGitBranchName.d.ts +6 -0
- package/dist/src/ui/hooks/useGitBranchName.js +61 -0
- package/dist/src/ui/hooks/useGitBranchName.js.map +1 -0
- package/dist/src/ui/hooks/useHistoryManager.d.ts +22 -0
- package/dist/src/ui/hooks/useHistoryManager.js +72 -0
- package/dist/src/ui/hooks/useHistoryManager.js.map +1 -0
- package/dist/src/ui/hooks/useInputHistory.d.ts +19 -0
- package/dist/src/ui/hooks/useInputHistory.js +84 -0
- package/dist/src/ui/hooks/useInputHistory.js.map +1 -0
- package/dist/src/ui/hooks/useLoadingIndicator.d.ts +10 -0
- package/dist/src/ui/hooks/useLoadingIndicator.js +44 -0
- package/dist/src/ui/hooks/useLoadingIndicator.js.map +1 -0
- package/dist/src/ui/hooks/useLogger.d.ts +10 -0
- package/dist/src/ui/hooks/useLogger.js +29 -0
- package/dist/src/ui/hooks/useLogger.js.map +1 -0
- package/dist/src/ui/hooks/usePhraseCycler.d.ts +14 -0
- package/dist/src/ui/hooks/usePhraseCycler.js +189 -0
- package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -0
- package/dist/src/ui/hooks/useReactToolScheduler.d.ts +33 -0
- package/dist/src/ui/hooks/useReactToolScheduler.js +186 -0
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -0
- package/dist/src/ui/hooks/useRefreshMemoryCommand.d.ts +6 -0
- package/dist/src/ui/hooks/useRefreshMemoryCommand.js +7 -0
- package/dist/src/ui/hooks/useRefreshMemoryCommand.js.map +1 -0
- package/dist/src/ui/hooks/useShellHistory.d.ts +11 -0
- package/dist/src/ui/hooks/useShellHistory.js +89 -0
- package/dist/src/ui/hooks/useShellHistory.js.map +1 -0
- package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +9 -0
- package/dist/src/ui/hooks/useShowMemoryCommand.js +58 -0
- package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -0
- package/dist/src/ui/hooks/useStateAndRef.d.ts +7 -0
- package/dist/src/ui/hooks/useStateAndRef.js +26 -0
- package/dist/src/ui/hooks/useStateAndRef.js.map +1 -0
- package/dist/src/ui/hooks/useTerminalSize.d.ts +9 -0
- package/dist/src/ui/hooks/useTerminalSize.js +27 -0
- package/dist/src/ui/hooks/useTerminalSize.js.map +1 -0
- package/dist/src/ui/hooks/useThemeCommand.d.ts +15 -0
- package/dist/src/ui/hooks/useThemeCommand.js +78 -0
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -0
- package/dist/src/ui/hooks/useTimer.d.ts +12 -0
- package/dist/src/ui/hooks/useTimer.js +58 -0
- package/dist/src/ui/hooks/useTimer.js.map +1 -0
- package/dist/src/ui/themes/ansi-light.d.ts +7 -0
- package/dist/src/ui/themes/ansi-light.js +139 -0
- package/dist/src/ui/themes/ansi-light.js.map +1 -0
- package/dist/src/ui/themes/ansi.d.ts +7 -0
- package/dist/src/ui/themes/ansi.js +149 -0
- package/dist/src/ui/themes/ansi.js.map +1 -0
- package/dist/src/ui/themes/atom-one-dark.d.ts +7 -0
- package/dist/src/ui/themes/atom-one-dark.js +136 -0
- package/dist/src/ui/themes/atom-one-dark.js.map +1 -0
- package/dist/src/ui/themes/ayu-light.d.ts +7 -0
- package/dist/src/ui/themes/ayu-light.js +128 -0
- package/dist/src/ui/themes/ayu-light.js.map +1 -0
- package/dist/src/ui/themes/ayu.d.ts +7 -0
- package/dist/src/ui/themes/ayu.js +102 -0
- package/dist/src/ui/themes/ayu.js.map +1 -0
- package/dist/src/ui/themes/default-light.d.ts +7 -0
- package/dist/src/ui/themes/default-light.js +100 -0
- package/dist/src/ui/themes/default-light.js.map +1 -0
- package/dist/src/ui/themes/default.d.ts +7 -0
- package/dist/src/ui/themes/default.js +143 -0
- package/dist/src/ui/themes/default.js.map +1 -0
- package/dist/src/ui/themes/dracula.d.ts +7 -0
- package/dist/src/ui/themes/dracula.js +113 -0
- package/dist/src/ui/themes/dracula.js.map +1 -0
- package/dist/src/ui/themes/github-dark.d.ts +7 -0
- package/dist/src/ui/themes/github-dark.js +136 -0
- package/dist/src/ui/themes/github-dark.js.map +1 -0
- package/dist/src/ui/themes/github-light.d.ts +7 -0
- package/dist/src/ui/themes/github-light.js +138 -0
- package/dist/src/ui/themes/github-light.js.map +1 -0
- package/dist/src/ui/themes/googlecode.d.ts +7 -0
- package/dist/src/ui/themes/googlecode.js +135 -0
- package/dist/src/ui/themes/googlecode.js.map +1 -0
- package/dist/src/ui/themes/no-color.d.ts +7 -0
- package/dist/src/ui/themes/no-color.js +84 -0
- package/dist/src/ui/themes/no-color.js.map +1 -0
- package/dist/src/ui/themes/theme-manager.d.ts +33 -0
- package/dist/src/ui/themes/theme-manager.js +107 -0
- package/dist/src/ui/themes/theme-manager.js.map +1 -0
- package/dist/src/ui/themes/theme.d.ts +67 -0
- package/dist/src/ui/themes/theme.js +304 -0
- package/dist/src/ui/themes/theme.js.map +1 -0
- package/dist/src/ui/themes/xcode.d.ts +7 -0
- package/dist/src/ui/themes/xcode.js +143 -0
- package/dist/src/ui/themes/xcode.js.map +1 -0
- package/dist/src/ui/types.d.ts +149 -0
- package/dist/src/ui/types.js +41 -0
- package/dist/src/ui/types.js.map +1 -0
- package/dist/src/ui/utils/CodeColorizer.d.ts +14 -0
- package/dist/src/ui/utils/CodeColorizer.js +97 -0
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -0
- package/dist/src/ui/utils/MarkdownDisplay.d.ts +14 -0
- package/dist/src/ui/utils/MarkdownDisplay.js +221 -0
- package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -0
- package/dist/src/ui/utils/commandUtils.d.ts +22 -0
- package/dist/src/ui/utils/commandUtils.js +25 -0
- package/dist/src/ui/utils/commandUtils.js.map +1 -0
- package/dist/src/ui/utils/errorParsing.d.ts +15 -0
- package/dist/src/ui/utils/errorParsing.js +80 -0
- package/dist/src/ui/utils/errorParsing.js.map +1 -0
- package/dist/src/ui/utils/formatters.d.ts +13 -0
- package/dist/src/ui/utils/formatters.js +56 -0
- package/dist/src/ui/utils/formatters.js.map +1 -0
- package/dist/src/ui/utils/markdownUtilities.d.ts +6 -0
- package/dist/src/ui/utils/markdownUtilities.js +110 -0
- package/dist/src/ui/utils/markdownUtilities.js.map +1 -0
- package/dist/src/ui/utils/textUtils.d.ts +22 -0
- package/dist/src/ui/utils/textUtils.js +58 -0
- package/dist/src/ui/utils/textUtils.js.map +1 -0
- package/dist/src/ui/utils/updateCheck.d.ts +6 -0
- package/dist/src/ui/utils/updateCheck.js +34 -0
- package/dist/src/ui/utils/updateCheck.js.map +1 -0
- package/dist/src/utils/cleanup.d.ts +6 -0
- package/dist/src/utils/cleanup.js +19 -0
- package/dist/src/utils/cleanup.js.map +1 -0
- package/dist/src/utils/package.d.ts +12 -0
- package/dist/src/utils/package.js +24 -0
- package/dist/src/utils/package.js.map +1 -0
- package/dist/src/utils/readStdin.d.ts +6 -0
- package/dist/src/utils/readStdin.js +34 -0
- package/dist/src/utils/readStdin.js.map +1 -0
- package/dist/src/utils/sandbox.d.ts +7 -0
- package/dist/src/utils/sandbox.js +680 -0
- package/dist/src/utils/sandbox.js.map +1 -0
- package/dist/src/utils/startupWarnings.d.ts +6 -0
- package/dist/src/utils/startupWarnings.js +40 -0
- package/dist/src/utils/startupWarnings.js.map +1 -0
- package/dist/src/utils/version.d.ts +6 -0
- package/dist/src/utils/version.js +11 -0
- package/dist/src/utils/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -71
- package/LICENSE +0 -202
- package/bundle/gemini.js +0 -257368
- package/bundle/shell.json +0 -18
- package/bundle/shell.md +0 -16
- /package/{bundle → dist/src/utils}/sandbox-macos-permissive-closed.sb +0 -0
- /package/{bundle → dist/src/utils}/sandbox-macos-permissive-open.sb +0 -0
- /package/{bundle → dist/src/utils}/sandbox-macos-permissive-proxied.sb +0 -0
- /package/{bundle → dist/src/utils}/sandbox-macos-restrictive-closed.sb +0 -0
- /package/{bundle → dist/src/utils}/sandbox-macos-restrictive-open.sb +0 -0
- /package/{bundle → dist/src/utils}/sandbox-macos-restrictive-proxied.sb +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { AuthType } from '@google/gemini-cli-core';
|
|
7
|
+
const RATE_LIMIT_ERROR_MESSAGE_GOOGLE = '\nPlease wait and try again later. To increase your limits, upgrade to a plan with higher limits, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey';
|
|
8
|
+
const RATE_LIMIT_ERROR_MESSAGE_USE_GEMINI = '\nPlease wait and try again later. To increase your limits, request a quota increase through AI Studio, or switch to another /auth method';
|
|
9
|
+
const RATE_LIMIT_ERROR_MESSAGE_VERTEX = '\nPlease wait and try again later. To increase your limits, request a quota increase through Vertex, or switch to another /auth method';
|
|
10
|
+
const RATE_LIMIT_ERROR_MESSAGE_DEFAULT = 'Your request has been rate limited. Please wait and try again later.';
|
|
11
|
+
function isApiError(error) {
|
|
12
|
+
return (typeof error === 'object' &&
|
|
13
|
+
error !== null &&
|
|
14
|
+
'error' in error &&
|
|
15
|
+
typeof error.error === 'object' &&
|
|
16
|
+
'message' in error.error);
|
|
17
|
+
}
|
|
18
|
+
function isStructuredError(error) {
|
|
19
|
+
return (typeof error === 'object' &&
|
|
20
|
+
error !== null &&
|
|
21
|
+
'message' in error &&
|
|
22
|
+
typeof error.message === 'string');
|
|
23
|
+
}
|
|
24
|
+
function getRateLimitMessage(authType) {
|
|
25
|
+
switch (authType) {
|
|
26
|
+
case AuthType.LOGIN_WITH_GOOGLE_PERSONAL:
|
|
27
|
+
case AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE:
|
|
28
|
+
return RATE_LIMIT_ERROR_MESSAGE_GOOGLE;
|
|
29
|
+
case AuthType.USE_GEMINI:
|
|
30
|
+
return RATE_LIMIT_ERROR_MESSAGE_USE_GEMINI;
|
|
31
|
+
case AuthType.USE_VERTEX_AI:
|
|
32
|
+
return RATE_LIMIT_ERROR_MESSAGE_VERTEX;
|
|
33
|
+
default:
|
|
34
|
+
return RATE_LIMIT_ERROR_MESSAGE_DEFAULT;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function parseAndFormatApiError(error, authType) {
|
|
38
|
+
if (isStructuredError(error)) {
|
|
39
|
+
let text = `[API Error: ${error.message}]`;
|
|
40
|
+
if (error.status === 429) {
|
|
41
|
+
text += getRateLimitMessage(authType);
|
|
42
|
+
}
|
|
43
|
+
return text;
|
|
44
|
+
}
|
|
45
|
+
// The error message might be a string containing a JSON object.
|
|
46
|
+
if (typeof error === 'string') {
|
|
47
|
+
const jsonStart = error.indexOf('{');
|
|
48
|
+
if (jsonStart === -1) {
|
|
49
|
+
return `[API Error: ${error}]`; // Not a JSON error, return as is.
|
|
50
|
+
}
|
|
51
|
+
const jsonString = error.substring(jsonStart);
|
|
52
|
+
try {
|
|
53
|
+
const parsedError = JSON.parse(jsonString);
|
|
54
|
+
if (isApiError(parsedError)) {
|
|
55
|
+
let finalMessage = parsedError.error.message;
|
|
56
|
+
try {
|
|
57
|
+
// See if the message is a stringified JSON with another error
|
|
58
|
+
const nestedError = JSON.parse(finalMessage);
|
|
59
|
+
if (isApiError(nestedError)) {
|
|
60
|
+
finalMessage = nestedError.error.message;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (_e) {
|
|
64
|
+
// It's not a nested JSON error, so we just use the message as is.
|
|
65
|
+
}
|
|
66
|
+
let text = `[API Error: ${finalMessage} (Status: ${parsedError.error.status})]`;
|
|
67
|
+
if (parsedError.error.code === 429) {
|
|
68
|
+
text += getRateLimitMessage(authType);
|
|
69
|
+
}
|
|
70
|
+
return text;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (_e) {
|
|
74
|
+
// Not a valid JSON, fall through and return the original message.
|
|
75
|
+
}
|
|
76
|
+
return `[API Error: ${error}]`;
|
|
77
|
+
}
|
|
78
|
+
return '[API Error: An unknown error occurred.]';
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=errorParsing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorParsing.js","sourceRoot":"","sources":["../../../../src/ui/utils/errorParsing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MAAM,yBAAyB,CAAC;AAEpE,MAAM,+BAA+B,GACnC,uMAAuM,CAAC;AAC1M,MAAM,mCAAmC,GACvC,2IAA2I,CAAC;AAC9I,MAAM,+BAA+B,GACnC,wIAAwI,CAAC;AAC3I,MAAM,gCAAgC,GACpC,sEAAsE,CAAC;AAWzE,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAO,IAAI,KAAK;QAChB,OAAQ,KAAkB,CAAC,KAAK,KAAK,QAAQ;QAC7C,SAAS,IAAK,KAAkB,CAAC,KAAK,CACvC,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAQ,KAAyB,CAAC,OAAO,KAAK,Q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,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAY,CAAC;oBACxD,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;wBAC5B,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC;oBAC3C,CAAC;gBACH,CAAC;gBAAC,OAAO,EAAE,EAAE,CAAC;oBACZ,kEAAkE;gBACpE,CAAC;gBACD,IAAI,IAAI,GAAG,eAAe,YAAY,aAAa,WAAW,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC;gBAChF,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACnC,IAAI,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAC;gBACxC,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,kEAAkE;QACpE,CAAC;QACD,OAAO,eAAe,KAAK,GAAG,CAAC;IACjC,CAAC;IAED,OAAO,yCAAyC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatMemoryUsage: (bytes: number) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Formats a duration in milliseconds into a concise, human-readable string (e.g., "1h 5s").
|
|
9
|
+
* It omits any time units that are zero.
|
|
10
|
+
* @param milliseconds The duration in milliseconds.
|
|
11
|
+
* @returns A formatted string representing the duration.
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatDuration: (milliseconds: number) => string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export const formatMemoryUsage = (bytes) => {
|
|
7
|
+
const gb = bytes / (1024 * 1024 * 1024);
|
|
8
|
+
if (bytes < 1024 * 1024) {
|
|
9
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
10
|
+
}
|
|
11
|
+
if (bytes < 1024 * 1024 * 1024) {
|
|
12
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
13
|
+
}
|
|
14
|
+
return `${gb.toFixed(2)} GB`;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Formats a duration in milliseconds into a concise, human-readable string (e.g., "1h 5s").
|
|
18
|
+
* It omits any time units that are zero.
|
|
19
|
+
* @param milliseconds The duration in milliseconds.
|
|
20
|
+
* @returns A formatted string representing the duration.
|
|
21
|
+
*/
|
|
22
|
+
export const formatDuration = (milliseconds) => {
|
|
23
|
+
if (milliseconds <= 0) {
|
|
24
|
+
return '0s';
|
|
25
|
+
}
|
|
26
|
+
if (milliseconds < 1000) {
|
|
27
|
+
return `${milliseconds}ms`;
|
|
28
|
+
}
|
|
29
|
+
const totalSeconds = milliseconds / 1000;
|
|
30
|
+
if (totalSeconds < 60) {
|
|
31
|
+
return `${totalSeconds.toFixed(1)}s`;
|
|
32
|
+
}
|
|
33
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
34
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
35
|
+
const seconds = Math.floor(totalSeconds % 60);
|
|
36
|
+
const parts = [];
|
|
37
|
+
if (hours > 0) {
|
|
38
|
+
parts.push(`${hours}h`);
|
|
39
|
+
}
|
|
40
|
+
if (minutes > 0) {
|
|
41
|
+
parts.push(`${minutes}m`);
|
|
42
|
+
}
|
|
43
|
+
if (seconds > 0) {
|
|
44
|
+
parts.push(`${seconds}s`);
|
|
45
|
+
}
|
|
46
|
+
// If all parts are zero (e.g., exactly 1 hour), return the largest unit.
|
|
47
|
+
if (parts.length === 0) {
|
|
48
|
+
if (hours > 0)
|
|
49
|
+
return `${hours}h`;
|
|
50
|
+
if (minutes > 0)
|
|
51
|
+
return `${minutes}m`;
|
|
52
|
+
return `${seconds}s`;
|
|
53
|
+
}
|
|
54
|
+
return parts.join(' ');
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../../src/ui/utils/formatters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE;IACzD,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACxC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC;IACD,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IACpD,CAAC;IACD,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,YAAoB,EAAU,EAAE;IAC7D,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,YAAY,GAAG,IAAI,EAAE,CAAC;QACxB,OAAO,GAAG,YAAY,IAAI,CAAC;IAC7B,CAAC;IAED,MAAM,YAAY,GAAG,YAAY,GAAG,IAAI,CAAC;IAEzC,IAAI,YAAY,GAAG,EAAE,EAAE,CAAC;QACtB,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACvC,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;IAE9C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,yEAAyE;IACzE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,IAAI,KAAK,GAAG,CAAC;YAAE,OAAO,GAAG,KAAK,GAAG,CAAC;QAClC,IAAI,OAAO,GAAG,CAAC;YAAE,OAAO,GAAG,OAAO,GAAG,CAAC;QACtC,OAAO,GAAG,OAAO,GAAG,CAAC;IACvB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/*
|
|
7
|
+
**Background & Purpose:**
|
|
8
|
+
|
|
9
|
+
The `findSafeSplitPoint` function is designed to address the challenge of displaying or processing large, potentially streaming, pieces of Markdown text. When content (e.g., from an LLM like Gemini) arrives in chunks or grows too large for a single display unit (like a message bubble), it needs to be split. A naive split (e.g., just at a character limit) can break Markdown formatting, especially critical for multi-line elements like code blocks, lists, or blockquotes, leading to incorrect rendering.
|
|
10
|
+
|
|
11
|
+
This function aims to find an *intelligent* or "safe" index within the provided `content` string at which to make such a split, prioritizing the preservation of Markdown integrity.
|
|
12
|
+
|
|
13
|
+
**Key Expectations & Behavior (Prioritized):**
|
|
14
|
+
|
|
15
|
+
1. **No Split if Short Enough:**
|
|
16
|
+
* If `content.length` is less than or equal to `idealMaxLength`, the function should return `content.length` (indicating no split is necessary for length reasons).
|
|
17
|
+
|
|
18
|
+
2. **Code Block Integrity (Highest Priority for Safety):**
|
|
19
|
+
* The function must try to avoid splitting *inside* a fenced code block (i.e., between ` ``` ` and ` ``` `).
|
|
20
|
+
* If `idealMaxLength` falls within a code block:
|
|
21
|
+
* The function will attempt to return an index that splits the content *before* the start of that code block.
|
|
22
|
+
* If a code block starts at the very beginning of the `content` and `idealMaxLength` falls within it (meaning the block itself is too long for the first chunk), the function might return `0`. This effectively makes the first chunk empty, pushing the entire oversized code block to the second part of the split.
|
|
23
|
+
* When considering splits near code blocks, the function prefers to keep the entire code block intact in one of the resulting chunks.
|
|
24
|
+
|
|
25
|
+
3. **Markdown-Aware Newline Splitting (If Not Governed by Code Block Logic):**
|
|
26
|
+
* If `idealMaxLength` does not fall within a code block (or after code block considerations have been made), the function will look for natural break points by scanning backwards from `idealMaxLength`:
|
|
27
|
+
* **Paragraph Breaks:** It prioritizes splitting after a double newline (`\n\n`), as this typically signifies the end of a paragraph or a block-level element.
|
|
28
|
+
* **Single Line Breaks:** If no double newline is found in a suitable range, it will look for a single newline (`\n`).
|
|
29
|
+
* Any newline chosen as a split point must also not be inside a code block.
|
|
30
|
+
|
|
31
|
+
4. **Fallback to `idealMaxLength`:**
|
|
32
|
+
* If no "safer" split point (respecting code blocks or finding suitable newlines) is identified before or at `idealMaxLength`, and `idealMaxLength` itself is not determined to be an unsafe split point (e.g., inside a code block), the function may return a length larger than `idealMaxLength`, again it CANNOT break markdown formatting. This could happen with very long lines of text without Markdown block structures or newlines.
|
|
33
|
+
|
|
34
|
+
**In essence, `findSafeSplitPoint` tries to be a good Markdown citizen when forced to divide content, preferring structural boundaries over arbitrary character limits, with a strong emphasis on not corrupting code blocks.**
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Checks if a given character index within a string is inside a fenced (```) code block.
|
|
38
|
+
* @param content The full string content.
|
|
39
|
+
* @param indexToTest The character index to test.
|
|
40
|
+
* @returns True if the index is inside a code block's content, false otherwise.
|
|
41
|
+
*/
|
|
42
|
+
const isIndexInsideCodeBlock = (content, indexToTest) => {
|
|
43
|
+
let fenceCount = 0;
|
|
44
|
+
let searchPos = 0;
|
|
45
|
+
while (searchPos < content.length) {
|
|
46
|
+
const nextFence = content.indexOf('```', searchPos);
|
|
47
|
+
if (nextFence === -1 || nextFence >= indexToTest) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
fenceCount++;
|
|
51
|
+
searchPos = nextFence + 3;
|
|
52
|
+
}
|
|
53
|
+
return fenceCount % 2 === 1;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Finds the starting index of the code block that encloses the given index.
|
|
57
|
+
* Returns -1 if the index is not inside a code block.
|
|
58
|
+
* @param content The markdown content.
|
|
59
|
+
* @param index The index to check.
|
|
60
|
+
* @returns Start index of the enclosing code block or -1.
|
|
61
|
+
*/
|
|
62
|
+
const findEnclosingCodeBlockStart = (content, index) => {
|
|
63
|
+
if (!isIndexInsideCodeBlock(content, index)) {
|
|
64
|
+
return -1;
|
|
65
|
+
}
|
|
66
|
+
let currentSearchPos = 0;
|
|
67
|
+
while (currentSearchPos < index) {
|
|
68
|
+
const blockStartIndex = content.indexOf('```', currentSearchPos);
|
|
69
|
+
if (blockStartIndex === -1 || blockStartIndex >= index) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
const blockEndIndex = content.indexOf('```', blockStartIndex + 3);
|
|
73
|
+
if (blockStartIndex < index) {
|
|
74
|
+
if (blockEndIndex === -1 || index < blockEndIndex + 3) {
|
|
75
|
+
return blockStartIndex;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (blockEndIndex === -1)
|
|
79
|
+
break;
|
|
80
|
+
currentSearchPos = blockEndIndex + 3;
|
|
81
|
+
}
|
|
82
|
+
return -1;
|
|
83
|
+
};
|
|
84
|
+
export const findLastSafeSplitPoint = (content) => {
|
|
85
|
+
const enclosingBlockStart = findEnclosingCodeBlockStart(content, content.length);
|
|
86
|
+
if (enclosingBlockStart !== -1) {
|
|
87
|
+
// The end of the content is contained in a code block. Split right before.
|
|
88
|
+
return enclosingBlockStart;
|
|
89
|
+
}
|
|
90
|
+
// Search for the last double newline (\n\n) not in a code block.
|
|
91
|
+
let searchStartIndex = content.length;
|
|
92
|
+
while (searchStartIndex >= 0) {
|
|
93
|
+
const dnlIndex = content.lastIndexOf('\n\n', searchStartIndex);
|
|
94
|
+
if (dnlIndex === -1) {
|
|
95
|
+
// No more double newlines found.
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
const potentialSplitPoint = dnlIndex + 2;
|
|
99
|
+
if (!isIndexInsideCodeBlock(content, potentialSplitPoint)) {
|
|
100
|
+
return potentialSplitPoint;
|
|
101
|
+
}
|
|
102
|
+
// If potentialSplitPoint was inside a code block,
|
|
103
|
+
// the next search should start *before* the \n\n we just found to ensure progress.
|
|
104
|
+
searchStartIndex = dnlIndex - 1;
|
|
105
|
+
}
|
|
106
|
+
// If no safe double newline is found, return content.length
|
|
107
|
+
// to keep the entire content as one piece.
|
|
108
|
+
return content.length;
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=markdownUtilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownUtilities.js","sourceRoot":"","sources":["../../../../src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.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Calculates the maximum width of a multi-line ASCII art string.
|
|
8
|
+
* @param asciiArt The ASCII art string.
|
|
9
|
+
* @returns The length of the longest line in the ASCII art.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getAsciiArtWidth: (asciiArt: string) => number;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a Buffer is likely binary by testing for the presence of a NULL byte.
|
|
14
|
+
* The presence of a NULL byte is a strong indicator that the data is not plain text.
|
|
15
|
+
* @param data The Buffer to check.
|
|
16
|
+
* @param sampleSize The number of bytes from the start of the buffer to test.
|
|
17
|
+
* @returns True if a NULL byte is found, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isBinary(data: Buffer | null | undefined, sampleSize?: number): boolean;
|
|
20
|
+
export declare function toCodePoints(str: string): string[];
|
|
21
|
+
export declare function cpLen(str: string): number;
|
|
22
|
+
export declare function cpSlice(str: string, start: number, end?: number): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Calculates the maximum width of a multi-line ASCII art string.
|
|
8
|
+
* @param asciiArt The ASCII art string.
|
|
9
|
+
* @returns The length of the longest line in the ASCII art.
|
|
10
|
+
*/
|
|
11
|
+
export const getAsciiArtWidth = (asciiArt) => {
|
|
12
|
+
if (!asciiArt) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
const lines = asciiArt.split('\n');
|
|
16
|
+
return Math.max(...lines.map((line) => line.length));
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a Buffer is likely binary by testing for the presence of a NULL byte.
|
|
20
|
+
* The presence of a NULL byte is a strong indicator that the data is not plain text.
|
|
21
|
+
* @param data The Buffer to check.
|
|
22
|
+
* @param sampleSize The number of bytes from the start of the buffer to test.
|
|
23
|
+
* @returns True if a NULL byte is found, false otherwise.
|
|
24
|
+
*/
|
|
25
|
+
export function isBinary(data, sampleSize = 512) {
|
|
26
|
+
if (!data) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const sample = data.length > sampleSize ? data.subarray(0, sampleSize) : data;
|
|
30
|
+
for (let i = 0; i < sample.length; i++) {
|
|
31
|
+
// The presence of a NULL byte (0x00) is one of the most reliable
|
|
32
|
+
// indicators of a binary file. Text files should not contain them.
|
|
33
|
+
if (sample[i] === 0) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// If no NULL bytes were found in the sample, we assume it's text.
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
/*
|
|
41
|
+
* -------------------------------------------------------------------------
|
|
42
|
+
* Unicode‑aware helpers (work at the code‑point level rather than UTF‑16
|
|
43
|
+
* code units so that surrogate‑pair emoji count as one "column".)
|
|
44
|
+
* ---------------------------------------------------------------------- */
|
|
45
|
+
export function toCodePoints(str) {
|
|
46
|
+
// [...str] or Array.from both iterate by UTF‑32 code point, handling
|
|
47
|
+
// surrogate pairs correctly.
|
|
48
|
+
return Array.from(str);
|
|
49
|
+
}
|
|
50
|
+
export function cpLen(str) {
|
|
51
|
+
return toCodePoints(str).length;
|
|
52
|
+
}
|
|
53
|
+
export function cpSlice(str, start, end) {
|
|
54
|
+
// Slice by code‑point indices and re‑join.
|
|
55
|
+
const arr = toCodePoints(str).slice(start, end);
|
|
56
|
+
return arr.join('');
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=textUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textUtils.js","sourceRoot":"","sources":["../../../../src/ui/utils/textUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC3D,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C,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAChD,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import updateNotifier from 'update-notifier';
|
|
7
|
+
import { getPackageJson } from '../../utils/package.js';
|
|
8
|
+
export async function checkForUpdates() {
|
|
9
|
+
try {
|
|
10
|
+
const packageJson = await getPackageJson();
|
|
11
|
+
if (!packageJson || !packageJson.name || !packageJson.version) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const notifier = updateNotifier({
|
|
15
|
+
pkg: {
|
|
16
|
+
name: packageJson.name,
|
|
17
|
+
version: packageJson.version,
|
|
18
|
+
},
|
|
19
|
+
// check every time
|
|
20
|
+
updateCheckInterval: 0,
|
|
21
|
+
// allow notifier to run in scripts
|
|
22
|
+
shouldNotifyInNpmScript: true,
|
|
23
|
+
});
|
|
24
|
+
if (notifier.update) {
|
|
25
|
+
return `Gemini CLI update available! ${notifier.update.current} → ${notifier.update.latest}\nRun npm install -g ${packageJson.name} to update`;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
console.warn('Failed to check for updates: ' + e);
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=updateCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateCheck.js","sourceRoot":"","sources":["../../../../src/ui/utils/updateCheck.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;QAC3C,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,QAAQ,GAAG,cAAc,CAAC;YAC9B,GAAG,EAAE;gBACH,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,OAAO,EAAE,WAAW,CAAC,OAAO;aAC7B;YACD,mBAAmB;YACnB,mBAAmB,EAAE,CAAC;YACtB,mCAAmC;YACnC,uBAAuB,EAAE,IAAI;SAC9B,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,gCAAgC,QAAQ,CAAC,MAAM,CAAC,OAAO,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,wBAAwB,WAAW,CAAC,IAAI,YAAY,CAAC;QACjJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,+BAA+B,GAAG,CAAC,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { promises as fs } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
import { getProjectTempDir } from '@google/gemini-cli-core';
|
|
9
|
+
export async function cleanupCheckpoints() {
|
|
10
|
+
const tempDir = getProjectTempDir(process.cwd());
|
|
11
|
+
const checkpointsDir = join(tempDir, 'checkpoints');
|
|
12
|
+
try {
|
|
13
|
+
await fs.rm(checkpointsDir, { recursive: true, force: true });
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Ignore errors if the directory doesn't exist or fails to delete.
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../../src/utils/cleanup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACpD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,mEAAmE;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type PackageJson as BasePackageJson } from 'read-package-up';
|
|
7
|
+
export type PackageJson = BasePackageJson & {
|
|
8
|
+
config?: {
|
|
9
|
+
sandboxImageUri?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare function getPackageJson(): Promise<PackageJson | undefined>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { readPackageUp, } from 'read-package-up';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
let packageJson;
|
|
12
|
+
export async function getPackageJson() {
|
|
13
|
+
if (packageJson) {
|
|
14
|
+
return packageJson;
|
|
15
|
+
}
|
|
16
|
+
const result = await readPackageUp({ cwd: __dirname });
|
|
17
|
+
if (!result) {
|
|
18
|
+
// TODO: Maybe bubble this up as an error.
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
packageJson = result.packageJson;
|
|
22
|
+
return packageJson;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/utils/package.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,GAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAQxB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,IAAI,WAAoC,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,0CAA0C;QAC1C,OAAO;IACT,CAAC;IAED,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACjC,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export async function readStdin() {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
let data = '';
|
|
9
|
+
process.stdin.setEncoding('utf8');
|
|
10
|
+
const onReadable = () => {
|
|
11
|
+
let chunk;
|
|
12
|
+
while ((chunk = process.stdin.read()) !== null) {
|
|
13
|
+
data += chunk;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const onEnd = () => {
|
|
17
|
+
cleanup();
|
|
18
|
+
resolve(data);
|
|
19
|
+
};
|
|
20
|
+
const onError = (err) => {
|
|
21
|
+
cleanup();
|
|
22
|
+
reject(err);
|
|
23
|
+
};
|
|
24
|
+
const cleanup = () => {
|
|
25
|
+
process.stdin.removeListener('readable', onReadable);
|
|
26
|
+
process.stdin.removeListener('end', onEnd);
|
|
27
|
+
process.stdin.removeListener('error', onError);
|
|
28
|
+
};
|
|
29
|
+
process.stdin.on('readable', onReadable);
|
|
30
|
+
process.stdin.on('end', onEnd);
|
|
31
|
+
process.stdin.on('error', onError);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=readStdin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readStdin.js","sourceRoot":"","sources":["../../../src/utils/readStdin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAElC,M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