@codingame/monaco-vscode-extensions-service-override 26.2.2 → 27.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 (64) hide show
  1. package/index.js +4 -0
  2. package/package.json +3 -3
  3. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +28 -28
  4. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +25 -25
  5. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +1 -1
  6. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.d.ts +1 -0
  7. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +53 -4
  8. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.d.ts +2 -3
  9. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.js +26 -11
  10. package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.d.ts +15 -0
  11. package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.js +114 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +14 -9
  13. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +133 -66
  14. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +4 -1
  15. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +2 -2
  16. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +1 -1
  17. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +1 -0
  18. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +11 -11
  19. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +20 -20
  20. package/vscode/src/vs/workbench/api/browser/mainThreadGitExtensionService.d.ts +21 -0
  21. package/vscode/src/vs/workbench/api/browser/mainThreadGitExtensionService.js +111 -0
  22. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.d.ts +3 -2
  23. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +33 -4
  24. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +2 -1
  25. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +8 -3
  26. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.d.ts +10 -1
  27. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.js +34 -10
  28. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +4 -4
  29. package/vscode/src/vs/workbench/api/browser/mainThreadMeteredConnection.d.ts +9 -0
  30. package/vscode/src/vs/workbench/api/browser/mainThreadMeteredConnection.js +26 -0
  31. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +1 -1
  32. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +3 -3
  33. package/vscode/src/vs/workbench/api/browser/mainThreadPower.d.ts +16 -0
  34. package/vscode/src/vs/workbench/api/browser/mainThreadPower.js +54 -0
  35. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +1 -1
  36. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +4 -0
  37. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +1 -1
  38. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +1 -1
  39. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +4 -2
  40. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.d.ts +1 -1
  41. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +8 -7
  42. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +2 -2
  43. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +2 -2
  44. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.d.ts +1 -1
  45. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +2 -1
  46. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +1 -1
  47. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +6 -7
  48. package/vscode/src/vs/workbench/api/common/shared/tasks.d.ts +1 -1
  49. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +1 -1
  50. package/vscode/src/vs/workbench/contrib/git/common/gitService.d.ts +44 -0
  51. package/vscode/src/vs/workbench/contrib/git/common/gitService.js +10 -0
  52. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +23 -23
  53. package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +2 -2
  54. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +3 -3
  55. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +13 -13
  56. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.d.ts +2 -0
  57. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +6 -1
  58. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManagers.d.ts +1 -0
  59. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +1 -1
  60. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +4 -4
  61. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.d.ts +1 -0
  62. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +3 -0
  63. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +2 -1
  64. package/vscode/src/vs/workbench/services/themes/browser/cssExtensionPoint.js +5 -5
@@ -0,0 +1,15 @@
1
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
+ import { IChatDebugService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service";
3
+ import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js";
4
+ import { IChatDebugEventDto, MainThreadChatDebugShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
5
+ export declare class MainThreadChatDebug extends Disposable implements MainThreadChatDebugShape {
6
+ private readonly _chatDebugService;
7
+ private readonly _proxy;
8
+ private readonly _providerDisposables;
9
+ private readonly _activeSessionResources;
10
+ constructor(extHostContext: IExtHostContext, _chatDebugService: IChatDebugService);
11
+ $registerChatDebugLogProvider(handle: number): void;
12
+ $unregisterChatDebugLogProvider(handle: number): void;
13
+ $acceptChatDebugEvent(handle: number, dto: IChatDebugEventDto): void;
14
+ private _reviveEvent;
15
+ }
@@ -0,0 +1,114 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
5
+ import { IChatDebugService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service';
6
+ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
7
+ import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
8
+
9
+ let MainThreadChatDebug = class MainThreadChatDebug extends Disposable {
10
+ constructor(extHostContext, _chatDebugService) {
11
+ super();
12
+ this._chatDebugService = _chatDebugService;
13
+ this._providerDisposables = ( new Map());
14
+ this._activeSessionResources = ( new Map());
15
+ this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChatDebug));
16
+ }
17
+ $registerChatDebugLogProvider(handle) {
18
+ const disposables = ( new DisposableStore());
19
+ this._providerDisposables.set(handle, disposables);
20
+ disposables.add(this._chatDebugService.registerProvider({
21
+ provideChatDebugLog: async (sessionResource, token) => {
22
+ this._activeSessionResources.set(handle, sessionResource);
23
+ const dtos = await this._proxy.$provideChatDebugLog(handle, sessionResource, token);
24
+ return dtos?.map(dto => this._reviveEvent(dto, sessionResource));
25
+ },
26
+ resolveChatDebugLogEvent: async (eventId, token) => {
27
+ return this._proxy.$resolveChatDebugLogEvent(handle, eventId, token);
28
+ }
29
+ }));
30
+ }
31
+ $unregisterChatDebugLogProvider(handle) {
32
+ const disposables = this._providerDisposables.get(handle);
33
+ disposables?.dispose();
34
+ this._providerDisposables.delete(handle);
35
+ this._activeSessionResources.delete(handle);
36
+ }
37
+ $acceptChatDebugEvent(handle, dto) {
38
+ const sessionResource = (dto.sessionResource ? URI.revive(dto.sessionResource) : undefined) ?? this._activeSessionResources.get(handle) ?? this._chatDebugService.activeSessionResource;
39
+ if (!sessionResource) {
40
+ return;
41
+ }
42
+ const revived = this._reviveEvent(dto, sessionResource);
43
+ this._chatDebugService.addProviderEvent(revived);
44
+ }
45
+ _reviveEvent(dto, sessionResource) {
46
+ const base = {
47
+ id: dto.id,
48
+ sessionResource,
49
+ created: ( new Date(dto.created)),
50
+ parentEventId: dto.parentEventId
51
+ };
52
+ switch (dto.kind) {
53
+ case "toolCall":
54
+ return {
55
+ ...base,
56
+ kind: "toolCall",
57
+ toolName: dto.toolName,
58
+ toolCallId: dto.toolCallId,
59
+ input: dto.input,
60
+ output: dto.output,
61
+ result: dto.result,
62
+ durationInMillis: dto.durationInMillis
63
+ };
64
+ case "modelTurn":
65
+ return {
66
+ ...base,
67
+ kind: "modelTurn",
68
+ model: dto.model,
69
+ requestName: dto.requestName,
70
+ inputTokens: dto.inputTokens,
71
+ outputTokens: dto.outputTokens,
72
+ totalTokens: dto.totalTokens,
73
+ durationInMillis: dto.durationInMillis
74
+ };
75
+ case "generic":
76
+ return {
77
+ ...base,
78
+ kind: "generic",
79
+ name: dto.name,
80
+ details: dto.details,
81
+ level: dto.level,
82
+ category: dto.category
83
+ };
84
+ case "subagentInvocation":
85
+ return {
86
+ ...base,
87
+ kind: "subagentInvocation",
88
+ agentName: dto.agentName,
89
+ description: dto.description,
90
+ status: dto.status,
91
+ durationInMillis: dto.durationInMillis,
92
+ toolCallCount: dto.toolCallCount,
93
+ modelTurnCount: dto.modelTurnCount
94
+ };
95
+ case "userMessage":
96
+ return {
97
+ ...base,
98
+ kind: "userMessage",
99
+ message: dto.message,
100
+ sections: dto.sections
101
+ };
102
+ case "agentResponse":
103
+ return {
104
+ ...base,
105
+ kind: "agentResponse",
106
+ message: dto.message,
107
+ sections: dto.sections
108
+ };
109
+ }
110
+ }
111
+ };
112
+ MainThreadChatDebug = __decorate([extHostNamedCustomer(MainContext.MainThreadChatDebug), ( __param(1, IChatDebugService))], MainThreadChatDebug);
113
+
114
+ export { MainThreadChatDebug };
@@ -1,5 +1,4 @@
1
1
  import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
- import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
3
2
  import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
4
3
  import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
5
4
  import { URI, UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
@@ -9,24 +8,26 @@ import { IAgentSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/wo
9
8
  import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
10
9
  import { IChatContentInlineReference, IChatProgress } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService";
11
10
  import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
12
- import { IChatSession, IChatSessionHistoryItem, IChatSessionProviderOptionItem } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService";
11
+ import { IChatSession, IChatSessionHistoryItem, IChatSessionItem, IChatSessionProviderOptionItem } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService";
13
12
  import { IChatSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service";
14
13
  import { IChatAgentRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents";
14
+ import { IChatTodoListService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/chatTodoListService.service";
15
15
  import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
16
16
  import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
17
17
  import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js";
18
18
  import { Dto } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/proxyIdentifier";
19
- import { ExtHostChatSessionsShape, IChatProgressDto, MainThreadChatSessionsShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
19
+ import { ExtHostChatSessionsShape, IChatProgressDto, IChatSessionItemsChange, MainThreadChatSessionsShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
20
20
  export declare class ObservableChatSession extends Disposable implements IChatSession {
21
21
  readonly sessionResource: URI;
22
22
  readonly providerHandle: number;
23
23
  readonly history: Array<IChatSessionHistoryItem>;
24
+ title?: string;
24
25
  private _options?;
25
26
  get options(): Record<string, string | IChatSessionProviderOptionItem> | undefined;
26
27
  private readonly _progressObservable;
27
28
  private readonly _isCompleteObservable;
28
29
  private readonly _onWillDispose;
29
- readonly onWillDispose: Event<void>;
30
+ readonly onWillDispose: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
30
31
  private readonly _pendingProgressChunks;
31
32
  private _isInitialized;
32
33
  private _interruptionWasCanceled;
@@ -62,29 +63,33 @@ export declare class MainThreadChatSessions extends Disposable implements MainTh
62
63
  private readonly _chatSessionsService;
63
64
  private readonly _chatService;
64
65
  private readonly _chatWidgetService;
66
+ private readonly _chatTodoListService;
65
67
  private readonly _dialogService;
66
68
  private readonly _editorService;
67
69
  private readonly editorGroupService;
68
70
  private readonly _logService;
69
- private readonly _itemProvidersRegistrations;
71
+ private readonly _itemControllerRegistrations;
70
72
  private readonly _contentProvidersRegistrations;
71
73
  private readonly _sessionTypeToHandle;
72
74
  private readonly _activeSessions;
73
75
  private readonly _sessionDisposables;
74
76
  private readonly _proxy;
75
- constructor(_extHostContext: IExtHostContext, _agentSessionsService: IAgentSessionsService, _chatSessionsService: IChatSessionsService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _dialogService: IDialogService, _editorService: IEditorService, editorGroupService: IEditorGroupsService, _logService: ILogService);
77
+ constructor(_extHostContext: IExtHostContext, _agentSessionsService: IAgentSessionsService, _chatSessionsService: IChatSessionsService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _chatTodoListService: IChatTodoListService, _dialogService: IDialogService, _editorService: IEditorService, editorGroupService: IEditorGroupsService, _logService: ILogService);
76
78
  private _getHandleForSessionType;
77
- $registerChatSessionItemProvider(handle: number, chatSessionType: string): void;
79
+ $registerChatSessionItemController(handle: number, chatSessionType: string): void;
80
+ private getController;
78
81
  $onDidChangeChatSessionItems(handle: number): void;
82
+ private _resolveSessionItem;
83
+ $updateChatSessionItems(controllerHandle: number, change: IChatSessionItemsChange): Promise<void>;
84
+ $addOrUpdateChatSessionItem(controllerHandle: number, item: Dto<IChatSessionItem>): Promise<void>;
79
85
  $onDidChangeChatSessionOptions(handle: number, sessionResourceComponents: UriComponents, updates: ReadonlyArray<{
80
86
  optionId: string;
81
87
  value: string;
82
88
  }>): void;
83
89
  $onDidCommitChatSessionItem(handle: number, originalComponents: UriComponents, modifiedCompoennts: UriComponents): Promise<void>;
84
- private _provideChatSessionItems;
85
90
  private handleSessionModelOverrides;
86
91
  private _provideChatSessionContent;
87
- $unregisterChatSessionItemProvider(handle: number): void;
92
+ $unregisterChatSessionItemController(handle: number): void;
88
93
  $registerChatSessionContentProvider(handle: number, chatSessionScheme: string): void;
89
94
  $unregisterChatSessionContentProvider(handle: number): void;
90
95
  $handleProgressChunk(handle: number, sessionResource: UriComponents, requestId: string, chunks: (IChatProgressDto | [
@@ -2,7 +2,7 @@
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
3
  import { raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
4
4
  import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
5
- import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
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
8
  import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
@@ -15,7 +15,7 @@ import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/
15
15
  import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
16
16
  import { hasValidDiff } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel';
17
17
  import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
18
- import { isIChatViewViewContext, ChatViewPaneTarget } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
18
+ import { isIChatViewViewContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
19
19
  import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
20
20
  import { ChatEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput';
21
21
  import { awaitStatsForSession } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chat';
@@ -24,6 +24,7 @@ import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/c
24
24
  import { ChatSessionStatus } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
25
25
  import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
26
26
  import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
27
+ import { IChatTodoListService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/chatTodoListService.service';
27
28
  import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
28
29
  import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
29
30
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
@@ -72,6 +73,7 @@ class ObservableChatSession extends Disposable {
72
73
  token
73
74
  );
74
75
  this._options = sessionContent.options;
76
+ this.title = sessionContent.title;
75
77
  this.history.length = 0;
76
78
  this.history.push(...( sessionContent.history.map(turn => {
77
79
  if (turn.type === "request") {
@@ -90,7 +92,8 @@ class ObservableChatSession extends Disposable {
90
92
  variableData: variables ? {
91
93
  variables
92
94
  } : undefined,
93
- id: turn.id
95
+ id: turn.id,
96
+ modelId: turn.modelId
94
97
  };
95
98
  }
96
99
  return {
@@ -113,7 +116,7 @@ class ObservableChatSession extends Disposable {
113
116
  return confirmInterrupt();
114
117
  }
115
118
  return this._dialogService.confirm({
116
- message: ( localize(2501, "Are you sure you want to interrupt the active session?"))
119
+ message: ( localize(2541, "Are you sure you want to interrupt the active session?"))
117
120
  }).then(confirmed => {
118
121
  if (confirmed.confirmed) {
119
122
  return confirmInterrupt();
@@ -236,6 +239,52 @@ class ObservableChatSession extends Disposable {
236
239
  super.dispose();
237
240
  }
238
241
  }
242
+ class MainThreadChatSessionItemController extends Disposable {
243
+ constructor(proxy, handle) {
244
+ super();
245
+ this._onDidChangeChatSessionItems = this._register(( new Emitter()));
246
+ this.onDidChangeChatSessionItems = this._onDidChangeChatSessionItems.event;
247
+ this._items = ( new ResourceMap());
248
+ this._proxy = proxy;
249
+ this._handle = handle;
250
+ }
251
+ get items() {
252
+ return Array.from(( this._items.values()));
253
+ }
254
+ refresh(token) {
255
+ return this._proxy.$refreshChatSessionItems(this._handle, token);
256
+ }
257
+ async newChatSessionItem(request, token) {
258
+ const dto = await raceCancellationError(this._proxy.$newChatSessionItem(this._handle, request, token), token);
259
+ if (!dto) {
260
+ return undefined;
261
+ }
262
+ const item = {
263
+ ...dto,
264
+ resource: URI.revive(dto.resource),
265
+ changes: revive(dto.changes)
266
+ };
267
+ this._items.set(item.resource, item);
268
+ this._onDidChangeChatSessionItems.fire();
269
+ return item;
270
+ }
271
+ acceptChange(change) {
272
+ for (const item of change.addedOrUpdated) {
273
+ this._items.set(item.resource, item);
274
+ }
275
+ for (const uri of change.removed) {
276
+ this._items.delete(uri);
277
+ }
278
+ this._onDidChangeChatSessionItems.fire();
279
+ }
280
+ addOrUpdateItem(item) {
281
+ this._items.set(item.resource, item);
282
+ this._onDidChangeChatSessionItems.fire();
283
+ }
284
+ fireOnDidChangeChatSessionItems() {
285
+ this._onDidChangeChatSessionItems.fire();
286
+ }
287
+ }
239
288
  let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
240
289
  constructor(
241
290
  _extHostContext,
@@ -243,6 +292,7 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
243
292
  _chatSessionsService,
244
293
  _chatService,
245
294
  _chatWidgetService,
295
+ _chatTodoListService,
246
296
  _dialogService,
247
297
  _editorService,
248
298
  editorGroupService,
@@ -254,11 +304,12 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
254
304
  this._chatSessionsService = _chatSessionsService;
255
305
  this._chatService = _chatService;
256
306
  this._chatWidgetService = _chatWidgetService;
307
+ this._chatTodoListService = _chatTodoListService;
257
308
  this._dialogService = _dialogService;
258
309
  this._editorService = _editorService;
259
310
  this.editorGroupService = editorGroupService;
260
311
  this._logService = _logService;
261
- this._itemProvidersRegistrations = this._register(( new DisposableMap()));
312
+ this._itemControllerRegistrations = this._register(( new DisposableMap()));
262
313
  this._contentProvidersRegistrations = this._register(( new DisposableMap()));
263
314
  this._sessionTypeToHandle = ( new Map());
264
315
  this._activeSessions = ( new ResourceMap());
@@ -286,9 +337,9 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
286
337
  this._register(
287
338
  this._agentSessionsService.model.onDidChangeSessionArchivedState(session => {
288
339
  for (const [handle, {
289
- provider
290
- }] of this._itemProvidersRegistrations) {
291
- if (provider.chatSessionType === session.providerType) {
340
+ chatSessionType
341
+ }] of this._itemControllerRegistrations) {
342
+ if (chatSessionType === session.providerType) {
292
343
  this._proxy.$onDidChangeChatSessionItemState(handle, session.resource, session.isArchived());
293
344
  }
294
345
  }
@@ -298,26 +349,72 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
298
349
  _getHandleForSessionType(chatSessionType) {
299
350
  return this._sessionTypeToHandle.get(chatSessionType);
300
351
  }
301
- $registerChatSessionItemProvider(handle, chatSessionType) {
352
+ $registerChatSessionItemController(handle, chatSessionType) {
302
353
  const disposables = ( new DisposableStore());
303
- const changeEmitter = disposables.add(( new Emitter()));
304
- const provider = {
305
- chatSessionType,
306
- onDidChangeChatSessionItems: Event.debounce(changeEmitter.event, (_, e) => e, 200),
307
- provideChatSessionItems: token => this._provideChatSessionItems(handle, token)
308
- };
309
- disposables.add(this._chatSessionsService.registerChatSessionItemProvider(provider));
310
- this._itemProvidersRegistrations.set(handle, {
311
- dispose: () => disposables.dispose(),
312
- provider,
313
- onDidChangeItems: changeEmitter
314
- });
354
+ const controller = disposables.add(( new MainThreadChatSessionItemController(this._proxy, handle)));
315
355
  disposables.add(
316
- this._chatSessionsService.registerChatModelChangeListeners(this._chatService, chatSessionType, () => changeEmitter.fire())
356
+ this._chatSessionsService.registerChatSessionItemController(chatSessionType, controller)
317
357
  );
358
+ this._itemControllerRegistrations.set(handle, {
359
+ chatSessionType,
360
+ controller,
361
+ dispose: () => disposables.dispose()
362
+ });
363
+ disposables.add(this._chatSessionsService.registerChatModelChangeListeners(
364
+ this._chatService,
365
+ chatSessionType,
366
+ () => controller.fireOnDidChangeChatSessionItems()
367
+ ));
368
+ }
369
+ getController(handle) {
370
+ const registration = this._itemControllerRegistrations.get(handle);
371
+ if (!registration) {
372
+ throw ( new Error(`No chat session controller registered for handle ${handle}`));
373
+ }
374
+ return registration.controller;
318
375
  }
319
376
  $onDidChangeChatSessionItems(handle) {
320
- this._itemProvidersRegistrations.get(handle)?.onDidChangeItems.fire();
377
+ const controller = this.getController(handle);
378
+ controller.fireOnDidChangeChatSessionItems();
379
+ }
380
+ async _resolveSessionItem(item) {
381
+ const uri = URI.revive(item.resource);
382
+ const model = this._chatService.getSession(uri);
383
+ if (model) {
384
+ item = await this.handleSessionModelOverrides(model, item);
385
+ }
386
+ if (!item.changes || !model) {
387
+ const stats = (await this._chatService.getMetadataForSession(uri))?.stats;
388
+ const diffs = {
389
+ files: stats?.fileCount || 0,
390
+ insertions: stats?.added || 0,
391
+ deletions: stats?.removed || 0
392
+ };
393
+ if (hasValidDiff(diffs)) {
394
+ item.changes = diffs;
395
+ }
396
+ }
397
+ return {
398
+ ...item,
399
+ changes: revive(item.changes),
400
+ resource: uri,
401
+ iconPath: item.iconPath,
402
+ tooltip: item.tooltip ? this._reviveTooltip(item.tooltip) : undefined,
403
+ archived: item.archived
404
+ };
405
+ }
406
+ async $updateChatSessionItems(controllerHandle, change) {
407
+ const controller = this.getController(controllerHandle);
408
+ const resolvedItems = await Promise.all(( change.addedOrUpdated.map(item => this._resolveSessionItem(item))));
409
+ controller.acceptChange({
410
+ addedOrUpdated: resolvedItems,
411
+ removed: ( change.removed.map(uri => URI.revive(uri)))
412
+ });
413
+ }
414
+ async $addOrUpdateChatSessionItem(controllerHandle, item) {
415
+ const controller = this.getController(controllerHandle);
416
+ const resolvedItem = await this._resolveSessionItem(item);
417
+ controller.addOrUpdateItem(resolvedItem);
321
418
  }
322
419
  $onDidChangeChatSessionOptions(handle, sessionResourceComponents, updates) {
323
420
  const sessionResource = URI.revive(sessionResourceComponents);
@@ -329,27 +426,28 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
329
426
  this._logService.trace(
330
427
  `$onDidCommitChatSessionItem: handle(${handle}), original(${originalResource}), modified(${modifiedResource})`
331
428
  );
332
- const chatSessionType = this._itemProvidersRegistrations.get(handle)?.provider.chatSessionType;
429
+ const chatSessionType = this._itemControllerRegistrations.get(handle)?.chatSessionType;
333
430
  if (!chatSessionType) {
334
431
  this._logService.error(`No chat session type found for provider handle ${handle}`);
335
432
  return;
336
433
  }
337
434
  const originalEditor = this._editorService.editors.find(editor => editor.resource?.toString() === ( originalResource.toString()));
338
- const originalModel = this._chatService.getActiveSessionReference(originalResource);
435
+ const originalModel = this._chatService.acquireExistingSession(originalResource);
339
436
  const contribution = this._chatSessionsService.getAllChatSessionContributions().find(c => c.type === chatSessionType);
340
437
  try {
438
+ this._chatTodoListService.migrateTodos(originalResource, modifiedResource);
341
439
  const originalGroup = this.editorGroupService.groups.find(group => ( group.editors.some(editor => isEqual(editor.resource, originalResource)))) ?? this.editorGroupService.activeGroup;
342
440
  const options = {
343
441
  title: {
344
442
  preferred: originalEditor?.getName() || undefined,
345
- fallback: ( localize(2502, "{0}", contribution?.displayName))
443
+ fallback: ( localize(2542, "{0}", contribution?.displayName))
346
444
  }
347
445
  };
348
446
  const newSession = await this._chatSessionsService.getOrCreateChatSession(URI.revive(modifiedResource), CancellationToken.None);
349
447
  if (originalEditor) {
350
448
  newSession.transferredState = originalEditor instanceof ChatEditorInput ? {
351
449
  editingSession: originalEditor.transferOutEditingSession(),
352
- inputState: originalModel?.object.inputModel.toJSON()
450
+ inputState: originalModel?.object?.inputModel.toJSON()
353
451
  } : undefined;
354
452
  await this._editorService.replaceEditors([{
355
453
  editor: originalEditor,
@@ -368,51 +466,17 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
368
466
  }
369
467
  const chatViewWidget = this._chatWidgetService.getWidgetBySessionResource(originalResource);
370
468
  if (chatViewWidget && isIChatViewViewContext(chatViewWidget.viewContext)) {
371
- await this._chatWidgetService.openSession(modifiedResource, ChatViewPaneTarget, {
469
+ await this._chatWidgetService.openSession(modifiedResource, undefined, {
372
470
  preserveFocus: true
373
471
  });
374
472
  } else {
375
- const ref = await this._chatService.loadSessionForResource(modifiedResource, ChatAgentLocation.Chat, CancellationToken.None);
473
+ const ref = await this._chatService.acquireOrLoadSession(modifiedResource, ChatAgentLocation.Chat, CancellationToken.None);
376
474
  ref?.dispose();
377
475
  }
378
476
  } finally {
379
477
  originalModel?.dispose();
380
478
  }
381
479
  }
382
- async _provideChatSessionItems(handle, token) {
383
- try {
384
- const sessions = await this._proxy.$provideChatSessionItems(handle, token);
385
- return Promise.all(( sessions.map(async session => {
386
- const uri = URI.revive(session.resource);
387
- const model = this._chatService.getSession(uri);
388
- if (model) {
389
- session = await this.handleSessionModelOverrides(model, session);
390
- }
391
- if (!session.changes || !model) {
392
- const stats = (await this._chatService.getMetadataForSession(uri))?.stats;
393
- const diffs = {
394
- files: stats?.fileCount || 0,
395
- insertions: stats?.added || 0,
396
- deletions: stats?.removed || 0
397
- };
398
- if (hasValidDiff(diffs)) {
399
- session.changes = diffs;
400
- }
401
- }
402
- return {
403
- ...session,
404
- changes: revive(session.changes),
405
- resource: uri,
406
- iconPath: session.iconPath,
407
- tooltip: session.tooltip ? this._reviveTooltip(session.tooltip) : undefined,
408
- archived: session.archived
409
- };
410
- })));
411
- } catch (error) {
412
- this._logService.error("Error providing chat sessions:", error);
413
- }
414
- return [];
415
- }
416
480
  async handleSessionModelOverrides(model, session) {
417
481
  const inProgress = model.getRequests().filter(r => r.response && !r.response.isComplete);
418
482
  if (inProgress.length) {
@@ -473,8 +537,8 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
473
537
  throw error;
474
538
  }
475
539
  }
476
- $unregisterChatSessionItemProvider(handle) {
477
- this._itemProvidersRegistrations.deleteAndDispose(handle);
540
+ $unregisterChatSessionItemController(handle) {
541
+ this._itemControllerRegistrations.deleteAndDispose(handle);
478
542
  }
479
543
  $registerChatSessionContentProvider(handle, chatSessionScheme) {
480
544
  const provider = {
@@ -556,6 +620,9 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
556
620
  })));
557
621
  this._chatSessionsService.setOptionGroupsForSessionType(chatSessionScheme, handle, groupsWithCallbacks);
558
622
  }
623
+ if (options?.newSessionOptions) {
624
+ this._chatSessionsService.setNewSessionOptionsForSessionType(chatSessionScheme, options.newSessionOptions);
625
+ }
559
626
  }).catch(err => this._logService.error("Error fetching chat session options", err));
560
627
  }
561
628
  dispose() {
@@ -598,6 +665,6 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
598
665
  }
599
666
  }
600
667
  };
601
- MainThreadChatSessions = __decorate([extHostNamedCustomer(MainContext.MainThreadChatSessions), ( __param(1, IAgentSessionsService)), ( __param(2, IChatSessionsService)), ( __param(3, IChatService)), ( __param(4, IChatWidgetService)), ( __param(5, IDialogService)), ( __param(6, IEditorService)), ( __param(7, IEditorGroupsService)), ( __param(8, ILogService))], MainThreadChatSessions);
668
+ MainThreadChatSessions = __decorate([extHostNamedCustomer(MainContext.MainThreadChatSessions), ( __param(1, IAgentSessionsService)), ( __param(2, IChatSessionsService)), ( __param(3, IChatService)), ( __param(4, IChatWidgetService)), ( __param(5, IChatTodoListService)), ( __param(6, IDialogService)), ( __param(7, IEditorService)), ( __param(8, IEditorGroupsService)), ( __param(9, ILogService))], MainThreadChatSessions);
602
669
 
603
670
  export { MainThreadChatSessions, ObservableChatSession };
@@ -195,10 +195,13 @@ class MainThreadCommentThread {
195
195
  dispose() {
196
196
  this._isDisposed = true;
197
197
  this._onDidChangeCollapsibleState.dispose();
198
+ this._onDidChangeInitialCollapsibleState.dispose();
198
199
  this._onDidChangeComments.dispose();
199
200
  this._onDidChangeInput.dispose();
200
201
  this._onDidChangeLabel.dispose();
202
+ this._onDidChangeCanReply.dispose();
201
203
  this._onDidChangeState.dispose();
204
+ this._onDidChangeApplicability.dispose();
202
205
  }
203
206
  toJSON() {
204
207
  return {
@@ -453,7 +456,7 @@ class MainThreadCommentController extends Disposable {
453
456
  };
454
457
  }
455
458
  }
456
- const commentsViewIcon = registerIcon("comments-view-icon", Codicon.commentDiscussion, ( localize(2503, "View icon of the comments view.")));
459
+ const commentsViewIcon = registerIcon("comments-view-icon", Codicon.commentDiscussion, ( localize(2543, "View icon of the comments view.")));
457
460
  let MainThreadComments = class MainThreadComments extends Disposable {
458
461
  constructor(
459
462
  extHostContext,
@@ -405,7 +405,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
405
405
  this._register(workingCopyService.registerWorkingCopy(this));
406
406
  this._register(extensionService.onWillStop(e => {
407
407
  e.veto(true, ( localize(
408
- 2504,
408
+ 2544,
409
409
  "An extension provided editor for '{0}' is still open that would close otherwise.",
410
410
  this.name
411
411
  )));
@@ -473,7 +473,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
473
473
  this._undoService.pushElement({
474
474
  type: UndoRedoElementType.Resource,
475
475
  resource: this._editorResource,
476
- label: label ?? ( localize(2505, "Edit")),
476
+ label: label ?? ( localize(2545, "Edit")),
477
477
  code: "undoredo.customEditorEdit",
478
478
  undo: () => this.undo(),
479
479
  redo: () => this.redo()
@@ -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(2506, "Aborted onWillCreateEditSessionIdentity-event after 10000ms"))))), this.timeout);
17
+ setTimeout(() => reject(( new Error(( localize(2546, "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);
@@ -142,6 +142,7 @@ class MainThreadTextEditor {
142
142
  }
143
143
  dispose() {
144
144
  this._modelListeners.dispose();
145
+ this._onPropertiesChanged.dispose();
145
146
  this._codeEditor = null;
146
147
  this._codeEditorListeners.dispose();
147
148
  }