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