@codingame/monaco-vscode-extensions-service-override 22.1.9 → 23.0.1

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 (78) hide show
  1. package/index.js +1 -0
  2. package/package.json +30 -29
  3. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +28 -28
  4. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.d.ts +3 -1
  5. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +47 -41
  6. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +1 -1
  7. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +1 -1
  8. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.d.ts +3 -1
  9. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +52 -24
  10. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.d.ts +16 -0
  11. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.js +43 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +23 -17
  13. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +133 -90
  14. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.d.ts +2 -1
  15. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.d.ts +1 -1
  16. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.d.ts +1 -1
  17. package/vscode/src/vs/workbench/api/browser/mainThreadComments.d.ts +6 -2
  18. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +1 -1
  19. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +8 -6
  20. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.d.ts +1 -1
  21. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.d.ts +1 -1
  22. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +1 -1
  23. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +1 -1
  24. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.d.ts +1 -1
  25. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +7 -7
  26. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.d.ts +1 -1
  27. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +1 -1
  28. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.d.ts +1 -1
  29. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +1 -1
  30. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +21 -14
  31. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +20 -20
  32. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.d.ts +7 -5
  33. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +17 -6
  34. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.d.ts +1 -1
  35. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +3 -3
  36. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.d.ts +5 -5
  37. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.js +29 -21
  38. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +4 -4
  39. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +4 -5
  40. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +2 -2
  41. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.d.ts +2 -2
  42. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +2 -2
  43. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.d.ts +1 -1
  44. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +13 -17
  45. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +2 -2
  46. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +3 -3
  47. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +1 -1
  48. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.d.ts +24 -3
  49. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +172 -55
  50. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.d.ts +2 -1
  51. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +57 -6
  52. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +1 -1
  53. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.d.ts +2 -1
  54. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +1 -1
  55. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +2 -2
  56. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.d.ts +2 -1
  57. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +6 -6
  58. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +7 -7
  59. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +2 -2
  60. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +2 -2
  61. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.d.ts +1 -1
  62. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +5 -5
  63. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.d.ts +1 -1
  64. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +1 -1
  65. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +5 -5
  66. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +1 -1
  67. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +3 -1
  68. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +23 -23
  69. package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +2 -2
  70. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +2 -2
  71. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +1 -1
  72. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +12 -12
  73. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +1 -1
  74. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +1 -1
  75. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +4 -4
  76. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.d.ts +1 -0
  77. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +6 -0
  78. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +1 -1
@@ -5,28 +5,26 @@ import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/c
5
5
  import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
6
6
  import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
7
7
  import { Disposable, DisposableMap, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
+ import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
8
9
  import { revive } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshalling';
9
10
  import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
11
+ import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
12
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
10
13
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
11
14
  import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
12
15
  import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
13
- import { ChatViewId } from '@codingame/monaco-vscode-b994942c-360d-5b68-8a33-77d4bde6b714-common/vscode/vs/workbench/contrib/chat/browser/chat';
16
+ import { ChatEditorInput } from '@codingame/monaco-vscode-aac7027b-326c-513a-95a9-e4eedd151b38-common/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
14
17
  import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
15
- import { ChatSessionUri } from '@codingame/monaco-vscode-b994942c-360d-5b68-8a33-77d4bde6b714-common/vscode/vs/workbench/contrib/chat/common/chatUri';
16
18
  import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
17
19
  import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
18
20
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
19
- import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
20
21
  import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
21
22
  import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
22
23
  import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
23
24
 
24
25
  class ObservableChatSession extends Disposable {
25
- static generateSessionKey(providerHandle, sessionId) {
26
- return `${providerHandle}_${sessionId}`;
27
- }
28
- get sessionKey() {
29
- return ObservableChatSession.generateSessionKey(this.providerHandle, this.sessionId);
26
+ get options() {
27
+ return this._options;
30
28
  }
31
29
  get progressObs() {
32
30
  return this._progressObservable;
@@ -34,7 +32,7 @@ class ObservableChatSession extends Disposable {
34
32
  get isCompleteObs() {
35
33
  return this._isCompleteObservable;
36
34
  }
37
- constructor(id, providerHandle, proxy, logService, dialogService) {
35
+ constructor(resource, providerHandle, proxy, logService, dialogService) {
38
36
  super();
39
37
  this._progressObservable = observableValue(this, []);
40
38
  this._isCompleteObservable = observableValue(this, false);
@@ -44,7 +42,7 @@ class ObservableChatSession extends Disposable {
44
42
  this._isInitialized = false;
45
43
  this._interruptionWasCanceled = false;
46
44
  this._disposalPending = false;
47
- this.sessionId = id;
45
+ this.sessionResource = resource;
48
46
  this.providerHandle = providerHandle;
49
47
  this.history = [];
50
48
  this._proxy = proxy;
@@ -60,11 +58,25 @@ class ObservableChatSession extends Disposable {
60
58
  }
61
59
  async _doInitializeContent(token) {
62
60
  try {
63
- const sessionContent = await raceCancellationError(this._proxy.$provideChatSessionContent(this._providerHandle, this.sessionId, token), token);
61
+ const sessionContent = await raceCancellationError(this._proxy.$provideChatSessionContent(this._providerHandle, this.sessionResource, token), token);
62
+ this._options = sessionContent.options;
64
63
  this.history.length = 0;
65
64
  this.history.push(...( sessionContent.history.map((turn) => {
66
65
  if (turn.type === 'request') {
67
- return { type: 'request', prompt: turn.prompt, participant: turn.participant };
66
+ const variables = turn.variableData?.variables.map(v => {
67
+ const entry = {
68
+ ...v,
69
+ value: revive(v.value)
70
+ };
71
+ return entry;
72
+ });
73
+ return {
74
+ type: 'request',
75
+ prompt: turn.prompt,
76
+ participant: turn.participant,
77
+ command: turn.command,
78
+ variableData: variables ? { variables } : undefined
79
+ };
68
80
  }
69
81
  return {
70
82
  type: 'response',
@@ -76,17 +88,17 @@ class ObservableChatSession extends Disposable {
76
88
  this.interruptActiveResponseCallback = async () => {
77
89
  const confirmInterrupt = () => {
78
90
  if (this._disposalPending) {
79
- this._proxy.$disposeChatSessionContent(this._providerHandle, this.sessionId);
91
+ this._proxy.$disposeChatSessionContent(this._providerHandle, this.sessionResource);
80
92
  this._disposalPending = false;
81
93
  }
82
- this._proxy.$interruptChatSessionActiveResponse(this._providerHandle, this.sessionId, 'ongoing');
94
+ this._proxy.$interruptChatSessionActiveResponse(this._providerHandle, this.sessionResource, 'ongoing');
83
95
  return true;
84
96
  };
85
97
  if (sessionContent.supportsInterruption) {
86
98
  return confirmInterrupt();
87
99
  }
88
100
  return this._dialogService.confirm({
89
- message: ( localize(2455, 'Are you sure you want to interrupt the active session?'))
101
+ message: ( localize(2466, 'Are you sure you want to interrupt the active session?'))
90
102
  }).then(confirmed => {
91
103
  if (confirmed.confirmed) {
92
104
  return confirmInterrupt();
@@ -98,7 +110,7 @@ class ObservableChatSession extends Disposable {
98
110
  }]);
99
111
  this._interruptionWasCanceled = true;
100
112
  if (this._disposalPending) {
101
- this._logService.info(`Canceling deferred disposal for session ${this.sessionId} (user canceled interruption)`);
113
+ this._logService.info(`Canceling deferred disposal for session ${this.sessionResource} (user canceled interruption)`);
102
114
  this._disposalPending = false;
103
115
  }
104
116
  return false;
@@ -124,7 +136,7 @@ class ObservableChatSession extends Disposable {
124
136
  }
125
137
  });
126
138
  try {
127
- await this._proxy.$invokeChatSessionRequestHandler(this._providerHandle, this.sessionId, request, history, token);
139
+ await this._proxy.$invokeChatSessionRequestHandler(this._providerHandle, this.sessionResource, request, history, token);
128
140
  if (!this._isCompleteObservable.get() && !this.interruptActiveResponseCallback) {
129
141
  this._markComplete();
130
142
  }
@@ -148,7 +160,7 @@ class ObservableChatSession extends Disposable {
148
160
  const hasRequestHandler = sessionContent.hasRequestHandler;
149
161
  const hasAnyCapability = hasActiveResponse || hasRequestHandler;
150
162
  for (const [requestId, chunks] of this._pendingProgressChunks) {
151
- this._logService.debug(`Processing ${chunks.length} pending progress chunks for session ${this.sessionId}, requestId ${requestId}`);
163
+ this._logService.debug(`Processing ${chunks.length} pending progress chunks for session ${this.sessionResource}, requestId ${requestId}`);
152
164
  this._addProgress(chunks);
153
165
  }
154
166
  this._pendingProgressChunks.clear();
@@ -157,7 +169,7 @@ class ObservableChatSession extends Disposable {
157
169
  }
158
170
  }
159
171
  catch (error) {
160
- this._logService.error(`Failed to initialize chat session ${this.sessionId}:`, error);
172
+ this._logService.error(`Failed to initialize chat session ${this.sessionResource}:`, error);
161
173
  throw error;
162
174
  }
163
175
  }
@@ -165,7 +177,7 @@ class ObservableChatSession extends Disposable {
165
177
  if (!this._isInitialized) {
166
178
  const existing = this._pendingProgressChunks.get(requestId) || [];
167
179
  this._pendingProgressChunks.set(requestId, [...existing, ...progress]);
168
- this._logService.debug(`Queuing ${progress.length} progress chunks for session ${this.sessionId}, requestId ${requestId} (session not initialized)`);
180
+ this._logService.debug(`Queuing ${progress.length} progress chunks for session ${this.sessionResource}, requestId ${requestId} (session not initialized)`);
169
181
  return;
170
182
  }
171
183
  this._addProgress(progress);
@@ -198,13 +210,13 @@ class ObservableChatSession extends Disposable {
198
210
  this._disposalPending = true;
199
211
  }
200
212
  else {
201
- this._proxy.$disposeChatSessionContent(this._providerHandle, this.sessionId);
213
+ this._proxy.$disposeChatSessionContent(this._providerHandle, this.sessionResource);
202
214
  }
203
215
  super.dispose();
204
216
  }
205
217
  }
206
218
  let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
207
- constructor(_extHostContext, _chatSessionsService, _dialogService, _editorService, editorGroupService, _logService, _viewsService) {
219
+ constructor(_extHostContext, _chatSessionsService, _dialogService, _editorService, editorGroupService, _logService) {
208
220
  super();
209
221
  this._extHostContext = _extHostContext;
210
222
  this._chatSessionsService = _chatSessionsService;
@@ -212,12 +224,21 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
212
224
  this._editorService = _editorService;
213
225
  this.editorGroupService = editorGroupService;
214
226
  this._logService = _logService;
215
- this._viewsService = _viewsService;
216
227
  this._itemProvidersRegistrations = this._register(( new DisposableMap()));
217
228
  this._contentProvidersRegistrations = this._register(( new DisposableMap()));
218
- this._activeSessions = ( new Map());
219
- this._sessionDisposables = ( new Map());
229
+ this._sessionTypeToHandle = ( new Map());
230
+ this._activeSessions = ( new ResourceMap());
231
+ this._sessionDisposables = ( new ResourceMap());
220
232
  this._proxy = ( this._extHostContext.getProxy(ExtHostContext.ExtHostChatSessions));
233
+ this._chatSessionsService.setOptionsChangeCallback(async (sessionResource, updates) => {
234
+ const handle = this._getHandleForSessionType(sessionResource.scheme);
235
+ if (handle !== undefined) {
236
+ await this.notifyOptionsChange(handle, sessionResource, updates);
237
+ }
238
+ });
239
+ }
240
+ _getHandleForSessionType(chatSessionType) {
241
+ return this._sessionTypeToHandle.get(chatSessionType);
221
242
  }
222
243
  $registerChatSessionItemProvider(handle, chatSessionType) {
223
244
  const disposables = ( new DisposableStore());
@@ -238,36 +259,37 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
238
259
  $onDidChangeChatSessionItems(handle) {
239
260
  this._itemProvidersRegistrations.get(handle)?.onDidChangeItems.fire();
240
261
  }
241
- $onDidCommitChatSessionItem(handle, original, modified) {
242
- this._logService.trace(`$onDidCommitChatSessionItem: handle(${handle}), original(${original}), modified(${modified})`);
262
+ async $onDidCommitChatSessionItem(handle, originalComponents, modifiedCompoennts) {
263
+ const originalResource = URI.revive(originalComponents);
264
+ const modifiedResource = URI.revive(modifiedCompoennts);
265
+ this._logService.trace(`$onDidCommitChatSessionItem: handle(${handle}), original(${originalResource}), modified(${modifiedResource})`);
243
266
  const chatSessionType = this._itemProvidersRegistrations.get(handle)?.provider.chatSessionType;
244
267
  if (!chatSessionType) {
245
268
  this._logService.error(`No chat session type found for provider handle ${handle}`);
246
269
  return;
247
270
  }
248
- const originalResource = ChatSessionUri.forSession(chatSessionType, original);
249
- const modifiedResource = ChatSessionUri.forSession(chatSessionType, modified);
250
271
  const originalEditor = this._editorService.editors.find(editor => editor.resource?.toString() === ( originalResource.toString()));
251
- let originalGroup;
252
- for (const group of this.editorGroupService.groups) {
253
- if (( group.editors.some(editor => editor.resource?.toString() === ( originalResource.toString())))) {
254
- originalGroup = group;
255
- break;
272
+ const contribution = this._chatSessionsService.getAllChatSessionContributions().find(c => c.type === chatSessionType);
273
+ const originalGroup = this.editorGroupService.groups.find(group => ( group.editors.some(editor => isEqual(editor.resource, originalResource))))
274
+ ?? this.editorGroupService.activeGroup;
275
+ const options = {
276
+ title: {
277
+ preferred: originalEditor?.getName() || undefined,
278
+ fallback: ( localize(2467, "{0}", contribution?.displayName)),
256
279
  }
257
- }
258
- if (!originalGroup) {
259
- originalGroup = this.editorGroupService.activeGroup;
260
- }
280
+ };
261
281
  if (originalEditor) {
262
- this._chatSessionsService.provideChatSessionContent(chatSessionType, modified, CancellationToken.None).then(() => {
263
- this._editorService.replaceEditors([{
264
- editor: originalEditor,
265
- replacement: {
266
- resource: modifiedResource,
267
- options: {}
268
- },
269
- }], originalGroup);
270
- });
282
+ const newSession = await this._chatSessionsService.getOrCreateChatSession(URI.revive(modifiedResource), CancellationToken.None);
283
+ newSession.initialEditingSession = originalEditor instanceof ChatEditorInput
284
+ ? originalEditor.transferOutEditingSession()
285
+ : undefined;
286
+ this._editorService.replaceEditors([{
287
+ editor: originalEditor,
288
+ replacement: {
289
+ resource: modifiedResource,
290
+ options,
291
+ },
292
+ }], originalGroup);
271
293
  }
272
294
  else {
273
295
  this._logService.warn(`Original chat session editor not found for resource ${( originalResource.toString())}`);
@@ -280,6 +302,7 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
280
302
  return ( sessions.map(session => ({
281
303
  ...session,
282
304
  id: session.id,
305
+ resource: URI.revive(session.resource),
283
306
  iconPath: session.iconPath,
284
307
  tooltip: session.tooltip ? this._reviveTooltip(session.tooltip) : undefined
285
308
  })));
@@ -298,6 +321,7 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
298
321
  return {
299
322
  ...chatSessionItem,
300
323
  id: chatSessionItem.id,
324
+ resource: URI.revive(chatSessionItem.resource),
301
325
  iconPath: chatSessionItem.iconPath,
302
326
  tooltip: chatSessionItem.tooltip ? this._reviveTooltip(chatSessionItem.tooltip) : undefined,
303
327
  };
@@ -307,40 +331,67 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
307
331
  throw error;
308
332
  }
309
333
  }
310
- async _provideChatSessionContent(providerHandle, id, token) {
311
- const sessionKey = ObservableChatSession.generateSessionKey(providerHandle, id);
312
- let session = this._activeSessions.get(sessionKey);
334
+ async _provideChatSessionContent(providerHandle, sessionResource, token) {
335
+ let session = this._activeSessions.get(sessionResource);
313
336
  if (!session) {
314
- session = ( new ObservableChatSession(id, providerHandle, this._proxy, this._logService, this._dialogService));
315
- this._activeSessions.set(sessionKey, session);
337
+ session = ( new ObservableChatSession(
338
+ sessionResource,
339
+ providerHandle,
340
+ this._proxy,
341
+ this._logService,
342
+ this._dialogService
343
+ ));
344
+ this._activeSessions.set(sessionResource, session);
316
345
  const disposable = session.onWillDispose(() => {
317
- this._activeSessions.delete(sessionKey);
318
- this._sessionDisposables.get(sessionKey)?.dispose();
319
- this._sessionDisposables.delete(sessionKey);
346
+ this._activeSessions.delete(sessionResource);
347
+ this._sessionDisposables.get(sessionResource)?.dispose();
348
+ this._sessionDisposables.delete(sessionResource);
320
349
  });
321
- this._sessionDisposables.set(sessionKey, disposable);
350
+ this._sessionDisposables.set(sessionResource, disposable);
322
351
  }
323
352
  try {
324
353
  await session.initialize(token);
354
+ if (session.options) {
355
+ for (const [_, handle] of this._sessionTypeToHandle) {
356
+ if (handle === providerHandle) {
357
+ for (const [optionId, value] of Object.entries(session.options)) {
358
+ this._chatSessionsService.setSessionOption(sessionResource, optionId, value);
359
+ }
360
+ break;
361
+ }
362
+ }
363
+ }
325
364
  return session;
326
365
  }
327
366
  catch (error) {
328
367
  session.dispose();
329
- this._logService.error(`Error providing chat session content for handle ${providerHandle} and id ${id}:`, error);
368
+ this._logService.error(`Error providing chat session content for handle ${providerHandle} and resource ${( sessionResource.toString())}:`, error);
330
369
  throw error;
331
370
  }
332
371
  }
333
372
  $unregisterChatSessionItemProvider(handle) {
334
373
  this._itemProvidersRegistrations.deleteAndDispose(handle);
335
374
  }
336
- $registerChatSessionContentProvider(handle, chatSessionType) {
375
+ $registerChatSessionContentProvider(handle, chatSessionScheme) {
337
376
  const provider = {
338
- provideChatSessionContent: (id, token) => this._provideChatSessionContent(handle, id, token)
377
+ provideChatSessionContent: (resource, token) => this._provideChatSessionContent(handle, resource, token)
339
378
  };
340
- this._contentProvidersRegistrations.set(handle, this._chatSessionsService.registerChatSessionContentProvider(chatSessionType, provider));
379
+ this._sessionTypeToHandle.set(chatSessionScheme, handle);
380
+ this._contentProvidersRegistrations.set(handle, this._chatSessionsService.registerChatSessionContentProvider(chatSessionScheme, provider));
381
+ this._proxy.$provideChatSessionProviderOptions(handle, CancellationToken.None).then(options => {
382
+ if (options?.optionGroups && options.optionGroups.length) {
383
+ this._chatSessionsService.setOptionGroupsForSessionType(chatSessionScheme, handle, options.optionGroups);
384
+ }
385
+ }).catch(err => this._logService.error('Error fetching chat session options', err));
341
386
  }
342
387
  $unregisterChatSessionContentProvider(handle) {
343
388
  this._contentProvidersRegistrations.deleteAndDispose(handle);
389
+ for (const [sessionType, h] of this._sessionTypeToHandle) {
390
+ if (h === handle) {
391
+ this._sessionTypeToHandle.delete(sessionType);
392
+ break;
393
+ }
394
+ }
344
395
  for (const [key, session] of this._activeSessions) {
345
396
  if (session.providerHandle === handle) {
346
397
  session.dispose();
@@ -348,31 +399,29 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
348
399
  }
349
400
  }
350
401
  }
351
- async $handleProgressChunk(handle, sessionId, requestId, chunks) {
352
- const sessionKey = ObservableChatSession.generateSessionKey(handle, sessionId);
353
- const observableSession = this._activeSessions.get(sessionKey);
402
+ async $handleProgressChunk(handle, sessionResource, requestId, chunks) {
403
+ const resource = URI.revive(sessionResource);
404
+ const observableSession = this._activeSessions.get(resource);
405
+ if (!observableSession) {
406
+ this._logService.warn(`No session found for progress chunks: handle ${handle}, sessionResource ${resource}, requestId ${requestId}`);
407
+ return;
408
+ }
354
409
  const chatProgressParts = ( chunks.map(chunk => {
355
410
  const [progress] = Array.isArray(chunk) ? chunk : [chunk];
356
411
  return revive(progress);
357
412
  }));
358
- if (observableSession) {
359
- observableSession.handleProgressChunk(requestId, chatProgressParts);
360
- }
361
- else {
362
- this._logService.warn(`No session found for progress chunks: handle ${handle}, sessionId ${sessionId}, requestId ${requestId}`);
363
- }
413
+ observableSession.handleProgressChunk(requestId, chatProgressParts);
364
414
  }
365
- $handleProgressComplete(handle, sessionId, requestId) {
366
- const sessionKey = ObservableChatSession.generateSessionKey(handle, sessionId);
367
- const observableSession = this._activeSessions.get(sessionKey);
368
- if (observableSession) {
369
- observableSession.handleProgressComplete(requestId);
370
- }
371
- else {
372
- this._logService.warn(`No session found for progress completion: handle ${handle}, sessionId ${sessionId}, requestId ${requestId}`);
415
+ $handleProgressComplete(handle, sessionResource, requestId) {
416
+ const resource = URI.revive(sessionResource);
417
+ const observableSession = this._activeSessions.get(resource);
418
+ if (!observableSession) {
419
+ this._logService.warn(`No session found for progress completion: handle ${handle}, sessionResource ${resource}, requestId ${requestId}`);
420
+ return;
373
421
  }
422
+ observableSession.handleProgressComplete(requestId);
374
423
  }
375
- $handleAnchorResolve(handle, sessionId, requestId, requestHandle, anchor) {
424
+ $handleAnchorResolve(handle, sesssionResource, requestId, requestHandle, anchor) {
376
425
  }
377
426
  dispose() {
378
427
  for (const session of ( this._activeSessions.values())) {
@@ -397,17 +446,12 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
397
446
  }
398
447
  return undefined;
399
448
  }
400
- async $showChatSession(chatSessionType, sessionId, position) {
401
- const sessionUri = ChatSessionUri.forSession(chatSessionType, sessionId);
402
- if (typeof position === 'undefined') {
403
- const chatPanel = await this._viewsService.openView(ChatViewId);
404
- await chatPanel?.loadSession(sessionUri);
449
+ async notifyOptionsChange(handle, sessionResource, updates) {
450
+ try {
451
+ await this._proxy.$provideHandleOptionsChange(handle, sessionResource, updates, CancellationToken.None);
405
452
  }
406
- else {
407
- await this._editorService.openEditor({
408
- resource: sessionUri,
409
- options: { pinned: true },
410
- }, position);
453
+ catch (error) {
454
+ this._logService.error(`Error notifying extension about options change for handle ${handle}, sessionResource ${sessionResource}:`, error);
411
455
  }
412
456
  }
413
457
  };
@@ -417,8 +461,7 @@ MainThreadChatSessions = __decorate([
417
461
  ( __param(2, IDialogService)),
418
462
  ( __param(3, IEditorService)),
419
463
  ( __param(4, IEditorGroupsService)),
420
- ( __param(5, ILogService)),
421
- ( __param(6, IViewsService))
464
+ ( __param(5, ILogService))
422
465
  ], MainThreadChatSessions);
423
466
 
424
467
  export { MainThreadChatSessions, ObservableChatSession };
@@ -1,10 +1,11 @@
1
+ import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js";
1
2
  import { MainThreadClipboardShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
2
3
  import { IClipboardService } from "@codingame/monaco-vscode-api/vscode/vs/platform/clipboard/common/clipboardService.service";
3
4
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
4
5
  export declare class MainThreadClipboard implements MainThreadClipboardShape {
5
6
  private readonly _clipboardService;
6
7
  private readonly _logService;
7
- constructor(_context: any, _clipboardService: IClipboardService, _logService: ILogService);
8
+ constructor(_context: IExtHostContext, _clipboardService: IClipboardService, _logService: ILogService);
8
9
  dispose(): void;
9
10
  $readText(): Promise<string>;
10
11
  $writeText(value: string): Promise<void>;
@@ -16,6 +16,6 @@ export declare class MainThreadEditorInsets implements MainThreadEditorInsetsSha
16
16
  $disposeEditorInset(handle: number): void;
17
17
  $setHtml(handle: number, value: string): void;
18
18
  $setOptions(handle: number, options: IWebviewContentOptions): void;
19
- $postMessage(handle: number, value: any): Promise<boolean>;
19
+ $postMessage(handle: number, value: unknown): Promise<boolean>;
20
20
  private getInset;
21
21
  }
@@ -15,6 +15,6 @@ export declare class MainThreadCommands implements MainThreadCommandsShape {
15
15
  $registerCommand(id: string): void;
16
16
  $unregisterCommand(id: string): void;
17
17
  $fireCommandActivationEvent(id: string): void;
18
- $executeCommand<T>(id: string, args: any[] | SerializableObjectWithBuffers<any[]>, retry: boolean): Promise<T | undefined>;
18
+ $executeCommand<T>(id: string, args: unknown[] | SerializableObjectWithBuffers<unknown[]>, retry: boolean): Promise<T | undefined>;
19
19
  $getCommands(): Promise<string[]>;
20
20
  }
@@ -10,7 +10,8 @@ import { ICommentController } from "@codingame/monaco-vscode-comments-service-ov
10
10
  import { ICommentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/comments/browser/commentService.service";
11
11
  import { CommentProviderFeatures, ExtHostCommentsShape, MainThreadCommentsShape, CommentThreadChanges } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
12
12
  import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service";
13
- import { ICellRange } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/common/notebookRange";
13
+ import { MarshalledId } from "@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds";
14
+ import { ICellRange } from "@codingame/monaco-vscode-9d2c06d1-1f89-51a5-9964-aa01fe50c198-common/vscode/vs/workbench/contrib/notebook/common/notebookRange";
14
15
  import { IViewsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service";
15
16
  import { MarshalledCommentThread } from "../../common/comments.js";
16
17
  import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
@@ -137,7 +138,10 @@ export declare class MainThreadCommentController extends Disposable implements I
137
138
  getAllComments(): MainThreadCommentThread<IRange | ICellRange>[];
138
139
  createCommentThreadTemplate(resource: UriComponents, range: IRange | undefined, editorId?: string): Promise<void>;
139
140
  updateCommentThreadTemplate(threadHandle: number, range: IRange): Promise<void>;
140
- toJSON(): any;
141
+ toJSON(): {
142
+ $mid: MarshalledId;
143
+ handle: number;
144
+ };
141
145
  }
142
146
  export declare class MainThreadComments extends Disposable implements MainThreadCommentsShape {
143
147
  private readonly _commentService;
@@ -424,7 +424,7 @@ class MainThreadCommentController extends Disposable {
424
424
  };
425
425
  }
426
426
  }
427
- const commentsViewIcon = registerIcon('comments-view-icon', Codicon.commentDiscussion, ( localize(2456, 'View icon of the comments view.')));
427
+ const commentsViewIcon = registerIcon('comments-view-icon', Codicon.commentDiscussion, ( localize(2468, 'View icon of the comments view.')));
428
428
  let MainThreadComments = class MainThreadComments extends Disposable {
429
429
  constructor(extHostContext, _commentService, _viewsService, _viewDescriptorService, _uriIdentityService, _editorService) {
430
430
  super();
@@ -25,16 +25,16 @@ import { ExtHostContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench
25
25
  import { CustomEditorInput } from '@codingame/monaco-vscode-7f39b6f1-3542-5430-8760-0f404d7a7cee-common/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput';
26
26
  import { ICustomEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/customEditor/common/customEditor.service';
27
27
  import { CustomTextEditorModel } from '../../contrib/customEditor/common/customTextEditorModel.js';
28
- import { ExtensionKeyedWebviewOriginStore } from '@codingame/monaco-vscode-a654b07e-8806-5425-b124-18f03ba8e11a-common/vscode/vs/workbench/contrib/webview/browser/webview';
28
+ import { ExtensionKeyedWebviewOriginStore } from '@codingame/monaco-vscode-2a04f0cd-b806-5886-909e-418183d32279-common/vscode/vs/workbench/contrib/webview/browser/webview';
29
29
  import { IWebviewWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.service';
30
- import { editorGroupToColumn } from '@codingame/monaco-vscode-a17e9d37-b6c1-5556-8402-5db73960fae3-common/vscode/vs/workbench/services/editor/common/editorGroupColumn';
30
+ import { editorGroupToColumn } from '@codingame/monaco-vscode-3b5a5cd1-d4ff-500a-b609-57e0cd4afa0a-common/vscode/vs/workbench/services/editor/common/editorGroupColumn';
31
31
  import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
32
32
  import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
33
33
  import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
34
34
  import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
35
35
  import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
36
- import { ResourceWorkingCopy } from '@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/resourceWorkingCopy';
37
- import { NO_TYPE_ID, WorkingCopyCapabilities } from '@codingame/monaco-vscode-caeb744c-8e3f-5c11-80fb-0f057d24d544-common/vscode/vs/workbench/services/workingCopy/common/workingCopy';
36
+ import { ResourceWorkingCopy } from '@codingame/monaco-vscode-6f931a91-88ea-5232-897f-a17ec3929ba5-common/vscode/vs/workbench/services/workingCopy/common/resourceWorkingCopy';
37
+ import { NO_TYPE_ID, WorkingCopyCapabilities } from '@codingame/monaco-vscode-d392702e-4ad7-5904-a915-f6063284cf14-common/vscode/vs/workbench/services/workingCopy/common/workingCopy';
38
38
  import { IWorkingCopyFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
39
39
  import { IWorkingCopyService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
40
40
  import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
@@ -303,7 +303,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
303
303
  this._register(workingCopyService.registerWorkingCopy(this));
304
304
  this._register(extensionService.onWillStop(e => {
305
305
  e.veto(true, ( localize(
306
- 2457,
306
+ 2469,
307
307
  "An extension provided editor for '{0}' is still open that would close otherwise.",
308
308
  this.name
309
309
  )));
@@ -371,7 +371,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
371
371
  this._undoService.pushElement({
372
372
  type: UndoRedoElementType.Resource,
373
373
  resource: this._editorResource,
374
- label: label ?? ( localize(2458, "Edit")),
374
+ label: label ?? ( localize(2470, "Edit")),
375
375
  code: 'undoredo.customEditorEdit',
376
376
  undo: () => this.undo(),
377
377
  redo: () => this.redo(),
@@ -513,6 +513,8 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
513
513
  const backupMeta = {
514
514
  viewType: this.viewType,
515
515
  editorResource: this._editorResource,
516
+ customTitle: primaryEditor.getWebviewTitle(),
517
+ iconPath: primaryEditor.iconPath,
516
518
  backupId: '',
517
519
  extension: primaryEditor.extension ? {
518
520
  id: primaryEditor.extension.id.value,
@@ -37,7 +37,7 @@ export declare class MainThreadDebugService implements MainThreadDebugServiceSha
37
37
  private getSession;
38
38
  $startDebugging(folder: UriComponents | undefined, nameOrConfig: string | IDebugConfiguration, options: IStartDebuggingOptions): Promise<boolean>;
39
39
  $setDebugSessionName(sessionId: DebugSessionUUID, name: string): void;
40
- $customDebugAdapterRequest(sessionId: DebugSessionUUID, request: string, args: any): Promise<any>;
40
+ $customDebugAdapterRequest(sessionId: DebugSessionUUID, request: string, args: unknown): Promise<unknown>;
41
41
  $getDebugProtocolBreakpoint(sessionId: DebugSessionUUID, breakpoinId: string): Promise<DebugProtocol.Breakpoint | undefined>;
42
42
  $stopDebugging(sessionId: DebugSessionUUID | undefined): Promise<void>;
43
43
  $appendDebugConsole(value: string): void;
@@ -25,7 +25,7 @@ export declare class BoundModelReferenceCollection {
25
25
  _maxSize?: number);
26
26
  dispose(): void;
27
27
  remove(uri: URI): void;
28
- add(uri: URI, ref: IReference<any>, length?: number): void;
28
+ add(uri: URI, ref: IReference<unknown>, length?: number): void;
29
29
  private _cleanup;
30
30
  }
31
31
  export declare class MainThreadDocuments extends Disposable implements MainThreadDocumentsShape {
@@ -13,7 +13,7 @@ import { MainThreadDocuments } from './mainThreadDocuments.js';
13
13
  import { MainThreadTextEditor } from './mainThreadEditor.js';
14
14
  import { MainThreadTextEditors } from './mainThreadEditors.js';
15
15
  import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
16
- import { editorGroupToColumn } from '@codingame/monaco-vscode-a17e9d37-b6c1-5556-8402-5db73960fae3-common/vscode/vs/workbench/services/editor/common/editorGroupColumn';
16
+ import { editorGroupToColumn } from '@codingame/monaco-vscode-3b5a5cd1-d4ff-500a-b609-57e0cd4afa0a-common/vscode/vs/workbench/services/editor/common/editorGroupColumn';
17
17
  import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
18
18
  import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
19
19
  import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
@@ -14,7 +14,7 @@ class ExtHostEditSessionIdentityCreateParticipant {
14
14
  }
15
15
  async participate(workspaceFolder, token) {
16
16
  const p = ( new Promise((resolve, reject) => {
17
- setTimeout(() => reject(( new Error(( localize(2459, "Aborted onWillCreateEditSessionIdentity-event after 10000ms"))))), this.timeout);
17
+ setTimeout(() => reject(( new Error(( localize(2471, "Aborted onWillCreateEditSessionIdentity-event after 10000ms"))))), this.timeout);
18
18
  this._proxy.$onWillCreateEditSessionIdentity(workspaceFolder.uri, token, this.timeout).then(resolve, reject);
19
19
  }));
20
20
  return raceCancellationError(p, token);
@@ -1,7 +1,7 @@
1
1
  import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
2
2
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
3
3
  import { MainThreadEditorTabsShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
4
- import { EditorGroupColumn } from "@codingame/monaco-vscode-a17e9d37-b6c1-5556-8402-5db73960fae3-common/vscode/vs/workbench/services/editor/common/editorGroupColumn";
4
+ import { EditorGroupColumn } from "@codingame/monaco-vscode-3b5a5cd1-d4ff-500a-b609-57e0cd4afa0a-common/vscode/vs/workbench/services/editor/common/editorGroupColumn";
5
5
  import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
6
6
  import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
7
7
  import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js";