@machina.ai/cell-cli 1.4.0-rc2 → 1.5.5-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.
Files changed (223) hide show
  1. package/dist/package.json +4 -3
  2. package/dist/src/config/config.js +13 -10
  3. package/dist/src/config/config.js.map +1 -1
  4. package/dist/src/config/extension.js +4 -0
  5. package/dist/src/config/extension.js.map +1 -1
  6. package/dist/src/config/settings.js +2 -2
  7. package/dist/src/config/settings.js.map +1 -1
  8. package/dist/src/config/settingsSchema.d.ts +47 -4
  9. package/dist/src/config/settingsSchema.js +41 -1
  10. package/dist/src/config/settingsSchema.js.map +1 -1
  11. package/dist/src/config/settingsSchema.test.js +62 -55
  12. package/dist/src/config/settingsSchema.test.js.map +1 -1
  13. package/dist/src/core/auth.d.ts +13 -0
  14. package/dist/src/core/auth.js +27 -0
  15. package/dist/src/core/auth.js.map +1 -0
  16. package/dist/src/core/initializer.d.ts +21 -0
  17. package/dist/src/core/initializer.js +28 -0
  18. package/dist/src/core/initializer.js.map +1 -0
  19. package/dist/src/core/theme.d.ts +12 -0
  20. package/dist/src/core/theme.js +20 -0
  21. package/dist/src/core/theme.js.map +1 -0
  22. package/dist/src/gemini.d.ts +2 -1
  23. package/dist/src/gemini.js +92 -53
  24. package/dist/src/gemini.js.map +1 -1
  25. package/dist/src/gemini.test.js +105 -14
  26. package/dist/src/gemini.test.js.map +1 -1
  27. package/dist/src/generated/git-commit.d.ts +2 -2
  28. package/dist/src/generated/git-commit.js +2 -2
  29. package/dist/src/generated/git-commit.js.map +1 -1
  30. package/dist/src/nonInteractiveCli.js +75 -73
  31. package/dist/src/nonInteractiveCli.js.map +1 -1
  32. package/dist/src/services/BuiltinCommandLoader.test.js +16 -17
  33. package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -1
  34. package/dist/src/ui/App.d.ts +1 -10
  35. package/dist/src/ui/App.js +13 -729
  36. package/dist/src/ui/App.js.map +1 -1
  37. package/dist/src/ui/AppContainer.d.ts +17 -0
  38. package/dist/src/ui/AppContainer.js +837 -0
  39. package/dist/src/ui/AppContainer.js.map +1 -0
  40. package/dist/src/ui/AppContainer.test.js +378 -0
  41. package/dist/src/ui/AppContainer.test.js.map +1 -0
  42. package/dist/src/ui/auth/AuthDialog.d.ts +18 -0
  43. package/dist/src/ui/auth/AuthDialog.js +81 -0
  44. package/dist/src/ui/auth/AuthDialog.js.map +1 -0
  45. package/dist/src/ui/auth/AuthDialog.test.d.ts +6 -0
  46. package/dist/src/ui/auth/AuthDialog.test.js +176 -0
  47. package/dist/src/ui/auth/AuthDialog.test.js.map +1 -0
  48. package/dist/src/ui/auth/AuthInProgress.js.map +1 -0
  49. package/dist/src/ui/auth/useAuth.d.ts +15 -0
  50. package/dist/src/ui/auth/useAuth.js +73 -0
  51. package/dist/src/ui/auth/useAuth.js.map +1 -0
  52. package/dist/src/ui/commands/corgiCommand.js +1 -0
  53. package/dist/src/ui/commands/corgiCommand.js.map +1 -1
  54. package/dist/src/ui/commands/mcpCommand.js +1 -1
  55. package/dist/src/ui/commands/mcpCommand.js.map +1 -1
  56. package/dist/src/ui/commands/types.d.ts +1 -0
  57. package/dist/src/ui/components/AppHeader.d.ts +10 -0
  58. package/dist/src/ui/components/AppHeader.js +22 -0
  59. package/dist/src/ui/components/AppHeader.js.map +1 -0
  60. package/dist/src/ui/components/AsciiArt.d.ts +3 -3
  61. package/dist/src/ui/components/AsciiArt.js +3 -3
  62. package/dist/src/ui/components/Composer.d.ts +6 -0
  63. package/dist/src/ui/components/Composer.js +69 -0
  64. package/dist/src/ui/components/Composer.js.map +1 -0
  65. package/dist/src/ui/components/Composer.test.d.ts +6 -0
  66. package/dist/src/ui/components/Composer.test.js +340 -0
  67. package/dist/src/ui/components/Composer.test.js.map +1 -0
  68. package/dist/src/ui/components/ConfigInitDisplay.d.ts +6 -0
  69. package/dist/src/ui/components/ConfigInitDisplay.js +37 -0
  70. package/dist/src/ui/components/ConfigInitDisplay.js.map +1 -0
  71. package/dist/src/ui/components/DialogManager.d.ts +6 -0
  72. package/dist/src/ui/components/DialogManager.js +81 -0
  73. package/dist/src/ui/components/DialogManager.js.map +1 -0
  74. package/dist/src/ui/components/FolderTrustDialog.js +16 -7
  75. package/dist/src/ui/components/FolderTrustDialog.js.map +1 -1
  76. package/dist/src/ui/components/FolderTrustDialog.test.js +12 -7
  77. package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
  78. package/dist/src/ui/components/Footer.d.ts +1 -5
  79. package/dist/src/ui/components/Footer.js +3 -4
  80. package/dist/src/ui/components/Footer.js.map +1 -1
  81. package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +5 -0
  82. package/dist/src/ui/components/GeminiRespondingSpinner.js +5 -1
  83. package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -1
  84. package/dist/src/ui/components/Help.d.ts +1 -1
  85. package/dist/src/ui/components/Help.js +6 -3
  86. package/dist/src/ui/components/Help.js.map +1 -1
  87. package/dist/src/ui/components/Help.test.d.ts +6 -0
  88. package/dist/src/ui/components/Help.test.js +57 -0
  89. package/dist/src/ui/components/Help.test.js.map +1 -0
  90. package/dist/src/ui/components/HistoryItemDisplay.d.ts +0 -2
  91. package/dist/src/ui/components/HistoryItemDisplay.js +1 -1
  92. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
  93. package/dist/src/ui/components/InputPrompt.js +25 -3
  94. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  95. package/dist/src/ui/components/MainContent.d.ts +6 -0
  96. package/dist/src/ui/components/MainContent.js +23 -0
  97. package/dist/src/ui/components/MainContent.js.map +1 -0
  98. package/dist/src/ui/components/Notifications.d.ts +6 -0
  99. package/dist/src/ui/components/Notifications.js +23 -0
  100. package/dist/src/ui/components/Notifications.js.map +1 -0
  101. package/dist/src/ui/components/ProQuotaDialog.d.ts +2 -2
  102. package/dist/src/ui/components/ProQuotaDialog.js +2 -2
  103. package/dist/src/ui/components/ProQuotaDialog.js.map +1 -1
  104. package/dist/src/ui/components/ProQuotaDialog.test.js +3 -3
  105. package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -1
  106. package/dist/src/ui/components/QuittingDisplay.d.ts +6 -0
  107. package/dist/src/ui/components/QuittingDisplay.js +20 -0
  108. package/dist/src/ui/components/QuittingDisplay.js.map +1 -0
  109. package/dist/src/ui/components/SettingsDialog.js +20 -5
  110. package/dist/src/ui/components/SettingsDialog.js.map +1 -1
  111. package/dist/src/ui/components/SettingsDialog.test.js +144 -79
  112. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
  113. package/dist/src/ui/components/SuggestionsDisplay.d.ts +2 -0
  114. package/dist/src/ui/components/SuggestionsDisplay.js +6 -12
  115. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
  116. package/dist/src/ui/components/ThemeDialog.js +10 -27
  117. package/dist/src/ui/components/ThemeDialog.js.map +1 -1
  118. package/dist/src/ui/components/ThemeDialog.test.d.ts +6 -0
  119. package/dist/src/ui/components/ThemeDialog.test.js +65 -0
  120. package/dist/src/ui/components/ThemeDialog.test.js.map +1 -0
  121. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +0 -2
  122. package/dist/src/ui/components/messages/ToolGroupMessage.js +7 -5
  123. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
  124. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +17 -15
  125. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -1
  126. package/dist/src/ui/components/shared/EnumSelector.d.ts +18 -0
  127. package/dist/src/ui/components/shared/EnumSelector.js +44 -0
  128. package/dist/src/ui/components/shared/EnumSelector.js.map +1 -0
  129. package/dist/src/ui/components/shared/EnumSelector.test.d.ts +6 -0
  130. package/dist/src/ui/components/shared/EnumSelector.test.js +70 -0
  131. package/dist/src/ui/components/shared/EnumSelector.test.js.map +1 -0
  132. package/dist/src/ui/components/shared/ScopeSelector.d.ts +19 -0
  133. package/dist/src/ui/components/shared/ScopeSelector.js +11 -0
  134. package/dist/src/ui/components/shared/ScopeSelector.js.map +1 -0
  135. package/dist/src/ui/contexts/AppContext.d.ts +11 -0
  136. package/dist/src/ui/contexts/AppContext.js +15 -0
  137. package/dist/src/ui/contexts/AppContext.js.map +1 -0
  138. package/dist/src/ui/contexts/ConfigContext.d.ts +9 -0
  139. package/dist/src/ui/contexts/ConfigContext.js +16 -0
  140. package/dist/src/ui/contexts/ConfigContext.js.map +1 -0
  141. package/dist/src/ui/contexts/KeypressContext.d.ts +3 -0
  142. package/dist/src/ui/contexts/KeypressContext.js +51 -2
  143. package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
  144. package/dist/src/ui/contexts/KeypressContext.test.js +173 -1
  145. package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
  146. package/dist/src/ui/contexts/UIActionsContext.d.ts +36 -0
  147. package/dist/src/ui/contexts/UIActionsContext.js +20 -0
  148. package/dist/src/ui/contexts/UIActionsContext.js.map +1 -0
  149. package/dist/src/ui/contexts/UIStateContext.d.ts +92 -0
  150. package/dist/src/ui/contexts/UIStateContext.js +15 -0
  151. package/dist/src/ui/contexts/UIStateContext.js.map +1 -0
  152. package/dist/src/ui/hooks/atCommandProcessor.test.js +7 -5
  153. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
  154. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +13 -2
  155. package/dist/src/ui/hooks/slashCommandProcessor.js +14 -26
  156. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  157. package/dist/src/ui/hooks/useFolderTrust.d.ts +1 -1
  158. package/dist/src/ui/hooks/useFolderTrust.js +12 -13
  159. package/dist/src/ui/hooks/useFolderTrust.js.map +1 -1
  160. package/dist/src/ui/hooks/useGeminiStream.d.ts +1 -1
  161. package/dist/src/ui/hooks/useGeminiStream.js +36 -34
  162. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  163. package/dist/src/ui/hooks/useMessageQueue.d.ts +2 -1
  164. package/dist/src/ui/hooks/useMessageQueue.js +5 -3
  165. package/dist/src/ui/hooks/useMessageQueue.js.map +1 -1
  166. package/dist/src/ui/hooks/useMessageQueue.test.js +9 -0
  167. package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
  168. package/dist/src/ui/hooks/useQuotaAndFallback.d.ts +21 -0
  169. package/dist/src/ui/hooks/useQuotaAndFallback.js +122 -0
  170. package/dist/src/ui/hooks/useQuotaAndFallback.js.map +1 -0
  171. package/dist/src/ui/hooks/useQuotaAndFallback.test.d.ts +6 -0
  172. package/dist/src/ui/hooks/useQuotaAndFallback.test.js +269 -0
  173. package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -0
  174. package/dist/src/ui/hooks/useReactToolScheduler.js +2 -0
  175. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
  176. package/dist/src/ui/hooks/useSlashCompletion.js +4 -2
  177. package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
  178. package/dist/src/ui/hooks/useSlashCompletion.test.js +155 -268
  179. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
  180. package/dist/src/ui/hooks/useThemeCommand.d.ts +1 -1
  181. package/dist/src/ui/hooks/useThemeCommand.js +3 -14
  182. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
  183. package/dist/src/ui/hooks/useToolScheduler.test.js +6 -1
  184. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
  185. package/dist/src/ui/types.d.ts +17 -1
  186. package/dist/src/ui/types.js +10 -0
  187. package/dist/src/ui/types.js.map +1 -1
  188. package/dist/src/ui/utils/highlight.d.ts +1 -1
  189. package/dist/src/ui/utils/highlight.js +15 -6
  190. package/dist/src/ui/utils/highlight.js.map +1 -1
  191. package/dist/src/ui/utils/highlight.test.js +56 -29
  192. package/dist/src/ui/utils/highlight.test.js.map +1 -1
  193. package/dist/src/ui/utils/kittyProtocolDetector.js +39 -29
  194. package/dist/src/ui/utils/kittyProtocolDetector.js.map +1 -1
  195. package/dist/src/utils/processUtils.d.ts +13 -0
  196. package/dist/src/utils/processUtils.js +18 -0
  197. package/dist/src/utils/processUtils.js.map +1 -0
  198. package/dist/src/utils/processUtils.test.d.ts +6 -0
  199. package/dist/src/utils/processUtils.test.js +20 -0
  200. package/dist/src/utils/processUtils.test.js.map +1 -0
  201. package/dist/src/utils/sandbox.d.ts +1 -1
  202. package/dist/src/utils/sandbox.js +17 -8
  203. package/dist/src/utils/sandbox.js.map +1 -1
  204. package/dist/src/utils/settingsUtils.d.ts +16 -6
  205. package/dist/src/utils/settingsUtils.js +35 -25
  206. package/dist/src/utils/settingsUtils.js.map +1 -1
  207. package/dist/src/utils/settingsUtils.test.js +418 -156
  208. package/dist/src/utils/settingsUtils.test.js.map +1 -1
  209. package/dist/src/zed-integration/schema.d.ts +596 -596
  210. package/dist/tsconfig.tsbuildinfo +1 -1
  211. package/package.json +4 -3
  212. package/dist/src/ui/components/AuthDialog.d.ts +0 -16
  213. package/dist/src/ui/components/AuthDialog.js +0 -62
  214. package/dist/src/ui/components/AuthDialog.js.map +0 -1
  215. package/dist/src/ui/components/AuthDialog.test.js +0 -175
  216. package/dist/src/ui/components/AuthDialog.test.js.map +0 -1
  217. package/dist/src/ui/components/AuthInProgress.js.map +0 -1
  218. package/dist/src/ui/hooks/useAuthCommand.d.ts +0 -15
  219. package/dist/src/ui/hooks/useAuthCommand.js +0 -68
  220. package/dist/src/ui/hooks/useAuthCommand.js.map +0 -1
  221. /package/dist/src/ui/{components/AuthDialog.test.d.ts → AppContainer.test.d.ts} +0 -0
  222. /package/dist/src/ui/{components → auth}/AuthInProgress.d.ts +0 -0
  223. /package/dist/src/ui/{components → auth}/AuthInProgress.js +0 -0
@@ -0,0 +1,837 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * @license
4
+ * Copyright 2025 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ import { useMemo, useState, useCallback, useEffect, useRef } from 'react';
8
+ import { measureElement } from 'ink';
9
+ import { App } from './App.js';
10
+ import { AppContext } from './contexts/AppContext.js';
11
+ import { UIStateContext } from './contexts/UIStateContext.js';
12
+ import { UIActionsContext, } from './contexts/UIActionsContext.js';
13
+ import { ConfigContext } from './contexts/ConfigContext.js';
14
+ import { ToolCallStatus, AuthState, } from './types.js';
15
+ import { MessageType, StreamingState } from './types.js';
16
+ import { DEFAULT_GEMINI_FLASH_MODEL, IdeClient, ideContext, getErrorMessage, getAllGeminiMdFilenames, AuthType, clearCachedCredentialFile, } from '@google/gemini-cli-core';
17
+ import { validateAuthMethod } from '../config/auth.js';
18
+ import { loadHierarchicalGeminiMemory } from '../config/config.js';
19
+ import process from 'node:process';
20
+ import { useHistory } from './hooks/useHistoryManager.js';
21
+ import { useThemeCommand } from './hooks/useThemeCommand.js';
22
+ import { useAuthCommand } from './auth/useAuth.js';
23
+ import { useQuotaAndFallback } from './hooks/useQuotaAndFallback.js';
24
+ import { useEditorSettings } from './hooks/useEditorSettings.js';
25
+ import { useSettingsCommand } from './hooks/useSettingsCommand.js';
26
+ import { useSlashCommandProcessor } from './hooks/slashCommandProcessor.js';
27
+ import { useVimMode } from './contexts/VimModeContext.js';
28
+ import { useConsoleMessages } from './hooks/useConsoleMessages.js';
29
+ import { useTerminalSize } from './hooks/useTerminalSize.js';
30
+ import { useStdin, useStdout } from 'ink';
31
+ import ansiEscapes from 'ansi-escapes';
32
+ import * as fs from 'node:fs';
33
+ import { useTextBuffer } from './components/shared/text-buffer.js';
34
+ import { useLogger } from './hooks/useLogger.js';
35
+ import { useGeminiStream } from './hooks/useGeminiStream.js';
36
+ import { useVim } from './hooks/vim.js';
37
+ import { SettingScope } from '../config/settings.js';
38
+ import {} from '../core/initializer.js';
39
+ import { useFocus } from './hooks/useFocus.js';
40
+ import { useBracketedPaste } from './hooks/useBracketedPaste.js';
41
+ import { useKeypress } from './hooks/useKeypress.js';
42
+ import { keyMatchers, Command } from './keyMatchers.js';
43
+ import { useLoadingIndicator } from './hooks/useLoadingIndicator.js';
44
+ import { useFolderTrust } from './hooks/useFolderTrust.js';
45
+ import { useIdeTrustListener } from './hooks/useIdeTrustListener.js';
46
+ import {} from './IdeIntegrationNudge.js';
47
+ import { appEvents, AppEvent } from '../utils/events.js';
48
+ import {} from './utils/updateCheck.js';
49
+ import { setUpdateHandler } from '../utils/handleAutoUpdate.js';
50
+ import { ConsolePatcher } from './utils/ConsolePatcher.js';
51
+ import { registerCleanup, runExitCleanup } from '../utils/cleanup.js';
52
+ import { useMessageQueue } from './hooks/useMessageQueue.js';
53
+ import { useAutoAcceptIndicator } from './hooks/useAutoAcceptIndicator.js';
54
+ import { useWorkspaceMigration } from './hooks/useWorkspaceMigration.js';
55
+ import { useSessionStats } from './contexts/SessionContext.js';
56
+ import { useGitBranchName } from './hooks/useGitBranchName.js';
57
+ const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
58
+ function isToolExecuting(pendingHistoryItems) {
59
+ return pendingHistoryItems.some((item) => {
60
+ if (item && item.type === 'tool_group') {
61
+ return item.tools.some((tool) => ToolCallStatus.Executing === tool.status);
62
+ }
63
+ return false;
64
+ });
65
+ }
66
+ export const AppContainer = (props) => {
67
+ const { settings, config, initializationResult } = props;
68
+ const historyManager = useHistory();
69
+ const [corgiMode, setCorgiMode] = useState(false);
70
+ const [debugMessage, setDebugMessage] = useState('');
71
+ const [quittingMessages, setQuittingMessages] = useState(null);
72
+ const [showPrivacyNotice, setShowPrivacyNotice] = useState(false);
73
+ const [themeError, setThemeError] = useState(initializationResult.themeError);
74
+ const [isProcessing, setIsProcessing] = useState(false);
75
+ const [geminiMdFileCount, setGeminiMdFileCount] = useState(initializationResult.geminiMdFileCount);
76
+ const [shellModeActive, setShellModeActive] = useState(false);
77
+ const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = useState(false);
78
+ const [historyRemountKey, setHistoryRemountKey] = useState(0);
79
+ const [updateInfo, setUpdateInfo] = useState(null);
80
+ const [isTrustedFolder, setIsTrustedFolder] = useState(config.isTrustedFolder());
81
+ // Helper to determine the effective model, considering the fallback state.
82
+ const getEffectiveModel = useCallback(() => {
83
+ if (config.isInFallbackMode()) {
84
+ return DEFAULT_GEMINI_FLASH_MODEL;
85
+ }
86
+ return config.getModel();
87
+ }, [config]);
88
+ const [currentModel, setCurrentModel] = useState(getEffectiveModel());
89
+ const [userTier, setUserTier] = useState(undefined);
90
+ const [isConfigInitialized, setConfigInitialized] = useState(false);
91
+ // Auto-accept indicator
92
+ const showAutoAcceptIndicator = useAutoAcceptIndicator({
93
+ config,
94
+ addItem: historyManager.addItem,
95
+ });
96
+ const logger = useLogger(config.storage);
97
+ const [userMessages, setUserMessages] = useState([]);
98
+ // Terminal and layout hooks
99
+ const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
100
+ const { stdin, setRawMode } = useStdin();
101
+ const { stdout } = useStdout();
102
+ // Additional hooks moved from App.tsx
103
+ const { stats: sessionStats } = useSessionStats();
104
+ const branchName = useGitBranchName(config.getTargetDir());
105
+ // Layout measurements
106
+ const mainControlsRef = useRef(null);
107
+ const staticExtraHeight = 3;
108
+ useEffect(() => {
109
+ (async () => {
110
+ // Note: the program will not work if this fails so let errors be
111
+ // handled by the global catch.
112
+ await config.initialize();
113
+ setConfigInitialized(true);
114
+ })();
115
+ registerCleanup(async () => {
116
+ const ideClient = await IdeClient.getInstance();
117
+ await ideClient.disconnect();
118
+ });
119
+ }, [config]);
120
+ useEffect(() => setUpdateHandler(historyManager.addItem, setUpdateInfo), [historyManager.addItem]);
121
+ // Watch for model changes (e.g., from Flash fallback)
122
+ useEffect(() => {
123
+ const checkModelChange = () => {
124
+ const effectiveModel = getEffectiveModel();
125
+ if (effectiveModel !== currentModel) {
126
+ setCurrentModel(effectiveModel);
127
+ }
128
+ };
129
+ checkModelChange();
130
+ const interval = setInterval(checkModelChange, 1000); // Check every second
131
+ return () => clearInterval(interval);
132
+ }, [config, currentModel, getEffectiveModel]);
133
+ const { consoleMessages, handleNewMessage, clearConsoleMessages: clearConsoleMessagesState, } = useConsoleMessages();
134
+ useEffect(() => {
135
+ const consolePatcher = new ConsolePatcher({
136
+ onNewMessage: handleNewMessage,
137
+ debugMode: config.getDebugMode(),
138
+ });
139
+ consolePatcher.patch();
140
+ registerCleanup(consolePatcher.cleanup);
141
+ }, [handleNewMessage, config]);
142
+ const widthFraction = 0.9;
143
+ const inputWidth = Math.max(20, Math.floor(terminalWidth * widthFraction) - 3);
144
+ const suggestionsWidth = Math.max(20, Math.floor(terminalWidth * 0.8));
145
+ const mainAreaWidth = Math.floor(terminalWidth * 0.9);
146
+ const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
147
+ const isValidPath = useCallback((filePath) => {
148
+ try {
149
+ return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
150
+ }
151
+ catch (_e) {
152
+ return false;
153
+ }
154
+ }, []);
155
+ const buffer = useTextBuffer({
156
+ initialText: '',
157
+ viewport: { height: 10, width: inputWidth },
158
+ stdin,
159
+ setRawMode,
160
+ isValidPath,
161
+ shellModeActive,
162
+ });
163
+ useEffect(() => {
164
+ const fetchUserMessages = async () => {
165
+ const pastMessagesRaw = (await logger?.getPreviousUserMessages()) || [];
166
+ const currentSessionUserMessages = historyManager.history
167
+ .filter((item) => item.type === 'user' &&
168
+ typeof item.text === 'string' &&
169
+ item.text.trim() !== '')
170
+ .map((item) => item.text)
171
+ .reverse();
172
+ const combinedMessages = [
173
+ ...currentSessionUserMessages,
174
+ ...pastMessagesRaw,
175
+ ];
176
+ const deduplicatedMessages = [];
177
+ if (combinedMessages.length > 0) {
178
+ deduplicatedMessages.push(combinedMessages[0]);
179
+ for (let i = 1; i < combinedMessages.length; i++) {
180
+ if (combinedMessages[i] !== combinedMessages[i - 1]) {
181
+ deduplicatedMessages.push(combinedMessages[i]);
182
+ }
183
+ }
184
+ }
185
+ setUserMessages(deduplicatedMessages.reverse());
186
+ };
187
+ fetchUserMessages();
188
+ }, [historyManager.history, logger]);
189
+ const refreshStatic = useCallback(() => {
190
+ stdout.write(ansiEscapes.clearTerminal);
191
+ setHistoryRemountKey((prev) => prev + 1);
192
+ }, [setHistoryRemountKey, stdout]);
193
+ const { isThemeDialogOpen, openThemeDialog, handleThemeSelect, handleThemeHighlight, } = useThemeCommand(settings, setThemeError, historyManager.addItem, initializationResult.themeError);
194
+ const { authState, setAuthState, authError, onAuthError } = useAuthCommand(settings, config);
195
+ const { proQuotaRequest, handleProQuotaChoice } = useQuotaAndFallback({
196
+ config,
197
+ historyManager,
198
+ userTier,
199
+ setAuthState,
200
+ setModelSwitchedFromQuotaError,
201
+ });
202
+ // Derive auth state variables for backward compatibility with UIStateContext
203
+ const isAuthDialogOpen = authState === AuthState.Updating;
204
+ const isAuthenticating = authState === AuthState.Unauthenticated;
205
+ // Create handleAuthSelect wrapper for backward compatibility
206
+ const handleAuthSelect = useCallback(async (authType, scope) => {
207
+ if (authType) {
208
+ await clearCachedCredentialFile();
209
+ settings.setValue(scope, 'security.auth.selectedType', authType);
210
+ try {
211
+ await config.refreshAuth(authType);
212
+ setAuthState(AuthState.Authenticated);
213
+ }
214
+ catch (e) {
215
+ onAuthError(`Failed to authenticate: ${e instanceof Error ? e.message : String(e)}`);
216
+ return;
217
+ }
218
+ if (authType === AuthType.LOGIN_WITH_GOOGLE &&
219
+ config.isBrowserLaunchSuppressed()) {
220
+ await runExitCleanup();
221
+ console.log(`
222
+ ----------------------------------------------------------------
223
+ Logging in with Google... Please restart Gemini CLI to continue.
224
+ ----------------------------------------------------------------
225
+ `);
226
+ process.exit(0);
227
+ }
228
+ }
229
+ setAuthState(AuthState.Authenticated);
230
+ }, [settings, config, setAuthState, onAuthError]);
231
+ // Sync user tier from config when authentication changes
232
+ useEffect(() => {
233
+ // Only sync when not currently authenticating
234
+ if (authState === AuthState.Authenticated) {
235
+ setUserTier(config.getUserTier());
236
+ }
237
+ }, [config, authState]);
238
+ // Check for enforced auth type mismatch
239
+ useEffect(() => {
240
+ if (settings.merged.security?.auth?.enforcedType &&
241
+ settings.merged.security?.auth.selectedType &&
242
+ settings.merged.security?.auth.enforcedType !==
243
+ settings.merged.security?.auth.selectedType) {
244
+ onAuthError(`Authentication is enforced to be ${settings.merged.security?.auth.enforcedType}, but you are currently using ${settings.merged.security?.auth.selectedType}.`);
245
+ }
246
+ else if (settings.merged.security?.auth?.selectedType &&
247
+ !settings.merged.security?.auth?.useExternal) {
248
+ const error = validateAuthMethod(settings.merged.security.auth.selectedType);
249
+ if (error) {
250
+ onAuthError(error);
251
+ }
252
+ }
253
+ }, [
254
+ settings.merged.security?.auth?.selectedType,
255
+ settings.merged.security?.auth?.enforcedType,
256
+ settings.merged.security?.auth?.useExternal,
257
+ onAuthError,
258
+ ]);
259
+ const [editorError, setEditorError] = useState(null);
260
+ const { isEditorDialogOpen, openEditorDialog, handleEditorSelect, exitEditorDialog, } = useEditorSettings(settings, setEditorError, historyManager.addItem);
261
+ const { isSettingsDialogOpen, openSettingsDialog, closeSettingsDialog } = useSettingsCommand();
262
+ const { showWorkspaceMigrationDialog, workspaceExtensions, onWorkspaceMigrationDialogOpen, onWorkspaceMigrationDialogClose, } = useWorkspaceMigration(settings);
263
+ const { toggleVimEnabled } = useVimMode();
264
+ const slashCommandActions = useMemo(() => ({
265
+ openAuthDialog: () => setAuthState(AuthState.Updating),
266
+ openThemeDialog,
267
+ openEditorDialog,
268
+ openPrivacyNotice: () => setShowPrivacyNotice(true),
269
+ openSettingsDialog,
270
+ quit: (messages) => {
271
+ setQuittingMessages(messages);
272
+ setTimeout(async () => {
273
+ await runExitCleanup();
274
+ process.exit(0);
275
+ }, 100);
276
+ },
277
+ setDebugMessage,
278
+ toggleCorgiMode: () => setCorgiMode((prev) => !prev),
279
+ }), [
280
+ setAuthState,
281
+ openThemeDialog,
282
+ openEditorDialog,
283
+ openSettingsDialog,
284
+ setQuittingMessages,
285
+ setDebugMessage,
286
+ setShowPrivacyNotice,
287
+ setCorgiMode,
288
+ ]);
289
+ const { handleSlashCommand, slashCommands, pendingHistoryItems: pendingSlashCommandHistoryItems, commandContext, shellConfirmationRequest, confirmationRequest, } = useSlashCommandProcessor(config, settings, historyManager.addItem, historyManager.clearItems, historyManager.loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, setGeminiMdFileCount, slashCommandActions, isConfigInitialized);
290
+ const performMemoryRefresh = useCallback(async () => {
291
+ historyManager.addItem({
292
+ type: MessageType.INFO,
293
+ text: 'Refreshing hierarchical memory (GEMINI.md or other context files)...',
294
+ }, Date.now());
295
+ try {
296
+ const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory(process.cwd(), settings.merged.context?.loadMemoryFromIncludeDirectories
297
+ ? config.getWorkspaceContext().getDirectories()
298
+ : [], config.getDebugMode(), config.getFileService(), settings.merged, config.getExtensionContextFilePaths(), config.isTrustedFolder(), settings.merged.context?.importFormat || 'tree', // Use setting or default to 'tree'
299
+ config.getFileFilteringOptions());
300
+ config.setUserMemory(memoryContent);
301
+ config.setGeminiMdFileCount(fileCount);
302
+ setGeminiMdFileCount(fileCount);
303
+ historyManager.addItem({
304
+ type: MessageType.INFO,
305
+ text: `Memory refreshed successfully. ${memoryContent.length > 0
306
+ ? `Loaded ${memoryContent.length} characters from ${fileCount} file(s).`
307
+ : 'No memory content found.'}`,
308
+ }, Date.now());
309
+ if (config.getDebugMode()) {
310
+ console.log(`[DEBUG] Refreshed memory content in config: ${memoryContent.substring(0, 200)}...`);
311
+ }
312
+ }
313
+ catch (error) {
314
+ const errorMessage = getErrorMessage(error);
315
+ historyManager.addItem({
316
+ type: MessageType.ERROR,
317
+ text: `Error refreshing memory: ${errorMessage}`,
318
+ }, Date.now());
319
+ console.error('Error refreshing memory:', error);
320
+ }
321
+ }, [config, historyManager, settings.merged]);
322
+ const cancelHandlerRef = useRef(() => { });
323
+ const { streamingState, submitQuery, initError, pendingHistoryItems: pendingGeminiHistoryItems, thought, cancelOngoingRequest, } = useGeminiStream(config.getGeminiClient(), historyManager.history, historyManager.addItem, config, settings, setDebugMessage, handleSlashCommand, shellModeActive, () => settings.merged.general?.preferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError, refreshStatic, () => cancelHandlerRef.current());
324
+ const { messageQueue, addMessage, clearQueue, getQueuedMessagesText } = useMessageQueue({
325
+ isConfigInitialized,
326
+ streamingState,
327
+ submitQuery,
328
+ });
329
+ cancelHandlerRef.current = useCallback(() => {
330
+ const pendingHistoryItems = [
331
+ ...pendingSlashCommandHistoryItems,
332
+ ...pendingGeminiHistoryItems,
333
+ ];
334
+ if (isToolExecuting(pendingHistoryItems)) {
335
+ buffer.setText(''); // Just clear the prompt
336
+ return;
337
+ }
338
+ const lastUserMessage = userMessages.at(-1);
339
+ let textToSet = lastUserMessage || '';
340
+ const queuedText = getQueuedMessagesText();
341
+ if (queuedText) {
342
+ textToSet = textToSet ? `${textToSet}\n\n${queuedText}` : queuedText;
343
+ clearQueue();
344
+ }
345
+ if (textToSet) {
346
+ buffer.setText(textToSet);
347
+ }
348
+ }, [
349
+ buffer,
350
+ userMessages,
351
+ getQueuedMessagesText,
352
+ clearQueue,
353
+ pendingSlashCommandHistoryItems,
354
+ pendingGeminiHistoryItems,
355
+ ]);
356
+ const handleFinalSubmit = useCallback((submittedValue) => {
357
+ addMessage(submittedValue);
358
+ }, [addMessage]);
359
+ const handleClearScreen = useCallback(() => {
360
+ historyManager.clearItems();
361
+ clearConsoleMessagesState();
362
+ console.clear();
363
+ refreshStatic();
364
+ }, [historyManager, clearConsoleMessagesState, refreshStatic]);
365
+ const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
366
+ /**
367
+ * Determines if the input prompt should be active and accept user input.
368
+ * Input is disabled during:
369
+ * - Initialization errors
370
+ * - Slash command processing
371
+ * - Tool confirmations (WaitingForConfirmation state)
372
+ * - Any future streaming states not explicitly allowed
373
+ */
374
+ const isInputActive = !initError &&
375
+ !isProcessing &&
376
+ (streamingState === StreamingState.Idle ||
377
+ streamingState === StreamingState.Responding) &&
378
+ !proQuotaRequest;
379
+ // Compute available terminal height based on controls measurement
380
+ const availableTerminalHeight = useMemo(() => {
381
+ if (mainControlsRef.current) {
382
+ const fullFooterMeasurement = measureElement(mainControlsRef.current);
383
+ return terminalHeight - fullFooterMeasurement.height - staticExtraHeight;
384
+ }
385
+ return terminalHeight - staticExtraHeight;
386
+ }, [terminalHeight]);
387
+ const isFocused = useFocus();
388
+ useBracketedPaste();
389
+ // Context file names computation
390
+ const contextFileNames = useMemo(() => {
391
+ const fromSettings = settings.merged.context?.fileName;
392
+ return fromSettings
393
+ ? Array.isArray(fromSettings)
394
+ ? fromSettings
395
+ : [fromSettings]
396
+ : getAllGeminiMdFilenames();
397
+ }, [settings.merged.context?.fileName]);
398
+ // Initial prompt handling
399
+ const initialPrompt = useMemo(() => config.getQuestion(), [config]);
400
+ const initialPromptSubmitted = useRef(false);
401
+ const geminiClient = config.getGeminiClient();
402
+ useEffect(() => {
403
+ if (initialPrompt &&
404
+ isConfigInitialized &&
405
+ !initialPromptSubmitted.current &&
406
+ !isAuthenticating &&
407
+ !isAuthDialogOpen &&
408
+ !isThemeDialogOpen &&
409
+ !isEditorDialogOpen &&
410
+ !showPrivacyNotice &&
411
+ geminiClient?.isInitialized?.()) {
412
+ handleFinalSubmit(initialPrompt);
413
+ initialPromptSubmitted.current = true;
414
+ }
415
+ }, [
416
+ initialPrompt,
417
+ isConfigInitialized,
418
+ handleFinalSubmit,
419
+ isAuthenticating,
420
+ isAuthDialogOpen,
421
+ isThemeDialogOpen,
422
+ isEditorDialogOpen,
423
+ showPrivacyNotice,
424
+ geminiClient,
425
+ ]);
426
+ const [idePromptAnswered, setIdePromptAnswered] = useState(false);
427
+ const [currentIDE, setCurrentIDE] = useState(null);
428
+ useEffect(() => {
429
+ const getIde = async () => {
430
+ const ideClient = await IdeClient.getInstance();
431
+ const currentIde = ideClient.getCurrentIde();
432
+ setCurrentIDE(currentIde || null);
433
+ };
434
+ getIde();
435
+ }, []);
436
+ const shouldShowIdePrompt = Boolean(currentIDE &&
437
+ !config.getIdeMode() &&
438
+ !settings.merged.ide?.hasSeenNudge &&
439
+ !idePromptAnswered);
440
+ const [showErrorDetails, setShowErrorDetails] = useState(false);
441
+ const [showToolDescriptions, setShowToolDescriptions] = useState(false);
442
+ const [ctrlCPressedOnce, setCtrlCPressedOnce] = useState(false);
443
+ const ctrlCTimerRef = useRef(null);
444
+ const [ctrlDPressedOnce, setCtrlDPressedOnce] = useState(false);
445
+ const ctrlDTimerRef = useRef(null);
446
+ const [constrainHeight, setConstrainHeight] = useState(true);
447
+ const [ideContextState, setIdeContextState] = useState();
448
+ const [showEscapePrompt, setShowEscapePrompt] = useState(false);
449
+ const [showIdeRestartPrompt, setShowIdeRestartPrompt] = useState(false);
450
+ const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings, setIsTrustedFolder, refreshStatic);
451
+ const { needsRestart: ideNeedsRestart } = useIdeTrustListener();
452
+ const isInitialMount = useRef(true);
453
+ useEffect(() => {
454
+ if (ideNeedsRestart) {
455
+ // IDE trust changed, force a restart.
456
+ setShowIdeRestartPrompt(true);
457
+ }
458
+ }, [ideNeedsRestart]);
459
+ useEffect(() => {
460
+ if (isInitialMount.current) {
461
+ isInitialMount.current = false;
462
+ return;
463
+ }
464
+ const handler = setTimeout(() => {
465
+ refreshStatic();
466
+ }, 300);
467
+ return () => {
468
+ clearTimeout(handler);
469
+ };
470
+ }, [terminalWidth, refreshStatic]);
471
+ useEffect(() => {
472
+ const unsubscribe = ideContext.subscribeToIdeContext(setIdeContextState);
473
+ setIdeContextState(ideContext.getIdeContext());
474
+ return unsubscribe;
475
+ }, []);
476
+ useEffect(() => {
477
+ const openDebugConsole = () => {
478
+ setShowErrorDetails(true);
479
+ setConstrainHeight(false);
480
+ };
481
+ appEvents.on(AppEvent.OpenDebugConsole, openDebugConsole);
482
+ const logErrorHandler = (errorMessage) => {
483
+ handleNewMessage({
484
+ type: 'error',
485
+ content: String(errorMessage),
486
+ count: 1,
487
+ });
488
+ };
489
+ appEvents.on(AppEvent.LogError, logErrorHandler);
490
+ return () => {
491
+ appEvents.off(AppEvent.OpenDebugConsole, openDebugConsole);
492
+ appEvents.off(AppEvent.LogError, logErrorHandler);
493
+ };
494
+ }, [handleNewMessage]);
495
+ const handleEscapePromptChange = useCallback((showPrompt) => {
496
+ setShowEscapePrompt(showPrompt);
497
+ }, []);
498
+ const handleIdePromptComplete = useCallback((result) => {
499
+ if (result.userSelection === 'yes') {
500
+ handleSlashCommand('/ide install');
501
+ settings.setValue(SettingScope.User, 'hasSeenIdeIntegrationNudge', true);
502
+ }
503
+ else if (result.userSelection === 'dismiss') {
504
+ settings.setValue(SettingScope.User, 'hasSeenIdeIntegrationNudge', true);
505
+ }
506
+ setIdePromptAnswered(true);
507
+ }, [handleSlashCommand, settings]);
508
+ const { elapsedTime, currentLoadingPhrase } = useLoadingIndicator(streamingState);
509
+ const handleExit = useCallback((pressedOnce, setPressedOnce, timerRef) => {
510
+ if (pressedOnce) {
511
+ if (timerRef.current) {
512
+ clearTimeout(timerRef.current);
513
+ }
514
+ handleSlashCommand('/quit');
515
+ }
516
+ else {
517
+ setPressedOnce(true);
518
+ timerRef.current = setTimeout(() => {
519
+ setPressedOnce(false);
520
+ timerRef.current = null;
521
+ }, CTRL_EXIT_PROMPT_DURATION_MS);
522
+ }
523
+ }, [handleSlashCommand]);
524
+ const handleGlobalKeypress = useCallback((key) => {
525
+ // Debug log keystrokes if enabled
526
+ if (settings.merged.general?.debugKeystrokeLogging) {
527
+ console.log('[DEBUG] Keystroke:', JSON.stringify(key));
528
+ }
529
+ const anyDialogOpen = isThemeDialogOpen ||
530
+ isAuthDialogOpen ||
531
+ isEditorDialogOpen ||
532
+ isSettingsDialogOpen ||
533
+ isFolderTrustDialogOpen ||
534
+ showPrivacyNotice;
535
+ if (anyDialogOpen) {
536
+ return;
537
+ }
538
+ let enteringConstrainHeightMode = false;
539
+ if (!constrainHeight) {
540
+ enteringConstrainHeightMode = true;
541
+ setConstrainHeight(true);
542
+ }
543
+ if (keyMatchers[Command.SHOW_ERROR_DETAILS](key)) {
544
+ setShowErrorDetails((prev) => !prev);
545
+ }
546
+ else if (keyMatchers[Command.TOGGLE_TOOL_DESCRIPTIONS](key)) {
547
+ const newValue = !showToolDescriptions;
548
+ setShowToolDescriptions(newValue);
549
+ const mcpServers = config.getMcpServers();
550
+ if (Object.keys(mcpServers || {}).length > 0) {
551
+ handleSlashCommand(newValue ? '/mcp desc' : '/mcp nodesc');
552
+ }
553
+ }
554
+ else if (keyMatchers[Command.TOGGLE_IDE_CONTEXT_DETAIL](key) &&
555
+ config.getIdeMode() &&
556
+ ideContextState) {
557
+ handleSlashCommand('/ide status');
558
+ }
559
+ else if (keyMatchers[Command.QUIT](key)) {
560
+ if (!ctrlCPressedOnce) {
561
+ cancelOngoingRequest?.();
562
+ }
563
+ handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef);
564
+ }
565
+ else if (keyMatchers[Command.EXIT](key)) {
566
+ if (buffer.text.length > 0) {
567
+ return;
568
+ }
569
+ handleExit(ctrlDPressedOnce, setCtrlDPressedOnce, ctrlDTimerRef);
570
+ }
571
+ else if (keyMatchers[Command.SHOW_MORE_LINES](key) &&
572
+ !enteringConstrainHeightMode) {
573
+ setConstrainHeight(false);
574
+ }
575
+ }, [
576
+ constrainHeight,
577
+ setConstrainHeight,
578
+ setShowErrorDetails,
579
+ showToolDescriptions,
580
+ setShowToolDescriptions,
581
+ config,
582
+ ideContextState,
583
+ handleExit,
584
+ ctrlCPressedOnce,
585
+ setCtrlCPressedOnce,
586
+ ctrlCTimerRef,
587
+ buffer.text.length,
588
+ ctrlDPressedOnce,
589
+ setCtrlDPressedOnce,
590
+ ctrlDTimerRef,
591
+ handleSlashCommand,
592
+ cancelOngoingRequest,
593
+ isThemeDialogOpen,
594
+ isAuthDialogOpen,
595
+ isEditorDialogOpen,
596
+ isSettingsDialogOpen,
597
+ isFolderTrustDialogOpen,
598
+ showPrivacyNotice,
599
+ settings.merged.general?.debugKeystrokeLogging,
600
+ ]);
601
+ useKeypress(handleGlobalKeypress, { isActive: true });
602
+ useKeypress((key) => {
603
+ if (key.name === 'r' || key.name === 'R') {
604
+ process.exit(0);
605
+ }
606
+ }, { isActive: showIdeRestartPrompt });
607
+ const filteredConsoleMessages = useMemo(() => {
608
+ if (config.getDebugMode()) {
609
+ return consoleMessages;
610
+ }
611
+ return consoleMessages.filter((msg) => msg.type !== 'debug');
612
+ }, [consoleMessages, config]);
613
+ // Computed values
614
+ const errorCount = useMemo(() => filteredConsoleMessages
615
+ .filter((msg) => msg.type === 'error')
616
+ .reduce((total, msg) => total + msg.count, 0), [filteredConsoleMessages]);
617
+ const nightly = props.version.includes('nightly');
618
+ const dialogsVisible = useMemo(() => showWorkspaceMigrationDialog ||
619
+ shouldShowIdePrompt ||
620
+ isFolderTrustDialogOpen ||
621
+ !!shellConfirmationRequest ||
622
+ !!confirmationRequest ||
623
+ isThemeDialogOpen ||
624
+ isSettingsDialogOpen ||
625
+ isAuthenticating ||
626
+ isAuthDialogOpen ||
627
+ isEditorDialogOpen ||
628
+ showPrivacyNotice ||
629
+ !!proQuotaRequest, [
630
+ showWorkspaceMigrationDialog,
631
+ shouldShowIdePrompt,
632
+ isFolderTrustDialogOpen,
633
+ shellConfirmationRequest,
634
+ confirmationRequest,
635
+ isThemeDialogOpen,
636
+ isSettingsDialogOpen,
637
+ isAuthenticating,
638
+ isAuthDialogOpen,
639
+ isEditorDialogOpen,
640
+ showPrivacyNotice,
641
+ proQuotaRequest,
642
+ ]);
643
+ const pendingHistoryItems = useMemo(() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems], [pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]);
644
+ const uiState = useMemo(() => ({
645
+ history: historyManager.history,
646
+ isThemeDialogOpen,
647
+ themeError,
648
+ isAuthenticating,
649
+ isConfigInitialized,
650
+ authError,
651
+ authMessage: authError ?? '',
652
+ isAuthDialogOpen,
653
+ editorError,
654
+ isEditorDialogOpen,
655
+ showPrivacyNotice,
656
+ corgiMode,
657
+ debugMessage,
658
+ quittingMessages,
659
+ isSettingsDialogOpen,
660
+ slashCommands,
661
+ pendingSlashCommandHistoryItems,
662
+ commandContext,
663
+ shellConfirmationRequest,
664
+ confirmationRequest,
665
+ geminiMdFileCount,
666
+ streamingState,
667
+ initError,
668
+ pendingGeminiHistoryItems,
669
+ thought,
670
+ shellModeActive,
671
+ userMessages,
672
+ buffer,
673
+ inputWidth,
674
+ suggestionsWidth,
675
+ isInputActive,
676
+ shouldShowIdePrompt,
677
+ isFolderTrustDialogOpen: isFolderTrustDialogOpen ?? false,
678
+ isTrustedFolder,
679
+ constrainHeight,
680
+ showErrorDetails,
681
+ filteredConsoleMessages,
682
+ ideContextState,
683
+ showToolDescriptions,
684
+ ctrlCPressedOnce,
685
+ ctrlDPressedOnce,
686
+ showEscapePrompt,
687
+ isFocused,
688
+ elapsedTime,
689
+ currentLoadingPhrase,
690
+ historyRemountKey,
691
+ messageQueue,
692
+ showAutoAcceptIndicator,
693
+ showWorkspaceMigrationDialog,
694
+ workspaceExtensions,
695
+ currentModel,
696
+ userTier,
697
+ proQuotaRequest,
698
+ contextFileNames,
699
+ errorCount,
700
+ availableTerminalHeight,
701
+ mainAreaWidth,
702
+ staticAreaMaxItemHeight,
703
+ staticExtraHeight,
704
+ dialogsVisible,
705
+ pendingHistoryItems,
706
+ nightly,
707
+ branchName,
708
+ sessionStats,
709
+ terminalWidth,
710
+ terminalHeight,
711
+ mainControlsRef,
712
+ currentIDE,
713
+ updateInfo,
714
+ showIdeRestartPrompt,
715
+ isRestarting,
716
+ }), [
717
+ historyManager.history,
718
+ isThemeDialogOpen,
719
+ themeError,
720
+ isAuthenticating,
721
+ isConfigInitialized,
722
+ authError,
723
+ isAuthDialogOpen,
724
+ editorError,
725
+ isEditorDialogOpen,
726
+ showPrivacyNotice,
727
+ corgiMode,
728
+ debugMessage,
729
+ quittingMessages,
730
+ isSettingsDialogOpen,
731
+ slashCommands,
732
+ pendingSlashCommandHistoryItems,
733
+ commandContext,
734
+ shellConfirmationRequest,
735
+ confirmationRequest,
736
+ geminiMdFileCount,
737
+ streamingState,
738
+ initError,
739
+ pendingGeminiHistoryItems,
740
+ thought,
741
+ shellModeActive,
742
+ userMessages,
743
+ buffer,
744
+ inputWidth,
745
+ suggestionsWidth,
746
+ isInputActive,
747
+ shouldShowIdePrompt,
748
+ isFolderTrustDialogOpen,
749
+ isTrustedFolder,
750
+ constrainHeight,
751
+ showErrorDetails,
752
+ filteredConsoleMessages,
753
+ ideContextState,
754
+ showToolDescriptions,
755
+ ctrlCPressedOnce,
756
+ ctrlDPressedOnce,
757
+ showEscapePrompt,
758
+ isFocused,
759
+ elapsedTime,
760
+ currentLoadingPhrase,
761
+ historyRemountKey,
762
+ messageQueue,
763
+ showAutoAcceptIndicator,
764
+ showWorkspaceMigrationDialog,
765
+ workspaceExtensions,
766
+ userTier,
767
+ proQuotaRequest,
768
+ contextFileNames,
769
+ errorCount,
770
+ availableTerminalHeight,
771
+ mainAreaWidth,
772
+ staticAreaMaxItemHeight,
773
+ staticExtraHeight,
774
+ dialogsVisible,
775
+ pendingHistoryItems,
776
+ nightly,
777
+ branchName,
778
+ sessionStats,
779
+ terminalWidth,
780
+ terminalHeight,
781
+ mainControlsRef,
782
+ currentIDE,
783
+ updateInfo,
784
+ showIdeRestartPrompt,
785
+ isRestarting,
786
+ currentModel,
787
+ ]);
788
+ const uiActions = useMemo(() => ({
789
+ handleThemeSelect,
790
+ handleThemeHighlight,
791
+ handleAuthSelect,
792
+ setAuthState,
793
+ onAuthError,
794
+ handleEditorSelect,
795
+ exitEditorDialog,
796
+ exitPrivacyNotice: () => setShowPrivacyNotice(false),
797
+ closeSettingsDialog,
798
+ setShellModeActive,
799
+ vimHandleInput,
800
+ handleIdePromptComplete,
801
+ handleFolderTrustSelect,
802
+ setConstrainHeight,
803
+ onEscapePromptChange: handleEscapePromptChange,
804
+ refreshStatic,
805
+ handleFinalSubmit,
806
+ handleClearScreen,
807
+ onWorkspaceMigrationDialogOpen,
808
+ onWorkspaceMigrationDialogClose,
809
+ handleProQuotaChoice,
810
+ }), [
811
+ handleThemeSelect,
812
+ handleThemeHighlight,
813
+ handleAuthSelect,
814
+ setAuthState,
815
+ onAuthError,
816
+ handleEditorSelect,
817
+ exitEditorDialog,
818
+ closeSettingsDialog,
819
+ setShellModeActive,
820
+ vimHandleInput,
821
+ handleIdePromptComplete,
822
+ handleFolderTrustSelect,
823
+ setConstrainHeight,
824
+ handleEscapePromptChange,
825
+ refreshStatic,
826
+ handleFinalSubmit,
827
+ handleClearScreen,
828
+ onWorkspaceMigrationDialogOpen,
829
+ onWorkspaceMigrationDialogClose,
830
+ handleProQuotaChoice,
831
+ ]);
832
+ return (_jsx(UIStateContext.Provider, { value: uiState, children: _jsx(UIActionsContext.Provider, { value: uiActions, children: _jsx(ConfigContext.Provider, { value: config, children: _jsx(AppContext.Provider, { value: {
833
+ version: props.version,
834
+ startupWarnings: props.startupWarnings || [],
835
+ }, children: _jsx(App, {}) }) }) }) }));
836
+ };
837
+ //# sourceMappingURL=AppContainer.js.map