@umsai/ums-code 0.1.4-v2 → 0.3.0-v1

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 (382) hide show
  1. package/dist/package.json +11 -3
  2. package/dist/src/config/config.d.ts +6 -0
  3. package/dist/src/config/config.js +102 -11
  4. package/dist/src/config/config.js.map +1 -1
  5. package/dist/src/config/settings.d.ts +5 -0
  6. package/dist/src/config/settings.js +15 -1
  7. package/dist/src/config/settings.js.map +1 -1
  8. package/dist/src/config/settingsSchema.d.ts +75 -17
  9. package/dist/src/config/settingsSchema.js +57 -17
  10. package/dist/src/config/settingsSchema.js.map +1 -1
  11. package/dist/src/config/webSearch.d.ts +35 -0
  12. package/dist/src/config/webSearch.js +87 -0
  13. package/dist/src/config/webSearch.js.map +1 -0
  14. package/dist/src/core/auth.d.ts +1 -1
  15. package/dist/src/core/auth.js +19 -3
  16. package/dist/src/core/auth.js.map +1 -1
  17. package/dist/src/core/initializer.js +13 -2
  18. package/dist/src/core/initializer.js.map +1 -1
  19. package/dist/src/core/theme.js +4 -1
  20. package/dist/src/core/theme.js.map +1 -1
  21. package/dist/src/gemini.d.ts +1 -1
  22. package/dist/src/gemini.js +53 -44
  23. package/dist/src/gemini.js.map +1 -1
  24. package/dist/src/gemini.test.js +117 -0
  25. package/dist/src/gemini.test.js.map +1 -1
  26. package/dist/src/generated/git-commit.d.ts +2 -2
  27. package/dist/src/generated/git-commit.js +2 -2
  28. package/dist/src/i18n/index.d.ts +18 -0
  29. package/dist/src/i18n/index.js +184 -0
  30. package/dist/src/i18n/index.js.map +1 -0
  31. package/dist/src/i18n/locales/en.js +1129 -0
  32. package/dist/src/i18n/locales/zh.js +1052 -0
  33. package/dist/src/nonInteractive/control/ControlContext.d.ts +63 -0
  34. package/dist/src/nonInteractive/control/ControlContext.js +31 -0
  35. package/dist/src/nonInteractive/control/ControlContext.js.map +1 -0
  36. package/dist/src/nonInteractive/control/ControlDispatcher.d.ts +86 -0
  37. package/dist/src/nonInteractive/control/ControlDispatcher.js +238 -0
  38. package/dist/src/nonInteractive/control/ControlDispatcher.js.map +1 -0
  39. package/dist/src/nonInteractive/control/ControlDispatcher.test.d.ts +6 -0
  40. package/dist/src/nonInteractive/control/ControlDispatcher.test.js +549 -0
  41. package/dist/src/nonInteractive/control/ControlDispatcher.test.js.map +1 -0
  42. package/dist/src/nonInteractive/control/ControlService.d.ts +78 -0
  43. package/dist/src/nonInteractive/control/ControlService.js +154 -0
  44. package/dist/src/nonInteractive/control/ControlService.js.map +1 -0
  45. package/dist/src/nonInteractive/control/controllers/baseController.d.ts +50 -0
  46. package/dist/src/nonInteractive/control/controllers/baseController.js +102 -0
  47. package/dist/src/nonInteractive/control/controllers/baseController.js.map +1 -0
  48. package/dist/src/nonInteractive/control/controllers/hookController.d.ts +25 -0
  49. package/dist/src/nonInteractive/control/controllers/hookController.js +42 -0
  50. package/dist/src/nonInteractive/control/controllers/hookController.js.map +1 -0
  51. package/dist/src/nonInteractive/control/controllers/mcpController.d.ts +42 -0
  52. package/dist/src/nonInteractive/control/controllers/mcpController.js +205 -0
  53. package/dist/src/nonInteractive/control/controllers/mcpController.js.map +1 -0
  54. package/dist/src/nonInteractive/control/controllers/permissionController.d.ts +78 -0
  55. package/dist/src/nonInteractive/control/controllers/permissionController.js +358 -0
  56. package/dist/src/nonInteractive/control/controllers/permissionController.js.map +1 -0
  57. package/dist/src/nonInteractive/control/controllers/systemController.d.ts +56 -0
  58. package/dist/src/nonInteractive/control/controllers/systemController.js +166 -0
  59. package/dist/src/nonInteractive/control/controllers/systemController.js.map +1 -0
  60. package/dist/src/nonInteractive/control/types/serviceAPIs.d.ts +120 -0
  61. package/dist/src/nonInteractive/control/types/serviceAPIs.js +7 -0
  62. package/dist/src/nonInteractive/control/types/serviceAPIs.js.map +1 -0
  63. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.d.ts +446 -0
  64. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.js +891 -0
  65. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.js.map +1 -0
  66. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.d.ts +6 -0
  67. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.js +1197 -0
  68. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.js.map +1 -0
  69. package/dist/src/nonInteractive/io/JsonOutputAdapter.d.ts +29 -0
  70. package/dist/src/nonInteractive/io/JsonOutputAdapter.js +56 -0
  71. package/dist/src/nonInteractive/io/JsonOutputAdapter.js.map +1 -0
  72. package/dist/src/nonInteractive/io/JsonOutputAdapter.test.d.ts +6 -0
  73. package/dist/src/nonInteractive/io/JsonOutputAdapter.test.js +624 -0
  74. package/dist/src/nonInteractive/io/JsonOutputAdapter.test.js.map +1 -0
  75. package/dist/src/nonInteractive/io/StreamJsonInputReader.d.ts +16 -0
  76. package/dist/src/nonInteractive/io/StreamJsonInputReader.js +54 -0
  77. package/dist/src/nonInteractive/io/StreamJsonInputReader.js.map +1 -0
  78. package/dist/src/nonInteractive/io/StreamJsonInputReader.test.d.ts +6 -0
  79. package/dist/src/nonInteractive/io/StreamJsonInputReader.test.js +178 -0
  80. package/dist/src/nonInteractive/io/StreamJsonInputReader.test.js.map +1 -0
  81. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.d.ts +69 -0
  82. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.js +185 -0
  83. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.js.map +1 -0
  84. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.d.ts +6 -0
  85. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.js +808 -0
  86. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.js.map +1 -0
  87. package/dist/src/nonInteractive/session.d.ts +23 -0
  88. package/dist/src/nonInteractive/session.js +549 -0
  89. package/dist/src/nonInteractive/session.js.map +1 -0
  90. package/dist/src/nonInteractive/session.test.d.ts +6 -0
  91. package/dist/src/nonInteractive/session.test.js +407 -0
  92. package/dist/src/nonInteractive/session.test.js.map +1 -0
  93. package/dist/src/nonInteractive/types.d.ts +344 -0
  94. package/dist/src/nonInteractive/types.js +78 -0
  95. package/dist/src/nonInteractive/types.js.map +1 -0
  96. package/dist/src/nonInteractiveCli.d.ts +21 -1
  97. package/dist/src/nonInteractiveCli.js +204 -57
  98. package/dist/src/nonInteractiveCli.js.map +1 -1
  99. package/dist/src/nonInteractiveCliCommands.d.ts +19 -1
  100. package/dist/src/nonInteractiveCliCommands.js +69 -4
  101. package/dist/src/nonInteractiveCliCommands.js.map +1 -1
  102. package/dist/src/services/BuiltinCommandLoader.js +2 -0
  103. package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
  104. package/dist/src/services/FileCommandLoader.js +4 -1
  105. package/dist/src/services/FileCommandLoader.js.map +1 -1
  106. package/dist/src/ui/AppContainer.js +41 -38
  107. package/dist/src/ui/AppContainer.js.map +1 -1
  108. package/dist/src/ui/auth/AuthDialog.d.ts +1 -13
  109. package/dist/src/ui/auth/AuthDialog.js +41 -111
  110. package/dist/src/ui/auth/AuthDialog.js.map +1 -1
  111. package/dist/src/ui/auth/AuthDialog.test.js +49 -19
  112. package/dist/src/ui/auth/AuthDialog.test.js.map +1 -1
  113. package/dist/src/ui/auth/AuthInProgress.js +2 -1
  114. package/dist/src/ui/auth/AuthInProgress.js.map +1 -1
  115. package/dist/src/ui/auth/useAuth.d.ts +9 -8
  116. package/dist/src/ui/auth/useAuth.js +135 -63
  117. package/dist/src/ui/auth/useAuth.js.map +1 -1
  118. package/dist/src/ui/commands/aboutCommand.js +7 -31
  119. package/dist/src/ui/commands/aboutCommand.js.map +1 -1
  120. package/dist/src/ui/commands/agentsCommand.js +10 -3
  121. package/dist/src/ui/commands/agentsCommand.js.map +1 -1
  122. package/dist/src/ui/commands/approvalModeCommand.js +8 -329
  123. package/dist/src/ui/commands/approvalModeCommand.js.map +1 -1
  124. package/dist/src/ui/commands/approvalModeCommand.test.js +19 -263
  125. package/dist/src/ui/commands/approvalModeCommand.test.js.map +1 -1
  126. package/dist/src/ui/commands/authCommand.js +4 -1
  127. package/dist/src/ui/commands/authCommand.js.map +1 -1
  128. package/dist/src/ui/commands/bugCommand.js +13 -47
  129. package/dist/src/ui/commands/bugCommand.js.map +1 -1
  130. package/dist/src/ui/commands/chatCommand.js +51 -25
  131. package/dist/src/ui/commands/chatCommand.js.map +1 -1
  132. package/dist/src/ui/commands/clearCommand.js +6 -3
  133. package/dist/src/ui/commands/clearCommand.js.map +1 -1
  134. package/dist/src/ui/commands/compressCommand.js +9 -4
  135. package/dist/src/ui/commands/compressCommand.js.map +1 -1
  136. package/dist/src/ui/commands/copyCommand.js +4 -1
  137. package/dist/src/ui/commands/copyCommand.js.map +1 -1
  138. package/dist/src/ui/commands/directoryCommand.js +30 -12
  139. package/dist/src/ui/commands/directoryCommand.js.map +1 -1
  140. package/dist/src/ui/commands/docsCommand.js +9 -3
  141. package/dist/src/ui/commands/docsCommand.js.map +1 -1
  142. package/dist/src/ui/commands/editorCommand.js +4 -1
  143. package/dist/src/ui/commands/editorCommand.js.map +1 -1
  144. package/dist/src/ui/commands/extensionsCommand.js +10 -3
  145. package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
  146. package/dist/src/ui/commands/helpCommand.js +4 -1
  147. package/dist/src/ui/commands/helpCommand.js.map +1 -1
  148. package/dist/src/ui/commands/ideCommand.js +23 -7
  149. package/dist/src/ui/commands/ideCommand.js.map +1 -1
  150. package/dist/src/ui/commands/initCommand.js +5 -3
  151. package/dist/src/ui/commands/initCommand.js.map +1 -1
  152. package/dist/src/ui/commands/languageCommand.d.ts +7 -0
  153. package/dist/src/ui/commands/languageCommand.js +386 -0
  154. package/dist/src/ui/commands/languageCommand.js.map +1 -0
  155. package/dist/src/ui/commands/mcpCommand.js +38 -18
  156. package/dist/src/ui/commands/mcpCommand.js.map +1 -1
  157. package/dist/src/ui/commands/memoryCommand.js +54 -25
  158. package/dist/src/ui/commands/memoryCommand.js.map +1 -1
  159. package/dist/src/ui/commands/modelCommand.js +9 -4
  160. package/dist/src/ui/commands/modelCommand.js.map +1 -1
  161. package/dist/src/ui/commands/permissionsCommand.js +4 -1
  162. package/dist/src/ui/commands/permissionsCommand.js.map +1 -1
  163. package/dist/src/ui/commands/quitCommand.js +7 -2
  164. package/dist/src/ui/commands/quitCommand.js.map +1 -1
  165. package/dist/src/ui/commands/settingsCommand.js +4 -1
  166. package/dist/src/ui/commands/settingsCommand.js.map +1 -1
  167. package/dist/src/ui/commands/setupGithubCommand.js +4 -1
  168. package/dist/src/ui/commands/setupGithubCommand.js.map +1 -1
  169. package/dist/src/ui/commands/statsCommand.js +11 -4
  170. package/dist/src/ui/commands/statsCommand.js.map +1 -1
  171. package/dist/src/ui/commands/summaryCommand.js +15 -8
  172. package/dist/src/ui/commands/summaryCommand.js.map +1 -1
  173. package/dist/src/ui/commands/terminalSetupCommand.js +9 -3
  174. package/dist/src/ui/commands/terminalSetupCommand.js.map +1 -1
  175. package/dist/src/ui/commands/themeCommand.js +4 -1
  176. package/dist/src/ui/commands/themeCommand.js.map +1 -1
  177. package/dist/src/ui/commands/toolsCommand.js +5 -2
  178. package/dist/src/ui/commands/toolsCommand.js.map +1 -1
  179. package/dist/src/ui/commands/types.d.ts +1 -1
  180. package/dist/src/ui/commands/types.js.map +1 -1
  181. package/dist/src/ui/commands/vimCommand.js +4 -1
  182. package/dist/src/ui/commands/vimCommand.js.map +1 -1
  183. package/dist/src/ui/components/AboutBox.d.ts +2 -9
  184. package/dist/src/ui/components/AboutBox.js +6 -2
  185. package/dist/src/ui/components/AboutBox.js.map +1 -1
  186. package/dist/src/ui/components/ApprovalModeDialog.d.ts +21 -0
  187. package/dist/src/ui/components/ApprovalModeDialog.js +68 -0
  188. package/dist/src/ui/components/ApprovalModeDialog.js.map +1 -0
  189. package/dist/src/ui/components/AutoAcceptIndicator.js +7 -6
  190. package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -1
  191. package/dist/src/ui/components/Composer.js +4 -3
  192. package/dist/src/ui/components/Composer.js.map +1 -1
  193. package/dist/src/ui/components/ConfigInitDisplay.js +7 -3
  194. package/dist/src/ui/components/ConfigInitDisplay.js.map +1 -1
  195. package/dist/src/ui/components/ContextSummaryDisplay.js +33 -9
  196. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
  197. package/dist/src/ui/components/DialogManager.js +60 -13
  198. package/dist/src/ui/components/DialogManager.js.map +1 -1
  199. package/dist/src/ui/components/EditorSettingsDialog.js +8 -3
  200. package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
  201. package/dist/src/ui/components/Help.js +14 -4
  202. package/dist/src/ui/components/Help.js.map +1 -1
  203. package/dist/src/ui/components/HistoryItemDisplay.js +1 -1
  204. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
  205. package/dist/src/ui/components/HistoryItemDisplay.test.js +17 -8
  206. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -1
  207. package/dist/src/ui/components/InputPrompt.js +10 -136
  208. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  209. package/dist/src/ui/components/LoadingIndicator.js +6 -1
  210. package/dist/src/ui/components/LoadingIndicator.js.map +1 -1
  211. package/dist/src/ui/components/ModelDialog.js +2 -1
  212. package/dist/src/ui/components/ModelDialog.js.map +1 -1
  213. package/dist/src/ui/components/ModelStatsDisplay.js +6 -5
  214. package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -1
  215. package/dist/src/ui/components/OpenAIKeyPrompt.d.ts +19 -1
  216. package/dist/src/ui/components/OpenAIKeyPrompt.js +38 -6
  217. package/dist/src/ui/components/OpenAIKeyPrompt.js.map +1 -1
  218. package/dist/src/ui/components/ProQuotaDialog.js +5 -4
  219. package/dist/src/ui/components/ProQuotaDialog.js.map +1 -1
  220. package/dist/src/ui/components/QuitConfirmationDialog.js +6 -5
  221. package/dist/src/ui/components/QuitConfirmationDialog.js.map +1 -1
  222. package/dist/src/ui/components/QwenOAuthProgress.d.ts +2 -2
  223. package/dist/src/ui/components/QwenOAuthProgress.js +14 -7
  224. package/dist/src/ui/components/QwenOAuthProgress.js.map +1 -1
  225. package/dist/src/ui/components/QwenOAuthProgress.test.js +1 -0
  226. package/dist/src/ui/components/QwenOAuthProgress.test.js.map +1 -1
  227. package/dist/src/ui/components/SessionSummaryDisplay.js +2 -1
  228. package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -1
  229. package/dist/src/ui/components/SettingsDialog.d.ts +3 -1
  230. package/dist/src/ui/components/SettingsDialog.js +35 -12
  231. package/dist/src/ui/components/SettingsDialog.js.map +1 -1
  232. package/dist/src/ui/components/SettingsDialog.test.js +5 -4
  233. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
  234. package/dist/src/ui/components/ShellConfirmationDialog.js +5 -4
  235. package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
  236. package/dist/src/ui/components/StatsDisplay.js +5 -4
  237. package/dist/src/ui/components/StatsDisplay.js.map +1 -1
  238. package/dist/src/ui/components/ThemeDialog.js +5 -2
  239. package/dist/src/ui/components/ThemeDialog.js.map +1 -1
  240. package/dist/src/ui/components/ToolStatsDisplay.js +3 -2
  241. package/dist/src/ui/components/ToolStatsDisplay.js.map +1 -1
  242. package/dist/src/ui/components/WelcomeBackDialog.js +13 -4
  243. package/dist/src/ui/components/WelcomeBackDialog.js.map +1 -1
  244. package/dist/src/ui/components/messages/CompressionMessage.js +10 -6
  245. package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -1
  246. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +40 -29
  247. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
  248. package/dist/src/ui/components/shared/BaseSelectionList.test.js +1 -1
  249. package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +1 -1
  250. package/dist/src/ui/components/shared/ScopeSelector.js +3 -1
  251. package/dist/src/ui/components/shared/ScopeSelector.js.map +1 -1
  252. package/dist/src/ui/components/subagents/create/AgentCreationWizard.js +39 -26
  253. package/dist/src/ui/components/subagents/create/AgentCreationWizard.js.map +1 -1
  254. package/dist/src/ui/components/subagents/create/CreationSummary.js +20 -10
  255. package/dist/src/ui/components/subagents/create/CreationSummary.js.map +1 -1
  256. package/dist/src/ui/components/subagents/create/DescriptionInput.js +6 -3
  257. package/dist/src/ui/components/subagents/create/DescriptionInput.js.map +1 -1
  258. package/dist/src/ui/components/subagents/create/GenerationMethodSelector.js +7 -2
  259. package/dist/src/ui/components/subagents/create/GenerationMethodSelector.js.map +1 -1
  260. package/dist/src/ui/components/subagents/create/LocationSelector.js +7 -2
  261. package/dist/src/ui/components/subagents/create/LocationSelector.js.map +1 -1
  262. package/dist/src/ui/components/subagents/create/ToolSelector.js +8 -7
  263. package/dist/src/ui/components/subagents/create/ToolSelector.js.map +1 -1
  264. package/dist/src/ui/components/subagents/manage/ActionSelectionStep.js +29 -4
  265. package/dist/src/ui/components/subagents/manage/ActionSelectionStep.js.map +1 -1
  266. package/dist/src/ui/components/subagents/manage/AgentDeleteStep.js +6 -3
  267. package/dist/src/ui/components/subagents/manage/AgentDeleteStep.js.map +1 -1
  268. package/dist/src/ui/components/subagents/manage/AgentEditStep.js +14 -5
  269. package/dist/src/ui/components/subagents/manage/AgentEditStep.js.map +1 -1
  270. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js +13 -6
  271. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js.map +1 -1
  272. package/dist/src/ui/components/subagents/manage/AgentViewerStep.js +3 -2
  273. package/dist/src/ui/components/subagents/manage/AgentViewerStep.js.map +1 -1
  274. package/dist/src/ui/components/subagents/manage/AgentsManagerDialog.js +14 -13
  275. package/dist/src/ui/components/subagents/manage/AgentsManagerDialog.js.map +1 -1
  276. package/dist/src/ui/components/subagents/runtime/AgentExecutionDisplay.js +8 -8
  277. package/dist/src/ui/components/views/McpStatus.js +28 -15
  278. package/dist/src/ui/components/views/McpStatus.js.map +1 -1
  279. package/dist/src/ui/components/views/ToolsList.js +2 -1
  280. package/dist/src/ui/components/views/ToolsList.js.map +1 -1
  281. package/dist/src/ui/contexts/UIActionsContext.d.ts +5 -4
  282. package/dist/src/ui/contexts/UIActionsContext.js +1 -0
  283. package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
  284. package/dist/src/ui/contexts/UIStateContext.d.ts +5 -7
  285. package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
  286. package/dist/src/ui/editors/editorSettingsManager.js +1 -0
  287. package/dist/src/ui/editors/editorSettingsManager.js.map +1 -1
  288. package/dist/src/ui/hooks/atCommandProcessor.test.js +2 -0
  289. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
  290. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +1 -0
  291. package/dist/src/ui/hooks/slashCommandProcessor.js +4 -7
  292. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  293. package/dist/src/ui/hooks/useApprovalModeCommand.d.ts +14 -0
  294. package/dist/src/ui/hooks/useApprovalModeCommand.js +33 -0
  295. package/dist/src/ui/hooks/useApprovalModeCommand.js.map +1 -0
  296. package/dist/src/ui/hooks/useAttentionNotifications.d.ts +14 -0
  297. package/dist/src/ui/hooks/useAttentionNotifications.js +41 -0
  298. package/dist/src/ui/hooks/useAttentionNotifications.js.map +1 -0
  299. package/dist/src/ui/hooks/useAttentionNotifications.test.d.ts +6 -0
  300. package/dist/src/ui/hooks/useAttentionNotifications.test.js +113 -0
  301. package/dist/src/ui/hooks/useAttentionNotifications.test.js.map +1 -0
  302. package/dist/src/ui/hooks/useCommandCompletion.d.ts +1 -4
  303. package/dist/src/ui/hooks/useCommandCompletion.js +1 -23
  304. package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -1
  305. package/dist/src/ui/hooks/useDialogClose.d.ts +6 -3
  306. package/dist/src/ui/hooks/useDialogClose.js +5 -0
  307. package/dist/src/ui/hooks/useDialogClose.js.map +1 -1
  308. package/dist/src/ui/hooks/useGitBranchName.js +6 -3
  309. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -1
  310. package/dist/src/ui/hooks/useGitBranchName.test.js +39 -21
  311. package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
  312. package/dist/src/ui/hooks/useInitializationAuthError.d.ts +22 -0
  313. package/dist/src/ui/hooks/useInitializationAuthError.js +40 -0
  314. package/dist/src/ui/hooks/useInitializationAuthError.js.map +1 -0
  315. package/dist/src/ui/hooks/usePhraseCycler.js +6 -4
  316. package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
  317. package/dist/src/ui/hooks/useQwenAuth.d.ts +7 -12
  318. package/dist/src/ui/hooks/useQwenAuth.js +4 -8
  319. package/dist/src/ui/hooks/useQwenAuth.js.map +1 -1
  320. package/dist/src/ui/hooks/useQwenAuth.test.js +72 -98
  321. package/dist/src/ui/hooks/useQwenAuth.test.js.map +1 -1
  322. package/dist/src/ui/hooks/useThemeCommand.js +8 -3
  323. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
  324. package/dist/src/ui/models/availableModels.js +7 -2
  325. package/dist/src/ui/models/availableModels.js.map +1 -1
  326. package/dist/src/ui/types.d.ts +32 -14
  327. package/dist/src/ui/types.js.map +1 -1
  328. package/dist/src/ui/utils/clipboardUtils.js +3 -3
  329. package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
  330. package/dist/src/ui/utils/commandUtils.d.ts +16 -0
  331. package/dist/src/ui/utils/commandUtils.js +16 -1
  332. package/dist/src/ui/utils/commandUtils.js.map +1 -1
  333. package/dist/src/ui/utils/commandUtils.test.js +5 -2
  334. package/dist/src/ui/utils/commandUtils.test.js.map +1 -1
  335. package/dist/src/ui/utils/terminalSetup.js +45 -18
  336. package/dist/src/ui/utils/terminalSetup.js.map +1 -1
  337. package/dist/src/utils/attentionNotification.d.ts +20 -0
  338. package/dist/src/utils/attentionNotification.js +34 -0
  339. package/dist/src/utils/attentionNotification.js.map +1 -0
  340. package/dist/src/utils/attentionNotification.test.d.ts +6 -0
  341. package/dist/src/utils/attentionNotification.test.js +46 -0
  342. package/dist/src/utils/attentionNotification.test.js.map +1 -0
  343. package/dist/src/utils/dialogScopeUtils.d.ts +0 -4
  344. package/dist/src/utils/dialogScopeUtils.js +5 -2
  345. package/dist/src/utils/dialogScopeUtils.js.map +1 -1
  346. package/dist/src/utils/errors.d.ts +10 -2
  347. package/dist/src/utils/errors.js +14 -13
  348. package/dist/src/utils/errors.js.map +1 -1
  349. package/dist/src/utils/errors.test.js +91 -54
  350. package/dist/src/utils/errors.test.js.map +1 -1
  351. package/dist/src/utils/nonInteractiveHelpers.d.ts +88 -0
  352. package/dist/src/utils/nonInteractiveHelpers.js +470 -0
  353. package/dist/src/utils/nonInteractiveHelpers.js.map +1 -0
  354. package/dist/src/utils/nonInteractiveHelpers.test.d.ts +6 -0
  355. package/dist/src/utils/nonInteractiveHelpers.test.js +945 -0
  356. package/dist/src/utils/nonInteractiveHelpers.test.js.map +1 -0
  357. package/dist/src/utils/sandbox.js +1 -1
  358. package/dist/src/utils/sandbox.js.map +1 -1
  359. package/dist/src/utils/settingsUtils.js +7 -1
  360. package/dist/src/utils/settingsUtils.js.map +1 -1
  361. package/dist/src/utils/systemInfo.d.ts +66 -0
  362. package/dist/src/utils/systemInfo.js +125 -0
  363. package/dist/src/utils/systemInfo.js.map +1 -0
  364. package/dist/src/utils/systemInfo.test.d.ts +6 -0
  365. package/dist/src/utils/systemInfo.test.js +259 -0
  366. package/dist/src/utils/systemInfo.test.js.map +1 -0
  367. package/dist/src/utils/systemInfoFields.d.ts +22 -0
  368. package/dist/src/utils/systemInfoFields.js +96 -0
  369. package/dist/src/utils/systemInfoFields.js.map +1 -0
  370. package/dist/src/utils/userStartupWarnings.js +9 -4
  371. package/dist/src/utils/userStartupWarnings.js.map +1 -1
  372. package/dist/src/validateNonInterActiveAuth.js +27 -6
  373. package/dist/src/validateNonInterActiveAuth.js.map +1 -1
  374. package/dist/src/zed-integration/acp.js +1 -2
  375. package/dist/src/zed-integration/acp.js.map +1 -1
  376. package/dist/src/zed-integration/schema.d.ts +506 -264
  377. package/dist/src/zed-integration/schema.js +13 -0
  378. package/dist/src/zed-integration/schema.js.map +1 -1
  379. package/dist/src/zed-integration/zedIntegration.js +376 -32
  380. package/dist/src/zed-integration/zedIntegration.js.map +1 -1
  381. package/dist/tsconfig.tsbuildinfo +1 -1
  382. package/package.json +12 -4
@@ -0,0 +1,549 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
7
+ import { ControlDispatcher } from './ControlDispatcher.js';
8
+ /**
9
+ * Creates a mock control context for testing
10
+ */
11
+ function createMockContext(debugMode = false) {
12
+ const abortController = new AbortController();
13
+ const mockStreamJson = {
14
+ send: vi.fn(),
15
+ };
16
+ const mockConfig = {
17
+ getDebugMode: vi.fn().mockReturnValue(debugMode),
18
+ };
19
+ return {
20
+ config: mockConfig,
21
+ streamJson: mockStreamJson,
22
+ sessionId: 'test-session-id',
23
+ abortSignal: abortController.signal,
24
+ debugMode,
25
+ permissionMode: 'default',
26
+ sdkMcpServers: new Set(),
27
+ mcpClients: new Map(),
28
+ };
29
+ }
30
+ /**
31
+ * Creates a mock system controller for testing
32
+ */
33
+ function createMockSystemController() {
34
+ return {
35
+ handleRequest: vi.fn(),
36
+ sendControlRequest: vi.fn(),
37
+ cleanup: vi.fn(),
38
+ };
39
+ }
40
+ describe('ControlDispatcher', () => {
41
+ let dispatcher;
42
+ let mockContext;
43
+ let mockSystemController;
44
+ beforeEach(() => {
45
+ mockContext = createMockContext();
46
+ mockSystemController = createMockSystemController();
47
+ // Mock SystemController constructor
48
+ vi.doMock('./controllers/systemController.js', () => ({
49
+ SystemController: vi.fn().mockImplementation(() => mockSystemController),
50
+ }));
51
+ dispatcher = new ControlDispatcher(mockContext);
52
+ // Replace with mock controller for easier testing
53
+ dispatcher.systemController = mockSystemController;
54
+ });
55
+ describe('constructor', () => {
56
+ it('should initialize with context and create controllers', () => {
57
+ expect(dispatcher).toBeDefined();
58
+ expect(dispatcher.systemController).toBeDefined();
59
+ });
60
+ it('should listen to abort signal and shutdown when aborted', () => {
61
+ const abortController = new AbortController();
62
+ const context = {
63
+ ...createMockContext(),
64
+ abortSignal: abortController.signal,
65
+ };
66
+ const newDispatcher = new ControlDispatcher(context);
67
+ vi.spyOn(newDispatcher, 'shutdown');
68
+ abortController.abort();
69
+ // Give event loop a chance to process
70
+ return new Promise((resolve) => {
71
+ setImmediate(() => {
72
+ expect(newDispatcher.shutdown).toHaveBeenCalled();
73
+ resolve();
74
+ });
75
+ });
76
+ });
77
+ });
78
+ describe('dispatch', () => {
79
+ it('should route initialize request to system controller', async () => {
80
+ const request = {
81
+ type: 'control_request',
82
+ request_id: 'req-1',
83
+ request: {
84
+ subtype: 'initialize',
85
+ },
86
+ };
87
+ const mockResponse = {
88
+ subtype: 'initialize',
89
+ capabilities: { test: true },
90
+ };
91
+ vi.mocked(mockSystemController.handleRequest).mockResolvedValue(mockResponse);
92
+ await dispatcher.dispatch(request);
93
+ expect(mockSystemController.handleRequest).toHaveBeenCalledWith(request.request, 'req-1');
94
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
95
+ type: 'control_response',
96
+ response: {
97
+ subtype: 'success',
98
+ request_id: 'req-1',
99
+ response: mockResponse,
100
+ },
101
+ });
102
+ });
103
+ it('should route interrupt request to system controller', async () => {
104
+ const request = {
105
+ type: 'control_request',
106
+ request_id: 'req-2',
107
+ request: {
108
+ subtype: 'interrupt',
109
+ },
110
+ };
111
+ const mockResponse = { subtype: 'interrupt' };
112
+ vi.mocked(mockSystemController.handleRequest).mockResolvedValue(mockResponse);
113
+ await dispatcher.dispatch(request);
114
+ expect(mockSystemController.handleRequest).toHaveBeenCalledWith(request.request, 'req-2');
115
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
116
+ type: 'control_response',
117
+ response: {
118
+ subtype: 'success',
119
+ request_id: 'req-2',
120
+ response: mockResponse,
121
+ },
122
+ });
123
+ });
124
+ it('should route set_model request to system controller', async () => {
125
+ const request = {
126
+ type: 'control_request',
127
+ request_id: 'req-3',
128
+ request: {
129
+ subtype: 'set_model',
130
+ model: 'test-model',
131
+ },
132
+ };
133
+ const mockResponse = {
134
+ subtype: 'set_model',
135
+ model: 'test-model',
136
+ };
137
+ vi.mocked(mockSystemController.handleRequest).mockResolvedValue(mockResponse);
138
+ await dispatcher.dispatch(request);
139
+ expect(mockSystemController.handleRequest).toHaveBeenCalledWith(request.request, 'req-3');
140
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
141
+ type: 'control_response',
142
+ response: {
143
+ subtype: 'success',
144
+ request_id: 'req-3',
145
+ response: mockResponse,
146
+ },
147
+ });
148
+ });
149
+ it('should route supported_commands request to system controller', async () => {
150
+ const request = {
151
+ type: 'control_request',
152
+ request_id: 'req-4',
153
+ request: {
154
+ subtype: 'supported_commands',
155
+ },
156
+ };
157
+ const mockResponse = {
158
+ subtype: 'supported_commands',
159
+ commands: ['initialize', 'interrupt'],
160
+ };
161
+ vi.mocked(mockSystemController.handleRequest).mockResolvedValue(mockResponse);
162
+ await dispatcher.dispatch(request);
163
+ expect(mockSystemController.handleRequest).toHaveBeenCalledWith(request.request, 'req-4');
164
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
165
+ type: 'control_response',
166
+ response: {
167
+ subtype: 'success',
168
+ request_id: 'req-4',
169
+ response: mockResponse,
170
+ },
171
+ });
172
+ });
173
+ it('should send error response when controller throws error', async () => {
174
+ const request = {
175
+ type: 'control_request',
176
+ request_id: 'req-5',
177
+ request: {
178
+ subtype: 'initialize',
179
+ },
180
+ };
181
+ const error = new Error('Test error');
182
+ vi.mocked(mockSystemController.handleRequest).mockRejectedValue(error);
183
+ await dispatcher.dispatch(request);
184
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
185
+ type: 'control_response',
186
+ response: {
187
+ subtype: 'error',
188
+ request_id: 'req-5',
189
+ error: 'Test error',
190
+ },
191
+ });
192
+ });
193
+ it('should handle non-Error thrown values', async () => {
194
+ const request = {
195
+ type: 'control_request',
196
+ request_id: 'req-6',
197
+ request: {
198
+ subtype: 'initialize',
199
+ },
200
+ };
201
+ vi.mocked(mockSystemController.handleRequest).mockRejectedValue('String error');
202
+ await dispatcher.dispatch(request);
203
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
204
+ type: 'control_response',
205
+ response: {
206
+ subtype: 'error',
207
+ request_id: 'req-6',
208
+ error: 'String error',
209
+ },
210
+ });
211
+ });
212
+ it('should send error response for unknown request subtype', async () => {
213
+ const request = {
214
+ type: 'control_request',
215
+ request_id: 'req-7',
216
+ request: {
217
+ subtype: 'unknown_subtype',
218
+ },
219
+ };
220
+ await dispatcher.dispatch(request);
221
+ // Dispatch catches errors and sends error response instead of throwing
222
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
223
+ type: 'control_response',
224
+ response: {
225
+ subtype: 'error',
226
+ request_id: 'req-7',
227
+ error: 'Unknown control request subtype: unknown_subtype',
228
+ },
229
+ });
230
+ });
231
+ });
232
+ describe('handleControlResponse', () => {
233
+ it('should resolve pending outgoing request on success response', () => {
234
+ const requestId = 'outgoing-req-1';
235
+ const response = {
236
+ type: 'control_response',
237
+ response: {
238
+ subtype: 'success',
239
+ request_id: requestId,
240
+ response: { result: 'success' },
241
+ },
242
+ };
243
+ // Register a pending outgoing request
244
+ const resolve = vi.fn();
245
+ const reject = vi.fn();
246
+ const timeoutId = setTimeout(() => { }, 1000);
247
+ // Access private method through type casting
248
+ dispatcher.registerOutgoingRequest(requestId, 'SystemController', resolve, reject, timeoutId);
249
+ dispatcher.handleControlResponse(response);
250
+ expect(resolve).toHaveBeenCalledWith(response.response);
251
+ expect(reject).not.toHaveBeenCalled();
252
+ });
253
+ it('should reject pending outgoing request on error response', () => {
254
+ const requestId = 'outgoing-req-2';
255
+ const response = {
256
+ type: 'control_response',
257
+ response: {
258
+ subtype: 'error',
259
+ request_id: requestId,
260
+ error: 'Request failed',
261
+ },
262
+ };
263
+ const resolve = vi.fn();
264
+ const reject = vi.fn();
265
+ const timeoutId = setTimeout(() => { }, 1000);
266
+ dispatcher.registerOutgoingRequest(requestId, 'SystemController', resolve, reject, timeoutId);
267
+ dispatcher.handleControlResponse(response);
268
+ expect(reject).toHaveBeenCalledWith(expect.objectContaining({
269
+ message: 'Request failed',
270
+ }));
271
+ expect(resolve).not.toHaveBeenCalled();
272
+ });
273
+ it('should handle error object in error response', () => {
274
+ const requestId = 'outgoing-req-3';
275
+ const response = {
276
+ type: 'control_response',
277
+ response: {
278
+ subtype: 'error',
279
+ request_id: requestId,
280
+ error: { message: 'Detailed error', code: 500 },
281
+ },
282
+ };
283
+ const resolve = vi.fn();
284
+ const reject = vi.fn();
285
+ const timeoutId = setTimeout(() => { }, 1000);
286
+ dispatcher.registerOutgoingRequest(requestId, 'SystemController', resolve, reject, timeoutId);
287
+ dispatcher.handleControlResponse(response);
288
+ expect(reject).toHaveBeenCalledWith(expect.objectContaining({
289
+ message: 'Detailed error',
290
+ }));
291
+ });
292
+ it('should handle response for non-existent pending request gracefully', () => {
293
+ const response = {
294
+ type: 'control_response',
295
+ response: {
296
+ subtype: 'success',
297
+ request_id: 'non-existent',
298
+ response: {},
299
+ },
300
+ };
301
+ // Should not throw
302
+ expect(() => dispatcher.handleControlResponse(response)).not.toThrow();
303
+ });
304
+ it('should handle response for non-existent request in debug mode', () => {
305
+ const context = createMockContext(true);
306
+ const consoleSpy = vi
307
+ .spyOn(console, 'error')
308
+ .mockImplementation(() => { });
309
+ const dispatcherWithDebug = new ControlDispatcher(context);
310
+ const response = {
311
+ type: 'control_response',
312
+ response: {
313
+ subtype: 'success',
314
+ request_id: 'non-existent',
315
+ response: {},
316
+ },
317
+ };
318
+ dispatcherWithDebug.handleControlResponse(response);
319
+ expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('[ControlDispatcher] No pending outgoing request for: non-existent'));
320
+ consoleSpy.mockRestore();
321
+ });
322
+ });
323
+ describe('sendControlRequest', () => {
324
+ it('should delegate to system controller sendControlRequest', async () => {
325
+ const payload = {
326
+ subtype: 'initialize',
327
+ };
328
+ const expectedResponse = {
329
+ subtype: 'success',
330
+ request_id: 'test-id',
331
+ response: {},
332
+ };
333
+ vi.mocked(mockSystemController.sendControlRequest).mockResolvedValue(expectedResponse);
334
+ const result = await dispatcher.sendControlRequest(payload, 5000);
335
+ expect(mockSystemController.sendControlRequest).toHaveBeenCalledWith(payload, 5000);
336
+ expect(result).toBe(expectedResponse);
337
+ });
338
+ });
339
+ describe('handleCancel', () => {
340
+ it('should cancel specific incoming request', () => {
341
+ const requestId = 'cancel-req-1';
342
+ const abortController = new AbortController();
343
+ const timeoutId = setTimeout(() => { }, 1000);
344
+ const abortSpy = vi.spyOn(abortController, 'abort');
345
+ dispatcher.registerIncomingRequest(requestId, 'SystemController', abortController, timeoutId);
346
+ dispatcher.handleCancel(requestId);
347
+ expect(abortSpy).toHaveBeenCalled();
348
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
349
+ type: 'control_response',
350
+ response: {
351
+ subtype: 'error',
352
+ request_id: requestId,
353
+ error: 'Request cancelled',
354
+ },
355
+ });
356
+ });
357
+ it('should cancel all incoming requests when no requestId provided', () => {
358
+ const requestId1 = 'cancel-req-2';
359
+ const requestId2 = 'cancel-req-3';
360
+ const abortController1 = new AbortController();
361
+ const abortController2 = new AbortController();
362
+ const timeoutId1 = setTimeout(() => { }, 1000);
363
+ const timeoutId2 = setTimeout(() => { }, 1000);
364
+ const abortSpy1 = vi.spyOn(abortController1, 'abort');
365
+ const abortSpy2 = vi.spyOn(abortController2, 'abort');
366
+ const register = dispatcher.registerIncomingRequest.bind(dispatcher);
367
+ register(requestId1, 'SystemController', abortController1, timeoutId1);
368
+ register(requestId2, 'SystemController', abortController2, timeoutId2);
369
+ dispatcher.handleCancel();
370
+ expect(abortSpy1).toHaveBeenCalled();
371
+ expect(abortSpy2).toHaveBeenCalled();
372
+ expect(mockContext.streamJson.send).toHaveBeenCalledTimes(2);
373
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
374
+ type: 'control_response',
375
+ response: {
376
+ subtype: 'error',
377
+ request_id: requestId1,
378
+ error: 'All requests cancelled',
379
+ },
380
+ });
381
+ expect(mockContext.streamJson.send).toHaveBeenCalledWith({
382
+ type: 'control_response',
383
+ response: {
384
+ subtype: 'error',
385
+ request_id: requestId2,
386
+ error: 'All requests cancelled',
387
+ },
388
+ });
389
+ });
390
+ it('should handle cancel of non-existent request gracefully', () => {
391
+ expect(() => dispatcher.handleCancel('non-existent')).not.toThrow();
392
+ });
393
+ it('should log cancellation in debug mode', () => {
394
+ const context = createMockContext(true);
395
+ const consoleSpy = vi
396
+ .spyOn(console, 'error')
397
+ .mockImplementation(() => { });
398
+ const dispatcherWithDebug = new ControlDispatcher(context);
399
+ const requestId = 'cancel-req-debug';
400
+ const abortController = new AbortController();
401
+ const timeoutId = setTimeout(() => { }, 1000);
402
+ dispatcherWithDebug.registerIncomingRequest(requestId, 'SystemController', abortController, timeoutId);
403
+ dispatcherWithDebug.handleCancel(requestId);
404
+ expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('[ControlDispatcher] Cancelled incoming request: cancel-req-debug'));
405
+ consoleSpy.mockRestore();
406
+ });
407
+ });
408
+ describe('shutdown', () => {
409
+ it('should cancel all pending incoming requests', () => {
410
+ const requestId1 = 'shutdown-req-1';
411
+ const requestId2 = 'shutdown-req-2';
412
+ const abortController1 = new AbortController();
413
+ const abortController2 = new AbortController();
414
+ const timeoutId1 = setTimeout(() => { }, 1000);
415
+ const timeoutId2 = setTimeout(() => { }, 1000);
416
+ const abortSpy1 = vi.spyOn(abortController1, 'abort');
417
+ const abortSpy2 = vi.spyOn(abortController2, 'abort');
418
+ const clearTimeoutSpy = vi.spyOn(global, 'clearTimeout');
419
+ const register = dispatcher.registerIncomingRequest.bind(dispatcher);
420
+ register(requestId1, 'SystemController', abortController1, timeoutId1);
421
+ register(requestId2, 'SystemController', abortController2, timeoutId2);
422
+ dispatcher.shutdown();
423
+ expect(abortSpy1).toHaveBeenCalled();
424
+ expect(abortSpy2).toHaveBeenCalled();
425
+ expect(clearTimeoutSpy).toHaveBeenCalledWith(timeoutId1);
426
+ expect(clearTimeoutSpy).toHaveBeenCalledWith(timeoutId2);
427
+ });
428
+ it('should reject all pending outgoing requests', () => {
429
+ const requestId1 = 'outgoing-shutdown-1';
430
+ const requestId2 = 'outgoing-shutdown-2';
431
+ const reject1 = vi.fn();
432
+ const reject2 = vi.fn();
433
+ const timeoutId1 = setTimeout(() => { }, 1000);
434
+ const timeoutId2 = setTimeout(() => { }, 1000);
435
+ const clearTimeoutSpy = vi.spyOn(global, 'clearTimeout');
436
+ const register = dispatcher.registerOutgoingRequest.bind(dispatcher);
437
+ register(requestId1, 'SystemController', vi.fn(), reject1, timeoutId1);
438
+ register(requestId2, 'SystemController', vi.fn(), reject2, timeoutId2);
439
+ dispatcher.shutdown();
440
+ expect(reject1).toHaveBeenCalledWith(expect.objectContaining({
441
+ message: 'Dispatcher shutdown',
442
+ }));
443
+ expect(reject2).toHaveBeenCalledWith(expect.objectContaining({
444
+ message: 'Dispatcher shutdown',
445
+ }));
446
+ expect(clearTimeoutSpy).toHaveBeenCalledWith(timeoutId1);
447
+ expect(clearTimeoutSpy).toHaveBeenCalledWith(timeoutId2);
448
+ });
449
+ it('should cleanup all controllers', () => {
450
+ vi.mocked(mockSystemController.cleanup).mockImplementation(() => { });
451
+ dispatcher.shutdown();
452
+ expect(mockSystemController.cleanup).toHaveBeenCalled();
453
+ });
454
+ it('should log shutdown in debug mode', () => {
455
+ const context = createMockContext(true);
456
+ const consoleSpy = vi
457
+ .spyOn(console, 'error')
458
+ .mockImplementation(() => { });
459
+ const dispatcherWithDebug = new ControlDispatcher(context);
460
+ dispatcherWithDebug.shutdown();
461
+ expect(consoleSpy).toHaveBeenCalledWith('[ControlDispatcher] Shutting down');
462
+ consoleSpy.mockRestore();
463
+ });
464
+ });
465
+ describe('pending request registry', () => {
466
+ describe('registerIncomingRequest', () => {
467
+ it('should register incoming request', () => {
468
+ const requestId = 'reg-incoming-1';
469
+ const abortController = new AbortController();
470
+ const timeoutId = setTimeout(() => { }, 1000);
471
+ dispatcher.registerIncomingRequest(requestId, 'SystemController', abortController, timeoutId);
472
+ // Verify it was registered by trying to cancel it
473
+ dispatcher.handleCancel(requestId);
474
+ expect(abortController.signal.aborted).toBe(true);
475
+ });
476
+ });
477
+ describe('deregisterIncomingRequest', () => {
478
+ it('should deregister incoming request', () => {
479
+ const requestId = 'dereg-incoming-1';
480
+ const abortController = new AbortController();
481
+ const timeoutId = setTimeout(() => { }, 1000);
482
+ const clearTimeoutSpy = vi.spyOn(global, 'clearTimeout');
483
+ dispatcher.registerIncomingRequest(requestId, 'SystemController', abortController, timeoutId);
484
+ dispatcher.deregisterIncomingRequest(requestId);
485
+ // Verify it was deregistered - cancel should not find it
486
+ const sendMock = vi.mocked(mockContext.streamJson.send);
487
+ const sendCallCount = sendMock.mock.calls.length;
488
+ dispatcher.handleCancel(requestId);
489
+ // Should not send cancel response for non-existent request
490
+ expect(sendMock.mock.calls.length).toBe(sendCallCount);
491
+ expect(clearTimeoutSpy).toHaveBeenCalledWith(timeoutId);
492
+ });
493
+ it('should handle deregister of non-existent request gracefully', () => {
494
+ expect(() => {
495
+ dispatcher.deregisterIncomingRequest('non-existent');
496
+ }).not.toThrow();
497
+ });
498
+ });
499
+ describe('registerOutgoingRequest', () => {
500
+ it('should register outgoing request', () => {
501
+ const requestId = 'reg-outgoing-1';
502
+ const resolve = vi.fn();
503
+ const reject = vi.fn();
504
+ const timeoutId = setTimeout(() => { }, 1000);
505
+ dispatcher.registerOutgoingRequest(requestId, 'SystemController', resolve, reject, timeoutId);
506
+ // Verify it was registered by handling a response
507
+ const response = {
508
+ type: 'control_response',
509
+ response: {
510
+ subtype: 'success',
511
+ request_id: requestId,
512
+ response: {},
513
+ },
514
+ };
515
+ dispatcher.handleControlResponse(response);
516
+ expect(resolve).toHaveBeenCalled();
517
+ });
518
+ });
519
+ describe('deregisterOutgoingRequest', () => {
520
+ it('should deregister outgoing request', () => {
521
+ const requestId = 'dereg-outgoing-1';
522
+ const resolve = vi.fn();
523
+ const reject = vi.fn();
524
+ const timeoutId = setTimeout(() => { }, 1000);
525
+ const clearTimeoutSpy = vi.spyOn(global, 'clearTimeout');
526
+ dispatcher.registerOutgoingRequest(requestId, 'SystemController', resolve, reject, timeoutId);
527
+ dispatcher.deregisterOutgoingRequest(requestId);
528
+ // Verify it was deregistered - response should not find it
529
+ const response = {
530
+ type: 'control_response',
531
+ response: {
532
+ subtype: 'success',
533
+ request_id: requestId,
534
+ response: {},
535
+ },
536
+ };
537
+ dispatcher.handleControlResponse(response);
538
+ expect(resolve).not.toHaveBeenCalled();
539
+ expect(clearTimeoutSpy).toHaveBeenCalledWith(timeoutId);
540
+ });
541
+ it('should handle deregister of non-existent request gracefully', () => {
542
+ expect(() => {
543
+ dispatcher.deregisterOutgoingRequest('non-existent');
544
+ }).not.toThrow();
545
+ });
546
+ });
547
+ });
548
+ });
549
+ //# sourceMappingURL=ControlDispatcher.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControlDispatcher.test.js","sourceRoot":"","sources":["../../../../src/nonInteractive/control/ControlDispatcher.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAe3D;;GAEG;AACH,SAAS,iBAAiB,CAAC,YAAqB,KAAK;IACnD,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,cAAc,GAAG;QACrB,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;KACwB,CAAC;IAExC,MAAM,UAAU,GAAG;QACjB,YAAY,EAAE,E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,EAAE,SAAS;wBACrB,QAAQ,EAAE,EAAE;qBACb;iBACF,CAAC;gBAEF,UAAU,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;gBAC3C,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;gBACvC,MAAM,CAAC,eAAe,CAAC,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;gBACrE,MAAM,CAAC,GAAG,EAAE;oBAER,UAGD,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAC;gBAC9C,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Control Service - Public Programmatic API
8
+ *
9
+ * Provides type-safe access to control plane functionality for internal
10
+ * CLI code. This is the ONLY programmatic interface that should be used by:
11
+ * - nonInteractiveCli
12
+ * - Session managers
13
+ * - Tool execution handlers
14
+ * - Internal CLI logic
15
+ *
16
+ * DO NOT use ControlDispatcher or controllers directly from application code.
17
+ *
18
+ * Architecture:
19
+ * - ControlContext stores shared session state (Layer 1)
20
+ * - ControlDispatcher handles protocol-level routing (Layer 2)
21
+ * - ControlService provides programmatic API for internal CLI usage (Layer 3)
22
+ *
23
+ * ControlService and ControlDispatcher share controller instances to ensure
24
+ * a single source of truth. All higher level code MUST access the control
25
+ * plane exclusively through ControlService.
26
+ */
27
+ import type { IControlContext } from './ControlContext.js';
28
+ import type { ControlDispatcher } from './ControlDispatcher.js';
29
+ import type { SystemServiceAPI } from './types/serviceAPIs.js';
30
+ /**
31
+ * Control Service
32
+ *
33
+ * Facade layer providing domain-grouped APIs for control plane operations.
34
+ * Shares controller instances with ControlDispatcher to ensure single source
35
+ * of truth and state consistency.
36
+ */
37
+ export declare class ControlService {
38
+ private dispatcher;
39
+ /**
40
+ * Construct ControlService
41
+ *
42
+ * @param context - Control context (unused directly, passed to dispatcher)
43
+ * @param dispatcher - Control dispatcher that owns the controller instances
44
+ */
45
+ constructor(context: IControlContext, dispatcher: ControlDispatcher);
46
+ /**
47
+ * Permission Domain API
48
+ *
49
+ * Handles tool execution permissions, approval checks, and callbacks.
50
+ * Delegates to the shared PermissionController instance.
51
+ */
52
+ /**
53
+ * System Domain API
54
+ *
55
+ * Handles system-level operations and session management.
56
+ * Delegates to the shared SystemController instance.
57
+ */
58
+ get system(): SystemServiceAPI;
59
+ /**
60
+ * MCP Domain API
61
+ *
62
+ * Handles Model Context Protocol server interactions.
63
+ * Delegates to the shared MCPController instance.
64
+ */
65
+ /**
66
+ * Hook Domain API
67
+ *
68
+ * Handles hook callback processing (placeholder for future expansion).
69
+ * Delegates to the shared HookController instance.
70
+ */
71
+ /**
72
+ * Cleanup all controllers
73
+ *
74
+ * Should be called on session shutdown. Delegates to dispatcher's shutdown
75
+ * method to ensure all controllers are properly cleaned up.
76
+ */
77
+ cleanup(): void;
78
+ }