Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/chatSessions/copilotcli/node/userInputHelpers.ts
13405 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 { UserInputRequestedEvent } from '@github/copilot/sdk';
7
import type { CancellationToken, ChatParticipantToolToken } from 'vscode';
8
import { createServiceIdentifier } from '../../../../util/common/services';
9
10
export type UserInputRequest = Omit<UserInputRequestedEvent['data'], 'requestId'>;
11
12
export type UserInputResponse = { answer: string; wasFreeform: boolean };
13
14
export const IUserQuestionHandler = createServiceIdentifier<IUserQuestionHandler>('IUserQuestionHandler');
15
16
export interface IQuestionOption {
17
readonly label: string;
18
readonly description?: string;
19
readonly recommended?: boolean;
20
}
21
22
export interface IQuestionAnswer {
23
readonly selected: string[];
24
readonly freeText: string | null;
25
readonly skipped: boolean;
26
}
27
28
export interface IQuestion {
29
readonly header: string;
30
readonly question: string;
31
readonly message?: string;
32
readonly multiSelect?: boolean;
33
readonly options?: IQuestionOption[];
34
readonly allowFreeformInput?: boolean;
35
}
36
37
export interface IUserQuestionHandler {
38
_serviceBrand: undefined;
39
askUserQuestion(question: IQuestion, toolInvocationToken: ChatParticipantToolToken, token: CancellationToken, toolCallId?: string): Promise<IQuestionAnswer | undefined>;
40
notifyQuestionCarouselAnswer?(toolCallId: string, question: IQuestion, response: UserInputResponse): Promise<void>;
41
}
42
43