@machina.ai/cell-cli 0.1.13-rc2

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 (475) hide show
  1. package/dist/.last_build +0 -0
  2. package/dist/index.d.ts +7 -0
  3. package/dist/index.js +20 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/package.json +79 -0
  6. package/dist/src/acp/acp.d.ts +208 -0
  7. package/dist/src/acp/acp.js +193 -0
  8. package/dist/src/acp/acp.js.map +1 -0
  9. package/dist/src/acp/acpPeer.d.ts +8 -0
  10. package/dist/src/acp/acpPeer.js +537 -0
  11. package/dist/src/acp/acpPeer.js.map +1 -0
  12. package/dist/src/config/auth.d.ts +6 -0
  13. package/dist/src/config/auth.js +15 -0
  14. package/dist/src/config/auth.js.map +1 -0
  15. package/dist/src/config/config.d.ts +39 -0
  16. package/dist/src/config/config.js +359 -0
  17. package/dist/src/config/config.js.map +1 -0
  18. package/dist/src/config/extension.d.ts +21 -0
  19. package/dist/src/config/extension.js +114 -0
  20. package/dist/src/config/extension.js.map +1 -0
  21. package/dist/src/config/sandboxConfig.d.ts +13 -0
  22. package/dist/src/config/sandboxConfig.js +75 -0
  23. package/dist/src/config/sandboxConfig.js.map +1 -0
  24. package/dist/src/config/settings.d.ts +91 -0
  25. package/dist/src/config/settings.js +282 -0
  26. package/dist/src/config/settings.js.map +1 -0
  27. package/dist/src/gemini.d.ts +6 -0
  28. package/dist/src/gemini.js +242 -0
  29. package/dist/src/gemini.js.map +1 -0
  30. package/dist/src/generated/git-commit.d.ts +6 -0
  31. package/dist/src/generated/git-commit.js +9 -0
  32. package/dist/src/generated/git-commit.js.map +1 -0
  33. package/dist/src/nonInteractiveCli.d.ts +7 -0
  34. package/dist/src/nonInteractiveCli.js +124 -0
  35. package/dist/src/nonInteractiveCli.js.map +1 -0
  36. package/dist/src/services/BuiltinCommandLoader.d.ts +24 -0
  37. package/dist/src/services/BuiltinCommandLoader.js +70 -0
  38. package/dist/src/services/BuiltinCommandLoader.js.map +1 -0
  39. package/dist/src/services/CommandService.d.ts +51 -0
  40. package/dist/src/services/CommandService.js +74 -0
  41. package/dist/src/services/CommandService.js.map +1 -0
  42. package/dist/src/services/FileCommandLoader.d.ts +37 -0
  43. package/dist/src/services/FileCommandLoader.js +133 -0
  44. package/dist/src/services/FileCommandLoader.js.map +1 -0
  45. package/dist/src/services/types.d.ts +22 -0
  46. package/dist/src/services/types.js +7 -0
  47. package/dist/src/services/types.js.map +1 -0
  48. package/dist/src/ui/App.d.ts +15 -0
  49. package/dist/src/ui/App.js +488 -0
  50. package/dist/src/ui/App.js.map +1 -0
  51. package/dist/src/ui/colors.d.ts +7 -0
  52. package/dist/src/ui/colors.js +48 -0
  53. package/dist/src/ui/colors.js.map +1 -0
  54. package/dist/src/ui/commands/aboutCommand.d.ts +7 -0
  55. package/dist/src/ui/commands/aboutCommand.js +39 -0
  56. package/dist/src/ui/commands/aboutCommand.js.map +1 -0
  57. package/dist/src/ui/commands/authCommand.d.ts +7 -0
  58. package/dist/src/ui/commands/authCommand.js +16 -0
  59. package/dist/src/ui/commands/authCommand.js.map +1 -0
  60. package/dist/src/ui/commands/bugCommand.d.ts +7 -0
  61. package/dist/src/ui/commands/bugCommand.js +63 -0
  62. package/dist/src/ui/commands/bugCommand.js.map +1 -0
  63. package/dist/src/ui/commands/chatCommand.d.ts +7 -0
  64. package/dist/src/ui/commands/chatCommand.js +174 -0
  65. package/dist/src/ui/commands/chatCommand.js.map +1 -0
  66. package/dist/src/ui/commands/clearCommand.d.ts +7 -0
  67. package/dist/src/ui/commands/clearCommand.js +27 -0
  68. package/dist/src/ui/commands/clearCommand.js.map +1 -0
  69. package/dist/src/ui/commands/compressCommand.d.ts +7 -0
  70. package/dist/src/ui/commands/compressCommand.js +64 -0
  71. package/dist/src/ui/commands/compressCommand.js.map +1 -0
  72. package/dist/src/ui/commands/copyCommand.d.ts +7 -0
  73. package/dist/src/ui/commands/copyCommand.js +59 -0
  74. package/dist/src/ui/commands/copyCommand.js.map +1 -0
  75. package/dist/src/ui/commands/corgiCommand.d.ts +7 -0
  76. package/dist/src/ui/commands/corgiCommand.js +15 -0
  77. package/dist/src/ui/commands/corgiCommand.js.map +1 -0
  78. package/dist/src/ui/commands/docsCommand.d.ts +7 -0
  79. package/dist/src/ui/commands/docsCommand.js +31 -0
  80. package/dist/src/ui/commands/docsCommand.js.map +1 -0
  81. package/dist/src/ui/commands/editorCommand.d.ts +7 -0
  82. package/dist/src/ui/commands/editorCommand.js +16 -0
  83. package/dist/src/ui/commands/editorCommand.js.map +1 -0
  84. package/dist/src/ui/commands/extensionsCommand.d.ts +7 -0
  85. package/dist/src/ui/commands/extensionsCommand.js +31 -0
  86. package/dist/src/ui/commands/extensionsCommand.js.map +1 -0
  87. package/dist/src/ui/commands/helpCommand.d.ts +7 -0
  88. package/dist/src/ui/commands/helpCommand.js +20 -0
  89. package/dist/src/ui/commands/helpCommand.js.map +1 -0
  90. package/dist/src/ui/commands/ideCommand.d.ts +8 -0
  91. package/dist/src/ui/commands/ideCommand.js +127 -0
  92. package/dist/src/ui/commands/ideCommand.js.map +1 -0
  93. package/dist/src/ui/commands/mcpCommand.d.ts +7 -0
  94. package/dist/src/ui/commands/mcpCommand.js +206 -0
  95. package/dist/src/ui/commands/mcpCommand.js.map +1 -0
  96. package/dist/src/ui/commands/memoryCommand.d.ts +7 -0
  97. package/dist/src/ui/commands/memoryCommand.js +86 -0
  98. package/dist/src/ui/commands/memoryCommand.js.map +1 -0
  99. package/dist/src/ui/commands/privacyCommand.d.ts +7 -0
  100. package/dist/src/ui/commands/privacyCommand.js +16 -0
  101. package/dist/src/ui/commands/privacyCommand.js.map +1 -0
  102. package/dist/src/ui/commands/quitCommand.d.ts +7 -0
  103. package/dist/src/ui/commands/quitCommand.js +34 -0
  104. package/dist/src/ui/commands/quitCommand.js.map +1 -0
  105. package/dist/src/ui/commands/restoreCommand.d.ts +8 -0
  106. package/dist/src/ui/commands/restoreCommand.js +128 -0
  107. package/dist/src/ui/commands/restoreCommand.js.map +1 -0
  108. package/dist/src/ui/commands/statsCommand.d.ts +7 -0
  109. package/dist/src/ui/commands/statsCommand.js +54 -0
  110. package/dist/src/ui/commands/statsCommand.js.map +1 -0
  111. package/dist/src/ui/commands/themeCommand.d.ts +7 -0
  112. package/dist/src/ui/commands/themeCommand.js +16 -0
  113. package/dist/src/ui/commands/themeCommand.js.map +1 -0
  114. package/dist/src/ui/commands/toolsCommand.d.ts +7 -0
  115. package/dist/src/ui/commands/toolsCommand.js +56 -0
  116. package/dist/src/ui/commands/toolsCommand.js.map +1 -0
  117. package/dist/src/ui/commands/types.d.ts +110 -0
  118. package/dist/src/ui/commands/types.js +11 -0
  119. package/dist/src/ui/commands/types.js.map +1 -0
  120. package/dist/src/ui/components/AboutBox.d.ts +16 -0
  121. package/dist/src/ui/components/AboutBox.js +6 -0
  122. package/dist/src/ui/components/AboutBox.js.map +1 -0
  123. package/dist/src/ui/components/AsciiArt.d.ts +7 -0
  124. package/dist/src/ui/components/AsciiArt.js +32 -0
  125. package/dist/src/ui/components/AsciiArt.js.map +1 -0
  126. package/dist/src/ui/components/AuthDialog.d.ts +15 -0
  127. package/dist/src/ui/components/AuthDialog.js +50 -0
  128. package/dist/src/ui/components/AuthDialog.js.map +1 -0
  129. package/dist/src/ui/components/AuthInProgress.d.ts +11 -0
  130. package/dist/src/ui/components/AuthInProgress.js +27 -0
  131. package/dist/src/ui/components/AuthInProgress.js.map +1 -0
  132. package/dist/src/ui/components/AutoAcceptIndicator.d.ts +12 -0
  133. package/dist/src/ui/components/AutoAcceptIndicator.js +26 -0
  134. package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -0
  135. package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +11 -0
  136. package/dist/src/ui/components/ConsoleSummaryDisplay.js +11 -0
  137. package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -0
  138. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +20 -0
  139. package/dist/src/ui/components/ContextSummaryDisplay.js +68 -0
  140. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -0
  141. package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +14 -0
  142. package/dist/src/ui/components/DetailedMessagesDisplay.js +34 -0
  143. package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -0
  144. package/dist/src/ui/components/EditorSettingsDialog.d.ts +15 -0
  145. package/dist/src/ui/components/EditorSettingsDialog.js +73 -0
  146. package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -0
  147. package/dist/src/ui/components/Footer.d.ts +21 -0
  148. package/dist/src/ui/components/Footer.js +14 -0
  149. package/dist/src/ui/components/Footer.js.map +1 -0
  150. package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +17 -0
  151. package/dist/src/ui/components/GeminiRespondingSpinner.js +16 -0
  152. package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -0
  153. package/dist/src/ui/components/Header.d.ts +14 -0
  154. package/dist/src/ui/components/Header.js +20 -0
  155. package/dist/src/ui/components/Header.js.map +1 -0
  156. package/dist/src/ui/components/Help.d.ts +12 -0
  157. package/dist/src/ui/components/Help.js +10 -0
  158. package/dist/src/ui/components/Help.js.map +1 -0
  159. package/dist/src/ui/components/HistoryItemDisplay.d.ts +18 -0
  160. package/dist/src/ui/components/HistoryItemDisplay.js +17 -0
  161. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -0
  162. package/dist/src/ui/components/InputPrompt.d.ts +25 -0
  163. package/dist/src/ui/components/InputPrompt.js +387 -0
  164. package/dist/src/ui/components/InputPrompt.js.map +1 -0
  165. package/dist/src/ui/components/LoadingIndicator.d.ts +15 -0
  166. package/dist/src/ui/components/LoadingIndicator.js +20 -0
  167. package/dist/src/ui/components/LoadingIndicator.js.map +1 -0
  168. package/dist/src/ui/components/MemoryUsageDisplay.d.ts +7 -0
  169. package/dist/src/ui/components/MemoryUsageDisplay.js +27 -0
  170. package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -0
  171. package/dist/src/ui/components/ModelStatsDisplay.d.ts +7 -0
  172. package/dist/src/ui/components/ModelStatsDisplay.js +33 -0
  173. package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -0
  174. package/dist/src/ui/components/SessionSummaryDisplay.d.ts +11 -0
  175. package/dist/src/ui/components/SessionSummaryDisplay.js +4 -0
  176. package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -0
  177. package/dist/src/ui/components/ShellModeIndicator.d.ts +7 -0
  178. package/dist/src/ui/components/ShellModeIndicator.js +5 -0
  179. package/dist/src/ui/components/ShellModeIndicator.js.map +1 -0
  180. package/dist/src/ui/components/ShowMoreLines.d.ts +10 -0
  181. package/dist/src/ui/components/ShowMoreLines.js +24 -0
  182. package/dist/src/ui/components/ShowMoreLines.js.map +1 -0
  183. package/dist/src/ui/components/StatsDisplay.d.ts +12 -0
  184. package/dist/src/ui/components/StatsDisplay.js +42 -0
  185. package/dist/src/ui/components/StatsDisplay.js.map +1 -0
  186. package/dist/src/ui/components/SuggestionsDisplay.d.ts +21 -0
  187. package/dist/src/ui/components/SuggestionsDisplay.js +32 -0
  188. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -0
  189. package/dist/src/ui/components/ThemeDialog.d.ts +19 -0
  190. package/dist/src/ui/components/ThemeDialog.js +148 -0
  191. package/dist/src/ui/components/ThemeDialog.js.map +1 -0
  192. package/dist/src/ui/components/Tips.d.ts +12 -0
  193. package/dist/src/ui/components/Tips.js +8 -0
  194. package/dist/src/ui/components/Tips.js.map +1 -0
  195. package/dist/src/ui/components/ToolStatsDisplay.d.ts +7 -0
  196. package/dist/src/ui/components/ToolStatsDisplay.js +41 -0
  197. package/dist/src/ui/components/ToolStatsDisplay.js.map +1 -0
  198. package/dist/src/ui/components/UpdateNotification.d.ts +10 -0
  199. package/dist/src/ui/components/UpdateNotification.js +10 -0
  200. package/dist/src/ui/components/UpdateNotification.js.map +1 -0
  201. package/dist/src/ui/components/messages/CompressionMessage.d.ts +11 -0
  202. package/dist/src/ui/components/messages/CompressionMessage.js +16 -0
  203. package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -0
  204. package/dist/src/ui/components/messages/DiffRenderer.d.ts +16 -0
  205. package/dist/src/ui/components/messages/DiffRenderer.js +212 -0
  206. package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -0
  207. package/dist/src/ui/components/messages/ErrorMessage.d.ts +11 -0
  208. package/dist/src/ui/components/messages/ErrorMessage.js +9 -0
  209. package/dist/src/ui/components/messages/ErrorMessage.js.map +1 -0
  210. package/dist/src/ui/components/messages/GeminiMessage.d.ts +14 -0
  211. package/dist/src/ui/components/messages/GeminiMessage.js +10 -0
  212. package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -0
  213. package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +14 -0
  214. package/dist/src/ui/components/messages/GeminiMessageContent.js +15 -0
  215. package/dist/src/ui/components/messages/GeminiMessageContent.js.map +1 -0
  216. package/dist/src/ui/components/messages/InfoMessage.d.ts +11 -0
  217. package/dist/src/ui/components/messages/InfoMessage.js +9 -0
  218. package/dist/src/ui/components/messages/InfoMessage.js.map +1 -0
  219. package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +15 -0
  220. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +111 -0
  221. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -0
  222. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +18 -0
  223. package/dist/src/ui/components/messages/ToolGroupMessage.js +55 -0
  224. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -0
  225. package/dist/src/ui/components/messages/ToolMessage.d.ts +15 -0
  226. package/dist/src/ui/components/messages/ToolMessage.js +61 -0
  227. package/dist/src/ui/components/messages/ToolMessage.js.map +1 -0
  228. package/dist/src/ui/components/messages/UserMessage.d.ts +11 -0
  229. package/dist/src/ui/components/messages/UserMessage.js +9 -0
  230. package/dist/src/ui/components/messages/UserMessage.js.map +1 -0
  231. package/dist/src/ui/components/messages/UserShellMessage.d.ts +11 -0
  232. package/dist/src/ui/components/messages/UserShellMessage.js +9 -0
  233. package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -0
  234. package/dist/src/ui/components/shared/MaxSizedBox.d.ts +61 -0
  235. package/dist/src/ui/components/shared/MaxSizedBox.js +451 -0
  236. package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -0
  237. package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +46 -0
  238. package/dist/src/ui/components/shared/RadioButtonSelect.js +119 -0
  239. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -0
  240. package/dist/src/ui/components/shared/text-buffer.d.ts +184 -0
  241. package/dist/src/ui/components/shared/text-buffer.js +1010 -0
  242. package/dist/src/ui/components/shared/text-buffer.js.map +1 -0
  243. package/dist/src/ui/constants.d.ts +9 -0
  244. package/dist/src/ui/constants.js +13 -0
  245. package/dist/src/ui/constants.js.map +1 -0
  246. package/dist/src/ui/contexts/OverflowContext.d.ts +19 -0
  247. package/dist/src/ui/contexts/OverflowContext.js +43 -0
  248. package/dist/src/ui/contexts/OverflowContext.js.map +1 -0
  249. package/dist/src/ui/contexts/SessionContext.d.ts +36 -0
  250. package/dist/src/ui/contexts/SessionContext.js +59 -0
  251. package/dist/src/ui/contexts/SessionContext.js.map +1 -0
  252. package/dist/src/ui/contexts/StreamingContext.d.ts +9 -0
  253. package/dist/src/ui/contexts/StreamingContext.js +15 -0
  254. package/dist/src/ui/contexts/StreamingContext.js.map +1 -0
  255. package/dist/src/ui/editors/editorSettingsManager.d.ts +19 -0
  256. package/dist/src/ui/editors/editorSettingsManager.js +54 -0
  257. package/dist/src/ui/editors/editorSettingsManager.js.map +1 -0
  258. package/dist/src/ui/hooks/atCommandProcessor.d.ts +31 -0
  259. package/dist/src/ui/hooks/atCommandProcessor.js +347 -0
  260. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -0
  261. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +16 -0
  262. package/dist/src/ui/hooks/shellCommandProcessor.js +295 -0
  263. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -0
  264. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +20 -0
  265. package/dist/src/ui/hooks/slashCommandProcessor.js +294 -0
  266. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -0
  267. package/dist/src/ui/hooks/useAuthCommand.d.ts +14 -0
  268. package/dist/src/ui/hooks/useAuthCommand.js +65 -0
  269. package/dist/src/ui/hooks/useAuthCommand.js.map +1 -0
  270. package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +10 -0
  271. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +37 -0
  272. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -0
  273. package/dist/src/ui/hooks/useBracketedPaste.d.ts +12 -0
  274. package/dist/src/ui/hooks/useBracketedPaste.js +32 -0
  275. package/dist/src/ui/hooks/useBracketedPaste.js.map +1 -0
  276. package/dist/src/ui/hooks/useCompletion.d.ts +22 -0
  277. package/dist/src/ui/hooks/useCompletion.js +393 -0
  278. package/dist/src/ui/hooks/useCompletion.js.map +1 -0
  279. package/dist/src/ui/hooks/useConsoleMessages.d.ts +12 -0
  280. package/dist/src/ui/hooks/useConsoleMessages.js +60 -0
  281. package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -0
  282. package/dist/src/ui/hooks/useEditorSettings.d.ts +16 -0
  283. package/dist/src/ui/hooks/useEditorSettings.js +43 -0
  284. package/dist/src/ui/hooks/useEditorSettings.js.map +1 -0
  285. package/dist/src/ui/hooks/useFocus.d.ts +6 -0
  286. package/dist/src/ui/hooks/useFocus.js +41 -0
  287. package/dist/src/ui/hooks/useFocus.js.map +1 -0
  288. package/dist/src/ui/hooks/useGeminiStream.d.ts +23 -0
  289. package/dist/src/ui/hooks/useGeminiStream.js +613 -0
  290. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -0
  291. package/dist/src/ui/hooks/useGitBranchName.d.ts +6 -0
  292. package/dist/src/ui/hooks/useGitBranchName.js +61 -0
  293. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -0
  294. package/dist/src/ui/hooks/useHistoryManager.d.ts +22 -0
  295. package/dist/src/ui/hooks/useHistoryManager.js +72 -0
  296. package/dist/src/ui/hooks/useHistoryManager.js.map +1 -0
  297. package/dist/src/ui/hooks/useInputHistory.d.ts +19 -0
  298. package/dist/src/ui/hooks/useInputHistory.js +84 -0
  299. package/dist/src/ui/hooks/useInputHistory.js.map +1 -0
  300. package/dist/src/ui/hooks/useKeypress.d.ts +29 -0
  301. package/dist/src/ui/hooks/useKeypress.js +156 -0
  302. package/dist/src/ui/hooks/useKeypress.js.map +1 -0
  303. package/dist/src/ui/hooks/useLoadingIndicator.d.ts +10 -0
  304. package/dist/src/ui/hooks/useLoadingIndicator.js +44 -0
  305. package/dist/src/ui/hooks/useLoadingIndicator.js.map +1 -0
  306. package/dist/src/ui/hooks/useLogger.d.ts +10 -0
  307. package/dist/src/ui/hooks/useLogger.js +29 -0
  308. package/dist/src/ui/hooks/useLogger.js.map +1 -0
  309. package/dist/src/ui/hooks/usePhraseCycler.d.ts +14 -0
  310. package/dist/src/ui/hooks/usePhraseCycler.js +189 -0
  311. package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -0
  312. package/dist/src/ui/hooks/usePrivacySettings.d.ts +16 -0
  313. package/dist/src/ui/hooks/usePrivacySettings.js +115 -0
  314. package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -0
  315. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +33 -0
  316. package/dist/src/ui/hooks/useReactToolScheduler.js +186 -0
  317. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -0
  318. package/dist/src/ui/hooks/useRefreshMemoryCommand.d.ts +6 -0
  319. package/dist/src/ui/hooks/useRefreshMemoryCommand.js +7 -0
  320. package/dist/src/ui/hooks/useRefreshMemoryCommand.js.map +1 -0
  321. package/dist/src/ui/hooks/useShellHistory.d.ts +11 -0
  322. package/dist/src/ui/hooks/useShellHistory.js +89 -0
  323. package/dist/src/ui/hooks/useShellHistory.js.map +1 -0
  324. package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +9 -0
  325. package/dist/src/ui/hooks/useShowMemoryCommand.js +58 -0
  326. package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -0
  327. package/dist/src/ui/hooks/useStateAndRef.d.ts +7 -0
  328. package/dist/src/ui/hooks/useStateAndRef.js +26 -0
  329. package/dist/src/ui/hooks/useStateAndRef.js.map +1 -0
  330. package/dist/src/ui/hooks/useTerminalSize.d.ts +9 -0
  331. package/dist/src/ui/hooks/useTerminalSize.js +27 -0
  332. package/dist/src/ui/hooks/useTerminalSize.js.map +1 -0
  333. package/dist/src/ui/hooks/useThemeCommand.d.ts +15 -0
  334. package/dist/src/ui/hooks/useThemeCommand.js +79 -0
  335. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -0
  336. package/dist/src/ui/hooks/useTimer.d.ts +12 -0
  337. package/dist/src/ui/hooks/useTimer.js +58 -0
  338. package/dist/src/ui/hooks/useTimer.js.map +1 -0
  339. package/dist/src/ui/privacy/CloudFreePrivacyNotice.d.ts +12 -0
  340. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js +40 -0
  341. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js.map +1 -0
  342. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.d.ts +10 -0
  343. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js +17 -0
  344. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js.map +1 -0
  345. package/dist/src/ui/privacy/GeminiPrivacyNotice.d.ts +10 -0
  346. package/dist/src/ui/privacy/GeminiPrivacyNotice.js +17 -0
  347. package/dist/src/ui/privacy/GeminiPrivacyNotice.js.map +1 -0
  348. package/dist/src/ui/privacy/PrivacyNotice.d.ts +12 -0
  349. package/dist/src/ui/privacy/PrivacyNotice.js +25 -0
  350. package/dist/src/ui/privacy/PrivacyNotice.js.map +1 -0
  351. package/dist/src/ui/themes/ansi-light.d.ts +7 -0
  352. package/dist/src/ui/themes/ansi-light.js +139 -0
  353. package/dist/src/ui/themes/ansi-light.js.map +1 -0
  354. package/dist/src/ui/themes/ansi.d.ts +7 -0
  355. package/dist/src/ui/themes/ansi.js +149 -0
  356. package/dist/src/ui/themes/ansi.js.map +1 -0
  357. package/dist/src/ui/themes/atom-one-dark.d.ts +7 -0
  358. package/dist/src/ui/themes/atom-one-dark.js +136 -0
  359. package/dist/src/ui/themes/atom-one-dark.js.map +1 -0
  360. package/dist/src/ui/themes/ayu-light.d.ts +7 -0
  361. package/dist/src/ui/themes/ayu-light.js +128 -0
  362. package/dist/src/ui/themes/ayu-light.js.map +1 -0
  363. package/dist/src/ui/themes/ayu.d.ts +7 -0
  364. package/dist/src/ui/themes/ayu.js +102 -0
  365. package/dist/src/ui/themes/ayu.js.map +1 -0
  366. package/dist/src/ui/themes/color-utils.d.ts +21 -0
  367. package/dist/src/ui/themes/color-utils.js +221 -0
  368. package/dist/src/ui/themes/color-utils.js.map +1 -0
  369. package/dist/src/ui/themes/default-light.d.ts +7 -0
  370. package/dist/src/ui/themes/default-light.js +100 -0
  371. package/dist/src/ui/themes/default-light.js.map +1 -0
  372. package/dist/src/ui/themes/default.d.ts +7 -0
  373. package/dist/src/ui/themes/default.js +143 -0
  374. package/dist/src/ui/themes/default.js.map +1 -0
  375. package/dist/src/ui/themes/dracula.d.ts +7 -0
  376. package/dist/src/ui/themes/dracula.js +113 -0
  377. package/dist/src/ui/themes/dracula.js.map +1 -0
  378. package/dist/src/ui/themes/github-dark.d.ts +7 -0
  379. package/dist/src/ui/themes/github-dark.js +136 -0
  380. package/dist/src/ui/themes/github-dark.js.map +1 -0
  381. package/dist/src/ui/themes/github-light.d.ts +7 -0
  382. package/dist/src/ui/themes/github-light.js +138 -0
  383. package/dist/src/ui/themes/github-light.js.map +1 -0
  384. package/dist/src/ui/themes/googlecode.d.ts +7 -0
  385. package/dist/src/ui/themes/googlecode.js +135 -0
  386. package/dist/src/ui/themes/googlecode.js.map +1 -0
  387. package/dist/src/ui/themes/no-color.d.ts +7 -0
  388. package/dist/src/ui/themes/no-color.js +84 -0
  389. package/dist/src/ui/themes/no-color.js.map +1 -0
  390. package/dist/src/ui/themes/shades-of-purple.d.ts +11 -0
  391. package/dist/src/ui/themes/shades-of-purple.js +302 -0
  392. package/dist/src/ui/themes/shades-of-purple.js.map +1 -0
  393. package/dist/src/ui/themes/theme-manager.d.ts +58 -0
  394. package/dist/src/ui/themes/theme-manager.js +179 -0
  395. package/dist/src/ui/themes/theme-manager.js.map +1 -0
  396. package/dist/src/ui/themes/theme.d.ts +84 -0
  397. package/dist/src/ui/themes/theme.js +341 -0
  398. package/dist/src/ui/themes/theme.js.map +1 -0
  399. package/dist/src/ui/themes/xcode.d.ts +7 -0
  400. package/dist/src/ui/themes/xcode.js +143 -0
  401. package/dist/src/ui/themes/xcode.js.map +1 -0
  402. package/dist/src/ui/types.d.ts +180 -0
  403. package/dist/src/ui/types.js +43 -0
  404. package/dist/src/ui/types.js.map +1 -0
  405. package/dist/src/ui/utils/CodeColorizer.d.ts +15 -0
  406. package/dist/src/ui/utils/CodeColorizer.js +97 -0
  407. package/dist/src/ui/utils/CodeColorizer.js.map +1 -0
  408. package/dist/src/ui/utils/ConsolePatcher.d.ts +23 -0
  409. package/dist/src/ui/utils/ConsolePatcher.js +42 -0
  410. package/dist/src/ui/utils/ConsolePatcher.js.map +1 -0
  411. package/dist/src/ui/utils/InlineMarkdownRenderer.d.ts +16 -0
  412. package/dist/src/ui/utils/InlineMarkdownRenderer.js +104 -0
  413. package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -0
  414. package/dist/src/ui/utils/MarkdownDisplay.d.ts +14 -0
  415. package/dist/src/ui/utils/MarkdownDisplay.js +205 -0
  416. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -0
  417. package/dist/src/ui/utils/TableRenderer.d.ts +17 -0
  418. package/dist/src/ui/utils/TableRenderer.js +84 -0
  419. package/dist/src/ui/utils/TableRenderer.js.map +1 -0
  420. package/dist/src/ui/utils/clipboardUtils.d.ts +22 -0
  421. package/dist/src/ui/utils/clipboardUtils.js +127 -0
  422. package/dist/src/ui/utils/clipboardUtils.js.map +1 -0
  423. package/dist/src/ui/utils/commandUtils.d.ts +23 -0
  424. package/dist/src/ui/utils/commandUtils.js +72 -0
  425. package/dist/src/ui/utils/commandUtils.js.map +1 -0
  426. package/dist/src/ui/utils/computeStats.d.ts +10 -0
  427. package/dist/src/ui/utils/computeStats.js +55 -0
  428. package/dist/src/ui/utils/computeStats.js.map +1 -0
  429. package/dist/src/ui/utils/displayUtils.d.ts +17 -0
  430. package/dist/src/ui/utils/displayUtils.js +24 -0
  431. package/dist/src/ui/utils/displayUtils.js.map +1 -0
  432. package/dist/src/ui/utils/errorParsing.d.ts +7 -0
  433. package/dist/src/ui/utils/errorParsing.js +90 -0
  434. package/dist/src/ui/utils/errorParsing.js.map +1 -0
  435. package/dist/src/ui/utils/formatters.d.ts +13 -0
  436. package/dist/src/ui/utils/formatters.js +56 -0
  437. package/dist/src/ui/utils/formatters.js.map +1 -0
  438. package/dist/src/ui/utils/markdownUtilities.d.ts +6 -0
  439. package/dist/src/ui/utils/markdownUtilities.js +110 -0
  440. package/dist/src/ui/utils/markdownUtilities.js.map +1 -0
  441. package/dist/src/ui/utils/textUtils.d.ts +22 -0
  442. package/dist/src/ui/utils/textUtils.js +58 -0
  443. package/dist/src/ui/utils/textUtils.js.map +1 -0
  444. package/dist/src/ui/utils/updateCheck.d.ts +6 -0
  445. package/dist/src/ui/utils/updateCheck.js +40 -0
  446. package/dist/src/ui/utils/updateCheck.js.map +1 -0
  447. package/dist/src/utils/cleanup.d.ts +8 -0
  448. package/dist/src/utils/cleanup.js +34 -0
  449. package/dist/src/utils/cleanup.js.map +1 -0
  450. package/dist/src/utils/package.d.ts +12 -0
  451. package/dist/src/utils/package.js +24 -0
  452. package/dist/src/utils/package.js.map +1 -0
  453. package/dist/src/utils/readStdin.d.ts +6 -0
  454. package/dist/src/utils/readStdin.js +34 -0
  455. package/dist/src/utils/readStdin.js.map +1 -0
  456. package/dist/src/utils/sandbox-macos-permissive-closed.sb +26 -0
  457. package/dist/src/utils/sandbox-macos-permissive-open.sb +19 -0
  458. package/dist/src/utils/sandbox-macos-permissive-proxied.sb +31 -0
  459. package/dist/src/utils/sandbox-macos-restrictive-closed.sb +87 -0
  460. package/dist/src/utils/sandbox-macos-restrictive-open.sb +90 -0
  461. package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +92 -0
  462. package/dist/src/utils/sandbox.d.ts +7 -0
  463. package/dist/src/utils/sandbox.js +680 -0
  464. package/dist/src/utils/sandbox.js.map +1 -0
  465. package/dist/src/utils/startupWarnings.d.ts +6 -0
  466. package/dist/src/utils/startupWarnings.js +40 -0
  467. package/dist/src/utils/startupWarnings.js.map +1 -0
  468. package/dist/src/utils/userStartupWarnings.d.ts +6 -0
  469. package/dist/src/utils/userStartupWarnings.js +54 -0
  470. package/dist/src/utils/userStartupWarnings.js.map +1 -0
  471. package/dist/src/utils/version.d.ts +6 -0
  472. package/dist/src/utils/version.js +11 -0
  473. package/dist/src/utils/version.js.map +1 -0
  474. package/dist/tsconfig.tsbuildinfo +1 -0
  475. package/package.json +79 -0
@@ -0,0 +1,295 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { spawn } from 'child_process';
7
+ import { TextDecoder } from 'util';
8
+ import { ToolCallStatus, } from '../types.js';
9
+ import { useCallback } from 'react';
10
+ import { getCachedEncodingForBuffer, } from '@google/gemini-cli-core';
11
+ import { formatMemoryUsage } from '../utils/formatters.js';
12
+ import { isBinary } from '../utils/textUtils.js';
13
+ import { SHELL_COMMAND_NAME } from '../constants.js';
14
+ import crypto from 'crypto';
15
+ import path from 'path';
16
+ import os from 'os';
17
+ import fs from 'fs';
18
+ import stripAnsi from 'strip-ansi';
19
+ const OUTPUT_UPDATE_INTERVAL_MS = 1000;
20
+ const MAX_OUTPUT_LENGTH = 10000;
21
+ /**
22
+ * Executes a shell command using `spawn`, capturing all output and lifecycle events.
23
+ * This is the single, unified implementation for shell execution.
24
+ *
25
+ * @param commandToExecute The exact command string to run.
26
+ * @param cwd The working directory to execute the command in.
27
+ * @param abortSignal An AbortSignal to terminate the process.
28
+ * @param onOutputChunk A callback for streaming real-time output.
29
+ * @param onDebugMessage A callback for logging debug information.
30
+ * @returns A promise that resolves with the complete execution result.
31
+ */
32
+ function executeShellCommand(commandToExecute, cwd, abortSignal, onOutputChunk, onDebugMessage) {
33
+ return new Promise((resolve) => {
34
+ const isWindows = os.platform() === 'win32';
35
+ const shell = isWindows ? 'cmd.exe' : 'bash';
36
+ const shellArgs = isWindows
37
+ ? ['/c', commandToExecute]
38
+ : ['-c', commandToExecute];
39
+ const child = spawn(shell, shellArgs, {
40
+ cwd,
41
+ stdio: ['ignore', 'pipe', 'pipe'],
42
+ detached: !isWindows, // Use process groups on non-Windows for robust killing
43
+ });
44
+ // Use decoders to handle multi-byte characters safely (for streaming output).
45
+ let stdoutDecoder = null;
46
+ let stderrDecoder = null;
47
+ let stdout = '';
48
+ let stderr = '';
49
+ const outputChunks = [];
50
+ let error = null;
51
+ let exited = false;
52
+ let streamToUi = true;
53
+ const MAX_SNIFF_SIZE = 4096;
54
+ let sniffedBytes = 0;
55
+ const handleOutput = (data, stream) => {
56
+ if (!stdoutDecoder || !stderrDecoder) {
57
+ const encoding = getCachedEncodingForBuffer(data);
58
+ stdoutDecoder = new TextDecoder(encoding);
59
+ stderrDecoder = new TextDecoder(encoding);
60
+ }
61
+ outputChunks.push(data);
62
+ if (streamToUi && sniffedBytes < MAX_SNIFF_SIZE) {
63
+ // Use a limited-size buffer for the check to avoid performance issues.
64
+ const sniffBuffer = Buffer.concat(outputChunks.slice(0, 20));
65
+ sniffedBytes = sniffBuffer.length;
66
+ if (isBinary(sniffBuffer)) {
67
+ streamToUi = false;
68
+ // Overwrite any garbled text that may have streamed with a clear message.
69
+ onOutputChunk('[Binary output detected. Halting stream...]');
70
+ }
71
+ }
72
+ const decodedChunk = stream === 'stdout'
73
+ ? stdoutDecoder.decode(data, { stream: true })
74
+ : stderrDecoder.decode(data, { stream: true });
75
+ if (stream === 'stdout') {
76
+ stdout += stripAnsi(decodedChunk);
77
+ }
78
+ else {
79
+ stderr += stripAnsi(decodedChunk);
80
+ }
81
+ if (!exited && streamToUi) {
82
+ // Send only the new chunk to avoid re-rendering the whole output.
83
+ const combinedOutput = stdout + (stderr ? `\n${stderr}` : '');
84
+ onOutputChunk(combinedOutput);
85
+ }
86
+ else if (!exited && !streamToUi) {
87
+ // Send progress updates for the binary stream
88
+ const totalBytes = outputChunks.reduce((sum, chunk) => sum + chunk.length, 0);
89
+ onOutputChunk(`[Receiving binary output... ${formatMemoryUsage(totalBytes)} received]`);
90
+ }
91
+ };
92
+ child.stdout.on('data', (data) => handleOutput(data, 'stdout'));
93
+ child.stderr.on('data', (data) => handleOutput(data, 'stderr'));
94
+ child.on('error', (err) => {
95
+ error = err;
96
+ });
97
+ const abortHandler = async () => {
98
+ if (child.pid && !exited) {
99
+ onDebugMessage(`Aborting shell command (PID: ${child.pid})`);
100
+ if (isWindows) {
101
+ spawn('taskkill', ['/pid', child.pid.toString(), '/f', '/t']);
102
+ }
103
+ else {
104
+ try {
105
+ // Kill the entire process group (negative PID).
106
+ // SIGTERM first, then SIGKILL if it doesn't die.
107
+ process.kill(-child.pid, 'SIGTERM');
108
+ await new Promise((res) => setTimeout(res, 200));
109
+ if (!exited) {
110
+ process.kill(-child.pid, 'SIGKILL');
111
+ }
112
+ }
113
+ catch (_e) {
114
+ // Fall back to killing just the main process if group kill fails.
115
+ if (!exited)
116
+ child.kill('SIGKILL');
117
+ }
118
+ }
119
+ }
120
+ };
121
+ abortSignal.addEventListener('abort', abortHandler, { once: true });
122
+ child.on('exit', (code, signal) => {
123
+ exited = true;
124
+ abortSignal.removeEventListener('abort', abortHandler);
125
+ // Handle any final bytes lingering in the decoders
126
+ if (stdoutDecoder) {
127
+ stdout += stdoutDecoder.decode();
128
+ }
129
+ if (stderrDecoder) {
130
+ stderr += stderrDecoder.decode();
131
+ }
132
+ const finalBuffer = Buffer.concat(outputChunks);
133
+ resolve({
134
+ rawOutput: finalBuffer,
135
+ output: stdout + (stderr ? `\n${stderr}` : ''),
136
+ exitCode: code,
137
+ signal,
138
+ error,
139
+ aborted: abortSignal.aborted,
140
+ });
141
+ });
142
+ });
143
+ }
144
+ function addShellCommandToGeminiHistory(geminiClient, rawQuery, resultText) {
145
+ const modelContent = resultText.length > MAX_OUTPUT_LENGTH
146
+ ? resultText.substring(0, MAX_OUTPUT_LENGTH) + '\n... (truncated)'
147
+ : resultText;
148
+ geminiClient.addHistory({
149
+ role: 'user',
150
+ parts: [
151
+ {
152
+ text: `I ran the following shell command:
153
+ \`\`\`sh
154
+ ${rawQuery}
155
+ \`\`\`
156
+
157
+ This produced the following result:
158
+ \`\`\`
159
+ ${modelContent}
160
+ \`\`\``,
161
+ },
162
+ ],
163
+ });
164
+ }
165
+ /**
166
+ * Hook to process shell commands.
167
+ * Orchestrates command execution and updates history and agent context.
168
+ */
169
+ export const useShellCommandProcessor = (addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config, geminiClient) => {
170
+ const handleShellCommand = useCallback((rawQuery, abortSignal) => {
171
+ if (typeof rawQuery !== 'string' || rawQuery.trim() === '') {
172
+ return false;
173
+ }
174
+ const userMessageTimestamp = Date.now();
175
+ const callId = `shell-${userMessageTimestamp}`;
176
+ addItemToHistory({ type: 'user_shell', text: rawQuery }, userMessageTimestamp);
177
+ const isWindows = os.platform() === 'win32';
178
+ const targetDir = config.getTargetDir();
179
+ let commandToExecute = rawQuery;
180
+ let pwdFilePath;
181
+ // On non-windows, wrap the command to capture the final working directory.
182
+ if (!isWindows) {
183
+ let command = rawQuery.trim();
184
+ const pwdFileName = `shell_pwd_${crypto.randomBytes(6).toString('hex')}.tmp`;
185
+ pwdFilePath = path.join(os.tmpdir(), pwdFileName);
186
+ // Ensure command ends with a separator before adding our own.
187
+ if (!command.endsWith(';') && !command.endsWith('&')) {
188
+ command += ';';
189
+ }
190
+ commandToExecute = `{ ${command} }; __code=$?; pwd > "${pwdFilePath}"; exit $__code`;
191
+ }
192
+ const execPromise = new Promise((resolve) => {
193
+ let lastUpdateTime = 0;
194
+ const initialToolDisplay = {
195
+ callId,
196
+ name: SHELL_COMMAND_NAME,
197
+ description: rawQuery,
198
+ status: ToolCallStatus.Executing,
199
+ resultDisplay: '',
200
+ confirmationDetails: undefined,
201
+ };
202
+ setPendingHistoryItem({
203
+ type: 'tool_group',
204
+ tools: [initialToolDisplay],
205
+ });
206
+ onDebugMessage(`Executing in ${targetDir}: ${commandToExecute}`);
207
+ executeShellCommand(commandToExecute, targetDir, abortSignal, (streamedOutput) => {
208
+ // Throttle pending UI updates to avoid excessive re-renders.
209
+ if (Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MS) {
210
+ setPendingHistoryItem({
211
+ type: 'tool_group',
212
+ tools: [
213
+ { ...initialToolDisplay, resultDisplay: streamedOutput },
214
+ ],
215
+ });
216
+ lastUpdateTime = Date.now();
217
+ }
218
+ }, onDebugMessage)
219
+ .then((result) => {
220
+ setPendingHistoryItem(null);
221
+ let mainContent;
222
+ if (isBinary(result.rawOutput)) {
223
+ mainContent =
224
+ '[Command produced binary output, which is not shown.]';
225
+ }
226
+ else {
227
+ mainContent =
228
+ result.output.trim() || '(Command produced no output)';
229
+ }
230
+ let finalOutput = mainContent;
231
+ let finalStatus = ToolCallStatus.Success;
232
+ if (result.error) {
233
+ finalStatus = ToolCallStatus.Error;
234
+ finalOutput = `${result.error.message}\n${finalOutput}`;
235
+ }
236
+ else if (result.aborted) {
237
+ finalStatus = ToolCallStatus.Canceled;
238
+ finalOutput = `Command was cancelled.\n${finalOutput}`;
239
+ }
240
+ else if (result.signal) {
241
+ finalStatus = ToolCallStatus.Error;
242
+ finalOutput = `Command terminated by signal: ${result.signal}.\n${finalOutput}`;
243
+ }
244
+ else if (result.exitCode !== 0) {
245
+ finalStatus = ToolCallStatus.Error;
246
+ finalOutput = `Command exited with code ${result.exitCode}.\n${finalOutput}`;
247
+ }
248
+ if (pwdFilePath && fs.existsSync(pwdFilePath)) {
249
+ const finalPwd = fs.readFileSync(pwdFilePath, 'utf8').trim();
250
+ if (finalPwd && finalPwd !== targetDir) {
251
+ const warning = `WARNING: shell mode is stateless; the directory change to '${finalPwd}' will not persist.`;
252
+ finalOutput = `${warning}\n\n${finalOutput}`;
253
+ }
254
+ }
255
+ const finalToolDisplay = {
256
+ ...initialToolDisplay,
257
+ status: finalStatus,
258
+ resultDisplay: finalOutput,
259
+ };
260
+ // Add the complete, contextual result to the local UI history.
261
+ addItemToHistory({
262
+ type: 'tool_group',
263
+ tools: [finalToolDisplay],
264
+ }, userMessageTimestamp);
265
+ // Add the same complete, contextual result to the LLM's history.
266
+ addShellCommandToGeminiHistory(geminiClient, rawQuery, finalOutput);
267
+ })
268
+ .catch((err) => {
269
+ setPendingHistoryItem(null);
270
+ const errorMessage = err instanceof Error ? err.message : String(err);
271
+ addItemToHistory({
272
+ type: 'error',
273
+ text: `An unexpected error occurred: ${errorMessage}`,
274
+ }, userMessageTimestamp);
275
+ })
276
+ .finally(() => {
277
+ if (pwdFilePath && fs.existsSync(pwdFilePath)) {
278
+ fs.unlinkSync(pwdFilePath);
279
+ }
280
+ resolve();
281
+ });
282
+ });
283
+ onExec(execPromise);
284
+ return true; // Command was initiated
285
+ }, [
286
+ config,
287
+ onDebugMessage,
288
+ addItemToHistory,
289
+ setPendingHistoryItem,
290
+ onExec,
291
+ geminiClient,
292
+ ]);
293
+ return { handleShellCommand };
294
+ };
295
+ //# sourceMappingURL=shellCommandProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shellCommandProcessor.js","sourceRoot":"","sources":["../../../../src/ui/hooks/shellCommandProcessor.ts"],"names":[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CACrB,CAAC;gBAEF,iEAAiE;gBACjE,8BAA8B,CAAC,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;YACtE,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,qBAAqB,CAAC,IAAI,CAAC,CAAC;gBAC5B,MAAM,YAAY,GAChB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACnD,gBAAgB,CACd;oBACE,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,iCAAiC,YAAY,EAAE;iBACtD,EACD,oBAAoB,CACrB,CAAC;YACJ,CAAC,CAAC;iBACD,OAAO,CAAC,GAAG,EAAE;gBACZ,IAAI,WAAW,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;oBAC9C,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAC7B,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,WAAW,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC,CAAC,wBAAwB;IACvC,CAAC,EACD;QACE,MAAM;QACN,cAAc;QACd,gBAAgB;QAChB,qBAAqB;QACrB,MAAM;QACN,YAAY;KACb,CACF,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAChC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { type PartListUnion } from '@google/genai';
7
+ import { UseHistoryManagerReturn } from './useHistoryManager.js';
8
+ import { Config } from '@google/gemini-cli-core';
9
+ import { HistoryItemWithoutId, HistoryItem, SlashCommandProcessorResult } from '../types.js';
10
+ import { LoadedSettings } from '../../config/settings.js';
11
+ import { type CommandContext, type SlashCommand } from '../commands/types.js';
12
+ /**
13
+ * Hook to define and process slash commands (e.g., /help, /clear).
14
+ */
15
+ export declare const useSlashCommandProcessor: (config: Config | null, settings: LoadedSettings, addItem: UseHistoryManagerReturn["addItem"], clearItems: UseHistoryManagerReturn["clearItems"], loadHistory: UseHistoryManagerReturn["loadHistory"], refreshStatic: () => void, setShowHelp: React.Dispatch<React.SetStateAction<boolean>>, onDebugMessage: (message: string) => void, openThemeDialog: () => void, openAuthDialog: () => void, openEditorDialog: () => void, toggleCorgiMode: () => void, setQuittingMessages: (message: HistoryItem[]) => void, openPrivacyNotice: () => void) => {
16
+ handleSlashCommand: (rawQuery: PartListUnion) => Promise<SlashCommandProcessorResult | false>;
17
+ slashCommands: readonly SlashCommand[];
18
+ pendingHistoryItems: HistoryItemWithoutId[];
19
+ commandContext: CommandContext;
20
+ };
@@ -0,0 +1,294 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { useCallback, useMemo, useEffect, useState } from 'react';
7
+ import process from 'node:process';
8
+ import { useStateAndRef } from './useStateAndRef.js';
9
+ import { GitService, Logger } from '@google/gemini-cli-core';
10
+ import { useSessionStats } from '../contexts/SessionContext.js';
11
+ import { MessageType, } from '../types.js';
12
+ import { CommandService } from '../../services/CommandService.js';
13
+ import { BuiltinCommandLoader } from '../../services/BuiltinCommandLoader.js';
14
+ import { FileCommandLoader } from '../../services/FileCommandLoader.js';
15
+ /**
16
+ * Hook to define and process slash commands (e.g., /help, /clear).
17
+ */
18
+ export const useSlashCommandProcessor = (config, settings, addItem, clearItems, loadHistory, refreshStatic, setShowHelp, onDebugMessage, openThemeDialog, openAuthDialog, openEditorDialog, toggleCorgiMode, setQuittingMessages, openPrivacyNotice) => {
19
+ const session = useSessionStats();
20
+ const [commands, setCommands] = useState([]);
21
+ const gitService = useMemo(() => {
22
+ if (!config?.getProjectRoot()) {
23
+ return;
24
+ }
25
+ return new GitService(config.getProjectRoot());
26
+ }, [config]);
27
+ const logger = useMemo(() => {
28
+ const l = new Logger(config?.getSessionId() || '');
29
+ // The logger's initialize is async, but we can create the instance
30
+ // synchronously. Commands that use it will await its initialization.
31
+ return l;
32
+ }, [config]);
33
+ const [pendingCompressionItemRef, setPendingCompressionItem] = useStateAndRef(null);
34
+ const pendingHistoryItems = useMemo(() => {
35
+ const items = [];
36
+ if (pendingCompressionItemRef.current != null) {
37
+ items.push(pendingCompressionItemRef.current);
38
+ }
39
+ return items;
40
+ }, [pendingCompressionItemRef]);
41
+ const addMessage = useCallback((message) => {
42
+ // Convert Message to HistoryItemWithoutId
43
+ let historyItemContent;
44
+ if (message.type === MessageType.ABOUT) {
45
+ historyItemContent = {
46
+ type: 'about',
47
+ cliVersion: message.cliVersion,
48
+ osVersion: message.osVersion,
49
+ sandboxEnv: message.sandboxEnv,
50
+ modelVersion: message.modelVersion,
51
+ selectedAuthType: message.selectedAuthType,
52
+ gcpProject: message.gcpProject,
53
+ };
54
+ }
55
+ else if (message.type === MessageType.STATS) {
56
+ historyItemContent = {
57
+ type: 'stats',
58
+ duration: message.duration,
59
+ };
60
+ }
61
+ else if (message.type === MessageType.MODEL_STATS) {
62
+ historyItemContent = {
63
+ type: 'model_stats',
64
+ };
65
+ }
66
+ else if (message.type === MessageType.TOOL_STATS) {
67
+ historyItemContent = {
68
+ type: 'tool_stats',
69
+ };
70
+ }
71
+ else if (message.type === MessageType.QUIT) {
72
+ historyItemContent = {
73
+ type: 'quit',
74
+ duration: message.duration,
75
+ };
76
+ }
77
+ else if (message.type === MessageType.COMPRESSION) {
78
+ historyItemContent = {
79
+ type: 'compression',
80
+ compression: message.compression,
81
+ };
82
+ }
83
+ else {
84
+ historyItemContent = {
85
+ type: message.type,
86
+ text: message.content,
87
+ };
88
+ }
89
+ addItem(historyItemContent, message.timestamp.getTime());
90
+ }, [addItem]);
91
+ const commandContext = useMemo(() => ({
92
+ services: {
93
+ config,
94
+ settings,
95
+ git: gitService,
96
+ logger,
97
+ },
98
+ ui: {
99
+ addItem,
100
+ clear: () => {
101
+ clearItems();
102
+ console.clear();
103
+ refreshStatic();
104
+ },
105
+ loadHistory,
106
+ setDebugMessage: onDebugMessage,
107
+ pendingItem: pendingCompressionItemRef.current,
108
+ setPendingItem: setPendingCompressionItem,
109
+ toggleCorgiMode,
110
+ },
111
+ session: {
112
+ stats: session.stats,
113
+ },
114
+ }), [
115
+ config,
116
+ settings,
117
+ gitService,
118
+ logger,
119
+ loadHistory,
120
+ addItem,
121
+ clearItems,
122
+ refreshStatic,
123
+ session.stats,
124
+ onDebugMessage,
125
+ pendingCompressionItemRef,
126
+ setPendingCompressionItem,
127
+ toggleCorgiMode,
128
+ ]);
129
+ useEffect(() => {
130
+ const controller = new AbortController();
131
+ const load = async () => {
132
+ const loaders = [
133
+ new BuiltinCommandLoader(config),
134
+ new FileCommandLoader(config),
135
+ ];
136
+ const commandService = await CommandService.create(loaders, controller.signal);
137
+ setCommands(commandService.getCommands());
138
+ };
139
+ load();
140
+ return () => {
141
+ controller.abort();
142
+ };
143
+ }, [config]);
144
+ const handleSlashCommand = useCallback(async (rawQuery) => {
145
+ if (typeof rawQuery !== 'string') {
146
+ return false;
147
+ }
148
+ const trimmed = rawQuery.trim();
149
+ if (!trimmed.startsWith('/') && !trimmed.startsWith('?')) {
150
+ return false;
151
+ }
152
+ const userMessageTimestamp = Date.now();
153
+ addItem({ type: MessageType.USER, text: trimmed }, userMessageTimestamp);
154
+ const parts = trimmed.substring(1).trim().split(/\s+/);
155
+ const commandPath = parts.filter((p) => p); // The parts of the command, e.g., ['memory', 'add']
156
+ let currentCommands = commands;
157
+ let commandToExecute;
158
+ let pathIndex = 0;
159
+ for (const part of commandPath) {
160
+ // TODO: For better performance and architectural clarity, this two-pass
161
+ // search could be replaced. A more optimal approach would be to
162
+ // pre-compute a single lookup map in `CommandService.ts` that resolves
163
+ // all name and alias conflicts during the initial loading phase. The
164
+ // processor would then perform a single, fast lookup on that map.
165
+ // First pass: check for an exact match on the primary command name.
166
+ let foundCommand = currentCommands.find((cmd) => cmd.name === part);
167
+ // Second pass: if no primary name matches, check for an alias.
168
+ if (!foundCommand) {
169
+ foundCommand = currentCommands.find((cmd) => cmd.altNames?.includes(part));
170
+ }
171
+ if (foundCommand) {
172
+ commandToExecute = foundCommand;
173
+ pathIndex++;
174
+ if (foundCommand.subCommands) {
175
+ currentCommands = foundCommand.subCommands;
176
+ }
177
+ else {
178
+ break;
179
+ }
180
+ }
181
+ else {
182
+ break;
183
+ }
184
+ }
185
+ if (commandToExecute) {
186
+ const args = parts.slice(pathIndex).join(' ');
187
+ if (commandToExecute.action) {
188
+ const result = await commandToExecute.action(commandContext, args);
189
+ if (result) {
190
+ switch (result.type) {
191
+ case 'tool':
192
+ return {
193
+ type: 'schedule_tool',
194
+ toolName: result.toolName,
195
+ toolArgs: result.toolArgs,
196
+ };
197
+ case 'message':
198
+ addItem({
199
+ type: result.messageType === 'error'
200
+ ? MessageType.ERROR
201
+ : MessageType.INFO,
202
+ text: result.content,
203
+ }, Date.now());
204
+ return { type: 'handled' };
205
+ case 'dialog':
206
+ switch (result.dialog) {
207
+ case 'help':
208
+ setShowHelp(true);
209
+ return { type: 'handled' };
210
+ case 'auth':
211
+ openAuthDialog();
212
+ return { type: 'handled' };
213
+ case 'theme':
214
+ openThemeDialog();
215
+ return { type: 'handled' };
216
+ case 'editor':
217
+ openEditorDialog();
218
+ return { type: 'handled' };
219
+ case 'privacy':
220
+ openPrivacyNotice();
221
+ return { type: 'handled' };
222
+ default: {
223
+ const unhandled = result.dialog;
224
+ throw new Error(`Unhandled slash command result: ${unhandled}`);
225
+ }
226
+ }
227
+ case 'load_history': {
228
+ await config
229
+ ?.getGeminiClient()
230
+ ?.setHistory(result.clientHistory);
231
+ commandContext.ui.clear();
232
+ result.history.forEach((item, index) => {
233
+ commandContext.ui.addItem(item, index);
234
+ });
235
+ return { type: 'handled' };
236
+ }
237
+ case 'quit':
238
+ setQuittingMessages(result.messages);
239
+ setTimeout(() => {
240
+ process.exit(0);
241
+ }, 100);
242
+ return { type: 'handled' };
243
+ case 'submit_prompt':
244
+ return {
245
+ type: 'submit_prompt',
246
+ content: result.content,
247
+ };
248
+ default: {
249
+ const unhandled = result;
250
+ throw new Error(`Unhandled slash command result: ${unhandled}`);
251
+ }
252
+ }
253
+ }
254
+ return { type: 'handled' };
255
+ }
256
+ else if (commandToExecute.subCommands) {
257
+ const helpText = `Command '/${commandToExecute.name}' requires a subcommand. Available:\n${commandToExecute.subCommands
258
+ .map((sc) => ` - ${sc.name}: ${sc.description || ''}`)
259
+ .join('\n')}`;
260
+ addMessage({
261
+ type: MessageType.INFO,
262
+ content: helpText,
263
+ timestamp: new Date(),
264
+ });
265
+ return { type: 'handled' };
266
+ }
267
+ }
268
+ addMessage({
269
+ type: MessageType.ERROR,
270
+ content: `Unknown command: ${trimmed}`,
271
+ timestamp: new Date(),
272
+ });
273
+ return { type: 'handled' };
274
+ }, [
275
+ config,
276
+ addItem,
277
+ setShowHelp,
278
+ openAuthDialog,
279
+ commands,
280
+ commandContext,
281
+ addMessage,
282
+ openThemeDialog,
283
+ openPrivacyNotice,
284
+ openEditorDialog,
285
+ setQuittingMessages,
286
+ ]);
287
+ return {
288
+ handleSlashCommand,
289
+ slashCommands: commands,
290
+ pendingHistoryItems,
291
+ commandContext,
292
+ };
293
+ };
294
+ //# sourceMappingURL=slashCommandProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slashCommandProcessor.js","sourceRoot":"","sources":["../../../../src/ui/hooks/slashCommandProcessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAU,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CA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I,CAAC,EAAE,CAAC;gBAChB,UAAU,CAAC;oBACT,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,OAAO,EAAE,QAAQ;oBACjB,SAAS,EAAE,IAAI,IAAI,EAAE;iBACtB,CAAC,CAAC;gBACH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,UAAU,CAAC;YACT,IAAI,EAAE,WAAW,CAAC,KAAK;YACvB,OAAO,EAAE,oBAAoB,OAAO,EAAE;YACtC,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC7B,CAAC,EACD;QACE,MAAM;QACN,OAAO;QACP,WAAW;QACX,cAAc;QACd,QAAQ;QACR,cAAc;QACd,UAAU;QACV,eAAe;QACf,iBAAiB;QACjB,gBAAgB;QAChB,mBAAmB;KACpB,CACF,CAAC;IAEF,OAAO;QACL,kBAAkB;QAClB,aAAa,EAAE,QAAQ;QACvB,mBAAmB;QACnB,cAAc;KACf,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { LoadedSettings, SettingScope } from '../../config/settings.js';
7
+ import { AuthType, Config } from '@google/gemini-cli-core';
8
+ export declare const useAuthCommand: (settings: LoadedSettings, setAuthError: (error: string | null) => void, config: Config) => {
9
+ isAuthDialogOpen: boolean;
10
+ openAuthDialog: () => void;
11
+ handleAuthSelect: (authType: AuthType | undefined, scope: SettingScope) => Promise<void>;
12
+ isAuthenticating: boolean;
13
+ cancelAuthentication: () => void;
14
+ };