@google/gemini-cli 0.12.0-preview.4 → 0.13.0-nightly.20251031.c89bc30d

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 (254) hide show
  1. package/dist/google-gemini-cli-0.13.0-nightly.20251029.cca41edc.tgz +0 -0
  2. package/dist/package.json +2 -2
  3. package/dist/src/commands/extensions/install.js +2 -2
  4. package/dist/src/commands/extensions/install.js.map +1 -1
  5. package/dist/src/commands/extensions/install.test.js +27 -16
  6. package/dist/src/commands/extensions/install.test.js.map +1 -1
  7. package/dist/src/commands/extensions/link.js +2 -2
  8. package/dist/src/commands/extensions/link.js.map +1 -1
  9. package/dist/src/commands/extensions/update.js +3 -2
  10. package/dist/src/commands/extensions/update.js.map +1 -1
  11. package/dist/src/commands/extensions/validate.d.ts +12 -0
  12. package/dist/src/commands/extensions/validate.js +83 -0
  13. package/dist/src/commands/extensions/validate.js.map +1 -0
  14. package/dist/src/commands/extensions/validate.test.d.ts +6 -0
  15. package/dist/src/commands/extensions/validate.test.js +93 -0
  16. package/dist/src/commands/extensions/validate.test.js.map +1 -0
  17. package/dist/src/commands/extensions.js +2 -0
  18. package/dist/src/commands/extensions.js.map +1 -1
  19. package/dist/src/config/auth.js +0 -5
  20. package/dist/src/config/auth.js.map +1 -1
  21. package/dist/src/config/auth.test.js +1 -3
  22. package/dist/src/config/auth.test.js.map +1 -1
  23. package/dist/src/config/config.js +2 -1
  24. package/dist/src/config/config.js.map +1 -1
  25. package/dist/src/config/config.test.js +6 -10
  26. package/dist/src/config/config.test.js.map +1 -1
  27. package/dist/src/config/extensions/update.d.ts +2 -2
  28. package/dist/src/config/extensions/update.js +28 -22
  29. package/dist/src/config/extensions/update.js.map +1 -1
  30. package/dist/src/config/sandboxConfig.d.ts +1 -1
  31. package/dist/src/config/sandboxConfig.js +6 -3
  32. package/dist/src/config/sandboxConfig.js.map +1 -1
  33. package/dist/src/config/settings.js +2 -2
  34. package/dist/src/config/settings.js.map +1 -1
  35. package/dist/src/config/settings.test.js +13 -53
  36. package/dist/src/config/settings.test.js.map +1 -1
  37. package/dist/src/config/settingsSchema.d.ts +25 -7
  38. package/dist/src/config/settingsSchema.js +24 -6
  39. package/dist/src/config/settingsSchema.js.map +1 -1
  40. package/dist/src/config/settingsSchema.test.js +2 -0
  41. package/dist/src/config/settingsSchema.test.js.map +1 -1
  42. package/dist/src/gemini.js +8 -1
  43. package/dist/src/gemini.js.map +1 -1
  44. package/dist/src/gemini.test.js +1 -0
  45. package/dist/src/gemini.test.js.map +1 -1
  46. package/dist/src/generated/git-commit.d.ts +2 -2
  47. package/dist/src/generated/git-commit.js +2 -2
  48. package/dist/src/generated/git-commit.js.map +1 -1
  49. package/dist/src/nonInteractiveCli.d.ts +9 -1
  50. package/dist/src/nonInteractiveCli.js +16 -1
  51. package/dist/src/nonInteractiveCli.js.map +1 -1
  52. package/dist/src/nonInteractiveCli.test.js +209 -103
  53. package/dist/src/nonInteractiveCli.test.js.map +1 -1
  54. package/dist/src/test-utils/async.d.ts +9 -0
  55. package/dist/src/test-utils/async.js +29 -0
  56. package/dist/src/test-utils/async.js.map +1 -0
  57. package/dist/src/test-utils/render.d.ts +2 -1
  58. package/dist/src/test-utils/render.js +23 -1
  59. package/dist/src/test-utils/render.js.map +1 -1
  60. package/dist/src/test-utils/render.test.js +29 -4
  61. package/dist/src/test-utils/render.test.js.map +1 -1
  62. package/dist/src/ui/App.test.js +1 -1
  63. package/dist/src/ui/App.test.js.map +1 -1
  64. package/dist/src/ui/AppContainer.js +33 -4
  65. package/dist/src/ui/AppContainer.js.map +1 -1
  66. package/dist/src/ui/AppContainer.test.js +205 -99
  67. package/dist/src/ui/AppContainer.test.js.map +1 -1
  68. package/dist/src/ui/auth/ApiAuthDialog.d.ts +14 -0
  69. package/dist/src/ui/auth/ApiAuthDialog.js +26 -0
  70. package/dist/src/ui/auth/ApiAuthDialog.js.map +1 -0
  71. package/dist/src/ui/auth/ApiAuthDialog.test.d.ts +6 -0
  72. package/dist/src/ui/auth/ApiAuthDialog.test.js +91 -0
  73. package/dist/src/ui/auth/ApiAuthDialog.test.js.map +1 -0
  74. package/dist/src/ui/auth/AuthDialog.js +7 -3
  75. package/dist/src/ui/auth/AuthDialog.js.map +1 -1
  76. package/dist/src/ui/auth/AuthDialog.test.js +1 -1
  77. package/dist/src/ui/auth/AuthDialog.test.js.map +1 -1
  78. package/dist/src/ui/auth/useAuth.d.ts +2 -0
  79. package/dist/src/ui/auth/useAuth.js +31 -2
  80. package/dist/src/ui/auth/useAuth.js.map +1 -1
  81. package/dist/src/ui/components/AnsiOutput.test.js +1 -1
  82. package/dist/src/ui/components/AnsiOutput.test.js.map +1 -1
  83. package/dist/src/ui/components/Composer.test.js +1 -1
  84. package/dist/src/ui/components/Composer.test.js.map +1 -1
  85. package/dist/src/ui/components/ConsentPrompt.test.js +18 -8
  86. package/dist/src/ui/components/ConsentPrompt.test.js.map +1 -1
  87. package/dist/src/ui/components/ContextSummaryDisplay.test.js +11 -6
  88. package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +1 -1
  89. package/dist/src/ui/components/DialogManager.js +4 -0
  90. package/dist/src/ui/components/DialogManager.js.map +1 -1
  91. package/dist/src/ui/components/FolderTrustDialog.test.js +4 -3
  92. package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
  93. package/dist/src/ui/components/Footer.js +3 -2
  94. package/dist/src/ui/components/Footer.js.map +1 -1
  95. package/dist/src/ui/components/Footer.test.js +59 -0
  96. package/dist/src/ui/components/Footer.test.js.map +1 -1
  97. package/dist/src/ui/components/Header.test.js +9 -5
  98. package/dist/src/ui/components/Header.test.js.map +1 -1
  99. package/dist/src/ui/components/Help.test.js +5 -3
  100. package/dist/src/ui/components/Help.test.js.map +1 -1
  101. package/dist/src/ui/components/InputPrompt.test.js +139 -111
  102. package/dist/src/ui/components/InputPrompt.test.js.map +1 -1
  103. package/dist/src/ui/components/LoadingIndicator.test.js +27 -14
  104. package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -1
  105. package/dist/src/ui/components/ModelDialog.test.js +20 -10
  106. package/dist/src/ui/components/ModelDialog.test.js.map +1 -1
  107. package/dist/src/ui/components/ModelStatsDisplay.test.js +1 -1
  108. package/dist/src/ui/components/ModelStatsDisplay.test.js.map +1 -1
  109. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +11 -10
  110. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +1 -1
  111. package/dist/src/ui/components/PrepareLabel.test.js +13 -7
  112. package/dist/src/ui/components/PrepareLabel.test.js.map +1 -1
  113. package/dist/src/ui/components/ProQuotaDialog.test.js +14 -6
  114. package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -1
  115. package/dist/src/ui/components/QueuedMessageDisplay.test.js +11 -6
  116. package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +1 -1
  117. package/dist/src/ui/components/SessionSummaryDisplay.test.js +1 -1
  118. package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +1 -1
  119. package/dist/src/ui/components/SettingsDialog.test.js +438 -512
  120. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
  121. package/dist/src/ui/components/StatsDisplay.test.js +1 -1
  122. package/dist/src/ui/components/StatsDisplay.test.js.map +1 -1
  123. package/dist/src/ui/components/ThemeDialog.test.js +3 -2
  124. package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
  125. package/dist/src/ui/components/ToolStatsDisplay.test.js +1 -1
  126. package/dist/src/ui/components/ToolStatsDisplay.test.js.map +1 -1
  127. package/dist/src/ui/components/messages/CompressionMessage.test.js +25 -17
  128. package/dist/src/ui/components/messages/CompressionMessage.test.js.map +1 -1
  129. package/dist/src/ui/components/messages/DiffRenderer.test.js +1 -1
  130. package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -1
  131. package/dist/src/ui/components/messages/Todo.js +27 -5
  132. package/dist/src/ui/components/messages/Todo.js.map +1 -1
  133. package/dist/src/ui/components/messages/Todo.test.js +20 -8
  134. package/dist/src/ui/components/messages/Todo.test.js.map +1 -1
  135. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +29 -15
  136. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -1
  137. package/dist/src/ui/components/shared/BaseSelectionList.test.js +12 -11
  138. package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +1 -1
  139. package/dist/src/ui/components/shared/MaxSizedBox.test.js +43 -22
  140. package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -1
  141. package/dist/src/ui/components/shared/TextInput.d.ts +15 -0
  142. package/dist/src/ui/components/shared/TextInput.js +38 -0
  143. package/dist/src/ui/components/shared/TextInput.js.map +1 -0
  144. package/dist/src/ui/components/shared/TextInput.test.d.ts +6 -0
  145. package/dist/src/ui/components/shared/TextInput.test.js +242 -0
  146. package/dist/src/ui/components/shared/TextInput.test.js.map +1 -0
  147. package/dist/src/ui/components/shared/text-buffer.d.ts +8 -2
  148. package/dist/src/ui/components/shared/text-buffer.js +28 -13
  149. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  150. package/dist/src/ui/components/shared/text-buffer.test.js +137 -0
  151. package/dist/src/ui/components/shared/text-buffer.test.js.map +1 -1
  152. package/dist/src/ui/components/views/ChatList.test.js +7 -4
  153. package/dist/src/ui/components/views/ChatList.test.js.map +1 -1
  154. package/dist/src/ui/components/views/ExtensionsList.js +1 -0
  155. package/dist/src/ui/components/views/ExtensionsList.js.map +1 -1
  156. package/dist/src/ui/components/views/ExtensionsList.test.js +13 -5
  157. package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -1
  158. package/dist/src/ui/components/views/McpStatus.test.js +23 -12
  159. package/dist/src/ui/components/views/McpStatus.test.js.map +1 -1
  160. package/dist/src/ui/contexts/KeypressContext.test.js +132 -252
  161. package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
  162. package/dist/src/ui/contexts/SessionContext.test.js +9 -5
  163. package/dist/src/ui/contexts/SessionContext.test.js.map +1 -1
  164. package/dist/src/ui/contexts/UIActionsContext.d.ts +2 -0
  165. package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
  166. package/dist/src/ui/contexts/UIStateContext.d.ts +2 -0
  167. package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
  168. package/dist/src/ui/hooks/atCommandProcessor.js +29 -7
  169. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
  170. package/dist/src/ui/hooks/atCommandProcessor.test.js +163 -64
  171. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
  172. package/dist/src/ui/hooks/shellCommandProcessor.test.js +47 -34
  173. package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
  174. package/dist/src/ui/hooks/slashCommandProcessor.test.js +141 -104
  175. package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +1 -1
  176. package/dist/src/ui/hooks/useAtCompletion.test.js +23 -21
  177. package/dist/src/ui/hooks/useAtCompletion.test.js.map +1 -1
  178. package/dist/src/ui/hooks/useCommandCompletion.test.js +16 -15
  179. package/dist/src/ui/hooks/useCommandCompletion.test.js.map +1 -1
  180. package/dist/src/ui/hooks/useConsoleMessages.test.js +1 -1
  181. package/dist/src/ui/hooks/useConsoleMessages.test.js.map +1 -1
  182. package/dist/src/ui/hooks/useEditorSettings.test.js +1 -1
  183. package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -1
  184. package/dist/src/ui/hooks/useExtensionUpdates.d.ts +1 -1
  185. package/dist/src/ui/hooks/useExtensionUpdates.js +9 -3
  186. package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -1
  187. package/dist/src/ui/hooks/useExtensionUpdates.test.js +10 -9
  188. package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
  189. package/dist/src/ui/hooks/useFocus.test.js +1 -1
  190. package/dist/src/ui/hooks/useFocus.test.js.map +1 -1
  191. package/dist/src/ui/hooks/useFolderTrust.test.js +7 -6
  192. package/dist/src/ui/hooks/useFolderTrust.test.js.map +1 -1
  193. package/dist/src/ui/hooks/useGeminiStream.test.js +39 -38
  194. package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -1
  195. package/dist/src/ui/hooks/useGitBranchName.test.js +5 -4
  196. package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
  197. package/dist/src/ui/hooks/useIdeTrustListener.test.js +25 -11
  198. package/dist/src/ui/hooks/useIdeTrustListener.test.js.map +1 -1
  199. package/dist/src/ui/hooks/useKeypress.test.js +1 -1
  200. package/dist/src/ui/hooks/useKeypress.test.js.map +1 -1
  201. package/dist/src/ui/hooks/useLoadingIndicator.test.js +1 -1
  202. package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
  203. package/dist/src/ui/hooks/useMemoryMonitor.test.js +1 -1
  204. package/dist/src/ui/hooks/useMemoryMonitor.test.js.map +1 -1
  205. package/dist/src/ui/hooks/useMessageQueue.test.js +5 -4
  206. package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
  207. package/dist/src/ui/hooks/useModelCommand.test.js +7 -4
  208. package/dist/src/ui/hooks/useModelCommand.test.js.map +1 -1
  209. package/dist/src/ui/hooks/usePhraseCycler.test.js +46 -16
  210. package/dist/src/ui/hooks/usePhraseCycler.test.js.map +1 -1
  211. package/dist/src/ui/hooks/usePrivacySettings.test.js +11 -7
  212. package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -1
  213. package/dist/src/ui/hooks/useQuotaAndFallback.test.js +28 -14
  214. package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -1
  215. package/dist/src/ui/hooks/useSelectionList.test.js +116 -109
  216. package/dist/src/ui/hooks/useSelectionList.test.js.map +1 -1
  217. package/dist/src/ui/hooks/useShellHistory.test.js +25 -17
  218. package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -1
  219. package/dist/src/ui/hooks/useSlashCompletion.js +18 -7
  220. package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
  221. package/dist/src/ui/hooks/useSlashCompletion.test.js +244 -111
  222. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
  223. package/dist/src/ui/hooks/useTimer.test.js +1 -1
  224. package/dist/src/ui/hooks/useTimer.test.js.map +1 -1
  225. package/dist/src/ui/hooks/useToolScheduler.test.js +6 -2
  226. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
  227. package/dist/src/ui/hooks/vim.test.js +6 -21
  228. package/dist/src/ui/hooks/vim.test.js.map +1 -1
  229. package/dist/src/ui/state/extensions.d.ts +1 -0
  230. package/dist/src/ui/state/extensions.js +1 -0
  231. package/dist/src/ui/state/extensions.js.map +1 -1
  232. package/dist/src/ui/types.d.ts +1 -0
  233. package/dist/src/ui/types.js +2 -0
  234. package/dist/src/ui/types.js.map +1 -1
  235. package/dist/src/ui/utils/clipboardUtils.js +2 -2
  236. package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
  237. package/dist/src/ui/utils/updateCheck.js +6 -3
  238. package/dist/src/ui/utils/updateCheck.js.map +1 -1
  239. package/dist/src/ui/utils/updateCheck.test.js +5 -1
  240. package/dist/src/ui/utils/updateCheck.test.js.map +1 -1
  241. package/dist/src/utils/commentJson.js +2 -2
  242. package/dist/src/utils/commentJson.js.map +1 -1
  243. package/dist/src/utils/commentJson.test.js +7 -6
  244. package/dist/src/utils/commentJson.test.js.map +1 -1
  245. package/dist/src/utils/version.js +6 -2
  246. package/dist/src/utils/version.js.map +1 -1
  247. package/dist/src/zed-integration/acp.js +2 -1
  248. package/dist/src/zed-integration/acp.js.map +1 -1
  249. package/dist/tsconfig.tsbuildinfo +1 -1
  250. package/package.json +3 -3
  251. package/dist/google-gemini-cli-0.12.0-preview.3.tgz +0 -0
  252. package/dist/src/utils/package.d.ts +0 -12
  253. package/dist/src/utils/package.js +0 -24
  254. package/dist/src/utils/package.js.map +0 -1
@@ -5,6 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
7
  import { renderWithProviders } from '../../test-utils/render.js';
8
+ import { waitFor } from '../../test-utils/async.js';
8
9
  import { act } from 'react';
9
10
  import { InputPrompt } from './InputPrompt.js';
10
11
  import { ApprovalMode } from '@google/gemini-cli-core';
@@ -213,7 +214,7 @@ describe('InputPrompt', () => {
213
214
  await act(async () => {
214
215
  stdin.write('\u001B[A');
215
216
  });
216
- await vi.waitFor(() => expect(mockShellHistory.getPreviousCommand).toHaveBeenCalled());
217
+ await waitFor(() => expect(mockShellHistory.getPreviousCommand).toHaveBeenCalled());
217
218
  unmount();
218
219
  });
219
220
  it('should call shellHistory.getNextCommand on down arrow in shell mode', async () => {
@@ -221,8 +222,8 @@ describe('InputPrompt', () => {
221
222
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
222
223
  await act(async () => {
223
224
  stdin.write('\u001B[B');
225
+ await waitFor(() => expect(mockShellHistory.getNextCommand).toHaveBeenCalled());
224
226
  });
225
- await vi.waitFor(() => expect(mockShellHistory.getNextCommand).toHaveBeenCalled());
226
227
  unmount();
227
228
  });
228
229
  it('should set the buffer text when a shell history command is retrieved', async () => {
@@ -232,7 +233,7 @@ describe('InputPrompt', () => {
232
233
  await act(async () => {
233
234
  stdin.write('\u001B[A');
234
235
  });
235
- await vi.waitFor(() => {
236
+ await waitFor(() => {
236
237
  expect(mockShellHistory.getPreviousCommand).toHaveBeenCalled();
237
238
  expect(props.buffer.setText).toHaveBeenCalledWith('previous command');
238
239
  });
@@ -245,7 +246,7 @@ describe('InputPrompt', () => {
245
246
  await act(async () => {
246
247
  stdin.write('\r');
247
248
  });
248
- await vi.waitFor(() => {
249
+ await waitFor(() => {
249
250
  expect(mockShellHistory.addCommandToHistory).toHaveBeenCalledWith('ls -l');
250
251
  expect(props.onSubmit).toHaveBeenCalledWith('ls -l');
251
252
  });
@@ -257,15 +258,15 @@ describe('InputPrompt', () => {
257
258
  await act(async () => {
258
259
  stdin.write('\u001B[A'); // Up arrow
259
260
  });
260
- await vi.waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
261
+ await waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
261
262
  await act(async () => {
262
263
  stdin.write('\u001B[B'); // Down arrow
263
264
  });
264
- await vi.waitFor(() => expect(mockInputHistory.navigateDown).toHaveBeenCalled());
265
+ await waitFor(() => expect(mockInputHistory.navigateDown).toHaveBeenCalled());
265
266
  await act(async () => {
266
267
  stdin.write('\r'); // Enter
267
268
  });
268
- await vi.waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('some text'));
269
+ await waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('some text'));
269
270
  expect(mockShellHistory.getPreviousCommand).not.toHaveBeenCalled();
270
271
  expect(mockShellHistory.getNextCommand).not.toHaveBeenCalled();
271
272
  expect(mockShellHistory.addCommandToHistory).not.toHaveBeenCalled();
@@ -286,11 +287,11 @@ describe('InputPrompt', () => {
286
287
  await act(async () => {
287
288
  stdin.write('\u001B[A'); // Up arrow
288
289
  });
289
- await vi.waitFor(() => expect(mockCommandCompletion.navigateUp).toHaveBeenCalledTimes(1));
290
+ await waitFor(() => expect(mockCommandCompletion.navigateUp).toHaveBeenCalledTimes(1));
290
291
  await act(async () => {
291
292
  stdin.write('\u0010'); // Ctrl+P
292
293
  });
293
- await vi.waitFor(() => expect(mockCommandCompletion.navigateUp).toHaveBeenCalledTimes(2));
294
+ await waitFor(() => expect(mockCommandCompletion.navigateUp).toHaveBeenCalledTimes(2));
294
295
  expect(mockCommandCompletion.navigateDown).not.toHaveBeenCalled();
295
296
  unmount();
296
297
  });
@@ -309,11 +310,11 @@ describe('InputPrompt', () => {
309
310
  await act(async () => {
310
311
  stdin.write('\u001B[B'); // Down arrow
311
312
  });
312
- await vi.waitFor(() => expect(mockCommandCompletion.navigateDown).toHaveBeenCalledTimes(1));
313
+ await waitFor(() => expect(mockCommandCompletion.navigateDown).toHaveBeenCalledTimes(1));
313
314
  await act(async () => {
314
315
  stdin.write('\u000E'); // Ctrl+N
315
316
  });
316
- await vi.waitFor(() => expect(mockCommandCompletion.navigateDown).toHaveBeenCalledTimes(2));
317
+ await waitFor(() => expect(mockCommandCompletion.navigateDown).toHaveBeenCalledTimes(2));
317
318
  expect(mockCommandCompletion.navigateUp).not.toHaveBeenCalled();
318
319
  unmount();
319
320
  });
@@ -327,21 +328,21 @@ describe('InputPrompt', () => {
327
328
  await act(async () => {
328
329
  stdin.write('\u001B[A'); // Up arrow
329
330
  });
330
- await vi.waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
331
+ await waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
331
332
  await act(async () => {
332
333
  stdin.write('\u001B[B'); // Down arrow
333
334
  });
334
- await vi.waitFor(() => expect(mockInputHistory.navigateDown).toHaveBeenCalled());
335
+ await waitFor(() => expect(mockInputHistory.navigateDown).toHaveBeenCalled());
335
336
  await act(async () => {
336
337
  stdin.write('\u0010'); // Ctrl+P
337
338
  });
338
- await vi.waitFor(() => { });
339
339
  await act(async () => {
340
340
  stdin.write('\u000E'); // Ctrl+N
341
341
  });
342
- await vi.waitFor(() => { });
343
- expect(mockCommandCompletion.navigateUp).not.toHaveBeenCalled();
344
- expect(mockCommandCompletion.navigateDown).not.toHaveBeenCalled();
342
+ await waitFor(() => {
343
+ expect(mockCommandCompletion.navigateUp).not.toHaveBeenCalled();
344
+ expect(mockCommandCompletion.navigateDown).not.toHaveBeenCalled();
345
+ });
345
346
  unmount();
346
347
  });
347
348
  describe('clipboard image paste', () => {
@@ -358,7 +359,7 @@ describe('InputPrompt', () => {
358
359
  await act(async () => {
359
360
  stdin.write('\x16'); // Ctrl+V
360
361
  });
361
- await vi.waitFor(() => {
362
+ await waitFor(() => {
362
363
  expect(clipboardUtils.clipboardHasImage).toHaveBeenCalled();
363
364
  expect(clipboardUtils.saveClipboardImage).toHaveBeenCalledWith(props.config.getTargetDir());
364
365
  expect(clipboardUtils.cleanupOldClipboardImages).toHaveBeenCalledWith(props.config.getTargetDir());
@@ -372,7 +373,7 @@ describe('InputPrompt', () => {
372
373
  await act(async () => {
373
374
  stdin.write('\x16'); // Ctrl+V
374
375
  });
375
- await vi.waitFor(() => {
376
+ await waitFor(() => {
376
377
  expect(clipboardUtils.clipboardHasImage).toHaveBeenCalled();
377
378
  });
378
379
  expect(clipboardUtils.saveClipboardImage).not.toHaveBeenCalled();
@@ -386,7 +387,7 @@ describe('InputPrompt', () => {
386
387
  await act(async () => {
387
388
  stdin.write('\x16'); // Ctrl+V
388
389
  });
389
- await vi.waitFor(() => {
390
+ await waitFor(() => {
390
391
  expect(clipboardUtils.saveClipboardImage).toHaveBeenCalled();
391
392
  });
392
393
  expect(mockBuffer.setText).not.toHaveBeenCalled();
@@ -405,7 +406,7 @@ describe('InputPrompt', () => {
405
406
  await act(async () => {
406
407
  stdin.write('\x16'); // Ctrl+V
407
408
  });
408
- await vi.waitFor(() => {
409
+ await waitFor(() => {
409
410
  // Should insert at cursor position with spaces
410
411
  expect(mockBuffer.replaceRangeByOffset).toHaveBeenCalled();
411
412
  });
@@ -426,7 +427,7 @@ describe('InputPrompt', () => {
426
427
  await act(async () => {
427
428
  stdin.write('\x16'); // Ctrl+V
428
429
  });
429
- await vi.waitFor(() => {
430
+ await waitFor(() => {
430
431
  expect(consoleErrorSpy).toHaveBeenCalledWith('Error handling clipboard image:', expect.any(Error));
431
432
  });
432
433
  expect(mockBuffer.setText).not.toHaveBeenCalled();
@@ -447,7 +448,7 @@ describe('InputPrompt', () => {
447
448
  await act(async () => {
448
449
  stdin.write('\t'); // Press Tab
449
450
  });
450
- await vi.waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
451
+ await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
451
452
  unmount();
452
453
  });
453
454
  it('should append a sub-command when the parent command is already complete', async () => {
@@ -466,7 +467,7 @@ describe('InputPrompt', () => {
466
467
  await act(async () => {
467
468
  stdin.write('\t'); // Press Tab
468
469
  });
469
- await vi.waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(1));
470
+ await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(1));
470
471
  unmount();
471
472
  });
472
473
  it('should handle the "backspace" edge case correctly', async () => {
@@ -486,7 +487,7 @@ describe('InputPrompt', () => {
486
487
  await act(async () => {
487
488
  stdin.write('\t'); // Press Tab
488
489
  });
489
- await vi.waitFor(() =>
490
+ await waitFor(() =>
490
491
  // It should NOT become '/show'. It should correctly become '/memory show'.
491
492
  expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
492
493
  unmount();
@@ -504,7 +505,7 @@ describe('InputPrompt', () => {
504
505
  await act(async () => {
505
506
  stdin.write('\t'); // Press Tab
506
507
  });
507
- await vi.waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
508
+ await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
508
509
  unmount();
509
510
  });
510
511
  it('should autocomplete on Enter when suggestions are active, without submitting', async () => {
@@ -519,7 +520,7 @@ describe('InputPrompt', () => {
519
520
  await act(async () => {
520
521
  stdin.write('\r');
521
522
  });
522
- await vi.waitFor(() => {
523
+ await waitFor(() => {
523
524
  // The app should autocomplete the text, NOT submit.
524
525
  expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0);
525
526
  });
@@ -546,7 +547,7 @@ describe('InputPrompt', () => {
546
547
  await act(async () => {
547
548
  stdin.write('\t'); // Press Tab for autocomplete
548
549
  });
549
- await vi.waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
550
+ await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
550
551
  unmount();
551
552
  });
552
553
  it('should not submit on Enter when the buffer is empty or only contains whitespace', async () => {
@@ -555,8 +556,9 @@ describe('InputPrompt', () => {
555
556
  await act(async () => {
556
557
  stdin.write('\r'); // Press Enter
557
558
  });
558
- await vi.waitFor(() => { });
559
- expect(props.onSubmit).not.toHaveBeenCalled();
559
+ await waitFor(() => {
560
+ expect(props.onSubmit).not.toHaveBeenCalled();
561
+ });
560
562
  unmount();
561
563
  });
562
564
  it('should submit directly on Enter when isPerfectMatch is true', async () => {
@@ -570,7 +572,7 @@ describe('InputPrompt', () => {
570
572
  await act(async () => {
571
573
  stdin.write('\r');
572
574
  });
573
- await vi.waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('/clear'));
575
+ await waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('/clear'));
574
576
  unmount();
575
577
  });
576
578
  it('should submit directly on Enter when a complete leaf command is typed', async () => {
@@ -584,7 +586,7 @@ describe('InputPrompt', () => {
584
586
  await act(async () => {
585
587
  stdin.write('\r');
586
588
  });
587
- await vi.waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('/clear'));
589
+ await waitFor(() => expect(props.onSubmit).toHaveBeenCalledWith('/clear'));
588
590
  unmount();
589
591
  });
590
592
  it('should autocomplete an @-path on Enter without submitting', async () => {
@@ -599,7 +601,7 @@ describe('InputPrompt', () => {
599
601
  await act(async () => {
600
602
  stdin.write('\r');
601
603
  });
602
- await vi.waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
604
+ await waitFor(() => expect(mockCommandCompletion.handleAutocomplete).toHaveBeenCalledWith(0));
603
605
  expect(props.onSubmit).not.toHaveBeenCalled();
604
606
  unmount();
605
607
  });
@@ -612,7 +614,7 @@ describe('InputPrompt', () => {
612
614
  await act(async () => {
613
615
  stdin.write('\r');
614
616
  });
615
- await vi.waitFor(() => {
617
+ await waitFor(() => {
616
618
  expect(props.buffer.backspace).toHaveBeenCalled();
617
619
  expect(props.buffer.newline).toHaveBeenCalled();
618
620
  });
@@ -620,12 +622,14 @@ describe('InputPrompt', () => {
620
622
  unmount();
621
623
  });
622
624
  it('should clear the buffer on Ctrl+C if it has text', async () => {
623
- props.buffer.setText('some text to clear');
625
+ await act(async () => {
626
+ props.buffer.setText('some text to clear');
627
+ });
624
628
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
625
629
  await act(async () => {
626
630
  stdin.write('\x03'); // Ctrl+C character
627
631
  });
628
- await vi.waitFor(() => {
632
+ await waitFor(() => {
629
633
  expect(props.buffer.setText).toHaveBeenCalledWith('');
630
634
  expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
631
635
  });
@@ -638,8 +642,9 @@ describe('InputPrompt', () => {
638
642
  await act(async () => {
639
643
  stdin.write('\x03'); // Ctrl+C character
640
644
  });
641
- await vi.waitFor(() => { });
642
- expect(props.buffer.setText).not.toHaveBeenCalled();
645
+ await waitFor(() => {
646
+ expect(props.buffer.setText).not.toHaveBeenCalled();
647
+ });
643
648
  unmount();
644
649
  });
645
650
  describe('cursor-based completion trigger', () => {
@@ -734,7 +739,7 @@ describe('InputPrompt', () => {
734
739
  : [],
735
740
  });
736
741
  const { unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
737
- await vi.waitFor(() => {
742
+ await waitFor(() => {
738
743
  expect(mockedUseCommandCompletion).toHaveBeenCalledWith(mockBuffer, ['/test/project/src'], path.join('test', 'project', 'src'), mockSlashCommands, mockCommandContext, false, false, expect.any(Object));
739
744
  });
740
745
  unmount();
@@ -747,7 +752,7 @@ describe('InputPrompt', () => {
747
752
  await act(async () => {
748
753
  stdin.write('i');
749
754
  });
750
- await vi.waitFor(() => {
755
+ await waitFor(() => {
751
756
  expect(props.vimHandleInput).toHaveBeenCalled();
752
757
  });
753
758
  expect(mockBuffer.handleInput).not.toHaveBeenCalled();
@@ -759,7 +764,7 @@ describe('InputPrompt', () => {
759
764
  await act(async () => {
760
765
  stdin.write('i');
761
766
  });
762
- await vi.waitFor(() => {
767
+ await waitFor(() => {
763
768
  expect(props.vimHandleInput).toHaveBeenCalled();
764
769
  expect(mockBuffer.handleInput).toHaveBeenCalled();
765
770
  });
@@ -772,7 +777,7 @@ describe('InputPrompt', () => {
772
777
  await act(async () => {
773
778
  stdin.write('i');
774
779
  });
775
- await vi.waitFor(() => {
780
+ await waitFor(() => {
776
781
  expect(props.vimHandleInput).toHaveBeenCalled();
777
782
  expect(mockBuffer.handleInput).toHaveBeenCalled();
778
783
  });
@@ -786,7 +791,7 @@ describe('InputPrompt', () => {
786
791
  await act(async () => {
787
792
  stdin.write('\x1B[200~pasted text\x1B[201~');
788
793
  });
789
- await vi.waitFor(() => {
794
+ await waitFor(() => {
790
795
  expect(mockBuffer.handleInput).toHaveBeenCalledWith(expect.objectContaining({
791
796
  paste: true,
792
797
  sequence: 'pasted text',
@@ -800,7 +805,7 @@ describe('InputPrompt', () => {
800
805
  await act(async () => {
801
806
  stdin.write('a');
802
807
  });
803
- await vi.waitFor(() => { });
808
+ await waitFor(() => { });
804
809
  expect(mockBuffer.handleInput).not.toHaveBeenCalled();
805
810
  unmount();
806
811
  });
@@ -862,7 +867,7 @@ describe('InputPrompt', () => {
862
867
  mockBuffer.viewportVisualLines = [text];
863
868
  mockBuffer.visualCursor = visualCursor;
864
869
  const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
865
- await vi.waitFor(() => {
870
+ await waitFor(() => {
866
871
  const frame = stdout.lastFrame();
867
872
  expect(frame).toContain(expected);
868
873
  });
@@ -909,7 +914,7 @@ describe('InputPrompt', () => {
909
914
  mockBuffer.visualCursor = visualCursor;
910
915
  mockBuffer.visualToLogicalMap = visualToLogicalMap;
911
916
  const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
912
- await vi.waitFor(() => {
917
+ await waitFor(() => {
913
918
  const frame = stdout.lastFrame();
914
919
  expect(frame).toContain(expected);
915
920
  });
@@ -927,7 +932,7 @@ describe('InputPrompt', () => {
927
932
  [2, 0],
928
933
  ];
929
934
  const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
930
- await vi.waitFor(() => {
935
+ await waitFor(() => {
931
936
  const frame = stdout.lastFrame();
932
937
  const lines = frame.split('\n');
933
938
  // The line with the cursor should just be an inverted space inside the box border
@@ -952,7 +957,7 @@ describe('InputPrompt', () => {
952
957
  [2, 0], // 'world' is logical line 2, col 0
953
958
  ];
954
959
  const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
955
- await vi.waitFor(() => {
960
+ await waitFor(() => {
956
961
  const frame = stdout.lastFrame();
957
962
  // Check that all lines, including the empty one, are rendered.
958
963
  // This implicitly tests that the Box wrapper provides height for the empty line.
@@ -985,7 +990,7 @@ describe('InputPrompt', () => {
985
990
  await act(async () => {
986
991
  stdin.write(`\x1b[200~${pastedText}\x1b[201~`);
987
992
  });
988
- await vi.waitFor(() => {
993
+ await waitFor(() => {
989
994
  // Verify that the buffer's handleInput was called once with the full text
990
995
  expect(props.buffer.handleInput).toHaveBeenCalledTimes(1);
991
996
  expect(props.buffer.handleInput).toHaveBeenCalledWith(expect.objectContaining({
@@ -1012,7 +1017,9 @@ describe('InputPrompt', () => {
1012
1017
  // isTerminalPasteTrusted will be false due to beforeEach setup.
1013
1018
  props.buffer.text = 'some command';
1014
1019
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
1015
- await vi.runAllTimersAsync();
1020
+ await act(async () => {
1021
+ await vi.runAllTimersAsync();
1022
+ });
1016
1023
  // Simulate a paste operation (this should set the paste protection)
1017
1024
  await act(async () => {
1018
1025
  stdin.write(`\x1b[200~pasted content\x1b[201~`);
@@ -1021,7 +1028,9 @@ describe('InputPrompt', () => {
1021
1028
  await act(async () => {
1022
1029
  stdin.write('\r');
1023
1030
  });
1024
- await vi.runAllTimersAsync();
1031
+ await act(async () => {
1032
+ await vi.runAllTimersAsync();
1033
+ });
1025
1034
  // Verify that onSubmit was NOT called due to recent paste protection
1026
1035
  expect(props.onSubmit).not.toHaveBeenCalled();
1027
1036
  // It should call newline() instead
@@ -1032,12 +1041,16 @@ describe('InputPrompt', () => {
1032
1041
  // isTerminalPasteTrusted will be false due to beforeEach setup.
1033
1042
  props.buffer.text = 'pasted text';
1034
1043
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
1035
- await vi.runAllTimersAsync();
1044
+ await act(async () => {
1045
+ await vi.runAllTimersAsync();
1046
+ });
1036
1047
  // Simulate a paste operation (this sets the protection)
1037
1048
  await act(async () => {
1038
1049
  stdin.write('\x1b[200~pasted text\x1b[201~');
1039
1050
  });
1040
- await vi.runAllTimersAsync();
1051
+ await act(async () => {
1052
+ await vi.runAllTimersAsync();
1053
+ });
1041
1054
  // Advance timers past the protection timeout
1042
1055
  await act(async () => {
1043
1056
  await vi.advanceTimersByTimeAsync(50);
@@ -1046,7 +1059,9 @@ describe('InputPrompt', () => {
1046
1059
  await act(async () => {
1047
1060
  stdin.write('\r');
1048
1061
  });
1049
- await vi.runAllTimersAsync();
1062
+ await act(async () => {
1063
+ await vi.runAllTimersAsync();
1064
+ });
1050
1065
  expect(props.onSubmit).toHaveBeenCalledWith('pasted text');
1051
1066
  expect(props.buffer.newline).not.toHaveBeenCalled();
1052
1067
  unmount();
@@ -1064,17 +1079,23 @@ describe('InputPrompt', () => {
1064
1079
  setup();
1065
1080
  props.buffer.text = 'pasted command';
1066
1081
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: true });
1067
- await vi.runAllTimersAsync();
1082
+ await act(async () => {
1083
+ await vi.runAllTimersAsync();
1084
+ });
1068
1085
  // Simulate a paste operation
1069
1086
  await act(async () => {
1070
1087
  stdin.write('\x1b[200~some pasted stuff\x1b[201~');
1071
1088
  });
1072
- await vi.runAllTimersAsync();
1089
+ await act(async () => {
1090
+ await vi.runAllTimersAsync();
1091
+ });
1073
1092
  // Simulate an Enter key press immediately after paste
1074
1093
  await act(async () => {
1075
1094
  stdin.write('\r');
1076
1095
  });
1077
- await vi.runAllTimersAsync();
1096
+ await act(async () => {
1097
+ await vi.runAllTimersAsync();
1098
+ });
1078
1099
  // Verify that onSubmit was called
1079
1100
  expect(props.onSubmit).toHaveBeenCalledWith('pasted command');
1080
1101
  unmount();
@@ -1083,12 +1104,16 @@ describe('InputPrompt', () => {
1083
1104
  // Set up buffer with text before rendering to ensure submission works
1084
1105
  props.buffer.text = 'normal command';
1085
1106
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
1086
- await vi.runAllTimersAsync();
1107
+ await act(async () => {
1108
+ await vi.runAllTimersAsync();
1109
+ });
1087
1110
  // Press Enter without any recent paste
1088
1111
  await act(async () => {
1089
1112
  stdin.write('\r');
1090
1113
  });
1091
- await vi.runAllTimersAsync();
1114
+ await act(async () => {
1115
+ await vi.runAllTimersAsync();
1116
+ });
1092
1117
  // Verify that onSubmit was called normally
1093
1118
  expect(props.onSubmit).toHaveBeenCalledWith('normal command');
1094
1119
  unmount();
@@ -1102,16 +1127,16 @@ describe('InputPrompt', () => {
1102
1127
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: false });
1103
1128
  await act(async () => {
1104
1129
  stdin.write('\x1B');
1105
- });
1106
- await vi.waitFor(() => {
1107
- expect(onEscapePromptChange).toHaveBeenCalledWith(true);
1130
+ await waitFor(() => {
1131
+ expect(onEscapePromptChange).toHaveBeenCalledWith(false);
1132
+ });
1108
1133
  });
1109
1134
  await act(async () => {
1110
1135
  stdin.write('\x1B');
1111
- });
1112
- await vi.waitFor(() => {
1113
- expect(props.buffer.setText).toHaveBeenCalledWith('');
1114
- expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
1136
+ await waitFor(() => {
1137
+ expect(props.buffer.setText).toHaveBeenCalledWith('');
1138
+ expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
1139
+ });
1115
1140
  });
1116
1141
  unmount();
1117
1142
  });
@@ -1122,15 +1147,15 @@ describe('InputPrompt', () => {
1122
1147
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: false });
1123
1148
  await act(async () => {
1124
1149
  stdin.write('\x1B');
1125
- });
1126
- await vi.waitFor(() => {
1127
- expect(onEscapePromptChange).toHaveBeenCalledWith(true);
1150
+ await waitFor(() => {
1151
+ expect(onEscapePromptChange).toHaveBeenCalledWith(false);
1152
+ });
1128
1153
  });
1129
1154
  await act(async () => {
1130
1155
  stdin.write('a');
1131
- });
1132
- await vi.waitFor(() => {
1133
- expect(onEscapePromptChange).toHaveBeenCalledWith(false);
1156
+ await waitFor(() => {
1157
+ expect(onEscapePromptChange).toHaveBeenCalledWith(false);
1158
+ });
1134
1159
  });
1135
1160
  unmount();
1136
1161
  });
@@ -1139,8 +1164,8 @@ describe('InputPrompt', () => {
1139
1164
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: false });
1140
1165
  await act(async () => {
1141
1166
  stdin.write('\x1B');
1167
+ await waitFor(() => expect(props.setShellModeActive).toHaveBeenCalledWith(false));
1142
1168
  });
1143
- await vi.waitFor(() => expect(props.setShellModeActive).toHaveBeenCalledWith(false));
1144
1169
  unmount();
1145
1170
  });
1146
1171
  it('should handle ESC when completion suggestions are showing', async () => {
@@ -1153,7 +1178,7 @@ describe('InputPrompt', () => {
1153
1178
  await act(async () => {
1154
1179
  stdin.write('\x1B');
1155
1180
  });
1156
- await vi.waitFor(() => expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled());
1181
+ await waitFor(() => expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled());
1157
1182
  unmount();
1158
1183
  });
1159
1184
  it('should not call onEscapePromptChange when not provided', async () => {
@@ -1161,11 +1186,15 @@ describe('InputPrompt', () => {
1161
1186
  props.onEscapePromptChange = undefined;
1162
1187
  props.buffer.setText('some text');
1163
1188
  const { stdin, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }), { kittyProtocolEnabled: false });
1164
- await vi.runAllTimersAsync();
1189
+ await act(async () => {
1190
+ await vi.runAllTimersAsync();
1191
+ });
1165
1192
  await act(async () => {
1166
1193
  stdin.write('\x1B');
1167
1194
  });
1168
- await vi.runAllTimersAsync();
1195
+ await act(async () => {
1196
+ await vi.runAllTimersAsync();
1197
+ });
1169
1198
  vi.useRealTimers();
1170
1199
  unmount();
1171
1200
  });
@@ -1174,11 +1203,11 @@ describe('InputPrompt', () => {
1174
1203
  await act(async () => {
1175
1204
  stdin.write('\x0C');
1176
1205
  });
1177
- await vi.waitFor(() => expect(props.onClearScreen).toHaveBeenCalled());
1206
+ await waitFor(() => expect(props.onClearScreen).toHaveBeenCalled());
1178
1207
  await act(async () => {
1179
1208
  stdin.write('\x01');
1180
1209
  });
1181
- await vi.waitFor(() => expect(props.buffer.move).toHaveBeenCalledWith('home'));
1210
+ await waitFor(() => expect(props.buffer.move).toHaveBeenCalledWith('home'));
1182
1211
  unmount();
1183
1212
  });
1184
1213
  });
@@ -1210,7 +1239,7 @@ describe('InputPrompt', () => {
1210
1239
  await act(async () => {
1211
1240
  stdin.write('\x12');
1212
1241
  });
1213
- await vi.waitFor(() => {
1242
+ await waitFor(() => {
1214
1243
  const frame = stdout.lastFrame();
1215
1244
  expect(frame).toContain('(r:)');
1216
1245
  expect(frame).toContain('echo hello');
@@ -1224,17 +1253,16 @@ describe('InputPrompt', () => {
1224
1253
  await act(async () => {
1225
1254
  stdin.write('\x12');
1226
1255
  });
1227
- await vi.waitFor(() => { });
1228
1256
  await act(async () => {
1229
1257
  stdin.write('\x1B');
1230
1258
  });
1231
1259
  await act(async () => {
1232
1260
  stdin.write('\u001b[27u'); // Press kitty escape key
1233
1261
  });
1234
- await vi.waitFor(() => {
1262
+ await waitFor(() => {
1235
1263
  expect(stdout.lastFrame()).not.toContain('(r:)');
1264
+ expect(stdout.lastFrame()).not.toContain('echo hello');
1236
1265
  });
1237
- expect(stdout.lastFrame()).not.toContain('echo hello');
1238
1266
  unmount();
1239
1267
  });
1240
1268
  it('completes the highlighted entry on Tab and exits reverse-search', async () => {
@@ -1261,14 +1289,14 @@ describe('InputPrompt', () => {
1261
1289
  stdin.write('\x12');
1262
1290
  });
1263
1291
  // Verify reverse search is active
1264
- await vi.waitFor(() => {
1292
+ await waitFor(() => {
1265
1293
  expect(stdout.lastFrame()).toContain('(r:)');
1266
1294
  });
1267
1295
  // Press Tab to complete the highlighted entry
1268
1296
  await act(async () => {
1269
1297
  stdin.write('\t');
1270
1298
  });
1271
- await vi.waitFor(() => {
1299
+ await waitFor(() => {
1272
1300
  expect(mockHandleAutocomplete).toHaveBeenCalledWith(0);
1273
1301
  expect(props.buffer.setText).toHaveBeenCalledWith('echo hello');
1274
1302
  });
@@ -1290,13 +1318,13 @@ describe('InputPrompt', () => {
1290
1318
  await act(async () => {
1291
1319
  stdin.write('\x12');
1292
1320
  });
1293
- await vi.waitFor(() => {
1321
+ await waitFor(() => {
1294
1322
  expect(stdout.lastFrame()).toContain('(r:)');
1295
1323
  });
1296
1324
  await act(async () => {
1297
1325
  stdin.write('\r');
1298
1326
  });
1299
- await vi.waitFor(() => {
1327
+ await waitFor(() => {
1300
1328
  expect(stdout.lastFrame()).not.toContain('(r:)');
1301
1329
  });
1302
1330
  expect(props.onSubmit).toHaveBeenCalledWith('echo hello');
@@ -1320,14 +1348,14 @@ describe('InputPrompt', () => {
1320
1348
  await act(async () => {
1321
1349
  stdin.write('\x12');
1322
1350
  });
1323
- await vi.waitFor(() => {
1351
+ await waitFor(() => {
1324
1352
  expect(stdout.lastFrame()).toContain('(r:)');
1325
1353
  });
1326
1354
  // Press kitty escape key
1327
1355
  await act(async () => {
1328
1356
  stdin.write('\u001b[27u');
1329
1357
  });
1330
- await vi.waitFor(() => {
1358
+ await waitFor(() => {
1331
1359
  expect(stdout.lastFrame()).not.toContain('(r:)');
1332
1360
  expect(props.buffer.text).toBe(initialText);
1333
1361
  expect(props.buffer.cursor).toEqual(initialCursor);
@@ -1344,7 +1372,7 @@ describe('InputPrompt', () => {
1344
1372
  await act(async () => {
1345
1373
  stdin.write('\x05'); // Ctrl+E
1346
1374
  });
1347
- await vi.waitFor(() => {
1375
+ await waitFor(() => {
1348
1376
  expect(props.buffer.move).toHaveBeenCalledWith('end');
1349
1377
  });
1350
1378
  expect(props.buffer.moveToOffset).not.toHaveBeenCalled();
@@ -1358,7 +1386,7 @@ describe('InputPrompt', () => {
1358
1386
  await act(async () => {
1359
1387
  stdin.write('\x05'); // Ctrl+E
1360
1388
  });
1361
- await vi.waitFor(() => {
1389
+ await waitFor(() => {
1362
1390
  expect(props.buffer.move).toHaveBeenCalledWith('end');
1363
1391
  });
1364
1392
  expect(props.buffer.moveToOffset).not.toHaveBeenCalled();
@@ -1383,7 +1411,7 @@ describe('InputPrompt', () => {
1383
1411
  await act(async () => {
1384
1412
  stdin.write('\x12'); // Ctrl+R
1385
1413
  });
1386
- await vi.waitFor(() => {
1414
+ await waitFor(() => {
1387
1415
  const frame = stdout.lastFrame() ?? '';
1388
1416
  expect(frame).toContain('(r:)');
1389
1417
  expect(frame).toContain('git commit');
@@ -1406,20 +1434,20 @@ describe('InputPrompt', () => {
1406
1434
  await act(async () => {
1407
1435
  stdin.write('\x12');
1408
1436
  });
1409
- await vi.waitFor(() => {
1437
+ await waitFor(() => {
1410
1438
  expect(clean(stdout.lastFrame())).toContain('→');
1411
1439
  });
1412
1440
  await act(async () => {
1413
1441
  stdin.write('\u001B[C');
1414
1442
  });
1415
- await vi.waitFor(() => {
1443
+ await waitFor(() => {
1416
1444
  expect(clean(stdout.lastFrame())).toContain('←');
1417
1445
  });
1418
1446
  expect(stdout.lastFrame()).toMatchSnapshot('command-search-render-expanded-match');
1419
1447
  await act(async () => {
1420
1448
  stdin.write('\u001B[D');
1421
1449
  });
1422
- await vi.waitFor(() => {
1450
+ await waitFor(() => {
1423
1451
  expect(clean(stdout.lastFrame())).toContain('→');
1424
1452
  });
1425
1453
  expect(stdout.lastFrame()).toMatchSnapshot('command-search-render-collapsed-match');
@@ -1442,13 +1470,13 @@ describe('InputPrompt', () => {
1442
1470
  await act(async () => {
1443
1471
  stdin.write('\x12');
1444
1472
  });
1445
- await vi.waitFor(() => {
1473
+ await waitFor(() => {
1446
1474
  expect(stdout.lastFrame()).toMatchSnapshot('command-search-render-collapsed-match');
1447
1475
  });
1448
1476
  await act(async () => {
1449
1477
  stdin.write('\u001B[C');
1450
1478
  });
1451
- await vi.waitFor(() => {
1479
+ await waitFor(() => {
1452
1480
  expect(stdout.lastFrame()).toMatchSnapshot('command-search-render-expanded-match');
1453
1481
  });
1454
1482
  unmount();
@@ -1468,7 +1496,7 @@ describe('InputPrompt', () => {
1468
1496
  await act(async () => {
1469
1497
  stdin.write('\x12');
1470
1498
  });
1471
- await vi.waitFor(() => {
1499
+ await waitFor(() => {
1472
1500
  const frame = clean(stdout.lastFrame());
1473
1501
  // Ensure it rendered the search mode
1474
1502
  expect(frame).toContain('(r:)');
@@ -1487,7 +1515,7 @@ describe('InputPrompt', () => {
1487
1515
  await act(async () => {
1488
1516
  stdin.write('\u001B[A');
1489
1517
  });
1490
- await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1518
+ await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1491
1519
  const callback = mockPopAllMessages.mock.calls[0][0];
1492
1520
  await act(async () => {
1493
1521
  callback('Message 1\n\nMessage 2\n\nMessage 3');
@@ -1503,7 +1531,7 @@ describe('InputPrompt', () => {
1503
1531
  await act(async () => {
1504
1532
  stdin.write('\u001B[A');
1505
1533
  });
1506
- await vi.waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
1534
+ await waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
1507
1535
  expect(mockPopAllMessages).not.toHaveBeenCalled();
1508
1536
  unmount();
1509
1537
  });
@@ -1515,7 +1543,7 @@ describe('InputPrompt', () => {
1515
1543
  await act(async () => {
1516
1544
  stdin.write('\u001B[A');
1517
1545
  });
1518
- await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1546
+ await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1519
1547
  const callback = mockPopAllMessages.mock.calls[0][0];
1520
1548
  await act(async () => {
1521
1549
  callback(undefined);
@@ -1535,7 +1563,7 @@ describe('InputPrompt', () => {
1535
1563
  await act(async () => {
1536
1564
  stdin.write('\u001B[A');
1537
1565
  });
1538
- await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1566
+ await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1539
1567
  unmount();
1540
1568
  });
1541
1569
  it('should handle single queued message', async () => {
@@ -1546,7 +1574,7 @@ describe('InputPrompt', () => {
1546
1574
  await act(async () => {
1547
1575
  stdin.write('\u001B[A');
1548
1576
  });
1549
- await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1577
+ await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1550
1578
  const callback = mockPopAllMessages.mock.calls[0][0];
1551
1579
  await act(async () => {
1552
1580
  callback('Single message');
@@ -1562,7 +1590,7 @@ describe('InputPrompt', () => {
1562
1590
  await act(async () => {
1563
1591
  stdin.write('\u001B[A');
1564
1592
  });
1565
- await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1593
+ await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1566
1594
  unmount();
1567
1595
  });
1568
1596
  it('should not call popAllMessages if it is not provided', async () => {
@@ -1572,7 +1600,7 @@ describe('InputPrompt', () => {
1572
1600
  await act(async () => {
1573
1601
  stdin.write('\u001B[A');
1574
1602
  });
1575
- await vi.waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
1603
+ await waitFor(() => expect(mockInputHistory.navigateUp).toHaveBeenCalled());
1576
1604
  unmount();
1577
1605
  });
1578
1606
  it('should navigate input history on fresh start when no queued messages exist', async () => {
@@ -1583,7 +1611,7 @@ describe('InputPrompt', () => {
1583
1611
  await act(async () => {
1584
1612
  stdin.write('\u001B[A');
1585
1613
  });
1586
- await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1614
+ await waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
1587
1615
  const callback = mockPopAllMessages.mock.calls[0][0];
1588
1616
  await act(async () => {
1589
1617
  callback(undefined);
@@ -1597,26 +1625,26 @@ describe('InputPrompt', () => {
1597
1625
  it('should render correctly in shell mode', async () => {
1598
1626
  props.shellModeActive = true;
1599
1627
  const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
1600
- await vi.waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
1628
+ await waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
1601
1629
  unmount();
1602
1630
  });
1603
1631
  it('should render correctly when accepting edits', async () => {
1604
1632
  props.approvalMode = ApprovalMode.AUTO_EDIT;
1605
1633
  const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
1606
- await vi.waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
1634
+ await waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
1607
1635
  unmount();
1608
1636
  });
1609
1637
  it('should render correctly in yolo mode', async () => {
1610
1638
  props.approvalMode = ApprovalMode.YOLO;
1611
1639
  const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
1612
- await vi.waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
1640
+ await waitFor(() => expect(stdout.lastFrame()).toMatchSnapshot());
1613
1641
  unmount();
1614
1642
  });
1615
1643
  it('should not show inverted cursor when shell is focused', async () => {
1616
1644
  props.isEmbeddedShellFocused = true;
1617
1645
  props.focus = false;
1618
1646
  const { stdout, unmount } = renderWithProviders(_jsx(InputPrompt, { ...props }));
1619
- await vi.waitFor(() => {
1647
+ await waitFor(() => {
1620
1648
  expect(stdout.lastFrame()).not.toContain(`{chalk.inverse(' ')}`);
1621
1649
  // This snapshot is good to make sure there was an input prompt but does
1622
1650
  // not show the inverted cursor because snapshots do not show colors.
@@ -1632,7 +1660,7 @@ describe('InputPrompt', () => {
1632
1660
  await act(async () => {
1633
1661
  stdin.write('a');
1634
1662
  });
1635
- await vi.waitFor(() => expect(mockBuffer.handleInput).toHaveBeenCalled());
1663
+ await waitFor(() => expect(mockBuffer.handleInput).toHaveBeenCalled());
1636
1664
  unmount();
1637
1665
  });
1638
1666
  describe('command queuing while streaming', () => {
@@ -1670,7 +1698,7 @@ describe('InputPrompt', () => {
1670
1698
  await act(async () => {
1671
1699
  stdin.write('\r');
1672
1700
  });
1673
- await vi.waitFor(() => {
1701
+ await waitFor(() => {
1674
1702
  if (shouldSubmit) {
1675
1703
  expect(props.onSubmit).toHaveBeenCalledWith(bufferText);
1676
1704
  expect(props.setQueueErrorMessage).not.toHaveBeenCalled();