@codingame/monaco-vscode-chat-service-override 10.1.3 → 11.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 (50) hide show
  1. package/chat.js +6 -3
  2. package/package.json +6 -2
  3. package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +8 -0
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +84 -38
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +265 -20
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +20 -39
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +373 -216
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -5
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -5
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +54 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -7
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +12 -11
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +14 -42
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +82 -50
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +326 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +448 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +507 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +76 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +4 -4
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorActions.js +109 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorController.js +284 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.js +116 -77
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +100 -9
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +3 -3
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +7 -9
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +61 -42
  29. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +5 -5
  30. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
  31. package/vscode/src/vs/workbench/contrib/chat/{common → browser}/languageModelToolsService.js +28 -31
  32. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeContributions.js +75 -0
  33. package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +120 -1
  34. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +10 -8
  35. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -18
  36. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js +21 -0
  38. package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +2 -2
  39. package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +6 -6
  40. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +68 -47
  41. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +250 -0
  42. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  43. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +7 -8
  44. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
  45. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +3 -3
  47. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +2 -2
  48. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +65 -128
  49. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +0 -170
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatGettingStarted.js +0 -131
@@ -1,6 +1,7 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { isNonEmptyArray, coalesce } from 'vscode/vscode/vs/base/common/arrays';
3
3
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
4
+ import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
4
5
  import { Event } from 'vscode/vscode/vs/base/common/event';
5
6
  import { DisposableMap, DisposableStore, toDisposable, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
6
7
  import { AmbiguousCharacters, InvisibleCharacters } from 'vscode/vscode/vs/base/common/strings';
@@ -19,14 +20,14 @@ import { showExtensionsWithIdsCommandId } from 'vscode/vscode/vs/workbench/contr
19
20
  import { IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions.service';
20
21
  import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
21
22
  import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
22
- import { CONTEXT_CHAT_PANEL_PARTICIPANT_REGISTERED, CONTEXT_CHAT_EXTENSION_INVALID } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
23
- import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
24
- import { CHAT_SIDEBAR_PANEL_ID, ChatViewPane } from './chatViewPane.js';
23
+ import { CONTEXT_CHAT_PANEL_PARTICIPANT_REGISTERED, CONTEXT_CHAT_EXTENSION_INVALID, CONTEXT_CHAT_EDITING_PARTICIPANT_REGISTERED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
24
+ import { CHAT_VIEW_ID } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/chat';
25
+ import { CHAT_SIDEBAR_PANEL_ID, ChatViewPane, CHAT_EDITING_SIDEBAR_PANEL_ID } from './chatViewPane.js';
25
26
 
26
27
  const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
27
28
  extensionPoint: 'chatParticipants',
28
29
  jsonSchema: {
29
- description: ( localize(7355, 'Contributes a chat participant')),
30
+ description: ( localize(7610, 'Contributes a chat participant')),
30
31
  type: 'array',
31
32
  items: {
32
33
  additionalProperties: false,
@@ -35,12 +36,12 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
35
36
  required: ['name', 'id'],
36
37
  properties: {
37
38
  id: {
38
- description: ( localize(7356, "A unique id for this chat participant.")),
39
+ description: ( localize(7611, "A unique id for this chat participant.")),
39
40
  type: 'string'
40
41
  },
41
42
  name: {
42
43
  description: ( localize(
43
- 7357,
44
+ 7612,
44
45
  "User-facing name for this chat participant. The user will use '@' with this name to invoke the participant. Name must not contain whitespace."
45
46
  )),
46
47
  type: 'string',
@@ -48,37 +49,37 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
48
49
  },
49
50
  fullName: {
50
51
  markdownDescription: ( localize(
51
- 7358,
52
+ 7613,
52
53
  "The full name of this chat participant, which is shown as the label for responses coming from this participant. If not provided, {0} is used.",
53
54
  '`name`'
54
55
  )),
55
56
  type: 'string'
56
57
  },
57
58
  description: {
58
- description: ( localize(7359, "A description of this chat participant, shown in the UI.")),
59
+ description: ( localize(7614, "A description of this chat participant, shown in the UI.")),
59
60
  type: 'string'
60
61
  },
61
62
  isSticky: {
62
63
  description: ( localize(
63
- 7360,
64
+ 7615,
64
65
  "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."
65
66
  )),
66
67
  type: 'boolean'
67
68
  },
68
69
  sampleRequest: {
69
70
  description: ( localize(
70
- 7361,
71
+ 7616,
71
72
  "When the user clicks this participant in `/help`, this text will be submitted to the participant."
72
73
  )),
73
74
  type: 'string'
74
75
  },
75
76
  when: {
76
- description: ( localize(7362, "A condition which must be true to enable this participant.")),
77
+ description: ( localize(7617, "A condition which must be true to enable this participant.")),
77
78
  type: 'string'
78
79
  },
79
80
  disambiguation: {
80
81
  description: ( localize(
81
- 7363,
82
+ 7618,
82
83
  "Metadata to help with automatically routing user questions to this chat participant."
83
84
  )),
84
85
  type: 'array',
@@ -90,21 +91,21 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
90
91
  properties: {
91
92
  category: {
92
93
  markdownDescription: ( localize(
93
- 7364,
94
+ 7619,
94
95
  "A detailed name for this category, e.g. `workspace_questions` or `web_questions`."
95
96
  )),
96
97
  type: 'string'
97
98
  },
98
99
  description: {
99
100
  description: ( localize(
100
- 7365,
101
+ 7620,
101
102
  "A detailed description of the kinds of questions that are suitable for this chat participant."
102
103
  )),
103
104
  type: 'string'
104
105
  },
105
106
  examples: {
106
107
  description: ( localize(
107
- 7366,
108
+ 7621,
108
109
  "A list of representative example questions that are suitable for this chat participant."
109
110
  )),
110
111
  type: 'array'
@@ -114,7 +115,7 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
114
115
  },
115
116
  commands: {
116
117
  markdownDescription: ( localize(
117
- 7367,
118
+ 7622,
118
119
  "Commands available for this chat participant, which the user can invoke with a `/`."
119
120
  )),
120
121
  type: 'array',
@@ -126,36 +127,36 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
126
127
  properties: {
127
128
  name: {
128
129
  description: ( localize(
129
- 7368,
130
+ 7623,
130
131
  "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."
131
132
  )),
132
133
  type: 'string'
133
134
  },
134
135
  description: {
135
- description: ( localize(7369, "A description of this command.")),
136
+ description: ( localize(7624, "A description of this command.")),
136
137
  type: 'string'
137
138
  },
138
139
  when: {
139
- description: ( localize(7370, "A condition which must be true to enable this command.")),
140
+ description: ( localize(7625, "A condition which must be true to enable this command.")),
140
141
  type: 'string'
141
142
  },
142
143
  sampleRequest: {
143
144
  description: ( localize(
144
- 7371,
145
+ 7626,
145
146
  "When the user clicks this command in `/help`, this text will be submitted to the participant."
146
147
  )),
147
148
  type: 'string'
148
149
  },
149
150
  isSticky: {
150
151
  description: ( localize(
151
- 7360,
152
+ 7615,
152
153
  "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."
153
154
  )),
154
155
  type: 'boolean'
155
156
  },
156
157
  disambiguation: {
157
158
  description: ( localize(
158
- 7372,
159
+ 7627,
159
160
  "Metadata to help with automatically routing user questions to this chat command."
160
161
  )),
161
162
  type: 'array',
@@ -167,21 +168,21 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
167
168
  properties: {
168
169
  category: {
169
170
  markdownDescription: ( localize(
170
- 7373,
171
+ 7628,
171
172
  "A detailed name for this category, e.g. `workspace_questions` or `web_questions`."
172
173
  )),
173
174
  type: 'string'
174
175
  },
175
176
  description: {
176
177
  description: ( localize(
177
- 7374,
178
+ 7629,
178
179
  "A detailed description of the kinds of questions that are suitable for this chat command."
179
180
  )),
180
181
  type: 'string'
181
182
  },
182
183
  examples: {
183
184
  description: ( localize(
184
- 7375,
185
+ 7630,
185
186
  "A list of representative example questions that are suitable for this chat command."
186
187
  )),
187
188
  type: 'array'
@@ -192,14 +193,6 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
192
193
  }
193
194
  }
194
195
  },
195
- supportsToolReferences: {
196
- description: ( localize(
197
- 7376,
198
- "Whether this participant supports {0}.",
199
- 'ChatRequest#toolReferences'
200
- )),
201
- type: 'boolean'
202
- }
203
196
  }
204
197
  }
205
198
  },
@@ -217,6 +210,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
217
210
  this._participantRegistrationDisposables = ( (new DisposableMap()));
218
211
  this._viewContainer = this.registerViewContainer();
219
212
  this.registerDefaultParticipantView();
213
+ this.registerChatEditingView();
220
214
  this.handleAndRegisterChatExtensions();
221
215
  }
222
216
  handleAndRegisterChatExtensions() {
@@ -239,7 +233,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
239
233
  this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT use API proposal: defaultChatParticipant.`);
240
234
  continue;
241
235
  }
242
- if ((providerDescriptor.defaultImplicitVariables || providerDescriptor.locations || providerDescriptor.supportsModelPicker) && !isProposedApiEnabled(extension.description, 'chatParticipantAdditions')) {
236
+ if ((providerDescriptor.defaultImplicitVariables || providerDescriptor.locations) && !isProposedApiEnabled(extension.description, 'chatParticipantAdditions')) {
243
237
  this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT use API proposal: chatParticipantAdditions.`);
244
238
  continue;
245
239
  }
@@ -248,47 +242,48 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
248
242
  continue;
249
243
  }
250
244
  const participantsAndCommandsDisambiguation = [];
251
- if (isProposedApiEnabled(extension.description, 'contribChatParticipantDetection')) {
252
- if (providerDescriptor.disambiguation?.length) {
253
- participantsAndCommandsDisambiguation.push(...( (providerDescriptor.disambiguation.map((d) => ({
254
- ...d, category: d.category ?? d.categoryName
255
- })))));
256
- }
257
- if (providerDescriptor.commands) {
258
- for (const command of providerDescriptor.commands) {
259
- if (command.disambiguation?.length) {
260
- participantsAndCommandsDisambiguation.push(...( (command.disambiguation.map((d) => ({
261
- ...d, category: d.category ?? d.categoryName
262
- })))));
263
- }
245
+ if (providerDescriptor.disambiguation?.length) {
246
+ participantsAndCommandsDisambiguation.push(...( (providerDescriptor.disambiguation.map((d) => ({
247
+ ...d, category: d.category ?? d.categoryName
248
+ })))));
249
+ }
250
+ if (providerDescriptor.commands) {
251
+ for (const command of providerDescriptor.commands) {
252
+ if (command.disambiguation?.length) {
253
+ participantsAndCommandsDisambiguation.push(...( (command.disambiguation.map((d) => ({
254
+ ...d, category: d.category ?? d.categoryName
255
+ })))));
264
256
  }
265
257
  }
266
258
  }
267
- const store = ( (new DisposableStore()));
268
- store.add(this._chatAgentService.registerAgent(providerDescriptor.id, {
269
- extensionId: extension.description.identifier,
270
- publisherDisplayName: extension.description.publisherDisplayName ?? extension.description.publisher,
271
- extensionPublisherId: extension.description.publisher,
272
- extensionDisplayName: extension.description.displayName ?? extension.description.name,
273
- id: providerDescriptor.id,
274
- description: providerDescriptor.description,
275
- supportsModelPicker: providerDescriptor.supportsModelPicker,
276
- when: providerDescriptor.when,
277
- metadata: {
278
- isSticky: providerDescriptor.isSticky,
279
- sampleRequest: providerDescriptor.sampleRequest,
280
- },
281
- name: providerDescriptor.name,
282
- fullName: providerDescriptor.fullName,
283
- isDefault: providerDescriptor.isDefault,
284
- locations: isNonEmptyArray(providerDescriptor.locations) ?
285
- ( (providerDescriptor.locations.map(ChatAgentLocation.fromRaw))) :
286
- [ChatAgentLocation.Panel],
287
- slashCommands: providerDescriptor.commands ?? [],
288
- disambiguation: coalesce(participantsAndCommandsDisambiguation.flat()),
289
- supportsToolReferences: providerDescriptor.supportsToolReferences,
290
- }));
291
- this._participantRegistrationDisposables.set(getParticipantKey(extension.description.identifier, providerDescriptor.id), store);
259
+ try {
260
+ const store = ( (new DisposableStore()));
261
+ store.add(this._chatAgentService.registerAgent(providerDescriptor.id, {
262
+ extensionId: extension.description.identifier,
263
+ publisherDisplayName: extension.description.publisherDisplayName ?? extension.description.publisher,
264
+ extensionPublisherId: extension.description.publisher,
265
+ extensionDisplayName: extension.description.displayName ?? extension.description.name,
266
+ id: providerDescriptor.id,
267
+ description: providerDescriptor.description,
268
+ when: providerDescriptor.when,
269
+ metadata: {
270
+ isSticky: providerDescriptor.isSticky,
271
+ sampleRequest: providerDescriptor.sampleRequest,
272
+ },
273
+ name: providerDescriptor.name,
274
+ fullName: providerDescriptor.fullName,
275
+ isDefault: providerDescriptor.isDefault,
276
+ locations: isNonEmptyArray(providerDescriptor.locations) ?
277
+ ( (providerDescriptor.locations.map(ChatAgentLocation.fromRaw))) :
278
+ [ChatAgentLocation.Panel],
279
+ slashCommands: providerDescriptor.commands ?? [],
280
+ disambiguation: coalesce(participantsAndCommandsDisambiguation.flat()),
281
+ }));
282
+ this._participantRegistrationDisposables.set(getParticipantKey(extension.description.identifier, providerDescriptor.id), store);
283
+ }
284
+ catch (e) {
285
+ this.logService.error(`Failed to register participant ${providerDescriptor.id}: ${toErrorMessage(e, true)}`);
286
+ }
292
287
  }
293
288
  }
294
289
  for (const extension of delta.removed) {
@@ -299,7 +294,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
299
294
  });
300
295
  }
301
296
  registerViewContainer() {
302
- const title = ( localize2(7377, "Chat"));
297
+ const title = ( localize2(7631, "Chat"));
303
298
  const icon = Codicon.commentDiscussion;
304
299
  const viewContainerId = CHAT_SIDEBAR_PANEL_ID;
305
300
  const viewContainer = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
@@ -313,7 +308,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
313
308
  storageId: viewContainerId,
314
309
  hideIfEmpty: true,
315
310
  order: 100,
316
- }, 0 );
311
+ }, 2 , { doNotRegisterOpenCommand: true });
317
312
  return viewContainer;
318
313
  }
319
314
  registerDefaultParticipantView() {
@@ -326,7 +321,17 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
326
321
  name: { value: name, original: name },
327
322
  canToggleVisibility: false,
328
323
  canMoveView: true,
329
- ctorDescriptor: ( (new SyncDescriptor(ChatViewPane))),
324
+ openCommandActionDescriptor: {
325
+ id: CHAT_SIDEBAR_PANEL_ID,
326
+ keybindings: {
327
+ primary: 2048 | 512 | 39 ,
328
+ mac: {
329
+ primary: 2048 | 256 | 39
330
+ }
331
+ },
332
+ order: 100
333
+ },
334
+ ctorDescriptor: ( (new SyncDescriptor(ChatViewPane, [{ location: ChatAgentLocation.Panel }]))),
330
335
  when: ( (ContextKeyExpr.or(CONTEXT_CHAT_PANEL_PARTICIPANT_REGISTERED, CONTEXT_CHAT_EXTENSION_INVALID)))
331
336
  }];
332
337
  ( (Registry.as(Extensions.ViewsRegistry))).registerViews(viewDescriptor, this._viewContainer);
@@ -334,6 +339,40 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
334
339
  ( (Registry.as(Extensions.ViewsRegistry))).deregisterViews(viewDescriptor, this._viewContainer);
335
340
  });
336
341
  }
342
+ registerChatEditingView() {
343
+ const title = ( localize2(7632, "Copilot Edits"));
344
+ const icon = Codicon.editSession;
345
+ const viewContainerId = CHAT_EDITING_SIDEBAR_PANEL_ID;
346
+ const viewContainer = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
347
+ id: viewContainerId,
348
+ title,
349
+ icon,
350
+ ctorDescriptor: ( (new SyncDescriptor(
351
+ ViewPaneContainer,
352
+ [viewContainerId, { mergeViewWithContainerWhenSingleView: true }]
353
+ ))),
354
+ storageId: viewContainerId,
355
+ hideIfEmpty: true,
356
+ order: 100,
357
+ }, 2 );
358
+ const id = 'workbench.panel.chat.view.edits';
359
+ const viewDescriptor = [{
360
+ id: id,
361
+ containerIcon: viewContainer.icon,
362
+ containerTitle: title.value,
363
+ singleViewPaneContainerTitle: title.value,
364
+ name: { value: title.value, original: title.value },
365
+ canToggleVisibility: false,
366
+ canMoveView: true,
367
+ ctorDescriptor: ( (new SyncDescriptor(ChatViewPane, [{ location: ChatAgentLocation.EditingSession }]))),
368
+ when: CONTEXT_CHAT_EDITING_PARTICIPANT_REGISTERED
369
+ }];
370
+ ( (Registry.as(Extensions.ViewsRegistry))).registerViews(viewDescriptor, viewContainer);
371
+ return toDisposable(() => {
372
+ ( (Registry.as(Extensions.ViewContainersRegistry))).deregisterViewContainer(viewContainer);
373
+ ( (Registry.as(Extensions.ViewsRegistry))).deregisterViews(viewDescriptor, viewContainer);
374
+ });
375
+ }
337
376
  };
338
377
  ChatExtensionPointHandler = ( (__decorate([
339
378
  ( (__param(0, IChatAgentService))),
@@ -366,9 +405,9 @@ let ChatCompatibilityNotifier = class ChatCompatibilityNotifier extends Disposab
366
405
  return;
367
406
  }
368
407
  this.registeredWelcomeView = true;
369
- const showExtensionLabel = ( localize(7378, "Show Extension"));
408
+ const showExtensionLabel = ( localize(7633, "Show Extension"));
370
409
  const mainMessage = ( localize(
371
- 7379,
410
+ 7634,
372
411
  "Chat failed to load because the installed version of the {0} extension is not compatible with this version of {1}. Please ensure that the GitHub Copilot Chat extension is up to date.",
373
412
  'GitHub Copilot Chat',
374
413
  this.productService.nameLong
@@ -2,25 +2,116 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { HierarchicalKind } from 'vscode/vscode/vs/base/common/hierarchicalKind';
3
3
  import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
4
4
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { ChatInputPart } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatInputPart';
5
+ import { ChatInputPart } from '@codingame/monaco-vscode-chat-extensions-notebook-common/vscode/vs/workbench/contrib/chat/browser/chatInputPart';
6
+ import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
7
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
8
+ import { localize } from 'vscode/vscode/vs/nls';
9
+ import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
10
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
6
11
 
7
12
  class PasteImageProvider {
8
- constructor() {
9
- this.kind = ( new HierarchicalKind('image'));
13
+ constructor(chatWidgetService, extensionService) {
14
+ this.chatWidgetService = chatWidgetService;
15
+ this.extensionService = extensionService;
16
+ this.kind = ( (new HierarchicalKind('image')));
10
17
  this.pasteMimeTypes = ['image/*'];
11
18
  }
12
19
  async provideDocumentPasteEdits(_model, _ranges, dataTransfer, context, token) {
20
+ if (!( (this.extensionService.extensions.some(ext => isProposedApiEnabled(ext, 'chatReferenceBinaryData'))))) {
21
+ return;
22
+ }
23
+ const supportedMimeTypes = [
24
+ 'image/png',
25
+ 'image/jpeg',
26
+ 'image/jpg',
27
+ 'image/bmp',
28
+ 'image/gif',
29
+ 'image/tiff'
30
+ ];
31
+ let mimeType;
32
+ let imageItem;
33
+ for (const type of supportedMimeTypes) {
34
+ imageItem = dataTransfer.get(type);
35
+ if (imageItem) {
36
+ mimeType = type;
37
+ break;
38
+ }
39
+ }
40
+ if (!imageItem || !mimeType) {
41
+ return;
42
+ }
43
+ const currClipboard = await imageItem.asFile()?.data();
44
+ if (token.isCancellationRequested || !currClipboard) {
45
+ return;
46
+ }
47
+ const widget = this.chatWidgetService.getWidgetByInputUri(_model.uri);
48
+ if (!widget) {
49
+ return;
50
+ }
51
+ const attachedVariables = widget.attachmentModel.attachments;
52
+ const displayName = ( localize(7635, 'Pasted Image'));
53
+ let tempDisplayName = displayName;
54
+ for (let appendValue = 2; ( (attachedVariables.some(attachment => attachment.name === tempDisplayName))); appendValue++) {
55
+ tempDisplayName = `${displayName} ${appendValue}`;
56
+ }
57
+ const imageContext = await getImageAttachContext(currClipboard, mimeType, token, tempDisplayName);
58
+ if (token.isCancellationRequested || !imageContext) {
59
+ return;
60
+ }
61
+ const currentContextIds = widget.attachmentModel.getAttachmentIDs();
62
+ if (( (currentContextIds.has(imageContext.id)))) {
63
+ return;
64
+ }
65
+ widget.attachmentModel.addContext(imageContext);
13
66
  return;
14
67
  }
15
68
  }
69
+ async function getImageAttachContext(data, mimeType, token, displayName) {
70
+ const imageHash = await imageToHash(data);
71
+ if (token.isCancellationRequested) {
72
+ return undefined;
73
+ }
74
+ return {
75
+ value: data,
76
+ id: imageHash,
77
+ name: displayName,
78
+ isImage: true,
79
+ icon: Codicon.fileMedia,
80
+ isDynamic: true,
81
+ isFile: false,
82
+ mimeType
83
+ };
84
+ }
85
+ async function imageToHash(data) {
86
+ const hashBuffer = await crypto.subtle.digest('SHA-256', data);
87
+ const hashArray = Array.from(( (new Uint8Array(hashBuffer))));
88
+ return ( (hashArray.map(b => ( (b.toString(16))).padStart(2, '0')))).join('');
89
+ }
90
+ function isImage(array) {
91
+ if (array.length < 4) {
92
+ return false;
93
+ }
94
+ const identifier = {
95
+ png: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A],
96
+ jpeg: [0xFF, 0xD8, 0xFF],
97
+ bmp: [0x42, 0x4D],
98
+ gif: [0x47, 0x49, 0x46, 0x38],
99
+ tiff: [0x49, 0x49, 0x2A, 0x00]
100
+ };
101
+ return (
102
+ (( (Object.values(identifier))).some((signature) => signature.every((byte, index) => array[index] === byte)))
103
+ );
104
+ }
16
105
  let ChatPasteProvidersFeature = class ChatPasteProvidersFeature extends Disposable {
17
- constructor(languageFeaturesService) {
106
+ constructor(languageFeaturesService, chatWidgetService, extensionService) {
18
107
  super();
19
- this._register(languageFeaturesService.documentPasteEditProvider.register({ scheme: ChatInputPart.INPUT_SCHEME, pattern: '*', hasAccessToAllModels: true }, ( new PasteImageProvider())));
108
+ this._register(languageFeaturesService.documentPasteEditProvider.register({ scheme: ChatInputPart.INPUT_SCHEME, pattern: '*', hasAccessToAllModels: true }, ( (new PasteImageProvider(chatWidgetService, extensionService)))));
20
109
  }
21
110
  };
22
- ChatPasteProvidersFeature = ( __decorate([
23
- ( __param(0, ILanguageFeaturesService))
24
- ], ChatPasteProvidersFeature));
111
+ ChatPasteProvidersFeature = ( (__decorate([
112
+ ( (__param(0, ILanguageFeaturesService))),
113
+ ( (__param(1, IChatWidgetService))),
114
+ ( (__param(2, IExtensionService)))
115
+ ], ChatPasteProvidersFeature)));
25
116
 
26
- export { ChatPasteProvidersFeature, PasteImageProvider };
117
+ export { ChatPasteProvidersFeature, PasteImageProvider, imageToHash, isImage };
@@ -22,8 +22,8 @@ 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 { showChatView } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
26
- import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
25
+ import { showChatView } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/chat';
26
+ import { ChatWidget } from '@codingame/monaco-vscode-chat-extensions-notebook-common/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
29
  import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
@@ -179,7 +179,7 @@ let QuickChat = class QuickChat extends Disposable {
179
179
  IContextKeyService,
180
180
  this._register(this.contextKeyService.createScoped(parent))
181
181
  ]))));
182
- this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, { isQuickChat: true }, { renderInputOnTop: true, renderStyle: 'compact', menus: { inputSideToolbar: MenuId.ChatInputSide } }, {
182
+ this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, { isQuickChat: true }, { autoScroll: true, renderInputOnTop: true, renderStyle: 'compact', menus: { inputSideToolbar: MenuId.ChatInputSide }, enableImplicitContext: true }, {
183
183
  listForeground: quickInputForeground,
184
184
  listBackground: quickInputBackground,
185
185
  overlayBackground: EDITOR_DRAG_AND_DROP_BACKGROUND,
@@ -2,7 +2,7 @@ import { renderMarkdownAsPlaintext } from 'vscode/vscode/vs/base/browser/markdow
2
2
  import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
3
3
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
4
  import { CONTEXT_IN_CHAT_SESSION } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
5
- import { isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
5
+ import { isResponseVM } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatViewModel';
6
6
  import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
7
7
 
8
8
  class ChatResponseAccessibleView {
@@ -3,16 +3,14 @@ import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
3
3
  import { onUnexpectedExternalError } from 'vscode/vscode/vs/base/common/errors';
4
4
  import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
5
5
  import { toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
6
- import { basename } from 'vscode/vscode/vs/base/common/path';
7
6
  import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
8
7
  import { URI } from 'vscode/vscode/vs/base/common/uri';
9
8
  import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
10
9
  import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
11
- import { ChatRequestVariablePart, ChatRequestDynamicVariablePart, ChatRequestToolPart } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
12
- import { showChatView } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
10
+ import { ChatRequestVariablePart, ChatRequestDynamicVariablePart, ChatRequestToolPart } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
11
+ import { showChatView } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/chat';
13
12
  import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
14
- import { ChatContextAttachments } from 'vscode/vscode/vs/workbench/contrib/chat/browser/contrib/chatContextAttachments';
15
- import { ChatDynamicVariableModel } from 'vscode/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
13
+ import { ChatDynamicVariableModel } from '@codingame/monaco-vscode-chat-extensions-notebook-common/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
16
14
 
17
15
  let ChatVariablesService = class ChatVariablesService {
18
16
  constructor(chatWidgetService, viewsService) {
@@ -44,7 +42,7 @@ let ChatVariablesService = class ChatVariablesService {
44
42
  }
45
43
  }
46
44
  else if (part instanceof ChatRequestDynamicVariablePart) {
47
- resolvedVariables[i] = { id: part.id, name: part.referenceText, range: part.range, value: part.data, fullName: part.fullName, icon: part.icon };
45
+ resolvedVariables[i] = { id: part.id, name: part.referenceText, range: part.range, value: part.data, fullName: part.fullName, icon: part.icon, isFile: part.isFile };
48
46
  }
49
47
  else if (part instanceof ChatRequestToolPart) {
50
48
  resolvedVariables[i] = { id: part.toolId, name: part.toolName, range: part.range, value: undefined, isTool: true, icon: ThemeIcon.isThemeIcon(part.icon) ? part.icon : undefined, fullName: part.displayName };
@@ -70,7 +68,7 @@ let ChatVariablesService = class ChatVariablesService {
70
68
  }).catch(onUnexpectedExternalError));
71
69
  }
72
70
  else if (attachment.isDynamic || attachment.isTool) {
73
- resolvedAttachedContext[i] = { ...attachment };
71
+ resolvedAttachedContext[i] = attachment;
74
72
  }
75
73
  });
76
74
  await Promise.allSettled(jobs);
@@ -133,14 +131,14 @@ let ChatVariablesService = class ChatVariablesService {
133
131
  if (key === 'file' && typeof value !== 'string') {
134
132
  const uri = URI.isUri(value) ? value : value.uri;
135
133
  const range = 'range' in value ? value.range : undefined;
136
- widget.getContrib(ChatContextAttachments.ID)?.setContext(false, { value, id: ( uri.toString()) + (range?.toString() ?? ''), name: basename(uri.path), isFile: true, isDynamic: true });
134
+ widget.attachmentModel.addFile(uri, range);
137
135
  return;
138
136
  }
139
137
  const resolved = this._resolver.get(key);
140
138
  if (!resolved) {
141
139
  return;
142
140
  }
143
- widget.getContrib(ChatContextAttachments.ID)?.setContext(false, { ...resolved.data, value });
141
+ widget.attachmentModel.addContext({ ...resolved.data, value });
144
142
  }
145
143
  };
146
144
  ChatVariablesService = ( __decorate([