@codingame/monaco-vscode-api 29.1.0 → 30.0.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/missing-services.js +39 -16
- package/package.json +8 -8
- package/services.js +3 -3
- package/vscode/src/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/vscode/src/vs/base/browser/ui/contextview/contextview.js +5 -5
- package/vscode/src/vs/base/browser/ui/dialog/dialog.js +6 -2
- package/vscode/src/vs/base/browser/ui/toolbar/toolbar.d.ts +19 -7
- package/vscode/src/vs/base/browser/ui/toolbar/toolbar.js +81 -15
- package/vscode/src/vs/base/common/codicons.d.ts +4 -0
- package/vscode/src/vs/base/common/codicons.js +3 -1
- package/vscode/src/vs/base/common/glob.js +5 -1
- package/vscode/src/vs/base/common/performance.d.ts +4 -0
- package/vscode/src/vs/base/common/performance.js +40 -17
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +1 -1
- package/vscode/src/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.d.ts +2 -1
- package/vscode/src/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +4 -0
- package/vscode/src/vs/platform/actionWidget/browser/actionList.d.ts +13 -0
- package/vscode/src/vs/platform/actionWidget/browser/actionList.js +106 -74
- package/vscode/src/vs/platform/actionWidget/browser/actionWidget.css +14 -11
- package/vscode/src/vs/platform/actions/common/actions.d.ts +3 -0
- package/vscode/src/vs/platform/actions/common/actions.js +9 -0
- package/vscode/src/vs/platform/browserView/common/browserView.d.ts +34 -7
- package/vscode/src/vs/platform/editor/common/editor.d.ts +29 -4
- package/vscode/src/vs/platform/environment/common/argv.d.ts +1 -0
- package/vscode/src/vs/platform/environment/common/environmentService.d.ts +1 -0
- package/vscode/src/vs/platform/extensions/common/extensions.d.ts +1 -0
- package/vscode/src/vs/platform/extensions/common/extensionsApiProposals.d.ts +3 -0
- package/vscode/src/vs/platform/extensions/common/extensionsApiProposals.js +3 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +2 -2
- package/vscode/src/vs/platform/label/common/label.d.ts +6 -0
- package/vscode/src/vs/platform/product/common/product.js +3 -3
- package/vscode/src/vs/platform/quickinput/browser/pickerQuickAccess.d.ts +11 -2
- package/vscode/src/vs/platform/quickinput/browser/pickerQuickAccess.js +6 -0
- package/vscode/src/vs/platform/quickinput/browser/quickInputActions.js +14 -1
- package/vscode/src/vs/platform/quickinput/browser/quickInputController.js +6 -2
- package/vscode/src/vs/platform/quickinput/common/quickInput.d.ts +5 -3
- package/vscode/src/vs/platform/quickinput/common/quickInput.js +6 -2
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperService.d.ts +4 -0
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperService.service.d.ts +6 -0
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperService.service.js +6 -0
- package/vscode/src/vs/platform/terminal/common/terminal.d.ts +3 -1
- package/vscode/src/vs/platform/terminal/common/terminal.js +5 -2
- package/vscode/src/vs/platform/theme/common/colorUtils.d.ts +4 -0
- package/vscode/src/vs/platform/theme/common/colorUtils.js +9 -0
- package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +6 -1
- package/vscode/src/vs/workbench/api/common/extHost.protocol.d.ts +21 -1
- package/vscode/src/vs/workbench/api/common/extHostApiCommands.js +3 -2
- package/vscode/src/vs/workbench/api/common/extHostChatAgents2.d.ts +5 -1
- package/vscode/src/vs/workbench/api/common/extHostChatAgents2.js +57 -4
- package/vscode/src/vs/workbench/api/common/extHostChatSessions.js +5 -3
- package/vscode/src/vs/workbench/api/common/extHostFileSystemEventService.js +34 -14
- package/vscode/src/vs/workbench/api/common/extHostLanguageModelTools.js +2 -1
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.d.ts +5 -1
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +32 -2
- package/vscode/src/vs/workbench/api/common/extHostTypes.d.ts +11 -1
- package/vscode/src/vs/workbench/api/common/extHostTypes.js +24 -2
- package/vscode/src/vs/workbench/browser/parts/editor/media/modalEditorPart.css +35 -5
- package/vscode/src/vs/workbench/browser/parts/editor/modalEditorPart.d.ts +1 -0
- package/vscode/src/vs/workbench/browser/parts/editor/modalEditorPart.js +70 -4
- package/vscode/src/vs/workbench/browser/parts/editor/multiEditorTabsControl.js +8 -1
- package/vscode/src/vs/workbench/browser/workbench.contribution.js +156 -167
- package/vscode/src/vs/workbench/common/configuration.js +9 -9
- package/vscode/src/vs/workbench/common/contextkeys.js +77 -77
- package/vscode/src/vs/workbench/common/editor/diffEditorInput.js +1 -1
- package/vscode/src/vs/workbench/common/editor/sideBySideEditorInput.js +1 -1
- package/vscode/src/vs/workbench/common/editor/textEditorModel.js +1 -1
- package/vscode/src/vs/workbench/common/editor.js +4 -4
- package/vscode/src/vs/workbench/common/theme.js +161 -161
- package/vscode/src/vs/workbench/common/views.d.ts +0 -6
- package/vscode/src/vs/workbench/common/views.js +4 -4
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.js +154 -154
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/browserView/common/browserView.d.ts +11 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +65 -64
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.d.ts +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.js +26 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.d.ts +21 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.js +21 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.js +8 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatScreenshotContext.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.d.ts +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +51 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +165 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +1409 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/common/actions/chatContextKeys.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/actions/chatContextKeys.js +87 -83
- package/vscode/src/vs/workbench/contrib/chat/common/aiCustomizationWorkspaceService.service.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.d.ts +12 -2
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.js +5 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatModes.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatModes.js +13 -12
- package/vscode/src/vs/workbench/contrib/chat/common/chatPerf.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatPerf.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatService.d.ts +9 -12
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatService.js +1 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatService.service.d.ts +1 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionsService.d.ts +45 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionsService.service.d.ts +17 -4
- package/vscode/src/vs/workbench/contrib/chat/common/constants.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/constants.js +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.d.ts +48 -5
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +46 -18
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.service.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/common/editing/chatEditingService.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/editing/chatEditingService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/editing/chatEditingService.service.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +23 -23
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModel.d.ts +11 -8
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModel.js +54 -20
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatToolInvocation.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatViewModel.d.ts +3 -5
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatViewModel.js +3 -7
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatAgents.js +5 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.service.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.service.d.ts +10 -6
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.service.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +36 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/config.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations.d.ts +3 -29
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations.js +2 -18
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookSchema.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookTypes.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptFileAttributes.js +78 -88
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser.js +1 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptTypes.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptTypes.js +16 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +28 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +1 -7
- package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/askQuestionsTool.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatArtifactsService.service.d.ts +2 -8
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +22 -22
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsService.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/widget/input/modelPickerWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +11 -11
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/dictation/editorDictation.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorAccessibilityHelp.js +5 -5
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +10 -10
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.js +41 -8
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMinimap.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleRenderControlCharacter.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleRenderWhitespace.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +5 -5
- package/vscode/src/vs/workbench/contrib/codeEditor/common/languageConfigurationExtensionPoint.js +65 -65
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +2 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsAccessibility.js +12 -12
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +9 -9
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +14 -14
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +16 -16
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/common/commentContextKeys.js +12 -12
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInput.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +29 -29
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +14 -14
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +75 -75
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +6 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/debugColors.js +12 -12
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +38 -38
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debugIcons.js +57 -57
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +4 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +18 -18
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +5 -5
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +9 -9
- package/vscode/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debug.js +65 -65
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +6 -6
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/dropOrPasteInto/browser/commands.js +2 -2
- package/vscode/src/vs/workbench/contrib/dropOrPasteInto/browser/configurationSchema.js +4 -4
- package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.js +18 -18
- package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +41 -41
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionFeaturesTab.js +15 -15
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js +14 -14
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +148 -148
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.js +170 -170
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsDependencyChecker.js +5 -5
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsIcons.js +25 -25
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.js +4 -4
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewer.js +7 -7
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +47 -47
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.js +5 -5
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.js +30 -30
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +76 -76
- package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsFileTemplate.js +5 -5
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +3 -3
- package/vscode/src/vs/workbench/contrib/extensions/common/runtimeExtensionsInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/common/searchExtensionsTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/configuration.js +4 -4
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpenerService.js +3 -3
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +8 -8
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +18 -18
- package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +14 -14
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +39 -39
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.js +84 -84
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands._save.js +4 -4
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +2 -2
- package/vscode/src/vs/workbench/contrib/files/browser/fileConstants.js +6 -6
- package/vscode/src/vs/workbench/contrib/files/browser/fileImportExport.js +27 -27
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._configuration.js +50 -50
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._editorPane.js +2 -2
- package/vscode/src/vs/workbench/contrib/files/browser/views/emptyView.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerDecorationsProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerView.js +7 -7
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerViewer.js +17 -17
- package/vscode/src/vs/workbench/contrib/files/browser/views/openEditorsView.js +7 -7
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +4 -4
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/common/files.js +16 -16
- package/vscode/src/vs/workbench/contrib/folding/browser/folding.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +20 -20
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsNone.js +4 -4
- package/vscode/src/vs/workbench/contrib/format/browser/formatModified.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlayHints/browser/inlayHintsAccessibilty.js +4 -4
- package/vscode/src/vs/workbench/contrib/list/browser/listResizeColumnAction.js +2 -2
- package/vscode/src/vs/workbench/contrib/list/browser/tableColumnResizeQuickPick.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommandsAddConfiguration.js +66 -66
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +40 -40
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +34 -34
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfiguration.js +40 -40
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +16 -16
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTypes.js +4 -4
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +4 -4
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +23 -23
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +20 -9
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +8 -8
- package/vscode/src/vs/workbench/contrib/meteredConnection/browser/meteredConnection.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/meteredConnection/browser/meteredConnectionStatus.js +4 -4
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/icons.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.js +3 -3
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +17 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +27 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +29 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingWidgets.js +3 -3
- package/vscode/src/vs/workbench/contrib/preferences/browser/preferencesIcons.js +13 -13
- package/vscode/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.js +10 -10
- package/vscode/src/vs/workbench/contrib/preferences/browser/settingsLayout.js +60 -60
- package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +3 -3
- package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +21 -21
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +15 -15
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +17 -17
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +59 -59
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistory.js +11 -11
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryChatContext.js +6 -6
- package/vscode/src/vs/workbench/contrib/scm/common/quickDiff.js +14 -14
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +30 -13
- package/vscode/src/vs/workbench/contrib/search/browser/patternInputWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsBase.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +12 -12
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +9 -9
- package/vscode/src/vs/workbench/contrib/search/browser/searchChatContext.js +5 -5
- package/vscode/src/vs/workbench/contrib/search/browser/searchFindInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchIcons.js +20 -20
- package/vscode/src/vs/workbench/contrib/search/browser/searchMessage.js +2 -2
- package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +14 -14
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +55 -55
- package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +11 -11
- package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +32 -5
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +4 -4
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +5 -5
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.js +3 -3
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsFile.js +3 -3
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsService.js +9 -9
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +29 -29
- package/vscode/src/vs/workbench/contrib/tasks/common/constants.js +1 -1
- package/vscode/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.js +5 -5
- package/vscode/src/vs/workbench/contrib/tasks/common/taskService.js +6 -6
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcons.js +13 -13
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalMenus.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalMenus.js +43 -45
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +15 -15
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +13 -10
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +23 -23
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalContextKey.js +17 -17
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStrings.js +26 -26
- package/vscode/src/vs/workbench/contrib/terminal/terminalContribExports.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/terminal/terminalContribExports.js +10 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/accessibility/common/terminalAccessibilityConfiguration.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/autoReplies/common/terminalAutoRepliesConfiguration.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.d.ts +10 -6
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.js +134 -91
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.service.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/commandGuide/common/terminalCommandGuideConfiguration.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/history/common/terminal.history.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/inlineHint/common/terminalInitialHintConfiguration.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/notification/common/terminalNotificationConfiguration.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/common/terminalStickyScrollConfiguration.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/suggest/common/terminalSuggestConfiguration.js +30 -30
- package/vscode/src/vs/workbench/contrib/terminalContrib/typeAhead/common/terminalTypeAheadConfiguration.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/zoom/common/terminal.zoom.js +2 -2
- package/vscode/src/vs/workbench/contrib/testing/common/constants.js +11 -11
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +2 -2
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +3 -3
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomains.js +6 -6
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindAccessibilityHelp.js +30 -30
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/workspace/common/workspace.js +2 -2
- package/vscode/src/vs/workbench/services/accounts/browser/defaultAccount.js +1 -1
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +11 -11
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +5 -5
- package/vscode/src/vs/workbench/services/chat/common/chatEntitlementService.d.ts +4 -0
- package/vscode/src/vs/workbench/services/chat/common/chatEntitlementService.js +27 -16
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolver.d.ts +1 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolver.js +1 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +16 -16
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +1 -1
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +16 -16
- package/vscode/src/vs/workbench/services/editor/common/editorResolverService.js +1 -1
- package/vscode/src/vs/workbench/services/environment/browser/environmentService.d.ts +1 -0
- package/vscode/src/vs/workbench/services/environment/browser/environmentService.js +9 -0
- package/vscode/src/vs/workbench/services/environment/common/environmentService.service.d.ts +1 -0
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionsIcons.js +3 -3
- package/vscode/src/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +6 -6
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +10 -10
- package/vscode/src/vs/workbench/services/extensions/common/extensionsRegistry.js +88 -88
- package/vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +5 -5
- package/vscode/src/vs/workbench/services/language/common/languageService.js +24 -24
- package/vscode/src/vs/workbench/services/log/common/logConstants.js +1 -1
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorInput.js +2 -2
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.js +7 -7
- package/vscode/src/vs/workbench/services/preferences/common/preferencesEditorInput.js +4 -4
- package/vscode/src/vs/workbench/services/preferences/common/preferencesModels.js +2 -2
- package/vscode/src/vs/workbench/services/preferences/common/preferencesValidation.js +30 -30
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +8 -8
- package/vscode/src/vs/workbench/services/remote/common/tunnelModel.js +6 -6
- package/vscode/src/vs/workbench/services/search/common/queryBuilder.js +1 -1
- package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +9 -9
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModel.js +3 -3
- package/vscode/src/vs/workbench/services/themes/common/colorExtensionPoint.js +18 -18
- package/vscode/src/vs/workbench/services/themes/common/colorThemeData.js +8 -8
- package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +13 -13
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +24 -24
- package/vscode/src/vs/workbench/services/themes/common/workbenchThemeService.d.ts +2 -2
- package/vscode/src/vs/workbench/services/themes/common/workbenchThemeService.js +8 -4
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +3 -3
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +1 -1
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +13 -13
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +16 -16
- package/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts +0 -4
- package/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts +19 -1
- package/vscode-dts/vscode.proposed.chatSessionCustomizationProvider.d.ts +168 -0
- package/vscode-dts/vscode.proposed.d.ts +1 -0
- package/vscode-dts/vscode.proposed.terminalShellEnv.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +0 -746
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -300
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +0 -273
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1963
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -314
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +0 -258
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -886
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -118
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +0 -71
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +0 -313
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +0 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +0 -265
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +0 -185
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +0 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +0 -43
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +0 -69
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +0 -469
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +0 -149
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -933
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +0 -180
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -32
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +0 -102
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -643
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -197
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +0 -75
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +0 -539
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +0 -90
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +0 -92
package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js
ADDED
|
@@ -0,0 +1,1409 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
3
|
+
import { sep } from '../../../../../base/common/path.js';
|
|
4
|
+
import { AsyncIterableProducer, raceCancellationError } from '../../../../../base/common/async.js';
|
|
5
|
+
import { CancellationToken, CancellationTokenSource } from '../../../../../base/common/cancellation.js';
|
|
6
|
+
import { Codicon } from '../../../../../base/common/codicons.js';
|
|
7
|
+
import { Emitter, Event } from '../../../../../base/common/event.js';
|
|
8
|
+
import { Disposable, DisposableMap, DisposableStore, combinedDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';
|
|
9
|
+
import { ResourceMap, ResourceSet } from '../../../../../base/common/map.js';
|
|
10
|
+
import { Schemas } from '../../../../../base/common/network.js';
|
|
11
|
+
import { joinPath } from '../../../../../base/common/resources.js';
|
|
12
|
+
import { ThemeIcon } from '../../../../../base/common/themables.js';
|
|
13
|
+
import { URI } from '../../../../../base/common/uri.js';
|
|
14
|
+
import { generateUuid } from '../../../../../base/common/uuid.js';
|
|
15
|
+
import { localize, localize2 } from '../../../../../nls.js';
|
|
16
|
+
import { MenuId, MenuItemAction, MenuRegistry, registerAction2, Action2 } from '../../../../../platform/actions/common/actions.js';
|
|
17
|
+
import { IMenuService } from '../../../../../platform/actions/common/actions.service.js';
|
|
18
|
+
import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
|
|
19
|
+
import { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.service.js';
|
|
20
|
+
import '../../../../../platform/instantiation/common/extensions.js';
|
|
21
|
+
import { ILabelService } from '../../../../../platform/label/common/label.service.js';
|
|
22
|
+
import { ILogService } from '../../../../../platform/log/common/log.service.js';
|
|
23
|
+
import { isDark } from '../../../../../platform/theme/common/theme.js';
|
|
24
|
+
import { IThemeService } from '../../../../../platform/theme/common/themeService.service.js';
|
|
25
|
+
import { IEditorService } from '../../../../services/editor/common/editorService.service.js';
|
|
26
|
+
import { isProposedApiEnabled } from '../../../../services/extensions/common/extensions.js';
|
|
27
|
+
import { IExtensionService } from '../../../../services/extensions/common/extensions.service.js';
|
|
28
|
+
import { ExtensionsRegistry } from '../../../../services/extensions/common/extensionsRegistry.js';
|
|
29
|
+
import { ChatEditorInput } from '../widgetHosts/editor/chatEditorInput.js';
|
|
30
|
+
import { IChatAgentService } from '../../common/participants/chatAgents.service.js';
|
|
31
|
+
import { ChatContextKeys } from '../../common/actions/chatContextKeys.js';
|
|
32
|
+
import { isSessionInProgressStatus, ChatSessionStatus } from '../../common/chatSessionsService.js';
|
|
33
|
+
import '../../../../../platform/instantiation/common/instantiation.js';
|
|
34
|
+
import { ChatAgentLocation, ChatModeKind } from '../../common/constants.js';
|
|
35
|
+
import { CHAT_CATEGORY } from '../actions/chatActions.js';
|
|
36
|
+
import { ResponseModelState } from '../../common/chatService/chatService.js';
|
|
37
|
+
import { IChatService } from '../../common/chatService/chatService.service.js';
|
|
38
|
+
import '../../../../../base/common/observableInternal/index.js';
|
|
39
|
+
import { toPromptFileVariableEntry, PromptFileVariableKind } from '../../common/attachments/chatVariableEntries.js';
|
|
40
|
+
import { IViewsService } from '../../../../services/views/common/viewsService.service.js';
|
|
41
|
+
import { ChatViewId } from '../chat.js';
|
|
42
|
+
import { AgentSessionProviders, getAgentSessionProviderName, getAgentSessionProvider } from '../agentSessions/agentSessions.js';
|
|
43
|
+
import { isCancellationError, BugIndicatingError } from '../../../../../base/common/errors.js';
|
|
44
|
+
import { IEditorGroupsService } from '../../../../services/editor/common/editorGroupsService.service.js';
|
|
45
|
+
import { isUntitledChatSession, LocalChatSessionUri } from '../../common/model/chatUri.js';
|
|
46
|
+
import { assertNever } from '../../../../../base/common/assert.js';
|
|
47
|
+
import { ICommandService } from '../../../../../platform/commands/common/commands.service.js';
|
|
48
|
+
import { Target } from '../../common/promptSyntax/promptTypes.js';
|
|
49
|
+
import { slashReg } from '../../common/requestParser/chatRequestParser.js';
|
|
50
|
+
import { IPromptsService } from '../../common/promptSyntax/service/promptsService.service.js';
|
|
51
|
+
import { OffsetRange } from '../../../../../editor/common/core/ranges/offsetRange.js';
|
|
52
|
+
import { ILanguageModelToolsService } from '../../common/tools/languageModelToolsService.service.js';
|
|
53
|
+
import { observableFromEvent } from '../../../../../base/common/observableInternal/observables/observableFromEvent.js';
|
|
54
|
+
import { autorun } from '../../../../../base/common/observableInternal/reactions/autorun.js';
|
|
55
|
+
|
|
56
|
+
const extensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
57
|
+
extensionPoint: "chatSessions",
|
|
58
|
+
jsonSchema: {
|
|
59
|
+
description: ( localize(6193, "Contributes chat session integrations to the chat widget.")),
|
|
60
|
+
type: "array",
|
|
61
|
+
items: {
|
|
62
|
+
type: "object",
|
|
63
|
+
additionalProperties: false,
|
|
64
|
+
properties: {
|
|
65
|
+
type: {
|
|
66
|
+
description: ( localize(6194, "Unique identifier for the type of chat session.")),
|
|
67
|
+
type: "string"
|
|
68
|
+
},
|
|
69
|
+
name: {
|
|
70
|
+
description: ( localize(
|
|
71
|
+
6195,
|
|
72
|
+
"Name of the dynamically registered chat participant (eg: @agent). Must not contain whitespace."
|
|
73
|
+
)),
|
|
74
|
+
type: "string",
|
|
75
|
+
pattern: "^[\\w-]+$"
|
|
76
|
+
},
|
|
77
|
+
displayName: {
|
|
78
|
+
description: ( localize(6196, "A longer name for this item which is used for display in menus.")),
|
|
79
|
+
type: "string"
|
|
80
|
+
},
|
|
81
|
+
description: {
|
|
82
|
+
description: ( localize(6197, "Description of the chat session for use in menus and tooltips.")),
|
|
83
|
+
type: "string"
|
|
84
|
+
},
|
|
85
|
+
when: {
|
|
86
|
+
description: ( localize(6198, "Condition which must be true to show this item.")),
|
|
87
|
+
type: "string"
|
|
88
|
+
},
|
|
89
|
+
icon: {
|
|
90
|
+
description: ( localize(
|
|
91
|
+
6199,
|
|
92
|
+
"Icon identifier (codicon ID) for the chat session editor tab. For example, \"{0}\" or \"{1}\".",
|
|
93
|
+
"$(github)",
|
|
94
|
+
"$(cloud)"
|
|
95
|
+
)),
|
|
96
|
+
anyOf: [{
|
|
97
|
+
type: "string"
|
|
98
|
+
}, {
|
|
99
|
+
type: "object",
|
|
100
|
+
properties: {
|
|
101
|
+
light: {
|
|
102
|
+
description: ( localize(6200, "Icon path when a light theme is used")),
|
|
103
|
+
type: "string"
|
|
104
|
+
},
|
|
105
|
+
dark: {
|
|
106
|
+
description: ( localize(6201, "Icon path when a dark theme is used")),
|
|
107
|
+
type: "string"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}]
|
|
111
|
+
},
|
|
112
|
+
order: {
|
|
113
|
+
description: ( localize(6202, "Order in which this item should be displayed.")),
|
|
114
|
+
type: "integer"
|
|
115
|
+
},
|
|
116
|
+
alternativeIds: {
|
|
117
|
+
description: ( localize(6203, "Alternative identifiers for backward compatibility.")),
|
|
118
|
+
type: "array",
|
|
119
|
+
items: {
|
|
120
|
+
type: "string"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
welcomeTitle: {
|
|
124
|
+
description: ( localize(
|
|
125
|
+
6204,
|
|
126
|
+
"Title text to display in the chat welcome view for this session type."
|
|
127
|
+
)),
|
|
128
|
+
type: "string"
|
|
129
|
+
},
|
|
130
|
+
welcomeMessage: {
|
|
131
|
+
description: ( localize(
|
|
132
|
+
6205,
|
|
133
|
+
"Message text (supports markdown) to display in the chat welcome view for this session type."
|
|
134
|
+
)),
|
|
135
|
+
type: "string"
|
|
136
|
+
},
|
|
137
|
+
welcomeTips: {
|
|
138
|
+
description: ( localize(
|
|
139
|
+
6206,
|
|
140
|
+
"Tips text (supports markdown and theme icons) to display in the chat welcome view for this session type."
|
|
141
|
+
)),
|
|
142
|
+
type: "string"
|
|
143
|
+
},
|
|
144
|
+
inputPlaceholder: {
|
|
145
|
+
description: ( localize(
|
|
146
|
+
6207,
|
|
147
|
+
"Placeholder text to display in the chat input box for this session type."
|
|
148
|
+
)),
|
|
149
|
+
type: "string"
|
|
150
|
+
},
|
|
151
|
+
capabilities: {
|
|
152
|
+
description: ( localize(6208, "Optional capabilities for this chat session.")),
|
|
153
|
+
type: "object",
|
|
154
|
+
additionalProperties: false,
|
|
155
|
+
properties: {
|
|
156
|
+
supportsFileAttachments: {
|
|
157
|
+
description: ( localize(
|
|
158
|
+
6209,
|
|
159
|
+
"Whether this chat session supports attaching files or file references."
|
|
160
|
+
)),
|
|
161
|
+
type: "boolean"
|
|
162
|
+
},
|
|
163
|
+
supportsToolAttachments: {
|
|
164
|
+
description: ( localize(
|
|
165
|
+
6210,
|
|
166
|
+
"Whether this chat session supports attaching tools or tool references."
|
|
167
|
+
)),
|
|
168
|
+
type: "boolean"
|
|
169
|
+
},
|
|
170
|
+
supportsMCPAttachments: {
|
|
171
|
+
description: ( localize(6211, "Whether this chat session supports attaching MCP resources.")),
|
|
172
|
+
type: "boolean"
|
|
173
|
+
},
|
|
174
|
+
supportsImageAttachments: {
|
|
175
|
+
description: ( localize(6212, "Whether this chat session supports attaching images.")),
|
|
176
|
+
type: "boolean"
|
|
177
|
+
},
|
|
178
|
+
supportsSearchResultAttachments: {
|
|
179
|
+
description: ( localize(6213, "Whether this chat session supports attaching search results.")),
|
|
180
|
+
type: "boolean"
|
|
181
|
+
},
|
|
182
|
+
supportsInstructionAttachments: {
|
|
183
|
+
description: ( localize(6214, "Whether this chat session supports attaching instructions.")),
|
|
184
|
+
type: "boolean"
|
|
185
|
+
},
|
|
186
|
+
supportsSourceControlAttachments: {
|
|
187
|
+
description: ( localize(
|
|
188
|
+
6215,
|
|
189
|
+
"Whether this chat session supports attaching source control changes."
|
|
190
|
+
)),
|
|
191
|
+
type: "boolean"
|
|
192
|
+
},
|
|
193
|
+
supportsProblemAttachments: {
|
|
194
|
+
description: ( localize(6216, "Whether this chat session supports attaching problems.")),
|
|
195
|
+
type: "boolean"
|
|
196
|
+
},
|
|
197
|
+
supportsSymbolAttachments: {
|
|
198
|
+
description: ( localize(6217, "Whether this chat session supports attaching symbols.")),
|
|
199
|
+
type: "boolean"
|
|
200
|
+
},
|
|
201
|
+
supportsPromptAttachments: {
|
|
202
|
+
description: ( localize(6218, "Whether this chat session supports attaching prompts.")),
|
|
203
|
+
type: "boolean"
|
|
204
|
+
},
|
|
205
|
+
supportsHandOffs: {
|
|
206
|
+
description: ( localize(6219, "Whether this chat session supports hand-off prompts.")),
|
|
207
|
+
type: "boolean"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
commands: {
|
|
212
|
+
markdownDescription: ( localize(
|
|
213
|
+
6220,
|
|
214
|
+
"Commands available for this chat session, which the user can invoke with a `/`."
|
|
215
|
+
)),
|
|
216
|
+
type: "array",
|
|
217
|
+
items: {
|
|
218
|
+
additionalProperties: false,
|
|
219
|
+
type: "object",
|
|
220
|
+
defaultSnippets: [{
|
|
221
|
+
body: {
|
|
222
|
+
name: "",
|
|
223
|
+
description: ""
|
|
224
|
+
}
|
|
225
|
+
}],
|
|
226
|
+
required: ["name"],
|
|
227
|
+
properties: {
|
|
228
|
+
name: {
|
|
229
|
+
description: ( localize(
|
|
230
|
+
6221,
|
|
231
|
+
"A short name by which this command is referred to in the UI, e.g. `fix` or `explain` for commands that fix an issue or explain code. The name should be unique among the commands provided by this participant."
|
|
232
|
+
)),
|
|
233
|
+
type: "string"
|
|
234
|
+
},
|
|
235
|
+
description: {
|
|
236
|
+
description: ( localize(6222, "A description of this command.")),
|
|
237
|
+
type: "string"
|
|
238
|
+
},
|
|
239
|
+
when: {
|
|
240
|
+
description: ( localize(6223, "A condition which must be true to enable this command.")),
|
|
241
|
+
type: "string"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
canDelegate: {
|
|
247
|
+
description: ( localize(
|
|
248
|
+
6224,
|
|
249
|
+
"Whether delegation is supported. Default is false. Note that enabling this is experimental and may not be respected at all times."
|
|
250
|
+
)),
|
|
251
|
+
type: "boolean",
|
|
252
|
+
default: false
|
|
253
|
+
},
|
|
254
|
+
customAgentTarget: {
|
|
255
|
+
description: ( localize(
|
|
256
|
+
6225,
|
|
257
|
+
"When set, the chat session will show a filtered mode picker that prefers custom agents whose target property matches this value. Custom agents without a target property are still shown in all session types. This enables the use of standard agent/mode with contributed sessions."
|
|
258
|
+
)),
|
|
259
|
+
type: "string"
|
|
260
|
+
},
|
|
261
|
+
requiresCustomModels: {
|
|
262
|
+
description: ( localize(
|
|
263
|
+
6226,
|
|
264
|
+
"When set, the chat session will show a filtered model picker that prefers custom models. This enables the use of standard model picker with contributed sessions."
|
|
265
|
+
)),
|
|
266
|
+
type: "boolean",
|
|
267
|
+
default: false
|
|
268
|
+
},
|
|
269
|
+
autoAttachReferences: {
|
|
270
|
+
description: ( localize(
|
|
271
|
+
6227,
|
|
272
|
+
"Whether to automatically attach instruction files to chat requests for this session type."
|
|
273
|
+
)),
|
|
274
|
+
type: "boolean",
|
|
275
|
+
default: false
|
|
276
|
+
},
|
|
277
|
+
useRequestToPopulateBuiltInPickers: {
|
|
278
|
+
description: ( localize(
|
|
279
|
+
6228,
|
|
280
|
+
"Whether to use ChatRequestTurn2 to populate built-in pickers such as the Agent and Model pickers."
|
|
281
|
+
)),
|
|
282
|
+
type: "boolean",
|
|
283
|
+
default: false
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
required: ["type", "name", "displayName", "description"]
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
activationEventsGenerator: function*(contribs) {
|
|
290
|
+
for (const contrib of contribs) {
|
|
291
|
+
yield `onChatSession:${contrib.type}`;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
class ContributedChatSessionData extends Disposable {
|
|
296
|
+
getOption(optionId) {
|
|
297
|
+
return this._optionsCache.get(optionId);
|
|
298
|
+
}
|
|
299
|
+
getAllOptions() {
|
|
300
|
+
return this._optionsCache.entries();
|
|
301
|
+
}
|
|
302
|
+
setOption(optionId, value) {
|
|
303
|
+
this._optionsCache.set(optionId, value);
|
|
304
|
+
}
|
|
305
|
+
constructor(session, chatSessionType, resource, options, onWillDispose) {
|
|
306
|
+
super();
|
|
307
|
+
this.session = session;
|
|
308
|
+
this.chatSessionType = chatSessionType;
|
|
309
|
+
this.resource = resource;
|
|
310
|
+
this.options = options;
|
|
311
|
+
this.onWillDispose = onWillDispose;
|
|
312
|
+
this._optionsCache = ( new Map(options));
|
|
313
|
+
this._register(this.session.onWillDispose(() => {
|
|
314
|
+
this.onWillDispose(this.resource);
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
let ChatSessionsService = class ChatSessionsService extends Disposable {
|
|
319
|
+
get onDidChangeInProgress() {
|
|
320
|
+
return this._onDidChangeInProgress.event;
|
|
321
|
+
}
|
|
322
|
+
get onDidChangeContentProviderSchemes() {
|
|
323
|
+
return this._onDidChangeContentProviderSchemes.event;
|
|
324
|
+
}
|
|
325
|
+
get onDidChangeSessionOptions() {
|
|
326
|
+
return this._onDidChangeSessionOptions.event;
|
|
327
|
+
}
|
|
328
|
+
get onDidChangeOptionGroups() {
|
|
329
|
+
return this._onDidChangeOptionGroups.event;
|
|
330
|
+
}
|
|
331
|
+
constructor(
|
|
332
|
+
_logService,
|
|
333
|
+
_chatAgentService,
|
|
334
|
+
_extensionService,
|
|
335
|
+
_contextKeyService,
|
|
336
|
+
_menuService,
|
|
337
|
+
_themeService,
|
|
338
|
+
_labelService
|
|
339
|
+
) {
|
|
340
|
+
super();
|
|
341
|
+
this._logService = _logService;
|
|
342
|
+
this._chatAgentService = _chatAgentService;
|
|
343
|
+
this._extensionService = _extensionService;
|
|
344
|
+
this._contextKeyService = _contextKeyService;
|
|
345
|
+
this._menuService = _menuService;
|
|
346
|
+
this._themeService = _themeService;
|
|
347
|
+
this._labelService = _labelService;
|
|
348
|
+
this._itemControllers = ( new Map());
|
|
349
|
+
this._contributions = ( new Map());
|
|
350
|
+
this._contributionDisposables = this._register(( new DisposableMap()));
|
|
351
|
+
this._contentProviders = ( new Map());
|
|
352
|
+
this._alternativeIdMap = ( new Map());
|
|
353
|
+
this._contextKeys = ( new Set());
|
|
354
|
+
this._onDidChangeItemsProviders = this._register(( new Emitter()));
|
|
355
|
+
this.onDidChangeItemsProviders = this._onDidChangeItemsProviders.event;
|
|
356
|
+
this._onDidChangeSessionItems = this._register(( new Emitter()));
|
|
357
|
+
this.onDidChangeSessionItems = this._onDidChangeSessionItems.event;
|
|
358
|
+
this._onDidCommitSession = this._register(( new Emitter()));
|
|
359
|
+
this.onDidCommitSession = this._onDidCommitSession.event;
|
|
360
|
+
this._onDidChangeAvailability = this._register(( new Emitter()));
|
|
361
|
+
this.onDidChangeAvailability = this._onDidChangeAvailability.event;
|
|
362
|
+
this._onDidChangeInProgress = this._register(( new Emitter()));
|
|
363
|
+
this._onDidChangeContentProviderSchemes = this._register(( new Emitter()));
|
|
364
|
+
this._onDidChangeSessionOptions = this._register(( new Emitter()));
|
|
365
|
+
this._onDidChangeOptionGroups = this._register(( new Emitter()));
|
|
366
|
+
this.inProgressMap = ( new Map());
|
|
367
|
+
this._sessionTypeOptions = ( new Map());
|
|
368
|
+
this._sessionTypeNewSessionOptions = ( new Map());
|
|
369
|
+
this._sessions = ( new ResourceMap());
|
|
370
|
+
this._resourceAliases = ( new ResourceMap());
|
|
371
|
+
this._customizationsProviders = ( new Map());
|
|
372
|
+
this._onDidChangeCustomizations = this._register(( new Emitter()));
|
|
373
|
+
this.onDidChangeCustomizations = this._onDidChangeCustomizations.event;
|
|
374
|
+
this._hasCanDelegateProvidersKey = ChatContextKeys.hasCanDelegateProviders.bindTo(this._contextKeyService);
|
|
375
|
+
this._register(extensionPoint.setHandler(extensions => {
|
|
376
|
+
for (const ext of extensions) {
|
|
377
|
+
if (!isProposedApiEnabled(ext.description)) {
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
if (!Array.isArray(ext.value)) {
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
for (const contribution of ext.value) {
|
|
384
|
+
this._register(this.registerContribution(contribution, ext.description));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}));
|
|
388
|
+
this._register(Event.filter(
|
|
389
|
+
this._contextKeyService.onDidChangeContext,
|
|
390
|
+
e => e.affectsSome(this._contextKeys)
|
|
391
|
+
)(() => {
|
|
392
|
+
this._evaluateAvailability();
|
|
393
|
+
}));
|
|
394
|
+
const builtinSessionProviders = [AgentSessionProviders.Local];
|
|
395
|
+
const contributedSessionProviders = observableFromEvent(this.onDidChangeAvailability, () => Array.from(( this._contributions.keys())).filter(key => ( this._contributionDisposables.has(key)))).recomputeInitiallyAndOnChange(this._store);
|
|
396
|
+
this._register(autorun(reader => {
|
|
397
|
+
const activatedProviders = contributedSessionProviders.read(reader);
|
|
398
|
+
for (const provider of builtinSessionProviders) {
|
|
399
|
+
reader.store.add(
|
|
400
|
+
registerNewSessionInPlaceAction(provider, getAgentSessionProviderName(provider))
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
for (const type of activatedProviders) {
|
|
404
|
+
const knownProvider = getAgentSessionProvider(type);
|
|
405
|
+
if (knownProvider) {
|
|
406
|
+
reader.store.add(
|
|
407
|
+
registerNewSessionInPlaceAction(type, getAgentSessionProviderName(knownProvider))
|
|
408
|
+
);
|
|
409
|
+
} else {
|
|
410
|
+
const contrib = this._contributions.get(type);
|
|
411
|
+
if (contrib) {
|
|
412
|
+
reader.store.add(registerNewSessionInPlaceAction(
|
|
413
|
+
type,
|
|
414
|
+
contrib.contribution.displayName ?? contrib.contribution.name ?? type
|
|
415
|
+
));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}));
|
|
420
|
+
this._register(this._labelService.registerFormatter({
|
|
421
|
+
scheme: Schemas.copilotPr,
|
|
422
|
+
formatting: {
|
|
423
|
+
label: "${authority}${path}",
|
|
424
|
+
separator: sep,
|
|
425
|
+
stripPathStartingSeparator: true
|
|
426
|
+
}
|
|
427
|
+
}));
|
|
428
|
+
}
|
|
429
|
+
reportInProgress(chatSessionType, count) {
|
|
430
|
+
if (!( this._itemControllers.has(chatSessionType))) {
|
|
431
|
+
this._logService.warn(
|
|
432
|
+
`Attempted to report in-progress status for unknown chat session type '${chatSessionType}'`
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
this.inProgressMap.set(chatSessionType, count);
|
|
436
|
+
this._onDidChangeInProgress.fire();
|
|
437
|
+
}
|
|
438
|
+
getInProgress() {
|
|
439
|
+
return ( Array.from(this.inProgressMap.entries()).map(([chatSessionType, count]) => ({
|
|
440
|
+
chatSessionType,
|
|
441
|
+
count
|
|
442
|
+
})));
|
|
443
|
+
}
|
|
444
|
+
async updateInProgressStatus(chatSessionType) {
|
|
445
|
+
try {
|
|
446
|
+
const items = [];
|
|
447
|
+
for await (const result of this.getChatSessionItems([chatSessionType], CancellationToken.None)) {
|
|
448
|
+
items.push(...result.items);
|
|
449
|
+
}
|
|
450
|
+
const inProgress = items.filter(item => item.status && isSessionInProgressStatus(item.status));
|
|
451
|
+
this.reportInProgress(chatSessionType, inProgress.length);
|
|
452
|
+
} catch (error) {
|
|
453
|
+
this._logService.warn(
|
|
454
|
+
`Failed to update in-progress status for chat session type '${chatSessionType}':`,
|
|
455
|
+
error
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
registerContribution(contribution, ext) {
|
|
460
|
+
this._logService.trace(
|
|
461
|
+
`[ChatSessionsService] registerContribution called for type='${contribution.type}', canDelegate=${contribution.canDelegate}, when='${contribution.when}', extension='${ext.identifier.value}'`
|
|
462
|
+
);
|
|
463
|
+
if (( this._contributions.has(contribution.type))) {
|
|
464
|
+
this._logService.trace(
|
|
465
|
+
`[ChatSessionsService] registerContribution: type='${contribution.type}' already registered, skipping`
|
|
466
|
+
);
|
|
467
|
+
return Disposable.None;
|
|
468
|
+
}
|
|
469
|
+
if (contribution.when) {
|
|
470
|
+
const whenExpr = ContextKeyExpr.deserialize(contribution.when);
|
|
471
|
+
if (whenExpr) {
|
|
472
|
+
for (const key of ( whenExpr.keys())) {
|
|
473
|
+
this._contextKeys.add(key);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
this._contributions.set(contribution.type, {
|
|
478
|
+
contribution,
|
|
479
|
+
extension: ext
|
|
480
|
+
});
|
|
481
|
+
if (contribution.alternativeIds) {
|
|
482
|
+
for (const altId of contribution.alternativeIds) {
|
|
483
|
+
if (( this._alternativeIdMap.has(altId))) {
|
|
484
|
+
this._logService.warn(
|
|
485
|
+
`Alternative ID '${altId}' is already mapped to '${this._alternativeIdMap.get(altId)}'. Remapping to '${contribution.type}'.`
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
this._alternativeIdMap.set(altId, contribution.type);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
this._evaluateAvailability();
|
|
492
|
+
return {
|
|
493
|
+
dispose: () => {
|
|
494
|
+
this._contributions.delete(contribution.type);
|
|
495
|
+
if (contribution.alternativeIds) {
|
|
496
|
+
for (const altId of contribution.alternativeIds) {
|
|
497
|
+
if (this._alternativeIdMap.get(altId) === contribution.type) {
|
|
498
|
+
this._alternativeIdMap.delete(altId);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
503
|
+
this._updateHasCanDelegateProvidersContextKey();
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
_isContributionAvailable(contribution) {
|
|
508
|
+
if (!contribution.when) {
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
const whenExpr = ContextKeyExpr.deserialize(contribution.when);
|
|
512
|
+
return !whenExpr || this._contextKeyService.contextMatchesRules(whenExpr);
|
|
513
|
+
}
|
|
514
|
+
_resolveToPrimaryType(sessionType) {
|
|
515
|
+
const contribution = this._contributions.get(sessionType)?.contribution;
|
|
516
|
+
if (contribution) {
|
|
517
|
+
if (this._isContributionAvailable(contribution)) {
|
|
518
|
+
return sessionType;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
const primaryType = this._alternativeIdMap.get(sessionType);
|
|
522
|
+
if (primaryType) {
|
|
523
|
+
const altContribution = this._contributions.get(primaryType)?.contribution;
|
|
524
|
+
if (altContribution && this._isContributionAvailable(altContribution)) {
|
|
525
|
+
return primaryType;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return undefined;
|
|
529
|
+
}
|
|
530
|
+
_registerMenuItems(contribution, extensionDescription) {
|
|
531
|
+
const contextKeyService = this._contextKeyService.createOverlay([["chatSessionType", contribution.type]]);
|
|
532
|
+
const rawMenuActions = this._menuService.getMenuActions(MenuId.AgentSessionsCreateSubMenu, contextKeyService);
|
|
533
|
+
const menuActions = ( rawMenuActions.map(value => value[1])).flat();
|
|
534
|
+
const disposables = ( new DisposableStore());
|
|
535
|
+
for (let i = 0; i < menuActions.length; i++) {
|
|
536
|
+
const action = menuActions[i];
|
|
537
|
+
if (action instanceof MenuItemAction) {
|
|
538
|
+
if (i === 0 && !contribution.canDelegate) {
|
|
539
|
+
disposables.add(
|
|
540
|
+
registerNewSessionExternalAction(contribution.type, contribution.displayName, action.item.id)
|
|
541
|
+
);
|
|
542
|
+
} else {
|
|
543
|
+
disposables.add(MenuRegistry.appendMenuItem(MenuId.ChatNewMenu, {
|
|
544
|
+
command: action.item,
|
|
545
|
+
group: "4_externally_contributed"
|
|
546
|
+
}));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return {
|
|
551
|
+
dispose: () => disposables.dispose()
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
_registerCommands(contribution) {
|
|
555
|
+
const isAvailableInSessionTypePicker = isAgentSessionProviderType(contribution.type);
|
|
556
|
+
return combinedDisposable(registerAction2(class OpenChatSessionAction extends Action2 {
|
|
557
|
+
constructor() {
|
|
558
|
+
super({
|
|
559
|
+
id: `workbench.action.chat.openSessionWithPrompt.${contribution.type}`,
|
|
560
|
+
title: ( localize2(6229, "New {0} with Prompt", contribution.displayName)),
|
|
561
|
+
category: CHAT_CATEGORY,
|
|
562
|
+
icon: Codicon.plus,
|
|
563
|
+
f1: false,
|
|
564
|
+
precondition: ChatContextKeys.enabled
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
async run(accessor, chatOptions) {
|
|
568
|
+
const chatService = accessor.get(IChatService);
|
|
569
|
+
const promptsService = accessor.get(IPromptsService);
|
|
570
|
+
const toolsService = accessor.get(ILanguageModelToolsService);
|
|
571
|
+
const {
|
|
572
|
+
type
|
|
573
|
+
} = contribution;
|
|
574
|
+
if (chatOptions) {
|
|
575
|
+
let attachedContext = chatOptions.attachedContext;
|
|
576
|
+
const resource = URI.revive(chatOptions.resource);
|
|
577
|
+
const ref = await chatService.acquireOrLoadSession(resource, ChatAgentLocation.Chat, CancellationToken.None);
|
|
578
|
+
try {
|
|
579
|
+
const promptFile = await resolvePromptSlashCommand(chatOptions.prompt, promptsService, toolsService);
|
|
580
|
+
if (promptFile) {
|
|
581
|
+
attachedContext = [promptFile, ...(attachedContext ?? [])];
|
|
582
|
+
}
|
|
583
|
+
const result = await chatService.sendRequest(resource, chatOptions.prompt, {
|
|
584
|
+
agentIdSilent: type,
|
|
585
|
+
attachedContext
|
|
586
|
+
});
|
|
587
|
+
if (result.kind === "queued") {
|
|
588
|
+
await result.deferred;
|
|
589
|
+
} else if (result.kind === "sent") {
|
|
590
|
+
await result.data.responseCompletePromise;
|
|
591
|
+
}
|
|
592
|
+
} finally {
|
|
593
|
+
ref?.dispose();
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}),
|
|
598
|
+
registerAction2(class OpenNewChatSessionEditorAction extends Action2 {
|
|
599
|
+
constructor() {
|
|
600
|
+
super({
|
|
601
|
+
id: `workbench.action.chat.openNewSessionEditor.${contribution.type}`,
|
|
602
|
+
title: ( localize2(6230, "New {0}", contribution.displayName)),
|
|
603
|
+
category: CHAT_CATEGORY,
|
|
604
|
+
icon: Codicon.plus,
|
|
605
|
+
f1: true,
|
|
606
|
+
precondition: ChatContextKeys.enabled
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
async run(accessor, chatOptions) {
|
|
610
|
+
const {
|
|
611
|
+
type,
|
|
612
|
+
displayName
|
|
613
|
+
} = contribution;
|
|
614
|
+
await openChatSession(accessor, {
|
|
615
|
+
type,
|
|
616
|
+
displayName,
|
|
617
|
+
position: ChatSessionPosition.Editor
|
|
618
|
+
}, chatOptions);
|
|
619
|
+
}
|
|
620
|
+
}),
|
|
621
|
+
registerAction2(class OpenNewChatSessionSidebarAction extends Action2 {
|
|
622
|
+
constructor() {
|
|
623
|
+
super({
|
|
624
|
+
id: `workbench.action.chat.openNewSessionSidebar.${contribution.type}`,
|
|
625
|
+
title: ( localize2(6231, "New {0}", contribution.displayName)),
|
|
626
|
+
category: CHAT_CATEGORY,
|
|
627
|
+
icon: Codicon.plus,
|
|
628
|
+
f1: false,
|
|
629
|
+
precondition: ChatContextKeys.enabled,
|
|
630
|
+
menu: !isAvailableInSessionTypePicker ? {
|
|
631
|
+
id: MenuId.ChatNewMenu,
|
|
632
|
+
group: "3_new_special"
|
|
633
|
+
} : undefined
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
async run(accessor, chatOptions) {
|
|
637
|
+
const {
|
|
638
|
+
type,
|
|
639
|
+
displayName
|
|
640
|
+
} = contribution;
|
|
641
|
+
await openChatSession(accessor, {
|
|
642
|
+
type,
|
|
643
|
+
displayName,
|
|
644
|
+
position: ChatSessionPosition.Sidebar
|
|
645
|
+
}, chatOptions);
|
|
646
|
+
}
|
|
647
|
+
}));
|
|
648
|
+
}
|
|
649
|
+
_evaluateAvailability() {
|
|
650
|
+
const newlyEnabledChatSessionTypes = ( new Set());
|
|
651
|
+
const newlyDisabledChatSessionTypes = ( new Set());
|
|
652
|
+
const disposedChatSessions = ( new ResourceSet());
|
|
653
|
+
for (const {
|
|
654
|
+
contribution,
|
|
655
|
+
extension
|
|
656
|
+
} of ( this._contributions.values())) {
|
|
657
|
+
const isCurrentlyRegistered = ( this._contributionDisposables.has(contribution.type));
|
|
658
|
+
const shouldBeRegistered = this._isContributionAvailable(contribution);
|
|
659
|
+
this._logService.trace(
|
|
660
|
+
`[ChatSessionsService] _evaluateAvailability: type='${contribution.type}', isCurrentlyRegistered=${isCurrentlyRegistered}, shouldBeRegistered=${shouldBeRegistered}, when='${contribution.when}'`
|
|
661
|
+
);
|
|
662
|
+
if (isCurrentlyRegistered && !shouldBeRegistered) {
|
|
663
|
+
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
664
|
+
for (const sessionResource of this._disposeSessionsForContribution(contribution.type)) {
|
|
665
|
+
disposedChatSessions.add(sessionResource);
|
|
666
|
+
}
|
|
667
|
+
newlyDisabledChatSessionTypes.add(contribution.type);
|
|
668
|
+
} else if (!isCurrentlyRegistered && shouldBeRegistered) {
|
|
669
|
+
if (extension) {
|
|
670
|
+
this._enableContribution(contribution, extension);
|
|
671
|
+
}
|
|
672
|
+
newlyEnabledChatSessionTypes.add(contribution.type);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
if (newlyEnabledChatSessionTypes.size > 0 || newlyDisabledChatSessionTypes.size > 0) {
|
|
676
|
+
this._onDidChangeAvailability.fire();
|
|
677
|
+
for (const chatSessionType of [...newlyEnabledChatSessionTypes, ...newlyDisabledChatSessionTypes]) {
|
|
678
|
+
this._onDidChangeItemsProviders.fire({
|
|
679
|
+
chatSessionType
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
if (disposedChatSessions.size > 0) {
|
|
683
|
+
this._onDidChangeSessionItems.fire({
|
|
684
|
+
removed: Array.from(disposedChatSessions)
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
this._updateHasCanDelegateProvidersContextKey();
|
|
689
|
+
}
|
|
690
|
+
_enableContribution(contribution, ext) {
|
|
691
|
+
this._logService.trace(
|
|
692
|
+
`[ChatSessionsService] _enableContribution: type='${contribution.type}', canDelegate=${contribution.canDelegate}`
|
|
693
|
+
);
|
|
694
|
+
const disposableStore = ( new DisposableStore());
|
|
695
|
+
this._contributionDisposables.set(contribution.type, disposableStore);
|
|
696
|
+
if (contribution.canDelegate) {
|
|
697
|
+
disposableStore.add(this._registerAgent(contribution, ext));
|
|
698
|
+
disposableStore.add(this._registerCommands(contribution));
|
|
699
|
+
}
|
|
700
|
+
disposableStore.add(this._registerMenuItems(contribution, ext));
|
|
701
|
+
}
|
|
702
|
+
_disposeSessionsForContribution(contributionId) {
|
|
703
|
+
const sessionsToDispose = [];
|
|
704
|
+
for (const [sessionResource, sessionData] of this._sessions) {
|
|
705
|
+
if (sessionData.chatSessionType === contributionId) {
|
|
706
|
+
sessionsToDispose.push(sessionResource);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
if (sessionsToDispose.length > 0) {
|
|
710
|
+
this._logService.info(
|
|
711
|
+
`Disposing ${sessionsToDispose.length} cached sessions for contribution '${contributionId}' due to when clause change`
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
for (const sessionKey of sessionsToDispose) {
|
|
715
|
+
const sessionData = this._sessions.get(sessionKey);
|
|
716
|
+
if (sessionData) {
|
|
717
|
+
sessionData.dispose();
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return sessionsToDispose;
|
|
721
|
+
}
|
|
722
|
+
_registerAgent(contribution, ext) {
|
|
723
|
+
const storedIcon = this.getContributionIcon(ext, contribution);
|
|
724
|
+
const icons = ThemeIcon.isThemeIcon(storedIcon) ? {
|
|
725
|
+
themeIcon: storedIcon,
|
|
726
|
+
icon: undefined,
|
|
727
|
+
iconDark: undefined
|
|
728
|
+
} : storedIcon ? {
|
|
729
|
+
icon: storedIcon.light,
|
|
730
|
+
iconDark: storedIcon.dark
|
|
731
|
+
} : {
|
|
732
|
+
themeIcon: Codicon.sendToRemoteAgent
|
|
733
|
+
};
|
|
734
|
+
const id = contribution.type;
|
|
735
|
+
const agentData = {
|
|
736
|
+
id,
|
|
737
|
+
name: contribution.name,
|
|
738
|
+
fullName: contribution.displayName,
|
|
739
|
+
description: contribution.description,
|
|
740
|
+
isDefault: false,
|
|
741
|
+
isCore: false,
|
|
742
|
+
isDynamic: true,
|
|
743
|
+
slashCommands: contribution.commands ?? [],
|
|
744
|
+
locations: [ChatAgentLocation.Chat],
|
|
745
|
+
modes: [ChatModeKind.Agent, ChatModeKind.Ask],
|
|
746
|
+
disambiguation: [],
|
|
747
|
+
metadata: {
|
|
748
|
+
...icons
|
|
749
|
+
},
|
|
750
|
+
capabilities: contribution.capabilities,
|
|
751
|
+
canAccessPreviousChatHistory: true,
|
|
752
|
+
extensionId: ext.identifier,
|
|
753
|
+
extensionVersion: ext.version,
|
|
754
|
+
extensionDisplayName: ext.displayName || ext.name,
|
|
755
|
+
extensionPublisherId: ext.publisher
|
|
756
|
+
};
|
|
757
|
+
return this._chatAgentService.registerAgent(id, agentData);
|
|
758
|
+
}
|
|
759
|
+
getAllChatSessionContributions() {
|
|
760
|
+
return ( Array.from(( this._contributions.values())).filter(entry => this._isContributionAvailable(entry.contribution)).map(
|
|
761
|
+
entry => this.resolveChatSessionContribution(entry.extension, entry.contribution)
|
|
762
|
+
));
|
|
763
|
+
}
|
|
764
|
+
_updateHasCanDelegateProvidersContextKey() {
|
|
765
|
+
const hasCanDelegate = this.getAllChatSessionContributions().filter(c => c.canDelegate);
|
|
766
|
+
const canDelegateEnabled = hasCanDelegate.length > 0;
|
|
767
|
+
this._logService.trace(
|
|
768
|
+
`[ChatSessionsService] hasCanDelegateProvidersAvailable=${canDelegateEnabled} (${( hasCanDelegate.map(c => c.type)).join(", ")})`
|
|
769
|
+
);
|
|
770
|
+
this._hasCanDelegateProvidersKey.set(canDelegateEnabled);
|
|
771
|
+
}
|
|
772
|
+
getChatSessionContribution(chatSessionType) {
|
|
773
|
+
const entry = this._contributions.get(chatSessionType);
|
|
774
|
+
if (!entry) {
|
|
775
|
+
return undefined;
|
|
776
|
+
}
|
|
777
|
+
if (!this._isContributionAvailable(entry.contribution)) {
|
|
778
|
+
return undefined;
|
|
779
|
+
}
|
|
780
|
+
return this.resolveChatSessionContribution(entry.extension, entry.contribution);
|
|
781
|
+
}
|
|
782
|
+
resolveChatSessionContribution(ext, contribution) {
|
|
783
|
+
return {
|
|
784
|
+
...contribution,
|
|
785
|
+
icon: this.resolveIconForCurrentColorTheme(this.getContributionIcon(ext, contribution))
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
getContributionIcon(ext, contribution) {
|
|
789
|
+
if (!contribution.icon) {
|
|
790
|
+
return undefined;
|
|
791
|
+
}
|
|
792
|
+
if (typeof contribution.icon === "string") {
|
|
793
|
+
return contribution.icon.startsWith("$(") && contribution.icon.endsWith(")") ? ThemeIcon.fromString(contribution.icon) : ThemeIcon.fromId(contribution.icon);
|
|
794
|
+
}
|
|
795
|
+
return {
|
|
796
|
+
dark: ext ? joinPath(ext.extensionLocation, contribution.icon.dark) : ( URI.parse(contribution.icon.dark)),
|
|
797
|
+
light: ext ? joinPath(ext.extensionLocation, contribution.icon.light) : ( URI.parse(contribution.icon.light))
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
resolveIconForCurrentColorTheme(rawIcon) {
|
|
801
|
+
if (!rawIcon) {
|
|
802
|
+
return undefined;
|
|
803
|
+
}
|
|
804
|
+
if (ThemeIcon.isThemeIcon(rawIcon)) {
|
|
805
|
+
return rawIcon;
|
|
806
|
+
} else if (isDark(this._themeService.getColorTheme().type)) {
|
|
807
|
+
return rawIcon.dark;
|
|
808
|
+
} else {
|
|
809
|
+
return rawIcon.light;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
registerChatSessionContribution(contribution) {
|
|
813
|
+
if (( this._contributions.has(contribution.type))) {
|
|
814
|
+
return {
|
|
815
|
+
dispose: () => {}
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
this._contributions.set(contribution.type, {
|
|
819
|
+
contribution,
|
|
820
|
+
extension: undefined
|
|
821
|
+
});
|
|
822
|
+
this._onDidChangeAvailability.fire();
|
|
823
|
+
return toDisposable(() => {
|
|
824
|
+
this._contributions.delete(contribution.type);
|
|
825
|
+
this._onDidChangeAvailability.fire();
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
async activateChatSessionItemProvider(chatViewType) {
|
|
829
|
+
await this.doActivateChatSessionItemController(chatViewType);
|
|
830
|
+
}
|
|
831
|
+
async doActivateChatSessionItemController(chatViewType) {
|
|
832
|
+
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
833
|
+
const resolvedType = this._resolveToPrimaryType(chatViewType);
|
|
834
|
+
if (resolvedType) {
|
|
835
|
+
chatViewType = resolvedType;
|
|
836
|
+
}
|
|
837
|
+
const contribution = this._contributions.get(chatViewType)?.contribution;
|
|
838
|
+
if (contribution && !this._isContributionAvailable(contribution)) {
|
|
839
|
+
return false;
|
|
840
|
+
}
|
|
841
|
+
if (( this._itemControllers.has(chatViewType))) {
|
|
842
|
+
return true;
|
|
843
|
+
}
|
|
844
|
+
await this._extensionService.activateByEvent(`onChatSession:${chatViewType}`);
|
|
845
|
+
const controller = this._itemControllers.get(chatViewType);
|
|
846
|
+
return !!controller;
|
|
847
|
+
}
|
|
848
|
+
async canResolveChatSession(sessionType) {
|
|
849
|
+
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
850
|
+
const resolvedType = this._resolveToPrimaryType(sessionType) || sessionType;
|
|
851
|
+
const contribution = this._contributions.get(resolvedType)?.contribution;
|
|
852
|
+
if (contribution && !this._isContributionAvailable(contribution)) {
|
|
853
|
+
return false;
|
|
854
|
+
}
|
|
855
|
+
if (( this._contentProviders.has(sessionType))) {
|
|
856
|
+
return true;
|
|
857
|
+
}
|
|
858
|
+
await this._extensionService.activateByEvent(`onChatSession:${sessionType}`);
|
|
859
|
+
return ( this._contentProviders.has(sessionType));
|
|
860
|
+
}
|
|
861
|
+
async tryActivateControllers(providersToResolve) {
|
|
862
|
+
await Promise.all(( this.getAllChatSessionContributions().map(async contrib => {
|
|
863
|
+
if (providersToResolve && !providersToResolve.includes(contrib.type)) {
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
if (!(await this.doActivateChatSessionItemController(contrib.type))) {
|
|
867
|
+
if (providersToResolve?.includes(contrib.type)) {
|
|
868
|
+
this._logService.trace(
|
|
869
|
+
`[ChatSessionsService] No enabled provider found for chat session type ${contrib.type}`
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
})));
|
|
874
|
+
}
|
|
875
|
+
getChatSessionItems(providersToResolve, token) {
|
|
876
|
+
return new AsyncIterableProducer(async writer => {
|
|
877
|
+
await raceCancellationError(this.tryActivateControllers(providersToResolve), token);
|
|
878
|
+
await Promise.all(
|
|
879
|
+
Array.from(this._itemControllers, async ([chatSessionType, controllerEntry]) => {
|
|
880
|
+
const resolvedType = this._resolveToPrimaryType(chatSessionType) ?? chatSessionType;
|
|
881
|
+
if (providersToResolve && !providersToResolve.includes(resolvedType)) {
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
try {
|
|
885
|
+
await raceCancellationError(controllerEntry.initialRefresh, token);
|
|
886
|
+
const providerSessions = controllerEntry.controller.items;
|
|
887
|
+
this._logService.trace(
|
|
888
|
+
`[ChatSessionsService] Resolved ${providerSessions.length} sessions for provider ${resolvedType}`
|
|
889
|
+
);
|
|
890
|
+
writer.emitOne({
|
|
891
|
+
chatSessionType: resolvedType,
|
|
892
|
+
items: providerSessions
|
|
893
|
+
});
|
|
894
|
+
} catch (err) {
|
|
895
|
+
if (!isCancellationError(err)) {
|
|
896
|
+
this._logService.error(
|
|
897
|
+
`[ChatSessionsService] Failed to resolve sessions for provider ${resolvedType}`,
|
|
898
|
+
err
|
|
899
|
+
);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
})
|
|
903
|
+
);
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
async refreshChatSessionItems(providersToResolve, token) {
|
|
907
|
+
await this.tryActivateControllers(providersToResolve);
|
|
908
|
+
await Promise.all(( Array.from(this._itemControllers).map(async ([chatSessionType, controllerEntry]) => {
|
|
909
|
+
const resolvedType = this._resolveToPrimaryType(chatSessionType) ?? chatSessionType;
|
|
910
|
+
if (providersToResolve && !providersToResolve.includes(resolvedType)) {
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
try {
|
|
914
|
+
await controllerEntry.controller.refresh(token);
|
|
915
|
+
} catch (err) {
|
|
916
|
+
if (!isCancellationError(err)) {
|
|
917
|
+
this._logService.error(
|
|
918
|
+
`[ChatSessionsService] Failed to resolve sessions for provider ${resolvedType}`,
|
|
919
|
+
err
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
})));
|
|
924
|
+
}
|
|
925
|
+
getRegisteredChatSessionItemProviders() {
|
|
926
|
+
return [...( new Set(( Array.from(( this._itemControllers.keys())).map(key => this._resolveToPrimaryType(key) ?? key))))];
|
|
927
|
+
}
|
|
928
|
+
registerChatSessionItemController(chatSessionType, controller) {
|
|
929
|
+
const disposables = ( new DisposableStore());
|
|
930
|
+
const initialRefreshCts = disposables.add(( new CancellationTokenSource()));
|
|
931
|
+
this._itemControllers.set(chatSessionType, {
|
|
932
|
+
controller,
|
|
933
|
+
initialRefresh: controller.refresh(initialRefreshCts.token)
|
|
934
|
+
});
|
|
935
|
+
this._onDidChangeItemsProviders.fire({
|
|
936
|
+
chatSessionType
|
|
937
|
+
});
|
|
938
|
+
disposables.add(controller.onDidChangeChatSessionItems(e => {
|
|
939
|
+
this._onDidChangeSessionItems.fire(e);
|
|
940
|
+
this.updateInProgressStatus(chatSessionType);
|
|
941
|
+
}));
|
|
942
|
+
return {
|
|
943
|
+
dispose: () => {
|
|
944
|
+
initialRefreshCts.cancel();
|
|
945
|
+
disposables.dispose();
|
|
946
|
+
const controller = this._itemControllers.get(chatSessionType);
|
|
947
|
+
if (controller) {
|
|
948
|
+
this._itemControllers.delete(chatSessionType);
|
|
949
|
+
this._onDidChangeItemsProviders.fire({
|
|
950
|
+
chatSessionType
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
this.updateInProgressStatus(chatSessionType);
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
registerChatSessionContentProvider(chatSessionType, provider) {
|
|
958
|
+
if (( this._contentProviders.has(chatSessionType))) {
|
|
959
|
+
throw ( new Error(`Content provider for ${chatSessionType} is already registered.`));
|
|
960
|
+
}
|
|
961
|
+
this._contentProviders.set(chatSessionType, provider);
|
|
962
|
+
this._onDidChangeContentProviderSchemes.fire({
|
|
963
|
+
added: [chatSessionType],
|
|
964
|
+
removed: []
|
|
965
|
+
});
|
|
966
|
+
return {
|
|
967
|
+
dispose: () => {
|
|
968
|
+
this._contentProviders.delete(chatSessionType);
|
|
969
|
+
this._onDidChangeContentProviderSchemes.fire({
|
|
970
|
+
added: [],
|
|
971
|
+
removed: [chatSessionType]
|
|
972
|
+
});
|
|
973
|
+
for (const [key, session] of this._sessions) {
|
|
974
|
+
if (session.chatSessionType === chatSessionType) {
|
|
975
|
+
session.dispose();
|
|
976
|
+
this._sessions.delete(key);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
registerCustomizationsProvider(chatSessionType, provider) {
|
|
983
|
+
this._customizationsProviders.set(chatSessionType, provider);
|
|
984
|
+
const onChangeDisposable = provider.onDidChangeCustomizations(() => {
|
|
985
|
+
this._onDidChangeCustomizations.fire({
|
|
986
|
+
chatSessionType
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
return toDisposable(() => {
|
|
990
|
+
onChangeDisposable.dispose();
|
|
991
|
+
if (this._customizationsProviders.get(chatSessionType) === provider) {
|
|
992
|
+
this._customizationsProviders.delete(chatSessionType);
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
hasCustomizationsProvider(chatSessionType) {
|
|
997
|
+
return ( this._customizationsProviders.has(chatSessionType));
|
|
998
|
+
}
|
|
999
|
+
async getCustomizations(chatSessionType, token) {
|
|
1000
|
+
const provider = this._customizationsProviders.get(chatSessionType);
|
|
1001
|
+
if (!provider) {
|
|
1002
|
+
return undefined;
|
|
1003
|
+
}
|
|
1004
|
+
return provider.provideCustomizations(token);
|
|
1005
|
+
}
|
|
1006
|
+
async createNewChatSessionItem(chatSessionType, request, token) {
|
|
1007
|
+
const controllerData = this._itemControllers.get(chatSessionType);
|
|
1008
|
+
if (!controllerData) {
|
|
1009
|
+
return undefined;
|
|
1010
|
+
}
|
|
1011
|
+
await controllerData.initialRefresh;
|
|
1012
|
+
return controllerData.controller.newChatSessionItem?.(request, token);
|
|
1013
|
+
}
|
|
1014
|
+
async getOrCreateChatSession(sessionResource, token) {
|
|
1015
|
+
{
|
|
1016
|
+
const existingSessionData = this._sessions.get(sessionResource);
|
|
1017
|
+
if (existingSessionData) {
|
|
1018
|
+
return existingSessionData.session;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
if (!(await raceCancellationError(this.canResolveChatSession(sessionResource.scheme), token))) {
|
|
1022
|
+
throw Error(`Can not find provider for ${sessionResource}`);
|
|
1023
|
+
}
|
|
1024
|
+
{
|
|
1025
|
+
const existingSessionData = this._sessions.get(sessionResource);
|
|
1026
|
+
if (existingSessionData) {
|
|
1027
|
+
return existingSessionData.session;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
const resolvedType = this._resolveToPrimaryType(sessionResource.scheme) || sessionResource.scheme;
|
|
1031
|
+
const provider = this._contentProviders.get(resolvedType);
|
|
1032
|
+
if (!provider) {
|
|
1033
|
+
throw Error(`Can not find provider for ${sessionResource}`);
|
|
1034
|
+
}
|
|
1035
|
+
let session;
|
|
1036
|
+
const newSessionOptions = this.getNewSessionOptionsForSessionType(resolvedType);
|
|
1037
|
+
if (isUntitledChatSession(sessionResource) && newSessionOptions) {
|
|
1038
|
+
session = {
|
|
1039
|
+
sessionResource: sessionResource,
|
|
1040
|
+
onWillDispose: Event.None,
|
|
1041
|
+
history: [],
|
|
1042
|
+
options: newSessionOptions ?? {},
|
|
1043
|
+
dispose: () => {}
|
|
1044
|
+
};
|
|
1045
|
+
} else {
|
|
1046
|
+
session = await raceCancellationError(provider.provideChatSessionContent(sessionResource, token), token);
|
|
1047
|
+
}
|
|
1048
|
+
if (session.options) {
|
|
1049
|
+
for (const [optionId, value] of session.options) {
|
|
1050
|
+
this.setSessionOption(sessionResource, optionId, value);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
{
|
|
1054
|
+
const existingSessionData = this._sessions.get(sessionResource);
|
|
1055
|
+
if (existingSessionData) {
|
|
1056
|
+
session.dispose();
|
|
1057
|
+
return existingSessionData.session;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
const sessionData = ( new ContributedChatSessionData(
|
|
1061
|
+
session,
|
|
1062
|
+
sessionResource.scheme,
|
|
1063
|
+
sessionResource,
|
|
1064
|
+
session.options,
|
|
1065
|
+
resource => {
|
|
1066
|
+
sessionData.dispose();
|
|
1067
|
+
this._sessions.delete(resource);
|
|
1068
|
+
}
|
|
1069
|
+
));
|
|
1070
|
+
this._sessions.set(sessionResource, sessionData);
|
|
1071
|
+
if (session.options) {
|
|
1072
|
+
this._onDidChangeSessionOptions.fire({
|
|
1073
|
+
sessionResource,
|
|
1074
|
+
updates: session.options
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
return session;
|
|
1078
|
+
}
|
|
1079
|
+
hasAnySessionOptions(sessionResource) {
|
|
1080
|
+
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1081
|
+
return !!session && !!session.options && session.options.size > 0;
|
|
1082
|
+
}
|
|
1083
|
+
getSessionOptions(sessionResource) {
|
|
1084
|
+
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1085
|
+
if (!session) {
|
|
1086
|
+
return undefined;
|
|
1087
|
+
}
|
|
1088
|
+
const result = ( new Map());
|
|
1089
|
+
for (const [key, value] of session.getAllOptions()) {
|
|
1090
|
+
result.set(key, typeof value === "string" ? value : value.id);
|
|
1091
|
+
}
|
|
1092
|
+
return result.size > 0 ? result : undefined;
|
|
1093
|
+
}
|
|
1094
|
+
getSessionOption(sessionResource, optionId) {
|
|
1095
|
+
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1096
|
+
return session?.getOption(optionId);
|
|
1097
|
+
}
|
|
1098
|
+
setSessionOption(sessionResource, optionId, value) {
|
|
1099
|
+
return this.updateSessionOptions(sessionResource, ( new Map([[optionId, value]])));
|
|
1100
|
+
}
|
|
1101
|
+
updateSessionOptions(sessionResource, updates) {
|
|
1102
|
+
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1103
|
+
if (!session) {
|
|
1104
|
+
return false;
|
|
1105
|
+
}
|
|
1106
|
+
let didChange = false;
|
|
1107
|
+
for (const [optionId, value] of updates) {
|
|
1108
|
+
const existingValue = session.getOption(optionId);
|
|
1109
|
+
if (existingValue !== value) {
|
|
1110
|
+
session.setOption(optionId, value);
|
|
1111
|
+
didChange = true;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
if (didChange) {
|
|
1115
|
+
this._onDidChangeSessionOptions.fire({
|
|
1116
|
+
sessionResource,
|
|
1117
|
+
updates: updates
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
return didChange;
|
|
1121
|
+
}
|
|
1122
|
+
_resolveResource(resource) {
|
|
1123
|
+
return this._resourceAliases.get(resource) ?? resource;
|
|
1124
|
+
}
|
|
1125
|
+
registerSessionResourceAlias(untitledResource, realResource) {
|
|
1126
|
+
this._resourceAliases.set(realResource, untitledResource);
|
|
1127
|
+
}
|
|
1128
|
+
fireSessionCommitted(original, committed) {
|
|
1129
|
+
this._onDidCommitSession.fire({
|
|
1130
|
+
original,
|
|
1131
|
+
committed
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
setOptionGroupsForSessionType(chatSessionType, handle, optionGroups) {
|
|
1135
|
+
if (optionGroups) {
|
|
1136
|
+
this._sessionTypeOptions.set(chatSessionType, optionGroups);
|
|
1137
|
+
} else {
|
|
1138
|
+
this._sessionTypeOptions.delete(chatSessionType);
|
|
1139
|
+
}
|
|
1140
|
+
this._onDidChangeOptionGroups.fire(chatSessionType);
|
|
1141
|
+
}
|
|
1142
|
+
getOptionGroupsForSessionType(chatSessionType) {
|
|
1143
|
+
return this._sessionTypeOptions.get(chatSessionType);
|
|
1144
|
+
}
|
|
1145
|
+
getNewSessionOptionsForSessionType(chatSessionType) {
|
|
1146
|
+
const options = this._sessionTypeNewSessionOptions.get(chatSessionType);
|
|
1147
|
+
if (!options || options.size === 0) {
|
|
1148
|
+
return undefined;
|
|
1149
|
+
}
|
|
1150
|
+
return ( new Map(options));
|
|
1151
|
+
}
|
|
1152
|
+
setNewSessionOptionsForSessionType(chatSessionType, options) {
|
|
1153
|
+
this._sessionTypeNewSessionOptions.set(chatSessionType, ( new Map(options)));
|
|
1154
|
+
}
|
|
1155
|
+
getCapabilitiesForSessionType(chatSessionType) {
|
|
1156
|
+
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1157
|
+
return contribution?.capabilities;
|
|
1158
|
+
}
|
|
1159
|
+
getCustomAgentTargetForSessionType(chatSessionType) {
|
|
1160
|
+
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1161
|
+
return contribution?.customAgentTarget ?? Target.Undefined;
|
|
1162
|
+
}
|
|
1163
|
+
requiresCustomModelsForSessionType(chatSessionType) {
|
|
1164
|
+
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1165
|
+
return !!contribution?.requiresCustomModels;
|
|
1166
|
+
}
|
|
1167
|
+
supportsDelegationForSessionType(chatSessionType) {
|
|
1168
|
+
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1169
|
+
return contribution?.supportsDelegation !== false;
|
|
1170
|
+
}
|
|
1171
|
+
sessionSupportsFork(sessionResource) {
|
|
1172
|
+
const session =
|
|
1173
|
+
this._sessions.get(sessionResource) ?? this._sessions.get(this._resolveResource(sessionResource));
|
|
1174
|
+
return !!session?.session.forkSession;
|
|
1175
|
+
}
|
|
1176
|
+
async forkChatSession(sessionResource, request, token) {
|
|
1177
|
+
const session =
|
|
1178
|
+
this._sessions.get(sessionResource) ?? this._sessions.get(this._resolveResource(sessionResource));
|
|
1179
|
+
if (!session?.session.forkSession) {
|
|
1180
|
+
throw ( new Error(`Session ${( sessionResource.toString())} does not support forking`));
|
|
1181
|
+
}
|
|
1182
|
+
return session.session.forkSession(request, token);
|
|
1183
|
+
}
|
|
1184
|
+
getContentProviderSchemes() {
|
|
1185
|
+
return Array.from(( this._contentProviders.keys()));
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
ChatSessionsService = ( __decorate([( __param(0, ILogService)), ( __param(1, IChatAgentService)), ( __param(2, IExtensionService)), ( __param(3, IContextKeyService)), ( __param(4, IMenuService)), ( __param(5, IThemeService)), ( __param(6, ILabelService))], ChatSessionsService));
|
|
1189
|
+
function registerNewSessionInPlaceAction(type, displayName) {
|
|
1190
|
+
return registerAction2(class NewChatSessionInPlaceAction extends Action2 {
|
|
1191
|
+
constructor() {
|
|
1192
|
+
super({
|
|
1193
|
+
id: `workbench.action.chat.openNewChatSessionInPlace.${type}`,
|
|
1194
|
+
title: ( localize2(6232, "New {0}", displayName)),
|
|
1195
|
+
category: CHAT_CATEGORY,
|
|
1196
|
+
f1: false,
|
|
1197
|
+
precondition: ChatContextKeys.enabled
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
async run(accessor, ...args) {
|
|
1201
|
+
if (args.length === 0) {
|
|
1202
|
+
throw ( new BugIndicatingError("Expected chat session position argument"));
|
|
1203
|
+
}
|
|
1204
|
+
const chatSessionPosition = args[0];
|
|
1205
|
+
if (chatSessionPosition !== ChatSessionPosition.Sidebar && chatSessionPosition !== ChatSessionPosition.Editor) {
|
|
1206
|
+
throw ( new BugIndicatingError(`Invalid chat session position argument: ${chatSessionPosition}`));
|
|
1207
|
+
}
|
|
1208
|
+
await openChatSession(accessor, {
|
|
1209
|
+
type: type,
|
|
1210
|
+
displayName: ( localize(6233, "Chat")),
|
|
1211
|
+
position: chatSessionPosition,
|
|
1212
|
+
replaceEditor: true
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
function registerNewSessionExternalAction(type, displayName, commandId) {
|
|
1218
|
+
return registerAction2(class NewChatSessionExternalAction extends Action2 {
|
|
1219
|
+
constructor() {
|
|
1220
|
+
super({
|
|
1221
|
+
id: `workbench.action.chat.openNewChatSessionExternal.${type}`,
|
|
1222
|
+
title: ( localize2(6234, "New {0}", displayName)),
|
|
1223
|
+
category: CHAT_CATEGORY,
|
|
1224
|
+
f1: false,
|
|
1225
|
+
precondition: ChatContextKeys.enabled
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
async run(accessor) {
|
|
1229
|
+
const commandService = accessor.get(ICommandService);
|
|
1230
|
+
await commandService.executeCommand(commandId);
|
|
1231
|
+
}
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
var ChatSessionPosition;
|
|
1235
|
+
(function(ChatSessionPosition) {
|
|
1236
|
+
ChatSessionPosition["Editor"] = "editor";
|
|
1237
|
+
ChatSessionPosition["Sidebar"] = "sidebar";
|
|
1238
|
+
})(ChatSessionPosition || (ChatSessionPosition = {}));
|
|
1239
|
+
async function openChatSession(accessor, openOptions, chatSendOptions) {
|
|
1240
|
+
const viewsService = accessor.get(IViewsService);
|
|
1241
|
+
const chatService = accessor.get(IChatService);
|
|
1242
|
+
const logService = accessor.get(ILogService);
|
|
1243
|
+
const editorGroupService = accessor.get(IEditorGroupsService);
|
|
1244
|
+
const editorService = accessor.get(IEditorService);
|
|
1245
|
+
const promptsService = accessor.get(IPromptsService);
|
|
1246
|
+
const toolsService = accessor.get(ILanguageModelToolsService);
|
|
1247
|
+
const resource = getResourceForNewChatSession(openOptions);
|
|
1248
|
+
try {
|
|
1249
|
+
switch (openOptions.position) {
|
|
1250
|
+
case ChatSessionPosition.Sidebar:
|
|
1251
|
+
{
|
|
1252
|
+
const view = await viewsService.openView(ChatViewId);
|
|
1253
|
+
if (openOptions.type === AgentSessionProviders.Local) {
|
|
1254
|
+
await view.widget.clear();
|
|
1255
|
+
} else {
|
|
1256
|
+
await view.loadSession(resource);
|
|
1257
|
+
}
|
|
1258
|
+
view.focus();
|
|
1259
|
+
break;
|
|
1260
|
+
}
|
|
1261
|
+
case ChatSessionPosition.Editor:
|
|
1262
|
+
{
|
|
1263
|
+
const options = {
|
|
1264
|
+
override: ChatEditorInput.EditorID,
|
|
1265
|
+
pinned: true,
|
|
1266
|
+
title: {
|
|
1267
|
+
fallback: ( localize(6235, "{0}", openOptions.displayName))
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
if (openOptions.replaceEditor) {
|
|
1271
|
+
const activeEditor = editorGroupService.activeGroup.activeEditor;
|
|
1272
|
+
if (!activeEditor || !(activeEditor instanceof ChatEditorInput)) {
|
|
1273
|
+
throw ( new Error("No active chat editor to replace"));
|
|
1274
|
+
}
|
|
1275
|
+
await editorService.replaceEditors([{
|
|
1276
|
+
editor: activeEditor,
|
|
1277
|
+
replacement: {
|
|
1278
|
+
resource,
|
|
1279
|
+
options
|
|
1280
|
+
}
|
|
1281
|
+
}], editorGroupService.activeGroup);
|
|
1282
|
+
} else {
|
|
1283
|
+
await editorService.openEditor({
|
|
1284
|
+
resource,
|
|
1285
|
+
options
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
default:
|
|
1291
|
+
assertNever(
|
|
1292
|
+
openOptions.position,
|
|
1293
|
+
`Unknown chat session position: ${openOptions.position}`
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1296
|
+
} catch (e) {
|
|
1297
|
+
logService.error(
|
|
1298
|
+
`Failed to open '${openOptions.type}' chat session with openOptions: ${JSON.stringify(openOptions)}`,
|
|
1299
|
+
e
|
|
1300
|
+
);
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
if (chatSendOptions) {
|
|
1304
|
+
try {
|
|
1305
|
+
if (chatSendOptions.initialSessionOptions) {
|
|
1306
|
+
const model = chatService.getSession(resource);
|
|
1307
|
+
if (model?.contributedChatSession) {
|
|
1308
|
+
model.setContributedChatSession({
|
|
1309
|
+
...model.contributedChatSession,
|
|
1310
|
+
initialSessionOptions: chatSendOptions.initialSessionOptions
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
let attachedContext = chatSendOptions.attachedContext;
|
|
1315
|
+
const promptFile = await resolvePromptSlashCommand(chatSendOptions.prompt, promptsService, toolsService);
|
|
1316
|
+
if (promptFile) {
|
|
1317
|
+
attachedContext = [promptFile, ...(attachedContext ?? [])];
|
|
1318
|
+
}
|
|
1319
|
+
await chatService.sendRequest(resource, chatSendOptions.prompt, {
|
|
1320
|
+
agentIdSilent: openOptions.type,
|
|
1321
|
+
attachedContext
|
|
1322
|
+
});
|
|
1323
|
+
} catch (e) {
|
|
1324
|
+
logService.error(
|
|
1325
|
+
`Failed to send initial request to '${openOptions.type}' chat session with contextOptions: ${JSON.stringify(chatSendOptions)}`,
|
|
1326
|
+
e
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
async function resolvePromptSlashCommand(prompt, promptsService, toolsService) {
|
|
1332
|
+
const slashMatch = prompt.match(slashReg);
|
|
1333
|
+
if (slashMatch) {
|
|
1334
|
+
const slashCommand = await promptsService.resolvePromptSlashCommand(slashMatch[1], CancellationToken.None);
|
|
1335
|
+
if (slashCommand) {
|
|
1336
|
+
const parseResult = slashCommand.parsedPromptFile;
|
|
1337
|
+
const refs = parseResult.body?.variableReferences.map((
|
|
1338
|
+
{
|
|
1339
|
+
name,
|
|
1340
|
+
offset
|
|
1341
|
+
}
|
|
1342
|
+
) => ({
|
|
1343
|
+
name,
|
|
1344
|
+
range: ( new OffsetRange(offset, offset + name.length + 1))
|
|
1345
|
+
})) ?? [];
|
|
1346
|
+
const toolReferences = toolsService.toToolReferences(refs);
|
|
1347
|
+
return toPromptFileVariableEntry(
|
|
1348
|
+
parseResult.uri,
|
|
1349
|
+
PromptFileVariableKind.PromptFile,
|
|
1350
|
+
undefined,
|
|
1351
|
+
true,
|
|
1352
|
+
toolReferences
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
return undefined;
|
|
1357
|
+
}
|
|
1358
|
+
function getResourceForNewChatSession(options) {
|
|
1359
|
+
const isRemoteSession = options.type !== AgentSessionProviders.Local;
|
|
1360
|
+
if (isRemoteSession) {
|
|
1361
|
+
return ( URI.from({
|
|
1362
|
+
scheme: options.type,
|
|
1363
|
+
path: `/untitled-${generateUuid()}`
|
|
1364
|
+
}));
|
|
1365
|
+
}
|
|
1366
|
+
const isEditorPosition = options.position === ChatSessionPosition.Editor;
|
|
1367
|
+
if (isEditorPosition) {
|
|
1368
|
+
return ChatEditorInput.getNewEditorUri();
|
|
1369
|
+
}
|
|
1370
|
+
return LocalChatSessionUri.getNewSessionUri();
|
|
1371
|
+
}
|
|
1372
|
+
function isAgentSessionProviderType(type) {
|
|
1373
|
+
return ( Object.values(AgentSessionProviders)).includes(type);
|
|
1374
|
+
}
|
|
1375
|
+
function getSessionStatusForModel(model) {
|
|
1376
|
+
if (model.requestInProgress.get()) {
|
|
1377
|
+
return ChatSessionStatus.InProgress;
|
|
1378
|
+
}
|
|
1379
|
+
const lastRequest = model.getRequests().at(-1);
|
|
1380
|
+
if (lastRequest?.response) {
|
|
1381
|
+
if (lastRequest.response.state === ResponseModelState.NeedsInput) {
|
|
1382
|
+
return ChatSessionStatus.NeedsInput;
|
|
1383
|
+
} else if (lastRequest.response.isCanceled || lastRequest.response.result?.errorDetails?.code === "canceled") {
|
|
1384
|
+
return ChatSessionStatus.Completed;
|
|
1385
|
+
} else if (lastRequest.response.result?.errorDetails) {
|
|
1386
|
+
return ChatSessionStatus.Failed;
|
|
1387
|
+
} else if (lastRequest.response.isComplete) {
|
|
1388
|
+
return ChatSessionStatus.Completed;
|
|
1389
|
+
} else {
|
|
1390
|
+
return ChatSessionStatus.InProgress;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
return undefined;
|
|
1394
|
+
}
|
|
1395
|
+
function chatResponseStateToSessionStatus(state) {
|
|
1396
|
+
switch (state) {
|
|
1397
|
+
case ResponseModelState.Cancelled:
|
|
1398
|
+
case ResponseModelState.Complete:
|
|
1399
|
+
return ChatSessionStatus.Completed;
|
|
1400
|
+
case ResponseModelState.Failed:
|
|
1401
|
+
return ChatSessionStatus.Failed;
|
|
1402
|
+
case ResponseModelState.Pending:
|
|
1403
|
+
return ChatSessionStatus.InProgress;
|
|
1404
|
+
case ResponseModelState.NeedsInput:
|
|
1405
|
+
return ChatSessionStatus.NeedsInput;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
export { ChatSessionPosition, ChatSessionsService, chatResponseStateToSessionStatus, getResourceForNewChatSession, getSessionStatusForModel };
|