Skip to content

Commit cf08027

Browse files
Copilotalexr00
andcommitted
initial plan for checkout PR in worktree feature
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent b44c1ed commit cf08027

File tree

4 files changed

+297
-39
lines changed

4 files changed

+297
-39
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ declare module 'vscode' {
9393
/**
9494
* An optional command that is executed when the context item is clicked.
9595
* The original context item will be passed as the first argument to the command.
96-
* The original context item will be passed as the first argument to the command.
9796
*/
9897
command?: Command;
9998
}
@@ -158,7 +157,6 @@ declare module 'vscode' {
158157
* `resolveChatContext` is only called for items that do not have a `value`.
159158
*
160159
* Called when the resource is a webview or a text editor.
161-
* Called when the resource is a webview or a text editor.
162160
*
163161
* @param options Options include the resource for which to provide context.
164162
* @param token A cancellation token.

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

Lines changed: 219 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
// version: 3
7+
68
declare module 'vscode' {
79

810
export interface ChatParticipant {
@@ -96,6 +98,108 @@ declare module 'vscode' {
9698
constructor(title: string, message: string | MarkdownString, data: any, buttons?: string[]);
9799
}
98100

101+
/**
102+
* An option for a question in a carousel.
103+
*/
104+
export interface ChatQuestionOption {
105+
/**
106+
* Unique identifier for the option.
107+
*/
108+
id: string;
109+
/**
110+
* The display label for the option.
111+
*/
112+
label: string;
113+
/**
114+
* The value returned when this option is selected.
115+
*/
116+
value: unknown;
117+
}
118+
119+
/**
120+
* The type of question for a chat question carousel.
121+
*/
122+
export enum ChatQuestionType {
123+
/**
124+
* A free-form text input question.
125+
*/
126+
Text = 1,
127+
/**
128+
* A single-select question with radio buttons.
129+
*/
130+
SingleSelect = 2,
131+
/**
132+
* A multi-select question with checkboxes.
133+
*/
134+
MultiSelect = 3
135+
}
136+
137+
/**
138+
* A question to be displayed in a question carousel.
139+
*/
140+
export class ChatQuestion {
141+
/**
142+
* Unique identifier for the question.
143+
*/
144+
id: string;
145+
/**
146+
* The type of question: Text for free-form input, SingleSelect for radio buttons, MultiSelect for checkboxes.
147+
*/
148+
type: ChatQuestionType;
149+
/**
150+
* The title/header of the question.
151+
*/
152+
title: string;
153+
/**
154+
* Optional detailed message or description for the question.
155+
*/
156+
message?: string | MarkdownString;
157+
/**
158+
* Options for singleSelect or multiSelect questions.
159+
*/
160+
options?: ChatQuestionOption[];
161+
/**
162+
* The id(s) of the default selected option(s).
163+
* For SingleSelect, this should be a single option id.
164+
* For MultiSelect, this can be an array of option ids.
165+
*/
166+
defaultValue?: string | string[];
167+
/**
168+
* Whether to allow free-form text input in addition to predefined options.
169+
* When true, users can provide their own text answer even for SingleSelect or MultiSelect questions.
170+
*/
171+
allowFreeformInput?: boolean;
172+
173+
constructor(
174+
id: string,
175+
type: ChatQuestionType,
176+
title: string,
177+
options?: {
178+
message?: string | MarkdownString;
179+
options?: ChatQuestionOption[];
180+
defaultValue?: string | string[];
181+
allowFreeformInput?: boolean;
182+
}
183+
);
184+
}
185+
186+
/**
187+
* A carousel view for presenting multiple questions inline in the chat.
188+
* The UI is displayed but does not block the chat input.
189+
*/
190+
export class ChatResponseQuestionCarouselPart {
191+
/**
192+
* The questions to display in the carousel.
193+
*/
194+
questions: ChatQuestion[];
195+
/**
196+
* Whether users can skip answering the questions.
197+
*/
198+
allowSkip: boolean;
199+
200+
constructor(questions: ChatQuestion[], allowSkip?: boolean);
201+
}
202+
99203
export class ChatResponseCodeCitationPart {
100204
value: Uri;
101205
license: string;
@@ -162,6 +266,66 @@ declare module 'vscode' {
162266
output: McpToolInvocationContentData[];
163267
}
164268

269+
export enum ChatTodoStatus {
270+
NotStarted = 1,
271+
InProgress = 2,
272+
Completed = 3
273+
}
274+
275+
export interface ChatTodoToolInvocationData {
276+
todoList: Array<{
277+
id: number;
278+
title: string;
279+
status: ChatTodoStatus;
280+
}>;
281+
}
282+
283+
/**
284+
* Generic tool result data that displays input and output in collapsible sections.
285+
*/
286+
export interface ChatSimpleToolResultData {
287+
/**
288+
* The input to display.
289+
*/
290+
input: string;
291+
/**
292+
* The output to display.
293+
*/
294+
output: string;
295+
}
296+
297+
298+
export interface ChatToolResourcesInvocationData {
299+
/**
300+
* Array of file URIs or locations to display as a collapsible list
301+
*/
302+
values: Array<Uri | Location>;
303+
}
304+
305+
export class ChatSubagentToolInvocationData {
306+
/**
307+
* A description of the subagent's purpose or task.
308+
*/
309+
description?: string;
310+
311+
/**
312+
* The name of the subagent being invoked.
313+
*/
314+
agentName?: string;
315+
316+
/**
317+
* The prompt given to the subagent.
318+
*/
319+
prompt?: string;
320+
321+
/**
322+
* The result text from the subagent after completion.
323+
*/
324+
result?: string;
325+
326+
constructor(description?: string, agentName?: string, prompt?: string, result?: string);
327+
}
328+
165329
export class ChatToolInvocationPart {
166330
toolName: string;
167331
toolCallId: string;
@@ -171,11 +335,16 @@ declare module 'vscode' {
171335
pastTenseMessage?: string | MarkdownString;
172336
isConfirmed?: boolean;
173337
isComplete?: boolean;
174-
toolSpecificData?: ChatTerminalToolInvocationData;
175-
fromSubAgent?: boolean;
338+
toolSpecificData?: ChatTerminalToolInvocationData | ChatMcpToolInvocationData | ChatTodoToolInvocationData | ChatSimpleToolResultData | ChatToolResourcesInvocationData | ChatSubagentToolInvocationData;
339+
subAgentInvocationId?: string;
176340
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
177341

178-
constructor(toolName: string, toolCallId: string, isError?: boolean);
342+
/**
343+
* If this flag is set, this will be treated as an update to any previous tool call with the same id.
344+
*/
345+
enablePartialUpdate?: boolean;
346+
347+
constructor(toolName: string, toolCallId: string, errorMessage?: string);
179348
}
180349

181350
/**
@@ -244,7 +413,31 @@ declare module 'vscode' {
244413
constructor(uris: Uri[], callback: () => Thenable<unknown>);
245414
}
246415

247-
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart;
416+
/**
417+
* Internal type that lists all the proposed chat response parts. This is used to generate `ExtendedChatResponsePart`
418+
* which is the actual type used in this API. This is done so that other proposals can easily add their own response parts
419+
* without having to modify this file.
420+
*/
421+
export interface ExtendedChatResponseParts {
422+
ChatResponsePart: ChatResponsePart;
423+
ChatResponseTextEditPart: ChatResponseTextEditPart;
424+
ChatResponseNotebookEditPart: ChatResponseNotebookEditPart;
425+
ChatResponseWorkspaceEditPart: ChatResponseWorkspaceEditPart;
426+
ChatResponseConfirmationPart: ChatResponseConfirmationPart;
427+
ChatResponseCodeCitationPart: ChatResponseCodeCitationPart;
428+
ChatResponseReferencePart2: ChatResponseReferencePart2;
429+
ChatResponseMovePart: ChatResponseMovePart;
430+
ChatResponseExtensionsPart: ChatResponseExtensionsPart;
431+
ChatResponsePullRequestPart: ChatResponsePullRequestPart;
432+
ChatToolInvocationPart: ChatToolInvocationPart;
433+
ChatResponseMultiDiffPart: ChatResponseMultiDiffPart;
434+
ChatResponseThinkingProgressPart: ChatResponseThinkingProgressPart;
435+
ChatResponseExternalEditPart: ChatResponseExternalEditPart;
436+
ChatResponseQuestionCarouselPart: ChatResponseQuestionCarouselPart;
437+
}
438+
439+
export type ExtendedChatResponsePart = ExtendedChatResponseParts[keyof ExtendedChatResponseParts];
440+
248441
export class ChatResponseWarningPart {
249442
value: MarkdownString;
250443
constructor(value: string | MarkdownString);
@@ -348,12 +541,16 @@ declare module 'vscode' {
348541
}
349542

350543
export class ChatResponsePullRequestPart {
351-
readonly uri: Uri;
544+
/**
545+
* @deprecated use `command` instead
546+
*/
547+
readonly uri?: Uri;
548+
readonly command: Command;
352549
readonly linkTag: string;
353550
readonly title: string;
354551
readonly description: string;
355552
readonly author: string;
356-
constructor(uri: Uri, title: string, description: string, author: string, linkTag: string);
553+
constructor(uriOrCommand: Uri | Command, title: string, description: string, author: string, linkTag: string);
357554
}
358555

359556
export interface ChatResponseStream {
@@ -408,6 +605,15 @@ declare module 'vscode' {
408605
*/
409606
confirmation(title: string, message: string | MarkdownString, data: any, buttons?: string[]): void;
410607

608+
/**
609+
* Show an inline carousel of questions to gather information from the user.
610+
* This is a blocking call that waits for the user to submit or skip the questions.
611+
* @param questions Array of questions to display to the user
612+
* @param allowSkip Whether the user can skip questions without answering
613+
* @returns A promise that resolves with the user's answers, or undefined if skipped
614+
*/
615+
questionCarousel(questions: ChatQuestion[], allowSkip?: boolean): Thenable<Record<string, unknown> | undefined>;
616+
411617
/**
412618
* Push a warning to this stream. Short-hand for
413619
* `push(new ChatResponseWarningPart(message))`.
@@ -442,6 +648,13 @@ declare module 'vscode' {
442648
push(part: ExtendedChatResponsePart): void;
443649

444650
clearToPreviousToolInvocation(reason: ChatResponseClearToPreviousToolInvocationReason): void;
651+
652+
/**
653+
* Report token usage information for this request.
654+
* This is typically called when the underlying language model provides usage statistics.
655+
* @param usage Token usage information including prompt and completion tokens
656+
*/
657+
usage(usage: ChatResultUsage): void;
445658
}
446659

447660
export enum ChatResponseReferencePartStatusKind {
@@ -633,12 +846,6 @@ declare module 'vscode' {
633846
* An optional detail string that will be rendered at the end of the response in certain UI contexts.
634847
*/
635848
details?: string;
636-
637-
/**
638-
* Token usage information for this request, if available.
639-
* This is typically provided by the underlying language model.
640-
*/
641-
readonly usage?: ChatResultUsage;
642849
}
643850

644851
export namespace chat {

0 commit comments

Comments
 (0)