@vybestack/llxprt-code 0.1.12

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 (575) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +256 -0
  3. package/dist/.last_build +0 -0
  4. package/dist/index.d.ts +7 -0
  5. package/dist/index.js +21 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/package.json +95 -0
  8. package/dist/src/config/auth.d.ts +6 -0
  9. package/dist/src/config/auth.js +42 -0
  10. package/dist/src/config/auth.js.map +1 -0
  11. package/dist/src/config/config.d.ts +41 -0
  12. package/dist/src/config/config.js +345 -0
  13. package/dist/src/config/config.js.map +1 -0
  14. package/dist/src/config/extension.d.ts +21 -0
  15. package/dist/src/config/extension.js +109 -0
  16. package/dist/src/config/extension.js.map +1 -0
  17. package/dist/src/config/sandboxConfig.d.ts +13 -0
  18. package/dist/src/config/sandboxConfig.js +75 -0
  19. package/dist/src/config/sandboxConfig.js.map +1 -0
  20. package/dist/src/config/settings.d.ts +88 -0
  21. package/dist/src/config/settings.js +263 -0
  22. package/dist/src/config/settings.js.map +1 -0
  23. package/dist/src/gemini.d.ts +6 -0
  24. package/dist/src/gemini.js +420 -0
  25. package/dist/src/gemini.js.map +1 -0
  26. package/dist/src/generated/git-commit.d.ts +6 -0
  27. package/dist/src/generated/git-commit.js +9 -0
  28. package/dist/src/generated/git-commit.js.map +1 -0
  29. package/dist/src/nonInteractiveCli.d.ts +7 -0
  30. package/dist/src/nonInteractiveCli.js +131 -0
  31. package/dist/src/nonInteractiveCli.js.map +1 -0
  32. package/dist/src/providers/IMessage.d.ts +38 -0
  33. package/dist/src/providers/IMessage.js +17 -0
  34. package/dist/src/providers/IMessage.js.map +1 -0
  35. package/dist/src/providers/IModel.d.ts +23 -0
  36. package/dist/src/providers/IModel.js +17 -0
  37. package/dist/src/providers/IModel.js.map +1 -0
  38. package/dist/src/providers/IProvider.d.ts +32 -0
  39. package/dist/src/providers/IProvider.js +17 -0
  40. package/dist/src/providers/IProvider.js.map +1 -0
  41. package/dist/src/providers/ITool.d.ts +23 -0
  42. package/dist/src/providers/ITool.js +17 -0
  43. package/dist/src/providers/ITool.js.map +1 -0
  44. package/dist/src/providers/ProviderAwareContentGenerator.d.ts +6 -0
  45. package/dist/src/providers/ProviderAwareContentGenerator.js +9 -0
  46. package/dist/src/providers/ProviderAwareContentGenerator.js.map +1 -0
  47. package/dist/src/providers/ProviderManager.d.ts +19 -0
  48. package/dist/src/providers/ProviderManager.js +63 -0
  49. package/dist/src/providers/ProviderManager.js.map +1 -0
  50. package/dist/src/providers/ProviderManagerAdapter.d.ts +17 -0
  51. package/dist/src/providers/ProviderManagerAdapter.js +113 -0
  52. package/dist/src/providers/ProviderManagerAdapter.js.map +1 -0
  53. package/dist/src/providers/README-qwen3.md +60 -0
  54. package/dist/src/providers/README.md +203 -0
  55. package/dist/src/providers/adapters/IStreamAdapter.d.ts +18 -0
  56. package/dist/src/providers/adapters/IStreamAdapter.js +7 -0
  57. package/dist/src/providers/adapters/IStreamAdapter.js.map +1 -0
  58. package/dist/src/providers/anthropic/AnthropicProvider.d.ts +46 -0
  59. package/dist/src/providers/anthropic/AnthropicProvider.js +478 -0
  60. package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -0
  61. package/dist/src/providers/contentGeneratorProvider.d.ts +13 -0
  62. package/dist/src/providers/contentGeneratorProvider.js +17 -0
  63. package/dist/src/providers/contentGeneratorProvider.js.map +1 -0
  64. package/dist/src/providers/enhanceConfigWithProviders.d.ts +12 -0
  65. package/dist/src/providers/enhanceConfigWithProviders.js +16 -0
  66. package/dist/src/providers/enhanceConfigWithProviders.js.map +1 -0
  67. package/dist/src/providers/gemini/GeminiProvider.d.ts +72 -0
  68. package/dist/src/providers/gemini/GeminiProvider.js +454 -0
  69. package/dist/src/providers/gemini/GeminiProvider.js.map +1 -0
  70. package/dist/src/providers/index.d.ts +13 -0
  71. package/dist/src/providers/index.js +18 -0
  72. package/dist/src/providers/index.js.map +1 -0
  73. package/dist/src/providers/integration/TEST_INSTRUCTIONS.md +197 -0
  74. package/dist/src/providers/openai/ConversationCache.d.ts +20 -0
  75. package/dist/src/providers/openai/ConversationCache.js +109 -0
  76. package/dist/src/providers/openai/ConversationCache.js.map +1 -0
  77. package/dist/src/providers/openai/IChatGenerateParams.d.ts +11 -0
  78. package/dist/src/providers/openai/IChatGenerateParams.js +2 -0
  79. package/dist/src/providers/openai/IChatGenerateParams.js.map +1 -0
  80. package/dist/src/providers/openai/OpenAIProvider.d.ts +71 -0
  81. package/dist/src/providers/openai/OpenAIProvider.js +486 -0
  82. package/dist/src/providers/openai/OpenAIProvider.js.map +1 -0
  83. package/dist/src/providers/openai/Qwen3FireworksProvider.d.ts +39 -0
  84. package/dist/src/providers/openai/Qwen3FireworksProvider.js +209 -0
  85. package/dist/src/providers/openai/Qwen3FireworksProvider.js.map +1 -0
  86. package/dist/src/providers/openai/RESPONSES_API_MODELS.d.ts +2 -0
  87. package/dist/src/providers/openai/RESPONSES_API_MODELS.js +14 -0
  88. package/dist/src/providers/openai/RESPONSES_API_MODELS.js.map +1 -0
  89. package/dist/src/providers/openai/buildResponsesRequest.d.ts +67 -0
  90. package/dist/src/providers/openai/buildResponsesRequest.js +144 -0
  91. package/dist/src/providers/openai/buildResponsesRequest.js.map +1 -0
  92. package/dist/src/providers/openai/docs/accessing-provider-info.md +172 -0
  93. package/dist/src/providers/openai/docs/params-mapping.md +91 -0
  94. package/dist/src/providers/openai/docs/qwen3-fireworks.md +47 -0
  95. package/dist/src/providers/openai/docs/responses-api-tool-calls.md +96 -0
  96. package/dist/src/providers/openai/estimateRemoteTokens.d.ts +26 -0
  97. package/dist/src/providers/openai/estimateRemoteTokens.js +75 -0
  98. package/dist/src/providers/openai/estimateRemoteTokens.js.map +1 -0
  99. package/dist/src/providers/openai/getOpenAIProviderInfo.d.ts +46 -0
  100. package/dist/src/providers/openai/getOpenAIProviderInfo.js +74 -0
  101. package/dist/src/providers/openai/getOpenAIProviderInfo.js.map +1 -0
  102. package/dist/src/providers/openai/parseResponsesStream.d.ts +3 -0
  103. package/dist/src/providers/openai/parseResponsesStream.js +444 -0
  104. package/dist/src/providers/openai/parseResponsesStream.js.map +1 -0
  105. package/dist/src/providers/parsers/TextToolCallParser.d.ts +35 -0
  106. package/dist/src/providers/parsers/TextToolCallParser.js +248 -0
  107. package/dist/src/providers/parsers/TextToolCallParser.js.map +1 -0
  108. package/dist/src/providers/providerConfigUtils.d.ts +26 -0
  109. package/dist/src/providers/providerConfigUtils.js +173 -0
  110. package/dist/src/providers/providerConfigUtils.js.map +1 -0
  111. package/dist/src/providers/providerManagerInstance.d.ts +9 -0
  112. package/dist/src/providers/providerManagerInstance.js +109 -0
  113. package/dist/src/providers/providerManagerInstance.js.map +1 -0
  114. package/dist/src/providers/tokenizers/AnthropicTokenizer.d.ts +19 -0
  115. package/dist/src/providers/tokenizers/AnthropicTokenizer.js +37 -0
  116. package/dist/src/providers/tokenizers/AnthropicTokenizer.js.map +1 -0
  117. package/dist/src/providers/tokenizers/ITokenizer.d.ts +18 -0
  118. package/dist/src/providers/tokenizers/ITokenizer.js +17 -0
  119. package/dist/src/providers/tokenizers/ITokenizer.js.map +1 -0
  120. package/dist/src/providers/tokenizers/OpenAITokenizer.d.ts +24 -0
  121. package/dist/src/providers/tokenizers/OpenAITokenizer.js +56 -0
  122. package/dist/src/providers/tokenizers/OpenAITokenizer.js.map +1 -0
  123. package/dist/src/providers/types.d.ts +14 -0
  124. package/dist/src/providers/types.js +16 -0
  125. package/dist/src/providers/types.js.map +1 -0
  126. package/dist/src/services/CommandService.d.ts +13 -0
  127. package/dist/src/services/CommandService.js +38 -0
  128. package/dist/src/services/CommandService.js.map +1 -0
  129. package/dist/src/tools/IToolFormatter.d.ts +40 -0
  130. package/dist/src/tools/IToolFormatter.js +17 -0
  131. package/dist/src/tools/IToolFormatter.js.map +1 -0
  132. package/dist/src/tools/ToolFormatter.d.ts +45 -0
  133. package/dist/src/tools/ToolFormatter.js +216 -0
  134. package/dist/src/tools/ToolFormatter.js.map +1 -0
  135. package/dist/src/ui/App.d.ts +15 -0
  136. package/dist/src/ui/App.js +468 -0
  137. package/dist/src/ui/App.js.map +1 -0
  138. package/dist/src/ui/colors.d.ts +25 -0
  139. package/dist/src/ui/colors.js +126 -0
  140. package/dist/src/ui/colors.js.map +1 -0
  141. package/dist/src/ui/commands/aboutCommand.d.ts +7 -0
  142. package/dist/src/ui/commands/aboutCommand.js +61 -0
  143. package/dist/src/ui/commands/aboutCommand.js.map +1 -0
  144. package/dist/src/ui/commands/authCommand.d.ts +7 -0
  145. package/dist/src/ui/commands/authCommand.js +14 -0
  146. package/dist/src/ui/commands/authCommand.js.map +1 -0
  147. package/dist/src/ui/commands/clearCommand.d.ts +7 -0
  148. package/dist/src/ui/commands/clearCommand.js +15 -0
  149. package/dist/src/ui/commands/clearCommand.js.map +1 -0
  150. package/dist/src/ui/commands/helpCommand.d.ts +7 -0
  151. package/dist/src/ui/commands/helpCommand.js +18 -0
  152. package/dist/src/ui/commands/helpCommand.js.map +1 -0
  153. package/dist/src/ui/commands/memoryCommand.d.ts +7 -0
  154. package/dist/src/ui/commands/memoryCommand.js +81 -0
  155. package/dist/src/ui/commands/memoryCommand.js.map +1 -0
  156. package/dist/src/ui/commands/privacyCommand.d.ts +7 -0
  157. package/dist/src/ui/commands/privacyCommand.js +14 -0
  158. package/dist/src/ui/commands/privacyCommand.js.map +1 -0
  159. package/dist/src/ui/commands/themeCommand.d.ts +7 -0
  160. package/dist/src/ui/commands/themeCommand.js +14 -0
  161. package/dist/src/ui/commands/themeCommand.js.map +1 -0
  162. package/dist/src/ui/commands/types.d.ts +63 -0
  163. package/dist/src/ui/commands/types.js +7 -0
  164. package/dist/src/ui/commands/types.js.map +1 -0
  165. package/dist/src/ui/components/AboutBox.d.ts +16 -0
  166. package/dist/src/ui/components/AboutBox.js +6 -0
  167. package/dist/src/ui/components/AboutBox.js.map +1 -0
  168. package/dist/src/ui/components/AsciiArt.d.ts +7 -0
  169. package/dist/src/ui/components/AsciiArt.js +24 -0
  170. package/dist/src/ui/components/AsciiArt.js.map +1 -0
  171. package/dist/src/ui/components/AuthDialog.d.ts +15 -0
  172. package/dist/src/ui/components/AuthDialog.js +102 -0
  173. package/dist/src/ui/components/AuthDialog.js.map +1 -0
  174. package/dist/src/ui/components/AuthInProgress.d.ts +11 -0
  175. package/dist/src/ui/components/AuthInProgress.js +27 -0
  176. package/dist/src/ui/components/AuthInProgress.js.map +1 -0
  177. package/dist/src/ui/components/AutoAcceptIndicator.d.ts +12 -0
  178. package/dist/src/ui/components/AutoAcceptIndicator.js +26 -0
  179. package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -0
  180. package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +11 -0
  181. package/dist/src/ui/components/ConsoleSummaryDisplay.js +11 -0
  182. package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -0
  183. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +15 -0
  184. package/dist/src/ui/components/ContextSummaryDisplay.js +41 -0
  185. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -0
  186. package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +14 -0
  187. package/dist/src/ui/components/DetailedMessagesDisplay.js +34 -0
  188. package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -0
  189. package/dist/src/ui/components/EditorSettingsDialog.d.ts +15 -0
  190. package/dist/src/ui/components/EditorSettingsDialog.js +73 -0
  191. package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -0
  192. package/dist/src/ui/components/ErrorBoundary.d.ts +46 -0
  193. package/dist/src/ui/components/ErrorBoundary.js +115 -0
  194. package/dist/src/ui/components/ErrorBoundary.js.map +1 -0
  195. package/dist/src/ui/components/Footer.d.ts +22 -0
  196. package/dist/src/ui/components/Footer.js +32 -0
  197. package/dist/src/ui/components/Footer.js.map +1 -0
  198. package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +17 -0
  199. package/dist/src/ui/components/GeminiRespondingSpinner.js +16 -0
  200. package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -0
  201. package/dist/src/ui/components/Header.d.ts +14 -0
  202. package/dist/src/ui/components/Header.js +20 -0
  203. package/dist/src/ui/components/Header.js.map +1 -0
  204. package/dist/src/ui/components/Help.d.ts +12 -0
  205. package/dist/src/ui/components/Help.js +10 -0
  206. package/dist/src/ui/components/Help.js.map +1 -0
  207. package/dist/src/ui/components/HistoryItemDisplay.d.ts +18 -0
  208. package/dist/src/ui/components/HistoryItemDisplay.js +17 -0
  209. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -0
  210. package/dist/src/ui/components/InputPrompt.d.ts +25 -0
  211. package/dist/src/ui/components/InputPrompt.js +350 -0
  212. package/dist/src/ui/components/InputPrompt.js.map +1 -0
  213. package/dist/src/ui/components/LayoutManager.d.ts +24 -0
  214. package/dist/src/ui/components/LayoutManager.js +58 -0
  215. package/dist/src/ui/components/LayoutManager.js.map +1 -0
  216. package/dist/src/ui/components/LoadingIndicator.d.ts +15 -0
  217. package/dist/src/ui/components/LoadingIndicator.js +20 -0
  218. package/dist/src/ui/components/LoadingIndicator.js.map +1 -0
  219. package/dist/src/ui/components/MemoryUsageDisplay.d.ts +7 -0
  220. package/dist/src/ui/components/MemoryUsageDisplay.js +27 -0
  221. package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -0
  222. package/dist/src/ui/components/ModelStatsDisplay.d.ts +7 -0
  223. package/dist/src/ui/components/ModelStatsDisplay.js +33 -0
  224. package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -0
  225. package/dist/src/ui/components/ProviderDialog.d.ts +9 -0
  226. package/dist/src/ui/components/ProviderDialog.js +54 -0
  227. package/dist/src/ui/components/ProviderDialog.js.map +1 -0
  228. package/dist/src/ui/components/ProviderModelDialog.d.ts +15 -0
  229. package/dist/src/ui/components/ProviderModelDialog.js +54 -0
  230. package/dist/src/ui/components/ProviderModelDialog.js.map +1 -0
  231. package/dist/src/ui/components/SessionSummaryDisplay.d.ts +11 -0
  232. package/dist/src/ui/components/SessionSummaryDisplay.js +4 -0
  233. package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -0
  234. package/dist/src/ui/components/ShellModeIndicator.d.ts +7 -0
  235. package/dist/src/ui/components/ShellModeIndicator.js +5 -0
  236. package/dist/src/ui/components/ShellModeIndicator.js.map +1 -0
  237. package/dist/src/ui/components/ShowMoreLines.d.ts +10 -0
  238. package/dist/src/ui/components/ShowMoreLines.js +24 -0
  239. package/dist/src/ui/components/ShowMoreLines.js.map +1 -0
  240. package/dist/src/ui/components/StatsDisplay.d.ts +12 -0
  241. package/dist/src/ui/components/StatsDisplay.js +42 -0
  242. package/dist/src/ui/components/StatsDisplay.js.map +1 -0
  243. package/dist/src/ui/components/SuggestionsDisplay.d.ts +21 -0
  244. package/dist/src/ui/components/SuggestionsDisplay.js +32 -0
  245. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -0
  246. package/dist/src/ui/components/ThemeDialog.d.ts +19 -0
  247. package/dist/src/ui/components/ThemeDialog.js +127 -0
  248. package/dist/src/ui/components/ThemeDialog.js.map +1 -0
  249. package/dist/src/ui/components/Tips.d.ts +12 -0
  250. package/dist/src/ui/components/Tips.js +8 -0
  251. package/dist/src/ui/components/Tips.js.map +1 -0
  252. package/dist/src/ui/components/ToolStatsDisplay.d.ts +7 -0
  253. package/dist/src/ui/components/ToolStatsDisplay.js +41 -0
  254. package/dist/src/ui/components/ToolStatsDisplay.js.map +1 -0
  255. package/dist/src/ui/components/UpdateNotification.d.ts +10 -0
  256. package/dist/src/ui/components/UpdateNotification.js +10 -0
  257. package/dist/src/ui/components/UpdateNotification.js.map +1 -0
  258. package/dist/src/ui/components/messages/CompressionMessage.d.ts +11 -0
  259. package/dist/src/ui/components/messages/CompressionMessage.js +16 -0
  260. package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -0
  261. package/dist/src/ui/components/messages/DiffRenderer.d.ts +15 -0
  262. package/dist/src/ui/components/messages/DiffRenderer.js +212 -0
  263. package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -0
  264. package/dist/src/ui/components/messages/ErrorMessage.d.ts +11 -0
  265. package/dist/src/ui/components/messages/ErrorMessage.js +9 -0
  266. package/dist/src/ui/components/messages/ErrorMessage.js.map +1 -0
  267. package/dist/src/ui/components/messages/GeminiMessage.d.ts +15 -0
  268. package/dist/src/ui/components/messages/GeminiMessage.js +10 -0
  269. package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -0
  270. package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +14 -0
  271. package/dist/src/ui/components/messages/GeminiMessageContent.js +15 -0
  272. package/dist/src/ui/components/messages/GeminiMessageContent.js.map +1 -0
  273. package/dist/src/ui/components/messages/InfoMessage.d.ts +11 -0
  274. package/dist/src/ui/components/messages/InfoMessage.js +9 -0
  275. package/dist/src/ui/components/messages/InfoMessage.js.map +1 -0
  276. package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +15 -0
  277. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +117 -0
  278. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -0
  279. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +18 -0
  280. package/dist/src/ui/components/messages/ToolGroupMessage.js +53 -0
  281. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -0
  282. package/dist/src/ui/components/messages/ToolMessage.d.ts +15 -0
  283. package/dist/src/ui/components/messages/ToolMessage.js +61 -0
  284. package/dist/src/ui/components/messages/ToolMessage.js.map +1 -0
  285. package/dist/src/ui/components/messages/UserMessage.d.ts +11 -0
  286. package/dist/src/ui/components/messages/UserMessage.js +9 -0
  287. package/dist/src/ui/components/messages/UserMessage.js.map +1 -0
  288. package/dist/src/ui/components/messages/UserShellMessage.d.ts +11 -0
  289. package/dist/src/ui/components/messages/UserShellMessage.js +9 -0
  290. package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -0
  291. package/dist/src/ui/components/shared/MaxSizedBox.d.ts +61 -0
  292. package/dist/src/ui/components/shared/MaxSizedBox.js +384 -0
  293. package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -0
  294. package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +44 -0
  295. package/dist/src/ui/components/shared/RadioButtonSelect.js +77 -0
  296. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -0
  297. package/dist/src/ui/components/shared/text-buffer.d.ts +184 -0
  298. package/dist/src/ui/components/shared/text-buffer.js +1021 -0
  299. package/dist/src/ui/components/shared/text-buffer.js.map +1 -0
  300. package/dist/src/ui/constants.d.ts +8 -0
  301. package/dist/src/ui/constants.js +12 -0
  302. package/dist/src/ui/constants.js.map +1 -0
  303. package/dist/src/ui/containers/SessionController.d.ts +26 -0
  304. package/dist/src/ui/containers/SessionController.js +314 -0
  305. package/dist/src/ui/containers/SessionController.js.map +1 -0
  306. package/dist/src/ui/containers/UIStateShell.d.ts +6 -0
  307. package/dist/src/ui/containers/UIStateShell.js +4 -0
  308. package/dist/src/ui/containers/UIStateShell.js.map +1 -0
  309. package/dist/src/ui/contexts/AppDispatchContext.d.ts +12 -0
  310. package/dist/src/ui/contexts/AppDispatchContext.js +17 -0
  311. package/dist/src/ui/contexts/AppDispatchContext.js.map +1 -0
  312. package/dist/src/ui/contexts/OpenAIProviderContext.d.ts +29 -0
  313. package/dist/src/ui/contexts/OpenAIProviderContext.js +63 -0
  314. package/dist/src/ui/contexts/OpenAIProviderContext.js.map +1 -0
  315. package/dist/src/ui/contexts/OverflowContext.d.ts +19 -0
  316. package/dist/src/ui/contexts/OverflowContext.js +43 -0
  317. package/dist/src/ui/contexts/OverflowContext.js.map +1 -0
  318. package/dist/src/ui/contexts/SessionContext.d.ts +36 -0
  319. package/dist/src/ui/contexts/SessionContext.js +66 -0
  320. package/dist/src/ui/contexts/SessionContext.js.map +1 -0
  321. package/dist/src/ui/contexts/SessionStateContext.d.ts +15 -0
  322. package/dist/src/ui/contexts/SessionStateContext.js +26 -0
  323. package/dist/src/ui/contexts/SessionStateContext.js.map +1 -0
  324. package/dist/src/ui/contexts/StreamingContext.d.ts +9 -0
  325. package/dist/src/ui/contexts/StreamingContext.js +15 -0
  326. package/dist/src/ui/contexts/StreamingContext.js.map +1 -0
  327. package/dist/src/ui/editors/editorSettingsManager.d.ts +19 -0
  328. package/dist/src/ui/editors/editorSettingsManager.js +54 -0
  329. package/dist/src/ui/editors/editorSettingsManager.js.map +1 -0
  330. package/dist/src/ui/hooks/atCommandProcessor.d.ts +31 -0
  331. package/dist/src/ui/hooks/atCommandProcessor.js +310 -0
  332. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -0
  333. package/dist/src/ui/hooks/index.d.ts +2 -0
  334. package/dist/src/ui/hooks/index.js +3 -0
  335. package/dist/src/ui/hooks/index.js.map +1 -0
  336. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +16 -0
  337. package/dist/src/ui/hooks/shellCommandProcessor.js +263 -0
  338. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -0
  339. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +27 -0
  340. package/dist/src/ui/hooks/slashCommandProcessor.js +1413 -0
  341. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -0
  342. package/dist/src/ui/hooks/useAuthCommand.d.ts +15 -0
  343. package/dist/src/ui/hooks/useAuthCommand.js +76 -0
  344. package/dist/src/ui/hooks/useAuthCommand.js.map +1 -0
  345. package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +10 -0
  346. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +37 -0
  347. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -0
  348. package/dist/src/ui/hooks/useBracketedPaste.d.ts +12 -0
  349. package/dist/src/ui/hooks/useBracketedPaste.js +32 -0
  350. package/dist/src/ui/hooks/useBracketedPaste.js.map +1 -0
  351. package/dist/src/ui/hooks/useCompletion.d.ts +21 -0
  352. package/dist/src/ui/hooks/useCompletion.js +375 -0
  353. package/dist/src/ui/hooks/useCompletion.js.map +1 -0
  354. package/dist/src/ui/hooks/useConsoleMessages.d.ts +12 -0
  355. package/dist/src/ui/hooks/useConsoleMessages.js +60 -0
  356. package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -0
  357. package/dist/src/ui/hooks/useEditorSettings.d.ts +17 -0
  358. package/dist/src/ui/hooks/useEditorSettings.js +48 -0
  359. package/dist/src/ui/hooks/useEditorSettings.js.map +1 -0
  360. package/dist/src/ui/hooks/useGeminiStream.d.ts +23 -0
  361. package/dist/src/ui/hooks/useGeminiStream.js +607 -0
  362. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -0
  363. package/dist/src/ui/hooks/useGitBranchName.d.ts +6 -0
  364. package/dist/src/ui/hooks/useGitBranchName.js +61 -0
  365. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -0
  366. package/dist/src/ui/hooks/useHistoryManager.d.ts +22 -0
  367. package/dist/src/ui/hooks/useHistoryManager.js +74 -0
  368. package/dist/src/ui/hooks/useHistoryManager.js.map +1 -0
  369. package/dist/src/ui/hooks/useInputHistory.d.ts +19 -0
  370. package/dist/src/ui/hooks/useInputHistory.js +84 -0
  371. package/dist/src/ui/hooks/useInputHistory.js.map +1 -0
  372. package/dist/src/ui/hooks/useKeypress.d.ts +29 -0
  373. package/dist/src/ui/hooks/useKeypress.js +162 -0
  374. package/dist/src/ui/hooks/useKeypress.js.map +1 -0
  375. package/dist/src/ui/hooks/useLoadingIndicator.d.ts +10 -0
  376. package/dist/src/ui/hooks/useLoadingIndicator.js +44 -0
  377. package/dist/src/ui/hooks/useLoadingIndicator.js.map +1 -0
  378. package/dist/src/ui/hooks/useLogger.d.ts +10 -0
  379. package/dist/src/ui/hooks/useLogger.js +29 -0
  380. package/dist/src/ui/hooks/useLogger.js.map +1 -0
  381. package/dist/src/ui/hooks/useOpenAIProviderInfo.d.ts +17 -0
  382. package/dist/src/ui/hooks/useOpenAIProviderInfo.js +43 -0
  383. package/dist/src/ui/hooks/useOpenAIProviderInfo.js.map +1 -0
  384. package/dist/src/ui/hooks/usePhraseCycler.d.ts +14 -0
  385. package/dist/src/ui/hooks/usePhraseCycler.js +197 -0
  386. package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -0
  387. package/dist/src/ui/hooks/usePrivacySettings.d.ts +16 -0
  388. package/dist/src/ui/hooks/usePrivacySettings.js +115 -0
  389. package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -0
  390. package/dist/src/ui/hooks/useProviderDialog.d.ts +25 -0
  391. package/dist/src/ui/hooks/useProviderDialog.js +61 -0
  392. package/dist/src/ui/hooks/useProviderDialog.js.map +1 -0
  393. package/dist/src/ui/hooks/useProviderModelDialog.d.ts +26 -0
  394. package/dist/src/ui/hooks/useProviderModelDialog.js +62 -0
  395. package/dist/src/ui/hooks/useProviderModelDialog.js.map +1 -0
  396. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +33 -0
  397. package/dist/src/ui/hooks/useReactToolScheduler.js +186 -0
  398. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -0
  399. package/dist/src/ui/hooks/useRefreshMemoryCommand.d.ts +6 -0
  400. package/dist/src/ui/hooks/useRefreshMemoryCommand.js +7 -0
  401. package/dist/src/ui/hooks/useRefreshMemoryCommand.js.map +1 -0
  402. package/dist/src/ui/hooks/useSession.d.ts +11 -0
  403. package/dist/src/ui/hooks/useSession.js +19 -0
  404. package/dist/src/ui/hooks/useSession.js.map +1 -0
  405. package/dist/src/ui/hooks/useShellHistory.d.ts +11 -0
  406. package/dist/src/ui/hooks/useShellHistory.js +89 -0
  407. package/dist/src/ui/hooks/useShellHistory.js.map +1 -0
  408. package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +9 -0
  409. package/dist/src/ui/hooks/useShowMemoryCommand.js +50 -0
  410. package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -0
  411. package/dist/src/ui/hooks/useStableCallback.d.ts +40 -0
  412. package/dist/src/ui/hooks/useStableCallback.js +58 -0
  413. package/dist/src/ui/hooks/useStableCallback.js.map +1 -0
  414. package/dist/src/ui/hooks/useStateAndRef.d.ts +7 -0
  415. package/dist/src/ui/hooks/useStateAndRef.js +26 -0
  416. package/dist/src/ui/hooks/useStateAndRef.js.map +1 -0
  417. package/dist/src/ui/hooks/useTerminalSize.d.ts +9 -0
  418. package/dist/src/ui/hooks/useTerminalSize.js +27 -0
  419. package/dist/src/ui/hooks/useTerminalSize.js.map +1 -0
  420. package/dist/src/ui/hooks/useThemeCommand.d.ts +16 -0
  421. package/dist/src/ui/hooks/useThemeCommand.js +94 -0
  422. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -0
  423. package/dist/src/ui/hooks/useTimer.d.ts +12 -0
  424. package/dist/src/ui/hooks/useTimer.js +58 -0
  425. package/dist/src/ui/hooks/useTimer.js.map +1 -0
  426. package/dist/src/ui/privacy/CloudFreePrivacyNotice.d.ts +12 -0
  427. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js +42 -0
  428. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js.map +1 -0
  429. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.d.ts +10 -0
  430. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js +17 -0
  431. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js.map +1 -0
  432. package/dist/src/ui/privacy/GeminiPrivacyNotice.d.ts +10 -0
  433. package/dist/src/ui/privacy/GeminiPrivacyNotice.js +17 -0
  434. package/dist/src/ui/privacy/GeminiPrivacyNotice.js.map +1 -0
  435. package/dist/src/ui/privacy/PrivacyNotice.d.ts +12 -0
  436. package/dist/src/ui/privacy/PrivacyNotice.js +25 -0
  437. package/dist/src/ui/privacy/PrivacyNotice.js.map +1 -0
  438. package/dist/src/ui/reducers/appReducer.d.ts +59 -0
  439. package/dist/src/ui/reducers/appReducer.js +91 -0
  440. package/dist/src/ui/reducers/appReducer.js.map +1 -0
  441. package/dist/src/ui/reducers/sessionReducer.d.ts +36 -0
  442. package/dist/src/ui/reducers/sessionReducer.js +30 -0
  443. package/dist/src/ui/reducers/sessionReducer.js.map +1 -0
  444. package/dist/src/ui/themes/ansi-light.d.ts +7 -0
  445. package/dist/src/ui/themes/ansi-light.js +139 -0
  446. package/dist/src/ui/themes/ansi-light.js.map +1 -0
  447. package/dist/src/ui/themes/ansi.d.ts +7 -0
  448. package/dist/src/ui/themes/ansi.js +149 -0
  449. package/dist/src/ui/themes/ansi.js.map +1 -0
  450. package/dist/src/ui/themes/atom-one-dark.d.ts +7 -0
  451. package/dist/src/ui/themes/atom-one-dark.js +136 -0
  452. package/dist/src/ui/themes/atom-one-dark.js.map +1 -0
  453. package/dist/src/ui/themes/ayu-light.d.ts +7 -0
  454. package/dist/src/ui/themes/ayu-light.js +128 -0
  455. package/dist/src/ui/themes/ayu-light.js.map +1 -0
  456. package/dist/src/ui/themes/ayu.d.ts +7 -0
  457. package/dist/src/ui/themes/ayu.js +102 -0
  458. package/dist/src/ui/themes/ayu.js.map +1 -0
  459. package/dist/src/ui/themes/default-light.d.ts +7 -0
  460. package/dist/src/ui/themes/default-light.js +100 -0
  461. package/dist/src/ui/themes/default-light.js.map +1 -0
  462. package/dist/src/ui/themes/default.d.ts +7 -0
  463. package/dist/src/ui/themes/default.js +143 -0
  464. package/dist/src/ui/themes/default.js.map +1 -0
  465. package/dist/src/ui/themes/dracula.d.ts +7 -0
  466. package/dist/src/ui/themes/dracula.js +113 -0
  467. package/dist/src/ui/themes/dracula.js.map +1 -0
  468. package/dist/src/ui/themes/github-dark.d.ts +7 -0
  469. package/dist/src/ui/themes/github-dark.js +136 -0
  470. package/dist/src/ui/themes/github-dark.js.map +1 -0
  471. package/dist/src/ui/themes/github-light.d.ts +7 -0
  472. package/dist/src/ui/themes/github-light.js +138 -0
  473. package/dist/src/ui/themes/github-light.js.map +1 -0
  474. package/dist/src/ui/themes/googlecode.d.ts +7 -0
  475. package/dist/src/ui/themes/googlecode.js +135 -0
  476. package/dist/src/ui/themes/googlecode.js.map +1 -0
  477. package/dist/src/ui/themes/green-screen.d.ts +7 -0
  478. package/dist/src/ui/themes/green-screen.js +113 -0
  479. package/dist/src/ui/themes/green-screen.js.map +1 -0
  480. package/dist/src/ui/themes/no-color.d.ts +7 -0
  481. package/dist/src/ui/themes/no-color.js +84 -0
  482. package/dist/src/ui/themes/no-color.js.map +1 -0
  483. package/dist/src/ui/themes/shades-of-purple.d.ts +11 -0
  484. package/dist/src/ui/themes/shades-of-purple.js +302 -0
  485. package/dist/src/ui/themes/shades-of-purple.js.map +1 -0
  486. package/dist/src/ui/themes/theme-manager.d.ts +33 -0
  487. package/dist/src/ui/themes/theme-manager.js +111 -0
  488. package/dist/src/ui/themes/theme-manager.js.map +1 -0
  489. package/dist/src/ui/themes/theme.d.ts +83 -0
  490. package/dist/src/ui/themes/theme.js +304 -0
  491. package/dist/src/ui/themes/theme.js.map +1 -0
  492. package/dist/src/ui/themes/xcode.d.ts +7 -0
  493. package/dist/src/ui/themes/xcode.js +143 -0
  494. package/dist/src/ui/themes/xcode.js.map +1 -0
  495. package/dist/src/ui/types.d.ts +174 -0
  496. package/dist/src/ui/types.js +43 -0
  497. package/dist/src/ui/types.js.map +1 -0
  498. package/dist/src/ui/utils/CodeColorizer.d.ts +14 -0
  499. package/dist/src/ui/utils/CodeColorizer.js +97 -0
  500. package/dist/src/ui/utils/CodeColorizer.js.map +1 -0
  501. package/dist/src/ui/utils/ConsolePatcher.d.ts +23 -0
  502. package/dist/src/ui/utils/ConsolePatcher.js +42 -0
  503. package/dist/src/ui/utils/ConsolePatcher.js.map +1 -0
  504. package/dist/src/ui/utils/InlineMarkdownRenderer.d.ts +16 -0
  505. package/dist/src/ui/utils/InlineMarkdownRenderer.js +104 -0
  506. package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -0
  507. package/dist/src/ui/utils/MarkdownDisplay.d.ts +14 -0
  508. package/dist/src/ui/utils/MarkdownDisplay.js +205 -0
  509. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -0
  510. package/dist/src/ui/utils/TableRenderer.d.ts +17 -0
  511. package/dist/src/ui/utils/TableRenderer.js +84 -0
  512. package/dist/src/ui/utils/TableRenderer.js.map +1 -0
  513. package/dist/src/ui/utils/clipboardUtils.d.ts +22 -0
  514. package/dist/src/ui/utils/clipboardUtils.js +127 -0
  515. package/dist/src/ui/utils/clipboardUtils.js.map +1 -0
  516. package/dist/src/ui/utils/commandUtils.d.ts +22 -0
  517. package/dist/src/ui/utils/commandUtils.js +25 -0
  518. package/dist/src/ui/utils/commandUtils.js.map +1 -0
  519. package/dist/src/ui/utils/computeStats.d.ts +10 -0
  520. package/dist/src/ui/utils/computeStats.js +55 -0
  521. package/dist/src/ui/utils/computeStats.js.map +1 -0
  522. package/dist/src/ui/utils/displayUtils.d.ts +17 -0
  523. package/dist/src/ui/utils/displayUtils.js +24 -0
  524. package/dist/src/ui/utils/displayUtils.js.map +1 -0
  525. package/dist/src/ui/utils/errorParsing.d.ts +7 -0
  526. package/dist/src/ui/utils/errorParsing.js +106 -0
  527. package/dist/src/ui/utils/errorParsing.js.map +1 -0
  528. package/dist/src/ui/utils/formatters.d.ts +13 -0
  529. package/dist/src/ui/utils/formatters.js +56 -0
  530. package/dist/src/ui/utils/formatters.js.map +1 -0
  531. package/dist/src/ui/utils/markdownUtilities.d.ts +6 -0
  532. package/dist/src/ui/utils/markdownUtilities.js +110 -0
  533. package/dist/src/ui/utils/markdownUtilities.js.map +1 -0
  534. package/dist/src/ui/utils/renderLoopDetector.d.ts +52 -0
  535. package/dist/src/ui/utils/renderLoopDetector.js +146 -0
  536. package/dist/src/ui/utils/renderLoopDetector.js.map +1 -0
  537. package/dist/src/ui/utils/textUtils.d.ts +22 -0
  538. package/dist/src/ui/utils/textUtils.js +58 -0
  539. package/dist/src/ui/utils/textUtils.js.map +1 -0
  540. package/dist/src/ui/utils/updateCheck.d.ts +6 -0
  541. package/dist/src/ui/utils/updateCheck.js +50 -0
  542. package/dist/src/ui/utils/updateCheck.js.map +1 -0
  543. package/dist/src/utils/ConversationContext.d.ts +55 -0
  544. package/dist/src/utils/ConversationContext.js +85 -0
  545. package/dist/src/utils/ConversationContext.js.map +1 -0
  546. package/dist/src/utils/cleanup.d.ts +8 -0
  547. package/dist/src/utils/cleanup.js +34 -0
  548. package/dist/src/utils/cleanup.js.map +1 -0
  549. package/dist/src/utils/package.d.ts +12 -0
  550. package/dist/src/utils/package.js +24 -0
  551. package/dist/src/utils/package.js.map +1 -0
  552. package/dist/src/utils/readStdin.d.ts +6 -0
  553. package/dist/src/utils/readStdin.js +34 -0
  554. package/dist/src/utils/readStdin.js.map +1 -0
  555. package/dist/src/utils/sandbox-macos-permissive-closed.sb +26 -0
  556. package/dist/src/utils/sandbox-macos-permissive-open.sb +19 -0
  557. package/dist/src/utils/sandbox-macos-permissive-proxied.sb +31 -0
  558. package/dist/src/utils/sandbox-macos-restrictive-closed.sb +87 -0
  559. package/dist/src/utils/sandbox-macos-restrictive-open.sb +90 -0
  560. package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +92 -0
  561. package/dist/src/utils/sandbox.d.ts +7 -0
  562. package/dist/src/utils/sandbox.js +680 -0
  563. package/dist/src/utils/sandbox.js.map +1 -0
  564. package/dist/src/utils/startupWarnings.d.ts +6 -0
  565. package/dist/src/utils/startupWarnings.js +40 -0
  566. package/dist/src/utils/startupWarnings.js.map +1 -0
  567. package/dist/src/utils/userStartupWarnings.d.ts +6 -0
  568. package/dist/src/utils/userStartupWarnings.js +48 -0
  569. package/dist/src/utils/userStartupWarnings.js.map +1 -0
  570. package/dist/src/utils/version.d.ts +6 -0
  571. package/dist/src/utils/version.js +11 -0
  572. package/dist/src/utils/version.js.map +1 -0
  573. package/dist/tsconfig.tsbuildinfo +1 -0
  574. package/dist/vybestack-llxprt-code-0.1.12.tgz +0 -0
  575. package/package.json +95 -0
@@ -0,0 +1,110 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /*
7
+ **Background & Purpose:**
8
+
9
+ The `findSafeSplitPoint` function is designed to address the challenge of displaying or processing large, potentially streaming, pieces of Markdown text. When content (e.g., from an LLM like Gemini) arrives in chunks or grows too large for a single display unit (like a message bubble), it needs to be split. A naive split (e.g., just at a character limit) can break Markdown formatting, especially critical for multi-line elements like code blocks, lists, or blockquotes, leading to incorrect rendering.
10
+
11
+ This function aims to find an *intelligent* or "safe" index within the provided `content` string at which to make such a split, prioritizing the preservation of Markdown integrity.
12
+
13
+ **Key Expectations & Behavior (Prioritized):**
14
+
15
+ 1. **No Split if Short Enough:**
16
+ * If `content.length` is less than or equal to `idealMaxLength`, the function should return `content.length` (indicating no split is necessary for length reasons).
17
+
18
+ 2. **Code Block Integrity (Highest Priority for Safety):**
19
+ * The function must try to avoid splitting *inside* a fenced code block (i.e., between ` ``` ` and ` ``` `).
20
+ * If `idealMaxLength` falls within a code block:
21
+ * The function will attempt to return an index that splits the content *before* the start of that code block.
22
+ * If a code block starts at the very beginning of the `content` and `idealMaxLength` falls within it (meaning the block itself is too long for the first chunk), the function might return `0`. This effectively makes the first chunk empty, pushing the entire oversized code block to the second part of the split.
23
+ * When considering splits near code blocks, the function prefers to keep the entire code block intact in one of the resulting chunks.
24
+
25
+ 3. **Markdown-Aware Newline Splitting (If Not Governed by Code Block Logic):**
26
+ * If `idealMaxLength` does not fall within a code block (or after code block considerations have been made), the function will look for natural break points by scanning backwards from `idealMaxLength`:
27
+ * **Paragraph Breaks:** It prioritizes splitting after a double newline (`\n\n`), as this typically signifies the end of a paragraph or a block-level element.
28
+ * **Single Line Breaks:** If no double newline is found in a suitable range, it will look for a single newline (`\n`).
29
+ * Any newline chosen as a split point must also not be inside a code block.
30
+
31
+ 4. **Fallback to `idealMaxLength`:**
32
+ * If no "safer" split point (respecting code blocks or finding suitable newlines) is identified before or at `idealMaxLength`, and `idealMaxLength` itself is not determined to be an unsafe split point (e.g., inside a code block), the function may return a length larger than `idealMaxLength`, again it CANNOT break markdown formatting. This could happen with very long lines of text without Markdown block structures or newlines.
33
+
34
+ **In essence, `findSafeSplitPoint` tries to be a good Markdown citizen when forced to divide content, preferring structural boundaries over arbitrary character limits, with a strong emphasis on not corrupting code blocks.**
35
+ */
36
+ /**
37
+ * Checks if a given character index within a string is inside a fenced (```) code block.
38
+ * @param content The full string content.
39
+ * @param indexToTest The character index to test.
40
+ * @returns True if the index is inside a code block's content, false otherwise.
41
+ */
42
+ const isIndexInsideCodeBlock = (content, indexToTest) => {
43
+ let fenceCount = 0;
44
+ let searchPos = 0;
45
+ while (searchPos < content.length) {
46
+ const nextFence = content.indexOf('```', searchPos);
47
+ if (nextFence === -1 || nextFence >= indexToTest) {
48
+ break;
49
+ }
50
+ fenceCount++;
51
+ searchPos = nextFence + 3;
52
+ }
53
+ return fenceCount % 2 === 1;
54
+ };
55
+ /**
56
+ * Finds the starting index of the code block that encloses the given index.
57
+ * Returns -1 if the index is not inside a code block.
58
+ * @param content The markdown content.
59
+ * @param index The index to check.
60
+ * @returns Start index of the enclosing code block or -1.
61
+ */
62
+ const findEnclosingCodeBlockStart = (content, index) => {
63
+ if (!isIndexInsideCodeBlock(content, index)) {
64
+ return -1;
65
+ }
66
+ let currentSearchPos = 0;
67
+ while (currentSearchPos < index) {
68
+ const blockStartIndex = content.indexOf('```', currentSearchPos);
69
+ if (blockStartIndex === -1 || blockStartIndex >= index) {
70
+ break;
71
+ }
72
+ const blockEndIndex = content.indexOf('```', blockStartIndex + 3);
73
+ if (blockStartIndex < index) {
74
+ if (blockEndIndex === -1 || index < blockEndIndex + 3) {
75
+ return blockStartIndex;
76
+ }
77
+ }
78
+ if (blockEndIndex === -1)
79
+ break;
80
+ currentSearchPos = blockEndIndex + 3;
81
+ }
82
+ return -1;
83
+ };
84
+ export const findLastSafeSplitPoint = (content) => {
85
+ const enclosingBlockStart = findEnclosingCodeBlockStart(content, content.length);
86
+ if (enclosingBlockStart !== -1) {
87
+ // The end of the content is contained in a code block. Split right before.
88
+ return enclosingBlockStart;
89
+ }
90
+ // Search for the last double newline (\n\n) not in a code block.
91
+ let searchStartIndex = content.length;
92
+ while (searchStartIndex >= 0) {
93
+ const dnlIndex = content.lastIndexOf('\n\n', searchStartIndex);
94
+ if (dnlIndex === -1) {
95
+ // No more double newlines found.
96
+ break;
97
+ }
98
+ const potentialSplitPoint = dnlIndex + 2;
99
+ if (!isIndexInsideCodeBlock(content, potentialSplitPoint)) {
100
+ return potentialSplitPoint;
101
+ }
102
+ // If potentialSplitPoint was inside a code block,
103
+ // the next search should start *before* the \n\n we just found to ensure progress.
104
+ searchStartIndex = dnlIndex - 1;
105
+ }
106
+ // If no safe double newline is found, return content.length
107
+ // to keep the entire content as one piece.
108
+ return content.length;
109
+ };
110
+ //# sourceMappingURL=markdownUtilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdownUtilities.js","sourceRoot":"","sources":["../../../../src/ui/utils/markdownUtilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BE;AAEF;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG,CAC7B,OAAe,EACf,WAAmB,EACV,EAAE;IACX,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,OAAO,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACpD,IAAI,SAAS,KAAK,CAAC,CAAC,IAAI,SAAS,IAAI,WAAW,EAAE,CAAC;YACjD,MAAM;QACR,CAAC;QACD,UAAU,EAAE,CAAC;QACb,SAAS,GAAG,SAAS,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,2BAA2B,GAAG,CAClC,OA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AgB,CAAC,CAAC;QAC/D,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;YACpB,iCAAiC;YACjC,MAAM;QACR,CAAC;QAED,MAAM,mBAAmB,GAAG,QAAQ,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CAAC;YAC1D,OAAO,mBAAmB,CAAC;QAC7B,CAAC;QAED,kDAAkD;QAClD,mFAAmF;QACnF,gBAAgB,GAAG,QAAQ,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,4DAA4D;IAC5D,2CAA2C;IAC3C,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Hook to detect potential render loops in development.
8
+ * Logs warnings when components render too frequently.
9
+ *
10
+ * @param componentName Name of the component for debugging
11
+ * @param props Optional props to log when loop detected
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * function MyComponent({ value }: Props) {
16
+ * useRenderLoopDetector('MyComponent', { value });
17
+ * // ... rest of component
18
+ * }
19
+ * ```
20
+ */
21
+ export declare function useRenderLoopDetector(componentName: string, props?: Record<string, unknown>): void;
22
+ /**
23
+ * Hook to track which props are causing re-renders.
24
+ * Logs when props change between renders.
25
+ *
26
+ * @param componentName Name of the component
27
+ * @param props Props to track
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * function MyComponent({ value, onChange }: Props) {
32
+ * useWhyDidYouRender('MyComponent', { value, onChange });
33
+ * // ... rest of component
34
+ * }
35
+ * ```
36
+ */
37
+ export declare function useWhyDidYouRender(componentName: string, props: Record<string, unknown>): void;
38
+ /**
39
+ * Get render statistics for all tracked components.
40
+ * Useful for debugging performance issues.
41
+ *
42
+ * @returns Object with render counts by component
43
+ */
44
+ export declare function getRenderStats(): Record<string, {
45
+ count: number;
46
+ recentCount: number;
47
+ }>;
48
+ /**
49
+ * Reset all render statistics.
50
+ * Useful when starting a new debugging session.
51
+ */
52
+ export declare function resetRenderStats(): void;
@@ -0,0 +1,146 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { useRef, useEffect } from 'react';
7
+ const renderCounts = new Map();
8
+ const RENDER_THRESHOLD = 50; // Consider it a loop if rendered more than 50 times
9
+ const TIME_WINDOW = 1000; // Within 1 second
10
+ const RAPID_RENDER_THRESHOLD = 10; // More than 10 renders
11
+ const RAPID_TIME_WINDOW = 100; // Within 100ms
12
+ /**
13
+ * Hook to detect potential render loops in development.
14
+ * Logs warnings when components render too frequently.
15
+ *
16
+ * @param componentName Name of the component for debugging
17
+ * @param props Optional props to log when loop detected
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * function MyComponent({ value }: Props) {
22
+ * useRenderLoopDetector('MyComponent', { value });
23
+ * // ... rest of component
24
+ * }
25
+ * ```
26
+ */
27
+ export function useRenderLoopDetector(componentName, props) {
28
+ const renderCountRef = useRef(0);
29
+ const renderTimesRef = useRef([]);
30
+ useEffect(() => {
31
+ if (process.env.NODE_ENV === 'production') {
32
+ return;
33
+ }
34
+ const now = Date.now();
35
+ renderCountRef.current += 1;
36
+ renderTimesRef.current.push(now);
37
+ // Update global tracking
38
+ const info = renderCounts.get(componentName) || {
39
+ count: 0,
40
+ lastRenderTime: now,
41
+ renderTimes: [],
42
+ };
43
+ info.count += 1;
44
+ info.lastRenderTime = now;
45
+ info.renderTimes.push(now);
46
+ // Keep only recent render times
47
+ const cutoffTime = now - TIME_WINDOW;
48
+ info.renderTimes = info.renderTimes.filter((time) => time > cutoffTime);
49
+ renderCounts.set(componentName, info);
50
+ // Check for render loops
51
+ const recentRenders = info.renderTimes.length;
52
+ const rapidRenders = info.renderTimes.filter((time) => time > now - RAPID_TIME_WINDOW).length;
53
+ if (rapidRenders > RAPID_RENDER_THRESHOLD) {
54
+ console.error(`🚨 RENDER LOOP DETECTED: ${componentName} rendered ${rapidRenders} times in ${RAPID_TIME_WINDOW}ms!`, '\nProps:', props, '\nTotal renders:', info.count, '\nConsider checking:', '\n- useEffect dependencies', '\n- State updates during render', '\n- Unmemoized props/callbacks', '\n- Inline object/array creation');
55
+ }
56
+ else if (recentRenders > RENDER_THRESHOLD) {
57
+ console.warn(`⚠️ High render count: ${componentName} rendered ${recentRenders} times in ${TIME_WINDOW}ms`, '\nProps:', props, '\nTotal renders:', info.count);
58
+ }
59
+ // Cleanup old entries periodically
60
+ if (renderCounts.size > 100) {
61
+ const oldestAllowed = now - 60000; // 1 minute
62
+ for (const [name, data] of renderCounts.entries()) {
63
+ if (data.lastRenderTime < oldestAllowed) {
64
+ renderCounts.delete(name);
65
+ }
66
+ }
67
+ }
68
+ });
69
+ }
70
+ /**
71
+ * Hook to track which props are causing re-renders.
72
+ * Logs when props change between renders.
73
+ *
74
+ * @param componentName Name of the component
75
+ * @param props Props to track
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * function MyComponent({ value, onChange }: Props) {
80
+ * useWhyDidYouRender('MyComponent', { value, onChange });
81
+ * // ... rest of component
82
+ * }
83
+ * ```
84
+ */
85
+ export function useWhyDidYouRender(componentName, props) {
86
+ const previousProps = useRef({});
87
+ useEffect(() => {
88
+ if (process.env.NODE_ENV === 'production') {
89
+ return;
90
+ }
91
+ if (previousProps.current) {
92
+ const allKeys = new Set([
93
+ ...Object.keys(previousProps.current),
94
+ ...Object.keys(props),
95
+ ]);
96
+ const changedProps = {};
97
+ for (const key of allKeys) {
98
+ const prevValue = previousProps.current[key];
99
+ const currentValue = props[key];
100
+ if (!Object.is(prevValue, currentValue)) {
101
+ changedProps[key] = {
102
+ from: prevValue,
103
+ to: currentValue,
104
+ };
105
+ }
106
+ }
107
+ if (Object.keys(changedProps).length > 0) {
108
+ console.log(`🔍 ${componentName} re-rendered due to prop changes:`, changedProps);
109
+ }
110
+ }
111
+ previousProps.current = props;
112
+ });
113
+ }
114
+ /**
115
+ * Get render statistics for all tracked components.
116
+ * Useful for debugging performance issues.
117
+ *
118
+ * @returns Object with render counts by component
119
+ */
120
+ export function getRenderStats() {
121
+ const stats = {};
122
+ const now = Date.now();
123
+ for (const [name, info] of renderCounts.entries()) {
124
+ const recentCount = info.renderTimes.filter((time) => time > now - TIME_WINDOW).length;
125
+ stats[name] = {
126
+ count: info.count,
127
+ recentCount,
128
+ };
129
+ }
130
+ return stats;
131
+ }
132
+ /**
133
+ * Reset all render statistics.
134
+ * Useful when starting a new debugging session.
135
+ */
136
+ export function resetRenderStats() {
137
+ renderCounts.clear();
138
+ }
139
+ // Export for console debugging
140
+ if (typeof window !== 'undefined' && process.env.NODE_ENV !== 'production') {
141
+ // Use global object for Node.js/CLI environment
142
+ const globalObj = typeof globalThis !== 'undefined' ? globalThis : global;
143
+ globalObj.__getRenderStats = getRenderStats;
144
+ globalObj.__resetRenderStats = resetRenderStats;
145
+ }
146
+ //# sourceMappingURL=renderLoopDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderLoopDetector.js","sourceRoot":"","sources":["../../../../src/ui/utils/renderLoopDetector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQ1C,MAAM,YAAY,GAAG,IAAI,GAAG,EAAsB,CAAC;AACnD,MAAM,gBAAgB,GAAG,EAAE,CAAC,CAAC,oDAAoD;AACjF,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,kBAAkB;AAC5C,MAAM,sBAAsB,GAAG,EAAE,CAAC,CAAC,uBAAuB;AAC1D,MAAM,iBAAiB,GAAG,GAAG,CAAC,CAAC,eAAe;AAE9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CACnC,aAAqB,EACrB,KAA+B;IAE/B,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACjC,MAA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AAE,CAAC;AACvB,CAAC;AAED,+BAA+B;AAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC3E,gDAAgD;IAChD,MAAM,SAAS,GAAG,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IACzE,SAAqC,CAAC,gBAAgB,GAAG,cAAc,CAAC;IACxE,SAAqC,CAAC,kBAAkB,GAAG,gBAAgB,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Calculates the maximum width of a multi-line ASCII art string.
8
+ * @param asciiArt The ASCII art string.
9
+ * @returns The length of the longest line in the ASCII art.
10
+ */
11
+ export declare const getAsciiArtWidth: (asciiArt: string) => number;
12
+ /**
13
+ * Checks if a Buffer is likely binary by testing for the presence of a NULL byte.
14
+ * The presence of a NULL byte is a strong indicator that the data is not plain text.
15
+ * @param data The Buffer to check.
16
+ * @param sampleSize The number of bytes from the start of the buffer to test.
17
+ * @returns True if a NULL byte is found, false otherwise.
18
+ */
19
+ export declare function isBinary(data: Buffer | null | undefined, sampleSize?: number): boolean;
20
+ export declare function toCodePoints(str: string): string[];
21
+ export declare function cpLen(str: string): number;
22
+ export declare function cpSlice(str: string, start: number, end?: number): string;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Calculates the maximum width of a multi-line ASCII art string.
8
+ * @param asciiArt The ASCII art string.
9
+ * @returns The length of the longest line in the ASCII art.
10
+ */
11
+ export const getAsciiArtWidth = (asciiArt) => {
12
+ if (!asciiArt) {
13
+ return 0;
14
+ }
15
+ const lines = asciiArt.split('\n');
16
+ return Math.max(...lines.map((line) => line.length));
17
+ };
18
+ /**
19
+ * Checks if a Buffer is likely binary by testing for the presence of a NULL byte.
20
+ * The presence of a NULL byte is a strong indicator that the data is not plain text.
21
+ * @param data The Buffer to check.
22
+ * @param sampleSize The number of bytes from the start of the buffer to test.
23
+ * @returns True if a NULL byte is found, false otherwise.
24
+ */
25
+ export function isBinary(data, sampleSize = 512) {
26
+ if (!data) {
27
+ return false;
28
+ }
29
+ const sample = data.length > sampleSize ? data.subarray(0, sampleSize) : data;
30
+ for (const byte of sample) {
31
+ // The presence of a NULL byte (0x00) is one of the most reliable
32
+ // indicators of a binary file. Text files should not contain them.
33
+ if (byte === 0) {
34
+ return true;
35
+ }
36
+ }
37
+ // If no NULL bytes were found in the sample, we assume it's text.
38
+ return false;
39
+ }
40
+ /*
41
+ * -------------------------------------------------------------------------
42
+ * Unicode‑aware helpers (work at the code‑point level rather than UTF‑16
43
+ * code units so that surrogate‑pair emoji count as one "column".)
44
+ * ---------------------------------------------------------------------- */
45
+ export function toCodePoints(str) {
46
+ // [...str] or Array.from both iterate by UTF‑32 code point, handling
47
+ // surrogate pairs correctly.
48
+ return Array.from(str);
49
+ }
50
+ export function cpLen(str) {
51
+ return toCodePoints(str).length;
52
+ }
53
+ export function cpSlice(str, start, end) {
54
+ // Slice by code‑point indices and re‑join.
55
+ const arr = toCodePoints(str).slice(start, end);
56
+ return arr.join('');
57
+ }
58
+ //# sourceMappingURL=textUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textUtils.js","sourceRoot":"","sources":["../../../../src/ui/utils/textUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,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-2.0
5
+ */
6
+ export declare function checkForUpdates(): Promise<string | null>;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import semver from 'semver';
7
+ import { getPackageJson } from '../../utils/package.js';
8
+ const UPDATE_CHECK_URL = 'https://raw.githubusercontent.com/acoliver/llxprt-code/main/package.json';
9
+ const UPDATE_CHECK_TIMEOUT_MS = 5000;
10
+ async function fetchWithTimeout(url, timeout) {
11
+ const controller = new AbortController();
12
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
13
+ try {
14
+ const response = await fetch(url, { signal: controller.signal });
15
+ return response;
16
+ }
17
+ catch (error) {
18
+ if (error instanceof Error && error.name === 'AbortError') {
19
+ throw new Error(`Request timed out after ${timeout}ms`);
20
+ }
21
+ throw error;
22
+ }
23
+ finally {
24
+ clearTimeout(timeoutId);
25
+ }
26
+ }
27
+ export async function checkForUpdates() {
28
+ try {
29
+ const packageJson = await getPackageJson();
30
+ if (!packageJson || !packageJson.name || !packageJson.version) {
31
+ return null;
32
+ }
33
+ const response = await fetchWithTimeout(UPDATE_CHECK_URL, UPDATE_CHECK_TIMEOUT_MS);
34
+ if (!response.ok) {
35
+ return null;
36
+ }
37
+ const latestPackageJson = await response.json();
38
+ if (latestPackageJson &&
39
+ latestPackageJson.version &&
40
+ semver.gt(latestPackageJson.version, packageJson.version)) {
41
+ return `LLxprt Code update available! ${packageJson.version} → ${latestPackageJson.version}\nRun npm install -g ${packageJson.name} to update`;
42
+ }
43
+ return null;
44
+ }
45
+ catch (e) {
46
+ console.warn('Failed to check for updates: ' + e);
47
+ return null;
48
+ }
49
+ }
50
+ //# sourceMappingURL=updateCheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateCheck.js","sourceRoot":"","sources":["../../../../src/ui/utils/updateCheck.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;A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EAAE,CAAC;QAEhD,IACE,iBAAiB;YACjB,iBAAiB,CAAC,OAAO;YACzB,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EACzD,CAAC;YACD,OAAO,iCAAiC,WAAW,CAAC,OAAO,MAAM,iBAAiB,CAAC,OAAO,wBAAwB,WAAW,CAAC,IAAI,YAAY,CAAC;QACjJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,+BAA+B,GAAG,CAAC,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright 2025 Vybestack LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface IConversationContext {
17
+ conversationId?: string;
18
+ parentId?: string;
19
+ }
20
+ /**
21
+ * Manages the state of the active conversation context for the CLI session.
22
+ * This is a singleton that holds the current conversationId and parentId.
23
+ */
24
+ declare class ConversationContextManager {
25
+ private context;
26
+ /**
27
+ * Generates a new, random conversation ID.
28
+ */
29
+ private generateConversationId;
30
+ /**
31
+ * Starts a new conversation, generating a new ID and clearing the parent ID.
32
+ */
33
+ startNewConversation(): void;
34
+ /**
35
+ * Retrieves the current conversation context.
36
+ * If no conversation is active, it starts a new one.
37
+ */
38
+ getContext(): IConversationContext;
39
+ /**
40
+ * Updates the parent ID for the next turn in the conversation.
41
+ * @param newParentId The ID of the most recent message, which becomes the parent for the next message.
42
+ */
43
+ setParentId(newParentId: string): void;
44
+ /**
45
+ * Restores the full conversation context, e.g., when loading a session.
46
+ * @param newContext The full context to restore.
47
+ */
48
+ setContext(newContext: IConversationContext): void;
49
+ /**
50
+ * Clears the current conversation context.
51
+ */
52
+ reset(): void;
53
+ }
54
+ export declare const ConversationContext: ConversationContextManager;
55
+ export {};
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Copyright 2025 Vybestack LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { randomBytes } from 'crypto';
17
+ /**
18
+ * Manages the state of the active conversation context for the CLI session.
19
+ * This is a singleton that holds the current conversationId and parentId.
20
+ */
21
+ class ConversationContextManager {
22
+ context = {};
23
+ /**
24
+ * Generates a new, random conversation ID.
25
+ */
26
+ generateConversationId() {
27
+ return `conv_${randomBytes(16).toString('hex')}`;
28
+ }
29
+ /**
30
+ * Starts a new conversation, generating a new ID and clearing the parent ID.
31
+ */
32
+ startNewConversation() {
33
+ this.context = {
34
+ conversationId: this.generateConversationId(),
35
+ parentId: undefined,
36
+ };
37
+ if (process.env.DEBUG) {
38
+ console.log(`[ConversationContext] Started new conversation: ${this.context.conversationId}`);
39
+ }
40
+ }
41
+ /**
42
+ * Retrieves the current conversation context.
43
+ * If no conversation is active, it starts a new one.
44
+ */
45
+ getContext() {
46
+ if (!this.context.conversationId) {
47
+ this.startNewConversation();
48
+ }
49
+ return this.context;
50
+ }
51
+ /**
52
+ * Updates the parent ID for the next turn in the conversation.
53
+ * @param newParentId The ID of the most recent message, which becomes the parent for the next message.
54
+ */
55
+ setParentId(newParentId) {
56
+ if (this.context.conversationId) {
57
+ this.context.parentId = newParentId;
58
+ if (process.env.DEBUG) {
59
+ console.log(`[ConversationContext] Set parentId to: ${newParentId}`);
60
+ }
61
+ }
62
+ else {
63
+ console.warn('[ConversationContext] Cannot set parentId without an active conversation.');
64
+ }
65
+ }
66
+ /**
67
+ * Restores the full conversation context, e.g., when loading a session.
68
+ * @param newContext The full context to restore.
69
+ */
70
+ setContext(newContext) {
71
+ this.context = newContext;
72
+ if (process.env.DEBUG) {
73
+ console.log(`[ConversationContext] Restored context: convId=${newContext.conversationId}, parentId=${newContext.parentId}`);
74
+ }
75
+ }
76
+ /**
77
+ * Clears the current conversation context.
78
+ */
79
+ reset() {
80
+ this.context = {};
81
+ }
82
+ }
83
+ // Export a singleton instance.
84
+ export const ConversationContext = new ConversationContextManager();
85
+ //# sourceMappingURL=ConversationContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConversationContext.js","sourceRoot":"","sources":["../../../src/utils/ConversationContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAOrC;;;GAGG;AACH,MAAM,0BAA0B;IACtB,OAAO,GAAyB,EAAE,CAAC;IAE3C;;OAEG;IACK,sBAAsB;QAC5B,OAAO,QAAQ,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,oBAAoB;QAClB,IAAI,CAAC,OAAO,GAAG;YACb,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAAE;YAC7C,QAAQ,EAAE,SAAS;SACpB,CAAC;QACF,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CACT,mDAAmD,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CACjF,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;YACjC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,WAAmB;QAC7B,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC;YACpC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,0CAA0C,WAAW,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CACV,2EAA2E,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,UAAgC;QACzC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;QAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CACT,kDAAkD,UAAU,CAAC,cAAc,cAAc,UAAU,CAAC,QAAQ,EAAE,CAC/G,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;CACF;AAED,+BAA+B;AAC/B,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,0BAA0B,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export declare function registerCleanup(fn: () => void): void;
7
+ export declare function runExitCleanup(): void;
8
+ export declare function cleanupCheckpoints(): Promise<void>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { promises as fs } from 'fs';
7
+ import { join } from 'path';
8
+ import { getProjectTempDir } from '@vybestack/llxprt-code-core';
9
+ const cleanupFunctions = [];
10
+ export function registerCleanup(fn) {
11
+ cleanupFunctions.push(fn);
12
+ }
13
+ export function runExitCleanup() {
14
+ for (const fn of cleanupFunctions) {
15
+ try {
16
+ fn();
17
+ }
18
+ catch (_) {
19
+ // Ignore errors during cleanup.
20
+ }
21
+ }
22
+ cleanupFunctions.length = 0; // Clear the array
23
+ }
24
+ export async function cleanupCheckpoints() {
25
+ const tempDir = getProjectTempDir(process.cwd());
26
+ const checkpointsDir = join(tempDir, 'checkpoints');
27
+ try {
28
+ await fs.rm(checkpointsDir, { recursive: true, force: true });
29
+ }
30
+ catch {
31
+ // Ignore errors if the directory doesn't exist or fails to delete.
32
+ }
33
+ }
34
+ //# sourceMappingURL=cleanup.js.map