diff --git a/extensions/github-authentication/src/flows.ts b/extensions/github-authentication/src/flows.ts index 0c470b1d65d..e9954dc2d02 100644 --- a/extensions/github-authentication/src/flows.ts +++ b/extensions/github-authentication/src/flows.ts @@ -571,14 +571,14 @@ export function getFlows(query: IFlowQuery) { */ export const enum GitHubSocialSignInProvider { Google = 'google', - // Apple = 'apple', + Apple = 'apple', } const GitHubSocialSignInProviderLabels = { [GitHubSocialSignInProvider.Google]: l10n.t('Google'), - // [GitHubSocialSignInProvider.Apple]: l10n.t('Apple'), + [GitHubSocialSignInProvider.Apple]: l10n.t('Apple'), }; export function isSocialSignInProvider(provider: unknown): provider is GitHubSocialSignInProvider { - return provider === GitHubSocialSignInProvider.Google; // || provider === GitHubSocialSignInProvider.Apple; + return provider === GitHubSocialSignInProvider.Google || provider === GitHubSocialSignInProvider.Apple; } diff --git a/package.json b/package.json index dd51bb0b769..b4b408cd82c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.103.0", - "distro": "7fd50e9bdc1a124eb32a184ee4bc0d437cdae9f0", + "distro": "e050762924418e1fb937b0aee594b586defeac82", "author": { "name": "Microsoft Corporation" }, diff --git a/src/vs/base/common/product.ts b/src/vs/base/common/product.ts index 4f18173228a..0743b45df6c 100644 --- a/src/vs/base/common/product.ts +++ b/src/vs/base/common/product.ts @@ -337,12 +337,13 @@ export interface IDefaultChatAgent { readonly upgradePlanUrl: string; readonly signUpUrl: string; - readonly providerId: string; - readonly providerName: string; - readonly enterpriseProviderId: string; - readonly enterpriseProviderName: string; - readonly alternativeProviderId: string; - readonly alternativeProviderName: string; + readonly provider: { + default: { id: string; name: string }; + enterprise: { id: string; name: string }; + google: { id: string; name: string }; + apple: { id: string; name: string }; + }; + readonly providerUriSetting: string; readonly providerScopes: string[][]; diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts index e2bd588e29c..e14d3084197 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts @@ -673,7 +673,7 @@ export function registerChatActions() { } }); - const nonEnterpriseCopilotUsers = ContextKeyExpr.and(ChatContextKeys.enabled, ContextKeyExpr.notEquals(`config.${defaultChat.completionsAdvancedSetting}.authProvider`, defaultChat.enterpriseProviderId)); + const nonEnterpriseCopilotUsers = ContextKeyExpr.and(ChatContextKeys.enabled, ContextKeyExpr.notEquals(`config.${defaultChat.completionsAdvancedSetting}.authProvider`, defaultChat.provider?.enterprise.id)); registerAction2(class extends Action2 { constructor() { super({ @@ -901,7 +901,7 @@ const defaultChat = { documentationUrl: product.defaultChatAgent?.documentationUrl ?? '', manageSettingsUrl: product.defaultChatAgent?.manageSettingsUrl ?? '', managePlanUrl: product.defaultChatAgent?.managePlanUrl ?? '', - enterpriseProviderId: product.defaultChatAgent?.enterpriseProviderId ?? '', + provider: product.defaultChatAgent?.provider ?? { enterprise: { id: '' } }, completionsAdvancedSetting: product.defaultChatAgent?.completionsAdvancedSetting ?? '', completionsMenuCommand: product.defaultChatAgent?.completionsMenuCommand ?? '', }; diff --git a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts index fa11055a422..f3f4164c855 100644 --- a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts +++ b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts @@ -478,7 +478,7 @@ configurationRegistry.registerConfiguration({ }, 'chat.setup.signInDialogVariant': { // TODO@bpasero remove me eventually type: 'string', - enum: ['default', 'alternate-first', 'alternate-color', 'alternate-monochrome'], + enum: ['default', 'apple'], description: nls.localize('chat.signInDialogVariant', "Control variations of the sign-in dialog."), default: 'default', tags: ['onExp', 'experimental'] diff --git a/src/vs/workbench/contrib/chat/browser/chatSetup.ts b/src/vs/workbench/contrib/chat/browser/chatSetup.ts index d4751a21054..8a619025797 100644 --- a/src/vs/workbench/contrib/chat/browser/chatSetup.ts +++ b/src/vs/workbench/contrib/chat/browser/chatSetup.ts @@ -80,13 +80,7 @@ const defaultChat = { publicCodeMatchesUrl: product.defaultChatAgent?.publicCodeMatchesUrl ?? '', manageOveragesUrl: product.defaultChatAgent?.manageOverageUrl ?? '', upgradePlanUrl: product.defaultChatAgent?.upgradePlanUrl ?? '', - signUpUrl: product.defaultChatAgent?.signUpUrl ?? '', - providerId: product.defaultChatAgent?.providerId ?? '', - providerName: product.defaultChatAgent?.providerName ?? '', - enterpriseProviderId: product.defaultChatAgent?.enterpriseProviderId ?? '', - enterpriseProviderName: product.defaultChatAgent?.enterpriseProviderName ?? '', - alternativeProviderId: product.defaultChatAgent?.alternativeProviderId ?? '', - alternativeProviderName: product.defaultChatAgent?.alternativeProviderName ?? '', + provider: product.defaultChatAgent?.provider ?? { default: { id: '', name: '' }, enterprise: { id: '', name: '' }, apple: { id: '', name: '' }, google: { id: '', name: '' } }, providerUriSetting: product.defaultChatAgent?.providerUriSetting ?? '', providerScopes: product.defaultChatAgent?.providerScopes ?? [[]], manageSettingsUrl: product.defaultChatAgent?.manageSettingsUrl ?? '', @@ -134,7 +128,7 @@ class SetupAgent extends Disposable implements IChatAgentImplementation { break; } - return SetupAgent.doRegisterAgent(instantiationService, chatAgentService, id, `${defaultChat.providerName} Copilot`, true, description, location, mode, context, controller); + return SetupAgent.doRegisterAgent(instantiationService, chatAgentService, id, `${defaultChat.provider?.default.name} Copilot`, true, description, location, mode, context, controller); }); } @@ -307,9 +301,9 @@ class SetupAgent extends Disposable implements IChatAgentImplementation { if (ready === 'error' || ready === 'timedout') { let warningMessage: string; if (ready === 'timedout') { - warningMessage = localize('copilotTookLongWarning', "Copilot took too long to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.", defaultChat.providerName, defaultChat.chatExtensionId); + warningMessage = localize('copilotTookLongWarning', "Copilot took too long to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.", defaultChat.provider?.default.name, defaultChat.chatExtensionId); } else { - warningMessage = localize('copilotFailedWarning', "Copilot failed to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.", defaultChat.providerName, defaultChat.chatExtensionId); + warningMessage = localize('copilotFailedWarning', "Copilot failed to get ready. Please ensure you are signed in to {0} and that the extension `{1}` is installed and enabled.", defaultChat.provider?.default.name, defaultChat.chatExtensionId); } progress({ @@ -398,7 +392,7 @@ class SetupAgent extends Disposable implements IChatAgentImplementation { case ChatSetupStep.SigningIn: progress({ kind: 'progressMessage', - content: new MarkdownString(localize('setupChatSignIn2', "Signing in to {0}.", ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.enterpriseProviderId ? defaultChat.enterpriseProviderName : defaultChat.providerName)), + content: new MarkdownString(localize('setupChatSignIn2', "Signing in to {0}.", ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.provider?.enterprise.id ? defaultChat.provider?.enterprise.name : defaultChat.provider?.default.name)), }); break; case ChatSetupStep.Installing: @@ -575,8 +569,8 @@ enum ChatSetupStrategy { DefaultSetup = 1, SetupWithoutEnterpriseProvider = 2, SetupWithEnterpriseProvider = 3, - SetupWithAccountCreate = 4, - SetupWithAlternateProvider = 5 + SetupWithGoogleProvider = 4, + SetupWithAppleProvider = 5 } type ChatSetupResultValue = boolean /* success */ | undefined /* canceled */; @@ -593,7 +587,7 @@ class ChatSetup { let instance = ChatSetup.instance; if (!instance) { instance = ChatSetup.instance = instantiationService.invokeFunction(accessor => { - return new ChatSetup(context, controller, instantiationService, accessor.get(ITelemetryService), accessor.get(IWorkbenchLayoutService), accessor.get(IKeybindingService), accessor.get(IChatEntitlementService) as ChatEntitlementService, accessor.get(ILogService), accessor.get(IConfigurationService), accessor.get(IViewsService), accessor.get(IOpenerService), accessor.get(IWorkspaceTrustRequestService)); + return new ChatSetup(context, controller, instantiationService, accessor.get(ITelemetryService), accessor.get(IWorkbenchLayoutService), accessor.get(IKeybindingService), accessor.get(IChatEntitlementService) as ChatEntitlementService, accessor.get(ILogService), accessor.get(IConfigurationService), accessor.get(IViewsService), accessor.get(IWorkspaceTrustRequestService)); }); } @@ -615,7 +609,6 @@ class ChatSetup { @ILogService private readonly logService: ILogService, @IConfigurationService private readonly configurationService: IConfigurationService, @IViewsService private readonly viewsService: IViewsService, - @IOpenerService private readonly openerService: IOpenerService, @IWorkspaceTrustRequestService private readonly workspaceTrustRequestService: IWorkspaceTrustRequestService ) { } @@ -660,7 +653,7 @@ class ChatSetup { setupStrategy = await this.showDialog(); } - if (setupStrategy === ChatSetupStrategy.DefaultSetup && ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.enterpriseProviderId) { + if (setupStrategy === ChatSetupStrategy.DefaultSetup && ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.provider?.enterprise.id) { setupStrategy = ChatSetupStrategy.SetupWithEnterpriseProvider; // users with a configured provider go through provider setup } @@ -674,20 +667,20 @@ class ChatSetup { try { switch (setupStrategy) { case ChatSetupStrategy.SetupWithEnterpriseProvider: - success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: true, useAlternateProvider: false }); + success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: true, useSocialProvider: undefined }); break; case ChatSetupStrategy.SetupWithoutEnterpriseProvider: - success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: false, useAlternateProvider: false }); + success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: false, useSocialProvider: undefined }); break; - case ChatSetupStrategy.SetupWithAlternateProvider: - success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: false, useAlternateProvider: true }); + case ChatSetupStrategy.SetupWithAppleProvider: + success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: false, useSocialProvider: 'apple' }); + break; + case ChatSetupStrategy.SetupWithGoogleProvider: + success = await this.controller.value.setupWithProvider({ useEnterpriseProvider: false, useSocialProvider: 'google' }); break; case ChatSetupStrategy.DefaultSetup: success = await this.controller.value.setup(); break; - case ChatSetupStrategy.SetupWithAccountCreate: - this.openerService.open(URI.parse(defaultChat.signUpUrl)); - return this.doRun(options); // open dialog again case ChatSetupStrategy.Canceled: this.context.update({ later: true }); this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedMaybeLater', installDuration: 0, signUpErrorCode: undefined, provider: undefined }); @@ -704,7 +697,7 @@ class ChatSetup { private async showDialog(): Promise { const disposables = new DisposableStore(); - const dialogVariant = this.configurationService.getValue<'default' | 'alternate-first' | 'alternate-color' | 'alternate-monochrome' | unknown>('chat.setup.signInDialogVariant'); + const dialogVariant = this.configurationService.getValue<'default' | 'apple' | unknown>('chat.setup.signInDialogVariant'); const buttons = this.getButtons(dialogVariant); const dialog = disposables.add(new Dialog( @@ -730,59 +723,41 @@ class ChatSetup { return buttons[button]?.[1] ?? ChatSetupStrategy.Canceled; } - private getButtons(variant: 'default' | 'alternate-first' | 'alternate-color' | 'alternate-monochrome' | unknown): Array<[string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]> { - let buttons: Array<[string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]>; + private getButtons(variant: 'default' | 'apple' | unknown): Array<[string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]> { + type ContinueWithButton = [string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]; + const styleButton = (...classes: string[]) => ({ styleButton: (button: IButton) => button.element.classList.add(...classes) }); + let buttons: Array; if (this.context.state.entitlement === ChatEntitlement.Unknown) { - let alternateProvider: 'off' | 'monochrome' | 'colorful' | 'first' = 'off'; - if (defaultChat.alternativeProviderId) { - switch (variant) { - case 'alternate-first': - alternateProvider = 'first'; - break; - case 'alternate-color': - alternateProvider = 'colorful'; - break; - case 'alternate-monochrome': - alternateProvider = 'monochrome'; - break; - } - } + const defaultProviderButton: ContinueWithButton = [localize('continueWith', "Continue with {0}", defaultChat.provider?.default.name), ChatSetupStrategy.SetupWithoutEnterpriseProvider, styleButton('continue-button', 'default')]; + const defaultProviderLink: ContinueWithButton = [defaultProviderButton[0], defaultProviderButton[1], styleButton('link-button')]; - if (ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.enterpriseProviderId) { + const enterpriseProviderButton: ContinueWithButton = [localize('continueWith', "Continue with {0}", defaultChat.provider?.enterprise.name), ChatSetupStrategy.SetupWithEnterpriseProvider, styleButton('continue-button', 'default')]; + const enterpriseProviderLink: ContinueWithButton = [enterpriseProviderButton[0], enterpriseProviderButton[1], styleButton('link-button')]; + + const googleProviderButton: ContinueWithButton = [localize('continueWith', "Continue with {0}", defaultChat.provider?.google.name), ChatSetupStrategy.SetupWithGoogleProvider, styleButton('continue-button', 'google')]; + const appleProviderButton: ContinueWithButton = [localize('continueWith', "Continue with {0}", defaultChat.provider?.apple.name), ChatSetupStrategy.SetupWithAppleProvider, styleButton('continue-button', 'apple')]; + + if (ChatEntitlementRequests.providerId(this.configurationService) !== defaultChat.provider?.enterprise.id) { buttons = coalesce([ - [localize('continueWith', "Continue with {0}", defaultChat.enterpriseProviderName), ChatSetupStrategy.SetupWithEnterpriseProvider, { - styleButton: button => button.element.classList.add('continue-button', 'default') - }], - alternateProvider !== 'off' ? [localize('continueWith', "Continue with {0}", defaultChat.alternativeProviderName), ChatSetupStrategy.SetupWithAlternateProvider, { - styleButton: button => button.element.classList.add('continue-button', 'alternate', alternateProvider) - }] : undefined, - [localize('signInWithProvider', "Sign in with a {0} account", defaultChat.providerName), ChatSetupStrategy.SetupWithoutEnterpriseProvider, { - styleButton: button => button.element.classList.add('link-button') - }] + defaultProviderButton, + googleProviderButton, + variant === 'apple' ? appleProviderButton : undefined, + enterpriseProviderLink ]); } else { buttons = coalesce([ - [localize('continueWith', "Continue with {0}", defaultChat.providerName), ChatSetupStrategy.SetupWithoutEnterpriseProvider, { - styleButton: button => button.element.classList.add('continue-button', 'default') - }], - alternateProvider !== 'off' ? [localize('continueWith', "Continue with {0}", defaultChat.alternativeProviderName), ChatSetupStrategy.SetupWithAlternateProvider, { - styleButton: button => button.element.classList.add('continue-button', 'alternate', alternateProvider) - }] : undefined, - [localize('signInWithProvider', "Sign in with a {0} account", defaultChat.enterpriseProviderName), ChatSetupStrategy.SetupWithEnterpriseProvider, { - styleButton: button => button.element.classList.add('link-button') - }] + enterpriseProviderButton, + googleProviderButton, + variant === 'apple' ? appleProviderButton : undefined, + defaultProviderLink ]); } - - if (alternateProvider === 'first') { - [buttons[0], buttons[1]] = [buttons[1], buttons[0]]; - } } else { buttons = [[localize('setupCopilotButton', "Set up Copilot"), ChatSetupStrategy.DefaultSetup, undefined]]; } - buttons.push([localize('skipForNow', "Skip for now"), ChatSetupStrategy.Canceled, { styleButton: button => button.element.classList.add('link-button', 'skip-button') }]); + buttons.push([localize('skipForNow', "Skip for now"), ChatSetupStrategy.Canceled, styleButton('link-button', 'skip-button')]); return buttons; } @@ -801,7 +776,7 @@ class ChatSetup { const markdown = this.instantiationService.createInstance(MarkdownRenderer, {}); // SKU Settings - const settings = localize({ key: 'settings', comment: ['{Locked="["}', '{Locked="]({0})"}', '{Locked="]({1})"}'] }, "{0} Copilot Free, Pro and Pro+ may show [public code]({1}) suggestions and we may use your data for product improvement. You can change these [settings]({2}) at any time.", defaultChat.providerName, defaultChat.publicCodeMatchesUrl, defaultChat.manageSettingsUrl); + const settings = localize({ key: 'settings', comment: ['{Locked="["}', '{Locked="]({0})"}', '{Locked="]({1})"}'] }, "{0} Copilot Free, Pro and Pro+ may show [public code]({1}) suggestions and we may use your data for product improvement. You can change these [settings]({2}) at any time.", defaultChat.provider?.default.name, defaultChat.publicCodeMatchesUrl, defaultChat.manageSettingsUrl); element.appendChild($('p', undefined, disposables.add(markdown.render(new MarkdownString(settings, { isTrusted: true }))).element)); return element; @@ -1221,7 +1196,7 @@ class ChatSetupController extends Disposable { this._onDidChange.fire(); } - async setup(options?: { forceSignIn?: boolean; useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }): Promise { + async setup(options?: { forceSignIn?: boolean; useSocialProvider?: string; useEnterpriseProvider?: boolean }): Promise { const watch = new StopWatch(false); const title = localize('setupChatProgress', "Getting Copilot ready..."); const badge = this.activityService.showViewContainerActivity(CHAT_SIDEBAR_PANEL_ID, { @@ -1239,7 +1214,7 @@ class ChatSetupController extends Disposable { } } - private async doSetup(options: { forceSignIn?: boolean; useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }, watch: StopWatch): Promise { + private async doSetup(options: { forceSignIn?: boolean; useSocialProvider?: string; useEnterpriseProvider?: boolean }, watch: StopWatch): Promise { this.context.suspend(); // reduces flicker let success: ChatSetupResultValue = false; @@ -1251,11 +1226,11 @@ class ChatSetupController extends Disposable { // Entitlement Unknown or `forceSignIn`: we need to sign-in user if (this.context.state.entitlement === ChatEntitlement.Unknown || options.forceSignIn) { this.setStep(ChatSetupStep.SigningIn); - const result = await this.signIn({ useAlternateProvider: options.useAlternateProvider }); + const result = await this.signIn(options); if (!result.session) { this.doInstall(); // still install the extension in the background to remind the user to sign-in eventually - const provider = options.useAlternateProvider ? defaultChat.alternativeProviderId : options.useEnterpriseProvider ? defaultChat.enterpriseProviderId : defaultChat.providerId; + const provider = options.useSocialProvider ?? options.useEnterpriseProvider ? defaultChat.provider?.enterprise.id : defaultChat.provider?.default.id; this.telemetryService.publicLog2('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider }); return undefined; // treat as cancelled because signing in already triggers an error dialog } @@ -1275,7 +1250,7 @@ class ChatSetupController extends Disposable { return success; } - private async signIn(options: { useAlternateProvider?: boolean }): Promise<{ session: AuthenticationSession | undefined; entitlement: ChatEntitlement | undefined }> { + private async signIn(options: { useSocialProvider?: string }): Promise<{ session: AuthenticationSession | undefined; entitlement: ChatEntitlement | undefined }> { let session: AuthenticationSession | undefined; let entitlements; try { @@ -1287,7 +1262,7 @@ class ChatSetupController extends Disposable { if (!session && !this.lifecycleService.willShutdown) { const { confirmed } = await this.dialogService.confirm({ type: Severity.Error, - message: localize('unknownSignInError', "Failed to sign in to {0}. Would you like to try again?", options?.useAlternateProvider ? defaultChat.alternativeProviderName : ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.enterpriseProviderId ? defaultChat.enterpriseProviderName : defaultChat.providerName), + message: localize('unknownSignInError', "Failed to sign in to {0}. Would you like to try again?", ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.provider?.enterprise.id ? defaultChat.provider?.enterprise.name : defaultChat.provider?.default.name), detail: localize('unknownSignInErrorDetail', "You must be signed in to use Copilot."), primaryButton: localize('retry', "Retry") }); @@ -1300,11 +1275,11 @@ class ChatSetupController extends Disposable { return { session, entitlement: entitlements?.entitlement }; } - private async install(session: AuthenticationSession | undefined, entitlement: ChatEntitlement, providerId: string, watch: StopWatch, options: { useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }): Promise { + private async install(session: AuthenticationSession | undefined, entitlement: ChatEntitlement, providerId: string, watch: StopWatch, options: { useSocialProvider?: string; useEnterpriseProvider?: boolean }): Promise { const wasRunning = this.context.state.installed && !this.context.state.disabled; let signUpResult: boolean | { errorCode: number } | undefined = undefined; - const provider = options.useAlternateProvider ? defaultChat.alternativeProviderId : options.useEnterpriseProvider ? defaultChat.enterpriseProviderId : defaultChat.providerId; + const provider = options.useSocialProvider ?? options.useEnterpriseProvider ? defaultChat.provider?.enterprise.id : defaultChat.provider?.default.id; try { @@ -1392,7 +1367,7 @@ class ChatSetupController extends Disposable { }, ChatViewId); } - async setupWithProvider(options: { useEnterpriseProvider: boolean; useAlternateProvider: boolean }): Promise { + async setupWithProvider(options: { useEnterpriseProvider: boolean; useSocialProvider: string | undefined }): Promise { const registry = Registry.as(ConfigurationExtensions.Configuration); registry.registerConfiguration({ 'id': 'copilot.setup', @@ -1427,7 +1402,7 @@ class ChatSetupController extends Disposable { if (options.useEnterpriseProvider) { await this.configurationService.updateValue(`${defaultChat.completionsAdvancedSetting}`, { ...existingAdvancedSetting, - 'authProvider': defaultChat.enterpriseProviderId + 'authProvider': defaultChat.provider?.enterprise.id }, ConfigurationTarget.USER); } else { await this.configurationService.updateValue(`${defaultChat.completionsAdvancedSetting}`, Object.keys(existingAdvancedSetting).length > 0 ? { @@ -1450,7 +1425,7 @@ class ChatSetupController extends Disposable { let isSingleWord = false; const result = await this.quickInputService.input({ - prompt: localize('enterpriseInstance', "What is your {0} instance?", defaultChat.enterpriseProviderName), + prompt: localize('enterpriseInstance', "What is your {0} instance?", defaultChat.provider?.enterprise.name), placeHolder: localize('enterpriseInstancePlaceholder', 'i.e. "octocat" or "https://octocat.ghe.com"...'), ignoreFocusLost: true, value: uri, @@ -1468,7 +1443,7 @@ class ChatSetupController extends Disposable { }; } if (!fullUriRegEx.test(value)) { return { - content: localize('invalidEnterpriseInstance', 'You must enter a valid {0} instance (i.e. "octocat" or "https://octocat.ghe.com")', defaultChat.enterpriseProviderName), + content: localize('invalidEnterpriseInstance', 'You must enter a valid {0} instance (i.e. "octocat" or "https://octocat.ghe.com")', defaultChat.provider?.enterprise.name), severity: Severity.Error }; } diff --git a/src/vs/workbench/contrib/chat/browser/media/apple-dark.svg b/src/vs/workbench/contrib/chat/browser/media/apple-dark.svg new file mode 100644 index 00000000000..be725db24f3 --- /dev/null +++ b/src/vs/workbench/contrib/chat/browser/media/apple-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/chat/browser/media/apple-light.svg b/src/vs/workbench/contrib/chat/browser/media/apple-light.svg new file mode 100644 index 00000000000..f51d23005c3 --- /dev/null +++ b/src/vs/workbench/contrib/chat/browser/media/apple-light.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/chat/browser/media/chatSetup.css b/src/vs/workbench/contrib/chat/browser/media/chatSetup.css index 055e3a8f9f2..7bd6ce82a2f 100644 --- a/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +++ b/src/vs/workbench/contrib/chat/browser/media/chatSetup.css @@ -23,7 +23,7 @@ background-image: url('./github.svg'); } - .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.alternate::before { + .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.google::before { background-image: url('./google.svg'); } @@ -51,12 +51,12 @@ } } -.monaco-workbench.hc-black .chat-setup-dialog .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.alternate.monochrome::before, -.monaco-workbench.vs-dark .chat-setup-dialog .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.alternate.monochrome::before { - background-image: url('./google-mono-dark.svg'); +.monaco-workbench.hc-black .chat-setup-dialog .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.apple::before, +.monaco-workbench.vs-dark .chat-setup-dialog .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.apple::before { + background-image: url('./apple-dark.svg'); } -.monaco-workbench.hc-light .chat-setup-dialog .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.alternate.monochrome::before, -.monaco-workbench.vs .chat-setup-dialog .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.alternate.monochrome::before { - background-image: url('./google-mono-light.svg'); +.monaco-workbench.hc-light .chat-setup-dialog .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.apple::before, +.monaco-workbench.vs .chat-setup-dialog .dialog-buttons-row > .dialog-buttons > .monaco-button.continue-button.apple::before { + background-image: url('./apple-light.svg'); } diff --git a/src/vs/workbench/contrib/chat/browser/media/google-mono-dark.svg b/src/vs/workbench/contrib/chat/browser/media/google-mono-dark.svg deleted file mode 100644 index 7c91281c36a..00000000000 --- a/src/vs/workbench/contrib/chat/browser/media/google-mono-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/workbench/contrib/chat/browser/media/google-mono-light.svg b/src/vs/workbench/contrib/chat/browser/media/google-mono-light.svg deleted file mode 100644 index 264c6ce8c5c..00000000000 --- a/src/vs/workbench/contrib/chat/browser/media/google-mono-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/workbench/contrib/chat/common/chatEntitlementService.ts b/src/vs/workbench/contrib/chat/common/chatEntitlementService.ts index f8e2b2f4e17..2850f656171 100644 --- a/src/vs/workbench/contrib/chat/common/chatEntitlementService.ts +++ b/src/vs/workbench/contrib/chat/common/chatEntitlementService.ts @@ -134,9 +134,7 @@ const defaultChat = { extensionId: product.defaultChatAgent?.extensionId ?? '', chatExtensionId: product.defaultChatAgent?.chatExtensionId ?? '', upgradePlanUrl: product.defaultChatAgent?.upgradePlanUrl ?? '', - providerId: product.defaultChatAgent?.providerId ?? '', - enterpriseProviderId: product.defaultChatAgent?.enterpriseProviderId ?? '', - alternativeProviderId: product.defaultChatAgent?.alternativeProviderId ?? '', + provider: product.defaultChatAgent?.provider ?? { default: { id: '' }, enterprise: { id: '' } }, providerScopes: product.defaultChatAgent?.providerScopes ?? [[]], entitlementUrl: product.defaultChatAgent?.entitlementUrl ?? '', entitlementSignupLimitedUrl: product.defaultChatAgent?.entitlementSignupLimitedUrl ?? '', @@ -421,11 +419,11 @@ interface IQuotas { export class ChatEntitlementRequests extends Disposable { static providerId(configurationService: IConfigurationService): string { - if (configurationService.getValue(`${defaultChat.completionsAdvancedSetting}.authProvider`) === defaultChat.enterpriseProviderId) { - return defaultChat.enterpriseProviderId; + if (configurationService.getValue(`${defaultChat.completionsAdvancedSetting}.authProvider`) === defaultChat.provider?.enterprise.id) { + return defaultChat.provider!.enterprise.id; } - return defaultChat.providerId; + return defaultChat.provider!.default.id; } private state: IEntitlements; @@ -568,7 +566,7 @@ export class ChatEntitlementRequests extends Disposable { } private async doResolveEntitlement(session: AuthenticationSession, token: CancellationToken): Promise { - if (ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.enterpriseProviderId) { + if (ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.provider?.enterprise.id) { this.logService.trace('[chat entitlement]: enterprise provider, assuming Enterprise plan'); return { entitlement: ChatEntitlement.Enterprise }; } @@ -857,9 +855,9 @@ export class ChatEntitlementRequests extends Disposable { } } - async signIn(options?: { useAlternateProvider?: boolean }) { + async signIn(options?: { useSocialProvider?: string }) { const providerId = ChatEntitlementRequests.providerId(this.configurationService); - const session = await this.authenticationService.createSession(providerId, defaultChat.providerScopes[0], options?.useAlternateProvider ? { provider: defaultChat.alternativeProviderId } : undefined); + const session = await this.authenticationService.createSession(providerId, defaultChat.providerScopes[0], options?.useSocialProvider ? { provider: options.useSocialProvider } : undefined); this.authenticationExtensionsService.updateAccountPreference(defaultChat.extensionId, providerId, session.account); this.authenticationExtensionsService.updateAccountPreference(defaultChat.chatExtensionId, providerId, session.account); diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.ts b/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.ts index f2172d92134..a7a2eb28265 100644 --- a/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.ts +++ b/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.ts @@ -19,7 +19,14 @@ interface IGettingStartedContentProvider { (): string; } -export const copilotSettingsMessage = localize({ key: 'settings', comment: ['{Locked="["}', '{Locked="]({0})"}', '{Locked="]({1})"}'] }, "{0} Copilot Free, Pro and Pro+ may show [public code]({1}) suggestions and we may use your data for product improvement. You can change these [settings]({2}) at any time.", product.defaultChatAgent?.providerName, product.defaultChatAgent?.publicCodeMatchesUrl, product.defaultChatAgent?.manageSettingsUrl); +const defaultChat = { + documentationUrl: product.defaultChatAgent?.documentationUrl ?? '', + manageSettingsUrl: product.defaultChatAgent?.manageSettingsUrl ?? '', + provider: product.defaultChatAgent?.provider ?? { default: { name: '' } }, + publicCodeMatchesUrl: product.defaultChatAgent?.publicCodeMatchesUrl ?? '', +}; + +export const copilotSettingsMessage = localize({ key: 'settings', comment: ['{Locked="["}', '{Locked="]({0})"}', '{Locked="]({1})"}'] }, "{0} Copilot Free, Pro and Pro+ may show [public code]({1}) suggestions and we may use your data for product improvement. You can change these [settings]({2}) at any time.", defaultChat.provider.default.name, defaultChat.publicCodeMatchesUrl, defaultChat.manageSettingsUrl); class GettingStartedContentProviderRegistry { @@ -217,7 +224,7 @@ export const startEntries: GettingStartedStartEntryContent = [ const Button = (title: string, href: string) => `[${title}](${href})`; const CopilotStepTitle = localize('gettingStarted.copilotSetup.title', "Use AI features with Copilot for free"); -const CopilotDescription = localize({ key: 'gettingStarted.copilotSetup.description', comment: ['{Locked="["}', '{Locked="]({0})"}'] }, "You can use [Copilot]({0}) to generate code across multiple files, fix errors, ask questions about your code and much more using natural language.", product.defaultChatAgent?.documentationUrl ?? ''); +const CopilotDescription = localize({ key: 'gettingStarted.copilotSetup.description', comment: ['{Locked="["}', '{Locked="]({0})"}'] }, "You can use [Copilot]({0}) to generate code across multiple files, fix errors, ask questions about your code and much more using natural language.", defaultChat.documentationUrl ?? ''); const CopilotSignedOutButton = Button(localize('setupCopilotButton.signIn', "Set up Copilot"), `command:workbench.action.chat.triggerSetup`); const CopilotSignedInButton = Button(localize('setupCopilotButton.setup', "Set up Copilot"), `command:workbench.action.chat.triggerSetup`); const CopilotCompleteButton = Button(localize('setupCopilotButton.chatWithCopilot', "Chat with Copilot"), 'command:workbench.action.chat.open');