@codingame/monaco-vscode-chat-service-override 14.0.6 → 15.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/index.js +14 -8
- package/package.json +20 -20
- package/vscode/src/vs/base/common/objectCache.d.ts +1 -1
- package/vscode/src/vs/base/common/objectCache.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +43 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +142 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +252 -260
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +8 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +12 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +31 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +151 -69
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +379 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/{chatEditingService.d.ts → chatEditingServiceImpl.d.ts} +12 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +423 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +38 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +16 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +93 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +21 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +101 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +146 -126
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +386 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +8 -91
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +7 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +45 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +11 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +78 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +12 -10
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +26 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +85 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -27
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.d.ts +4 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.js +15 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +175 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +12 -12
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +31 -36
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +0 -505
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +0 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +0 -871
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +0 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -245
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.d.ts +0 -39
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.js +0 -314
|
@@ -14,7 +14,7 @@ import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/comm
|
|
|
14
14
|
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
15
15
|
import { Disposable, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
16
16
|
import { MarkdownRenderer } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
17
|
-
import {
|
|
17
|
+
import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
18
18
|
import { Action2, MenuId, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
19
19
|
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
20
20
|
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
@@ -45,17 +45,17 @@ import { ProgressBadge } from '@codingame/monaco-vscode-a7c9ae3c-16d2-5d17-86b2-
|
|
|
45
45
|
import { IActivityService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity.service';
|
|
46
46
|
import { IAuthenticationService, IAuthenticationExtensionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
47
47
|
import { IWorkbenchExtensionEnablementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.service';
|
|
48
|
-
import { Parts } from '@codingame/monaco-vscode-
|
|
48
|
+
import { Parts } from '@codingame/monaco-vscode-81f603ca-d6ea-5402-90dd-3014dffc63b4-common/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
49
49
|
import { IWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
50
50
|
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
51
51
|
import { IExtensionsWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/common/extensions.service';
|
|
52
52
|
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
53
53
|
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
54
|
-
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-
|
|
55
|
-
import { showCopilotView, ensureSideBarChatViewSize, ChatViewId, preferCopilotEditsView, EditsViewId } from '@codingame/monaco-vscode-
|
|
56
|
-
import { CHAT_EDITING_SIDEBAR_PANEL_ID, CHAT_SIDEBAR_PANEL_ID } from '
|
|
57
|
-
import { ChatViewsWelcomeExtensions } from '@codingame/monaco-vscode-
|
|
58
|
-
import { IChatQuotasService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/
|
|
54
|
+
import { CHAT_CATEGORY, CHAT_SETUP_ACTION_LABEL, CHAT_SETUP_ACTION_ID } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
55
|
+
import { showCopilotView, ensureSideBarChatViewSize, ChatViewId, preferCopilotEditsView, EditsViewId } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
56
|
+
import { CHAT_EDITING_SIDEBAR_PANEL_ID, CHAT_SIDEBAR_PANEL_ID } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chatViewPane';
|
|
57
|
+
import { ChatViewsWelcomeExtensions } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome';
|
|
58
|
+
import { IChatQuotasService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatQuotasService.service';
|
|
59
59
|
import { mainWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/window';
|
|
60
60
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
61
61
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
@@ -72,6 +72,9 @@ import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platf
|
|
|
72
72
|
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
73
73
|
import { equalsIgnoreCase } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
74
74
|
import { IWorkbenchAssignmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/assignment/common/assignmentService.service';
|
|
75
|
+
import { ChatEntitlement } from '../common/chatEntitlementsService.js';
|
|
76
|
+
import { IChatEntitlementsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEntitlementsService.service';
|
|
77
|
+
import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
|
|
75
78
|
|
|
76
79
|
var ChatSetupRequests_1, ChatSetupContext_1;
|
|
77
80
|
const defaultChat = {
|
|
@@ -94,34 +97,44 @@ const defaultChat = {
|
|
|
94
97
|
entitlementSignupLimitedUrl: product.defaultChatAgent?.entitlementSignupLimitedUrl ?? '',
|
|
95
98
|
manageSettingsUrl: product.defaultChatAgent?.manageSettingsUrl ?? '',
|
|
96
99
|
};
|
|
97
|
-
|
|
98
|
-
(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
let ChatEntitlementsService = class ChatEntitlementsService extends Disposable {
|
|
101
|
+
constructor(instantiationService, productService, environmentService) {
|
|
102
|
+
super();
|
|
103
|
+
if (!productService.defaultChatAgent ||
|
|
104
|
+
(isWeb && !environmentService.remoteAuthority)
|
|
105
|
+
) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const context = this.context = ( new Lazy(
|
|
109
|
+
() => this._register(instantiationService.createInstance(ChatSetupContext))
|
|
110
|
+
));
|
|
111
|
+
this.requests = ( new Lazy(
|
|
112
|
+
() => this._register(instantiationService.createInstance(ChatSetupRequests, context.value))
|
|
113
|
+
));
|
|
114
|
+
}
|
|
115
|
+
async resolve(token) {
|
|
116
|
+
return this.requests?.value.forceResolveEntitlement(undefined, token);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
ChatEntitlementsService = ( __decorate([
|
|
120
|
+
( __param(0, IInstantiationService)),
|
|
121
|
+
( __param(1, IProductService)),
|
|
122
|
+
( __param(2, IWorkbenchEnvironmentService))
|
|
123
|
+
], ChatEntitlementsService));
|
|
108
124
|
let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
109
125
|
static { this.ID = 'workbench.chat.setup'; }
|
|
110
|
-
constructor(productService, instantiationService,
|
|
126
|
+
constructor(productService, instantiationService, commandService, telemetryService, experimentService, chatEntitlementsService) {
|
|
111
127
|
super();
|
|
112
128
|
this.productService = productService;
|
|
113
129
|
this.instantiationService = instantiationService;
|
|
114
|
-
this.environmentService = environmentService;
|
|
115
130
|
this.commandService = commandService;
|
|
116
131
|
this.telemetryService = telemetryService;
|
|
117
132
|
this.experimentService = experimentService;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
) {
|
|
133
|
+
const context = chatEntitlementsService.context?.value;
|
|
134
|
+
const requests = chatEntitlementsService.requests?.value;
|
|
135
|
+
if (!context || !requests) {
|
|
121
136
|
return;
|
|
122
137
|
}
|
|
123
|
-
const context = this._register(this.instantiationService.createInstance(ChatSetupContext));
|
|
124
|
-
const requests = this._register(this.instantiationService.createInstance(ChatSetupRequests, context));
|
|
125
138
|
const controller = ( new Lazy(
|
|
126
139
|
() => this._register(this.instantiationService.createInstance(ChatSetupController, context, requests))
|
|
127
140
|
));
|
|
@@ -132,7 +145,7 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
132
145
|
}
|
|
133
146
|
registerChatWelcome(controller, context) {
|
|
134
147
|
( Registry.as(ChatViewsWelcomeExtensions.ChatViewsWelcomeRegistry)).register({
|
|
135
|
-
title: ( localize(
|
|
148
|
+
title: ( localize(4672, "Welcome to Copilot")),
|
|
136
149
|
when: ChatContextKeys.SetupViewCondition,
|
|
137
150
|
icon: Codicon.copilotLarge,
|
|
138
151
|
content: disposables => disposables.add(this.instantiationService.createInstance(ChatSetupWelcomeContent, controller.value, context)).element,
|
|
@@ -143,13 +156,13 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
143
156
|
class ChatSetupTriggerAction extends Action2 {
|
|
144
157
|
constructor() {
|
|
145
158
|
super({
|
|
146
|
-
id:
|
|
147
|
-
title:
|
|
159
|
+
id: CHAT_SETUP_ACTION_ID,
|
|
160
|
+
title: CHAT_SETUP_ACTION_LABEL,
|
|
148
161
|
category: CHAT_CATEGORY,
|
|
149
162
|
f1: true,
|
|
150
163
|
precondition: chatSetupTriggerContext,
|
|
151
164
|
menu: {
|
|
152
|
-
id: MenuId.
|
|
165
|
+
id: MenuId.ChatTitleBarMenu,
|
|
153
166
|
group: 'a_last',
|
|
154
167
|
order: 1,
|
|
155
168
|
when: chatSetupTriggerContext
|
|
@@ -161,15 +174,17 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
161
174
|
const viewDescriptorService = accessor.get(IViewDescriptorService);
|
|
162
175
|
const configurationService = accessor.get(IConfigurationService);
|
|
163
176
|
const layoutService = accessor.get(IWorkbenchLayoutService);
|
|
177
|
+
const statusbarService = accessor.get(IStatusbarService);
|
|
164
178
|
await context.update({ hidden: false });
|
|
165
179
|
showCopilotView(viewsService, layoutService);
|
|
166
180
|
ensureSideBarChatViewSize(viewDescriptorService, layoutService, viewsService);
|
|
181
|
+
statusbarService.updateEntryVisibility('chat.statusBarEntry', true);
|
|
167
182
|
configurationService.updateValue('chat.commandCenter.enabled', true);
|
|
168
183
|
}
|
|
169
184
|
}
|
|
170
185
|
class ChatSetupHideAction extends Action2 {
|
|
171
186
|
static { this.ID = 'workbench.action.chat.hideSetup'; }
|
|
172
|
-
static { this.TITLE = ( localize2(
|
|
187
|
+
static { this.TITLE = ( localize2(4673, "Hide Copilot")); }
|
|
173
188
|
constructor() {
|
|
174
189
|
super({
|
|
175
190
|
id: ChatSetupHideAction.ID,
|
|
@@ -178,7 +193,7 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
178
193
|
category: CHAT_CATEGORY,
|
|
179
194
|
precondition: ( ChatContextKeys.Setup.installed.negate()),
|
|
180
195
|
menu: {
|
|
181
|
-
id: MenuId.
|
|
196
|
+
id: MenuId.ChatTitleBarMenu,
|
|
182
197
|
group: 'z_hide',
|
|
183
198
|
order: 1,
|
|
184
199
|
when: ( ChatContextKeys.Setup.installed.negate())
|
|
@@ -190,19 +205,28 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
190
205
|
const layoutService = accessor.get(IWorkbenchLayoutService);
|
|
191
206
|
const configurationService = accessor.get(IConfigurationService);
|
|
192
207
|
const dialogService = accessor.get(IDialogService);
|
|
208
|
+
const statusbarService = accessor.get(IStatusbarService);
|
|
193
209
|
const { confirmed } = await dialogService.confirm({
|
|
194
|
-
message: ( localize(
|
|
210
|
+
message: ( localize(4674, "Are you sure you want to hide Copilot?")),
|
|
195
211
|
detail: ( localize(
|
|
196
|
-
|
|
212
|
+
4675,
|
|
197
213
|
"You can restore Copilot by running the '{0}' command.",
|
|
198
|
-
|
|
214
|
+
CHAT_SETUP_ACTION_LABEL.value
|
|
199
215
|
)),
|
|
200
|
-
primaryButton: ( localize(
|
|
216
|
+
primaryButton: ( localize(4676, "Hide Copilot"))
|
|
201
217
|
});
|
|
202
218
|
if (!confirmed) {
|
|
203
219
|
return;
|
|
204
220
|
}
|
|
205
|
-
|
|
221
|
+
const location = viewsDescriptorService.getViewLocationById(ChatViewId);
|
|
222
|
+
await context.update({ hidden: true });
|
|
223
|
+
if (location === ViewContainerLocation.AuxiliaryBar) {
|
|
224
|
+
const activeContainers = viewsDescriptorService.getViewContainersByLocation(location).filter(container => viewsDescriptorService.getViewContainerModel(container).activeViewDescriptors.length > 0);
|
|
225
|
+
if (activeContainers.length === 0) {
|
|
226
|
+
layoutService.setPartHidden(true, Parts.AUXILIARYBAR_PART);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
statusbarService.updateEntryVisibility('chat.statusBarEntry', false);
|
|
206
230
|
configurationService.updateValue('chat.commandCenter.enabled', false);
|
|
207
231
|
}
|
|
208
232
|
}
|
|
@@ -211,12 +235,12 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
211
235
|
constructor() {
|
|
212
236
|
super({
|
|
213
237
|
id: 'workbench.action.chat.upgradePlan',
|
|
214
|
-
title: ( localize2(
|
|
215
|
-
category: ( localize2(
|
|
238
|
+
title: ( localize2(4677, "Upgrade to Copilot Pro")),
|
|
239
|
+
category: ( localize2(4678, 'Chat')),
|
|
216
240
|
f1: true,
|
|
217
241
|
precondition: ( ContextKeyExpr.or(ChatContextKeys.Setup.canSignUp, ChatContextKeys.Setup.limited)),
|
|
218
242
|
menu: {
|
|
219
|
-
id: MenuId.
|
|
243
|
+
id: MenuId.ChatTitleBarMenu,
|
|
220
244
|
group: 'a_first',
|
|
221
245
|
order: 1,
|
|
222
246
|
when: ( ContextKeyExpr.or(
|
|
@@ -241,23 +265,13 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
241
265
|
async onWindowFocus(focus, commandService) {
|
|
242
266
|
if (focus) {
|
|
243
267
|
windowFocusListener.clear();
|
|
244
|
-
const
|
|
245
|
-
if (entitlement === ChatEntitlement.Pro) {
|
|
268
|
+
const entitlements = await requests.forceResolveEntitlement(undefined);
|
|
269
|
+
if (entitlements?.entitlement === ChatEntitlement.Pro) {
|
|
246
270
|
refreshTokens(commandService);
|
|
247
271
|
}
|
|
248
272
|
}
|
|
249
273
|
}
|
|
250
274
|
}
|
|
251
|
-
async function hideSetupView(viewsDescriptorService, layoutService) {
|
|
252
|
-
const location = viewsDescriptorService.getViewLocationById(ChatViewId);
|
|
253
|
-
await context.update({ hidden: true });
|
|
254
|
-
if (location === ViewContainerLocation.AuxiliaryBar) {
|
|
255
|
-
const activeContainers = viewsDescriptorService.getViewContainersByLocation(location).filter(container => viewsDescriptorService.getViewContainerModel(container).activeViewDescriptors.length > 0);
|
|
256
|
-
if (activeContainers.length === 0) {
|
|
257
|
-
layoutService.setPartHidden(true, Parts.AUXILIARYBAR_PART);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
275
|
registerAction2(ChatSetupTriggerAction);
|
|
262
276
|
registerAction2(ChatSetupHideAction);
|
|
263
277
|
registerAction2(UpgradePlanAction);
|
|
@@ -269,8 +283,8 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
269
283
|
},
|
|
270
284
|
handleURL: async (url) => {
|
|
271
285
|
const params = ( new URLSearchParams(url.query));
|
|
272
|
-
this.telemetryService.publicLog2('workbenchActionExecuted', { id:
|
|
273
|
-
await this.commandService.executeCommand(
|
|
286
|
+
this.telemetryService.publicLog2('workbenchActionExecuted', { id: CHAT_SETUP_ACTION_ID, from: 'url', detail: params.get('referrer') ?? undefined });
|
|
287
|
+
await this.commandService.executeCommand(CHAT_SETUP_ACTION_ID);
|
|
274
288
|
return true;
|
|
275
289
|
}
|
|
276
290
|
}));
|
|
@@ -286,14 +300,14 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
286
300
|
const defaultValue = value ?? (context.state.entitlement === ChatEntitlement.Limited ? 5 : 15);
|
|
287
301
|
const node = {
|
|
288
302
|
id: 'chatSidebar',
|
|
289
|
-
title: ( localize(
|
|
303
|
+
title: ( localize(4679, "Chat")),
|
|
290
304
|
type: 'object',
|
|
291
305
|
properties: {
|
|
292
306
|
'chat.agent.maxRequests': {
|
|
293
307
|
type: 'number',
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
"The maximum number of requests to allow Copilot Edits to use in agent mode."
|
|
308
|
+
markdownDescription: ( localize(
|
|
309
|
+
4680,
|
|
310
|
+
"The maximum number of requests to allow Copilot Edits to use per-turn in agent mode. When the limit is reached, Copilot will ask the user to confirm that it should keep working. \n\n> **Note**: For users on the Copilot Free plan, note that each agent mode request currently uses one chat request."
|
|
297
311
|
)),
|
|
298
312
|
default: defaultValue,
|
|
299
313
|
tags: ['experimental']
|
|
@@ -310,10 +324,10 @@ let ChatSetupContribution = class ChatSetupContribution extends Disposable {
|
|
|
310
324
|
ChatSetupContribution = ( __decorate([
|
|
311
325
|
( __param(0, IProductService)),
|
|
312
326
|
( __param(1, IInstantiationService)),
|
|
313
|
-
( __param(2,
|
|
314
|
-
( __param(3,
|
|
315
|
-
( __param(4,
|
|
316
|
-
( __param(5,
|
|
327
|
+
( __param(2, ICommandService)),
|
|
328
|
+
( __param(3, ITelemetryService)),
|
|
329
|
+
( __param(4, IWorkbenchAssignmentService)),
|
|
330
|
+
( __param(5, IChatEntitlementsService))
|
|
317
331
|
], ChatSetupContribution));
|
|
318
332
|
let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Disposable {
|
|
319
333
|
static providerId(configurationService) {
|
|
@@ -418,7 +432,7 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
418
432
|
this.didResolveEntitlements = true;
|
|
419
433
|
this.update(entitlements);
|
|
420
434
|
}
|
|
421
|
-
return entitlements
|
|
435
|
+
return entitlements;
|
|
422
436
|
}
|
|
423
437
|
async doResolveEntitlement(session, token) {
|
|
424
438
|
if (ChatSetupRequests_1.providerId(this.configurationService) === defaultChat.enterpriseProviderId) {
|
|
@@ -478,8 +492,10 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
478
492
|
const entitlements = {
|
|
479
493
|
entitlement,
|
|
480
494
|
quotas: {
|
|
481
|
-
|
|
482
|
-
|
|
495
|
+
chatTotal: entitlementsResponse.monthly_quotas?.chat,
|
|
496
|
+
completionsTotal: entitlementsResponse.monthly_quotas?.completions,
|
|
497
|
+
chatRemaining: entitlementsResponse.limited_user_quotas?.chat,
|
|
498
|
+
completionsRemaining: entitlementsResponse.limited_user_quotas?.completions,
|
|
483
499
|
resetDate: entitlementsResponse.limited_user_reset_date
|
|
484
500
|
}
|
|
485
501
|
};
|
|
@@ -515,20 +531,24 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
515
531
|
this.context.update({ entitlement: this.state.entitlement });
|
|
516
532
|
if (state.quotas) {
|
|
517
533
|
this.chatQuotasService.acceptQuotas({
|
|
518
|
-
chatQuotaExceeded: typeof state.quotas.
|
|
519
|
-
completionsQuotaExceeded: typeof state.quotas.
|
|
520
|
-
quotaResetDate: state.quotas.resetDate ? ( new Date(state.quotas.resetDate)) : undefined
|
|
534
|
+
chatQuotaExceeded: typeof state.quotas.chatRemaining === 'number' ? state.quotas.chatRemaining <= 0 : false,
|
|
535
|
+
completionsQuotaExceeded: typeof state.quotas.completionsRemaining === 'number' ? state.quotas.completionsRemaining <= 0 : false,
|
|
536
|
+
quotaResetDate: state.quotas.resetDate ? ( new Date(state.quotas.resetDate)) : undefined,
|
|
537
|
+
chatTotal: state.quotas.chatTotal,
|
|
538
|
+
completionsTotal: state.quotas.completionsTotal,
|
|
539
|
+
chatRemaining: state.quotas.chatRemaining,
|
|
540
|
+
completionsRemaining: state.quotas.completionsRemaining
|
|
521
541
|
});
|
|
522
542
|
}
|
|
523
543
|
}
|
|
524
|
-
async forceResolveEntitlement(session) {
|
|
544
|
+
async forceResolveEntitlement(session, token = CancellationToken.None) {
|
|
525
545
|
if (!session) {
|
|
526
|
-
session = await this.findMatchingProviderSession(
|
|
546
|
+
session = await this.findMatchingProviderSession(token);
|
|
527
547
|
}
|
|
528
548
|
if (!session) {
|
|
529
549
|
return undefined;
|
|
530
550
|
}
|
|
531
|
-
return this.resolveEntitlement(session,
|
|
551
|
+
return this.resolveEntitlement(session, token);
|
|
532
552
|
}
|
|
533
553
|
async signUpLimited(session) {
|
|
534
554
|
const body = {
|
|
@@ -537,7 +557,7 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
537
557
|
};
|
|
538
558
|
const response = await this.request(defaultChat.entitlementSignupLimitedUrl, 'POST', body, session, CancellationToken.None);
|
|
539
559
|
if (!response) {
|
|
540
|
-
const retry = await this.onUnknownSignUpError(( localize(
|
|
560
|
+
const retry = await this.onUnknownSignUpError(( localize(4681, "No response received.")), '[chat setup] sign-up: no response');
|
|
541
561
|
return retry ? this.signUpLimited(session) : { errorCode: 1 };
|
|
542
562
|
}
|
|
543
563
|
if (response.res.statusCode && response.res.statusCode !== 200) {
|
|
@@ -555,7 +575,7 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
555
575
|
catch (error) {
|
|
556
576
|
}
|
|
557
577
|
}
|
|
558
|
-
const retry = await this.onUnknownSignUpError(( localize(
|
|
578
|
+
const retry = await this.onUnknownSignUpError(( localize(4682, "Unexpected status code {0}.", response.res.statusCode)), `[chat setup] sign-up: unexpected status code ${response.res.statusCode}`);
|
|
559
579
|
return retry ? this.signUpLimited(session) : { errorCode: response.res.statusCode };
|
|
560
580
|
}
|
|
561
581
|
let responseText = null;
|
|
@@ -565,7 +585,7 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
565
585
|
catch (error) {
|
|
566
586
|
}
|
|
567
587
|
if (!responseText) {
|
|
568
|
-
const retry = await this.onUnknownSignUpError(( localize(
|
|
588
|
+
const retry = await this.onUnknownSignUpError(( localize(4683, "Response has no contents.")), '[chat setup] sign-up: response has no content');
|
|
569
589
|
return retry ? this.signUpLimited(session) : { errorCode: 2 };
|
|
570
590
|
}
|
|
571
591
|
let parsedResult = undefined;
|
|
@@ -574,7 +594,7 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
574
594
|
this.logService.trace(`[chat setup] sign-up: response is ${responseText}`);
|
|
575
595
|
}
|
|
576
596
|
catch (err) {
|
|
577
|
-
const retry = await this.onUnknownSignUpError(( localize(
|
|
597
|
+
const retry = await this.onUnknownSignUpError(( localize(4684, "Invalid response contents.")), `[chat setup] sign-up: error parsing response (${err})`);
|
|
578
598
|
return retry ? this.signUpLimited(session) : { errorCode: 3 };
|
|
579
599
|
}
|
|
580
600
|
this.update({ entitlement: ChatEntitlement.Limited });
|
|
@@ -585,11 +605,11 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
585
605
|
const { confirmed } = await this.dialogService.confirm({
|
|
586
606
|
type: Severity.Error,
|
|
587
607
|
message: ( localize(
|
|
588
|
-
|
|
608
|
+
4685,
|
|
589
609
|
"An error occurred while signing up for Copilot Free. Would you like to try again?"
|
|
590
610
|
)),
|
|
591
611
|
detail,
|
|
592
|
-
primaryButton: ( localize(
|
|
612
|
+
primaryButton: ( localize(4686, "Retry"))
|
|
593
613
|
});
|
|
594
614
|
return confirmed;
|
|
595
615
|
}
|
|
@@ -597,15 +617,15 @@ let ChatSetupRequests = ChatSetupRequests_1 = class ChatSetupRequests extends Di
|
|
|
597
617
|
this.logService.error(logMessage);
|
|
598
618
|
this.dialogService.prompt({
|
|
599
619
|
type: Severity.Error,
|
|
600
|
-
message: ( localize(
|
|
620
|
+
message: ( localize(4687, "An error occurred while signing up for Copilot Free.")),
|
|
601
621
|
detail: logDetails,
|
|
602
622
|
buttons: [
|
|
603
623
|
{
|
|
604
|
-
label: ( localize(
|
|
624
|
+
label: ( localize(4688, "OK")),
|
|
605
625
|
run: () => { }
|
|
606
626
|
},
|
|
607
627
|
{
|
|
608
|
-
label: ( localize(
|
|
628
|
+
label: ( localize(4689, "Learn More")),
|
|
609
629
|
run: () => this.openerService.open(( URI.parse(defaultChat.upgradePlanUrl)))
|
|
610
630
|
}
|
|
611
631
|
]
|
|
@@ -673,14 +693,14 @@ let ChatSetupController = class ChatSetupController extends Disposable {
|
|
|
673
693
|
}
|
|
674
694
|
async setup(options) {
|
|
675
695
|
const watch = ( new StopWatch(false));
|
|
676
|
-
const title = ( localize(
|
|
696
|
+
const title = ( localize(4690, "Getting Copilot ready..."));
|
|
677
697
|
const badge = this.activityService.showViewContainerActivity(preferCopilotEditsView(this.viewsService) ? CHAT_EDITING_SIDEBAR_PANEL_ID : CHAT_SIDEBAR_PANEL_ID, {
|
|
678
698
|
badge: ( new ProgressBadge(() => title)),
|
|
679
699
|
});
|
|
680
700
|
try {
|
|
681
701
|
await this.progressService.withProgress({
|
|
682
702
|
location: ProgressLocation.Window,
|
|
683
|
-
command:
|
|
703
|
+
command: CHAT_SETUP_ACTION_ID,
|
|
684
704
|
title,
|
|
685
705
|
}, () => this.doSetup(options?.forceSignIn ?? false, watch));
|
|
686
706
|
}
|
|
@@ -706,7 +726,7 @@ let ChatSetupController = class ChatSetupController extends Disposable {
|
|
|
706
726
|
entitlement = result.entitlement;
|
|
707
727
|
}
|
|
708
728
|
const trusted = await this.workspaceTrustRequestService.requestWorkspaceTrust({
|
|
709
|
-
message: ( localize(
|
|
729
|
+
message: ( localize(4691, "Copilot is currently only supported in trusted workspaces."))
|
|
710
730
|
});
|
|
711
731
|
if (!trusted) {
|
|
712
732
|
this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedNotTrusted', installDuration: watch.elapsed(), signUpErrorCode: undefined });
|
|
@@ -728,13 +748,13 @@ let ChatSetupController = class ChatSetupController extends Disposable {
|
|
|
728
748
|
}
|
|
729
749
|
async signIn(providerId) {
|
|
730
750
|
let session;
|
|
731
|
-
let
|
|
751
|
+
let entitlements;
|
|
732
752
|
try {
|
|
733
753
|
showCopilotView(this.viewsService, this.layoutService);
|
|
734
754
|
session = await this.authenticationService.createSession(providerId, defaultChat.providerScopes[0]);
|
|
735
755
|
this.authenticationExtensionsService.updateAccountPreference(defaultChat.extensionId, providerId, session.account);
|
|
736
756
|
this.authenticationExtensionsService.updateAccountPreference(defaultChat.chatExtensionId, providerId, session.account);
|
|
737
|
-
|
|
757
|
+
entitlements = await this.requests.forceResolveEntitlement(session);
|
|
738
758
|
}
|
|
739
759
|
catch (e) {
|
|
740
760
|
this.logService.error(`[chat setup] signIn: error ${e}`);
|
|
@@ -743,18 +763,18 @@ let ChatSetupController = class ChatSetupController extends Disposable {
|
|
|
743
763
|
const { confirmed } = await this.dialogService.confirm({
|
|
744
764
|
type: Severity.Error,
|
|
745
765
|
message: ( localize(
|
|
746
|
-
|
|
766
|
+
4692,
|
|
747
767
|
"Failed to sign in to {0}. Would you like to try again?",
|
|
748
768
|
ChatSetupRequests.providerId(this.configurationService) === defaultChat.enterpriseProviderId ? defaultChat.enterpriseProviderName : defaultChat.providerName
|
|
749
769
|
)),
|
|
750
|
-
detail: ( localize(
|
|
751
|
-
primaryButton: ( localize(
|
|
770
|
+
detail: ( localize(4693, "You must be signed in to use Copilot.")),
|
|
771
|
+
primaryButton: ( localize(4686, "Retry"))
|
|
752
772
|
});
|
|
753
773
|
if (confirmed) {
|
|
754
774
|
return this.signIn(providerId);
|
|
755
775
|
}
|
|
756
776
|
}
|
|
757
|
-
return { session, entitlement };
|
|
777
|
+
return { session, entitlement: entitlements?.entitlement };
|
|
758
778
|
}
|
|
759
779
|
async install(session, entitlement, providerId, watch) {
|
|
760
780
|
const wasInstalled = this.context.state.installed;
|
|
@@ -817,11 +837,11 @@ let ChatSetupController = class ChatSetupController extends Disposable {
|
|
|
817
837
|
const { confirmed } = await this.dialogService.confirm({
|
|
818
838
|
type: Severity.Error,
|
|
819
839
|
message: ( localize(
|
|
820
|
-
|
|
840
|
+
4694,
|
|
821
841
|
"An error occurred while setting up Copilot. Would you like to try again?"
|
|
822
842
|
)),
|
|
823
843
|
detail: error && !isCancellationError(error) ? toErrorMessage(error) : undefined,
|
|
824
|
-
primaryButton: ( localize(
|
|
844
|
+
primaryButton: ( localize(4686, "Retry"))
|
|
825
845
|
});
|
|
826
846
|
if (confirmed) {
|
|
827
847
|
return this.doInstall();
|
|
@@ -867,7 +887,7 @@ let ChatSetupWelcomeContent = class ChatSetupWelcomeContent extends Disposable {
|
|
|
867
887
|
const markdown = this.instantiationService.createInstance(MarkdownRenderer, {});
|
|
868
888
|
{
|
|
869
889
|
const header = ( localize(
|
|
870
|
-
|
|
890
|
+
4695,
|
|
871
891
|
"[Copilot]({0}) is your AI pair programmer.",
|
|
872
892
|
this.context.state.installed ? 'command:github.copilot.open.walkthrough' : defaultChat.documentationUrl
|
|
873
893
|
));
|
|
@@ -879,18 +899,18 @@ let ChatSetupWelcomeContent = class ChatSetupWelcomeContent extends Disposable {
|
|
|
879
899
|
const featureChatContainer = featuresContainer.appendChild($('div.chat-feature-container'));
|
|
880
900
|
featureChatContainer.appendChild(renderIcon(Codicon.code));
|
|
881
901
|
const featureChatLabel = featureChatContainer.appendChild($('span'));
|
|
882
|
-
featureChatLabel.textContent = ( localize(
|
|
902
|
+
featureChatLabel.textContent = ( localize(4696, "Code faster with Completions"));
|
|
883
903
|
const featureEditsContainer = featuresContainer.appendChild($('div.chat-feature-container'));
|
|
884
904
|
featureEditsContainer.appendChild(renderIcon(Codicon.editSession));
|
|
885
905
|
const featureEditsLabel = featureEditsContainer.appendChild($('span'));
|
|
886
|
-
featureEditsLabel.textContent = ( localize(
|
|
906
|
+
featureEditsLabel.textContent = ( localize(4697, "Build features with Copilot Edits"));
|
|
887
907
|
const featureExploreContainer = featuresContainer.appendChild($('div.chat-feature-container'));
|
|
888
908
|
featureExploreContainer.appendChild(renderIcon(Codicon.commentDiscussion));
|
|
889
909
|
const featureExploreLabel = featureExploreContainer.appendChild($('span'));
|
|
890
|
-
featureExploreLabel.textContent = ( localize(
|
|
910
|
+
featureExploreLabel.textContent = ( localize(4698, "Explore your codebase with Chat"));
|
|
891
911
|
}
|
|
892
912
|
const free = ( localize(
|
|
893
|
-
|
|
913
|
+
4699,
|
|
894
914
|
"$(sparkle-filled) We now offer [Copilot for free]({0}).",
|
|
895
915
|
defaultChat.skusDocumentationUrl
|
|
896
916
|
));
|
|
@@ -900,8 +920,8 @@ let ChatSetupWelcomeContent = class ChatSetupWelcomeContent extends Disposable {
|
|
|
900
920
|
buttonContainer.classList.add('button-container');
|
|
901
921
|
const button = this._register(( new ButtonWithDropdown(buttonContainer, {
|
|
902
922
|
actions: [
|
|
903
|
-
toAction({ id: 'chatSetup.setupWithProvider', label: ( localize(
|
|
904
|
-
toAction({ id: 'chatSetup.setupWithEnterpriseProvider', label: ( localize(
|
|
923
|
+
toAction({ id: 'chatSetup.setupWithProvider', label: ( localize(4700, "Sign in with a {0} Account", defaultChat.providerName)), run: () => this.setupWithProvider(false) }),
|
|
924
|
+
toAction({ id: 'chatSetup.setupWithEnterpriseProvider', label: ( localize(4701, "Sign in with a {0} Account", defaultChat.enterpriseProviderName)), run: () => this.setupWithProvider(true) })
|
|
905
925
|
],
|
|
906
926
|
addPrimaryActionToDropdown: false,
|
|
907
927
|
contextMenuProvider: this.contextMenuService,
|
|
@@ -910,14 +930,14 @@ let ChatSetupWelcomeContent = class ChatSetupWelcomeContent extends Disposable {
|
|
|
910
930
|
})));
|
|
911
931
|
this._register(button.onDidClick(() => this.controller.setup()));
|
|
912
932
|
const terms = ( localize(
|
|
913
|
-
|
|
933
|
+
4702,
|
|
914
934
|
"By continuing, you agree to the [Terms]({0}) and [Privacy Policy]({1}).",
|
|
915
935
|
defaultChat.termsStatementUrl,
|
|
916
936
|
defaultChat.privacyStatementUrl
|
|
917
937
|
));
|
|
918
938
|
this.element.appendChild($('p')).appendChild(this._register(markdown.render(( new MarkdownString(terms, { isTrusted: true })))).element);
|
|
919
939
|
const settings = ( localize(
|
|
920
|
-
|
|
940
|
+
4703,
|
|
921
941
|
"Copilot Free and Pro may show [public code]({0}) suggestions and we may use your data for product improvement. You can change these [settings]({1}) at any time.",
|
|
922
942
|
defaultChat.publicCodeMatchesUrl,
|
|
923
943
|
defaultChat.manageSettingsUrl
|
|
@@ -933,33 +953,33 @@ let ChatSetupWelcomeContent = class ChatSetupWelcomeContent extends Disposable {
|
|
|
933
953
|
switch (this.context.state.entitlement) {
|
|
934
954
|
case ChatEntitlement.Unknown:
|
|
935
955
|
showFree = true;
|
|
936
|
-
buttonLabel = this.context.state.registered ? ( localize(
|
|
956
|
+
buttonLabel = this.context.state.registered ? ( localize(4704, "Sign in to Use Copilot")) : ( localize(4705, "Sign in to Use Copilot for Free"));
|
|
937
957
|
break;
|
|
938
958
|
case ChatEntitlement.Unresolved:
|
|
939
959
|
showFree = true;
|
|
940
|
-
buttonLabel = this.context.state.registered ? ( localize(
|
|
960
|
+
buttonLabel = this.context.state.registered ? ( localize(4706, "Use Copilot")) : ( localize(4707, "Use Copilot for Free"));
|
|
941
961
|
break;
|
|
942
962
|
case ChatEntitlement.Available:
|
|
943
963
|
case ChatEntitlement.Limited:
|
|
944
964
|
showFree = true;
|
|
945
|
-
buttonLabel = ( localize(
|
|
965
|
+
buttonLabel = ( localize(4707, "Use Copilot for Free"));
|
|
946
966
|
break;
|
|
947
967
|
case ChatEntitlement.Pro:
|
|
948
968
|
case ChatEntitlement.Unavailable:
|
|
949
969
|
showFree = false;
|
|
950
|
-
buttonLabel = ( localize(
|
|
970
|
+
buttonLabel = ( localize(4706, "Use Copilot"));
|
|
951
971
|
break;
|
|
952
972
|
}
|
|
953
973
|
switch (this.controller.step) {
|
|
954
974
|
case ChatSetupStep.SigningIn:
|
|
955
975
|
buttonLabel = ( localize(
|
|
956
|
-
|
|
976
|
+
4708,
|
|
957
977
|
"$(loading~spin) Signing in to {0}...",
|
|
958
978
|
ChatSetupRequests.providerId(this.configurationService) === defaultChat.enterpriseProviderId ? defaultChat.enterpriseProviderName : defaultChat.providerName
|
|
959
979
|
));
|
|
960
980
|
break;
|
|
961
981
|
case ChatSetupStep.Installing:
|
|
962
|
-
buttonLabel = ( localize(
|
|
982
|
+
buttonLabel = ( localize(4709, "$(loading~spin) Getting Copilot Ready..."));
|
|
963
983
|
break;
|
|
964
984
|
}
|
|
965
985
|
setVisibility(showFree, freeContainer);
|
|
@@ -982,11 +1002,11 @@ let ChatSetupWelcomeContent = class ChatSetupWelcomeContent extends Disposable {
|
|
|
982
1002
|
}
|
|
983
1003
|
});
|
|
984
1004
|
if (useEnterpriseProvider) {
|
|
985
|
-
await this.configurationService.updateValue(defaultChat.providerSetting, defaultChat.enterpriseProviderId, ConfigurationTarget.USER);
|
|
986
1005
|
const success = await this.handleEnterpriseInstance();
|
|
987
1006
|
if (!success) {
|
|
988
1007
|
return;
|
|
989
1008
|
}
|
|
1009
|
+
await this.configurationService.updateValue(defaultChat.providerSetting, defaultChat.enterpriseProviderId, ConfigurationTarget.USER);
|
|
990
1010
|
}
|
|
991
1011
|
else {
|
|
992
1012
|
await this.configurationService.updateValue(defaultChat.providerSetting, undefined, ConfigurationTarget.USER);
|
|
@@ -995,38 +1015,38 @@ let ChatSetupWelcomeContent = class ChatSetupWelcomeContent extends Disposable {
|
|
|
995
1015
|
return this.controller.setup({ forceSignIn: true });
|
|
996
1016
|
}
|
|
997
1017
|
async handleEnterpriseInstance() {
|
|
1018
|
+
const domainRegEx = /^[a-zA-Z\-_]+$/;
|
|
1019
|
+
const fullUriRegEx = /^(https:\/\/)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.ghe\.com\/?$/;
|
|
998
1020
|
const uri = this.configurationService.getValue(defaultChat.providerUriSetting);
|
|
999
|
-
if (uri) {
|
|
1021
|
+
if (typeof uri === 'string' && fullUriRegEx.test(uri)) {
|
|
1000
1022
|
return true;
|
|
1001
1023
|
}
|
|
1002
1024
|
let isSingleWord = false;
|
|
1003
1025
|
const result = await this.quickInputService.input({
|
|
1004
|
-
prompt: ( localize(
|
|
1005
|
-
placeHolder: ( localize(
|
|
1026
|
+
prompt: ( localize(4710, "What is your {0} instance?", defaultChat.enterpriseProviderName)),
|
|
1027
|
+
placeHolder: ( localize(4711, 'i.e. "octocat" or "https://octocat.ghe.com"...')),
|
|
1028
|
+
value: uri,
|
|
1006
1029
|
validateInput: async (value) => {
|
|
1007
1030
|
isSingleWord = false;
|
|
1008
1031
|
if (!value) {
|
|
1009
1032
|
return undefined;
|
|
1010
1033
|
}
|
|
1011
|
-
if (
|
|
1034
|
+
if (domainRegEx.test(value)) {
|
|
1012
1035
|
isSingleWord = true;
|
|
1013
1036
|
return {
|
|
1014
|
-
content: ( localize(
|
|
1037
|
+
content: ( localize(4712, "Will resolve to {0}", `https://${value}.ghe.com`)),
|
|
1015
1038
|
severity: Severity.Info
|
|
1016
1039
|
};
|
|
1017
1040
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
severity: Severity.Error
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1041
|
+
if (!fullUriRegEx.test(value)) {
|
|
1042
|
+
return {
|
|
1043
|
+
content: ( localize(
|
|
1044
|
+
4713,
|
|
1045
|
+
'Please enter a valid {0} instance (i.e. "octocat" or "https://octocat.ghe.com")',
|
|
1046
|
+
defaultChat.enterpriseProviderName
|
|
1047
|
+
)),
|
|
1048
|
+
severity: Severity.Error
|
|
1049
|
+
};
|
|
1030
1050
|
}
|
|
1031
1051
|
return undefined;
|
|
1032
1052
|
}
|
|
@@ -1035,11 +1055,11 @@ let ChatSetupWelcomeContent = class ChatSetupWelcomeContent extends Disposable {
|
|
|
1035
1055
|
const { confirmed } = await this.dialogService.confirm({
|
|
1036
1056
|
type: Severity.Error,
|
|
1037
1057
|
message: ( localize(
|
|
1038
|
-
|
|
1058
|
+
4714,
|
|
1039
1059
|
"The provided {0} instance is invalid. Would you like to enter it again?",
|
|
1040
1060
|
defaultChat.enterpriseProviderName
|
|
1041
1061
|
)),
|
|
1042
|
-
primaryButton: ( localize(
|
|
1062
|
+
primaryButton: ( localize(4686, "Retry"))
|
|
1043
1063
|
});
|
|
1044
1064
|
if (confirmed) {
|
|
1045
1065
|
return this.handleEnterpriseInstance();
|
|
@@ -1171,4 +1191,4 @@ function refreshTokens(commandService) {
|
|
|
1171
1191
|
commandService.executeCommand('github.copilot.refreshToken');
|
|
1172
1192
|
}
|
|
1173
1193
|
|
|
1174
|
-
export { ChatSetupContribution };
|
|
1194
|
+
export { ChatEntitlementsService, ChatSetupContribution };
|