@google/gemini-cli 0.5.5 → 0.6.0-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +12 -2
  3. package/dist/index.js +0 -0
  4. package/dist/package.json +3 -3
  5. package/dist/src/commands/extensions/disable.d.ts +1 -1
  6. package/dist/src/commands/extensions/disable.js +3 -3
  7. package/dist/src/commands/extensions/disable.js.map +1 -1
  8. package/dist/src/commands/extensions/enable.d.ts +1 -1
  9. package/dist/src/commands/extensions/enable.js +5 -7
  10. package/dist/src/commands/extensions/enable.js.map +1 -1
  11. package/dist/src/commands/extensions/install.d.ts +1 -0
  12. package/dist/src/commands/extensions/install.js +10 -2
  13. package/dist/src/commands/extensions/install.js.map +1 -1
  14. package/dist/src/commands/extensions/install.test.js +75 -2
  15. package/dist/src/commands/extensions/install.test.js.map +1 -1
  16. package/dist/src/commands/extensions/update.js +14 -4
  17. package/dist/src/commands/extensions/update.js.map +1 -1
  18. package/dist/src/config/config.d.ts +1 -1
  19. package/dist/src/config/config.js +19 -5
  20. package/dist/src/config/config.js.map +1 -1
  21. package/dist/src/config/extension.d.ts +17 -8
  22. package/dist/src/config/extension.js +192 -73
  23. package/dist/src/config/extension.js.map +1 -1
  24. package/dist/src/config/extensions/extensionEnablement.d.ts +30 -0
  25. package/dist/src/config/extensions/extensionEnablement.js +113 -0
  26. package/dist/src/config/extensions/extensionEnablement.js.map +1 -0
  27. package/dist/src/config/extensions/extensionEnablement.test.js +116 -0
  28. package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -0
  29. package/dist/src/config/extensions/variableSchema.d.ts +8 -0
  30. package/dist/src/config/extensions/variableSchema.js +4 -0
  31. package/dist/src/config/extensions/variableSchema.js.map +1 -1
  32. package/dist/src/config/keyBindings.d.ts +4 -1
  33. package/dist/src/config/keyBindings.js +8 -0
  34. package/dist/src/config/keyBindings.js.map +1 -1
  35. package/dist/src/config/settings.d.ts +3 -0
  36. package/dist/src/config/settings.js +54 -15
  37. package/dist/src/config/settings.js.map +1 -1
  38. package/dist/src/config/settingsSchema.d.ts +67 -1
  39. package/dist/src/config/settingsSchema.js +64 -1
  40. package/dist/src/config/settingsSchema.js.map +1 -1
  41. package/dist/src/config/settingsSchema.test.js +6 -0
  42. package/dist/src/config/settingsSchema.test.js.map +1 -1
  43. package/dist/src/config/trustedFolders.d.ts +1 -1
  44. package/dist/src/config/trustedFolders.js +9 -4
  45. package/dist/src/config/trustedFolders.js.map +1 -1
  46. package/dist/src/config/trustedFolders.test.js +41 -25
  47. package/dist/src/config/trustedFolders.test.js.map +1 -1
  48. package/dist/src/core/initializer.js +6 -1
  49. package/dist/src/core/initializer.js.map +1 -1
  50. package/dist/src/gemini.js +29 -46
  51. package/dist/src/gemini.js.map +1 -1
  52. package/dist/src/gemini.test.js +11 -15
  53. package/dist/src/gemini.test.js.map +1 -1
  54. package/dist/src/generated/git-commit.d.ts +2 -2
  55. package/dist/src/generated/git-commit.js +2 -2
  56. package/dist/src/generated/git-commit.js.map +1 -1
  57. package/dist/src/nonInteractiveCli.js +23 -9
  58. package/dist/src/nonInteractiveCli.js.map +1 -1
  59. package/dist/src/services/McpPromptLoader.js +43 -8
  60. package/dist/src/services/McpPromptLoader.js.map +1 -1
  61. package/dist/src/services/McpPromptLoader.test.js +228 -1
  62. package/dist/src/services/McpPromptLoader.test.js.map +1 -1
  63. package/dist/src/services/prompt-processors/shellProcessor.js +8 -1
  64. package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -1
  65. package/dist/src/ui/AppContainer.js +69 -32
  66. package/dist/src/ui/AppContainer.js.map +1 -1
  67. package/dist/src/ui/AppContainer.test.js +36 -0
  68. package/dist/src/ui/AppContainer.test.js.map +1 -1
  69. package/dist/src/ui/IdeIntegrationNudge.js +2 -1
  70. package/dist/src/ui/IdeIntegrationNudge.js.map +1 -1
  71. package/dist/src/ui/auth/AuthDialog.js +2 -2
  72. package/dist/src/ui/auth/AuthDialog.js.map +1 -1
  73. package/dist/src/ui/auth/AuthInProgress.js +2 -2
  74. package/dist/src/ui/auth/AuthInProgress.js.map +1 -1
  75. package/dist/src/ui/commands/chatCommand.d.ts +2 -0
  76. package/dist/src/ui/commands/chatCommand.js +82 -3
  77. package/dist/src/ui/commands/chatCommand.js.map +1 -1
  78. package/dist/src/ui/commands/extensionsCommand.js +70 -16
  79. package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
  80. package/dist/src/ui/commands/ideCommand.js +2 -2
  81. package/dist/src/ui/commands/ideCommand.js.map +1 -1
  82. package/dist/src/ui/commands/types.d.ts +4 -1
  83. package/dist/src/ui/commands/types.js +0 -1
  84. package/dist/src/ui/commands/types.js.map +1 -1
  85. package/dist/src/ui/components/AboutBox.js +2 -2
  86. package/dist/src/ui/components/AboutBox.js.map +1 -1
  87. package/dist/src/ui/components/AnsiOutput.d.ts +13 -0
  88. package/dist/src/ui/components/AnsiOutput.js +12 -0
  89. package/dist/src/ui/components/AnsiOutput.js.map +1 -0
  90. package/dist/src/ui/components/AnsiOutput.test.d.ts +6 -0
  91. package/dist/src/ui/components/AnsiOutput.test.js +97 -0
  92. package/dist/src/ui/components/AnsiOutput.test.js.map +1 -0
  93. package/dist/src/ui/components/AutoAcceptIndicator.js +4 -4
  94. package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -1
  95. package/dist/src/ui/components/Composer.js +10 -5
  96. package/dist/src/ui/components/Composer.js.map +1 -1
  97. package/dist/src/ui/components/ConfigInitDisplay.js +2 -1
  98. package/dist/src/ui/components/ConfigInitDisplay.js.map +1 -1
  99. package/dist/src/ui/components/ConsoleSummaryDisplay.js +2 -2
  100. package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -1
  101. package/dist/src/ui/components/ContextSummaryDisplay.js +3 -3
  102. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
  103. package/dist/src/ui/components/ContextUsageDisplay.js +2 -2
  104. package/dist/src/ui/components/ContextUsageDisplay.js.map +1 -1
  105. package/dist/src/ui/components/DebugProfiler.js +2 -2
  106. package/dist/src/ui/components/DebugProfiler.js.map +1 -1
  107. package/dist/src/ui/components/DetailedMessagesDisplay.js +7 -7
  108. package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -1
  109. package/dist/src/ui/components/DialogManager.js +9 -5
  110. package/dist/src/ui/components/DialogManager.js.map +1 -1
  111. package/dist/src/ui/components/EditorSettingsDialog.js +5 -5
  112. package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
  113. package/dist/src/ui/components/FolderTrustDialog.js +6 -14
  114. package/dist/src/ui/components/FolderTrustDialog.js.map +1 -1
  115. package/dist/src/ui/components/FolderTrustDialog.test.js +13 -13
  116. package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
  117. package/dist/src/ui/components/Footer.d.ts +3 -0
  118. package/dist/src/ui/components/Footer.js +8 -3
  119. package/dist/src/ui/components/Footer.js.map +1 -1
  120. package/dist/src/ui/components/GeminiRespondingSpinner.js +3 -2
  121. package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -1
  122. package/dist/src/ui/components/Header.js +2 -2
  123. package/dist/src/ui/components/Header.js.map +1 -1
  124. package/dist/src/ui/components/Help.js +5 -5
  125. package/dist/src/ui/components/Help.js.map +1 -1
  126. package/dist/src/ui/components/HistoryItemDisplay.d.ts +2 -0
  127. package/dist/src/ui/components/HistoryItemDisplay.js +2 -1
  128. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
  129. package/dist/src/ui/components/InputPrompt.d.ts +3 -0
  130. package/dist/src/ui/components/InputPrompt.js +97 -19
  131. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  132. package/dist/src/ui/components/LoadingIndicator.js +2 -2
  133. package/dist/src/ui/components/LoadingIndicator.js.map +1 -1
  134. package/dist/src/ui/components/LoopDetectionConfirmation.d.ts +13 -0
  135. package/dist/src/ui/components/LoopDetectionConfirmation.js +35 -0
  136. package/dist/src/ui/components/LoopDetectionConfirmation.js.map +1 -0
  137. package/dist/src/ui/components/LoopDetectionConfirmation.test.d.ts +6 -0
  138. package/dist/src/ui/components/LoopDetectionConfirmation.test.js +25 -0
  139. package/dist/src/ui/components/LoopDetectionConfirmation.test.js.map +1 -0
  140. package/dist/src/ui/components/MainContent.js +1 -1
  141. package/dist/src/ui/components/MainContent.js.map +1 -1
  142. package/dist/src/ui/components/MemoryUsageDisplay.js +6 -4
  143. package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -1
  144. package/dist/src/ui/components/ModelStatsDisplay.js +7 -7
  145. package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -1
  146. package/dist/src/ui/components/Notifications.js +2 -2
  147. package/dist/src/ui/components/Notifications.js.map +1 -1
  148. package/dist/src/ui/components/PrepareLabel.d.ts +5 -5
  149. package/dist/src/ui/components/PrepareLabel.js +67 -11
  150. package/dist/src/ui/components/PrepareLabel.js.map +1 -1
  151. package/dist/src/ui/components/PrepareLabel.test.d.ts +6 -0
  152. package/dist/src/ui/components/PrepareLabel.test.js +71 -0
  153. package/dist/src/ui/components/PrepareLabel.test.js.map +1 -0
  154. package/dist/src/ui/components/ProQuotaDialog.js +2 -2
  155. package/dist/src/ui/components/ProQuotaDialog.js.map +1 -1
  156. package/dist/src/ui/components/SettingsDialog.d.ts +2 -1
  157. package/dist/src/ui/components/SettingsDialog.js +73 -17
  158. package/dist/src/ui/components/SettingsDialog.js.map +1 -1
  159. package/dist/src/ui/components/SettingsDialog.test.js +291 -0
  160. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
  161. package/dist/src/ui/components/ShellConfirmationDialog.js +2 -2
  162. package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
  163. package/dist/src/ui/components/ShellInputPrompt.d.ts +11 -0
  164. package/dist/src/ui/components/ShellInputPrompt.js +36 -0
  165. package/dist/src/ui/components/ShellInputPrompt.js.map +1 -0
  166. package/dist/src/ui/components/ShellModeIndicator.js +2 -2
  167. package/dist/src/ui/components/ShellModeIndicator.js.map +1 -1
  168. package/dist/src/ui/components/ShowMoreLines.js +2 -2
  169. package/dist/src/ui/components/ShowMoreLines.js.map +1 -1
  170. package/dist/src/ui/components/StatsDisplay.js +6 -6
  171. package/dist/src/ui/components/StatsDisplay.js.map +1 -1
  172. package/dist/src/ui/components/SuggestionsDisplay.d.ts +5 -2
  173. package/dist/src/ui/components/SuggestionsDisplay.js +17 -11
  174. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
  175. package/dist/src/ui/components/ThemeDialog.js +4 -4
  176. package/dist/src/ui/components/ThemeDialog.js.map +1 -1
  177. package/dist/src/ui/components/ThemeDialog.test.js +10 -0
  178. package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
  179. package/dist/src/ui/components/Tips.js +2 -2
  180. package/dist/src/ui/components/Tips.js.map +1 -1
  181. package/dist/src/ui/components/ToolStatsDisplay.js +4 -4
  182. package/dist/src/ui/components/ToolStatsDisplay.js.map +1 -1
  183. package/dist/src/ui/components/UpdateNotification.js +2 -2
  184. package/dist/src/ui/components/UpdateNotification.js.map +1 -1
  185. package/dist/src/ui/components/WorkspaceMigrationDialog.js +4 -4
  186. package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +1 -1
  187. package/dist/src/ui/components/messages/CompressionMessage.d.ts +1 -2
  188. package/dist/src/ui/components/messages/CompressionMessage.js +37 -8
  189. package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -1
  190. package/dist/src/ui/components/messages/CompressionMessage.test.d.ts +6 -0
  191. package/dist/src/ui/components/messages/CompressionMessage.test.js +160 -0
  192. package/dist/src/ui/components/messages/CompressionMessage.test.js.map +1 -0
  193. package/dist/src/ui/components/messages/DiffRenderer.d.ts +2 -1
  194. package/dist/src/ui/components/messages/DiffRenderer.js +14 -22
  195. package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
  196. package/dist/src/ui/components/messages/ErrorMessage.js +2 -2
  197. package/dist/src/ui/components/messages/ErrorMessage.js.map +1 -1
  198. package/dist/src/ui/components/messages/GeminiMessage.js +2 -2
  199. package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -1
  200. package/dist/src/ui/components/messages/InfoMessage.js +2 -2
  201. package/dist/src/ui/components/messages/InfoMessage.js.map +1 -1
  202. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +31 -19
  203. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
  204. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +3 -0
  205. package/dist/src/ui/components/messages/ToolGroupMessage.js +10 -6
  206. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
  207. package/dist/src/ui/components/messages/ToolMessage.d.ts +4 -0
  208. package/dist/src/ui/components/messages/ToolMessage.js +17 -10
  209. package/dist/src/ui/components/messages/ToolMessage.js.map +1 -1
  210. package/dist/src/ui/components/messages/ToolMessage.test.js +33 -1
  211. package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -1
  212. package/dist/src/ui/components/messages/UserMessage.js +3 -3
  213. package/dist/src/ui/components/messages/UserMessage.js.map +1 -1
  214. package/dist/src/ui/components/messages/UserShellMessage.js +2 -2
  215. package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -1
  216. package/dist/src/ui/components/shared/MaxSizedBox.js +2 -2
  217. package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -1
  218. package/dist/src/ui/components/shared/RadioButtonSelect.js +12 -12
  219. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
  220. package/dist/src/ui/components/shared/text-buffer.d.ts +19 -2
  221. package/dist/src/ui/components/shared/text-buffer.js +191 -133
  222. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  223. package/dist/src/ui/components/views/ExtensionsList.d.ts +6 -0
  224. package/dist/src/ui/components/views/ExtensionsList.js +47 -0
  225. package/dist/src/ui/components/views/ExtensionsList.js.map +1 -0
  226. package/dist/src/ui/components/views/ExtensionsList.test.d.ts +6 -0
  227. package/dist/src/ui/components/views/ExtensionsList.test.js +97 -0
  228. package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -0
  229. package/dist/src/ui/contexts/UIStateContext.d.ts +6 -1
  230. package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
  231. package/dist/src/ui/hooks/keyToAnsi.d.ts +15 -0
  232. package/dist/src/ui/hooks/keyToAnsi.js +67 -0
  233. package/dist/src/ui/hooks/keyToAnsi.js.map +1 -0
  234. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +2 -1
  235. package/dist/src/ui/hooks/shellCommandProcessor.js +58 -15
  236. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
  237. package/dist/src/ui/hooks/shellCommandProcessor.test.js +196 -17
  238. package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
  239. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +3 -1
  240. package/dist/src/ui/hooks/slashCommandProcessor.js +14 -44
  241. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  242. package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +3 -2
  243. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +9 -5
  244. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -1
  245. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +69 -0
  246. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -1
  247. package/dist/src/ui/hooks/useGeminiStream.d.ts +11 -1
  248. package/dist/src/ui/hooks/useGeminiStream.js +75 -18
  249. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  250. package/dist/src/ui/hooks/useGitBranchName.js +15 -18
  251. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -1
  252. package/dist/src/ui/hooks/useGitBranchName.test.js +49 -53
  253. package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
  254. package/dist/src/ui/hooks/useIdeTrustListener.js +2 -2
  255. package/dist/src/ui/hooks/useIdeTrustListener.js.map +1 -1
  256. package/dist/src/ui/hooks/useQuotaAndFallback.test.js +0 -2
  257. package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -1
  258. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +3 -2
  259. package/dist/src/ui/hooks/useReactToolScheduler.js +21 -17
  260. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
  261. package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +1 -1
  262. package/dist/src/ui/hooks/useReverseSearchCompletion.js +67 -20
  263. package/dist/src/ui/hooks/useReverseSearchCompletion.js.map +1 -1
  264. package/dist/src/ui/hooks/useSlashCompletion.d.ts +1 -1
  265. package/dist/src/ui/hooks/useSlashCompletion.js +12 -1
  266. package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
  267. package/dist/src/ui/hooks/useSlashCompletion.test.js +14 -2
  268. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
  269. package/dist/src/ui/hooks/useToolScheduler.test.js +6 -4
  270. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
  271. package/dist/src/ui/keyMatchers.test.js +8 -0
  272. package/dist/src/ui/keyMatchers.test.js.map +1 -1
  273. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js +5 -5
  274. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js.map +1 -1
  275. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js +2 -2
  276. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js.map +1 -1
  277. package/dist/src/ui/privacy/GeminiPrivacyNotice.js +2 -2
  278. package/dist/src/ui/privacy/GeminiPrivacyNotice.js.map +1 -1
  279. package/dist/src/ui/state/extensions.d.ts +14 -0
  280. package/dist/src/ui/state/extensions.js +16 -0
  281. package/dist/src/ui/state/extensions.js.map +1 -0
  282. package/dist/src/ui/themes/ayu.js +1 -1
  283. package/dist/src/ui/themes/dracula.js +2 -2
  284. package/dist/src/ui/themes/github-dark.js +1 -1
  285. package/dist/src/ui/themes/theme.js +17 -17
  286. package/dist/src/ui/themes/theme.js.map +1 -1
  287. package/dist/src/ui/types.d.ts +12 -2
  288. package/dist/src/ui/types.js +1 -0
  289. package/dist/src/ui/types.js.map +1 -1
  290. package/dist/src/ui/utils/CodeColorizer.js +3 -2
  291. package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
  292. package/dist/src/ui/utils/InlineMarkdownRenderer.js +7 -7
  293. package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -1
  294. package/dist/src/ui/utils/MarkdownDisplay.js +10 -10
  295. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
  296. package/dist/src/ui/utils/MarkdownDisplay.test.js +6 -2
  297. package/dist/src/ui/utils/MarkdownDisplay.test.js.map +1 -1
  298. package/dist/src/ui/utils/TableRenderer.js +4 -4
  299. package/dist/src/ui/utils/TableRenderer.js.map +1 -1
  300. package/dist/src/ui/utils/clipboardUtils.js +5 -6
  301. package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
  302. package/dist/src/ui/utils/displayUtils.js +4 -4
  303. package/dist/src/ui/utils/displayUtils.js.map +1 -1
  304. package/dist/src/ui/utils/textUtils.d.ts +9 -0
  305. package/dist/src/ui/utils/textUtils.js +52 -3
  306. package/dist/src/ui/utils/textUtils.js.map +1 -1
  307. package/dist/src/utils/commands.d.ts +20 -0
  308. package/dist/src/utils/commands.js +53 -0
  309. package/dist/src/utils/commands.js.map +1 -0
  310. package/dist/src/utils/commands.test.d.ts +6 -0
  311. package/dist/src/utils/commands.test.js +115 -0
  312. package/dist/src/utils/commands.test.js.map +1 -0
  313. package/dist/src/utils/commentJson.d.ts +9 -0
  314. package/dist/src/utils/commentJson.js +48 -0
  315. package/dist/src/utils/commentJson.js.map +1 -0
  316. package/dist/src/utils/commentJson.test.d.ts +6 -0
  317. package/dist/src/utils/commentJson.test.js +146 -0
  318. package/dist/src/utils/commentJson.test.js.map +1 -0
  319. package/dist/src/utils/errors.d.ts +21 -0
  320. package/dist/src/utils/errors.js +93 -0
  321. package/dist/src/utils/errors.js.map +1 -1
  322. package/dist/src/utils/errors.test.d.ts +6 -0
  323. package/dist/src/utils/errors.test.js +303 -0
  324. package/dist/src/utils/errors.test.js.map +1 -0
  325. package/dist/src/utils/sandbox.d.ts +1 -1
  326. package/dist/src/utils/sandbox.js +10 -17
  327. package/dist/src/utils/sandbox.js.map +1 -1
  328. package/dist/src/utils/settingsUtils.test.js +37 -2
  329. package/dist/src/utils/settingsUtils.test.js.map +1 -1
  330. package/dist/src/validateNonInterActiveAuth.js +30 -18
  331. package/dist/src/validateNonInterActiveAuth.js.map +1 -1
  332. package/dist/src/zed-integration/schema.d.ts +18 -18
  333. package/dist/src/zed-integration/zedIntegration.js +10 -7
  334. package/dist/src/zed-integration/zedIntegration.js.map +1 -1
  335. package/dist/tsconfig.tsbuildinfo +1 -1
  336. package/package.json +5 -5
  337. package/dist/src/utils/processUtils.d.ts +0 -13
  338. package/dist/src/utils/processUtils.js +0 -18
  339. package/dist/src/utils/processUtils.js.map +0 -1
  340. package/dist/src/utils/processUtils.test.js +0 -20
  341. package/dist/src/utils/processUtils.test.js.map +0 -1
  342. /package/dist/src/{utils/processUtils.test.d.ts → config/extensions/extensionEnablement.test.d.ts} +0 -0
@@ -8,9 +8,8 @@ import fs from 'node:fs';
8
8
  import os from 'node:os';
9
9
  import pathMod from 'node:path';
10
10
  import { useState, useCallback, useEffect, useMemo, useReducer } from 'react';
11
- import stringWidth from 'string-width';
12
11
  import { unescapePath } from '@google/gemini-cli-core';
13
- import { toCodePoints, cpLen, cpSlice, stripUnsafeCharacters, } from '../../utils/textUtils.js';
12
+ import { toCodePoints, cpLen, cpSlice, stripUnsafeCharacters, getCachedStringWidth, } from '../../utils/textUtils.js';
14
13
  import { handleVimAction } from './vim-buffer-actions.js';
15
14
  // Simple helper for word‑wise ops.
16
15
  function isWordChar(ch) {
@@ -455,12 +454,12 @@ export function logicalPosToOffset(lines, row, col) {
455
454
  }
456
455
  return offset;
457
456
  }
458
- // Helper to calculate visual lines and map cursor positions
459
- function calculateVisualLayout(logicalLines, logicalCursor, viewportWidth) {
457
+ // Calculates the visual wrapping of lines and the mapping between logical and visual coordinates.
458
+ // This is an expensive operation and should be memoized.
459
+ function calculateLayout(logicalLines, viewportWidth) {
460
460
  const visualLines = [];
461
461
  const logicalToVisualMap = [];
462
462
  const visualToLogicalMap = [];
463
- let currentVisualCursor = [0, 0];
464
463
  logicalLines.forEach((logLine, logIndex) => {
465
464
  logicalToVisualMap[logIndex] = [];
466
465
  if (logLine.length === 0) {
@@ -468,9 +467,6 @@ function calculateVisualLayout(logicalLines, logicalCursor, viewportWidth) {
468
467
  logicalToVisualMap[logIndex].push([visualLines.length, 0]);
469
468
  visualToLogicalMap.push([logIndex, 0]);
470
469
  visualLines.push('');
471
- if (logIndex === logicalCursor[0] && logicalCursor[1] === 0) {
472
- currentVisualCursor = [visualLines.length - 1, 0];
473
- }
474
470
  }
475
471
  else {
476
472
  // Non-empty logical line
@@ -485,7 +481,7 @@ function calculateVisualLayout(logicalLines, logicalCursor, viewportWidth) {
485
481
  // Iterate through code points to build the current visual line (chunk)
486
482
  for (let i = currentPosInLogLine; i < codePointsInLogLine.length; i++) {
487
483
  const char = codePointsInLogLine[i];
488
- const charVisualWidth = stringWidth(char);
484
+ const charVisualWidth = getCachedStringWidth(char);
489
485
  if (currentChunkVisualWidth + charVisualWidth > viewportWidth) {
490
486
  // Character would exceed viewport width
491
487
  if (lastWordBreakPoint !== -1 &&
@@ -551,27 +547,6 @@ function calculateVisualLayout(logicalLines, logicalCursor, viewportWidth) {
551
547
  ]);
552
548
  visualToLogicalMap.push([logIndex, currentPosInLogLine]);
553
549
  visualLines.push(currentChunk);
554
- // Cursor mapping logic
555
- // Note: currentPosInLogLine here is the start of the currentChunk within the logical line.
556
- if (logIndex === logicalCursor[0]) {
557
- const cursorLogCol = logicalCursor[1]; // This is a code point index
558
- if (cursorLogCol >= currentPosInLogLine &&
559
- cursorLogCol < currentPosInLogLine + numCodePointsInChunk // Cursor is within this chunk
560
- ) {
561
- currentVisualCursor = [
562
- visualLines.length - 1,
563
- cursorLogCol - currentPosInLogLine, // Visual col is also code point index within visual line
564
- ];
565
- }
566
- else if (cursorLogCol === currentPosInLogLine + numCodePointsInChunk &&
567
- numCodePointsInChunk > 0) {
568
- // Cursor is exactly at the end of this non-empty chunk
569
- currentVisualCursor = [
570
- visualLines.length - 1,
571
- numCodePointsInChunk,
572
- ];
573
- }
574
- }
575
550
  const logicalStartOfThisChunk = currentPosInLogLine;
576
551
  currentPosInLogLine += numCodePointsInChunk;
577
552
  // If the chunk processed did not consume the entire logical line,
@@ -584,20 +559,6 @@ function calculateVisualLayout(logicalLines, logicalCursor, viewportWidth) {
584
559
  currentPosInLogLine++;
585
560
  }
586
561
  }
587
- // After all chunks of a non-empty logical line are processed,
588
- // if the cursor is at the very end of this logical line, update visual cursor.
589
- if (logIndex === logicalCursor[0] &&
590
- logicalCursor[1] === codePointsInLogLine.length // Cursor at end of logical line
591
- ) {
592
- const lastVisualLineIdx = visualLines.length - 1;
593
- if (lastVisualLineIdx >= 0 &&
594
- visualLines[lastVisualLineIdx] !== undefined) {
595
- currentVisualCursor = [
596
- lastVisualLineIdx,
597
- cpLen(visualLines[lastVisualLineIdx]), // Cursor at end of last visual line for this logical line
598
- ];
599
- }
600
- }
601
562
  }
602
563
  });
603
564
  // If the entire logical text was empty, ensure there's one empty visual line.
@@ -610,23 +571,46 @@ function calculateVisualLayout(logicalLines, logicalCursor, viewportWidth) {
610
571
  logicalToVisualMap[0].push([0, 0]);
611
572
  visualToLogicalMap.push([0, 0]);
612
573
  }
613
- currentVisualCursor = [0, 0];
614
- }
615
- // Handle cursor at the very end of the text (after all processing)
616
- // This case might be covered by the loop end condition now, but kept for safety.
617
- else if (logicalCursor[0] === logicalLines.length - 1 &&
618
- logicalCursor[1] === cpLen(logicalLines[logicalLines.length - 1]) &&
619
- visualLines.length > 0) {
620
- const lastVisLineIdx = visualLines.length - 1;
621
- currentVisualCursor = [lastVisLineIdx, cpLen(visualLines[lastVisLineIdx])];
622
574
  }
623
575
  return {
624
576
  visualLines,
625
- visualCursor: currentVisualCursor,
626
577
  logicalToVisualMap,
627
578
  visualToLogicalMap,
628
579
  };
629
580
  }
581
+ // Calculates the visual cursor position based on a pre-calculated layout.
582
+ // This is a lightweight operation.
583
+ function calculateVisualCursorFromLayout(layout, logicalCursor) {
584
+ const { logicalToVisualMap, visualLines } = layout;
585
+ const [logicalRow, logicalCol] = logicalCursor;
586
+ const segmentsForLogicalLine = logicalToVisualMap[logicalRow];
587
+ if (!segmentsForLogicalLine || segmentsForLogicalLine.length === 0) {
588
+ // This can happen for an empty document.
589
+ return [0, 0];
590
+ }
591
+ // Find the segment where the logical column fits.
592
+ // The segments are sorted by startColInLogical.
593
+ let targetSegmentIndex = segmentsForLogicalLine.findIndex(([, startColInLogical], index) => {
594
+ const nextStartColInLogical = index + 1 < segmentsForLogicalLine.length
595
+ ? segmentsForLogicalLine[index + 1][1]
596
+ : Infinity;
597
+ return (logicalCol >= startColInLogical && logicalCol < nextStartColInLogical);
598
+ });
599
+ // If not found, it means the cursor is at the end of the logical line.
600
+ if (targetSegmentIndex === -1) {
601
+ if (logicalCol === 0) {
602
+ targetSegmentIndex = 0;
603
+ }
604
+ else {
605
+ targetSegmentIndex = segmentsForLogicalLine.length - 1;
606
+ }
607
+ }
608
+ const [visualRow, startColInLogical] = segmentsForLogicalLine[targetSegmentIndex];
609
+ const visualCol = logicalCol - startColInLogical;
610
+ // The visual column should not exceed the length of the visual line.
611
+ const clampedVisualCol = Math.min(visualCol, cpLen(visualLines[visualRow] ?? ''));
612
+ return [visualRow, clampedVisualCol];
613
+ }
630
614
  const historyLimit = 100;
631
615
  export const pushUndo = (currentState) => {
632
616
  const snapshot = {
@@ -640,7 +624,7 @@ export const pushUndo = (currentState) => {
640
624
  }
641
625
  return { ...currentState, undoStack: newStack, redoStack: [] };
642
626
  };
643
- export function textBufferReducer(state, action) {
627
+ function textBufferReducerLogic(state, action) {
644
628
  const pushUndoLocal = pushUndo;
645
629
  const currentLine = (r) => state.lines[r] ?? '';
646
630
  const currentLineLen = (r) => cpLen(currentLine(r));
@@ -727,68 +711,101 @@ export function textBufferReducer(state, action) {
727
711
  preferredCol: null,
728
712
  };
729
713
  }
730
- case 'set_viewport_width': {
731
- if (action.payload === state.viewportWidth) {
714
+ case 'set_viewport': {
715
+ const { width, height } = action.payload;
716
+ if (width === state.viewportWidth && height === state.viewportHeight) {
732
717
  return state;
733
718
  }
734
- return { ...state, viewportWidth: action.payload };
719
+ return {
720
+ ...state,
721
+ viewportWidth: width,
722
+ viewportHeight: height,
723
+ };
735
724
  }
736
725
  case 'move': {
737
726
  const { dir } = action.payload;
738
- const { lines, cursorRow, cursorCol, viewportWidth } = state;
739
- const visualLayout = calculateVisualLayout(lines, [cursorRow, cursorCol], viewportWidth);
740
- const { visualLines, visualCursor, visualToLogicalMap } = visualLayout;
741
- let newVisualRow = visualCursor[0];
742
- let newVisualCol = visualCursor[1];
743
- let newPreferredCol = state.preferredCol;
744
- const currentVisLineLen = cpLen(visualLines[newVisualRow] ?? '');
745
- switch (dir) {
746
- case 'left':
747
- newPreferredCol = null;
748
- if (newVisualCol > 0) {
749
- newVisualCol--;
750
- }
751
- else if (newVisualRow > 0) {
752
- newVisualRow--;
753
- newVisualCol = cpLen(visualLines[newVisualRow] ?? '');
754
- }
755
- break;
756
- case 'right':
757
- newPreferredCol = null;
758
- if (newVisualCol < currentVisLineLen) {
759
- newVisualCol++;
760
- }
761
- else if (newVisualRow < visualLines.length - 1) {
762
- newVisualRow++;
727
+ const { cursorRow, cursorCol, lines, visualLayout, preferredCol } = state;
728
+ // Visual movements
729
+ if (dir === 'left' ||
730
+ dir === 'right' ||
731
+ dir === 'up' ||
732
+ dir === 'down' ||
733
+ dir === 'home' ||
734
+ dir === 'end') {
735
+ const visualCursor = calculateVisualCursorFromLayout(visualLayout, [
736
+ cursorRow,
737
+ cursorCol,
738
+ ]);
739
+ const { visualLines, visualToLogicalMap } = visualLayout;
740
+ let newVisualRow = visualCursor[0];
741
+ let newVisualCol = visualCursor[1];
742
+ let newPreferredCol = preferredCol;
743
+ const currentVisLineLen = cpLen(visualLines[newVisualRow] ?? '');
744
+ switch (dir) {
745
+ case 'left':
746
+ newPreferredCol = null;
747
+ if (newVisualCol > 0) {
748
+ newVisualCol--;
749
+ }
750
+ else if (newVisualRow > 0) {
751
+ newVisualRow--;
752
+ newVisualCol = cpLen(visualLines[newVisualRow] ?? '');
753
+ }
754
+ break;
755
+ case 'right':
756
+ newPreferredCol = null;
757
+ if (newVisualCol < currentVisLineLen) {
758
+ newVisualCol++;
759
+ }
760
+ else if (newVisualRow < visualLines.length - 1) {
761
+ newVisualRow++;
762
+ newVisualCol = 0;
763
+ }
764
+ break;
765
+ case 'up':
766
+ if (newVisualRow > 0) {
767
+ if (newPreferredCol === null)
768
+ newPreferredCol = newVisualCol;
769
+ newVisualRow--;
770
+ newVisualCol = clamp(newPreferredCol, 0, cpLen(visualLines[newVisualRow] ?? ''));
771
+ }
772
+ break;
773
+ case 'down':
774
+ if (newVisualRow < visualLines.length - 1) {
775
+ if (newPreferredCol === null)
776
+ newPreferredCol = newVisualCol;
777
+ newVisualRow++;
778
+ newVisualCol = clamp(newPreferredCol, 0, cpLen(visualLines[newVisualRow] ?? ''));
779
+ }
780
+ break;
781
+ case 'home':
782
+ newPreferredCol = null;
763
783
  newVisualCol = 0;
784
+ break;
785
+ case 'end':
786
+ newPreferredCol = null;
787
+ newVisualCol = currentVisLineLen;
788
+ break;
789
+ default: {
790
+ const exhaustiveCheck = dir;
791
+ console.error(`Unknown visual movement direction: ${exhaustiveCheck}`);
792
+ return state;
764
793
  }
765
- break;
766
- case 'up':
767
- if (newVisualRow > 0) {
768
- if (newPreferredCol === null)
769
- newPreferredCol = newVisualCol;
770
- newVisualRow--;
771
- newVisualCol = clamp(newPreferredCol, 0, cpLen(visualLines[newVisualRow] ?? ''));
772
- }
773
- break;
774
- case 'down':
775
- if (newVisualRow < visualLines.length - 1) {
776
- if (newPreferredCol === null)
777
- newPreferredCol = newVisualCol;
778
- newVisualRow++;
779
- newVisualCol = clamp(newPreferredCol, 0, cpLen(visualLines[newVisualRow] ?? ''));
780
- }
781
- break;
782
- case 'home':
783
- newPreferredCol = null;
784
- newVisualCol = 0;
785
- break;
786
- case 'end':
787
- newPreferredCol = null;
788
- newVisualCol = currentVisLineLen;
789
- break;
794
+ }
795
+ if (visualToLogicalMap[newVisualRow]) {
796
+ const [logRow, logStartCol] = visualToLogicalMap[newVisualRow];
797
+ return {
798
+ ...state,
799
+ cursorRow: logRow,
800
+ cursorCol: clamp(logStartCol + newVisualCol, 0, cpLen(lines[logRow] ?? '')),
801
+ preferredCol: newPreferredCol,
802
+ };
803
+ }
804
+ return state;
805
+ }
806
+ // Logical movements
807
+ switch (dir) {
790
808
  case 'wordLeft': {
791
- const { cursorRow, cursorCol, lines } = state;
792
809
  if (cursorCol === 0 && cursorRow === 0)
793
810
  return state;
794
811
  let newCursorRow = cursorRow;
@@ -827,7 +844,6 @@ export function textBufferReducer(state, action) {
827
844
  };
828
845
  }
829
846
  case 'wordRight': {
830
- const { cursorRow, cursorCol, lines } = state;
831
847
  if (cursorRow === lines.length - 1 &&
832
848
  cursorCol === cpLen(lines[cursorRow] ?? '')) {
833
849
  return state;
@@ -856,18 +872,14 @@ export function textBufferReducer(state, action) {
856
872
  };
857
873
  }
858
874
  default:
859
- break;
860
- }
861
- if (visualToLogicalMap[newVisualRow]) {
862
- const [logRow, logStartCol] = visualToLogicalMap[newVisualRow];
863
- return {
864
- ...state,
865
- cursorRow: logRow,
866
- cursorCol: clamp(logStartCol + newVisualCol, 0, cpLen(state.lines[logRow] ?? '')),
867
- preferredCol: newPreferredCol,
868
- };
875
+ return state;
869
876
  }
870
- return state;
877
+ }
878
+ case 'set_cursor': {
879
+ return {
880
+ ...state,
881
+ ...action.payload,
882
+ };
871
883
  }
872
884
  case 'delete': {
873
885
  const { cursorRow, cursorCol, lines } = state;
@@ -878,7 +890,11 @@ export function textBufferReducer(state, action) {
878
890
  newLines[cursorRow] =
879
891
  cpSlice(lineContent, 0, cursorCol) +
880
892
  cpSlice(lineContent, cursorCol + 1);
881
- return { ...nextState, lines: newLines, preferredCol: null };
893
+ return {
894
+ ...nextState,
895
+ lines: newLines,
896
+ preferredCol: null,
897
+ };
882
898
  }
883
899
  else if (cursorRow < lines.length - 1) {
884
900
  const nextState = pushUndoLocal(state);
@@ -886,7 +902,11 @@ export function textBufferReducer(state, action) {
886
902
  const newLines = [...nextState.lines];
887
903
  newLines[cursorRow] = lineContent + nextLineContent;
888
904
  newLines.splice(cursorRow + 1, 1);
889
- return { ...nextState, lines: newLines, preferredCol: null };
905
+ return {
906
+ ...nextState,
907
+ lines: newLines,
908
+ preferredCol: null,
909
+ };
890
910
  }
891
911
  return state;
892
912
  }
@@ -958,7 +978,10 @@ export function textBufferReducer(state, action) {
958
978
  const nextState = pushUndoLocal(state);
959
979
  const newLines = [...nextState.lines];
960
980
  newLines[cursorRow] = cpSlice(lineContent, 0, cursorCol);
961
- return { ...nextState, lines: newLines };
981
+ return {
982
+ ...nextState,
983
+ lines: newLines,
984
+ };
962
985
  }
963
986
  else if (cursorRow < lines.length - 1) {
964
987
  // Act as a delete
@@ -967,7 +990,11 @@ export function textBufferReducer(state, action) {
967
990
  const newLines = [...nextState.lines];
968
991
  newLines[cursorRow] = lineContent + nextLineContent;
969
992
  newLines.splice(cursorRow + 1, 1);
970
- return { ...nextState, lines: newLines, preferredCol: null };
993
+ return {
994
+ ...nextState,
995
+ lines: newLines,
996
+ preferredCol: null,
997
+ };
971
998
  }
972
999
  return state;
973
1000
  }
@@ -1078,11 +1105,23 @@ export function textBufferReducer(state, action) {
1078
1105
  }
1079
1106
  }
1080
1107
  }
1108
+ export function textBufferReducer(state, action) {
1109
+ const newState = textBufferReducerLogic(state, action);
1110
+ if (newState.lines !== state.lines ||
1111
+ newState.viewportWidth !== state.viewportWidth) {
1112
+ return {
1113
+ ...newState,
1114
+ visualLayout: calculateLayout(newState.lines, newState.viewportWidth),
1115
+ };
1116
+ }
1117
+ return newState;
1118
+ }
1081
1119
  // --- End of reducer logic ---
1082
1120
  export function useTextBuffer({ initialText = '', initialCursorOffset = 0, viewport, stdin, setRawMode, onChange, isValidPath, shellModeActive = false, }) {
1083
1121
  const initialState = useMemo(() => {
1084
1122
  const lines = initialText.split('\n');
1085
1123
  const [initialCursorRow, initialCursorCol] = calculateInitialCursorPosition(lines.length === 0 ? [''] : lines, initialCursorOffset);
1124
+ const visualLayout = calculateLayout(lines.length === 0 ? [''] : lines, viewport.width);
1086
1125
  return {
1087
1126
  lines: lines.length === 0 ? [''] : lines,
1088
1127
  cursorRow: initialCursorRow,
@@ -1093,13 +1132,15 @@ export function useTextBuffer({ initialText = '', initialCursorOffset = 0, viewp
1093
1132
  clipboard: null,
1094
1133
  selectionAnchor: null,
1095
1134
  viewportWidth: viewport.width,
1135
+ viewportHeight: viewport.height,
1136
+ visualLayout,
1096
1137
  };
1097
- }, [initialText, initialCursorOffset, viewport.width]);
1138
+ }, [initialText, initialCursorOffset, viewport.width, viewport.height]);
1098
1139
  const [state, dispatch] = useReducer(textBufferReducer, initialState);
1099
- const { lines, cursorRow, cursorCol, preferredCol, selectionAnchor } = state;
1140
+ const { lines, cursorRow, cursorCol, preferredCol, selectionAnchor, visualLayout, } = state;
1100
1141
  const text = useMemo(() => lines.join('\n'), [lines]);
1101
- const visualLayout = useMemo(() => calculateVisualLayout(lines, [cursorRow, cursorCol], state.viewportWidth), [lines, cursorRow, cursorCol, state.viewportWidth]);
1102
- const { visualLines, visualCursor } = visualLayout;
1142
+ const visualCursor = useMemo(() => calculateVisualCursorFromLayout(visualLayout, [cursorRow, cursorCol]), [visualLayout, cursorRow, cursorCol]);
1143
+ const { visualLines } = visualLayout;
1103
1144
  const [visualScrollRow, setVisualScrollRow] = useState(0);
1104
1145
  useEffect(() => {
1105
1146
  if (onChange) {
@@ -1107,8 +1148,11 @@ export function useTextBuffer({ initialText = '', initialCursorOffset = 0, viewp
1107
1148
  }
1108
1149
  }, [text, onChange]);
1109
1150
  useEffect(() => {
1110
- dispatch({ type: 'set_viewport_width', payload: viewport.width });
1111
- }, [viewport.width]);
1151
+ dispatch({
1152
+ type: 'set_viewport',
1153
+ payload: { width: viewport.width, height: viewport.height },
1154
+ });
1155
+ }, [viewport.width, viewport.height]);
1112
1156
  // Update visual scroll (vertical)
1113
1157
  useEffect(() => {
1114
1158
  const { height } = viewport;
@@ -1170,7 +1214,7 @@ export function useTextBuffer({ initialText = '', initialCursorOffset = 0, viewp
1170
1214
  }, []);
1171
1215
  const move = useCallback((dir) => {
1172
1216
  dispatch({ type: 'move', payload: { dir } });
1173
- }, []);
1217
+ }, [dispatch]);
1174
1218
  const undo = useCallback(() => {
1175
1219
  dispatch({ type: 'undo' });
1176
1220
  }, []);
@@ -1388,10 +1432,24 @@ export function useTextBuffer({ initialText = '', initialCursorOffset = 0, viewp
1388
1432
  backspace();
1389
1433
  else if (key.name === 'delete' || (key.ctrl && key.name === 'd'))
1390
1434
  del();
1435
+ else if (key.ctrl && !key.shift && key.name === 'z')
1436
+ undo();
1437
+ else if (key.ctrl && key.shift && key.name === 'z')
1438
+ redo();
1391
1439
  else if (input && !key.ctrl && !key.meta) {
1392
1440
  insert(input, { paste: key.paste });
1393
1441
  }
1394
- }, [newline, move, deleteWordLeft, deleteWordRight, backspace, del, insert]);
1442
+ }, [
1443
+ newline,
1444
+ move,
1445
+ deleteWordLeft,
1446
+ deleteWordRight,
1447
+ backspace,
1448
+ del,
1449
+ insert,
1450
+ undo,
1451
+ redo,
1452
+ ]);
1395
1453
  const renderedVisualLines = useMemo(() => visualLines.slice(visualScrollRow, visualScrollRow + viewport.height), [visualLines, visualScrollRow, viewport.height]);
1396
1454
  const replaceRange = useCallback((startRow, startCol, endRow, endCol, text) => {
1397
1455
  dispatch({