Path: blob/main/extensions/copilot/src/platform/authentication/common/authenticationUpgrade.ts
13401 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import type { ChatContext, ChatRequest, ChatResponseStream } from 'vscode';6import { createServiceIdentifier } from '../../../util/common/services';7import { Event } from '../../../util/vs/base/common/event';8910export const IAuthenticationChatUpgradeService = createServiceIdentifier<IAuthenticationChatUpgradeService>('IAuthenticationChatUpgradeService');1112export interface IAuthenticationChatUpgradeService {13_serviceBrand: undefined;1415readonly onDidGrantAuthUpgrade: Event<void>;1617/**18* Checks if the user should be prompted for a permissive session upgrade.19* @returns Promise<boolean> - indicating whether an upgrade is required.20*/21shouldRequestPermissiveSessionUpgrade(): Promise<boolean>;2223/**24* Displays a modal dialog requesting the user to grant an upgrade to a more permissive session.25* @returns A promise that resolves to a boolean indicating whether the user granted the upgrade.26*/27showPermissiveSessionModal(skipRepeatCheck?: boolean): Promise<boolean>;2829/**30* Presents the upgrade prompt within the chat interface itself.31* @param stream - The live chat response stream where the prompt will be rendered.32* @param data - The initial chat request data for context.33* @param detail - Optional detail overriding34*/35showPermissiveSessionUpgradeInChat(stream: ChatResponseStream, data: ChatRequest, detail?: string, context?: ChatContext): void;3637/**38* Manages the user's input regarding the confirmation request for a session upgrade.39* @param request - The chat request object containing details necessary for the upgrade flow.40* @returns Promise<ChatRequest> - The ChatRequest that was originally presented the confirmation, or the request that41* was passed in if we don't detect that the confirmation was presented.42*/43handleConfirmationRequest(stream: ChatResponseStream, request: ChatRequest, history: ChatContext['history']): Promise<ChatRequest>;44}454647