@codingame/monaco-vscode-chat-service-override 23.3.0 → 24.1.0
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/index.js +13 -10
- package/package.json +5 -41
- package/vscode/src/vs/platform/domWidget/browser/domWidget.d.ts +52 -0
- package/vscode/src/vs/platform/domWidget/browser/domWidget.js +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +61 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +152 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +37 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +3 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +7 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +12 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +21 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +27 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.d.ts +6 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.js +44 -208
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +23 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +140 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +85 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +358 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +222 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +241 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.d.ts +11 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.js +67 -230
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +65 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +186 -62
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsProvider.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsProvider.js +140 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsview.css +2 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +115 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +389 -166
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +22 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.js +63 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimeline.d.ts +7 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.d.ts +14 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.js +173 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +66 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +32 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +6 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +8 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.js +12 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +5 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +15 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +13 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +66 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +15 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +30 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +13 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +23 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +8 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +20 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +47 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +270 -143
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +310 -170
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +12 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +42 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +35 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.d.ts +1 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.js +22 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.d.ts +18 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.js +80 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.d.ts +2 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.js +48 -77
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.d.ts +16 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.js +257 -77
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatSetup.d.ts → chatSetup/chatSetupContributions.d.ts} +4 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +622 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +359 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.d.ts +89 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +667 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +260 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/chatSetup.css +4 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.js +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatStatus.js → chatStatus/chatStatusDashboard.js} +193 -325
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatStatus.d.ts → chatStatus/chatStatusEntry.d.ts} +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +190 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatStatusItemService.d.ts → chatStatus/chatStatusItemService.d.ts} +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatStatus/media}/chatStatus.css +22 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusWidget.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusWidget.js +108 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTerminalOutputAccessibleView.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTerminalOutputAccessibleView.js +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +57 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +478 -146
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewTitleControl.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewTitleControl.js +204 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidgetService.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidgetService.js +187 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +108 -62
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.js +37 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +37 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +232 -97
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatusWidget.css +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewPane.css +142 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewTitleControl.css +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +51 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +19 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatModelStore.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatModelStore.js +100 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +3 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +41 -15
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +208 -162
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +15 -7
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +61 -7
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +60 -43
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptDocumentSemanticTokensProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +27 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +37 -47
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +120 -87
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileContributions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +49 -42
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +293 -187
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +17 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +43 -9
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +48 -29
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +8 -13
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +36 -41
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +18 -18
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +142 -38
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.js +3 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +19 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +78 -6
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +7 -11
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +26 -44
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +9 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +23 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +4 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +26 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +32 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +15 -29
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +10 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +38 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +32 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +5 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +4 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +4 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +128 -62
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +12 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +68 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +20 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +13 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +20 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +72 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +5 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.d.ts +0 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.js +0 -154
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.js +0 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.js +0 -135
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.d.ts +0 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.js +0 -216
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +0 -1617
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +0 -44
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +0 -313
- /package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/apple-dark.svg +0 -0
- /package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/apple-light.svg +0 -0
- /package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/github.svg +0 -0
- /package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/google.svg +0 -0
- /package/vscode/src/vs/workbench/contrib/chat/browser/{chatStatusItemService.js → chatStatus/chatStatusItemService.js} +0 -0
|
@@ -1,1617 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
4
|
-
import * as chatSetup from './media/chatSetup.css';
|
|
5
|
-
import { $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
6
|
-
import { Dialog, DialogContentsAlignment } from '@codingame/monaco-vscode-f1bbc6d3-6129-583c-a2ba-c80b832993d2-common/vscode/vs/base/browser/ui/dialog/dialog';
|
|
7
|
-
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
8
|
-
import { timeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
9
|
-
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
10
|
-
import { toErrorMessage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errorMessage';
|
|
11
|
-
import { isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
12
|
-
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
13
|
-
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
14
|
-
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
15
|
-
import { Disposable, DisposableStore, markAsSingleton, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
16
|
-
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
17
|
-
import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
|
|
18
|
-
import { equalsIgnoreCase } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
19
|
-
import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
20
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
21
|
-
import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service';
|
|
22
|
-
import { localize2, localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
23
|
-
import { Action2, MenuId, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
24
|
-
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
25
|
-
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
26
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
27
|
-
import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
28
|
-
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
29
|
-
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
30
|
-
import { createWorkbenchDialogOptions } from '@codingame/monaco-vscode-f1bbc6d3-6129-583c-a2ba-c80b832993d2-common/vscode/vs/platform/dialogs/browser/dialog';
|
|
31
|
-
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
32
|
-
import { ExtensionIdentifier } from '@codingame/monaco-vscode-api/vscode/vs/platform/extensions/common/extensions';
|
|
33
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
34
|
-
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
35
|
-
import { ILayoutService } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service';
|
|
36
|
-
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
37
|
-
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
38
|
-
import product from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/product';
|
|
39
|
-
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
40
|
-
import { ProgressLocation } from '@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress';
|
|
41
|
-
import { IProgressService } from '@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress.service';
|
|
42
|
-
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
43
|
-
import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
|
|
44
|
-
import { TelemetryLevel } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry';
|
|
45
|
-
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
46
|
-
import { IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
47
|
-
import { ViewContainerLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
|
|
48
|
-
import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
|
|
49
|
-
import { ProgressBadge } from '@codingame/monaco-vscode-3b5a5cd1-d4ff-500a-b609-57e0cd4afa0a-common/vscode/vs/workbench/services/activity/common/activity';
|
|
50
|
-
import { IActivityService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity.service';
|
|
51
|
-
import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
52
|
-
import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
53
|
-
import { EnablementState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
|
|
54
|
-
import { IWorkbenchExtensionEnablementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.service';
|
|
55
|
-
import { ExtensionUrlHandlerOverrideRegistry } from '@codingame/monaco-vscode-8c844347-a703-5de1-9eeb-5e0c7f503a58-common/vscode/vs/workbench/services/extensions/browser/extensionUrlHandler';
|
|
56
|
-
import { nullExtensionDescription } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions';
|
|
57
|
-
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
58
|
-
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
59
|
-
import { Parts } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
60
|
-
import { IWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
61
|
-
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
62
|
-
import { IPreferencesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/preferences/common/preferences.service';
|
|
63
|
-
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
64
|
-
import { ToolDataSource } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService';
|
|
65
|
-
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
|
|
66
|
-
import { IExtensionsWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/common/extensions.service';
|
|
67
|
-
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
68
|
-
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
69
|
-
import { ChatEntitlement, ChatEntitlementRequests, isProUser } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService';
|
|
70
|
-
import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
|
|
71
|
-
import { ChatRequestModel } from '@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
72
|
-
import { ChatMode } from '@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatModes';
|
|
73
|
-
import { IChatModeService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes.service';
|
|
74
|
-
import { ChatRequestToolPart, ChatRequestAgentPart } from '@codingame/monaco-vscode-aac7027b-326c-513a-95a9-e4eedd151b38-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
75
|
-
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
76
|
-
import { ChatConfiguration, ChatAgentLocation, ChatModeKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
77
|
-
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
78
|
-
import { CHAT_SETUP_ACTION_ID, CHAT_CATEGORY, CHAT_SETUP_SUPPORT_ANONYMOUS_ACTION_ID, CHAT_OPEN_ACTION_ID } from '@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
79
|
-
import { showChatView, ChatViewId } from '@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
80
|
-
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
81
|
-
import { CHAT_SIDEBAR_PANEL_ID } from './chatViewPane.js';
|
|
82
|
-
import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
|
|
83
|
-
import { chatViewsWelcomeRegistry } from '@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common/vscode/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome';
|
|
84
|
-
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
|
|
85
|
-
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
86
|
-
|
|
87
|
-
var SetupAgent_1, DefaultNewSymbolNamesProvider_1, ChatSetup_1, ChatTeardownContribution_1;
|
|
88
|
-
registerCss(chatSetup);
|
|
89
|
-
const defaultChat = {
|
|
90
|
-
extensionId: product.defaultChatAgent?.extensionId ?? '',
|
|
91
|
-
chatExtensionId: product.defaultChatAgent?.chatExtensionId ?? '',
|
|
92
|
-
publicCodeMatchesUrl: product.defaultChatAgent?.publicCodeMatchesUrl ?? '',
|
|
93
|
-
manageOveragesUrl: product.defaultChatAgent?.manageOverageUrl ?? '',
|
|
94
|
-
upgradePlanUrl: product.defaultChatAgent?.upgradePlanUrl ?? '',
|
|
95
|
-
provider: product.defaultChatAgent?.provider ?? { default: { id: '', name: '' }, enterprise: { id: '', name: '' }, apple: { id: '', name: '' }, google: { id: '', name: '' } },
|
|
96
|
-
providerUriSetting: product.defaultChatAgent?.providerUriSetting ?? '',
|
|
97
|
-
manageSettingsUrl: product.defaultChatAgent?.manageSettingsUrl ?? '',
|
|
98
|
-
completionsAdvancedSetting: product.defaultChatAgent?.completionsAdvancedSetting ?? '',
|
|
99
|
-
completionsRefreshTokenCommand: product.defaultChatAgent?.completionsRefreshTokenCommand ?? '',
|
|
100
|
-
chatRefreshTokenCommand: product.defaultChatAgent?.chatRefreshTokenCommand ?? '',
|
|
101
|
-
termsStatementUrl: product.defaultChatAgent?.termsStatementUrl ?? '',
|
|
102
|
-
privacyStatementUrl: product.defaultChatAgent?.privacyStatementUrl ?? ''
|
|
103
|
-
};
|
|
104
|
-
var ChatSetupAnonymous;
|
|
105
|
-
(function (ChatSetupAnonymous) {
|
|
106
|
-
ChatSetupAnonymous[ChatSetupAnonymous["Disabled"] = 0] = "Disabled";
|
|
107
|
-
ChatSetupAnonymous[ChatSetupAnonymous["EnabledWithDialog"] = 1] = "EnabledWithDialog";
|
|
108
|
-
ChatSetupAnonymous[ChatSetupAnonymous["EnabledWithoutDialog"] = 2] = "EnabledWithoutDialog";
|
|
109
|
-
})(ChatSetupAnonymous || (ChatSetupAnonymous = {}));
|
|
110
|
-
const ToolsAgentContextKey = ( ContextKeyExpr.and(( ContextKeyExpr.equals(`config.${ChatConfiguration.AgentEnabled}`, true)),
|
|
111
|
-
ContextKeyExpr.not(`previewFeaturesDisabled`)));
|
|
112
|
-
let SetupAgent = class SetupAgent extends Disposable {
|
|
113
|
-
static { SetupAgent_1 = this; }
|
|
114
|
-
static registerDefaultAgents(instantiationService, location, mode, context, controller) {
|
|
115
|
-
return instantiationService.invokeFunction(accessor => {
|
|
116
|
-
const chatAgentService = accessor.get(IChatAgentService);
|
|
117
|
-
let id;
|
|
118
|
-
let description = ChatMode.Ask.description.get();
|
|
119
|
-
switch (location) {
|
|
120
|
-
case ChatAgentLocation.Chat:
|
|
121
|
-
if (mode === ChatModeKind.Ask) {
|
|
122
|
-
id = 'setup.chat';
|
|
123
|
-
}
|
|
124
|
-
else if (mode === ChatModeKind.Edit) {
|
|
125
|
-
id = 'setup.edits';
|
|
126
|
-
description = ChatMode.Edit.description.get();
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
id = 'setup.agent';
|
|
130
|
-
description = ChatMode.Agent.description.get();
|
|
131
|
-
}
|
|
132
|
-
break;
|
|
133
|
-
case ChatAgentLocation.Terminal:
|
|
134
|
-
id = 'setup.terminal';
|
|
135
|
-
break;
|
|
136
|
-
case ChatAgentLocation.EditorInline:
|
|
137
|
-
id = 'setup.editor';
|
|
138
|
-
break;
|
|
139
|
-
case ChatAgentLocation.Notebook:
|
|
140
|
-
id = 'setup.notebook';
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
return SetupAgent_1.doRegisterAgent(instantiationService, chatAgentService, id, `${defaultChat.provider.default.name} Copilot` , true, description, location, mode, context, controller);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
static registerBuiltInAgents(instantiationService, context, controller) {
|
|
147
|
-
return instantiationService.invokeFunction(accessor => {
|
|
148
|
-
const chatAgentService = accessor.get(IChatAgentService);
|
|
149
|
-
const disposables = ( new DisposableStore());
|
|
150
|
-
const { disposable: vscodeDisposable } = SetupAgent_1.doRegisterAgent(instantiationService, chatAgentService, 'setup.vscode', 'vscode', false, ( localize2(5435, "Ask questions about VS Code")).value, ChatAgentLocation.Chat, undefined, context, controller);
|
|
151
|
-
disposables.add(vscodeDisposable);
|
|
152
|
-
const { disposable: workspaceDisposable } = SetupAgent_1.doRegisterAgent(instantiationService, chatAgentService, 'setup.workspace', 'workspace', false, ( localize2(5436, "Ask about your workspace")).value, ChatAgentLocation.Chat, undefined, context, controller);
|
|
153
|
-
disposables.add(workspaceDisposable);
|
|
154
|
-
const { disposable: terminalDisposable } = SetupAgent_1.doRegisterAgent(instantiationService, chatAgentService, 'setup.terminal.agent', 'terminal', false, ( localize2(5437, "Ask how to do something in the terminal")).value, ChatAgentLocation.Chat, undefined, context, controller);
|
|
155
|
-
disposables.add(terminalDisposable);
|
|
156
|
-
disposables.add(SetupTool.registerTool(instantiationService, {
|
|
157
|
-
id: 'setup_tools_createNewWorkspace',
|
|
158
|
-
source: ToolDataSource.Internal,
|
|
159
|
-
icon: Codicon.newFolder,
|
|
160
|
-
displayName: ( localize(5438, "New Workspace")),
|
|
161
|
-
modelDescription: ( localize(5439, "Scaffold a new workspace in VS Code")),
|
|
162
|
-
userDescription: ( localize(5439, "Scaffold a new workspace in VS Code")),
|
|
163
|
-
canBeReferencedInPrompt: true,
|
|
164
|
-
toolReferenceName: 'new',
|
|
165
|
-
when: ContextKeyExpr.true(),
|
|
166
|
-
}));
|
|
167
|
-
return disposables;
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
static doRegisterAgent(instantiationService, chatAgentService, id, name, isDefault, description, location, mode, context, controller) {
|
|
171
|
-
const disposables = ( new DisposableStore());
|
|
172
|
-
disposables.add(chatAgentService.registerAgent(id, {
|
|
173
|
-
id,
|
|
174
|
-
name,
|
|
175
|
-
isDefault,
|
|
176
|
-
isCore: true,
|
|
177
|
-
modes: mode ? [mode] : [ChatModeKind.Ask],
|
|
178
|
-
when: mode === ChatModeKind.Agent ? ToolsAgentContextKey?.serialize() : undefined,
|
|
179
|
-
slashCommands: [],
|
|
180
|
-
disambiguation: [],
|
|
181
|
-
locations: [location],
|
|
182
|
-
metadata: { helpTextPrefix: SetupAgent_1.SETUP_NEEDED_MESSAGE },
|
|
183
|
-
description,
|
|
184
|
-
extensionId: nullExtensionDescription.identifier,
|
|
185
|
-
extensionVersion: undefined,
|
|
186
|
-
extensionDisplayName: nullExtensionDescription.name,
|
|
187
|
-
extensionPublisherId: nullExtensionDescription.publisher
|
|
188
|
-
}));
|
|
189
|
-
const agent = disposables.add(instantiationService.createInstance(SetupAgent_1, context, controller, location));
|
|
190
|
-
disposables.add(chatAgentService.registerAgentImplementation(id, agent));
|
|
191
|
-
if (mode === ChatModeKind.Agent) {
|
|
192
|
-
chatAgentService.updateAgent(id, { themeIcon: Codicon.tools });
|
|
193
|
-
}
|
|
194
|
-
return { agent, disposable: disposables };
|
|
195
|
-
}
|
|
196
|
-
static { this.SETUP_NEEDED_MESSAGE = ( new MarkdownString(( localize(5440, "You need to set up GitHub Copilot and be signed in to use Chat.")))); }
|
|
197
|
-
static { this.TRUST_NEEDED_MESSAGE = ( new MarkdownString(( localize(5441, "You need to trust this workspace to use Chat.")))); }
|
|
198
|
-
constructor(context, controller, location, instantiationService, logService, configurationService, telemetryService, environmentService, workspaceTrustManagementService, chatEntitlementService) {
|
|
199
|
-
super();
|
|
200
|
-
this.context = context;
|
|
201
|
-
this.controller = controller;
|
|
202
|
-
this.location = location;
|
|
203
|
-
this.instantiationService = instantiationService;
|
|
204
|
-
this.logService = logService;
|
|
205
|
-
this.configurationService = configurationService;
|
|
206
|
-
this.telemetryService = telemetryService;
|
|
207
|
-
this.environmentService = environmentService;
|
|
208
|
-
this.workspaceTrustManagementService = workspaceTrustManagementService;
|
|
209
|
-
this.chatEntitlementService = chatEntitlementService;
|
|
210
|
-
this._onUnresolvableError = this._register(( new Emitter()));
|
|
211
|
-
this.onUnresolvableError = this._onUnresolvableError.event;
|
|
212
|
-
this.pendingForwardedRequests = ( new ResourceMap());
|
|
213
|
-
}
|
|
214
|
-
async invoke(request, progress) {
|
|
215
|
-
return this.instantiationService.invokeFunction(async (accessor ) => {
|
|
216
|
-
const chatService = accessor.get(IChatService);
|
|
217
|
-
const languageModelsService = accessor.get(ILanguageModelsService);
|
|
218
|
-
const chatWidgetService = accessor.get(IChatWidgetService);
|
|
219
|
-
const chatAgentService = accessor.get(IChatAgentService);
|
|
220
|
-
const languageModelToolsService = accessor.get(ILanguageModelToolsService);
|
|
221
|
-
return this.doInvoke(request, part => progress([part]), chatService, languageModelsService, chatWidgetService, chatAgentService, languageModelToolsService);
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
async doInvoke(request, progress, chatService, languageModelsService, chatWidgetService, chatAgentService, languageModelToolsService) {
|
|
225
|
-
if (!this.context.state.installed ||
|
|
226
|
-
this.context.state.disabled ||
|
|
227
|
-
this.context.state.untrusted ||
|
|
228
|
-
this.context.state.entitlement === ChatEntitlement.Available ||
|
|
229
|
-
((
|
|
230
|
-
this.context.state.entitlement === ChatEntitlement.Unknown && !this.chatEntitlementService.anonymous)
|
|
231
|
-
)) {
|
|
232
|
-
return this.doInvokeWithSetup(request, progress, chatService, languageModelsService, chatWidgetService, chatAgentService, languageModelToolsService);
|
|
233
|
-
}
|
|
234
|
-
return this.doInvokeWithoutSetup(request, progress, chatService, languageModelsService, chatWidgetService, chatAgentService, languageModelToolsService);
|
|
235
|
-
}
|
|
236
|
-
async doInvokeWithoutSetup(request, progress, chatService, languageModelsService, chatWidgetService, chatAgentService, languageModelToolsService) {
|
|
237
|
-
const requestModel = chatWidgetService.getWidgetBySessionId(request.sessionId)?.viewModel?.model.getRequests().at(-1);
|
|
238
|
-
if (!requestModel) {
|
|
239
|
-
this.logService.error('[chat setup] Request model not found, cannot redispatch request.');
|
|
240
|
-
return {};
|
|
241
|
-
}
|
|
242
|
-
progress({
|
|
243
|
-
kind: 'progressMessage',
|
|
244
|
-
content: ( new MarkdownString(( localize(5442, "Getting chat ready...")))),
|
|
245
|
-
});
|
|
246
|
-
await this.forwardRequestToChat(requestModel, progress, chatService, languageModelsService, chatAgentService, chatWidgetService, languageModelToolsService);
|
|
247
|
-
return {};
|
|
248
|
-
}
|
|
249
|
-
async forwardRequestToChat(requestModel, progress, chatService, languageModelsService, chatAgentService, chatWidgetService, languageModelToolsService) {
|
|
250
|
-
try {
|
|
251
|
-
await this.doForwardRequestToChat(requestModel, progress, chatService, languageModelsService, chatAgentService, chatWidgetService, languageModelToolsService);
|
|
252
|
-
}
|
|
253
|
-
catch (error) {
|
|
254
|
-
progress({
|
|
255
|
-
kind: 'warning',
|
|
256
|
-
content: ( new MarkdownString(( localize(5443, "Failed to get a response. Please try again."))))
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
async doForwardRequestToChat(requestModel, progress, chatService, languageModelsService, chatAgentService, chatWidgetService, languageModelToolsService) {
|
|
261
|
-
if (( this.pendingForwardedRequests.has(requestModel.session.sessionResource))) {
|
|
262
|
-
throw ( new Error('Request already in progress'));
|
|
263
|
-
}
|
|
264
|
-
const forwardRequest = this.doForwardRequestToChatWhenReady(requestModel, progress, chatService, languageModelsService, chatAgentService, chatWidgetService, languageModelToolsService);
|
|
265
|
-
this.pendingForwardedRequests.set(requestModel.session.sessionResource, forwardRequest);
|
|
266
|
-
try {
|
|
267
|
-
await forwardRequest;
|
|
268
|
-
}
|
|
269
|
-
finally {
|
|
270
|
-
this.pendingForwardedRequests.delete(requestModel.session.sessionResource);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
async doForwardRequestToChatWhenReady(requestModel, progress, chatService, languageModelsService, chatAgentService, chatWidgetService, languageModelToolsService) {
|
|
274
|
-
const widget = chatWidgetService.getWidgetBySessionResource(requestModel.session.sessionResource);
|
|
275
|
-
const modeInfo = widget?.input.currentModeInfo;
|
|
276
|
-
let agentReady = false;
|
|
277
|
-
let languageModelReady = false;
|
|
278
|
-
let toolsModelReady = false;
|
|
279
|
-
const whenAgentReady = this.whenAgentReady(chatAgentService, modeInfo?.kind)?.then(() => agentReady = true);
|
|
280
|
-
const whenLanguageModelReady = this.whenLanguageModelReady(languageModelsService, requestModel.modelId)?.then(() => languageModelReady = true);
|
|
281
|
-
const whenToolsModelReady = this.whenToolsModelReady(languageModelToolsService, requestModel)?.then(() => toolsModelReady = true);
|
|
282
|
-
if (whenLanguageModelReady instanceof Promise || whenAgentReady instanceof Promise || whenToolsModelReady instanceof Promise) {
|
|
283
|
-
const timeoutHandle = setTimeout(() => {
|
|
284
|
-
progress({
|
|
285
|
-
kind: 'progressMessage',
|
|
286
|
-
content: ( new MarkdownString(( localize(5444, "Chat is almost ready...")))),
|
|
287
|
-
});
|
|
288
|
-
}, 10000);
|
|
289
|
-
try {
|
|
290
|
-
const ready = await Promise.race([
|
|
291
|
-
timeout(this.environmentService.remoteAuthority ? 60000 : 20000).then(() => 'timedout'),
|
|
292
|
-
this.whenDefaultAgentFailed(chatService).then(() => 'error'),
|
|
293
|
-
Promise.allSettled([whenLanguageModelReady, whenAgentReady, whenToolsModelReady])
|
|
294
|
-
]);
|
|
295
|
-
if (ready === 'error' || ready === 'timedout') {
|
|
296
|
-
let warningMessage;
|
|
297
|
-
if (ready === 'timedout') {
|
|
298
|
-
if (this.chatEntitlementService.anonymous) {
|
|
299
|
-
warningMessage = ( localize(
|
|
300
|
-
5445,
|
|
301
|
-
"Chat took too long to get ready. Please ensure that the extension `{0}` is installed and enabled.",
|
|
302
|
-
defaultChat.chatExtensionId
|
|
303
|
-
));
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
warningMessage = ( localize(
|
|
307
|
-
5446,
|
|
308
|
-
"Chat took too long to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.",
|
|
309
|
-
defaultChat.provider.default.name,
|
|
310
|
-
defaultChat.chatExtensionId
|
|
311
|
-
));
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
if (this.chatEntitlementService.anonymous) {
|
|
316
|
-
warningMessage = ( localize(
|
|
317
|
-
5447,
|
|
318
|
-
"Chat failed to get ready. Please ensure that the extension `{0}` is installed and enabled.",
|
|
319
|
-
defaultChat.chatExtensionId
|
|
320
|
-
));
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
warningMessage = ( localize(
|
|
324
|
-
5448,
|
|
325
|
-
"Chat failed to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.",
|
|
326
|
-
defaultChat.provider.default.name,
|
|
327
|
-
defaultChat.chatExtensionId
|
|
328
|
-
));
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
this.logService.warn(warningMessage, {
|
|
332
|
-
agentReady: whenAgentReady ? agentReady : undefined,
|
|
333
|
-
languageModelReady: whenLanguageModelReady ? languageModelReady : undefined,
|
|
334
|
-
toolsModelReady: whenToolsModelReady ? toolsModelReady : undefined
|
|
335
|
-
});
|
|
336
|
-
progress({
|
|
337
|
-
kind: 'warning',
|
|
338
|
-
content: ( new MarkdownString(warningMessage))
|
|
339
|
-
});
|
|
340
|
-
this._onUnresolvableError.fire();
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
finally {
|
|
345
|
-
clearTimeout(timeoutHandle);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
await chatService.resendRequest(requestModel, {
|
|
349
|
-
...widget?.getModeRequestOptions(),
|
|
350
|
-
modeInfo,
|
|
351
|
-
userSelectedModelId: widget?.input.currentLanguageModel
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
whenLanguageModelReady(languageModelsService, modelId) {
|
|
355
|
-
const hasModelForRequest = () => {
|
|
356
|
-
if (modelId) {
|
|
357
|
-
return !!languageModelsService.lookupLanguageModel(modelId);
|
|
358
|
-
}
|
|
359
|
-
for (const id of languageModelsService.getLanguageModelIds()) {
|
|
360
|
-
const model = languageModelsService.lookupLanguageModel(id);
|
|
361
|
-
if (model?.isDefault) {
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
return false;
|
|
366
|
-
};
|
|
367
|
-
if (hasModelForRequest()) {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
return Event.toPromise(Event.filter(languageModelsService.onDidChangeLanguageModels, () => hasModelForRequest()));
|
|
371
|
-
}
|
|
372
|
-
whenToolsModelReady(languageModelToolsService, requestModel) {
|
|
373
|
-
const needsToolsModel = ( requestModel.message.parts.some(part => part instanceof ChatRequestToolPart));
|
|
374
|
-
if (!needsToolsModel) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
for (const tool of languageModelToolsService.getTools()) {
|
|
378
|
-
if (tool.id.startsWith('copilot_')) {
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
return Event.toPromise(Event.filter(languageModelToolsService.onDidChangeTools, () => {
|
|
383
|
-
for (const tool of languageModelToolsService.getTools()) {
|
|
384
|
-
if (tool.id.startsWith('copilot_')) {
|
|
385
|
-
return true;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return false;
|
|
389
|
-
}));
|
|
390
|
-
}
|
|
391
|
-
whenAgentReady(chatAgentService, mode) {
|
|
392
|
-
const defaultAgent = chatAgentService.getDefaultAgent(this.location, mode);
|
|
393
|
-
if (defaultAgent && !defaultAgent.isCore) {
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
return Event.toPromise(Event.filter(chatAgentService.onDidChangeAgents, () => {
|
|
397
|
-
const defaultAgent = chatAgentService.getDefaultAgent(this.location, mode);
|
|
398
|
-
return Boolean(defaultAgent && !defaultAgent.isCore);
|
|
399
|
-
}));
|
|
400
|
-
}
|
|
401
|
-
async whenDefaultAgentFailed(chatService) {
|
|
402
|
-
return ( new Promise(resolve => {
|
|
403
|
-
chatService.activateDefaultAgent(this.location).catch(() => resolve());
|
|
404
|
-
}));
|
|
405
|
-
}
|
|
406
|
-
async doInvokeWithSetup(request, progress, chatService, languageModelsService, chatWidgetService, chatAgentService, languageModelToolsService) {
|
|
407
|
-
this.telemetryService.publicLog2('workbenchActionExecuted', { id: CHAT_SETUP_ACTION_ID, from: 'chat' });
|
|
408
|
-
const widget = chatWidgetService.getWidgetBySessionId(request.sessionId);
|
|
409
|
-
const requestModel = widget?.viewModel?.model.getRequests().at(-1);
|
|
410
|
-
const setupListener = Event.runAndSubscribe(this.controller.value.onDidChange, (() => {
|
|
411
|
-
switch (this.controller.value.step) {
|
|
412
|
-
case ChatSetupStep.SigningIn:
|
|
413
|
-
progress({
|
|
414
|
-
kind: 'progressMessage',
|
|
415
|
-
content: ( new MarkdownString(( localize(
|
|
416
|
-
5449,
|
|
417
|
-
"Signing in to {0}...",
|
|
418
|
-
ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.provider.enterprise.id ? defaultChat.provider.enterprise.name : defaultChat.provider.default.name
|
|
419
|
-
)))),
|
|
420
|
-
});
|
|
421
|
-
break;
|
|
422
|
-
case ChatSetupStep.Installing:
|
|
423
|
-
progress({
|
|
424
|
-
kind: 'progressMessage',
|
|
425
|
-
content: ( new MarkdownString(( localize(5450, "Getting chat ready...")))),
|
|
426
|
-
});
|
|
427
|
-
break;
|
|
428
|
-
}
|
|
429
|
-
}));
|
|
430
|
-
let result = undefined;
|
|
431
|
-
try {
|
|
432
|
-
result = await ChatSetup.getInstance(this.instantiationService, this.context, this.controller).run({
|
|
433
|
-
disableChatViewReveal: true,
|
|
434
|
-
forceAnonymous: this.chatEntitlementService.anonymous ? ChatSetupAnonymous.EnabledWithoutDialog : undefined
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
catch (error) {
|
|
438
|
-
this.logService.error(`[chat setup] Error during setup: ${toErrorMessage(error)}`);
|
|
439
|
-
}
|
|
440
|
-
finally {
|
|
441
|
-
setupListener.dispose();
|
|
442
|
-
}
|
|
443
|
-
if (typeof result?.success === 'boolean') {
|
|
444
|
-
if (result.success) {
|
|
445
|
-
if (result.dialogSkipped) {
|
|
446
|
-
widget?.clear();
|
|
447
|
-
}
|
|
448
|
-
else if (requestModel) {
|
|
449
|
-
let newRequest = this.replaceAgentInRequestModel(requestModel, chatAgentService);
|
|
450
|
-
newRequest = this.replaceToolInRequestModel(newRequest);
|
|
451
|
-
await this.forwardRequestToChat(newRequest, progress, chatService, languageModelsService, chatAgentService, chatWidgetService, languageModelToolsService);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
else {
|
|
455
|
-
progress({
|
|
456
|
-
kind: 'warning',
|
|
457
|
-
content: ( new MarkdownString(( localize(5451, "Chat setup failed."))))
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
else {
|
|
462
|
-
progress({
|
|
463
|
-
kind: 'markdownContent',
|
|
464
|
-
content: this.workspaceTrustManagementService.isWorkspaceTrusted() ? SetupAgent_1.SETUP_NEEDED_MESSAGE : SetupAgent_1.TRUST_NEEDED_MESSAGE
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
return {};
|
|
468
|
-
}
|
|
469
|
-
replaceAgentInRequestModel(requestModel, chatAgentService) {
|
|
470
|
-
const agentPart = requestModel.message.parts.find((r) => r instanceof ChatRequestAgentPart);
|
|
471
|
-
if (!agentPart) {
|
|
472
|
-
return requestModel;
|
|
473
|
-
}
|
|
474
|
-
const agentId = agentPart.agent.id.replace(/setup\./, `${defaultChat.extensionId}.`.toLowerCase());
|
|
475
|
-
const githubAgent = chatAgentService.getAgent(agentId);
|
|
476
|
-
if (!githubAgent) {
|
|
477
|
-
return requestModel;
|
|
478
|
-
}
|
|
479
|
-
const newAgentPart = ( new ChatRequestAgentPart(agentPart.range, agentPart.editorRange, githubAgent));
|
|
480
|
-
return ( new ChatRequestModel({
|
|
481
|
-
session: requestModel.session,
|
|
482
|
-
message: {
|
|
483
|
-
parts: ( requestModel.message.parts.map(part => {
|
|
484
|
-
if (part instanceof ChatRequestAgentPart) {
|
|
485
|
-
return newAgentPart;
|
|
486
|
-
}
|
|
487
|
-
return part;
|
|
488
|
-
})),
|
|
489
|
-
text: requestModel.message.text
|
|
490
|
-
},
|
|
491
|
-
variableData: requestModel.variableData,
|
|
492
|
-
timestamp: Date.now(),
|
|
493
|
-
attempt: requestModel.attempt,
|
|
494
|
-
modeInfo: requestModel.modeInfo,
|
|
495
|
-
confirmation: requestModel.confirmation,
|
|
496
|
-
locationData: requestModel.locationData,
|
|
497
|
-
attachedContext: requestModel.attachedContext,
|
|
498
|
-
isCompleteAddedRequest: requestModel.isCompleteAddedRequest,
|
|
499
|
-
}));
|
|
500
|
-
}
|
|
501
|
-
replaceToolInRequestModel(requestModel) {
|
|
502
|
-
const toolPart = requestModel.message.parts.find((r) => r instanceof ChatRequestToolPart);
|
|
503
|
-
if (!toolPart) {
|
|
504
|
-
return requestModel;
|
|
505
|
-
}
|
|
506
|
-
const toolId = toolPart.toolId.replace(/setup.tools\./, `copilot_`.toLowerCase());
|
|
507
|
-
const newToolPart = ( new ChatRequestToolPart(
|
|
508
|
-
toolPart.range,
|
|
509
|
-
toolPart.editorRange,
|
|
510
|
-
toolPart.toolName,
|
|
511
|
-
toolId,
|
|
512
|
-
toolPart.displayName,
|
|
513
|
-
toolPart.icon
|
|
514
|
-
));
|
|
515
|
-
const chatRequestToolEntry = {
|
|
516
|
-
id: toolId,
|
|
517
|
-
name: 'new',
|
|
518
|
-
range: toolPart.range,
|
|
519
|
-
kind: 'tool',
|
|
520
|
-
value: undefined
|
|
521
|
-
};
|
|
522
|
-
const variableData = {
|
|
523
|
-
variables: [chatRequestToolEntry]
|
|
524
|
-
};
|
|
525
|
-
return ( new ChatRequestModel({
|
|
526
|
-
session: requestModel.session,
|
|
527
|
-
message: {
|
|
528
|
-
parts: ( requestModel.message.parts.map(part => {
|
|
529
|
-
if (part instanceof ChatRequestToolPart) {
|
|
530
|
-
return newToolPart;
|
|
531
|
-
}
|
|
532
|
-
return part;
|
|
533
|
-
})),
|
|
534
|
-
text: requestModel.message.text
|
|
535
|
-
},
|
|
536
|
-
variableData: variableData,
|
|
537
|
-
timestamp: Date.now(),
|
|
538
|
-
attempt: requestModel.attempt,
|
|
539
|
-
modeInfo: requestModel.modeInfo,
|
|
540
|
-
confirmation: requestModel.confirmation,
|
|
541
|
-
locationData: requestModel.locationData,
|
|
542
|
-
attachedContext: [chatRequestToolEntry],
|
|
543
|
-
isCompleteAddedRequest: requestModel.isCompleteAddedRequest,
|
|
544
|
-
}));
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
SetupAgent = SetupAgent_1 = ( __decorate([
|
|
548
|
-
( __param(3, IInstantiationService)),
|
|
549
|
-
( __param(4, ILogService)),
|
|
550
|
-
( __param(5, IConfigurationService)),
|
|
551
|
-
( __param(6, ITelemetryService)),
|
|
552
|
-
( __param(7, IWorkbenchEnvironmentService)),
|
|
553
|
-
( __param(8, IWorkspaceTrustManagementService)),
|
|
554
|
-
( __param(9, IChatEntitlementService))
|
|
555
|
-
], SetupAgent));
|
|
556
|
-
class SetupTool {
|
|
557
|
-
static registerTool(instantiationService, toolData) {
|
|
558
|
-
return instantiationService.invokeFunction(accessor => {
|
|
559
|
-
const toolService = accessor.get(ILanguageModelToolsService);
|
|
560
|
-
const disposables = ( new DisposableStore());
|
|
561
|
-
const tool = instantiationService.createInstance(SetupTool);
|
|
562
|
-
disposables.add(toolService.registerTool(toolData, tool));
|
|
563
|
-
return disposables;
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
async invoke(invocation, countTokens, progress, token) {
|
|
567
|
-
const result = {
|
|
568
|
-
content: [
|
|
569
|
-
{
|
|
570
|
-
kind: 'text',
|
|
571
|
-
value: ''
|
|
572
|
-
}
|
|
573
|
-
]
|
|
574
|
-
};
|
|
575
|
-
return result;
|
|
576
|
-
}
|
|
577
|
-
async prepareToolInvocation(parameters, token) {
|
|
578
|
-
return undefined;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
let DefaultNewSymbolNamesProvider = DefaultNewSymbolNamesProvider_1 = class DefaultNewSymbolNamesProvider {
|
|
582
|
-
static registerProvider(instantiationService, context, controller) {
|
|
583
|
-
return instantiationService.invokeFunction(accessor => {
|
|
584
|
-
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
|
|
585
|
-
const disposables = ( new DisposableStore());
|
|
586
|
-
const provider = instantiationService.createInstance(DefaultNewSymbolNamesProvider_1, context, controller);
|
|
587
|
-
disposables.add(languageFeaturesService.newSymbolNamesProvider.register('*', provider));
|
|
588
|
-
return disposables;
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
constructor(context, controller, instantiationService, chatEntitlementService) {
|
|
592
|
-
this.context = context;
|
|
593
|
-
this.controller = controller;
|
|
594
|
-
this.instantiationService = instantiationService;
|
|
595
|
-
this.chatEntitlementService = chatEntitlementService;
|
|
596
|
-
}
|
|
597
|
-
async provideNewSymbolNames(model, range, triggerKind, token) {
|
|
598
|
-
await this.instantiationService.invokeFunction(accessor => {
|
|
599
|
-
return ChatSetup.getInstance(this.instantiationService, this.context, this.controller).run({
|
|
600
|
-
forceAnonymous: this.chatEntitlementService.anonymous ? ChatSetupAnonymous.EnabledWithDialog : undefined
|
|
601
|
-
});
|
|
602
|
-
});
|
|
603
|
-
return [];
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
DefaultNewSymbolNamesProvider = DefaultNewSymbolNamesProvider_1 = ( __decorate([
|
|
607
|
-
( __param(2, IInstantiationService)),
|
|
608
|
-
( __param(3, IChatEntitlementService))
|
|
609
|
-
], DefaultNewSymbolNamesProvider));
|
|
610
|
-
var ChatSetupStrategy;
|
|
611
|
-
(function (ChatSetupStrategy) {
|
|
612
|
-
ChatSetupStrategy[ChatSetupStrategy["Canceled"] = 0] = "Canceled";
|
|
613
|
-
ChatSetupStrategy[ChatSetupStrategy["DefaultSetup"] = 1] = "DefaultSetup";
|
|
614
|
-
ChatSetupStrategy[ChatSetupStrategy["SetupWithoutEnterpriseProvider"] = 2] = "SetupWithoutEnterpriseProvider";
|
|
615
|
-
ChatSetupStrategy[ChatSetupStrategy["SetupWithEnterpriseProvider"] = 3] = "SetupWithEnterpriseProvider";
|
|
616
|
-
ChatSetupStrategy[ChatSetupStrategy["SetupWithGoogleProvider"] = 4] = "SetupWithGoogleProvider";
|
|
617
|
-
ChatSetupStrategy[ChatSetupStrategy["SetupWithAppleProvider"] = 5] = "SetupWithAppleProvider";
|
|
618
|
-
})(ChatSetupStrategy || (ChatSetupStrategy = {}));
|
|
619
|
-
let ChatSetup = class ChatSetup {
|
|
620
|
-
static { ChatSetup_1 = this; }
|
|
621
|
-
static { this.instance = undefined; }
|
|
622
|
-
static getInstance(instantiationService, context, controller) {
|
|
623
|
-
let instance = ChatSetup_1.instance;
|
|
624
|
-
if (!instance) {
|
|
625
|
-
instance = ChatSetup_1.instance = instantiationService.invokeFunction(accessor => {
|
|
626
|
-
return ( new ChatSetup_1(
|
|
627
|
-
context,
|
|
628
|
-
controller,
|
|
629
|
-
accessor.get(ITelemetryService),
|
|
630
|
-
accessor.get(IWorkbenchLayoutService),
|
|
631
|
-
accessor.get(IKeybindingService),
|
|
632
|
-
accessor.get(IChatEntitlementService),
|
|
633
|
-
accessor.get(ILogService),
|
|
634
|
-
accessor.get(IConfigurationService),
|
|
635
|
-
accessor.get(IViewsService),
|
|
636
|
-
accessor.get(IWorkspaceTrustRequestService),
|
|
637
|
-
accessor.get(IMarkdownRendererService)
|
|
638
|
-
));
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
return instance;
|
|
642
|
-
}
|
|
643
|
-
constructor(context, controller, telemetryService, layoutService, keybindingService, chatEntitlementService, logService, configurationService, viewsService, workspaceTrustRequestService, markdownRendererService) {
|
|
644
|
-
this.context = context;
|
|
645
|
-
this.controller = controller;
|
|
646
|
-
this.telemetryService = telemetryService;
|
|
647
|
-
this.layoutService = layoutService;
|
|
648
|
-
this.keybindingService = keybindingService;
|
|
649
|
-
this.chatEntitlementService = chatEntitlementService;
|
|
650
|
-
this.logService = logService;
|
|
651
|
-
this.configurationService = configurationService;
|
|
652
|
-
this.viewsService = viewsService;
|
|
653
|
-
this.workspaceTrustRequestService = workspaceTrustRequestService;
|
|
654
|
-
this.markdownRendererService = markdownRendererService;
|
|
655
|
-
this.pendingRun = undefined;
|
|
656
|
-
this.skipDialogOnce = false;
|
|
657
|
-
}
|
|
658
|
-
skipDialog() {
|
|
659
|
-
this.skipDialogOnce = true;
|
|
660
|
-
}
|
|
661
|
-
async run(options) {
|
|
662
|
-
if (this.pendingRun) {
|
|
663
|
-
return this.pendingRun;
|
|
664
|
-
}
|
|
665
|
-
this.pendingRun = this.doRun(options);
|
|
666
|
-
try {
|
|
667
|
-
return await this.pendingRun;
|
|
668
|
-
}
|
|
669
|
-
finally {
|
|
670
|
-
this.pendingRun = undefined;
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
async doRun(options) {
|
|
674
|
-
this.context.update({ later: false });
|
|
675
|
-
const dialogSkipped = this.skipDialogOnce;
|
|
676
|
-
this.skipDialogOnce = false;
|
|
677
|
-
const trusted = await this.workspaceTrustRequestService.requestWorkspaceTrust({
|
|
678
|
-
message: ( localize(5452, "AI features are currently only supported in trusted workspaces."))
|
|
679
|
-
});
|
|
680
|
-
if (!trusted) {
|
|
681
|
-
this.context.update({ later: true });
|
|
682
|
-
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedNotTrusted', installDuration: 0, signUpErrorCode: undefined, provider: undefined });
|
|
683
|
-
return { dialogSkipped, success: undefined };
|
|
684
|
-
}
|
|
685
|
-
let setupStrategy;
|
|
686
|
-
if (!options?.forceSignInDialog && (dialogSkipped || isProUser(this.chatEntitlementService.entitlement) || this.chatEntitlementService.entitlement === ChatEntitlement.Free)) {
|
|
687
|
-
setupStrategy = ChatSetupStrategy.DefaultSetup;
|
|
688
|
-
}
|
|
689
|
-
else if (options?.forceAnonymous === ChatSetupAnonymous.EnabledWithoutDialog) {
|
|
690
|
-
setupStrategy = ChatSetupStrategy.DefaultSetup;
|
|
691
|
-
}
|
|
692
|
-
else {
|
|
693
|
-
setupStrategy = await this.showDialog(options);
|
|
694
|
-
}
|
|
695
|
-
if (setupStrategy === ChatSetupStrategy.DefaultSetup && ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.provider.enterprise.id) {
|
|
696
|
-
setupStrategy = ChatSetupStrategy.SetupWithEnterpriseProvider;
|
|
697
|
-
}
|
|
698
|
-
if (setupStrategy !== ChatSetupStrategy.Canceled && !options?.disableChatViewReveal) {
|
|
699
|
-
showChatView(this.viewsService, this.layoutService);
|
|
700
|
-
}
|
|
701
|
-
let success = undefined;
|
|
702
|
-
try {
|
|
703
|
-
switch (setupStrategy) {
|
|
704
|
-
case ChatSetupStrategy.SetupWithEnterpriseProvider:
|
|
705
|
-
success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: true, useSocialProvider: undefined, additionalScopes: options?.additionalScopes, forceAnonymous: options?.forceAnonymous });
|
|
706
|
-
break;
|
|
707
|
-
case ChatSetupStrategy.SetupWithoutEnterpriseProvider:
|
|
708
|
-
success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: false, useSocialProvider: undefined, additionalScopes: options?.additionalScopes, forceAnonymous: options?.forceAnonymous });
|
|
709
|
-
break;
|
|
710
|
-
case ChatSetupStrategy.SetupWithAppleProvider:
|
|
711
|
-
success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: false, useSocialProvider: 'apple', additionalScopes: options?.additionalScopes, forceAnonymous: options?.forceAnonymous });
|
|
712
|
-
break;
|
|
713
|
-
case ChatSetupStrategy.SetupWithGoogleProvider:
|
|
714
|
-
success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: false, useSocialProvider: 'google', additionalScopes: options?.additionalScopes, forceAnonymous: options?.forceAnonymous });
|
|
715
|
-
break;
|
|
716
|
-
case ChatSetupStrategy.DefaultSetup:
|
|
717
|
-
success = await this.controller.value.setup({ ...options, forceAnonymous: options?.forceAnonymous });
|
|
718
|
-
break;
|
|
719
|
-
case ChatSetupStrategy.Canceled:
|
|
720
|
-
this.context.update({ later: true });
|
|
721
|
-
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedMaybeLater', installDuration: 0, signUpErrorCode: undefined, provider: undefined });
|
|
722
|
-
break;
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
catch (error) {
|
|
726
|
-
this.logService.error(`[chat setup] Error during setup: ${toErrorMessage(error)}`);
|
|
727
|
-
success = false;
|
|
728
|
-
}
|
|
729
|
-
return { success, dialogSkipped };
|
|
730
|
-
}
|
|
731
|
-
async showDialog(options) {
|
|
732
|
-
const disposables = ( new DisposableStore());
|
|
733
|
-
const buttons = this.getButtons(options);
|
|
734
|
-
const dialog = disposables.add(( new Dialog(
|
|
735
|
-
this.layoutService.activeContainer,
|
|
736
|
-
this.getDialogTitle(options),
|
|
737
|
-
( buttons.map(button => button[0])),
|
|
738
|
-
createWorkbenchDialogOptions({
|
|
739
|
-
type: 'none',
|
|
740
|
-
extraClasses: ['chat-setup-dialog'],
|
|
741
|
-
detail: ' ',
|
|
742
|
-
icon: Codicon.copilotLarge,
|
|
743
|
-
alignment: DialogContentsAlignment.Vertical,
|
|
744
|
-
cancelId: buttons.length - 1,
|
|
745
|
-
disableCloseButton: true,
|
|
746
|
-
renderFooter: footer => footer.appendChild(this.createDialogFooter(disposables, options)),
|
|
747
|
-
buttonOptions: ( buttons.map(button => button[2]))
|
|
748
|
-
}, this.keybindingService, this.layoutService)
|
|
749
|
-
)));
|
|
750
|
-
const { button } = await dialog.show();
|
|
751
|
-
disposables.dispose();
|
|
752
|
-
return buttons[button]?.[1] ?? ChatSetupStrategy.Canceled;
|
|
753
|
-
}
|
|
754
|
-
getButtons(options) {
|
|
755
|
-
const styleButton = (...classes) => ({ styleButton: (button) => button.element.classList.add(...classes) });
|
|
756
|
-
let buttons;
|
|
757
|
-
if (!options?.forceAnonymous && (this.context.state.entitlement === ChatEntitlement.Unknown || options?.forceSignInDialog)) {
|
|
758
|
-
const defaultProviderButton = [( localize(5453, "Continue with {0}", defaultChat.provider.default.name)), ChatSetupStrategy.SetupWithoutEnterpriseProvider, styleButton('continue-button', 'default')];
|
|
759
|
-
const defaultProviderLink = [defaultProviderButton[0], defaultProviderButton[1], styleButton('link-button')];
|
|
760
|
-
const enterpriseProviderButton = [( localize(5453, "Continue with {0}", defaultChat.provider.enterprise.name)), ChatSetupStrategy.SetupWithEnterpriseProvider, styleButton('continue-button', 'default')];
|
|
761
|
-
const enterpriseProviderLink = [enterpriseProviderButton[0], enterpriseProviderButton[1], styleButton('link-button')];
|
|
762
|
-
const googleProviderButton = [( localize(5453, "Continue with {0}", defaultChat.provider.google.name)), ChatSetupStrategy.SetupWithGoogleProvider, styleButton('continue-button', 'google')];
|
|
763
|
-
const appleProviderButton = [( localize(5453, "Continue with {0}", defaultChat.provider.apple.name)), ChatSetupStrategy.SetupWithAppleProvider, styleButton('continue-button', 'apple')];
|
|
764
|
-
if (ChatEntitlementRequests.providerId(this.configurationService) !== defaultChat.provider.enterprise.id) {
|
|
765
|
-
buttons = coalesce([
|
|
766
|
-
defaultProviderButton,
|
|
767
|
-
googleProviderButton,
|
|
768
|
-
appleProviderButton,
|
|
769
|
-
enterpriseProviderLink
|
|
770
|
-
]);
|
|
771
|
-
}
|
|
772
|
-
else {
|
|
773
|
-
buttons = coalesce([
|
|
774
|
-
enterpriseProviderButton,
|
|
775
|
-
googleProviderButton,
|
|
776
|
-
appleProviderButton,
|
|
777
|
-
defaultProviderLink
|
|
778
|
-
]);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
else {
|
|
782
|
-
buttons = [[( localize(5454, "Use AI Features")), ChatSetupStrategy.DefaultSetup, undefined]];
|
|
783
|
-
}
|
|
784
|
-
buttons.push([( localize(5455, "Skip for now")), ChatSetupStrategy.Canceled, styleButton('link-button', 'skip-button')]);
|
|
785
|
-
return buttons;
|
|
786
|
-
}
|
|
787
|
-
getDialogTitle(options) {
|
|
788
|
-
if (this.chatEntitlementService.anonymous) {
|
|
789
|
-
if (options?.forceAnonymous) {
|
|
790
|
-
return localize(5456, "Start using AI Features");
|
|
791
|
-
}
|
|
792
|
-
else {
|
|
793
|
-
return localize(5457, "Enable more AI features");
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
if (this.context.state.entitlement === ChatEntitlement.Unknown || options?.forceSignInDialog) {
|
|
797
|
-
return localize(5458, "Sign in to use AI Features");
|
|
798
|
-
}
|
|
799
|
-
return localize(5456, "Start using AI Features");
|
|
800
|
-
}
|
|
801
|
-
createDialogFooter(disposables, options) {
|
|
802
|
-
const element = $('.chat-setup-dialog-footer');
|
|
803
|
-
let footer;
|
|
804
|
-
if (options?.forceAnonymous || this.telemetryService.telemetryLevel === TelemetryLevel.NONE) {
|
|
805
|
-
footer = ( localize(
|
|
806
|
-
5459,
|
|
807
|
-
"By continuing, you agree to {0}'s [Terms]({1}) and [Privacy Statement]({2}).",
|
|
808
|
-
defaultChat.provider.default.name,
|
|
809
|
-
defaultChat.termsStatementUrl,
|
|
810
|
-
defaultChat.privacyStatementUrl
|
|
811
|
-
));
|
|
812
|
-
}
|
|
813
|
-
else {
|
|
814
|
-
footer = ( localize(
|
|
815
|
-
5460,
|
|
816
|
-
"By continuing, you agree to {0}'s [Terms]({1}) and [Privacy Statement]({2}). {3} Copilot may show [public code]({4}) suggestions and use your data to improve the product. You can change these [settings]({5}) anytime.",
|
|
817
|
-
defaultChat.provider.default.name,
|
|
818
|
-
defaultChat.termsStatementUrl,
|
|
819
|
-
defaultChat.privacyStatementUrl,
|
|
820
|
-
defaultChat.provider.default.name,
|
|
821
|
-
defaultChat.publicCodeMatchesUrl,
|
|
822
|
-
defaultChat.manageSettingsUrl
|
|
823
|
-
));
|
|
824
|
-
}
|
|
825
|
-
element.appendChild($('p', undefined, disposables.add(this.markdownRendererService.render(( new MarkdownString(footer, { isTrusted: true })))).element));
|
|
826
|
-
return element;
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
ChatSetup = ChatSetup_1 = ( __decorate([
|
|
830
|
-
( __param(2, ITelemetryService)),
|
|
831
|
-
( __param(3, ILayoutService)),
|
|
832
|
-
( __param(4, IKeybindingService)),
|
|
833
|
-
( __param(5, IChatEntitlementService)),
|
|
834
|
-
( __param(6, ILogService)),
|
|
835
|
-
( __param(7, IConfigurationService)),
|
|
836
|
-
( __param(8, IViewsService)),
|
|
837
|
-
( __param(9, IWorkspaceTrustRequestService)),
|
|
838
|
-
( __param(10, IMarkdownRendererService))
|
|
839
|
-
], ChatSetup));
|
|
840
|
-
let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
841
|
-
static { this.ID = 'workbench.contrib.chatSetup'; }
|
|
842
|
-
constructor(productService, instantiationService, commandService, telemetryService, chatEntitlementService, chatModeService, logService, contextKeyService, extensionEnablementService, extensionsWorkbenchService, extensionService, environmentService, configurationService) {
|
|
843
|
-
super();
|
|
844
|
-
this.productService = productService;
|
|
845
|
-
this.instantiationService = instantiationService;
|
|
846
|
-
this.commandService = commandService;
|
|
847
|
-
this.telemetryService = telemetryService;
|
|
848
|
-
this.chatModeService = chatModeService;
|
|
849
|
-
this.logService = logService;
|
|
850
|
-
this.contextKeyService = contextKeyService;
|
|
851
|
-
this.extensionEnablementService = extensionEnablementService;
|
|
852
|
-
this.extensionsWorkbenchService = extensionsWorkbenchService;
|
|
853
|
-
this.extensionService = extensionService;
|
|
854
|
-
this.environmentService = environmentService;
|
|
855
|
-
this.configurationService = configurationService;
|
|
856
|
-
const context = chatEntitlementService.context?.value;
|
|
857
|
-
const requests = chatEntitlementService.requests?.value;
|
|
858
|
-
if (!context || !requests) {
|
|
859
|
-
return;
|
|
860
|
-
}
|
|
861
|
-
const controller = ( new Lazy(
|
|
862
|
-
() => this._register(this.instantiationService.createInstance(ChatSetupController, context, requests))
|
|
863
|
-
));
|
|
864
|
-
this.registerSetupAgents(context, controller);
|
|
865
|
-
this.registerActions(context, requests, controller);
|
|
866
|
-
this.registerUrlLinkHandler();
|
|
867
|
-
this.checkExtensionInstallation(context);
|
|
868
|
-
}
|
|
869
|
-
registerSetupAgents(context, controller) {
|
|
870
|
-
if (this.configurationService.getValue('chat.experimental.disableCoreAgents')) {
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
const defaultAgentDisposables = markAsSingleton(( new MutableDisposable()));
|
|
874
|
-
const vscodeAgentDisposables = markAsSingleton(( new MutableDisposable()));
|
|
875
|
-
const renameProviderDisposables = markAsSingleton(( new MutableDisposable()));
|
|
876
|
-
const updateRegistration = () => {
|
|
877
|
-
{
|
|
878
|
-
if (!context.state.hidden && !context.state.disabled) {
|
|
879
|
-
if (!defaultAgentDisposables.value) {
|
|
880
|
-
const disposables = defaultAgentDisposables.value = ( new DisposableStore());
|
|
881
|
-
const panelAgentDisposables = disposables.add(( new DisposableStore()));
|
|
882
|
-
for (const mode of [ChatModeKind.Ask, ChatModeKind.Edit, ChatModeKind.Agent]) {
|
|
883
|
-
const { agent, disposable } = SetupAgent.registerDefaultAgents(this.instantiationService, ChatAgentLocation.Chat, mode, context, controller);
|
|
884
|
-
panelAgentDisposables.add(disposable);
|
|
885
|
-
panelAgentDisposables.add(agent.onUnresolvableError(() => {
|
|
886
|
-
const panelAgentHasGuidance = ( chatViewsWelcomeRegistry.get().some(descriptor => this.contextKeyService.contextMatchesRules(descriptor.when)));
|
|
887
|
-
if (panelAgentHasGuidance) {
|
|
888
|
-
this.logService.error('[chat setup] Unresolvable error from Chat agent registration, clearing registration.');
|
|
889
|
-
panelAgentDisposables.dispose();
|
|
890
|
-
}
|
|
891
|
-
}));
|
|
892
|
-
}
|
|
893
|
-
disposables.add(SetupAgent.registerDefaultAgents(this.instantiationService, ChatAgentLocation.Terminal, undefined, context, controller).disposable);
|
|
894
|
-
disposables.add(SetupAgent.registerDefaultAgents(this.instantiationService, ChatAgentLocation.Notebook, undefined, context, controller).disposable);
|
|
895
|
-
disposables.add(SetupAgent.registerDefaultAgents(this.instantiationService, ChatAgentLocation.EditorInline, undefined, context, controller).disposable);
|
|
896
|
-
}
|
|
897
|
-
if ((!context.state.installed || context.state.entitlement === ChatEntitlement.Unknown || context.state.entitlement === ChatEntitlement.Unresolved) && !vscodeAgentDisposables.value) {
|
|
898
|
-
const disposables = vscodeAgentDisposables.value = ( new DisposableStore());
|
|
899
|
-
disposables.add(SetupAgent.registerBuiltInAgents(this.instantiationService, context, controller));
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
else {
|
|
903
|
-
defaultAgentDisposables.clear();
|
|
904
|
-
vscodeAgentDisposables.clear();
|
|
905
|
-
}
|
|
906
|
-
if (context.state.installed && !context.state.disabled) {
|
|
907
|
-
vscodeAgentDisposables.clear();
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
{
|
|
911
|
-
if (!context.state.installed && !context.state.hidden && !context.state.disabled) {
|
|
912
|
-
if (!renameProviderDisposables.value) {
|
|
913
|
-
renameProviderDisposables.value = DefaultNewSymbolNamesProvider.registerProvider(this.instantiationService, context, controller);
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
else {
|
|
917
|
-
renameProviderDisposables.clear();
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
};
|
|
921
|
-
this._register(Event.runAndSubscribe(context.onDidChange, () => updateRegistration()));
|
|
922
|
-
}
|
|
923
|
-
registerActions(context, requests, controller) {
|
|
924
|
-
class ChatSetupTriggerAction extends Action2 {
|
|
925
|
-
static { this.CHAT_SETUP_ACTION_LABEL = ( localize2(5461, "Use AI Features with Copilot for free...")); }
|
|
926
|
-
constructor() {
|
|
927
|
-
super({
|
|
928
|
-
id: CHAT_SETUP_ACTION_ID,
|
|
929
|
-
title: ChatSetupTriggerAction.CHAT_SETUP_ACTION_LABEL,
|
|
930
|
-
category: CHAT_CATEGORY,
|
|
931
|
-
f1: true,
|
|
932
|
-
precondition: ( ContextKeyExpr.or(
|
|
933
|
-
ChatContextKeys.Setup.hidden,
|
|
934
|
-
ChatContextKeys.Setup.disabled,
|
|
935
|
-
ChatContextKeys.Setup.untrusted,
|
|
936
|
-
( ChatContextKeys.Setup.installed.negate()),
|
|
937
|
-
ChatContextKeys.Entitlement.canSignUp
|
|
938
|
-
))
|
|
939
|
-
});
|
|
940
|
-
}
|
|
941
|
-
async run(accessor, mode, options) {
|
|
942
|
-
const viewsService = accessor.get(IViewsService);
|
|
943
|
-
const layoutService = accessor.get(IWorkbenchLayoutService);
|
|
944
|
-
const instantiationService = accessor.get(IInstantiationService);
|
|
945
|
-
const dialogService = accessor.get(IDialogService);
|
|
946
|
-
const commandService = accessor.get(ICommandService);
|
|
947
|
-
const lifecycleService = accessor.get(ILifecycleService);
|
|
948
|
-
const configurationService = accessor.get(IConfigurationService);
|
|
949
|
-
await context.update({ hidden: false });
|
|
950
|
-
configurationService.updateValue(ChatTeardownContribution.CHAT_DISABLED_CONFIGURATION_KEY, false);
|
|
951
|
-
if (mode) {
|
|
952
|
-
const chatWidget = await showChatView(viewsService, layoutService);
|
|
953
|
-
chatWidget?.input.setChatMode(mode);
|
|
954
|
-
}
|
|
955
|
-
const setup = ChatSetup.getInstance(instantiationService, context, controller);
|
|
956
|
-
const { success } = await setup.run(options);
|
|
957
|
-
if (success === false && !lifecycleService.willShutdown) {
|
|
958
|
-
const { confirmed } = await dialogService.confirm({
|
|
959
|
-
type: Severity.Error,
|
|
960
|
-
message: ( localize(5462, "Chat setup failed. Would you like to try again?")),
|
|
961
|
-
primaryButton: ( localize(5463, "Retry")),
|
|
962
|
-
});
|
|
963
|
-
if (confirmed) {
|
|
964
|
-
return Boolean(await commandService.executeCommand(CHAT_SETUP_ACTION_ID, mode, options));
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
return Boolean(success);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
class ChatSetupTriggerSupportAnonymousAction extends Action2 {
|
|
971
|
-
constructor() {
|
|
972
|
-
super({
|
|
973
|
-
id: CHAT_SETUP_SUPPORT_ANONYMOUS_ACTION_ID,
|
|
974
|
-
title: ChatSetupTriggerAction.CHAT_SETUP_ACTION_LABEL
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
async run(accessor) {
|
|
978
|
-
const commandService = accessor.get(ICommandService);
|
|
979
|
-
const telemetryService = accessor.get(ITelemetryService);
|
|
980
|
-
const chatEntitlementService = accessor.get(IChatEntitlementService);
|
|
981
|
-
telemetryService.publicLog2('workbenchActionExecuted', { id: CHAT_SETUP_ACTION_ID, from: 'api' });
|
|
982
|
-
return commandService.executeCommand(CHAT_SETUP_ACTION_ID, undefined, {
|
|
983
|
-
forceAnonymous: chatEntitlementService.anonymous ? ChatSetupAnonymous.EnabledWithDialog : undefined
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
class ChatSetupTriggerForceSignInDialogAction extends Action2 {
|
|
988
|
-
constructor() {
|
|
989
|
-
super({
|
|
990
|
-
id: 'workbench.action.chat.triggerSetupForceSignIn',
|
|
991
|
-
title: ( localize2(5464, "Sign in to use AI features"))
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
async run(accessor) {
|
|
995
|
-
const commandService = accessor.get(ICommandService);
|
|
996
|
-
const telemetryService = accessor.get(ITelemetryService);
|
|
997
|
-
telemetryService.publicLog2('workbenchActionExecuted', { id: CHAT_SETUP_ACTION_ID, from: 'api' });
|
|
998
|
-
return commandService.executeCommand(CHAT_SETUP_ACTION_ID, undefined, { forceSignInDialog: true });
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
class ChatSetupTriggerAnonymousWithoutDialogAction extends Action2 {
|
|
1002
|
-
constructor() {
|
|
1003
|
-
super({
|
|
1004
|
-
id: 'workbench.action.chat.triggerSetupAnonymousWithoutDialog',
|
|
1005
|
-
title: ChatSetupTriggerAction.CHAT_SETUP_ACTION_LABEL
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
async run(accessor) {
|
|
1009
|
-
const commandService = accessor.get(ICommandService);
|
|
1010
|
-
const telemetryService = accessor.get(ITelemetryService);
|
|
1011
|
-
telemetryService.publicLog2('workbenchActionExecuted', { id: CHAT_SETUP_ACTION_ID, from: 'api' });
|
|
1012
|
-
return commandService.executeCommand(CHAT_SETUP_ACTION_ID, undefined, { forceAnonymous: ChatSetupAnonymous.EnabledWithoutDialog });
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
class ChatSetupFromAccountsAction extends Action2 {
|
|
1016
|
-
constructor() {
|
|
1017
|
-
super({
|
|
1018
|
-
id: 'workbench.action.chat.triggerSetupFromAccounts',
|
|
1019
|
-
title: ( localize2(5465, "Sign in to use AI features...")),
|
|
1020
|
-
menu: {
|
|
1021
|
-
id: MenuId.AccountsContext,
|
|
1022
|
-
group: '2_copilot',
|
|
1023
|
-
when: ( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.installed.negate()), ChatContextKeys.Entitlement.signedOut))
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
async run(accessor) {
|
|
1028
|
-
const commandService = accessor.get(ICommandService);
|
|
1029
|
-
const telemetryService = accessor.get(ITelemetryService);
|
|
1030
|
-
telemetryService.publicLog2('workbenchActionExecuted', { id: CHAT_SETUP_ACTION_ID, from: 'accounts' });
|
|
1031
|
-
return commandService.executeCommand(CHAT_SETUP_ACTION_ID);
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
const windowFocusListener = this._register(( new MutableDisposable()));
|
|
1035
|
-
class UpgradePlanAction extends Action2 {
|
|
1036
|
-
constructor() {
|
|
1037
|
-
super({
|
|
1038
|
-
id: 'workbench.action.chat.upgradePlan',
|
|
1039
|
-
title: ( localize2(5466, "Upgrade to GitHub Copilot Pro")),
|
|
1040
|
-
category: ( localize2(5467, 'Chat')),
|
|
1041
|
-
f1: true,
|
|
1042
|
-
precondition: ( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ContextKeyExpr.or(
|
|
1043
|
-
ChatContextKeys.Entitlement.canSignUp,
|
|
1044
|
-
ChatContextKeys.Entitlement.planFree
|
|
1045
|
-
)))),
|
|
1046
|
-
menu: {
|
|
1047
|
-
id: MenuId.ChatTitleBarMenu,
|
|
1048
|
-
group: 'a_first',
|
|
1049
|
-
order: 1,
|
|
1050
|
-
when: ( ContextKeyExpr.and(ChatContextKeys.Entitlement.planFree, ( ContextKeyExpr.or(
|
|
1051
|
-
ChatContextKeys.chatQuotaExceeded,
|
|
1052
|
-
ChatContextKeys.completionsQuotaExceeded
|
|
1053
|
-
))))
|
|
1054
|
-
}
|
|
1055
|
-
});
|
|
1056
|
-
}
|
|
1057
|
-
async run(accessor) {
|
|
1058
|
-
const openerService = accessor.get(IOpenerService);
|
|
1059
|
-
const hostService = accessor.get(IHostService);
|
|
1060
|
-
const commandService = accessor.get(ICommandService);
|
|
1061
|
-
openerService.open(( URI.parse(defaultChat.upgradePlanUrl)));
|
|
1062
|
-
const entitlement = context.state.entitlement;
|
|
1063
|
-
if (!isProUser(entitlement)) {
|
|
1064
|
-
windowFocusListener.value = hostService.onDidChangeFocus(focus => this.onWindowFocus(focus, commandService));
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
async onWindowFocus(focus, commandService) {
|
|
1068
|
-
if (focus) {
|
|
1069
|
-
windowFocusListener.clear();
|
|
1070
|
-
const entitlements = await requests.forceResolveEntitlement(undefined);
|
|
1071
|
-
if (entitlements?.entitlement && isProUser(entitlements?.entitlement)) {
|
|
1072
|
-
refreshTokens(commandService);
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
class EnableOveragesAction extends Action2 {
|
|
1078
|
-
constructor() {
|
|
1079
|
-
super({
|
|
1080
|
-
id: 'workbench.action.chat.manageOverages',
|
|
1081
|
-
title: ( localize2(5468, "Manage GitHub Copilot Overages")),
|
|
1082
|
-
category: ( localize2(5467, 'Chat')),
|
|
1083
|
-
f1: true,
|
|
1084
|
-
precondition: ( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ContextKeyExpr.or(
|
|
1085
|
-
ChatContextKeys.Entitlement.planPro,
|
|
1086
|
-
ChatContextKeys.Entitlement.planProPlus
|
|
1087
|
-
)))),
|
|
1088
|
-
menu: {
|
|
1089
|
-
id: MenuId.ChatTitleBarMenu,
|
|
1090
|
-
group: 'a_first',
|
|
1091
|
-
order: 1,
|
|
1092
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.or(
|
|
1093
|
-
ChatContextKeys.Entitlement.planPro,
|
|
1094
|
-
ChatContextKeys.Entitlement.planProPlus
|
|
1095
|
-
)), ( ContextKeyExpr.or(
|
|
1096
|
-
ChatContextKeys.chatQuotaExceeded,
|
|
1097
|
-
ChatContextKeys.completionsQuotaExceeded
|
|
1098
|
-
))))
|
|
1099
|
-
}
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
async run(accessor) {
|
|
1103
|
-
const openerService = accessor.get(IOpenerService);
|
|
1104
|
-
openerService.open(( URI.parse(defaultChat.manageOveragesUrl)));
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
registerAction2(ChatSetupTriggerAction);
|
|
1108
|
-
registerAction2(ChatSetupTriggerForceSignInDialogAction);
|
|
1109
|
-
registerAction2(ChatSetupFromAccountsAction);
|
|
1110
|
-
registerAction2(ChatSetupTriggerAnonymousWithoutDialogAction);
|
|
1111
|
-
registerAction2(ChatSetupTriggerSupportAnonymousAction);
|
|
1112
|
-
registerAction2(UpgradePlanAction);
|
|
1113
|
-
registerAction2(EnableOveragesAction);
|
|
1114
|
-
}
|
|
1115
|
-
registerUrlLinkHandler() {
|
|
1116
|
-
this._register(ExtensionUrlHandlerOverrideRegistry.registerHandler({
|
|
1117
|
-
canHandleURL: url => {
|
|
1118
|
-
return url.scheme === this.productService.urlProtocol && equalsIgnoreCase(url.authority, defaultChat.chatExtensionId);
|
|
1119
|
-
},
|
|
1120
|
-
handleURL: async (url) => {
|
|
1121
|
-
const params = ( new URLSearchParams(url.query));
|
|
1122
|
-
this.telemetryService.publicLog2('workbenchActionExecuted', { id: CHAT_SETUP_ACTION_ID, from: 'url', detail: params.get('referrer') ?? undefined });
|
|
1123
|
-
const agentParam = params.get('agent') ?? params.get('mode');
|
|
1124
|
-
if (agentParam) {
|
|
1125
|
-
const agents = this.chatModeService.getModes();
|
|
1126
|
-
const allAgents = [...agents.builtin, ...agents.custom];
|
|
1127
|
-
let foundAgent = allAgents.find(agent => agent.id === agentParam);
|
|
1128
|
-
if (!foundAgent) {
|
|
1129
|
-
const nameLower = agentParam.toLowerCase();
|
|
1130
|
-
foundAgent = allAgents.find(agent => agent.name.get().toLowerCase() === nameLower);
|
|
1131
|
-
}
|
|
1132
|
-
await this.commandService.executeCommand(CHAT_SETUP_ACTION_ID, foundAgent?.id);
|
|
1133
|
-
return true;
|
|
1134
|
-
}
|
|
1135
|
-
return false;
|
|
1136
|
-
}
|
|
1137
|
-
}));
|
|
1138
|
-
}
|
|
1139
|
-
async checkExtensionInstallation(context) {
|
|
1140
|
-
if (this.environmentService.isExtensionDevelopment) {
|
|
1141
|
-
await this.extensionService.whenInstalledExtensionsRegistered();
|
|
1142
|
-
if (this.extensionService.extensions.find(ext => ExtensionIdentifier.equals(ext.identifier, defaultChat.chatExtensionId))) {
|
|
1143
|
-
context.update({ installed: true, disabled: false, untrusted: false });
|
|
1144
|
-
return;
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
await this.extensionsWorkbenchService.queryLocal();
|
|
1148
|
-
this._register(Event.runAndSubscribe(this.extensionsWorkbenchService.onChange, e => {
|
|
1149
|
-
if (e && !ExtensionIdentifier.equals(e.identifier.id, defaultChat.chatExtensionId)) {
|
|
1150
|
-
return;
|
|
1151
|
-
}
|
|
1152
|
-
const defaultChatExtension = this.extensionsWorkbenchService.local.find(value => ExtensionIdentifier.equals(value.identifier.id, defaultChat.chatExtensionId));
|
|
1153
|
-
const installed = !!defaultChatExtension?.local;
|
|
1154
|
-
let disabled;
|
|
1155
|
-
let untrusted = false;
|
|
1156
|
-
if (installed) {
|
|
1157
|
-
disabled = !this.extensionEnablementService.isEnabled(defaultChatExtension.local);
|
|
1158
|
-
if (disabled) {
|
|
1159
|
-
const state = this.extensionEnablementService.getEnablementState(defaultChatExtension.local);
|
|
1160
|
-
if (state === EnablementState.DisabledByTrustRequirement) {
|
|
1161
|
-
disabled = false;
|
|
1162
|
-
untrusted = true;
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
else {
|
|
1167
|
-
disabled = false;
|
|
1168
|
-
}
|
|
1169
|
-
context.update({ installed, disabled, untrusted });
|
|
1170
|
-
}));
|
|
1171
|
-
}
|
|
1172
|
-
};
|
|
1173
|
-
ChatSetupContribution = ( __decorate([
|
|
1174
|
-
( __param(0, IProductService)),
|
|
1175
|
-
( __param(1, IInstantiationService)),
|
|
1176
|
-
( __param(2, ICommandService)),
|
|
1177
|
-
( __param(3, ITelemetryService)),
|
|
1178
|
-
( __param(4, IChatEntitlementService)),
|
|
1179
|
-
( __param(5, IChatModeService)),
|
|
1180
|
-
( __param(6, ILogService)),
|
|
1181
|
-
( __param(7, IContextKeyService)),
|
|
1182
|
-
( __param(8, IWorkbenchExtensionEnablementService)),
|
|
1183
|
-
( __param(9, IExtensionsWorkbenchService)),
|
|
1184
|
-
( __param(10, IExtensionService)),
|
|
1185
|
-
( __param(11, IEnvironmentService)),
|
|
1186
|
-
( __param(12, IConfigurationService))
|
|
1187
|
-
], ChatSetupContribution));
|
|
1188
|
-
let ChatTeardownContribution = class ChatTeardownContribution extends Disposable {
|
|
1189
|
-
static { ChatTeardownContribution_1 = this; }
|
|
1190
|
-
static { this.ID = 'workbench.contrib.chatTeardown'; }
|
|
1191
|
-
static { this.CHAT_DISABLED_CONFIGURATION_KEY = 'chat.disableAIFeatures'; }
|
|
1192
|
-
constructor(chatEntitlementService, configurationService, extensionsWorkbenchService, extensionEnablementService, viewDescriptorService, layoutService) {
|
|
1193
|
-
super();
|
|
1194
|
-
this.configurationService = configurationService;
|
|
1195
|
-
this.extensionsWorkbenchService = extensionsWorkbenchService;
|
|
1196
|
-
this.extensionEnablementService = extensionEnablementService;
|
|
1197
|
-
this.viewDescriptorService = viewDescriptorService;
|
|
1198
|
-
this.layoutService = layoutService;
|
|
1199
|
-
const context = chatEntitlementService.context?.value;
|
|
1200
|
-
if (!context) {
|
|
1201
|
-
return;
|
|
1202
|
-
}
|
|
1203
|
-
this.registerListeners();
|
|
1204
|
-
this.registerActions();
|
|
1205
|
-
this.handleChatDisabled(false);
|
|
1206
|
-
}
|
|
1207
|
-
handleChatDisabled(fromEvent) {
|
|
1208
|
-
const chatDisabled = this.configurationService.inspect(ChatTeardownContribution_1.CHAT_DISABLED_CONFIGURATION_KEY);
|
|
1209
|
-
if (chatDisabled.value === true) {
|
|
1210
|
-
this.maybeEnableOrDisableExtension(typeof chatDisabled.workspaceValue === 'boolean' ? EnablementState.DisabledWorkspace : EnablementState.DisabledGlobally);
|
|
1211
|
-
if (fromEvent) {
|
|
1212
|
-
this.maybeHideAuxiliaryBar();
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
else if (chatDisabled.value === false && fromEvent ) {
|
|
1216
|
-
this.maybeEnableOrDisableExtension(typeof chatDisabled.workspaceValue === 'boolean' ? EnablementState.EnabledWorkspace : EnablementState.EnabledGlobally);
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
async registerListeners() {
|
|
1220
|
-
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
1221
|
-
if (!e.affectsConfiguration(ChatTeardownContribution_1.CHAT_DISABLED_CONFIGURATION_KEY)) {
|
|
1222
|
-
return;
|
|
1223
|
-
}
|
|
1224
|
-
this.handleChatDisabled(true);
|
|
1225
|
-
}));
|
|
1226
|
-
await this.extensionsWorkbenchService.queryLocal();
|
|
1227
|
-
this._register(this.extensionsWorkbenchService.onChange(e => {
|
|
1228
|
-
if (e && !ExtensionIdentifier.equals(e.identifier.id, defaultChat.chatExtensionId)) {
|
|
1229
|
-
return;
|
|
1230
|
-
}
|
|
1231
|
-
const defaultChatExtension = this.extensionsWorkbenchService.local.find(value => ExtensionIdentifier.equals(value.identifier.id, defaultChat.chatExtensionId));
|
|
1232
|
-
if (defaultChatExtension?.local && this.extensionEnablementService.isEnabled(defaultChatExtension.local)) {
|
|
1233
|
-
this.configurationService.updateValue(ChatTeardownContribution_1.CHAT_DISABLED_CONFIGURATION_KEY, false);
|
|
1234
|
-
}
|
|
1235
|
-
}));
|
|
1236
|
-
}
|
|
1237
|
-
async maybeEnableOrDisableExtension(state) {
|
|
1238
|
-
const defaultChatExtension = this.extensionsWorkbenchService.local.find(value => ExtensionIdentifier.equals(value.identifier.id, defaultChat.chatExtensionId));
|
|
1239
|
-
if (!defaultChatExtension) {
|
|
1240
|
-
return;
|
|
1241
|
-
}
|
|
1242
|
-
await this.extensionsWorkbenchService.setEnablement([defaultChatExtension], state);
|
|
1243
|
-
await this.extensionsWorkbenchService.updateRunningExtensions(state === EnablementState.EnabledGlobally || state === EnablementState.EnabledWorkspace ? ( localize(5469, "Enabling AI features")) : ( localize(5470, "Disabling AI features")));
|
|
1244
|
-
}
|
|
1245
|
-
maybeHideAuxiliaryBar() {
|
|
1246
|
-
const activeContainers = this.viewDescriptorService.getViewContainersByLocation(ViewContainerLocation.AuxiliaryBar).filter(container => this.viewDescriptorService.getViewContainerModel(container).activeViewDescriptors.length > 0);
|
|
1247
|
-
if ((activeContainers.length === 0) ||
|
|
1248
|
-
(activeContainers.length === 1 && activeContainers.at(0)?.id === CHAT_SIDEBAR_PANEL_ID)
|
|
1249
|
-
) {
|
|
1250
|
-
this.layoutService.setPartHidden(true, Parts.AUXILIARYBAR_PART);
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
registerActions() {
|
|
1254
|
-
class ChatSetupHideAction extends Action2 {
|
|
1255
|
-
static { this.ID = 'workbench.action.chat.hideSetup'; }
|
|
1256
|
-
static { this.TITLE = ( localize2(5471, "Learn How to Hide AI Features")); }
|
|
1257
|
-
constructor() {
|
|
1258
|
-
super({
|
|
1259
|
-
id: ChatSetupHideAction.ID,
|
|
1260
|
-
title: ChatSetupHideAction.TITLE,
|
|
1261
|
-
f1: true,
|
|
1262
|
-
category: CHAT_CATEGORY,
|
|
1263
|
-
precondition: ( ChatContextKeys.Setup.hidden.negate()),
|
|
1264
|
-
menu: {
|
|
1265
|
-
id: MenuId.ChatTitleBarMenu,
|
|
1266
|
-
group: 'z_hide',
|
|
1267
|
-
order: 1,
|
|
1268
|
-
when: ( ChatContextKeys.Setup.installed.negate())
|
|
1269
|
-
}
|
|
1270
|
-
});
|
|
1271
|
-
}
|
|
1272
|
-
async run(accessor) {
|
|
1273
|
-
const preferencesService = accessor.get(IPreferencesService);
|
|
1274
|
-
preferencesService.openSettings({ jsonEditor: false, query: `@id:${ChatTeardownContribution_1.CHAT_DISABLED_CONFIGURATION_KEY}` });
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
registerAction2(ChatSetupHideAction);
|
|
1278
|
-
}
|
|
1279
|
-
};
|
|
1280
|
-
ChatTeardownContribution = ChatTeardownContribution_1 = ( __decorate([
|
|
1281
|
-
( __param(0, IChatEntitlementService)),
|
|
1282
|
-
( __param(1, IConfigurationService)),
|
|
1283
|
-
( __param(2, IExtensionsWorkbenchService)),
|
|
1284
|
-
( __param(3, IWorkbenchExtensionEnablementService)),
|
|
1285
|
-
( __param(4, IViewDescriptorService)),
|
|
1286
|
-
( __param(5, IWorkbenchLayoutService))
|
|
1287
|
-
], ChatTeardownContribution));
|
|
1288
|
-
var ChatSetupStep;
|
|
1289
|
-
(function (ChatSetupStep) {
|
|
1290
|
-
ChatSetupStep[ChatSetupStep["Initial"] = 1] = "Initial";
|
|
1291
|
-
ChatSetupStep[ChatSetupStep["SigningIn"] = 2] = "SigningIn";
|
|
1292
|
-
ChatSetupStep[ChatSetupStep["Installing"] = 3] = "Installing";
|
|
1293
|
-
})(ChatSetupStep || (ChatSetupStep = {}));
|
|
1294
|
-
let ChatSetupController = class ChatSetupController extends Disposable {
|
|
1295
|
-
get step() { return this._step; }
|
|
1296
|
-
constructor(context, requests, telemetryService, authenticationService, extensionsWorkbenchService, productService, logService, progressService, activityService, commandService, dialogService, configurationService, lifecycleService, quickInputService) {
|
|
1297
|
-
super();
|
|
1298
|
-
this.context = context;
|
|
1299
|
-
this.requests = requests;
|
|
1300
|
-
this.telemetryService = telemetryService;
|
|
1301
|
-
this.authenticationService = authenticationService;
|
|
1302
|
-
this.extensionsWorkbenchService = extensionsWorkbenchService;
|
|
1303
|
-
this.productService = productService;
|
|
1304
|
-
this.logService = logService;
|
|
1305
|
-
this.progressService = progressService;
|
|
1306
|
-
this.activityService = activityService;
|
|
1307
|
-
this.commandService = commandService;
|
|
1308
|
-
this.dialogService = dialogService;
|
|
1309
|
-
this.configurationService = configurationService;
|
|
1310
|
-
this.lifecycleService = lifecycleService;
|
|
1311
|
-
this.quickInputService = quickInputService;
|
|
1312
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
1313
|
-
this.onDidChange = this._onDidChange.event;
|
|
1314
|
-
this._step = ChatSetupStep.Initial;
|
|
1315
|
-
this.registerListeners();
|
|
1316
|
-
}
|
|
1317
|
-
registerListeners() {
|
|
1318
|
-
this._register(this.context.onDidChange(() => this._onDidChange.fire()));
|
|
1319
|
-
}
|
|
1320
|
-
setStep(step) {
|
|
1321
|
-
if (this._step === step) {
|
|
1322
|
-
return;
|
|
1323
|
-
}
|
|
1324
|
-
this._step = step;
|
|
1325
|
-
this._onDidChange.fire();
|
|
1326
|
-
}
|
|
1327
|
-
async setup(options = {}) {
|
|
1328
|
-
const watch = ( new StopWatch(false));
|
|
1329
|
-
const title = ( localize(5472, "Getting chat ready..."));
|
|
1330
|
-
const badge = this.activityService.showViewContainerActivity(CHAT_SIDEBAR_PANEL_ID, {
|
|
1331
|
-
badge: ( new ProgressBadge(() => title)),
|
|
1332
|
-
});
|
|
1333
|
-
try {
|
|
1334
|
-
return await this.progressService.withProgress({
|
|
1335
|
-
location: ProgressLocation.Window,
|
|
1336
|
-
command: CHAT_OPEN_ACTION_ID,
|
|
1337
|
-
title,
|
|
1338
|
-
}, () => this.doSetup(options, watch));
|
|
1339
|
-
}
|
|
1340
|
-
finally {
|
|
1341
|
-
badge.dispose();
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
async doSetup(options, watch) {
|
|
1345
|
-
this.context.suspend();
|
|
1346
|
-
let success = false;
|
|
1347
|
-
try {
|
|
1348
|
-
const providerId = ChatEntitlementRequests.providerId(this.configurationService);
|
|
1349
|
-
let session;
|
|
1350
|
-
let entitlement;
|
|
1351
|
-
let signIn;
|
|
1352
|
-
if (options.forceSignIn) {
|
|
1353
|
-
signIn = true;
|
|
1354
|
-
}
|
|
1355
|
-
else if (this.context.state.entitlement === ChatEntitlement.Unknown) {
|
|
1356
|
-
if (options.forceAnonymous) {
|
|
1357
|
-
signIn = false;
|
|
1358
|
-
}
|
|
1359
|
-
else {
|
|
1360
|
-
signIn = true;
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
else {
|
|
1364
|
-
signIn = false;
|
|
1365
|
-
}
|
|
1366
|
-
if (signIn) {
|
|
1367
|
-
this.setStep(ChatSetupStep.SigningIn);
|
|
1368
|
-
const result = await this.signIn(options);
|
|
1369
|
-
if (!result.session) {
|
|
1370
|
-
this.doInstall();
|
|
1371
|
-
const provider = options.useSocialProvider ?? (options.useEnterpriseProvider ? defaultChat.provider.enterprise.id : defaultChat.provider.default.id);
|
|
1372
|
-
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider });
|
|
1373
|
-
return undefined;
|
|
1374
|
-
}
|
|
1375
|
-
session = result.session;
|
|
1376
|
-
entitlement = result.entitlement;
|
|
1377
|
-
}
|
|
1378
|
-
this.setStep(ChatSetupStep.Installing);
|
|
1379
|
-
success = await this.install(session, entitlement ?? this.context.state.entitlement, providerId, watch, options);
|
|
1380
|
-
}
|
|
1381
|
-
finally {
|
|
1382
|
-
this.setStep(ChatSetupStep.Initial);
|
|
1383
|
-
this.context.resume();
|
|
1384
|
-
}
|
|
1385
|
-
return success;
|
|
1386
|
-
}
|
|
1387
|
-
async signIn(options) {
|
|
1388
|
-
let session;
|
|
1389
|
-
let entitlements;
|
|
1390
|
-
try {
|
|
1391
|
-
({ session, entitlements } = await this.requests.signIn(options));
|
|
1392
|
-
}
|
|
1393
|
-
catch (e) {
|
|
1394
|
-
this.logService.error(`[chat setup] signIn: error ${e}`);
|
|
1395
|
-
}
|
|
1396
|
-
if (!session && !this.lifecycleService.willShutdown) {
|
|
1397
|
-
const { confirmed } = await this.dialogService.confirm({
|
|
1398
|
-
type: Severity.Error,
|
|
1399
|
-
message: ( localize(
|
|
1400
|
-
5473,
|
|
1401
|
-
"Failed to sign in to {0}. Would you like to try again?",
|
|
1402
|
-
ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.provider.enterprise.id ? defaultChat.provider.enterprise.name : defaultChat.provider.default.name
|
|
1403
|
-
)),
|
|
1404
|
-
detail: ( localize(5474, "You must be signed in to use AI features.")),
|
|
1405
|
-
primaryButton: ( localize(5463, "Retry"))
|
|
1406
|
-
});
|
|
1407
|
-
if (confirmed) {
|
|
1408
|
-
return this.signIn(options);
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
return { session, entitlement: entitlements?.entitlement };
|
|
1412
|
-
}
|
|
1413
|
-
async install(session, entitlement, providerId, watch, options) {
|
|
1414
|
-
const wasRunning = this.context.state.installed && !this.context.state.disabled;
|
|
1415
|
-
let signUpResult = undefined;
|
|
1416
|
-
let provider;
|
|
1417
|
-
if (options.forceAnonymous && entitlement === ChatEntitlement.Unknown) {
|
|
1418
|
-
provider = 'anonymous';
|
|
1419
|
-
}
|
|
1420
|
-
else {
|
|
1421
|
-
provider = options.useSocialProvider ?? (options.useEnterpriseProvider ? defaultChat.provider.enterprise.id : defaultChat.provider.default.id);
|
|
1422
|
-
}
|
|
1423
|
-
let sessions = session ? [session] : undefined;
|
|
1424
|
-
try {
|
|
1425
|
-
if (!options.forceAnonymous &&
|
|
1426
|
-
entitlement !== ChatEntitlement.Free &&
|
|
1427
|
-
!isProUser(entitlement) &&
|
|
1428
|
-
entitlement !== ChatEntitlement.Unavailable
|
|
1429
|
-
) {
|
|
1430
|
-
if (!sessions) {
|
|
1431
|
-
try {
|
|
1432
|
-
const existingSessions = await this.authenticationService.getSessions(providerId);
|
|
1433
|
-
sessions = existingSessions.length > 0 ? [...existingSessions] : undefined;
|
|
1434
|
-
}
|
|
1435
|
-
catch (error) {
|
|
1436
|
-
}
|
|
1437
|
-
if (!sessions || sessions.length === 0) {
|
|
1438
|
-
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedNoSession', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider });
|
|
1439
|
-
return false;
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
signUpResult = await this.requests.signUpFree(sessions);
|
|
1443
|
-
if (typeof signUpResult !== 'boolean' ) {
|
|
1444
|
-
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedSignUp', installDuration: watch.elapsed(), signUpErrorCode: signUpResult.errorCode, provider });
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
await this.doInstallWithRetry();
|
|
1448
|
-
}
|
|
1449
|
-
catch (error) {
|
|
1450
|
-
this.logService.error(`[chat setup] install: error ${error}`);
|
|
1451
|
-
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: isCancellationError(error) ? 'cancelled' : 'failedInstall', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider });
|
|
1452
|
-
return false;
|
|
1453
|
-
}
|
|
1454
|
-
if (typeof signUpResult === 'boolean' || typeof signUpResult === 'undefined' ) {
|
|
1455
|
-
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: wasRunning && !signUpResult ? 'alreadyInstalled' : 'installed', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider });
|
|
1456
|
-
}
|
|
1457
|
-
if (wasRunning) {
|
|
1458
|
-
refreshTokens(this.commandService);
|
|
1459
|
-
}
|
|
1460
|
-
return true;
|
|
1461
|
-
}
|
|
1462
|
-
async doInstallWithRetry() {
|
|
1463
|
-
let error;
|
|
1464
|
-
try {
|
|
1465
|
-
await this.doInstall();
|
|
1466
|
-
}
|
|
1467
|
-
catch (e) {
|
|
1468
|
-
this.logService.error(`[chat setup] install: error ${error}`);
|
|
1469
|
-
error = e;
|
|
1470
|
-
}
|
|
1471
|
-
if (error) {
|
|
1472
|
-
if (!this.lifecycleService.willShutdown) {
|
|
1473
|
-
const { confirmed } = await this.dialogService.confirm({
|
|
1474
|
-
type: Severity.Error,
|
|
1475
|
-
message: ( localize(
|
|
1476
|
-
5475,
|
|
1477
|
-
"An error occurred while setting up chat. Would you like to try again?"
|
|
1478
|
-
)),
|
|
1479
|
-
detail: error && !isCancellationError(error) ? toErrorMessage(error) : undefined,
|
|
1480
|
-
primaryButton: ( localize(5463, "Retry"))
|
|
1481
|
-
});
|
|
1482
|
-
if (confirmed) {
|
|
1483
|
-
return this.doInstallWithRetry();
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
throw error;
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
async doInstall() {
|
|
1490
|
-
await this.extensionsWorkbenchService.install(defaultChat.chatExtensionId, {
|
|
1491
|
-
enable: true,
|
|
1492
|
-
isApplicationScoped: true,
|
|
1493
|
-
isMachineScoped: false,
|
|
1494
|
-
installEverywhere: true,
|
|
1495
|
-
installPreReleaseVersion: this.productService.quality !== 'stable'
|
|
1496
|
-
}, ChatViewId);
|
|
1497
|
-
}
|
|
1498
|
-
async setupWithProvider(options) {
|
|
1499
|
-
const registry = ( Registry.as(Extensions.Configuration));
|
|
1500
|
-
registry.registerConfiguration({
|
|
1501
|
-
'id': 'copilot.setup',
|
|
1502
|
-
'type': 'object',
|
|
1503
|
-
'properties': {
|
|
1504
|
-
[defaultChat.completionsAdvancedSetting]: {
|
|
1505
|
-
'type': 'object',
|
|
1506
|
-
'properties': {
|
|
1507
|
-
'authProvider': {
|
|
1508
|
-
'type': 'string'
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
},
|
|
1512
|
-
[defaultChat.providerUriSetting]: {
|
|
1513
|
-
'type': 'string'
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
});
|
|
1517
|
-
if (options.useEnterpriseProvider) {
|
|
1518
|
-
const success = await this.handleEnterpriseInstance();
|
|
1519
|
-
if (!success) {
|
|
1520
|
-
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedEnterpriseSetup', installDuration: 0, signUpErrorCode: undefined, provider: undefined });
|
|
1521
|
-
return success;
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
let existingAdvancedSetting = this.configurationService.inspect(defaultChat.completionsAdvancedSetting).user?.value;
|
|
1525
|
-
if (!isObject(existingAdvancedSetting)) {
|
|
1526
|
-
existingAdvancedSetting = {};
|
|
1527
|
-
}
|
|
1528
|
-
if (options.useEnterpriseProvider) {
|
|
1529
|
-
await this.configurationService.updateValue(`${defaultChat.completionsAdvancedSetting}`, {
|
|
1530
|
-
...existingAdvancedSetting,
|
|
1531
|
-
'authProvider': defaultChat.provider.enterprise.id
|
|
1532
|
-
}, ConfigurationTarget.USER);
|
|
1533
|
-
}
|
|
1534
|
-
else {
|
|
1535
|
-
await this.configurationService.updateValue(`${defaultChat.completionsAdvancedSetting}`, ( Object.keys(existingAdvancedSetting)).length > 0 ? {
|
|
1536
|
-
...existingAdvancedSetting,
|
|
1537
|
-
'authProvider': undefined
|
|
1538
|
-
} : undefined, ConfigurationTarget.USER);
|
|
1539
|
-
}
|
|
1540
|
-
return this.setup({ ...options, forceSignIn: true });
|
|
1541
|
-
}
|
|
1542
|
-
async handleEnterpriseInstance() {
|
|
1543
|
-
const domainRegEx = /^[a-zA-Z\-_]+$/;
|
|
1544
|
-
const fullUriRegEx = /^(https:\/\/)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.ghe\.com\/?$/;
|
|
1545
|
-
const uri = this.configurationService.getValue(defaultChat.providerUriSetting);
|
|
1546
|
-
if (typeof uri === 'string' && fullUriRegEx.test(uri)) {
|
|
1547
|
-
return true;
|
|
1548
|
-
}
|
|
1549
|
-
let isSingleWord = false;
|
|
1550
|
-
const result = await this.quickInputService.input({
|
|
1551
|
-
prompt: ( localize(5476, "What is your {0} instance?", defaultChat.provider.enterprise.name)),
|
|
1552
|
-
placeHolder: ( localize(5477, 'i.e. "octocat" or "https://octocat.ghe.com"...')),
|
|
1553
|
-
ignoreFocusLost: true,
|
|
1554
|
-
value: uri,
|
|
1555
|
-
validateInput: async (value) => {
|
|
1556
|
-
isSingleWord = false;
|
|
1557
|
-
if (!value) {
|
|
1558
|
-
return undefined;
|
|
1559
|
-
}
|
|
1560
|
-
if (domainRegEx.test(value)) {
|
|
1561
|
-
isSingleWord = true;
|
|
1562
|
-
return {
|
|
1563
|
-
content: ( localize(5478, "Will resolve to {0}", `https://${value}.ghe.com`)),
|
|
1564
|
-
severity: Severity.Info
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
|
-
if (!fullUriRegEx.test(value)) {
|
|
1568
|
-
return {
|
|
1569
|
-
content: ( localize(
|
|
1570
|
-
5479,
|
|
1571
|
-
'You must enter a valid {0} instance (i.e. "octocat" or "https://octocat.ghe.com")',
|
|
1572
|
-
defaultChat.provider.enterprise.name
|
|
1573
|
-
)),
|
|
1574
|
-
severity: Severity.Error
|
|
1575
|
-
};
|
|
1576
|
-
}
|
|
1577
|
-
return undefined;
|
|
1578
|
-
}
|
|
1579
|
-
});
|
|
1580
|
-
if (!result) {
|
|
1581
|
-
return undefined;
|
|
1582
|
-
}
|
|
1583
|
-
let resolvedUri = result;
|
|
1584
|
-
if (isSingleWord) {
|
|
1585
|
-
resolvedUri = `https://${resolvedUri}.ghe.com`;
|
|
1586
|
-
}
|
|
1587
|
-
else {
|
|
1588
|
-
const normalizedUri = result.toLowerCase();
|
|
1589
|
-
const hasHttps = normalizedUri.startsWith('https://');
|
|
1590
|
-
if (!hasHttps) {
|
|
1591
|
-
resolvedUri = `https://${result}`;
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
await this.configurationService.updateValue(defaultChat.providerUriSetting, resolvedUri, ConfigurationTarget.USER);
|
|
1595
|
-
return true;
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
|
-
ChatSetupController = ( __decorate([
|
|
1599
|
-
( __param(2, ITelemetryService)),
|
|
1600
|
-
( __param(3, IAuthenticationService)),
|
|
1601
|
-
( __param(4, IExtensionsWorkbenchService)),
|
|
1602
|
-
( __param(5, IProductService)),
|
|
1603
|
-
( __param(6, ILogService)),
|
|
1604
|
-
( __param(7, IProgressService)),
|
|
1605
|
-
( __param(8, IActivityService)),
|
|
1606
|
-
( __param(9, ICommandService)),
|
|
1607
|
-
( __param(10, IDialogService)),
|
|
1608
|
-
( __param(11, IConfigurationService)),
|
|
1609
|
-
( __param(12, ILifecycleService)),
|
|
1610
|
-
( __param(13, IQuickInputService))
|
|
1611
|
-
], ChatSetupController));
|
|
1612
|
-
function refreshTokens(commandService) {
|
|
1613
|
-
commandService.executeCommand(defaultChat.completionsRefreshTokenCommand);
|
|
1614
|
-
commandService.executeCommand(defaultChat.chatRefreshTokenCommand);
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
export { ChatSetupContribution, ChatTeardownContribution };
|