Skip to content

Commit 6c9b128

Browse files
committed
Revert proposal changes
1 parent 2b0f858 commit 6c9b128

4 files changed

Lines changed: 40 additions & 264 deletions

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

Lines changed: 13 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,16 @@ declare module 'vscode' {
1111
export namespace chat {
1212

1313
/**
14-
* Register a chat workspace context provider. Workspace context is automatically included in all chat requests.
14+
* Register a chat context provider. Chat context can be provided:
15+
* - For a resource. Make sure to pass a selector that matches the resource you want to provide context for.
16+
* Providers registered without a selector will not be called for resource-based context.
17+
* - Explicitly. These context items are shown as options when the user explicitly attaches context.
1518
*
1619
* To ensure your extension is activated when chat context is requested, make sure to include the following activations events:
1720
* - If your extension implements `provideWorkspaceChatContext` or `provideChatContextForResource`, find an activation event which is a good signal to activate.
1821
* Ex: `onLanguage:<languageId>`, `onWebviewPanel:<viewType>`, etc.`
1922
* - If your extension implements `provideChatContextExplicit`, your extension will be automatically activated when the user requests explicit context.
2023
*
21-
* @param id Unique identifier for the provider.
22-
* @param provider The chat workspace context provider.
23-
*/
24-
export function registerChatWorkspaceContextProvider(id: string, provider: ChatWorkspaceContextProvider): Disposable;
25-
26-
/**
27-
* Register a chat explicit context provider. Explicit context items are shown as options when the user explicitly attaches context.
28-
*
29-
* To ensure your extension is activated when chat context is requested, make sure to include the `onChatContextProvider:<id>` activation event in your `package.json`.
30-
*
31-
* @param id Unique identifier for the provider.
32-
* @param provider The chat explicit context provider.
33-
*/
34-
export function registerChatExplicitContextProvider(id: string, provider: ChatExplicitContextProvider): Disposable;
35-
36-
/**
37-
* Register a chat resource context provider. Resource context is provided for a specific resource.
38-
* Make sure to pass a selector that matches the resource you want to provide context for.
39-
*
40-
* To ensure your extension is activated when chat context is requested, make sure to include the `onChatContextProvider:<id>` activation event in your `package.json`.
41-
*
42-
* @param selector Document selector to filter which resources the provider is called for.
43-
* @param id Unique identifier for the provider.
44-
* @param provider The chat resource context provider.
45-
*/
46-
export function registerChatResourceContextProvider(selector: DocumentSelector, id: string, provider: ChatResourceContextProvider): Disposable;
47-
48-
/**
49-
* Register a chat context provider.
50-
*
51-
* @deprecated Use {@link registerChatWorkspaceContextProvider}, {@link registerChatExplicitContextProvider}, or {@link registerChatResourceContextProvider} instead.
52-
*
5324
* @param selector Optional document selector to filter which resources the provider is called for. If omitted, the provider will only be called for explicit context requests.
5425
* @param id Unique identifier for the provider.
5526
* @param provider The chat context provider.
@@ -61,21 +32,12 @@ declare module 'vscode' {
6132
export interface ChatContextItem {
6233
/**
6334
* Icon for the context item.
64-
* - If `icon` is not defined, no icon is shown.
65-
* - If `icon` is defined and is a file or folder icon, the icon is derived from {@link resourceUri} if `resourceUri` is defined.
66-
* - Otherwise, `icon` is used.
6735
*/
68-
icon?: ThemeIcon;
36+
icon: ThemeIcon;
6937
/**
7038
* Human readable label for the context item.
71-
* If not set, the label is derived from {@link resourceUri}.
72-
*/
73-
label?: string;
74-
/**
75-
* A resource URI for the context item.
76-
* Used to derive the {@link label} and {@link icon} if they are not set.
7739
*/
78-
resourceUri?: Uri;
40+
label: string;
7941
/**
8042
* An optional description of the context item, e.g. to describe the item to the language model.
8143
*/
@@ -95,24 +57,23 @@ declare module 'vscode' {
9557
command?: Command;
9658
}
9759

98-
export interface ChatWorkspaceContextProvider<T extends ChatContextItem = ChatContextItem> {
60+
export interface ChatContextProvider<T extends ChatContextItem = ChatContextItem> {
9961

10062
/**
10163
* An optional event that should be fired when the workspace chat context has changed.
10264
*/
10365
onDidChangeWorkspaceChatContext?: Event<void>;
10466

10567
/**
68+
* TODO @API: should this be a separate provider interface?
69+
*
10670
* Provide a list of chat context items to be included as workspace context for all chat requests.
10771
* This should be used very sparingly to avoid providing useless context and to avoid using up the context window.
10872
* A good example use case is to provide information about which branch the user is working on in a source control context.
10973
*
11074
* @param token A cancellation token.
11175
*/
112-
provideChatContext(token: CancellationToken): ProviderResult<T[]>;
113-
}
114-
115-
export interface ChatExplicitContextProvider<T extends ChatContextItem = ChatContextItem> {
76+
provideWorkspaceChatContext?(token: CancellationToken): ProviderResult<T[]>;
11677

11778
/**
11879
* Provide a list of chat context items that a user can choose from. These context items are shown as options when the user explicitly attaches context.
@@ -121,18 +82,7 @@ declare module 'vscode' {
12182
*
12283
* @param token A cancellation token.
12384
*/
124-
provideChatContext(token: CancellationToken): ProviderResult<T[]>;
125-
126-
/**
127-
* If a chat context item is provided without a `value`, this method is called to resolve the `value` for the item.
128-
*
129-
* @param context The context item to resolve.
130-
* @param token A cancellation token.
131-
*/
132-
resolveChatContext(context: T, token: CancellationToken): ProviderResult<ChatContextItem>;
133-
}
134-
135-
export interface ChatResourceContextProvider<T extends ChatContextItem = ChatContextItem> {
85+
provideChatContextExplicit?(token: CancellationToken): ProviderResult<T[]>;
13686

13787
/**
13888
* Given a particular resource, provide a chat context item for it. This is used for implicit context (see the settings `chat.implicitContext.enabled` and `chat.implicitContext.suggestedContext`).
@@ -144,51 +94,15 @@ declare module 'vscode' {
14494
* @param options Options include the resource for which to provide context.
14595
* @param token A cancellation token.
14696
*/
147-
provideChatContext(options: { resource: Uri }, token: CancellationToken): ProviderResult<T | undefined>;
97+
provideChatContextForResource?(options: { resource: Uri }, token: CancellationToken): ProviderResult<T | undefined>;
14898

14999
/**
150-
* If a chat context item is provided without a `value`, this method is called to resolve the `value` for the item.
100+
* If a chat context item is provided without a `value`, from either of the `provide` methods, this method is called to resolve the `value` for the item.
151101
*
152102
* @param context The context item to resolve.
153103
* @param token A cancellation token.
154104
*/
155105
resolveChatContext(context: T, token: CancellationToken): ProviderResult<ChatContextItem>;
156106
}
157107

158-
/**
159-
* @deprecated Use {@link ChatWorkspaceContextProvider}, {@link ChatExplicitContextProvider}, or {@link ChatResourceContextProvider} instead.
160-
*/
161-
export interface ChatContextProvider<T extends ChatContextItem = ChatContextItem> {
162-
163-
/**
164-
* An optional event that should be fired when the workspace chat context has changed.
165-
* @deprecated Use {@link ChatWorkspaceContextProvider.onDidChangeWorkspaceChatContext} instead.
166-
*/
167-
onDidChangeWorkspaceChatContext?: Event<void>;
168-
169-
/**
170-
* Provide a list of chat context items to be included as workspace context for all chat requests.
171-
* @deprecated Use {@link ChatWorkspaceContextProvider.provideChatContext} instead.
172-
*/
173-
provideWorkspaceChatContext?(token: CancellationToken): ProviderResult<T[]>;
174-
175-
/**
176-
* Provide a list of chat context items that a user can choose from.
177-
* @deprecated Use {@link ChatExplicitContextProvider.provideChatContext} instead.
178-
*/
179-
provideChatContextExplicit?(token: CancellationToken): ProviderResult<T[]>;
180-
181-
/**
182-
* Given a particular resource, provide a chat context item for it.
183-
* @deprecated Use {@link ChatResourceContextProvider.provideChatContext} instead.
184-
*/
185-
provideChatContextForResource?(options: { resource: Uri }, token: CancellationToken): ProviderResult<T | undefined>;
186-
187-
/**
188-
* If a chat context item is provided without a `value`, this method is called to resolve the `value` for the item.
189-
* @deprecated Use the `resolveChatContext` method on the specific provider type instead.
190-
*/
191-
resolveChatContext?(context: T, token: CancellationToken): ProviderResult<ChatContextItem>;
192-
}
193-
194108
}

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

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

6-
// version: 1
7-
86
declare module 'vscode' {
97

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

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-
20399
export class ChatResponseCodeCitationPart {
204100
value: Uri;
205101
license: string;
@@ -266,20 +162,6 @@ declare module 'vscode' {
266162
output: McpToolInvocationContentData[];
267163
}
268164

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-
283165
export class ChatToolInvocationPart {
284166
toolName: string;
285167
toolCallId: string;
@@ -289,8 +171,8 @@ declare module 'vscode' {
289171
pastTenseMessage?: string | MarkdownString;
290172
isConfirmed?: boolean;
291173
isComplete?: boolean;
292-
toolSpecificData?: ChatTerminalToolInvocationData | ChatMcpToolInvocationData | ChatTodoToolInvocationData;
293-
subAgentInvocationId?: string;
174+
toolSpecificData?: ChatTerminalToolInvocationData;
175+
fromSubAgent?: boolean;
294176
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
295177

296178
constructor(toolName: string, toolCallId: string, isError?: boolean);
@@ -362,7 +244,7 @@ declare module 'vscode' {
362244
constructor(uris: Uri[], callback: () => Thenable<unknown>);
363245
}
364246

365-
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseWorkspaceEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart | ChatResponseQuestionCarouselPart;
247+
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart;
366248
export class ChatResponseWarningPart {
367249
value: MarkdownString;
368250
constructor(value: string | MarkdownString);
@@ -526,15 +408,6 @@ declare module 'vscode' {
526408
*/
527409
confirmation(title: string, message: string | MarkdownString, data: any, buttons?: string[]): void;
528410

529-
/**
530-
* Show an inline carousel of questions to gather information from the user.
531-
* This is a blocking call that waits for the user to submit or skip the questions.
532-
* @param questions Array of questions to display to the user
533-
* @param allowSkip Whether the user can skip questions without answering
534-
* @returns A promise that resolves with the user's answers, or undefined if skipped
535-
*/
536-
questionCarousel(questions: ChatQuestion[], allowSkip?: boolean): Thenable<Record<string, unknown> | undefined>;
537-
538411
/**
539412
* Push a warning to this stream. Short-hand for
540413
* `push(new ChatResponseWarningPart(message))`.
@@ -569,13 +442,6 @@ declare module 'vscode' {
569442
push(part: ExtendedChatResponsePart): void;
570443

571444
clearToPreviousToolInvocation(reason: ChatResponseClearToPreviousToolInvocationReason): void;
572-
573-
/**
574-
* Report token usage information for this request.
575-
* This is typically called when the underlying language model provides usage statistics.
576-
* @param usage Token usage information including prompt and completion tokens
577-
*/
578-
usage(usage: ChatResultUsage): void;
579445
}
580446

581447
export enum ChatResponseReferencePartStatusKind {
@@ -767,6 +633,12 @@ declare module 'vscode' {
767633
* An optional detail string that will be rendered at the end of the response in certain UI contexts.
768634
*/
769635
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;
770642
}
771643

772644
export namespace chat {

0 commit comments

Comments
 (0)