@didim365/agent-cli 0.1.1 → 0.1.3

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 (1091) hide show
  1. package/dist/package.json +5 -2
  2. package/dist/src/config/settingsSchema.d.ts +85 -0
  3. package/dist/src/config/settingsSchema.js +85 -0
  4. package/dist/src/config/settingsSchema.js.map +1 -1
  5. package/dist/src/core/initializer.js +42 -3
  6. package/dist/src/core/initializer.js.map +1 -1
  7. package/dist/src/gemini.d.ts +6 -0
  8. package/dist/src/gemini.js +79 -5
  9. package/dist/src/gemini.js.map +1 -1
  10. package/dist/src/generated/git-commit.d.ts +1 -1
  11. package/dist/src/generated/git-commit.js +1 -1
  12. package/dist/src/test-utils/render.js +9 -0
  13. package/dist/src/test-utils/render.js.map +1 -1
  14. package/dist/src/ui/AppContainer.js +182 -9
  15. package/dist/src/ui/AppContainer.js.map +1 -1
  16. package/dist/src/ui/auth/ApiAuthDialog.d.ts +3 -1
  17. package/dist/src/ui/auth/ApiAuthDialog.js +7 -5
  18. package/dist/src/ui/auth/ApiAuthDialog.js.map +1 -1
  19. package/dist/src/ui/auth/AuthDialog.d.ts +3 -1
  20. package/dist/src/ui/auth/AuthDialog.js +6 -6
  21. package/dist/src/ui/auth/AuthDialog.js.map +1 -1
  22. package/dist/src/ui/auth/ProviderSelectDialog.d.ts +15 -0
  23. package/dist/src/ui/auth/ProviderSelectDialog.js +39 -0
  24. package/dist/src/ui/auth/ProviderSelectDialog.js.map +1 -0
  25. package/dist/src/ui/auth/SlmConfigDialog.d.ts +21 -0
  26. package/dist/src/ui/auth/SlmConfigDialog.js +170 -0
  27. package/dist/src/ui/auth/SlmConfigDialog.js.map +1 -0
  28. package/dist/src/ui/auth/VertexConfigDialog.d.ts +18 -0
  29. package/dist/src/ui/auth/VertexConfigDialog.js +97 -0
  30. package/dist/src/ui/auth/VertexConfigDialog.js.map +1 -0
  31. package/dist/src/ui/auth/providerMetadata.d.ts +38 -0
  32. package/dist/src/ui/auth/providerMetadata.js +71 -0
  33. package/dist/src/ui/auth/providerMetadata.js.map +1 -0
  34. package/dist/src/ui/auth/useAuth.d.ts +3 -0
  35. package/dist/src/ui/auth/useAuth.js +243 -39
  36. package/dist/src/ui/auth/useAuth.js.map +1 -1
  37. package/dist/src/ui/commands/authCommand.js +18 -1
  38. package/dist/src/ui/commands/authCommand.js.map +1 -1
  39. package/dist/src/ui/commands/initCommand.js +1 -1
  40. package/dist/src/ui/commands/initCommand.js.map +1 -1
  41. package/dist/src/ui/commands/rewindCommand.js.map +1 -1
  42. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
  43. package/dist/src/ui/components/DialogManager.js +27 -2
  44. package/dist/src/ui/components/DialogManager.js.map +1 -1
  45. package/dist/src/ui/components/InputPrompt.js +1 -1
  46. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  47. package/dist/src/ui/contexts/UIActionsContext.d.ts +14 -0
  48. package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
  49. package/dist/src/ui/contexts/UIStateContext.d.ts +4 -0
  50. package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
  51. package/dist/src/ui/hooks/useRewind.js.map +1 -1
  52. package/dist/src/ui/types.d.ts +4 -1
  53. package/dist/src/ui/types.js +6 -0
  54. package/dist/src/ui/types.js.map +1 -1
  55. package/dist/src/ui/utils/mouse.js +1 -1
  56. package/dist/src/ui/utils/mouse.js.map +1 -1
  57. package/dist/src/ui/utils/rewindFileOps.js.map +1 -1
  58. package/package.json +6 -3
  59. package/dist/src/commands/extensions/configure.test.d.ts +0 -1
  60. package/dist/src/commands/extensions/configure.test.js +0 -197
  61. package/dist/src/commands/extensions/configure.test.js.map +0 -1
  62. package/dist/src/commands/extensions/disable.test.d.ts +0 -6
  63. package/dist/src/commands/extensions/disable.test.js +0 -169
  64. package/dist/src/commands/extensions/disable.test.js.map +0 -1
  65. package/dist/src/commands/extensions/enable.test.d.ts +0 -6
  66. package/dist/src/commands/extensions/enable.test.js +0 -199
  67. package/dist/src/commands/extensions/enable.test.js.map +0 -1
  68. package/dist/src/commands/extensions/install.test.d.ts +0 -6
  69. package/dist/src/commands/extensions/install.test.js +0 -140
  70. package/dist/src/commands/extensions/install.test.js.map +0 -1
  71. package/dist/src/commands/extensions/link.test.d.ts +0 -6
  72. package/dist/src/commands/extensions/link.test.js +0 -137
  73. package/dist/src/commands/extensions/link.test.js.map +0 -1
  74. package/dist/src/commands/extensions/list.test.d.ts +0 -6
  75. package/dist/src/commands/extensions/list.test.js +0 -148
  76. package/dist/src/commands/extensions/list.test.js.map +0 -1
  77. package/dist/src/commands/extensions/new.test.d.ts +0 -6
  78. package/dist/src/commands/extensions/new.test.js +0 -62
  79. package/dist/src/commands/extensions/new.test.js.map +0 -1
  80. package/dist/src/commands/extensions/uninstall.test.d.ts +0 -6
  81. package/dist/src/commands/extensions/uninstall.test.js +0 -199
  82. package/dist/src/commands/extensions/uninstall.test.js.map +0 -1
  83. package/dist/src/commands/extensions/update.test.d.ts +0 -6
  84. package/dist/src/commands/extensions/update.test.js +0 -170
  85. package/dist/src/commands/extensions/update.test.js.map +0 -1
  86. package/dist/src/commands/extensions/validate.test.d.ts +0 -6
  87. package/dist/src/commands/extensions/validate.test.js +0 -96
  88. package/dist/src/commands/extensions/validate.test.js.map +0 -1
  89. package/dist/src/commands/extensions.test.d.ts +0 -6
  90. package/dist/src/commands/extensions.test.js +0 -67
  91. package/dist/src/commands/extensions.test.js.map +0 -1
  92. package/dist/src/commands/hooks/migrate.test.d.ts +0 -6
  93. package/dist/src/commands/hooks/migrate.test.js +0 -388
  94. package/dist/src/commands/hooks/migrate.test.js.map +0 -1
  95. package/dist/src/commands/mcp/add.test.d.ts +0 -6
  96. package/dist/src/commands/mcp/add.test.js +0 -274
  97. package/dist/src/commands/mcp/add.test.js.map +0 -1
  98. package/dist/src/commands/mcp/list.test.d.ts +0 -6
  99. package/dist/src/commands/mcp/list.test.js +0 -150
  100. package/dist/src/commands/mcp/list.test.js.map +0 -1
  101. package/dist/src/commands/mcp/remove.test.d.ts +0 -6
  102. package/dist/src/commands/mcp/remove.test.js +0 -189
  103. package/dist/src/commands/mcp/remove.test.js.map +0 -1
  104. package/dist/src/commands/mcp.test.d.ts +0 -6
  105. package/dist/src/commands/mcp.test.js +0 -65
  106. package/dist/src/commands/mcp.test.js.map +0 -1
  107. package/dist/src/commands/skills/disable.test.d.ts +0 -6
  108. package/dist/src/commands/skills/disable.test.js +0 -96
  109. package/dist/src/commands/skills/disable.test.js.map +0 -1
  110. package/dist/src/commands/skills/enable.test.d.ts +0 -6
  111. package/dist/src/commands/skills/enable.test.js +0 -107
  112. package/dist/src/commands/skills/enable.test.js.map +0 -1
  113. package/dist/src/commands/skills/install.test.d.ts +0 -6
  114. package/dist/src/commands/skills/install.test.js +0 -95
  115. package/dist/src/commands/skills/install.test.js.map +0 -1
  116. package/dist/src/commands/skills/list.test.d.ts +0 -6
  117. package/dist/src/commands/skills/list.test.js +0 -136
  118. package/dist/src/commands/skills/list.test.js.map +0 -1
  119. package/dist/src/commands/skills/uninstall.test.d.ts +0 -6
  120. package/dist/src/commands/skills/uninstall.test.js +0 -61
  121. package/dist/src/commands/skills/uninstall.test.js.map +0 -1
  122. package/dist/src/commands/skills.test.d.ts +0 -6
  123. package/dist/src/commands/skills.test.js +0 -49
  124. package/dist/src/commands/skills.test.js.map +0 -1
  125. package/dist/src/commands/utils.test.d.ts +0 -6
  126. package/dist/src/commands/utils.test.js +0 -35
  127. package/dist/src/commands/utils.test.js.map +0 -1
  128. package/dist/src/config/auth.test.d.ts +0 -6
  129. package/dist/src/config/auth.test.js +0 -89
  130. package/dist/src/config/auth.test.js.map +0 -1
  131. package/dist/src/config/config.integration.test.d.ts +0 -6
  132. package/dist/src/config/config.integration.test.js +0 -205
  133. package/dist/src/config/config.integration.test.js.map +0 -1
  134. package/dist/src/config/config.test.d.ts +0 -6
  135. package/dist/src/config/config.test.js +0 -2413
  136. package/dist/src/config/config.test.js.map +0 -1
  137. package/dist/src/config/extension-manager-agents.test.d.ts +0 -6
  138. package/dist/src/config/extension-manager-agents.test.js +0 -114
  139. package/dist/src/config/extension-manager-agents.test.js.map +0 -1
  140. package/dist/src/config/extension-manager-scope.test.d.ts +0 -6
  141. package/dist/src/config/extension-manager-scope.test.js +0 -153
  142. package/dist/src/config/extension-manager-scope.test.js.map +0 -1
  143. package/dist/src/config/extension-manager-skills.test.d.ts +0 -6
  144. package/dist/src/config/extension-manager-skills.test.js +0 -148
  145. package/dist/src/config/extension-manager-skills.test.js.map +0 -1
  146. package/dist/src/config/extension.test.d.ts +0 -6
  147. package/dist/src/config/extension.test.js +0 -1671
  148. package/dist/src/config/extension.test.js.map +0 -1
  149. package/dist/src/config/extensions/consent.test.d.ts +0 -6
  150. package/dist/src/config/extensions/consent.test.js +0 -280
  151. package/dist/src/config/extensions/consent.test.js.map +0 -1
  152. package/dist/src/config/extensions/extensionEnablement.test.d.ts +0 -6
  153. package/dist/src/config/extensions/extensionEnablement.test.js +0 -404
  154. package/dist/src/config/extensions/extensionEnablement.test.js.map +0 -1
  155. package/dist/src/config/extensions/extensionSettings.test.d.ts +0 -6
  156. package/dist/src/config/extensions/extensionSettings.test.js +0 -493
  157. package/dist/src/config/extensions/extensionSettings.test.js.map +0 -1
  158. package/dist/src/config/extensions/extensionUpdates.test.d.ts +0 -6
  159. package/dist/src/config/extensions/extensionUpdates.test.js +0 -230
  160. package/dist/src/config/extensions/extensionUpdates.test.js.map +0 -1
  161. package/dist/src/config/extensions/github.test.d.ts +0 -6
  162. package/dist/src/config/extensions/github.test.js +0 -441
  163. package/dist/src/config/extensions/github.test.js.map +0 -1
  164. package/dist/src/config/extensions/github_fetch.test.d.ts +0 -6
  165. package/dist/src/config/extensions/github_fetch.test.js +0 -169
  166. package/dist/src/config/extensions/github_fetch.test.js.map +0 -1
  167. package/dist/src/config/extensions/storage.test.d.ts +0 -6
  168. package/dist/src/config/extensions/storage.test.js +0 -64
  169. package/dist/src/config/extensions/storage.test.js.map +0 -1
  170. package/dist/src/config/extensions/update.test.d.ts +0 -6
  171. package/dist/src/config/extensions/update.test.js +0 -231
  172. package/dist/src/config/extensions/update.test.js.map +0 -1
  173. package/dist/src/config/extensions/variables.test.d.ts +0 -6
  174. package/dist/src/config/extensions/variables.test.js +0 -103
  175. package/dist/src/config/extensions/variables.test.js.map +0 -1
  176. package/dist/src/config/keyBindings.test.d.ts +0 -6
  177. package/dist/src/config/keyBindings.test.js +0 -108
  178. package/dist/src/config/keyBindings.test.js.map +0 -1
  179. package/dist/src/config/mcp/mcpServerEnablement.test.d.ts +0 -6
  180. package/dist/src/config/mcp/mcpServerEnablement.test.js +0 -147
  181. package/dist/src/config/mcp/mcpServerEnablement.test.js.map +0 -1
  182. package/dist/src/config/policy-engine.integration.test.d.ts +0 -6
  183. package/dist/src/config/policy-engine.integration.test.js +0 -353
  184. package/dist/src/config/policy-engine.integration.test.js.map +0 -1
  185. package/dist/src/config/sandboxConfig.test.d.ts +0 -6
  186. package/dist/src/config/sandboxConfig.test.js +0 -184
  187. package/dist/src/config/sandboxConfig.test.js.map +0 -1
  188. package/dist/src/config/settingPaths.test.d.ts +0 -6
  189. package/dist/src/config/settingPaths.test.js +0 -22
  190. package/dist/src/config/settingPaths.test.js.map +0 -1
  191. package/dist/src/config/settings-validation.test.d.ts +0 -6
  192. package/dist/src/config/settings-validation.test.js +0 -370
  193. package/dist/src/config/settings-validation.test.js.map +0 -1
  194. package/dist/src/config/settings.test.d.ts +0 -6
  195. package/dist/src/config/settings.test.js +0 -1822
  196. package/dist/src/config/settings.test.js.map +0 -1
  197. package/dist/src/config/settingsSchema.test.d.ts +0 -6
  198. package/dist/src/config/settingsSchema.test.js +0 -309
  199. package/dist/src/config/settingsSchema.test.js.map +0 -1
  200. package/dist/src/config/settings_repro.test.d.ts +0 -6
  201. package/dist/src/config/settings_repro.test.js +0 -166
  202. package/dist/src/config/settings_repro.test.js.map +0 -1
  203. package/dist/src/config/settings_validation_warning.test.d.ts +0 -6
  204. package/dist/src/config/settings_validation_warning.test.js +0 -123
  205. package/dist/src/config/settings_validation_warning.test.js.map +0 -1
  206. package/dist/src/config/skills-backward-compatibility.test.d.ts +0 -6
  207. package/dist/src/config/skills-backward-compatibility.test.js +0 -99
  208. package/dist/src/config/skills-backward-compatibility.test.js.map +0 -1
  209. package/dist/src/config/trustedFolders.test.d.ts +0 -6
  210. package/dist/src/config/trustedFolders.test.js +0 -385
  211. package/dist/src/config/trustedFolders.test.js.map +0 -1
  212. package/dist/src/core/auth.test.d.ts +0 -6
  213. package/dist/src/core/auth.test.js +0 -47
  214. package/dist/src/core/auth.test.js.map +0 -1
  215. package/dist/src/core/initializer.test.d.ts +0 -6
  216. package/dist/src/core/initializer.test.js +0 -101
  217. package/dist/src/core/initializer.test.js.map +0 -1
  218. package/dist/src/core/theme.test.d.ts +0 -6
  219. package/dist/src/core/theme.test.js +0 -46
  220. package/dist/src/core/theme.test.js.map +0 -1
  221. package/dist/src/deferred.test.d.ts +0 -6
  222. package/dist/src/deferred.test.js +0 -164
  223. package/dist/src/deferred.test.js.map +0 -1
  224. package/dist/src/gemini.test.d.ts +0 -6
  225. package/dist/src/gemini.test.js +0 -1334
  226. package/dist/src/gemini.test.js.map +0 -1
  227. package/dist/src/gemini_cleanup.test.d.ts +0 -6
  228. package/dist/src/gemini_cleanup.test.js +0 -208
  229. package/dist/src/gemini_cleanup.test.js.map +0 -1
  230. package/dist/src/nonInteractiveCli.test.d.ts +0 -6
  231. package/dist/src/nonInteractiveCli.test.js +0 -1687
  232. package/dist/src/nonInteractiveCli.test.js.map +0 -1
  233. package/dist/src/services/BuiltinCommandLoader.test.d.ts +0 -6
  234. package/dist/src/services/BuiltinCommandLoader.test.js +0 -254
  235. package/dist/src/services/BuiltinCommandLoader.test.js.map +0 -1
  236. package/dist/src/services/CommandService.test.d.ts +0 -6
  237. package/dist/src/services/CommandService.test.js +0 -234
  238. package/dist/src/services/CommandService.test.js.map +0 -1
  239. package/dist/src/services/FileCommandLoader.test.d.ts +0 -6
  240. package/dist/src/services/FileCommandLoader.test.js +0 -1102
  241. package/dist/src/services/FileCommandLoader.test.js.map +0 -1
  242. package/dist/src/services/McpPromptLoader.test.d.ts +0 -6
  243. package/dist/src/services/McpPromptLoader.test.js +0 -411
  244. package/dist/src/services/McpPromptLoader.test.js.map +0 -1
  245. package/dist/src/services/prompt-processors/argumentProcessor.test.d.ts +0 -6
  246. package/dist/src/services/prompt-processors/argumentProcessor.test.js +0 -40
  247. package/dist/src/services/prompt-processors/argumentProcessor.test.js.map +0 -1
  248. package/dist/src/services/prompt-processors/atFileProcessor.test.d.ts +0 -6
  249. package/dist/src/services/prompt-processors/atFileProcessor.test.js +0 -174
  250. package/dist/src/services/prompt-processors/atFileProcessor.test.js.map +0 -1
  251. package/dist/src/services/prompt-processors/injectionParser.test.d.ts +0 -6
  252. package/dist/src/services/prompt-processors/injectionParser.test.js +0 -189
  253. package/dist/src/services/prompt-processors/injectionParser.test.js.map +0 -1
  254. package/dist/src/services/prompt-processors/shellProcessor.test.d.ts +0 -6
  255. package/dist/src/services/prompt-processors/shellProcessor.test.js +0 -514
  256. package/dist/src/services/prompt-processors/shellProcessor.test.js.map +0 -1
  257. package/dist/src/test-utils/mockCommandContext.test.d.ts +0 -6
  258. package/dist/src/test-utils/mockCommandContext.test.js +0 -51
  259. package/dist/src/test-utils/mockCommandContext.test.js.map +0 -1
  260. package/dist/src/test-utils/render.test.d.ts +0 -6
  261. package/dist/src/test-utils/render.test.js +0 -79
  262. package/dist/src/test-utils/render.test.js.map +0 -1
  263. package/dist/src/ui/App.test.d.ts +0 -6
  264. package/dist/src/ui/App.test.js +0 -218
  265. package/dist/src/ui/App.test.js.map +0 -1
  266. package/dist/src/ui/AppContainer.test.d.ts +0 -6
  267. package/dist/src/ui/AppContainer.test.js +0 -2072
  268. package/dist/src/ui/AppContainer.test.js.map +0 -1
  269. package/dist/src/ui/IdeIntegrationNudge.test.d.ts +0 -6
  270. package/dist/src/ui/IdeIntegrationNudge.test.js +0 -158
  271. package/dist/src/ui/IdeIntegrationNudge.test.js.map +0 -1
  272. package/dist/src/ui/auth/ApiAuthDialog.test.d.ts +0 -6
  273. package/dist/src/ui/auth/ApiAuthDialog.test.js +0 -109
  274. package/dist/src/ui/auth/ApiAuthDialog.test.js.map +0 -1
  275. package/dist/src/ui/auth/AuthDialog.test.d.ts +0 -6
  276. package/dist/src/ui/auth/AuthDialog.test.js +0 -309
  277. package/dist/src/ui/auth/AuthDialog.test.js.map +0 -1
  278. package/dist/src/ui/auth/AuthInProgress.test.d.ts +0 -6
  279. package/dist/src/ui/auth/AuthInProgress.test.js +0 -81
  280. package/dist/src/ui/auth/AuthInProgress.test.js.map +0 -1
  281. package/dist/src/ui/auth/LoginWithGoogleRestartDialog.test.d.ts +0 -6
  282. package/dist/src/ui/auth/LoginWithGoogleRestartDialog.test.js +0 -66
  283. package/dist/src/ui/auth/LoginWithGoogleRestartDialog.test.js.map +0 -1
  284. package/dist/src/ui/auth/useAuth.test.d.ts +0 -6
  285. package/dist/src/ui/auth/useAuth.test.js +0 -189
  286. package/dist/src/ui/auth/useAuth.test.js.map +0 -1
  287. package/dist/src/ui/commands/aboutCommand.test.d.ts +0 -6
  288. package/dist/src/ui/commands/aboutCommand.test.js +0 -143
  289. package/dist/src/ui/commands/aboutCommand.test.js.map +0 -1
  290. package/dist/src/ui/commands/agentsCommand.test.d.ts +0 -6
  291. package/dist/src/ui/commands/agentsCommand.test.js +0 -344
  292. package/dist/src/ui/commands/agentsCommand.test.js.map +0 -1
  293. package/dist/src/ui/commands/authCommand.test.d.ts +0 -6
  294. package/dist/src/ui/commands/authCommand.test.js +0 -98
  295. package/dist/src/ui/commands/authCommand.test.js.map +0 -1
  296. package/dist/src/ui/commands/bugCommand.test.d.ts +0 -6
  297. package/dist/src/ui/commands/bugCommand.test.js +0 -186
  298. package/dist/src/ui/commands/bugCommand.test.js.map +0 -1
  299. package/dist/src/ui/commands/chatCommand.test.d.ts +0 -6
  300. package/dist/src/ui/commands/chatCommand.test.js +0 -620
  301. package/dist/src/ui/commands/chatCommand.test.js.map +0 -1
  302. package/dist/src/ui/commands/clearCommand.test.d.ts +0 -6
  303. package/dist/src/ui/commands/clearCommand.test.js +0 -87
  304. package/dist/src/ui/commands/clearCommand.test.js.map +0 -1
  305. package/dist/src/ui/commands/compressCommand.test.d.ts +0 -6
  306. package/dist/src/ui/commands/compressCommand.test.js +0 -98
  307. package/dist/src/ui/commands/compressCommand.test.js.map +0 -1
  308. package/dist/src/ui/commands/copyCommand.test.d.ts +0 -6
  309. package/dist/src/ui/commands/copyCommand.test.js +0 -242
  310. package/dist/src/ui/commands/copyCommand.test.js.map +0 -1
  311. package/dist/src/ui/commands/corgiCommand.test.d.ts +0 -6
  312. package/dist/src/ui/commands/corgiCommand.test.js +0 -28
  313. package/dist/src/ui/commands/corgiCommand.test.js.map +0 -1
  314. package/dist/src/ui/commands/directoryCommand.test.d.ts +0 -6
  315. package/dist/src/ui/commands/directoryCommand.test.js +0 -353
  316. package/dist/src/ui/commands/directoryCommand.test.js.map +0 -1
  317. package/dist/src/ui/commands/docsCommand.test.d.ts +0 -6
  318. package/dist/src/ui/commands/docsCommand.test.js +0 -72
  319. package/dist/src/ui/commands/docsCommand.test.js.map +0 -1
  320. package/dist/src/ui/commands/editorCommand.test.d.ts +0 -6
  321. package/dist/src/ui/commands/editorCommand.test.js +0 -27
  322. package/dist/src/ui/commands/editorCommand.test.js.map +0 -1
  323. package/dist/src/ui/commands/extensionsCommand.test.d.ts +0 -6
  324. package/dist/src/ui/commands/extensionsCommand.test.js +0 -778
  325. package/dist/src/ui/commands/extensionsCommand.test.js.map +0 -1
  326. package/dist/src/ui/commands/helpCommand.test.d.ts +0 -6
  327. package/dist/src/ui/commands/helpCommand.test.js +0 -42
  328. package/dist/src/ui/commands/helpCommand.test.js.map +0 -1
  329. package/dist/src/ui/commands/hooksCommand.test.d.ts +0 -6
  330. package/dist/src/ui/commands/hooksCommand.test.js +0 -572
  331. package/dist/src/ui/commands/hooksCommand.test.js.map +0 -1
  332. package/dist/src/ui/commands/ideCommand.test.d.ts +0 -6
  333. package/dist/src/ui/commands/ideCommand.test.js +0 -203
  334. package/dist/src/ui/commands/ideCommand.test.js.map +0 -1
  335. package/dist/src/ui/commands/initCommand.test.d.ts +0 -6
  336. package/dist/src/ui/commands/initCommand.test.js +0 -84
  337. package/dist/src/ui/commands/initCommand.test.js.map +0 -1
  338. package/dist/src/ui/commands/mcpCommand.test.d.ts +0 -6
  339. package/dist/src/ui/commands/mcpCommand.test.js +0 -189
  340. package/dist/src/ui/commands/mcpCommand.test.js.map +0 -1
  341. package/dist/src/ui/commands/memoryCommand.test.d.ts +0 -6
  342. package/dist/src/ui/commands/memoryCommand.test.js +0 -350
  343. package/dist/src/ui/commands/memoryCommand.test.js.map +0 -1
  344. package/dist/src/ui/commands/modelCommand.test.d.ts +0 -6
  345. package/dist/src/ui/commands/modelCommand.test.js +0 -41
  346. package/dist/src/ui/commands/modelCommand.test.js.map +0 -1
  347. package/dist/src/ui/commands/permissionsCommand.test.d.ts +0 -6
  348. package/dist/src/ui/commands/permissionsCommand.test.js +0 -86
  349. package/dist/src/ui/commands/permissionsCommand.test.js.map +0 -1
  350. package/dist/src/ui/commands/policiesCommand.test.d.ts +0 -6
  351. package/dist/src/ui/commands/policiesCommand.test.js +0 -87
  352. package/dist/src/ui/commands/policiesCommand.test.js.map +0 -1
  353. package/dist/src/ui/commands/privacyCommand.test.d.ts +0 -6
  354. package/dist/src/ui/commands/privacyCommand.test.js +0 -32
  355. package/dist/src/ui/commands/privacyCommand.test.js.map +0 -1
  356. package/dist/src/ui/commands/quitCommand.test.d.ts +0 -6
  357. package/dist/src/ui/commands/quitCommand.test.js +0 -50
  358. package/dist/src/ui/commands/quitCommand.test.js.map +0 -1
  359. package/dist/src/ui/commands/restoreCommand.test.d.ts +0 -6
  360. package/dist/src/ui/commands/restoreCommand.test.js +0 -190
  361. package/dist/src/ui/commands/restoreCommand.test.js.map +0 -1
  362. package/dist/src/ui/commands/rewindCommand.test.d.ts +0 -6
  363. package/dist/src/ui/commands/rewindCommand.test.js +0 -242
  364. package/dist/src/ui/commands/rewindCommand.test.js.map +0 -1
  365. package/dist/src/ui/commands/settingsCommand.test.d.ts +0 -6
  366. package/dist/src/ui/commands/settingsCommand.test.js +0 -30
  367. package/dist/src/ui/commands/settingsCommand.test.js.map +0 -1
  368. package/dist/src/ui/commands/setupGithubCommand.test.d.ts +0 -6
  369. package/dist/src/ui/commands/setupGithubCommand.test.js +0 -238
  370. package/dist/src/ui/commands/setupGithubCommand.test.js.map +0 -1
  371. package/dist/src/ui/commands/skillsCommand.test.d.ts +0 -6
  372. package/dist/src/ui/commands/skillsCommand.test.js +0 -426
  373. package/dist/src/ui/commands/skillsCommand.test.js.map +0 -1
  374. package/dist/src/ui/commands/statsCommand.test.d.ts +0 -6
  375. package/dist/src/ui/commands/statsCommand.test.js +0 -70
  376. package/dist/src/ui/commands/statsCommand.test.js.map +0 -1
  377. package/dist/src/ui/commands/terminalSetupCommand.test.d.ts +0 -6
  378. package/dist/src/ui/commands/terminalSetupCommand.test.js +0 -66
  379. package/dist/src/ui/commands/terminalSetupCommand.test.js.map +0 -1
  380. package/dist/src/ui/commands/themeCommand.test.d.ts +0 -6
  381. package/dist/src/ui/commands/themeCommand.test.js +0 -32
  382. package/dist/src/ui/commands/themeCommand.test.js.map +0 -1
  383. package/dist/src/ui/commands/toolsCommand.test.d.ts +0 -6
  384. package/dist/src/ui/commands/toolsCommand.test.js +0 -100
  385. package/dist/src/ui/commands/toolsCommand.test.js.map +0 -1
  386. package/dist/src/ui/components/AboutBox.test.d.ts +0 -6
  387. package/dist/src/ui/components/AboutBox.test.js +0 -59
  388. package/dist/src/ui/components/AboutBox.test.js.map +0 -1
  389. package/dist/src/ui/components/AdminSettingsChangedDialog.test.d.ts +0 -6
  390. package/dist/src/ui/components/AdminSettingsChangedDialog.test.js +0 -43
  391. package/dist/src/ui/components/AdminSettingsChangedDialog.test.js.map +0 -1
  392. package/dist/src/ui/components/AgentConfigDialog.test.d.ts +0 -6
  393. package/dist/src/ui/components/AgentConfigDialog.test.js +0 -241
  394. package/dist/src/ui/components/AgentConfigDialog.test.js.map +0 -1
  395. package/dist/src/ui/components/AlternateBufferQuittingDisplay.test.d.ts +0 -6
  396. package/dist/src/ui/components/AlternateBufferQuittingDisplay.test.js +0 -190
  397. package/dist/src/ui/components/AlternateBufferQuittingDisplay.test.js.map +0 -1
  398. package/dist/src/ui/components/AnsiOutput.test.d.ts +0 -6
  399. package/dist/src/ui/components/AnsiOutput.test.js +0 -92
  400. package/dist/src/ui/components/AnsiOutput.test.js.map +0 -1
  401. package/dist/src/ui/components/AppHeader.test.d.ts +0 -6
  402. package/dist/src/ui/components/AppHeader.test.js +0 -225
  403. package/dist/src/ui/components/AppHeader.test.js.map +0 -1
  404. package/dist/src/ui/components/ApprovalModeIndicator.test.d.ts +0 -6
  405. package/dist/src/ui/components/ApprovalModeIndicator.test.js +0 -37
  406. package/dist/src/ui/components/ApprovalModeIndicator.test.js.map +0 -1
  407. package/dist/src/ui/components/AskUserDialog.test.d.ts +0 -6
  408. package/dist/src/ui/components/AskUserDialog.test.js +0 -598
  409. package/dist/src/ui/components/AskUserDialog.test.js.map +0 -1
  410. package/dist/src/ui/components/Banner.test.d.ts +0 -6
  411. package/dist/src/ui/components/Banner.test.js +0 -24
  412. package/dist/src/ui/components/Banner.test.js.map +0 -1
  413. package/dist/src/ui/components/CliSpinner.test.d.ts +0 -6
  414. package/dist/src/ui/components/CliSpinner.test.js +0 -28
  415. package/dist/src/ui/components/CliSpinner.test.js.map +0 -1
  416. package/dist/src/ui/components/Composer.test.d.ts +0 -6
  417. package/dist/src/ui/components/Composer.test.js +0 -383
  418. package/dist/src/ui/components/Composer.test.js.map +0 -1
  419. package/dist/src/ui/components/ConfigInitDisplay.test.d.ts +0 -6
  420. package/dist/src/ui/components/ConfigInitDisplay.test.js +0 -117
  421. package/dist/src/ui/components/ConfigInitDisplay.test.js.map +0 -1
  422. package/dist/src/ui/components/ConsentPrompt.test.d.ts +0 -6
  423. package/dist/src/ui/components/ConsentPrompt.test.js +0 -77
  424. package/dist/src/ui/components/ConsentPrompt.test.js.map +0 -1
  425. package/dist/src/ui/components/ConsoleSummaryDisplay.test.d.ts +0 -6
  426. package/dist/src/ui/components/ConsoleSummaryDisplay.test.js +0 -26
  427. package/dist/src/ui/components/ConsoleSummaryDisplay.test.js.map +0 -1
  428. package/dist/src/ui/components/ContextSummaryDisplay.test.d.ts +0 -6
  429. package/dist/src/ui/components/ContextSummaryDisplay.test.js +0 -102
  430. package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +0 -1
  431. package/dist/src/ui/components/ContextUsageDisplay.test.d.ts +0 -6
  432. package/dist/src/ui/components/ContextUsageDisplay.test.js +0 -43
  433. package/dist/src/ui/components/ContextUsageDisplay.test.js.map +0 -1
  434. package/dist/src/ui/components/CopyModeWarning.test.d.ts +0 -6
  435. package/dist/src/ui/components/CopyModeWarning.test.js +0 -33
  436. package/dist/src/ui/components/CopyModeWarning.test.js.map +0 -1
  437. package/dist/src/ui/components/DebugProfiler.test.d.ts +0 -6
  438. package/dist/src/ui/components/DebugProfiler.test.js +0 -229
  439. package/dist/src/ui/components/DebugProfiler.test.js.map +0 -1
  440. package/dist/src/ui/components/DetailedMessagesDisplay.test.d.ts +0 -6
  441. package/dist/src/ui/components/DetailedMessagesDisplay.test.js +0 -39
  442. package/dist/src/ui/components/DetailedMessagesDisplay.test.js.map +0 -1
  443. package/dist/src/ui/components/DialogManager.test.d.ts +0 -6
  444. package/dist/src/ui/components/DialogManager.test.js +0 -177
  445. package/dist/src/ui/components/DialogManager.test.js.map +0 -1
  446. package/dist/src/ui/components/EditorSettingsDialog.test.d.ts +0 -6
  447. package/dist/src/ui/components/EditorSettingsDialog.test.js +0 -119
  448. package/dist/src/ui/components/EditorSettingsDialog.test.js.map +0 -1
  449. package/dist/src/ui/components/ExitWarning.test.d.ts +0 -6
  450. package/dist/src/ui/components/ExitWarning.test.js +0 -54
  451. package/dist/src/ui/components/ExitWarning.test.js.map +0 -1
  452. package/dist/src/ui/components/FolderTrustDialog.test.d.ts +0 -6
  453. package/dist/src/ui/components/FolderTrustDialog.test.js +0 -102
  454. package/dist/src/ui/components/FolderTrustDialog.test.js.map +0 -1
  455. package/dist/src/ui/components/Footer.test.d.ts +0 -6
  456. package/dist/src/ui/components/Footer.test.js +0 -321
  457. package/dist/src/ui/components/Footer.test.js.map +0 -1
  458. package/dist/src/ui/components/GeminiRespondingSpinner.test.d.ts +0 -6
  459. package/dist/src/ui/components/GeminiRespondingSpinner.test.js +0 -61
  460. package/dist/src/ui/components/GeminiRespondingSpinner.test.js.map +0 -1
  461. package/dist/src/ui/components/GradientRegression.test.d.ts +0 -6
  462. package/dist/src/ui/components/GradientRegression.test.js +0 -105
  463. package/dist/src/ui/components/GradientRegression.test.js.map +0 -1
  464. package/dist/src/ui/components/Header.test.d.ts +0 -6
  465. package/dist/src/ui/components/Header.test.js +0 -147
  466. package/dist/src/ui/components/Header.test.js.map +0 -1
  467. package/dist/src/ui/components/Help.test.d.ts +0 -6
  468. package/dist/src/ui/components/Help.test.js +0 -67
  469. package/dist/src/ui/components/Help.test.js.map +0 -1
  470. package/dist/src/ui/components/HistoryItemDisplay.test.d.ts +0 -6
  471. package/dist/src/ui/components/HistoryItemDisplay.test.js +0 -207
  472. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +0 -1
  473. package/dist/src/ui/components/HookStatusDisplay.test.d.ts +0 -6
  474. package/dist/src/ui/components/HookStatusDisplay.test.js +0 -51
  475. package/dist/src/ui/components/HookStatusDisplay.test.js.map +0 -1
  476. package/dist/src/ui/components/IdeTrustChangeDialog.test.d.ts +0 -6
  477. package/dist/src/ui/components/IdeTrustChangeDialog.test.js +0 -58
  478. package/dist/src/ui/components/IdeTrustChangeDialog.test.js.map +0 -1
  479. package/dist/src/ui/components/InputPrompt.test.d.ts +0 -6
  480. package/dist/src/ui/components/InputPrompt.test.js +0 -2596
  481. package/dist/src/ui/components/InputPrompt.test.js.map +0 -1
  482. package/dist/src/ui/components/LoadingIndicator.test.d.ts +0 -6
  483. package/dist/src/ui/components/LoadingIndicator.test.js +0 -207
  484. package/dist/src/ui/components/LoadingIndicator.test.js.map +0 -1
  485. package/dist/src/ui/components/LogoutConfirmationDialog.test.d.ts +0 -6
  486. package/dist/src/ui/components/LogoutConfirmationDialog.test.js +0 -59
  487. package/dist/src/ui/components/LogoutConfirmationDialog.test.js.map +0 -1
  488. package/dist/src/ui/components/LoopDetectionConfirmation.test.d.ts +0 -6
  489. package/dist/src/ui/components/LoopDetectionConfirmation.test.js +0 -25
  490. package/dist/src/ui/components/LoopDetectionConfirmation.test.js.map +0 -1
  491. package/dist/src/ui/components/MainContent.test.d.ts +0 -6
  492. package/dist/src/ui/components/MainContent.test.js +0 -83
  493. package/dist/src/ui/components/MainContent.test.js.map +0 -1
  494. package/dist/src/ui/components/MemoryUsageDisplay.test.d.ts +0 -6
  495. package/dist/src/ui/components/MemoryUsageDisplay.test.js +0 -49
  496. package/dist/src/ui/components/MemoryUsageDisplay.test.js.map +0 -1
  497. package/dist/src/ui/components/ModelDialog.test.d.ts +0 -6
  498. package/dist/src/ui/components/ModelDialog.test.js +0 -197
  499. package/dist/src/ui/components/ModelDialog.test.js.map +0 -1
  500. package/dist/src/ui/components/ModelStatsDisplay.test.d.ts +0 -6
  501. package/dist/src/ui/components/ModelStatsDisplay.test.js +0 -343
  502. package/dist/src/ui/components/ModelStatsDisplay.test.js.map +0 -1
  503. package/dist/src/ui/components/MultiFolderTrustDialog.test.d.ts +0 -6
  504. package/dist/src/ui/components/MultiFolderTrustDialog.test.js +0 -162
  505. package/dist/src/ui/components/MultiFolderTrustDialog.test.js.map +0 -1
  506. package/dist/src/ui/components/NewAgentsNotification.test.d.ts +0 -6
  507. package/dist/src/ui/components/NewAgentsNotification.test.js +0 -48
  508. package/dist/src/ui/components/NewAgentsNotification.test.js.map +0 -1
  509. package/dist/src/ui/components/Notifications.test.d.ts +0 -6
  510. package/dist/src/ui/components/Notifications.test.js +0 -164
  511. package/dist/src/ui/components/Notifications.test.js.map +0 -1
  512. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.d.ts +0 -6
  513. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +0 -162
  514. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +0 -1
  515. package/dist/src/ui/components/ProQuotaDialog.test.d.ts +0 -6
  516. package/dist/src/ui/components/ProQuotaDialog.test.js +0 -191
  517. package/dist/src/ui/components/ProQuotaDialog.test.js.map +0 -1
  518. package/dist/src/ui/components/QueuedMessageDisplay.test.d.ts +0 -6
  519. package/dist/src/ui/components/QueuedMessageDisplay.test.js +0 -65
  520. package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +0 -1
  521. package/dist/src/ui/components/QuittingDisplay.test.d.ts +0 -6
  522. package/dist/src/ui/components/QuittingDisplay.test.js +0 -49
  523. package/dist/src/ui/components/QuittingDisplay.test.js.map +0 -1
  524. package/dist/src/ui/components/RawMarkdownIndicator.test.d.ts +0 -6
  525. package/dist/src/ui/components/RawMarkdownIndicator.test.js +0 -34
  526. package/dist/src/ui/components/RawMarkdownIndicator.test.js.map +0 -1
  527. package/dist/src/ui/components/RewindConfirmation.test.d.ts +0 -6
  528. package/dist/src/ui/components/RewindConfirmation.test.js +0 -53
  529. package/dist/src/ui/components/RewindConfirmation.test.js.map +0 -1
  530. package/dist/src/ui/components/RewindViewer.test.d.ts +0 -6
  531. package/dist/src/ui/components/RewindViewer.test.js +0 -241
  532. package/dist/src/ui/components/RewindViewer.test.js.map +0 -1
  533. package/dist/src/ui/components/SessionBrowser.test.d.ts +0 -6
  534. package/dist/src/ui/components/SessionBrowser.test.js +0 -256
  535. package/dist/src/ui/components/SessionBrowser.test.js.map +0 -1
  536. package/dist/src/ui/components/SessionSummaryDisplay.test.d.ts +0 -6
  537. package/dist/src/ui/components/SessionSummaryDisplay.test.js +0 -75
  538. package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +0 -1
  539. package/dist/src/ui/components/SettingsDialog.test.d.ts +0 -6
  540. package/dist/src/ui/components/SettingsDialog.test.js +0 -1150
  541. package/dist/src/ui/components/SettingsDialog.test.js.map +0 -1
  542. package/dist/src/ui/components/ShellInputPrompt.test.d.ts +0 -6
  543. package/dist/src/ui/components/ShellInputPrompt.test.js +0 -91
  544. package/dist/src/ui/components/ShellInputPrompt.test.js.map +0 -1
  545. package/dist/src/ui/components/ShellModeIndicator.test.d.ts +0 -6
  546. package/dist/src/ui/components/ShellModeIndicator.test.js +0 -17
  547. package/dist/src/ui/components/ShellModeIndicator.test.js.map +0 -1
  548. package/dist/src/ui/components/ShowMoreLines.test.d.ts +0 -6
  549. package/dist/src/ui/components/ShowMoreLines.test.js +0 -40
  550. package/dist/src/ui/components/ShowMoreLines.test.js.map +0 -1
  551. package/dist/src/ui/components/StatsDisplay.test.d.ts +0 -6
  552. package/dist/src/ui/components/StatsDisplay.test.js +0 -438
  553. package/dist/src/ui/components/StatsDisplay.test.js.map +0 -1
  554. package/dist/src/ui/components/StatusDisplay.test.d.ts +0 -6
  555. package/dist/src/ui/components/StatusDisplay.test.js +0 -155
  556. package/dist/src/ui/components/StatusDisplay.test.js.map +0 -1
  557. package/dist/src/ui/components/StickyHeader.test.d.ts +0 -6
  558. package/dist/src/ui/components/StickyHeader.test.js +0 -17
  559. package/dist/src/ui/components/StickyHeader.test.js.map +0 -1
  560. package/dist/src/ui/components/SuggestionsDisplay.test.d.ts +0 -6
  561. package/dist/src/ui/components/SuggestionsDisplay.test.js +0 -56
  562. package/dist/src/ui/components/SuggestionsDisplay.test.js.map +0 -1
  563. package/dist/src/ui/components/Table.test.d.ts +0 -6
  564. package/dist/src/ui/components/Table.test.js +0 -53
  565. package/dist/src/ui/components/Table.test.js.map +0 -1
  566. package/dist/src/ui/components/ThemeDialog.test.d.ts +0 -6
  567. package/dist/src/ui/components/ThemeDialog.test.js +0 -167
  568. package/dist/src/ui/components/ThemeDialog.test.js.map +0 -1
  569. package/dist/src/ui/components/ThemedGradient.test.d.ts +0 -6
  570. package/dist/src/ui/components/ThemedGradient.test.js +0 -30
  571. package/dist/src/ui/components/ThemedGradient.test.js.map +0 -1
  572. package/dist/src/ui/components/Tips.test.d.ts +0 -6
  573. package/dist/src/ui/components/Tips.test.js +0 -23
  574. package/dist/src/ui/components/Tips.test.js.map +0 -1
  575. package/dist/src/ui/components/ToolConfirmationQueue.test.d.ts +0 -6
  576. package/dist/src/ui/components/ToolConfirmationQueue.test.js +0 -71
  577. package/dist/src/ui/components/ToolConfirmationQueue.test.js.map +0 -1
  578. package/dist/src/ui/components/ToolStatsDisplay.test.d.ts +0 -6
  579. package/dist/src/ui/components/ToolStatsDisplay.test.js +0 -227
  580. package/dist/src/ui/components/ToolStatsDisplay.test.js.map +0 -1
  581. package/dist/src/ui/components/UpdateNotification.test.d.ts +0 -6
  582. package/dist/src/ui/components/UpdateNotification.test.js +0 -16
  583. package/dist/src/ui/components/UpdateNotification.test.js.map +0 -1
  584. package/dist/src/ui/components/ValidationDialog.test.d.ts +0 -6
  585. package/dist/src/ui/components/ValidationDialog.test.js +0 -153
  586. package/dist/src/ui/components/ValidationDialog.test.js.map +0 -1
  587. package/dist/src/ui/components/messages/CompressionMessage.test.d.ts +0 -6
  588. package/dist/src/ui/components/messages/CompressionMessage.test.js +0 -191
  589. package/dist/src/ui/components/messages/CompressionMessage.test.js.map +0 -1
  590. package/dist/src/ui/components/messages/DiffRenderer.test.d.ts +0 -6
  591. package/dist/src/ui/components/messages/DiffRenderer.test.js +0 -240
  592. package/dist/src/ui/components/messages/DiffRenderer.test.js.map +0 -1
  593. package/dist/src/ui/components/messages/ErrorMessage.test.d.ts +0 -6
  594. package/dist/src/ui/components/messages/ErrorMessage.test.js +0 -23
  595. package/dist/src/ui/components/messages/ErrorMessage.test.js.map +0 -1
  596. package/dist/src/ui/components/messages/GeminiMessage.test.d.ts +0 -6
  597. package/dist/src/ui/components/messages/GeminiMessage.test.js +0 -35
  598. package/dist/src/ui/components/messages/GeminiMessage.test.js.map +0 -1
  599. package/dist/src/ui/components/messages/InfoMessage.test.d.ts +0 -6
  600. package/dist/src/ui/components/messages/InfoMessage.test.js +0 -28
  601. package/dist/src/ui/components/messages/InfoMessage.test.js.map +0 -1
  602. package/dist/src/ui/components/messages/RedirectionConfirmation.test.d.ts +0 -6
  603. package/dist/src/ui/components/messages/RedirectionConfirmation.test.js +0 -33
  604. package/dist/src/ui/components/messages/RedirectionConfirmation.test.js.map +0 -1
  605. package/dist/src/ui/components/messages/ShellToolMessage.test.d.ts +0 -6
  606. package/dist/src/ui/components/messages/ShellToolMessage.test.js +0 -123
  607. package/dist/src/ui/components/messages/ShellToolMessage.test.js.map +0 -1
  608. package/dist/src/ui/components/messages/Todo.test.d.ts +0 -6
  609. package/dist/src/ui/components/messages/Todo.test.js +0 -114
  610. package/dist/src/ui/components/messages/Todo.test.js.map +0 -1
  611. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.d.ts +0 -6
  612. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +0 -232
  613. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +0 -1
  614. package/dist/src/ui/components/messages/ToolGroupMessage.test.d.ts +0 -6
  615. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +0 -529
  616. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +0 -1
  617. package/dist/src/ui/components/messages/ToolMessage.test.d.ts +0 -6
  618. package/dist/src/ui/components/messages/ToolMessage.test.js +0 -217
  619. package/dist/src/ui/components/messages/ToolMessage.test.js.map +0 -1
  620. package/dist/src/ui/components/messages/ToolMessageFocusHint.test.d.ts +0 -6
  621. package/dist/src/ui/components/messages/ToolMessageFocusHint.test.js +0 -89
  622. package/dist/src/ui/components/messages/ToolMessageFocusHint.test.js.map +0 -1
  623. package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.d.ts +0 -6
  624. package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.js +0 -62
  625. package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.js.map +0 -1
  626. package/dist/src/ui/components/messages/ToolResultDisplay.test.d.ts +0 -6
  627. package/dist/src/ui/components/messages/ToolResultDisplay.test.js +0 -114
  628. package/dist/src/ui/components/messages/ToolResultDisplay.test.js.map +0 -1
  629. package/dist/src/ui/components/messages/ToolStickyHeaderRegression.test.d.ts +0 -6
  630. package/dist/src/ui/components/messages/ToolStickyHeaderRegression.test.js +0 -134
  631. package/dist/src/ui/components/messages/ToolStickyHeaderRegression.test.js.map +0 -1
  632. package/dist/src/ui/components/messages/UserMessage.test.d.ts +0 -6
  633. package/dist/src/ui/components/messages/UserMessage.test.js +0 -32
  634. package/dist/src/ui/components/messages/UserMessage.test.js.map +0 -1
  635. package/dist/src/ui/components/messages/WarningMessage.test.d.ts +0 -6
  636. package/dist/src/ui/components/messages/WarningMessage.test.js +0 -23
  637. package/dist/src/ui/components/messages/WarningMessage.test.js.map +0 -1
  638. package/dist/src/ui/components/shared/BaseSelectionList.test.d.ts +0 -6
  639. package/dist/src/ui/components/shared/BaseSelectionList.test.js +0 -386
  640. package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +0 -1
  641. package/dist/src/ui/components/shared/BaseSettingsDialog.test.d.ts +0 -6
  642. package/dist/src/ui/components/shared/BaseSettingsDialog.test.js +0 -434
  643. package/dist/src/ui/components/shared/BaseSettingsDialog.test.js.map +0 -1
  644. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.d.ts +0 -6
  645. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.js +0 -79
  646. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.js.map +0 -1
  647. package/dist/src/ui/components/shared/EnumSelector.test.d.ts +0 -6
  648. package/dist/src/ui/components/shared/EnumSelector.test.js +0 -70
  649. package/dist/src/ui/components/shared/EnumSelector.test.js.map +0 -1
  650. package/dist/src/ui/components/shared/ExpandableText.test.d.ts +0 -6
  651. package/dist/src/ui/components/shared/ExpandableText.test.js +0 -88
  652. package/dist/src/ui/components/shared/ExpandableText.test.js.map +0 -1
  653. package/dist/src/ui/components/shared/HalfLinePaddedBox.test.d.ts +0 -6
  654. package/dist/src/ui/components/shared/HalfLinePaddedBox.test.js +0 -34
  655. package/dist/src/ui/components/shared/HalfLinePaddedBox.test.js.map +0 -1
  656. package/dist/src/ui/components/shared/MaxSizedBox.test.d.ts +0 -6
  657. package/dist/src/ui/components/shared/MaxSizedBox.test.js +0 -90
  658. package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +0 -1
  659. package/dist/src/ui/components/shared/RadioButtonSelect.test.d.ts +0 -6
  660. package/dist/src/ui/components/shared/RadioButtonSelect.test.js +0 -134
  661. package/dist/src/ui/components/shared/RadioButtonSelect.test.js.map +0 -1
  662. package/dist/src/ui/components/shared/Scrollable.test.d.ts +0 -6
  663. package/dist/src/ui/components/shared/Scrollable.test.js +0 -74
  664. package/dist/src/ui/components/shared/Scrollable.test.js.map +0 -1
  665. package/dist/src/ui/components/shared/ScrollableList.test.d.ts +0 -6
  666. package/dist/src/ui/components/shared/ScrollableList.test.js +0 -241
  667. package/dist/src/ui/components/shared/ScrollableList.test.js.map +0 -1
  668. package/dist/src/ui/components/shared/TabHeader.test.d.ts +0 -6
  669. package/dist/src/ui/components/shared/TabHeader.test.js +0 -106
  670. package/dist/src/ui/components/shared/TabHeader.test.js.map +0 -1
  671. package/dist/src/ui/components/shared/TextInput.test.d.ts +0 -6
  672. package/dist/src/ui/components/shared/TextInput.test.js +0 -242
  673. package/dist/src/ui/components/shared/TextInput.test.js.map +0 -1
  674. package/dist/src/ui/components/shared/VirtualizedList.test.d.ts +0 -6
  675. package/dist/src/ui/components/shared/VirtualizedList.test.js +0 -171
  676. package/dist/src/ui/components/shared/VirtualizedList.test.js.map +0 -1
  677. package/dist/src/ui/components/shared/performance.test.d.ts +0 -1
  678. package/dist/src/ui/components/shared/performance.test.js +0 -67
  679. package/dist/src/ui/components/shared/performance.test.js.map +0 -1
  680. package/dist/src/ui/components/shared/text-buffer.test.d.ts +0 -6
  681. package/dist/src/ui/components/shared/text-buffer.test.js +0 -2490
  682. package/dist/src/ui/components/shared/text-buffer.test.js.map +0 -1
  683. package/dist/src/ui/components/shared/vim-buffer-actions.test.d.ts +0 -6
  684. package/dist/src/ui/components/shared/vim-buffer-actions.test.js +0 -964
  685. package/dist/src/ui/components/shared/vim-buffer-actions.test.js.map +0 -1
  686. package/dist/src/ui/components/views/ChatList.test.d.ts +0 -6
  687. package/dist/src/ui/components/views/ChatList.test.js +0 -45
  688. package/dist/src/ui/components/views/ChatList.test.js.map +0 -1
  689. package/dist/src/ui/components/views/ExtensionsList.test.d.ts +0 -6
  690. package/dist/src/ui/components/views/ExtensionsList.test.js +0 -148
  691. package/dist/src/ui/components/views/ExtensionsList.test.js.map +0 -1
  692. package/dist/src/ui/components/views/McpStatus.test.d.ts +0 -6
  693. package/dist/src/ui/components/views/McpStatus.test.js +0 -153
  694. package/dist/src/ui/components/views/McpStatus.test.js.map +0 -1
  695. package/dist/src/ui/components/views/SkillsList.test.d.ts +0 -6
  696. package/dist/src/ui/components/views/SkillsList.test.js +0 -97
  697. package/dist/src/ui/components/views/SkillsList.test.js.map +0 -1
  698. package/dist/src/ui/components/views/ToolsList.test.d.ts +0 -6
  699. package/dist/src/ui/components/views/ToolsList.test.js +0 -45
  700. package/dist/src/ui/components/views/ToolsList.test.js.map +0 -1
  701. package/dist/src/ui/contexts/KeypressContext.test.d.ts +0 -6
  702. package/dist/src/ui/contexts/KeypressContext.test.js +0 -957
  703. package/dist/src/ui/contexts/KeypressContext.test.js.map +0 -1
  704. package/dist/src/ui/contexts/MouseContext.test.d.ts +0 -6
  705. package/dist/src/ui/contexts/MouseContext.test.js +0 -198
  706. package/dist/src/ui/contexts/MouseContext.test.js.map +0 -1
  707. package/dist/src/ui/contexts/ScrollProvider.drag.test.d.ts +0 -6
  708. package/dist/src/ui/contexts/ScrollProvider.drag.test.js +0 -319
  709. package/dist/src/ui/contexts/ScrollProvider.drag.test.js.map +0 -1
  710. package/dist/src/ui/contexts/ScrollProvider.test.d.ts +0 -6
  711. package/dist/src/ui/contexts/ScrollProvider.test.js +0 -377
  712. package/dist/src/ui/contexts/ScrollProvider.test.js.map +0 -1
  713. package/dist/src/ui/contexts/SessionContext.test.d.ts +0 -6
  714. package/dist/src/ui/contexts/SessionContext.test.js +0 -198
  715. package/dist/src/ui/contexts/SessionContext.test.js.map +0 -1
  716. package/dist/src/ui/contexts/ToolActionsContext.test.d.ts +0 -6
  717. package/dist/src/ui/contexts/ToolActionsContext.test.js +0 -166
  718. package/dist/src/ui/contexts/ToolActionsContext.test.js.map +0 -1
  719. package/dist/src/ui/hooks/atCommandProcessor.test.d.ts +0 -6
  720. package/dist/src/ui/hooks/atCommandProcessor.test.js +0 -1032
  721. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +0 -1
  722. package/dist/src/ui/hooks/atCommandProcessor_agents.test.d.ts +0 -6
  723. package/dist/src/ui/hooks/atCommandProcessor_agents.test.js +0 -183
  724. package/dist/src/ui/hooks/atCommandProcessor_agents.test.js.map +0 -1
  725. package/dist/src/ui/hooks/shellCommandProcessor.test.d.ts +0 -6
  726. package/dist/src/ui/hooks/shellCommandProcessor.test.js +0 -521
  727. package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +0 -1
  728. package/dist/src/ui/hooks/slashCommandProcessor.test.d.ts +0 -6
  729. package/dist/src/ui/hooks/slashCommandProcessor.test.js +0 -796
  730. package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +0 -1
  731. package/dist/src/ui/hooks/toolMapping.test.d.ts +0 -6
  732. package/dist/src/ui/hooks/toolMapping.test.js +0 -209
  733. package/dist/src/ui/hooks/toolMapping.test.js.map +0 -1
  734. package/dist/src/ui/hooks/useAnimatedScrollbar.test.d.ts +0 -6
  735. package/dist/src/ui/hooks/useAnimatedScrollbar.test.js +0 -85
  736. package/dist/src/ui/hooks/useAnimatedScrollbar.test.js.map +0 -1
  737. package/dist/src/ui/hooks/useApprovalModeIndicator.test.d.ts +0 -6
  738. package/dist/src/ui/hooks/useApprovalModeIndicator.test.js +0 -435
  739. package/dist/src/ui/hooks/useApprovalModeIndicator.test.js.map +0 -1
  740. package/dist/src/ui/hooks/useAtCompletion.test.d.ts +0 -6
  741. package/dist/src/ui/hooks/useAtCompletion.test.js +0 -417
  742. package/dist/src/ui/hooks/useAtCompletion.test.js.map +0 -1
  743. package/dist/src/ui/hooks/useAtCompletion_agents.test.d.ts +0 -6
  744. package/dist/src/ui/hooks/useAtCompletion_agents.test.js +0 -87
  745. package/dist/src/ui/hooks/useAtCompletion_agents.test.js.map +0 -1
  746. package/dist/src/ui/hooks/useBanner.test.d.ts +0 -6
  747. package/dist/src/ui/hooks/useBanner.test.js +0 -92
  748. package/dist/src/ui/hooks/useBanner.test.js.map +0 -1
  749. package/dist/src/ui/hooks/useBatchedScroll.test.d.ts +0 -6
  750. package/dist/src/ui/hooks/useBatchedScroll.test.js +0 -62
  751. package/dist/src/ui/hooks/useBatchedScroll.test.js.map +0 -1
  752. package/dist/src/ui/hooks/useCommandCompletion.test.d.ts +0 -6
  753. package/dist/src/ui/hooks/useCommandCompletion.test.js +0 -462
  754. package/dist/src/ui/hooks/useCommandCompletion.test.js.map +0 -1
  755. package/dist/src/ui/hooks/useConsoleMessages.test.d.ts +0 -6
  756. package/dist/src/ui/hooks/useConsoleMessages.test.js +0 -159
  757. package/dist/src/ui/hooks/useConsoleMessages.test.js.map +0 -1
  758. package/dist/src/ui/hooks/useEditorSettings.test.d.ts +0 -6
  759. package/dist/src/ui/hooks/useEditorSettings.test.js +0 -179
  760. package/dist/src/ui/hooks/useEditorSettings.test.js.map +0 -1
  761. package/dist/src/ui/hooks/useExtensionUpdates.test.d.ts +0 -6
  762. package/dist/src/ui/hooks/useExtensionUpdates.test.js +0 -279
  763. package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +0 -1
  764. package/dist/src/ui/hooks/useFlickerDetector.test.d.ts +0 -6
  765. package/dist/src/ui/hooks/useFlickerDetector.test.js +0 -106
  766. package/dist/src/ui/hooks/useFlickerDetector.test.js.map +0 -1
  767. package/dist/src/ui/hooks/useFocus.test.d.ts +0 -6
  768. package/dist/src/ui/hooks/useFocus.test.js +0 -131
  769. package/dist/src/ui/hooks/useFocus.test.js.map +0 -1
  770. package/dist/src/ui/hooks/useFolderTrust.test.d.ts +0 -6
  771. package/dist/src/ui/hooks/useFolderTrust.test.js +0 -218
  772. package/dist/src/ui/hooks/useFolderTrust.test.js.map +0 -1
  773. package/dist/src/ui/hooks/useGeminiStream.test.d.ts +0 -6
  774. package/dist/src/ui/hooks/useGeminiStream.test.js +0 -2149
  775. package/dist/src/ui/hooks/useGeminiStream.test.js.map +0 -1
  776. package/dist/src/ui/hooks/useGitBranchName.test.d.ts +0 -6
  777. package/dist/src/ui/hooks/useGitBranchName.test.js +0 -183
  778. package/dist/src/ui/hooks/useGitBranchName.test.js.map +0 -1
  779. package/dist/src/ui/hooks/useHistoryManager.test.d.ts +0 -6
  780. package/dist/src/ui/hooks/useHistoryManager.test.js +0 -188
  781. package/dist/src/ui/hooks/useHistoryManager.test.js.map +0 -1
  782. package/dist/src/ui/hooks/useHookDisplayState.test.d.ts +0 -6
  783. package/dist/src/ui/hooks/useHookDisplayState.test.js +0 -180
  784. package/dist/src/ui/hooks/useHookDisplayState.test.js.map +0 -1
  785. package/dist/src/ui/hooks/useIdeTrustListener.test.d.ts +0 -6
  786. package/dist/src/ui/hooks/useIdeTrustListener.test.js +0 -214
  787. package/dist/src/ui/hooks/useIdeTrustListener.test.js.map +0 -1
  788. package/dist/src/ui/hooks/useIncludeDirsTrust.test.d.ts +0 -6
  789. package/dist/src/ui/hooks/useIncludeDirsTrust.test.js +0 -172
  790. package/dist/src/ui/hooks/useIncludeDirsTrust.test.js.map +0 -1
  791. package/dist/src/ui/hooks/useInputHistory.test.d.ts +0 -6
  792. package/dist/src/ui/hooks/useInputHistory.test.js +0 -208
  793. package/dist/src/ui/hooks/useInputHistory.test.js.map +0 -1
  794. package/dist/src/ui/hooks/useInputHistoryStore.test.d.ts +0 -6
  795. package/dist/src/ui/hooks/useInputHistoryStore.test.js +0 -238
  796. package/dist/src/ui/hooks/useInputHistoryStore.test.js.map +0 -1
  797. package/dist/src/ui/hooks/useKeypress.test.d.ts +0 -6
  798. package/dist/src/ui/hooks/useKeypress.test.js +0 -205
  799. package/dist/src/ui/hooks/useKeypress.test.js.map +0 -1
  800. package/dist/src/ui/hooks/useLoadingIndicator.test.d.ts +0 -6
  801. package/dist/src/ui/hooks/useLoadingIndicator.test.js +0 -145
  802. package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +0 -1
  803. package/dist/src/ui/hooks/useMcpStatus.test.d.ts +0 -6
  804. package/dist/src/ui/hooks/useMcpStatus.test.js +0 -69
  805. package/dist/src/ui/hooks/useMcpStatus.test.js.map +0 -1
  806. package/dist/src/ui/hooks/useMemoryMonitor.test.d.ts +0 -6
  807. package/dist/src/ui/hooks/useMemoryMonitor.test.js +0 -62
  808. package/dist/src/ui/hooks/useMemoryMonitor.test.js.map +0 -1
  809. package/dist/src/ui/hooks/useMessageQueue.test.d.ts +0 -6
  810. package/dist/src/ui/hooks/useMessageQueue.test.js +0 -327
  811. package/dist/src/ui/hooks/useMessageQueue.test.js.map +0 -1
  812. package/dist/src/ui/hooks/useModelCommand.test.d.ts +0 -6
  813. package/dist/src/ui/hooks/useModelCommand.test.js +0 -45
  814. package/dist/src/ui/hooks/useModelCommand.test.js.map +0 -1
  815. package/dist/src/ui/hooks/useMouse.test.d.ts +0 -6
  816. package/dist/src/ui/hooks/useMouse.test.js +0 -57
  817. package/dist/src/ui/hooks/useMouse.test.js.map +0 -1
  818. package/dist/src/ui/hooks/useMouseClick.test.d.ts +0 -6
  819. package/dist/src/ui/hooks/useMouseClick.test.js +0 -59
  820. package/dist/src/ui/hooks/useMouseClick.test.js.map +0 -1
  821. package/dist/src/ui/hooks/useMouseDoubleClick.test.d.ts +0 -6
  822. package/dist/src/ui/hooks/useMouseDoubleClick.test.js +0 -125
  823. package/dist/src/ui/hooks/useMouseDoubleClick.test.js.map +0 -1
  824. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.d.ts +0 -6
  825. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js +0 -291
  826. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js.map +0 -1
  827. package/dist/src/ui/hooks/usePhraseCycler.test.d.ts +0 -6
  828. package/dist/src/ui/hooks/usePhraseCycler.test.js +0 -208
  829. package/dist/src/ui/hooks/usePhraseCycler.test.js.map +0 -1
  830. package/dist/src/ui/hooks/usePrivacySettings.test.d.ts +0 -6
  831. package/dist/src/ui/hooks/usePrivacySettings.test.js +0 -104
  832. package/dist/src/ui/hooks/usePrivacySettings.test.js.map +0 -1
  833. package/dist/src/ui/hooks/useQuotaAndFallback.test.d.ts +0 -6
  834. package/dist/src/ui/hooks/useQuotaAndFallback.test.js +0 -477
  835. package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +0 -1
  836. package/dist/src/ui/hooks/useReactToolScheduler.test.d.ts +0 -6
  837. package/dist/src/ui/hooks/useReactToolScheduler.test.js +0 -58
  838. package/dist/src/ui/hooks/useReactToolScheduler.test.js.map +0 -1
  839. package/dist/src/ui/hooks/useReverseSearchCompletion.test.d.ts +0 -6
  840. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js +0 -169
  841. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js.map +0 -1
  842. package/dist/src/ui/hooks/useRewind.test.d.ts +0 -6
  843. package/dist/src/ui/hooks/useRewind.test.js +0 -100
  844. package/dist/src/ui/hooks/useRewind.test.js.map +0 -1
  845. package/dist/src/ui/hooks/useSelectionList.test.d.ts +0 -6
  846. package/dist/src/ui/hooks/useSelectionList.test.js +0 -848
  847. package/dist/src/ui/hooks/useSelectionList.test.js.map +0 -1
  848. package/dist/src/ui/hooks/useSessionBrowser.test.d.ts +0 -6
  849. package/dist/src/ui/hooks/useSessionBrowser.test.js +0 -203
  850. package/dist/src/ui/hooks/useSessionBrowser.test.js.map +0 -1
  851. package/dist/src/ui/hooks/useSessionResume.test.d.ts +0 -6
  852. package/dist/src/ui/hooks/useSessionResume.test.js +0 -336
  853. package/dist/src/ui/hooks/useSessionResume.test.js.map +0 -1
  854. package/dist/src/ui/hooks/useShellHistory.test.d.ts +0 -6
  855. package/dist/src/ui/hooks/useShellHistory.test.js +0 -223
  856. package/dist/src/ui/hooks/useShellHistory.test.js.map +0 -1
  857. package/dist/src/ui/hooks/useShellInactivityStatus.test.d.ts +0 -6
  858. package/dist/src/ui/hooks/useShellInactivityStatus.test.js +0 -84
  859. package/dist/src/ui/hooks/useShellInactivityStatus.test.js.map +0 -1
  860. package/dist/src/ui/hooks/useSlashCompletion.test.d.ts +0 -9
  861. package/dist/src/ui/hooks/useSlashCompletion.test.js +0 -845
  862. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +0 -1
  863. package/dist/src/ui/hooks/useSnowfall.test.d.ts +0 -6
  864. package/dist/src/ui/hooks/useSnowfall.test.js +0 -88
  865. package/dist/src/ui/hooks/useSnowfall.test.js.map +0 -1
  866. package/dist/src/ui/hooks/useTabbedNavigation.test.d.ts +0 -6
  867. package/dist/src/ui/hooks/useTabbedNavigation.test.js +0 -187
  868. package/dist/src/ui/hooks/useTabbedNavigation.test.js.map +0 -1
  869. package/dist/src/ui/hooks/useTimer.test.d.ts +0 -6
  870. package/dist/src/ui/hooks/useTimer.test.js +0 -119
  871. package/dist/src/ui/hooks/useTimer.test.js.map +0 -1
  872. package/dist/src/ui/hooks/useTips.test.d.ts +0 -6
  873. package/dist/src/ui/hooks/useTips.test.js +0 -33
  874. package/dist/src/ui/hooks/useTips.test.js.map +0 -1
  875. package/dist/src/ui/hooks/useToolExecutionScheduler.test.d.ts +0 -6
  876. package/dist/src/ui/hooks/useToolExecutionScheduler.test.js +0 -376
  877. package/dist/src/ui/hooks/useToolExecutionScheduler.test.js.map +0 -1
  878. package/dist/src/ui/hooks/useToolScheduler.test.d.ts +0 -6
  879. package/dist/src/ui/hooks/useToolScheduler.test.js +0 -881
  880. package/dist/src/ui/hooks/useToolScheduler.test.js.map +0 -1
  881. package/dist/src/ui/hooks/useToolSchedulerFacade.test.d.ts +0 -6
  882. package/dist/src/ui/hooks/useToolSchedulerFacade.test.js +0 -45
  883. package/dist/src/ui/hooks/useToolSchedulerFacade.test.js.map +0 -1
  884. package/dist/src/ui/hooks/useTurnActivityMonitor.test.d.ts +0 -6
  885. package/dist/src/ui/hooks/useTurnActivityMonitor.test.js +0 -97
  886. package/dist/src/ui/hooks/useTurnActivityMonitor.test.js.map +0 -1
  887. package/dist/src/ui/hooks/vim.test.d.ts +0 -6
  888. package/dist/src/ui/hooks/vim.test.js +0 -1384
  889. package/dist/src/ui/hooks/vim.test.js.map +0 -1
  890. package/dist/src/ui/keyMatchers.test.d.ts +0 -6
  891. package/dist/src/ui/keyMatchers.test.js +0 -386
  892. package/dist/src/ui/keyMatchers.test.js.map +0 -1
  893. package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.d.ts +0 -6
  894. package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.js +0 -121
  895. package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.js.map +0 -1
  896. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.d.ts +0 -6
  897. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.js +0 -34
  898. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.js.map +0 -1
  899. package/dist/src/ui/privacy/GeminiPrivacyNotice.test.d.ts +0 -6
  900. package/dist/src/ui/privacy/GeminiPrivacyNotice.test.js +0 -34
  901. package/dist/src/ui/privacy/GeminiPrivacyNotice.test.js.map +0 -1
  902. package/dist/src/ui/privacy/PrivacyNotice.test.d.ts +0 -6
  903. package/dist/src/ui/privacy/PrivacyNotice.test.js +0 -62
  904. package/dist/src/ui/privacy/PrivacyNotice.test.js.map +0 -1
  905. package/dist/src/ui/state/extensions.test.d.ts +0 -6
  906. package/dist/src/ui/state/extensions.test.js +0 -219
  907. package/dist/src/ui/state/extensions.test.js.map +0 -1
  908. package/dist/src/ui/themes/color-utils.test.d.ts +0 -6
  909. package/dist/src/ui/themes/color-utils.test.js +0 -245
  910. package/dist/src/ui/themes/color-utils.test.js.map +0 -1
  911. package/dist/src/ui/themes/theme-manager.test.d.ts +0 -6
  912. package/dist/src/ui/themes/theme-manager.test.js +0 -150
  913. package/dist/src/ui/themes/theme-manager.test.js.map +0 -1
  914. package/dist/src/ui/themes/theme.test.d.ts +0 -6
  915. package/dist/src/ui/themes/theme.test.js +0 -174
  916. package/dist/src/ui/themes/theme.test.js.map +0 -1
  917. package/dist/src/ui/utils/CodeColorizer.test.d.ts +0 -6
  918. package/dist/src/ui/utils/CodeColorizer.test.js +0 -38
  919. package/dist/src/ui/utils/CodeColorizer.test.js.map +0 -1
  920. package/dist/src/ui/utils/InlineMarkdownRenderer.test.d.ts +0 -6
  921. package/dist/src/ui/utils/InlineMarkdownRenderer.test.js +0 -21
  922. package/dist/src/ui/utils/InlineMarkdownRenderer.test.js.map +0 -1
  923. package/dist/src/ui/utils/MarkdownDisplay.test.d.ts +0 -6
  924. package/dist/src/ui/utils/MarkdownDisplay.test.js +0 -159
  925. package/dist/src/ui/utils/MarkdownDisplay.test.js.map +0 -1
  926. package/dist/src/ui/utils/clipboardUtils.test.d.ts +0 -6
  927. package/dist/src/ui/utils/clipboardUtils.test.js +0 -359
  928. package/dist/src/ui/utils/clipboardUtils.test.js.map +0 -1
  929. package/dist/src/ui/utils/clipboardUtils.windows.test.d.ts +0 -6
  930. package/dist/src/ui/utils/clipboardUtils.windows.test.js +0 -55
  931. package/dist/src/ui/utils/clipboardUtils.windows.test.js.map +0 -1
  932. package/dist/src/ui/utils/commandUtils.test.d.ts +0 -6
  933. package/dist/src/ui/utils/commandUtils.test.js +0 -479
  934. package/dist/src/ui/utils/commandUtils.test.js.map +0 -1
  935. package/dist/src/ui/utils/computeStats.test.d.ts +0 -6
  936. package/dist/src/ui/utils/computeStats.test.js +0 -271
  937. package/dist/src/ui/utils/computeStats.test.js.map +0 -1
  938. package/dist/src/ui/utils/directoryUtils.test.d.ts +0 -6
  939. package/dist/src/ui/utils/directoryUtils.test.js +0 -244
  940. package/dist/src/ui/utils/directoryUtils.test.js.map +0 -1
  941. package/dist/src/ui/utils/displayUtils.test.d.ts +0 -6
  942. package/dist/src/ui/utils/displayUtils.test.js +0 -61
  943. package/dist/src/ui/utils/displayUtils.test.js.map +0 -1
  944. package/dist/src/ui/utils/formatters.test.d.ts +0 -6
  945. package/dist/src/ui/utils/formatters.test.js +0 -124
  946. package/dist/src/ui/utils/formatters.test.js.map +0 -1
  947. package/dist/src/ui/utils/highlight.test.d.ts +0 -6
  948. package/dist/src/ui/utils/highlight.test.js +0 -198
  949. package/dist/src/ui/utils/highlight.test.js.map +0 -1
  950. package/dist/src/ui/utils/input.test.d.ts +0 -6
  951. package/dist/src/ui/utils/input.test.js +0 -44
  952. package/dist/src/ui/utils/input.test.js.map +0 -1
  953. package/dist/src/ui/utils/markdownUtilities.test.d.ts +0 -6
  954. package/dist/src/ui/utils/markdownUtilities.test.js +0 -42
  955. package/dist/src/ui/utils/markdownUtilities.test.js.map +0 -1
  956. package/dist/src/ui/utils/mouse.test.d.ts +0 -6
  957. package/dist/src/ui/utils/mouse.test.js +0 -136
  958. package/dist/src/ui/utils/mouse.test.js.map +0 -1
  959. package/dist/src/ui/utils/rewindFileOps.test.d.ts +0 -6
  960. package/dist/src/ui/utils/rewindFileOps.test.js +0 -375
  961. package/dist/src/ui/utils/rewindFileOps.test.js.map +0 -1
  962. package/dist/src/ui/utils/terminalCapabilityManager.test.d.ts +0 -6
  963. package/dist/src/ui/utils/terminalCapabilityManager.test.js +0 -220
  964. package/dist/src/ui/utils/terminalCapabilityManager.test.js.map +0 -1
  965. package/dist/src/ui/utils/terminalSetup.test.d.ts +0 -6
  966. package/dist/src/ui/utils/terminalSetup.test.js +0 -147
  967. package/dist/src/ui/utils/terminalSetup.test.js.map +0 -1
  968. package/dist/src/ui/utils/terminalUtils.test.d.ts +0 -6
  969. package/dist/src/ui/utils/terminalUtils.test.js +0 -40
  970. package/dist/src/ui/utils/terminalUtils.test.js.map +0 -1
  971. package/dist/src/ui/utils/textOutput.test.d.ts +0 -6
  972. package/dist/src/ui/utils/textOutput.test.js +0 -79
  973. package/dist/src/ui/utils/textOutput.test.js.map +0 -1
  974. package/dist/src/ui/utils/textUtils.test.d.ts +0 -6
  975. package/dist/src/ui/utils/textUtils.test.js +0 -168
  976. package/dist/src/ui/utils/textUtils.test.js.map +0 -1
  977. package/dist/src/ui/utils/ui-sizing.test.d.ts +0 -6
  978. package/dist/src/ui/utils/ui-sizing.test.js +0 -38
  979. package/dist/src/ui/utils/ui-sizing.test.js.map +0 -1
  980. package/dist/src/ui/utils/updateCheck.test.d.ts +0 -6
  981. package/dist/src/ui/utils/updateCheck.test.js +0 -134
  982. package/dist/src/ui/utils/updateCheck.test.js.map +0 -1
  983. package/dist/src/utils/agentUtils.test.d.ts +0 -6
  984. package/dist/src/utils/agentUtils.test.js +0 -121
  985. package/dist/src/utils/agentUtils.test.js.map +0 -1
  986. package/dist/src/utils/checks.test.d.ts +0 -6
  987. package/dist/src/utils/checks.test.js +0 -29
  988. package/dist/src/utils/checks.test.js.map +0 -1
  989. package/dist/src/utils/cleanup.test.d.ts +0 -6
  990. package/dist/src/utils/cleanup.test.js +0 -92
  991. package/dist/src/utils/cleanup.test.js.map +0 -1
  992. package/dist/src/utils/commands.test.d.ts +0 -6
  993. package/dist/src/utils/commands.test.js +0 -115
  994. package/dist/src/utils/commands.test.js.map +0 -1
  995. package/dist/src/utils/commentJson.test.d.ts +0 -6
  996. package/dist/src/utils/commentJson.test.js +0 -308
  997. package/dist/src/utils/commentJson.test.js.map +0 -1
  998. package/dist/src/utils/deepMerge.test.d.ts +0 -6
  999. package/dist/src/utils/deepMerge.test.js +0 -201
  1000. package/dist/src/utils/deepMerge.test.js.map +0 -1
  1001. package/dist/src/utils/dialogScopeUtils.test.d.ts +0 -6
  1002. package/dist/src/utils/dialogScopeUtils.test.js +0 -81
  1003. package/dist/src/utils/dialogScopeUtils.test.js.map +0 -1
  1004. package/dist/src/utils/envVarResolver.test.d.ts +0 -6
  1005. package/dist/src/utils/envVarResolver.test.js +0 -221
  1006. package/dist/src/utils/envVarResolver.test.js.map +0 -1
  1007. package/dist/src/utils/errors.test.d.ts +0 -6
  1008. package/dist/src/utils/errors.test.js +0 -435
  1009. package/dist/src/utils/errors.test.js.map +0 -1
  1010. package/dist/src/utils/events.test.d.ts +0 -6
  1011. package/dist/src/utils/events.test.js +0 -24
  1012. package/dist/src/utils/events.test.js.map +0 -1
  1013. package/dist/src/utils/gitUtils.test.d.ts +0 -6
  1014. package/dist/src/utils/gitUtils.test.js +0 -113
  1015. package/dist/src/utils/gitUtils.test.js.map +0 -1
  1016. package/dist/src/utils/handleAutoUpdate.test.d.ts +0 -6
  1017. package/dist/src/utils/handleAutoUpdate.test.js +0 -310
  1018. package/dist/src/utils/handleAutoUpdate.test.js.map +0 -1
  1019. package/dist/src/utils/installationInfo.test.d.ts +0 -6
  1020. package/dist/src/utils/installationInfo.test.js +0 -296
  1021. package/dist/src/utils/installationInfo.test.js.map +0 -1
  1022. package/dist/src/utils/jsonoutput.test.d.ts +0 -6
  1023. package/dist/src/utils/jsonoutput.test.js +0 -74
  1024. package/dist/src/utils/jsonoutput.test.js.map +0 -1
  1025. package/dist/src/utils/math.test.d.ts +0 -6
  1026. package/dist/src/utils/math.test.js +0 -23
  1027. package/dist/src/utils/math.test.js.map +0 -1
  1028. package/dist/src/utils/persistentState.test.d.ts +0 -6
  1029. package/dist/src/utils/persistentState.test.js +0 -68
  1030. package/dist/src/utils/persistentState.test.js.map +0 -1
  1031. package/dist/src/utils/processUtils.test.d.ts +0 -6
  1032. package/dist/src/utils/processUtils.test.js +0 -20
  1033. package/dist/src/utils/processUtils.test.js.map +0 -1
  1034. package/dist/src/utils/readStdin.test.d.ts +0 -6
  1035. package/dist/src/utils/readStdin.test.js +0 -117
  1036. package/dist/src/utils/readStdin.test.js.map +0 -1
  1037. package/dist/src/utils/readStdin_safety.test.d.ts +0 -6
  1038. package/dist/src/utils/readStdin_safety.test.js +0 -68
  1039. package/dist/src/utils/readStdin_safety.test.js.map +0 -1
  1040. package/dist/src/utils/relaunch.test.d.ts +0 -6
  1041. package/dist/src/utils/relaunch.test.js +0 -279
  1042. package/dist/src/utils/relaunch.test.js.map +0 -1
  1043. package/dist/src/utils/resolvePath.test.d.ts +0 -6
  1044. package/dist/src/utils/resolvePath.test.js +0 -34
  1045. package/dist/src/utils/resolvePath.test.js.map +0 -1
  1046. package/dist/src/utils/sandbox.test.d.ts +0 -6
  1047. package/dist/src/utils/sandbox.test.js +0 -314
  1048. package/dist/src/utils/sandbox.test.js.map +0 -1
  1049. package/dist/src/utils/sandboxUtils.test.d.ts +0 -6
  1050. package/dist/src/utils/sandboxUtils.test.js +0 -122
  1051. package/dist/src/utils/sandboxUtils.test.js.map +0 -1
  1052. package/dist/src/utils/sessionCleanup.integration.test.d.ts +0 -6
  1053. package/dist/src/utils/sessionCleanup.integration.test.js +0 -182
  1054. package/dist/src/utils/sessionCleanup.integration.test.js.map +0 -1
  1055. package/dist/src/utils/sessionCleanup.test.d.ts +0 -6
  1056. package/dist/src/utils/sessionCleanup.test.js +0 -1298
  1057. package/dist/src/utils/sessionCleanup.test.js.map +0 -1
  1058. package/dist/src/utils/sessionUtils.test.d.ts +0 -6
  1059. package/dist/src/utils/sessionUtils.test.js +0 -503
  1060. package/dist/src/utils/sessionUtils.test.js.map +0 -1
  1061. package/dist/src/utils/sessions.test.d.ts +0 -6
  1062. package/dist/src/utils/sessions.test.js +0 -581
  1063. package/dist/src/utils/sessions.test.js.map +0 -1
  1064. package/dist/src/utils/settingsUtils.test.d.ts +0 -6
  1065. package/dist/src/utils/settingsUtils.test.js +0 -808
  1066. package/dist/src/utils/settingsUtils.test.js.map +0 -1
  1067. package/dist/src/utils/skillUtils.test.d.ts +0 -6
  1068. package/dist/src/utils/skillUtils.test.js +0 -70
  1069. package/dist/src/utils/skillUtils.test.js.map +0 -1
  1070. package/dist/src/utils/startupWarnings.test.d.ts +0 -6
  1071. package/dist/src/utils/startupWarnings.test.js +0 -61
  1072. package/dist/src/utils/startupWarnings.test.js.map +0 -1
  1073. package/dist/src/utils/updateEventEmitter.test.d.ts +0 -6
  1074. package/dist/src/utils/updateEventEmitter.test.js +0 -18
  1075. package/dist/src/utils/updateEventEmitter.test.js.map +0 -1
  1076. package/dist/src/utils/userStartupWarnings.test.d.ts +0 -6
  1077. package/dist/src/utils/userStartupWarnings.test.js +0 -98
  1078. package/dist/src/utils/userStartupWarnings.test.js.map +0 -1
  1079. package/dist/src/utils/windowTitle.test.d.ts +0 -6
  1080. package/dist/src/utils/windowTitle.test.js +0 -216
  1081. package/dist/src/utils/windowTitle.test.js.map +0 -1
  1082. package/dist/src/validateNonInterActiveAuth.test.d.ts +0 -6
  1083. package/dist/src/validateNonInterActiveAuth.test.js +0 -319
  1084. package/dist/src/validateNonInterActiveAuth.test.js.map +0 -1
  1085. package/dist/src/zed-integration/fileSystemService.test.d.ts +0 -6
  1086. package/dist/src/zed-integration/fileSystemService.test.js +0 -88
  1087. package/dist/src/zed-integration/fileSystemService.test.js.map +0 -1
  1088. package/dist/src/zed-integration/zedIntegration.test.d.ts +0 -6
  1089. package/dist/src/zed-integration/zedIntegration.test.js +0 -625
  1090. package/dist/src/zed-integration/zedIntegration.test.js.map +0 -1
  1091. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,1687 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { ToolErrorType, LlmEventType, OutputFormat, uiTelemetryService, FatalInputError, CoreEvent, } from '@didim365/agent-cli-core';
7
- import { runNonInteractive } from './nonInteractiveCli.js';
8
- import { describe, it, expect, beforeEach, afterEach, vi, } from 'vitest';
9
- // Mock core modules
10
- vi.mock('./ui/hooks/atCommandProcessor.js');
11
- const mockCoreEvents = vi.hoisted(() => ({
12
- on: vi.fn(),
13
- off: vi.fn(),
14
- emit: vi.fn(),
15
- emitConsoleLog: vi.fn(),
16
- emitFeedback: vi.fn(),
17
- drainBacklogs: vi.fn(),
18
- }));
19
- const mockSchedulerSchedule = vi.hoisted(() => vi.fn());
20
- vi.mock('@didim365/agent-cli-core', async (importOriginal) => {
21
- const original = await importOriginal();
22
- class MockChatRecordingService {
23
- initialize = vi.fn();
24
- recordMessage = vi.fn();
25
- recordMessageTokens = vi.fn();
26
- recordToolCalls = vi.fn();
27
- }
28
- return {
29
- ...original,
30
- Scheduler: class {
31
- schedule = mockSchedulerSchedule;
32
- cancelAll = vi.fn();
33
- },
34
- isTelemetrySdkInitialized: vi.fn().mockReturnValue(true),
35
- ChatRecordingService: MockChatRecordingService,
36
- uiTelemetryService: {
37
- getMetrics: vi.fn(),
38
- },
39
- coreEvents: mockCoreEvents,
40
- createWorkingStdio: vi.fn(() => ({
41
- stdout: process.stdout,
42
- stderr: process.stderr,
43
- })),
44
- };
45
- });
46
- const mockGetCommands = vi.hoisted(() => vi.fn());
47
- const mockCommandServiceCreate = vi.hoisted(() => vi.fn());
48
- vi.mock('./services/CommandService.js', () => ({
49
- CommandService: {
50
- create: mockCommandServiceCreate,
51
- },
52
- }));
53
- vi.mock('./services/FileCommandLoader.js');
54
- vi.mock('./services/McpPromptLoader.js');
55
- vi.mock('./services/BuiltinCommandLoader.js');
56
- describe('runNonInteractive', () => {
57
- let mockConfig;
58
- let mockSettings;
59
- let mockToolRegistry;
60
- let consoleErrorSpy;
61
- let processStdoutSpy;
62
- let processStderrSpy;
63
- let mockGeminiClient;
64
- const MOCK_SESSION_METRICS = {
65
- models: {},
66
- tools: {
67
- totalCalls: 0,
68
- totalSuccess: 0,
69
- totalFail: 0,
70
- totalDurationMs: 0,
71
- totalDecisions: {
72
- accept: 0,
73
- reject: 0,
74
- modify: 0,
75
- auto_accept: 0,
76
- },
77
- byName: {},
78
- },
79
- files: {
80
- totalLinesAdded: 0,
81
- totalLinesRemoved: 0,
82
- },
83
- };
84
- beforeEach(async () => {
85
- mockSchedulerSchedule.mockReset();
86
- mockCommandServiceCreate.mockResolvedValue({
87
- getCommands: mockGetCommands,
88
- });
89
- consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => { });
90
- processStdoutSpy = vi
91
- .spyOn(process.stdout, 'write')
92
- .mockImplementation(() => true);
93
- vi.spyOn(process.stdout, 'on').mockImplementation(() => process.stdout);
94
- processStderrSpy = vi
95
- .spyOn(process.stderr, 'write')
96
- .mockImplementation(() => true);
97
- vi.spyOn(process, 'exit').mockImplementation((code) => {
98
- throw new Error(`process.exit(${code}) called`);
99
- });
100
- mockToolRegistry = {
101
- getTool: vi.fn(),
102
- getFunctionDeclarations: vi.fn().mockReturnValue([]),
103
- };
104
- mockGeminiClient = {
105
- sendMessageStream: vi.fn(),
106
- resumeChat: vi.fn().mockResolvedValue(undefined),
107
- getChatRecordingService: vi.fn(() => ({
108
- initialize: vi.fn(),
109
- recordMessage: vi.fn(),
110
- recordMessageTokens: vi.fn(),
111
- recordToolCalls: vi.fn(),
112
- })),
113
- };
114
- mockConfig = {
115
- initialize: vi.fn().mockResolvedValue(undefined),
116
- getMessageBus: vi.fn().mockReturnValue({
117
- subscribe: vi.fn(),
118
- unsubscribe: vi.fn(),
119
- publish: vi.fn(),
120
- }),
121
- getGeminiClient: vi.fn().mockReturnValue(mockGeminiClient),
122
- getToolRegistry: vi.fn().mockReturnValue(mockToolRegistry),
123
- getMaxSessionTurns: vi.fn().mockReturnValue(10),
124
- getSessionId: vi.fn().mockReturnValue('test-session-id'),
125
- getProjectRoot: vi.fn().mockReturnValue('/test/project'),
126
- storage: {
127
- getProjectTempDir: vi.fn().mockReturnValue('/test/project/.gemini/tmp'),
128
- },
129
- getIdeMode: vi.fn().mockReturnValue(false),
130
- getContentGeneratorConfig: vi.fn().mockReturnValue({}),
131
- getDebugMode: vi.fn().mockReturnValue(false),
132
- getOutputFormat: vi.fn().mockReturnValue('text'),
133
- getModel: vi.fn().mockReturnValue('test-model'),
134
- getFolderTrust: vi.fn().mockReturnValue(false),
135
- isTrustedFolder: vi.fn().mockReturnValue(false),
136
- getRawOutput: vi.fn().mockReturnValue(false),
137
- getAcceptRawOutputRisk: vi.fn().mockReturnValue(false),
138
- };
139
- mockSettings = {
140
- system: { path: '', settings: {} },
141
- systemDefaults: { path: '', settings: {} },
142
- user: { path: '', settings: {} },
143
- workspace: { path: '', settings: {} },
144
- errors: [],
145
- setValue: vi.fn(),
146
- merged: {
147
- security: {
148
- auth: {
149
- enforcedType: undefined,
150
- },
151
- },
152
- },
153
- isTrusted: true,
154
- migratedInMemoryScopes: new Set(),
155
- forScope: vi.fn(),
156
- computeMergedSettings: vi.fn(),
157
- };
158
- const { handleAtCommand } = await import('./ui/hooks/atCommandProcessor.js');
159
- vi.mocked(handleAtCommand).mockImplementation(async ({ query }) => ({
160
- processedQuery: [{ text: query }],
161
- }));
162
- });
163
- afterEach(() => {
164
- vi.restoreAllMocks();
165
- });
166
- async function* createStreamFromEvents(events) {
167
- for (const event of events) {
168
- yield event;
169
- }
170
- }
171
- const getWrittenOutput = () => processStdoutSpy.mock.calls.map((c) => c[0]).join('');
172
- it('should process input and write text output', async () => {
173
- const events = [
174
- { type: LlmEventType.TextDelta, text: 'Hello' },
175
- { type: LlmEventType.TextDelta, text: ' World' },
176
- {
177
- type: LlmEventType.Finished,
178
- finishReason: undefined,
179
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
180
- },
181
- ];
182
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
183
- await runNonInteractive({
184
- config: mockConfig,
185
- settings: mockSettings,
186
- input: 'Test input',
187
- prompt_id: 'prompt-id-1',
188
- });
189
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledWith([{ text: 'Test input' }], expect.any(AbortSignal), 'prompt-id-1');
190
- expect(getWrittenOutput()).toBe('Hello World\n');
191
- // Note: Telemetry shutdown is now handled in runExitCleanup() in cleanup.ts
192
- // so we no longer expect shutdownTelemetry to be called directly here
193
- });
194
- it('should handle a single tool call and respond', async () => {
195
- const toolCallEvent = {
196
- type: LlmEventType.ToolCallRequest,
197
- callId: 'tool-1',
198
- name: 'testTool',
199
- args: { arg1: 'value1' },
200
- isClientInitiated: false,
201
- promptId: 'prompt-id-2',
202
- };
203
- const toolResponse = [{ text: 'Tool response' }];
204
- mockSchedulerSchedule.mockResolvedValue([
205
- {
206
- status: 'success',
207
- request: {
208
- callId: 'tool-1',
209
- name: 'testTool',
210
- args: { arg1: 'value1' },
211
- isClientInitiated: false,
212
- prompt_id: 'prompt-id-2',
213
- },
214
- tool: {},
215
- invocation: {},
216
- response: {
217
- responseParts: toolResponse,
218
- callId: 'tool-1',
219
- error: undefined,
220
- errorType: undefined,
221
- contentLength: undefined,
222
- },
223
- },
224
- ]);
225
- const firstCallEvents = [toolCallEvent];
226
- const secondCallEvents = [
227
- { type: LlmEventType.TextDelta, text: 'Final answer' },
228
- {
229
- type: LlmEventType.Finished,
230
- finishReason: undefined,
231
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
232
- },
233
- ];
234
- mockGeminiClient.sendMessageStream
235
- .mockReturnValueOnce(createStreamFromEvents(firstCallEvents))
236
- .mockReturnValueOnce(createStreamFromEvents(secondCallEvents));
237
- await runNonInteractive({
238
- config: mockConfig,
239
- settings: mockSettings,
240
- input: 'Use a tool',
241
- prompt_id: 'prompt-id-2',
242
- });
243
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledTimes(2);
244
- expect(mockSchedulerSchedule).toHaveBeenCalledWith([expect.objectContaining({ name: 'testTool' })], expect.any(AbortSignal));
245
- expect(mockGeminiClient.sendMessageStream).toHaveBeenNthCalledWith(2, [{ text: 'Tool response' }], expect.any(AbortSignal), 'prompt-id-2');
246
- expect(getWrittenOutput()).toBe('Final answer\n');
247
- });
248
- it('should write a single newline between sequential text outputs from the model', async () => {
249
- // This test simulates a multi-turn conversation to ensure that a single newline
250
- // is printed between each block of text output from the model.
251
- // 1. Define the tool requests that the model will ask the CLI to run.
252
- const toolCallEvent = {
253
- type: LlmEventType.ToolCallRequest,
254
- callId: 'mock-tool',
255
- name: 'mockTool',
256
- args: {},
257
- isClientInitiated: false,
258
- promptId: 'prompt-id-multi',
259
- };
260
- // 2. Mock the execution of the tools. We just need them to succeed.
261
- mockSchedulerSchedule.mockResolvedValue([
262
- {
263
- status: 'success',
264
- request: {
265
- callId: 'mock-tool',
266
- name: 'mockTool',
267
- args: {},
268
- isClientInitiated: false,
269
- prompt_id: 'prompt-id-multi',
270
- },
271
- tool: {},
272
- invocation: {},
273
- response: {
274
- responseParts: [],
275
- callId: 'mock-tool',
276
- },
277
- },
278
- ]);
279
- // 3. Define the sequence of events streamed from the mock model.
280
- // Turn 1: Model outputs text, then requests a tool call.
281
- const modelTurn1 = [
282
- { type: LlmEventType.TextDelta, text: 'Use mock tool' },
283
- toolCallEvent,
284
- ];
285
- // Turn 2: Model outputs more text, then requests another tool call.
286
- const modelTurn2 = [
287
- { type: LlmEventType.TextDelta, text: 'Use mock tool again' },
288
- toolCallEvent,
289
- ];
290
- // Turn 3: Model outputs a final answer.
291
- const modelTurn3 = [
292
- { type: LlmEventType.TextDelta, text: 'Finished.' },
293
- {
294
- type: LlmEventType.Finished,
295
- finishReason: undefined,
296
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
297
- },
298
- ];
299
- mockGeminiClient.sendMessageStream
300
- .mockReturnValueOnce(createStreamFromEvents(modelTurn1))
301
- .mockReturnValueOnce(createStreamFromEvents(modelTurn2))
302
- .mockReturnValueOnce(createStreamFromEvents(modelTurn3));
303
- // 4. Run the command.
304
- await runNonInteractive({
305
- config: mockConfig,
306
- settings: mockSettings,
307
- input: 'Use mock tool multiple times',
308
- prompt_id: 'prompt-id-multi',
309
- });
310
- // 5. Verify the output.
311
- // The rendered output should contain the text from each turn, separated by a
312
- // single newline, with a final newline at the end.
313
- expect(getWrittenOutput()).toMatchSnapshot();
314
- // Also verify the tools were called as expected.
315
- expect(mockSchedulerSchedule).toHaveBeenCalledTimes(2);
316
- });
317
- it('should handle error during tool execution and should send error back to the model', async () => {
318
- const toolCallEvent = {
319
- type: LlmEventType.ToolCallRequest,
320
- callId: 'tool-1',
321
- name: 'errorTool',
322
- args: {},
323
- isClientInitiated: false,
324
- promptId: 'prompt-id-3',
325
- };
326
- mockSchedulerSchedule.mockResolvedValue([
327
- {
328
- status: 'error',
329
- request: {
330
- callId: 'tool-1',
331
- name: 'errorTool',
332
- args: {},
333
- isClientInitiated: false,
334
- prompt_id: 'prompt-id-3',
335
- },
336
- tool: {},
337
- response: {
338
- callId: 'tool-1',
339
- error: new Error('Execution failed'),
340
- errorType: ToolErrorType.EXECUTION_FAILED,
341
- responseParts: [
342
- {
343
- functionResponse: {
344
- name: 'errorTool',
345
- response: {
346
- output: 'Error: Execution failed',
347
- },
348
- },
349
- },
350
- ],
351
- resultDisplay: 'Execution failed',
352
- contentLength: undefined,
353
- },
354
- },
355
- ]);
356
- const finalResponse = [
357
- {
358
- type: LlmEventType.TextDelta,
359
- text: 'Sorry, let me try again.',
360
- },
361
- {
362
- type: LlmEventType.Finished,
363
- finishReason: undefined,
364
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
365
- },
366
- ];
367
- mockGeminiClient.sendMessageStream
368
- .mockReturnValueOnce(createStreamFromEvents([toolCallEvent]))
369
- .mockReturnValueOnce(createStreamFromEvents(finalResponse));
370
- await runNonInteractive({
371
- config: mockConfig,
372
- settings: mockSettings,
373
- input: 'Trigger tool error',
374
- prompt_id: 'prompt-id-3',
375
- });
376
- expect(mockSchedulerSchedule).toHaveBeenCalled();
377
- expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool errorTool: Execution failed');
378
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledTimes(2);
379
- expect(mockGeminiClient.sendMessageStream).toHaveBeenNthCalledWith(2, [
380
- {
381
- functionResponse: {
382
- name: 'errorTool',
383
- response: {
384
- output: 'Error: Execution failed',
385
- },
386
- },
387
- },
388
- ], expect.any(AbortSignal), 'prompt-id-3');
389
- expect(getWrittenOutput()).toBe('Sorry, let me try again.\n');
390
- });
391
- it('should exit with error if sendMessageStream throws initially', async () => {
392
- const apiError = new Error('API connection failed');
393
- mockGeminiClient.sendMessageStream.mockImplementation(() => {
394
- throw apiError;
395
- });
396
- await expect(runNonInteractive({
397
- config: mockConfig,
398
- settings: mockSettings,
399
- input: 'Initial fail',
400
- prompt_id: 'prompt-id-4',
401
- })).rejects.toThrow(apiError);
402
- });
403
- it('should not exit if a tool is not found, and should send error back to model', async () => {
404
- const toolCallEvent = {
405
- type: LlmEventType.ToolCallRequest,
406
- callId: 'tool-1',
407
- name: 'nonexistentTool',
408
- args: {},
409
- isClientInitiated: false,
410
- promptId: 'prompt-id-5',
411
- };
412
- mockSchedulerSchedule.mockResolvedValue([
413
- {
414
- status: 'error',
415
- request: {
416
- callId: 'tool-1',
417
- name: 'nonexistentTool',
418
- args: {},
419
- isClientInitiated: false,
420
- prompt_id: 'prompt-id-5',
421
- },
422
- response: {
423
- callId: 'tool-1',
424
- error: new Error('Tool "nonexistentTool" not found in registry.'),
425
- resultDisplay: 'Tool "nonexistentTool" not found in registry.',
426
- responseParts: [],
427
- errorType: undefined,
428
- contentLength: undefined,
429
- },
430
- },
431
- ]);
432
- const finalResponse = [
433
- {
434
- type: LlmEventType.TextDelta,
435
- text: "Sorry, I can't find that tool.",
436
- },
437
- {
438
- type: LlmEventType.Finished,
439
- finishReason: undefined,
440
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
441
- },
442
- ];
443
- mockGeminiClient.sendMessageStream
444
- .mockReturnValueOnce(createStreamFromEvents([toolCallEvent]))
445
- .mockReturnValueOnce(createStreamFromEvents(finalResponse));
446
- await runNonInteractive({
447
- config: mockConfig,
448
- settings: mockSettings,
449
- input: 'Trigger tool not found',
450
- prompt_id: 'prompt-id-5',
451
- });
452
- expect(mockSchedulerSchedule).toHaveBeenCalled();
453
- expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool nonexistentTool: Tool "nonexistentTool" not found in registry.');
454
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledTimes(2);
455
- expect(getWrittenOutput()).toBe("Sorry, I can't find that tool.\n");
456
- });
457
- it('should exit when max session turns are exceeded', async () => {
458
- vi.mocked(mockConfig.getMaxSessionTurns).mockReturnValue(0);
459
- await expect(runNonInteractive({
460
- config: mockConfig,
461
- settings: mockSettings,
462
- input: 'Trigger loop',
463
- prompt_id: 'prompt-id-6',
464
- })).rejects.toThrow('process.exit(53) called');
465
- });
466
- it('should preprocess @include commands before sending to the model', async () => {
467
- // 1. Mock the imported atCommandProcessor
468
- const { handleAtCommand } = await import('./ui/hooks/atCommandProcessor.js');
469
- const mockHandleAtCommand = vi.mocked(handleAtCommand);
470
- // 2. Define the raw input and the expected processed output
471
- const rawInput = 'Summarize @file.txt';
472
- const processedParts = [
473
- { text: 'Summarize @file.txt' },
474
- { text: '\n--- Content from referenced files ---\n' },
475
- { text: 'This is the content of the file.' },
476
- { text: '\n--- End of content ---' },
477
- ];
478
- // 3. Setup the mock to return the processed parts
479
- mockHandleAtCommand.mockResolvedValue({
480
- processedQuery: processedParts,
481
- });
482
- // Mock a simple stream response from the Gemini client
483
- const events = [
484
- { type: LlmEventType.TextDelta, text: 'Summary complete.' },
485
- {
486
- type: LlmEventType.Finished,
487
- finishReason: undefined,
488
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
489
- },
490
- ];
491
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
492
- // 4. Run the non-interactive mode with the raw input
493
- await runNonInteractive({
494
- config: mockConfig,
495
- settings: mockSettings,
496
- input: rawInput,
497
- prompt_id: 'prompt-id-7',
498
- });
499
- // 5. Assert that sendMessageStream was called with the PROCESSED parts, not the raw input
500
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledWith(processedParts, expect.any(AbortSignal), 'prompt-id-7');
501
- // 6. Assert the final output is correct
502
- expect(getWrittenOutput()).toBe('Summary complete.\n');
503
- });
504
- it('should process input and write JSON output with stats', async () => {
505
- const events = [
506
- { type: LlmEventType.TextDelta, text: 'Hello World' },
507
- {
508
- type: LlmEventType.Finished,
509
- finishReason: undefined,
510
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
511
- },
512
- ];
513
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
514
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.JSON);
515
- vi.mocked(uiTelemetryService.getMetrics).mockReturnValue(MOCK_SESSION_METRICS);
516
- await runNonInteractive({
517
- config: mockConfig,
518
- settings: mockSettings,
519
- input: 'Test input',
520
- prompt_id: 'prompt-id-1',
521
- });
522
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledWith([{ text: 'Test input' }], expect.any(AbortSignal), 'prompt-id-1');
523
- expect(processStdoutSpy).toHaveBeenCalledWith(JSON.stringify({
524
- session_id: 'test-session-id',
525
- response: 'Hello World',
526
- stats: MOCK_SESSION_METRICS,
527
- }, null, 2));
528
- });
529
- it('should write JSON output with stats for tool-only commands (no text response)', async () => {
530
- // Test the scenario where a command completes successfully with only tool calls
531
- // but no text response - this would have caught the original bug
532
- const toolCallEvent = {
533
- type: LlmEventType.ToolCallRequest,
534
- callId: 'tool-1',
535
- name: 'testTool',
536
- args: { arg1: 'value1' },
537
- isClientInitiated: false,
538
- promptId: 'prompt-id-tool-only',
539
- };
540
- const toolResponse = [{ text: 'Tool executed successfully' }];
541
- mockSchedulerSchedule.mockResolvedValue([
542
- {
543
- status: 'success',
544
- request: {
545
- callId: 'tool-1',
546
- name: 'testTool',
547
- args: { arg1: 'value1' },
548
- isClientInitiated: false,
549
- prompt_id: 'prompt-id-tool-only',
550
- },
551
- tool: {},
552
- invocation: {},
553
- response: {
554
- responseParts: toolResponse,
555
- callId: 'tool-1',
556
- error: undefined,
557
- errorType: undefined,
558
- contentLength: undefined,
559
- },
560
- },
561
- ]);
562
- // First call returns only tool call, no content
563
- const firstCallEvents = [
564
- toolCallEvent,
565
- {
566
- type: LlmEventType.Finished,
567
- finishReason: undefined,
568
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 5 },
569
- },
570
- ];
571
- // Second call returns no content (tool-only completion)
572
- const secondCallEvents = [
573
- {
574
- type: LlmEventType.Finished,
575
- finishReason: undefined,
576
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 3 },
577
- },
578
- ];
579
- mockGeminiClient.sendMessageStream
580
- .mockReturnValueOnce(createStreamFromEvents(firstCallEvents))
581
- .mockReturnValueOnce(createStreamFromEvents(secondCallEvents));
582
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.JSON);
583
- vi.mocked(uiTelemetryService.getMetrics).mockReturnValue(MOCK_SESSION_METRICS);
584
- await runNonInteractive({
585
- config: mockConfig,
586
- settings: mockSettings,
587
- input: 'Execute tool only',
588
- prompt_id: 'prompt-id-tool-only',
589
- });
590
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledTimes(2);
591
- expect(mockSchedulerSchedule).toHaveBeenCalledWith([expect.objectContaining({ name: 'testTool' })], expect.any(AbortSignal));
592
- // This should output JSON with empty response but include stats
593
- expect(processStdoutSpy).toHaveBeenCalledWith(JSON.stringify({
594
- session_id: 'test-session-id',
595
- response: '',
596
- stats: MOCK_SESSION_METRICS,
597
- }, null, 2));
598
- });
599
- it('should write JSON output with stats for empty response commands', async () => {
600
- // Test the scenario where a command completes but produces no content at all
601
- const events = [
602
- {
603
- type: LlmEventType.Finished,
604
- finishReason: undefined,
605
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 1 },
606
- },
607
- ];
608
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
609
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.JSON);
610
- vi.mocked(uiTelemetryService.getMetrics).mockReturnValue(MOCK_SESSION_METRICS);
611
- await runNonInteractive({
612
- config: mockConfig,
613
- settings: mockSettings,
614
- input: 'Empty response test',
615
- prompt_id: 'prompt-id-empty',
616
- });
617
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledWith([{ text: 'Empty response test' }], expect.any(AbortSignal), 'prompt-id-empty');
618
- // This should output JSON with empty response but include stats
619
- expect(processStdoutSpy).toHaveBeenCalledWith(JSON.stringify({
620
- session_id: 'test-session-id',
621
- response: '',
622
- stats: MOCK_SESSION_METRICS,
623
- }, null, 2));
624
- });
625
- it('should handle errors in JSON format', async () => {
626
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.JSON);
627
- const testError = new Error('Invalid input provided');
628
- mockGeminiClient.sendMessageStream.mockImplementation(() => {
629
- throw testError;
630
- });
631
- let thrownError = null;
632
- try {
633
- await runNonInteractive({
634
- config: mockConfig,
635
- settings: mockSettings,
636
- input: 'Test input',
637
- prompt_id: 'prompt-id-error',
638
- });
639
- // Should not reach here
640
- expect.fail('Expected process.exit to be called');
641
- }
642
- catch (error) {
643
- thrownError = error;
644
- }
645
- // Should throw because of mocked process.exit
646
- expect(thrownError?.message).toBe('process.exit(1) called');
647
- expect(mockCoreEvents.emitFeedback).toHaveBeenCalledWith('error', JSON.stringify({
648
- session_id: 'test-session-id',
649
- error: {
650
- type: 'Error',
651
- message: 'Invalid input provided',
652
- code: 1,
653
- },
654
- }, null, 2));
655
- });
656
- it('should handle FatalInputError with custom exit code in JSON format', async () => {
657
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.JSON);
658
- const fatalError = new FatalInputError('Invalid command syntax provided');
659
- mockGeminiClient.sendMessageStream.mockImplementation(() => {
660
- throw fatalError;
661
- });
662
- let thrownError = null;
663
- try {
664
- await runNonInteractive({
665
- config: mockConfig,
666
- settings: mockSettings,
667
- input: 'Invalid syntax',
668
- prompt_id: 'prompt-id-fatal',
669
- });
670
- // Should not reach here
671
- expect.fail('Expected process.exit to be called');
672
- }
673
- catch (error) {
674
- thrownError = error;
675
- }
676
- // Should throw because of mocked process.exit with custom exit code
677
- expect(thrownError?.message).toBe('process.exit(42) called');
678
- expect(mockCoreEvents.emitFeedback).toHaveBeenCalledWith('error', JSON.stringify({
679
- session_id: 'test-session-id',
680
- error: {
681
- type: 'FatalInputError',
682
- message: 'Invalid command syntax provided',
683
- code: 42,
684
- },
685
- }, null, 2));
686
- });
687
- it('should execute a slash command that returns a prompt', async () => {
688
- const mockCommand = {
689
- name: 'testcommand',
690
- description: 'a test command',
691
- action: vi.fn().mockResolvedValue({
692
- type: 'submit_prompt',
693
- content: [{ text: 'Prompt from command' }],
694
- }),
695
- };
696
- mockGetCommands.mockReturnValue([mockCommand]);
697
- const events = [
698
- { type: LlmEventType.TextDelta, text: 'Response from command' },
699
- {
700
- type: LlmEventType.Finished,
701
- finishReason: undefined,
702
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 5 },
703
- },
704
- ];
705
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
706
- await runNonInteractive({
707
- config: mockConfig,
708
- settings: mockSettings,
709
- input: '/testcommand',
710
- prompt_id: 'prompt-id-slash',
711
- });
712
- // Ensure the prompt sent to the model is from the command, not the raw input
713
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledWith([{ text: 'Prompt from command' }], expect.any(AbortSignal), 'prompt-id-slash');
714
- expect(getWrittenOutput()).toBe('Response from command\n');
715
- });
716
- it('should handle slash commands', async () => {
717
- const nonInteractiveCliCommands = await import('./nonInteractiveCliCommands.js');
718
- const handleSlashCommandSpy = vi.spyOn(nonInteractiveCliCommands, 'handleSlashCommand');
719
- handleSlashCommandSpy.mockResolvedValue([{ text: 'Slash command output' }]);
720
- const events = [
721
- { type: LlmEventType.TextDelta, text: 'Response to slash command' },
722
- {
723
- type: LlmEventType.Finished,
724
- finishReason: undefined,
725
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
726
- },
727
- ];
728
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
729
- await runNonInteractive({
730
- config: mockConfig,
731
- settings: mockSettings,
732
- input: '/help',
733
- prompt_id: 'prompt-id-slash',
734
- });
735
- expect(handleSlashCommandSpy).toHaveBeenCalledWith('/help', expect.any(AbortController), mockConfig, mockSettings);
736
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledWith([{ text: 'Slash command output' }], expect.any(AbortSignal), 'prompt-id-slash');
737
- expect(getWrittenOutput()).toBe('Response to slash command\n');
738
- handleSlashCommandSpy.mockRestore();
739
- });
740
- it('should handle cancellation (Ctrl+C)', async () => {
741
- // Mock isTTY and setRawMode safely
742
- const originalIsTTY = process.stdin.isTTY;
743
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
744
- const originalSetRawMode = process.stdin.setRawMode;
745
- Object.defineProperty(process.stdin, 'isTTY', {
746
- value: true,
747
- configurable: true,
748
- });
749
- if (!originalSetRawMode) {
750
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
751
- process.stdin.setRawMode = vi.fn();
752
- }
753
- const stdinOnSpy = vi
754
- .spyOn(process.stdin, 'on')
755
- .mockImplementation(() => process.stdin);
756
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
757
- vi.spyOn(process.stdin, 'setRawMode').mockImplementation(() => true);
758
- vi.spyOn(process.stdin, 'resume').mockImplementation(() => process.stdin);
759
- vi.spyOn(process.stdin, 'pause').mockImplementation(() => process.stdin);
760
- vi.spyOn(process.stdin, 'removeAllListeners').mockImplementation(() => process.stdin);
761
- // Spy on handleCancellationError to verify it's called
762
- const errors = await import('./utils/errors.js');
763
- const handleCancellationErrorSpy = vi
764
- .spyOn(errors, 'handleCancellationError')
765
- .mockImplementation(() => {
766
- throw new Error('Cancelled');
767
- });
768
- const events = [
769
- { type: LlmEventType.TextDelta, text: 'Thinking...' },
770
- ];
771
- // Create a stream that responds to abortion
772
- mockGeminiClient.sendMessageStream.mockImplementation((_messages, signal) => (async function* () {
773
- yield events[0];
774
- await new Promise((resolve, reject) => {
775
- const timeout = setTimeout(resolve, 1000);
776
- signal.addEventListener('abort', () => {
777
- clearTimeout(timeout);
778
- setTimeout(() => {
779
- reject(new Error('Aborted')); // This will be caught by nonInteractiveCli and passed to handleError
780
- }, 300);
781
- });
782
- });
783
- })());
784
- const runPromise = runNonInteractive({
785
- config: mockConfig,
786
- settings: mockSettings,
787
- input: 'Long running query',
788
- prompt_id: 'prompt-id-cancel',
789
- });
790
- // Wait a bit for setup to complete and listeners to be registered
791
- await new Promise((resolve) => setTimeout(resolve, 100));
792
- // Find the keypress handler registered by runNonInteractive
793
- const keypressCall = stdinOnSpy.mock.calls.find(
794
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
795
- (call) => call[0] === 'keypress');
796
- expect(keypressCall).toBeDefined();
797
- const keypressHandler = keypressCall?.[1];
798
- if (keypressHandler) {
799
- // Simulate Ctrl+C
800
- keypressHandler('\u0003', { ctrl: true, name: 'c' });
801
- }
802
- // The promise should reject with 'Aborted' because our mock stream throws it,
803
- // and nonInteractiveCli catches it and calls handleError, which doesn't necessarily throw.
804
- // Wait, if handleError is called, we should check that.
805
- // But here we want to check if Ctrl+C works.
806
- // In our current setup, Ctrl+C aborts the signal. The stream throws 'Aborted'.
807
- // nonInteractiveCli catches 'Aborted' and calls handleError.
808
- // If we want to test that handleCancellationError is called, we need the loop to detect abortion.
809
- // But our stream throws before the loop can detect it.
810
- // Let's just check that the promise rejects with 'Aborted' for now,
811
- // which proves the abortion signal reached the stream.
812
- await expect(runPromise).rejects.toThrow('Aborted');
813
- expect(processStderrSpy.mock.calls.some((call) => typeof call[0] === 'string' && call[0].includes('Cancelling'))).toBe(true);
814
- handleCancellationErrorSpy.mockRestore();
815
- // Restore original values
816
- Object.defineProperty(process.stdin, 'isTTY', {
817
- value: originalIsTTY,
818
- configurable: true,
819
- });
820
- if (originalSetRawMode) {
821
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
822
- process.stdin.setRawMode = originalSetRawMode;
823
- }
824
- else {
825
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
826
- delete process.stdin.setRawMode;
827
- }
828
- // Spies are automatically restored by vi.restoreAllMocks() in afterEach,
829
- // but we can also do it manually if needed.
830
- });
831
- it('should throw FatalInputError if a command requires confirmation', async () => {
832
- const mockCommand = {
833
- name: 'confirm',
834
- description: 'a command that needs confirmation',
835
- action: vi.fn().mockResolvedValue({
836
- type: 'confirm_shell_commands',
837
- commands: ['rm -rf /'],
838
- }),
839
- };
840
- mockGetCommands.mockReturnValue([mockCommand]);
841
- await expect(runNonInteractive({
842
- config: mockConfig,
843
- settings: mockSettings,
844
- input: '/confirm',
845
- prompt_id: 'prompt-id-confirm',
846
- })).rejects.toThrow('Exiting due to a confirmation prompt requested by the command.');
847
- });
848
- it('should treat an unknown slash command as a regular prompt', async () => {
849
- // No commands are mocked, so any slash command is "unknown"
850
- mockGetCommands.mockReturnValue([]);
851
- const events = [
852
- { type: LlmEventType.TextDelta, text: 'Response to unknown' },
853
- {
854
- type: LlmEventType.Finished,
855
- finishReason: undefined,
856
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 5 },
857
- },
858
- ];
859
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
860
- await runNonInteractive({
861
- config: mockConfig,
862
- settings: mockSettings,
863
- input: '/unknowncommand',
864
- prompt_id: 'prompt-id-unknown',
865
- });
866
- // Ensure the raw input is sent to the model
867
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledWith([{ text: '/unknowncommand' }], expect.any(AbortSignal), 'prompt-id-unknown');
868
- expect(getWrittenOutput()).toBe('Response to unknown\n');
869
- });
870
- it('should throw for unhandled command result types', async () => {
871
- const mockCommand = {
872
- name: 'noaction',
873
- description: 'unhandled type',
874
- action: vi.fn().mockResolvedValue({
875
- type: 'unhandled',
876
- }),
877
- };
878
- mockGetCommands.mockReturnValue([mockCommand]);
879
- await expect(runNonInteractive({
880
- config: mockConfig,
881
- settings: mockSettings,
882
- input: '/noaction',
883
- prompt_id: 'prompt-id-unhandled',
884
- })).rejects.toThrow('Exiting due to command result that is not supported in non-interactive mode.');
885
- });
886
- it('should pass arguments to the slash command action', async () => {
887
- const mockAction = vi.fn().mockResolvedValue({
888
- type: 'submit_prompt',
889
- content: [{ text: 'Prompt from command' }],
890
- });
891
- const mockCommand = {
892
- name: 'testargs',
893
- description: 'a test command',
894
- action: mockAction,
895
- };
896
- mockGetCommands.mockReturnValue([mockCommand]);
897
- const events = [
898
- { type: LlmEventType.TextDelta, text: 'Acknowledged' },
899
- {
900
- type: LlmEventType.Finished,
901
- finishReason: undefined,
902
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 1 },
903
- },
904
- ];
905
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
906
- await runNonInteractive({
907
- config: mockConfig,
908
- settings: mockSettings,
909
- input: '/testargs arg1 arg2',
910
- prompt_id: 'prompt-id-args',
911
- });
912
- expect(mockAction).toHaveBeenCalledWith(expect.any(Object), 'arg1 arg2');
913
- expect(getWrittenOutput()).toBe('Acknowledged\n');
914
- });
915
- it('should instantiate CommandService with correct loaders for slash commands', async () => {
916
- // This test indirectly checks that handleSlashCommand is using the right loaders.
917
- const { FileCommandLoader } = await import('./services/FileCommandLoader.js');
918
- const { McpPromptLoader } = await import('./services/McpPromptLoader.js');
919
- const { BuiltinCommandLoader } = await import('./services/BuiltinCommandLoader.js');
920
- mockGetCommands.mockReturnValue([]); // No commands found, so it will fall through
921
- const events = [
922
- { type: LlmEventType.TextDelta, text: 'Acknowledged' },
923
- {
924
- type: LlmEventType.Finished,
925
- finishReason: undefined,
926
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 1 },
927
- },
928
- ];
929
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
930
- await runNonInteractive({
931
- config: mockConfig,
932
- settings: mockSettings,
933
- input: '/mycommand',
934
- prompt_id: 'prompt-id-loaders',
935
- });
936
- // Check that loaders were instantiated with the config
937
- expect(FileCommandLoader).toHaveBeenCalledTimes(1);
938
- expect(FileCommandLoader).toHaveBeenCalledWith(mockConfig);
939
- expect(McpPromptLoader).toHaveBeenCalledTimes(1);
940
- expect(McpPromptLoader).toHaveBeenCalledWith(mockConfig);
941
- expect(BuiltinCommandLoader).toHaveBeenCalledWith(mockConfig);
942
- // Check that instances were passed to CommandService.create
943
- expect(mockCommandServiceCreate).toHaveBeenCalledTimes(1);
944
- const loadersArg = mockCommandServiceCreate.mock.calls[0][0];
945
- expect(loadersArg).toHaveLength(3);
946
- expect(loadersArg[0]).toBe(vi.mocked(BuiltinCommandLoader).mock.instances[0]);
947
- expect(loadersArg[1]).toBe(vi.mocked(McpPromptLoader).mock.instances[0]);
948
- expect(loadersArg[2]).toBe(vi.mocked(FileCommandLoader).mock.instances[0]);
949
- });
950
- it('should allow a normally-excluded tool when --allowed-tools is set', async () => {
951
- // By default, ShellTool is excluded in non-interactive mode.
952
- // This test ensures that --allowed-tools overrides this exclusion.
953
- vi.mocked(mockConfig.getToolRegistry).mockReturnValue({
954
- getTool: vi.fn().mockReturnValue({
955
- name: 'ShellTool',
956
- description: 'A shell tool',
957
- run: vi.fn(),
958
- }),
959
- getFunctionDeclarations: vi.fn().mockReturnValue([{ name: 'ShellTool' }]),
960
- });
961
- const toolCallEvent = {
962
- type: LlmEventType.ToolCallRequest,
963
- callId: 'tool-shell-1',
964
- name: 'ShellTool',
965
- args: { command: 'ls' },
966
- isClientInitiated: false,
967
- promptId: 'prompt-id-allowed',
968
- };
969
- const toolResponse = [{ text: 'file.txt' }];
970
- mockSchedulerSchedule.mockResolvedValue([
971
- {
972
- status: 'success',
973
- request: {
974
- callId: 'tool-shell-1',
975
- name: 'ShellTool',
976
- args: { command: 'ls' },
977
- isClientInitiated: false,
978
- prompt_id: 'prompt-id-allowed',
979
- },
980
- tool: {},
981
- invocation: {},
982
- response: {
983
- responseParts: toolResponse,
984
- callId: 'tool-shell-1',
985
- error: undefined,
986
- errorType: undefined,
987
- contentLength: undefined,
988
- },
989
- },
990
- ]);
991
- const firstCallEvents = [toolCallEvent];
992
- const secondCallEvents = [
993
- { type: LlmEventType.TextDelta, text: 'file.txt' },
994
- {
995
- type: LlmEventType.Finished,
996
- finishReason: undefined,
997
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
998
- },
999
- ];
1000
- mockGeminiClient.sendMessageStream
1001
- .mockReturnValueOnce(createStreamFromEvents(firstCallEvents))
1002
- .mockReturnValueOnce(createStreamFromEvents(secondCallEvents));
1003
- await runNonInteractive({
1004
- config: mockConfig,
1005
- settings: mockSettings,
1006
- input: 'List the files',
1007
- prompt_id: 'prompt-id-allowed',
1008
- });
1009
- expect(mockSchedulerSchedule).toHaveBeenCalledWith([expect.objectContaining({ name: 'ShellTool' })], expect.any(AbortSignal));
1010
- expect(getWrittenOutput()).toBe('file.txt\n');
1011
- });
1012
- describe('CoreEvents Integration', () => {
1013
- it('subscribes to UserFeedback and drains backlog on start', async () => {
1014
- const events = [
1015
- {
1016
- type: LlmEventType.Finished,
1017
- finishReason: undefined,
1018
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
1019
- },
1020
- ];
1021
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1022
- await runNonInteractive({
1023
- config: mockConfig,
1024
- settings: mockSettings,
1025
- input: 'test',
1026
- prompt_id: 'prompt-id-events',
1027
- });
1028
- expect(mockCoreEvents.on).toHaveBeenCalledWith(CoreEvent.UserFeedback, expect.any(Function));
1029
- expect(mockCoreEvents.drainBacklogs).toHaveBeenCalledTimes(1);
1030
- });
1031
- it('unsubscribes from UserFeedback on finish', async () => {
1032
- const events = [
1033
- {
1034
- type: LlmEventType.Finished,
1035
- finishReason: undefined,
1036
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
1037
- },
1038
- ];
1039
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1040
- await runNonInteractive({
1041
- config: mockConfig,
1042
- settings: mockSettings,
1043
- input: 'test',
1044
- prompt_id: 'prompt-id-events',
1045
- });
1046
- expect(mockCoreEvents.off).toHaveBeenCalledWith(CoreEvent.UserFeedback, expect.any(Function));
1047
- });
1048
- it('logs to process.stderr when UserFeedback event is received', async () => {
1049
- const events = [
1050
- {
1051
- type: LlmEventType.Finished,
1052
- finishReason: undefined,
1053
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
1054
- },
1055
- ];
1056
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1057
- await runNonInteractive({
1058
- config: mockConfig,
1059
- settings: mockSettings,
1060
- input: 'test',
1061
- prompt_id: 'prompt-id-events',
1062
- });
1063
- // Get the registered handler
1064
- const handler = mockCoreEvents.on.mock.calls.find((call) => call[0] === CoreEvent.UserFeedback)?.[1];
1065
- expect(handler).toBeDefined();
1066
- // Simulate an event
1067
- const payload = {
1068
- severity: 'error',
1069
- message: 'Test error message',
1070
- };
1071
- handler(payload);
1072
- expect(processStderrSpy).toHaveBeenCalledWith('[ERROR] Test error message\n');
1073
- });
1074
- it('logs optional error object to process.stderr in debug mode', async () => {
1075
- vi.mocked(mockConfig.getDebugMode).mockReturnValue(true);
1076
- const events = [
1077
- {
1078
- type: LlmEventType.Finished,
1079
- finishReason: undefined,
1080
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
1081
- },
1082
- ];
1083
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1084
- await runNonInteractive({
1085
- config: mockConfig,
1086
- settings: mockSettings,
1087
- input: 'test',
1088
- prompt_id: 'prompt-id-events',
1089
- });
1090
- // Get the registered handler
1091
- const handler = mockCoreEvents.on.mock.calls.find((call) => call[0] === CoreEvent.UserFeedback)?.[1];
1092
- expect(handler).toBeDefined();
1093
- // Simulate an event with error object
1094
- const errorObj = new Error('Original error');
1095
- // Mock stack for deterministic testing
1096
- errorObj.stack = 'Error: Original error\n at test';
1097
- const payload = {
1098
- severity: 'warning',
1099
- message: 'Test warning message',
1100
- error: errorObj,
1101
- };
1102
- handler(payload);
1103
- expect(processStderrSpy).toHaveBeenCalledWith('[WARNING] Test warning message\n');
1104
- expect(processStderrSpy).toHaveBeenCalledWith('Error: Original error\n at test\n');
1105
- });
1106
- });
1107
- it('should emit appropriate events for streaming JSON output', async () => {
1108
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.STREAM_JSON);
1109
- vi.mocked(uiTelemetryService.getMetrics).mockReturnValue(MOCK_SESSION_METRICS);
1110
- const toolCallEvent = {
1111
- type: LlmEventType.ToolCallRequest,
1112
- callId: 'tool-1',
1113
- name: 'testTool',
1114
- args: { arg1: 'value1' },
1115
- isClientInitiated: false,
1116
- promptId: 'prompt-id-stream',
1117
- };
1118
- mockSchedulerSchedule.mockResolvedValue([
1119
- {
1120
- status: 'success',
1121
- request: {
1122
- callId: 'tool-1',
1123
- name: 'testTool',
1124
- args: { arg1: 'value1' },
1125
- isClientInitiated: false,
1126
- prompt_id: 'prompt-id-stream',
1127
- },
1128
- tool: {},
1129
- invocation: {},
1130
- response: {
1131
- responseParts: [{ text: 'Tool response' }],
1132
- callId: 'tool-1',
1133
- error: undefined,
1134
- errorType: undefined,
1135
- contentLength: undefined,
1136
- resultDisplay: 'Tool executed successfully',
1137
- },
1138
- },
1139
- ]);
1140
- const firstCallEvents = [
1141
- { type: LlmEventType.TextDelta, text: 'Thinking...' },
1142
- toolCallEvent,
1143
- ];
1144
- const secondCallEvents = [
1145
- { type: LlmEventType.TextDelta, text: 'Final answer' },
1146
- {
1147
- type: LlmEventType.Finished,
1148
- finishReason: undefined,
1149
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
1150
- },
1151
- ];
1152
- mockGeminiClient.sendMessageStream
1153
- .mockReturnValueOnce(createStreamFromEvents(firstCallEvents))
1154
- .mockReturnValueOnce(createStreamFromEvents(secondCallEvents));
1155
- await runNonInteractive({
1156
- config: mockConfig,
1157
- settings: mockSettings,
1158
- input: 'Stream test',
1159
- prompt_id: 'prompt-id-stream',
1160
- });
1161
- const output = getWrittenOutput();
1162
- const sanitizedOutput = output
1163
- .replace(/"timestamp":"[^"]+"/g, '"timestamp":"<TIMESTAMP>"')
1164
- .replace(/"duration_ms":\d+/g, '"duration_ms":<DURATION>');
1165
- expect(sanitizedOutput).toMatchSnapshot();
1166
- });
1167
- it('should handle EPIPE error gracefully', async () => {
1168
- const events = [
1169
- { type: LlmEventType.TextDelta, text: 'Hello' },
1170
- { type: LlmEventType.TextDelta, text: ' World' },
1171
- ];
1172
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1173
- // Mock process.exit to track calls without throwing
1174
- vi.spyOn(process, 'exit').mockImplementation((_code) => undefined);
1175
- // Simulate EPIPE error on stdout
1176
- const stdoutErrorCallback = process.stdout.on.mock.calls.find((call) => call[0] === 'error')?.[1];
1177
- if (stdoutErrorCallback) {
1178
- stdoutErrorCallback({ code: 'EPIPE' });
1179
- }
1180
- await runNonInteractive({
1181
- config: mockConfig,
1182
- settings: mockSettings,
1183
- input: 'EPIPE test',
1184
- prompt_id: 'prompt-id-epipe',
1185
- });
1186
- // Since EPIPE is simulated, it might exit early or continue depending on timing,
1187
- // but our main goal is to verify the handler is registered and handles EPIPE.
1188
- expect(process.stdout.on).toHaveBeenCalledWith('error', expect.any(Function));
1189
- });
1190
- it('should resume chat when resumedSessionData is provided', async () => {
1191
- const events = [
1192
- { type: LlmEventType.TextDelta, text: 'Resumed' },
1193
- {
1194
- type: LlmEventType.Finished,
1195
- finishReason: undefined,
1196
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 5 },
1197
- },
1198
- ];
1199
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1200
- const resumedSessionData = {
1201
- conversation: {
1202
- sessionId: 'resumed-session-id',
1203
- messages: [
1204
- { role: 'user', parts: [{ text: 'Previous message' }] },
1205
- ], // eslint-disable-line @typescript-eslint/no-explicit-any
1206
- startTime: new Date().toISOString(),
1207
- lastUpdated: new Date().toISOString(),
1208
- firstUserMessage: 'Previous message',
1209
- projectHash: 'test-hash',
1210
- },
1211
- filePath: '/path/to/session.json',
1212
- };
1213
- await runNonInteractive({
1214
- config: mockConfig,
1215
- settings: mockSettings,
1216
- input: 'Continue',
1217
- prompt_id: 'prompt-id-resume',
1218
- resumedSessionData,
1219
- });
1220
- expect(mockGeminiClient.resumeChat).toHaveBeenCalledWith(expect.any(Array), resumedSessionData);
1221
- expect(getWrittenOutput()).toBe('Resumed\n');
1222
- });
1223
- it.each([
1224
- {
1225
- name: 'loop detected',
1226
- events: [{ type: LlmEventType.LoopDetected }],
1227
- input: 'Loop test',
1228
- promptId: 'prompt-id-loop',
1229
- },
1230
- {
1231
- name: 'max session turns',
1232
- events: [{ type: LlmEventType.MaxSessionTurns }],
1233
- input: 'Max turns test',
1234
- promptId: 'prompt-id-max-turns',
1235
- },
1236
- ])('should emit appropriate error event in streaming JSON mode: $name', async ({ events, input, promptId }) => {
1237
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.STREAM_JSON);
1238
- vi.mocked(uiTelemetryService.getMetrics).mockReturnValue(MOCK_SESSION_METRICS);
1239
- const streamEvents = [
1240
- ...events,
1241
- {
1242
- type: LlmEventType.Finished,
1243
- finishReason: undefined,
1244
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
1245
- },
1246
- ];
1247
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(streamEvents));
1248
- try {
1249
- await runNonInteractive({
1250
- config: mockConfig,
1251
- settings: mockSettings,
1252
- input,
1253
- prompt_id: promptId,
1254
- });
1255
- }
1256
- catch (_error) {
1257
- // Expected exit
1258
- }
1259
- const output = getWrittenOutput();
1260
- const sanitizedOutput = output
1261
- .replace(/"timestamp":"[^"]+"/g, '"timestamp":"<TIMESTAMP>"')
1262
- .replace(/"duration_ms":\d+/g, '"duration_ms":<DURATION>');
1263
- expect(sanitizedOutput).toMatchSnapshot();
1264
- });
1265
- it('should log error when tool recording fails', async () => {
1266
- const toolCallEvent = {
1267
- type: LlmEventType.ToolCallRequest,
1268
- callId: 'tool-1',
1269
- name: 'testTool',
1270
- args: {},
1271
- isClientInitiated: false,
1272
- promptId: 'prompt-id-tool-error',
1273
- };
1274
- mockSchedulerSchedule.mockResolvedValue([
1275
- {
1276
- status: 'success',
1277
- request: {
1278
- callId: 'tool-1',
1279
- name: 'testTool',
1280
- args: {},
1281
- isClientInitiated: false,
1282
- prompt_id: 'prompt-id-tool-error',
1283
- },
1284
- tool: {},
1285
- invocation: {},
1286
- response: {
1287
- responseParts: [],
1288
- callId: 'tool-1',
1289
- error: undefined,
1290
- errorType: undefined,
1291
- contentLength: undefined,
1292
- },
1293
- },
1294
- ]);
1295
- const events = [
1296
- toolCallEvent,
1297
- { type: LlmEventType.TextDelta, text: 'Done' },
1298
- {
1299
- type: LlmEventType.Finished,
1300
- finishReason: undefined,
1301
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 5 },
1302
- },
1303
- ];
1304
- mockGeminiClient.sendMessageStream
1305
- .mockReturnValueOnce(createStreamFromEvents(events))
1306
- .mockReturnValueOnce(createStreamFromEvents([
1307
- { type: LlmEventType.TextDelta, text: 'Done' },
1308
- {
1309
- type: LlmEventType.Finished,
1310
- finishReason: undefined,
1311
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 5 },
1312
- },
1313
- ]));
1314
- // Mock getChat to throw when recording tool calls
1315
- const mockChat = {
1316
- recordCompletedToolCalls: vi.fn().mockImplementation(() => {
1317
- throw new Error('Recording failed');
1318
- }),
1319
- };
1320
- // @ts-expect-error - Mocking internal structure
1321
- mockGeminiClient.getChat = vi.fn().mockReturnValue(mockChat);
1322
- // @ts-expect-error - Mocking internal structure
1323
- mockGeminiClient.getCurrentSequenceModel = vi
1324
- .fn()
1325
- .mockReturnValue('model-1');
1326
- // Mock debugLogger.error
1327
- const { debugLogger } = await import('@didim365/agent-cli-core');
1328
- const debugLoggerErrorSpy = vi
1329
- .spyOn(debugLogger, 'error')
1330
- .mockImplementation(() => { });
1331
- await runNonInteractive({
1332
- config: mockConfig,
1333
- settings: mockSettings,
1334
- input: 'Tool recording error test',
1335
- prompt_id: 'prompt-id-tool-error',
1336
- });
1337
- expect(debugLoggerErrorSpy).toHaveBeenCalledWith(expect.stringContaining('Error recording completed tool call information: Error: Recording failed'));
1338
- expect(getWrittenOutput()).toContain('Done');
1339
- });
1340
- it('should stop agent execution immediately when a tool call returns STOP_EXECUTION error', async () => {
1341
- const toolCallEvent = {
1342
- type: LlmEventType.ToolCallRequest,
1343
- callId: 'stop-call',
1344
- name: 'stopTool',
1345
- args: {},
1346
- isClientInitiated: false,
1347
- promptId: 'prompt-id-stop',
1348
- };
1349
- // Mock tool execution returning STOP_EXECUTION
1350
- mockSchedulerSchedule.mockResolvedValue([
1351
- {
1352
- status: 'error',
1353
- request: {
1354
- callId: 'stop-call',
1355
- name: 'stopTool',
1356
- args: {},
1357
- isClientInitiated: false,
1358
- prompt_id: 'prompt-id-stop',
1359
- },
1360
- tool: {},
1361
- invocation: {},
1362
- response: {
1363
- callId: 'stop-call',
1364
- responseParts: [{ text: 'error occurred' }],
1365
- errorType: ToolErrorType.STOP_EXECUTION,
1366
- error: new Error('Stop reason from hook'),
1367
- resultDisplay: undefined,
1368
- },
1369
- },
1370
- ]);
1371
- const firstCallEvents = [
1372
- { type: LlmEventType.TextDelta, text: 'Executing tool...' },
1373
- toolCallEvent,
1374
- ];
1375
- // Setup the mock to return events for the first call.
1376
- // We expect the loop to terminate after the tool execution.
1377
- // If it doesn't, it might call sendMessageStream again, which we'll assert against.
1378
- mockGeminiClient.sendMessageStream
1379
- .mockReturnValueOnce(createStreamFromEvents(firstCallEvents))
1380
- .mockReturnValueOnce(createStreamFromEvents([]));
1381
- await runNonInteractive({
1382
- config: mockConfig,
1383
- settings: mockSettings,
1384
- input: 'Run stop tool',
1385
- prompt_id: 'prompt-id-stop',
1386
- });
1387
- expect(mockSchedulerSchedule).toHaveBeenCalled();
1388
- // The key assertion: sendMessageStream should have been called ONLY ONCE (initial user input).
1389
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledTimes(1);
1390
- expect(processStderrSpy).toHaveBeenCalledWith('Agent execution stopped: Stop reason from hook\n');
1391
- });
1392
- it('should write JSON output when a tool call returns STOP_EXECUTION error', async () => {
1393
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.JSON);
1394
- vi.mocked(uiTelemetryService.getMetrics).mockReturnValue(MOCK_SESSION_METRICS);
1395
- const toolCallEvent = {
1396
- type: LlmEventType.ToolCallRequest,
1397
- callId: 'stop-call',
1398
- name: 'stopTool',
1399
- args: {},
1400
- isClientInitiated: false,
1401
- promptId: 'prompt-id-stop-json',
1402
- };
1403
- mockSchedulerSchedule.mockResolvedValue([
1404
- {
1405
- status: 'error',
1406
- request: {
1407
- callId: 'stop-call',
1408
- name: 'stopTool',
1409
- args: {},
1410
- isClientInitiated: false,
1411
- prompt_id: 'prompt-id-stop-json',
1412
- },
1413
- tool: {},
1414
- invocation: {},
1415
- response: {
1416
- callId: 'stop-call',
1417
- responseParts: [{ text: 'error occurred' }],
1418
- errorType: ToolErrorType.STOP_EXECUTION,
1419
- error: new Error('Stop reason'),
1420
- resultDisplay: undefined,
1421
- },
1422
- },
1423
- ]);
1424
- const firstCallEvents = [
1425
- { type: LlmEventType.TextDelta, text: 'Partial content' },
1426
- toolCallEvent,
1427
- ];
1428
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(firstCallEvents));
1429
- await runNonInteractive({
1430
- config: mockConfig,
1431
- settings: mockSettings,
1432
- input: 'Run stop tool',
1433
- prompt_id: 'prompt-id-stop-json',
1434
- });
1435
- expect(processStdoutSpy).toHaveBeenCalledWith(JSON.stringify({
1436
- session_id: 'test-session-id',
1437
- response: 'Partial content',
1438
- stats: MOCK_SESSION_METRICS,
1439
- }, null, 2));
1440
- });
1441
- it('should emit result event when a tool call returns STOP_EXECUTION error in streaming JSON mode', async () => {
1442
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.STREAM_JSON);
1443
- vi.mocked(uiTelemetryService.getMetrics).mockReturnValue(MOCK_SESSION_METRICS);
1444
- const toolCallEvent = {
1445
- type: LlmEventType.ToolCallRequest,
1446
- callId: 'stop-call',
1447
- name: 'stopTool',
1448
- args: {},
1449
- isClientInitiated: false,
1450
- promptId: 'prompt-id-stop-stream',
1451
- };
1452
- mockSchedulerSchedule.mockResolvedValue([
1453
- {
1454
- status: 'error',
1455
- request: {
1456
- callId: 'stop-call',
1457
- name: 'stopTool',
1458
- args: {},
1459
- isClientInitiated: false,
1460
- prompt_id: 'prompt-id-stop-stream',
1461
- },
1462
- tool: {},
1463
- invocation: {},
1464
- response: {
1465
- callId: 'stop-call',
1466
- responseParts: [{ text: 'error occurred' }],
1467
- errorType: ToolErrorType.STOP_EXECUTION,
1468
- error: new Error('Stop reason'),
1469
- resultDisplay: undefined,
1470
- },
1471
- },
1472
- ]);
1473
- const firstCallEvents = [toolCallEvent];
1474
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(firstCallEvents));
1475
- await runNonInteractive({
1476
- config: mockConfig,
1477
- settings: mockSettings,
1478
- input: 'Run stop tool',
1479
- prompt_id: 'prompt-id-stop-stream',
1480
- });
1481
- const output = getWrittenOutput();
1482
- expect(output).toContain('"type":"result"');
1483
- expect(output).toContain('"status":"success"');
1484
- });
1485
- describe('Agent Execution Events', () => {
1486
- it('should handle AgentExecutionStopped event', async () => {
1487
- const events = [
1488
- {
1489
- type: LlmEventType.AgentStopped,
1490
- reason: 'Stopped by hook',
1491
- },
1492
- ];
1493
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1494
- await runNonInteractive({
1495
- config: mockConfig,
1496
- settings: mockSettings,
1497
- input: 'test stop',
1498
- prompt_id: 'prompt-id-stop',
1499
- });
1500
- expect(processStderrSpy).toHaveBeenCalledWith('Agent execution stopped: Stopped by hook\n');
1501
- // Should exit without calling sendMessageStream again
1502
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledTimes(1);
1503
- });
1504
- it('should handle AgentExecutionBlocked event', async () => {
1505
- const allEvents = [
1506
- {
1507
- type: LlmEventType.AgentBlocked,
1508
- reason: 'Blocked by hook',
1509
- },
1510
- { type: LlmEventType.TextDelta, text: 'Final answer' },
1511
- {
1512
- type: LlmEventType.Finished,
1513
- finishReason: undefined,
1514
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
1515
- },
1516
- ];
1517
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(allEvents));
1518
- await runNonInteractive({
1519
- config: mockConfig,
1520
- settings: mockSettings,
1521
- input: 'test block',
1522
- prompt_id: 'prompt-id-block',
1523
- });
1524
- expect(processStderrSpy).toHaveBeenCalledWith('[WARNING] Agent execution blocked: Blocked by hook\n');
1525
- // sendMessageStream is called once, recursion is internal to it and transparent to the caller
1526
- expect(mockGeminiClient.sendMessageStream).toHaveBeenCalledTimes(1);
1527
- expect(getWrittenOutput()).toBe('Final answer\n');
1528
- });
1529
- });
1530
- describe('Output Sanitization', () => {
1531
- const ANSI_SEQUENCE = '\u001B[31mRed Text\u001B[0m';
1532
- const OSC_HYPERLINK = '\u001B]8;;http://example.com\u001B\\Link\u001B]8;;\u001B\\';
1533
- const PLAIN_TEXT_RED = 'Red Text';
1534
- const PLAIN_TEXT_LINK = 'Link';
1535
- it('should sanitize ANSI output by default', async () => {
1536
- const events = [
1537
- { type: LlmEventType.TextDelta, text: ANSI_SEQUENCE },
1538
- { type: LlmEventType.TextDelta, text: ' ' },
1539
- { type: LlmEventType.TextDelta, text: OSC_HYPERLINK },
1540
- {
1541
- type: LlmEventType.Finished,
1542
- finishReason: undefined,
1543
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
1544
- },
1545
- ];
1546
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1547
- vi.mocked(mockConfig.getRawOutput).mockReturnValue(false);
1548
- await runNonInteractive({
1549
- config: mockConfig,
1550
- settings: mockSettings,
1551
- input: 'Test input',
1552
- prompt_id: 'prompt-id-sanitization',
1553
- });
1554
- expect(getWrittenOutput()).toBe(`${PLAIN_TEXT_RED} ${PLAIN_TEXT_LINK}\n`);
1555
- });
1556
- it('should allow ANSI output when rawOutput is true', async () => {
1557
- const events = [
1558
- { type: LlmEventType.TextDelta, text: ANSI_SEQUENCE },
1559
- { type: LlmEventType.TextDelta, text: ' ' },
1560
- { type: LlmEventType.TextDelta, text: OSC_HYPERLINK },
1561
- {
1562
- type: LlmEventType.Finished,
1563
- finishReason: undefined,
1564
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 10 },
1565
- },
1566
- ];
1567
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1568
- vi.mocked(mockConfig.getRawOutput).mockReturnValue(true);
1569
- vi.mocked(mockConfig.getAcceptRawOutputRisk).mockReturnValue(true);
1570
- await runNonInteractive({
1571
- config: mockConfig,
1572
- settings: mockSettings,
1573
- input: 'Test input',
1574
- prompt_id: 'prompt-id-raw',
1575
- });
1576
- expect(getWrittenOutput()).toBe(`${ANSI_SEQUENCE} ${OSC_HYPERLINK}\n`);
1577
- });
1578
- it('should allow ANSI output when only acceptRawOutputRisk is true', async () => {
1579
- const events = [
1580
- { type: LlmEventType.TextDelta, text: ANSI_SEQUENCE },
1581
- {
1582
- type: LlmEventType.Finished,
1583
- finishReason: undefined,
1584
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 5 },
1585
- },
1586
- ];
1587
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1588
- vi.mocked(mockConfig.getRawOutput).mockReturnValue(false);
1589
- vi.mocked(mockConfig.getAcceptRawOutputRisk).mockReturnValue(true);
1590
- await runNonInteractive({
1591
- config: mockConfig,
1592
- settings: mockSettings,
1593
- input: 'Test input',
1594
- prompt_id: 'prompt-id-accept-only',
1595
- });
1596
- expect(getWrittenOutput()).toBe(`${ANSI_SEQUENCE}\n`);
1597
- });
1598
- it('should warn when rawOutput is true and acceptRisk is false', async () => {
1599
- const events = [
1600
- {
1601
- type: LlmEventType.Finished,
1602
- finishReason: undefined,
1603
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
1604
- },
1605
- ];
1606
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1607
- vi.mocked(mockConfig.getRawOutput).mockReturnValue(true);
1608
- vi.mocked(mockConfig.getAcceptRawOutputRisk).mockReturnValue(false);
1609
- await runNonInteractive({
1610
- config: mockConfig,
1611
- settings: mockSettings,
1612
- input: 'Test input',
1613
- prompt_id: 'prompt-id-warn',
1614
- });
1615
- expect(processStderrSpy).toHaveBeenCalledWith(expect.stringContaining('[WARNING] --raw-output is enabled'));
1616
- });
1617
- it('should not warn when rawOutput is true and acceptRisk is true', async () => {
1618
- const events = [
1619
- {
1620
- type: LlmEventType.Finished,
1621
- finishReason: undefined,
1622
- usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 },
1623
- },
1624
- ];
1625
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1626
- vi.mocked(mockConfig.getRawOutput).mockReturnValue(true);
1627
- vi.mocked(mockConfig.getAcceptRawOutputRisk).mockReturnValue(true);
1628
- await runNonInteractive({
1629
- config: mockConfig,
1630
- settings: mockSettings,
1631
- input: 'Test input',
1632
- prompt_id: 'prompt-id-no-warn',
1633
- });
1634
- expect(processStderrSpy).not.toHaveBeenCalledWith(expect.stringContaining('[WARNING] --raw-output is enabled'));
1635
- });
1636
- it('should report cancelled tool calls as success in stream-json mode (legacy parity)', async () => {
1637
- const toolCallEvent = {
1638
- type: LlmEventType.ToolCallRequest,
1639
- callId: 'tool-1',
1640
- name: 'testTool',
1641
- args: { arg1: 'value1' },
1642
- isClientInitiated: false,
1643
- promptId: 'prompt-id-cancel',
1644
- };
1645
- // Mock the scheduler to return a cancelled status
1646
- mockSchedulerSchedule.mockResolvedValue([
1647
- {
1648
- status: 'cancelled',
1649
- request: {
1650
- callId: 'tool-1',
1651
- name: 'testTool',
1652
- args: { arg1: 'value1' },
1653
- isClientInitiated: false,
1654
- prompt_id: 'prompt-id-cancel',
1655
- },
1656
- tool: {},
1657
- invocation: {},
1658
- response: {
1659
- callId: 'tool-1',
1660
- responseParts: [{ text: 'Operation cancelled' }],
1661
- resultDisplay: 'Cancelled',
1662
- },
1663
- },
1664
- ]);
1665
- const events = [
1666
- toolCallEvent,
1667
- {
1668
- type: LlmEventType.TextDelta,
1669
- text: 'Model continues...',
1670
- },
1671
- ];
1672
- mockGeminiClient.sendMessageStream.mockReturnValue(createStreamFromEvents(events));
1673
- vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.STREAM_JSON);
1674
- vi.mocked(uiTelemetryService.getMetrics).mockReturnValue(MOCK_SESSION_METRICS);
1675
- await runNonInteractive({
1676
- config: mockConfig,
1677
- settings: mockSettings,
1678
- input: 'Test input',
1679
- prompt_id: 'prompt-id-cancel',
1680
- });
1681
- const output = getWrittenOutput();
1682
- expect(output).toContain('"type":"tool_result"');
1683
- expect(output).toContain('"status":"success"');
1684
- });
1685
- });
1686
- });
1687
- //# sourceMappingURL=nonInteractiveCli.test.js.map