Skip to content

Commit fa8e917

Browse files
Copilotalexr00
andcommitted
Initial plan for addressing review feedback
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent eef6223 commit fa8e917

2 files changed

Lines changed: 235 additions & 26 deletions

File tree

src/@types/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 195 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ declare module 'vscode' {
6666

6767
export class ChatResponseConfirmationPart {
6868
title: string;
69-
message: string;
69+
message: string | MarkdownString;
7070
data: any;
7171
buttons?: string[];
72-
constructor(title: string, message: string, data: any, buttons?: string[]);
72+
constructor(title: string, message: string | MarkdownString, data: any, buttons?: string[]);
7373
}
7474

7575
export class ChatResponseCodeCitationPart {
@@ -84,8 +84,83 @@ declare module 'vscode' {
8484
constructor(toolName: string);
8585
}
8686

87-
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatPrepareToolInvocationPart;
87+
export interface ChatTerminalToolInvocationData {
88+
commandLine: {
89+
original: string;
90+
userEdited?: string;
91+
toolEdited?: string;
92+
};
93+
language: string;
94+
}
95+
96+
export class ChatToolInvocationPart {
97+
toolName: string;
98+
toolCallId: string;
99+
isError?: boolean;
100+
invocationMessage?: string | MarkdownString;
101+
originMessage?: string | MarkdownString;
102+
pastTenseMessage?: string | MarkdownString;
103+
isConfirmed?: boolean;
104+
isComplete?: boolean;
105+
toolSpecificData?: ChatTerminalToolInvocationData;
106+
fromSubAgent?: boolean;
107+
108+
constructor(toolName: string, toolCallId: string, isError?: boolean);
109+
}
110+
111+
/**
112+
* Represents a single file diff entry in a multi diff view.
113+
*/
114+
export interface ChatResponseDiffEntry {
115+
/**
116+
* The original file URI (undefined for new files).
117+
*/
118+
originalUri?: Uri;
119+
120+
/**
121+
* The modified file URI (undefined for deleted files).
122+
*/
123+
modifiedUri?: Uri;
124+
125+
/**
126+
* Optional URI to navigate to when clicking on the file.
127+
*/
128+
goToFileUri?: Uri;
129+
130+
/**
131+
* Added data (e.g. line numbers) to show in the UI
132+
*/
133+
added?: number;
134+
135+
/**
136+
* Removed data (e.g. line numbers) to show in the UI
137+
*/
138+
removed?: number;
139+
}
140+
141+
/**
142+
* Represents a part of a chat response that shows multiple file diffs.
143+
*/
144+
export class ChatResponseMultiDiffPart {
145+
/**
146+
* Array of file diff entries to display.
147+
*/
148+
value: ChatResponseDiffEntry[];
149+
150+
/**
151+
* The title for the multi diff editor.
152+
*/
153+
title: string;
88154

155+
/**
156+
* Create a new ChatResponseMultiDiffPart.
157+
* @param value Array of file diff entries.
158+
* @param title The title for the multi diff editor.
159+
*/
160+
constructor(value: ChatResponseDiffEntry[], title: string);
161+
}
162+
163+
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart;
89164
export class ChatResponseWarningPart {
90165
value: MarkdownString;
91166
constructor(value: string | MarkdownString);
@@ -97,6 +172,23 @@ declare module 'vscode' {
97172
constructor(value: string, task?: (progress: Progress<ChatResponseWarningPart | ChatResponseReferencePart>) => Thenable<string | void>);
98173
}
99174

175+
/**
176+
* A specialized progress part for displaying thinking/reasoning steps.
177+
*/
178+
export class ChatResponseThinkingProgressPart {
179+
value: string | string[];
180+
id?: string;
181+
metadata?: { readonly [key: string]: any };
182+
task?: (progress: Progress<LanguageModelThinkingPart>) => Thenable<string | void>;
183+
184+
/**
185+
* Creates a new thinking progress part.
186+
* @param value An initial progress message
187+
* @param task A task that will emit thinking parts during its execution
188+
*/
189+
constructor(value: string | string[], id?: string, metadata?: { readonly [key: string]: any }, task?: (progress: Progress<LanguageModelThinkingPart>) => Thenable<string | void>);
190+
}
191+
100192
export class ChatResponseReferencePart2 {
101193
/**
102194
* The reference target.
@@ -171,6 +263,15 @@ declare module 'vscode' {
171263
constructor(extensions: string[]);
172264
}
173265

266+
export class ChatResponsePullRequestPart {
267+
readonly uri: Uri;
268+
readonly linkTag: string;
269+
readonly title: string;
270+
readonly description: string;
271+
readonly author: string;
272+
constructor(uri: Uri, title: string, description: string, author: string, linkTag: string);
273+
}
274+
174275
export interface ChatResponseStream {
175276

176277
/**
@@ -183,6 +284,8 @@ declare module 'vscode' {
183284
*/
184285
progress(value: string, task?: (progress: Progress<ChatResponseWarningPart | ChatResponseReferencePart>) => Thenable<string | void>): void;
185286

287+
thinkingProgress(thinkingDelta: ThinkingDelta): void;
288+
186289
textEdit(target: Uri, edits: TextEdit | TextEdit[]): void;
187290

188291
textEdit(target: Uri, isDone: true): void;
@@ -205,7 +308,7 @@ declare module 'vscode' {
205308
* TODO@API should this be MarkdownString?
206309
* TODO@API should actually be a more generic function that takes an array of buttons
207310
*/
208-
confirmation(title: string, message: string, data: any, buttons?: string[]): void;
311+
confirmation(title: string, message: string | MarkdownString, data: any, buttons?: string[]): void;
209312

210313
/**
211314
* Push a warning to this stream. Short-hand for
@@ -225,6 +328,8 @@ declare module 'vscode' {
225328
prepareToolInvocation(toolName: string): void;
226329

227330
push(part: ExtendedChatResponsePart): void;
331+
332+
clearToPreviousToolInvocation(reason: ChatResponseClearToPreviousToolInvocationReason): void;
228333
}
229334

230335
export enum ChatResponseReferencePartStatusKind {
@@ -233,6 +338,26 @@ declare module 'vscode' {
233338
Omitted = 3
234339
}
235340

341+
export type ThinkingDelta = {
342+
text?: string | string[];
343+
id: string;
344+
metadata?: { readonly [key: string]: any };
345+
} | {
346+
text?: string | string[];
347+
id?: string;
348+
metadata: { readonly [key: string]: any };
349+
} |
350+
{
351+
text: string | string[];
352+
id?: string;
353+
metadata?: { readonly [key: string]: any };
354+
};
355+
356+
export enum ChatResponseClearToPreviousToolInvocationReason {
357+
NoReason = 0,
358+
FilteredContentRetry = 1,
359+
CopyrightContentRetry = 2,
360+
}
236361

237362
/**
238363
* Does this piggy-back on the existing ChatRequest, or is it a different type of request entirely?
@@ -265,6 +390,43 @@ declare module 'vscode' {
265390
export const onDidChangeChatRequestTools: Event<ChatRequest>;
266391
}
267392

393+
export class LanguageModelToolExtensionSource {
394+
/**
395+
* ID of the extension that published the tool.
396+
*/
397+
readonly id: string;
398+
399+
/**
400+
* Label of the extension that published the tool.
401+
*/
402+
readonly label: string;
403+
404+
private constructor(id: string, label: string);
405+
}
406+
407+
export class LanguageModelToolMCPSource {
408+
/**
409+
* Editor-configured label of the MCP server that published the tool.
410+
*/
411+
readonly label: string;
412+
413+
/**
414+
* Server-defined name of the MCP server.
415+
*/
416+
readonly name: string;
417+
418+
/**
419+
* Server-defined instructions for MCP tool use.
420+
*/
421+
readonly instructions?: string;
422+
423+
private constructor(label: string, name: string, instructions?: string);
424+
}
425+
426+
export interface LanguageModelToolInformation {
427+
source: LanguageModelToolExtensionSource | LanguageModelToolMCPSource | undefined;
428+
}
429+
268430
// TODO@API fit this into the stream
269431
export interface ChatUsedContext {
270432
documents: ChatDocumentContext[];
@@ -314,6 +476,10 @@ declare module 'vscode' {
314476
participant?: string;
315477
command?: string;
316478
};
479+
/**
480+
* An optional detail string that will be rendered at the end of the response in certain UI contexts.
481+
*/
482+
details?: string;
317483
}
318484

319485
export namespace chat {
@@ -408,6 +574,17 @@ declare module 'vscode' {
408574
outcome: ChatEditingSessionActionOutcome;
409575
}
410576

577+
export interface ChatEditingHunkAction {
578+
// eslint-disable-next-line local/vscode-dts-string-type-literals
579+
kind: 'chatEditingHunkAction';
580+
uri: Uri;
581+
lineCount: number;
582+
linesAdded: number;
583+
linesRemoved: number;
584+
outcome: ChatEditingSessionActionOutcome;
585+
hasRemainingEdits: boolean;
586+
}
587+
411588
export enum ChatEditingSessionActionOutcome {
412589
Accepted = 1,
413590
Rejected = 2,
@@ -416,14 +593,19 @@ declare module 'vscode' {
416593

417594
export interface ChatUserActionEvent {
418595
readonly result: ChatResult;
419-
readonly action: ChatCopyAction | ChatInsertAction | ChatApplyAction | ChatTerminalAction | ChatCommandAction | ChatFollowupAction | ChatBugReportAction | ChatEditorAction | ChatEditingSessionAction;
596+
readonly action: ChatCopyAction | ChatInsertAction | ChatApplyAction | ChatTerminalAction | ChatCommandAction | ChatFollowupAction | ChatBugReportAction | ChatEditorAction | ChatEditingSessionAction | ChatEditingHunkAction;
420597
}
421598

422599
export interface ChatPromptReference {
423600
/**
424601
* TODO Needed for now to drive the variableName-type reference, but probably both of these should go away in the future.
425602
*/
426603
readonly name: string;
604+
605+
/**
606+
* The list of tools were referenced in the value of the reference
607+
*/
608+
readonly toolReferences?: readonly ChatLanguageModelToolReference[];
427609
}
428610

429611
export interface ChatResultFeedback {
@@ -465,6 +647,13 @@ declare module 'vscode' {
465647
}
466648

467649
export interface ChatRequest {
468-
modeInstructions?: string;
650+
readonly modeInstructions?: string;
651+
readonly modeInstructions2?: ChatRequestModeInstructions;
652+
}
653+
654+
export interface ChatRequestModeInstructions {
655+
readonly content: string;
656+
readonly toolReferences?: readonly ChatLanguageModelToolReference[];
657+
readonly metadata?: Record<string, boolean | string | number>;
469658
}
470659
}

0 commit comments

Comments
 (0)