Skip to content

Commit 7a0845c

Browse files
Copilotalexr00
andcommitted
Initial plan for fixing stale worktree repo entry
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 62777df commit 7a0845c

File tree

3 files changed

+99
-16
lines changed

3 files changed

+99
-16
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,16 @@ declare module 'vscode' {
223223
};
224224
language: string;
225225

226+
/**
227+
* Overrides for how the command is presented in the UI.
228+
* For example, when a `cd <dir> && <command>` prefix is detected,
229+
* the presentation can show only the actual command.
230+
*/
231+
presentationOverrides?: {
232+
commandLine: string;
233+
language?: string;
234+
};
235+
226236
/**
227237
* Terminal command output. Displayed when the terminal is no longer available.
228238
*/
@@ -1020,8 +1030,6 @@ declare module 'vscode' {
10201030
readonly rawInput?: unknown;
10211031

10221032
readonly chatRequestId?: string;
1023-
/** @deprecated Use {@link chatSessionResource} instead */
1024-
readonly chatSessionId?: string;
10251033
readonly chatSessionResource?: Uri;
10261034
readonly chatInteractionId?: string;
10271035
}
@@ -1055,5 +1063,9 @@ declare module 'vscode' {
10551063
readonly content: string;
10561064
readonly toolReferences?: readonly ChatLanguageModelToolReference[];
10571065
readonly metadata?: Record<string, boolean | string | number>;
1066+
/**
1067+
* Whether the mode is a builtin mode (e.g. Ask, Edit, Agent) rather than a user or extension-defined custom mode.
1068+
*/
1069+
readonly isBuiltin?: boolean;
10581070
}
10591071
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,15 @@ declare module 'vscode' {
176176
*/
177177
readonly editedFileEvents?: ChatRequestEditedFileEvent[];
178178

179+
/**
180+
* The identifier of the language model that was used for this request, if known.
181+
*/
182+
readonly modelId?: string;
183+
179184
/**
180185
* @hidden
181186
*/
182-
constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined, id: string | undefined);
187+
constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined, id: string | undefined, modelId: string | undefined);
183188
}
184189

185190
export class ChatResponseTurn2 {
@@ -262,8 +267,6 @@ declare module 'vscode' {
262267

263268
export interface LanguageModelToolInvocationOptions<T> {
264269
chatRequestId?: string;
265-
/** @deprecated Use {@link chatSessionResource} instead */
266-
chatSessionId?: string;
267270
chatSessionResource?: Uri;
268271
chatInteractionId?: string;
269272
terminalCommand?: string;
@@ -289,8 +292,6 @@ declare module 'vscode' {
289292
*/
290293
input: T;
291294
chatRequestId?: string;
292-
/** @deprecated Use {@link chatSessionResource} instead */
293-
chatSessionId?: string;
294295
chatSessionResource?: Uri;
295296
chatInteractionId?: string;
296297
/**

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

Lines changed: 79 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ declare module 'vscode' {
3535
/**
3636
* Registers a new {@link ChatSessionItemProvider chat session item provider}.
3737
*
38+
* @deprecated Use {@linkcode createChatSessionItemController} instead.
39+
*
3840
* To use this, also make sure to also add `chatSessions` contribution in the `package.json`.
3941
*
4042
* @param chatSessionType The type of chat session the provider is for.
@@ -46,12 +48,21 @@ declare module 'vscode' {
4648

4749
/**
4850
* Creates a new {@link ChatSessionItemController chat session item controller} with the given unique identifier.
51+
*
52+
* To use this, also make sure to also add `chatSessions` contribution in the `package.json`.
53+
*
54+
* @param chatSessionType The type of chat session the provider is for.
55+
* @param refreshHandler The controller's {@link ChatSessionItemController.refreshHandler refresh handler}.
56+
*
57+
* @returns A new controller instance that can be used to manage chat session items for the given chat session type.
4958
*/
50-
export function createChatSessionItemController(id: string, refreshHandler: (token: CancellationToken) => Thenable<void>): ChatSessionItemController;
59+
export function createChatSessionItemController(chatSessionType: string, refreshHandler: ChatSessionItemControllerRefreshHandler): ChatSessionItemController;
5160
}
5261

5362
/**
5463
* Provides a list of information about chat sessions.
64+
*
65+
* @deprecated Use {@linkcode ChatSessionItemController} instead.
5566
*/
5667
export interface ChatSessionItemProvider {
5768
/**
@@ -77,7 +88,21 @@ declare module 'vscode' {
7788
}
7889

7990
/**
80-
* Provides a list of information about chat sessions.
91+
* Extension callback invoked to refresh the collection of chat session items for a {@linkcode ChatSessionItemController}.
92+
*/
93+
export type ChatSessionItemControllerRefreshHandler = (token: CancellationToken) => Thenable<void>;
94+
95+
export interface ChatSessionItemControllerNewItemHandlerContext {
96+
readonly request: ChatRequest;
97+
}
98+
99+
/**
100+
* Extension callback invoked when a new chat session is started.
101+
*/
102+
export type ChatSessionItemControllerNewItemHandler = (context: ChatSessionItemControllerNewItemHandlerContext, token: CancellationToken) => Thenable<ChatSessionItem>;
103+
104+
/**
105+
* Manages chat sessions for a specific chat session type
81106
*/
82107
export interface ChatSessionItemController {
83108
readonly id: string;
@@ -93,7 +118,7 @@ declare module 'vscode' {
93118
readonly items: ChatSessionItemCollection;
94119

95120
/**
96-
* Creates a new managed chat session item that be added to the collection.
121+
* Creates a new managed chat session item that can be added to the collection.
97122
*/
98123
createChatSessionItem(resource: Uri, label: string): ChatSessionItem;
99124

@@ -102,7 +127,16 @@ declare module 'vscode' {
102127
*
103128
* This is also called on first load to get the initial set of items.
104129
*/
105-
readonly refreshHandler: (token: CancellationToken) => Thenable<void>;
130+
readonly refreshHandler: ChatSessionItemControllerRefreshHandler;
131+
132+
/**
133+
* Invoked when a new chat session is started.
134+
*
135+
* This allows the controller to initialize the chat session item with information from the initial request.
136+
*
137+
* The returned chat session is added to the collection and shown in the UI.
138+
*/
139+
newChatSessionItemHandler?: ChatSessionItemControllerNewItemHandler;
106140

107141
/**
108142
* Fired when an item's archived state changes.
@@ -121,7 +155,8 @@ declare module 'vscode' {
121155

122156
/**
123157
* Replaces the items stored by the collection.
124-
* @param items Items to store.
158+
*
159+
* @param items Items to store. If two items have the same resource URI, the last one will be used.
125160
*/
126161
replace(items: readonly ChatSessionItem[]): void;
127162

@@ -136,31 +171,42 @@ declare module 'vscode' {
136171
/**
137172
* Adds the chat session item to the collection. If an item with the same resource URI already
138173
* exists, it'll be replaced.
174+
*
139175
* @param item Item to add.
140176
*/
141177
add(item: ChatSessionItem): void;
142178

143179
/**
144180
* Removes a single chat session item from the collection.
181+
*
145182
* @param resource Item resource to delete.
146183
*/
147184
delete(resource: Uri): void;
148185

149186
/**
150187
* Efficiently gets a chat session item by resource, if it exists, in the collection.
188+
*
151189
* @param resource Item resource to get.
190+
*
152191
* @returns The found item or undefined if it does not exist.
153192
*/
154193
get(resource: Uri): ChatSessionItem | undefined;
155194
}
156195

196+
/**
197+
* A chat session show in the UI.
198+
*
199+
* This should be created by calling a {@link ChatSessionItemController.createChatSessionItem createChatSessionItem}
200+
* method on the controller. The item can then be added to the controller's {@link ChatSessionItemController.items items collection}
201+
* to show it in the UI.
202+
*/
157203
export interface ChatSessionItem {
158204
/**
159205
* The resource associated with the chat session.
160206
*
161207
* This is uniquely identifies the chat session and is used to open the chat session.
162208
*/
163-
resource: Uri;
209+
readonly resource: Uri;
164210

165211
/**
166212
* Human readable name of the session shown in the UI
@@ -300,6 +346,15 @@ declare module 'vscode' {
300346
}
301347

302348
export interface ChatSession {
349+
/**
350+
* An optional title for the chat session.
351+
*
352+
* When provided, this title is used as the display name for the session
353+
* (e.g. in the editor tab). When not provided, the title defaults to
354+
* the first user message in the session history.
355+
*/
356+
readonly title?: string;
357+
303358
/**
304359
* The full history of the session
305360
*
@@ -335,6 +390,7 @@ declare module 'vscode' {
335390
*/
336391
// TODO: Should we introduce our own type for `ChatRequestHandler` since not all field apply to chat sessions?
337392
// TODO: Revisit this to align with code.
393+
// TODO: pass in options?
338394
readonly requestHandler: ChatRequestHandler | undefined;
339395
}
340396

@@ -400,9 +456,8 @@ declare module 'vscode' {
400456

401457
/**
402458
* Called as soon as you register (call me once)
403-
* @param token
404459
*/
405-
provideChatSessionProviderOptions?(token: CancellationToken): Thenable<ChatSessionProviderOptions | ChatSessionProviderOptions>;
460+
provideChatSessionProviderOptions?(token: CancellationToken): Thenable<ChatSessionProviderOptions>;
406461
}
407462

408463
export interface ChatSessionOptionUpdate {
@@ -435,7 +490,15 @@ declare module 'vscode' {
435490

436491
export interface ChatSessionContext {
437492
readonly chatSessionItem: ChatSessionItem; // Maps to URI of chat session editor (could be 'untitled-1', etc..)
493+
494+
/** @deprecated This will be removed along with the concept of `untitled-` sessions. */
438495
readonly isUntitled: boolean;
496+
497+
/**
498+
* The initial option selections for the session, provided with the first request.
499+
* Contains the options the user selected (or defaults) before the session was created.
500+
*/
501+
readonly initialSessionOptions?: ReadonlyArray<{ optionId: string; value: string | ChatSessionProviderOptionItem }>;
439502
}
440503

441504
export interface ChatSessionCapabilities {
@@ -551,6 +614,13 @@ declare module 'vscode' {
551614
* Provider-defined option groups (0-2 groups supported).
552615
* Examples: models picker, sub-agents picker, etc.
553616
*/
554-
optionGroups?: ChatSessionProviderOptionGroup[];
617+
readonly optionGroups?: readonly ChatSessionProviderOptionGroup[];
618+
619+
/**
620+
* The set of default options used for new chat sessions, provided as key-value pairs.
621+
*
622+
* Keys correspond to option group IDs (e.g., 'models', 'subagents').
623+
*/
624+
readonly newSessionOptions?: Record<string, string | ChatSessionProviderOptionItem>;
555625
}
556626
}

0 commit comments

Comments
 (0)