@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,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * @license
4
+ * Copyright 2025 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ import React from 'react';
8
+ import { Box, Text } from 'ink';
9
+ import { ToolCallStatus } from '../../types.js';
10
+ import { DiffRenderer } from './DiffRenderer.js';
11
+ import { Colors } from '../../colors.js';
12
+ import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js';
13
+ import { GeminiRespondingSpinner } from '../GeminiRespondingSpinner.js';
14
+ import { MaxSizedBox } from '../shared/MaxSizedBox.js';
15
+ const STATIC_HEIGHT = 1;
16
+ const RESERVED_LINE_COUNT = 5; // for tool name, status, padding etc.
17
+ const STATUS_INDICATOR_WIDTH = 3;
18
+ const MIN_LINES_SHOWN = 2; // show at least this many lines
19
+ // Large threshold to ensure we don't cause performance issues for very large
20
+ // outputs that will get truncated further MaxSizedBox anyway.
21
+ const MAXIMUM_RESULT_DISPLAY_CHARACTERS = 1000000;
22
+ export const ToolMessage = ({ name, description, resultDisplay, status, availableTerminalHeight, terminalWidth, emphasis = 'medium', renderOutputAsMarkdown = true, }) => {
23
+ const availableHeight = availableTerminalHeight
24
+ ? Math.max(availableTerminalHeight - STATIC_HEIGHT - RESERVED_LINE_COUNT, MIN_LINES_SHOWN + 1)
25
+ : undefined;
26
+ // Long tool call response in MarkdownDisplay doesn't respect availableTerminalHeight properly,
27
+ // we're forcing it to not render as markdown when the response is too long, it will fallback
28
+ // to render as plain text, which is contained within the terminal using MaxSizedBox
29
+ if (availableHeight) {
30
+ renderOutputAsMarkdown = false;
31
+ }
32
+ const childWidth = terminalWidth - 3; // account for padding.
33
+ if (typeof resultDisplay === 'string') {
34
+ if (resultDisplay.length > MAXIMUM_RESULT_DISPLAY_CHARACTERS) {
35
+ // Truncate the result display to fit within the available width.
36
+ resultDisplay =
37
+ '...' + resultDisplay.slice(-MAXIMUM_RESULT_DISPLAY_CHARACTERS);
38
+ }
39
+ }
40
+ return (_jsxs(Box, { paddingX: 1, paddingY: 0, flexDirection: "column", children: [_jsxs(Box, { minHeight: 1, children: [_jsx(ToolStatusIndicator, { status: status }), _jsx(ToolInfo, { name: name, status: status, description: description, emphasis: emphasis }), emphasis === 'high' && _jsx(TrailingIndicator, {})] }), resultDisplay && (_jsx(Box, { paddingLeft: STATUS_INDICATOR_WIDTH, width: "100%", marginTop: 1, children: _jsxs(Box, { flexDirection: "column", children: [typeof resultDisplay === 'string' && renderOutputAsMarkdown && (_jsx(Box, { flexDirection: "column", children: _jsx(MarkdownDisplay, { text: resultDisplay, isPending: false, availableTerminalHeight: availableHeight, terminalWidth: childWidth }) })), typeof resultDisplay === 'string' && !renderOutputAsMarkdown && (_jsx(MaxSizedBox, { maxHeight: availableHeight, maxWidth: childWidth, children: _jsx(Box, { children: _jsx(Text, { wrap: "wrap", children: resultDisplay }) }) })), typeof resultDisplay !== 'string' && (_jsx(DiffRenderer, { diffContent: resultDisplay.fileDiff, filename: resultDisplay.fileName, availableTerminalHeight: availableHeight, terminalWidth: childWidth }))] }) }))] }));
41
+ };
42
+ const ToolStatusIndicator = ({ status, }) => (_jsxs(Box, { minWidth: STATUS_INDICATOR_WIDTH, children: [status === ToolCallStatus.Pending && (_jsx(Text, { color: Colors.AccentGreen, children: "o" })), status === ToolCallStatus.Executing && (_jsx(GeminiRespondingSpinner, { spinnerType: "toggle", nonRespondingDisplay: '⊷' })), status === ToolCallStatus.Success && (_jsx(Text, { color: Colors.AccentGreen, children: "\u2714" })), status === ToolCallStatus.Confirming && (_jsx(Text, { color: Colors.AccentYellow, children: "?" })), status === ToolCallStatus.Canceled && (_jsx(Text, { color: Colors.AccentYellow, bold: true, children: "-" })), status === ToolCallStatus.Error && (_jsx(Text, { color: Colors.AccentRed, bold: true, children: "x" }))] }));
43
+ const ToolInfo = ({ name, description, status, emphasis, }) => {
44
+ const nameColor = React.useMemo(() => {
45
+ switch (emphasis) {
46
+ case 'high':
47
+ return Colors.Foreground;
48
+ case 'medium':
49
+ return Colors.Foreground;
50
+ case 'low':
51
+ return Colors.Gray;
52
+ default: {
53
+ const exhaustiveCheck = emphasis;
54
+ return exhaustiveCheck;
55
+ }
56
+ }
57
+ }, [emphasis]);
58
+ return (_jsx(Box, { children: _jsxs(Text, { wrap: "truncate-end", strikethrough: status === ToolCallStatus.Canceled, children: [_jsx(Text, { color: nameColor, bold: true, children: name }), ' ', _jsx(Text, { color: Colors.Gray, children: description })] }) }));
59
+ };
60
+ const TrailingIndicator = () => (_jsxs(Text, { color: Colors.Foreground, wrap: "truncate", children: [' ', "\u2190"] }));
61
+ //# sourceMappingURL=ToolMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolMessage.js","sourceRoot":"","sources":["../../../../../src/ui/components/messages/ToolMessage.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAA6B,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,mBAAmB,GAAG,CAAC,CAAC,CAAC,sCAAsC;AACrE,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,eAAe,GAAG,CAAC,CAAC,CAAC,gCAAgC;AAE3D,6EAA6E;AAC7E,8DAA8D;AAC9D,MAAM,iCAAiC,GAAG,OAAO,CAAC;AAUlD,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EACtD,IAAI,EACJ,WAAW,EACX,aAAa,EACb,MAAM,EACN,uBAAuB,EACvB,aAAa,EACb,QAAQ,GAAG,QAAQ,EACnB,sBAAsB,GAAG,IAAI,GAC9B,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,uBAAuB;QAC7C,CAAC,CAAC,IAAI,CAAC,GAAG,CACN,uBAAuB,GAAG,aAAa,GAAG,mBAAmB,EAC7D,eAAe,GAAG,CAAC,CACpB;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,+FAA+F;IAC/F,6FAA6F;IAC7F,oFAAoF;IACpF,IAAI,eAAe,EAAE,CAAC;QACpB,sBAAsB,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,MAAM,UAAU,GAAG,aAAa,GAAG,CAAC,CAAC,CAAC,uBAAuB;IAC7D,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACtC,IAAI,aAAa,CAAC,MAAM,GAAG,iCAAiC,EAAE,CAAC;YAC7D,iEAAiE;YACjE,aAAa;gBACX,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,iCAAiC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IACD,OAAO,CACL,MAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,aACnD,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,aACf,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,GAAI,EACvC,KAAC,QAAQ,IACP,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GAClB,EACD,QAAQ,KAAK,MAAM,IAAI,KAAC,iBAAiB,KAAG,IACzC,EACL,aAAa,IAAI,CAChB,KAAC,GAAG,IAAC,WAAW,EAAE,sBAAsB,EAAE,KAAK,EAAC,MAAM,EAAC,SAAS,EAAE,CAAC,YACjE,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aACxB,OAAO,aAAa,KAAK,QAAQ,IAAI,sBAAsB,IAAI,CAC9D,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,YACzB,KAAC,eAAe,IACd,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,KAAK,EAChB,uBAAuB,EAAE,eAAe,EACxC,aAAa,EAAE,UAAU,GACzB,GACE,CACP,EACA,OAAO,aAAa,KAAK,QAAQ,IAAI,CAAC,sBAAsB,IAAI,CAC/D,KAAC,WAAW,IAAC,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,YAC3D,KAAC,GAAG,cACF,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,YAAE,aAAa,GAAQ,GACpC,GACM,CACf,EACA,OAAO,aAAa,KAAK,QAAQ,IAAI,CACpC,KAAC,YAAY,IACX,WAAW,EAAE,aAAa,CAAC,QAAQ,EACnC,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAChC,uBAAuB,EAAE,eAAe,EACxC,aAAa,EAAE,UAAU,GACzB,CACH,IACG,GACF,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAMF,MAAM,mBAAmB,GAAuC,CAAC,EAC/D,MAAM,GACP,EAAE,EAAE,CAAC,CACJ,MAAC,GAAG,IAAC,QAAQ,EAAE,sBAAsB,aAClC,MAAM,KAAK,cAAc,CAAC,OAAO,IAAI,CACpC,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,WAAW,kBAAU,CAC1C,EACA,MAAM,KAAK,cAAc,CAAC,SAAS,IAAI,CACtC,KAAC,uBAAuB,IACtB,WAAW,EAAC,QAAQ,EACpB,oBAAoB,EAAE,GAAG,GACzB,CACH,EACA,MAAM,KAAK,cAAc,CAAC,OAAO,IAAI,CACpC,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,WAAW,uBAAU,CAC1C,EACA,MAAM,KAAK,cAAc,CAAC,UAAU,IAAI,CACvC,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,YAAY,kBAAU,CAC3C,EACA,MAAM,KAAK,cAAc,CAAC,QAAQ,IAAI,CACrC,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,IAAI,wBAE/B,CACR,EACA,MAAM,KAAK,cAAc,CAAC,KAAK,IAAI,CAClC,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,wBAE5B,CACR,IACG,CACP,CAAC;AAQF,MAAM,QAAQ,GAAuB,CAAC,EACpC,IAAI,EACJ,WAAW,EACX,MAAM,EACN,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAS,GAAG,EAAE;QAC3C,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,MAAM;gBACT,OAAO,MAAM,CAAC,UAAU,CAAC;YAC3B,KAAK,QAAQ;gBACX,OAAO,MAAM,CAAC,UAAU,CAAC;YAC3B,KAAK,KAAK;gBACR,OAAO,MAAM,CAAC,IAAI,CAAC;YACrB,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,eAAe,GAAU,QAAQ,CAAC;gBACxC,OAAO,eAAe,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACf,OAAO,CACL,KAAC,GAAG,cACF,MAAC,IAAI,IACH,IAAI,EAAC,cAAc,EACnB,aAAa,EAAE,MAAM,KAAK,cAAc,CAAC,QAAQ,aAEjD,KAAC,IAAI,IAAC,KAAK,EAAE,SAAS,EAAE,IAAI,kBACzB,IAAI,GACA,EAAC,GAAG,EACX,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,YAAG,WAAW,GAAQ,IACzC,GACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAa,GAAG,EAAE,CAAC,CACxC,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,EAAC,UAAU,aAC5C,GAAG,cAEC,CACR,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import React from 'react';
7
+ interface UserMessageProps {
8
+ text: string;
9
+ }
10
+ export declare const UserMessage: React.FC<UserMessageProps>;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text, Box } from 'ink';
3
+ import { Colors } from '../../colors.js';
4
+ export const UserMessage = ({ text }) => {
5
+ const prefix = '> ';
6
+ const prefixWidth = prefix.length;
7
+ return (_jsxs(Box, { borderStyle: "round", borderColor: Colors.Gray, flexDirection: "row", paddingX: 2, paddingY: 0, marginY: 1, alignSelf: "flex-start", children: [_jsx(Box, { width: prefixWidth, children: _jsx(Text, { color: Colors.Gray, children: prefix }) }), _jsx(Box, { flexGrow: 1, children: _jsx(Text, { wrap: "wrap", color: Colors.Gray, children: text }) })] }));
8
+ };
9
+ //# sourceMappingURL=UserMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserMessage.js","sourceRoot":"","sources":["../../../../../src/ui/components/messages/UserMessage.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAMzC,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAClE,MAAM,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IAElC,OAAO,CACL,MAAC,GAAG,IACF,WAAW,EAAC,OAAO,EACnB,WAAW,EAAE,MAAM,CAAC,IAAI,EACxB,aAAa,EAAC,KAAK,EACnB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,CAAC,EACV,SAAS,EAAC,YAAY,aAEtB,KAAC,GAAG,IAAC,KAAK,EAAE,WAAW,YACrB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,YAAG,MAAM,GAAQ,GACrC,EACN,KAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,YACd,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAE,MAAM,CAAC,IAAI,YACjC,IAAI,GACA,GACH,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import React from 'react';
7
+ interface UserShellMessageProps {
8
+ text: string;
9
+ }
10
+ export declare const UserShellMessage: React.FC<UserShellMessageProps>;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { Colors } from '../../colors.js';
4
+ export const UserShellMessage = ({ text }) => {
5
+ // Remove leading '!' if present, as App.tsx adds it for the processor.
6
+ const commandToDisplay = text.startsWith('!') ? text.substring(1) : text;
7
+ return (_jsxs(Box, { children: [_jsx(Text, { color: Colors.AccentCyan, children: "$ " }), _jsx(Text, { children: commandToDisplay })] }));
8
+ };
9
+ //# sourceMappingURL=UserShellMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserShellMessage.js","sourceRoot":"","sources":["../../../../../src/ui/components/messages/UserShellMessage.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAMzC,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC5E,uEAAuE;IACvE,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEzE,OAAO,CACL,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,UAAU,mBAAW,EACzC,KAAC,IAAI,cAAE,gBAAgB,GAAQ,IAC3B,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import React from 'react';
7
+ /**
8
+ * Minimum height for the MaxSizedBox component.
9
+ * This ensures there is room for at least one line of content as well as the
10
+ * message that content was truncated.
11
+ */
12
+ export declare const MINIMUM_MAX_HEIGHT = 2;
13
+ export declare function setMaxSizedBoxDebugging(value: boolean): void;
14
+ interface MaxSizedBoxProps {
15
+ children?: React.ReactNode;
16
+ maxWidth?: number;
17
+ maxHeight: number | undefined;
18
+ overflowDirection?: 'top' | 'bottom';
19
+ additionalHiddenLinesCount?: number;
20
+ }
21
+ /**
22
+ * A React component that constrains the size of its children and provides
23
+ * content-aware truncation when the content exceeds the specified `maxHeight`.
24
+ *
25
+ * `MaxSizedBox` requires a specific structure for its children to correctly
26
+ * measure and render the content:
27
+ *
28
+ * 1. **Direct children must be `<Box>` elements.** Each `<Box>` represents a
29
+ * single row of content.
30
+ * 2. **Row `<Box>` elements must contain only `<Text>` elements.** These
31
+ * `<Text>` elements can be nested and there are no restrictions to Text
32
+ * element styling other than that non-wrapping text elements must be
33
+ * before wrapping text elements.
34
+ *
35
+ * **Constraints:**
36
+ * - **Box Properties:** Custom properties on the child `<Box>` elements are
37
+ * ignored. In debug mode, runtime checks will report errors for any
38
+ * unsupported properties.
39
+ * - **Text Wrapping:** Within a single row, `<Text>` elements with no wrapping
40
+ * (e.g., headers, labels) must appear before any `<Text>` elements that wrap.
41
+ * - **Element Types:** Runtime checks will warn if unsupported element types
42
+ * are used as children.
43
+ *
44
+ * @example
45
+ * <MaxSizedBox maxWidth={80} maxHeight={10}>
46
+ * <Box>
47
+ * <Text>This is the first line.</Text>
48
+ * </Box>
49
+ * <Box>
50
+ * <Text color="cyan" wrap="truncate">Non-wrapping Header: </Text>
51
+ * <Text>This is the rest of the line which will wrap if it's too long.</Text>
52
+ * </Box>
53
+ * <Box>
54
+ * <Text>
55
+ * Line 3 with <Text color="yellow">nested styled text</Text> inside of it.
56
+ * </Text>
57
+ * </Box>
58
+ * </MaxSizedBox>
59
+ */
60
+ export declare const MaxSizedBox: React.FC<MaxSizedBoxProps>;
61
+ export {};
@@ -0,0 +1,451 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * @license
4
+ * Copyright 2025 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ import React, { Fragment, useEffect, useId } from 'react';
8
+ import { Box, Text } from 'ink';
9
+ import stringWidth from 'string-width';
10
+ import { Colors } from '../../colors.js';
11
+ import { toCodePoints } from '../../utils/textUtils.js';
12
+ import { useOverflowActions } from '../../contexts/OverflowContext.js';
13
+ let enableDebugLog = false;
14
+ /**
15
+ * Minimum height for the MaxSizedBox component.
16
+ * This ensures there is room for at least one line of content as well as the
17
+ * message that content was truncated.
18
+ */
19
+ export const MINIMUM_MAX_HEIGHT = 2;
20
+ export function setMaxSizedBoxDebugging(value) {
21
+ enableDebugLog = value;
22
+ }
23
+ function debugReportError(message, element) {
24
+ if (!enableDebugLog)
25
+ return;
26
+ if (!React.isValidElement(element)) {
27
+ console.error(message, `Invalid element: '${String(element)}' typeof=${typeof element}`);
28
+ return;
29
+ }
30
+ let sourceMessage = '<Unknown file>';
31
+ try {
32
+ const elementWithSource = element;
33
+ const fileName = elementWithSource._source?.fileName;
34
+ const lineNumber = elementWithSource._source?.lineNumber;
35
+ sourceMessage = fileName ? `${fileName}:${lineNumber}` : '<Unknown file>';
36
+ }
37
+ catch (error) {
38
+ console.error('Error while trying to get file name:', error);
39
+ }
40
+ console.error(message, `${String(element.type)}. Source: ${sourceMessage}`);
41
+ }
42
+ /**
43
+ * A React component that constrains the size of its children and provides
44
+ * content-aware truncation when the content exceeds the specified `maxHeight`.
45
+ *
46
+ * `MaxSizedBox` requires a specific structure for its children to correctly
47
+ * measure and render the content:
48
+ *
49
+ * 1. **Direct children must be `<Box>` elements.** Each `<Box>` represents a
50
+ * single row of content.
51
+ * 2. **Row `<Box>` elements must contain only `<Text>` elements.** These
52
+ * `<Text>` elements can be nested and there are no restrictions to Text
53
+ * element styling other than that non-wrapping text elements must be
54
+ * before wrapping text elements.
55
+ *
56
+ * **Constraints:**
57
+ * - **Box Properties:** Custom properties on the child `<Box>` elements are
58
+ * ignored. In debug mode, runtime checks will report errors for any
59
+ * unsupported properties.
60
+ * - **Text Wrapping:** Within a single row, `<Text>` elements with no wrapping
61
+ * (e.g., headers, labels) must appear before any `<Text>` elements that wrap.
62
+ * - **Element Types:** Runtime checks will warn if unsupported element types
63
+ * are used as children.
64
+ *
65
+ * @example
66
+ * <MaxSizedBox maxWidth={80} maxHeight={10}>
67
+ * <Box>
68
+ * <Text>This is the first line.</Text>
69
+ * </Box>
70
+ * <Box>
71
+ * <Text color="cyan" wrap="truncate">Non-wrapping Header: </Text>
72
+ * <Text>This is the rest of the line which will wrap if it's too long.</Text>
73
+ * </Box>
74
+ * <Box>
75
+ * <Text>
76
+ * Line 3 with <Text color="yellow">nested styled text</Text> inside of it.
77
+ * </Text>
78
+ * </Box>
79
+ * </MaxSizedBox>
80
+ */
81
+ export const MaxSizedBox = ({ children, maxWidth, maxHeight, overflowDirection = 'top', additionalHiddenLinesCount = 0, }) => {
82
+ const id = useId();
83
+ const { addOverflowingId, removeOverflowingId } = useOverflowActions() || {};
84
+ const laidOutStyledText = [];
85
+ const targetMaxHeight = Math.max(Math.round(maxHeight ?? Number.MAX_SAFE_INTEGER), MINIMUM_MAX_HEIGHT);
86
+ if (maxWidth === undefined) {
87
+ throw new Error('maxWidth must be defined when maxHeight is set.');
88
+ }
89
+ function visitRows(element) {
90
+ if (!React.isValidElement(element)) {
91
+ return;
92
+ }
93
+ if (element.type === Fragment) {
94
+ React.Children.forEach(element.props.children, visitRows);
95
+ return;
96
+ }
97
+ if (element.type === Box) {
98
+ layoutInkElementAsStyledText(element, maxWidth, laidOutStyledText);
99
+ return;
100
+ }
101
+ debugReportError('MaxSizedBox children must be <Box> elements', element);
102
+ }
103
+ React.Children.forEach(children, visitRows);
104
+ const contentWillOverflow = (targetMaxHeight !== undefined &&
105
+ laidOutStyledText.length > targetMaxHeight) ||
106
+ additionalHiddenLinesCount > 0;
107
+ const visibleContentHeight = contentWillOverflow && targetMaxHeight !== undefined
108
+ ? targetMaxHeight - 1
109
+ : targetMaxHeight;
110
+ const hiddenLinesCount = visibleContentHeight !== undefined
111
+ ? Math.max(0, laidOutStyledText.length - visibleContentHeight)
112
+ : 0;
113
+ const totalHiddenLines = hiddenLinesCount + additionalHiddenLinesCount;
114
+ useEffect(() => {
115
+ if (totalHiddenLines > 0) {
116
+ addOverflowingId?.(id);
117
+ }
118
+ else {
119
+ removeOverflowingId?.(id);
120
+ }
121
+ return () => {
122
+ removeOverflowingId?.(id);
123
+ };
124
+ }, [id, totalHiddenLines, addOverflowingId, removeOverflowingId]);
125
+ const visibleStyledText = hiddenLinesCount > 0
126
+ ? overflowDirection === 'top'
127
+ ? laidOutStyledText.slice(hiddenLinesCount, laidOutStyledText.length)
128
+ : laidOutStyledText.slice(0, visibleContentHeight)
129
+ : laidOutStyledText;
130
+ const visibleLines = visibleStyledText.map((line, index) => (_jsx(Box, { children: line.length > 0 ? (line.map((segment, segIndex) => (_jsx(Text, { ...segment.props, children: segment.text }, segIndex)))) : (_jsx(Text, { children: " " })) }, index)));
131
+ return (_jsxs(Box, { flexDirection: "column", width: maxWidth, flexShrink: 0, children: [totalHiddenLines > 0 && overflowDirection === 'top' && (_jsxs(Text, { color: Colors.Gray, wrap: "truncate", children: ["... first ", totalHiddenLines, " line", totalHiddenLines === 1 ? '' : 's', ' ', "hidden ..."] })), visibleLines, totalHiddenLines > 0 && overflowDirection === 'bottom' && (_jsxs(Text, { color: Colors.Gray, wrap: "truncate", children: ["... last ", totalHiddenLines, " line", totalHiddenLines === 1 ? '' : 's', ' ', "hidden ..."] }))] }));
132
+ };
133
+ /**
134
+ * Flattens the child elements of MaxSizedBox into an array of `Row` objects.
135
+ *
136
+ * This function expects a specific child structure to function correctly:
137
+ * 1. The top-level child of `MaxSizedBox` should be a single `<Box>`. This
138
+ * outer box is primarily for structure and is not directly rendered.
139
+ * 2. Inside the outer `<Box>`, there should be one or more children. Each of
140
+ * these children must be a `<Box>` that represents a row.
141
+ * 3. Inside each "row" `<Box>`, the children must be `<Text>` components.
142
+ *
143
+ * The structure should look like this:
144
+ * <MaxSizedBox>
145
+ * <Box> // Row 1
146
+ * <Text>...</Text>
147
+ * <Text>...</Text>
148
+ * </Box>
149
+ * <Box> // Row 2
150
+ * <Text>...</Text>
151
+ * </Box>
152
+ * </MaxSizedBox>
153
+ *
154
+ * It is an error for a <Text> child without wrapping to appear after a
155
+ * <Text> child with wrapping within the same row Box.
156
+ *
157
+ * @param element The React node to flatten.
158
+ * @returns An array of `Row` objects.
159
+ */
160
+ function visitBoxRow(element) {
161
+ if (!React.isValidElement(element) ||
162
+ element.type !== Box) {
163
+ debugReportError(`All children of MaxSizedBox must be <Box> elements`, element);
164
+ return {
165
+ noWrapSegments: [{ text: '<ERROR>', props: {} }],
166
+ segments: [],
167
+ };
168
+ }
169
+ if (enableDebugLog) {
170
+ const boxProps = element.props;
171
+ // Ensure the Box has no props other than the default ones and key.
172
+ let maxExpectedProps = 4;
173
+ if (boxProps.children !== undefined) {
174
+ // Allow the key prop, which is automatically added by React.
175
+ maxExpectedProps += 1;
176
+ }
177
+ if (boxProps.flexDirection !== undefined &&
178
+ boxProps.flexDirection !== 'row') {
179
+ debugReportError('MaxSizedBox children must have flexDirection="row".', element);
180
+ }
181
+ if (Object.keys(boxProps).length > maxExpectedProps) {
182
+ debugReportError(`Boxes inside MaxSizedBox must not have additional props. ${Object.keys(boxProps).join(', ')}`, element);
183
+ }
184
+ }
185
+ const row = {
186
+ noWrapSegments: [],
187
+ segments: [],
188
+ };
189
+ let hasSeenWrapped = false;
190
+ function visitRowChild(element, parentProps) {
191
+ if (element === null) {
192
+ return;
193
+ }
194
+ if (typeof element === 'string' || typeof element === 'number') {
195
+ const text = String(element);
196
+ // Ignore empty strings as they don't need to be rendered.
197
+ if (!text) {
198
+ return;
199
+ }
200
+ const segment = { text, props: parentProps ?? {} };
201
+ // Check the 'wrap' property from the merged props to decide the segment type.
202
+ if (parentProps === undefined || parentProps.wrap === 'wrap') {
203
+ hasSeenWrapped = true;
204
+ row.segments.push(segment);
205
+ }
206
+ else {
207
+ if (!hasSeenWrapped) {
208
+ row.noWrapSegments.push(segment);
209
+ }
210
+ else {
211
+ // put in the wrapped segment as the row is already stuck in wrapped mode.
212
+ row.segments.push(segment);
213
+ debugReportError('Text elements without wrapping cannot appear after elements with wrapping in the same row.', element);
214
+ }
215
+ }
216
+ return;
217
+ }
218
+ if (!React.isValidElement(element)) {
219
+ debugReportError('Invalid element.', element);
220
+ return;
221
+ }
222
+ if (element.type === Fragment) {
223
+ React.Children.forEach(element.props.children, (child) => visitRowChild(child, parentProps));
224
+ return;
225
+ }
226
+ if (element.type !== Text) {
227
+ debugReportError('Children of a row Box must be <Text> elements.', element);
228
+ return;
229
+ }
230
+ // Merge props from parent <Text> elements. Child props take precedence.
231
+ const { children, ...currentProps } = element.props;
232
+ const mergedProps = parentProps === undefined
233
+ ? currentProps
234
+ : { ...parentProps, ...currentProps };
235
+ React.Children.forEach(children, (child) => visitRowChild(child, mergedProps));
236
+ }
237
+ React.Children.forEach(element.props.children, (child) => visitRowChild(child, undefined));
238
+ return row;
239
+ }
240
+ function layoutInkElementAsStyledText(element, maxWidth, output) {
241
+ const row = visitBoxRow(element);
242
+ if (row.segments.length === 0 && row.noWrapSegments.length === 0) {
243
+ // Return a single empty line if there are no segments to display
244
+ output.push([]);
245
+ return;
246
+ }
247
+ const lines = [];
248
+ const nonWrappingContent = [];
249
+ let noWrappingWidth = 0;
250
+ // First, lay out the non-wrapping segments
251
+ row.noWrapSegments.forEach((segment) => {
252
+ nonWrappingContent.push(segment);
253
+ noWrappingWidth += stringWidth(segment.text);
254
+ });
255
+ if (row.segments.length === 0) {
256
+ // This is a bit of a special case when there are no segments that allow
257
+ // wrapping. It would be ideal to unify.
258
+ const lines = [];
259
+ let currentLine = [];
260
+ nonWrappingContent.forEach((segment) => {
261
+ const textLines = segment.text.split('\n');
262
+ textLines.forEach((text, index) => {
263
+ if (index > 0) {
264
+ lines.push(currentLine);
265
+ currentLine = [];
266
+ }
267
+ if (text) {
268
+ currentLine.push({ text, props: segment.props });
269
+ }
270
+ });
271
+ });
272
+ if (currentLine.length > 0 ||
273
+ (nonWrappingContent.length > 0 &&
274
+ nonWrappingContent[nonWrappingContent.length - 1].text.endsWith('\n'))) {
275
+ lines.push(currentLine);
276
+ }
277
+ for (const line of lines) {
278
+ output.push(line);
279
+ }
280
+ return;
281
+ }
282
+ const availableWidth = maxWidth - noWrappingWidth;
283
+ if (availableWidth < 1) {
284
+ // No room to render the wrapping segments. Truncate the non-wrapping
285
+ // content and append an ellipsis so the line always fits within maxWidth.
286
+ // Handle line breaks in non-wrapping content when truncating
287
+ const lines = [];
288
+ let currentLine = [];
289
+ let currentLineWidth = 0;
290
+ for (const segment of nonWrappingContent) {
291
+ const textLines = segment.text.split('\n');
292
+ textLines.forEach((text, index) => {
293
+ if (index > 0) {
294
+ // New line encountered, finish current line and start new one
295
+ lines.push(currentLine);
296
+ currentLine = [];
297
+ currentLineWidth = 0;
298
+ }
299
+ if (text) {
300
+ const textWidth = stringWidth(text);
301
+ // When there's no room for wrapping content, be very conservative
302
+ // For lines after the first line break, show only ellipsis if the text would be truncated
303
+ if (index > 0 && textWidth > 0) {
304
+ // This is content after a line break - just show ellipsis to indicate truncation
305
+ currentLine.push({ text: '…', props: {} });
306
+ currentLineWidth = stringWidth('…');
307
+ }
308
+ else {
309
+ // This is the first line or a continuation, try to fit what we can
310
+ const maxContentWidth = Math.max(0, maxWidth - stringWidth('…'));
311
+ if (textWidth <= maxContentWidth && currentLineWidth === 0) {
312
+ // Text fits completely on this line
313
+ currentLine.push({ text, props: segment.props });
314
+ currentLineWidth += textWidth;
315
+ }
316
+ else {
317
+ // Text needs truncation
318
+ const codePoints = toCodePoints(text);
319
+ let truncatedWidth = currentLineWidth;
320
+ let sliceEndIndex = 0;
321
+ for (const char of codePoints) {
322
+ const charWidth = stringWidth(char);
323
+ if (truncatedWidth + charWidth > maxContentWidth) {
324
+ break;
325
+ }
326
+ truncatedWidth += charWidth;
327
+ sliceEndIndex++;
328
+ }
329
+ const slice = codePoints.slice(0, sliceEndIndex).join('');
330
+ if (slice) {
331
+ currentLine.push({ text: slice, props: segment.props });
332
+ }
333
+ currentLine.push({ text: '…', props: {} });
334
+ currentLineWidth = truncatedWidth + stringWidth('…');
335
+ }
336
+ }
337
+ }
338
+ });
339
+ }
340
+ // Add the last line if it has content or if the last segment ended with \n
341
+ if (currentLine.length > 0 ||
342
+ (nonWrappingContent.length > 0 &&
343
+ nonWrappingContent[nonWrappingContent.length - 1].text.endsWith('\n'))) {
344
+ lines.push(currentLine);
345
+ }
346
+ // If we don't have any lines yet, add an ellipsis line
347
+ if (lines.length === 0) {
348
+ lines.push([{ text: '…', props: {} }]);
349
+ }
350
+ for (const line of lines) {
351
+ output.push(line);
352
+ }
353
+ return;
354
+ }
355
+ // Now, lay out the wrapping segments
356
+ let wrappingPart = [];
357
+ let wrappingPartWidth = 0;
358
+ function addWrappingPartToLines() {
359
+ if (lines.length === 0) {
360
+ lines.push([...nonWrappingContent, ...wrappingPart]);
361
+ }
362
+ else {
363
+ if (noWrappingWidth > 0) {
364
+ lines.push([
365
+ ...[{ text: ' '.repeat(noWrappingWidth), props: {} }],
366
+ ...wrappingPart,
367
+ ]);
368
+ }
369
+ else {
370
+ lines.push(wrappingPart);
371
+ }
372
+ }
373
+ wrappingPart = [];
374
+ wrappingPartWidth = 0;
375
+ }
376
+ function addToWrappingPart(text, props) {
377
+ if (wrappingPart.length > 0 &&
378
+ wrappingPart[wrappingPart.length - 1].props === props) {
379
+ wrappingPart[wrappingPart.length - 1].text += text;
380
+ }
381
+ else {
382
+ wrappingPart.push({ text, props });
383
+ }
384
+ }
385
+ row.segments.forEach((segment) => {
386
+ const linesFromSegment = segment.text.split('\n');
387
+ linesFromSegment.forEach((lineText, lineIndex) => {
388
+ if (lineIndex > 0) {
389
+ addWrappingPartToLines();
390
+ }
391
+ const words = lineText.split(/(\s+)/); // Split by whitespace
392
+ words.forEach((word) => {
393
+ if (!word)
394
+ return;
395
+ const wordWidth = stringWidth(word);
396
+ if (wrappingPartWidth + wordWidth > availableWidth &&
397
+ wrappingPartWidth > 0) {
398
+ addWrappingPartToLines();
399
+ if (/^\s+$/.test(word)) {
400
+ return;
401
+ }
402
+ }
403
+ if (wordWidth > availableWidth) {
404
+ // Word is too long, needs to be split across lines
405
+ const wordAsCodePoints = toCodePoints(word);
406
+ let remainingWordAsCodePoints = wordAsCodePoints;
407
+ while (remainingWordAsCodePoints.length > 0) {
408
+ let splitIndex = 0;
409
+ let currentSplitWidth = 0;
410
+ for (const char of remainingWordAsCodePoints) {
411
+ const charWidth = stringWidth(char);
412
+ if (wrappingPartWidth + currentSplitWidth + charWidth >
413
+ availableWidth) {
414
+ break;
415
+ }
416
+ currentSplitWidth += charWidth;
417
+ splitIndex++;
418
+ }
419
+ if (splitIndex > 0) {
420
+ const part = remainingWordAsCodePoints
421
+ .slice(0, splitIndex)
422
+ .join('');
423
+ addToWrappingPart(part, segment.props);
424
+ wrappingPartWidth += stringWidth(part);
425
+ remainingWordAsCodePoints =
426
+ remainingWordAsCodePoints.slice(splitIndex);
427
+ }
428
+ if (remainingWordAsCodePoints.length > 0) {
429
+ addWrappingPartToLines();
430
+ }
431
+ }
432
+ }
433
+ else {
434
+ addToWrappingPart(word, segment.props);
435
+ wrappingPartWidth += wordWidth;
436
+ }
437
+ });
438
+ });
439
+ // Split omits a trailing newline, so we need to handle it here
440
+ if (segment.text.endsWith('\n')) {
441
+ addWrappingPartToLines();
442
+ }
443
+ });
444
+ if (wrappingPart.length > 0) {
445
+ addWrappingPartToLines();
446
+ }
447
+ for (const line of lines) {
448
+ output.push(line);
449
+ }
450
+ }
451
+ //# sourceMappingURL=MaxSizedBox.js.map