@umsai/ums-code 0.3.0-v2 → 0.6.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 (397) hide show
  1. package/dist/package.json +6 -6
  2. package/dist/src/{zed-integration → acp-integration}/acp.d.ts +13 -0
  3. package/dist/src/{zed-integration → acp-integration}/acp.js +32 -0
  4. package/dist/src/acp-integration/acp.js.map +1 -0
  5. package/dist/src/acp-integration/acpAgent.d.ts +10 -0
  6. package/dist/src/acp-integration/acpAgent.js +264 -0
  7. package/dist/src/acp-integration/acpAgent.js.map +1 -0
  8. package/dist/src/{zed-integration → acp-integration}/schema.d.ts +2235 -905
  9. package/dist/src/{zed-integration → acp-integration}/schema.js +100 -2
  10. package/dist/src/acp-integration/schema.js.map +1 -0
  11. package/dist/src/{zed-integration/fileSystemService.d.ts → acp-integration/service/filesystem.d.ts} +1 -1
  12. package/dist/src/{zed-integration/fileSystemService.js → acp-integration/service/filesystem.js} +14 -1
  13. package/dist/src/acp-integration/service/filesystem.js.map +1 -0
  14. package/dist/src/{ui/hooks/useQuotaAndFallback.test.d.ts → acp-integration/service/filesystem.test.d.ts} +1 -1
  15. package/dist/src/acp-integration/service/filesystem.test.js +39 -0
  16. package/dist/src/acp-integration/service/filesystem.test.js.map +1 -0
  17. package/dist/src/acp-integration/session/HistoryReplayer.d.ts +51 -0
  18. package/dist/src/acp-integration/session/HistoryReplayer.js +164 -0
  19. package/dist/src/acp-integration/session/HistoryReplayer.js.map +1 -0
  20. package/dist/src/acp-integration/session/HistoryReplayer.test.d.ts +6 -0
  21. package/dist/src/acp-integration/session/HistoryReplayer.test.js +374 -0
  22. package/dist/src/acp-integration/session/HistoryReplayer.test.js.map +1 -0
  23. package/dist/src/acp-integration/session/Session.d.ts +61 -0
  24. package/dist/src/acp-integration/session/Session.js +839 -0
  25. package/dist/src/acp-integration/session/Session.js.map +1 -0
  26. package/dist/src/acp-integration/session/SubAgentTracker.d.ts +51 -0
  27. package/dist/src/acp-integration/session/SubAgentTracker.js +257 -0
  28. package/dist/src/acp-integration/session/SubAgentTracker.js.map +1 -0
  29. package/dist/src/acp-integration/session/SubAgentTracker.test.d.ts +6 -0
  30. package/dist/src/acp-integration/session/SubAgentTracker.test.js +369 -0
  31. package/dist/src/acp-integration/session/SubAgentTracker.test.js.map +1 -0
  32. package/dist/src/acp-integration/session/emitters/BaseEmitter.d.ts +27 -0
  33. package/dist/src/acp-integration/session/emitters/BaseEmitter.js +34 -0
  34. package/dist/src/acp-integration/session/emitters/BaseEmitter.js.map +1 -0
  35. package/dist/src/acp-integration/session/emitters/MessageEmitter.d.ts +41 -0
  36. package/dist/src/acp-integration/session/emitters/MessageEmitter.js +77 -0
  37. package/dist/src/acp-integration/session/emitters/MessageEmitter.js.map +1 -0
  38. package/dist/src/acp-integration/session/emitters/MessageEmitter.test.d.ts +6 -0
  39. package/dist/src/acp-integration/session/emitters/MessageEmitter.test.js +174 -0
  40. package/dist/src/acp-integration/session/emitters/MessageEmitter.test.js.map +1 -0
  41. package/dist/src/acp-integration/session/emitters/PlanEmitter.d.ts +39 -0
  42. package/dist/src/acp-integration/session/emitters/PlanEmitter.js +83 -0
  43. package/dist/src/acp-integration/session/emitters/PlanEmitter.js.map +1 -0
  44. package/dist/src/acp-integration/session/emitters/PlanEmitter.test.d.ts +6 -0
  45. package/dist/src/acp-integration/session/emitters/PlanEmitter.test.js +176 -0
  46. package/dist/src/acp-integration/session/emitters/PlanEmitter.test.js.map +1 -0
  47. package/dist/src/acp-integration/session/emitters/ToolCallEmitter.d.ts +80 -0
  48. package/dist/src/acp-integration/session/emitters/ToolCallEmitter.js +248 -0
  49. package/dist/src/acp-integration/session/emitters/ToolCallEmitter.js.map +1 -0
  50. package/dist/src/acp-integration/session/emitters/ToolCallEmitter.test.d.ts +6 -0
  51. package/dist/src/acp-integration/session/emitters/ToolCallEmitter.test.js +561 -0
  52. package/dist/src/acp-integration/session/emitters/ToolCallEmitter.test.js.map +1 -0
  53. package/dist/src/acp-integration/session/emitters/index.d.ts +9 -0
  54. package/dist/src/acp-integration/session/emitters/index.js +10 -0
  55. package/dist/src/acp-integration/session/emitters/index.js.map +1 -0
  56. package/dist/src/acp-integration/session/index.d.ts +24 -0
  57. package/dist/src/acp-integration/session/index.js +16 -0
  58. package/dist/src/acp-integration/session/index.js.map +1 -0
  59. package/dist/src/acp-integration/session/types.d.ts +71 -0
  60. package/dist/src/acp-integration/session/types.js +7 -0
  61. package/dist/src/acp-integration/session/types.js.map +1 -0
  62. package/dist/src/commandMode.d.ts +11 -0
  63. package/dist/src/commandMode.js +238 -0
  64. package/dist/src/commandMode.js.map +1 -0
  65. package/dist/src/config/auth.d.ts +1 -0
  66. package/dist/src/config/auth.js +29 -0
  67. package/dist/src/config/auth.js.map +1 -1
  68. package/dist/src/config/config.d.ts +19 -3
  69. package/dist/src/config/config.js +175 -24
  70. package/dist/src/config/config.js.map +1 -1
  71. package/dist/src/config/extension.js +0 -2
  72. package/dist/src/config/extension.js.map +1 -1
  73. package/dist/src/config/extensions/update.test.js +9 -0
  74. package/dist/src/config/extensions/update.test.js.map +1 -1
  75. package/dist/src/config/settingsSchema.d.ts +53 -2
  76. package/dist/src/config/settingsSchema.js +46 -2
  77. package/dist/src/config/settingsSchema.js.map +1 -1
  78. package/dist/src/core/auth.d.ts +1 -1
  79. package/dist/src/core/auth.js +3 -2
  80. package/dist/src/core/auth.js.map +1 -1
  81. package/dist/src/core/initializer.js +3 -0
  82. package/dist/src/core/initializer.js.map +1 -1
  83. package/dist/src/gemini.js +75 -35
  84. package/dist/src/gemini.js.map +1 -1
  85. package/dist/src/gemini.test.js +37 -4
  86. package/dist/src/gemini.test.js.map +1 -1
  87. package/dist/src/generated/git-commit.d.ts +3 -3
  88. package/dist/src/generated/git-commit.js +3 -3
  89. package/dist/src/i18n/index.d.ts +10 -2
  90. package/dist/src/i18n/index.js +26 -1
  91. package/dist/src/i18n/index.js.map +1 -1
  92. package/dist/src/i18n/languages.d.ts +20 -0
  93. package/dist/src/i18n/languages.js +36 -0
  94. package/dist/src/i18n/languages.js.map +1 -0
  95. package/dist/src/i18n/locales/de.js +1073 -0
  96. package/dist/src/i18n/locales/en.js +121 -175
  97. package/dist/src/i18n/locales/ru.js +1095 -0
  98. package/dist/src/i18n/locales/zh.js +52 -174
  99. package/dist/src/nonInteractive/control/ControlDispatcher.d.ts +24 -1
  100. package/dist/src/nonInteractive/control/ControlDispatcher.js +46 -17
  101. package/dist/src/nonInteractive/control/ControlDispatcher.js.map +1 -1
  102. package/dist/src/nonInteractive/control/ControlService.d.ts +2 -1
  103. package/dist/src/nonInteractive/control/ControlService.js +22 -37
  104. package/dist/src/nonInteractive/control/ControlService.js.map +1 -1
  105. package/dist/src/nonInteractive/control/controllers/baseController.d.ts +2 -1
  106. package/dist/src/nonInteractive/control/controllers/baseController.js +38 -5
  107. package/dist/src/nonInteractive/control/controllers/baseController.js.map +1 -1
  108. package/dist/src/nonInteractive/control/controllers/permissionController.d.ts +1 -22
  109. package/dist/src/nonInteractive/control/controllers/permissionController.js +38 -38
  110. package/dist/src/nonInteractive/control/controllers/permissionController.js.map +1 -1
  111. package/dist/src/nonInteractive/control/controllers/sdkMcpController.d.ts +54 -0
  112. package/dist/src/nonInteractive/control/controllers/sdkMcpController.js +84 -0
  113. package/dist/src/nonInteractive/control/controllers/sdkMcpController.js.map +1 -0
  114. package/dist/src/nonInteractive/control/controllers/systemController.d.ts +16 -6
  115. package/dist/src/nonInteractive/control/controllers/systemController.js +184 -44
  116. package/dist/src/nonInteractive/control/controllers/systemController.js.map +1 -1
  117. package/dist/src/nonInteractive/control/types/serviceAPIs.d.ts +1 -16
  118. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.d.ts +11 -0
  119. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.js +64 -5
  120. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.js.map +1 -1
  121. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.js +40 -0
  122. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.js.map +1 -1
  123. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.js +50 -0
  124. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.js.map +1 -1
  125. package/dist/src/nonInteractive/session.d.ts +0 -16
  126. package/dist/src/nonInteractive/session.js +317 -321
  127. package/dist/src/nonInteractive/session.js.map +1 -1
  128. package/dist/src/nonInteractive/session.test.js +6 -0
  129. package/dist/src/nonInteractive/session.test.js.map +1 -1
  130. package/dist/src/nonInteractive/types.d.ts +57 -3
  131. package/dist/src/nonInteractive/types.js +0 -1
  132. package/dist/src/nonInteractive/types.js.map +1 -1
  133. package/dist/src/nonInteractiveCli.js +121 -56
  134. package/dist/src/nonInteractiveCli.js.map +1 -1
  135. package/dist/src/nonInteractiveCliCommands.d.ts +48 -9
  136. package/dist/src/nonInteractiveCliCommands.js +180 -64
  137. package/dist/src/nonInteractiveCliCommands.js.map +1 -1
  138. package/dist/src/nonInteractiveCliCommands.test.d.ts +6 -0
  139. package/dist/src/nonInteractiveCliCommands.test.js +157 -0
  140. package/dist/src/nonInteractiveCliCommands.test.js.map +1 -0
  141. package/dist/src/services/BuiltinCommandLoader.js +7 -6
  142. package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
  143. package/dist/src/services/BuiltinCommandLoader.test.js +0 -3
  144. package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -1
  145. package/dist/src/services/McpPromptLoader.js +4 -2
  146. package/dist/src/services/McpPromptLoader.js.map +1 -1
  147. package/dist/src/services/McpPromptLoader.test.js +1 -1
  148. package/dist/src/services/McpPromptLoader.test.js.map +1 -1
  149. package/dist/src/test-utils/mockCommandContext.js +11 -2
  150. package/dist/src/test-utils/mockCommandContext.js.map +1 -1
  151. package/dist/src/ui/AppContainer.js +62 -56
  152. package/dist/src/ui/AppContainer.js.map +1 -1
  153. package/dist/src/ui/AppContainer.test.js +0 -46
  154. package/dist/src/ui/AppContainer.test.js.map +1 -1
  155. package/dist/src/ui/auth/AuthDialog.test.js +4 -4
  156. package/dist/src/ui/auth/AuthDialog.test.js.map +1 -1
  157. package/dist/src/ui/auth/useAuth.js +31 -4
  158. package/dist/src/ui/auth/useAuth.js.map +1 -1
  159. package/dist/src/ui/commands/approvalModeCommand.js +53 -4
  160. package/dist/src/ui/commands/approvalModeCommand.js.map +1 -1
  161. package/dist/src/ui/commands/approvalModeCommand.test.js +72 -10
  162. package/dist/src/ui/commands/approvalModeCommand.test.js.map +1 -1
  163. package/dist/src/ui/commands/clearCommand.js +22 -10
  164. package/dist/src/ui/commands/clearCommand.js.map +1 -1
  165. package/dist/src/ui/commands/compressCommand.js +86 -16
  166. package/dist/src/ui/commands/compressCommand.js.map +1 -1
  167. package/dist/src/ui/commands/languageCommand.d.ts +6 -1
  168. package/dist/src/ui/commands/languageCommand.js +162 -183
  169. package/dist/src/ui/commands/languageCommand.js.map +1 -1
  170. package/dist/src/ui/commands/languageCommand.test.d.ts +6 -0
  171. package/dist/src/ui/commands/languageCommand.test.js +558 -0
  172. package/dist/src/ui/commands/languageCommand.test.js.map +1 -0
  173. package/dist/src/ui/commands/modelCommand.js +4 -2
  174. package/dist/src/ui/commands/modelCommand.js.map +1 -1
  175. package/dist/src/ui/commands/quitCommand.d.ts +0 -1
  176. package/dist/src/ui/commands/quitCommand.js +0 -27
  177. package/dist/src/ui/commands/quitCommand.js.map +1 -1
  178. package/dist/src/ui/commands/restoreCommand.js +1 -1
  179. package/dist/src/ui/commands/restoreCommand.js.map +1 -1
  180. package/dist/src/ui/commands/resumeCommand.d.ts +7 -0
  181. package/dist/src/ui/commands/resumeCommand.js +19 -0
  182. package/dist/src/ui/commands/resumeCommand.js.map +1 -0
  183. package/dist/src/ui/commands/resumeCommand.test.d.ts +6 -0
  184. package/dist/src/ui/commands/resumeCommand.test.js +32 -0
  185. package/dist/src/ui/commands/resumeCommand.test.js.map +1 -0
  186. package/dist/src/ui/commands/reviewCommand.d.ts +9 -0
  187. package/dist/src/ui/commands/reviewCommand.js +2046 -0
  188. package/dist/src/ui/commands/reviewCommand.js.map +1 -0
  189. package/dist/src/ui/commands/reviewCommand.test.js +600 -0
  190. package/dist/src/ui/commands/reviewCommand.test.js.map +1 -0
  191. package/dist/src/ui/commands/setupGithubCommand.js +11 -10
  192. package/dist/src/ui/commands/setupGithubCommand.js.map +1 -1
  193. package/dist/src/ui/commands/setupGithubCommand.test.js +14 -14
  194. package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -1
  195. package/dist/src/ui/commands/summaryCommand.js +129 -42
  196. package/dist/src/ui/commands/summaryCommand.js.map +1 -1
  197. package/dist/src/ui/commands/types.d.ts +24 -10
  198. package/dist/src/ui/commands/types.js.map +1 -1
  199. package/dist/src/ui/commands/ums/unittestCommand.d.ts +9 -0
  200. package/dist/src/ui/commands/ums/unittestCommand.js +387 -0
  201. package/dist/src/ui/commands/ums/unittestCommand.js.map +1 -0
  202. package/dist/src/ui/components/Composer.test.js +1 -2
  203. package/dist/src/ui/components/Composer.test.js.map +1 -1
  204. package/dist/src/ui/components/ContextUsageDisplay.d.ts +3 -2
  205. package/dist/src/ui/components/ContextUsageDisplay.js +8 -2
  206. package/dist/src/ui/components/ContextUsageDisplay.js.map +1 -1
  207. package/dist/src/ui/components/DialogManager.js +7 -23
  208. package/dist/src/ui/components/DialogManager.js.map +1 -1
  209. package/dist/src/ui/components/Footer.js +2 -3
  210. package/dist/src/ui/components/Footer.js.map +1 -1
  211. package/dist/src/ui/components/Help.js +13 -2
  212. package/dist/src/ui/components/Help.js.map +1 -1
  213. package/dist/src/ui/components/Help.test.js +6 -0
  214. package/dist/src/ui/components/Help.test.js.map +1 -1
  215. package/dist/src/ui/components/HistoryItemDisplay.js +3 -1
  216. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
  217. package/dist/src/ui/components/HistoryItemDisplay.test.js +5 -2
  218. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -1
  219. package/dist/src/ui/components/InputPrompt.js +6 -4
  220. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  221. package/dist/src/ui/components/ModelDialog.d.ts +3 -1
  222. package/dist/src/ui/components/ModelDialog.js +25 -5
  223. package/dist/src/ui/components/ModelDialog.js.map +1 -1
  224. package/dist/src/ui/components/OpenAIKeyPrompt.d.ts +3 -0
  225. package/dist/src/ui/components/OpenAIKeyPrompt.js +1 -0
  226. package/dist/src/ui/components/OpenAIKeyPrompt.js.map +1 -1
  227. package/dist/src/ui/components/PermissionsModifyTrustDialog.js +1 -1
  228. package/dist/src/ui/components/PermissionsModifyTrustDialog.js.map +1 -1
  229. package/dist/src/ui/components/SessionPicker.d.ts +18 -0
  230. package/dist/src/ui/components/SessionPicker.js +69 -0
  231. package/dist/src/ui/components/SessionPicker.js.map +1 -0
  232. package/dist/src/ui/components/SessionSummaryDisplay.js +14 -2
  233. package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -1
  234. package/dist/src/ui/components/SettingsDialog.test.js +2 -2
  235. package/dist/src/ui/components/StandaloneSessionPicker.d.ts +10 -0
  236. package/dist/src/ui/components/StandaloneSessionPicker.js +78 -0
  237. package/dist/src/ui/components/StandaloneSessionPicker.js.map +1 -0
  238. package/dist/src/ui/components/StandaloneSessionPicker.test.d.ts +6 -0
  239. package/dist/src/ui/components/StandaloneSessionPicker.test.js +410 -0
  240. package/dist/src/ui/components/StandaloneSessionPicker.test.js.map +1 -0
  241. package/dist/src/ui/components/SuggestionsDisplay.js +3 -2
  242. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
  243. package/dist/src/ui/components/messages/GeminiThoughtMessage.d.ts +18 -0
  244. package/dist/src/ui/components/messages/GeminiThoughtMessage.js +14 -0
  245. package/dist/src/ui/components/messages/GeminiThoughtMessage.js.map +1 -0
  246. package/dist/src/ui/components/messages/GeminiThoughtMessageContent.d.ts +18 -0
  247. package/dist/src/ui/components/messages/GeminiThoughtMessageContent.js +14 -0
  248. package/dist/src/ui/components/messages/GeminiThoughtMessageContent.js.map +1 -0
  249. package/dist/src/ui/components/subagents/manage/AgentEditStep.js +4 -1
  250. package/dist/src/ui/components/subagents/manage/AgentEditStep.js.map +1 -1
  251. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js +2 -2
  252. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js.map +1 -1
  253. package/dist/src/ui/components/ums/UMSKeyPrompt.d.ts +1 -1
  254. package/dist/src/ui/components/ums/UMSKeyPrompt.js +24 -4
  255. package/dist/src/ui/components/ums/UMSKeyPrompt.js.map +1 -1
  256. package/dist/src/ui/components/ums/umsStartupWarnings.d.ts +6 -0
  257. package/dist/src/ui/components/ums/umsStartupWarnings.js +47 -0
  258. package/dist/src/ui/components/ums/umsStartupWarnings.js.map +1 -0
  259. package/dist/src/ui/contexts/SessionContext.d.ts +2 -0
  260. package/dist/src/ui/contexts/SessionContext.js +18 -10
  261. package/dist/src/ui/contexts/SessionContext.js.map +1 -1
  262. package/dist/src/ui/contexts/UIActionsContext.d.ts +3 -1
  263. package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
  264. package/dist/src/ui/contexts/UIStateContext.d.ts +3 -11
  265. package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
  266. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +3 -8
  267. package/dist/src/ui/hooks/slashCommandProcessor.js +77 -101
  268. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  269. package/dist/src/ui/hooks/useAttentionNotifications.d.ts +3 -1
  270. package/dist/src/ui/hooks/useAttentionNotifications.js +10 -5
  271. package/dist/src/ui/hooks/useAttentionNotifications.js.map +1 -1
  272. package/dist/src/ui/hooks/useAttentionNotifications.test.js +39 -2
  273. package/dist/src/ui/hooks/useAttentionNotifications.test.js.map +1 -1
  274. package/dist/src/ui/hooks/useDialogClose.d.ts +0 -3
  275. package/dist/src/ui/hooks/useDialogClose.js +0 -2
  276. package/dist/src/ui/hooks/useDialogClose.js.map +1 -1
  277. package/dist/src/ui/hooks/useGeminiStream.js +87 -12
  278. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  279. package/dist/src/ui/hooks/useLoadingIndicator.test.js +11 -6
  280. package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
  281. package/dist/src/ui/hooks/useLogger.d.ts +1 -1
  282. package/dist/src/ui/hooks/useLogger.js +6 -3
  283. package/dist/src/ui/hooks/useLogger.js.map +1 -1
  284. package/dist/src/ui/hooks/usePhraseCycler.js +12 -136
  285. package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
  286. package/dist/src/ui/hooks/useQwenAuth.test.js +1 -1
  287. package/dist/src/ui/hooks/useQwenAuth.test.js.map +1 -1
  288. package/dist/src/ui/hooks/useReactToolScheduler.js +2 -2
  289. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
  290. package/dist/src/ui/hooks/useResumeCommand.d.ts +20 -0
  291. package/dist/src/ui/hooks/useResumeCommand.js +49 -0
  292. package/dist/src/ui/hooks/useResumeCommand.js.map +1 -0
  293. package/dist/src/ui/hooks/useResumeCommand.test.d.ts +6 -0
  294. package/dist/src/ui/hooks/useResumeCommand.test.js +144 -0
  295. package/dist/src/ui/hooks/useResumeCommand.test.js.map +1 -0
  296. package/dist/src/ui/hooks/useSessionPicker.d.ts +36 -0
  297. package/dist/src/ui/hooks/useSessionPicker.js +189 -0
  298. package/dist/src/ui/hooks/useSessionPicker.js.map +1 -0
  299. package/dist/src/ui/hooks/useSlashCompletion.js +9 -1
  300. package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
  301. package/dist/src/ui/hooks/useSlashCompletion.test.js +36 -31
  302. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
  303. package/dist/src/ui/hooks/useToolScheduler.test.js +2 -1
  304. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
  305. package/dist/src/ui/models/availableModels.d.ts +9 -2
  306. package/dist/src/ui/models/availableModels.js +32 -35
  307. package/dist/src/ui/models/availableModels.js.map +1 -1
  308. package/dist/src/ui/noninteractive/nonInteractiveUi.js +0 -1
  309. package/dist/src/ui/noninteractive/nonInteractiveUi.js.map +1 -1
  310. package/dist/src/ui/types.d.ts +9 -14
  311. package/dist/src/ui/types.js +0 -1
  312. package/dist/src/ui/types.js.map +1 -1
  313. package/dist/src/ui/utils/InlineMarkdownRenderer.d.ts +1 -0
  314. package/dist/src/ui/utils/InlineMarkdownRenderer.js +2 -2
  315. package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -1
  316. package/dist/src/ui/utils/MarkdownDisplay.d.ts +1 -0
  317. package/dist/src/ui/utils/MarkdownDisplay.js +13 -13
  318. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
  319. package/dist/src/ui/utils/formatters.d.ts +6 -0
  320. package/dist/src/ui/utils/formatters.js +31 -0
  321. package/dist/src/ui/utils/formatters.js.map +1 -1
  322. package/dist/src/ui/utils/formatters.test.js +51 -2
  323. package/dist/src/ui/utils/formatters.test.js.map +1 -1
  324. package/dist/src/ui/utils/resumeHistoryUtils.d.ts +19 -0
  325. package/dist/src/ui/utils/resumeHistoryUtils.js +267 -0
  326. package/dist/src/ui/utils/resumeHistoryUtils.js.map +1 -0
  327. package/dist/src/ui/utils/resumeHistoryUtils.test.d.ts +6 -0
  328. package/dist/src/ui/utils/resumeHistoryUtils.test.js +253 -0
  329. package/dist/src/ui/utils/resumeHistoryUtils.test.js.map +1 -0
  330. package/dist/src/ui/utils/sessionPickerUtils.d.ts +30 -0
  331. package/dist/src/ui/utils/sessionPickerUtils.js +41 -0
  332. package/dist/src/ui/utils/sessionPickerUtils.js.map +1 -0
  333. package/dist/src/ui/utils/sessionPickerUtils.test.d.ts +6 -0
  334. package/dist/src/ui/utils/sessionPickerUtils.test.js +38 -0
  335. package/dist/src/ui/utils/sessionPickerUtils.test.js.map +1 -0
  336. package/dist/src/utils/attentionNotification.d.ts +1 -0
  337. package/dist/src/utils/attentionNotification.js +4 -0
  338. package/dist/src/utils/attentionNotification.js.map +1 -1
  339. package/dist/src/utils/errors.d.ts +1 -1
  340. package/dist/src/utils/errors.js +14 -3
  341. package/dist/src/utils/errors.js.map +1 -1
  342. package/dist/src/utils/errors.test.js +43 -1
  343. package/dist/src/utils/errors.test.js.map +1 -1
  344. package/dist/src/utils/gitUtils.js +25 -8
  345. package/dist/src/utils/gitUtils.js.map +1 -1
  346. package/dist/src/utils/gitUtils.test.js +59 -0
  347. package/dist/src/utils/gitUtils.test.js.map +1 -1
  348. package/dist/src/utils/nonInteractiveHelpers.d.ts +3 -1
  349. package/dist/src/utils/nonInteractiveHelpers.js +14 -15
  350. package/dist/src/utils/nonInteractiveHelpers.js.map +1 -1
  351. package/dist/src/utils/nonInteractiveHelpers.test.js +36 -21
  352. package/dist/src/utils/nonInteractiveHelpers.test.js.map +1 -1
  353. package/dist/src/utils/relaunch.js +2 -2
  354. package/dist/src/utils/relaunch.js.map +1 -1
  355. package/dist/src/utils/relaunch.test.js +5 -5
  356. package/dist/src/utils/relaunch.test.js.map +1 -1
  357. package/dist/src/utils/systemInfo.js +2 -1
  358. package/dist/src/utils/systemInfo.js.map +1 -1
  359. package/dist/src/validateNonInterActiveAuth.js +10 -1
  360. package/dist/src/validateNonInterActiveAuth.js.map +1 -1
  361. package/dist/tsconfig.tsbuildinfo +1 -1
  362. package/package.json +7 -7
  363. package/dist/src/nonInteractive/control/controllers/mcpController.d.ts +0 -42
  364. package/dist/src/nonInteractive/control/controllers/mcpController.js +0 -205
  365. package/dist/src/nonInteractive/control/controllers/mcpController.js.map +0 -1
  366. package/dist/src/ui/commands/chatCommand.d.ts +0 -9
  367. package/dist/src/ui/commands/chatCommand.js +0 -351
  368. package/dist/src/ui/commands/chatCommand.js.map +0 -1
  369. package/dist/src/ui/commands/corgiCommand.d.ts +0 -7
  370. package/dist/src/ui/commands/corgiCommand.js +0 -16
  371. package/dist/src/ui/commands/corgiCommand.js.map +0 -1
  372. package/dist/src/ui/components/ProQuotaDialog.d.ts +0 -13
  373. package/dist/src/ui/components/ProQuotaDialog.js +0 -24
  374. package/dist/src/ui/components/ProQuotaDialog.js.map +0 -1
  375. package/dist/src/ui/components/ProQuotaDialog.test.js +0 -58
  376. package/dist/src/ui/components/ProQuotaDialog.test.js.map +0 -1
  377. package/dist/src/ui/components/QuitConfirmationDialog.d.ts +0 -17
  378. package/dist/src/ui/components/QuitConfirmationDialog.js +0 -49
  379. package/dist/src/ui/components/QuitConfirmationDialog.js.map +0 -1
  380. package/dist/src/ui/hooks/usePromptCompletion.d.ts +0 -23
  381. package/dist/src/ui/hooks/usePromptCompletion.js +0 -177
  382. package/dist/src/ui/hooks/usePromptCompletion.js.map +0 -1
  383. package/dist/src/ui/hooks/useQuitConfirmation.d.ts +0 -14
  384. package/dist/src/ui/hooks/useQuitConfirmation.js +0 -36
  385. package/dist/src/ui/hooks/useQuitConfirmation.js.map +0 -1
  386. package/dist/src/ui/hooks/useQuotaAndFallback.d.ts +0 -21
  387. package/dist/src/ui/hooks/useQuotaAndFallback.js +0 -122
  388. package/dist/src/ui/hooks/useQuotaAndFallback.js.map +0 -1
  389. package/dist/src/ui/hooks/useQuotaAndFallback.test.js +0 -269
  390. package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +0 -1
  391. package/dist/src/zed-integration/acp.js.map +0 -1
  392. package/dist/src/zed-integration/fileSystemService.js.map +0 -1
  393. package/dist/src/zed-integration/schema.js.map +0 -1
  394. package/dist/src/zed-integration/zedIntegration.d.ts +0 -17
  395. package/dist/src/zed-integration/zedIntegration.js +0 -1135
  396. package/dist/src/zed-integration/zedIntegration.js.map +0 -1
  397. /package/dist/src/ui/{components/ProQuotaDialog.test.d.ts → commands/reviewCommand.test.d.ts} +0 -0
@@ -0,0 +1,267 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Code
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { ToolCallStatus } from '../types.js';
7
+ /**
8
+ * Extracts text content from a Content object's parts (excluding thought parts).
9
+ */
10
+ function extractTextFromParts(parts) {
11
+ if (!parts)
12
+ return '';
13
+ const textParts = [];
14
+ for (const part of parts) {
15
+ if ('text' in part && part.text) {
16
+ // Skip thought parts - they have a 'thought' property
17
+ if (!('thought' in part && part.thought)) {
18
+ textParts.push(part.text);
19
+ }
20
+ }
21
+ }
22
+ return textParts.join('\n');
23
+ }
24
+ /**
25
+ * Extracts thought text content from a Content object's parts.
26
+ * Thought parts are identified by having `thought: true`.
27
+ */
28
+ function extractThoughtTextFromParts(parts) {
29
+ if (!parts)
30
+ return '';
31
+ const thoughtParts = [];
32
+ for (const part of parts) {
33
+ if ('text' in part && part.text && 'thought' in part && part.thought) {
34
+ thoughtParts.push(part.text);
35
+ }
36
+ }
37
+ return thoughtParts.join('\n');
38
+ }
39
+ /**
40
+ * Extracts function calls from a Content object's parts.
41
+ */
42
+ function extractFunctionCalls(parts) {
43
+ if (!parts)
44
+ return [];
45
+ const calls = [];
46
+ for (const part of parts) {
47
+ if ('functionCall' in part && part.functionCall) {
48
+ const fc = part.functionCall;
49
+ calls.push({
50
+ id: fc.id || `call-${calls.length}`,
51
+ name: fc.name || 'unknown',
52
+ args: fc.args || {},
53
+ });
54
+ }
55
+ }
56
+ return calls;
57
+ }
58
+ function getTool(config, name) {
59
+ const toolRegistry = config.getToolRegistry();
60
+ return toolRegistry.getTool(name);
61
+ }
62
+ /**
63
+ * Formats a tool description from its name and arguments using actual tool instances.
64
+ * This ensures we get the exact same descriptions as during normal operation.
65
+ */
66
+ function formatToolDescription(tool, args) {
67
+ try {
68
+ // Create tool invocation instance and get description
69
+ const invocation = tool.build(args);
70
+ return invocation.getDescription();
71
+ }
72
+ catch {
73
+ return '';
74
+ }
75
+ }
76
+ /**
77
+ * Restores a HistoryItemWithoutId from the serialized shape stored in
78
+ * SlashCommandRecordPayload.outputHistoryItems.
79
+ */
80
+ function restoreHistoryItem(raw) {
81
+ if (!raw || typeof raw !== 'object') {
82
+ return;
83
+ }
84
+ const clone = { ...raw };
85
+ if ('timestamp' in clone) {
86
+ const ts = clone['timestamp'];
87
+ if (typeof ts === 'string' || typeof ts === 'number') {
88
+ clone['timestamp'] = new Date(ts);
89
+ }
90
+ }
91
+ if (typeof clone['type'] !== 'string') {
92
+ return;
93
+ }
94
+ return clone;
95
+ }
96
+ /**
97
+ * Converts ChatRecord messages to UI history items for display.
98
+ *
99
+ * This function transforms the raw ChatRecords into a format suitable
100
+ * for the CLI's HistoryItemDisplay component.
101
+ *
102
+ * @param conversation The conversation record from a resumed session
103
+ * @param config The config object for accessing tool registry
104
+ * @returns Array of history items for UI display
105
+ */
106
+ function convertToHistoryItems(conversation, config) {
107
+ const items = [];
108
+ // Track pending tool calls for grouping with results
109
+ const pendingToolCalls = new Map();
110
+ let currentToolGroup = [];
111
+ for (const record of conversation.messages) {
112
+ if (record.type === 'system') {
113
+ if (record.subtype === 'slash_command') {
114
+ // Flush any pending tool group to avoid mixing contexts.
115
+ if (currentToolGroup.length > 0) {
116
+ items.push({
117
+ type: 'tool_group',
118
+ tools: [...currentToolGroup],
119
+ });
120
+ currentToolGroup = [];
121
+ }
122
+ const payload = record.systemPayload;
123
+ if (!payload)
124
+ continue;
125
+ if (payload.phase === 'invocation' && payload.rawCommand) {
126
+ items.push({ type: 'user', text: payload.rawCommand });
127
+ }
128
+ if (payload.phase === 'result') {
129
+ const outputs = payload.outputHistoryItems ?? [];
130
+ for (const raw of outputs) {
131
+ const restored = restoreHistoryItem(raw);
132
+ if (restored) {
133
+ items.push(restored);
134
+ }
135
+ }
136
+ }
137
+ }
138
+ continue;
139
+ }
140
+ switch (record.type) {
141
+ case 'user': {
142
+ // Flush any pending tool group before user message
143
+ if (currentToolGroup.length > 0) {
144
+ items.push({
145
+ type: 'tool_group',
146
+ tools: [...currentToolGroup],
147
+ });
148
+ currentToolGroup = [];
149
+ }
150
+ const text = extractTextFromParts(record.message?.parts);
151
+ if (text) {
152
+ items.push({ type: 'user', text });
153
+ }
154
+ break;
155
+ }
156
+ case 'assistant': {
157
+ const parts = record.message?.parts;
158
+ // Extract thought content
159
+ const thoughtText = !config
160
+ .getContentGenerator()
161
+ .useSummarizedThinking()
162
+ ? extractThoughtTextFromParts(parts)
163
+ : '';
164
+ // Extract text content (non-function-call, non-thought)
165
+ const text = extractTextFromParts(parts);
166
+ // Extract function calls
167
+ const functionCalls = extractFunctionCalls(parts);
168
+ // If there's thought content, add it as a gemini_thought message
169
+ if (thoughtText) {
170
+ // Flush any pending tool group before thought
171
+ if (currentToolGroup.length > 0) {
172
+ items.push({
173
+ type: 'tool_group',
174
+ tools: [...currentToolGroup],
175
+ });
176
+ currentToolGroup = [];
177
+ }
178
+ items.push({ type: 'gemini_thought', text: thoughtText });
179
+ }
180
+ // If there's text content, add it as a gemini message
181
+ if (text) {
182
+ // Flush any pending tool group before text
183
+ if (currentToolGroup.length > 0) {
184
+ items.push({
185
+ type: 'tool_group',
186
+ tools: [...currentToolGroup],
187
+ });
188
+ currentToolGroup = [];
189
+ }
190
+ items.push({ type: 'gemini', text });
191
+ }
192
+ // Track function calls for pairing with results
193
+ for (const fc of functionCalls) {
194
+ const tool = getTool(config, fc.name);
195
+ pendingToolCalls.set(fc.id, { name: fc.name, args: fc.args });
196
+ // Add placeholder tool call to current group
197
+ currentToolGroup.push({
198
+ callId: fc.id,
199
+ name: tool?.displayName || fc.name,
200
+ description: tool ? formatToolDescription(tool, fc.args) : '',
201
+ resultDisplay: undefined,
202
+ status: ToolCallStatus.Success, // Will be updated by tool_result
203
+ confirmationDetails: undefined,
204
+ });
205
+ }
206
+ break;
207
+ }
208
+ case 'tool_result': {
209
+ // Update the corresponding tool call in the current group
210
+ if (record.toolCallResult) {
211
+ const callId = record.toolCallResult.callId;
212
+ const toolCall = currentToolGroup.find((t) => t.callId === callId);
213
+ if (toolCall) {
214
+ // Preserve the resultDisplay as-is - it can be a string or structured object
215
+ const rawDisplay = record.toolCallResult.resultDisplay;
216
+ toolCall.resultDisplay = rawDisplay;
217
+ // Check if status exists and use it
218
+ const rawStatus = record.toolCallResult['status'];
219
+ toolCall.status =
220
+ rawStatus === 'error'
221
+ ? ToolCallStatus.Error
222
+ : ToolCallStatus.Success;
223
+ }
224
+ pendingToolCalls.delete(callId || '');
225
+ }
226
+ break;
227
+ }
228
+ default:
229
+ // Skip unknown record types
230
+ break;
231
+ }
232
+ }
233
+ // Flush any remaining tool group
234
+ if (currentToolGroup.length > 0) {
235
+ items.push({
236
+ type: 'tool_group',
237
+ tools: currentToolGroup,
238
+ });
239
+ }
240
+ return items;
241
+ }
242
+ /**
243
+ * Builds the complete UI history items for a resumed session.
244
+ *
245
+ * This function takes the resumed session data, converts it to UI history format,
246
+ * and assigns unique IDs to each item for use with loadHistory.
247
+ *
248
+ * @param sessionData The resumed session data from SessionService
249
+ * @param config The config object for accessing tool registry
250
+ * @param baseTimestamp Base timestamp for generating unique IDs
251
+ * @returns Array of HistoryItem with proper IDs
252
+ */
253
+ export function buildResumedHistoryItems(sessionData, config, baseTimestamp = Date.now()) {
254
+ const items = [];
255
+ let idCounter = 1;
256
+ const getNextId = () => baseTimestamp + idCounter++;
257
+ // Convert conversation directly to history items
258
+ const historyItems = convertToHistoryItems(sessionData.conversation, config);
259
+ for (const item of historyItems) {
260
+ items.push({
261
+ ...item,
262
+ id: getNextId(),
263
+ });
264
+ }
265
+ return items;
266
+ }
267
+ //# sourceMappingURL=resumeHistoryUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resumeHistoryUtils.js","sourceRoot":"","sources":["../../../../src/ui/utils/resumeHistoryUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,SAAS,oBAAoB,CAAC,KAAyB;IACrD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,MAAM,IAAI,IAAI,I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E,CAAC;IAE5D,iDAAiD;IACjD,MAAM,YAAY,GAAG,qBAAqB,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC7E,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC;YACT,GAAG,IAAI;YACP,EAAE,EAAE,SAAS,EAAE;SACD,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Code
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export {};
@@ -0,0 +1,253 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Code
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
7
+ import { buildResumedHistoryItems } from './resumeHistoryUtils.js';
8
+ import { ToolCallStatus } from '../types.js';
9
+ const makeConfig = (tools) => ({
10
+ getToolRegistry: () => ({
11
+ getTool: (name) => tools[name],
12
+ }),
13
+ getContentGenerator: () => ({
14
+ // Default to showing full thinking content during resume unless explicitly
15
+ // summarized; tests don't care about summarized thinking behavior.
16
+ useSummarizedThinking: () => false,
17
+ }),
18
+ });
19
+ describe('resumeHistoryUtils', () => {
20
+ let mockTool;
21
+ beforeEach(() => {
22
+ const mockInvocation = {
23
+ getDescription: () => 'Mocked description',
24
+ };
25
+ mockTool = {
26
+ name: 'replace',
27
+ displayName: 'Replace',
28
+ description: 'Replace text',
29
+ build: vi.fn().mockReturnValue(mockInvocation),
30
+ };
31
+ });
32
+ it('converts conversation into history items with incremental ids', () => {
33
+ const conversation = {
34
+ messages: [
35
+ {
36
+ type: 'user',
37
+ message: { parts: [{ text: 'Hello' }] },
38
+ },
39
+ {
40
+ type: 'assistant',
41
+ message: {
42
+ parts: [
43
+ { text: 'Hi there' },
44
+ {
45
+ functionCall: {
46
+ id: 'call-1',
47
+ name: 'replace',
48
+ args: { old: 'a', new: 'b' },
49
+ },
50
+ },
51
+ ],
52
+ },
53
+ },
54
+ {
55
+ type: 'tool_result',
56
+ toolCallResult: {
57
+ callId: 'call-1',
58
+ resultDisplay: 'All set',
59
+ status: 'success',
60
+ },
61
+ },
62
+ ],
63
+ };
64
+ const session = {
65
+ conversation,
66
+ };
67
+ const baseTimestamp = 1_000;
68
+ const items = buildResumedHistoryItems(session, makeConfig({ replace: mockTool }), baseTimestamp);
69
+ expect(items).toEqual([
70
+ { id: baseTimestamp + 1, type: 'user', text: 'Hello' },
71
+ { id: baseTimestamp + 2, type: 'gemini', text: 'Hi there' },
72
+ {
73
+ id: baseTimestamp + 3,
74
+ type: 'tool_group',
75
+ tools: [
76
+ {
77
+ callId: 'call-1',
78
+ name: 'Replace',
79
+ description: 'Mocked description',
80
+ resultDisplay: 'All set',
81
+ status: ToolCallStatus.Success,
82
+ confirmationDetails: undefined,
83
+ },
84
+ ],
85
+ },
86
+ ]);
87
+ });
88
+ it('marks tool results as error, captures thought text, and falls back when tool is missing', () => {
89
+ const conversation = {
90
+ messages: [
91
+ {
92
+ type: 'assistant',
93
+ message: {
94
+ parts: [
95
+ {
96
+ text: 'should be skipped',
97
+ thought: { subject: 'hidden' },
98
+ },
99
+ { text: 'visible text' },
100
+ {
101
+ functionCall: {
102
+ id: 'missing-call',
103
+ name: 'unknown_tool',
104
+ args: { foo: 'bar' },
105
+ },
106
+ },
107
+ ],
108
+ },
109
+ },
110
+ {
111
+ type: 'tool_result',
112
+ toolCallResult: {
113
+ callId: 'missing-call',
114
+ resultDisplay: { summary: 'failure' },
115
+ status: 'error',
116
+ },
117
+ },
118
+ ],
119
+ };
120
+ const session = {
121
+ conversation,
122
+ };
123
+ const items = buildResumedHistoryItems(session, makeConfig({}));
124
+ expect(items).toEqual([
125
+ {
126
+ id: expect.any(Number),
127
+ type: 'gemini_thought',
128
+ text: 'should be skipped',
129
+ },
130
+ { id: expect.any(Number), type: 'gemini', text: 'visible text' },
131
+ {
132
+ id: expect.any(Number),
133
+ type: 'tool_group',
134
+ tools: [
135
+ {
136
+ callId: 'missing-call',
137
+ name: 'unknown_tool',
138
+ description: '',
139
+ resultDisplay: { summary: 'failure' },
140
+ status: ToolCallStatus.Error,
141
+ confirmationDetails: undefined,
142
+ },
143
+ ],
144
+ },
145
+ ]);
146
+ });
147
+ it('flushes pending tool groups before subsequent user messages', () => {
148
+ const conversation = {
149
+ messages: [
150
+ {
151
+ type: 'assistant',
152
+ message: {
153
+ parts: [
154
+ {
155
+ functionCall: {
156
+ id: 'call-2',
157
+ name: 'replace',
158
+ args: { target: 'a' },
159
+ },
160
+ },
161
+ ],
162
+ },
163
+ },
164
+ {
165
+ type: 'user',
166
+ message: { parts: [{ text: 'next user message' }] },
167
+ },
168
+ ],
169
+ };
170
+ const session = {
171
+ conversation,
172
+ };
173
+ const items = buildResumedHistoryItems(session, makeConfig({ replace: mockTool }), 10);
174
+ expect(items[0]).toEqual({
175
+ id: 11,
176
+ type: 'tool_group',
177
+ tools: [
178
+ {
179
+ callId: 'call-2',
180
+ name: 'Replace',
181
+ description: 'Mocked description',
182
+ resultDisplay: undefined,
183
+ status: ToolCallStatus.Success,
184
+ confirmationDetails: undefined,
185
+ },
186
+ ],
187
+ });
188
+ expect(items[1]).toEqual({
189
+ id: 12,
190
+ type: 'user',
191
+ text: 'next user message',
192
+ });
193
+ });
194
+ it('replays slash command history items (e.g., /about) on resume', () => {
195
+ const conversation = {
196
+ messages: [
197
+ {
198
+ type: 'system',
199
+ subtype: 'slash_command',
200
+ systemPayload: {
201
+ phase: 'invocation',
202
+ rawCommand: '/about',
203
+ },
204
+ },
205
+ {
206
+ type: 'system',
207
+ subtype: 'slash_command',
208
+ systemPayload: {
209
+ phase: 'result',
210
+ rawCommand: '/about',
211
+ outputHistoryItems: [
212
+ {
213
+ type: 'about',
214
+ systemInfo: {
215
+ cliVersion: '1.2.3',
216
+ osPlatform: 'darwin',
217
+ osArch: 'arm64',
218
+ osRelease: 'test',
219
+ nodeVersion: '20.x',
220
+ npmVersion: '10.x',
221
+ sandboxEnv: 'none',
222
+ modelVersion: 'qwen',
223
+ selectedAuthType: 'none',
224
+ ideClient: 'none',
225
+ sessionId: 'abc',
226
+ memoryUsage: '0 MB',
227
+ },
228
+ },
229
+ ],
230
+ },
231
+ },
232
+ {
233
+ type: 'assistant',
234
+ message: { parts: [{ text: 'Follow-up' }] },
235
+ },
236
+ ],
237
+ };
238
+ const session = {
239
+ conversation,
240
+ };
241
+ const items = buildResumedHistoryItems(session, makeConfig({}), 5);
242
+ expect(items).toEqual([
243
+ { id: 6, type: 'user', text: '/about' },
244
+ {
245
+ id: 7,
246
+ type: 'about',
247
+ systemInfo: expect.objectContaining({ cliVersion: '1.2.3' }),
248
+ },
249
+ { id: 8, type: 'gemini', text: 'Follow-up' },
250
+ ]);
251
+ });
252
+ });
253
+ //# sourceMappingURL=resumeHistoryUtils.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resumeHistoryUtils.test.js","sourceRoot":"","sources":["../../../../src/ui/utils/resumeHistoryUtils.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAS7C,MAAM,UAAU,GAAG,CAAC,KAAyC,EAAE,EAAE,CAC/D,CAAC;IACC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;QACtB,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;KACvC,CAAC;IACF,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;QAC1B,2EAA2E;QAC3E,mEAAmE;QACnE,qBAAqB,EAAE,GAAG,EAAE,CAAC,KAAK;KACnC,CAAC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UAAU,EAAE,MAAM;oCAClB,UAAU,EAAE,MAAM;oCAClB,YAAY,EAAE,MAAM;oCACpB,gBAAgB,EAAE,MAAM;oCACxB,SAAS,EAAE,MAAM;oCACjB,SAAS,EAAE,KAAK;oCAChB,WAAW,EAAE,MAAM;iCACpB;6BACF;yBACF;qBACF;iBACF;gBACD;oBACE,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAU,CAAC,EAAE;iBACpD;aACF;SAC+B,CAAC;QAEnC,MAAM,OAAO,GAAuB;YAClC,YAAY;SACS,CAAC;QAExB,MAAM,KAAK,GAAG,wBAAwB,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAEnE,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YACpB,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;YACvC;gBACE,EAAE,EAAE,CAAC;gBACL,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;aAC7D;YACD,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE;SAC7C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Code
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { SessionListItem } from '@umsai/ums-code-core';
7
+ /**
8
+ * State for managing loaded sessions in the session picker.
9
+ */
10
+ export interface SessionState {
11
+ sessions: SessionListItem[];
12
+ hasMore: boolean;
13
+ nextCursor?: number;
14
+ }
15
+ /**
16
+ * Page size for loading sessions.
17
+ */
18
+ export declare const SESSION_PAGE_SIZE = 20;
19
+ /**
20
+ * Truncates text to fit within a given width, adding ellipsis if needed.
21
+ */
22
+ export declare function truncateText(text: string, maxWidth: number): string;
23
+ /**
24
+ * Filters sessions optionally by branch.
25
+ */
26
+ export declare function filterSessions(sessions: SessionListItem[], filterByBranch: boolean, currentBranch?: string): SessionListItem[];
27
+ /**
28
+ * Formats message count for display with proper pluralization.
29
+ */
30
+ export declare function formatMessageCount(count: number): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Code
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Page size for loading sessions.
8
+ */
9
+ export const SESSION_PAGE_SIZE = 20;
10
+ /**
11
+ * Truncates text to fit within a given width, adding ellipsis if needed.
12
+ */
13
+ export function truncateText(text, maxWidth) {
14
+ const firstLine = text.split(/\r?\n/, 1)[0];
15
+ if (firstLine.length <= maxWidth) {
16
+ return firstLine;
17
+ }
18
+ if (maxWidth <= 3) {
19
+ return firstLine.slice(0, maxWidth);
20
+ }
21
+ return firstLine.slice(0, maxWidth - 3) + '...';
22
+ }
23
+ /**
24
+ * Filters sessions optionally by branch.
25
+ */
26
+ export function filterSessions(sessions, filterByBranch, currentBranch) {
27
+ return sessions.filter((session) => {
28
+ // Apply branch filter if enabled
29
+ if (filterByBranch && currentBranch) {
30
+ return session.gitBranch === currentBranch;
31
+ }
32
+ return true;
33
+ });
34
+ }
35
+ /**
36
+ * Formats message count for display with proper pluralization.
37
+ */
38
+ export function formatMessageCount(count) {
39
+ return count === 1 ? '1 message' : `${count} messages`;
40
+ }
41
+ //# sourceMappingURL=sessionPickerUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionPickerUtils.js","sourceRoot":"","sources":["../../../../src/ui/utils/sessionPickerUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,QAAgB;IACzD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,IAAI,SAAS,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,QAA2B,EAC3B,cAAuB,EACvB,aAAsB;IAEtB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;QACjC,iCAAiC;QACjC,IAAI,cAAc,IAAI,aAAa,EAAE,CAAC;YACpC,OAAO,OAAO,CAAC,SAAS,KAAK,aAAa,CAAC;QAC7C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,KAAK,WAAW,CAAC;AACzD,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Code
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Code
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, it, expect } from 'vitest';
7
+ import { truncateText } from './sessionPickerUtils.js';
8
+ describe('sessionPickerUtils', () => {
9
+ describe('truncateText', () => {
10
+ it('returns the original text when it fits and has no newline', () => {
11
+ expect(truncateText('hello', 10)).toBe('hello');
12
+ });
13
+ it('truncates long text with ellipsis', () => {
14
+ expect(truncateText('hello world', 5)).toBe('he...');
15
+ });
16
+ it('truncates without ellipsis when maxWidth <= 3', () => {
17
+ expect(truncateText('hello', 3)).toBe('hel');
18
+ expect(truncateText('hello', 2)).toBe('he');
19
+ });
20
+ it('breaks at newline and returns only the first line', () => {
21
+ expect(truncateText('hello\nworld', 20)).toBe('hello');
22
+ expect(truncateText('hello\r\nworld', 20)).toBe('hello');
23
+ });
24
+ it('breaks at newline and still truncates the first line when needed', () => {
25
+ expect(truncateText('hello\nworld', 2)).toBe('he');
26
+ expect(truncateText('hello\nworld', 3)).toBe('hel');
27
+ expect(truncateText('hello\nworld', 4)).toBe('h...');
28
+ });
29
+ it('does not add ellipsis when the string ends at a newline', () => {
30
+ expect(truncateText('hello\n', 20)).toBe('hello');
31
+ expect(truncateText('hello\r\n', 20)).toBe('hello');
32
+ });
33
+ it('returns only the first line even if there are multiple line breaks', () => {
34
+ expect(truncateText('hello\n\nworld', 20)).toBe('hello');
35
+ });
36
+ });
37
+ });
38
+ //# sourceMappingURL=sessionPickerUtils.test.js.map