Skip to content

Commit d72649d

Browse files
committed
Rename some classes and methods from "interactive session" to "chat"
1 parent 4f9aef9 commit d72649d

37 files changed

+691
-691
lines changed

src/vs/platform/actions/common/actions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ export class MenuId {
179179
static readonly MergeBaseToolbar = new MenuId('MergeBaseToolbar');
180180
static readonly MergeInputResultToolbar = new MenuId('MergeToolbarResultToolbar');
181181
static readonly InlineSuggestionToolbar = new MenuId('InlineSuggestionToolbar');
182-
static readonly InteractiveSessionContext = new MenuId('InteractiveSessionContext');
183-
static readonly InteractiveSessionCodeBlock = new MenuId('InteractiveSessionCodeblock');
184-
static readonly InteractiveSessionTitle = new MenuId('InteractiveSessionTitle');
185-
static readonly InteractiveSessionExecute = new MenuId('InteractiveSessionExecute');
182+
static readonly ChatContext = new MenuId('ChatContext');
183+
static readonly ChatCodeBlock = new MenuId('ChatCodeblock');
184+
static readonly ChatTitle = new MenuId('ChatTitle');
185+
static readonly ChatExecute = new MenuId('ChatExecute');
186186

187187
/**
188188
* Create or reuse a `MenuId` with the given identifier

src/vs/workbench/api/browser/mainThreadInteractiveSession.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@ import { Disposable, DisposableMap } from 'vs/base/common/lifecycle';
88
import { URI } from 'vs/base/common/uri';
99
import { ILogService } from 'vs/platform/log/common/log';
1010
import { IProductService } from 'vs/platform/product/common/productService';
11-
import { ExtHostContext, ExtHostInteractiveSessionShape, IInteractiveRequestDto, MainContext, MainThreadInteractiveSessionShape } from 'vs/workbench/api/common/extHost.protocol';
12-
import { IInteractiveSessionWidgetService } from 'vs/workbench/contrib/interactiveSession/browser/interactiveSession';
13-
import { IInteractiveSessionContributionService } from 'vs/workbench/contrib/interactiveSession/common/interactiveSessionContributionService';
14-
import { IInteractiveProgress, IInteractiveRequest, IInteractiveResponse, IInteractiveSession, IInteractiveSessionDynamicRequest, IInteractiveSessionService } from 'vs/workbench/contrib/interactiveSession/common/interactiveSessionService';
11+
import { ExtHostContext, ExtHostChatShape, IChatRequestDto, MainContext, MainThreadChatShape } from 'vs/workbench/api/common/extHost.protocol';
12+
import { IChatWidgetService } from 'vs/workbench/contrib/interactiveSession/browser/interactiveSession';
13+
import { IChatContributionService } from 'vs/workbench/contrib/interactiveSession/common/interactiveSessionContributionService';
14+
import { IChatProgress, IChatRequest, IChatResponse, IChat, IChatDynamicRequest, IChatService } from 'vs/workbench/contrib/interactiveSession/common/interactiveSessionService';
1515
import { IExtHostContext, extHostNamedCustomer } from 'vs/workbench/services/extensions/common/extHostCustomers';
1616

17-
@extHostNamedCustomer(MainContext.MainThreadInteractiveSession)
18-
export class MainThreadInteractiveSession extends Disposable implements MainThreadInteractiveSessionShape {
17+
@extHostNamedCustomer(MainContext.MainThreadChat)
18+
export class MainThreadChat extends Disposable implements MainThreadChatShape {
1919

2020
private readonly _providerRegistrations = this._register(new DisposableMap<number>());
21-
private readonly _activeRequestProgressCallbacks = new Map<string, (progress: IInteractiveProgress) => void>();
21+
private readonly _activeRequestProgressCallbacks = new Map<string, (progress: IChatProgress) => void>();
2222
private readonly _stateEmitters = new Map<number, Emitter<any>>();
2323

24-
private readonly _proxy: ExtHostInteractiveSessionShape;
24+
private readonly _proxy: ExtHostChatShape;
2525

2626
constructor(
2727
extHostContext: IExtHostContext,
28-
@IInteractiveSessionService private readonly _interactiveSessionService: IInteractiveSessionService,
29-
@IInteractiveSessionWidgetService private readonly _interactiveSessionWidgetService: IInteractiveSessionWidgetService,
30-
@IInteractiveSessionContributionService private readonly interactiveSessionContribService: IInteractiveSessionContributionService,
28+
@IChatService private readonly _interactiveSessionService: IChatService,
29+
@IChatWidgetService private readonly _interactiveSessionWidgetService: IChatWidgetService,
30+
@IChatContributionService private readonly interactiveSessionContribService: IChatContributionService,
3131
@IProductService private readonly productService: IProductService,
3232
@ILogService private readonly logService: ILogService,
3333
) {
3434
super();
35-
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostInteractiveSession);
35+
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostChat);
3636

3737
this._register(this._interactiveSessionService.onDidPerformUserAction(e => {
3838
this._proxy.$onDidPerformUserAction(e);
@@ -62,7 +62,7 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
6262
this._providerRegistrations.deleteAndDispose(handle);
6363
}
6464

65-
async $registerInteractiveSessionProvider(handle: number, id: string): Promise<void> {
65+
async $registerChatProvider(handle: number, id: string): Promise<void> {
6666
if (this.productService.quality === 'stable') {
6767
this.logService.trace(`The interactive session API is not supported in stable VS Code.`);
6868
return;
@@ -77,7 +77,7 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
7777
id,
7878
displayName: registration.label,
7979
prepareSession: async (initialState, token) => {
80-
const session = await this._proxy.$prepareInteractiveSession(handle, initialState, token);
80+
const session = await this._proxy.$prepareChat(handle, initialState, token);
8181
if (!session) {
8282
return undefined;
8383
}
@@ -88,7 +88,7 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
8888

8989
const emitter = new Emitter<any>();
9090
this._stateEmitters.set(session.id, emitter);
91-
return <IInteractiveSession>{
91+
return <IChat>{
9292
id: session.id,
9393
requesterUsername: session.requesterUsername,
9494
requesterAvatarIconUri: URI.revive(session.requesterAvatarIconUri),
@@ -104,8 +104,8 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
104104
};
105105
},
106106
resolveRequest: async (session, context, token) => {
107-
const dto = await this._proxy.$resolveInteractiveRequest(handle, session.id, context, token);
108-
return <IInteractiveRequest>{
107+
const dto = await this._proxy.$resolveRequest(handle, session.id, context, token);
108+
return <IChatRequest>{
109109
session,
110110
...dto
111111
};
@@ -114,11 +114,11 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
114114
const id = `${handle}_${request.session.id}`;
115115
this._activeRequestProgressCallbacks.set(id, progress);
116116
try {
117-
const requestDto: IInteractiveRequestDto = {
117+
const requestDto: IChatRequestDto = {
118118
message: request.message,
119119
};
120-
const dto = await this._proxy.$provideInteractiveReply(handle, request.session.id, requestDto, token);
121-
return <IInteractiveResponse>{
120+
const dto = await this._proxy.$provideReply(handle, request.session.id, requestDto, token);
121+
return <IChatResponse>{
122122
session: request.session,
123123
...dto
124124
};
@@ -140,27 +140,27 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
140140
this._providerRegistrations.set(handle, unreg);
141141
}
142142

143-
$acceptInteractiveResponseProgress(handle: number, sessionId: number, progress: IInteractiveProgress): void {
143+
$acceptResponseProgress(handle: number, sessionId: number, progress: IChatProgress): void {
144144
const id = `${handle}_${sessionId}`;
145145
this._activeRequestProgressCallbacks.get(id)?.(progress);
146146
}
147147

148-
async $acceptInteractiveSessionState(sessionId: number, state: any): Promise<void> {
148+
async $acceptChatState(sessionId: number, state: any): Promise<void> {
149149
this._stateEmitters.get(sessionId)?.fire(state);
150150
}
151151

152-
$addInteractiveSessionRequest(context: any): void {
153-
this._interactiveSessionService.addInteractiveRequest(context);
152+
$addRequest(context: any): void {
153+
this._interactiveSessionService.addRequest(context);
154154
}
155155

156-
async $sendInteractiveRequestToProvider(providerId: string, message: IInteractiveSessionDynamicRequest): Promise<void> {
156+
async $sendRequestToProvider(providerId: string, message: IChatDynamicRequest): Promise<void> {
157157
const widget = await this._interactiveSessionWidgetService.revealViewForProvider(providerId);
158158
if (widget && widget.viewModel) {
159-
this._interactiveSessionService.sendInteractiveRequestToProvider(widget.viewModel.sessionId, message);
159+
this._interactiveSessionService.sendRequestToProvider(widget.viewModel.sessionId, message);
160160
}
161161
}
162162

163-
async $unregisterInteractiveSessionProvider(handle: number): Promise<void> {
163+
async $unregisterChatProvider(handle: number): Promise<void> {
164164
this._providerRegistrations.deleteAndDispose(handle);
165165
}
166166
}

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ import { IExtHostLocalizationService } from 'vs/workbench/api/common/extHostLoca
9797
import { EditSessionIdentityMatch } from 'vs/platform/workspace/common/editSessions';
9898
import { ExtHostProfileContentHandlers } from 'vs/workbench/api/common/extHostProfileContentHandler';
9999
import { ExtHostQuickDiff } from 'vs/workbench/api/common/extHostQuickDiff';
100-
import { ExtHostInteractiveSession } from 'vs/workbench/api/common/extHostInteractiveSession';
100+
import { ExtHostChat } from 'vs/workbench/api/common/extHostInteractiveSession';
101101
import { ExtHostInteractiveEditor } from 'vs/workbench/api/common/extHostInteractiveEditor';
102102
import { ExtHostNotebookDocumentSaveParticipant } from 'vs/workbench/api/common/extHostNotebookDocumentSaveParticipant';
103103
import { ExtHostSemanticSimilarity } from 'vs/workbench/api/common/extHostSemanticSimilarity';
@@ -201,7 +201,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
201201
const extHostProfileContentHandlers = rpcProtocol.set(ExtHostContext.ExtHostProfileContentHandlers, new ExtHostProfileContentHandlers(rpcProtocol));
202202
rpcProtocol.set(ExtHostContext.ExtHostInteractive, new ExtHostInteractive(rpcProtocol, extHostNotebook, extHostDocumentsAndEditors, extHostCommands, extHostLogService));
203203
const extHostInteractiveEditor = rpcProtocol.set(ExtHostContext.ExtHostInteractiveEditor, new ExtHostInteractiveEditor(rpcProtocol, extHostDocuments, extHostLogService));
204-
const extHostInteractiveSession = rpcProtocol.set(ExtHostContext.ExtHostInteractiveSession, new ExtHostInteractiveSession(rpcProtocol, extHostLogService));
204+
const extHostChat = rpcProtocol.set(ExtHostContext.ExtHostChat, new ExtHostChat(rpcProtocol, extHostLogService));
205205
const extHostSemanticSimilarity = rpcProtocol.set(ExtHostContext.ExtHostSemanticSimilarity, new ExtHostSemanticSimilarity(rpcProtocol));
206206
const extHostIssueReporter = rpcProtocol.set(ExtHostContext.ExtHostIssueReporter, new ExtHostIssueReporter(rpcProtocol));
207207

@@ -1275,26 +1275,26 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
12751275
},
12761276
registerInteractiveSessionProvider(id: string, provider: vscode.InteractiveSessionProvider) {
12771277
checkProposedApiEnabled(extension, 'interactive');
1278-
return extHostInteractiveSession.registerInteractiveSessionProvider(extension, id, provider);
1278+
return extHostChat.registerChatProvider(extension, id, provider);
12791279
},
12801280
addInteractiveRequest(context: vscode.InteractiveSessionRequestArgs) {
12811281
checkProposedApiEnabled(extension, 'interactive');
1282-
return extHostInteractiveSession.addInteractiveSessionRequest(context);
1282+
return extHostChat.addChatRequest(context);
12831283
},
12841284
sendInteractiveRequestToProvider(providerId: string, message: vscode.InteractiveSessionDynamicRequest) {
12851285
checkProposedApiEnabled(extension, 'interactive');
1286-
return extHostInteractiveSession.sendInteractiveRequestToProvider(providerId, message);
1286+
return extHostChat.sendInteractiveRequestToProvider(providerId, message);
12871287
},
12881288
get onDidPerformUserAction() {
1289-
return extHostInteractiveSession.onDidPerformUserAction;
1289+
return extHostChat.onDidPerformUserAction;
12901290
}
12911291
};
12921292

12931293
// namespace: interactiveSlashCommands
12941294
const interactiveSlashCommands: typeof vscode.interactiveSlashCommands = {
12951295
registerSlashCommandProvider(chatProviderId: string, provider: vscode.InteractiveSlashCommandProvider) {
12961296
checkProposedApiEnabled(extension, 'interactiveSlashCommands');
1297-
return extHostInteractiveSession.registerSlashCommandProvider(extension, chatProviderId, provider);
1297+
return extHostChat.registerSlashCommandProvider(extension, chatProviderId, provider);
12981298
}
12991299
};
13001300

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import { SaveReason } from 'vs/workbench/common/editor';
5151
import { IRevealOptions, ITreeItem, IViewBadge } from 'vs/workbench/common/views';
5252
import { CallHierarchyItem } from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
5353
import { DebugConfigurationProviderTriggerKind, IAdapterDescriptor, IConfig, IDebugSessionReplMode } from 'vs/workbench/contrib/debug/common/debug';
54-
import { IInteractiveProgress, IInteractiveResponseErrorDetails, IInteractiveSessionDynamicRequest, IInteractiveSessionFollowup, IInteractiveSessionReplyFollowup, IInteractiveSessionUserActionEvent, IInteractiveSlashCommand } from 'vs/workbench/contrib/interactiveSession/common/interactiveSessionService';
54+
import { IChatProgress, IChatResponseErrorDetails, IChatDynamicRequest, IChatFollowup, IChatReplyFollowup, IChatUserActionEvent, ISlashCommand } from 'vs/workbench/contrib/interactiveSession/common/interactiveSessionService';
5555
import * as notebookCommon from 'vs/workbench/contrib/notebook/common/notebookCommon';
5656
import { CellExecutionUpdateType } from 'vs/workbench/contrib/notebook/common/notebookExecutionService';
5757
import { ICellExecutionComplete, ICellExecutionStateUpdate } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService';
@@ -1117,7 +1117,7 @@ export interface MainThreadUrlsShape extends IDisposable {
11171117
$createAppUri(uri: UriComponents): Promise<UriComponents>;
11181118
}
11191119

1120-
export interface IInteractiveSessionDto {
1120+
export interface IChatDto {
11211121
id: number;
11221122
requesterUsername: string;
11231123
requesterAvatarIconUri?: UriComponents;
@@ -1126,41 +1126,41 @@ export interface IInteractiveSessionDto {
11261126
inputPlaceholder?: string;
11271127
}
11281128

1129-
export interface IInteractiveRequestDto {
1130-
message: string | IInteractiveSessionReplyFollowup;
1129+
export interface IChatRequestDto {
1130+
message: string | IChatReplyFollowup;
11311131
}
11321132

1133-
export interface IInteractiveResponseDto {
1134-
errorDetails?: IInteractiveResponseErrorDetails;
1133+
export interface IChatResponseDto {
1134+
errorDetails?: IChatResponseErrorDetails;
11351135
timings: {
11361136
firstProgress: number;
11371137
totalElapsed: number;
11381138
};
11391139
}
11401140

1141-
export interface MainThreadInteractiveSessionShape extends IDisposable {
1142-
$registerInteractiveSessionProvider(handle: number, id: string): Promise<void>;
1143-
$acceptInteractiveSessionState(sessionId: number, state: any): Promise<void>;
1144-
$addInteractiveSessionRequest(context: any): void;
1145-
$sendInteractiveRequestToProvider(providerId: string, message: IInteractiveSessionDynamicRequest): void;
1146-
$unregisterInteractiveSessionProvider(handle: number): Promise<void>;
1147-
$acceptInteractiveResponseProgress(handle: number, sessionId: number, progress: IInteractiveProgress): void;
1141+
export interface MainThreadChatShape extends IDisposable {
1142+
$registerChatProvider(handle: number, id: string): Promise<void>;
1143+
$acceptChatState(sessionId: number, state: any): Promise<void>;
1144+
$addRequest(context: any): void;
1145+
$sendRequestToProvider(providerId: string, message: IChatDynamicRequest): void;
1146+
$unregisterChatProvider(handle: number): Promise<void>;
1147+
$acceptResponseProgress(handle: number, sessionId: number, progress: IChatProgress): void;
11481148

11491149
$registerSlashCommandProvider(handle: number, chatProviderId: string): Promise<void>;
11501150
$unregisterSlashCommandProvider(handle: number): Promise<void>;
11511151
}
11521152

1153-
export interface ExtHostInteractiveSessionShape {
1154-
$prepareInteractiveSession(handle: number, initialState: any, token: CancellationToken): Promise<IInteractiveSessionDto | undefined>;
1155-
$resolveInteractiveRequest(handle: number, sessionId: number, context: any, token: CancellationToken): Promise<Omit<IInteractiveRequestDto, 'id'> | undefined>;
1156-
$provideWelcomeMessage(handle: number, token: CancellationToken): Promise<(string | IInteractiveSessionReplyFollowup[])[] | undefined>;
1157-
$provideFollowups(handle: number, sessionId: number, token: CancellationToken): Promise<IInteractiveSessionFollowup[] | undefined>;
1158-
$provideInteractiveReply(handle: number, sessionId: number, request: IInteractiveRequestDto, token: CancellationToken): Promise<IInteractiveResponseDto | undefined>;
1159-
$provideSlashCommands(handle: number, sessionId: number, token: CancellationToken): Promise<IInteractiveSlashCommand[] | undefined>;
1153+
export interface ExtHostChatShape {
1154+
$prepareChat(handle: number, initialState: any, token: CancellationToken): Promise<IChatDto | undefined>;
1155+
$resolveRequest(handle: number, sessionId: number, context: any, token: CancellationToken): Promise<Omit<IChatRequestDto, 'id'> | undefined>;
1156+
$provideWelcomeMessage(handle: number, token: CancellationToken): Promise<(string | IChatReplyFollowup[])[] | undefined>;
1157+
$provideFollowups(handle: number, sessionId: number, token: CancellationToken): Promise<IChatFollowup[] | undefined>;
1158+
$provideReply(handle: number, sessionId: number, request: IChatRequestDto, token: CancellationToken): Promise<IChatResponseDto | undefined>;
1159+
$provideSlashCommands(handle: number, sessionId: number, token: CancellationToken): Promise<ISlashCommand[] | undefined>;
11601160
$releaseSession(sessionId: number): void;
1161-
$onDidPerformUserAction(event: IInteractiveSessionUserActionEvent): Promise<void>;
1161+
$onDidPerformUserAction(event: IChatUserActionEvent): Promise<void>;
11621162

1163-
$provideProviderSlashCommands(handle: number, token: CancellationToken): Promise<IInteractiveSlashCommand[] | undefined>;
1163+
$provideProviderSlashCommands(handle: number, token: CancellationToken): Promise<ISlashCommand[] | undefined>;
11641164
$resolveSlashCommand(handle: number, command: string, token: CancellationToken): Promise<string | undefined>;
11651165
}
11661166

@@ -2532,7 +2532,7 @@ export const MainContext = {
25322532
MainThreadNotebookKernels: createProxyIdentifier<MainThreadNotebookKernelsShape>('MainThreadNotebookKernels'),
25332533
MainThreadNotebookRenderers: createProxyIdentifier<MainThreadNotebookRenderersShape>('MainThreadNotebookRenderers'),
25342534
MainThreadInteractive: createProxyIdentifier<MainThreadInteractiveShape>('MainThreadInteractive'),
2535-
MainThreadInteractiveSession: createProxyIdentifier<MainThreadInteractiveSessionShape>('MainThreadInteractiveSession'),
2535+
MainThreadChat: createProxyIdentifier<MainThreadChatShape>('MainThreadChat'),
25362536
MainThreadInteractiveEditor: createProxyIdentifier<MainThreadInteractiveEditorShape>('MainThreadInteractiveEditor'),
25372537
MainThreadTheming: createProxyIdentifier<MainThreadThemingShape>('MainThreadTheming'),
25382538
MainThreadTunnelService: createProxyIdentifier<MainThreadTunnelServiceShape>('MainThreadTunnelService'),
@@ -2594,7 +2594,7 @@ export const ExtHostContext = {
25942594
ExtHostNotebookDocumentSaveParticipant: createProxyIdentifier<ExtHostNotebookDocumentSaveParticipantShape>('ExtHostNotebookDocumentSaveParticipant'),
25952595
ExtHostInteractive: createProxyIdentifier<ExtHostInteractiveShape>('ExtHostInteractive'),
25962596
ExtHostInteractiveEditor: createProxyIdentifier<ExtHostInteractiveEditorShape>('ExtHostInteractiveEditor'),
2597-
ExtHostInteractiveSession: createProxyIdentifier<ExtHostInteractiveSessionShape>('ExtHostInteractiveSession'),
2597+
ExtHostChat: createProxyIdentifier<ExtHostChatShape>('ExtHostChat'),
25982598
ExtHostSemanticSimilarity: createProxyIdentifier<ExtHostSemanticSimilarityShape>('ExtHostSemanticSimilarity'),
25992599
ExtHostTheming: createProxyIdentifier<ExtHostThemingShape>('ExtHostTheming'),
26002600
ExtHostTunnelService: createProxyIdentifier<ExtHostTunnelServiceShape>('ExtHostTunnelService'),

0 commit comments

Comments
 (0)