@codingame/monaco-vscode-api 21.6.0 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/missing-services.js +68 -78
- package/package.json +8 -8
- package/services.d.ts +4 -4
- package/services.js +5 -4
- package/vscode/product.json.js +1 -1
- package/vscode/src/vs/base/browser/dom.js +6 -3
- package/vscode/src/vs/base/browser/domSanitize.d.ts +8 -0
- package/vscode/src/vs/base/browser/domSanitize.js +49 -27
- package/vscode/src/vs/base/browser/domStylesheets.js +5 -1
- package/vscode/src/vs/base/browser/markdownRenderer.js +7 -5
- package/vscode/src/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/vscode/src/vs/base/browser/ui/contextview/contextview.js +2 -2
- package/vscode/src/vs/base/browser/ui/dropdown/dropdown.js +1 -1
- package/vscode/src/vs/base/browser/ui/menu/menu.js +1 -0
- package/vscode/src/vs/base/browser/ui/progressbar/progressbar.d.ts +1 -1
- package/vscode/src/vs/base/common/async.js +6 -0
- package/vscode/src/vs/base/common/cancellation.d.ts +21 -0
- package/vscode/src/vs/base/common/cancellation.js +42 -1
- package/vscode/src/vs/base/common/codicons.d.ts +3 -0
- package/vscode/src/vs/base/common/codiconsLibrary.d.ts +3 -0
- package/vscode/src/vs/base/common/codiconsLibrary.js +3 -0
- package/vscode/src/vs/base/common/decorators/cancelPreviousCalls.d.ts +84 -0
- package/vscode/src/vs/base/common/decorators.d.ts +1 -1
- package/vscode/src/vs/base/common/htmlContent.d.ts +2 -0
- package/vscode/src/vs/base/common/htmlContent.js +9 -6
- package/vscode/src/vs/base/common/lifecycle.js +21 -7
- package/vscode/src/vs/base/common/numbers.d.ts +0 -45
- package/vscode/src/vs/base/common/oauth.d.ts +33 -0
- package/vscode/src/vs/base/common/oauth.js +79 -3
- package/vscode/src/vs/base/common/observableInternal/base.d.ts +4 -0
- package/vscode/src/vs/base/common/observableInternal/index.js +3 -0
- package/vscode/src/vs/base/common/observableInternal/logging/debugGetDependencyGraph.d.ts +4 -0
- package/vscode/src/vs/base/common/observableInternal/logging/debugGetDependencyGraph.js +98 -0
- package/vscode/src/vs/base/common/observableInternal/observables/baseObservable.d.ts +4 -0
- package/vscode/src/vs/base/common/observableInternal/observables/baseObservable.js +8 -1
- package/vscode/src/vs/base/common/observableInternal/observables/derivedImpl.d.ts +1 -0
- package/vscode/src/vs/base/common/observableInternal/observables/derivedImpl.js +10 -0
- package/vscode/src/vs/base/common/observableInternal/observables/observableFromEvent.d.ts +4 -0
- package/vscode/src/vs/base/common/observableInternal/observables/observableFromEvent.js +3 -0
- package/vscode/src/vs/base/common/observableInternal/reactions/autorunImpl.d.ts +1 -0
- package/vscode/src/vs/base/common/observableInternal/reactions/autorunImpl.js +9 -0
- package/vscode/src/vs/base/common/product.d.ts +7 -1
- package/vscode/src/vs/base/common/strings.d.ts +0 -1
- package/vscode/src/vs/base/common/strings.js +9 -4
- package/vscode/src/vs/base/common/uriIpc.js +24 -1
- package/vscode/src/vs/editor/browser/controller/editContext/native/screenReaderContentRich.js +26 -16
- package/vscode/src/vs/editor/browser/controller/editContext/native/screenReaderContentSimple.js +3 -3
- package/vscode/src/vs/editor/browser/services/hoverService/hover.css +1 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/commands.d.ts +3 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/commands.js +12 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +8 -8
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js +4 -4
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.d.ts +1 -0
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +26 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/features/gutterFeature.js +1 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js +1 -1
- package/vscode/src/vs/editor/common/config/editorOptions.d.ts +93 -85
- package/vscode/src/vs/editor/common/config/editorOptions.js +386 -351
- package/vscode/src/vs/editor/common/core/editorColorRegistry.js +71 -71
- package/vscode/src/vs/editor/common/core/ranges/lineRange.d.ts +3 -3
- package/vscode/src/vs/editor/common/editorContextKeys.js +46 -46
- package/vscode/src/vs/editor/common/languages/modesRegistry.js +1 -1
- package/vscode/src/vs/editor/common/languages.d.ts +5 -1
- package/vscode/src/vs/editor/common/languages.js +56 -56
- package/vscode/src/vs/editor/common/model/editStack.js +1 -1
- package/vscode/src/vs/editor/common/standalone/standaloneEnums.d.ts +86 -85
- package/vscode/src/vs/editor/common/standalone/standaloneEnums.js +86 -85
- package/vscode/src/vs/editor/common/standaloneStrings.js +47 -47
- package/vscode/src/vs/editor/common/textModelEditSource.d.ts +1 -0
- package/vscode/src/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
- package/vscode/src/vs/editor/common/viewModel/monospaceLineBreaksComputer.js +9 -7
- package/vscode/src/vs/editor/common/viewModel/screenReaderSimpleModel.d.ts +1 -0
- package/vscode/src/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/vscode/src/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +6 -6
- package/vscode/src/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
- package/vscode/src/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
- package/vscode/src/vs/editor/contrib/clipboard/browser/clipboard.js +17 -17
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
- package/vscode/src/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
- package/vscode/src/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
- package/vscode/src/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +1 -1
- package/vscode/src/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/vscode/src/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/vscode/src/vs/editor/contrib/contextmenu/browser/contextmenu.js +10 -10
- package/vscode/src/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +9 -9
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +2 -2
- package/vscode/src/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/vscode/src/vs/editor/contrib/find/browser/findController.js +16 -16
- package/vscode/src/vs/editor/contrib/find/browser/findWidget.js +26 -26
- package/vscode/src/vs/editor/contrib/floatingMenu/browser/floatingMenu.contribution.d.ts +1 -0
- package/vscode/src/vs/editor/contrib/floatingMenu/browser/floatingMenu.contribution.js +8 -0
- package/vscode/src/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +44 -0
- package/vscode/src/vs/editor/contrib/floatingMenu/browser/floatingMenu.d.ts +10 -0
- package/vscode/src/vs/editor/contrib/floatingMenu/browser/floatingMenu.js +81 -0
- package/vscode/src/vs/editor/contrib/folding/browser/folding.js +21 -20
- package/vscode/src/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/vscode/src/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/vscode/src/vs/editor/contrib/format/browser/format.js +3 -0
- package/vscode/src/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/vscode/src/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/vscode/src/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.d.ts +4 -1
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +20 -11
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/vscode/src/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/vscode/src/vs/editor/contrib/hover/browser/contentHoverController.js +2 -1
- package/vscode/src/vs/editor/contrib/hover/browser/contentHoverRendered.js +3 -3
- package/vscode/src/vs/editor/contrib/hover/browser/hoverAccessibleViews.js +2 -2
- package/vscode/src/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/vscode/src/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/vscode/src/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +9 -9
- package/vscode/src/vs/editor/contrib/hover/browser/markerHoverParticipant.js +5 -5
- package/vscode/src/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/vscode/src/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/vscode/src/vs/editor/contrib/inlayHints/browser/inlayHints.js +2 -7
- package/vscode/src/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +19 -19
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +12 -12
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +18 -13
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.d.ts +3 -1
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +14 -6
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.d.ts +7 -1
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +154 -5
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.d.ts +1 -0
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +3 -0
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.d.ts +7 -3
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +18 -3
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/telemetry.d.ts +45 -0
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/telemetry.js +7 -0
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +16 -15
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +5 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +1 -1
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +2 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +24 -21
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +13 -4
- package/vscode/src/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/vscode/src/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/vscode/src/vs/editor/contrib/linesOperations/browser/linesOperations.d.ts +2 -1
- package/vscode/src/vs/editor/contrib/linesOperations/browser/linesOperations.js +36 -35
- package/vscode/src/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/vscode/src/vs/editor/contrib/links/browser/links.js +11 -11
- package/vscode/src/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/vscode/src/vs/editor/contrib/middleScroll/browser/middleScrollController.js +3 -3
- package/vscode/src/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/vscode/src/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/vscode/src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/vscode/src/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/vscode/src/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/vscode/src/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/vscode/src/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/vscode/src/vs/editor/contrib/rename/browser/renameWidget.js +6 -6
- package/vscode/src/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/vscode/src/vs/editor/contrib/snippet/browser/snippetController2.d.ts +3 -0
- package/vscode/src/vs/editor/contrib/snippet/browser/snippetController2.js +13 -4
- package/vscode/src/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +12 -19
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.js +10 -1
- package/vscode/src/vs/editor/contrib/suggest/browser/suggest.js +8 -8
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestController.js +10 -10
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestWidget.js +18 -18
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +2 -2
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/vscode/src/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/vscode/src/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/vscode/src/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/vscode/src/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/vscode/src/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/vscode/src/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +26 -26
- package/vscode/src/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/vscode/src/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/vscode/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/vscode/src/vs/editor/contrib/wordOperations/browser/wordOperations.js +1 -1
- package/vscode/src/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js +1 -1
- package/vscode/src/vs/editor/standalone/browser/standaloneServices.js +0 -1
- package/vscode/src/vs/editor/standalone/browser/standaloneThemeService.js +1 -0
- package/vscode/src/vs/platform/accessibility/browser/accessibleView.d.ts +1 -1
- package/vscode/src/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/vscode/src/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/vscode/src/vs/platform/actionWidget/browser/actionList.js +9 -6
- package/vscode/src/vs/platform/actionWidget/browser/actionWidget.css +13 -14
- package/vscode/src/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/vscode/src/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/vscode/src/vs/platform/actions/browser/toolbar.d.ts +1 -1
- package/vscode/src/vs/platform/actions/browser/toolbar.js +5 -5
- package/vscode/src/vs/platform/actions/common/actions.d.ts +2 -0
- package/vscode/src/vs/platform/actions/common/actions.js +2 -0
- package/vscode/src/vs/platform/actions/common/menuResetAction.js +1 -1
- package/vscode/src/vs/platform/actions/common/menuService.js +2 -2
- package/vscode/src/vs/platform/assignment/common/assignment.d.ts +6 -1
- package/vscode/src/vs/platform/clipboard/browser/clipboardService.js +2 -2
- package/vscode/src/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/vscode/src/vs/platform/contextkey/browser/contextKeyService.d.ts +2 -0
- package/vscode/src/vs/platform/contextkey/browser/contextKeyService.js +32 -3
- package/vscode/src/vs/platform/contextkey/common/contextkey.js +11 -11
- package/vscode/src/vs/platform/contextkey/common/contextkeys.d.ts +0 -1
- package/vscode/src/vs/platform/contextkey/common/contextkeys.js +10 -11
- package/vscode/src/vs/platform/contextkey/common/scanner.js +5 -5
- package/vscode/src/vs/platform/dataChannel/browser/forwardingTelemetryService.d.ts +32 -0
- package/vscode/src/vs/platform/dataChannel/browser/forwardingTelemetryService.js +86 -0
- package/vscode/src/vs/platform/dialogs/common/dialogs.service.d.ts +1 -1
- package/vscode/src/vs/platform/dnd/browser/dnd.js +1 -1
- package/vscode/src/vs/platform/environment/common/argv.d.ts +1 -0
- package/vscode/src/vs/platform/environment/common/environment.service.d.ts +0 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +19 -19
- package/vscode/src/vs/platform/extensionManagement/common/extensionNls.js +1 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionsScannerService.js +7 -7
- package/vscode/src/vs/platform/extensionManagement/common/implicitActivationEvents.d.ts +1 -3
- package/vscode/src/vs/platform/extensionManagement/common/implicitActivationEvents.js +1 -1
- package/vscode/src/vs/platform/extensions/common/extensionValidator.js +20 -20
- package/vscode/src/vs/platform/extensions/common/extensions.d.ts +2 -1
- package/vscode/src/vs/platform/extensions/common/extensionsApiProposals.d.ts +4 -3
- package/vscode/src/vs/platform/extensions/common/extensionsApiProposals.js +4 -3
- package/vscode/src/vs/platform/files/browser/htmlFileSystemProvider.js +2 -2
- package/vscode/src/vs/platform/files/common/files.js +6 -6
- package/vscode/src/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/vscode/src/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/vscode/src/vs/platform/list/browser/listService.js +27 -27
- package/vscode/src/vs/platform/log/common/log.js +6 -6
- package/vscode/src/vs/platform/markers/common/markerService.js +2 -2
- package/vscode/src/vs/platform/markers/common/markers.js +6 -6
- package/vscode/src/vs/platform/mcp/common/mcpGalleryManifest.d.ts +10 -2
- package/vscode/src/vs/platform/mcp/common/mcpGalleryManifest.js +10 -2
- package/vscode/src/vs/platform/mcp/common/mcpManagement.service.d.ts +3 -3
- package/vscode/src/vs/platform/notification/common/notification.js +3 -3
- package/vscode/src/vs/platform/product/common/product.js +3 -3
- package/vscode/src/vs/platform/quickinput/browser/quickInput.d.ts +1 -0
- package/vscode/src/vs/platform/quickinput/browser/quickInput.js +23 -15
- package/vscode/src/vs/platform/quickinput/browser/quickInputActions.js +47 -13
- package/vscode/src/vs/platform/quickinput/browser/quickInputController.js +10 -61
- package/vscode/src/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/vscode/src/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/vscode/src/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/vscode/src/vs/platform/quickinput/browser/tree/quickInputTreeController.d.ts +6 -0
- package/vscode/src/vs/platform/quickinput/browser/tree/quickInputTreeController.js +10 -0
- package/vscode/src/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js +10 -5
- package/vscode/src/vs/platform/quickinput/browser/tree/quickTree.js +4 -1
- package/vscode/src/vs/platform/quickinput/common/quickInput.d.ts +10 -1
- package/vscode/src/vs/platform/request/common/request.js +34 -18
- package/vscode/src/vs/platform/telemetry/common/telemetryUtils.js +1 -1
- package/vscode/src/vs/platform/terminal/common/terminal.d.ts +2 -3
- package/vscode/src/vs/platform/terminal/common/terminal.js +6 -7
- package/vscode/src/vs/platform/theme/common/colorUtils.js +2 -2
- package/vscode/src/vs/platform/theme/common/colors/baseColors.js +17 -17
- package/vscode/src/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/vscode/src/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/vscode/src/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/vscode/src/vs/platform/theme/common/colors/listColors.js +36 -36
- package/vscode/src/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/vscode/src/vs/platform/theme/common/colors/minimapColors.js +11 -11
- package/vscode/src/vs/platform/theme/common/colors/miscColors.js +15 -15
- package/vscode/src/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/vscode/src/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/vscode/src/vs/platform/theme/common/iconRegistry.js +6 -6
- package/vscode/src/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfile.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataSync.js +5 -5
- package/vscode/src/vs/platform/workspace/common/workspace.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +11 -10
- package/vscode/src/vs/workbench/api/common/extHost.protocol.d.ts +25 -24
- package/vscode/src/vs/workbench/api/common/extHostAuthentication.d.ts +4 -4
- package/vscode/src/vs/workbench/api/common/extHostAuthentication.js +10 -18
- package/vscode/src/vs/workbench/api/common/extHostChatAgents2.d.ts +5 -0
- package/vscode/src/vs/workbench/api/common/extHostChatAgents2.js +16 -4
- package/vscode/src/vs/workbench/api/common/extHostChatSessions.d.ts +1 -3
- package/vscode/src/vs/workbench/api/common/extHostChatSessions.js +9 -5
- package/vscode/src/vs/workbench/api/common/extHostCustomEditors.d.ts +1 -1
- package/vscode/src/vs/workbench/api/common/extHostDebugService.js +0 -3
- package/vscode/src/vs/workbench/api/common/extHostDiagnostics.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostExtensionService.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostLanguageFeatures.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostLanguageModelTools.js +9 -4
- package/vscode/src/vs/workbench/api/common/extHostLanguageModels.js +7 -2
- package/vscode/src/vs/workbench/api/common/extHostLogService.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostMcp.d.ts +97 -9
- package/vscode/src/vs/workbench/api/common/extHostMcp.js +66 -62
- package/vscode/src/vs/workbench/api/common/extHostNotebook.d.ts +1 -1
- package/vscode/src/vs/workbench/api/common/extHostNotebook.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostSCM.d.ts +2 -0
- package/vscode/src/vs/workbench/api/common/extHostSCM.js +22 -0
- package/vscode/src/vs/workbench/api/common/extHostSecrets.d.ts +0 -1
- package/vscode/src/vs/workbench/api/common/extHostSecrets.js +0 -3
- package/vscode/src/vs/workbench/api/common/extHostStatusBar.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostTelemetry.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostTerminalService.d.ts +2 -2
- package/vscode/src/vs/workbench/api/common/extHostTerminalService.js +8 -8
- package/vscode/src/vs/workbench/api/common/extHostTreeViews.js +53 -3
- package/vscode/src/vs/workbench/api/common/extHostTunnelService.d.ts +2 -0
- package/vscode/src/vs/workbench/api/common/extHostTunnelService.js +5 -2
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.d.ts +6 -2
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +60 -9
- package/vscode/src/vs/workbench/api/common/extHostTypes.d.ts +18 -14
- package/vscode/src/vs/workbench/api/common/extHostTypes.js +7 -7
- package/vscode/src/vs/workbench/api/common/extHostWebviewPanels.d.ts +1 -1
- package/vscode/src/vs/workbench/api/common/extHostWorkspace.js +1 -1
- package/vscode/src/vs/workbench/api/common/jsonValidationExtensionPoint.js +12 -12
- package/vscode/src/vs/workbench/browser/actions/developerActions.js +262 -31
- package/vscode/src/vs/workbench/browser/actions/textInputActions.js +6 -6
- package/vscode/src/vs/workbench/browser/contextkeys.d.ts +5 -7
- package/vscode/src/vs/workbench/browser/contextkeys.js +15 -43
- package/vscode/src/vs/workbench/common/configuration.js +9 -9
- package/vscode/src/vs/workbench/common/contextkeys.js +73 -73
- package/vscode/src/vs/workbench/common/editor/diffEditorInput.js +1 -1
- package/vscode/src/vs/workbench/common/editor/editorInput.d.ts +1 -1
- package/vscode/src/vs/workbench/common/editor/sideBySideEditorInput.js +1 -1
- package/vscode/src/vs/workbench/common/editor/textEditorModel.js +1 -1
- package/vscode/src/vs/workbench/common/editor.js +4 -4
- package/vscode/src/vs/workbench/common/theme.js +167 -167
- package/vscode/src/vs/workbench/common/views.js +4 -4
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.js +175 -158
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.service.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContextPickService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys.js +15 -9
- package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +61 -66
- package/vscode/src/vs/workbench/contrib/chat/common/chatEditingService.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatEditingService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatLayoutService.service.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatService.d.ts +24 -8
- package/vscode/src/vs/workbench/contrib/chat/common/chatService.service.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionsService.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionsService.service.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatVariableEntries.d.ts +28 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatVariableEntries.js +35 -6
- package/vscode/src/vs/workbench/contrib/chat/common/constants.d.ts +16 -6
- package/vscode/src/vs/workbench/contrib/chat/common/constants.js +11 -8
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelToolsService.d.ts +9 -2
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelToolsService.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelToolsService.service.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.d.ts +8 -4
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +50 -42
- package/vscode/src/vs/workbench/contrib/chat/common/modelPicker/modelPickerWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service.d.ts +23 -8
- package/vscode/src/vs/workbench/contrib/chat/common/tools/manageTodoListTool.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/common/tools/manageTodoListTool.js +29 -29
- package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.js +4 -3
- package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +13 -13
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/dictation/editorDictation.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorAccessibilityHelp.js +5 -5
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.js +7 -6
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMinimap.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleRenderControlCharacter.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleRenderWhitespace.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +5 -5
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsAccessibility.js +12 -12
- package/vscode/src/vs/workbench/contrib/comments/common/commentContextKeys.js +11 -11
- package/vscode/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debug.js +65 -65
- package/vscode/src/vs/workbench/contrib/dropOrPasteInto/browser/commands.js +2 -2
- package/vscode/src/vs/workbench/contrib/dropOrPasteInto/browser/configurationSchema.js +4 -4
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/common/searchExtensionsTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/files/browser/fileConstants.js +6 -6
- package/vscode/src/vs/workbench/contrib/folding/browser/folding.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +20 -20
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsNone.js +4 -4
- package/vscode/src/vs/workbench/contrib/format/browser/formatModified.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlayHints/browser/inlayHintsAccessibilty.js +4 -4
- package/vscode/src/vs/workbench/contrib/list/browser/listResizeColumnAction.js +2 -2
- package/vscode/src/vs/workbench/contrib/list/browser/tableColumnResizeQuickPick.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistryTypes.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTypes.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTypes.js +16 -5
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTypes.service.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.d.ts +217 -60
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/scm/common/history.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.js +3 -3
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsFile.js +3 -3
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsService.js +9 -9
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +29 -29
- package/vscode/src/vs/workbench/contrib/tasks/common/constants.js +1 -1
- package/vscode/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.js +7 -7
- package/vscode/src/vs/workbench/contrib/tasks/common/taskService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.d.ts +16 -3
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +18 -6
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.service.d.ts +42 -8
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.service.js +2 -1
- package/vscode/src/vs/workbench/contrib/testing/common/constants.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/testing/common/constants.js +12 -11
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +3 -3
- package/vscode/src/vs/workbench/services/accounts/common/defaultAccount.js +2 -2
- package/vscode/src/vs/workbench/services/activity/common/activity.service.d.ts +1 -1
- package/vscode/src/vs/workbench/services/authentication/common/authentication.d.ts +4 -4
- package/vscode/src/vs/workbench/services/authentication/common/authentication.js +2 -2
- package/vscode/src/vs/workbench/services/authentication/common/authentication.service.d.ts +6 -6
- package/vscode/src/vs/workbench/services/chat/common/chatEntitlementService.d.ts +286 -0
- package/vscode/src/vs/workbench/services/chat/common/chatEntitlementService.js +861 -0
- package/vscode/src/vs/workbench/{contrib → services}/chat/common/chatEntitlementService.service.d.ts +8 -2
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +16 -16
- package/vscode/src/vs/workbench/services/editor/common/editorResolverService.js +1 -1
- package/vscode/src/vs/workbench/services/extensions/common/extensionsRegistry.js +87 -87
- package/vscode/src/vs/workbench/services/language/common/languageService.js +30 -30
- package/vscode/src/vs/workbench/services/log/common/logConstants.js +1 -1
- package/vscode/src/vs/workbench/services/preferences/common/preferences.service.d.ts +1 -1
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +8 -8
- package/vscode/src/vs/workbench/services/remote/common/tunnelModel.js +6 -6
- package/vscode/src/vs/workbench/services/search/common/queryBuilder.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/common/encoding.js +1 -1
- package/vscode/src/vs/workbench/services/themes/common/colorExtensionPoint.js +22 -22
- package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +13 -13
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +13 -13
- package/vscode-dts/vscode.d.ts +92 -47
- package/vscode-dts/vscode.proposed.authenticationChallenges.d.ts +7 -80
- package/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts +14 -1
- package/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts +12 -0
- package/vscode-dts/vscode.proposed.chatProvider.d.ts +19 -0
- package/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts +19 -11
- package/vscode-dts/vscode.proposed.d.ts +1 -1
- package/vscode-dts/{vscode.proposed.secretStorageKeys.d.ts → vscode.proposed.devDeviceId.d.ts} +3 -4
- package/vscode-dts/vscode.proposed.languageModelCapabilities.d.ts +5 -0
- package/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts +2 -0
- package/vscode-dts/vscode.proposed.terminalCompletionProvider.d.ts +70 -16
- package/vscode/src/vs/workbench/contrib/chat/common/chatLayoutService.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/frontMatterCodec/tokens/index.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/codecs/base/simpleCodec/tokens/tokens.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/types.d.ts +0 -55
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/types.d.ts +0 -91
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +0 -125
- /package/vscode/src/vs/workbench/{contrib → services}/chat/common/chatEntitlementService.service.js +0 -0
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
3
|
+
import product from '../../../../platform/product/common/product.js';
|
|
4
|
+
import { Barrier } from '../../../../base/common/async.js';
|
|
5
|
+
import { CancellationTokenSource, CancellationToken } from '../../../../base/common/cancellation.js';
|
|
6
|
+
import { Emitter, Event } from '../../../../base/common/event.js';
|
|
7
|
+
import { Lazy } from '../../../../base/common/lazy.js';
|
|
8
|
+
import { Disposable, MutableDisposable } from '../../../../base/common/lifecycle.js';
|
|
9
|
+
import { localize } from '../../../../nls.js';
|
|
10
|
+
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.service.js';
|
|
11
|
+
import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
|
|
12
|
+
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.service.js';
|
|
13
|
+
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.service.js';
|
|
14
|
+
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
15
|
+
import { ILogService } from '../../../../platform/log/common/log.service.js';
|
|
16
|
+
import { IProductService } from '../../../../platform/product/common/productService.service.js';
|
|
17
|
+
import { asText } from '../../../../platform/request/common/request.js';
|
|
18
|
+
import { IRequestService } from '../../../../platform/request/common/request.service.js';
|
|
19
|
+
import { StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
|
|
20
|
+
import { IStorageService } from '../../../../platform/storage/common/storage.service.js';
|
|
21
|
+
import { TelemetryLevel } from '../../../../platform/telemetry/common/telemetry.js';
|
|
22
|
+
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.service.js';
|
|
23
|
+
import { IAuthenticationService, IAuthenticationExtensionsService } from '../../authentication/common/authentication.service.js';
|
|
24
|
+
import { IOpenerService } from '../../../../platform/opener/common/opener.service.js';
|
|
25
|
+
import { URI } from '../../../../base/common/uri.js';
|
|
26
|
+
import Severity$1 from '../../../../base/common/severity.js';
|
|
27
|
+
import { IWorkbenchEnvironmentService } from '../../environment/common/environmentService.service.js';
|
|
28
|
+
import { isWeb } from '../../../../base/common/platform.js';
|
|
29
|
+
import { ILifecycleService } from '../../lifecycle/common/lifecycle.service.js';
|
|
30
|
+
import { distinct } from '../../../../base/common/arrays.js';
|
|
31
|
+
import '../../../../platform/instantiation/common/extensions.js';
|
|
32
|
+
import '../../../../base/common/observableInternal/index.js';
|
|
33
|
+
import { observableFromEvent } from '../../../../base/common/observableInternal/observables/observableFromEvent.js';
|
|
34
|
+
|
|
35
|
+
var ChatEntitlementRequests_1, ChatEntitlementContext_1;
|
|
36
|
+
var ChatEntitlementContextKeys;
|
|
37
|
+
(function (ChatEntitlementContextKeys) {
|
|
38
|
+
ChatEntitlementContextKeys.Setup = {
|
|
39
|
+
hidden: ( new RawContextKey('chatSetupHidden', false, true)),
|
|
40
|
+
installed: ( new RawContextKey('chatSetupInstalled', false, true)),
|
|
41
|
+
disabled: ( new RawContextKey('chatSetupDisabled', false, true)),
|
|
42
|
+
untrusted: ( new RawContextKey('chatSetupUntrusted', false, true)),
|
|
43
|
+
later: ( new RawContextKey('chatSetupLater', false, true)),
|
|
44
|
+
registered: ( new RawContextKey('chatSetupRegistered', false, true))
|
|
45
|
+
};
|
|
46
|
+
ChatEntitlementContextKeys.Entitlement = {
|
|
47
|
+
signedOut: ( new RawContextKey('chatEntitlementSignedOut', false, true)),
|
|
48
|
+
canSignUp: ( new RawContextKey('chatPlanCanSignUp', false, true)),
|
|
49
|
+
planFree: ( new RawContextKey('chatPlanFree', false, true)),
|
|
50
|
+
planPro: ( new RawContextKey('chatPlanPro', false, true)),
|
|
51
|
+
planProPlus: ( new RawContextKey('chatPlanProPlus', false, true)),
|
|
52
|
+
planBusiness: ( new RawContextKey('chatPlanBusiness', false, true)),
|
|
53
|
+
planEnterprise: ( new RawContextKey('chatPlanEnterprise', false, true)),
|
|
54
|
+
organisations: ( new RawContextKey('chatEntitlementOrganisations', undefined, true)),
|
|
55
|
+
internal: ( new RawContextKey('chatEntitlementInternal', false, true)),
|
|
56
|
+
sku: ( new RawContextKey('chatEntitlementSku', undefined, true)),
|
|
57
|
+
};
|
|
58
|
+
ChatEntitlementContextKeys.chatQuotaExceeded = ( new RawContextKey('chatQuotaExceeded', false, true));
|
|
59
|
+
ChatEntitlementContextKeys.completionsQuotaExceeded = ( new RawContextKey('completionsQuotaExceeded', false, true));
|
|
60
|
+
ChatEntitlementContextKeys.chatAnonymous = ( new RawContextKey('chatAnonymous', false, true));
|
|
61
|
+
})(ChatEntitlementContextKeys || (ChatEntitlementContextKeys = {}));
|
|
62
|
+
var ChatEntitlement;
|
|
63
|
+
(function (ChatEntitlement) {
|
|
64
|
+
ChatEntitlement[ChatEntitlement["Unknown"] = 1] = "Unknown";
|
|
65
|
+
ChatEntitlement[ChatEntitlement["Unresolved"] = 2] = "Unresolved";
|
|
66
|
+
ChatEntitlement[ChatEntitlement["Available"] = 3] = "Available";
|
|
67
|
+
ChatEntitlement[ChatEntitlement["Unavailable"] = 4] = "Unavailable";
|
|
68
|
+
ChatEntitlement[ChatEntitlement["Free"] = 5] = "Free";
|
|
69
|
+
ChatEntitlement[ChatEntitlement["Pro"] = 6] = "Pro";
|
|
70
|
+
ChatEntitlement[ChatEntitlement["ProPlus"] = 7] = "ProPlus";
|
|
71
|
+
ChatEntitlement[ChatEntitlement["Business"] = 8] = "Business";
|
|
72
|
+
ChatEntitlement[ChatEntitlement["Enterprise"] = 9] = "Enterprise";
|
|
73
|
+
})(ChatEntitlement || (ChatEntitlement = {}));
|
|
74
|
+
function isProUser(chatEntitlement) {
|
|
75
|
+
return chatEntitlement === ChatEntitlement.Pro ||
|
|
76
|
+
chatEntitlement === ChatEntitlement.ProPlus ||
|
|
77
|
+
chatEntitlement === ChatEntitlement.Business ||
|
|
78
|
+
chatEntitlement === ChatEntitlement.Enterprise;
|
|
79
|
+
}
|
|
80
|
+
const defaultChat = {
|
|
81
|
+
extensionId: product.defaultChatAgent?.extensionId ?? '',
|
|
82
|
+
chatExtensionId: product.defaultChatAgent?.chatExtensionId ?? '',
|
|
83
|
+
upgradePlanUrl: product.defaultChatAgent?.upgradePlanUrl ?? '',
|
|
84
|
+
provider: product.defaultChatAgent?.provider ?? { default: { id: '' }, enterprise: { id: '' } },
|
|
85
|
+
providerUriSetting: product.defaultChatAgent?.providerUriSetting ?? '',
|
|
86
|
+
providerScopes: product.defaultChatAgent?.providerScopes ?? [[]],
|
|
87
|
+
entitlementUrl: product.defaultChatAgent?.entitlementUrl ?? '',
|
|
88
|
+
entitlementSignupLimitedUrl: product.defaultChatAgent?.entitlementSignupLimitedUrl ?? '',
|
|
89
|
+
completionsAdvancedSetting: product.defaultChatAgent?.completionsAdvancedSetting ?? '',
|
|
90
|
+
chatQuotaExceededContext: product.defaultChatAgent?.chatQuotaExceededContext ?? '',
|
|
91
|
+
completionsQuotaExceededContext: product.defaultChatAgent?.completionsQuotaExceededContext ?? ''
|
|
92
|
+
};
|
|
93
|
+
const CHAT_ALLOW_ANONYMOUS_CONFIGURATION_KEY = 'chat.allowAnonymousAccess';
|
|
94
|
+
function isAnonymous(configurationService, entitlement, sentiment) {
|
|
95
|
+
if (configurationService.getValue(CHAT_ALLOW_ANONYMOUS_CONFIGURATION_KEY) !== true) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
if (entitlement !== ChatEntitlement.Unknown) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (sentiment.hidden || sentiment.disabled) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
let ChatEntitlementService = class ChatEntitlementService extends Disposable {
|
|
107
|
+
constructor(instantiationService, productService, environmentService, contextKeyService, configurationService) {
|
|
108
|
+
super();
|
|
109
|
+
this.contextKeyService = contextKeyService;
|
|
110
|
+
this.configurationService = configurationService;
|
|
111
|
+
this._onDidChangeQuotaExceeded = this._register(( new Emitter()));
|
|
112
|
+
this.onDidChangeQuotaExceeded = this._onDidChangeQuotaExceeded.event;
|
|
113
|
+
this._onDidChangeQuotaRemaining = this._register(( new Emitter()));
|
|
114
|
+
this.onDidChangeQuotaRemaining = this._onDidChangeQuotaRemaining.event;
|
|
115
|
+
this._quotas = {};
|
|
116
|
+
this.ExtensionQuotaContextKeys = {
|
|
117
|
+
chatQuotaExceeded: defaultChat.chatQuotaExceededContext,
|
|
118
|
+
completionsQuotaExceeded: defaultChat.completionsQuotaExceededContext,
|
|
119
|
+
};
|
|
120
|
+
this._onDidChangeAnonymous = this._register(( new Emitter()));
|
|
121
|
+
this.onDidChangeAnonymous = this._onDidChangeAnonymous.event;
|
|
122
|
+
this.anonymousObs = observableFromEvent(this.onDidChangeAnonymous, () => this.anonymous);
|
|
123
|
+
this.chatQuotaExceededContextKey = ChatEntitlementContextKeys.chatQuotaExceeded.bindTo(this.contextKeyService);
|
|
124
|
+
this.completionsQuotaExceededContextKey = ChatEntitlementContextKeys.completionsQuotaExceeded.bindTo(this.contextKeyService);
|
|
125
|
+
this.anonymousContextKey = ChatEntitlementContextKeys.chatAnonymous.bindTo(this.contextKeyService);
|
|
126
|
+
this.onDidChangeEntitlement = ( Event.map(
|
|
127
|
+
Event.filter(this.contextKeyService.onDidChangeContext, e => e.affectsSome(( new Set([
|
|
128
|
+
ChatEntitlementContextKeys.Entitlement.planPro.key,
|
|
129
|
+
ChatEntitlementContextKeys.Entitlement.planBusiness.key,
|
|
130
|
+
ChatEntitlementContextKeys.Entitlement.planEnterprise.key,
|
|
131
|
+
ChatEntitlementContextKeys.Entitlement.planProPlus.key,
|
|
132
|
+
ChatEntitlementContextKeys.Entitlement.planFree.key,
|
|
133
|
+
ChatEntitlementContextKeys.Entitlement.canSignUp.key,
|
|
134
|
+
ChatEntitlementContextKeys.Entitlement.signedOut.key,
|
|
135
|
+
ChatEntitlementContextKeys.Entitlement.organisations.key,
|
|
136
|
+
ChatEntitlementContextKeys.Entitlement.internal.key,
|
|
137
|
+
ChatEntitlementContextKeys.Entitlement.sku.key
|
|
138
|
+
]))), this._store),
|
|
139
|
+
() => { },
|
|
140
|
+
this._store
|
|
141
|
+
));
|
|
142
|
+
this.entitlementObs = observableFromEvent(this.onDidChangeEntitlement, () => this.entitlement);
|
|
143
|
+
this.onDidChangeSentiment = ( Event.map(
|
|
144
|
+
Event.filter(this.contextKeyService.onDidChangeContext, e => e.affectsSome(( new Set([
|
|
145
|
+
ChatEntitlementContextKeys.Setup.hidden.key,
|
|
146
|
+
ChatEntitlementContextKeys.Setup.disabled.key,
|
|
147
|
+
ChatEntitlementContextKeys.Setup.untrusted.key,
|
|
148
|
+
ChatEntitlementContextKeys.Setup.installed.key,
|
|
149
|
+
ChatEntitlementContextKeys.Setup.later.key,
|
|
150
|
+
ChatEntitlementContextKeys.Setup.registered.key
|
|
151
|
+
]))), this._store),
|
|
152
|
+
() => { },
|
|
153
|
+
this._store
|
|
154
|
+
));
|
|
155
|
+
this.sentimentObs = observableFromEvent(this.onDidChangeSentiment, () => this.sentiment);
|
|
156
|
+
if ((
|
|
157
|
+
(isWeb &&
|
|
158
|
+
!environmentService.remoteAuthority && !configurationService.getValue('chat.experimental.serverlessWebEnabled')))) {
|
|
159
|
+
ChatEntitlementContextKeys.Setup.hidden.bindTo(this.contextKeyService).set(true);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (!productService.defaultChatAgent) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const context = this.context = ( new Lazy(
|
|
166
|
+
() => this._register(instantiationService.createInstance(ChatEntitlementContext))
|
|
167
|
+
));
|
|
168
|
+
this.requests = ( new Lazy(
|
|
169
|
+
() => this._register(instantiationService.createInstance(ChatEntitlementRequests, context.value, {
|
|
170
|
+
clearQuotas: () => this.clearQuotas(),
|
|
171
|
+
acceptQuotas: quotas => this.acceptQuotas(quotas)
|
|
172
|
+
}))
|
|
173
|
+
));
|
|
174
|
+
this.registerListeners();
|
|
175
|
+
}
|
|
176
|
+
get entitlement() {
|
|
177
|
+
if (this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.planPro.key) === true) {
|
|
178
|
+
return ChatEntitlement.Pro;
|
|
179
|
+
}
|
|
180
|
+
else if (this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.planBusiness.key) === true) {
|
|
181
|
+
return ChatEntitlement.Business;
|
|
182
|
+
}
|
|
183
|
+
else if (this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.planEnterprise.key) === true) {
|
|
184
|
+
return ChatEntitlement.Enterprise;
|
|
185
|
+
}
|
|
186
|
+
else if (this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.planProPlus.key) === true) {
|
|
187
|
+
return ChatEntitlement.ProPlus;
|
|
188
|
+
}
|
|
189
|
+
else if (this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.planFree.key) === true) {
|
|
190
|
+
return ChatEntitlement.Free;
|
|
191
|
+
}
|
|
192
|
+
else if (this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.canSignUp.key) === true) {
|
|
193
|
+
return ChatEntitlement.Available;
|
|
194
|
+
}
|
|
195
|
+
else if (this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.signedOut.key) === true) {
|
|
196
|
+
return ChatEntitlement.Unknown;
|
|
197
|
+
}
|
|
198
|
+
return ChatEntitlement.Unresolved;
|
|
199
|
+
}
|
|
200
|
+
get isInternal() {
|
|
201
|
+
return this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.internal.key) === true;
|
|
202
|
+
}
|
|
203
|
+
get organisations() {
|
|
204
|
+
return this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.organisations.key);
|
|
205
|
+
}
|
|
206
|
+
get sku() {
|
|
207
|
+
return this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Entitlement.sku.key);
|
|
208
|
+
}
|
|
209
|
+
get quotas() { return this._quotas; }
|
|
210
|
+
registerListeners() {
|
|
211
|
+
const quotaExceededSet = ( new Set(
|
|
212
|
+
[this.ExtensionQuotaContextKeys.chatQuotaExceeded, this.ExtensionQuotaContextKeys.completionsQuotaExceeded]
|
|
213
|
+
));
|
|
214
|
+
const cts = this._register(( new MutableDisposable()));
|
|
215
|
+
this._register(this.contextKeyService.onDidChangeContext(e => {
|
|
216
|
+
if (e.affectsSome(quotaExceededSet)) {
|
|
217
|
+
if (cts.value) {
|
|
218
|
+
cts.value.cancel();
|
|
219
|
+
}
|
|
220
|
+
cts.value = ( new CancellationTokenSource());
|
|
221
|
+
this.update(cts.value.token);
|
|
222
|
+
}
|
|
223
|
+
}));
|
|
224
|
+
let anonymousUsage = this.anonymous;
|
|
225
|
+
const updateAnonymousUsage = () => {
|
|
226
|
+
const newAnonymousUsage = this.anonymous;
|
|
227
|
+
if (newAnonymousUsage !== anonymousUsage) {
|
|
228
|
+
anonymousUsage = newAnonymousUsage;
|
|
229
|
+
this.anonymousContextKey.set(newAnonymousUsage);
|
|
230
|
+
this._onDidChangeAnonymous.fire();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
234
|
+
if (e.affectsConfiguration(CHAT_ALLOW_ANONYMOUS_CONFIGURATION_KEY)) {
|
|
235
|
+
updateAnonymousUsage();
|
|
236
|
+
}
|
|
237
|
+
}));
|
|
238
|
+
this._register(this.onDidChangeEntitlement(() => updateAnonymousUsage()));
|
|
239
|
+
this._register(this.onDidChangeSentiment(() => updateAnonymousUsage()));
|
|
240
|
+
}
|
|
241
|
+
acceptQuotas(quotas) {
|
|
242
|
+
const oldQuota = this._quotas;
|
|
243
|
+
this._quotas = quotas;
|
|
244
|
+
this.updateContextKeys();
|
|
245
|
+
const { changed: chatChanged } = this.compareQuotas(oldQuota.chat, quotas.chat);
|
|
246
|
+
const { changed: completionsChanged } = this.compareQuotas(oldQuota.completions, quotas.completions);
|
|
247
|
+
const { changed: premiumChatChanged } = this.compareQuotas(oldQuota.premiumChat, quotas.premiumChat);
|
|
248
|
+
if (chatChanged.exceeded || completionsChanged.exceeded || premiumChatChanged.exceeded) {
|
|
249
|
+
this._onDidChangeQuotaExceeded.fire();
|
|
250
|
+
}
|
|
251
|
+
if (chatChanged.remaining || completionsChanged.remaining || premiumChatChanged.remaining) {
|
|
252
|
+
this._onDidChangeQuotaRemaining.fire();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
compareQuotas(oldQuota, newQuota) {
|
|
256
|
+
return {
|
|
257
|
+
changed: {
|
|
258
|
+
exceeded: (oldQuota?.percentRemaining === 0) !== (newQuota?.percentRemaining === 0),
|
|
259
|
+
remaining: oldQuota?.percentRemaining !== newQuota?.percentRemaining
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
clearQuotas() {
|
|
264
|
+
this.acceptQuotas({});
|
|
265
|
+
}
|
|
266
|
+
updateContextKeys() {
|
|
267
|
+
this.chatQuotaExceededContextKey.set(this._quotas.chat?.percentRemaining === 0);
|
|
268
|
+
this.completionsQuotaExceededContextKey.set(this._quotas.completions?.percentRemaining === 0);
|
|
269
|
+
}
|
|
270
|
+
get sentiment() {
|
|
271
|
+
return {
|
|
272
|
+
installed: this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Setup.installed.key) === true,
|
|
273
|
+
hidden: this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Setup.hidden.key) === true,
|
|
274
|
+
disabled: this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Setup.disabled.key) === true,
|
|
275
|
+
untrusted: this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Setup.untrusted.key) === true,
|
|
276
|
+
later: this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Setup.later.key) === true,
|
|
277
|
+
registered: this.contextKeyService.getContextKeyValue(ChatEntitlementContextKeys.Setup.registered.key) === true
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
get anonymous() {
|
|
281
|
+
return isAnonymous(this.configurationService, this.entitlement, this.sentiment);
|
|
282
|
+
}
|
|
283
|
+
async update(token) {
|
|
284
|
+
await this.requests?.value.forceResolveEntitlement(undefined, token);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
ChatEntitlementService = ( __decorate([
|
|
288
|
+
( __param(0, IInstantiationService)),
|
|
289
|
+
( __param(1, IProductService)),
|
|
290
|
+
( __param(2, IWorkbenchEnvironmentService)),
|
|
291
|
+
( __param(3, IContextKeyService)),
|
|
292
|
+
( __param(4, IConfigurationService))
|
|
293
|
+
], ChatEntitlementService));
|
|
294
|
+
let ChatEntitlementRequests = ChatEntitlementRequests_1 = class ChatEntitlementRequests extends Disposable {
|
|
295
|
+
static providerId(configurationService) {
|
|
296
|
+
if (configurationService.getValue(`${defaultChat.completionsAdvancedSetting}.authProvider`) === defaultChat.provider.enterprise.id) {
|
|
297
|
+
return defaultChat.provider.enterprise.id;
|
|
298
|
+
}
|
|
299
|
+
return defaultChat.provider.default.id;
|
|
300
|
+
}
|
|
301
|
+
constructor(context, chatQuotasAccessor, telemetryService, authenticationService, logService, requestService, dialogService, openerService, configurationService, authenticationExtensionsService, lifecycleService) {
|
|
302
|
+
super();
|
|
303
|
+
this.context = context;
|
|
304
|
+
this.chatQuotasAccessor = chatQuotasAccessor;
|
|
305
|
+
this.telemetryService = telemetryService;
|
|
306
|
+
this.authenticationService = authenticationService;
|
|
307
|
+
this.logService = logService;
|
|
308
|
+
this.requestService = requestService;
|
|
309
|
+
this.dialogService = dialogService;
|
|
310
|
+
this.openerService = openerService;
|
|
311
|
+
this.configurationService = configurationService;
|
|
312
|
+
this.authenticationExtensionsService = authenticationExtensionsService;
|
|
313
|
+
this.lifecycleService = lifecycleService;
|
|
314
|
+
this.pendingResolveCts = ( new CancellationTokenSource());
|
|
315
|
+
this.didResolveEntitlements = false;
|
|
316
|
+
this.state = { entitlement: this.context.state.entitlement };
|
|
317
|
+
this.registerListeners();
|
|
318
|
+
this.resolve();
|
|
319
|
+
}
|
|
320
|
+
registerListeners() {
|
|
321
|
+
this._register(this.authenticationService.onDidChangeDeclaredProviders(() => this.resolve()));
|
|
322
|
+
this._register(this.authenticationService.onDidChangeSessions(e => {
|
|
323
|
+
if (e.providerId === ChatEntitlementRequests_1.providerId(this.configurationService)) {
|
|
324
|
+
this.resolve();
|
|
325
|
+
}
|
|
326
|
+
}));
|
|
327
|
+
this._register(this.authenticationService.onDidRegisterAuthenticationProvider(e => {
|
|
328
|
+
if (e.id === ChatEntitlementRequests_1.providerId(this.configurationService)) {
|
|
329
|
+
this.resolve();
|
|
330
|
+
}
|
|
331
|
+
}));
|
|
332
|
+
this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(e => {
|
|
333
|
+
if (e.id === ChatEntitlementRequests_1.providerId(this.configurationService)) {
|
|
334
|
+
this.resolve();
|
|
335
|
+
}
|
|
336
|
+
}));
|
|
337
|
+
this._register(this.context.onDidChange(() => {
|
|
338
|
+
if (!this.context.state.installed || this.context.state.disabled || this.context.state.entitlement === ChatEntitlement.Unknown) {
|
|
339
|
+
this.state = { entitlement: this.state.entitlement, quotas: undefined };
|
|
340
|
+
this.chatQuotasAccessor.clearQuotas();
|
|
341
|
+
}
|
|
342
|
+
}));
|
|
343
|
+
}
|
|
344
|
+
async resolve() {
|
|
345
|
+
this.pendingResolveCts.dispose(true);
|
|
346
|
+
const cts = this.pendingResolveCts = ( new CancellationTokenSource());
|
|
347
|
+
const session = await this.findMatchingProviderSession(cts.token);
|
|
348
|
+
if (cts.token.isCancellationRequested) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
let state = undefined;
|
|
352
|
+
if (session) {
|
|
353
|
+
if (this.state.entitlement === ChatEntitlement.Unknown) {
|
|
354
|
+
state = { entitlement: ChatEntitlement.Unresolved };
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
this.didResolveEntitlements = false;
|
|
359
|
+
state = { entitlement: ChatEntitlement.Unknown };
|
|
360
|
+
}
|
|
361
|
+
if (state) {
|
|
362
|
+
this.update(state);
|
|
363
|
+
}
|
|
364
|
+
if (session && !this.didResolveEntitlements) {
|
|
365
|
+
await this.resolveEntitlement(session, cts.token);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
async findMatchingProviderSession(token) {
|
|
369
|
+
const sessions = await this.doGetSessions(ChatEntitlementRequests_1.providerId(this.configurationService));
|
|
370
|
+
if (token.isCancellationRequested) {
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
373
|
+
const matchingSessions = ( new Set());
|
|
374
|
+
for (const session of sessions) {
|
|
375
|
+
for (const scopes of defaultChat.providerScopes) {
|
|
376
|
+
if (this.includesScopes(session.scopes, scopes)) {
|
|
377
|
+
matchingSessions.add(session);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return matchingSessions.size > 0 ? Array.from(matchingSessions) : undefined;
|
|
382
|
+
}
|
|
383
|
+
async doGetSessions(providerId) {
|
|
384
|
+
const preferredAccountName = this.authenticationExtensionsService.getAccountPreference(defaultChat.chatExtensionId, providerId) ?? this.authenticationExtensionsService.getAccountPreference(defaultChat.extensionId, providerId);
|
|
385
|
+
let preferredAccount;
|
|
386
|
+
for (const account of await this.authenticationService.getAccounts(providerId)) {
|
|
387
|
+
if (account.label === preferredAccountName) {
|
|
388
|
+
preferredAccount = account;
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
return await this.authenticationService.getSessions(providerId, undefined, { account: preferredAccount });
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
}
|
|
397
|
+
return [];
|
|
398
|
+
}
|
|
399
|
+
includesScopes(scopes, expectedScopes) {
|
|
400
|
+
return expectedScopes.every(scope => scopes.includes(scope));
|
|
401
|
+
}
|
|
402
|
+
async resolveEntitlement(sessions, token) {
|
|
403
|
+
const entitlements = await this.doResolveEntitlement(sessions, token);
|
|
404
|
+
if (typeof entitlements?.entitlement === 'number' && !token.isCancellationRequested) {
|
|
405
|
+
this.didResolveEntitlements = true;
|
|
406
|
+
this.update(entitlements);
|
|
407
|
+
}
|
|
408
|
+
return entitlements;
|
|
409
|
+
}
|
|
410
|
+
async doResolveEntitlement(sessions, token) {
|
|
411
|
+
if (token.isCancellationRequested) {
|
|
412
|
+
return undefined;
|
|
413
|
+
}
|
|
414
|
+
const response = await this.request(this.getEntitlementUrl(), 'GET', undefined, sessions, token);
|
|
415
|
+
if (token.isCancellationRequested) {
|
|
416
|
+
return undefined;
|
|
417
|
+
}
|
|
418
|
+
if (!response) {
|
|
419
|
+
this.logService.trace('[chat entitlement]: no response');
|
|
420
|
+
return { entitlement: ChatEntitlement.Unresolved };
|
|
421
|
+
}
|
|
422
|
+
if (response.res.statusCode && response.res.statusCode !== 200) {
|
|
423
|
+
this.logService.trace(`[chat entitlement]: unexpected status code ${response.res.statusCode}`);
|
|
424
|
+
return ((
|
|
425
|
+
response.res.statusCode === 401 || response.res.statusCode === 404)
|
|
426
|
+
) ? { entitlement: ChatEntitlement.Unknown } : { entitlement: ChatEntitlement.Unresolved };
|
|
427
|
+
}
|
|
428
|
+
let responseText = null;
|
|
429
|
+
try {
|
|
430
|
+
responseText = await asText(response);
|
|
431
|
+
}
|
|
432
|
+
catch (error) {
|
|
433
|
+
}
|
|
434
|
+
if (token.isCancellationRequested) {
|
|
435
|
+
return undefined;
|
|
436
|
+
}
|
|
437
|
+
if (!responseText) {
|
|
438
|
+
this.logService.trace('[chat entitlement]: response has no content');
|
|
439
|
+
return { entitlement: ChatEntitlement.Unresolved };
|
|
440
|
+
}
|
|
441
|
+
let entitlementsResponse;
|
|
442
|
+
try {
|
|
443
|
+
entitlementsResponse = JSON.parse(responseText);
|
|
444
|
+
this.logService.trace(`[chat entitlement]: parsed result is ${JSON.stringify(entitlementsResponse)}`);
|
|
445
|
+
}
|
|
446
|
+
catch (err) {
|
|
447
|
+
this.logService.trace(`[chat entitlement]: error parsing response (${err})`);
|
|
448
|
+
return { entitlement: ChatEntitlement.Unresolved };
|
|
449
|
+
}
|
|
450
|
+
let entitlement;
|
|
451
|
+
if (entitlementsResponse.access_type_sku === 'free_limited_copilot') {
|
|
452
|
+
entitlement = ChatEntitlement.Free;
|
|
453
|
+
}
|
|
454
|
+
else if (entitlementsResponse.can_signup_for_limited) {
|
|
455
|
+
entitlement = ChatEntitlement.Available;
|
|
456
|
+
}
|
|
457
|
+
else if (entitlementsResponse.copilot_plan === 'individual') {
|
|
458
|
+
entitlement = ChatEntitlement.Pro;
|
|
459
|
+
}
|
|
460
|
+
else if (entitlementsResponse.copilot_plan === 'individual_pro') {
|
|
461
|
+
entitlement = ChatEntitlement.ProPlus;
|
|
462
|
+
}
|
|
463
|
+
else if (entitlementsResponse.copilot_plan === 'business') {
|
|
464
|
+
entitlement = ChatEntitlement.Business;
|
|
465
|
+
}
|
|
466
|
+
else if (entitlementsResponse.copilot_plan === 'enterprise') {
|
|
467
|
+
entitlement = ChatEntitlement.Enterprise;
|
|
468
|
+
}
|
|
469
|
+
else if (entitlementsResponse.chat_enabled) {
|
|
470
|
+
entitlement = ChatEntitlement.Pro;
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
entitlement = ChatEntitlement.Unavailable;
|
|
474
|
+
}
|
|
475
|
+
const entitlements = {
|
|
476
|
+
entitlement,
|
|
477
|
+
organisations: entitlementsResponse.organization_login_list,
|
|
478
|
+
quotas: this.toQuotas(entitlementsResponse),
|
|
479
|
+
sku: entitlementsResponse.access_type_sku
|
|
480
|
+
};
|
|
481
|
+
this.logService.trace(`[chat entitlement]: resolved to ${entitlements.entitlement}, quotas: ${JSON.stringify(entitlements.quotas)}`);
|
|
482
|
+
this.telemetryService.publicLog2('chatInstallEntitlement', {
|
|
483
|
+
entitlement: entitlements.entitlement,
|
|
484
|
+
tid: entitlementsResponse.analytics_tracking_id,
|
|
485
|
+
sku: entitlements.sku,
|
|
486
|
+
quotaChat: entitlements.quotas?.chat?.remaining,
|
|
487
|
+
quotaPremiumChat: entitlements.quotas?.premiumChat?.remaining,
|
|
488
|
+
quotaCompletions: entitlements.quotas?.completions?.remaining,
|
|
489
|
+
quotaResetDate: entitlements.quotas?.resetDate
|
|
490
|
+
});
|
|
491
|
+
return entitlements;
|
|
492
|
+
}
|
|
493
|
+
getEntitlementUrl() {
|
|
494
|
+
if (ChatEntitlementRequests_1.providerId(this.configurationService) === defaultChat.provider.enterprise.id) {
|
|
495
|
+
try {
|
|
496
|
+
const enterpriseUrl = ( new URL(this.configurationService.getValue(defaultChat.providerUriSetting)));
|
|
497
|
+
return `${enterpriseUrl.protocol}//api.${enterpriseUrl.hostname}${enterpriseUrl.port ? ':' + enterpriseUrl.port : ''}/copilot_internal/user`;
|
|
498
|
+
}
|
|
499
|
+
catch (error) {
|
|
500
|
+
this.logService.error(error);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return defaultChat.entitlementUrl;
|
|
504
|
+
}
|
|
505
|
+
toQuotas(response) {
|
|
506
|
+
const quotas = {
|
|
507
|
+
resetDate: response.quota_reset_date_utc ?? response.quota_reset_date ?? response.limited_user_reset_date,
|
|
508
|
+
resetDateHasTime: typeof response.quota_reset_date_utc === 'string',
|
|
509
|
+
};
|
|
510
|
+
if (response.monthly_quotas?.chat && typeof response.limited_user_quotas?.chat === 'number') {
|
|
511
|
+
quotas.chat = {
|
|
512
|
+
total: response.monthly_quotas.chat,
|
|
513
|
+
remaining: response.limited_user_quotas.chat,
|
|
514
|
+
percentRemaining: Math.min(100, Math.max(0, (response.limited_user_quotas.chat / response.monthly_quotas.chat) * 100)),
|
|
515
|
+
overageEnabled: false,
|
|
516
|
+
overageCount: 0,
|
|
517
|
+
unlimited: false
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
if (response.monthly_quotas?.completions && typeof response.limited_user_quotas?.completions === 'number') {
|
|
521
|
+
quotas.completions = {
|
|
522
|
+
total: response.monthly_quotas.completions,
|
|
523
|
+
remaining: response.limited_user_quotas.completions,
|
|
524
|
+
percentRemaining: Math.min(100, Math.max(0, (response.limited_user_quotas.completions / response.monthly_quotas.completions) * 100)),
|
|
525
|
+
overageEnabled: false,
|
|
526
|
+
overageCount: 0,
|
|
527
|
+
unlimited: false
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
if (response.quota_snapshots) {
|
|
531
|
+
for (const quotaType of ['chat', 'completions', 'premium_interactions']) {
|
|
532
|
+
const rawQuotaSnapshot = response.quota_snapshots[quotaType];
|
|
533
|
+
if (!rawQuotaSnapshot) {
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
const quotaSnapshot = {
|
|
537
|
+
total: rawQuotaSnapshot.entitlement,
|
|
538
|
+
remaining: rawQuotaSnapshot.remaining,
|
|
539
|
+
percentRemaining: Math.min(100, Math.max(0, rawQuotaSnapshot.percent_remaining)),
|
|
540
|
+
overageEnabled: rawQuotaSnapshot.overage_permitted,
|
|
541
|
+
overageCount: rawQuotaSnapshot.overage_count,
|
|
542
|
+
unlimited: rawQuotaSnapshot.unlimited
|
|
543
|
+
};
|
|
544
|
+
switch (quotaType) {
|
|
545
|
+
case 'chat':
|
|
546
|
+
quotas.chat = quotaSnapshot;
|
|
547
|
+
break;
|
|
548
|
+
case 'completions':
|
|
549
|
+
quotas.completions = quotaSnapshot;
|
|
550
|
+
break;
|
|
551
|
+
case 'premium_interactions':
|
|
552
|
+
quotas.premiumChat = quotaSnapshot;
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return quotas;
|
|
558
|
+
}
|
|
559
|
+
async request(url, type, body, sessions, token) {
|
|
560
|
+
let lastRequest;
|
|
561
|
+
for (const session of sessions) {
|
|
562
|
+
if (token.isCancellationRequested) {
|
|
563
|
+
return lastRequest;
|
|
564
|
+
}
|
|
565
|
+
try {
|
|
566
|
+
const response = await this.requestService.request({
|
|
567
|
+
type,
|
|
568
|
+
url,
|
|
569
|
+
data: type === 'POST' ? JSON.stringify(body) : undefined,
|
|
570
|
+
disableCache: true,
|
|
571
|
+
headers: {
|
|
572
|
+
'Authorization': `Bearer ${session.accessToken}`
|
|
573
|
+
}
|
|
574
|
+
}, token);
|
|
575
|
+
const status = response.res.statusCode;
|
|
576
|
+
if (status && status !== 200) {
|
|
577
|
+
lastRequest = response;
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
return response;
|
|
581
|
+
}
|
|
582
|
+
catch (error) {
|
|
583
|
+
if (!token.isCancellationRequested) {
|
|
584
|
+
this.logService.error(`[chat entitlement] request: error ${error}`);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return lastRequest;
|
|
589
|
+
}
|
|
590
|
+
update(state) {
|
|
591
|
+
this.state = state;
|
|
592
|
+
this.context.update({ entitlement: this.state.entitlement, organisations: this.state.organisations, sku: this.state.sku });
|
|
593
|
+
if (state.quotas) {
|
|
594
|
+
this.chatQuotasAccessor.acceptQuotas(state.quotas);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
async forceResolveEntitlement(sessions, token = CancellationToken.None) {
|
|
598
|
+
if (!sessions) {
|
|
599
|
+
sessions = await this.findMatchingProviderSession(token);
|
|
600
|
+
}
|
|
601
|
+
if (!sessions || sessions.length === 0) {
|
|
602
|
+
return undefined;
|
|
603
|
+
}
|
|
604
|
+
return this.resolveEntitlement(sessions, token);
|
|
605
|
+
}
|
|
606
|
+
async signUpFree(sessions) {
|
|
607
|
+
const body = {
|
|
608
|
+
restricted_telemetry: this.telemetryService.telemetryLevel === TelemetryLevel.NONE ? 'disabled' : 'enabled',
|
|
609
|
+
public_code_suggestions: 'enabled'
|
|
610
|
+
};
|
|
611
|
+
const response = await this.request(defaultChat.entitlementSignupLimitedUrl, 'POST', body, sessions, CancellationToken.None);
|
|
612
|
+
if (!response) {
|
|
613
|
+
const retry = await this.onUnknownSignUpError(( localize(13212, "No response received.")), '[chat entitlement] sign-up: no response');
|
|
614
|
+
return retry ? this.signUpFree(sessions) : { errorCode: 1 };
|
|
615
|
+
}
|
|
616
|
+
if (response.res.statusCode && response.res.statusCode !== 200) {
|
|
617
|
+
if (response.res.statusCode === 422) {
|
|
618
|
+
try {
|
|
619
|
+
const responseText = await asText(response);
|
|
620
|
+
if (responseText) {
|
|
621
|
+
const responseError = JSON.parse(responseText);
|
|
622
|
+
if (typeof responseError.message === 'string' && responseError.message) {
|
|
623
|
+
this.onUnprocessableSignUpError(`[chat entitlement] sign-up: unprocessable entity (${responseError.message})`, responseError.message);
|
|
624
|
+
return { errorCode: response.res.statusCode };
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
catch (error) {
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
const retry = await this.onUnknownSignUpError(( localize(13213, "Unexpected status code {0}.", response.res.statusCode)), `[chat entitlement] sign-up: unexpected status code ${response.res.statusCode}`);
|
|
632
|
+
return retry ? this.signUpFree(sessions) : { errorCode: response.res.statusCode };
|
|
633
|
+
}
|
|
634
|
+
let responseText = null;
|
|
635
|
+
try {
|
|
636
|
+
responseText = await asText(response);
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
}
|
|
640
|
+
if (!responseText) {
|
|
641
|
+
const retry = await this.onUnknownSignUpError(( localize(13214, "Response has no contents.")), '[chat entitlement] sign-up: response has no content');
|
|
642
|
+
return retry ? this.signUpFree(sessions) : { errorCode: 2 };
|
|
643
|
+
}
|
|
644
|
+
let parsedResult = undefined;
|
|
645
|
+
try {
|
|
646
|
+
parsedResult = JSON.parse(responseText);
|
|
647
|
+
this.logService.trace(`[chat entitlement] sign-up: response is ${responseText}`);
|
|
648
|
+
}
|
|
649
|
+
catch (err) {
|
|
650
|
+
const retry = await this.onUnknownSignUpError(( localize(13215, "Invalid response contents.")), `[chat entitlement] sign-up: error parsing response (${err})`);
|
|
651
|
+
return retry ? this.signUpFree(sessions) : { errorCode: 3 };
|
|
652
|
+
}
|
|
653
|
+
this.update({ entitlement: ChatEntitlement.Free });
|
|
654
|
+
return Boolean(parsedResult?.subscribed);
|
|
655
|
+
}
|
|
656
|
+
async onUnknownSignUpError(detail, logMessage) {
|
|
657
|
+
this.logService.error(logMessage);
|
|
658
|
+
if (!this.lifecycleService.willShutdown) {
|
|
659
|
+
const { confirmed } = await this.dialogService.confirm({
|
|
660
|
+
type: Severity$1.Error,
|
|
661
|
+
message: ( localize(
|
|
662
|
+
13216,
|
|
663
|
+
"An error occurred while signing up for the GitHub Copilot Free plan. Would you like to try again?"
|
|
664
|
+
)),
|
|
665
|
+
detail,
|
|
666
|
+
primaryButton: ( localize(13217, "Retry"))
|
|
667
|
+
});
|
|
668
|
+
return confirmed;
|
|
669
|
+
}
|
|
670
|
+
return false;
|
|
671
|
+
}
|
|
672
|
+
onUnprocessableSignUpError(logMessage, logDetails) {
|
|
673
|
+
this.logService.error(logMessage);
|
|
674
|
+
if (!this.lifecycleService.willShutdown) {
|
|
675
|
+
this.dialogService.prompt({
|
|
676
|
+
type: Severity$1.Error,
|
|
677
|
+
message: ( localize(
|
|
678
|
+
13218,
|
|
679
|
+
"An error occurred while signing up for the GitHub Copilot Free plan."
|
|
680
|
+
)),
|
|
681
|
+
detail: logDetails,
|
|
682
|
+
buttons: [
|
|
683
|
+
{
|
|
684
|
+
label: ( localize(13219, "OK")),
|
|
685
|
+
run: () => { }
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
label: ( localize(13220, "Learn More")),
|
|
689
|
+
run: () => this.openerService.open(( URI.parse(defaultChat.upgradePlanUrl)))
|
|
690
|
+
}
|
|
691
|
+
]
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
async signIn(options) {
|
|
696
|
+
const providerId = ChatEntitlementRequests_1.providerId(this.configurationService);
|
|
697
|
+
const scopes = options?.additionalScopes ? distinct([...defaultChat.providerScopes[0], ...options.additionalScopes]) : defaultChat.providerScopes[0];
|
|
698
|
+
const session = await this.authenticationService.createSession(providerId, scopes, {
|
|
699
|
+
extraAuthorizeParameters: { get_started_with: 'copilot-vscode' },
|
|
700
|
+
provider: options?.useSocialProvider
|
|
701
|
+
});
|
|
702
|
+
this.authenticationExtensionsService.updateAccountPreference(defaultChat.extensionId, providerId, session.account);
|
|
703
|
+
this.authenticationExtensionsService.updateAccountPreference(defaultChat.chatExtensionId, providerId, session.account);
|
|
704
|
+
const entitlements = await this.forceResolveEntitlement([session]);
|
|
705
|
+
return { session, entitlements };
|
|
706
|
+
}
|
|
707
|
+
dispose() {
|
|
708
|
+
this.pendingResolveCts.dispose(true);
|
|
709
|
+
super.dispose();
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
ChatEntitlementRequests = ChatEntitlementRequests_1 = ( __decorate([
|
|
713
|
+
( __param(2, ITelemetryService)),
|
|
714
|
+
( __param(3, IAuthenticationService)),
|
|
715
|
+
( __param(4, ILogService)),
|
|
716
|
+
( __param(5, IRequestService)),
|
|
717
|
+
( __param(6, IDialogService)),
|
|
718
|
+
( __param(7, IOpenerService)),
|
|
719
|
+
( __param(8, IConfigurationService)),
|
|
720
|
+
( __param(9, IAuthenticationExtensionsService)),
|
|
721
|
+
( __param(10, ILifecycleService))
|
|
722
|
+
], ChatEntitlementRequests));
|
|
723
|
+
let ChatEntitlementContext = class ChatEntitlementContext extends Disposable {
|
|
724
|
+
static { ChatEntitlementContext_1 = this; }
|
|
725
|
+
static { this.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY = 'chat.setupContext'; }
|
|
726
|
+
static { this.CHAT_DISABLED_CONFIGURATION_KEY = 'chat.disableAIFeatures'; }
|
|
727
|
+
get state() { return this.withConfiguration(this.suspendedState ?? this._state); }
|
|
728
|
+
constructor(contextKeyService, storageService, logService, configurationService, telemetryService) {
|
|
729
|
+
super();
|
|
730
|
+
this.storageService = storageService;
|
|
731
|
+
this.logService = logService;
|
|
732
|
+
this.configurationService = configurationService;
|
|
733
|
+
this.telemetryService = telemetryService;
|
|
734
|
+
this.suspendedState = undefined;
|
|
735
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
736
|
+
this.onDidChange = this._onDidChange.event;
|
|
737
|
+
this.updateBarrier = undefined;
|
|
738
|
+
this.canSignUpContextKey = ChatEntitlementContextKeys.Entitlement.canSignUp.bindTo(contextKeyService);
|
|
739
|
+
this.signedOutContextKey = ChatEntitlementContextKeys.Entitlement.signedOut.bindTo(contextKeyService);
|
|
740
|
+
this.freeContextKey = ChatEntitlementContextKeys.Entitlement.planFree.bindTo(contextKeyService);
|
|
741
|
+
this.proContextKey = ChatEntitlementContextKeys.Entitlement.planPro.bindTo(contextKeyService);
|
|
742
|
+
this.proPlusContextKey = ChatEntitlementContextKeys.Entitlement.planProPlus.bindTo(contextKeyService);
|
|
743
|
+
this.businessContextKey = ChatEntitlementContextKeys.Entitlement.planBusiness.bindTo(contextKeyService);
|
|
744
|
+
this.enterpriseContextKey = ChatEntitlementContextKeys.Entitlement.planEnterprise.bindTo(contextKeyService);
|
|
745
|
+
this.organisationsContextKey = ChatEntitlementContextKeys.Entitlement.organisations.bindTo(contextKeyService);
|
|
746
|
+
this.isInternalContextKey = ChatEntitlementContextKeys.Entitlement.internal.bindTo(contextKeyService);
|
|
747
|
+
this.skuContextKey = ChatEntitlementContextKeys.Entitlement.sku.bindTo(contextKeyService);
|
|
748
|
+
this.hiddenContext = ChatEntitlementContextKeys.Setup.hidden.bindTo(contextKeyService);
|
|
749
|
+
this.laterContext = ChatEntitlementContextKeys.Setup.later.bindTo(contextKeyService);
|
|
750
|
+
this.installedContext = ChatEntitlementContextKeys.Setup.installed.bindTo(contextKeyService);
|
|
751
|
+
this.disabledContext = ChatEntitlementContextKeys.Setup.disabled.bindTo(contextKeyService);
|
|
752
|
+
this.untrustedContext = ChatEntitlementContextKeys.Setup.untrusted.bindTo(contextKeyService);
|
|
753
|
+
this.registeredContext = ChatEntitlementContextKeys.Setup.registered.bindTo(contextKeyService);
|
|
754
|
+
this._state = this.storageService.getObject(ChatEntitlementContext_1.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY, StorageScope.PROFILE) ?? { entitlement: ChatEntitlement.Unknown, organisations: undefined, sku: undefined };
|
|
755
|
+
this.updateContextSync();
|
|
756
|
+
this.registerListeners();
|
|
757
|
+
}
|
|
758
|
+
registerListeners() {
|
|
759
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
760
|
+
if (e.affectsConfiguration(ChatEntitlementContext_1.CHAT_DISABLED_CONFIGURATION_KEY)) {
|
|
761
|
+
this.updateContext();
|
|
762
|
+
}
|
|
763
|
+
}));
|
|
764
|
+
}
|
|
765
|
+
withConfiguration(state) {
|
|
766
|
+
if (this.configurationService.getValue(ChatEntitlementContext_1.CHAT_DISABLED_CONFIGURATION_KEY) === true) {
|
|
767
|
+
return {
|
|
768
|
+
...state,
|
|
769
|
+
hidden: true
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
return state;
|
|
773
|
+
}
|
|
774
|
+
async update(context) {
|
|
775
|
+
this.logService.trace(`[chat entitlement context] update(): ${JSON.stringify(context)}`);
|
|
776
|
+
const oldState = JSON.stringify(this._state);
|
|
777
|
+
if (typeof context.installed === 'boolean' && typeof context.disabled === 'boolean' && typeof context.untrusted === 'boolean') {
|
|
778
|
+
this._state.installed = context.installed;
|
|
779
|
+
this._state.disabled = context.disabled;
|
|
780
|
+
this._state.untrusted = context.untrusted;
|
|
781
|
+
if (context.installed && !context.disabled) {
|
|
782
|
+
context.hidden = false;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
if (typeof context.hidden === 'boolean') {
|
|
786
|
+
this._state.hidden = context.hidden;
|
|
787
|
+
}
|
|
788
|
+
if (typeof context.later === 'boolean') {
|
|
789
|
+
this._state.later = context.later;
|
|
790
|
+
}
|
|
791
|
+
if (typeof context.entitlement === 'number') {
|
|
792
|
+
this._state.entitlement = context.entitlement;
|
|
793
|
+
this._state.organisations = context.organisations;
|
|
794
|
+
this._state.sku = context.sku;
|
|
795
|
+
if (this._state.entitlement === ChatEntitlement.Free || isProUser(this._state.entitlement)) {
|
|
796
|
+
this._state.registered = true;
|
|
797
|
+
}
|
|
798
|
+
else if (this._state.entitlement === ChatEntitlement.Available) {
|
|
799
|
+
this._state.registered = false;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
if (oldState === JSON.stringify(this._state)) {
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
this.storageService.store(ChatEntitlementContext_1.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY, {
|
|
806
|
+
...this._state,
|
|
807
|
+
later: undefined
|
|
808
|
+
}, StorageScope.PROFILE, StorageTarget.MACHINE);
|
|
809
|
+
return this.updateContext();
|
|
810
|
+
}
|
|
811
|
+
async updateContext() {
|
|
812
|
+
await this.updateBarrier?.wait();
|
|
813
|
+
this.updateContextSync();
|
|
814
|
+
}
|
|
815
|
+
updateContextSync() {
|
|
816
|
+
const state = this.withConfiguration(this._state);
|
|
817
|
+
this.signedOutContextKey.set(state.entitlement === ChatEntitlement.Unknown);
|
|
818
|
+
this.canSignUpContextKey.set(state.entitlement === ChatEntitlement.Available);
|
|
819
|
+
this.freeContextKey.set(state.entitlement === ChatEntitlement.Free);
|
|
820
|
+
this.proContextKey.set(state.entitlement === ChatEntitlement.Pro);
|
|
821
|
+
this.proPlusContextKey.set(state.entitlement === ChatEntitlement.ProPlus);
|
|
822
|
+
this.businessContextKey.set(state.entitlement === ChatEntitlement.Business);
|
|
823
|
+
this.enterpriseContextKey.set(state.entitlement === ChatEntitlement.Enterprise);
|
|
824
|
+
this.organisationsContextKey.set(state.organisations);
|
|
825
|
+
this.isInternalContextKey.set(Boolean(state.organisations?.some(org => org === 'github' || org === 'microsoft' || org === 'ms-copilot' || org === 'MicrosoftCopilot')));
|
|
826
|
+
this.skuContextKey.set(state.sku);
|
|
827
|
+
this.hiddenContext.set(!!state.hidden);
|
|
828
|
+
this.laterContext.set(!!state.later);
|
|
829
|
+
this.installedContext.set(!!state.installed);
|
|
830
|
+
this.disabledContext.set(!!state.disabled);
|
|
831
|
+
this.untrustedContext.set(!!state.untrusted);
|
|
832
|
+
this.registeredContext.set(!!state.registered);
|
|
833
|
+
this.logService.trace(`[chat entitlement context] updateContext(): ${JSON.stringify(state)}`);
|
|
834
|
+
this.telemetryService.publicLog2('chatEntitlements', {
|
|
835
|
+
chatHidden: Boolean(state.hidden),
|
|
836
|
+
chatDisabled: Boolean(state.disabled),
|
|
837
|
+
chatEntitlement: state.entitlement,
|
|
838
|
+
chatRegistered: Boolean(state.registered),
|
|
839
|
+
chatAnonymous: isAnonymous(this.configurationService, state.entitlement, state)
|
|
840
|
+
});
|
|
841
|
+
this._onDidChange.fire();
|
|
842
|
+
}
|
|
843
|
+
suspend() {
|
|
844
|
+
this.suspendedState = { ...this._state };
|
|
845
|
+
this.updateBarrier = ( new Barrier());
|
|
846
|
+
}
|
|
847
|
+
resume() {
|
|
848
|
+
this.suspendedState = undefined;
|
|
849
|
+
this.updateBarrier?.open();
|
|
850
|
+
this.updateBarrier = undefined;
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
ChatEntitlementContext = ChatEntitlementContext_1 = ( __decorate([
|
|
854
|
+
( __param(0, IContextKeyService)),
|
|
855
|
+
( __param(1, IStorageService)),
|
|
856
|
+
( __param(2, ILogService)),
|
|
857
|
+
( __param(3, IConfigurationService)),
|
|
858
|
+
( __param(4, ITelemetryService))
|
|
859
|
+
], ChatEntitlementContext));
|
|
860
|
+
|
|
861
|
+
export { ChatEntitlement, ChatEntitlementContext, ChatEntitlementContextKeys, ChatEntitlementRequests, ChatEntitlementService, isProUser };
|