Skip to content

Commit a4b870c

Browse files
authored
Fix build break due to API change (#8017)
1 parent 6a4831d commit a4b870c

3 files changed

Lines changed: 78 additions & 4 deletions

File tree

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
// version: 10
6+
// version: 11
77

88
declare module 'vscode' {
99

@@ -285,4 +285,24 @@ declare module 'vscode' {
285285
}
286286

287287
// #endregion
288+
289+
// #region LanguageModelProxyProvider
290+
291+
/**
292+
* Duplicated so that this proposal and languageModelProxy can be independent.
293+
*/
294+
export interface LanguageModelProxy extends Disposable {
295+
readonly uri: Uri;
296+
readonly key: string;
297+
}
298+
299+
export interface LanguageModelProxyProvider {
300+
provideModelProxy(forExtensionId: string, token: CancellationToken): ProviderResult<LanguageModelProxy>;
301+
}
302+
303+
export namespace lm {
304+
export function registerLanguageModelProxyProvider(provider: LanguageModelProxyProvider): Disposable;
305+
}
306+
307+
// #endregion
288308
}

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,18 @@ declare module 'vscode' {
7171
export interface ChatSessionItem {
7272
/**
7373
* Unique identifier for the chat session.
74+
*
75+
* @deprecated Will be replaced by `resource`
7476
*/
7577
id: string;
7678

79+
/**
80+
* The resource associated with the chat session.
81+
*
82+
* This is uniquely identifies the chat session and is used to open the chat session.
83+
*/
84+
resource: Uri | undefined;
85+
7786
/**
7887
* Human readable name of the session shown in the UI
7988
*/
@@ -139,6 +148,11 @@ declare module 'vscode' {
139148
// TODO: link request + response to encourage correct usage?
140149
readonly history: ReadonlyArray<ChatRequestTurn | ChatResponseTurn2>;
141150

151+
/**
152+
* Options configured for this session.
153+
*/
154+
readonly options?: { model?: LanguageModelChatInformation };
155+
142156
/**
143157
* Callback invoked by the editor for a currently running response. This allows the session to push items for the
144158
* current response and stream these in as them come in. The current response will be considered complete once the
@@ -166,6 +180,32 @@ declare module 'vscode' {
166180
* @param token A cancellation token that can be used to cancel the operation.
167181
*/
168182
provideChatSessionContent(sessionId: string, token: CancellationToken): Thenable<ChatSession> | ChatSession;
183+
184+
/**
185+
*
186+
* @param sessionId Identifier of the chat session being updated.
187+
* @param updates Collection of option identifiers and their new values. Only the options that changed are included.
188+
* @param token A cancellation token that can be used to cancel the notification if the session is disposed.
189+
*/
190+
provideHandleOptionsChange?(sessionId: string, updates: ReadonlyArray<ChatSessionOptionUpdate>, token: CancellationToken): void;
191+
192+
/**
193+
* Called as soon as you register (call me once)
194+
* @param token
195+
*/
196+
provideChatSessionProviderOptions?(token: CancellationToken): Thenable<ChatSessionProviderOptions> | ChatSessionProviderOptions;
197+
}
198+
199+
export interface ChatSessionOptionUpdate {
200+
/**
201+
* Identifier of the option that changed (for example `model`).
202+
*/
203+
readonly optionId: string;
204+
205+
/**
206+
* The new value assigned to the option. When `undefined`, the option is cleared.
207+
*/
208+
readonly value: string | undefined;
169209
}
170210

171211
export namespace chat {
@@ -212,6 +252,16 @@ declare module 'vscode' {
212252
supportsInterruptions?: boolean;
213253
}
214254

255+
export interface ChatSessionProviderOptions {
256+
/**
257+
* Set of available models.
258+
*/
259+
models?: LanguageModelChatInformation[];
260+
}
261+
262+
/**
263+
* @deprecated
264+
*/
215265
export interface ChatSessionShowOptions {
216266
/**
217267
* The editor view column to show the chat session in.
@@ -224,6 +274,8 @@ declare module 'vscode' {
224274
export namespace window {
225275
/**
226276
* Shows a chat session in the panel or editor.
277+
*
278+
* @deprecated
227279
*/
228280
export function showChatSession(chatSessionType: string, sessionId: string, options: ChatSessionShowOptions): Thenable<void>;
229281
}

src/github/copilotRemoteAgent.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ export class CopilotRemoteAgentManager extends Disposable {
167167
return {};
168168
}
169169
// Tell UI to the new chat session
170-
this._onDidCommitChatSession.fire({ original: context.chatSessionContext.chatSessionItem, modified: { id: String(number), label: `Pull Request ${number}` } });
170+
const modified: vscode.ChatSessionItem = { id: String(number), label: `Pull Request ${number}` } as unknown as vscode.ChatSessionItem;
171+
this._onDidCommitChatSession.fire({ original: context.chatSessionContext.chatSessionItem, modified });
171172
} else if (context.chatSessionContext) {
172173
/* Follow up to an existing coding agent session */
173174
try {
@@ -1061,7 +1062,7 @@ export class CopilotRemoteAgentManager extends Disposable {
10611062
repoInfo = `${owner}/${repo} `;
10621063
}
10631064
const description = new vscode.MarkdownString(`[${repoInfo}#${pullRequest.number}](${uri.toString()} "${prLinkTitle}")`); // pullRequest.base.ref === defaultBranch ? `PR #${pullRequest.number}`: `PR #${pullRequest.number} → ${pullRequest.base.ref}`;
1064-
return {
1065+
const chatSession: ChatSessionWithPR = {
10651066
id: `${pullRequest.number}`,
10661067
label: pullRequest.title || `Session ${pullRequest.number}`,
10671068
iconPath: this.getIconForSession(status),
@@ -1076,7 +1077,8 @@ export class CopilotRemoteAgentManager extends Disposable {
10761077
insertions: pullRequest.item.additions,
10771078
deletions: pullRequest.item.deletions
10781079
} : undefined
1079-
};
1080+
} as unknown as ChatSessionWithPR;
1081+
return chatSession;
10801082
}));
10811083
} catch (error) {
10821084
Logger.error(`Failed to provide coding agents information: ${error}`, CopilotRemoteAgentManager.ID);

0 commit comments

Comments
 (0)