@@ -8,33 +8,33 @@ import { Disposable, DisposableMap } from 'vs/base/common/lifecycle';
88import { URI } from 'vs/base/common/uri' ;
99import { ILogService } from 'vs/platform/log/common/log' ;
1010import { 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/chat /browser/chat ' ;
13+ import { IChatContributionService } from 'vs/workbench/contrib/chat /common/chatContributionService ' ;
14+ import { IChatProgress , IChatRequest , IChatResponse , IChat , IChatDynamicRequest , IChatService } from 'vs/workbench/contrib/chat /common/chatService ' ;
1515import { 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 _chatService : IChatService ,
29+ @IChatWidgetService private readonly _chatWidgetService : IChatWidgetService ,
30+ @IChatContributionService private readonly chatContribService : 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
37- this . _register ( this . _interactiveSessionService . onDidPerformUserAction ( e => {
37+ this . _register ( this . _chatService . onDidPerformUserAction ( e => {
3838 this . _proxy . $onDidPerformUserAction ( e ) ;
3939 } ) ) ;
4040 }
@@ -45,7 +45,7 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
4545 return ;
4646 }
4747
48- const unreg = this . _interactiveSessionService . registerSlashCommandProvider ( {
48+ const unreg = this . _chatService . registerSlashCommandProvider ( {
4949 chatProviderId,
5050 provideSlashCommands : async token => {
5151 return this . _proxy . $provideProviderSlashCommands ( handle , token ) ;
@@ -62,22 +62,22 @@ 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 ;
6969 }
7070
71- const registration = this . interactiveSessionContribService . registeredProviders . find ( staticProvider => staticProvider . id === id ) ;
71+ const registration = this . chatContribService . registeredProviders . find ( staticProvider => staticProvider . id === id ) ;
7272 if ( ! registration ) {
7373 throw new Error ( `Provider ${ id } must be declared in the package.json.` ) ;
7474 }
7575
76- const unreg = this . _interactiveSessionService . registerProvider ( {
76+ const unreg = this . _chatService . registerProvider ( {
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 . _chatService . addRequest ( context ) ;
154154 }
155155
156- async $sendInteractiveRequestToProvider ( providerId : string , message : IInteractiveSessionDynamicRequest ) : Promise < void > {
157- const widget = await this . _interactiveSessionWidgetService . revealViewForProvider ( providerId ) ;
156+ async $sendRequestToProvider ( providerId : string , message : IChatDynamicRequest ) : Promise < void > {
157+ const widget = await this . _chatWidgetService . revealViewForProvider ( providerId ) ;
158158 if ( widget && widget . viewModel ) {
159- this . _interactiveSessionService . sendInteractiveRequestToProvider ( widget . viewModel . sessionId , message ) ;
159+ this . _chatService . 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}
0 commit comments