@machina.ai/cell-cli 1.18.4-rc1 → 1.19.4-rc1
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/index.d.ts +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/package.json +6 -6
- package/dist/src/commands/extensions.test.d.ts +6 -0
- package/dist/src/commands/extensions.test.js +67 -0
- package/dist/src/commands/extensions.test.js.map +1 -0
- package/dist/src/commands/utils.test.d.ts +6 -0
- package/dist/src/commands/utils.test.js +35 -0
- package/dist/src/commands/utils.test.js.map +1 -0
- package/dist/src/config/auth.js +4 -0
- package/dist/src/config/auth.js.map +1 -1
- package/dist/src/config/auth.test.js +1 -2
- package/dist/src/config/auth.test.js.map +1 -1
- package/dist/src/config/config.integration.test.js +81 -198
- package/dist/src/config/config.integration.test.js.map +1 -1
- package/dist/src/config/config.js +3 -9
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +200 -316
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/extension.test.js +109 -133
- package/dist/src/config/extension.test.js.map +1 -1
- package/dist/src/config/extensions/consent.test.d.ts +6 -0
- package/dist/src/config/extensions/consent.test.js +152 -0
- package/dist/src/config/extensions/consent.test.js.map +1 -0
- package/dist/src/config/extensions/extensionEnablement.test.js +82 -15
- package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -1
- package/dist/src/config/extensions/extensionSettings.test.js +105 -1
- package/dist/src/config/extensions/extensionSettings.test.js.map +1 -1
- package/dist/src/config/extensions/github.d.ts +1 -0
- package/dist/src/config/extensions/github.js +21 -5
- package/dist/src/config/extensions/github.js.map +1 -1
- package/dist/src/config/extensions/github.test.js +201 -318
- package/dist/src/config/extensions/github.test.js.map +1 -1
- package/dist/src/config/extensions/storage.test.d.ts +6 -0
- package/dist/src/config/extensions/storage.test.js +64 -0
- package/dist/src/config/extensions/storage.test.js.map +1 -0
- package/dist/src/config/extensions/update.test.js +154 -263
- package/dist/src/config/extensions/update.test.js.map +1 -1
- package/dist/src/config/extensions/variables.test.js +87 -1
- package/dist/src/config/extensions/variables.test.js.map +1 -1
- package/dist/src/config/sandboxConfig.d.ts +1 -1
- package/dist/src/config/sandboxConfig.js.map +1 -1
- package/dist/src/config/sandboxConfig.test.d.ts +6 -0
- package/dist/src/config/sandboxConfig.test.js +178 -0
- package/dist/src/config/sandboxConfig.test.js.map +1 -0
- package/dist/src/config/settingPaths.test.d.ts +6 -0
- package/dist/src/config/settingPaths.test.js +22 -0
- package/dist/src/config/settingPaths.test.js.map +1 -0
- package/dist/src/config/settings.js +12 -1
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settings.test.js +228 -227
- package/dist/src/config/settings.test.js.map +1 -1
- package/dist/src/config/settingsSchema.d.ts +13 -4
- package/dist/src/config/settingsSchema.js +13 -4
- package/dist/src/config/settingsSchema.js.map +1 -1
- package/dist/src/config/settingsSchema.test.js +10 -5
- package/dist/src/config/settingsSchema.test.js.map +1 -1
- package/dist/src/core/auth.test.d.ts +6 -0
- package/dist/src/core/auth.test.js +43 -0
- package/dist/src/core/auth.test.js.map +1 -0
- package/dist/src/core/initializer.test.d.ts +6 -0
- package/dist/src/core/initializer.test.js +101 -0
- package/dist/src/core/initializer.test.js.map +1 -0
- package/dist/src/core/theme.test.d.ts +6 -0
- package/dist/src/core/theme.test.js +46 -0
- package/dist/src/core/theme.test.js.map +1 -0
- package/dist/src/gemini.d.ts +1 -0
- package/dist/src/gemini.js +7 -2
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +625 -1
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/gemini_cleanup.test.d.ts +6 -0
- package/dist/src/gemini_cleanup.test.js +201 -0
- package/dist/src/gemini_cleanup.test.js.map +1 -0
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/nonInteractiveCli.test.js +336 -0
- package/dist/src/nonInteractiveCli.test.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.js +3 -1
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.test.js +1 -22
- package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -1
- package/dist/src/test-utils/mockCommandContext.js +1 -1
- package/dist/src/test-utils/render.js +4 -0
- package/dist/src/test-utils/render.js.map +1 -1
- package/dist/src/ui/App.test.js +28 -14
- package/dist/src/ui/App.test.js.map +1 -1
- package/dist/src/ui/AppContainer.js +30 -6
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/IdeIntegrationNudge.test.d.ts +6 -0
- package/dist/src/ui/IdeIntegrationNudge.test.js +147 -0
- package/dist/src/ui/IdeIntegrationNudge.test.js.map +1 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.js +12 -17
- package/dist/src/ui/auth/ApiAuthDialog.test.js.map +1 -1
- package/dist/src/ui/auth/AuthDialog.test.js +48 -17
- package/dist/src/ui/auth/AuthDialog.test.js.map +1 -1
- package/dist/src/ui/auth/AuthInProgress.test.d.ts +6 -0
- package/dist/src/ui/auth/AuthInProgress.test.js +71 -0
- package/dist/src/ui/auth/AuthInProgress.test.js.map +1 -0
- package/dist/src/ui/auth/useAuth.d.ts +2 -0
- package/dist/src/ui/auth/useAuth.js +6 -1
- package/dist/src/ui/auth/useAuth.js.map +1 -1
- package/dist/src/ui/auth/useAuth.test.d.ts +6 -0
- package/dist/src/ui/auth/useAuth.test.js +178 -0
- package/dist/src/ui/auth/useAuth.test.js.map +1 -0
- package/dist/src/ui/commands/extensionsCommand.js +28 -6
- package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
- package/dist/src/ui/commands/extensionsCommand.test.js +32 -0
- package/dist/src/ui/commands/extensionsCommand.test.js.map +1 -1
- package/dist/src/ui/commands/resumeCommand.d.ts +7 -0
- package/dist/src/ui/commands/resumeCommand.js +16 -0
- package/dist/src/ui/commands/resumeCommand.js.map +1 -0
- package/dist/src/ui/commands/statsCommand.js +27 -16
- package/dist/src/ui/commands/statsCommand.js.map +1 -1
- package/dist/src/ui/commands/types.d.ts +1 -1
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/components/AboutBox.test.d.ts +6 -0
- package/dist/src/ui/components/AboutBox.test.js +53 -0
- package/dist/src/ui/components/AboutBox.test.js.map +1 -0
- package/dist/src/ui/components/AlternateBufferQuittingDisplay.test.js +62 -11
- package/dist/src/ui/components/AlternateBufferQuittingDisplay.test.js.map +1 -1
- package/dist/src/ui/components/AnsiOutput.test.js +18 -23
- package/dist/src/ui/components/AnsiOutput.test.js.map +1 -1
- package/dist/src/ui/components/AsciiArt.d.ts +6 -6
- package/dist/src/ui/components/AsciiArt.js +6 -6
- package/dist/src/ui/components/AutoAcceptIndicator.test.d.ts +6 -0
- package/dist/src/ui/components/AutoAcceptIndicator.test.js +31 -0
- package/dist/src/ui/components/AutoAcceptIndicator.test.js.map +1 -0
- package/dist/src/ui/components/Banner.test.d.ts +6 -0
- package/dist/src/ui/components/Banner.test.js +24 -0
- package/dist/src/ui/components/Banner.test.js.map +1 -0
- package/dist/src/ui/components/ConfigInitDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ConfigInitDisplay.test.js +103 -0
- package/dist/src/ui/components/ConfigInitDisplay.test.js.map +1 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.test.js +26 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.test.js.map +1 -0
- package/dist/src/ui/components/ContextUsageDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ContextUsageDisplay.test.js +39 -0
- package/dist/src/ui/components/ContextUsageDisplay.test.js.map +1 -0
- package/dist/src/ui/components/CopyModeWarning.test.d.ts +6 -0
- package/dist/src/ui/components/CopyModeWarning.test.js +33 -0
- package/dist/src/ui/components/CopyModeWarning.test.js.map +1 -0
- package/dist/src/ui/components/DebugProfiler.js +1 -1
- package/dist/src/ui/components/DebugProfiler.js.map +1 -1
- package/dist/src/ui/components/DebugProfiler.test.js +46 -1
- package/dist/src/ui/components/DebugProfiler.test.js.map +1 -1
- package/dist/src/ui/components/DetailedMessagesDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/DetailedMessagesDisplay.test.js +49 -0
- package/dist/src/ui/components/DetailedMessagesDisplay.test.js.map +1 -0
- package/dist/src/ui/components/DialogManager.js +4 -0
- package/dist/src/ui/components/DialogManager.js.map +1 -1
- package/dist/src/ui/components/DialogManager.test.d.ts +6 -0
- package/dist/src/ui/components/DialogManager.test.js +167 -0
- package/dist/src/ui/components/DialogManager.test.js.map +1 -0
- package/dist/src/ui/components/EditorSettingsDialog.test.d.ts +6 -0
- package/dist/src/ui/components/EditorSettingsDialog.test.js +111 -0
- package/dist/src/ui/components/EditorSettingsDialog.test.js.map +1 -0
- package/dist/src/ui/components/ExitWarning.test.d.ts +6 -0
- package/dist/src/ui/components/ExitWarning.test.js +54 -0
- package/dist/src/ui/components/ExitWarning.test.js.map +1 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.test.d.ts +6 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.test.js +58 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.test.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.js +1 -1
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.test.js +6 -0
- package/dist/src/ui/components/InputPrompt.test.js.map +1 -1
- package/dist/src/ui/components/MainContent.test.d.ts +6 -0
- package/dist/src/ui/components/MainContent.test.js +73 -0
- package/dist/src/ui/components/MainContent.test.js.map +1 -0
- package/dist/src/ui/components/MemoryUsageDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/MemoryUsageDisplay.test.js +49 -0
- package/dist/src/ui/components/MemoryUsageDisplay.test.js.map +1 -0
- package/dist/src/ui/components/ModelDialog.test.js +1 -1
- package/dist/src/ui/components/ModelDialog.test.js.map +1 -1
- package/dist/src/ui/components/Notifications.js +5 -3
- package/dist/src/ui/components/Notifications.js.map +1 -1
- package/dist/src/ui/components/Notifications.test.d.ts +6 -0
- package/dist/src/ui/components/Notifications.test.js +153 -0
- package/dist/src/ui/components/Notifications.test.js.map +1 -0
- package/dist/src/ui/components/QuittingDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/QuittingDisplay.test.js +49 -0
- package/dist/src/ui/components/QuittingDisplay.test.js.map +1 -0
- package/dist/src/ui/components/RawMarkdownIndicator.test.d.ts +6 -0
- package/dist/src/ui/components/RawMarkdownIndicator.test.js +34 -0
- package/dist/src/ui/components/RawMarkdownIndicator.test.js.map +1 -0
- package/dist/src/ui/components/SessionBrowser.d.ts +98 -0
- package/dist/src/ui/components/SessionBrowser.js +457 -0
- package/dist/src/ui/components/SessionBrowser.js.map +1 -0
- package/dist/src/ui/components/SessionBrowser.test.d.ts +6 -0
- package/dist/src/ui/components/SessionBrowser.test.js +250 -0
- package/dist/src/ui/components/SessionBrowser.test.js.map +1 -0
- package/dist/src/ui/components/ShellInputPrompt.test.d.ts +6 -0
- package/dist/src/ui/components/ShellInputPrompt.test.js +82 -0
- package/dist/src/ui/components/ShellInputPrompt.test.js.map +1 -0
- package/dist/src/ui/components/ShellModeIndicator.test.d.ts +6 -0
- package/dist/src/ui/components/ShellModeIndicator.test.js +17 -0
- package/dist/src/ui/components/ShellModeIndicator.test.js.map +1 -0
- package/dist/src/ui/components/ShowMoreLines.test.d.ts +6 -0
- package/dist/src/ui/components/ShowMoreLines.test.js +40 -0
- package/dist/src/ui/components/ShowMoreLines.test.js.map +1 -0
- package/dist/src/ui/components/SuggestionsDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/SuggestionsDisplay.test.js +56 -0
- package/dist/src/ui/components/SuggestionsDisplay.test.js.map +1 -0
- package/dist/src/ui/components/ThemeDialog.js +6 -2
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.test.js +20 -6
- package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
- package/dist/src/ui/components/ThemedGradient.test.d.ts +6 -0
- package/dist/src/ui/components/ThemedGradient.test.js +30 -0
- package/dist/src/ui/components/ThemedGradient.test.js.map +1 -0
- package/dist/src/ui/components/Tips.test.d.ts +6 -0
- package/dist/src/ui/components/Tips.test.js +23 -0
- package/dist/src/ui/components/Tips.test.js.map +1 -0
- package/dist/src/ui/components/UpdateNotification.test.d.ts +6 -0
- package/dist/src/ui/components/UpdateNotification.test.js +16 -0
- package/dist/src/ui/components/UpdateNotification.test.js.map +1 -0
- package/dist/src/ui/components/messages/ErrorMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ErrorMessage.test.js +23 -0
- package/dist/src/ui/components/messages/ErrorMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/InfoMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/InfoMessage.test.js +28 -0
- package/dist/src/ui/components/messages/InfoMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +5 -6
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessage.test.js +13 -21
- package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/ToolResultDisplay.js +1 -1
- package/dist/src/ui/components/messages/ToolResultDisplay.js.map +1 -1
- package/dist/src/ui/components/messages/ToolResultDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolResultDisplay.test.js +96 -0
- package/dist/src/ui/components/messages/ToolResultDisplay.test.js.map +1 -0
- package/dist/src/ui/components/messages/UserMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/UserMessage.test.js +32 -0
- package/dist/src/ui/components/messages/UserMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/WarningMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/WarningMessage.test.js +23 -0
- package/dist/src/ui/components/messages/WarningMessage.test.js.map +1 -0
- package/dist/src/ui/components/shared/text-buffer.js +20 -4
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.test.js +20 -0
- package/dist/src/ui/components/shared/text-buffer.test.js.map +1 -1
- package/dist/src/ui/contexts/UIActionsContext.d.ts +5 -0
- package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
- package/dist/src/ui/contexts/UIStateContext.d.ts +1 -0
- package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +1 -0
- package/dist/src/ui/hooks/slashCommandProcessor.js +3 -0
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.test.js +1 -0
- package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/useBracketedPaste.js +3 -5
- package/dist/src/ui/hooks/useBracketedPaste.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.test.js +1 -1
- package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -1
- package/dist/src/ui/hooks/useSessionBrowser.d.ts +18 -1
- package/dist/src/ui/hooks/useSessionBrowser.js +63 -0
- package/dist/src/ui/hooks/useSessionBrowser.js.map +1 -1
- package/dist/src/ui/hooks/useSessionBrowser.test.js +154 -526
- package/dist/src/ui/hooks/useSessionBrowser.test.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.test.js +5 -5
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +6 -2
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.d.ts +6 -0
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.js +121 -0
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.js.map +1 -0
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.d.ts +6 -0
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.js +34 -0
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.js.map +1 -0
- package/dist/src/ui/privacy/GeminiPrivacyNotice.test.d.ts +6 -0
- package/dist/src/ui/privacy/GeminiPrivacyNotice.test.js +34 -0
- package/dist/src/ui/privacy/GeminiPrivacyNotice.test.js.map +1 -0
- package/dist/src/ui/privacy/PrivacyNotice.test.d.ts +6 -0
- package/dist/src/ui/privacy/PrivacyNotice.test.js +62 -0
- package/dist/src/ui/privacy/PrivacyNotice.test.js.map +1 -0
- package/dist/src/ui/state/extensions.test.js +208 -51
- package/dist/src/ui/state/extensions.test.js.map +1 -1
- package/dist/src/ui/themes/holiday.d.ts +7 -0
- package/dist/src/ui/themes/holiday.js +162 -0
- package/dist/src/ui/themes/holiday.js.map +1 -0
- package/dist/src/ui/themes/theme-manager.js +2 -0
- package/dist/src/ui/themes/theme-manager.js.map +1 -1
- package/dist/src/ui/types.js +1 -1
- package/dist/src/ui/utils/bracketedPaste.d.ts +7 -0
- package/dist/src/ui/utils/bracketedPaste.js +15 -0
- package/dist/src/ui/utils/bracketedPaste.js.map +1 -0
- package/dist/src/ui/utils/kittyProtocolDetector.test.d.ts +6 -0
- package/dist/src/ui/utils/kittyProtocolDetector.test.js +113 -0
- package/dist/src/ui/utils/kittyProtocolDetector.test.js.map +1 -0
- package/dist/src/ui/utils/terminalSetup.js +39 -38
- package/dist/src/ui/utils/terminalSetup.js.map +1 -1
- package/dist/src/ui/utils/terminalSetup.test.d.ts +6 -0
- package/dist/src/ui/utils/terminalSetup.test.js +132 -0
- package/dist/src/ui/utils/terminalSetup.test.js.map +1 -0
- package/dist/src/ui/utils/ui-sizing.test.d.ts +6 -0
- package/dist/src/ui/utils/ui-sizing.test.js +56 -0
- package/dist/src/ui/utils/ui-sizing.test.js.map +1 -0
- package/dist/src/utils/checks.test.d.ts +6 -0
- package/dist/src/utils/checks.test.js +29 -0
- package/dist/src/utils/checks.test.js.map +1 -0
- package/dist/src/utils/cleanup.test.js +69 -16
- package/dist/src/utils/cleanup.test.js.map +1 -1
- package/dist/src/utils/dialogScopeUtils.test.d.ts +6 -0
- package/dist/src/utils/dialogScopeUtils.test.js +81 -0
- package/dist/src/utils/dialogScopeUtils.test.js.map +1 -0
- package/dist/src/utils/errors.test.js +62 -0
- package/dist/src/utils/errors.test.js.map +1 -1
- package/dist/src/utils/events.test.d.ts +6 -0
- package/dist/src/utils/events.test.js +24 -0
- package/dist/src/utils/events.test.js.map +1 -0
- package/dist/src/utils/handleAutoUpdate.test.js +103 -24
- package/dist/src/utils/handleAutoUpdate.test.js.map +1 -1
- package/dist/src/utils/math.test.d.ts +6 -0
- package/dist/src/utils/math.test.js +23 -0
- package/dist/src/utils/math.test.js.map +1 -0
- package/dist/src/utils/persistentState.test.d.ts +6 -0
- package/dist/src/utils/persistentState.test.js +68 -0
- package/dist/src/utils/persistentState.test.js.map +1 -0
- package/dist/src/utils/readStdin.js +1 -0
- package/dist/src/utils/readStdin.js.map +1 -1
- package/dist/src/utils/readStdin.test.js +25 -0
- package/dist/src/utils/readStdin.test.js.map +1 -1
- package/dist/src/utils/resolvePath.test.d.ts +6 -0
- package/dist/src/utils/resolvePath.test.js +31 -0
- package/dist/src/utils/resolvePath.test.js.map +1 -0
- package/dist/src/utils/sandbox.js +6 -137
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/sandbox.test.d.ts +6 -0
- package/dist/src/utils/sandbox.test.js +302 -0
- package/dist/src/utils/sandbox.test.js.map +1 -0
- package/dist/src/utils/sandboxUtils.d.ts +14 -0
- package/dist/src/utils/sandboxUtils.js +120 -0
- package/dist/src/utils/sandboxUtils.js.map +1 -0
- package/dist/src/utils/sandboxUtils.test.d.ts +6 -0
- package/dist/src/utils/sandboxUtils.test.js +119 -0
- package/dist/src/utils/sandboxUtils.test.js.map +1 -0
- package/dist/src/utils/sessionCleanup.test.js +38 -0
- package/dist/src/utils/sessionCleanup.test.js.map +1 -1
- package/dist/src/utils/sessionUtils.d.ts +49 -4
- package/dist/src/utils/sessionUtils.js +100 -25
- package/dist/src/utils/sessionUtils.js.map +1 -1
- package/dist/src/utils/sessionUtils.test.js +46 -3
- package/dist/src/utils/sessionUtils.test.js.map +1 -1
- package/dist/src/utils/sessions.js +4 -1
- package/dist/src/utils/sessions.js.map +1 -1
- package/dist/src/utils/sessions.test.js +42 -0
- package/dist/src/utils/sessions.test.js.map +1 -1
- package/dist/src/utils/updateEventEmitter.test.d.ts +6 -0
- package/dist/src/utils/updateEventEmitter.test.js +18 -0
- package/dist/src/utils/updateEventEmitter.test.js.map +1 -0
- package/dist/src/utils/version.test.d.ts +6 -0
- package/dist/src/utils/version.test.js +39 -0
- package/dist/src/utils/version.test.js.map +1 -0
- package/dist/src/zed-integration/connection.test.d.ts +6 -0
- package/dist/src/zed-integration/connection.test.js +175 -0
- package/dist/src/zed-integration/connection.test.js.map +1 -0
- package/dist/src/zed-integration/fileSystemService.test.d.ts +6 -0
- package/dist/src/zed-integration/fileSystemService.test.js +98 -0
- package/dist/src/zed-integration/fileSystemService.test.js.map +1 -0
- package/dist/src/zed-integration/zedIntegration.d.ts +31 -1
- package/dist/src/zed-integration/zedIntegration.js +5 -2
- package/dist/src/zed-integration/zedIntegration.js.map +1 -1
- package/dist/src/zed-integration/zedIntegration.test.d.ts +6 -0
- package/dist/src/zed-integration/zedIntegration.test.js +619 -0
- package/dist/src/zed-integration/zedIntegration.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
package/dist/src/gemini.test.js
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { describe, it, expect, vi, beforeEach, afterEach, } from 'vitest';
|
|
7
|
-
import { main, setupUnhandledRejectionHandler, validateDnsResolutionOrder, startInteractiveUI, } from './gemini.js';
|
|
7
|
+
import { main, setupUnhandledRejectionHandler, validateDnsResolutionOrder, startInteractiveUI, getNodeMemoryArgs, } from './gemini.js';
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import v8 from 'node:v8';
|
|
8
10
|
import {} from './config/settings.js';
|
|
9
11
|
import { appEvents, AppEvent } from './utils/events.js';
|
|
10
12
|
import { debugLogger, } from '@google/gemini-cli-core';
|
|
@@ -33,6 +35,10 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
|
|
33
35
|
write: vi.fn(),
|
|
34
36
|
},
|
|
35
37
|
})),
|
|
38
|
+
enableMouseEvents: vi.fn(),
|
|
39
|
+
disableMouseEvents: vi.fn(),
|
|
40
|
+
enterAlternateScreen: vi.fn(),
|
|
41
|
+
disableLineWrapping: vi.fn(),
|
|
36
42
|
};
|
|
37
43
|
});
|
|
38
44
|
vi.mock('ink', async (importOriginal) => {
|
|
@@ -122,6 +128,7 @@ vi.mock('./utils/sandbox.js', () => ({
|
|
|
122
128
|
}));
|
|
123
129
|
vi.mock('./utils/relaunch.js', () => ({
|
|
124
130
|
relaunchAppInChildProcess: vi.fn(),
|
|
131
|
+
relaunchOnExitCode: vi.fn(),
|
|
125
132
|
}));
|
|
126
133
|
vi.mock('./config/sandboxConfig.js', () => ({
|
|
127
134
|
loadSandboxConfig: vi.fn(),
|
|
@@ -275,6 +282,71 @@ describe('gemini.tsx main function', () => {
|
|
|
275
282
|
processExitSpy.mockRestore();
|
|
276
283
|
});
|
|
277
284
|
});
|
|
285
|
+
describe('setWindowTitle', () => {
|
|
286
|
+
it('should set window title when hideWindowTitle is false', async () => {
|
|
287
|
+
// setWindowTitle is not exported, but we can test its effect if we had a way to call it.
|
|
288
|
+
// Since we can't easily call it directly without exporting it, we skip direct testing
|
|
289
|
+
// and rely on startInteractiveUI tests which call it.
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
describe('initializeOutputListenersAndFlush', () => {
|
|
293
|
+
afterEach(() => {
|
|
294
|
+
vi.restoreAllMocks();
|
|
295
|
+
});
|
|
296
|
+
it('should flush backlogs and setup listeners if no listeners exist', async () => {
|
|
297
|
+
const { coreEvents } = await import('@google/gemini-cli-core');
|
|
298
|
+
const { initializeOutputListenersAndFlush } = await import('./gemini.js');
|
|
299
|
+
// Mock listenerCount to return 0
|
|
300
|
+
vi.spyOn(coreEvents, 'listenerCount').mockReturnValue(0);
|
|
301
|
+
const drainSpy = vi.spyOn(coreEvents, 'drainBacklogs');
|
|
302
|
+
initializeOutputListenersAndFlush();
|
|
303
|
+
expect(drainSpy).toHaveBeenCalled();
|
|
304
|
+
// We can't easily check if listeners were added without access to the internal state of coreEvents,
|
|
305
|
+
// but we can verify that drainBacklogs was called.
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
describe('getNodeMemoryArgs', () => {
|
|
309
|
+
let osTotalMemSpy;
|
|
310
|
+
let v8GetHeapStatisticsSpy;
|
|
311
|
+
beforeEach(() => {
|
|
312
|
+
osTotalMemSpy = vi.spyOn(os, 'totalmem');
|
|
313
|
+
v8GetHeapStatisticsSpy = vi.spyOn(v8, 'getHeapStatistics');
|
|
314
|
+
delete process.env['CELL_CLI_NO_RELAUNCH'];
|
|
315
|
+
});
|
|
316
|
+
afterEach(() => {
|
|
317
|
+
vi.restoreAllMocks();
|
|
318
|
+
});
|
|
319
|
+
it('should return empty array if CELL_CLI_NO_RELAUNCH is set', () => {
|
|
320
|
+
process.env['CELL_CLI_NO_RELAUNCH'] = 'true';
|
|
321
|
+
expect(getNodeMemoryArgs(false)).toEqual([]);
|
|
322
|
+
});
|
|
323
|
+
it('should return empty array if current heap limit is sufficient', () => {
|
|
324
|
+
osTotalMemSpy.mockReturnValue(16 * 1024 * 1024 * 1024); // 16GB
|
|
325
|
+
v8GetHeapStatisticsSpy.mockReturnValue({
|
|
326
|
+
heap_size_limit: 8 * 1024 * 1024 * 1024, // 8GB
|
|
327
|
+
});
|
|
328
|
+
// Target is 50% of 16GB = 8GB. Current is 8GB. No relaunch needed.
|
|
329
|
+
expect(getNodeMemoryArgs(false)).toEqual([]);
|
|
330
|
+
});
|
|
331
|
+
it('should return memory args if current heap limit is insufficient', () => {
|
|
332
|
+
osTotalMemSpy.mockReturnValue(16 * 1024 * 1024 * 1024); // 16GB
|
|
333
|
+
v8GetHeapStatisticsSpy.mockReturnValue({
|
|
334
|
+
heap_size_limit: 4 * 1024 * 1024 * 1024, // 4GB
|
|
335
|
+
});
|
|
336
|
+
// Target is 50% of 16GB = 8GB. Current is 4GB. Relaunch needed.
|
|
337
|
+
expect(getNodeMemoryArgs(false)).toEqual(['--max-old-space-size=8192']);
|
|
338
|
+
});
|
|
339
|
+
it('should log debug info when isDebugMode is true', () => {
|
|
340
|
+
const debugSpy = vi.spyOn(debugLogger, 'debug');
|
|
341
|
+
osTotalMemSpy.mockReturnValue(16 * 1024 * 1024 * 1024);
|
|
342
|
+
v8GetHeapStatisticsSpy.mockReturnValue({
|
|
343
|
+
heap_size_limit: 4 * 1024 * 1024 * 1024,
|
|
344
|
+
});
|
|
345
|
+
getNodeMemoryArgs(true);
|
|
346
|
+
expect(debugSpy).toHaveBeenCalledWith(expect.stringContaining('Current heap size'));
|
|
347
|
+
expect(debugSpy).toHaveBeenCalledWith(expect.stringContaining('Need to relaunch with more memory'));
|
|
348
|
+
});
|
|
349
|
+
});
|
|
278
350
|
describe('gemini.tsx main function kitty protocol', () => {
|
|
279
351
|
let originalEnvNoRelaunch;
|
|
280
352
|
let setRawModeSpy;
|
|
@@ -395,6 +467,547 @@ describe('gemini.tsx main function kitty protocol', () => {
|
|
|
395
467
|
expect(setRawModeSpy).toHaveBeenCalledWith(true);
|
|
396
468
|
expect(detectAndEnableKittyProtocol).toHaveBeenCalledTimes(1);
|
|
397
469
|
});
|
|
470
|
+
it.each([
|
|
471
|
+
{ flag: 'listExtensions' },
|
|
472
|
+
{ flag: 'listSessions' },
|
|
473
|
+
{ flag: 'deleteSession', value: 'session-id' },
|
|
474
|
+
])('should handle --$flag flag', async ({ flag, value }) => {
|
|
475
|
+
const { loadCliConfig, parseArguments } = await import('./config/config.js');
|
|
476
|
+
const { loadSettings } = await import('./config/settings.js');
|
|
477
|
+
const { listSessions, deleteSession } = await import('./utils/sessions.js');
|
|
478
|
+
const processExitSpy = vi
|
|
479
|
+
.spyOn(process, 'exit')
|
|
480
|
+
.mockImplementation((code) => {
|
|
481
|
+
throw new MockProcessExitError(code);
|
|
482
|
+
});
|
|
483
|
+
vi.mocked(loadSettings).mockReturnValue({
|
|
484
|
+
merged: {
|
|
485
|
+
advanced: {},
|
|
486
|
+
security: { auth: {} },
|
|
487
|
+
ui: {},
|
|
488
|
+
},
|
|
489
|
+
setValue: vi.fn(),
|
|
490
|
+
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
|
|
491
|
+
errors: [],
|
|
492
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
493
|
+
vi.mocked(parseArguments).mockResolvedValue({
|
|
494
|
+
promptInteractive: false,
|
|
495
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
496
|
+
const mockConfig = {
|
|
497
|
+
isInteractive: () => false,
|
|
498
|
+
getQuestion: () => '',
|
|
499
|
+
getSandbox: () => false,
|
|
500
|
+
getDebugMode: () => false,
|
|
501
|
+
getListExtensions: () => flag === 'listExtensions',
|
|
502
|
+
getListSessions: () => flag === 'listSessions',
|
|
503
|
+
getDeleteSession: () => (flag === 'deleteSession' ? value : undefined),
|
|
504
|
+
getExtensions: () => [{ name: 'ext1' }],
|
|
505
|
+
getPolicyEngine: vi.fn(),
|
|
506
|
+
getMessageBus: () => ({ subscribe: vi.fn() }),
|
|
507
|
+
initialize: vi.fn(),
|
|
508
|
+
getContentGeneratorConfig: vi.fn(),
|
|
509
|
+
getMcpServers: () => ({}),
|
|
510
|
+
getMcpClientManager: vi.fn(),
|
|
511
|
+
getIdeMode: () => false,
|
|
512
|
+
getExperimentalZedIntegration: () => false,
|
|
513
|
+
getScreenReader: () => false,
|
|
514
|
+
getGeminiMdFileCount: () => 0,
|
|
515
|
+
getProjectRoot: () => '/',
|
|
516
|
+
};
|
|
517
|
+
vi.mocked(loadCliConfig).mockResolvedValue(mockConfig);
|
|
518
|
+
vi.mock('./utils/sessions.js', () => ({
|
|
519
|
+
listSessions: vi.fn(),
|
|
520
|
+
deleteSession: vi.fn(),
|
|
521
|
+
}));
|
|
522
|
+
const debugLoggerLogSpy = vi
|
|
523
|
+
.spyOn(debugLogger, 'log')
|
|
524
|
+
.mockImplementation(() => { });
|
|
525
|
+
try {
|
|
526
|
+
await main();
|
|
527
|
+
}
|
|
528
|
+
catch (e) {
|
|
529
|
+
if (!(e instanceof MockProcessExitError))
|
|
530
|
+
throw e;
|
|
531
|
+
}
|
|
532
|
+
if (flag === 'listExtensions') {
|
|
533
|
+
expect(debugLoggerLogSpy).toHaveBeenCalledWith(expect.stringContaining('ext1'));
|
|
534
|
+
}
|
|
535
|
+
else if (flag === 'listSessions') {
|
|
536
|
+
expect(listSessions).toHaveBeenCalledWith(mockConfig);
|
|
537
|
+
}
|
|
538
|
+
else if (flag === 'deleteSession') {
|
|
539
|
+
expect(deleteSession).toHaveBeenCalledWith(mockConfig, value);
|
|
540
|
+
}
|
|
541
|
+
expect(processExitSpy).toHaveBeenCalledWith(0);
|
|
542
|
+
processExitSpy.mockRestore();
|
|
543
|
+
});
|
|
544
|
+
it('should handle sandbox activation', async () => {
|
|
545
|
+
const { loadCliConfig, parseArguments } = await import('./config/config.js');
|
|
546
|
+
const { loadSandboxConfig } = await import('./config/sandboxConfig.js');
|
|
547
|
+
const { start_sandbox } = await import('./utils/sandbox.js');
|
|
548
|
+
const { relaunchOnExitCode } = await import('./utils/relaunch.js');
|
|
549
|
+
const { loadSettings } = await import('./config/settings.js');
|
|
550
|
+
const processExitSpy = vi
|
|
551
|
+
.spyOn(process, 'exit')
|
|
552
|
+
.mockImplementation((code) => {
|
|
553
|
+
throw new MockProcessExitError(code);
|
|
554
|
+
});
|
|
555
|
+
vi.mocked(parseArguments).mockResolvedValue({
|
|
556
|
+
promptInteractive: false,
|
|
557
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
558
|
+
vi.mocked(loadSettings).mockReturnValue({
|
|
559
|
+
merged: {
|
|
560
|
+
advanced: {},
|
|
561
|
+
security: { auth: {} },
|
|
562
|
+
ui: {},
|
|
563
|
+
},
|
|
564
|
+
setValue: vi.fn(),
|
|
565
|
+
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
|
|
566
|
+
errors: [],
|
|
567
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
568
|
+
const mockConfig = {
|
|
569
|
+
isInteractive: () => false,
|
|
570
|
+
getQuestion: () => '',
|
|
571
|
+
getSandbox: () => true,
|
|
572
|
+
getDebugMode: () => false,
|
|
573
|
+
getListExtensions: () => false,
|
|
574
|
+
getListSessions: () => false,
|
|
575
|
+
getDeleteSession: () => undefined,
|
|
576
|
+
getExtensions: () => [],
|
|
577
|
+
getPolicyEngine: vi.fn(),
|
|
578
|
+
getMessageBus: () => ({ subscribe: vi.fn() }),
|
|
579
|
+
initialize: vi.fn(),
|
|
580
|
+
getContentGeneratorConfig: vi.fn(),
|
|
581
|
+
getMcpServers: () => ({}),
|
|
582
|
+
getMcpClientManager: vi.fn(),
|
|
583
|
+
getIdeMode: () => false,
|
|
584
|
+
getExperimentalZedIntegration: () => false,
|
|
585
|
+
getScreenReader: () => false,
|
|
586
|
+
getGeminiMdFileCount: () => 0,
|
|
587
|
+
getProjectRoot: () => '/',
|
|
588
|
+
refreshAuth: vi.fn(),
|
|
589
|
+
};
|
|
590
|
+
vi.mocked(loadCliConfig).mockResolvedValue(mockConfig);
|
|
591
|
+
vi.mocked(loadSandboxConfig).mockResolvedValue({}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
592
|
+
vi.mocked(relaunchOnExitCode).mockImplementation(async (fn) => {
|
|
593
|
+
await fn();
|
|
594
|
+
});
|
|
595
|
+
try {
|
|
596
|
+
await main();
|
|
597
|
+
}
|
|
598
|
+
catch (e) {
|
|
599
|
+
if (!(e instanceof MockProcessExitError))
|
|
600
|
+
throw e;
|
|
601
|
+
}
|
|
602
|
+
expect(start_sandbox).toHaveBeenCalled();
|
|
603
|
+
expect(processExitSpy).toHaveBeenCalledWith(0);
|
|
604
|
+
processExitSpy.mockRestore();
|
|
605
|
+
});
|
|
606
|
+
it('should exit with error when --prompt-interactive is used with piped input', async () => {
|
|
607
|
+
const { loadCliConfig, parseArguments } = await import('./config/config.js');
|
|
608
|
+
const { loadSettings } = await import('./config/settings.js');
|
|
609
|
+
const core = await import('@google/gemini-cli-core');
|
|
610
|
+
const processExitSpy = vi
|
|
611
|
+
.spyOn(process, 'exit')
|
|
612
|
+
.mockImplementation((code) => {
|
|
613
|
+
throw new MockProcessExitError(code);
|
|
614
|
+
});
|
|
615
|
+
const writeToStderrSpy = vi
|
|
616
|
+
.spyOn(core, 'writeToStderr')
|
|
617
|
+
.mockImplementation(() => true);
|
|
618
|
+
vi.mocked(loadSettings).mockReturnValue({
|
|
619
|
+
merged: { advanced: {}, security: { auth: {} }, ui: {} },
|
|
620
|
+
setValue: vi.fn(),
|
|
621
|
+
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
|
|
622
|
+
errors: [],
|
|
623
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
624
|
+
vi.mocked(parseArguments).mockResolvedValue({
|
|
625
|
+
promptInteractive: true,
|
|
626
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
627
|
+
vi.mocked(loadCliConfig).mockResolvedValue({
|
|
628
|
+
isInteractive: () => false,
|
|
629
|
+
getQuestion: () => '',
|
|
630
|
+
getSandbox: () => false,
|
|
631
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
632
|
+
// Mock stdin to be non-TTY
|
|
633
|
+
Object.defineProperty(process.stdin, 'isTTY', {
|
|
634
|
+
value: false,
|
|
635
|
+
configurable: true,
|
|
636
|
+
});
|
|
637
|
+
try {
|
|
638
|
+
await main();
|
|
639
|
+
}
|
|
640
|
+
catch (e) {
|
|
641
|
+
if (!(e instanceof MockProcessExitError))
|
|
642
|
+
throw e;
|
|
643
|
+
}
|
|
644
|
+
expect(writeToStderrSpy).toHaveBeenCalledWith(expect.stringContaining('Error: The --prompt-interactive flag cannot be used'));
|
|
645
|
+
expect(processExitSpy).toHaveBeenCalledWith(1);
|
|
646
|
+
processExitSpy.mockRestore();
|
|
647
|
+
writeToStderrSpy.mockRestore();
|
|
648
|
+
Object.defineProperty(process.stdin, 'isTTY', {
|
|
649
|
+
value: true,
|
|
650
|
+
configurable: true,
|
|
651
|
+
}); // Restore TTY
|
|
652
|
+
});
|
|
653
|
+
it('should log warning when theme is not found', async () => {
|
|
654
|
+
const { loadCliConfig, parseArguments } = await import('./config/config.js');
|
|
655
|
+
const { loadSettings } = await import('./config/settings.js');
|
|
656
|
+
const { themeManager } = await import('./ui/themes/theme-manager.js');
|
|
657
|
+
const debugLoggerWarnSpy = vi
|
|
658
|
+
.spyOn(debugLogger, 'warn')
|
|
659
|
+
.mockImplementation(() => { });
|
|
660
|
+
const processExitSpy = vi
|
|
661
|
+
.spyOn(process, 'exit')
|
|
662
|
+
.mockImplementation((code) => {
|
|
663
|
+
throw new MockProcessExitError(code);
|
|
664
|
+
});
|
|
665
|
+
vi.mocked(loadSettings).mockReturnValue({
|
|
666
|
+
merged: {
|
|
667
|
+
advanced: {},
|
|
668
|
+
security: { auth: {} },
|
|
669
|
+
ui: { theme: 'non-existent-theme' },
|
|
670
|
+
},
|
|
671
|
+
setValue: vi.fn(),
|
|
672
|
+
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
|
|
673
|
+
errors: [],
|
|
674
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
675
|
+
vi.mocked(parseArguments).mockResolvedValue({
|
|
676
|
+
promptInteractive: false,
|
|
677
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
678
|
+
vi.mocked(loadCliConfig).mockResolvedValue({
|
|
679
|
+
isInteractive: () => false,
|
|
680
|
+
getQuestion: () => 'test',
|
|
681
|
+
getSandbox: () => false,
|
|
682
|
+
getDebugMode: () => false,
|
|
683
|
+
getPolicyEngine: vi.fn(),
|
|
684
|
+
getMessageBus: () => ({ subscribe: vi.fn() }),
|
|
685
|
+
initialize: vi.fn(),
|
|
686
|
+
getContentGeneratorConfig: vi.fn(),
|
|
687
|
+
getMcpServers: () => ({}),
|
|
688
|
+
getMcpClientManager: vi.fn(),
|
|
689
|
+
getIdeMode: () => false,
|
|
690
|
+
getExperimentalZedIntegration: () => false,
|
|
691
|
+
getScreenReader: () => false,
|
|
692
|
+
getGeminiMdFileCount: () => 0,
|
|
693
|
+
getProjectRoot: () => '/',
|
|
694
|
+
getListExtensions: () => false,
|
|
695
|
+
getListSessions: () => false,
|
|
696
|
+
getDeleteSession: () => undefined,
|
|
697
|
+
getToolRegistry: vi.fn(),
|
|
698
|
+
getExtensions: () => [],
|
|
699
|
+
getModel: () => 'gemini-pro',
|
|
700
|
+
getEmbeddingModel: () => 'embedding-001',
|
|
701
|
+
getApprovalMode: () => 'default',
|
|
702
|
+
getCoreTools: () => [],
|
|
703
|
+
getTelemetryEnabled: () => false,
|
|
704
|
+
getTelemetryLogPromptsEnabled: () => false,
|
|
705
|
+
getFileFilteringRespectGitIgnore: () => true,
|
|
706
|
+
getOutputFormat: () => 'text',
|
|
707
|
+
getUsageStatisticsEnabled: () => false,
|
|
708
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
709
|
+
vi.spyOn(themeManager, 'setActiveTheme').mockReturnValue(false);
|
|
710
|
+
try {
|
|
711
|
+
await main();
|
|
712
|
+
}
|
|
713
|
+
catch (e) {
|
|
714
|
+
if (!(e instanceof MockProcessExitError))
|
|
715
|
+
throw e;
|
|
716
|
+
}
|
|
717
|
+
expect(debugLoggerWarnSpy).toHaveBeenCalledWith(expect.stringContaining('Warning: Theme "non-existent-theme" not found.'));
|
|
718
|
+
processExitSpy.mockRestore();
|
|
719
|
+
});
|
|
720
|
+
it('should handle session selector error', async () => {
|
|
721
|
+
const { loadCliConfig, parseArguments } = await import('./config/config.js');
|
|
722
|
+
const { loadSettings } = await import('./config/settings.js');
|
|
723
|
+
vi.mock('./utils/sessionUtils.js', () => ({
|
|
724
|
+
SessionSelector: class {
|
|
725
|
+
resolveSession = vi
|
|
726
|
+
.fn()
|
|
727
|
+
.mockRejectedValue(new Error('Session not found'));
|
|
728
|
+
},
|
|
729
|
+
}));
|
|
730
|
+
const processExitSpy = vi
|
|
731
|
+
.spyOn(process, 'exit')
|
|
732
|
+
.mockImplementation((code) => {
|
|
733
|
+
throw new MockProcessExitError(code);
|
|
734
|
+
});
|
|
735
|
+
const consoleErrorSpy = vi
|
|
736
|
+
.spyOn(console, 'error')
|
|
737
|
+
.mockImplementation(() => { });
|
|
738
|
+
vi.mocked(loadSettings).mockReturnValue({
|
|
739
|
+
merged: { advanced: {}, security: { auth: {} }, ui: { theme: 'test' } },
|
|
740
|
+
setValue: vi.fn(),
|
|
741
|
+
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
|
|
742
|
+
errors: [],
|
|
743
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
744
|
+
vi.mocked(parseArguments).mockResolvedValue({
|
|
745
|
+
promptInteractive: false,
|
|
746
|
+
resume: 'session-id',
|
|
747
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
748
|
+
vi.mocked(loadCliConfig).mockResolvedValue({
|
|
749
|
+
isInteractive: () => true,
|
|
750
|
+
getQuestion: () => '',
|
|
751
|
+
getSandbox: () => false,
|
|
752
|
+
getDebugMode: () => false,
|
|
753
|
+
getPolicyEngine: vi.fn(),
|
|
754
|
+
getMessageBus: () => ({ subscribe: vi.fn() }),
|
|
755
|
+
initialize: vi.fn(),
|
|
756
|
+
getContentGeneratorConfig: vi.fn(),
|
|
757
|
+
getMcpServers: () => ({}),
|
|
758
|
+
getMcpClientManager: vi.fn(),
|
|
759
|
+
getIdeMode: () => false,
|
|
760
|
+
getExperimentalZedIntegration: () => false,
|
|
761
|
+
getScreenReader: () => false,
|
|
762
|
+
getGeminiMdFileCount: () => 0,
|
|
763
|
+
getProjectRoot: () => '/',
|
|
764
|
+
getListExtensions: () => false,
|
|
765
|
+
getListSessions: () => false,
|
|
766
|
+
getDeleteSession: () => undefined,
|
|
767
|
+
getToolRegistry: vi.fn(),
|
|
768
|
+
getExtensions: () => [],
|
|
769
|
+
getModel: () => 'gemini-pro',
|
|
770
|
+
getEmbeddingModel: () => 'embedding-001',
|
|
771
|
+
getApprovalMode: () => 'default',
|
|
772
|
+
getCoreTools: () => [],
|
|
773
|
+
getTelemetryEnabled: () => false,
|
|
774
|
+
getTelemetryLogPromptsEnabled: () => false,
|
|
775
|
+
getFileFilteringRespectGitIgnore: () => true,
|
|
776
|
+
getOutputFormat: () => 'text',
|
|
777
|
+
getUsageStatisticsEnabled: () => false,
|
|
778
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
779
|
+
try {
|
|
780
|
+
await main();
|
|
781
|
+
}
|
|
782
|
+
catch (e) {
|
|
783
|
+
if (!(e instanceof MockProcessExitError))
|
|
784
|
+
throw e;
|
|
785
|
+
}
|
|
786
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining('Error resuming session: Session not found'));
|
|
787
|
+
expect(processExitSpy).toHaveBeenCalledWith(1);
|
|
788
|
+
processExitSpy.mockRestore();
|
|
789
|
+
consoleErrorSpy.mockRestore();
|
|
790
|
+
});
|
|
791
|
+
it.skip('should log error when cleanupExpiredSessions fails', async () => {
|
|
792
|
+
const { loadCliConfig, parseArguments } = await import('./config/config.js');
|
|
793
|
+
const { loadSettings } = await import('./config/settings.js');
|
|
794
|
+
const { cleanupExpiredSessions } = await import('./utils/sessionCleanup.js');
|
|
795
|
+
vi.mocked(cleanupExpiredSessions).mockRejectedValue(new Error('Cleanup failed'));
|
|
796
|
+
const debugLoggerErrorSpy = vi
|
|
797
|
+
.spyOn(debugLogger, 'error')
|
|
798
|
+
.mockImplementation(() => { });
|
|
799
|
+
const processExitSpy = vi
|
|
800
|
+
.spyOn(process, 'exit')
|
|
801
|
+
.mockImplementation((code) => {
|
|
802
|
+
throw new MockProcessExitError(code);
|
|
803
|
+
});
|
|
804
|
+
vi.mocked(loadSettings).mockReturnValue({
|
|
805
|
+
merged: { advanced: {}, security: { auth: {} }, ui: {} },
|
|
806
|
+
setValue: vi.fn(),
|
|
807
|
+
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
|
|
808
|
+
errors: [],
|
|
809
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
810
|
+
vi.mocked(parseArguments).mockResolvedValue({
|
|
811
|
+
promptInteractive: false,
|
|
812
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
813
|
+
vi.mocked(loadCliConfig).mockResolvedValue({
|
|
814
|
+
isInteractive: () => false,
|
|
815
|
+
getQuestion: () => 'test',
|
|
816
|
+
getSandbox: () => false,
|
|
817
|
+
getDebugMode: () => false,
|
|
818
|
+
getPolicyEngine: vi.fn(),
|
|
819
|
+
getMessageBus: () => ({ subscribe: vi.fn() }),
|
|
820
|
+
initialize: vi.fn(),
|
|
821
|
+
getContentGeneratorConfig: vi.fn(),
|
|
822
|
+
getMcpServers: () => ({}),
|
|
823
|
+
getMcpClientManager: vi.fn(),
|
|
824
|
+
getIdeMode: () => false,
|
|
825
|
+
getExperimentalZedIntegration: () => false,
|
|
826
|
+
getScreenReader: () => false,
|
|
827
|
+
getGeminiMdFileCount: () => 0,
|
|
828
|
+
getProjectRoot: () => '/',
|
|
829
|
+
getListExtensions: () => false,
|
|
830
|
+
getListSessions: () => false,
|
|
831
|
+
getDeleteSession: () => undefined,
|
|
832
|
+
getToolRegistry: vi.fn(),
|
|
833
|
+
getExtensions: () => [],
|
|
834
|
+
getModel: () => 'gemini-pro',
|
|
835
|
+
getEmbeddingModel: () => 'embedding-001',
|
|
836
|
+
getApprovalMode: () => 'default',
|
|
837
|
+
getCoreTools: () => [],
|
|
838
|
+
getTelemetryEnabled: () => false,
|
|
839
|
+
getTelemetryLogPromptsEnabled: () => false,
|
|
840
|
+
getFileFilteringRespectGitIgnore: () => true,
|
|
841
|
+
getOutputFormat: () => 'text',
|
|
842
|
+
getUsageStatisticsEnabled: () => false,
|
|
843
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
844
|
+
// The mock is already set up at the top of the test
|
|
845
|
+
try {
|
|
846
|
+
await main();
|
|
847
|
+
}
|
|
848
|
+
catch (e) {
|
|
849
|
+
if (!(e instanceof MockProcessExitError))
|
|
850
|
+
throw e;
|
|
851
|
+
}
|
|
852
|
+
expect(debugLoggerErrorSpy).toHaveBeenCalledWith(expect.stringContaining('Failed to cleanup expired sessions: Cleanup failed'));
|
|
853
|
+
expect(processExitSpy).toHaveBeenCalledWith(0); // Should not exit on cleanup failure
|
|
854
|
+
processExitSpy.mockRestore();
|
|
855
|
+
});
|
|
856
|
+
it('should handle refreshAuth failure', async () => {
|
|
857
|
+
const { loadCliConfig, parseArguments } = await import('./config/config.js');
|
|
858
|
+
const { loadSettings } = await import('./config/settings.js');
|
|
859
|
+
const { loadSandboxConfig } = await import('./config/sandboxConfig.js');
|
|
860
|
+
const processExitSpy = vi
|
|
861
|
+
.spyOn(process, 'exit')
|
|
862
|
+
.mockImplementation((code) => {
|
|
863
|
+
throw new MockProcessExitError(code);
|
|
864
|
+
});
|
|
865
|
+
const debugLoggerErrorSpy = vi
|
|
866
|
+
.spyOn(debugLogger, 'error')
|
|
867
|
+
.mockImplementation(() => { });
|
|
868
|
+
vi.mocked(loadSettings).mockReturnValue({
|
|
869
|
+
merged: {
|
|
870
|
+
advanced: {},
|
|
871
|
+
security: { auth: { selectedType: 'google' } },
|
|
872
|
+
ui: {},
|
|
873
|
+
},
|
|
874
|
+
setValue: vi.fn(),
|
|
875
|
+
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
|
|
876
|
+
errors: [],
|
|
877
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
878
|
+
vi.mocked(loadSandboxConfig).mockResolvedValue({}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
879
|
+
vi.mocked(parseArguments).mockResolvedValue({
|
|
880
|
+
promptInteractive: false,
|
|
881
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
882
|
+
vi.mocked(loadCliConfig).mockResolvedValue({
|
|
883
|
+
isInteractive: () => true,
|
|
884
|
+
getQuestion: () => '',
|
|
885
|
+
getSandbox: () => false,
|
|
886
|
+
getDebugMode: () => false,
|
|
887
|
+
getPolicyEngine: vi.fn(),
|
|
888
|
+
getMessageBus: () => ({ subscribe: vi.fn() }),
|
|
889
|
+
initialize: vi.fn(),
|
|
890
|
+
getContentGeneratorConfig: vi.fn(),
|
|
891
|
+
getMcpServers: () => ({}),
|
|
892
|
+
getMcpClientManager: vi.fn(),
|
|
893
|
+
getIdeMode: () => false,
|
|
894
|
+
getExperimentalZedIntegration: () => false,
|
|
895
|
+
getScreenReader: () => false,
|
|
896
|
+
getGeminiMdFileCount: () => 0,
|
|
897
|
+
getProjectRoot: () => '/',
|
|
898
|
+
getListExtensions: () => false,
|
|
899
|
+
getListSessions: () => false,
|
|
900
|
+
getDeleteSession: () => undefined,
|
|
901
|
+
getToolRegistry: vi.fn(),
|
|
902
|
+
getExtensions: () => [],
|
|
903
|
+
getModel: () => 'gemini-pro',
|
|
904
|
+
getEmbeddingModel: () => 'embedding-001',
|
|
905
|
+
getApprovalMode: () => 'default',
|
|
906
|
+
getCoreTools: () => [],
|
|
907
|
+
getTelemetryEnabled: () => false,
|
|
908
|
+
getTelemetryLogPromptsEnabled: () => false,
|
|
909
|
+
getFileFilteringRespectGitIgnore: () => true,
|
|
910
|
+
getOutputFormat: () => 'text',
|
|
911
|
+
getUsageStatisticsEnabled: () => false,
|
|
912
|
+
refreshAuth: vi.fn().mockRejectedValue(new Error('Auth refresh failed')),
|
|
913
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
914
|
+
try {
|
|
915
|
+
await main();
|
|
916
|
+
}
|
|
917
|
+
catch (e) {
|
|
918
|
+
if (!(e instanceof MockProcessExitError))
|
|
919
|
+
throw e;
|
|
920
|
+
}
|
|
921
|
+
expect(debugLoggerErrorSpy).toHaveBeenCalledWith('Error authenticating:', expect.any(Error));
|
|
922
|
+
expect(processExitSpy).toHaveBeenCalledWith(1);
|
|
923
|
+
processExitSpy.mockRestore();
|
|
924
|
+
});
|
|
925
|
+
it('should read from stdin in non-interactive mode', async () => {
|
|
926
|
+
const { loadCliConfig, parseArguments } = await import('./config/config.js');
|
|
927
|
+
const { loadSettings } = await import('./config/settings.js');
|
|
928
|
+
const { readStdin } = await import('./utils/readStdin.js');
|
|
929
|
+
const processExitSpy = vi
|
|
930
|
+
.spyOn(process, 'exit')
|
|
931
|
+
.mockImplementation((code) => {
|
|
932
|
+
throw new MockProcessExitError(code);
|
|
933
|
+
});
|
|
934
|
+
vi.mocked(loadSettings).mockReturnValue({
|
|
935
|
+
merged: { advanced: {}, security: { auth: {} }, ui: {} },
|
|
936
|
+
setValue: vi.fn(),
|
|
937
|
+
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
|
|
938
|
+
errors: [],
|
|
939
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
940
|
+
vi.mocked(parseArguments).mockResolvedValue({
|
|
941
|
+
promptInteractive: false,
|
|
942
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
943
|
+
vi.mocked(loadCliConfig).mockResolvedValue({
|
|
944
|
+
isInteractive: () => false,
|
|
945
|
+
getQuestion: () => 'test-question',
|
|
946
|
+
getSandbox: () => false,
|
|
947
|
+
getDebugMode: () => false,
|
|
948
|
+
getPolicyEngine: vi.fn(),
|
|
949
|
+
getMessageBus: () => ({ subscribe: vi.fn() }),
|
|
950
|
+
initialize: vi.fn(),
|
|
951
|
+
getContentGeneratorConfig: vi.fn(),
|
|
952
|
+
getMcpServers: () => ({}),
|
|
953
|
+
getMcpClientManager: vi.fn(),
|
|
954
|
+
getIdeMode: () => false,
|
|
955
|
+
getExperimentalZedIntegration: () => false,
|
|
956
|
+
getScreenReader: () => false,
|
|
957
|
+
getGeminiMdFileCount: () => 0,
|
|
958
|
+
getProjectRoot: () => '/',
|
|
959
|
+
getListExtensions: () => false,
|
|
960
|
+
getListSessions: () => false,
|
|
961
|
+
getDeleteSession: () => undefined,
|
|
962
|
+
getToolRegistry: vi.fn(),
|
|
963
|
+
getExtensions: () => [],
|
|
964
|
+
getModel: () => 'gemini-pro',
|
|
965
|
+
getEmbeddingModel: () => 'embedding-001',
|
|
966
|
+
getApprovalMode: () => 'default',
|
|
967
|
+
getCoreTools: () => [],
|
|
968
|
+
getTelemetryEnabled: () => false,
|
|
969
|
+
getTelemetryLogPromptsEnabled: () => false,
|
|
970
|
+
getFileFilteringRespectGitIgnore: () => true,
|
|
971
|
+
getOutputFormat: () => 'text',
|
|
972
|
+
getUsageStatisticsEnabled: () => false,
|
|
973
|
+
}); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
974
|
+
vi.mock('./utils/readStdin.js', () => ({
|
|
975
|
+
readStdin: vi.fn().mockResolvedValue('stdin-data'),
|
|
976
|
+
}));
|
|
977
|
+
const runNonInteractiveSpy = vi.hoisted(() => vi.fn());
|
|
978
|
+
vi.mock('./nonInteractiveCli.js', () => ({
|
|
979
|
+
runNonInteractive: runNonInteractiveSpy,
|
|
980
|
+
}));
|
|
981
|
+
runNonInteractiveSpy.mockClear();
|
|
982
|
+
vi.mock('./validateNonInterActiveAuth.js', () => ({
|
|
983
|
+
validateNonInteractiveAuth: vi.fn().mockResolvedValue({}),
|
|
984
|
+
}));
|
|
985
|
+
// Mock stdin to be non-TTY
|
|
986
|
+
Object.defineProperty(process.stdin, 'isTTY', {
|
|
987
|
+
value: false,
|
|
988
|
+
configurable: true,
|
|
989
|
+
});
|
|
990
|
+
try {
|
|
991
|
+
await main();
|
|
992
|
+
}
|
|
993
|
+
catch (e) {
|
|
994
|
+
if (!(e instanceof MockProcessExitError))
|
|
995
|
+
throw e;
|
|
996
|
+
}
|
|
997
|
+
expect(readStdin).toHaveBeenCalled();
|
|
998
|
+
// In this test setup, runNonInteractive might be called on the mocked module,
|
|
999
|
+
// but we need to ensure we are checking the correct spy instance.
|
|
1000
|
+
// Since vi.mock is hoisted, runNonInteractiveSpy is defined early.
|
|
1001
|
+
expect(runNonInteractiveSpy).toHaveBeenCalled();
|
|
1002
|
+
const callArgs = runNonInteractiveSpy.mock.calls[0][0];
|
|
1003
|
+
expect(callArgs.input).toBe('test-question');
|
|
1004
|
+
expect(processExitSpy).toHaveBeenCalledWith(0);
|
|
1005
|
+
processExitSpy.mockRestore();
|
|
1006
|
+
Object.defineProperty(process.stdin, 'isTTY', {
|
|
1007
|
+
value: true,
|
|
1008
|
+
configurable: true,
|
|
1009
|
+
});
|
|
1010
|
+
});
|
|
398
1011
|
});
|
|
399
1012
|
describe('validateDnsResolutionOrder', () => {
|
|
400
1013
|
let debugLoggerWarnSpy;
|
|
@@ -490,6 +1103,17 @@ describe('startInteractiveUI', () => {
|
|
|
490
1103
|
// Verify React element structure is valid (but don't deep dive into JSX internals)
|
|
491
1104
|
expect(reactElement).toBeDefined();
|
|
492
1105
|
});
|
|
1106
|
+
it('should enable mouse events when alternate buffer is enabled', async () => {
|
|
1107
|
+
const { enableMouseEvents } = await import('@google/gemini-cli-core');
|
|
1108
|
+
await startTestInteractiveUI(mockConfig, mockSettings, mockStartupWarnings, mockWorkspaceRoot, undefined, mockInitializationResult);
|
|
1109
|
+
expect(enableMouseEvents).toHaveBeenCalled();
|
|
1110
|
+
});
|
|
1111
|
+
it('should patch console', async () => {
|
|
1112
|
+
const { ConsolePatcher } = await import('./ui/utils/ConsolePatcher.js');
|
|
1113
|
+
const patchSpy = vi.spyOn(ConsolePatcher.prototype, 'patch');
|
|
1114
|
+
await startTestInteractiveUI(mockConfig, mockSettings, mockStartupWarnings, mockWorkspaceRoot, undefined, mockInitializationResult);
|
|
1115
|
+
expect(patchSpy).toHaveBeenCalled();
|
|
1116
|
+
});
|
|
493
1117
|
it('should perform all startup tasks in correct order', async () => {
|
|
494
1118
|
const { getCliVersion } = await import('./utils/version.js');
|
|
495
1119
|
const { checkForUpdates } = await import('./ui/utils/updateCheck.js');
|