Skip to content

Commit 93256a5

Browse files
Copilotjoshspicer
andcommitted
Addressing PR comments
Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
1 parent 9249692 commit 93256a5

3 files changed

Lines changed: 161 additions & 25 deletions

File tree

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

Lines changed: 135 additions & 5 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,72 @@ 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+
107+
constructor(toolName: string, toolCallId: string, isError?: boolean);
108+
}
109+
110+
/**
111+
* Represents a single file diff entry in a multi diff view.
112+
*/
113+
export interface ChatResponseDiffEntry {
114+
/**
115+
* The original file URI (undefined for new files).
116+
*/
117+
originalUri?: Uri;
118+
119+
/**
120+
* The modified file URI (undefined for deleted files).
121+
*/
122+
modifiedUri?: Uri;
123+
124+
/**
125+
* Optional URI to navigate to when clicking on the file.
126+
*/
127+
goToFileUri?: Uri;
128+
}
88129

130+
/**
131+
* Represents a part of a chat response that shows multiple file diffs.
132+
*/
133+
export class ChatResponseMultiDiffPart {
134+
/**
135+
* Array of file diff entries to display.
136+
*/
137+
value: ChatResponseDiffEntry[];
138+
139+
/**
140+
* The title for the multi diff editor.
141+
*/
142+
title: string;
143+
144+
/**
145+
* Create a new ChatResponseMultiDiffPart.
146+
* @param value Array of file diff entries.
147+
* @param title The title for the multi diff editor.
148+
*/
149+
constructor(value: ChatResponseDiffEntry[], title: string);
150+
}
151+
152+
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart;
89153
export class ChatResponseWarningPart {
90154
value: MarkdownString;
91155
constructor(value: string | MarkdownString);
@@ -171,6 +235,15 @@ declare module 'vscode' {
171235
constructor(extensions: string[]);
172236
}
173237

238+
export class ChatResponsePullRequestPart {
239+
readonly uri: Uri;
240+
readonly linkTag: string;
241+
readonly title: string;
242+
readonly description: string;
243+
readonly author: string;
244+
constructor(uri: Uri, title: string, description: string, author: string, linkTag: string);
245+
}
246+
174247
export interface ChatResponseStream {
175248

176249
/**
@@ -205,7 +278,7 @@ declare module 'vscode' {
205278
* TODO@API should this be MarkdownString?
206279
* TODO@API should actually be a more generic function that takes an array of buttons
207280
*/
208-
confirmation(title: string, message: string, data: any, buttons?: string[]): void;
281+
confirmation(title: string, message: string | MarkdownString, data: any, buttons?: string[]): void;
209282

210283
/**
211284
* Push a warning to this stream. Short-hand for
@@ -258,6 +331,50 @@ declare module 'vscode' {
258331
readonly tools: Map<string, boolean>;
259332
}
260333

334+
export namespace lm {
335+
/**
336+
* Fired when the set of tools on a chat request changes.
337+
*/
338+
export const onDidChangeChatRequestTools: Event<ChatRequest>;
339+
}
340+
341+
export class LanguageModelToolExtensionSource {
342+
/**
343+
* ID of the extension that published the tool.
344+
*/
345+
readonly id: string;
346+
347+
/**
348+
* Label of the extension that published the tool.
349+
*/
350+
readonly label: string;
351+
352+
private constructor(id: string, label: string);
353+
}
354+
355+
export class LanguageModelToolMCPSource {
356+
/**
357+
* Editor-configured label of the MCP server that published the tool.
358+
*/
359+
readonly label: string;
360+
361+
/**
362+
* Server-defined name of the MCP server.
363+
*/
364+
readonly name: string;
365+
366+
/**
367+
* Server-defined instructions for MCP tool use.
368+
*/
369+
readonly instructions?: string;
370+
371+
private constructor(label: string, name: string, instructions?: string);
372+
}
373+
374+
export interface LanguageModelToolInformation {
375+
source: LanguageModelToolExtensionSource | LanguageModelToolMCPSource | undefined;
376+
}
377+
261378
// TODO@API fit this into the stream
262379
export interface ChatUsedContext {
263380
documents: ChatDocumentContext[];
@@ -307,6 +424,10 @@ declare module 'vscode' {
307424
participant?: string;
308425
command?: string;
309426
};
427+
/**
428+
* An optional detail string that will be rendered at the end of the response in certain UI contexts.
429+
*/
430+
details?: string;
310431
}
311432

312433
export namespace chat {
@@ -401,6 +522,15 @@ declare module 'vscode' {
401522
outcome: ChatEditingSessionActionOutcome;
402523
}
403524

525+
export interface ChatEditingHunkAction {
526+
// eslint-disable-next-line local/vscode-dts-string-type-literals
527+
kind: 'chatEditingHunkAction';
528+
uri: Uri;
529+
lineCount: number;
530+
outcome: ChatEditingSessionActionOutcome;
531+
hasRemainingEdits: boolean;
532+
}
533+
404534
export enum ChatEditingSessionActionOutcome {
405535
Accepted = 1,
406536
Rejected = 2,
@@ -409,7 +539,7 @@ declare module 'vscode' {
409539

410540
export interface ChatUserActionEvent {
411541
readonly result: ChatResult;
412-
readonly action: ChatCopyAction | ChatInsertAction | ChatApplyAction | ChatTerminalAction | ChatCommandAction | ChatFollowupAction | ChatBugReportAction | ChatEditorAction | ChatEditingSessionAction;
542+
readonly action: ChatCopyAction | ChatInsertAction | ChatApplyAction | ChatTerminalAction | ChatCommandAction | ChatFollowupAction | ChatBugReportAction | ChatEditorAction | ChatEditingSessionAction | ChatEditingHunkAction;
413543
}
414544

415545
export interface ChatPromptReference {

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

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,31 @@ declare module 'vscode' {
137137
/**
138138
* @hidden
139139
*/
140-
private constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined);
140+
constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined);
141+
}
142+
143+
export class ChatResponseTurn2 {
144+
/**
145+
* The content that was received from the chat participant. Only the stream parts that represent actual content (not metadata) are represented.
146+
*/
147+
readonly response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart | ExtendedChatResponsePart | ChatToolInvocationPart>;
148+
149+
/**
150+
* The result that was received from the chat participant.
151+
*/
152+
readonly result: ChatResult;
153+
154+
/**
155+
* The id of the chat participant that this response came from.
156+
*/
157+
readonly participant: string;
158+
159+
/**
160+
* The name of the command that this response came from.
161+
*/
162+
readonly command?: string;
163+
164+
constructor(response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart | ExtendedChatResponsePart>, result: ChatResult, participant: string);
141165
}
142166

143167
export interface ChatParticipant {
@@ -205,24 +229,6 @@ declare module 'vscode' {
205229
presentation?: 'hidden' | undefined;
206230
}
207231

208-
export interface LanguageModelTool<T> {
209-
prepareInvocation2?(options: LanguageModelToolInvocationPrepareOptions<T>, token: CancellationToken): ProviderResult<PreparedTerminalToolInvocation>;
210-
}
211-
212-
export class PreparedTerminalToolInvocation {
213-
readonly command: string;
214-
readonly language: string;
215-
readonly confirmationMessages?: LanguageModelToolConfirmationMessages;
216-
readonly presentation?: 'hidden' | undefined;
217-
218-
constructor(
219-
command: string,
220-
language: string,
221-
confirmationMessages?: LanguageModelToolConfirmationMessages,
222-
presentation?: 'hidden'
223-
);
224-
}
225-
226232
export class ExtendedLanguageModelToolResult extends LanguageModelToolResult {
227233
toolResultMessage?: string | MarkdownString;
228234
toolResultDetails?: Array<Uri | Location>;

src/github/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*--------------------------------------------------------------------------------------------*/
55
'use strict';
66

7-
import * as OctokitTypes from '@octokit/types';
87
import * as crypto from 'crypto';
8+
import * as OctokitTypes from '@octokit/types';
99
import * as vscode from 'vscode';
1010
import { Repository } from '../api/api';
1111
import { GitApiImpl } from '../api/api1';

0 commit comments

Comments
 (0)