Skip to content

Commit ab8b610

Browse files
authored
Update to chat sessions proposed API (#7366)
1 parent b57cbf9 commit ab8b610

File tree

5 files changed

+28
-26
lines changed

5 files changed

+28
-26
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3278,7 +3278,7 @@
32783278
"chat/chatSessions": [
32793279
{
32803280
"command": "pr.openDescription",
3281-
"when": "chatSessionType == github.pullRequest.codingAgent"
3281+
"when": "chatSessionType == copilot-swe-agent"
32823282
}
32833283
]
32843284
},

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55

66
declare module 'vscode' {
77
/**
8-
* Provides a list of chat sessions
8+
* Provides a list of information about chat sessions.
99
*/
10-
export interface ChatSessionsProvider extends Disposable {
10+
export interface ChatSessionItemProvider {
1111
/**
12-
* Type to identify providers.
12+
* Label of the extension that registers the provider.
1313
*/
14-
readonly chatSessionType: string;
14+
readonly label: string;
1515

1616
/**
17-
* Fired when chat sessions change.
17+
* Event that the provider can fire to signal that chat sessions have changed.
1818
*/
19-
readonly onDidChangeChatSessionContent: Event<void>;
19+
readonly onDidChangeChatSessionItems: Event<void>;
2020

2121
/**
22-
* Provide a list of chat sessions.
23-
* */
24-
provideChatSessions(token: CancellationToken): Thenable<ChatSessionContent[]>;
22+
* Provides a list of chat sessions.
23+
*/
24+
provideChatSessionItems(token: CancellationToken): ProviderResult<ChatSessionItem[]>;
2525
}
2626

27-
export interface ChatSessionContent {
27+
export interface ChatSessionItem {
2828
/**
29-
* Identifies the session
30-
* */
31-
uri: Uri;
29+
* Unique identifier for the chat session.
30+
*/
31+
id: string;
3232

3333
/**
3434
* Human readable name of the session shown in the UI
@@ -42,6 +42,6 @@ declare module 'vscode' {
4242
}
4343

4444
export namespace chat {
45-
export function registerChatSessionsProvider(provider: ChatSessionsProvider): Disposable;
45+
export function registerChatSessionItemProvider(chatSessionType: string, provider: ChatSessionItemProvider): Disposable;
4646
}
4747
}

src/extension.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,17 @@ async function deferredActivate(context: vscode.ExtensionContext, showPRControll
411411

412412
const copilotRemoteAgentManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
413413
context.subscriptions.push(copilotRemoteAgentManager);
414-
context.subscriptions.push(vscode.chat.registerChatSessionsProvider({
415-
chatSessionType: 'github.pullRequest.codingAgent',
416-
provideChatSessions: async (token) => {
417-
return await copilotRemoteAgentManager.provideChatSessions(token);
418-
},
419-
// Events not used yet, but required by interface.
420-
onDidChangeChatSessionContent: new vscode.EventEmitter<void>().event,
421-
dispose: () => { }
422-
}));
414+
context.subscriptions.push(vscode.chat.registerChatSessionItemProvider(
415+
'copilot-swe-agent',
416+
{
417+
label: vscode.l10n.t('GitHub Copilot Coding Agent'),
418+
provideChatSessionItems: async (token) => {
419+
return await copilotRemoteAgentManager.provideChatSessions(token);
420+
},
421+
// Events not used yet, but required by interface.
422+
onDidChangeChatSessionItems: new vscode.EventEmitter<void>().event,
423+
}
424+
));
423425

424426
const prTree = new PullRequestsTreeDataProvider(telemetry, context, reposManager, copilotRemoteAgentManager);
425427
context.subscriptions.push(prTree);

src/github/copilotApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface RemoteAgentJobResponse {
3838
}
3939
}
4040

41-
export interface ChatSessionWithPR extends vscode.ChatSessionContent {
41+
export interface ChatSessionWithPR extends vscode.ChatSessionItem {
4242
pullRequest: PullRequestModel;
4343
}
4444

src/github/copilotRemoteAgent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ export class CopilotRemoteAgentManager extends Disposable {
737737
const sessions = await capi.getAllCodingAgentPRs(this.repositoriesManager);
738738
return sessions.map(session => {
739739
return {
740-
uri: vscode.Uri.parse(`github://coding-agent/${session.id}`),
740+
id: `${session.id}`,
741741
label: session.title || `Session ${session.id}`,
742742
iconPath: undefined,
743743
pullRequest: session

0 commit comments

Comments
 (0)