Path: blob/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts
3290 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*--------------------------------------------------------------------------------------------*/45// version: 1067declare module 'vscode' {89/**10* The location at which the chat is happening.11*/12export enum ChatLocation {13/**14* The chat panel15*/16Panel = 1,17/**18* Terminal inline chat19*/20Terminal = 2,21/**22* Notebook inline chat23*/24Notebook = 3,25/**26* Code editor inline chat27*/28Editor = 4,29}3031export class ChatRequestEditorData {32//TODO@API should be the editor33document: TextDocument;34selection: Selection;35wholeRange: Range;3637constructor(document: TextDocument, selection: Selection, wholeRange: Range);38}3940export class ChatRequestNotebookData {41//TODO@API should be the editor42readonly cell: TextDocument;4344constructor(cell: TextDocument);45}4647export interface ChatRequest {48/**49* The id of the chat request. Used to identity an interaction with any of the chat surfaces.50*/51readonly id: string;52/**53* The attempt number of the request. The first request has attempt number 0.54*/55readonly attempt: number;5657/**58* If automatic command detection is enabled.59*/60readonly enableCommandDetection: boolean;6162/**63* If the chat participant or command was automatically assigned.64*/65readonly isParticipantDetected: boolean;6667/**68* The location at which the chat is happening. This will always be one of the supported values69*70* @deprecated71*/72readonly location: ChatLocation;7374/**75* Information that is specific to the location at which chat is happening, e.g within a document, notebook,76* or terminal. Will be `undefined` for the chat panel.77*/78readonly location2: ChatRequestEditorData | ChatRequestNotebookData | undefined;7980/**81* Events for edited files in this session collected since the last request.82*/83readonly editedFileEvents?: ChatRequestEditedFileEvent[];84}8586export enum ChatRequestEditedFileEventKind {87Keep = 1,88Undo = 2,89UserModification = 3,90}9192export interface ChatRequestEditedFileEvent {93readonly uri: Uri;94readonly eventKind: ChatRequestEditedFileEventKind;95}9697/**98* ChatRequestTurn + private additions. Note- at runtime this is the SAME as ChatRequestTurn and instanceof is safe.99*/100export class ChatRequestTurn2 {101/**102* The prompt as entered by the user.103*104* Information about references used in this request is stored in {@link ChatRequestTurn.references}.105*106* *Note* that the {@link ChatParticipant.name name} of the participant and the {@link ChatCommand.name command}107* are not part of the prompt.108*/109readonly prompt: string;110111/**112* The id of the chat participant to which this request was directed.113*/114readonly participant: string;115116/**117* The name of the {@link ChatCommand command} that was selected for this request.118*/119readonly command?: string;120121/**122* The references that were used in this message.123*/124readonly references: ChatPromptReference[];125126/**127* The list of tools were attached to this request.128*/129readonly toolReferences: readonly ChatLanguageModelToolReference[];130131/**132* Events for edited files in this session collected between the previous request and this one.133*/134readonly editedFileEvents?: ChatRequestEditedFileEvent[];135136/**137* @hidden138*/139constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined);140}141142export class ChatResponseTurn2 {143/**144* The content that was received from the chat participant. Only the stream parts that represent actual content (not metadata) are represented.145*/146readonly response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart | ExtendedChatResponsePart | ChatToolInvocationPart>;147148/**149* The result that was received from the chat participant.150*/151readonly result: ChatResult;152153/**154* The id of the chat participant that this response came from.155*/156readonly participant: string;157158/**159* The name of the command that this response came from.160*/161readonly command?: string;162163constructor(response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart | ExtendedChatResponsePart>, result: ChatResult, participant: string);164}165166export interface ChatParticipant {167supportIssueReporting?: boolean;168}169170export enum ChatErrorLevel {171Info = 0,172Warning = 1,173Error = 2,174}175176export interface ChatErrorDetails {177/**178* If set to true, the message content is completely hidden. Only ChatErrorDetails#message will be shown.179*/180responseIsRedacted?: boolean;181182isQuotaExceeded?: boolean;183184level?: ChatErrorLevel;185186code?: string;187}188189export namespace chat {190export function createDynamicChatParticipant(id: string, dynamicProps: DynamicChatParticipantProps, handler: ChatExtendedRequestHandler): ChatParticipant;191}192193/**194* These don't get set on the ChatParticipant after creation, like other props, because they are typically defined in package.json and we want them at the time of creation.195*/196export interface DynamicChatParticipantProps {197name: string;198publisherName: string;199description?: string;200fullName?: string;201}202203export namespace lm {204export function registerIgnoredFileProvider(provider: LanguageModelIgnoredFileProvider): Disposable;205}206207export interface LanguageModelIgnoredFileProvider {208provideFileIgnored(uri: Uri, token: CancellationToken): ProviderResult<boolean>;209}210211export interface LanguageModelToolInvocationOptions<T> {212chatRequestId?: string;213chatSessionId?: string;214chatInteractionId?: string;215terminalCommand?: string;216}217218export interface LanguageModelToolInvocationPrepareOptions<T> {219/**220* The input that the tool is being invoked with.221*/222input: T;223chatRequestId?: string;224chatSessionId?: string;225chatInteractionId?: string;226}227228export interface PreparedToolInvocation {229pastTenseMessage?: string | MarkdownString;230presentation?: 'hidden' | undefined;231}232233export class ExtendedLanguageModelToolResult extends LanguageModelToolResult {234toolResultMessage?: string | MarkdownString;235toolResultDetails?: Array<Uri | Location>;236}237238// #region Chat participant detection239240export interface ChatParticipantMetadata {241participant: string;242command?: string;243disambiguation: { category: string; description: string; examples: string[] }[];244}245246export interface ChatParticipantDetectionResult {247participant: string;248command?: string;249}250251export interface ChatParticipantDetectionProvider {252provideParticipantDetection(chatRequest: ChatRequest, context: ChatContext, options: { participants?: ChatParticipantMetadata[]; location: ChatLocation }, token: CancellationToken): ProviderResult<ChatParticipantDetectionResult>;253}254255export namespace chat {256export function registerChatParticipantDetectionProvider(participantDetectionProvider: ChatParticipantDetectionProvider): Disposable;257258export const onDidDisposeChatSession: Event<string>;259}260261// #endregion262263// #region ChatErrorDetailsWithConfirmation264265export interface ChatErrorDetails {266confirmationButtons?: ChatErrorDetailsConfirmationButton[];267}268269export interface ChatErrorDetailsConfirmationButton {270data: any;271label: string;272}273274// #endregion275}276277278