@umsai/ums-code 0.0.14-v1 → 0.0.14-v2

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 (892) hide show
  1. package/dist/index.js +9 -0
  2. package/dist/index.js.map +1 -1
  3. package/dist/package.json +10 -7
  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 +25 -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 +18 -0
  24. package/dist/src/commands/extensions/uninstall.test.js.map +1 -0
  25. package/dist/src/commands/extensions/update.d.ts +12 -0
  26. package/dist/src/commands/extensions/update.js +38 -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/add.d.ts +7 -0
  32. package/dist/src/commands/mcp/add.js +167 -0
  33. package/dist/src/commands/mcp/add.js.map +1 -0
  34. package/dist/src/commands/mcp/list.d.ts +8 -0
  35. package/dist/src/commands/mcp/list.js +110 -0
  36. package/dist/src/commands/mcp/list.js.map +1 -0
  37. package/dist/src/commands/mcp/remove.d.ts +7 -0
  38. package/dist/src/commands/mcp/remove.js +44 -0
  39. package/dist/src/commands/mcp/remove.js.map +1 -0
  40. package/dist/src/commands/mcp.d.ts +7 -0
  41. package/dist/src/commands/mcp.js +23 -0
  42. package/dist/src/commands/mcp.js.map +1 -0
  43. package/dist/src/config/auth.js +13 -12
  44. package/dist/src/config/auth.js.map +1 -1
  45. package/dist/src/config/auth.test.d.ts +6 -0
  46. package/dist/src/config/auth.test.js +57 -0
  47. package/dist/src/config/auth.test.js.map +1 -0
  48. package/dist/src/config/config.d.ts +11 -9
  49. package/dist/src/config/config.js +257 -133
  50. package/dist/src/config/config.js.map +1 -1
  51. package/dist/src/config/extension.d.ts +41 -3
  52. package/dist/src/config/extension.js +277 -18
  53. package/dist/src/config/extension.js.map +1 -1
  54. package/dist/src/config/extensions/variableSchema.d.ts +28 -0
  55. package/dist/src/config/extensions/variableSchema.js +18 -0
  56. package/dist/src/config/extensions/variableSchema.js.map +1 -0
  57. package/dist/src/config/extensions/variables.d.ts +17 -0
  58. package/dist/src/config/extensions/variables.js +40 -0
  59. package/dist/src/config/extensions/variables.js.map +1 -0
  60. package/dist/src/config/extensions/variables.test.d.ts +6 -0
  61. package/dist/src/config/extensions/variables.test.js +17 -0
  62. package/dist/src/config/extensions/variables.test.js.map +1 -0
  63. package/dist/src/config/keyBindings.d.ts +66 -0
  64. package/dist/src/config/keyBindings.js +141 -0
  65. package/dist/src/config/keyBindings.js.map +1 -0
  66. package/dist/src/config/keyBindings.test.d.ts +6 -0
  67. package/dist/src/config/keyBindings.test.js +51 -0
  68. package/dist/src/config/keyBindings.test.js.map +1 -0
  69. package/dist/src/config/sandboxConfig.d.ts +2 -2
  70. package/dist/src/config/sandboxConfig.js +8 -10
  71. package/dist/src/config/sandboxConfig.js.map +1 -1
  72. package/dist/src/config/settings.d.ts +14 -69
  73. package/dist/src/config/settings.js +425 -94
  74. package/dist/src/config/settings.js.map +1 -1
  75. package/dist/src/config/settingsSchema.d.ts +884 -0
  76. package/dist/src/config/settingsSchema.js +857 -0
  77. package/dist/src/config/settingsSchema.js.map +1 -0
  78. package/dist/src/config/settingsSchema.test.d.ts +6 -0
  79. package/dist/src/config/settingsSchema.test.js +194 -0
  80. package/dist/src/config/settingsSchema.test.js.map +1 -0
  81. package/dist/src/config/trustedFolders.d.ts +37 -0
  82. package/dist/src/config/trustedFolders.js +118 -0
  83. package/dist/src/config/trustedFolders.js.map +1 -0
  84. package/dist/src/config/trustedFolders.test.d.ts +6 -0
  85. package/dist/src/config/trustedFolders.test.js +164 -0
  86. package/dist/src/config/trustedFolders.test.js.map +1 -0
  87. package/dist/src/gemini.d.ts +3 -1
  88. package/dist/src/gemini.js +118 -99
  89. package/dist/src/gemini.js.map +1 -1
  90. package/dist/src/gemini.test.d.ts +6 -0
  91. package/dist/src/gemini.test.js +247 -0
  92. package/dist/src/gemini.test.js.map +1 -0
  93. package/dist/src/generated/git-commit.d.ts +2 -1
  94. package/dist/src/generated/git-commit.js +2 -1
  95. package/dist/src/generated/git-commit.js.map +1 -1
  96. package/dist/src/nonInteractiveCli.d.ts +1 -1
  97. package/dist/src/nonInteractiveCli.js +26 -42
  98. package/dist/src/nonInteractiveCli.js.map +1 -1
  99. package/dist/src/services/BuiltinCommandLoader.d.ts +3 -4
  100. package/dist/src/services/BuiltinCommandLoader.js +15 -4
  101. package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
  102. package/dist/src/services/BuiltinCommandLoader.test.d.ts +6 -0
  103. package/dist/src/services/BuiltinCommandLoader.test.js +130 -0
  104. package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -0
  105. package/dist/src/services/CommandService.d.ts +2 -2
  106. package/dist/src/services/CommandService.test.d.ts +6 -0
  107. package/dist/src/services/CommandService.test.js +233 -0
  108. package/dist/src/services/CommandService.test.js.map +1 -0
  109. package/dist/src/services/FileCommandLoader.d.ts +3 -3
  110. package/dist/src/services/FileCommandLoader.js +31 -19
  111. package/dist/src/services/FileCommandLoader.js.map +1 -1
  112. package/dist/src/services/McpPromptLoader.d.ts +14 -4
  113. package/dist/src/services/McpPromptLoader.js +46 -20
  114. package/dist/src/services/McpPromptLoader.js.map +1 -1
  115. package/dist/src/services/McpPromptLoader.test.d.ts +6 -0
  116. package/dist/src/services/McpPromptLoader.test.js +114 -0
  117. package/dist/src/services/McpPromptLoader.test.js.map +1 -0
  118. package/dist/src/services/prompt-processors/argumentProcessor.d.ts +5 -10
  119. package/dist/src/services/prompt-processors/argumentProcessor.js +5 -12
  120. package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -1
  121. package/dist/src/services/prompt-processors/atFileProcessor.d.ts +12 -0
  122. package/dist/src/services/prompt-processors/atFileProcessor.js +62 -0
  123. package/dist/src/services/prompt-processors/atFileProcessor.js.map +1 -0
  124. package/dist/src/services/prompt-processors/atFileProcessor.test.d.ts +6 -0
  125. package/dist/src/services/prompt-processors/atFileProcessor.test.js +174 -0
  126. package/dist/src/services/prompt-processors/atFileProcessor.test.js.map +1 -0
  127. package/dist/src/services/prompt-processors/injectionParser.d.ts +29 -0
  128. package/dist/src/services/prompt-processors/injectionParser.js +60 -0
  129. package/dist/src/services/prompt-processors/injectionParser.js.map +1 -0
  130. package/dist/src/services/prompt-processors/injectionParser.test.d.ts +6 -0
  131. package/dist/src/services/prompt-processors/injectionParser.test.js +189 -0
  132. package/dist/src/services/prompt-processors/injectionParser.test.js.map +1 -0
  133. package/dist/src/services/prompt-processors/shellProcessor.d.ts +11 -16
  134. package/dist/src/services/prompt-processors/shellProcessor.js +85 -41
  135. package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -1
  136. package/dist/src/services/prompt-processors/types.d.ts +15 -8
  137. package/dist/src/services/prompt-processors/types.js +6 -0
  138. package/dist/src/services/prompt-processors/types.js.map +1 -1
  139. package/dist/src/services/types.d.ts +1 -1
  140. package/dist/src/test-utils/customMatchers.d.ts +14 -0
  141. package/dist/src/test-utils/customMatchers.js +40 -0
  142. package/dist/src/test-utils/customMatchers.js.map +1 -0
  143. package/dist/src/test-utils/mockCommandContext.d.ts +18 -0
  144. package/dist/src/test-utils/mockCommandContext.js +90 -0
  145. package/dist/src/test-utils/mockCommandContext.js.map +1 -0
  146. package/dist/src/test-utils/mockCommandContext.test.d.ts +6 -0
  147. package/dist/src/test-utils/mockCommandContext.test.js +51 -0
  148. package/dist/src/test-utils/mockCommandContext.test.js.map +1 -0
  149. package/dist/src/test-utils/render.d.ts +8 -0
  150. package/dist/src/test-utils/render.js +10 -0
  151. package/dist/src/test-utils/render.js.map +1 -0
  152. package/dist/src/ui/App.d.ts +2 -2
  153. package/dist/src/ui/App.js +342 -70
  154. package/dist/src/ui/App.js.map +1 -1
  155. package/dist/src/ui/IdeIntegrationNudge.d.ts +16 -0
  156. package/dist/src/ui/IdeIntegrationNudge.js +52 -0
  157. package/dist/src/ui/IdeIntegrationNudge.js.map +1 -0
  158. package/dist/src/ui/colors.d.ts +1 -1
  159. package/dist/src/ui/commands/aboutCommand.d.ts +1 -1
  160. package/dist/src/ui/commands/aboutCommand.js +10 -6
  161. package/dist/src/ui/commands/aboutCommand.js.map +1 -1
  162. package/dist/src/ui/commands/agentsCommand.d.ts +7 -0
  163. package/dist/src/ui/commands/agentsCommand.js +32 -0
  164. package/dist/src/ui/commands/agentsCommand.js.map +1 -0
  165. package/dist/src/ui/commands/approvalModeCommand.d.ts +7 -0
  166. package/dist/src/ui/commands/approvalModeCommand.js +340 -0
  167. package/dist/src/ui/commands/approvalModeCommand.js.map +1 -0
  168. package/dist/src/ui/commands/approvalModeCommand.test.d.ts +6 -0
  169. package/dist/src/ui/commands/approvalModeCommand.test.js +293 -0
  170. package/dist/src/ui/commands/approvalModeCommand.test.js.map +1 -0
  171. package/dist/src/ui/commands/authCommand.d.ts +1 -1
  172. package/dist/src/ui/commands/authCommand.js.map +1 -1
  173. package/dist/src/ui/commands/bugCommand.js +13 -5
  174. package/dist/src/ui/commands/bugCommand.js.map +1 -1
  175. package/dist/src/ui/commands/chatCommand.d.ts +1 -1
  176. package/dist/src/ui/commands/chatCommand.js +27 -9
  177. package/dist/src/ui/commands/chatCommand.js.map +1 -1
  178. package/dist/src/ui/commands/clearCommand.d.ts +1 -1
  179. package/dist/src/ui/commands/clearCommand.js +0 -1
  180. package/dist/src/ui/commands/clearCommand.js.map +1 -1
  181. package/dist/src/ui/commands/compressCommand.d.ts +1 -1
  182. package/dist/src/ui/commands/compressCommand.js +2 -0
  183. package/dist/src/ui/commands/compressCommand.js.map +1 -1
  184. package/dist/src/ui/commands/copyCommand.d.ts +1 -1
  185. package/dist/src/ui/commands/copyCommand.js +2 -2
  186. package/dist/src/ui/commands/copyCommand.js.map +1 -1
  187. package/dist/src/ui/commands/directoryCommand.d.ts +1 -1
  188. package/dist/src/ui/commands/directoryCommand.js +7 -8
  189. package/dist/src/ui/commands/directoryCommand.js.map +1 -1
  190. package/dist/src/ui/commands/docsCommand.js +1 -1
  191. package/dist/src/ui/commands/docsCommand.js.map +1 -1
  192. package/dist/src/ui/commands/helpCommand.d.ts +1 -1
  193. package/dist/src/ui/commands/helpCommand.js.map +1 -1
  194. package/dist/src/ui/commands/ideCommand.d.ts +2 -2
  195. package/dist/src/ui/commands/ideCommand.js +92 -22
  196. package/dist/src/ui/commands/ideCommand.js.map +1 -1
  197. package/dist/src/ui/commands/initCommand.d.ts +2 -2
  198. package/dist/src/ui/commands/initCommand.js +20 -10
  199. package/dist/src/ui/commands/initCommand.js.map +1 -1
  200. package/dist/src/ui/commands/mcpCommand.d.ts +1 -1
  201. package/dist/src/ui/commands/mcpCommand.js +12 -8
  202. package/dist/src/ui/commands/mcpCommand.js.map +1 -1
  203. package/dist/src/ui/commands/memoryCommand.d.ts +1 -1
  204. package/dist/src/ui/commands/memoryCommand.js +143 -9
  205. package/dist/src/ui/commands/memoryCommand.js.map +1 -1
  206. package/dist/src/ui/commands/modelCommand.d.ts +7 -0
  207. package/dist/src/ui/commands/modelCommand.js +68 -0
  208. package/dist/src/ui/commands/modelCommand.js.map +1 -0
  209. package/dist/src/ui/commands/modelCommand.test.d.ts +6 -0
  210. package/dist/src/ui/commands/modelCommand.test.js +138 -0
  211. package/dist/src/ui/commands/modelCommand.test.js.map +1 -0
  212. package/dist/src/ui/commands/privacyCommand.d.ts +1 -1
  213. package/dist/src/ui/commands/privacyCommand.js.map +1 -1
  214. package/dist/src/ui/commands/quitCommand.d.ts +1 -0
  215. package/dist/src/ui/commands/quitCommand.js +25 -0
  216. package/dist/src/ui/commands/quitCommand.js.map +1 -1
  217. package/dist/src/ui/commands/restoreCommand.d.ts +1 -1
  218. package/dist/src/ui/commands/restoreCommand.js +4 -8
  219. package/dist/src/ui/commands/restoreCommand.js.map +1 -1
  220. package/dist/src/ui/commands/settingsCommand.d.ts +7 -0
  221. package/dist/src/ui/commands/settingsCommand.js +16 -0
  222. package/dist/src/ui/commands/settingsCommand.js.map +1 -0
  223. package/dist/src/ui/commands/setupGithubCommand.d.ts +3 -1
  224. package/dist/src/ui/commands/setupGithubCommand.js +133 -27
  225. package/dist/src/ui/commands/setupGithubCommand.js.map +1 -1
  226. package/dist/src/ui/commands/setupGithubCommand.test.d.ts +6 -0
  227. package/dist/src/ui/commands/setupGithubCommand.test.js +167 -0
  228. package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -0
  229. package/dist/src/ui/commands/statsCommand.js.map +1 -1
  230. package/dist/src/ui/commands/summaryCommand.d.ts +7 -0
  231. package/dist/src/ui/commands/summaryCommand.js +149 -0
  232. package/dist/src/ui/commands/summaryCommand.js.map +1 -0
  233. package/dist/src/ui/commands/terminalSetupCommand.d.ts +13 -0
  234. package/dist/src/ui/commands/terminalSetupCommand.js +41 -0
  235. package/dist/src/ui/commands/terminalSetupCommand.js.map +1 -0
  236. package/dist/src/ui/commands/themeCommand.d.ts +1 -1
  237. package/dist/src/ui/commands/themeCommand.js.map +1 -1
  238. package/dist/src/ui/commands/toolsCommand.js +1 -1
  239. package/dist/src/ui/commands/toolsCommand.js.map +1 -1
  240. package/dist/src/ui/commands/types.d.ts +26 -11
  241. package/dist/src/ui/commands/types.js +1 -0
  242. package/dist/src/ui/commands/types.js.map +1 -1
  243. package/dist/src/ui/commands/ums/umsInitCommand.d.ts +1 -1
  244. package/dist/src/ui/commands/ums/umsInitCommand.js +54 -20
  245. package/dist/src/ui/commands/ums/umsInitCommand.js.map +1 -1
  246. package/dist/src/ui/commands/vimCommand.d.ts +1 -1
  247. package/dist/src/ui/commands/vimCommand.js.map +1 -1
  248. package/dist/src/ui/components/AboutBox.d.ts +2 -1
  249. package/dist/src/ui/components/AboutBox.js +1 -1
  250. package/dist/src/ui/components/AboutBox.js.map +1 -1
  251. package/dist/src/ui/components/AsciiArt.d.ts +1 -0
  252. package/dist/src/ui/components/AsciiArt.js +8 -0
  253. package/dist/src/ui/components/AsciiArt.js.map +1 -1
  254. package/dist/src/ui/components/AuthDialog.d.ts +2 -2
  255. package/dist/src/ui/components/AuthDialog.js +23 -22
  256. package/dist/src/ui/components/AuthDialog.js.map +1 -1
  257. package/dist/src/ui/components/AuthDialog.test.d.ts +6 -0
  258. package/dist/src/ui/components/AuthDialog.test.js +280 -0
  259. package/dist/src/ui/components/AuthDialog.test.js.map +1 -0
  260. package/dist/src/ui/components/AuthInProgress.d.ts +1 -1
  261. package/dist/src/ui/components/AuthInProgress.js +6 -10
  262. package/dist/src/ui/components/AuthInProgress.js.map +1 -1
  263. package/dist/src/ui/components/AutoAcceptIndicator.d.ts +1 -1
  264. package/dist/src/ui/components/AutoAcceptIndicator.js +8 -3
  265. package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -1
  266. package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +1 -1
  267. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +1 -1
  268. package/dist/src/ui/components/ContextSummaryDisplay.js +23 -25
  269. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
  270. package/dist/src/ui/components/ContextUsageDisplay.d.ts +9 -0
  271. package/dist/src/ui/components/ContextUsageDisplay.js +14 -0
  272. package/dist/src/ui/components/ContextUsageDisplay.js.map +1 -0
  273. package/dist/src/ui/components/DebugProfiler.js +5 -4
  274. package/dist/src/ui/components/DebugProfiler.js.map +1 -1
  275. package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +2 -2
  276. package/dist/src/ui/components/DetailedMessagesDisplay.js +1 -1
  277. package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -1
  278. package/dist/src/ui/components/EditorSettingsDialog.d.ts +4 -3
  279. package/dist/src/ui/components/EditorSettingsDialog.js +14 -16
  280. package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
  281. package/dist/src/ui/components/FolderTrustDialog.d.ts +17 -0
  282. package/dist/src/ui/components/FolderTrustDialog.js +45 -0
  283. package/dist/src/ui/components/FolderTrustDialog.js.map +1 -0
  284. package/dist/src/ui/components/FolderTrustDialog.test.d.ts +6 -0
  285. package/dist/src/ui/components/FolderTrustDialog.test.js +63 -0
  286. package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -0
  287. package/dist/src/ui/components/Footer.d.ts +2 -1
  288. package/dist/src/ui/components/Footer.js +16 -6
  289. package/dist/src/ui/components/Footer.js.map +1 -1
  290. package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +1 -1
  291. package/dist/src/ui/components/GeminiRespondingSpinner.js +5 -3
  292. package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -1
  293. package/dist/src/ui/components/Header.d.ts +1 -2
  294. package/dist/src/ui/components/Header.js +13 -5
  295. package/dist/src/ui/components/Header.js.map +1 -1
  296. package/dist/src/ui/components/Header.test.d.ts +6 -0
  297. package/dist/src/ui/components/Header.test.js +37 -0
  298. package/dist/src/ui/components/Header.test.js.map +1 -0
  299. package/dist/src/ui/components/Help.d.ts +2 -2
  300. package/dist/src/ui/components/Help.js +2 -2
  301. package/dist/src/ui/components/Help.js.map +1 -1
  302. package/dist/src/ui/components/HistoryItemDisplay.d.ts +5 -5
  303. package/dist/src/ui/components/HistoryItemDisplay.js +5 -1
  304. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
  305. package/dist/src/ui/components/HistoryItemDisplay.test.d.ts +6 -0
  306. package/dist/src/ui/components/HistoryItemDisplay.test.js +93 -0
  307. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -0
  308. package/dist/src/ui/components/InputPrompt.d.ts +6 -5
  309. package/dist/src/ui/components/InputPrompt.js +238 -53
  310. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  311. package/dist/src/ui/components/LoadingIndicator.d.ts +2 -2
  312. package/dist/src/ui/components/LoadingIndicator.js +10 -5
  313. package/dist/src/ui/components/LoadingIndicator.js.map +1 -1
  314. package/dist/src/ui/components/LoadingIndicator.test.d.ts +6 -0
  315. package/dist/src/ui/components/LoadingIndicator.test.js +190 -0
  316. package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -0
  317. package/dist/src/ui/components/MemoryUsageDisplay.d.ts +1 -1
  318. package/dist/src/ui/components/MemoryUsageDisplay.js +0 -5
  319. package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -1
  320. package/dist/src/ui/components/ModelSelectionDialog.d.ts +14 -0
  321. package/dist/src/ui/components/ModelSelectionDialog.js +26 -0
  322. package/dist/src/ui/components/ModelSelectionDialog.js.map +1 -0
  323. package/dist/src/ui/components/ModelSelectionDialog.test.d.ts +6 -0
  324. package/dist/src/ui/components/ModelSelectionDialog.test.js +124 -0
  325. package/dist/src/ui/components/ModelSelectionDialog.test.js.map +1 -0
  326. package/dist/src/ui/components/ModelStatsDisplay.d.ts +1 -1
  327. package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -1
  328. package/dist/src/ui/components/ModelSwitchDialog.d.ts +15 -0
  329. package/dist/src/ui/components/ModelSwitchDialog.js +37 -0
  330. package/dist/src/ui/components/ModelSwitchDialog.js.map +1 -0
  331. package/dist/src/ui/components/ModelSwitchDialog.test.d.ts +6 -0
  332. package/dist/src/ui/components/ModelSwitchDialog.test.js +125 -0
  333. package/dist/src/ui/components/ModelSwitchDialog.test.js.map +1 -0
  334. package/dist/src/ui/components/OpenAIKeyPrompt.d.ts +1 -1
  335. package/dist/src/ui/components/OpenAIKeyPrompt.js +0 -5
  336. package/dist/src/ui/components/OpenAIKeyPrompt.js.map +1 -1
  337. package/dist/src/ui/components/OpenAIKeyPrompt.test.d.ts +6 -0
  338. package/dist/src/ui/components/OpenAIKeyPrompt.test.js +44 -0
  339. package/dist/src/ui/components/OpenAIKeyPrompt.test.js.map +1 -0
  340. package/dist/src/ui/components/PlanSummaryDisplay.d.ts +14 -0
  341. package/dist/src/ui/components/PlanSummaryDisplay.js +9 -0
  342. package/dist/src/ui/components/PlanSummaryDisplay.js.map +1 -0
  343. package/dist/src/ui/components/PrepareLabel.d.ts +1 -1
  344. package/dist/src/ui/components/QuitConfirmationDialog.d.ts +17 -0
  345. package/dist/src/ui/components/QuitConfirmationDialog.js +44 -0
  346. package/dist/src/ui/components/QuitConfirmationDialog.js.map +1 -0
  347. package/dist/src/ui/components/QwenOAuthProgress.d.ts +2 -2
  348. package/dist/src/ui/components/QwenOAuthProgress.js +0 -5
  349. package/dist/src/ui/components/QwenOAuthProgress.js.map +1 -1
  350. package/dist/src/ui/components/QwenOAuthProgress.test.d.ts +6 -0
  351. package/dist/src/ui/components/QwenOAuthProgress.test.js +292 -0
  352. package/dist/src/ui/components/QwenOAuthProgress.test.js.map +1 -0
  353. package/dist/src/ui/components/SessionSummaryDisplay.d.ts +1 -1
  354. package/dist/src/ui/components/SettingsDialog.d.ts +15 -0
  355. package/dist/src/ui/components/SettingsDialog.js +550 -0
  356. package/dist/src/ui/components/SettingsDialog.js.map +1 -0
  357. package/dist/src/ui/components/SettingsDialog.test.d.ts +6 -0
  358. package/dist/src/ui/components/SettingsDialog.test.js +646 -0
  359. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -0
  360. package/dist/src/ui/components/ShellConfirmationDialog.d.ts +1 -1
  361. package/dist/src/ui/components/ShellConfirmationDialog.js +8 -6
  362. package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
  363. package/dist/src/ui/components/ShellConfirmationDialog.test.d.ts +6 -0
  364. package/dist/src/ui/components/ShellConfirmationDialog.test.js +40 -0
  365. package/dist/src/ui/components/ShellConfirmationDialog.test.js.map +1 -0
  366. package/dist/src/ui/components/ShellModeIndicator.d.ts +1 -1
  367. package/dist/src/ui/components/StatsDisplay.d.ts +1 -1
  368. package/dist/src/ui/components/StatsDisplay.js +9 -8
  369. package/dist/src/ui/components/StatsDisplay.js.map +1 -1
  370. package/dist/src/ui/components/SuggestionsDisplay.js +12 -4
  371. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
  372. package/dist/src/ui/components/ThemeDialog.d.ts +3 -2
  373. package/dist/src/ui/components/ThemeDialog.js +14 -29
  374. package/dist/src/ui/components/ThemeDialog.js.map +1 -1
  375. package/dist/src/ui/components/Tips.d.ts +1 -1
  376. package/dist/src/ui/components/Tips.js +1 -0
  377. package/dist/src/ui/components/Tips.js.map +1 -1
  378. package/dist/src/ui/components/TodoDisplay.d.ts +16 -0
  379. package/dist/src/ui/components/TodoDisplay.js +27 -0
  380. package/dist/src/ui/components/TodoDisplay.js.map +1 -0
  381. package/dist/src/ui/components/TodoDisplay.test.d.ts +6 -0
  382. package/dist/src/ui/components/TodoDisplay.test.js +77 -0
  383. package/dist/src/ui/components/TodoDisplay.test.js.map +1 -0
  384. package/dist/src/ui/components/ToolStatsDisplay.d.ts +1 -1
  385. package/dist/src/ui/components/WelcomeBackDialog.d.ts +13 -0
  386. package/dist/src/ui/components/WelcomeBackDialog.js +32 -0
  387. package/dist/src/ui/components/WelcomeBackDialog.js.map +1 -0
  388. package/dist/src/ui/components/WorkspaceMigrationDialog.d.ts +11 -0
  389. package/dist/src/ui/components/WorkspaceMigrationDialog.js +42 -0
  390. package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +1 -0
  391. package/dist/src/ui/components/messages/CompressionMessage.d.ts +2 -2
  392. package/dist/src/ui/components/messages/CompressionMessage.js +2 -1
  393. package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -1
  394. package/dist/src/ui/components/messages/DiffRenderer.d.ts +1 -1
  395. package/dist/src/ui/components/messages/DiffRenderer.js +16 -3
  396. package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
  397. package/dist/src/ui/components/messages/DiffRenderer.test.d.ts +6 -0
  398. package/dist/src/ui/components/messages/DiffRenderer.test.js +239 -0
  399. package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -0
  400. package/dist/src/ui/components/messages/ErrorMessage.d.ts +1 -1
  401. package/dist/src/ui/components/messages/GeminiMessage.d.ts +1 -1
  402. package/dist/src/ui/components/messages/GeminiMessage.js +2 -1
  403. package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -1
  404. package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +1 -1
  405. package/dist/src/ui/components/messages/InfoMessage.d.ts +1 -1
  406. package/dist/src/ui/components/messages/InfoMessage.js +6 -1
  407. package/dist/src/ui/components/messages/InfoMessage.js.map +1 -1
  408. package/dist/src/ui/components/messages/SummaryMessage.d.ts +11 -0
  409. package/dist/src/ui/components/messages/SummaryMessage.js +35 -0
  410. package/dist/src/ui/components/messages/SummaryMessage.js.map +1 -0
  411. package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +4 -3
  412. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +111 -35
  413. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
  414. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.d.ts +6 -0
  415. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +137 -0
  416. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -0
  417. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +4 -4
  418. package/dist/src/ui/components/messages/ToolGroupMessage.js +2 -7
  419. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
  420. package/dist/src/ui/components/messages/ToolGroupMessage.test.d.ts +6 -0
  421. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +259 -0
  422. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -0
  423. package/dist/src/ui/components/messages/ToolMessage.d.ts +3 -1
  424. package/dist/src/ui/components/messages/ToolMessage.js +88 -11
  425. package/dist/src/ui/components/messages/ToolMessage.js.map +1 -1
  426. package/dist/src/ui/components/messages/ToolMessage.test.d.ts +6 -0
  427. package/dist/src/ui/components/messages/ToolMessage.test.js +149 -0
  428. package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -0
  429. package/dist/src/ui/components/messages/UserMessage.d.ts +1 -1
  430. package/dist/src/ui/components/messages/UserMessage.js +4 -2
  431. package/dist/src/ui/components/messages/UserMessage.js.map +1 -1
  432. package/dist/src/ui/components/messages/UserShellMessage.d.ts +1 -1
  433. package/dist/src/ui/components/shared/MaxSizedBox.js +1 -1
  434. package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -1
  435. package/dist/src/ui/components/shared/MaxSizedBox.test.d.ts +6 -0
  436. package/dist/src/ui/components/shared/MaxSizedBox.test.js +154 -0
  437. package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -0
  438. package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +1 -1
  439. package/dist/src/ui/components/shared/RadioButtonSelect.js +12 -15
  440. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
  441. package/dist/src/ui/components/shared/RadioButtonSelect.test.d.ts +6 -0
  442. package/dist/src/ui/components/shared/RadioButtonSelect.test.js +111 -0
  443. package/dist/src/ui/components/shared/RadioButtonSelect.test.js.map +1 -0
  444. package/dist/src/ui/components/shared/TextInput.d.ts +16 -0
  445. package/dist/src/ui/components/shared/TextInput.js +127 -0
  446. package/dist/src/ui/components/shared/TextInput.js.map +1 -0
  447. package/dist/src/ui/components/shared/text-buffer.d.ts +17 -4
  448. package/dist/src/ui/components/shared/text-buffer.js +235 -97
  449. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  450. package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +1 -1
  451. package/dist/src/ui/components/shared/vim-buffer-actions.js +139 -152
  452. package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -1
  453. package/dist/src/ui/components/subagents/constants.d.ts +23 -0
  454. package/dist/src/ui/components/subagents/constants.js +67 -0
  455. package/dist/src/ui/components/subagents/constants.js.map +1 -0
  456. package/dist/src/ui/components/subagents/create/AgentCreationWizard.d.ts +15 -0
  457. package/dist/src/ui/components/subagents/create/AgentCreationWizard.js +174 -0
  458. package/dist/src/ui/components/subagents/create/AgentCreationWizard.js.map +1 -0
  459. package/dist/src/ui/components/subagents/create/ColorSelector.d.ts +15 -0
  460. package/dist/src/ui/components/subagents/create/ColorSelector.js +42 -0
  461. package/dist/src/ui/components/subagents/create/ColorSelector.js.map +1 -0
  462. package/dist/src/ui/components/subagents/create/CreationSummary.d.ts +10 -0
  463. package/dist/src/ui/components/subagents/create/CreationSummary.js +163 -0
  464. package/dist/src/ui/components/subagents/create/CreationSummary.js.map +1 -0
  465. package/dist/src/ui/components/subagents/create/DescriptionInput.d.ts +10 -0
  466. package/dist/src/ui/components/subagents/create/DescriptionInput.js +105 -0
  467. package/dist/src/ui/components/subagents/create/DescriptionInput.js.map +1 -0
  468. package/dist/src/ui/components/subagents/create/GenerationMethodSelector.d.ts +10 -0
  469. package/dist/src/ui/components/subagents/create/GenerationMethodSelector.js +33 -0
  470. package/dist/src/ui/components/subagents/create/GenerationMethodSelector.js.map +1 -0
  471. package/dist/src/ui/components/subagents/create/LocationSelector.d.ts +10 -0
  472. package/dist/src/ui/components/subagents/create/LocationSelector.js +33 -0
  473. package/dist/src/ui/components/subagents/create/LocationSelector.js.map +1 -0
  474. package/dist/src/ui/components/subagents/create/TextEntryStep.d.ts +26 -0
  475. package/dist/src/ui/components/subagents/create/TextEntryStep.js +28 -0
  476. package/dist/src/ui/components/subagents/create/TextEntryStep.js.map +1 -0
  477. package/dist/src/ui/components/subagents/create/ToolSelector.d.ts +16 -0
  478. package/dist/src/ui/components/subagents/create/ToolSelector.js +143 -0
  479. package/dist/src/ui/components/subagents/create/ToolSelector.js.map +1 -0
  480. package/dist/src/ui/components/subagents/index.d.ts +8 -0
  481. package/dist/src/ui/components/subagents/index.js +12 -0
  482. package/dist/src/ui/components/subagents/index.js.map +1 -0
  483. package/dist/src/ui/components/subagents/manage/ActionSelectionStep.d.ts +13 -0
  484. package/dist/src/ui/components/subagents/manage/ActionSelectionStep.js +46 -0
  485. package/dist/src/ui/components/subagents/manage/ActionSelectionStep.js.map +1 -0
  486. package/dist/src/ui/components/subagents/manage/AgentDeleteStep.d.ts +13 -0
  487. package/dist/src/ui/components/subagents/manage/AgentDeleteStep.js +33 -0
  488. package/dist/src/ui/components/subagents/manage/AgentDeleteStep.js.map +1 -0
  489. package/dist/src/ui/components/subagents/manage/AgentEditStep.d.ts +15 -0
  490. package/dist/src/ui/components/subagents/manage/AgentEditStep.js +63 -0
  491. package/dist/src/ui/components/subagents/manage/AgentEditStep.js.map +1 -0
  492. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.d.ts +12 -0
  493. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js +225 -0
  494. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js.map +1 -0
  495. package/dist/src/ui/components/subagents/manage/AgentViewerStep.d.ts +11 -0
  496. package/dist/src/ui/components/subagents/manage/AgentViewerStep.js +19 -0
  497. package/dist/src/ui/components/subagents/manage/AgentViewerStep.js.map +1 -0
  498. package/dist/src/ui/components/subagents/manage/AgentsManagerDialog.d.ts +15 -0
  499. package/dist/src/ui/components/subagents/manage/AgentsManagerDialog.js +212 -0
  500. package/dist/src/ui/components/subagents/manage/AgentsManagerDialog.js.map +1 -0
  501. package/dist/src/ui/components/subagents/reducers.d.ts +14 -0
  502. package/dist/src/ui/components/subagents/reducers.js +162 -0
  503. package/dist/src/ui/components/subagents/reducers.js.map +1 -0
  504. package/dist/src/ui/components/subagents/runtime/AgentExecutionDisplay.d.ts +20 -0
  505. package/dist/src/ui/components/subagents/runtime/AgentExecutionDisplay.js +194 -0
  506. package/dist/src/ui/components/subagents/runtime/AgentExecutionDisplay.js.map +1 -0
  507. package/dist/src/ui/components/subagents/types.d.ts +137 -0
  508. package/dist/src/ui/components/subagents/types.js +15 -0
  509. package/dist/src/ui/components/subagents/types.js.map +1 -0
  510. package/dist/src/ui/components/subagents/utils.d.ts +15 -0
  511. package/dist/src/ui/components/subagents/utils.js +79 -0
  512. package/dist/src/ui/components/subagents/utils.js.map +1 -0
  513. package/dist/src/ui/components/ums/UMSKeyPrompt.js +4 -4
  514. package/dist/src/ui/components/ums/UMSKeyPrompt.js.map +1 -1
  515. package/dist/src/ui/components/ums/useUMSAuth.d.ts +1 -1
  516. package/dist/src/ui/components/ums/useUMSAuth.js +1 -1
  517. package/dist/src/ui/components/ums/useUMSAuth.js.map +1 -1
  518. package/dist/src/ui/constants.d.ts +8 -0
  519. package/dist/src/ui/constants.js +9 -0
  520. package/dist/src/ui/constants.js.map +1 -1
  521. package/dist/src/ui/contexts/KeypressContext.d.ts +32 -0
  522. package/dist/src/ui/contexts/KeypressContext.js +371 -0
  523. package/dist/src/ui/contexts/KeypressContext.js.map +1 -0
  524. package/dist/src/ui/contexts/KeypressContext.test.d.ts +6 -0
  525. package/dist/src/ui/contexts/KeypressContext.test.js +894 -0
  526. package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -0
  527. package/dist/src/ui/contexts/OverflowContext.d.ts +1 -1
  528. package/dist/src/ui/contexts/OverflowContext.js +0 -5
  529. package/dist/src/ui/contexts/OverflowContext.js.map +1 -1
  530. package/dist/src/ui/contexts/SessionContext.d.ts +5 -3
  531. package/dist/src/ui/contexts/SessionContext.js +3 -16
  532. package/dist/src/ui/contexts/SessionContext.js.map +1 -1
  533. package/dist/src/ui/contexts/SettingsContext.d.ts +9 -0
  534. package/dist/src/ui/contexts/SettingsContext.js +15 -0
  535. package/dist/src/ui/contexts/SettingsContext.js.map +1 -0
  536. package/dist/src/ui/contexts/StreamingContext.d.ts +1 -1
  537. package/dist/src/ui/contexts/VimModeContext.d.ts +1 -1
  538. package/dist/src/ui/contexts/VimModeContext.js +4 -4
  539. package/dist/src/ui/contexts/VimModeContext.js.map +1 -1
  540. package/dist/src/ui/hooks/atCommandProcessor.d.ts +3 -3
  541. package/dist/src/ui/hooks/atCommandProcessor.js +20 -20
  542. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
  543. package/dist/src/ui/hooks/atCommandProcessor.test.d.ts +6 -0
  544. package/dist/src/ui/hooks/atCommandProcessor.test.js +832 -0
  545. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -0
  546. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +3 -3
  547. package/dist/src/ui/hooks/shellCommandProcessor.js +15 -19
  548. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
  549. package/dist/src/ui/hooks/shellCommandProcessor.test.d.ts +6 -0
  550. package/dist/src/ui/hooks/shellCommandProcessor.test.js +329 -0
  551. package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -0
  552. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +14 -6
  553. package/dist/src/ui/hooks/slashCommandProcessor.js +243 -65
  554. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  555. package/dist/src/ui/hooks/useAgentsManagerDialog.d.ts +11 -0
  556. package/dist/src/ui/hooks/useAgentsManagerDialog.js +21 -0
  557. package/dist/src/ui/hooks/useAgentsManagerDialog.js.map +1 -0
  558. package/dist/src/ui/hooks/useAtCompletion.d.ts +2 -2
  559. package/dist/src/ui/hooks/useAtCompletion.js +6 -4
  560. package/dist/src/ui/hooks/useAtCompletion.js.map +1 -1
  561. package/dist/src/ui/hooks/useAuthCommand.d.ts +2 -2
  562. package/dist/src/ui/hooks/useAuthCommand.js +5 -4
  563. package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
  564. package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +4 -2
  565. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +20 -19
  566. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -1
  567. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.d.ts +6 -0
  568. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +263 -0
  569. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -0
  570. package/dist/src/ui/hooks/useCommandCompletion.d.ts +8 -5
  571. package/dist/src/ui/hooks/useCommandCompletion.js +30 -9
  572. package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -1
  573. package/dist/src/ui/hooks/useCompletion.d.ts +1 -1
  574. package/dist/src/ui/hooks/useCompletion.js +1 -1
  575. package/dist/src/ui/hooks/useCompletion.js.map +1 -1
  576. package/dist/src/ui/hooks/useConsoleMessages.d.ts +1 -1
  577. package/dist/src/ui/hooks/useDialogClose.d.ts +34 -0
  578. package/dist/src/ui/hooks/useDialogClose.js +62 -0
  579. package/dist/src/ui/hooks/useDialogClose.js.map +1 -0
  580. package/dist/src/ui/hooks/useEditorSettings.d.ts +2 -2
  581. package/dist/src/ui/hooks/useEditorSettings.js.map +1 -1
  582. package/dist/src/ui/hooks/useEditorSettings.test.d.ts +6 -0
  583. package/dist/src/ui/hooks/useEditorSettings.test.js +164 -0
  584. package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -0
  585. package/dist/src/ui/hooks/useFocus.d.ts +4 -0
  586. package/dist/src/ui/hooks/useFocus.js +4 -4
  587. package/dist/src/ui/hooks/useFocus.js.map +1 -1
  588. package/dist/src/ui/hooks/useFolderTrust.d.ts +13 -0
  589. package/dist/src/ui/hooks/useFolderTrust.js +64 -0
  590. package/dist/src/ui/hooks/useFolderTrust.js.map +1 -0
  591. package/dist/src/ui/hooks/useGeminiStream.d.ts +10 -5
  592. package/dist/src/ui/hooks/useGeminiStream.js +118 -71
  593. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  594. package/dist/src/ui/hooks/useGitBranchName.js +1 -1
  595. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -1
  596. package/dist/src/ui/hooks/useGitBranchName.test.d.ts +6 -0
  597. package/dist/src/ui/hooks/useGitBranchName.test.js +175 -0
  598. package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -0
  599. package/dist/src/ui/hooks/useHistoryManager.d.ts +1 -1
  600. package/dist/src/ui/hooks/useHistoryManager.test.d.ts +6 -0
  601. package/dist/src/ui/hooks/useHistoryManager.test.js +171 -0
  602. package/dist/src/ui/hooks/useHistoryManager.test.js.map +1 -0
  603. package/dist/src/ui/hooks/useInputHistory.test.d.ts +6 -0
  604. package/dist/src/ui/hooks/useInputHistory.test.js +207 -0
  605. package/dist/src/ui/hooks/useInputHistory.test.js.map +1 -0
  606. package/dist/src/ui/hooks/useKeypress.d.ts +4 -16
  607. package/dist/src/ui/hooks/useKeypress.js +8 -140
  608. package/dist/src/ui/hooks/useKeypress.js.map +1 -1
  609. package/dist/src/ui/hooks/useKittyKeyboardProtocol.d.ts +15 -0
  610. package/dist/src/ui/hooks/useKittyKeyboardProtocol.js +20 -0
  611. package/dist/src/ui/hooks/useKittyKeyboardProtocol.js.map +1 -0
  612. package/dist/src/ui/hooks/useLaunchEditor.d.ts +10 -0
  613. package/dist/src/ui/hooks/useLaunchEditor.js +70 -0
  614. package/dist/src/ui/hooks/useLaunchEditor.js.map +1 -0
  615. package/dist/src/ui/hooks/useLoadingIndicator.test.d.ts +6 -0
  616. package/dist/src/ui/hooks/useLoadingIndicator.test.js +91 -0
  617. package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -0
  618. package/dist/src/ui/hooks/useLogger.d.ts +2 -1
  619. package/dist/src/ui/hooks/useLogger.js +3 -3
  620. package/dist/src/ui/hooks/useLogger.js.map +1 -1
  621. package/dist/src/ui/hooks/useMessageQueue.d.ts +22 -0
  622. package/dist/src/ui/hooks/useMessageQueue.js +49 -0
  623. package/dist/src/ui/hooks/useMessageQueue.js.map +1 -0
  624. package/dist/src/ui/hooks/useMessageQueue.test.d.ts +6 -0
  625. package/dist/src/ui/hooks/useMessageQueue.test.js +158 -0
  626. package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -0
  627. package/dist/src/ui/hooks/usePhraseCycler.js +2 -2
  628. package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
  629. package/dist/src/ui/hooks/usePrivacySettings.d.ts +1 -1
  630. package/dist/src/ui/hooks/usePrivacySettings.js +6 -2
  631. package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -1
  632. package/dist/src/ui/hooks/usePrivacySettings.test.d.ts +6 -0
  633. package/dist/src/ui/hooks/usePrivacySettings.test.js +154 -0
  634. package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -0
  635. package/dist/src/ui/hooks/usePromptCompletion.d.ts +23 -0
  636. package/dist/src/ui/hooks/usePromptCompletion.js +177 -0
  637. package/dist/src/ui/hooks/usePromptCompletion.js.map +1 -0
  638. package/dist/src/ui/hooks/useQuitConfirmation.d.ts +14 -0
  639. package/dist/src/ui/hooks/useQuitConfirmation.js +36 -0
  640. package/dist/src/ui/hooks/useQuitConfirmation.js.map +1 -0
  641. package/dist/src/ui/hooks/useQwenAuth.d.ts +1 -1
  642. package/dist/src/ui/hooks/useQwenAuth.js +1 -1
  643. package/dist/src/ui/hooks/useQwenAuth.js.map +1 -1
  644. package/dist/src/ui/hooks/useQwenAuth.test.d.ts +6 -0
  645. package/dist/src/ui/hooks/useQwenAuth.test.js +292 -0
  646. package/dist/src/ui/hooks/useQwenAuth.test.js.map +1 -0
  647. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +3 -3
  648. package/dist/src/ui/hooks/useReactToolScheduler.js +17 -18
  649. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
  650. package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +2 -2
  651. package/dist/src/ui/hooks/useReverseSearchCompletion.test.d.ts +6 -0
  652. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js +163 -0
  653. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js.map +1 -0
  654. package/dist/src/ui/hooks/useSettingsCommand.d.ts +10 -0
  655. package/dist/src/ui/hooks/useSettingsCommand.js +21 -0
  656. package/dist/src/ui/hooks/useSettingsCommand.js.map +1 -0
  657. package/dist/src/ui/hooks/useShellHistory.d.ts +2 -1
  658. package/dist/src/ui/hooks/useShellHistory.js +9 -10
  659. package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
  660. package/dist/src/ui/hooks/useShellHistory.test.d.ts +6 -0
  661. package/dist/src/ui/hooks/useShellHistory.test.js +187 -0
  662. package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -0
  663. package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +3 -3
  664. package/dist/src/ui/hooks/useShowMemoryCommand.js +1 -1
  665. package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -1
  666. package/dist/src/ui/hooks/useSlashCompletion.d.ts +2 -2
  667. package/dist/src/ui/hooks/useSlashCompletion.test.d.ts +6 -0
  668. package/dist/src/ui/hooks/useSlashCompletion.test.js +272 -0
  669. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -0
  670. package/dist/src/ui/hooks/useSubagentCreateDialog.d.ts +10 -0
  671. package/dist/src/ui/hooks/useSubagentCreateDialog.js +21 -0
  672. package/dist/src/ui/hooks/useSubagentCreateDialog.js.map +1 -0
  673. package/dist/src/ui/hooks/useThemeCommand.d.ts +1 -1
  674. package/dist/src/ui/hooks/useThemeCommand.js +9 -9
  675. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
  676. package/dist/src/ui/hooks/useTimer.test.d.ts +6 -0
  677. package/dist/src/ui/hooks/useTimer.test.js +90 -0
  678. package/dist/src/ui/hooks/useTimer.test.js.map +1 -0
  679. package/dist/src/ui/hooks/useToolScheduler.test.d.ts +6 -0
  680. package/dist/src/ui/hooks/useToolScheduler.test.js +850 -0
  681. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -0
  682. package/dist/src/ui/hooks/useVisionAutoSwitch.d.ts +47 -0
  683. package/dist/src/ui/hooks/useVisionAutoSwitch.js +262 -0
  684. package/dist/src/ui/hooks/useVisionAutoSwitch.js.map +1 -0
  685. package/dist/src/ui/hooks/useVisionAutoSwitch.test.d.ts +6 -0
  686. package/dist/src/ui/hooks/useVisionAutoSwitch.test.js +515 -0
  687. package/dist/src/ui/hooks/useVisionAutoSwitch.test.js.map +1 -0
  688. package/dist/src/ui/hooks/useWelcomeBack.d.ts +23 -0
  689. package/dist/src/ui/hooks/useWelcomeBack.js +79 -0
  690. package/dist/src/ui/hooks/useWelcomeBack.js.map +1 -0
  691. package/dist/src/ui/hooks/useWorkspaceMigration.d.ts +13 -0
  692. package/dist/src/ui/hooks/useWorkspaceMigration.js +53 -0
  693. package/dist/src/ui/hooks/useWorkspaceMigration.js.map +1 -0
  694. package/dist/src/ui/keyMatchers.d.ts +27 -0
  695. package/dist/src/ui/keyMatchers.js +68 -0
  696. package/dist/src/ui/keyMatchers.js.map +1 -0
  697. package/dist/src/ui/keyMatchers.test.d.ts +6 -0
  698. package/dist/src/ui/keyMatchers.test.js +276 -0
  699. package/dist/src/ui/keyMatchers.test.js.map +1 -0
  700. package/dist/src/ui/models/availableModels.d.ts +29 -0
  701. package/dist/src/ui/models/availableModels.js +40 -0
  702. package/dist/src/ui/models/availableModels.js.map +1 -0
  703. package/dist/src/ui/privacy/CloudFreePrivacyNotice.d.ts +1 -1
  704. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js +5 -4
  705. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js.map +1 -1
  706. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js +5 -4
  707. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js.map +1 -1
  708. package/dist/src/ui/privacy/GeminiPrivacyNotice.js +5 -4
  709. package/dist/src/ui/privacy/GeminiPrivacyNotice.js.map +1 -1
  710. package/dist/src/ui/semantic-colors.d.ts +7 -0
  711. package/dist/src/ui/semantic-colors.js +24 -0
  712. package/dist/src/ui/semantic-colors.js.map +1 -0
  713. package/dist/src/ui/textConstants.d.ts +9 -0
  714. package/dist/src/ui/textConstants.js +10 -0
  715. package/dist/src/ui/textConstants.js.map +1 -0
  716. package/dist/src/ui/themes/ansi-light.js +2 -1
  717. package/dist/src/ui/themes/ansi-light.js.map +1 -1
  718. package/dist/src/ui/themes/ansi.js +2 -1
  719. package/dist/src/ui/themes/ansi.js.map +1 -1
  720. package/dist/src/ui/themes/color-utils.test.d.ts +6 -0
  721. package/dist/src/ui/themes/color-utils.test.js +197 -0
  722. package/dist/src/ui/themes/color-utils.test.js.map +1 -0
  723. package/dist/src/ui/themes/googlecode.js +1 -1
  724. package/dist/src/ui/themes/googlecode.js.map +1 -1
  725. package/dist/src/ui/themes/no-color.js +30 -1
  726. package/dist/src/ui/themes/no-color.js.map +1 -1
  727. package/dist/src/ui/themes/qwen-dark.js +2 -1
  728. package/dist/src/ui/themes/qwen-dark.js.map +1 -1
  729. package/dist/src/ui/themes/qwen-light.js +2 -1
  730. package/dist/src/ui/themes/qwen-light.js.map +1 -1
  731. package/dist/src/ui/themes/semantic-tokens.d.ts +37 -0
  732. package/dist/src/ui/themes/semantic-tokens.js +94 -0
  733. package/dist/src/ui/themes/semantic-tokens.js.map +1 -0
  734. package/dist/src/ui/themes/theme-manager.d.ts +9 -1
  735. package/dist/src/ui/themes/theme-manager.js +81 -7
  736. package/dist/src/ui/themes/theme-manager.js.map +1 -1
  737. package/dist/src/ui/themes/theme-manager.test.d.ts +6 -0
  738. package/dist/src/ui/themes/theme-manager.test.js +142 -0
  739. package/dist/src/ui/themes/theme-manager.test.js.map +1 -0
  740. package/dist/src/ui/themes/theme.d.ts +45 -2
  741. package/dist/src/ui/themes/theme.js +120 -107
  742. package/dist/src/ui/themes/theme.js.map +1 -1
  743. package/dist/src/ui/types.d.ts +34 -6
  744. package/dist/src/ui/types.js +2 -0
  745. package/dist/src/ui/types.js.map +1 -1
  746. package/dist/src/ui/utils/CodeColorizer.d.ts +3 -2
  747. package/dist/src/ui/utils/CodeColorizer.js +5 -4
  748. package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
  749. package/dist/src/ui/utils/ConsolePatcher.d.ts +2 -1
  750. package/dist/src/ui/utils/ConsolePatcher.js +4 -1
  751. package/dist/src/ui/utils/ConsolePatcher.js.map +1 -1
  752. package/dist/src/ui/utils/InlineMarkdownRenderer.js +8 -1
  753. package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -1
  754. package/dist/src/ui/utils/MarkdownDisplay.js +5 -3
  755. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
  756. package/dist/src/ui/utils/MarkdownDisplay.test.d.ts +6 -0
  757. package/dist/src/ui/utils/MarkdownDisplay.test.js +161 -0
  758. package/dist/src/ui/utils/MarkdownDisplay.test.js.map +1 -0
  759. package/dist/src/ui/utils/clipboardUtils.js +4 -4
  760. package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
  761. package/dist/src/ui/utils/clipboardUtils.test.d.ts +6 -0
  762. package/dist/src/ui/utils/clipboardUtils.test.js +65 -0
  763. package/dist/src/ui/utils/clipboardUtils.test.js.map +1 -0
  764. package/dist/src/ui/utils/commandUtils.d.ts +2 -1
  765. package/dist/src/ui/utils/commandUtils.js +74 -15
  766. package/dist/src/ui/utils/commandUtils.js.map +1 -1
  767. package/dist/src/ui/utils/commandUtils.test.d.ts +6 -0
  768. package/dist/src/ui/utils/commandUtils.test.js +349 -0
  769. package/dist/src/ui/utils/commandUtils.test.js.map +1 -0
  770. package/dist/src/ui/utils/computeStats.d.ts +1 -1
  771. package/dist/src/ui/utils/computeStats.js +3 -1
  772. package/dist/src/ui/utils/computeStats.js.map +1 -1
  773. package/dist/src/ui/utils/displayUtils.test.d.ts +6 -0
  774. package/dist/src/ui/utils/displayUtils.test.js +42 -0
  775. package/dist/src/ui/utils/displayUtils.test.js.map +1 -0
  776. package/dist/src/ui/utils/formatters.test.d.ts +6 -0
  777. package/dist/src/ui/utils/formatters.test.js +56 -0
  778. package/dist/src/ui/utils/formatters.test.js.map +1 -0
  779. package/dist/src/ui/utils/isNarrowWidth.d.ts +6 -0
  780. package/dist/src/ui/utils/isNarrowWidth.js +9 -0
  781. package/dist/src/ui/utils/isNarrowWidth.js.map +1 -0
  782. package/dist/src/ui/utils/kittyProtocolDetector.d.ts +13 -0
  783. package/dist/src/ui/utils/kittyProtocolDetector.js +88 -0
  784. package/dist/src/ui/utils/kittyProtocolDetector.js.map +1 -0
  785. package/dist/src/ui/utils/markdownUtilities.test.d.ts +6 -0
  786. package/dist/src/ui/utils/markdownUtilities.test.js +42 -0
  787. package/dist/src/ui/utils/markdownUtilities.test.js.map +1 -0
  788. package/dist/src/ui/utils/platformConstants.d.ts +52 -0
  789. package/dist/src/ui/utils/platformConstants.js +53 -0
  790. package/dist/src/ui/utils/platformConstants.js.map +1 -0
  791. package/dist/src/ui/utils/terminalSetup.d.ts +30 -0
  792. package/dist/src/ui/utils/terminalSetup.js +281 -0
  793. package/dist/src/ui/utils/terminalSetup.js.map +1 -0
  794. package/dist/src/ui/utils/textUtils.d.ts +18 -0
  795. package/dist/src/ui/utils/textUtils.js +44 -0
  796. package/dist/src/ui/utils/textUtils.js.map +1 -1
  797. package/dist/src/ui/utils/updateCheck.d.ts +2 -2
  798. package/dist/src/ui/utils/updateCheck.js +2 -2
  799. package/dist/src/ui/utils/updateCheck.js.map +1 -1
  800. package/dist/src/ui/utils/updateCheck.test.d.ts +6 -0
  801. package/dist/src/ui/utils/updateCheck.test.js +145 -0
  802. package/dist/src/ui/utils/updateCheck.test.js.map +1 -0
  803. package/dist/src/utils/checks.d.ts +19 -0
  804. package/dist/src/utils/checks.js +24 -0
  805. package/dist/src/utils/checks.js.map +1 -0
  806. package/dist/src/utils/cleanup.d.ts +2 -2
  807. package/dist/src/utils/cleanup.js +7 -6
  808. package/dist/src/utils/cleanup.js.map +1 -1
  809. package/dist/src/utils/dialogScopeUtils.d.ts +32 -0
  810. package/dist/src/utils/dialogScopeUtils.js +48 -0
  811. package/dist/src/utils/dialogScopeUtils.js.map +1 -0
  812. package/dist/src/utils/errors.d.ts +6 -0
  813. package/dist/src/utils/errors.js +12 -0
  814. package/dist/src/utils/errors.js.map +1 -0
  815. package/dist/src/utils/events.d.ts +1 -1
  816. package/dist/src/utils/events.js +1 -1
  817. package/dist/src/utils/events.js.map +1 -1
  818. package/dist/src/utils/gitUtils.d.ts +21 -1
  819. package/dist/src/utils/gitUtils.js +69 -4
  820. package/dist/src/utils/gitUtils.js.map +1 -1
  821. package/dist/src/utils/gitUtils.test.d.ts +6 -0
  822. package/dist/src/utils/gitUtils.test.js +113 -0
  823. package/dist/src/utils/gitUtils.test.js.map +1 -0
  824. package/dist/src/utils/handleAutoUpdate.d.ts +4 -4
  825. package/dist/src/utils/handleAutoUpdate.js +4 -3
  826. package/dist/src/utils/handleAutoUpdate.js.map +1 -1
  827. package/dist/src/utils/installationInfo.js +3 -3
  828. package/dist/src/utils/installationInfo.js.map +1 -1
  829. package/dist/src/utils/installationInfo.test.d.ts +6 -0
  830. package/dist/src/utils/installationInfo.test.js +242 -0
  831. package/dist/src/utils/installationInfo.test.js.map +1 -0
  832. package/dist/src/utils/package.js +2 -2
  833. package/dist/src/utils/package.js.map +1 -1
  834. package/dist/src/utils/readStdin.js +25 -0
  835. package/dist/src/utils/readStdin.js.map +1 -1
  836. package/dist/src/utils/readStdin.test.d.ts +6 -0
  837. package/dist/src/utils/readStdin.test.js +88 -0
  838. package/dist/src/utils/readStdin.test.js.map +1 -0
  839. package/dist/src/utils/resolvePath.js +2 -2
  840. package/dist/src/utils/resolvePath.js.map +1 -1
  841. package/dist/src/utils/sandbox.d.ts +2 -2
  842. package/dist/src/utils/sandbox.js +460 -444
  843. package/dist/src/utils/sandbox.js.map +1 -1
  844. package/dist/src/utils/settingsUtils.d.ts +134 -0
  845. package/dist/src/utils/settingsUtils.js +330 -0
  846. package/dist/src/utils/settingsUtils.js.map +1 -0
  847. package/dist/src/utils/settingsUtils.test.d.ts +6 -0
  848. package/dist/src/utils/settingsUtils.test.js +511 -0
  849. package/dist/src/utils/settingsUtils.test.js.map +1 -0
  850. package/dist/src/utils/spawnWrapper.d.ts +1 -1
  851. package/dist/src/utils/spawnWrapper.js +1 -1
  852. package/dist/src/utils/spawnWrapper.js.map +1 -1
  853. package/dist/src/utils/startupWarnings.js +2 -2
  854. package/dist/src/utils/startupWarnings.js.map +1 -1
  855. package/dist/src/utils/updateEventEmitter.d.ts +1 -1
  856. package/dist/src/utils/updateEventEmitter.js +1 -1
  857. package/dist/src/utils/updateEventEmitter.js.map +1 -1
  858. package/dist/src/utils/userStartupWarnings.js +3 -3
  859. package/dist/src/utils/userStartupWarnings.js.map +1 -1
  860. package/dist/src/utils/userStartupWarnings.test.d.ts +6 -0
  861. package/dist/src/utils/userStartupWarnings.test.js +67 -0
  862. package/dist/src/utils/userStartupWarnings.test.js.map +1 -0
  863. package/dist/src/utils/version.js +1 -1
  864. package/dist/src/utils/version.js.map +1 -1
  865. package/dist/src/validateNonInterActiveAuth.d.ts +1 -1
  866. package/dist/src/validateNonInterActiveAuth.js +4 -7
  867. package/dist/src/validateNonInterActiveAuth.js.map +1 -1
  868. package/dist/src/zed-integration/acp.d.ts +63 -0
  869. package/dist/src/{acp → zed-integration}/acp.js +78 -45
  870. package/dist/src/zed-integration/acp.js.map +1 -0
  871. package/dist/src/zed-integration/fileSystemService.d.ts +19 -0
  872. package/dist/src/zed-integration/fileSystemService.js +43 -0
  873. package/dist/src/zed-integration/fileSystemService.js.map +1 -0
  874. package/dist/src/zed-integration/schema.d.ts +11782 -0
  875. package/dist/src/zed-integration/schema.js +311 -0
  876. package/dist/src/zed-integration/schema.js.map +1 -0
  877. package/dist/src/zed-integration/zedIntegration.d.ts +10 -0
  878. package/dist/src/zed-integration/zedIntegration.js +787 -0
  879. package/dist/src/zed-integration/zedIntegration.js.map +1 -0
  880. package/dist/tsconfig.tsbuildinfo +1 -1
  881. package/package.json +10 -7
  882. package/dist/src/acp/acp.d.ts +0 -208
  883. package/dist/src/acp/acp.js.map +0 -1
  884. package/dist/src/acp/acpPeer.d.ts +0 -8
  885. package/dist/src/acp/acpPeer.js +0 -537
  886. package/dist/src/acp/acpPeer.js.map +0 -1
  887. package/dist/src/ui/components/IDEContextDetailDisplay.d.ts +0 -12
  888. package/dist/src/ui/components/IDEContextDetailDisplay.js +0 -12
  889. package/dist/src/ui/components/IDEContextDetailDisplay.js.map +0 -1
  890. package/dist/src/ui/utils/errorParsing.d.ts +0 -7
  891. package/dist/src/ui/utils/errorParsing.js +0 -90
  892. package/dist/src/ui/utils/errorParsing.js.map +0 -1
@@ -0,0 +1,189 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, it, expect } from 'vitest';
7
+ import { extractInjections } from './injectionParser.js';
8
+ describe('extractInjections', () => {
9
+ const SHELL_TRIGGER = '!{';
10
+ const AT_FILE_TRIGGER = '@{';
11
+ describe('Basic Functionality', () => {
12
+ it('should return an empty array if no trigger is present', () => {
13
+ const prompt = 'This is a simple prompt without injections.';
14
+ const result = extractInjections(prompt, SHELL_TRIGGER);
15
+ expect(result).toEqual([]);
16
+ });
17
+ it('should extract a single, simple injection', () => {
18
+ const prompt = 'Run this command: !{ls -la}';
19
+ const result = extractInjections(prompt, SHELL_TRIGGER);
20
+ expect(result).toEqual([
21
+ {
22
+ content: 'ls -la',
23
+ startIndex: 18,
24
+ endIndex: 27,
25
+ },
26
+ ]);
27
+ });
28
+ it('should extract multiple injections', () => {
29
+ const prompt = 'First: !{cmd1}, Second: !{cmd2}';
30
+ const result = extractInjections(prompt, SHELL_TRIGGER);
31
+ expect(result).toHaveLength(2);
32
+ expect(result[0]).toEqual({
33
+ content: 'cmd1',
34
+ startIndex: 7,
35
+ endIndex: 14,
36
+ });
37
+ expect(result[1]).toEqual({
38
+ content: 'cmd2',
39
+ startIndex: 24,
40
+ endIndex: 31,
41
+ });
42
+ });
43
+ it('should handle different triggers (e.g., @{)', () => {
44
+ const prompt = 'Read this file: @{path/to/file.txt}';
45
+ const result = extractInjections(prompt, AT_FILE_TRIGGER);
46
+ expect(result).toEqual([
47
+ {
48
+ content: 'path/to/file.txt',
49
+ startIndex: 16,
50
+ endIndex: 35,
51
+ },
52
+ ]);
53
+ });
54
+ });
55
+ describe('Positioning and Edge Cases', () => {
56
+ it('should handle injections at the start and end of the prompt', () => {
57
+ const prompt = '!{start} middle text !{end}';
58
+ const result = extractInjections(prompt, SHELL_TRIGGER);
59
+ expect(result).toHaveLength(2);
60
+ expect(result[0]).toEqual({
61
+ content: 'start',
62
+ startIndex: 0,
63
+ endIndex: 8,
64
+ });
65
+ expect(result[1]).toEqual({
66
+ content: 'end',
67
+ startIndex: 21,
68
+ endIndex: 27,
69
+ });
70
+ });
71
+ it('should handle adjacent injections', () => {
72
+ const prompt = '!{A}!{B}';
73
+ const result = extractInjections(prompt, SHELL_TRIGGER);
74
+ expect(result).toHaveLength(2);
75
+ expect(result[0]).toEqual({ content: 'A', startIndex: 0, endIndex: 4 });
76
+ expect(result[1]).toEqual({ content: 'B', startIndex: 4, endIndex: 8 });
77
+ });
78
+ it('should handle empty injections', () => {
79
+ const prompt = 'Empty: !{}';
80
+ const result = extractInjections(prompt, SHELL_TRIGGER);
81
+ expect(result).toEqual([
82
+ {
83
+ content: '',
84
+ startIndex: 7,
85
+ endIndex: 10,
86
+ },
87
+ ]);
88
+ });
89
+ it('should trim whitespace within the content', () => {
90
+ const prompt = '!{ \n command with space \t }';
91
+ const result = extractInjections(prompt, SHELL_TRIGGER);
92
+ expect(result).toEqual([
93
+ {
94
+ content: 'command with space',
95
+ startIndex: 0,
96
+ endIndex: 29,
97
+ },
98
+ ]);
99
+ });
100
+ it('should ignore similar patterns that are not the exact trigger', () => {
101
+ const prompt = 'Not a trigger: !(cmd) or {cmd} or ! {cmd}';
102
+ const result = extractInjections(prompt, SHELL_TRIGGER);
103
+ expect(result).toEqual([]);
104
+ });
105
+ it('should ignore extra closing braces before the trigger', () => {
106
+ const prompt = 'Ignore this } then !{run}';
107
+ const result = extractInjections(prompt, SHELL_TRIGGER);
108
+ expect(result).toEqual([
109
+ {
110
+ content: 'run',
111
+ startIndex: 19,
112
+ endIndex: 25,
113
+ },
114
+ ]);
115
+ });
116
+ it('should stop parsing at the first balanced closing brace (non-greedy)', () => {
117
+ // This tests that the parser doesn't greedily consume extra closing braces
118
+ const prompt = 'Run !{ls -l}} extra braces';
119
+ const result = extractInjections(prompt, SHELL_TRIGGER);
120
+ expect(result).toEqual([
121
+ {
122
+ content: 'ls -l',
123
+ startIndex: 4,
124
+ endIndex: 12,
125
+ },
126
+ ]);
127
+ });
128
+ });
129
+ describe('Nested Braces (Balanced)', () => {
130
+ it('should correctly parse content with simple nested braces (e.g., JSON)', () => {
131
+ const prompt = `Send JSON: !{curl -d '{"key": "value"}'}`;
132
+ const result = extractInjections(prompt, SHELL_TRIGGER);
133
+ expect(result).toHaveLength(1);
134
+ expect(result[0].content).toBe(`curl -d '{"key": "value"}'`);
135
+ });
136
+ it('should correctly parse content with shell constructs (e.g., awk)', () => {
137
+ const prompt = `Process text: !{awk '{print $1}' file.txt}`;
138
+ const result = extractInjections(prompt, SHELL_TRIGGER);
139
+ expect(result).toHaveLength(1);
140
+ expect(result[0].content).toBe(`awk '{print $1}' file.txt`);
141
+ });
142
+ it('should correctly parse multiple levels of nesting', () => {
143
+ const prompt = `!{level1 {level2 {level3}} suffix}`;
144
+ const result = extractInjections(prompt, SHELL_TRIGGER);
145
+ expect(result).toHaveLength(1);
146
+ expect(result[0].content).toBe(`level1 {level2 {level3}} suffix`);
147
+ expect(result[0].endIndex).toBe(prompt.length);
148
+ });
149
+ it('should correctly parse paths containing balanced braces', () => {
150
+ const prompt = 'Analyze @{path/with/{braces}/file.txt}';
151
+ const result = extractInjections(prompt, AT_FILE_TRIGGER);
152
+ expect(result).toHaveLength(1);
153
+ expect(result[0].content).toBe('path/with/{braces}/file.txt');
154
+ });
155
+ it('should correctly handle an injection containing the trigger itself', () => {
156
+ // This works because the parser counts braces, it doesn't look for the trigger again until the current one is closed.
157
+ const prompt = '!{echo "The trigger is !{ confusing }"}';
158
+ const expectedContent = 'echo "The trigger is !{ confusing }"';
159
+ const result = extractInjections(prompt, SHELL_TRIGGER);
160
+ expect(result).toHaveLength(1);
161
+ expect(result[0].content).toBe(expectedContent);
162
+ });
163
+ });
164
+ describe('Error Handling (Unbalanced/Unclosed)', () => {
165
+ it('should throw an error for a simple unclosed injection', () => {
166
+ const prompt = 'This prompt has !{an unclosed trigger';
167
+ expect(() => extractInjections(prompt, SHELL_TRIGGER)).toThrow(/Invalid syntax: Unclosed injection starting at index 16 \('!{'\)/);
168
+ });
169
+ it('should throw an error if the prompt ends inside a nested block', () => {
170
+ const prompt = 'This fails: !{outer {inner';
171
+ expect(() => extractInjections(prompt, SHELL_TRIGGER)).toThrow(/Invalid syntax: Unclosed injection starting at index 12 \('!{'\)/);
172
+ });
173
+ it('should include the context name in the error message if provided', () => {
174
+ const prompt = 'Failing !{command';
175
+ const contextName = 'test-command';
176
+ expect(() => extractInjections(prompt, SHELL_TRIGGER, contextName)).toThrow(/Invalid syntax in command 'test-command': Unclosed injection starting at index 8/);
177
+ });
178
+ it('should throw if content contains unbalanced braces (e.g., missing closing)', () => {
179
+ // This is functionally the same as an unclosed injection from the parser's perspective.
180
+ const prompt = 'Analyze @{path/with/braces{example.txt}';
181
+ expect(() => extractInjections(prompt, AT_FILE_TRIGGER)).toThrow(/Invalid syntax: Unclosed injection starting at index 8 \('@{'\)/);
182
+ });
183
+ it('should clearly state that unbalanced braces in content are not supported in the error', () => {
184
+ const prompt = 'Analyze @{path/with/braces{example.txt}';
185
+ expect(() => extractInjections(prompt, AT_FILE_TRIGGER)).toThrow(/Paths or commands with unbalanced braces are not supported directly/);
186
+ });
187
+ });
188
+ });
189
+ //# sourceMappingURL=injectionParser.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectionParser.test.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/injectionParser.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,aAAa,GAAG,IAAI,CAAC;IAC3B,MAAM,eAAe,GAAG,IAAI,CAAC;IAE7B,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAC/D,MAAM,MAAM,GAAG,6CAA6C,CAAC;YAC7D,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YACxD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACnD,MAAM,MAAM,GAAG,6BAA6B,CAAC;YAC7C,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YACxD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB;oBACE,OAAO,EAAE,QAAQ;oBACjB,UAAU,EAAE,EAAE;oBACd,QAAQ,EAAE,EAAE;iBACb;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,MAAM,GAAG,iCAAiC,CAAC;YACjD,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,EAAE,aAAa,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,EAAE,aAAa,EAAE,WAAW,CAAC,CACtD,CAAC,OAAO,CACP,kFAAkF,CACnF,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4EAA4E,EAAE,GAAG,EAAE;YACpF,wFAAwF;YACxF,MAAM,MAAM,GAAG,yCAAyC,CAAC;YACzD,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,OAAO,CAC9D,iEAAiE,CAClE,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uFAAuF,EAAE,GAAG,EAAE;YAC/F,MAAM,MAAM,GAAG,yCAAyC,CAAC;YACzD,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,OAAO,CAC9D,qEAAqE,CACtE,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -3,30 +3,25 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { CommandContext } from '../../ui/commands/types.js';
7
- import { IPromptProcessor } from './types.js';
6
+ import type { CommandContext } from '../../ui/commands/types.js';
7
+ import type { IPromptProcessor, PromptPipelineContent } from './types.js';
8
8
  export declare class ConfirmationRequiredError extends Error {
9
9
  commandsToConfirm: string[];
10
10
  constructor(message: string, commandsToConfirm: string[]);
11
11
  }
12
12
  /**
13
- * Finds all instances of shell command injections (`!{...}`) in a prompt,
14
- * executes them, and replaces the injection site with the command's output.
13
+ * Handles prompt interpolation, including shell command execution (`!{...}`)
14
+ * and context-aware argument injection (`{{args}}`).
15
15
  *
16
- * This processor ensures that only allowlisted commands are executed. If a
17
- * disallowed command is found, it halts execution and reports an error.
16
+ * This processor ensures that:
17
+ * 1. `{{args}}` outside `!{...}` are replaced with raw input.
18
+ * 2. `{{args}}` inside `!{...}` are replaced with shell-escaped input.
19
+ * 3. Shell commands are executed securely after argument substitution.
20
+ * 4. Parsing correctly handles nested braces.
18
21
  */
19
22
  export declare class ShellProcessor implements IPromptProcessor {
20
23
  private readonly commandName;
21
- /**
22
- * A regular expression to find all instances of `!{...}`. The inner
23
- * capture group extracts the command itself.
24
- */
25
- private static readonly SHELL_INJECTION_REGEX;
26
- /**
27
- * @param commandName The name of the custom command being executed, used
28
- * for logging and error messages.
29
- */
30
24
  constructor(commandName: string);
31
- process(prompt: string, context: CommandContext): Promise<string>;
25
+ process(prompt: PromptPipelineContent, context: CommandContext): Promise<PromptPipelineContent>;
26
+ private processString;
32
27
  }
@@ -3,7 +3,9 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { checkCommandPermissions, ShellExecutionService, } from '@umsai/ums-code-core';
6
+ import { ApprovalMode, checkCommandPermissions, escapeShellArg, getShellConfiguration, ShellExecutionService, flatMapTextParts, } from '@umsai/ums-code-core';
7
+ import { SHELL_INJECTION_TRIGGER, SHORTHAND_ARGS_PLACEHOLDER, } from './types.js';
8
+ import { extractInjections } from './injectionParser.js';
7
9
  export class ConfirmationRequiredError extends Error {
8
10
  commandsToConfirm;
9
11
  constructor(message, commandsToConfirm) {
@@ -13,65 +15,107 @@ export class ConfirmationRequiredError extends Error {
13
15
  }
14
16
  }
15
17
  /**
16
- * Finds all instances of shell command injections (`!{...}`) in a prompt,
17
- * executes them, and replaces the injection site with the command's output.
18
+ * Handles prompt interpolation, including shell command execution (`!{...}`)
19
+ * and context-aware argument injection (`{{args}}`).
18
20
  *
19
- * This processor ensures that only allowlisted commands are executed. If a
20
- * disallowed command is found, it halts execution and reports an error.
21
+ * This processor ensures that:
22
+ * 1. `{{args}}` outside `!{...}` are replaced with raw input.
23
+ * 2. `{{args}}` inside `!{...}` are replaced with shell-escaped input.
24
+ * 3. Shell commands are executed securely after argument substitution.
25
+ * 4. Parsing correctly handles nested braces.
21
26
  */
22
27
  export class ShellProcessor {
23
28
  commandName;
24
- /**
25
- * A regular expression to find all instances of `!{...}`. The inner
26
- * capture group extracts the command itself.
27
- */
28
- static SHELL_INJECTION_REGEX = /!\{([^}]*)\}/g;
29
- /**
30
- * @param commandName The name of the custom command being executed, used
31
- * for logging and error messages.
32
- */
33
29
  constructor(commandName) {
34
30
  this.commandName = commandName;
35
31
  }
36
32
  async process(prompt, context) {
37
- const { config, sessionShellAllowlist } = {
38
- ...context.services,
39
- ...context.session,
40
- };
41
- const commandsToExecute = [];
42
- const commandsToConfirm = new Set();
43
- const matches = [...prompt.matchAll(ShellProcessor.SHELL_INJECTION_REGEX)];
44
- if (matches.length === 0) {
45
- return prompt; // No shell commands, nothing to do.
33
+ return flatMapTextParts(prompt, (text) => this.processString(text, context));
34
+ }
35
+ async processString(prompt, context) {
36
+ const userArgsRaw = context.invocation?.args || '';
37
+ if (!prompt.includes(SHELL_INJECTION_TRIGGER)) {
38
+ return [
39
+ { text: prompt.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw) },
40
+ ];
41
+ }
42
+ const config = context.services.config;
43
+ if (!config) {
44
+ throw new Error(`Security configuration not loaded. Cannot verify shell command permissions for '${this.commandName}'. Aborting.`);
46
45
  }
47
- // Discover all commands and check permissions.
48
- for (const match of matches) {
49
- const command = match[1].trim();
46
+ const { sessionShellAllowlist } = context.session;
47
+ const injections = extractInjections(prompt, SHELL_INJECTION_TRIGGER, this.commandName);
48
+ // If extractInjections found no closed blocks (and didn't throw), treat as raw.
49
+ if (injections.length === 0) {
50
+ return [
51
+ { text: prompt.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw) },
52
+ ];
53
+ }
54
+ const { shell } = getShellConfiguration();
55
+ const userArgsEscaped = escapeShellArg(userArgsRaw, shell);
56
+ const resolvedInjections = injections.map((injection) => {
57
+ const command = injection.content;
58
+ if (command === '') {
59
+ return { ...injection, resolvedCommand: undefined };
60
+ }
61
+ const resolvedCommand = command.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsEscaped);
62
+ return { ...injection, resolvedCommand };
63
+ });
64
+ const commandsToConfirm = new Set();
65
+ for (const injection of resolvedInjections) {
66
+ const command = injection.resolvedCommand;
67
+ if (!command)
68
+ continue;
69
+ // Security check on the final, escaped command string.
50
70
  const { allAllowed, disallowedCommands, blockReason, isHardDenial } = checkCommandPermissions(command, config, sessionShellAllowlist);
51
71
  if (!allAllowed) {
52
- // If it's a hard denial, this is a non-recoverable security error.
53
72
  if (isHardDenial) {
54
- throw new Error(`${this.commandName} cannot be run. ${blockReason || 'A shell command in this custom command is explicitly blocked in your config settings.'}`);
73
+ throw new Error(`${this.commandName} cannot be run. Blocked command: "${command}". Reason: ${blockReason || 'Blocked by configuration.'}`);
74
+ }
75
+ // If not a hard denial, respect YOLO mode and auto-approve.
76
+ if (config.getApprovalMode() !== ApprovalMode.YOLO) {
77
+ disallowedCommands.forEach((uc) => commandsToConfirm.add(uc));
55
78
  }
56
- // Add each soft denial disallowed command to the set for confirmation.
57
- disallowedCommands.forEach((uc) => commandsToConfirm.add(uc));
58
79
  }
59
- commandsToExecute.push({ fullMatch: match[0], command });
60
80
  }
61
- // If any commands require confirmation, throw a special error to halt the
62
- // pipeline and trigger the UI flow.
81
+ // Handle confirmation requirements.
63
82
  if (commandsToConfirm.size > 0) {
64
83
  throw new ConfirmationRequiredError('Shell command confirmation required', Array.from(commandsToConfirm));
65
84
  }
66
- // Execute all commands (only runs if no confirmation was needed).
67
- let processedPrompt = prompt;
68
- for (const { fullMatch, command } of commandsToExecute) {
69
- const { result } = ShellExecutionService.execute(command, config.getTargetDir(), () => { }, // No streaming needed.
70
- new AbortController().signal);
71
- const executionResult = await result;
72
- processedPrompt = processedPrompt.replace(fullMatch, executionResult.output);
85
+ let processedPrompt = '';
86
+ let lastIndex = 0;
87
+ for (const injection of resolvedInjections) {
88
+ // Append the text segment BEFORE the injection, substituting {{args}} with RAW input.
89
+ const segment = prompt.substring(lastIndex, injection.startIndex);
90
+ processedPrompt += segment.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw);
91
+ // Execute the resolved command (which already has ESCAPED input).
92
+ if (injection.resolvedCommand) {
93
+ const { result } = await ShellExecutionService.execute(injection.resolvedCommand, config.getTargetDir(), () => { }, new AbortController().signal, config.getShouldUseNodePtyShell());
94
+ const executionResult = await result;
95
+ // Handle Spawn Errors
96
+ if (executionResult.error && !executionResult.aborted) {
97
+ throw new Error(`Failed to start shell command in '${this.commandName}': ${executionResult.error.message}. Command: ${injection.resolvedCommand}`);
98
+ }
99
+ // Append the output, making stderr explicit for the model.
100
+ processedPrompt += executionResult.output;
101
+ // Append a status message if the command did not succeed.
102
+ if (executionResult.aborted) {
103
+ processedPrompt += `\n[Shell command '${injection.resolvedCommand}' aborted]`;
104
+ }
105
+ else if (executionResult.exitCode !== 0 &&
106
+ executionResult.exitCode !== null) {
107
+ processedPrompt += `\n[Shell command '${injection.resolvedCommand}' exited with code ${executionResult.exitCode}]`;
108
+ }
109
+ else if (executionResult.signal !== null) {
110
+ processedPrompt += `\n[Shell command '${injection.resolvedCommand}' terminated by signal ${executionResult.signal}]`;
111
+ }
112
+ }
113
+ lastIndex = injection.endIndex;
73
114
  }
74
- return processedPrompt;
115
+ // Append the remaining text AFTER the last injection, substituting {{args}} with RAW input.
116
+ const finalSegment = prompt.substring(lastIndex);
117
+ processedPrompt += finalSegment.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw);
118
+ return [{ text: processedPrompt }];
75
119
  }
76
120
  }
77
121
  //# sourceMappingURL=shellProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shellProcessor.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/shellProcessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAK9B,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAGzC;IAFT,YACE,OAAe,EACR,iB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uF,EAAE,CAC/I,CAAC;gBACJ,CAAC;gBAED,uEAAuE;gBACvE,kBAAkB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAChE,CAAC;YACD,iBAAiB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,0EAA0E;QAC1E,oCAAoC;QACpC,IAAI,iBAAiB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,yBAAyB,CACjC,qCAAqC,EACrC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAC9B,CAAC;QACJ,CAAC;QAED,kEAAkE;QAClE,IAAI,eAAe,GAAG,MAAM,CAAC;QAC7B,KAAK,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,iBAAiB,EAAE,CAAC;YACvD,MAAM,EAAE,MAAM,EAAE,GAAG,qBAAqB,CAAC,OAAO,CAC9C,OAAO,EACP,MAAO,CAAC,YAAY,EAAE,EACtB,GAAG,EAAE,GAAE,CAAC,EAAE,uBAAuB;YACjC,IAAI,eAAe,EAAE,CAAC,MAAM,CAC7B,CAAC;YAEF,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC;YACrC,eAAe,GAAG,eAAe,CAAC,OAAO,CACvC,SAAS,EACT,eAAe,CAAC,MAAM,CACvB,CAAC;QACJ,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC"}
1
+ {"version":3,"file":"shellProcessor.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/shellProcessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,uBAAuB,E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,CAAC,WAAW,MAAM,eAAe,CAAC,KAAK,CAAC,OAAO,cAAc,SAAS,CAAC,eAAe,EAAE,CAClI,CAAC;gBACJ,CAAC;gBAED,2DAA2D;gBAC3D,eAAe,IAAI,eAAe,CAAC,MAAM,CAAC;gBAE1C,0DAA0D;gBAC1D,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;oBAC5B,eAAe,IAAI,qBAAqB,SAAS,CAAC,eAAe,YAAY,CAAC;gBAChF,CAAC;qBAAM,IACL,eAAe,CAAC,QAAQ,KAAK,CAAC;oBAC9B,eAAe,CAAC,QAAQ,KAAK,IAAI,EACjC,CAAC;oBACD,eAAe,IAAI,qBAAqB,SAAS,CAAC,eAAe,sBAAsB,eAAe,CAAC,QAAQ,GAAG,CAAC;gBACrH,CAAC;qBAAM,IAAI,eAAe,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;oBAC3C,eAAe,IAAI,qBAAqB,SAAS,CAAC,eAAe,0BAA0B,eAAe,CAAC,MAAM,GAAG,CAAC;gBACvH,CAAC;YACH,CAAC;YAED,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC;QACjC,CAAC;QAED,4FAA4F;QAC5F,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACjD,eAAe,IAAI,YAAY,CAAC,UAAU,CACxC,0BAA0B,EAC1B,WAAW,CACZ,CAAC;QAEF,OAAO,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -3,7 +3,12 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { CommandContext } from '../../ui/commands/types.js';
6
+ import type { CommandContext } from '../../ui/commands/types.js';
7
+ import type { PartUnion } from '@google/genai';
8
+ /**
9
+ * Defines the input/output type for prompt processors.
10
+ */
11
+ export type PromptPipelineContent = PartUnion[];
7
12
  /**
8
13
  * Defines the interface for a prompt processor, a module that can transform
9
14
  * a prompt string before it is sent to the model. Processors are chained
@@ -11,12 +16,8 @@ import { CommandContext } from '../../ui/commands/types.js';
11
16
  */
12
17
  export interface IPromptProcessor {
13
18
  /**
14
- * Processes a prompt string, applying a specific transformation as part of a pipeline.
15
- *
16
- * Each processor in a command's pipeline receives the output of the previous
17
- * processor. This method provides the full command context, allowing for
18
- * complex transformations that may require access to invocation details,
19
- * application services, or UI state.
19
+ * Processes a prompt input (which may contain text and multi-modal parts),
20
+ * applying a specific transformation as part of a pipeline.
20
21
  *
21
22
  * @param prompt The current state of the prompt string. This may have been
22
23
  * modified by previous processors in the pipeline.
@@ -26,13 +27,19 @@ export interface IPromptProcessor {
26
27
  * @returns A promise that resolves to the transformed prompt string, which
27
28
  * will be passed to the next processor or, if it's the last one, sent to the model.
28
29
  */
29
- process(prompt: string, context: CommandContext): Promise<string>;
30
+ process(prompt: PromptPipelineContent, context: CommandContext): Promise<PromptPipelineContent>;
30
31
  }
31
32
  /**
32
33
  * The placeholder string for shorthand argument injection in custom commands.
34
+ * When used outside of !{...}, arguments are injected raw.
35
+ * When used inside !{...}, arguments are shell-escaped.
33
36
  */
34
37
  export declare const SHORTHAND_ARGS_PLACEHOLDER = "{{args}}";
35
38
  /**
36
39
  * The trigger string for shell command injection in custom commands.
37
40
  */
38
41
  export declare const SHELL_INJECTION_TRIGGER = "!{";
42
+ /**
43
+ * The trigger string for at file injection in custom commands.
44
+ */
45
+ export declare const AT_FILE_INJECTION_TRIGGER = "@{";
@@ -5,10 +5,16 @@
5
5
  */
6
6
  /**
7
7
  * The placeholder string for shorthand argument injection in custom commands.
8
+ * When used outside of !{...}, arguments are injected raw.
9
+ * When used inside !{...}, arguments are shell-escaped.
8
10
  */
9
11
  export const SHORTHAND_ARGS_PLACEHOLDER = '{{args}}';
10
12
  /**
11
13
  * The trigger string for shell command injection in custom commands.
12
14
  */
13
15
  export const SHELL_INJECTION_TRIGGER = '!{';
16
+ /**
17
+ * The trigger string for at file injection in custom commands.
18
+ */
19
+ export const AT_FILE_INJECTION_TRIGGER = '@{';
14
20
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6BH;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/services/prompt-processors/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkCH;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { SlashCommand } from '../ui/commands/types.js';
6
+ import type { SlashCommand } from '../ui/commands/types.js';
7
7
  /**
8
8
  * Defines the contract for any class that can load and provide slash commands.
9
9
  * This allows the CommandService to be extended with new command sources
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ declare module 'vitest' {
7
+ interface Assertion<T> {
8
+ toHaveOnlyValidCharacters(): T;
9
+ }
10
+ interface AsymmetricMatchersContaining {
11
+ toHaveOnlyValidCharacters(): void;
12
+ }
13
+ }
14
+ export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { expect } from 'vitest';
7
+ // RegExp to detect invalid characters: backspace, and ANSI escape codes
8
+ // eslint-disable-next-line no-control-regex
9
+ const invalidCharsRegex = /[\b\x1b]/;
10
+ function toHaveOnlyValidCharacters(buffer) {
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ const { isNot } = this;
13
+ let pass = true;
14
+ const invalidLines = [];
15
+ for (let i = 0; i < buffer.lines.length; i++) {
16
+ const line = buffer.lines[i];
17
+ if (line.includes('\n')) {
18
+ pass = false;
19
+ invalidLines.push({ line: i, content: line });
20
+ break; // Fail fast on newlines
21
+ }
22
+ if (invalidCharsRegex.test(line)) {
23
+ pass = false;
24
+ invalidLines.push({ line: i, content: line });
25
+ }
26
+ }
27
+ return {
28
+ pass,
29
+ message: () => `Expected buffer ${isNot ? 'not ' : ''}to have only valid characters, but found invalid characters in lines:\n${invalidLines
30
+ .map((l) => ` [${l.line}]: "${l.content}"`) /* This line was changed */
31
+ .join('\n')}`,
32
+ actual: buffer.lines,
33
+ expected: 'Lines with no line breaks, backspaces, or escape codes.',
34
+ };
35
+ }
36
+ expect.extend({
37
+ toHaveOnlyValidCharacters,
38
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
+ });
40
+ //# sourceMappingURL=customMatchers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customMatchers.js","sourceRoot":"","sources":["../../../src/test-utils/customMatchers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,wEAAwE;AACxE,4CAA4C;AAC5C,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAErC,SAAS,yBAAyB,CAAkB,MAAkB;IACpE,8DAA8D;IAC9D,MAAM,EAAE,KAAK,EAAE,GAAG,IAAW,CAAC;IAC9B,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,MAAM,YAAY,GAA6C,EAAE,CAAC;IAElE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,IAAI,GAAG,KAAK,CAAC;YACb,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,MAAM,CAAC,wBAAwB;QACjC,CAAC;QACD,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,IAAI,GAAG,KAAK,CAAC;YACb,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,GAAG,EAAE,CACZ,mBAAmB,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,0EAA0E,YAAY;aACzH,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,2BAA2B;aACvE,IAAI,CAAC,IAAI,CAAC,EAAE;QACjB,MAAM,EAAE,MAAM,CAAC,KAAK;QACpB,QAAQ,EAAE,yDAAyD;KACpE,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,CAAC;IACZ,yBAAyB;IACzB,8DAA8D;CACxD,CAAC,CAAC"}
@@ -0,0 +1,18 @@
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
+ type DeepPartial<T> = T extends object ? {
8
+ [P in keyof T]?: DeepPartial<T[P]>;
9
+ } : T;
10
+ /**
11
+ * Creates a deep, fully-typed mock of the CommandContext for use in tests.
12
+ * All functions are pre-mocked with `vi.fn()`.
13
+ *
14
+ * @param overrides - A deep partial object to override any default mock values.
15
+ * @returns A complete, mocked CommandContext object.
16
+ */
17
+ export declare const createMockCommandContext: (overrides?: DeepPartial<CommandContext>) => CommandContext;
18
+ export {};