@codingame/monaco-vscode-chat-service-override 4.5.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/chat.js +6 -6
  2. package/package.json +2 -2
  3. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +2 -2
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +36 -60
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +78 -51
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +5 -12
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +6 -13
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +10 -27
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +39 -95
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +102 -40
  11. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +57 -70
  12. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +3 -23
  13. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +4 -3
  14. package/vscode/src/vs/workbench/contrib/chat/browser/{chatContributionServiceImpl.js → chatParticipantContributions.js} +63 -202
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +35 -28
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +1 -1
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +49 -41
  18. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +71 -74
  19. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +142 -185
  20. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +3 -3
  21. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +5 -4
  22. package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +131 -0
  23. package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +11 -2
  24. package/vscode/src/vs/workbench/contrib/chat/common/voiceChat.js +4 -4
  25. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +1 -4
  26. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +35 -34
@@ -1,9 +1,8 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
3
3
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
4
- import { DisposableStore, DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { DisposableStore, DisposableMap, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
5
  import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
6
- import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
7
6
  import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
8
7
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
9
8
  import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
@@ -11,83 +10,19 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
11
10
  import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
12
11
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
13
12
  import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
14
- import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
15
13
  import { Extensions } from 'vscode/vscode/vs/workbench/common/views';
16
- import { getHistoryAction, getOpenChatEditorAction } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
17
- import { getNewChatAction } from './actions/chatClearActions.js';
18
- import { getMoveToEditorAction, getMoveToNewWindowAction } from './actions/chatMoveActions.js';
19
- import { getQuickChatActionForProvider } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions';
14
+ import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
20
15
  import { ChatViewPane, CHAT_SIDEBAR_PANEL_ID } from './chatViewPane.js';
21
16
  import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
22
17
  import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
23
- import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService.service';
24
18
  import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
25
19
  import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
26
20
 
27
- const chatExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
28
- extensionPoint: 'interactiveSession',
29
- jsonSchema: {
30
- description: ( localizeWithPath(
31
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
32
- 'vscode.extension.contributes.interactiveSession',
33
- 'Contributes an Interactive Session provider'
34
- )),
35
- type: 'array',
36
- items: {
37
- additionalProperties: false,
38
- type: 'object',
39
- defaultSnippets: [{ body: { id: '', program: '', runtime: '' } }],
40
- required: ['id', 'label'],
41
- properties: {
42
- id: {
43
- description: ( localizeWithPath(
44
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
45
- 'vscode.extension.contributes.interactiveSession.id',
46
- "Unique identifier for this Interactive Session provider."
47
- )),
48
- type: 'string'
49
- },
50
- label: {
51
- description: ( localizeWithPath(
52
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
53
- 'vscode.extension.contributes.interactiveSession.label',
54
- "Display name for this Interactive Session provider."
55
- )),
56
- type: 'string'
57
- },
58
- icon: {
59
- description: ( localizeWithPath(
60
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
61
- 'vscode.extension.contributes.interactiveSession.icon',
62
- "An icon for this Interactive Session provider."
63
- )),
64
- type: 'string'
65
- },
66
- when: {
67
- description: ( localizeWithPath(
68
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
69
- 'vscode.extension.contributes.interactiveSession.when',
70
- "A condition which must be true to enable this Interactive Session provider."
71
- )),
72
- type: 'string'
73
- },
74
- }
75
- }
76
- },
77
- activationEventsGenerator: (contributions, result) => {
78
- for (const contrib of contributions) {
79
- result.push(`onInteractiveSession:${contrib.id}`);
80
- }
81
- },
82
- });
21
+ const _moduleId = "vs/workbench/contrib/chat/browser/chatParticipantContributions";
83
22
  const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
84
23
  extensionPoint: 'chatParticipants',
85
24
  jsonSchema: {
86
- description: ( localizeWithPath(
87
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
88
- 'vscode.extension.contributes.chatParticipant',
89
- 'Contributes a chat participant'
90
- )),
25
+ description: ( localizeWithPath(_moduleId, 0, 'Contributes a chat participant')),
91
26
  type: 'array',
92
27
  items: {
93
28
  additionalProperties: false,
@@ -96,41 +31,33 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
96
31
  required: ['name', 'id'],
97
32
  properties: {
98
33
  id: {
99
- description: ( localizeWithPath(
100
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
101
- 'chatParticipantId',
102
- "A unique id for this chat participant."
103
- )),
34
+ description: ( localizeWithPath(_moduleId, 1, "A unique id for this chat participant.")),
104
35
  type: 'string'
105
36
  },
106
37
  name: {
107
38
  description: ( localizeWithPath(
108
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
109
- 'chatParticipantName',
39
+ _moduleId,
40
+ 2,
110
41
  "User-facing display name for this chat participant. The user will use '@' with this name to invoke the participant."
111
42
  )),
112
43
  type: 'string'
113
44
  },
114
45
  description: {
115
- description: ( localizeWithPath(
116
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
117
- 'chatParticipantDescription',
118
- "A description of this chat participant, shown in the UI."
119
- )),
46
+ description: ( localizeWithPath(_moduleId, 3, "A description of this chat participant, shown in the UI.")),
120
47
  type: 'string'
121
48
  },
122
49
  isDefault: {
123
50
  markdownDescription: ( localizeWithPath(
124
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
125
- 'chatParticipantIsDefaultDescription',
51
+ _moduleId,
52
+ 4,
126
53
  "**Only** allowed for extensions that have the `defaultChatParticipant` proposal."
127
54
  )),
128
55
  type: 'boolean',
129
56
  },
130
57
  isSticky: {
131
58
  description: ( localizeWithPath(
132
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
133
- 'chatCommandSticky',
59
+ _moduleId,
60
+ 5,
134
61
  "Whether invoking the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message."
135
62
  )),
136
63
  type: 'boolean'
@@ -144,8 +71,8 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
144
71
  },
145
72
  commands: {
146
73
  markdownDescription: ( localizeWithPath(
147
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
148
- 'chatCommandsDescription',
74
+ _moduleId,
75
+ 6,
149
76
  "Commands available for this chat participant, which the user can invoke with a `/`."
150
77
  )),
151
78
  type: 'array',
@@ -157,48 +84,40 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
157
84
  properties: {
158
85
  name: {
159
86
  description: ( localizeWithPath(
160
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
161
- 'chatCommand',
87
+ _moduleId,
88
+ 7,
162
89
  "A short name by which this command is referred to in the UI, e.g. `fix` or * `explain` for commands that fix an issue or explain code. The name should be unique among the commands provided by this participant."
163
90
  )),
164
91
  type: 'string'
165
92
  },
166
93
  description: {
167
- description: ( localizeWithPath(
168
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
169
- 'chatCommandDescription',
170
- "A description of this command."
171
- )),
94
+ description: ( localizeWithPath(_moduleId, 8, "A description of this command.")),
172
95
  type: 'string'
173
96
  },
174
97
  when: {
175
- description: ( localizeWithPath(
176
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
177
- 'chatCommandWhen',
178
- "A condition which must be true to enable this command."
179
- )),
98
+ description: ( localizeWithPath(_moduleId, 9, "A condition which must be true to enable this command.")),
180
99
  type: 'string'
181
100
  },
182
101
  sampleRequest: {
183
102
  description: ( localizeWithPath(
184
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
185
- 'chatCommandSampleRequest',
103
+ _moduleId,
104
+ 10,
186
105
  "When the user clicks this command in `/help`, this text will be submitted to this participant."
187
106
  )),
188
107
  type: 'string'
189
108
  },
190
109
  isSticky: {
191
110
  description: ( localizeWithPath(
192
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
193
- 'chatCommandSticky',
111
+ _moduleId,
112
+ 5,
194
113
  "Whether invoking the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message."
195
114
  )),
196
115
  type: 'boolean'
197
116
  },
198
117
  defaultImplicitVariables: {
199
118
  markdownDescription: ( localizeWithPath(
200
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
201
- 'defaultImplicitVariables',
119
+ _moduleId,
120
+ 11,
202
121
  "**Only** allowed for extensions that have the `chatParticipantAdditions` proposal. The names of the variables that are invoked by default"
203
122
  )),
204
123
  type: 'array',
@@ -210,11 +129,7 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
210
129
  }
211
130
  },
212
131
  locations: {
213
- markdownDescription: ( localizeWithPath(
214
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
215
- 'chatLocationsDescription',
216
- "Locations in which this chat participant is available."
217
- )),
132
+ markdownDescription: ( localizeWithPath(_moduleId, 12, "Locations in which this chat participant is available.")),
218
133
  type: 'array',
219
134
  default: ['panel'],
220
135
  items: {
@@ -233,15 +148,13 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
233
148
  });
234
149
  let ChatExtensionPointHandler = class ChatExtensionPointHandler {
235
150
  static { this.ID = 'workbench.contrib.chatExtensionPointHandler'; }
236
- constructor(_chatContributionService, _chatAgentService, productService, contextService, logService) {
237
- this._chatContributionService = _chatContributionService;
151
+ constructor(_chatAgentService, productService, contextService, logService) {
238
152
  this._chatAgentService = _chatAgentService;
239
153
  this.productService = productService;
240
154
  this.contextService = contextService;
241
155
  this.logService = logService;
242
- this.disposables = ( new DisposableStore());
243
- this._registrationDisposables = ( new Map());
244
- this._participantRegistrationDisposables = ( new DisposableMap());
156
+ this.disposables = ( (new DisposableStore()));
157
+ this._participantRegistrationDisposables = ( (new DisposableMap()));
245
158
  this._viewContainer = this.registerViewContainer();
246
159
  this.registerListeners();
247
160
  this.handleAndRegisterChatExtensions();
@@ -252,26 +165,22 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
252
165
  return;
253
166
  }
254
167
  const showWelcomeViewConfigKey = 'workbench.chat.experimental.showWelcomeView';
255
- const keys = ( new Set([showWelcomeViewConfigKey]));
168
+ const keys = ( (new Set([showWelcomeViewConfigKey])));
256
169
  if (e.affectsSome(keys)) {
257
- const contextKeyExpr = ( ContextKeyExpr.equals(showWelcomeViewConfigKey, true));
258
- const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
170
+ const contextKeyExpr = ( (ContextKeyExpr.equals(showWelcomeViewConfigKey, true)));
171
+ const viewsRegistry = ( (Registry.as(Extensions.ViewsRegistry)));
259
172
  if (this.contextService.contextMatchesRules(contextKeyExpr)) {
260
- const viewId = this._chatContributionService.getViewIdForProvider(this.productService.chatWelcomeView.welcomeViewId);
261
173
  this._welcomeViewDescriptor = {
262
- id: viewId,
174
+ id: CHAT_VIEW_ID,
263
175
  name: { original: this.productService.chatWelcomeView.welcomeViewTitle, value: this.productService.chatWelcomeView.welcomeViewTitle },
264
176
  containerIcon: this._viewContainer.icon,
265
- ctorDescriptor: ( new SyncDescriptor(
266
- ChatViewPane,
267
- [{ providerId: this.productService.chatWelcomeView.welcomeViewId }]
268
- )),
177
+ ctorDescriptor: ( (new SyncDescriptor(ChatViewPane))),
269
178
  canToggleVisibility: false,
270
179
  canMoveView: true,
271
180
  order: 100
272
181
  };
273
182
  viewsRegistry.registerViews([this._welcomeViewDescriptor], this._viewContainer);
274
- viewsRegistry.registerViewWelcomeContent(viewId, {
183
+ viewsRegistry.registerViewWelcomeContent(CHAT_VIEW_ID, {
275
184
  content: this.productService.chatWelcomeView.welcomeViewContent,
276
185
  });
277
186
  }
@@ -282,26 +191,6 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
282
191
  }, null, this.disposables);
283
192
  }
284
193
  handleAndRegisterChatExtensions() {
285
- chatExtensionPoint.setHandler((extensions, delta) => {
286
- for (const extension of delta.added) {
287
- const extensionDisposable = ( new DisposableStore());
288
- for (const providerDescriptor of extension.value) {
289
- this.registerChatProvider(providerDescriptor);
290
- this._chatContributionService.registerChatProvider(providerDescriptor);
291
- }
292
- this._registrationDisposables.set(extension.description.identifier.value, extensionDisposable);
293
- }
294
- for (const extension of delta.removed) {
295
- const registration = this._registrationDisposables.get(extension.description.identifier.value);
296
- if (registration) {
297
- registration.dispose();
298
- this._registrationDisposables.delete(extension.description.identifier.value);
299
- }
300
- for (const providerDescriptor of extension.value) {
301
- this._chatContributionService.deregisterChatProvider(providerDescriptor.id);
302
- }
303
- }
304
- });
305
194
  chatParticipantExtensionPoint.setHandler((extensions, delta) => {
306
195
  for (const extension of delta.added) {
307
196
  for (const providerDescriptor of extension.value) {
@@ -317,8 +206,15 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
317
206
  this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT register participant without both id and name.`);
318
207
  continue;
319
208
  }
320
- this._participantRegistrationDisposables.set(getParticipantKey(extension.description.identifier, providerDescriptor.name), this._chatAgentService.registerAgent(providerDescriptor.id, {
209
+ const store = ( (new DisposableStore()));
210
+ if (providerDescriptor.isDefault && (!providerDescriptor.locations || providerDescriptor.locations?.includes(ChatAgentLocation.Panel))) {
211
+ store.add(this.registerDefaultParticipantView(providerDescriptor));
212
+ }
213
+ store.add(this._chatAgentService.registerAgent(providerDescriptor.id, {
321
214
  extensionId: extension.description.identifier,
215
+ extensionPublisherDisplayName: extension.description.publisherDisplayName ?? extension.description.publisher,
216
+ extensionPublisherId: extension.description.publisher,
217
+ extensionDisplayName: extension.description.displayName ?? extension.description.name,
322
218
  id: providerDescriptor.id,
323
219
  description: providerDescriptor.description,
324
220
  metadata: {
@@ -328,10 +224,11 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
328
224
  isDefault: providerDescriptor.isDefault,
329
225
  defaultImplicitVariables: providerDescriptor.defaultImplicitVariables,
330
226
  locations: isNonEmptyArray(providerDescriptor.locations) ?
331
- ( providerDescriptor.locations.map(ChatAgentLocation.fromRaw)) :
227
+ ( (providerDescriptor.locations.map(ChatAgentLocation.fromRaw))) :
332
228
  [ChatAgentLocation.Panel],
333
229
  slashCommands: providerDescriptor.commands ?? []
334
230
  }));
231
+ this._participantRegistrationDisposables.set(getParticipantKey(extension.description.identifier, providerDescriptor.id), store);
335
232
  }
336
233
  }
337
234
  for (const extension of delta.removed) {
@@ -342,84 +239,48 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
342
239
  });
343
240
  }
344
241
  registerViewContainer() {
345
- const title = ( localize2WithPath(
346
- 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
347
- 'chat.viewContainer.label',
348
- "Chat"
349
- ));
242
+ const title = ( localize2WithPath(_moduleId, 13, "Chat"));
350
243
  const icon = Codicon.commentDiscussion;
351
244
  const viewContainerId = CHAT_SIDEBAR_PANEL_ID;
352
- const viewContainer = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
245
+ const viewContainer = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
353
246
  id: viewContainerId,
354
247
  title,
355
248
  icon,
356
- ctorDescriptor: ( new SyncDescriptor(
249
+ ctorDescriptor: ( (new SyncDescriptor(
357
250
  ViewPaneContainer,
358
251
  [viewContainerId, { mergeViewWithContainerWhenSingleView: true }]
359
- )),
252
+ ))),
360
253
  storageId: viewContainerId,
361
254
  hideIfEmpty: true,
362
255
  order: 100,
363
256
  }, 0 );
364
257
  return viewContainer;
365
258
  }
366
- registerChatProvider(providerDescriptor) {
367
- const viewId = this._chatContributionService.getViewIdForProvider(providerDescriptor.id);
259
+ registerDefaultParticipantView(defaultParticipantDescriptor) {
368
260
  const viewDescriptor = [{
369
- id: viewId,
261
+ id: CHAT_VIEW_ID,
370
262
  containerIcon: this._viewContainer.icon,
371
263
  containerTitle: this._viewContainer.title.value,
372
264
  singleViewPaneContainerTitle: this._viewContainer.title.value,
373
- name: { value: providerDescriptor.label, original: providerDescriptor.label },
265
+ name: { value: defaultParticipantDescriptor.name, original: defaultParticipantDescriptor.name },
374
266
  canToggleVisibility: false,
375
267
  canMoveView: true,
376
- ctorDescriptor: ( new SyncDescriptor(ChatViewPane, [{ providerId: providerDescriptor.id }])),
377
- when: ContextKeyExpr.deserialize(providerDescriptor.when)
268
+ ctorDescriptor: ( (new SyncDescriptor(ChatViewPane))),
378
269
  }];
379
- ( Registry.as(Extensions.ViewsRegistry)).registerViews(viewDescriptor, this._viewContainer);
380
- const disposables = ( new DisposableStore());
381
- disposables.add(registerAction2(getHistoryAction(viewId, providerDescriptor.id)));
382
- disposables.add(registerAction2(getNewChatAction(viewId, providerDescriptor.id)));
383
- disposables.add(registerAction2(getMoveToEditorAction(viewId, providerDescriptor.id)));
384
- disposables.add(registerAction2(getMoveToNewWindowAction(viewId, providerDescriptor.id)));
385
- disposables.add(registerAction2(getOpenChatEditorAction(providerDescriptor.id, providerDescriptor.label, providerDescriptor.when)));
386
- disposables.add(registerAction2(getQuickChatActionForProvider(providerDescriptor.id, providerDescriptor.label)));
387
- return {
388
- dispose: () => {
389
- ( Registry.as(Extensions.ViewsRegistry)).deregisterViews(viewDescriptor, this._viewContainer);
390
- ( Registry.as(Extensions.ViewContainersRegistry)).deregisterViewContainer(this._viewContainer);
391
- disposables.dispose();
392
- }
393
- };
270
+ ( (Registry.as(Extensions.ViewsRegistry))).registerViews(viewDescriptor, this._viewContainer);
271
+ return toDisposable(() => {
272
+ ( (Registry.as(Extensions.ViewsRegistry))).deregisterViews(viewDescriptor, this._viewContainer);
273
+ });
394
274
  }
395
275
  };
396
- ChatExtensionPointHandler = ( __decorate([
397
- ( __param(0, IChatContributionService)),
398
- ( __param(1, IChatAgentService)),
399
- ( __param(2, IProductService)),
400
- ( __param(3, IContextKeyService)),
401
- ( __param(4, ILogService))
402
- ], ChatExtensionPointHandler));
403
- registerWorkbenchContribution2(ChatExtensionPointHandler.ID, ChatExtensionPointHandler, 1 );
276
+ ChatExtensionPointHandler = ( (__decorate([
277
+ ( (__param(0, IChatAgentService))),
278
+ ( (__param(1, IProductService))),
279
+ ( (__param(2, IContextKeyService))),
280
+ ( (__param(3, ILogService)))
281
+ ], ChatExtensionPointHandler)));
404
282
  function getParticipantKey(extensionId, participantName) {
405
283
  return `${extensionId.value}_${participantName}`;
406
284
  }
407
- class ChatContributionService {
408
- constructor() {
409
- this._registeredProviders = ( new Map());
410
- }
411
- getViewIdForProvider(providerId) {
412
- return ChatViewPane.ID + '.' + providerId;
413
- }
414
- registerChatProvider(provider) {
415
- this._registeredProviders.set(provider.id, provider);
416
- }
417
- deregisterChatProvider(providerId) {
418
- this._registeredProviders.delete(providerId);
419
- }
420
- get registeredProviders() {
421
- return Array.from(( this._registeredProviders.values()));
422
- }
423
- }
424
285
 
425
- export { ChatContributionService, ChatExtensionPointHandler };
286
+ export { ChatExtensionPointHandler };
@@ -22,10 +22,11 @@ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
22
22
  import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
23
23
  import { quickInputForeground, quickInputBackground } from 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
24
24
  import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
25
- import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
25
+ import { showChatView } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
26
26
  import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
27
27
  import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
28
28
  import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
29
+ import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
29
30
 
30
31
  var QuickChat_1;
31
32
  let QuickChatService = class QuickChatService extends Disposable {
@@ -38,7 +39,7 @@ let QuickChatService = class QuickChatService extends Disposable {
38
39
  this.onDidClose = this._onDidClose.event;
39
40
  }
40
41
  get enabled() {
41
- return this.chatService.getProviderInfos().length > 0;
42
+ return !!this.chatService.isEnabled(ChatAgentLocation.Panel);
42
43
  }
43
44
  get focused() {
44
45
  const widget = this._input?.widget;
@@ -47,12 +48,12 @@ let QuickChatService = class QuickChatService extends Disposable {
47
48
  }
48
49
  return isAncestorOfActiveElement(widget);
49
50
  }
50
- toggle(providerId, options) {
51
+ toggle(options) {
51
52
  if (this.focused && !options?.query) {
52
53
  this.close();
53
54
  }
54
55
  else {
55
- this.open(providerId, options);
56
+ this.open(options);
56
57
  if (options?.isPartialQuery) {
57
58
  const disposable = this._store.add(Event.once(this.onDidClose)(() => {
58
59
  this._currentChat?.clearValue();
@@ -61,7 +62,7 @@ let QuickChatService = class QuickChatService extends Disposable {
61
62
  }
62
63
  }
63
64
  }
64
- open(providerId, options) {
65
+ open(options) {
65
66
  if (this._input) {
66
67
  if (this._currentChat && options?.query) {
67
68
  this._currentChat.focus();
@@ -73,12 +74,6 @@ let QuickChatService = class QuickChatService extends Disposable {
73
74
  }
74
75
  return this.focus();
75
76
  }
76
- const providerInfo = providerId
77
- ? this.chatService.getProviderInfos().find(info => info.id === providerId)
78
- : this.chatService.getProviderInfos()[0];
79
- if (!providerInfo) {
80
- return;
81
- }
82
77
  const disposableStore = ( new DisposableStore());
83
78
  this._input = this.quickInputService.createQuickWidget();
84
79
  this._input.contextKey = 'chatInputVisible';
@@ -88,9 +83,7 @@ let QuickChatService = class QuickChatService extends Disposable {
88
83
  this._input.widget = this._container;
89
84
  this._input.show();
90
85
  if (!this._currentChat) {
91
- this._currentChat = this.instantiationService.createInstance(QuickChat, {
92
- providerId: providerInfo.id,
93
- });
86
+ this._currentChat = this.instantiationService.createInstance(QuickChat);
94
87
  this._currentChat.render(this._container);
95
88
  }
96
89
  else {
@@ -131,14 +124,13 @@ let QuickChat = class QuickChat extends Disposable {
131
124
  static { QuickChat_1 = this; }
132
125
  static { this.DEFAULT_MIN_HEIGHT = 200; }
133
126
  static { this.DEFAULT_HEIGHT_OFFSET = 100; }
134
- constructor(_options, instantiationService, contextKeyService, chatService, _chatWidgetService, layoutService) {
127
+ constructor(instantiationService, contextKeyService, chatService, layoutService, viewsService) {
135
128
  super();
136
- this._options = _options;
137
129
  this.instantiationService = instantiationService;
138
130
  this.contextKeyService = contextKeyService;
139
131
  this.chatService = chatService;
140
- this._chatWidgetService = _chatWidgetService;
141
132
  this.layoutService = layoutService;
133
+ this.viewsService = viewsService;
142
134
  this.maintainScrollTimer = this._register(( new MutableDisposable()));
143
135
  this._deferUpdatingDynamicLayout = false;
144
136
  }
@@ -180,7 +172,7 @@ let QuickChat = class QuickChat extends Disposable {
180
172
  }
181
173
  render(parent) {
182
174
  if (this.widget) {
183
- throw new Error('Cannot render quick chat twice');
175
+ throw ( new Error('Cannot render quick chat twice'));
184
176
  }
185
177
  const scopedInstantiationService = this.instantiationService.createChild(( new ServiceCollection([
186
178
  IContextKeyService,
@@ -240,14 +232,29 @@ let QuickChat = class QuickChat extends Disposable {
240
232
  return this.widget.acceptInput();
241
233
  }
242
234
  async openChatView() {
243
- const widget = await this._chatWidgetService.revealViewForProvider(this._options.providerId);
235
+ const widget = await showChatView(this.viewsService);
244
236
  if (!widget?.viewModel || !this.model) {
245
237
  return;
246
238
  }
247
239
  for (const request of this.model.getRequests()) {
248
240
  if (request.response?.response.value || request.response?.result) {
249
- this.chatService.addCompleteRequest(widget.viewModel.sessionId, request.message, request.variableData, {
250
- message: request.response.response.value,
241
+ const message = [];
242
+ for (const item of request.response.response.value) {
243
+ if (item.kind === 'textEditGroup') {
244
+ for (const group of item.edits) {
245
+ message.push({
246
+ kind: 'textEdit',
247
+ edits: group,
248
+ uri: item.uri
249
+ });
250
+ }
251
+ }
252
+ else {
253
+ message.push(item);
254
+ }
255
+ }
256
+ this.chatService.addCompleteRequest(widget.viewModel.sessionId, request.message, request.variableData, request.attempt, {
257
+ message,
251
258
  result: request.response.result,
252
259
  followups: request.response.followups
253
260
  });
@@ -267,19 +274,19 @@ let QuickChat = class QuickChat extends Disposable {
267
274
  this.widget.inputEditor.setValue('');
268
275
  }
269
276
  updateModel() {
270
- this.model ??= this.chatService.startSession(this._options.providerId, CancellationToken.None);
277
+ this.model ??= this.chatService.startSession(ChatAgentLocation.Panel, CancellationToken.None);
271
278
  if (!this.model) {
272
- throw new Error('Could not start chat session');
279
+ throw ( new Error('Could not start chat session'));
273
280
  }
274
281
  this.widget.setModel(this.model, { inputValue: this._currentQuery });
275
282
  }
276
283
  };
277
284
  QuickChat = QuickChat_1 = ( __decorate([
278
- ( __param(1, IInstantiationService)),
279
- ( __param(2, IContextKeyService)),
280
- ( __param(3, IChatService)),
281
- ( __param(4, IChatWidgetService)),
282
- ( __param(5, ILayoutService))
285
+ ( __param(0, IInstantiationService)),
286
+ ( __param(1, IContextKeyService)),
287
+ ( __param(2, IChatService)),
288
+ ( __param(3, ILayoutService)),
289
+ ( __param(4, IViewsService))
283
290
  ], QuickChat));
284
291
 
285
292
  export { QuickChatService };
@@ -75,7 +75,7 @@ let ChatVariablesService = class ChatVariablesService {
75
75
  registerVariable(data, resolver) {
76
76
  const key = data.name.toLowerCase();
77
77
  if (( this._resolver.has(key))) {
78
- throw new Error(`A chat variable with the name '${data.name}' already exists.`);
78
+ throw ( new Error(`A chat variable with the name '${data.name}' already exists.`));
79
79
  }
80
80
  this._resolver.set(key, { data, resolver });
81
81
  return toDisposable(() => {