@machina.ai/cell-cli 1.0.21-rc4 → 1.2.2-rc1

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 (556) hide show
  1. package/dist/index.js +9 -0
  2. package/dist/index.js.map +1 -1
  3. package/dist/package.json +7 -8
  4. package/dist/src/commands/extensions/disable.d.ts +14 -0
  5. package/dist/src/commands/extensions/disable.js +42 -0
  6. package/dist/src/commands/extensions/disable.js.map +1 -0
  7. package/dist/src/commands/extensions/enable.d.ts +14 -0
  8. package/dist/src/commands/extensions/enable.js +48 -0
  9. package/dist/src/commands/extensions/enable.js.map +1 -0
  10. package/dist/src/commands/extensions/install.d.ts +13 -0
  11. package/dist/src/commands/extensions/install.js +48 -0
  12. package/dist/src/commands/extensions/install.js.map +1 -0
  13. package/dist/src/commands/extensions/install.test.d.ts +6 -0
  14. package/dist/src/commands/extensions/install.test.js +19 -0
  15. package/dist/src/commands/extensions/install.test.js.map +1 -0
  16. package/dist/src/commands/extensions/list.d.ts +8 -0
  17. package/dist/src/commands/extensions/list.js +32 -0
  18. package/dist/src/commands/extensions/list.js.map +1 -0
  19. package/dist/src/commands/extensions/uninstall.d.ts +12 -0
  20. package/dist/src/commands/extensions/uninstall.js +38 -0
  21. package/dist/src/commands/extensions/uninstall.js.map +1 -0
  22. package/dist/src/commands/extensions/uninstall.test.d.ts +6 -0
  23. package/dist/src/commands/extensions/uninstall.test.js +15 -0
  24. package/dist/src/commands/extensions/uninstall.test.js.map +1 -0
  25. package/dist/src/commands/extensions/update.d.ts +13 -0
  26. package/dist/src/commands/extensions/update.js +60 -0
  27. package/dist/src/commands/extensions/update.js.map +1 -0
  28. package/dist/src/commands/extensions.d.ts +7 -0
  29. package/dist/src/commands/extensions.js +29 -0
  30. package/dist/src/commands/extensions.js.map +1 -0
  31. package/dist/src/commands/mcp/list.js +1 -1
  32. package/dist/src/commands/mcp/list.js.map +1 -1
  33. package/dist/src/config/auth.js +2 -2
  34. package/dist/src/config/auth.js.map +1 -1
  35. package/dist/src/config/auth.test.js +4 -3
  36. package/dist/src/config/auth.test.js.map +1 -1
  37. package/dist/src/config/config.d.ts +10 -7
  38. package/dist/src/config/config.js +95 -56
  39. package/dist/src/config/config.js.map +1 -1
  40. package/dist/src/config/extension.d.ts +42 -2
  41. package/dist/src/config/extension.js +285 -15
  42. package/dist/src/config/extension.js.map +1 -1
  43. package/dist/src/config/extensions/variableSchema.d.ts +28 -0
  44. package/dist/src/config/extensions/variableSchema.js +18 -0
  45. package/dist/src/config/extensions/variableSchema.js.map +1 -0
  46. package/dist/src/config/extensions/variables.d.ts +17 -0
  47. package/dist/src/config/extensions/variables.js +40 -0
  48. package/dist/src/config/extensions/variables.js.map +1 -0
  49. package/dist/src/config/extensions/variables.test.d.ts +6 -0
  50. package/dist/src/config/extensions/variables.test.js +17 -0
  51. package/dist/src/config/extensions/variables.test.js.map +1 -0
  52. package/dist/src/config/keyBindings.test.js +1 -1
  53. package/dist/src/config/keyBindings.test.js.map +1 -1
  54. package/dist/src/config/sandboxConfig.d.ts +2 -2
  55. package/dist/src/config/sandboxConfig.js +5 -7
  56. package/dist/src/config/sandboxConfig.js.map +1 -1
  57. package/dist/src/config/settings.d.ts +13 -7
  58. package/dist/src/config/settings.js +375 -119
  59. package/dist/src/config/settings.js.map +1 -1
  60. package/dist/src/config/settingsSchema.d.ts +654 -338
  61. package/dist/src/config/settingsSchema.js +649 -333
  62. package/dist/src/config/settingsSchema.js.map +1 -1
  63. package/dist/src/config/settingsSchema.test.js +87 -89
  64. package/dist/src/config/settingsSchema.test.js.map +1 -1
  65. package/dist/src/config/trustedFolders.d.ts +14 -4
  66. package/dist/src/config/trustedFolders.js +53 -41
  67. package/dist/src/config/trustedFolders.js.map +1 -1
  68. package/dist/src/config/trustedFolders.test.js +43 -5
  69. package/dist/src/config/trustedFolders.test.js.map +1 -1
  70. package/dist/src/gemini.d.ts +3 -1
  71. package/dist/src/gemini.js +115 -50
  72. package/dist/src/gemini.js.map +1 -1
  73. package/dist/src/gemini.test.js +79 -25
  74. package/dist/src/gemini.test.js.map +1 -1
  75. package/dist/src/generated/git-commit.d.ts +2 -2
  76. package/dist/src/generated/git-commit.js +2 -2
  77. package/dist/src/generated/git-commit.js.map +1 -1
  78. package/dist/src/nonInteractiveCli.d.ts +1 -1
  79. package/dist/src/nonInteractiveCli.js +25 -37
  80. package/dist/src/nonInteractiveCli.js.map +1 -1
  81. package/dist/src/services/BuiltinCommandLoader.d.ts +3 -3
  82. package/dist/src/services/CommandService.d.ts +2 -2
  83. package/dist/src/services/CommandService.test.js +1 -0
  84. package/dist/src/services/CommandService.test.js.map +1 -1
  85. package/dist/src/services/FileCommandLoader.d.ts +5 -3
  86. package/dist/src/services/FileCommandLoader.js +33 -16
  87. package/dist/src/services/FileCommandLoader.js.map +1 -1
  88. package/dist/src/services/McpPromptLoader.d.ts +14 -4
  89. package/dist/src/services/McpPromptLoader.js +43 -17
  90. package/dist/src/services/McpPromptLoader.js.map +1 -1
  91. package/dist/src/services/McpPromptLoader.test.d.ts +6 -0
  92. package/dist/src/services/McpPromptLoader.test.js +114 -0
  93. package/dist/src/services/McpPromptLoader.test.js.map +1 -0
  94. package/dist/src/services/prompt-processors/argumentProcessor.d.ts +3 -3
  95. package/dist/src/services/prompt-processors/argumentProcessor.js +3 -2
  96. package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -1
  97. package/dist/src/services/prompt-processors/atFileProcessor.d.ts +12 -0
  98. package/dist/src/services/prompt-processors/atFileProcessor.js +62 -0
  99. package/dist/src/services/prompt-processors/atFileProcessor.js.map +1 -0
  100. package/dist/src/services/prompt-processors/atFileProcessor.test.d.ts +6 -0
  101. package/dist/src/services/prompt-processors/atFileProcessor.test.js +174 -0
  102. package/dist/src/services/prompt-processors/atFileProcessor.test.js.map +1 -0
  103. package/dist/src/services/prompt-processors/injectionParser.d.ts +29 -0
  104. package/dist/src/services/prompt-processors/injectionParser.js +60 -0
  105. package/dist/src/services/prompt-processors/injectionParser.js.map +1 -0
  106. package/dist/src/services/prompt-processors/injectionParser.test.d.ts +6 -0
  107. package/dist/src/services/prompt-processors/injectionParser.test.js +189 -0
  108. package/dist/src/services/prompt-processors/injectionParser.test.js.map +1 -0
  109. package/dist/src/services/prompt-processors/shellProcessor.d.ts +4 -12
  110. package/dist/src/services/prompt-processors/shellProcessor.js +19 -68
  111. package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -1
  112. package/dist/src/services/prompt-processors/types.d.ts +13 -8
  113. package/dist/src/services/prompt-processors/types.js +4 -0
  114. package/dist/src/services/prompt-processors/types.js.map +1 -1
  115. package/dist/src/services/types.d.ts +1 -1
  116. package/dist/src/test-utils/customMatchers.js +0 -6
  117. package/dist/src/test-utils/customMatchers.js.map +1 -1
  118. package/dist/src/test-utils/mockCommandContext.d.ts +1 -1
  119. package/dist/src/test-utils/render.d.ts +1 -1
  120. package/dist/src/ui/App.d.ts +2 -2
  121. package/dist/src/ui/App.js +124 -66
  122. package/dist/src/ui/App.js.map +1 -1
  123. package/dist/src/ui/IdeIntegrationNudge.d.ts +1 -1
  124. package/dist/src/ui/IdeIntegrationNudge.js +2 -7
  125. package/dist/src/ui/IdeIntegrationNudge.js.map +1 -1
  126. package/dist/src/ui/colors.d.ts +1 -1
  127. package/dist/src/ui/commands/aboutCommand.d.ts +1 -1
  128. package/dist/src/ui/commands/aboutCommand.js +1 -1
  129. package/dist/src/ui/commands/aboutCommand.js.map +1 -1
  130. package/dist/src/ui/commands/authCommand.d.ts +1 -1
  131. package/dist/src/ui/commands/authCommand.js.map +1 -1
  132. package/dist/src/ui/commands/chatCommand.d.ts +1 -1
  133. package/dist/src/ui/commands/chatCommand.js +5 -4
  134. package/dist/src/ui/commands/chatCommand.js.map +1 -1
  135. package/dist/src/ui/commands/clearCommand.d.ts +1 -1
  136. package/dist/src/ui/commands/clearCommand.js.map +1 -1
  137. package/dist/src/ui/commands/compressCommand.d.ts +1 -1
  138. package/dist/src/ui/commands/compressCommand.js +2 -0
  139. package/dist/src/ui/commands/compressCommand.js.map +1 -1
  140. package/dist/src/ui/commands/copyCommand.d.ts +1 -1
  141. package/dist/src/ui/commands/copyCommand.js +2 -2
  142. package/dist/src/ui/commands/copyCommand.js.map +1 -1
  143. package/dist/src/ui/commands/directoryCommand.d.ts +1 -1
  144. package/dist/src/ui/commands/directoryCommand.js +5 -4
  145. package/dist/src/ui/commands/directoryCommand.js.map +1 -1
  146. package/dist/src/ui/commands/helpCommand.d.ts +1 -1
  147. package/dist/src/ui/commands/helpCommand.js.map +1 -1
  148. package/dist/src/ui/commands/ideCommand.d.ts +2 -2
  149. package/dist/src/ui/commands/ideCommand.js +31 -12
  150. package/dist/src/ui/commands/ideCommand.js.map +1 -1
  151. package/dist/src/ui/commands/initCommand.d.ts +1 -1
  152. package/dist/src/ui/commands/initCommand.js +3 -3
  153. package/dist/src/ui/commands/initCommand.js.map +1 -1
  154. package/dist/src/ui/commands/mcpCommand.d.ts +1 -1
  155. package/dist/src/ui/commands/mcpCommand.js +4 -4
  156. package/dist/src/ui/commands/mcpCommand.js.map +1 -1
  157. package/dist/src/ui/commands/memoryCommand.d.ts +1 -1
  158. package/dist/src/ui/commands/memoryCommand.js +4 -3
  159. package/dist/src/ui/commands/memoryCommand.js.map +1 -1
  160. package/dist/src/ui/commands/privacyCommand.d.ts +1 -1
  161. package/dist/src/ui/commands/privacyCommand.js.map +1 -1
  162. package/dist/src/ui/commands/restoreCommand.d.ts +1 -1
  163. package/dist/src/ui/commands/restoreCommand.js +5 -9
  164. package/dist/src/ui/commands/restoreCommand.js.map +1 -1
  165. package/dist/src/ui/commands/settingsCommand.d.ts +1 -1
  166. package/dist/src/ui/commands/settingsCommand.js.map +1 -1
  167. package/dist/src/ui/commands/setupGithubCommand.d.ts +3 -1
  168. package/dist/src/ui/commands/setupGithubCommand.js +48 -9
  169. package/dist/src/ui/commands/setupGithubCommand.js.map +1 -1
  170. package/dist/src/ui/commands/setupGithubCommand.test.js +100 -7
  171. package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -1
  172. package/dist/src/ui/commands/statsCommand.js.map +1 -1
  173. package/dist/src/ui/commands/terminalSetupCommand.d.ts +1 -1
  174. package/dist/src/ui/commands/terminalSetupCommand.js.map +1 -1
  175. package/dist/src/ui/commands/themeCommand.d.ts +1 -1
  176. package/dist/src/ui/commands/themeCommand.js.map +1 -1
  177. package/dist/src/ui/commands/toolsCommand.js +2 -2
  178. package/dist/src/ui/commands/toolsCommand.js.map +1 -1
  179. package/dist/src/ui/commands/types.d.ts +7 -8
  180. package/dist/src/ui/commands/types.js +1 -0
  181. package/dist/src/ui/commands/types.js.map +1 -1
  182. package/dist/src/ui/commands/vimCommand.d.ts +1 -1
  183. package/dist/src/ui/commands/vimCommand.js.map +1 -1
  184. package/dist/src/ui/components/AboutBox.d.ts +1 -1
  185. package/dist/src/ui/components/AsciiArt.d.ts +3 -3
  186. package/dist/src/ui/components/AsciiArt.js +3 -3
  187. package/dist/src/ui/components/AuthDialog.d.ts +3 -2
  188. package/dist/src/ui/components/AuthDialog.js +7 -7
  189. package/dist/src/ui/components/AuthDialog.js.map +1 -1
  190. package/dist/src/ui/components/AuthDialog.test.js +36 -18
  191. package/dist/src/ui/components/AuthDialog.test.js.map +1 -1
  192. package/dist/src/ui/components/AuthInProgress.d.ts +1 -1
  193. package/dist/src/ui/components/AuthInProgress.js +0 -5
  194. package/dist/src/ui/components/AuthInProgress.js.map +1 -1
  195. package/dist/src/ui/components/AutoAcceptIndicator.d.ts +1 -1
  196. package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +1 -1
  197. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +1 -1
  198. package/dist/src/ui/components/ContextSummaryDisplay.js +1 -0
  199. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
  200. package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +2 -2
  201. package/dist/src/ui/components/DetailedMessagesDisplay.js +1 -1
  202. package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -1
  203. package/dist/src/ui/components/EditorSettingsDialog.d.ts +4 -3
  204. package/dist/src/ui/components/EditorSettingsDialog.js +8 -11
  205. package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
  206. package/dist/src/ui/components/FolderTrustDialog.d.ts +2 -1
  207. package/dist/src/ui/components/FolderTrustDialog.js +13 -5
  208. package/dist/src/ui/components/FolderTrustDialog.js.map +1 -1
  209. package/dist/src/ui/components/FolderTrustDialog.test.js +55 -3
  210. package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
  211. package/dist/src/ui/components/Footer.d.ts +1 -1
  212. package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +1 -1
  213. package/dist/src/ui/components/GeminiRespondingSpinner.js +5 -3
  214. package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -1
  215. package/dist/src/ui/components/Header.d.ts +1 -1
  216. package/dist/src/ui/components/Help.d.ts +2 -2
  217. package/dist/src/ui/components/Help.js +1 -1
  218. package/dist/src/ui/components/Help.js.map +1 -1
  219. package/dist/src/ui/components/HistoryItemDisplay.d.ts +4 -4
  220. package/dist/src/ui/components/HistoryItemDisplay.test.js +2 -0
  221. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -1
  222. package/dist/src/ui/components/InputPrompt.d.ts +5 -5
  223. package/dist/src/ui/components/InputPrompt.js +142 -20
  224. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  225. package/dist/src/ui/components/LoadingIndicator.d.ts +2 -2
  226. package/dist/src/ui/components/MemoryUsageDisplay.d.ts +1 -1
  227. package/dist/src/ui/components/MemoryUsageDisplay.js +0 -5
  228. package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -1
  229. package/dist/src/ui/components/ModelStatsDisplay.d.ts +1 -1
  230. package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -1
  231. package/dist/src/ui/components/PrepareLabel.d.ts +1 -1
  232. package/dist/src/ui/components/ProQuotaDialog.d.ts +13 -0
  233. package/dist/src/ui/components/ProQuotaDialog.js +21 -0
  234. package/dist/src/ui/components/ProQuotaDialog.js.map +1 -0
  235. package/dist/src/ui/components/ProQuotaDialog.test.d.ts +6 -0
  236. package/dist/src/ui/components/ProQuotaDialog.test.js +56 -0
  237. package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -0
  238. package/dist/src/ui/components/SessionSummaryDisplay.d.ts +1 -1
  239. package/dist/src/ui/components/SettingsDialog.d.ts +2 -1
  240. package/dist/src/ui/components/SettingsDialog.js +67 -36
  241. package/dist/src/ui/components/SettingsDialog.js.map +1 -1
  242. package/dist/src/ui/components/SettingsDialog.test.js +134 -56
  243. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
  244. package/dist/src/ui/components/ShellConfirmationDialog.d.ts +1 -1
  245. package/dist/src/ui/components/ShellConfirmationDialog.js +1 -1
  246. package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
  247. package/dist/src/ui/components/ShellModeIndicator.d.ts +1 -1
  248. package/dist/src/ui/components/StatsDisplay.d.ts +1 -1
  249. package/dist/src/ui/components/StatsDisplay.js +3 -3
  250. package/dist/src/ui/components/StatsDisplay.js.map +1 -1
  251. package/dist/src/ui/components/SuggestionsDisplay.js +12 -4
  252. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
  253. package/dist/src/ui/components/ThemeDialog.d.ts +3 -2
  254. package/dist/src/ui/components/ThemeDialog.js +5 -10
  255. package/dist/src/ui/components/ThemeDialog.js.map +1 -1
  256. package/dist/src/ui/components/Tips.d.ts +1 -1
  257. package/dist/src/ui/components/Tips.js +1 -0
  258. package/dist/src/ui/components/Tips.js.map +1 -1
  259. package/dist/src/ui/components/ToolStatsDisplay.d.ts +1 -1
  260. package/dist/src/ui/components/WorkspaceMigrationDialog.d.ts +11 -0
  261. package/dist/src/ui/components/WorkspaceMigrationDialog.js +42 -0
  262. package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +1 -0
  263. package/dist/src/ui/components/messages/CompressionMessage.d.ts +2 -2
  264. package/dist/src/ui/components/messages/CompressionMessage.js +2 -1
  265. package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -1
  266. package/dist/src/ui/components/messages/DiffRenderer.d.ts +1 -1
  267. package/dist/src/ui/components/messages/DiffRenderer.js +6 -2
  268. package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
  269. package/dist/src/ui/components/messages/ErrorMessage.d.ts +1 -1
  270. package/dist/src/ui/components/messages/GeminiMessage.d.ts +1 -1
  271. package/dist/src/ui/components/messages/GeminiMessage.js +2 -1
  272. package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -1
  273. package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +1 -1
  274. package/dist/src/ui/components/messages/InfoMessage.d.ts +1 -1
  275. package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +3 -3
  276. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +41 -24
  277. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
  278. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +79 -2
  279. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -1
  280. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +4 -4
  281. package/dist/src/ui/components/messages/ToolGroupMessage.js +1 -6
  282. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
  283. package/dist/src/ui/components/messages/ToolGroupMessage.test.d.ts +6 -0
  284. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +259 -0
  285. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -0
  286. package/dist/src/ui/components/messages/ToolMessage.d.ts +1 -1
  287. package/dist/src/ui/components/messages/ToolMessage.js +2 -1
  288. package/dist/src/ui/components/messages/ToolMessage.js.map +1 -1
  289. package/dist/src/ui/components/messages/ToolMessage.test.js +6 -6
  290. package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -1
  291. package/dist/src/ui/components/messages/UserMessage.d.ts +1 -1
  292. package/dist/src/ui/components/messages/UserMessage.js +4 -2
  293. package/dist/src/ui/components/messages/UserMessage.js.map +1 -1
  294. package/dist/src/ui/components/messages/UserShellMessage.d.ts +1 -1
  295. package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -1
  296. package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +1 -1
  297. package/dist/src/ui/components/shared/RadioButtonSelect.js +1 -6
  298. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
  299. package/dist/src/ui/components/shared/text-buffer.js +5 -49
  300. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  301. package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +1 -1
  302. package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -1
  303. package/dist/src/ui/constants.d.ts +8 -0
  304. package/dist/src/ui/constants.js +9 -0
  305. package/dist/src/ui/constants.js.map +1 -1
  306. package/dist/src/ui/contexts/KeypressContext.d.ts +4 -3
  307. package/dist/src/ui/contexts/KeypressContext.js +34 -25
  308. package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
  309. package/dist/src/ui/contexts/KeypressContext.test.js +176 -10
  310. package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
  311. package/dist/src/ui/contexts/OverflowContext.d.ts +1 -1
  312. package/dist/src/ui/contexts/OverflowContext.js +0 -5
  313. package/dist/src/ui/contexts/OverflowContext.js.map +1 -1
  314. package/dist/src/ui/contexts/SessionContext.d.ts +2 -2
  315. package/dist/src/ui/contexts/SessionContext.js +1 -6
  316. package/dist/src/ui/contexts/SessionContext.js.map +1 -1
  317. package/dist/src/ui/contexts/SettingsContext.d.ts +1 -1
  318. package/dist/src/ui/contexts/StreamingContext.d.ts +1 -1
  319. package/dist/src/ui/contexts/VimModeContext.d.ts +1 -1
  320. package/dist/src/ui/contexts/VimModeContext.js +4 -4
  321. package/dist/src/ui/contexts/VimModeContext.js.map +1 -1
  322. package/dist/src/ui/hooks/atCommandProcessor.d.ts +3 -3
  323. package/dist/src/ui/hooks/atCommandProcessor.js +4 -7
  324. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
  325. package/dist/src/ui/hooks/atCommandProcessor.test.js +33 -10
  326. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
  327. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +3 -3
  328. package/dist/src/ui/hooks/shellCommandProcessor.js +15 -19
  329. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
  330. package/dist/src/ui/hooks/shellCommandProcessor.test.js +16 -19
  331. package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
  332. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +5 -4
  333. package/dist/src/ui/hooks/slashCommandProcessor.js +8 -6
  334. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  335. package/dist/src/ui/hooks/useAtCompletion.d.ts +2 -2
  336. package/dist/src/ui/hooks/useAtCompletion.js +3 -2
  337. package/dist/src/ui/hooks/useAtCompletion.js.map +1 -1
  338. package/dist/src/ui/hooks/useAuthCommand.d.ts +2 -2
  339. package/dist/src/ui/hooks/useAuthCommand.js +5 -4
  340. package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
  341. package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +3 -1
  342. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +13 -4
  343. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -1
  344. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +122 -2
  345. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -1
  346. package/dist/src/ui/hooks/useCommandCompletion.d.ts +8 -5
  347. package/dist/src/ui/hooks/useCommandCompletion.js +30 -9
  348. package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -1
  349. package/dist/src/ui/hooks/useCompletion.d.ts +1 -1
  350. package/dist/src/ui/hooks/useCompletion.js +1 -1
  351. package/dist/src/ui/hooks/useCompletion.js.map +1 -1
  352. package/dist/src/ui/hooks/useConsoleMessages.d.ts +1 -1
  353. package/dist/src/ui/hooks/useEditorSettings.d.ts +2 -2
  354. package/dist/src/ui/hooks/useEditorSettings.js.map +1 -1
  355. package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -1
  356. package/dist/src/ui/hooks/useFolderTrust.d.ts +2 -1
  357. package/dist/src/ui/hooks/useFolderTrust.js +25 -12
  358. package/dist/src/ui/hooks/useFolderTrust.js.map +1 -1
  359. package/dist/src/ui/hooks/useGeminiStream.d.ts +6 -5
  360. package/dist/src/ui/hooks/useGeminiStream.js +66 -45
  361. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  362. package/dist/src/ui/hooks/useGitBranchName.js +1 -1
  363. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -1
  364. package/dist/src/ui/hooks/useGitBranchName.test.js +1 -1
  365. package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
  366. package/dist/src/ui/hooks/useHistoryManager.d.ts +1 -1
  367. package/dist/src/ui/hooks/useInputHistoryStore.d.ts +19 -0
  368. package/dist/src/ui/hooks/useInputHistoryStore.js +81 -0
  369. package/dist/src/ui/hooks/useInputHistoryStore.js.map +1 -0
  370. package/dist/src/ui/hooks/useInputHistoryStore.test.d.ts +6 -0
  371. package/dist/src/ui/hooks/useInputHistoryStore.test.js +234 -0
  372. package/dist/src/ui/hooks/useInputHistoryStore.test.js.map +1 -0
  373. package/dist/src/ui/hooks/useKeypress.d.ts +2 -2
  374. package/dist/src/ui/hooks/useKeypress.js +1 -1
  375. package/dist/src/ui/hooks/useKeypress.js.map +1 -1
  376. package/dist/src/ui/hooks/useLogger.d.ts +2 -1
  377. package/dist/src/ui/hooks/useLogger.js +3 -3
  378. package/dist/src/ui/hooks/useLogger.js.map +1 -1
  379. package/dist/src/ui/hooks/usePrivacySettings.d.ts +1 -1
  380. package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -1
  381. package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -1
  382. package/dist/src/ui/hooks/usePromptCompletion.d.ts +23 -0
  383. package/dist/src/ui/hooks/usePromptCompletion.js +177 -0
  384. package/dist/src/ui/hooks/usePromptCompletion.js.map +1 -0
  385. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +2 -2
  386. package/dist/src/ui/hooks/useReactToolScheduler.js +2 -3
  387. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
  388. package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +2 -2
  389. package/dist/src/ui/hooks/useShellHistory.d.ts +2 -1
  390. package/dist/src/ui/hooks/useShellHistory.js +9 -10
  391. package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
  392. package/dist/src/ui/hooks/useShellHistory.test.js +30 -4
  393. package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -1
  394. package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +3 -3
  395. package/dist/src/ui/hooks/useShowMemoryCommand.js +1 -1
  396. package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -1
  397. package/dist/src/ui/hooks/useSlashCompletion.d.ts +2 -2
  398. package/dist/src/ui/hooks/useSlashCompletion.js +263 -67
  399. package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
  400. package/dist/src/ui/hooks/useSlashCompletion.test.d.ts +4 -1
  401. package/dist/src/ui/hooks/useSlashCompletion.test.js +452 -59
  402. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
  403. package/dist/src/ui/hooks/useThemeCommand.d.ts +1 -1
  404. package/dist/src/ui/hooks/useThemeCommand.js +8 -8
  405. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
  406. package/dist/src/ui/hooks/useToolScheduler.test.js +96 -96
  407. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
  408. package/dist/src/ui/hooks/useWorkspaceMigration.d.ts +13 -0
  409. package/dist/src/ui/hooks/useWorkspaceMigration.js +53 -0
  410. package/dist/src/ui/hooks/useWorkspaceMigration.js.map +1 -0
  411. package/dist/src/ui/keyMatchers.d.ts +2 -1
  412. package/dist/src/ui/keyMatchers.js +1 -1
  413. package/dist/src/ui/keyMatchers.js.map +1 -1
  414. package/dist/src/ui/keyMatchers.test.js.map +1 -1
  415. package/dist/src/ui/privacy/CloudFreePrivacyNotice.d.ts +1 -1
  416. package/dist/src/ui/semantic-colors.d.ts +1 -1
  417. package/dist/src/ui/textConstants.d.ts +9 -0
  418. package/dist/src/ui/textConstants.js +10 -0
  419. package/dist/src/ui/textConstants.js.map +1 -0
  420. package/dist/src/ui/themes/atom-one-dark.js +1 -2
  421. package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
  422. package/dist/src/ui/themes/ayu-light.js +1 -2
  423. package/dist/src/ui/themes/ayu-light.js.map +1 -1
  424. package/dist/src/ui/themes/ayu.js +1 -2
  425. package/dist/src/ui/themes/ayu.js.map +1 -1
  426. package/dist/src/ui/themes/default-light.js +1 -2
  427. package/dist/src/ui/themes/default-light.js.map +1 -1
  428. package/dist/src/ui/themes/default.js +1 -2
  429. package/dist/src/ui/themes/default.js.map +1 -1
  430. package/dist/src/ui/themes/dracula.js +1 -2
  431. package/dist/src/ui/themes/dracula.js.map +1 -1
  432. package/dist/src/ui/themes/github-dark.js +1 -2
  433. package/dist/src/ui/themes/github-dark.js.map +1 -1
  434. package/dist/src/ui/themes/github-light.js +1 -2
  435. package/dist/src/ui/themes/github-light.js.map +1 -1
  436. package/dist/src/ui/themes/googlecode.js +2 -3
  437. package/dist/src/ui/themes/googlecode.js.map +1 -1
  438. package/dist/src/ui/themes/no-color.js.map +1 -1
  439. package/dist/src/ui/themes/shades-of-purple.js +1 -2
  440. package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
  441. package/dist/src/ui/themes/theme-manager.d.ts +4 -2
  442. package/dist/src/ui/themes/theme-manager.js +73 -6
  443. package/dist/src/ui/themes/theme-manager.js.map +1 -1
  444. package/dist/src/ui/themes/theme-manager.test.js +60 -1
  445. package/dist/src/ui/themes/theme-manager.test.js.map +1 -1
  446. package/dist/src/ui/themes/theme.d.ts +3 -3
  447. package/dist/src/ui/themes/theme.js +30 -2
  448. package/dist/src/ui/themes/theme.js.map +1 -1
  449. package/dist/src/ui/themes/xcode.js +1 -2
  450. package/dist/src/ui/themes/xcode.js.map +1 -1
  451. package/dist/src/ui/types.d.ts +4 -2
  452. package/dist/src/ui/types.js.map +1 -1
  453. package/dist/src/ui/utils/CodeColorizer.d.ts +2 -2
  454. package/dist/src/ui/utils/CodeColorizer.js +1 -1
  455. package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
  456. package/dist/src/ui/utils/ConsolePatcher.d.ts +1 -1
  457. package/dist/src/ui/utils/ConsolePatcher.js +1 -1
  458. package/dist/src/ui/utils/ConsolePatcher.js.map +1 -1
  459. package/dist/src/ui/utils/MarkdownDisplay.js +2 -1
  460. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
  461. package/dist/src/ui/utils/MarkdownDisplay.test.js +17 -16
  462. package/dist/src/ui/utils/MarkdownDisplay.test.js.map +1 -1
  463. package/dist/src/ui/utils/clipboardUtils.js +6 -6
  464. package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
  465. package/dist/src/ui/utils/commandUtils.d.ts +1 -1
  466. package/dist/src/ui/utils/commandUtils.js +52 -14
  467. package/dist/src/ui/utils/commandUtils.js.map +1 -1
  468. package/dist/src/ui/utils/commandUtils.test.js +76 -21
  469. package/dist/src/ui/utils/commandUtils.test.js.map +1 -1
  470. package/dist/src/ui/utils/computeStats.d.ts +1 -1
  471. package/dist/src/ui/utils/platformConstants.d.ts +9 -0
  472. package/dist/src/ui/utils/platformConstants.js +9 -0
  473. package/dist/src/ui/utils/platformConstants.js.map +1 -1
  474. package/dist/src/ui/utils/terminalSetup.js +5 -5
  475. package/dist/src/ui/utils/terminalSetup.js.map +1 -1
  476. package/dist/src/ui/utils/textUtils.d.ts +18 -0
  477. package/dist/src/ui/utils/textUtils.js +44 -0
  478. package/dist/src/ui/utils/textUtils.js.map +1 -1
  479. package/dist/src/ui/utils/updateCheck.d.ts +1 -1
  480. package/dist/src/ui/utils/updateCheck.js.map +1 -1
  481. package/dist/src/utils/cleanup.js +5 -4
  482. package/dist/src/utils/cleanup.js.map +1 -1
  483. package/dist/src/utils/dialogScopeUtils.d.ts +2 -1
  484. package/dist/src/utils/dialogScopeUtils.js.map +1 -1
  485. package/dist/src/utils/envVarResolver.d.ts +39 -0
  486. package/dist/src/utils/envVarResolver.js +97 -0
  487. package/dist/src/utils/envVarResolver.js.map +1 -0
  488. package/dist/src/utils/envVarResolver.test.d.ts +6 -0
  489. package/dist/src/utils/envVarResolver.test.js +221 -0
  490. package/dist/src/utils/envVarResolver.test.js.map +1 -0
  491. package/dist/src/utils/errors.d.ts +6 -0
  492. package/dist/src/utils/errors.js +12 -0
  493. package/dist/src/utils/errors.js.map +1 -0
  494. package/dist/src/utils/events.d.ts +1 -1
  495. package/dist/src/utils/events.js +1 -1
  496. package/dist/src/utils/events.js.map +1 -1
  497. package/dist/src/utils/gitUtils.js +1 -1
  498. package/dist/src/utils/gitUtils.js.map +1 -1
  499. package/dist/src/utils/gitUtils.test.js +4 -4
  500. package/dist/src/utils/gitUtils.test.js.map +1 -1
  501. package/dist/src/utils/handleAutoUpdate.d.ts +4 -4
  502. package/dist/src/utils/handleAutoUpdate.js +4 -3
  503. package/dist/src/utils/handleAutoUpdate.js.map +1 -1
  504. package/dist/src/utils/installationInfo.js +3 -3
  505. package/dist/src/utils/installationInfo.js.map +1 -1
  506. package/dist/src/utils/installationInfo.test.js +3 -3
  507. package/dist/src/utils/installationInfo.test.js.map +1 -1
  508. package/dist/src/utils/package.js +2 -2
  509. package/dist/src/utils/package.js.map +1 -1
  510. package/dist/src/utils/readStdin.js +15 -0
  511. package/dist/src/utils/readStdin.js.map +1 -1
  512. package/dist/src/utils/readStdin.test.d.ts +6 -0
  513. package/dist/src/utils/readStdin.test.js +88 -0
  514. package/dist/src/utils/readStdin.test.js.map +1 -0
  515. package/dist/src/utils/resolvePath.js +2 -2
  516. package/dist/src/utils/resolvePath.js.map +1 -1
  517. package/dist/src/utils/sandbox-macos-permissive-closed.sb +1 -1
  518. package/dist/src/utils/sandbox-macos-permissive-open.sb +2 -2
  519. package/dist/src/utils/sandbox-macos-permissive-proxied.sb +1 -1
  520. package/dist/src/utils/sandbox-macos-restrictive-closed.sb +2 -2
  521. package/dist/src/utils/sandbox-macos-restrictive-open.sb +2 -2
  522. package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +1 -1
  523. package/dist/src/utils/sandbox.d.ts +2 -2
  524. package/dist/src/utils/sandbox.js +20 -27
  525. package/dist/src/utils/sandbox.js.map +1 -1
  526. package/dist/src/utils/settingsUtils.d.ts +2 -2
  527. package/dist/src/utils/settingsUtils.js +2 -8
  528. package/dist/src/utils/settingsUtils.js.map +1 -1
  529. package/dist/src/utils/settingsUtils.test.js +145 -148
  530. package/dist/src/utils/settingsUtils.test.js.map +1 -1
  531. package/dist/src/utils/spawnWrapper.d.ts +1 -1
  532. package/dist/src/utils/spawnWrapper.js +1 -1
  533. package/dist/src/utils/spawnWrapper.js.map +1 -1
  534. package/dist/src/utils/startupWarnings.js +2 -2
  535. package/dist/src/utils/startupWarnings.js.map +1 -1
  536. package/dist/src/utils/updateEventEmitter.d.ts +1 -1
  537. package/dist/src/utils/updateEventEmitter.js +1 -1
  538. package/dist/src/utils/updateEventEmitter.js.map +1 -1
  539. package/dist/src/utils/userStartupWarnings.js +3 -3
  540. package/dist/src/utils/userStartupWarnings.js.map +1 -1
  541. package/dist/src/utils/userStartupWarnings.test.js +3 -3
  542. package/dist/src/utils/userStartupWarnings.test.js.map +1 -1
  543. package/dist/src/validateNonInterActiveAuth.d.ts +2 -1
  544. package/dist/src/validateNonInterActiveAuth.js.map +1 -1
  545. package/dist/src/zed-integration/acp.d.ts +1 -1
  546. package/dist/src/zed-integration/acp.js +2 -1
  547. package/dist/src/zed-integration/acp.js.map +1 -1
  548. package/dist/src/zed-integration/fileSystemService.d.ts +2 -2
  549. package/dist/src/zed-integration/schema.d.ts +116 -13
  550. package/dist/src/zed-integration/schema.js +7 -1
  551. package/dist/src/zed-integration/schema.js.map +1 -1
  552. package/dist/src/zed-integration/zedIntegration.d.ts +4 -4
  553. package/dist/src/zed-integration/zedIntegration.js +190 -154
  554. package/dist/src/zed-integration/zedIntegration.js.map +1 -1
  555. package/dist/tsconfig.tsbuildinfo +1 -1
  556. package/package.json +10 -10
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { McpPromptLoader } from './McpPromptLoader.js';
7
+ import { describe, it, expect } from 'vitest';
8
+ describe('McpPromptLoader', () => {
9
+ const mockConfig = {};
10
+ describe('parseArgs', () => {
11
+ it('should handle multi-word positional arguments', () => {
12
+ const loader = new McpPromptLoader(mockConfig);
13
+ const promptArgs = [
14
+ { name: 'arg1', required: true },
15
+ { name: 'arg2', required: true },
16
+ ];
17
+ const userArgs = 'hello world';
18
+ const result = loader.parseArgs(userArgs, promptArgs);
19
+ expect(result).toEqual({ arg1: 'hello', arg2: 'world' });
20
+ });
21
+ it('should handle quoted multi-word positional arguments', () => {
22
+ const loader = new McpPromptLoader(mockConfig);
23
+ const promptArgs = [
24
+ { name: 'arg1', required: true },
25
+ { name: 'arg2', required: true },
26
+ ];
27
+ const userArgs = '"hello world" foo';
28
+ const result = loader.parseArgs(userArgs, promptArgs);
29
+ expect(result).toEqual({ arg1: 'hello world', arg2: 'foo' });
30
+ });
31
+ it('should handle a single positional argument with multiple words', () => {
32
+ const loader = new McpPromptLoader(mockConfig);
33
+ const promptArgs = [{ name: 'arg1', required: true }];
34
+ const userArgs = 'hello world';
35
+ const result = loader.parseArgs(userArgs, promptArgs);
36
+ expect(result).toEqual({ arg1: 'hello world' });
37
+ });
38
+ it('should handle escaped quotes in positional arguments', () => {
39
+ const loader = new McpPromptLoader(mockConfig);
40
+ const promptArgs = [{ name: 'arg1', required: true }];
41
+ const userArgs = '"hello \\"world\\""';
42
+ const result = loader.parseArgs(userArgs, promptArgs);
43
+ expect(result).toEqual({ arg1: 'hello "world"' });
44
+ });
45
+ it('should handle escaped backslashes in positional arguments', () => {
46
+ const loader = new McpPromptLoader(mockConfig);
47
+ const promptArgs = [{ name: 'arg1', required: true }];
48
+ const userArgs = '"hello\\\\world"';
49
+ const result = loader.parseArgs(userArgs, promptArgs);
50
+ expect(result).toEqual({ arg1: 'hello\\world' });
51
+ });
52
+ it('should handle named args followed by positional args', () => {
53
+ const loader = new McpPromptLoader(mockConfig);
54
+ const promptArgs = [
55
+ { name: 'named', required: true },
56
+ { name: 'pos', required: true },
57
+ ];
58
+ const userArgs = '--named="value" positional';
59
+ const result = loader.parseArgs(userArgs, promptArgs);
60
+ expect(result).toEqual({ named: 'value', pos: 'positional' });
61
+ });
62
+ it('should handle positional args followed by named args', () => {
63
+ const loader = new McpPromptLoader(mockConfig);
64
+ const promptArgs = [
65
+ { name: 'pos', required: true },
66
+ { name: 'named', required: true },
67
+ ];
68
+ const userArgs = 'positional --named="value"';
69
+ const result = loader.parseArgs(userArgs, promptArgs);
70
+ expect(result).toEqual({ pos: 'positional', named: 'value' });
71
+ });
72
+ it('should handle positional args interspersed with named args', () => {
73
+ const loader = new McpPromptLoader(mockConfig);
74
+ const promptArgs = [
75
+ { name: 'pos1', required: true },
76
+ { name: 'named', required: true },
77
+ { name: 'pos2', required: true },
78
+ ];
79
+ const userArgs = 'p1 --named="value" p2';
80
+ const result = loader.parseArgs(userArgs, promptArgs);
81
+ expect(result).toEqual({ pos1: 'p1', named: 'value', pos2: 'p2' });
82
+ });
83
+ it('should treat an escaped quote at the start as a literal', () => {
84
+ const loader = new McpPromptLoader(mockConfig);
85
+ const promptArgs = [
86
+ { name: 'arg1', required: true },
87
+ { name: 'arg2', required: true },
88
+ ];
89
+ const userArgs = '\\"hello world';
90
+ const result = loader.parseArgs(userArgs, promptArgs);
91
+ expect(result).toEqual({ arg1: '"hello', arg2: 'world' });
92
+ });
93
+ it('should handle a complex mix of args', () => {
94
+ const loader = new McpPromptLoader(mockConfig);
95
+ const promptArgs = [
96
+ { name: 'pos1', required: true },
97
+ { name: 'named1', required: true },
98
+ { name: 'pos2', required: true },
99
+ { name: 'named2', required: true },
100
+ { name: 'pos3', required: true },
101
+ ];
102
+ const userArgs = 'p1 --named1="value 1" "p2 has spaces" --named2=value2 "p3 \\"with quotes\\""';
103
+ const result = loader.parseArgs(userArgs, promptArgs);
104
+ expect(result).toEqual({
105
+ pos1: 'p1',
106
+ named1: 'value 1',
107
+ pos2: 'p2 has spaces',
108
+ named2: 'value2',
109
+ pos3: 'p3 "with quotes"',
110
+ });
111
+ });
112
+ });
113
+ });
114
+ //# sourceMappingURL=McpPromptLoader.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpPromptLoader.test.js","sourceRoot":"","sources":["../../../src/services/McpPromptLoader.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,MAAM,UAAU,GAAG,EAAY,CAAC;IAEhC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;YAC/C,MAAM,UAAU,GAAqB;gBACnC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAChC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;aACjC,CAAC;YACF,MAAM,QAAQ,GAAG,aAAa,CAAC;YAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC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BAAkB;aACzB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -3,8 +3,8 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { IPromptProcessor } from './types.js';
7
- import { CommandContext } from '../../ui/commands/types.js';
6
+ import type { IPromptProcessor, PromptPipelineContent } from './types.js';
7
+ import type { CommandContext } from '../../ui/commands/types.js';
8
8
  /**
9
9
  * Appends the user's full command invocation to the prompt if arguments are
10
10
  * provided, allowing the model to perform its own argument parsing.
@@ -12,5 +12,5 @@ import { CommandContext } from '../../ui/commands/types.js';
12
12
  * This processor is only used if the prompt does NOT contain {{args}}.
13
13
  */
14
14
  export declare class DefaultArgumentProcessor implements IPromptProcessor {
15
- process(prompt: string, context: CommandContext): Promise<string>;
15
+ process(prompt: PromptPipelineContent, context: CommandContext): Promise<PromptPipelineContent>;
16
16
  }
@@ -3,6 +3,7 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { appendToLastTextPart } from '@machina.ai/cell-cli-core';
6
7
  /**
7
8
  * Appends the user's full command invocation to the prompt if arguments are
8
9
  * provided, allowing the model to perform its own argument parsing.
@@ -11,8 +12,8 @@
11
12
  */
12
13
  export class DefaultArgumentProcessor {
13
14
  async process(prompt, context) {
14
- if (context.invocation.args) {
15
- return `${prompt}\n\n${context.invocation.raw}`;
15
+ if (context.invocation?.args) {
16
+ return appendToLastTextPart(prompt, context.invocation.raw);
16
17
  }
17
18
  return prompt;
18
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"argumentProcessor.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/argumentProcessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IACnC,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,OAAuB;QACnD,IAAI,OAAO,CAAC,UAAW,CAAC,IAAI,EAAE,CAAC;YAC7B,OAAO,GAAG,MAAM,OAAO,OAAO,CAAC,UAAW,CAAC,GAAG,EAAE,CAAC;QACnD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
1
+ {"version":3,"file":"argumentProcessor.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/argumentProcessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IACnC,KAAK,CAAC,OAAO,CACX,MAA6B,EAC7B,OAAuB;QAEvB,IAAI,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;YAC7B,OAAO,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { CommandContext } from '../../ui/commands/types.js';
7
+ import { type IPromptProcessor, type PromptPipelineContent } from './types.js';
8
+ export declare class AtFileProcessor implements IPromptProcessor {
9
+ private readonly commandName?;
10
+ constructor(commandName?: string | undefined);
11
+ process(input: PromptPipelineContent, context: CommandContext): Promise<PromptPipelineContent>;
12
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { flatMapTextParts, readPathFromWorkspace, } from '@machina.ai/cell-cli-core';
7
+ import { MessageType } from '../../ui/types.js';
8
+ import { AT_FILE_INJECTION_TRIGGER, } from './types.js';
9
+ import { extractInjections } from './injectionParser.js';
10
+ export class AtFileProcessor {
11
+ commandName;
12
+ constructor(commandName) {
13
+ this.commandName = commandName;
14
+ }
15
+ async process(input, context) {
16
+ const config = context.services.config;
17
+ if (!config) {
18
+ return input;
19
+ }
20
+ return flatMapTextParts(input, async (text) => {
21
+ if (!text.includes(AT_FILE_INJECTION_TRIGGER)) {
22
+ return [{ text }];
23
+ }
24
+ const injections = extractInjections(text, AT_FILE_INJECTION_TRIGGER, this.commandName);
25
+ if (injections.length === 0) {
26
+ return [{ text }];
27
+ }
28
+ const output = [];
29
+ let lastIndex = 0;
30
+ for (const injection of injections) {
31
+ const prefix = text.substring(lastIndex, injection.startIndex);
32
+ if (prefix) {
33
+ output.push({ text: prefix });
34
+ }
35
+ const pathStr = injection.content;
36
+ try {
37
+ const fileContentParts = await readPathFromWorkspace(pathStr, config);
38
+ if (fileContentParts.length === 0) {
39
+ const uiMessage = `File '@{${pathStr}}' was ignored by .gitignore or .geminiignore and was not included in the prompt.`;
40
+ context.ui.addItem({ type: MessageType.INFO, text: uiMessage }, Date.now());
41
+ }
42
+ output.push(...fileContentParts);
43
+ }
44
+ catch (error) {
45
+ const message = error instanceof Error ? error.message : String(error);
46
+ const uiMessage = `Failed to inject content for '@{${pathStr}}': ${message}`;
47
+ console.error(`[AtFileProcessor] ${uiMessage}. Leaving placeholder in prompt.`);
48
+ context.ui.addItem({ type: MessageType.ERROR, text: uiMessage }, Date.now());
49
+ const placeholder = text.substring(injection.startIndex, injection.endIndex);
50
+ output.push({ text: placeholder });
51
+ }
52
+ lastIndex = injection.endIndex;
53
+ }
54
+ const suffix = text.substring(lastIndex);
55
+ if (suffix) {
56
+ output.push({ text: suffix });
57
+ }
58
+ return output;
59
+ });
60
+ }
61
+ }
62
+ //# sourceMappingURL=atFileProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atFileProcessor.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/atFileProcessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAE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C,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YAChC,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export {};
@@ -0,0 +1,174 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
7
+ import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
8
+ import {} from '../../ui/commands/types.js';
9
+ import { AtFileProcessor } from './atFileProcessor.js';
10
+ import { MessageType } from '../../ui/types.js';
11
+ // Mock the core dependency
12
+ const mockReadPathFromWorkspace = vi.hoisted(() => vi.fn());
13
+ vi.mock('@machina.ai/cell-cli-core', async (importOriginal) => {
14
+ const original = await importOriginal();
15
+ return {
16
+ ...original,
17
+ readPathFromWorkspace: mockReadPathFromWorkspace,
18
+ };
19
+ });
20
+ describe('AtFileProcessor', () => {
21
+ let context;
22
+ let mockConfig;
23
+ beforeEach(() => {
24
+ vi.clearAllMocks();
25
+ mockConfig = {
26
+ // The processor only passes the config through, so we don't need a full mock.
27
+ };
28
+ context = createMockCommandContext({
29
+ services: {
30
+ config: mockConfig,
31
+ },
32
+ });
33
+ // Default mock success behavior: return content wrapped in a text part.
34
+ mockReadPathFromWorkspace.mockImplementation(async (path) => [
35
+ { text: `content of ${path}` },
36
+ ]);
37
+ });
38
+ it('should not change the prompt if no @{ trigger is present', async () => {
39
+ const processor = new AtFileProcessor();
40
+ const prompt = [{ text: 'This is a simple prompt.' }];
41
+ const result = await processor.process(prompt, context);
42
+ expect(result).toEqual(prompt);
43
+ expect(mockReadPathFromWorkspace).not.toHaveBeenCalled();
44
+ });
45
+ it('should not change the prompt if config service is missing', async () => {
46
+ const processor = new AtFileProcessor();
47
+ const prompt = [{ text: 'Analyze @{file.txt}' }];
48
+ const contextWithoutConfig = createMockCommandContext({
49
+ services: {
50
+ config: null,
51
+ },
52
+ });
53
+ const result = await processor.process(prompt, contextWithoutConfig);
54
+ expect(result).toEqual(prompt);
55
+ expect(mockReadPathFromWorkspace).not.toHaveBeenCalled();
56
+ });
57
+ describe('Parsing Logic', () => {
58
+ it('should replace a single valid @{path/to/file.txt} placeholder', async () => {
59
+ const processor = new AtFileProcessor();
60
+ const prompt = [
61
+ { text: 'Analyze this file: @{path/to/file.txt}' },
62
+ ];
63
+ const result = await processor.process(prompt, context);
64
+ expect(mockReadPathFromWorkspace).toHaveBeenCalledWith('path/to/file.txt', mockConfig);
65
+ expect(result).toEqual([
66
+ { text: 'Analyze this file: ' },
67
+ { text: 'content of path/to/file.txt' },
68
+ ]);
69
+ });
70
+ it('should replace multiple different @{...} placeholders', async () => {
71
+ const processor = new AtFileProcessor();
72
+ const prompt = [
73
+ { text: 'Compare @{file1.js} with @{file2.js}' },
74
+ ];
75
+ const result = await processor.process(prompt, context);
76
+ expect(mockReadPathFromWorkspace).toHaveBeenCalledTimes(2);
77
+ expect(mockReadPathFromWorkspace).toHaveBeenCalledWith('file1.js', mockConfig);
78
+ expect(mockReadPathFromWorkspace).toHaveBeenCalledWith('file2.js', mockConfig);
79
+ expect(result).toEqual([
80
+ { text: 'Compare ' },
81
+ { text: 'content of file1.js' },
82
+ { text: ' with ' },
83
+ { text: 'content of file2.js' },
84
+ ]);
85
+ });
86
+ it('should handle placeholders at the beginning, middle, and end', async () => {
87
+ const processor = new AtFileProcessor();
88
+ const prompt = [
89
+ { text: '@{start.txt} in the @{middle.txt} and @{end.txt}' },
90
+ ];
91
+ const result = await processor.process(prompt, context);
92
+ expect(result).toEqual([
93
+ { text: 'content of start.txt' },
94
+ { text: ' in the ' },
95
+ { text: 'content of middle.txt' },
96
+ { text: ' and ' },
97
+ { text: 'content of end.txt' },
98
+ ]);
99
+ });
100
+ it('should correctly parse paths that contain balanced braces', async () => {
101
+ const processor = new AtFileProcessor();
102
+ const prompt = [
103
+ { text: 'Analyze @{path/with/{braces}/file.txt}' },
104
+ ];
105
+ const result = await processor.process(prompt, context);
106
+ expect(mockReadPathFromWorkspace).toHaveBeenCalledWith('path/with/{braces}/file.txt', mockConfig);
107
+ expect(result).toEqual([
108
+ { text: 'Analyze ' },
109
+ { text: 'content of path/with/{braces}/file.txt' },
110
+ ]);
111
+ });
112
+ it('should throw an error if the prompt contains an unclosed trigger', async () => {
113
+ const processor = new AtFileProcessor();
114
+ const prompt = [{ text: 'Hello @{world' }];
115
+ // The new parser throws an error for unclosed injections.
116
+ await expect(processor.process(prompt, context)).rejects.toThrow(/Unclosed injection/);
117
+ });
118
+ });
119
+ describe('Integration and Error Handling', () => {
120
+ it('should leave the placeholder unmodified if readPathFromWorkspace throws', async () => {
121
+ const processor = new AtFileProcessor();
122
+ const prompt = [
123
+ { text: 'Analyze @{not-found.txt} and @{good-file.txt}' },
124
+ ];
125
+ mockReadPathFromWorkspace.mockImplementation(async (path) => {
126
+ if (path === 'not-found.txt') {
127
+ throw new Error('File not found');
128
+ }
129
+ return [{ text: `content of ${path}` }];
130
+ });
131
+ const result = await processor.process(prompt, context);
132
+ expect(result).toEqual([
133
+ { text: 'Analyze ' },
134
+ { text: '@{not-found.txt}' }, // Placeholder is preserved as a text part
135
+ { text: ' and ' },
136
+ { text: 'content of good-file.txt' },
137
+ ]);
138
+ });
139
+ });
140
+ describe('UI Feedback', () => {
141
+ it('should call ui.addItem with an ERROR on failure', async () => {
142
+ const processor = new AtFileProcessor();
143
+ const prompt = [{ text: 'Analyze @{bad-file.txt}' }];
144
+ mockReadPathFromWorkspace.mockRejectedValue(new Error('Access denied'));
145
+ await processor.process(prompt, context);
146
+ expect(context.ui.addItem).toHaveBeenCalledTimes(1);
147
+ expect(context.ui.addItem).toHaveBeenCalledWith({
148
+ type: MessageType.ERROR,
149
+ text: "Failed to inject content for '@{bad-file.txt}': Access denied",
150
+ }, expect.any(Number));
151
+ });
152
+ it('should call ui.addItem with a WARNING if the file was ignored', async () => {
153
+ const processor = new AtFileProcessor();
154
+ const prompt = [{ text: 'Analyze @{ignored.txt}' }];
155
+ // Simulate an ignored file by returning an empty array.
156
+ mockReadPathFromWorkspace.mockResolvedValue([]);
157
+ const result = await processor.process(prompt, context);
158
+ // The placeholder should be removed, resulting in only the prefix.
159
+ expect(result).toEqual([{ text: 'Analyze ' }]);
160
+ expect(context.ui.addItem).toHaveBeenCalledTimes(1);
161
+ expect(context.ui.addItem).toHaveBeenCalledWith({
162
+ type: MessageType.INFO,
163
+ text: "File '@{ignored.txt}' was ignored by .gitignore or .geminiignore and was not included in the prompt.",
164
+ }, expect.any(Number));
165
+ });
166
+ it('should NOT call ui.addItem on success', async () => {
167
+ const processor = new AtFileProcessor();
168
+ const prompt = [{ text: 'Analyze @{good-file.txt}' }];
169
+ await processor.process(prompt, context);
170
+ expect(context.ui.addItem).not.toHaveBeenCalled();
171
+ });
172
+ });
173
+ });
174
+ //# sourceMappingURL=atFileProcessor.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atFileProcessor.test.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/atFileProcessor.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAuB,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,2BAA2B;AAC3B,MAAM,yBAAyB,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5D,EAAE,CAAC,IAAI,CAAC,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,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAExD,mEAAmE;YACnE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;YAE/C,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACpD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAC7C;gBACE,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,IAAI,EAAE,sGAAsG;aAC7G,EACD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CACnB,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;YACrD,MAAM,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;YACxC,MAAM,MAAM,GAAgB,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC;YACnE,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACzC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Represents a single detected injection site in a prompt string.
8
+ */
9
+ export interface Injection {
10
+ /** The content extracted from within the braces (e.g., the command or path), trimmed. */
11
+ content: string;
12
+ /** The starting index of the injection (inclusive, points to the start of the trigger). */
13
+ startIndex: number;
14
+ /** The ending index of the injection (exclusive, points after the closing '}'). */
15
+ endIndex: number;
16
+ }
17
+ /**
18
+ * Iteratively parses a prompt string to extract injections (e.g., !{...} or @{...}),
19
+ * correctly handling nested braces within the content.
20
+ *
21
+ * This parser relies on simple brace counting and does not support escaping.
22
+ *
23
+ * @param prompt The prompt string to parse.
24
+ * @param trigger The opening trigger sequence (e.g., '!{', '@{').
25
+ * @param contextName Optional context name (e.g., command name) for error messages.
26
+ * @returns An array of extracted Injection objects.
27
+ * @throws Error if an unclosed injection is found.
28
+ */
29
+ export declare function extractInjections(prompt: string, trigger: string, contextName?: string): Injection[];
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Iteratively parses a prompt string to extract injections (e.g., !{...} or @{...}),
8
+ * correctly handling nested braces within the content.
9
+ *
10
+ * This parser relies on simple brace counting and does not support escaping.
11
+ *
12
+ * @param prompt The prompt string to parse.
13
+ * @param trigger The opening trigger sequence (e.g., '!{', '@{').
14
+ * @param contextName Optional context name (e.g., command name) for error messages.
15
+ * @returns An array of extracted Injection objects.
16
+ * @throws Error if an unclosed injection is found.
17
+ */
18
+ export function extractInjections(prompt, trigger, contextName) {
19
+ const injections = [];
20
+ let index = 0;
21
+ while (index < prompt.length) {
22
+ const startIndex = prompt.indexOf(trigger, index);
23
+ if (startIndex === -1) {
24
+ break;
25
+ }
26
+ let currentIndex = startIndex + trigger.length;
27
+ let braceCount = 1;
28
+ let foundEnd = false;
29
+ while (currentIndex < prompt.length) {
30
+ const char = prompt[currentIndex];
31
+ if (char === '{') {
32
+ braceCount++;
33
+ }
34
+ else if (char === '}') {
35
+ braceCount--;
36
+ if (braceCount === 0) {
37
+ const injectionContent = prompt.substring(startIndex + trigger.length, currentIndex);
38
+ const endIndex = currentIndex + 1;
39
+ injections.push({
40
+ content: injectionContent.trim(),
41
+ startIndex,
42
+ endIndex,
43
+ });
44
+ index = endIndex;
45
+ foundEnd = true;
46
+ break;
47
+ }
48
+ }
49
+ currentIndex++;
50
+ }
51
+ // Check if the inner loop finished without finding the closing brace.
52
+ if (!foundEnd) {
53
+ const contextInfo = contextName ? ` in command '${contextName}'` : '';
54
+ // Enforce strict parsing (Comment 1) and clarify limitations (Comment 2).
55
+ throw new Error(`Invalid syntax${contextInfo}: Unclosed injection starting at index ${startIndex} ('${trigger}'). Ensure braces are balanced. Paths or commands with unbalanced braces are not supported directly.`);
56
+ }
57
+ }
58
+ return injections;
59
+ }
60
+ //# sourceMappingURL=injectionParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectionParser.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/injectionParser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAc,EACd,OAAe,EACf,WAAoB;IAEpB,MAAM,UAAU,GAAgB,EAAE,CAAC;IACnC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAElD,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,MAAM;QACR,CAAC;QAED,IAAI,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;QAC/C,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;QAErB,OAAO,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;YAElC,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACjB,UAAU,EAAE,CAAC;YACf,CAAC;iBAAM,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACxB,UAAU,EAAE,CAAC;gBACb,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;oBACrB,MAAM,gBAAgB,GAA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