@codingame/monaco-vscode-api 37.1.0 → 37.2.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 +6 -26
- package/package.json +8 -8
- package/services.d.ts +1 -1
- package/services.js +3 -3
- package/tools.d.ts +4 -0
- package/tools.js +24 -1
- package/vscode/src/vs/platform/product/common/product.js +1 -1
- package/vscode/src/vs/platform/webWorker/browser/webWorkerServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.d.ts +63 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +305 -0
- package/vscode/src/vs/workbench/api/common/extHost.protocol.d.ts +2 -2
- package/vscode/src/vs/workbench/api/common/extHostLanguageModelTools.js +1 -2
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +1 -1
- package/vscode/src/vs/workbench/browser/media/code-icon.svg +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatConstants.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatConstants.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.js +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageBuffer.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageBuffer.js +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatService.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.service.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.service.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginSource.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatParserTypes.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolIds.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolIds.js +7 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/AISearch/aiSearchModel.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchModel.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchModelBase.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchTreeModel/folderMatch.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchTreeModel/searchTreeCommon.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +4 -3
- package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcomeInput.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcomeInput.js +72 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.js +96 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css +1148 -0
- package/vscode/src/vs/workbench/contrib/welcomeOnboarding/common/onboardingTypes.d.ts +81 -0
- package/vscode/src/vs/workbench/contrib/welcomeOnboarding/common/onboardingTypes.js +97 -0
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.d.ts +32 -0
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +45 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostEnablementService.d.ts +0 -7
- package/vscode/src/vs/platform/agentHost/common/agentHostEnablementService.js +0 -92
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.d.ts +0 -12
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +0 -64
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.d.ts +0 -262
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.js +0 -865
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.js +0 -311
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatVariables.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatVariables.js +0 -80
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +0 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +0 -231
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +0 -1850
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.d.ts +0 -109
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +0 -85
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.d.ts +0 -140
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.js +0 -186
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatDynamicVariablesConstant.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatDynamicVariablesConstant.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.d.ts +0 -46
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.js +0 -17
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.d.ts +0 -253
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +0 -20
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.d.ts +0 -34
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +0 -194
- package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.d.ts +0 -87
- package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.js +0 -69
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.d.ts +0 -300
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +0 -272
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +0 -178
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +0 -78
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +0 -51
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.d.ts +0 -67
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.js +0 -195
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +0 -67
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +0 -294
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +0 -212
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +0 -955
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.js +0 -122
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +0 -697
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/config.d.ts +0 -150
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/config.js +0 -142
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +0 -77
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +0 -77
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +0 -120
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +0 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.d.ts +0 -92
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.js +0 -335
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +0 -235
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +0 -1673
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +0 -202
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +0 -872
- package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.d.ts +0 -35
- package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.js +0 -289
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/askQuestionsTool.d.ts +0 -72
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/askQuestionsTool.js +0 -600
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.js +0 -239
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.js +0 -143
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +0 -298
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +0 -177
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.d.ts +0 -73
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +0 -577
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +0 -90
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.d.ts +0 -16
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +0 -130
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.js +0 -53
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.js +0 -12
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.js +0 -92
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +0 -518
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +0 -231
- package/vscode/src/vs/workbench/contrib/chat/common/tools/terminalToolIds.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/chat/common/tools/terminalToolIds.js +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +0 -283
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.d.ts +0 -91
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +0 -340
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +0 -272
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css +0 -686
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css +0 -348
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css +0 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css +0 -79
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css +0 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookChatEditController.css +0 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookChatEditorOverlay.css +0 -63
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css +0 -79
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css +0 -63
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css +0 -79
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css +0 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css +0 -102
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.js +0 -131
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookCellLayoutManager.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookCellLayoutManager.js +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.d.ts +0 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +0 -673
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +0 -37
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.d.ts +0 -354
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2926
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +0 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +0 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.d.ts +0 -200
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +0 -591
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.d.ts +0 -56
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.d.ts +0 -99
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +0 -131
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +0 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +0 -158
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +0 -183
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +0 -66
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.d.ts +0 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +0 -429
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +0 -108
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +0 -221
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +0 -142
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +0 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.d.ts +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +0 -762
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +0 -58
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +0 -357
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +0 -32
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.d.ts +0 -47
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +0 -260
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellWidgets.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellWidgets.js +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.d.ts +0 -182
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +0 -796
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +0 -79
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +0 -126
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +0 -32
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +0 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +0 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +0 -443
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +0 -56
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellEditorPool.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellEditorPool.js +0 -121
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.d.ts +0 -152
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +0 -1288
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.d.ts +0 -59
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +0 -287
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon.d.ts +0 -117
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.d.ts +0 -222
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +0 -1840
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.d.ts +0 -63
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +0 -449
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.d.ts +0 -432
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +0 -2546
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +0 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.d.ts +0 -137
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +0 -646
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +0 -101
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputTextHelper.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputTextHelper.js +0 -111
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +0 -65
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +0 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.d.ts +0 -89
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +0 -472
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +0 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.d.ts +0 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +0 -275
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.d.ts +0 -69
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +0 -269
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.d.ts +0 -125
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +0 -958
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +0 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookCellOverlays.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookCellOverlays.js +0 -101
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +0 -458
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.d.ts +0 -80
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +0 -708
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.d.ts +0 -37
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +0 -193
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookHorizontalTracker.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookHorizontalTracker.js +0 -62
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.d.ts +0 -108
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +0 -717
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +0 -183
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +0 -134
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +0 -135
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones.js +0 -213
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +0 -104
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.d.ts +0 -115
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +0 -480
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.d.ts +0 -87
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -352
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.d.ts +0 -81
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.js +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +0 -19
package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js
DELETED
|
@@ -1,1850 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
3
|
-
import { sep } from '../../../../../base/common/path.js';
|
|
4
|
-
import { AsyncIterableProducer, raceCancellationError, DeferredPromise } 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, isEqual } from '../../../../../base/common/resources.js';
|
|
12
|
-
import { ThemeIcon } from '../../../../../base/common/themables.js';
|
|
13
|
-
import { URI } from '../../../../../base/common/uri.js';
|
|
14
|
-
import { localize, localize2 } from '../../../../../nls.js';
|
|
15
|
-
import { MenuId, MenuItemAction, MenuRegistry, registerAction2, Action2 } from '../../../../../platform/actions/common/actions.js';
|
|
16
|
-
import { IMenuService } from '../../../../../platform/actions/common/actions.service.js';
|
|
17
|
-
import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
|
|
18
|
-
import { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.service.js';
|
|
19
|
-
import '../../../../../platform/instantiation/common/extensions.js';
|
|
20
|
-
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
|
|
21
|
-
import { ILabelService } from '../../../../../platform/label/common/label.service.js';
|
|
22
|
-
import { ILogService } from '../../../../../platform/log/common/log.service.js';
|
|
23
|
-
import { IProgressService } from '../../../../../platform/progress/common/progress.service.js';
|
|
24
|
-
import { Registry } from '../../../../../platform/registry/common/platform.js';
|
|
25
|
-
import { isDark } from '../../../../../platform/theme/common/theme.js';
|
|
26
|
-
import { IThemeService } from '../../../../../platform/theme/common/themeService.service.js';
|
|
27
|
-
import { IEditorService } from '../../../../services/editor/common/editorService.service.js';
|
|
28
|
-
import { isProposedApiEnabled } from '../../../../services/extensions/common/extensions.js';
|
|
29
|
-
import { IExtensionService } from '../../../../services/extensions/common/extensions.service.js';
|
|
30
|
-
import { ExtensionsRegistry } from '../../../../services/extensions/common/extensionsRegistry.js';
|
|
31
|
-
import { ChatEditorInput } from '../widgetHosts/editor/chatEditorInput.js';
|
|
32
|
-
import { IChatAgentService } from '../../common/participants/chatAgents.service.js';
|
|
33
|
-
import { ChatContextKeys } from '../../common/actions/chatContextKeys.js';
|
|
34
|
-
import { SessionType, ChatSessionsExtensions, isSessionInProgressStatus, localChatSessionType, ChatSessionOptionsMap, ChatSessionStatus } from '../../common/chatSessionsService.js';
|
|
35
|
-
import { IChatSessionsService } from '../../common/chatSessionsService.service.js';
|
|
36
|
-
import { ChatAgentLocation, ChatModeKind } from '../../common/constants.js';
|
|
37
|
-
import { CHAT_CATEGORY } from '../actions/chatActions.js';
|
|
38
|
-
import { ResponseModelState } from '../../common/chatService/chatService.js';
|
|
39
|
-
import { IChatService } from '../../common/chatService/chatService.service.js';
|
|
40
|
-
import '../../../../../base/common/observableInternal/index.js';
|
|
41
|
-
import { toPromptFileVariableEntry, PromptFileVariableKind } from '../../common/attachments/chatVariableEntries.js';
|
|
42
|
-
import { IViewsService } from '../../../../services/views/common/viewsService.service.js';
|
|
43
|
-
import { ChatViewId } from '../chat.js';
|
|
44
|
-
import { AgentSessionProviders, getAgentSessionProviderName, getAgentSessionProvider } from '../agentSessions/agentSessions.js';
|
|
45
|
-
import { IAgentHostImportConversationStore } from '../agentSessions/agentHost/agentHostImportConversationStore.service.js';
|
|
46
|
-
import { isCancellationError, BugIndicatingError } from '../../../../../base/common/errors.js';
|
|
47
|
-
import { IEditorGroupsService } from '../../../../services/editor/common/editorGroupsService.service.js';
|
|
48
|
-
import { getChatSessionType, isUntitledChatSession, LocalChatSessionUri } from '../../common/model/chatUri.js';
|
|
49
|
-
import { assertNever } from '../../../../../base/common/assert.js';
|
|
50
|
-
import { ICommandService } from '../../../../../platform/commands/common/commands.service.js';
|
|
51
|
-
import { Target } from '../../common/promptSyntax/promptTypes.js';
|
|
52
|
-
import { slashReg } from '../../common/requestParser/chatRequestParser.js';
|
|
53
|
-
import { OffsetRange } from '../../../../../editor/common/core/ranges/offsetRange.js';
|
|
54
|
-
import { ILanguageModelToolsService } from '../../common/tools/languageModelToolsService.service.js';
|
|
55
|
-
import { ICustomizationHarnessService } from '../../common/customizationHarnessService.service.js';
|
|
56
|
-
import { generateUuid } from '../../../../../base/common/uuid.js';
|
|
57
|
-
import { AGENT_HOST_ENABLED_CONTEXT_KEY } from '../../../../../platform/agentHost/common/agentHostEnablementService.js';
|
|
58
|
-
import { AgentHostCodexAgentEnabledSettingId, CodexPreferAgentHostEditorSettingId } from '../../../../../platform/agentHost/common/agentService.js';
|
|
59
|
-
import { IsSessionsWindowContext } from '../../../../common/contextkeys.js';
|
|
60
|
-
import { observableFromEvent } from '../../../../../base/common/observableInternal/observables/observableFromEvent.js';
|
|
61
|
-
import { autorun } from '../../../../../base/common/observableInternal/reactions/autorun.js';
|
|
62
|
-
|
|
63
|
-
const extensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
64
|
-
extensionPoint: "chatSessions",
|
|
65
|
-
jsonSchema: {
|
|
66
|
-
description: ( localize(8542, "Contributes chat session integrations to the chat widget.")),
|
|
67
|
-
type: "array",
|
|
68
|
-
items: {
|
|
69
|
-
type: "object",
|
|
70
|
-
additionalProperties: false,
|
|
71
|
-
properties: {
|
|
72
|
-
type: {
|
|
73
|
-
description: ( localize(8543, "Unique identifier for the type of chat session.")),
|
|
74
|
-
type: "string"
|
|
75
|
-
},
|
|
76
|
-
name: {
|
|
77
|
-
description: ( localize(
|
|
78
|
-
8544,
|
|
79
|
-
"Name of the dynamically registered chat participant (eg: @agent). Must not contain whitespace."
|
|
80
|
-
)),
|
|
81
|
-
type: "string",
|
|
82
|
-
pattern: "^[\\w-]+$"
|
|
83
|
-
},
|
|
84
|
-
displayName: {
|
|
85
|
-
description: ( localize(8545, "A longer name for this item which is used for display in menus.")),
|
|
86
|
-
type: "string"
|
|
87
|
-
},
|
|
88
|
-
description: {
|
|
89
|
-
description: ( localize(8546, "Description of the chat session for use in menus and tooltips.")),
|
|
90
|
-
type: "string"
|
|
91
|
-
},
|
|
92
|
-
when: {
|
|
93
|
-
description: ( localize(8547, "Condition which must be true to show this item.")),
|
|
94
|
-
type: "string"
|
|
95
|
-
},
|
|
96
|
-
icon: {
|
|
97
|
-
description: ( localize(
|
|
98
|
-
8548,
|
|
99
|
-
"Icon identifier (codicon ID) for the chat session editor tab. For example, \"{0}\" or \"{1}\".",
|
|
100
|
-
"$(github)",
|
|
101
|
-
"$(cloud)"
|
|
102
|
-
)),
|
|
103
|
-
anyOf: [{
|
|
104
|
-
type: "string"
|
|
105
|
-
}, {
|
|
106
|
-
type: "object",
|
|
107
|
-
properties: {
|
|
108
|
-
light: {
|
|
109
|
-
description: ( localize(8549, "Icon path when a light theme is used")),
|
|
110
|
-
type: "string"
|
|
111
|
-
},
|
|
112
|
-
dark: {
|
|
113
|
-
description: ( localize(8550, "Icon path when a dark theme is used")),
|
|
114
|
-
type: "string"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}]
|
|
118
|
-
},
|
|
119
|
-
order: {
|
|
120
|
-
description: ( localize(8551, "Order in which this item should be displayed.")),
|
|
121
|
-
type: "integer"
|
|
122
|
-
},
|
|
123
|
-
alternativeIds: {
|
|
124
|
-
description: ( localize(8552, "Alternative identifiers for backward compatibility.")),
|
|
125
|
-
type: "array",
|
|
126
|
-
items: {
|
|
127
|
-
type: "string"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
welcomeTitle: {
|
|
131
|
-
description: ( localize(
|
|
132
|
-
8553,
|
|
133
|
-
"Title text to display in the chat welcome view for this session type."
|
|
134
|
-
)),
|
|
135
|
-
type: "string"
|
|
136
|
-
},
|
|
137
|
-
welcomeMessage: {
|
|
138
|
-
description: ( localize(
|
|
139
|
-
8554,
|
|
140
|
-
"Message text (supports markdown) to display in the chat welcome view for this session type."
|
|
141
|
-
)),
|
|
142
|
-
type: "string"
|
|
143
|
-
},
|
|
144
|
-
welcomeTips: {
|
|
145
|
-
description: ( localize(
|
|
146
|
-
8555,
|
|
147
|
-
"Tips text (supports markdown and theme icons) to display in the chat welcome view for this session type."
|
|
148
|
-
)),
|
|
149
|
-
type: "string"
|
|
150
|
-
},
|
|
151
|
-
inputPlaceholder: {
|
|
152
|
-
description: ( localize(
|
|
153
|
-
8556,
|
|
154
|
-
"Placeholder text to display in the chat input box for this session type."
|
|
155
|
-
)),
|
|
156
|
-
type: "string"
|
|
157
|
-
},
|
|
158
|
-
capabilities: {
|
|
159
|
-
description: ( localize(8557, "Optional capabilities for this chat session.")),
|
|
160
|
-
type: "object",
|
|
161
|
-
additionalProperties: false,
|
|
162
|
-
properties: {
|
|
163
|
-
supportsFileAttachments: {
|
|
164
|
-
description: ( localize(
|
|
165
|
-
8558,
|
|
166
|
-
"Whether this chat session supports attaching files or file references."
|
|
167
|
-
)),
|
|
168
|
-
type: "boolean"
|
|
169
|
-
},
|
|
170
|
-
supportsToolAttachments: {
|
|
171
|
-
description: ( localize(
|
|
172
|
-
8559,
|
|
173
|
-
"Whether this chat session supports attaching tools or tool references."
|
|
174
|
-
)),
|
|
175
|
-
type: "boolean"
|
|
176
|
-
},
|
|
177
|
-
supportsMCPAttachments: {
|
|
178
|
-
description: ( localize(8560, "Whether this chat session supports attaching MCP resources.")),
|
|
179
|
-
type: "boolean"
|
|
180
|
-
},
|
|
181
|
-
supportsImageAttachments: {
|
|
182
|
-
description: ( localize(8561, "Whether this chat session supports attaching images.")),
|
|
183
|
-
type: "boolean"
|
|
184
|
-
},
|
|
185
|
-
supportsSearchResultAttachments: {
|
|
186
|
-
description: ( localize(8562, "Whether this chat session supports attaching search results.")),
|
|
187
|
-
type: "boolean"
|
|
188
|
-
},
|
|
189
|
-
supportsInstructionAttachments: {
|
|
190
|
-
description: ( localize(8563, "Whether this chat session supports attaching instructions.")),
|
|
191
|
-
type: "boolean"
|
|
192
|
-
},
|
|
193
|
-
supportsSourceControlAttachments: {
|
|
194
|
-
description: ( localize(
|
|
195
|
-
8564,
|
|
196
|
-
"Whether this chat session supports attaching source control changes."
|
|
197
|
-
)),
|
|
198
|
-
type: "boolean"
|
|
199
|
-
},
|
|
200
|
-
supportsProblemAttachments: {
|
|
201
|
-
description: ( localize(8565, "Whether this chat session supports attaching problems.")),
|
|
202
|
-
type: "boolean"
|
|
203
|
-
},
|
|
204
|
-
supportsSymbolAttachments: {
|
|
205
|
-
description: ( localize(8566, "Whether this chat session supports attaching symbols.")),
|
|
206
|
-
type: "boolean"
|
|
207
|
-
},
|
|
208
|
-
supportsPromptAttachments: {
|
|
209
|
-
description: ( localize(8567, "Whether this chat session supports attaching prompts.")),
|
|
210
|
-
type: "boolean"
|
|
211
|
-
},
|
|
212
|
-
supportsHandOffs: {
|
|
213
|
-
description: ( localize(8568, "Whether this chat session supports hand-off prompts.")),
|
|
214
|
-
type: "boolean"
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
commands: {
|
|
219
|
-
markdownDescription: ( localize(
|
|
220
|
-
8569,
|
|
221
|
-
"Commands available for this chat session, which the user can invoke with a `/`."
|
|
222
|
-
)),
|
|
223
|
-
type: "array",
|
|
224
|
-
items: {
|
|
225
|
-
additionalProperties: false,
|
|
226
|
-
type: "object",
|
|
227
|
-
defaultSnippets: [{
|
|
228
|
-
body: {
|
|
229
|
-
name: "",
|
|
230
|
-
description: ""
|
|
231
|
-
}
|
|
232
|
-
}],
|
|
233
|
-
required: ["name"],
|
|
234
|
-
properties: {
|
|
235
|
-
name: {
|
|
236
|
-
description: ( localize(
|
|
237
|
-
8570,
|
|
238
|
-
"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."
|
|
239
|
-
)),
|
|
240
|
-
type: "string"
|
|
241
|
-
},
|
|
242
|
-
description: {
|
|
243
|
-
description: ( localize(8571, "A description of this command.")),
|
|
244
|
-
type: "string"
|
|
245
|
-
},
|
|
246
|
-
when: {
|
|
247
|
-
description: ( localize(8572, "A condition which must be true to enable this command.")),
|
|
248
|
-
type: "string"
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
canDelegate: {
|
|
254
|
-
description: ( localize(
|
|
255
|
-
8573,
|
|
256
|
-
"Whether delegation is supported. Default is false. Note that enabling this is experimental and may not be respected at all times."
|
|
257
|
-
)),
|
|
258
|
-
type: "boolean",
|
|
259
|
-
default: false
|
|
260
|
-
},
|
|
261
|
-
customAgentTarget: {
|
|
262
|
-
description: ( localize(
|
|
263
|
-
8574,
|
|
264
|
-
"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."
|
|
265
|
-
)),
|
|
266
|
-
type: "string"
|
|
267
|
-
},
|
|
268
|
-
requiresCustomModels: {
|
|
269
|
-
description: ( localize(
|
|
270
|
-
8575,
|
|
271
|
-
"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."
|
|
272
|
-
)),
|
|
273
|
-
type: "boolean",
|
|
274
|
-
default: false
|
|
275
|
-
},
|
|
276
|
-
supportsAutoModel: {
|
|
277
|
-
description: ( localize(
|
|
278
|
-
8576,
|
|
279
|
-
"Whether the chat session supports the synthetic \"Auto\" model fallback. Defaults to false. When true and no models are available, the picker shows \"Auto\" instead of a \"No models available\" state."
|
|
280
|
-
)),
|
|
281
|
-
type: "boolean",
|
|
282
|
-
default: false
|
|
283
|
-
},
|
|
284
|
-
requiresCopilotSignIn: {
|
|
285
|
-
description: ( localize(
|
|
286
|
-
8577,
|
|
287
|
-
"Whether the chat session relies on a GitHub Copilot account and so cannot be used until the user signs in. Defaults to false."
|
|
288
|
-
)),
|
|
289
|
-
type: "boolean",
|
|
290
|
-
default: false
|
|
291
|
-
},
|
|
292
|
-
autoAttachReferences: {
|
|
293
|
-
description: ( localize(
|
|
294
|
-
8578,
|
|
295
|
-
"Whether to automatically attach instruction files to chat requests for this session type."
|
|
296
|
-
)),
|
|
297
|
-
type: "boolean",
|
|
298
|
-
default: false
|
|
299
|
-
},
|
|
300
|
-
useRequestToPopulateBuiltInPickers: {
|
|
301
|
-
description: ( localize(
|
|
302
|
-
8579,
|
|
303
|
-
"Whether to use ChatRequestTurn2 to populate built-in pickers such as the Agent and Model pickers."
|
|
304
|
-
)),
|
|
305
|
-
type: "boolean",
|
|
306
|
-
default: false
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
required: ["type", "name", "displayName", "description"]
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
activationEventsGenerator: function*(contribs) {
|
|
313
|
-
for (const contrib of contribs) {
|
|
314
|
-
yield `onChatSession:${contrib.type}`;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
const codexExtensionHostAvailableWhen = ( ContextKeyExpr.and(( IsSessionsWindowContext.negate()), ( ContextKeyExpr.or(( AGENT_HOST_ENABLED_CONTEXT_KEY.negate()), ContextKeyExpr.not(`config.${AgentHostCodexAgentEnabledSettingId}`), ContextKeyExpr.not(`config.${CodexPreferAgentHostEditorSettingId}`)))));
|
|
319
|
-
function applyCodexAgentHostPreference(contribution) {
|
|
320
|
-
if (contribution.type !== SessionType.Codex) {
|
|
321
|
-
return contribution;
|
|
322
|
-
}
|
|
323
|
-
const contributedWhen = contribution.when ? ContextKeyExpr.deserialize(contribution.when) : undefined;
|
|
324
|
-
return {
|
|
325
|
-
...contribution,
|
|
326
|
-
when: ( ContextKeyExpr.and(contributedWhen, codexExtensionHostAvailableWhen))?.serialize()
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
class ContributedChatSessionData extends Disposable {
|
|
330
|
-
getOption(optionId) {
|
|
331
|
-
return this._optionsCache.get(optionId);
|
|
332
|
-
}
|
|
333
|
-
getAllOptions() {
|
|
334
|
-
return this._optionsCache.entries();
|
|
335
|
-
}
|
|
336
|
-
setOption(optionId, value) {
|
|
337
|
-
this._optionsCache.set(optionId, value);
|
|
338
|
-
}
|
|
339
|
-
constructor(session, chatSessionType, resource, options, onWillDispose) {
|
|
340
|
-
super();
|
|
341
|
-
this.session = session;
|
|
342
|
-
this.chatSessionType = chatSessionType;
|
|
343
|
-
this.resource = resource;
|
|
344
|
-
this.options = options;
|
|
345
|
-
this.onWillDispose = onWillDispose;
|
|
346
|
-
this._optionsCache = ( new Map(options));
|
|
347
|
-
this._register(this.session.onWillDispose(() => {
|
|
348
|
-
this.onWillDispose(this.resource);
|
|
349
|
-
}));
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
let ChatSessionsService = class ChatSessionsService extends Disposable {
|
|
353
|
-
get onDidChangeInProgress() {
|
|
354
|
-
return this._onDidChangeInProgress.event;
|
|
355
|
-
}
|
|
356
|
-
get onDidChangeContentProviderSchemes() {
|
|
357
|
-
return this._onDidChangeContentProviderSchemes.event;
|
|
358
|
-
}
|
|
359
|
-
get onDidChangeSessionOptions() {
|
|
360
|
-
return this._onDidChangeSessionOptions.event;
|
|
361
|
-
}
|
|
362
|
-
get onDidChangeOptionGroups() {
|
|
363
|
-
return this._onDidChangeOptionGroups.event;
|
|
364
|
-
}
|
|
365
|
-
constructor(
|
|
366
|
-
_logService,
|
|
367
|
-
_chatAgentService,
|
|
368
|
-
_extensionService,
|
|
369
|
-
_contextKeyService,
|
|
370
|
-
_menuService,
|
|
371
|
-
_themeService,
|
|
372
|
-
_labelService,
|
|
373
|
-
_instantiationService
|
|
374
|
-
) {
|
|
375
|
-
super();
|
|
376
|
-
this._logService = _logService;
|
|
377
|
-
this._chatAgentService = _chatAgentService;
|
|
378
|
-
this._extensionService = _extensionService;
|
|
379
|
-
this._contextKeyService = _contextKeyService;
|
|
380
|
-
this._menuService = _menuService;
|
|
381
|
-
this._themeService = _themeService;
|
|
382
|
-
this._labelService = _labelService;
|
|
383
|
-
this._instantiationService = _instantiationService;
|
|
384
|
-
this._itemControllers = ( new Map());
|
|
385
|
-
this._asyncActivationRegistry = ( Registry.as(ChatSessionsExtensions.AsyncActivation));
|
|
386
|
-
this._contributions = ( new Map());
|
|
387
|
-
this._contributionDisposables = this._register(( new DisposableMap()));
|
|
388
|
-
this._contentProviders = ( new Map());
|
|
389
|
-
this._alternativeIdMap = ( new Map());
|
|
390
|
-
this._contextKeys = ( new Set());
|
|
391
|
-
this._onDidChangeItemsProviders = this._register(( new Emitter()));
|
|
392
|
-
this.onDidChangeItemsProviders = this._onDidChangeItemsProviders.event;
|
|
393
|
-
this._onDidChangeSessionItems = this._register(( new Emitter()));
|
|
394
|
-
this.onDidChangeSessionItems = this._onDidChangeSessionItems.event;
|
|
395
|
-
this._onDidCommitSession = this._register(( new Emitter()));
|
|
396
|
-
this.onDidCommitSession = this._onDidCommitSession.event;
|
|
397
|
-
this._onDidChangeAvailability = this._register(( new Emitter()));
|
|
398
|
-
this.onDidChangeAvailability = this._onDidChangeAvailability.event;
|
|
399
|
-
this._onDidChangeInProgress = this._register(( new Emitter()));
|
|
400
|
-
this._onDidChangeContentProviderSchemes = this._register(( new Emitter()));
|
|
401
|
-
this._onDidChangeSessionOptions = this._register(( new Emitter()));
|
|
402
|
-
this._onDidChangeOptionGroups = this._register(( new Emitter()));
|
|
403
|
-
this.inProgressMap = ( new Map());
|
|
404
|
-
this._sessionTypeOptions = ( new Map());
|
|
405
|
-
this._sessions = ( new ResourceMap());
|
|
406
|
-
this._resourceAliases = ( new ResourceMap());
|
|
407
|
-
this._realResources = ( new ResourceMap());
|
|
408
|
-
this._pendingSessionResolutions = ( new Map());
|
|
409
|
-
this._customizationsProviders = ( new Map());
|
|
410
|
-
this._onDidChangeCustomizations = this._register(( new Emitter()));
|
|
411
|
-
this.onDidChangeCustomizations = this._onDidChangeCustomizations.event;
|
|
412
|
-
this._hasCanDelegateProvidersKey = ChatContextKeys.hasCanDelegateProviders.bindTo(this._contextKeyService);
|
|
413
|
-
this._register(extensionPoint.setHandler(extensions => {
|
|
414
|
-
for (const ext of extensions) {
|
|
415
|
-
if (!isProposedApiEnabled(ext.description, "chatSessionsProvider")) {
|
|
416
|
-
continue;
|
|
417
|
-
}
|
|
418
|
-
if (!Array.isArray(ext.value)) {
|
|
419
|
-
continue;
|
|
420
|
-
}
|
|
421
|
-
for (const contribution of ext.value) {
|
|
422
|
-
this._register(this.registerContribution(contribution, ext.description));
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}));
|
|
426
|
-
this._register(Event.filter(
|
|
427
|
-
this._contextKeyService.onDidChangeContext,
|
|
428
|
-
e => e.affectsSome(this._contextKeys)
|
|
429
|
-
)(() => {
|
|
430
|
-
this._evaluateAvailability();
|
|
431
|
-
}));
|
|
432
|
-
const builtinSessionProviders = [AgentSessionProviders.Local];
|
|
433
|
-
const contributedSessionProviders = observableFromEvent(this.onDidChangeAvailability, () => Array.from(( this._contributions.keys())).filter(key => ( this._contributionDisposables.has(key)))).recomputeInitiallyAndOnChange(this._store);
|
|
434
|
-
this._register(autorun(reader => {
|
|
435
|
-
const activatedProviders = contributedSessionProviders.read(reader);
|
|
436
|
-
for (const provider of builtinSessionProviders) {
|
|
437
|
-
reader.store.add(
|
|
438
|
-
registerNewSessionInPlaceAction(provider, getAgentSessionProviderName(provider))
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
for (const type of activatedProviders) {
|
|
442
|
-
const knownProvider = getAgentSessionProvider(type);
|
|
443
|
-
if (knownProvider) {
|
|
444
|
-
const label = getAgentSessionProviderName(knownProvider);
|
|
445
|
-
reader.store.add(registerNewSessionInPlaceAction(type, label));
|
|
446
|
-
} else {
|
|
447
|
-
const contrib = this._contributions.get(type);
|
|
448
|
-
if (contrib) {
|
|
449
|
-
reader.store.add(registerNewSessionInPlaceAction(
|
|
450
|
-
type,
|
|
451
|
-
contrib.contribution.displayName ?? contrib.contribution.name ?? type
|
|
452
|
-
));
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}));
|
|
457
|
-
this._register(this._labelService.registerFormatter({
|
|
458
|
-
scheme: Schemas.copilotPr,
|
|
459
|
-
formatting: {
|
|
460
|
-
label: "${authority}${path}",
|
|
461
|
-
separator: sep,
|
|
462
|
-
stripPathStartingSeparator: true
|
|
463
|
-
}
|
|
464
|
-
}));
|
|
465
|
-
}
|
|
466
|
-
reportInProgress(chatSessionType, count) {
|
|
467
|
-
if (!( this._itemControllers.has(chatSessionType))) {
|
|
468
|
-
this._logService.warn(
|
|
469
|
-
`Attempted to report in-progress status for unknown chat session type '${chatSessionType}'`
|
|
470
|
-
);
|
|
471
|
-
}
|
|
472
|
-
this.inProgressMap.set(chatSessionType, count);
|
|
473
|
-
this._onDidChangeInProgress.fire();
|
|
474
|
-
}
|
|
475
|
-
getInProgress() {
|
|
476
|
-
return ( Array.from(this.inProgressMap.entries()).map(([chatSessionType, count]) => ({
|
|
477
|
-
chatSessionType,
|
|
478
|
-
count
|
|
479
|
-
})));
|
|
480
|
-
}
|
|
481
|
-
async resolveChatSessionItem(chatSessionType, resource, token) {
|
|
482
|
-
const entry = this._itemControllers.get(chatSessionType);
|
|
483
|
-
if (!entry?.controller.resolveChatSessionItem) {
|
|
484
|
-
return undefined;
|
|
485
|
-
}
|
|
486
|
-
return entry.controller.resolveChatSessionItem(resource, token);
|
|
487
|
-
}
|
|
488
|
-
canSetChatSessionItemArchived(sessionResource) {
|
|
489
|
-
return typeof this._getChatSessionItemController(sessionResource)?.controller.setChatSessionItemArchived === "function";
|
|
490
|
-
}
|
|
491
|
-
setChatSessionItemArchived(sessionResource, archived) {
|
|
492
|
-
const controller = this._getChatSessionItemController(sessionResource)?.controller;
|
|
493
|
-
if (!controller?.setChatSessionItemArchived) {
|
|
494
|
-
throw ( new Error(`Session ${( sessionResource.toString())} does not support archiving`));
|
|
495
|
-
}
|
|
496
|
-
controller.setChatSessionItemArchived(sessionResource, archived);
|
|
497
|
-
}
|
|
498
|
-
canSetChatSessionItemRead(sessionResource) {
|
|
499
|
-
return typeof this._getChatSessionItemController(sessionResource)?.controller.setChatSessionItemRead === "function";
|
|
500
|
-
}
|
|
501
|
-
setChatSessionItemRead(sessionResource, isRead) {
|
|
502
|
-
const controller = this._getChatSessionItemController(sessionResource)?.controller;
|
|
503
|
-
if (!controller?.setChatSessionItemRead) {
|
|
504
|
-
throw ( new Error(`Session ${( sessionResource.toString())} does not own read state`));
|
|
505
|
-
}
|
|
506
|
-
controller.setChatSessionItemRead(sessionResource, isRead);
|
|
507
|
-
}
|
|
508
|
-
async updateInProgressStatus(chatSessionType) {
|
|
509
|
-
const controller = this._itemControllers.get(chatSessionType)?.controller;
|
|
510
|
-
if (!controller) {
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
try {
|
|
514
|
-
const items = [];
|
|
515
|
-
for await (const result of this.getChatSessionItems([chatSessionType], CancellationToken.None)) {
|
|
516
|
-
items.push(...result.items);
|
|
517
|
-
}
|
|
518
|
-
if (this._itemControllers.get(chatSessionType)?.controller !== controller) {
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
const inProgress = items.filter(
|
|
522
|
-
item => !item.archived && item.status && isSessionInProgressStatus(item.status)
|
|
523
|
-
);
|
|
524
|
-
this.reportInProgress(chatSessionType, inProgress.length);
|
|
525
|
-
} catch (error) {
|
|
526
|
-
this._logService.warn(
|
|
527
|
-
`Failed to update in-progress status for chat session type '${chatSessionType}':`,
|
|
528
|
-
error
|
|
529
|
-
);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
registerContribution(contribution, ext) {
|
|
533
|
-
contribution = applyCodexAgentHostPreference(contribution);
|
|
534
|
-
this._logService.trace(
|
|
535
|
-
`[ChatSessionsService] registerContribution called for type='${contribution.type}', canDelegate=${contribution.canDelegate}, when='${contribution.when}', extension='${ext.identifier.value}'`
|
|
536
|
-
);
|
|
537
|
-
if (( this._contributions.has(contribution.type))) {
|
|
538
|
-
this._logService.trace(
|
|
539
|
-
`[ChatSessionsService] registerContribution: type='${contribution.type}' already registered, skipping`
|
|
540
|
-
);
|
|
541
|
-
return Disposable.None;
|
|
542
|
-
}
|
|
543
|
-
if (contribution.when) {
|
|
544
|
-
const whenExpr = ContextKeyExpr.deserialize(contribution.when);
|
|
545
|
-
if (whenExpr) {
|
|
546
|
-
for (const key of ( whenExpr.keys())) {
|
|
547
|
-
this._contextKeys.add(key);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
this._contributions.set(contribution.type, {
|
|
552
|
-
contribution,
|
|
553
|
-
extension: ext
|
|
554
|
-
});
|
|
555
|
-
if (contribution.alternativeIds) {
|
|
556
|
-
for (const altId of contribution.alternativeIds) {
|
|
557
|
-
if (( this._alternativeIdMap.has(altId))) {
|
|
558
|
-
this._logService.warn(
|
|
559
|
-
`Alternative ID '${altId}' is already mapped to '${this._alternativeIdMap.get(altId)}'. Remapping to '${contribution.type}'.`
|
|
560
|
-
);
|
|
561
|
-
}
|
|
562
|
-
this._alternativeIdMap.set(altId, contribution.type);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
this._evaluateAvailability();
|
|
566
|
-
return {
|
|
567
|
-
dispose: () => {
|
|
568
|
-
this._contributions.delete(contribution.type);
|
|
569
|
-
if (contribution.alternativeIds) {
|
|
570
|
-
for (const altId of contribution.alternativeIds) {
|
|
571
|
-
if (this._alternativeIdMap.get(altId) === contribution.type) {
|
|
572
|
-
this._alternativeIdMap.delete(altId);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
577
|
-
this._updateHasCanDelegateProvidersContextKey();
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
_isContributionAvailable(contribution) {
|
|
582
|
-
if (!contribution.when) {
|
|
583
|
-
return true;
|
|
584
|
-
}
|
|
585
|
-
const whenExpr = ContextKeyExpr.deserialize(contribution.when);
|
|
586
|
-
return !whenExpr || this._contextKeyService.contextMatchesRules(whenExpr);
|
|
587
|
-
}
|
|
588
|
-
_isContributionAvailableForType(sessionType) {
|
|
589
|
-
const primaryType = ( this._contributions.has(sessionType)) ? sessionType : this._alternativeIdMap.get(sessionType);
|
|
590
|
-
const contribution = primaryType ? this._contributions.get(primaryType)?.contribution : undefined;
|
|
591
|
-
return !contribution || this._isContributionAvailable(contribution);
|
|
592
|
-
}
|
|
593
|
-
_resolveToPrimaryType(sessionType) {
|
|
594
|
-
const contribution = this._contributions.get(sessionType)?.contribution;
|
|
595
|
-
if (contribution) {
|
|
596
|
-
if (this._isContributionAvailable(contribution)) {
|
|
597
|
-
return sessionType;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
const primaryType = this._alternativeIdMap.get(sessionType);
|
|
601
|
-
if (primaryType) {
|
|
602
|
-
const altContribution = this._contributions.get(primaryType)?.contribution;
|
|
603
|
-
if (altContribution && this._isContributionAvailable(altContribution)) {
|
|
604
|
-
return primaryType;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
return undefined;
|
|
608
|
-
}
|
|
609
|
-
_registerMenuItems(contribution, extensionDescription) {
|
|
610
|
-
const disposables = ( new DisposableStore());
|
|
611
|
-
if (!contribution.canDelegate) {
|
|
612
|
-
disposables.add(registerNewSessionExternalAction(
|
|
613
|
-
contribution.type,
|
|
614
|
-
contribution.displayName,
|
|
615
|
-
() => this._resolveCreateSubMenuCommandId(contribution.type)
|
|
616
|
-
));
|
|
617
|
-
}
|
|
618
|
-
const contextKeyService = this._contextKeyService.createOverlay([["chatSessionType", contribution.type]]);
|
|
619
|
-
const rawMenuActions = this._menuService.getMenuActions(MenuId.AgentSessionsCreateSubMenu, contextKeyService);
|
|
620
|
-
const menuActions = ( rawMenuActions.map(value => value[1])).flat();
|
|
621
|
-
const menuItemActions = menuActions.filter(action => action instanceof MenuItemAction);
|
|
622
|
-
const actionsToMirror = contribution.canDelegate ? menuItemActions : menuItemActions.slice(1);
|
|
623
|
-
for (const action of actionsToMirror) {
|
|
624
|
-
disposables.add(MenuRegistry.appendMenuItem(MenuId.ChatNewMenu, {
|
|
625
|
-
command: action.item,
|
|
626
|
-
group: "4_externally_contributed"
|
|
627
|
-
}));
|
|
628
|
-
}
|
|
629
|
-
return {
|
|
630
|
-
dispose: () => disposables.dispose()
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
_resolveCreateSubMenuCommandId(type) {
|
|
634
|
-
const contextKeyService = this._contextKeyService.createOverlay([["chatSessionType", type]]);
|
|
635
|
-
const rawMenuActions = this._menuService.getMenuActions(MenuId.AgentSessionsCreateSubMenu, contextKeyService);
|
|
636
|
-
const menuActions = ( rawMenuActions.map(value => value[1])).flat();
|
|
637
|
-
for (const action of menuActions) {
|
|
638
|
-
if (action instanceof MenuItemAction) {
|
|
639
|
-
return action.item.id;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
return undefined;
|
|
643
|
-
}
|
|
644
|
-
_registerCommands(contribution) {
|
|
645
|
-
const isAvailableInSessionTypePicker = isAgentSessionProviderType(contribution.type);
|
|
646
|
-
return combinedDisposable(registerAction2(class OpenChatSessionAction extends Action2 {
|
|
647
|
-
constructor() {
|
|
648
|
-
super({
|
|
649
|
-
id: `workbench.action.chat.openSessionWithPrompt.${contribution.type}`,
|
|
650
|
-
title: ( localize2(8580, "New {0} with Prompt", contribution.displayName)),
|
|
651
|
-
category: CHAT_CATEGORY,
|
|
652
|
-
icon: Codicon.plus,
|
|
653
|
-
f1: false,
|
|
654
|
-
precondition: ChatContextKeys.enabled
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
async run(accessor, chatOptions) {
|
|
658
|
-
const chatService = accessor.get(IChatService);
|
|
659
|
-
const customizationHarnessService = accessor.get(ICustomizationHarnessService);
|
|
660
|
-
const toolsService = accessor.get(ILanguageModelToolsService);
|
|
661
|
-
const {
|
|
662
|
-
type
|
|
663
|
-
} = contribution;
|
|
664
|
-
if (chatOptions) {
|
|
665
|
-
let attachedContext = chatOptions.attachedContext;
|
|
666
|
-
const sessionResource = URI.revive(chatOptions.resource);
|
|
667
|
-
const ref = await chatService.acquireOrLoadSession(
|
|
668
|
-
sessionResource,
|
|
669
|
-
ChatAgentLocation.Chat,
|
|
670
|
-
CancellationToken.None,
|
|
671
|
-
"ChatSessionsContribution#sendPrompt"
|
|
672
|
-
);
|
|
673
|
-
try {
|
|
674
|
-
const promptFile = await resolvePromptSlashCommand(
|
|
675
|
-
chatOptions.prompt,
|
|
676
|
-
sessionResource,
|
|
677
|
-
customizationHarnessService,
|
|
678
|
-
toolsService
|
|
679
|
-
);
|
|
680
|
-
if (promptFile) {
|
|
681
|
-
attachedContext = [promptFile, ...(attachedContext ?? [])];
|
|
682
|
-
}
|
|
683
|
-
const result = await chatService.sendRequest(sessionResource, chatOptions.prompt, {
|
|
684
|
-
agentIdSilent: type,
|
|
685
|
-
attachedContext
|
|
686
|
-
});
|
|
687
|
-
if (result.kind === "queued") {
|
|
688
|
-
await result.deferred;
|
|
689
|
-
} else if (result.kind === "sent") {
|
|
690
|
-
await result.data.responseCompletePromise;
|
|
691
|
-
}
|
|
692
|
-
} finally {
|
|
693
|
-
ref?.dispose();
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}),
|
|
698
|
-
registerAction2(class OpenNewChatSessionEditorAction extends Action2 {
|
|
699
|
-
constructor() {
|
|
700
|
-
super({
|
|
701
|
-
id: `workbench.action.chat.openNewSessionEditor.${contribution.type}`,
|
|
702
|
-
title: ( localize2(8581, "New {0} Session", contribution.displayName)),
|
|
703
|
-
category: CHAT_CATEGORY,
|
|
704
|
-
icon: Codicon.plus,
|
|
705
|
-
f1: true,
|
|
706
|
-
precondition: ChatContextKeys.enabled
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
async run(accessor, chatOptions) {
|
|
710
|
-
const {
|
|
711
|
-
type,
|
|
712
|
-
displayName
|
|
713
|
-
} = contribution;
|
|
714
|
-
await openChatSession(accessor, {
|
|
715
|
-
type,
|
|
716
|
-
displayName,
|
|
717
|
-
position: ChatSessionPosition.Editor
|
|
718
|
-
}, chatOptions);
|
|
719
|
-
}
|
|
720
|
-
}),
|
|
721
|
-
registerAction2(class OpenNewChatSessionSidebarAction extends Action2 {
|
|
722
|
-
constructor() {
|
|
723
|
-
super({
|
|
724
|
-
id: `workbench.action.chat.openNewSessionSidebar.${contribution.type}`,
|
|
725
|
-
title: ( localize2(8582, "New {0} Session", contribution.displayName)),
|
|
726
|
-
category: CHAT_CATEGORY,
|
|
727
|
-
icon: Codicon.plus,
|
|
728
|
-
f1: false,
|
|
729
|
-
precondition: ChatContextKeys.enabled,
|
|
730
|
-
menu: !isAvailableInSessionTypePicker ? {
|
|
731
|
-
id: MenuId.ChatNewMenu,
|
|
732
|
-
group: "3_new_special"
|
|
733
|
-
} : undefined
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
async run(accessor, chatOptions) {
|
|
737
|
-
const {
|
|
738
|
-
type,
|
|
739
|
-
displayName
|
|
740
|
-
} = contribution;
|
|
741
|
-
await openChatSession(accessor, {
|
|
742
|
-
type,
|
|
743
|
-
displayName,
|
|
744
|
-
position: ChatSessionPosition.Sidebar
|
|
745
|
-
}, chatOptions);
|
|
746
|
-
}
|
|
747
|
-
}));
|
|
748
|
-
}
|
|
749
|
-
_evaluateAvailability() {
|
|
750
|
-
const newlyEnabledChatSessionTypes = ( new Set());
|
|
751
|
-
const newlyDisabledChatSessionTypes = ( new Set());
|
|
752
|
-
const disposedChatSessions = ( new ResourceSet());
|
|
753
|
-
for (const {
|
|
754
|
-
contribution,
|
|
755
|
-
extension
|
|
756
|
-
} of ( this._contributions.values())) {
|
|
757
|
-
const isCurrentlyRegistered = ( this._contributionDisposables.has(contribution.type));
|
|
758
|
-
const shouldBeRegistered = this._isContributionAvailable(contribution);
|
|
759
|
-
this._logService.trace(
|
|
760
|
-
`[ChatSessionsService] _evaluateAvailability: type='${contribution.type}', isCurrentlyRegistered=${isCurrentlyRegistered}, shouldBeRegistered=${shouldBeRegistered}, when='${contribution.when}'`
|
|
761
|
-
);
|
|
762
|
-
if (isCurrentlyRegistered && !shouldBeRegistered) {
|
|
763
|
-
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
764
|
-
for (const sessionResource of this._disposeSessionsForContribution(contribution.type)) {
|
|
765
|
-
disposedChatSessions.add(sessionResource);
|
|
766
|
-
}
|
|
767
|
-
newlyDisabledChatSessionTypes.add(contribution.type);
|
|
768
|
-
} else if (!isCurrentlyRegistered && shouldBeRegistered) {
|
|
769
|
-
if (extension) {
|
|
770
|
-
this._enableContribution(contribution, extension);
|
|
771
|
-
}
|
|
772
|
-
newlyEnabledChatSessionTypes.add(contribution.type);
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
if (newlyEnabledChatSessionTypes.size > 0 || newlyDisabledChatSessionTypes.size > 0) {
|
|
776
|
-
this._onDidChangeAvailability.fire();
|
|
777
|
-
for (const chatSessionType of [...newlyEnabledChatSessionTypes, ...newlyDisabledChatSessionTypes]) {
|
|
778
|
-
this._onDidChangeItemsProviders.fire({
|
|
779
|
-
chatSessionType
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
if (disposedChatSessions.size > 0) {
|
|
783
|
-
this._onDidChangeSessionItems.fire({
|
|
784
|
-
removed: Array.from(disposedChatSessions)
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
this._updateHasCanDelegateProvidersContextKey();
|
|
789
|
-
}
|
|
790
|
-
_enableContribution(contribution, ext) {
|
|
791
|
-
this._logService.trace(
|
|
792
|
-
`[ChatSessionsService] _enableContribution: type='${contribution.type}', canDelegate=${contribution.canDelegate}`
|
|
793
|
-
);
|
|
794
|
-
const disposableStore = ( new DisposableStore());
|
|
795
|
-
this._contributionDisposables.set(contribution.type, disposableStore);
|
|
796
|
-
if (contribution.canDelegate) {
|
|
797
|
-
disposableStore.add(this._registerAgent(contribution, ext));
|
|
798
|
-
disposableStore.add(this._registerCommands(contribution));
|
|
799
|
-
}
|
|
800
|
-
disposableStore.add(this._registerMenuItems(contribution, ext));
|
|
801
|
-
}
|
|
802
|
-
_disposeSessionsForContribution(contributionId) {
|
|
803
|
-
const sessionsToDispose = [];
|
|
804
|
-
for (const [sessionResource, sessionData] of this._sessions) {
|
|
805
|
-
if (sessionData.chatSessionType === contributionId) {
|
|
806
|
-
sessionsToDispose.push(sessionResource);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
if (sessionsToDispose.length > 0) {
|
|
810
|
-
this._logService.info(
|
|
811
|
-
`Disposing ${sessionsToDispose.length} cached sessions for contribution '${contributionId}' due to when clause change`
|
|
812
|
-
);
|
|
813
|
-
}
|
|
814
|
-
for (const sessionKey of sessionsToDispose) {
|
|
815
|
-
const sessionData = this._sessions.get(sessionKey);
|
|
816
|
-
if (sessionData) {
|
|
817
|
-
sessionData.dispose();
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
return sessionsToDispose;
|
|
821
|
-
}
|
|
822
|
-
_registerAgent(contribution, ext) {
|
|
823
|
-
const storedIcon = this.getContributionIcon(ext, contribution);
|
|
824
|
-
const icons = ThemeIcon.isThemeIcon(storedIcon) ? {
|
|
825
|
-
themeIcon: storedIcon,
|
|
826
|
-
icon: undefined,
|
|
827
|
-
iconDark: undefined
|
|
828
|
-
} : storedIcon ? {
|
|
829
|
-
icon: storedIcon.light,
|
|
830
|
-
iconDark: storedIcon.dark
|
|
831
|
-
} : {
|
|
832
|
-
themeIcon: Codicon.sendToRemoteAgent
|
|
833
|
-
};
|
|
834
|
-
const id = contribution.type;
|
|
835
|
-
const agentData = {
|
|
836
|
-
id,
|
|
837
|
-
name: contribution.name,
|
|
838
|
-
fullName: contribution.displayName,
|
|
839
|
-
description: contribution.description,
|
|
840
|
-
isDefault: false,
|
|
841
|
-
isCore: false,
|
|
842
|
-
isDynamic: true,
|
|
843
|
-
slashCommands: contribution.commands ?? [],
|
|
844
|
-
locations: contribution.locations ?? [ChatAgentLocation.Chat],
|
|
845
|
-
modes: [ChatModeKind.Agent, ChatModeKind.Ask],
|
|
846
|
-
disambiguation: [],
|
|
847
|
-
metadata: {
|
|
848
|
-
...icons
|
|
849
|
-
},
|
|
850
|
-
capabilities: contribution.capabilities,
|
|
851
|
-
canAccessPreviousChatHistory: true,
|
|
852
|
-
extensionId: ext.identifier,
|
|
853
|
-
extensionVersion: ext.version,
|
|
854
|
-
extensionDisplayName: ext.displayName || ext.name,
|
|
855
|
-
extensionPublisherId: ext.publisher
|
|
856
|
-
};
|
|
857
|
-
return this._chatAgentService.registerAgent(id, agentData);
|
|
858
|
-
}
|
|
859
|
-
getAllChatSessionContributions() {
|
|
860
|
-
return ( Array.from(( this._contributions.values())).filter(entry => this._isContributionAvailable(entry.contribution)).map(
|
|
861
|
-
entry => this.resolveChatSessionContribution(entry.extension, entry.contribution)
|
|
862
|
-
));
|
|
863
|
-
}
|
|
864
|
-
_updateHasCanDelegateProvidersContextKey() {
|
|
865
|
-
const hasCanDelegate = this.getAllChatSessionContributions().filter(c => c.canDelegate);
|
|
866
|
-
const canDelegateEnabled = hasCanDelegate.length > 0;
|
|
867
|
-
this._logService.trace(
|
|
868
|
-
`[ChatSessionsService] hasCanDelegateProvidersAvailable=${canDelegateEnabled} (${( hasCanDelegate.map(c => c.type)).join(", ")})`
|
|
869
|
-
);
|
|
870
|
-
this._hasCanDelegateProvidersKey.set(canDelegateEnabled);
|
|
871
|
-
}
|
|
872
|
-
getChatSessionContribution(chatSessionType) {
|
|
873
|
-
const entry = this._contributions.get(chatSessionType);
|
|
874
|
-
if (!entry) {
|
|
875
|
-
return undefined;
|
|
876
|
-
}
|
|
877
|
-
if (!this._isContributionAvailable(entry.contribution)) {
|
|
878
|
-
return undefined;
|
|
879
|
-
}
|
|
880
|
-
return this.resolveChatSessionContribution(entry.extension, entry.contribution);
|
|
881
|
-
}
|
|
882
|
-
resolveChatSessionContribution(ext, contribution) {
|
|
883
|
-
return {
|
|
884
|
-
...contribution,
|
|
885
|
-
icon: this.resolveIconForCurrentColorTheme(this.getContributionIcon(ext, contribution))
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
getContributionIcon(ext, contribution) {
|
|
889
|
-
if (!contribution.icon) {
|
|
890
|
-
return undefined;
|
|
891
|
-
}
|
|
892
|
-
if (typeof contribution.icon === "string") {
|
|
893
|
-
return contribution.icon.startsWith("$(") && contribution.icon.endsWith(")") ? ThemeIcon.fromString(contribution.icon) : ThemeIcon.fromId(contribution.icon);
|
|
894
|
-
}
|
|
895
|
-
return {
|
|
896
|
-
dark: ext ? joinPath(ext.extensionLocation, contribution.icon.dark) : ( URI.parse(contribution.icon.dark)),
|
|
897
|
-
light: ext ? joinPath(ext.extensionLocation, contribution.icon.light) : ( URI.parse(contribution.icon.light))
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
|
-
resolveIconForCurrentColorTheme(rawIcon) {
|
|
901
|
-
if (!rawIcon) {
|
|
902
|
-
return undefined;
|
|
903
|
-
}
|
|
904
|
-
if (ThemeIcon.isThemeIcon(rawIcon)) {
|
|
905
|
-
return rawIcon;
|
|
906
|
-
} else if (isDark(this._themeService.getColorTheme().type)) {
|
|
907
|
-
return rawIcon.dark;
|
|
908
|
-
} else {
|
|
909
|
-
return rawIcon.light;
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
registerChatSessionContribution(contribution) {
|
|
913
|
-
if (( this._contributions.has(contribution.type))) {
|
|
914
|
-
return {
|
|
915
|
-
dispose: () => {}
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
this._contributions.set(contribution.type, {
|
|
919
|
-
contribution,
|
|
920
|
-
extension: undefined
|
|
921
|
-
});
|
|
922
|
-
if (contribution.alternativeIds) {
|
|
923
|
-
for (const alternativeId of contribution.alternativeIds) {
|
|
924
|
-
this._alternativeIdMap.set(alternativeId, contribution.type);
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
const disposables = ( new DisposableStore());
|
|
928
|
-
this._contributionDisposables.set(contribution.type, disposables);
|
|
929
|
-
if (contribution.onDidChangeRequiresCopilotSignIn) {
|
|
930
|
-
disposables.add(
|
|
931
|
-
contribution.onDidChangeRequiresCopilotSignIn(() => this._onDidChangeAvailability.fire())
|
|
932
|
-
);
|
|
933
|
-
}
|
|
934
|
-
this._updateHasCanDelegateProvidersContextKey();
|
|
935
|
-
this._onDidChangeAvailability.fire();
|
|
936
|
-
return toDisposable(() => {
|
|
937
|
-
this._contributions.delete(contribution.type);
|
|
938
|
-
if (contribution.alternativeIds) {
|
|
939
|
-
for (const alternativeId of contribution.alternativeIds) {
|
|
940
|
-
if (this._alternativeIdMap.get(alternativeId) === contribution.type) {
|
|
941
|
-
this._alternativeIdMap.delete(alternativeId);
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
946
|
-
this._updateHasCanDelegateProvidersContextKey();
|
|
947
|
-
this._onDidChangeAvailability.fire();
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
async activateChatSessionItemProvider(chatViewType) {
|
|
951
|
-
await this.doActivateChatSessionItemController(chatViewType);
|
|
952
|
-
}
|
|
953
|
-
async doActivateChatSessionItemController(chatViewType) {
|
|
954
|
-
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
955
|
-
const resolvedType = this._resolveToPrimaryType(chatViewType);
|
|
956
|
-
if (resolvedType) {
|
|
957
|
-
chatViewType = resolvedType;
|
|
958
|
-
}
|
|
959
|
-
if (!this._isContributionAvailableForType(chatViewType)) {
|
|
960
|
-
return false;
|
|
961
|
-
}
|
|
962
|
-
if (( this._itemControllers.has(chatViewType))) {
|
|
963
|
-
return true;
|
|
964
|
-
}
|
|
965
|
-
await this._extensionService.activateByEvent(`onChatSession:${chatViewType}`);
|
|
966
|
-
const controller = this._itemControllers.get(chatViewType);
|
|
967
|
-
return !!controller;
|
|
968
|
-
}
|
|
969
|
-
async canResolveChatSession(sessionType) {
|
|
970
|
-
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
971
|
-
if (!this._isContributionAvailableForType(sessionType)) {
|
|
972
|
-
return false;
|
|
973
|
-
}
|
|
974
|
-
if (( this._contentProviders.has(sessionType))) {
|
|
975
|
-
return true;
|
|
976
|
-
}
|
|
977
|
-
const asyncActivators = this._asyncActivationRegistry.getActivators(sessionType);
|
|
978
|
-
if (asyncActivators.length) {
|
|
979
|
-
for (const activator of asyncActivators) {
|
|
980
|
-
if (await this._instantiationService.invokeFunction(accessor => activator.waitForActivation(accessor, sessionType))) {
|
|
981
|
-
await this.waitForContentProvider(sessionType);
|
|
982
|
-
if (( this._contentProviders.has(sessionType))) {
|
|
983
|
-
return true;
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
return false;
|
|
988
|
-
}
|
|
989
|
-
await this._extensionService.activateByEvent(`onChatSession:${sessionType}`);
|
|
990
|
-
return ( this._contentProviders.has(sessionType));
|
|
991
|
-
}
|
|
992
|
-
async waitForContentProvider(sessionType) {
|
|
993
|
-
if (( this._contentProviders.has(sessionType))) {
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
await Event.toPromise(
|
|
997
|
-
Event.filter(this.onDidChangeContentProviderSchemes, e => e.added.includes(sessionType))
|
|
998
|
-
);
|
|
999
|
-
}
|
|
1000
|
-
async provideChatInputCompletions(sessionResource, params, token) {
|
|
1001
|
-
const sessionType = getChatSessionType(sessionResource);
|
|
1002
|
-
const resolvedType = this._resolveToPrimaryType(sessionType) || sessionType;
|
|
1003
|
-
const provider = this._contentProviders.get(resolvedType);
|
|
1004
|
-
if (!provider?.provideChatInputCompletions) {
|
|
1005
|
-
return undefined;
|
|
1006
|
-
}
|
|
1007
|
-
return provider.provideChatInputCompletions(sessionResource, params, token);
|
|
1008
|
-
}
|
|
1009
|
-
resolveChatResponseUri(sessionResource, href, kind) {
|
|
1010
|
-
const sessionType = getChatSessionType(sessionResource);
|
|
1011
|
-
const resolvedType = this._resolveToPrimaryType(sessionType) || sessionType;
|
|
1012
|
-
return this._contentProviders.get(resolvedType)?.resolveChatResponseUri?.(sessionResource, href, kind) ?? href;
|
|
1013
|
-
}
|
|
1014
|
-
updateChatSessionMetadata(sessionResource, metadata) {
|
|
1015
|
-
const sessionType = getChatSessionType(sessionResource);
|
|
1016
|
-
const resolvedType = this._resolveToPrimaryType(sessionType) || sessionType;
|
|
1017
|
-
const provider = this._contentProviders.get(resolvedType);
|
|
1018
|
-
if (!provider?.updateChatSessionMetadata) {
|
|
1019
|
-
return false;
|
|
1020
|
-
}
|
|
1021
|
-
provider.updateChatSessionMetadata(sessionResource, metadata);
|
|
1022
|
-
return true;
|
|
1023
|
-
}
|
|
1024
|
-
async getChatInputCompletionTriggerCharacters(sessionType) {
|
|
1025
|
-
const resolvedType = this._resolveToPrimaryType(sessionType) || sessionType;
|
|
1026
|
-
const provider = this._contentProviders.get(resolvedType);
|
|
1027
|
-
if (!provider) {
|
|
1028
|
-
return undefined;
|
|
1029
|
-
}
|
|
1030
|
-
if (!provider.provideChatInputCompletionTriggerCharacters) {
|
|
1031
|
-
return [];
|
|
1032
|
-
}
|
|
1033
|
-
return provider.provideChatInputCompletionTriggerCharacters();
|
|
1034
|
-
}
|
|
1035
|
-
async tryActivateControllers(providersToResolve) {
|
|
1036
|
-
await Promise.all(( this.getAllChatSessionContributions().map(async contrib => {
|
|
1037
|
-
if (providersToResolve && !providersToResolve.includes(contrib.type)) {
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
if (!(await this.doActivateChatSessionItemController(contrib.type))) {
|
|
1041
|
-
if (providersToResolve?.includes(contrib.type)) {
|
|
1042
|
-
this._logService.trace(
|
|
1043
|
-
`[ChatSessionsService] No enabled provider found for chat session type ${contrib.type}`
|
|
1044
|
-
);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
})));
|
|
1048
|
-
}
|
|
1049
|
-
getChatSessionItems(providersToResolve, token) {
|
|
1050
|
-
return new AsyncIterableProducer(async writer => {
|
|
1051
|
-
await raceCancellationError(this.tryActivateControllers(providersToResolve), token);
|
|
1052
|
-
await Promise.all(
|
|
1053
|
-
Array.from(this._itemControllers, async ([chatSessionType, controllerEntry]) => {
|
|
1054
|
-
const resolvedType = this._resolveToPrimaryType(chatSessionType) ?? chatSessionType;
|
|
1055
|
-
if (providersToResolve && !providersToResolve.includes(resolvedType)) {
|
|
1056
|
-
return;
|
|
1057
|
-
}
|
|
1058
|
-
if (!this._isContributionAvailableForType(chatSessionType)) {
|
|
1059
|
-
return;
|
|
1060
|
-
}
|
|
1061
|
-
try {
|
|
1062
|
-
await raceCancellationError(controllerEntry.initialRefresh, token);
|
|
1063
|
-
const providerSessions = controllerEntry.controller.items;
|
|
1064
|
-
this._logService.trace(
|
|
1065
|
-
`[ChatSessionsService] Resolved ${providerSessions.length} sessions for provider ${resolvedType}`
|
|
1066
|
-
);
|
|
1067
|
-
writer.emitOne({
|
|
1068
|
-
chatSessionType: resolvedType,
|
|
1069
|
-
items: providerSessions
|
|
1070
|
-
});
|
|
1071
|
-
} catch (err) {
|
|
1072
|
-
if (!isCancellationError(err)) {
|
|
1073
|
-
this._logService.error(
|
|
1074
|
-
`[ChatSessionsService] Failed to resolve sessions for provider ${resolvedType}`,
|
|
1075
|
-
err
|
|
1076
|
-
);
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
})
|
|
1080
|
-
);
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
async refreshChatSessionItems(providersToResolve, token) {
|
|
1084
|
-
await this.tryActivateControllers(providersToResolve);
|
|
1085
|
-
await Promise.all(( Array.from(this._itemControllers).map(async ([chatSessionType, controllerEntry]) => {
|
|
1086
|
-
const resolvedType = this._resolveToPrimaryType(chatSessionType) ?? chatSessionType;
|
|
1087
|
-
if (providersToResolve && !providersToResolve.includes(resolvedType)) {
|
|
1088
|
-
return;
|
|
1089
|
-
}
|
|
1090
|
-
try {
|
|
1091
|
-
await controllerEntry.controller.refresh(token);
|
|
1092
|
-
} catch (err) {
|
|
1093
|
-
if (!isCancellationError(err)) {
|
|
1094
|
-
this._logService.error(
|
|
1095
|
-
`[ChatSessionsService] Failed to resolve sessions for provider ${resolvedType}`,
|
|
1096
|
-
err
|
|
1097
|
-
);
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
})));
|
|
1101
|
-
}
|
|
1102
|
-
getRegisteredChatSessionItemProviders() {
|
|
1103
|
-
return [...( new Set(( Array.from(( this._itemControllers.keys())).map(key => this._resolveToPrimaryType(key) ?? key))))];
|
|
1104
|
-
}
|
|
1105
|
-
registerChatSessionItemController(chatSessionType, controller) {
|
|
1106
|
-
const disposables = ( new DisposableStore());
|
|
1107
|
-
const initialRefreshCts = disposables.add(( new CancellationTokenSource()));
|
|
1108
|
-
this._itemControllers.set(chatSessionType, {
|
|
1109
|
-
controller,
|
|
1110
|
-
initialRefresh: controller.refresh(initialRefreshCts.token)
|
|
1111
|
-
});
|
|
1112
|
-
this._onDidChangeItemsProviders.fire({
|
|
1113
|
-
chatSessionType
|
|
1114
|
-
});
|
|
1115
|
-
disposables.add(controller.onDidChangeChatSessionItems(e => {
|
|
1116
|
-
for (const sessionResource of e.removed ?? []) {
|
|
1117
|
-
this._disposeSession(sessionResource);
|
|
1118
|
-
}
|
|
1119
|
-
this._onDidChangeSessionItems.fire(e);
|
|
1120
|
-
this.updateInProgressStatus(chatSessionType);
|
|
1121
|
-
}));
|
|
1122
|
-
return {
|
|
1123
|
-
dispose: () => {
|
|
1124
|
-
initialRefreshCts.cancel();
|
|
1125
|
-
disposables.dispose();
|
|
1126
|
-
const registeredController = this._itemControllers.get(chatSessionType)?.controller;
|
|
1127
|
-
if (registeredController === controller) {
|
|
1128
|
-
this._itemControllers.delete(chatSessionType);
|
|
1129
|
-
this._onDidChangeItemsProviders.fire({
|
|
1130
|
-
chatSessionType
|
|
1131
|
-
});
|
|
1132
|
-
if (this.inProgressMap.delete(chatSessionType)) {
|
|
1133
|
-
this._onDidChangeInProgress.fire();
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
}
|
|
1139
|
-
registerChatSessionContentProvider(chatSessionType, provider) {
|
|
1140
|
-
if (( this._contentProviders.has(chatSessionType))) {
|
|
1141
|
-
throw ( new Error(`Content provider for ${chatSessionType} is already registered.`));
|
|
1142
|
-
}
|
|
1143
|
-
this._contentProviders.set(chatSessionType, provider);
|
|
1144
|
-
this._onDidChangeContentProviderSchemes.fire({
|
|
1145
|
-
added: [chatSessionType],
|
|
1146
|
-
removed: []
|
|
1147
|
-
});
|
|
1148
|
-
return {
|
|
1149
|
-
dispose: () => {
|
|
1150
|
-
this._contentProviders.delete(chatSessionType);
|
|
1151
|
-
this._onDidChangeContentProviderSchemes.fire({
|
|
1152
|
-
added: [],
|
|
1153
|
-
removed: [chatSessionType]
|
|
1154
|
-
});
|
|
1155
|
-
for (const [key, session] of this._sessions) {
|
|
1156
|
-
if (session.chatSessionType === chatSessionType) {
|
|
1157
|
-
session.dispose();
|
|
1158
|
-
this._sessions.delete(key);
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
|
-
registerCustomizationsProvider(chatSessionType, provider) {
|
|
1165
|
-
this._customizationsProviders.set(chatSessionType, provider);
|
|
1166
|
-
const onChangeDisposable = provider.onDidChangeCustomizations(() => {
|
|
1167
|
-
this._onDidChangeCustomizations.fire({
|
|
1168
|
-
chatSessionType
|
|
1169
|
-
});
|
|
1170
|
-
});
|
|
1171
|
-
return toDisposable(() => {
|
|
1172
|
-
onChangeDisposable.dispose();
|
|
1173
|
-
if (this._customizationsProviders.get(chatSessionType) === provider) {
|
|
1174
|
-
this._customizationsProviders.delete(chatSessionType);
|
|
1175
|
-
}
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
hasCustomizationsProvider(chatSessionType) {
|
|
1179
|
-
return ( this._customizationsProviders.has(chatSessionType));
|
|
1180
|
-
}
|
|
1181
|
-
async getCustomizations(chatSessionType, token) {
|
|
1182
|
-
const provider = this._customizationsProviders.get(chatSessionType);
|
|
1183
|
-
if (!provider) {
|
|
1184
|
-
return undefined;
|
|
1185
|
-
}
|
|
1186
|
-
return provider.provideCustomizations(token);
|
|
1187
|
-
}
|
|
1188
|
-
async createNewChatSessionItem(chatSessionType, request, token) {
|
|
1189
|
-
const controllerData = this._itemControllers.get(chatSessionType);
|
|
1190
|
-
if (!controllerData) {
|
|
1191
|
-
return undefined;
|
|
1192
|
-
}
|
|
1193
|
-
await controllerData.initialRefresh;
|
|
1194
|
-
return controllerData.controller.newChatSessionItem?.(request, token);
|
|
1195
|
-
}
|
|
1196
|
-
notifySessionMaterialized(sessionResource) {
|
|
1197
|
-
this._getChatSessionItemController(sessionResource)?.controller.notifySessionMaterialized?.(sessionResource);
|
|
1198
|
-
}
|
|
1199
|
-
async deleteChatSessionItem(sessionResource, token) {
|
|
1200
|
-
const controllerData = this._getChatSessionItemController(sessionResource);
|
|
1201
|
-
if (!controllerData?.controller.deleteChatSessionItem) {
|
|
1202
|
-
throw ( new Error(`Session ${( sessionResource.toString())} does not support deletion`));
|
|
1203
|
-
}
|
|
1204
|
-
await controllerData.initialRefresh;
|
|
1205
|
-
await controllerData.controller.deleteChatSessionItem(sessionResource, token);
|
|
1206
|
-
this._disposeSession(sessionResource);
|
|
1207
|
-
}
|
|
1208
|
-
_disposeSession(sessionResource) {
|
|
1209
|
-
const resolvedResource = this._resolveResource(sessionResource);
|
|
1210
|
-
for (const resource of [sessionResource, resolvedResource]) {
|
|
1211
|
-
const resourceKey = ( resource.toString());
|
|
1212
|
-
const pendingSession = this._pendingSessionResolutions.get(resourceKey);
|
|
1213
|
-
if (pendingSession) {
|
|
1214
|
-
this._pendingSessionResolutions.delete(resourceKey);
|
|
1215
|
-
pendingSession.cancellationTokenSource.cancel();
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
const sessionData = this._sessions.get(sessionResource) ?? this._sessions.get(resolvedResource);
|
|
1219
|
-
if (sessionData) {
|
|
1220
|
-
this._sessions.delete(sessionData.resource);
|
|
1221
|
-
sessionData.dispose();
|
|
1222
|
-
sessionData.session.dispose();
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
_getChatSessionItemController(sessionResource) {
|
|
1226
|
-
const sessionType = getChatSessionType(sessionResource);
|
|
1227
|
-
const resolvedType = this._resolveToPrimaryType(sessionType) ?? sessionType;
|
|
1228
|
-
return this._itemControllers.get(resolvedType);
|
|
1229
|
-
}
|
|
1230
|
-
async getOrCreateChatSession(sessionResource, token) {
|
|
1231
|
-
{
|
|
1232
|
-
const existingSessionData = this._sessions.get(sessionResource);
|
|
1233
|
-
if (existingSessionData) {
|
|
1234
|
-
this._logService.trace(
|
|
1235
|
-
`[ChatSessionsService] getOrCreateChatSession: cache hit for ${( sessionResource.toString())}`
|
|
1236
|
-
);
|
|
1237
|
-
return existingSessionData.session;
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
const resourceKey = ( sessionResource.toString());
|
|
1241
|
-
let pendingSession = this._pendingSessionResolutions.get(resourceKey);
|
|
1242
|
-
if (!pendingSession) {
|
|
1243
|
-
const cancellationTokenSource = ( new CancellationTokenSource());
|
|
1244
|
-
const promise = this._getOrCreateChatSession(sessionResource, cancellationTokenSource.token);
|
|
1245
|
-
pendingSession = {
|
|
1246
|
-
promise,
|
|
1247
|
-
cancellationTokenSource,
|
|
1248
|
-
waiterCount: 0
|
|
1249
|
-
};
|
|
1250
|
-
this._pendingSessionResolutions.set(resourceKey, pendingSession);
|
|
1251
|
-
const clearPendingSession = () => {
|
|
1252
|
-
if (this._pendingSessionResolutions.get(resourceKey) === pendingSession) {
|
|
1253
|
-
this._pendingSessionResolutions.delete(resourceKey);
|
|
1254
|
-
}
|
|
1255
|
-
cancellationTokenSource.dispose();
|
|
1256
|
-
};
|
|
1257
|
-
void promise.then(clearPendingSession, clearPendingSession);
|
|
1258
|
-
}
|
|
1259
|
-
return this._waitForPendingSessionResolution(resourceKey, pendingSession, token);
|
|
1260
|
-
}
|
|
1261
|
-
_waitForPendingSessionResolution(resourceKey, pendingSession, token) {
|
|
1262
|
-
pendingSession.waiterCount++;
|
|
1263
|
-
let released = false;
|
|
1264
|
-
const release = () => {
|
|
1265
|
-
if (released) {
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
released = true;
|
|
1269
|
-
pendingSession.waiterCount--;
|
|
1270
|
-
if (pendingSession.waiterCount === 0 && this._pendingSessionResolutions.get(resourceKey) === pendingSession) {
|
|
1271
|
-
this._pendingSessionResolutions.delete(resourceKey);
|
|
1272
|
-
pendingSession.cancellationTokenSource.cancel();
|
|
1273
|
-
}
|
|
1274
|
-
};
|
|
1275
|
-
const cancellationListener = token.onCancellationRequested(release);
|
|
1276
|
-
return raceCancellationError(pendingSession.promise, token).finally(() => {
|
|
1277
|
-
cancellationListener.dispose();
|
|
1278
|
-
release();
|
|
1279
|
-
});
|
|
1280
|
-
}
|
|
1281
|
-
async _getOrCreateChatSession(sessionResource, token) {
|
|
1282
|
-
const sessionType = getChatSessionType(sessionResource);
|
|
1283
|
-
if (!(await raceCancellationError(this.canResolveChatSession(sessionType), token))) {
|
|
1284
|
-
throw Error(`Cannot find provider '${sessionType}'`);
|
|
1285
|
-
}
|
|
1286
|
-
{
|
|
1287
|
-
const existingSessionData = this._sessions.get(sessionResource);
|
|
1288
|
-
if (existingSessionData) {
|
|
1289
|
-
return existingSessionData.session;
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
const resolvedType = this._resolveToPrimaryType(sessionType) || sessionType;
|
|
1293
|
-
const provider = this._contentProviders.get(resolvedType);
|
|
1294
|
-
if (!provider) {
|
|
1295
|
-
throw Error(`Cannot find provider '${resolvedType}'`);
|
|
1296
|
-
}
|
|
1297
|
-
let session;
|
|
1298
|
-
const newSessionOptionGroups = isUntitledChatSession(sessionResource) ? await this.getNewChatSessionInputState(resolvedType, sessionResource) : undefined;
|
|
1299
|
-
if (isUntitledChatSession(sessionResource) && (newSessionOptionGroups || resolvedType.startsWith("agent-host-"))) {
|
|
1300
|
-
const options = ( new Map());
|
|
1301
|
-
for (const group of newSessionOptionGroups ?? []) {
|
|
1302
|
-
const selected = group.selected ?? group.items.find(item => item.default) ?? group.items[0];
|
|
1303
|
-
if (selected) {
|
|
1304
|
-
options.set(group.id, selected);
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
session = {
|
|
1308
|
-
sessionResource: sessionResource,
|
|
1309
|
-
onWillDispose: Event.None,
|
|
1310
|
-
history: [],
|
|
1311
|
-
options: options.size > 0 ? options : undefined,
|
|
1312
|
-
dispose: () => {}
|
|
1313
|
-
};
|
|
1314
|
-
} else {
|
|
1315
|
-
this._logService.trace(
|
|
1316
|
-
`[ChatSessionsService] getOrCreateChatSession: resolving content from provider '${resolvedType}' for ${( sessionResource.toString())}`
|
|
1317
|
-
);
|
|
1318
|
-
const contentPromise = provider.provideChatSessionContent(sessionResource, token);
|
|
1319
|
-
void contentPromise.then(session => {
|
|
1320
|
-
if (token.isCancellationRequested) {
|
|
1321
|
-
session.dispose();
|
|
1322
|
-
}
|
|
1323
|
-
}, () => {});
|
|
1324
|
-
session = await raceCancellationError(contentPromise, token);
|
|
1325
|
-
this._logService.trace(
|
|
1326
|
-
`[ChatSessionsService] getOrCreateChatSession: provider returned ${session.history.length} history item(s) for ${( sessionResource.toString())}`
|
|
1327
|
-
);
|
|
1328
|
-
}
|
|
1329
|
-
if (session.options) {
|
|
1330
|
-
for (const [optionId, value] of session.options) {
|
|
1331
|
-
this.setSessionOption(sessionResource, optionId, value);
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
{
|
|
1335
|
-
const existingSessionData = this._sessions.get(sessionResource);
|
|
1336
|
-
if (existingSessionData) {
|
|
1337
|
-
session.dispose();
|
|
1338
|
-
return existingSessionData.session;
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
const sessionData = ( new ContributedChatSessionData(session, sessionType, sessionResource, session.options, resource => {
|
|
1342
|
-
sessionData.dispose();
|
|
1343
|
-
this._sessions.delete(resource);
|
|
1344
|
-
}));
|
|
1345
|
-
this._sessions.set(sessionResource, sessionData);
|
|
1346
|
-
if (session.options) {
|
|
1347
|
-
this._onDidChangeSessionOptions.fire({
|
|
1348
|
-
sessionResource,
|
|
1349
|
-
updates: session.options
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
return session;
|
|
1353
|
-
}
|
|
1354
|
-
async getChatSessionHistory(sessionResource, token) {
|
|
1355
|
-
const existing = this._sessions.get(this._resolveResource(sessionResource));
|
|
1356
|
-
if (existing) {
|
|
1357
|
-
return [...existing.session.history];
|
|
1358
|
-
}
|
|
1359
|
-
if (isUntitledChatSession(sessionResource)) {
|
|
1360
|
-
return [];
|
|
1361
|
-
}
|
|
1362
|
-
const sessionType = getChatSessionType(sessionResource);
|
|
1363
|
-
const resolvedType = this._resolveToPrimaryType(sessionType) || sessionType;
|
|
1364
|
-
if (!(await raceCancellationError(this.canResolveChatSession(resolvedType), token))) {
|
|
1365
|
-
throw Error(`Cannot find provider '${resolvedType}'`);
|
|
1366
|
-
}
|
|
1367
|
-
const provider = this._contentProviders.get(resolvedType);
|
|
1368
|
-
if (!provider) {
|
|
1369
|
-
throw Error(`Cannot find provider '${resolvedType}'`);
|
|
1370
|
-
}
|
|
1371
|
-
const session = await raceCancellationError(provider.provideChatSessionContent(sessionResource, token), token);
|
|
1372
|
-
try {
|
|
1373
|
-
return [...session.history];
|
|
1374
|
-
} finally {
|
|
1375
|
-
session.dispose();
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
hasAnySessionOptions(sessionResource) {
|
|
1379
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1380
|
-
return !!session && !!session.options && session.options.size > 0;
|
|
1381
|
-
}
|
|
1382
|
-
getSessionOptions(sessionResource) {
|
|
1383
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1384
|
-
if (!session) {
|
|
1385
|
-
return undefined;
|
|
1386
|
-
}
|
|
1387
|
-
const result = ( new Map());
|
|
1388
|
-
for (const [key, value] of session.getAllOptions()) {
|
|
1389
|
-
result.set(key, typeof value === "string" ? value : value.id);
|
|
1390
|
-
}
|
|
1391
|
-
return result.size > 0 ? result : undefined;
|
|
1392
|
-
}
|
|
1393
|
-
getSessionOption(sessionResource, optionId) {
|
|
1394
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1395
|
-
return session?.getOption(optionId);
|
|
1396
|
-
}
|
|
1397
|
-
setSessionOption(sessionResource, optionId, value) {
|
|
1398
|
-
return this.updateSessionOptions(sessionResource, ( new Map([[optionId, value]])));
|
|
1399
|
-
}
|
|
1400
|
-
updateSessionOptions(sessionResource, updates) {
|
|
1401
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1402
|
-
if (!session) {
|
|
1403
|
-
return false;
|
|
1404
|
-
}
|
|
1405
|
-
let didChange = false;
|
|
1406
|
-
for (const [optionId, value] of updates) {
|
|
1407
|
-
const existingValue = session.getOption(optionId);
|
|
1408
|
-
if (existingValue !== value) {
|
|
1409
|
-
session.setOption(optionId, value);
|
|
1410
|
-
didChange = true;
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
if (didChange) {
|
|
1414
|
-
this._onDidChangeSessionOptions.fire({
|
|
1415
|
-
sessionResource,
|
|
1416
|
-
updates: updates
|
|
1417
|
-
});
|
|
1418
|
-
}
|
|
1419
|
-
return didChange;
|
|
1420
|
-
}
|
|
1421
|
-
_resolveResource(resource) {
|
|
1422
|
-
return this._resourceAliases.get(resource) ?? resource;
|
|
1423
|
-
}
|
|
1424
|
-
registerSessionResourceAlias(untitledResource, realResource) {
|
|
1425
|
-
this._resourceAliases.set(realResource, untitledResource);
|
|
1426
|
-
}
|
|
1427
|
-
setMaterializedSessionResource(untitledResource, realResource) {
|
|
1428
|
-
this._realResources.set(untitledResource, realResource);
|
|
1429
|
-
}
|
|
1430
|
-
getMaterializedSessionResource(untitledResource) {
|
|
1431
|
-
return this._realResources.get(untitledResource);
|
|
1432
|
-
}
|
|
1433
|
-
clearMaterializedSessionResource(sessionResource) {
|
|
1434
|
-
this._realResources.delete(sessionResource);
|
|
1435
|
-
const untitled = this._resourceAliases.get(sessionResource);
|
|
1436
|
-
if (untitled) {
|
|
1437
|
-
this._realResources.delete(untitled);
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
fireSessionCommitted(original, committed) {
|
|
1441
|
-
this._onDidCommitSession.fire({
|
|
1442
|
-
original,
|
|
1443
|
-
committed
|
|
1444
|
-
});
|
|
1445
|
-
}
|
|
1446
|
-
setOptionGroupsForSessionType(chatSessionType, handle, optionGroups) {
|
|
1447
|
-
if (optionGroups) {
|
|
1448
|
-
this._sessionTypeOptions.set(chatSessionType, optionGroups);
|
|
1449
|
-
} else {
|
|
1450
|
-
this._sessionTypeOptions.delete(chatSessionType);
|
|
1451
|
-
}
|
|
1452
|
-
this._onDidChangeOptionGroups.fire(chatSessionType);
|
|
1453
|
-
}
|
|
1454
|
-
getOptionGroupsForSessionType(chatSessionType) {
|
|
1455
|
-
return this._sessionTypeOptions.get(chatSessionType);
|
|
1456
|
-
}
|
|
1457
|
-
async getNewChatSessionInputState(chatSessionType, sessionResource) {
|
|
1458
|
-
const controllerData = this._itemControllers.get(chatSessionType);
|
|
1459
|
-
if (controllerData?.controller.getNewChatSessionInputState) {
|
|
1460
|
-
const groups = await controllerData.controller.getNewChatSessionInputState(sessionResource, CancellationToken.None);
|
|
1461
|
-
if (groups?.length) {
|
|
1462
|
-
this._sessionTypeOptions.set(chatSessionType, [...groups]);
|
|
1463
|
-
this._onDidChangeOptionGroups.fire(chatSessionType);
|
|
1464
|
-
}
|
|
1465
|
-
return groups;
|
|
1466
|
-
}
|
|
1467
|
-
const groups = this._sessionTypeOptions.get(chatSessionType);
|
|
1468
|
-
if (!groups?.length) {
|
|
1469
|
-
return undefined;
|
|
1470
|
-
}
|
|
1471
|
-
return groups;
|
|
1472
|
-
}
|
|
1473
|
-
getCapabilitiesForSessionType(chatSessionType) {
|
|
1474
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1475
|
-
return contribution?.capabilities;
|
|
1476
|
-
}
|
|
1477
|
-
getCustomAgentTargetForSessionType(chatSessionType) {
|
|
1478
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1479
|
-
return contribution?.customAgentTarget ?? Target.Undefined;
|
|
1480
|
-
}
|
|
1481
|
-
requiresCustomModelsForSessionType(chatSessionType) {
|
|
1482
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1483
|
-
return !!contribution?.requiresCustomModels;
|
|
1484
|
-
}
|
|
1485
|
-
supportsAutoModelForSessionType(chatSessionType) {
|
|
1486
|
-
if (chatSessionType === localChatSessionType) {
|
|
1487
|
-
return true;
|
|
1488
|
-
}
|
|
1489
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1490
|
-
return !!contribution?.supportsAutoModel;
|
|
1491
|
-
}
|
|
1492
|
-
supportsDelegationForSessionType(chatSessionType) {
|
|
1493
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1494
|
-
return contribution?.supportsDelegation !== false;
|
|
1495
|
-
}
|
|
1496
|
-
requiresCopilotSignInForSessionType(chatSessionType) {
|
|
1497
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1498
|
-
if (!contribution) {
|
|
1499
|
-
return false;
|
|
1500
|
-
}
|
|
1501
|
-
const requires = contribution.requiresCopilotSignIn;
|
|
1502
|
-
return typeof requires === "function" ? requires() : !!requires;
|
|
1503
|
-
}
|
|
1504
|
-
sessionSupportsFork(sessionResource) {
|
|
1505
|
-
const session =
|
|
1506
|
-
this._sessions.get(sessionResource) ?? this._sessions.get(this._resolveResource(sessionResource));
|
|
1507
|
-
return !!session?.session.forkSession;
|
|
1508
|
-
}
|
|
1509
|
-
async forkChatSession(sessionResource, request, token) {
|
|
1510
|
-
const session =
|
|
1511
|
-
this._sessions.get(sessionResource) ?? this._sessions.get(this._resolveResource(sessionResource));
|
|
1512
|
-
if (!session?.session.forkSession) {
|
|
1513
|
-
throw ( new Error(`Session ${( sessionResource.toString())} does not support forking`));
|
|
1514
|
-
}
|
|
1515
|
-
return session.session.forkSession(request, token);
|
|
1516
|
-
}
|
|
1517
|
-
sessionSupportsRename(sessionResource) {
|
|
1518
|
-
const session =
|
|
1519
|
-
this._sessions.get(sessionResource) ?? this._sessions.get(this._resolveResource(sessionResource));
|
|
1520
|
-
return !!session?.session.renameSession;
|
|
1521
|
-
}
|
|
1522
|
-
async renameChatSession(sessionResource, title, token) {
|
|
1523
|
-
const session = await this.getOrCreateChatSession(sessionResource, token);
|
|
1524
|
-
if (!session.renameSession) {
|
|
1525
|
-
throw ( new Error(`Session ${( sessionResource.toString())} does not support renaming`));
|
|
1526
|
-
}
|
|
1527
|
-
return session.renameSession(title, token);
|
|
1528
|
-
}
|
|
1529
|
-
getContentProviderSchemes() {
|
|
1530
|
-
return Array.from(( this._contentProviders.keys()));
|
|
1531
|
-
}
|
|
1532
|
-
};
|
|
1533
|
-
ChatSessionsService = ( __decorate([( __param(0, ILogService)), ( __param(1, IChatAgentService)), ( __param(2, IExtensionService)), ( __param(3, IContextKeyService)), ( __param(4, IMenuService)), ( __param(5, IThemeService)), ( __param(6, ILabelService)), ( __param(7, IInstantiationService))], ChatSessionsService));
|
|
1534
|
-
function registerNewSessionInPlaceAction(type, displayName) {
|
|
1535
|
-
return registerAction2(class NewChatSessionInPlaceAction extends Action2 {
|
|
1536
|
-
constructor() {
|
|
1537
|
-
super({
|
|
1538
|
-
id: `workbench.action.chat.openNewChatSessionInPlace.${type}`,
|
|
1539
|
-
title: ( localize2(8583, "New {0} Session", displayName)),
|
|
1540
|
-
category: CHAT_CATEGORY,
|
|
1541
|
-
f1: false,
|
|
1542
|
-
precondition: ChatContextKeys.enabled
|
|
1543
|
-
});
|
|
1544
|
-
}
|
|
1545
|
-
async run(accessor, ...args) {
|
|
1546
|
-
if (args.length === 0) {
|
|
1547
|
-
throw ( new BugIndicatingError("Expected chat session position argument"));
|
|
1548
|
-
}
|
|
1549
|
-
const chatSessionPosition = args[0];
|
|
1550
|
-
if (chatSessionPosition !== ChatSessionPosition.Sidebar && chatSessionPosition !== ChatSessionPosition.Editor) {
|
|
1551
|
-
throw ( new BugIndicatingError(`Invalid chat session position argument: ${chatSessionPosition}`));
|
|
1552
|
-
}
|
|
1553
|
-
const activeEditor = accessor.get(IEditorGroupsService).activeGroup.activeEditor;
|
|
1554
|
-
const replaceEditorForResource = activeEditor instanceof ChatEditorInput ? activeEditor.sessionResource : undefined;
|
|
1555
|
-
await openChatSession(accessor, {
|
|
1556
|
-
type: type,
|
|
1557
|
-
displayName: ( localize(8584, "Chat")),
|
|
1558
|
-
position: chatSessionPosition,
|
|
1559
|
-
replaceEditorForResource
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1562
|
-
});
|
|
1563
|
-
}
|
|
1564
|
-
function registerNewSessionExternalAction(type, displayName, resolveCommandId) {
|
|
1565
|
-
return registerAction2(class NewChatSessionExternalAction extends Action2 {
|
|
1566
|
-
constructor() {
|
|
1567
|
-
super({
|
|
1568
|
-
id: `workbench.action.chat.openNewChatSessionExternal.${type}`,
|
|
1569
|
-
title: ( localize2(8585, "New {0} Session", displayName)),
|
|
1570
|
-
category: CHAT_CATEGORY,
|
|
1571
|
-
f1: false,
|
|
1572
|
-
precondition: ChatContextKeys.enabled
|
|
1573
|
-
});
|
|
1574
|
-
}
|
|
1575
|
-
async run(accessor) {
|
|
1576
|
-
const commandService = accessor.get(ICommandService);
|
|
1577
|
-
const logService = accessor.get(ILogService);
|
|
1578
|
-
const commandId = resolveCommandId();
|
|
1579
|
-
if (!commandId) {
|
|
1580
|
-
logService.warn(
|
|
1581
|
-
`[ChatSessionsService] No create command contributed to '${MenuId.AgentSessionsCreateSubMenu.id}' for chat session type '${type}'; cannot open a new session.`
|
|
1582
|
-
);
|
|
1583
|
-
return;
|
|
1584
|
-
}
|
|
1585
|
-
await commandService.executeCommand(commandId);
|
|
1586
|
-
}
|
|
1587
|
-
});
|
|
1588
|
-
}
|
|
1589
|
-
var ChatSessionPosition;
|
|
1590
|
-
(function(ChatSessionPosition) {
|
|
1591
|
-
ChatSessionPosition["Editor"] = "editor";
|
|
1592
|
-
ChatSessionPosition["Sidebar"] = "sidebar";
|
|
1593
|
-
})(ChatSessionPosition || (ChatSessionPosition = {}));
|
|
1594
|
-
async function openChatSession(accessor, openOptions, chatSendOptions) {
|
|
1595
|
-
const viewsService = accessor.get(IViewsService);
|
|
1596
|
-
const chatService = accessor.get(IChatService);
|
|
1597
|
-
const chatSessionService = accessor.get(IChatSessionsService);
|
|
1598
|
-
const logService = accessor.get(ILogService);
|
|
1599
|
-
const editorGroupService = accessor.get(IEditorGroupsService);
|
|
1600
|
-
const editorService = accessor.get(IEditorService);
|
|
1601
|
-
const customizationHarnessService = accessor.get(ICustomizationHarnessService);
|
|
1602
|
-
const toolsService = accessor.get(ILanguageModelToolsService);
|
|
1603
|
-
const importConversationStore = accessor.get(IAgentHostImportConversationStore);
|
|
1604
|
-
const progressService = accessor.get(IProgressService);
|
|
1605
|
-
const sessionResource = getResourceForNewChatSession(openOptions);
|
|
1606
|
-
if (chatSendOptions?.importConversation && chatSendOptions.importConversation.turns.length > 0) {
|
|
1607
|
-
importConversationStore.set(sessionResource, chatSendOptions.importConversation);
|
|
1608
|
-
}
|
|
1609
|
-
let sessionsListSuppression;
|
|
1610
|
-
let transitionProgress;
|
|
1611
|
-
try {
|
|
1612
|
-
switch (openOptions.position) {
|
|
1613
|
-
case ChatSessionPosition.Sidebar:
|
|
1614
|
-
{
|
|
1615
|
-
const view = await viewsService.openView(ChatViewId);
|
|
1616
|
-
if (chatSendOptions?.importConversation) {
|
|
1617
|
-
sessionsListSuppression = view.beginSessionsListSuppression();
|
|
1618
|
-
transitionProgress = ( new DeferredPromise());
|
|
1619
|
-
progressService.withProgress({
|
|
1620
|
-
location: ChatViewId
|
|
1621
|
-
}, () => transitionProgress.p);
|
|
1622
|
-
}
|
|
1623
|
-
if (openOptions.type === AgentSessionProviders.Local) {
|
|
1624
|
-
await view.startNewLocalSession();
|
|
1625
|
-
} else {
|
|
1626
|
-
await view.loadSession(sessionResource, "explicitOverride");
|
|
1627
|
-
}
|
|
1628
|
-
view.focus();
|
|
1629
|
-
break;
|
|
1630
|
-
}
|
|
1631
|
-
case ChatSessionPosition.Editor:
|
|
1632
|
-
{
|
|
1633
|
-
const options = {
|
|
1634
|
-
override: ChatEditorInput.EditorID,
|
|
1635
|
-
pinned: true,
|
|
1636
|
-
sessionTypeSelectionReason: "explicitOverride",
|
|
1637
|
-
...(openOptions.type === AgentSessionProviders.Local ? {
|
|
1638
|
-
explicitSessionType: localChatSessionType
|
|
1639
|
-
} : {}),
|
|
1640
|
-
title: {
|
|
1641
|
-
fallback: ( localize(8586, "{0}", openOptions.displayName))
|
|
1642
|
-
}
|
|
1643
|
-
};
|
|
1644
|
-
if (openOptions.replaceEditorForResource) {
|
|
1645
|
-
const sourceResource = openOptions.replaceEditorForResource;
|
|
1646
|
-
let replaced = false;
|
|
1647
|
-
for (const group of editorGroupService.groups) {
|
|
1648
|
-
const editor = group.editors.find(
|
|
1649
|
-
e => e instanceof ChatEditorInput && isEqual(e.sessionResource, sourceResource)
|
|
1650
|
-
);
|
|
1651
|
-
if (editor) {
|
|
1652
|
-
await editorService.replaceEditors([{
|
|
1653
|
-
editor,
|
|
1654
|
-
replacement: {
|
|
1655
|
-
resource: sessionResource,
|
|
1656
|
-
options
|
|
1657
|
-
}
|
|
1658
|
-
}], group);
|
|
1659
|
-
replaced = true;
|
|
1660
|
-
break;
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
if (!replaced) {
|
|
1664
|
-
await editorService.openEditor({
|
|
1665
|
-
resource: sessionResource,
|
|
1666
|
-
options
|
|
1667
|
-
});
|
|
1668
|
-
}
|
|
1669
|
-
} else {
|
|
1670
|
-
await editorService.openEditor({
|
|
1671
|
-
resource: sessionResource,
|
|
1672
|
-
options
|
|
1673
|
-
});
|
|
1674
|
-
}
|
|
1675
|
-
break;
|
|
1676
|
-
}
|
|
1677
|
-
default:
|
|
1678
|
-
assertNever(
|
|
1679
|
-
openOptions.position,
|
|
1680
|
-
`Unknown chat session position: ${openOptions.position}`
|
|
1681
|
-
);
|
|
1682
|
-
}
|
|
1683
|
-
} catch (e) {
|
|
1684
|
-
logService.error(
|
|
1685
|
-
`Failed to open '${openOptions.type}' chat session with openOptions: ${JSON.stringify(openOptions)}`,
|
|
1686
|
-
e
|
|
1687
|
-
);
|
|
1688
|
-
sessionsListSuppression?.dispose();
|
|
1689
|
-
transitionProgress?.complete();
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
if (chatSendOptions) {
|
|
1693
|
-
try {
|
|
1694
|
-
if (chatSendOptions.initialSessionOptions) {
|
|
1695
|
-
chatSessionService.updateSessionOptions(
|
|
1696
|
-
sessionResource,
|
|
1697
|
-
normalizeSessionOptions(chatSendOptions.initialSessionOptions)
|
|
1698
|
-
);
|
|
1699
|
-
}
|
|
1700
|
-
let attachedContext = chatSendOptions.attachedContext;
|
|
1701
|
-
const promptFile = await resolvePromptSlashCommand(
|
|
1702
|
-
chatSendOptions.prompt,
|
|
1703
|
-
sessionResource,
|
|
1704
|
-
customizationHarnessService,
|
|
1705
|
-
toolsService
|
|
1706
|
-
);
|
|
1707
|
-
if (promptFile) {
|
|
1708
|
-
attachedContext = [promptFile, ...(attachedContext ?? [])];
|
|
1709
|
-
}
|
|
1710
|
-
const result = await chatService.sendRequest(sessionResource, chatSendOptions.prompt, {
|
|
1711
|
-
agentIdSilent: openOptions.type,
|
|
1712
|
-
attachedContext
|
|
1713
|
-
});
|
|
1714
|
-
const newSessionResource = result.kind === "sent" || result.kind === "rejected" ? result.newSessionResource : undefined;
|
|
1715
|
-
if (newSessionResource && !isEqual(newSessionResource, sessionResource)) {
|
|
1716
|
-
switch (openOptions.position) {
|
|
1717
|
-
case ChatSessionPosition.Sidebar:
|
|
1718
|
-
{
|
|
1719
|
-
const view = await viewsService.openView(ChatViewId);
|
|
1720
|
-
await view.loadSession(newSessionResource);
|
|
1721
|
-
break;
|
|
1722
|
-
}
|
|
1723
|
-
case ChatSessionPosition.Editor:
|
|
1724
|
-
{
|
|
1725
|
-
for (const group of editorGroupService.groups) {
|
|
1726
|
-
const editor = group.editors.find(
|
|
1727
|
-
e => e instanceof ChatEditorInput && isEqual(e.sessionResource, sessionResource)
|
|
1728
|
-
);
|
|
1729
|
-
if (editor) {
|
|
1730
|
-
await editorService.replaceEditors([{
|
|
1731
|
-
editor,
|
|
1732
|
-
replacement: {
|
|
1733
|
-
resource: newSessionResource,
|
|
1734
|
-
options: {
|
|
1735
|
-
override: ChatEditorInput.EditorID,
|
|
1736
|
-
pinned: true
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
}], group);
|
|
1740
|
-
break;
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
break;
|
|
1744
|
-
}
|
|
1745
|
-
default:
|
|
1746
|
-
assertNever(
|
|
1747
|
-
openOptions.position,
|
|
1748
|
-
`Unknown chat session position: ${openOptions.position}`
|
|
1749
|
-
);
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
} catch (e) {
|
|
1753
|
-
logService.error(
|
|
1754
|
-
`Failed to send initial request to '${openOptions.type}' chat session with contextOptions: ${JSON.stringify(chatSendOptions)}`,
|
|
1755
|
-
e
|
|
1756
|
-
);
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
sessionsListSuppression?.dispose();
|
|
1760
|
-
transitionProgress?.complete();
|
|
1761
|
-
}
|
|
1762
|
-
function normalizeSessionOptions(options) {
|
|
1763
|
-
if (options instanceof Map) {
|
|
1764
|
-
return options;
|
|
1765
|
-
}
|
|
1766
|
-
if (Array.isArray(options)) {
|
|
1767
|
-
return ( new Map(( options.map(o => [o.optionId, o.value]))));
|
|
1768
|
-
}
|
|
1769
|
-
return ChatSessionOptionsMap.fromRecord(options);
|
|
1770
|
-
}
|
|
1771
|
-
async function resolvePromptSlashCommand(prompt, sessionResource, customizationHarnessService, toolsService) {
|
|
1772
|
-
const slashMatch = prompt.match(slashReg);
|
|
1773
|
-
if (slashMatch) {
|
|
1774
|
-
const slashCommand = await customizationHarnessService.resolvePromptSlashCommand(slashMatch[1], sessionResource, CancellationToken.None);
|
|
1775
|
-
const parseResult = slashCommand?.parsedPromptFile;
|
|
1776
|
-
if (parseResult) {
|
|
1777
|
-
const refs = parseResult.body?.variableReferences.map((
|
|
1778
|
-
{
|
|
1779
|
-
name,
|
|
1780
|
-
offset,
|
|
1781
|
-
fullLength
|
|
1782
|
-
}
|
|
1783
|
-
) => ({
|
|
1784
|
-
name,
|
|
1785
|
-
range: ( new OffsetRange(offset, offset + fullLength))
|
|
1786
|
-
})) ?? [];
|
|
1787
|
-
const toolReferences = toolsService.toToolReferences(refs);
|
|
1788
|
-
return toPromptFileVariableEntry(
|
|
1789
|
-
parseResult.uri,
|
|
1790
|
-
PromptFileVariableKind.PromptFile,
|
|
1791
|
-
undefined,
|
|
1792
|
-
true,
|
|
1793
|
-
toolReferences
|
|
1794
|
-
);
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
return undefined;
|
|
1798
|
-
}
|
|
1799
|
-
function getResourceForNewChatSession(options) {
|
|
1800
|
-
const isRemoteSession = options.type !== AgentSessionProviders.Local;
|
|
1801
|
-
if (isRemoteSession) {
|
|
1802
|
-
return ( URI.from({
|
|
1803
|
-
scheme: options.type,
|
|
1804
|
-
path: `/untitled-${generateUuid()}`
|
|
1805
|
-
}));
|
|
1806
|
-
}
|
|
1807
|
-
const isEditorPosition = options.position === ChatSessionPosition.Editor;
|
|
1808
|
-
if (isEditorPosition) {
|
|
1809
|
-
return ChatEditorInput.getNewEditorUri();
|
|
1810
|
-
}
|
|
1811
|
-
return LocalChatSessionUri.getNewSessionUri();
|
|
1812
|
-
}
|
|
1813
|
-
function isAgentSessionProviderType(type) {
|
|
1814
|
-
return ( Object.values(AgentSessionProviders)).includes(type);
|
|
1815
|
-
}
|
|
1816
|
-
function getSessionStatusForModel(model) {
|
|
1817
|
-
if (model.requestInProgress.get()) {
|
|
1818
|
-
return ChatSessionStatus.InProgress;
|
|
1819
|
-
}
|
|
1820
|
-
const lastRequest = model.getRequests().at(-1);
|
|
1821
|
-
if (lastRequest?.response) {
|
|
1822
|
-
if (lastRequest.response.state === ResponseModelState.NeedsInput) {
|
|
1823
|
-
return ChatSessionStatus.NeedsInput;
|
|
1824
|
-
} else if (lastRequest.response.isCanceled || lastRequest.response.result?.errorDetails?.code === "canceled") {
|
|
1825
|
-
return ChatSessionStatus.Completed;
|
|
1826
|
-
} else if (lastRequest.response.result?.errorDetails) {
|
|
1827
|
-
return ChatSessionStatus.Failed;
|
|
1828
|
-
} else if (lastRequest.response.isComplete) {
|
|
1829
|
-
return ChatSessionStatus.Completed;
|
|
1830
|
-
} else {
|
|
1831
|
-
return ChatSessionStatus.InProgress;
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
return undefined;
|
|
1835
|
-
}
|
|
1836
|
-
function chatResponseStateToSessionStatus(state) {
|
|
1837
|
-
switch (state) {
|
|
1838
|
-
case ResponseModelState.Cancelled:
|
|
1839
|
-
case ResponseModelState.Complete:
|
|
1840
|
-
return ChatSessionStatus.Completed;
|
|
1841
|
-
case ResponseModelState.Failed:
|
|
1842
|
-
return ChatSessionStatus.Failed;
|
|
1843
|
-
case ResponseModelState.Pending:
|
|
1844
|
-
return ChatSessionStatus.InProgress;
|
|
1845
|
-
case ResponseModelState.NeedsInput:
|
|
1846
|
-
return ChatSessionStatus.NeedsInput;
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
export { ChatSessionPosition, ChatSessionsService, applyCodexAgentHostPreference, chatResponseStateToSessionStatus, getResourceForNewChatSession, getSessionStatusForModel, openChatSession };
|