@@ -8,31 +8,31 @@ import { Disposable, DisposableMap } from 'vs/base/common/lifecycle';
8
8
import { URI } from 'vs/base/common/uri' ;
9
9
import { ILogService } from 'vs/platform/log/common/log' ;
10
10
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' ;
15
15
import { IExtHostContext , extHostNamedCustomer } from 'vs/workbench/services/extensions/common/extHostCustomers' ;
16
16
17
- @extHostNamedCustomer ( MainContext . MainThreadInteractiveSession )
18
- export class MainThreadInteractiveSession extends Disposable implements MainThreadInteractiveSessionShape {
17
+ @extHostNamedCustomer ( MainContext . MainThreadChat )
18
+ export class MainThreadChat extends Disposable implements MainThreadChatShape {
19
19
20
20
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 > ( ) ;
22
22
private readonly _stateEmitters = new Map < number , Emitter < any > > ( ) ;
23
23
24
- private readonly _proxy : ExtHostInteractiveSessionShape ;
24
+ private readonly _proxy : ExtHostChatShape ;
25
25
26
26
constructor (
27
27
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 ,
31
31
@IProductService private readonly productService : IProductService ,
32
32
@ILogService private readonly logService : ILogService ,
33
33
) {
34
34
super ( ) ;
35
- this . _proxy = extHostContext . getProxy ( ExtHostContext . ExtHostInteractiveSession ) ;
35
+ this . _proxy = extHostContext . getProxy ( ExtHostContext . ExtHostChat ) ;
36
36
37
37
this . _register ( this . _interactiveSessionService . onDidPerformUserAction ( e => {
38
38
this . _proxy . $onDidPerformUserAction ( e ) ;
@@ -62,7 +62,7 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
62
62
this . _providerRegistrations . deleteAndDispose ( handle ) ;
63
63
}
64
64
65
- async $registerInteractiveSessionProvider ( handle : number , id : string ) : Promise < void > {
65
+ async $registerChatProvider ( handle : number , id : string ) : Promise < void > {
66
66
if ( this . productService . quality === 'stable' ) {
67
67
this . logService . trace ( `The interactive session API is not supported in stable VS Code.` ) ;
68
68
return ;
@@ -77,7 +77,7 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
77
77
id,
78
78
displayName : registration . label ,
79
79
prepareSession : async ( initialState , token ) => {
80
- const session = await this . _proxy . $prepareInteractiveSession ( handle , initialState , token ) ;
80
+ const session = await this . _proxy . $prepareChat ( handle , initialState , token ) ;
81
81
if ( ! session ) {
82
82
return undefined ;
83
83
}
@@ -88,7 +88,7 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
88
88
89
89
const emitter = new Emitter < any > ( ) ;
90
90
this . _stateEmitters . set ( session . id , emitter ) ;
91
- return < IInteractiveSession > {
91
+ return < IChat > {
92
92
id : session . id ,
93
93
requesterUsername : session . requesterUsername ,
94
94
requesterAvatarIconUri : URI . revive ( session . requesterAvatarIconUri ) ,
@@ -104,8 +104,8 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
104
104
} ;
105
105
} ,
106
106
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 > {
109
109
session,
110
110
...dto
111
111
} ;
@@ -114,11 +114,11 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
114
114
const id = `${ handle } _${ request . session . id } ` ;
115
115
this . _activeRequestProgressCallbacks . set ( id , progress ) ;
116
116
try {
117
- const requestDto : IInteractiveRequestDto = {
117
+ const requestDto : IChatRequestDto = {
118
118
message : request . message ,
119
119
} ;
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 > {
122
122
session : request . session ,
123
123
...dto
124
124
} ;
@@ -140,27 +140,27 @@ export class MainThreadInteractiveSession extends Disposable implements MainThre
140
140
this . _providerRegistrations . set ( handle , unreg ) ;
141
141
}
142
142
143
- $acceptInteractiveResponseProgress ( handle : number , sessionId : number , progress : IInteractiveProgress ) : void {
143
+ $acceptResponseProgress ( handle : number , sessionId : number , progress : IChatProgress ) : void {
144
144
const id = `${ handle } _${ sessionId } ` ;
145
145
this . _activeRequestProgressCallbacks . get ( id ) ?.( progress ) ;
146
146
}
147
147
148
- async $acceptInteractiveSessionState ( sessionId : number , state : any ) : Promise < void > {
148
+ async $acceptChatState ( sessionId : number , state : any ) : Promise < void > {
149
149
this . _stateEmitters . get ( sessionId ) ?. fire ( state ) ;
150
150
}
151
151
152
- $addInteractiveSessionRequest ( context : any ) : void {
153
- this . _interactiveSessionService . addInteractiveRequest ( context ) ;
152
+ $addRequest ( context : any ) : void {
153
+ this . _interactiveSessionService . addRequest ( context ) ;
154
154
}
155
155
156
- async $sendInteractiveRequestToProvider ( providerId : string , message : IInteractiveSessionDynamicRequest ) : Promise < void > {
156
+ async $sendRequestToProvider ( providerId : string , message : IChatDynamicRequest ) : Promise < void > {
157
157
const widget = await this . _interactiveSessionWidgetService . revealViewForProvider ( providerId ) ;
158
158
if ( widget && widget . viewModel ) {
159
- this . _interactiveSessionService . sendInteractiveRequestToProvider ( widget . viewModel . sessionId , message ) ;
159
+ this . _interactiveSessionService . sendRequestToProvider ( widget . viewModel . sessionId , message ) ;
160
160
}
161
161
}
162
162
163
- async $unregisterInteractiveSessionProvider ( handle : number ) : Promise < void > {
163
+ async $unregisterChatProvider ( handle : number ) : Promise < void > {
164
164
this . _providerRegistrations . deleteAndDispose ( handle ) ;
165
165
}
166
166
}
0 commit comments