@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.
- package/dist/package.json +6 -6
- package/dist/src/{zed-integration → acp-integration}/acp.d.ts +13 -0
- package/dist/src/{zed-integration → acp-integration}/acp.js +32 -0
- package/dist/src/acp-integration/acp.js.map +1 -0
- package/dist/src/acp-integration/acpAgent.d.ts +10 -0
- package/dist/src/acp-integration/acpAgent.js +264 -0
- package/dist/src/acp-integration/acpAgent.js.map +1 -0
- package/dist/src/{zed-integration → acp-integration}/schema.d.ts +2235 -905
- package/dist/src/{zed-integration → acp-integration}/schema.js +100 -2
- package/dist/src/acp-integration/schema.js.map +1 -0
- package/dist/src/{zed-integration/fileSystemService.d.ts → acp-integration/service/filesystem.d.ts} +1 -1
- package/dist/src/{zed-integration/fileSystemService.js → acp-integration/service/filesystem.js} +14 -1
- package/dist/src/acp-integration/service/filesystem.js.map +1 -0
- package/dist/src/{ui/hooks/useQuotaAndFallback.test.d.ts → acp-integration/service/filesystem.test.d.ts} +1 -1
- package/dist/src/acp-integration/service/filesystem.test.js +39 -0
- package/dist/src/acp-integration/service/filesystem.test.js.map +1 -0
- package/dist/src/acp-integration/session/HistoryReplayer.d.ts +51 -0
- package/dist/src/acp-integration/session/HistoryReplayer.js +164 -0
- package/dist/src/acp-integration/session/HistoryReplayer.js.map +1 -0
- package/dist/src/acp-integration/session/HistoryReplayer.test.d.ts +6 -0
- package/dist/src/acp-integration/session/HistoryReplayer.test.js +374 -0
- package/dist/src/acp-integration/session/HistoryReplayer.test.js.map +1 -0
- package/dist/src/acp-integration/session/Session.d.ts +61 -0
- package/dist/src/acp-integration/session/Session.js +839 -0
- package/dist/src/acp-integration/session/Session.js.map +1 -0
- package/dist/src/acp-integration/session/SubAgentTracker.d.ts +51 -0
- package/dist/src/acp-integration/session/SubAgentTracker.js +257 -0
- package/dist/src/acp-integration/session/SubAgentTracker.js.map +1 -0
- package/dist/src/acp-integration/session/SubAgentTracker.test.d.ts +6 -0
- package/dist/src/acp-integration/session/SubAgentTracker.test.js +369 -0
- package/dist/src/acp-integration/session/SubAgentTracker.test.js.map +1 -0
- package/dist/src/acp-integration/session/emitters/BaseEmitter.d.ts +27 -0
- package/dist/src/acp-integration/session/emitters/BaseEmitter.js +34 -0
- package/dist/src/acp-integration/session/emitters/BaseEmitter.js.map +1 -0
- package/dist/src/acp-integration/session/emitters/MessageEmitter.d.ts +41 -0
- package/dist/src/acp-integration/session/emitters/MessageEmitter.js +77 -0
- package/dist/src/acp-integration/session/emitters/MessageEmitter.js.map +1 -0
- package/dist/src/acp-integration/session/emitters/MessageEmitter.test.d.ts +6 -0
- package/dist/src/acp-integration/session/emitters/MessageEmitter.test.js +174 -0
- package/dist/src/acp-integration/session/emitters/MessageEmitter.test.js.map +1 -0
- package/dist/src/acp-integration/session/emitters/PlanEmitter.d.ts +39 -0
- package/dist/src/acp-integration/session/emitters/PlanEmitter.js +83 -0
- package/dist/src/acp-integration/session/emitters/PlanEmitter.js.map +1 -0
- package/dist/src/acp-integration/session/emitters/PlanEmitter.test.d.ts +6 -0
- package/dist/src/acp-integration/session/emitters/PlanEmitter.test.js +176 -0
- package/dist/src/acp-integration/session/emitters/PlanEmitter.test.js.map +1 -0
- package/dist/src/acp-integration/session/emitters/ToolCallEmitter.d.ts +80 -0
- package/dist/src/acp-integration/session/emitters/ToolCallEmitter.js +248 -0
- package/dist/src/acp-integration/session/emitters/ToolCallEmitter.js.map +1 -0
- package/dist/src/acp-integration/session/emitters/ToolCallEmitter.test.d.ts +6 -0
- package/dist/src/acp-integration/session/emitters/ToolCallEmitter.test.js +561 -0
- package/dist/src/acp-integration/session/emitters/ToolCallEmitter.test.js.map +1 -0
- package/dist/src/acp-integration/session/emitters/index.d.ts +9 -0
- package/dist/src/acp-integration/session/emitters/index.js +10 -0
- package/dist/src/acp-integration/session/emitters/index.js.map +1 -0
- package/dist/src/acp-integration/session/index.d.ts +24 -0
- package/dist/src/acp-integration/session/index.js +16 -0
- package/dist/src/acp-integration/session/index.js.map +1 -0
- package/dist/src/acp-integration/session/types.d.ts +71 -0
- package/dist/src/acp-integration/session/types.js +7 -0
- package/dist/src/acp-integration/session/types.js.map +1 -0
- package/dist/src/commandMode.d.ts +11 -0
- package/dist/src/commandMode.js +238 -0
- package/dist/src/commandMode.js.map +1 -0
- package/dist/src/config/auth.d.ts +1 -0
- package/dist/src/config/auth.js +29 -0
- package/dist/src/config/auth.js.map +1 -1
- package/dist/src/config/config.d.ts +19 -3
- package/dist/src/config/config.js +175 -24
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/extension.js +0 -2
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/extensions/update.test.js +9 -0
- package/dist/src/config/extensions/update.test.js.map +1 -1
- package/dist/src/config/settingsSchema.d.ts +53 -2
- package/dist/src/config/settingsSchema.js +46 -2
- package/dist/src/config/settingsSchema.js.map +1 -1
- package/dist/src/core/auth.d.ts +1 -1
- package/dist/src/core/auth.js +3 -2
- package/dist/src/core/auth.js.map +1 -1
- package/dist/src/core/initializer.js +3 -0
- package/dist/src/core/initializer.js.map +1 -1
- package/dist/src/gemini.js +75 -35
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +37 -4
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +3 -3
- package/dist/src/generated/git-commit.js +3 -3
- package/dist/src/i18n/index.d.ts +10 -2
- package/dist/src/i18n/index.js +26 -1
- package/dist/src/i18n/index.js.map +1 -1
- package/dist/src/i18n/languages.d.ts +20 -0
- package/dist/src/i18n/languages.js +36 -0
- package/dist/src/i18n/languages.js.map +1 -0
- package/dist/src/i18n/locales/de.js +1073 -0
- package/dist/src/i18n/locales/en.js +121 -175
- package/dist/src/i18n/locales/ru.js +1095 -0
- package/dist/src/i18n/locales/zh.js +52 -174
- package/dist/src/nonInteractive/control/ControlDispatcher.d.ts +24 -1
- package/dist/src/nonInteractive/control/ControlDispatcher.js +46 -17
- package/dist/src/nonInteractive/control/ControlDispatcher.js.map +1 -1
- package/dist/src/nonInteractive/control/ControlService.d.ts +2 -1
- package/dist/src/nonInteractive/control/ControlService.js +22 -37
- package/dist/src/nonInteractive/control/ControlService.js.map +1 -1
- package/dist/src/nonInteractive/control/controllers/baseController.d.ts +2 -1
- package/dist/src/nonInteractive/control/controllers/baseController.js +38 -5
- package/dist/src/nonInteractive/control/controllers/baseController.js.map +1 -1
- package/dist/src/nonInteractive/control/controllers/permissionController.d.ts +1 -22
- package/dist/src/nonInteractive/control/controllers/permissionController.js +38 -38
- package/dist/src/nonInteractive/control/controllers/permissionController.js.map +1 -1
- package/dist/src/nonInteractive/control/controllers/sdkMcpController.d.ts +54 -0
- package/dist/src/nonInteractive/control/controllers/sdkMcpController.js +84 -0
- package/dist/src/nonInteractive/control/controllers/sdkMcpController.js.map +1 -0
- package/dist/src/nonInteractive/control/controllers/systemController.d.ts +16 -6
- package/dist/src/nonInteractive/control/controllers/systemController.js +184 -44
- package/dist/src/nonInteractive/control/controllers/systemController.js.map +1 -1
- package/dist/src/nonInteractive/control/types/serviceAPIs.d.ts +1 -16
- package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.d.ts +11 -0
- package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.js +64 -5
- package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.js.map +1 -1
- package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.js +40 -0
- package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.js.map +1 -1
- package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.js +50 -0
- package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.js.map +1 -1
- package/dist/src/nonInteractive/session.d.ts +0 -16
- package/dist/src/nonInteractive/session.js +317 -321
- package/dist/src/nonInteractive/session.js.map +1 -1
- package/dist/src/nonInteractive/session.test.js +6 -0
- package/dist/src/nonInteractive/session.test.js.map +1 -1
- package/dist/src/nonInteractive/types.d.ts +57 -3
- package/dist/src/nonInteractive/types.js +0 -1
- package/dist/src/nonInteractive/types.js.map +1 -1
- package/dist/src/nonInteractiveCli.js +121 -56
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/nonInteractiveCliCommands.d.ts +48 -9
- package/dist/src/nonInteractiveCliCommands.js +180 -64
- package/dist/src/nonInteractiveCliCommands.js.map +1 -1
- package/dist/src/nonInteractiveCliCommands.test.d.ts +6 -0
- package/dist/src/nonInteractiveCliCommands.test.js +157 -0
- package/dist/src/nonInteractiveCliCommands.test.js.map +1 -0
- package/dist/src/services/BuiltinCommandLoader.js +7 -6
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.test.js +0 -3
- package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -1
- package/dist/src/services/McpPromptLoader.js +4 -2
- package/dist/src/services/McpPromptLoader.js.map +1 -1
- package/dist/src/services/McpPromptLoader.test.js +1 -1
- package/dist/src/services/McpPromptLoader.test.js.map +1 -1
- package/dist/src/test-utils/mockCommandContext.js +11 -2
- package/dist/src/test-utils/mockCommandContext.js.map +1 -1
- package/dist/src/ui/AppContainer.js +62 -56
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/AppContainer.test.js +0 -46
- package/dist/src/ui/AppContainer.test.js.map +1 -1
- package/dist/src/ui/auth/AuthDialog.test.js +4 -4
- package/dist/src/ui/auth/AuthDialog.test.js.map +1 -1
- package/dist/src/ui/auth/useAuth.js +31 -4
- package/dist/src/ui/auth/useAuth.js.map +1 -1
- package/dist/src/ui/commands/approvalModeCommand.js +53 -4
- package/dist/src/ui/commands/approvalModeCommand.js.map +1 -1
- package/dist/src/ui/commands/approvalModeCommand.test.js +72 -10
- package/dist/src/ui/commands/approvalModeCommand.test.js.map +1 -1
- package/dist/src/ui/commands/clearCommand.js +22 -10
- package/dist/src/ui/commands/clearCommand.js.map +1 -1
- package/dist/src/ui/commands/compressCommand.js +86 -16
- package/dist/src/ui/commands/compressCommand.js.map +1 -1
- package/dist/src/ui/commands/languageCommand.d.ts +6 -1
- package/dist/src/ui/commands/languageCommand.js +162 -183
- package/dist/src/ui/commands/languageCommand.js.map +1 -1
- package/dist/src/ui/commands/languageCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/languageCommand.test.js +558 -0
- package/dist/src/ui/commands/languageCommand.test.js.map +1 -0
- package/dist/src/ui/commands/modelCommand.js +4 -2
- package/dist/src/ui/commands/modelCommand.js.map +1 -1
- package/dist/src/ui/commands/quitCommand.d.ts +0 -1
- package/dist/src/ui/commands/quitCommand.js +0 -27
- package/dist/src/ui/commands/quitCommand.js.map +1 -1
- package/dist/src/ui/commands/restoreCommand.js +1 -1
- package/dist/src/ui/commands/restoreCommand.js.map +1 -1
- package/dist/src/ui/commands/resumeCommand.d.ts +7 -0
- package/dist/src/ui/commands/resumeCommand.js +19 -0
- package/dist/src/ui/commands/resumeCommand.js.map +1 -0
- package/dist/src/ui/commands/resumeCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/resumeCommand.test.js +32 -0
- package/dist/src/ui/commands/resumeCommand.test.js.map +1 -0
- package/dist/src/ui/commands/reviewCommand.d.ts +9 -0
- package/dist/src/ui/commands/reviewCommand.js +2046 -0
- package/dist/src/ui/commands/reviewCommand.js.map +1 -0
- package/dist/src/ui/commands/reviewCommand.test.js +600 -0
- package/dist/src/ui/commands/reviewCommand.test.js.map +1 -0
- package/dist/src/ui/commands/setupGithubCommand.js +11 -10
- package/dist/src/ui/commands/setupGithubCommand.js.map +1 -1
- package/dist/src/ui/commands/setupGithubCommand.test.js +14 -14
- package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -1
- package/dist/src/ui/commands/summaryCommand.js +129 -42
- package/dist/src/ui/commands/summaryCommand.js.map +1 -1
- package/dist/src/ui/commands/types.d.ts +24 -10
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/commands/ums/unittestCommand.d.ts +9 -0
- package/dist/src/ui/commands/ums/unittestCommand.js +387 -0
- package/dist/src/ui/commands/ums/unittestCommand.js.map +1 -0
- package/dist/src/ui/components/Composer.test.js +1 -2
- package/dist/src/ui/components/Composer.test.js.map +1 -1
- package/dist/src/ui/components/ContextUsageDisplay.d.ts +3 -2
- package/dist/src/ui/components/ContextUsageDisplay.js +8 -2
- package/dist/src/ui/components/ContextUsageDisplay.js.map +1 -1
- package/dist/src/ui/components/DialogManager.js +7 -23
- package/dist/src/ui/components/DialogManager.js.map +1 -1
- package/dist/src/ui/components/Footer.js +2 -3
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Help.js +13 -2
- package/dist/src/ui/components/Help.js.map +1 -1
- package/dist/src/ui/components/Help.test.js +6 -0
- package/dist/src/ui/components/Help.test.js.map +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.js +3 -1
- package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.test.js +5 -2
- package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.js +6 -4
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/ModelDialog.d.ts +3 -1
- package/dist/src/ui/components/ModelDialog.js +25 -5
- package/dist/src/ui/components/ModelDialog.js.map +1 -1
- package/dist/src/ui/components/OpenAIKeyPrompt.d.ts +3 -0
- package/dist/src/ui/components/OpenAIKeyPrompt.js +1 -0
- package/dist/src/ui/components/OpenAIKeyPrompt.js.map +1 -1
- package/dist/src/ui/components/PermissionsModifyTrustDialog.js +1 -1
- package/dist/src/ui/components/PermissionsModifyTrustDialog.js.map +1 -1
- package/dist/src/ui/components/SessionPicker.d.ts +18 -0
- package/dist/src/ui/components/SessionPicker.js +69 -0
- package/dist/src/ui/components/SessionPicker.js.map +1 -0
- package/dist/src/ui/components/SessionSummaryDisplay.js +14 -2
- package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.test.js +2 -2
- package/dist/src/ui/components/StandaloneSessionPicker.d.ts +10 -0
- package/dist/src/ui/components/StandaloneSessionPicker.js +78 -0
- package/dist/src/ui/components/StandaloneSessionPicker.js.map +1 -0
- package/dist/src/ui/components/StandaloneSessionPicker.test.d.ts +6 -0
- package/dist/src/ui/components/StandaloneSessionPicker.test.js +410 -0
- package/dist/src/ui/components/StandaloneSessionPicker.test.js.map +1 -0
- package/dist/src/ui/components/SuggestionsDisplay.js +3 -2
- package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
- package/dist/src/ui/components/messages/GeminiThoughtMessage.d.ts +18 -0
- package/dist/src/ui/components/messages/GeminiThoughtMessage.js +14 -0
- package/dist/src/ui/components/messages/GeminiThoughtMessage.js.map +1 -0
- package/dist/src/ui/components/messages/GeminiThoughtMessageContent.d.ts +18 -0
- package/dist/src/ui/components/messages/GeminiThoughtMessageContent.js +14 -0
- package/dist/src/ui/components/messages/GeminiThoughtMessageContent.js.map +1 -0
- package/dist/src/ui/components/subagents/manage/AgentEditStep.js +4 -1
- package/dist/src/ui/components/subagents/manage/AgentEditStep.js.map +1 -1
- package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js +2 -2
- package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js.map +1 -1
- package/dist/src/ui/components/ums/UMSKeyPrompt.d.ts +1 -1
- package/dist/src/ui/components/ums/UMSKeyPrompt.js +24 -4
- package/dist/src/ui/components/ums/UMSKeyPrompt.js.map +1 -1
- package/dist/src/ui/components/ums/umsStartupWarnings.d.ts +6 -0
- package/dist/src/ui/components/ums/umsStartupWarnings.js +47 -0
- package/dist/src/ui/components/ums/umsStartupWarnings.js.map +1 -0
- package/dist/src/ui/contexts/SessionContext.d.ts +2 -0
- package/dist/src/ui/contexts/SessionContext.js +18 -10
- package/dist/src/ui/contexts/SessionContext.js.map +1 -1
- package/dist/src/ui/contexts/UIActionsContext.d.ts +3 -1
- package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
- package/dist/src/ui/contexts/UIStateContext.d.ts +3 -11
- package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +3 -8
- package/dist/src/ui/hooks/slashCommandProcessor.js +77 -101
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useAttentionNotifications.d.ts +3 -1
- package/dist/src/ui/hooks/useAttentionNotifications.js +10 -5
- package/dist/src/ui/hooks/useAttentionNotifications.js.map +1 -1
- package/dist/src/ui/hooks/useAttentionNotifications.test.js +39 -2
- package/dist/src/ui/hooks/useAttentionNotifications.test.js.map +1 -1
- package/dist/src/ui/hooks/useDialogClose.d.ts +0 -3
- package/dist/src/ui/hooks/useDialogClose.js +0 -2
- package/dist/src/ui/hooks/useDialogClose.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.js +87 -12
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useLoadingIndicator.test.js +11 -6
- package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useLogger.d.ts +1 -1
- package/dist/src/ui/hooks/useLogger.js +6 -3
- package/dist/src/ui/hooks/useLogger.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.js +12 -136
- package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
- package/dist/src/ui/hooks/useQwenAuth.test.js +1 -1
- package/dist/src/ui/hooks/useQwenAuth.test.js.map +1 -1
- package/dist/src/ui/hooks/useReactToolScheduler.js +2 -2
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
- package/dist/src/ui/hooks/useResumeCommand.d.ts +20 -0
- package/dist/src/ui/hooks/useResumeCommand.js +49 -0
- package/dist/src/ui/hooks/useResumeCommand.js.map +1 -0
- package/dist/src/ui/hooks/useResumeCommand.test.d.ts +6 -0
- package/dist/src/ui/hooks/useResumeCommand.test.js +144 -0
- package/dist/src/ui/hooks/useResumeCommand.test.js.map +1 -0
- package/dist/src/ui/hooks/useSessionPicker.d.ts +36 -0
- package/dist/src/ui/hooks/useSessionPicker.js +189 -0
- package/dist/src/ui/hooks/useSessionPicker.js.map +1 -0
- package/dist/src/ui/hooks/useSlashCompletion.js +9 -1
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.test.js +36 -31
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +2 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/models/availableModels.d.ts +9 -2
- package/dist/src/ui/models/availableModels.js +32 -35
- package/dist/src/ui/models/availableModels.js.map +1 -1
- package/dist/src/ui/noninteractive/nonInteractiveUi.js +0 -1
- package/dist/src/ui/noninteractive/nonInteractiveUi.js.map +1 -1
- package/dist/src/ui/types.d.ts +9 -14
- package/dist/src/ui/types.js +0 -1
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/ui/utils/InlineMarkdownRenderer.d.ts +1 -0
- package/dist/src/ui/utils/InlineMarkdownRenderer.js +2 -2
- package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -1
- package/dist/src/ui/utils/MarkdownDisplay.d.ts +1 -0
- package/dist/src/ui/utils/MarkdownDisplay.js +13 -13
- package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
- package/dist/src/ui/utils/formatters.d.ts +6 -0
- package/dist/src/ui/utils/formatters.js +31 -0
- package/dist/src/ui/utils/formatters.js.map +1 -1
- package/dist/src/ui/utils/formatters.test.js +51 -2
- package/dist/src/ui/utils/formatters.test.js.map +1 -1
- package/dist/src/ui/utils/resumeHistoryUtils.d.ts +19 -0
- package/dist/src/ui/utils/resumeHistoryUtils.js +267 -0
- package/dist/src/ui/utils/resumeHistoryUtils.js.map +1 -0
- package/dist/src/ui/utils/resumeHistoryUtils.test.d.ts +6 -0
- package/dist/src/ui/utils/resumeHistoryUtils.test.js +253 -0
- package/dist/src/ui/utils/resumeHistoryUtils.test.js.map +1 -0
- package/dist/src/ui/utils/sessionPickerUtils.d.ts +30 -0
- package/dist/src/ui/utils/sessionPickerUtils.js +41 -0
- package/dist/src/ui/utils/sessionPickerUtils.js.map +1 -0
- package/dist/src/ui/utils/sessionPickerUtils.test.d.ts +6 -0
- package/dist/src/ui/utils/sessionPickerUtils.test.js +38 -0
- package/dist/src/ui/utils/sessionPickerUtils.test.js.map +1 -0
- package/dist/src/utils/attentionNotification.d.ts +1 -0
- package/dist/src/utils/attentionNotification.js +4 -0
- package/dist/src/utils/attentionNotification.js.map +1 -1
- package/dist/src/utils/errors.d.ts +1 -1
- package/dist/src/utils/errors.js +14 -3
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/errors.test.js +43 -1
- package/dist/src/utils/errors.test.js.map +1 -1
- package/dist/src/utils/gitUtils.js +25 -8
- package/dist/src/utils/gitUtils.js.map +1 -1
- package/dist/src/utils/gitUtils.test.js +59 -0
- package/dist/src/utils/gitUtils.test.js.map +1 -1
- package/dist/src/utils/nonInteractiveHelpers.d.ts +3 -1
- package/dist/src/utils/nonInteractiveHelpers.js +14 -15
- package/dist/src/utils/nonInteractiveHelpers.js.map +1 -1
- package/dist/src/utils/nonInteractiveHelpers.test.js +36 -21
- package/dist/src/utils/nonInteractiveHelpers.test.js.map +1 -1
- package/dist/src/utils/relaunch.js +2 -2
- package/dist/src/utils/relaunch.js.map +1 -1
- package/dist/src/utils/relaunch.test.js +5 -5
- package/dist/src/utils/relaunch.test.js.map +1 -1
- package/dist/src/utils/systemInfo.js +2 -1
- package/dist/src/utils/systemInfo.js.map +1 -1
- package/dist/src/validateNonInterActiveAuth.js +10 -1
- package/dist/src/validateNonInterActiveAuth.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/dist/src/nonInteractive/control/controllers/mcpController.d.ts +0 -42
- package/dist/src/nonInteractive/control/controllers/mcpController.js +0 -205
- package/dist/src/nonInteractive/control/controllers/mcpController.js.map +0 -1
- package/dist/src/ui/commands/chatCommand.d.ts +0 -9
- package/dist/src/ui/commands/chatCommand.js +0 -351
- package/dist/src/ui/commands/chatCommand.js.map +0 -1
- package/dist/src/ui/commands/corgiCommand.d.ts +0 -7
- package/dist/src/ui/commands/corgiCommand.js +0 -16
- package/dist/src/ui/commands/corgiCommand.js.map +0 -1
- package/dist/src/ui/components/ProQuotaDialog.d.ts +0 -13
- package/dist/src/ui/components/ProQuotaDialog.js +0 -24
- package/dist/src/ui/components/ProQuotaDialog.js.map +0 -1
- package/dist/src/ui/components/ProQuotaDialog.test.js +0 -58
- package/dist/src/ui/components/ProQuotaDialog.test.js.map +0 -1
- package/dist/src/ui/components/QuitConfirmationDialog.d.ts +0 -17
- package/dist/src/ui/components/QuitConfirmationDialog.js +0 -49
- package/dist/src/ui/components/QuitConfirmationDialog.js.map +0 -1
- package/dist/src/ui/hooks/usePromptCompletion.d.ts +0 -23
- package/dist/src/ui/hooks/usePromptCompletion.js +0 -177
- package/dist/src/ui/hooks/usePromptCompletion.js.map +0 -1
- package/dist/src/ui/hooks/useQuitConfirmation.d.ts +0 -14
- package/dist/src/ui/hooks/useQuitConfirmation.js +0 -36
- package/dist/src/ui/hooks/useQuitConfirmation.js.map +0 -1
- package/dist/src/ui/hooks/useQuotaAndFallback.d.ts +0 -21
- package/dist/src/ui/hooks/useQuotaAndFallback.js +0 -122
- package/dist/src/ui/hooks/useQuotaAndFallback.js.map +0 -1
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js +0 -269
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +0 -1
- package/dist/src/zed-integration/acp.js.map +0 -1
- package/dist/src/zed-integration/fileSystemService.js.map +0 -1
- package/dist/src/zed-integration/schema.js.map +0 -1
- package/dist/src/zed-integration/zedIntegration.d.ts +0 -17
- package/dist/src/zed-integration/zedIntegration.js +0 -1135
- package/dist/src/zed-integration/zedIntegration.js.map +0 -1
- /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,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAChC,sDAAsD;YACtD,IAAI,CAAC,CAAC,SAAS,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,C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ACpB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -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;IAC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|
|
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,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
|