Path: blob/main/extensions/copilot/src/extension/chatSessions/copilotcli/node/userInputHelpers.ts
13405 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 { UserInputRequestedEvent } from '@github/copilot/sdk';6import type { CancellationToken, ChatParticipantToolToken } from 'vscode';7import { createServiceIdentifier } from '../../../../util/common/services';89export type UserInputRequest = Omit<UserInputRequestedEvent['data'], 'requestId'>;1011export type UserInputResponse = { answer: string; wasFreeform: boolean };1213export const IUserQuestionHandler = createServiceIdentifier<IUserQuestionHandler>('IUserQuestionHandler');1415export interface IQuestionOption {16readonly label: string;17readonly description?: string;18readonly recommended?: boolean;19}2021export interface IQuestionAnswer {22readonly selected: string[];23readonly freeText: string | null;24readonly skipped: boolean;25}2627export interface IQuestion {28readonly header: string;29readonly question: string;30readonly message?: string;31readonly multiSelect?: boolean;32readonly options?: IQuestionOption[];33readonly allowFreeformInput?: boolean;34}3536export interface IUserQuestionHandler {37_serviceBrand: undefined;38askUserQuestion(question: IQuestion, toolInvocationToken: ChatParticipantToolToken, token: CancellationToken, toolCallId?: string): Promise<IQuestionAnswer | undefined>;39notifyQuestionCarouselAnswer?(toolCallId: string, question: IQuestion, response: UserInputResponse): Promise<void>;40}414243