@codingame/monaco-vscode-extensions-service-override 25.1.1 → 26.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 (120) hide show
  1. package/index.js +7 -0
  2. package/package.json +3 -3
  3. package/vscode/src/vs/base/common/console.js +24 -15
  4. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.d.ts +4 -1
  5. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +149 -84
  6. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +20 -12
  7. package/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.js +38 -21
  8. package/vscode/src/vs/platform/remote/common/managedSocket.js +7 -10
  9. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +5 -2
  10. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +5 -2
  11. package/vscode/src/vs/workbench/api/browser/mainThreadAiSettingsSearch.js +4 -1
  12. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +200 -143
  13. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +10 -14
  14. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +41 -31
  15. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.d.ts +9 -12
  16. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +168 -115
  17. package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.js +11 -13
  18. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.d.ts +5 -5
  19. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.js +42 -15
  20. package/vscode/src/vs/workbench/api/browser/mainThreadChatOutputRenderer.js +8 -7
  21. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +4 -2
  22. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +170 -99
  23. package/vscode/src/vs/workbench/api/browser/mainThreadChatStatus.js +2 -5
  24. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +4 -9
  25. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +13 -12
  26. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +16 -19
  27. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +127 -70
  28. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +80 -26
  29. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +5 -11
  30. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +199 -97
  31. package/vscode/src/vs/workbench/api/browser/mainThreadDataChannels.js +1 -4
  32. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +88 -73
  33. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +5 -5
  34. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +16 -12
  35. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +10 -8
  36. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +14 -6
  37. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +52 -37
  38. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +78 -58
  39. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +5 -7
  40. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +75 -63
  41. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +99 -91
  42. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +93 -55
  43. package/vscode/src/vs/workbench/api/browser/mainThreadEmbeddings.js +3 -7
  44. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +85 -60
  45. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +49 -45
  46. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +114 -72
  47. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +4 -7
  48. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +1 -4
  49. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.d.ts +2 -2
  50. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +381 -238
  51. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.d.ts +7 -3
  52. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +90 -13
  53. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +81 -58
  54. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +9 -10
  55. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +2 -7
  56. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +6 -10
  57. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +12 -10
  58. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.d.ts +3 -2
  59. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.js +162 -97
  60. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +32 -26
  61. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +38 -32
  62. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +48 -46
  63. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +22 -18
  64. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +5 -8
  65. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +35 -21
  66. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +31 -28
  67. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +5 -7
  68. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +47 -23
  69. package/vscode/src/vs/workbench/api/browser/mainThreadProfileContentHandlers.js +15 -12
  70. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +17 -18
  71. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +6 -7
  72. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +83 -66
  73. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +1 -5
  74. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +250 -92
  75. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +6 -8
  76. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +37 -26
  77. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +34 -21
  78. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +3 -6
  79. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +19 -14
  80. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +41 -16
  81. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +18 -17
  82. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +145 -145
  83. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +19 -11
  84. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +176 -80
  85. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +52 -21
  86. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +26 -24
  87. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +1 -4
  88. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +5 -8
  89. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.d.ts +4 -1
  90. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +106 -46
  91. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +83 -65
  92. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +20 -20
  93. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +14 -9
  94. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +17 -9
  95. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +49 -38
  96. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +10 -13
  97. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +38 -27
  98. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +5 -11
  99. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.d.ts +4 -1
  100. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +73 -43
  101. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +2 -2
  102. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +17 -10
  103. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +17 -11
  104. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +107 -80
  105. package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +336 -175
  106. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +126 -71
  107. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +76 -54
  108. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +1 -2
  109. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.d.ts +2 -0
  110. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +343 -192
  111. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +5 -3
  112. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.d.ts +0 -1
  113. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +75 -68
  114. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +135 -36
  115. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +22 -18
  116. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +14 -12
  117. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +21 -9
  118. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +48 -25
  119. package/vscode/src/vs/workbench/services/themes/browser/cssExtensionPoint.d.ts +24 -0
  120. package/vscode/src/vs/workbench/services/themes/browser/cssExtensionPoint.js +300 -0
@@ -11,19 +11,46 @@ let MainThreadChatContext = class MainThreadChatContext extends Disposable {
11
11
  this._chatContextService = _chatContextService;
12
12
  this._providers = ( new Map());
13
13
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChatContext));
14
+ this._chatContextService.setExecuteCommandCallback(itemHandle => this._proxy.$executeChatContextItemCommand(itemHandle));
14
15
  }
15
- $registerChatContextProvider(handle, id, selector, _options, support) {
16
- this._providers.set(handle, { selector, support, id });
17
- this._chatContextService.registerChatContextProvider(id, selector, {
18
- provideChatContext: (token) => {
19
- return this._proxy.$provideChatContext(handle, token);
16
+ $registerChatWorkspaceContextProvider(handle, id) {
17
+ this._providers.set(handle, {
18
+ id
19
+ });
20
+ this._chatContextService.registerChatWorkspaceContextProvider(id, {
21
+ provideWorkspaceChatContext: token => {
22
+ return this._proxy.$provideWorkspaceChatContext(handle, token);
23
+ }
24
+ });
25
+ }
26
+ $registerChatExplicitContextProvider(handle, id) {
27
+ this._providers.set(handle, {
28
+ id
29
+ });
30
+ this._chatContextService.registerChatExplicitContextProvider(id, {
31
+ provideChatContext: token => {
32
+ return this._proxy.$provideExplicitChatContext(handle, token);
20
33
  },
21
- resolveChatContext: support.supportsResolve ? (context, token) => {
22
- return this._proxy.$resolveChatContext(handle, context, token);
23
- } : undefined,
24
- provideChatContextForResource: support.supportsResource ? (resource, withValue, token) => {
25
- return this._proxy.$provideChatContextForResource(handle, { resource, withValue }, token);
26
- } : undefined
34
+ resolveChatContext: (context, token) => {
35
+ return this._proxy.$resolveExplicitChatContext(handle, context, token);
36
+ }
37
+ });
38
+ }
39
+ $registerChatResourceContextProvider(handle, id, selector) {
40
+ this._providers.set(handle, {
41
+ id,
42
+ selector
43
+ });
44
+ this._chatContextService.registerChatResourceContextProvider(id, selector, {
45
+ provideChatContext: (resource, withValue, token) => {
46
+ return this._proxy.$provideResourceChatContext(handle, {
47
+ resource,
48
+ withValue
49
+ }, token);
50
+ },
51
+ resolveChatContext: (context, token) => {
52
+ return this._proxy.$resolveResourceChatContext(handle, context, token);
53
+ }
27
54
  });
28
55
  }
29
56
  $unregisterChatContextProvider(handle) {
@@ -41,10 +68,10 @@ let MainThreadChatContext = class MainThreadChatContext extends Disposable {
41
68
  }
42
69
  this._chatContextService.updateWorkspaceContextItems(provider.id, items);
43
70
  }
71
+ $executeChatContextItemCommand(itemHandle) {
72
+ return this._proxy.$executeChatContextItemCommand(itemHandle);
73
+ }
44
74
  };
45
- MainThreadChatContext = __decorate([
46
- extHostNamedCustomer(MainContext.MainThreadChatContext),
47
- ( __param(1, IChatContextService))
48
- ], MainThreadChatContext);
75
+ MainThreadChatContext = __decorate([extHostNamedCustomer(MainContext.MainThreadChatContext), ( __param(1, IChatContextService))], MainThreadChatContext);
49
76
 
50
77
  export { MainThreadChatContext };
@@ -25,20 +25,21 @@ let MainThreadChatOutputRenderer = class MainThreadChatOutputRenderer extends Di
25
25
  renderOutputPart: async (mime, data, webview, token) => {
26
26
  const webviewHandle = `chat-output-${++this._webviewHandlePool}`;
27
27
  this._mainThreadWebview.addWebview(webviewHandle, webview, {
28
- serializeBuffersForPostMessage: true,
28
+ serializeBuffersForPostMessage: true
29
29
  });
30
- this._proxy.$renderChatOutput(viewType, mime, VSBuffer.wrap(data), webviewHandle, token);
31
- },
30
+ return this._proxy.$renderChatOutput(viewType, mime, VSBuffer.wrap(data), webviewHandle, token);
31
+ }
32
32
  }, {
33
- extension: { id: extensionId, location: URI.revive(extensionLocation) }
33
+ extension: {
34
+ id: extensionId,
35
+ location: URI.revive(extensionLocation)
36
+ }
34
37
  });
35
38
  }
36
39
  $unregisterChatOutputRenderer(viewType) {
37
40
  this.registeredRenderers.get(viewType)?.dispose();
38
41
  }
39
42
  };
40
- MainThreadChatOutputRenderer = ( __decorate([
41
- ( __param(2, IChatOutputRendererService))
42
- ], MainThreadChatOutputRenderer));
43
+ MainThreadChatOutputRenderer = ( __decorate([( __param(2, IChatOutputRendererService))], MainThreadChatOutputRenderer));
43
44
 
44
45
  export { MainThreadChatOutputRenderer };
@@ -5,12 +5,13 @@ import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/
5
5
  import { URI, UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
6
6
  import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
7
7
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
8
+ import { IAgentSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service";
8
9
  import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
9
- import { IChatAgentRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents";
10
10
  import { IChatContentInlineReference, IChatProgress } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService";
11
11
  import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
12
12
  import { IChatSession, IChatSessionHistoryItem, IChatSessionProviderOptionItem } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService";
13
13
  import { IChatSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service";
14
+ import { IChatAgentRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents";
14
15
  import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
15
16
  import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
16
17
  import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js";
@@ -57,6 +58,7 @@ export declare class ObservableChatSession extends Disposable implements IChatSe
57
58
  }
58
59
  export declare class MainThreadChatSessions extends Disposable implements MainThreadChatSessionsShape {
59
60
  private readonly _extHostContext;
61
+ private readonly _agentSessionsService;
60
62
  private readonly _chatSessionsService;
61
63
  private readonly _chatService;
62
64
  private readonly _chatWidgetService;
@@ -70,7 +72,7 @@ export declare class MainThreadChatSessions extends Disposable implements MainTh
70
72
  private readonly _activeSessions;
71
73
  private readonly _sessionDisposables;
72
74
  private readonly _proxy;
73
- constructor(_extHostContext: IExtHostContext, _chatSessionsService: IChatSessionsService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _dialogService: IDialogService, _editorService: IEditorService, editorGroupService: IEditorGroupsService, _logService: ILogService);
75
+ constructor(_extHostContext: IExtHostContext, _agentSessionsService: IAgentSessionsService, _chatSessionsService: IChatSessionsService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _dialogService: IDialogService, _editorService: IEditorService, editorGroupService: IEditorGroupsService, _logService: ILogService);
74
76
  private _getHandleForSessionType;
75
77
  $registerChatSessionItemProvider(handle: number, chatSessionType: string): void;
76
78
  $onDidChangeChatSessionItems(handle: number): void;
@@ -14,6 +14,7 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
14
14
  import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
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
+ import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
17
18
  import { isIChatViewViewContext, ChatViewPaneTarget } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
18
19
  import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
19
20
  import { ChatEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput';
@@ -66,11 +67,14 @@ class ObservableChatSession extends Disposable {
66
67
  }
67
68
  async _doInitializeContent(token) {
68
69
  try {
69
- const sessionContent = await raceCancellationError(this._proxy.$provideChatSessionContent(this._providerHandle, this.sessionResource, token), token);
70
+ const sessionContent = await raceCancellationError(
71
+ this._proxy.$provideChatSessionContent(this._providerHandle, this.sessionResource, token),
72
+ token
73
+ );
70
74
  this._options = sessionContent.options;
71
75
  this.history.length = 0;
72
- this.history.push(...( sessionContent.history.map((turn) => {
73
- if (turn.type === 'request') {
76
+ this.history.push(...( sessionContent.history.map(turn => {
77
+ if (turn.type === "request") {
74
78
  const variables = turn.variableData?.variables.map(v => {
75
79
  const entry = {
76
80
  ...v,
@@ -79,17 +83,19 @@ class ObservableChatSession extends Disposable {
79
83
  return entry;
80
84
  });
81
85
  return {
82
- type: 'request',
86
+ type: "request",
83
87
  prompt: turn.prompt,
84
88
  participant: turn.participant,
85
89
  command: turn.command,
86
- variableData: variables ? { variables } : undefined,
90
+ variableData: variables ? {
91
+ variables
92
+ } : undefined,
87
93
  id: turn.id
88
94
  };
89
95
  }
90
96
  return {
91
- type: 'response',
92
- parts: ( turn.parts.map((part) => revive(part))),
97
+ type: "response",
98
+ parts: ( turn.parts.map(part => revive(part))),
93
99
  participant: turn.participant
94
100
  };
95
101
  })));
@@ -100,26 +106,30 @@ class ObservableChatSession extends Disposable {
100
106
  this._proxy.$disposeChatSessionContent(this._providerHandle, this.sessionResource);
101
107
  this._disposalPending = false;
102
108
  }
103
- this._proxy.$interruptChatSessionActiveResponse(this._providerHandle, this.sessionResource, 'ongoing');
109
+ this._proxy.$interruptChatSessionActiveResponse(this._providerHandle, this.sessionResource, "ongoing");
104
110
  return true;
105
111
  };
106
112
  if (sessionContent.supportsInterruption) {
107
113
  return confirmInterrupt();
108
114
  }
109
115
  return this._dialogService.confirm({
110
- message: ( localize(2498, 'Are you sure you want to interrupt the active session?'))
116
+ message: ( localize(2501, "Are you sure you want to interrupt the active session?"))
111
117
  }).then(confirmed => {
112
118
  if (confirmed.confirmed) {
113
119
  return confirmInterrupt();
114
- }
115
- else {
120
+ } else {
116
121
  this._addProgress([{
117
- kind: 'progressMessage',
118
- content: { value: '', isTrusted: false }
119
- }]);
122
+ kind: "progressMessage",
123
+ content: {
124
+ value: "",
125
+ isTrusted: false
126
+ }
127
+ }]);
120
128
  this._interruptionWasCanceled = true;
121
129
  if (this._disposalPending) {
122
- this._logService.info(`Canceling deferred disposal for session ${this.sessionResource} (user canceled interruption)`);
130
+ this._logService.info(
131
+ `Canceling deferred disposal for session ${this.sessionResource} (user canceled interruption)`
132
+ );
123
133
  this._disposalPending = false;
124
134
  }
125
135
  return false;
@@ -149,17 +159,18 @@ class ObservableChatSession extends Disposable {
149
159
  if (!this._isCompleteObservable.get() && !this.interruptActiveResponseCallback) {
150
160
  this._markComplete();
151
161
  }
152
- }
153
- catch (error) {
162
+ } catch (error) {
154
163
  const errorProgress = {
155
- kind: 'progressMessage',
156
- content: { value: `Error: ${error instanceof Error ? error.message : String(error)}`, isTrusted: false }
164
+ kind: "progressMessage",
165
+ content: {
166
+ value: `Error: ${error instanceof Error ? error.message : String(error)}`,
167
+ isTrusted: false
168
+ }
157
169
  };
158
170
  this._addProgress([errorProgress]);
159
171
  this._markComplete();
160
172
  throw error;
161
- }
162
- finally {
173
+ } finally {
163
174
  progressDisposable.dispose();
164
175
  }
165
176
  };
@@ -169,15 +180,16 @@ class ObservableChatSession extends Disposable {
169
180
  const hasRequestHandler = sessionContent.hasRequestHandler;
170
181
  const hasAnyCapability = hasActiveResponse || hasRequestHandler;
171
182
  for (const [requestId, chunks] of this._pendingProgressChunks) {
172
- this._logService.debug(`Processing ${chunks.length} pending progress chunks for session ${this.sessionResource}, requestId ${requestId}`);
183
+ this._logService.debug(
184
+ `Processing ${chunks.length} pending progress chunks for session ${this.sessionResource}, requestId ${requestId}`
185
+ );
173
186
  this._addProgress(chunks);
174
187
  }
175
188
  this._pendingProgressChunks.clear();
176
189
  if (!hasAnyCapability) {
177
190
  this._isCompleteObservable.set(true, undefined);
178
191
  }
179
- }
180
- catch (error) {
192
+ } catch (error) {
181
193
  this._logService.error(`Failed to initialize chat session ${this.sessionResource}:`, error);
182
194
  throw error;
183
195
  }
@@ -186,7 +198,9 @@ class ObservableChatSession extends Disposable {
186
198
  if (!this._isInitialized) {
187
199
  const existing = this._pendingProgressChunks.get(requestId) || [];
188
200
  this._pendingProgressChunks.set(requestId, [...existing, ...progress]);
189
- this._logService.debug(`Queuing ${progress.length} progress chunks for session ${this.sessionResource}, requestId ${requestId} (session not initialized)`);
201
+ this._logService.debug(
202
+ `Queuing ${progress.length} progress chunks for session ${this.sessionResource}, requestId ${requestId} (session not initialized)`
203
+ );
190
204
  return;
191
205
  }
192
206
  this._addProgress(progress);
@@ -196,8 +210,7 @@ class ObservableChatSession extends Disposable {
196
210
  if (this._isInitialized) {
197
211
  if (!this._interruptionWasCanceled) {
198
212
  this._markComplete();
199
- }
200
- else {
213
+ } else {
201
214
  this._interruptionWasCanceled = false;
202
215
  }
203
216
  }
@@ -217,17 +230,27 @@ class ObservableChatSession extends Disposable {
217
230
  this._pendingProgressChunks.clear();
218
231
  if (this.interruptActiveResponseCallback && !this._interruptionWasCanceled) {
219
232
  this._disposalPending = true;
220
- }
221
- else {
233
+ } else {
222
234
  this._proxy.$disposeChatSessionContent(this._providerHandle, this.sessionResource);
223
235
  }
224
236
  super.dispose();
225
237
  }
226
238
  }
227
239
  let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
228
- constructor(_extHostContext, _chatSessionsService, _chatService, _chatWidgetService, _dialogService, _editorService, editorGroupService, _logService) {
240
+ constructor(
241
+ _extHostContext,
242
+ _agentSessionsService,
243
+ _chatSessionsService,
244
+ _chatService,
245
+ _chatWidgetService,
246
+ _dialogService,
247
+ _editorService,
248
+ editorGroupService,
249
+ _logService
250
+ ) {
229
251
  super();
230
252
  this._extHostContext = _extHostContext;
253
+ this._agentSessionsService = _agentSessionsService;
231
254
  this._chatSessionsService = _chatSessionsService;
232
255
  this._chatService = _chatService;
233
256
  this._chatWidgetService = _chatWidgetService;
@@ -241,12 +264,36 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
241
264
  this._activeSessions = ( new ResourceMap());
242
265
  this._sessionDisposables = ( new ResourceMap());
243
266
  this._proxy = ( this._extHostContext.getProxy(ExtHostContext.ExtHostChatSessions));
244
- this._chatSessionsService.setOptionsChangeCallback(async (sessionResource, updates) => {
267
+ this._register(this._chatSessionsService.onRequestNotifyExtension((
268
+ {
269
+ sessionResource,
270
+ updates,
271
+ waitUntil
272
+ }
273
+ ) => {
245
274
  const handle = this._getHandleForSessionType(sessionResource.scheme);
275
+ this._logService.trace(
276
+ `[MainThreadChatSessions] onRequestNotifyExtension received: scheme '${sessionResource.scheme}', handle ${handle}, ${updates.length} update(s)`
277
+ );
246
278
  if (handle !== undefined) {
247
- await this.notifyOptionsChange(handle, sessionResource, updates);
279
+ waitUntil(this.notifyOptionsChange(handle, sessionResource, updates));
280
+ } else {
281
+ this._logService.warn(
282
+ `[MainThreadChatSessions] Cannot notify option change for scheme '${sessionResource.scheme}': no provider registered. Registered schemes: [${Array.from(( this._sessionTypeToHandle.keys())).join(", ")}]`
283
+ );
248
284
  }
249
- });
285
+ }));
286
+ this._register(
287
+ this._agentSessionsService.model.onDidChangeSessionArchivedState(session => {
288
+ for (const [handle, {
289
+ provider
290
+ }] of this._itemProvidersRegistrations) {
291
+ if (provider.chatSessionType === session.providerType) {
292
+ this._proxy.$onDidChangeChatSessionItemState(handle, session.resource, session.isArchived());
293
+ }
294
+ }
295
+ })
296
+ );
250
297
  }
251
298
  _getHandleForSessionType(chatSessionType) {
252
299
  return this._sessionTypeToHandle.get(chatSessionType);
@@ -257,15 +304,17 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
257
304
  const provider = {
258
305
  chatSessionType,
259
306
  onDidChangeChatSessionItems: Event.debounce(changeEmitter.event, (_, e) => e, 200),
260
- provideChatSessionItems: (token) => this._provideChatSessionItems(handle, token),
307
+ provideChatSessionItems: token => this._provideChatSessionItems(handle, token)
261
308
  };
262
309
  disposables.add(this._chatSessionsService.registerChatSessionItemProvider(provider));
263
310
  this._itemProvidersRegistrations.set(handle, {
264
311
  dispose: () => disposables.dispose(),
265
312
  provider,
266
- onDidChangeItems: changeEmitter,
313
+ onDidChangeItems: changeEmitter
267
314
  });
268
- disposables.add(this._chatSessionsService.registerChatModelChangeListeners(this._chatService, chatSessionType, () => changeEmitter.fire()));
315
+ disposables.add(
316
+ this._chatSessionsService.registerChatModelChangeListeners(this._chatService, chatSessionType, () => changeEmitter.fire())
317
+ );
269
318
  }
270
319
  $onDidChangeChatSessionItems(handle) {
271
320
  this._itemProvidersRegistrations.get(handle)?.onDidChangeItems.fire();
@@ -277,56 +326,63 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
277
326
  async $onDidCommitChatSessionItem(handle, originalComponents, modifiedCompoennts) {
278
327
  const originalResource = URI.revive(originalComponents);
279
328
  const modifiedResource = URI.revive(modifiedCompoennts);
280
- this._logService.trace(`$onDidCommitChatSessionItem: handle(${handle}), original(${originalResource}), modified(${modifiedResource})`);
329
+ this._logService.trace(
330
+ `$onDidCommitChatSessionItem: handle(${handle}), original(${originalResource}), modified(${modifiedResource})`
331
+ );
281
332
  const chatSessionType = this._itemProvidersRegistrations.get(handle)?.provider.chatSessionType;
282
333
  if (!chatSessionType) {
283
334
  this._logService.error(`No chat session type found for provider handle ${handle}`);
284
335
  return;
285
336
  }
286
337
  const originalEditor = this._editorService.editors.find(editor => editor.resource?.toString() === ( originalResource.toString()));
287
- const originalModel = this._chatService.getSession(originalResource);
338
+ const originalModel = this._chatService.getActiveSessionReference(originalResource);
288
339
  const contribution = this._chatSessionsService.getAllChatSessionContributions().find(c => c.type === chatSessionType);
289
- const originalGroup = this.editorGroupService.groups.find(group => ( group.editors.some(editor => isEqual(editor.resource, originalResource))))
290
- ?? this.editorGroupService.activeGroup;
291
- const options = {
292
- title: {
293
- preferred: originalEditor?.getName() || undefined,
294
- fallback: ( localize(2499, "{0}", contribution?.displayName)),
295
- }
296
- };
297
- const newSession = await this._chatSessionsService.getOrCreateChatSession(URI.revive(modifiedResource), CancellationToken.None);
298
- if (originalEditor) {
299
- newSession.transferredState = originalEditor instanceof ChatEditorInput
300
- ? { editingSession: originalEditor.transferOutEditingSession(), inputState: originalModel?.inputModel.toJSON() }
301
- : undefined;
302
- this._editorService.replaceEditors([{
340
+ try {
341
+ const originalGroup = this.editorGroupService.groups.find(group => ( group.editors.some(editor => isEqual(editor.resource, originalResource)))) ?? this.editorGroupService.activeGroup;
342
+ const options = {
343
+ title: {
344
+ preferred: originalEditor?.getName() || undefined,
345
+ fallback: ( localize(2502, "{0}", contribution?.displayName))
346
+ }
347
+ };
348
+ const newSession = await this._chatSessionsService.getOrCreateChatSession(URI.revive(modifiedResource), CancellationToken.None);
349
+ if (originalEditor) {
350
+ newSession.transferredState = originalEditor instanceof ChatEditorInput ? {
351
+ editingSession: originalEditor.transferOutEditingSession(),
352
+ inputState: originalModel?.object.inputModel.toJSON()
353
+ } : undefined;
354
+ await this._editorService.replaceEditors([{
303
355
  editor: originalEditor,
304
356
  replacement: {
305
357
  resource: modifiedResource,
306
- options,
307
- },
358
+ options
359
+ }
308
360
  }], originalGroup);
309
- return;
310
- }
311
- if (originalModel) {
312
- newSession.transferredState = {
313
- editingSession: originalModel.editingSession,
314
- inputState: originalModel.inputModel.toJSON()
315
- };
316
- }
317
- const chatViewWidget = this._chatWidgetService.getWidgetBySessionResource(originalResource);
318
- if (chatViewWidget && isIChatViewViewContext(chatViewWidget.viewContext)) {
319
- await this._chatWidgetService.openSession(modifiedResource, ChatViewPaneTarget, { preserveFocus: true });
320
- }
321
- else {
322
- const ref = await this._chatService.loadSessionForResource(modifiedResource, ChatAgentLocation.Chat, CancellationToken.None);
323
- ref?.dispose();
361
+ return;
362
+ }
363
+ if (originalModel) {
364
+ newSession.transferredState = {
365
+ editingSession: originalModel.object.editingSession,
366
+ inputState: originalModel.object.inputModel.toJSON()
367
+ };
368
+ }
369
+ const chatViewWidget = this._chatWidgetService.getWidgetBySessionResource(originalResource);
370
+ if (chatViewWidget && isIChatViewViewContext(chatViewWidget.viewContext)) {
371
+ await this._chatWidgetService.openSession(modifiedResource, ChatViewPaneTarget, {
372
+ preserveFocus: true
373
+ });
374
+ } else {
375
+ const ref = await this._chatService.loadSessionForResource(modifiedResource, ChatAgentLocation.Chat, CancellationToken.None);
376
+ ref?.dispose();
377
+ }
378
+ } finally {
379
+ originalModel?.dispose();
324
380
  }
325
381
  }
326
382
  async _provideChatSessionItems(handle, token) {
327
383
  try {
328
384
  const sessions = await this._proxy.$provideChatSessionItems(handle, token);
329
- return Promise.all(( sessions.map(async (session) => {
385
+ return Promise.all(( sessions.map(async session => {
330
386
  const uri = URI.revive(session.resource);
331
387
  const model = this._chatService.getSession(uri);
332
388
  if (model) {
@@ -349,11 +405,11 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
349
405
  resource: uri,
350
406
  iconPath: session.iconPath,
351
407
  tooltip: session.tooltip ? this._reviveTooltip(session.tooltip) : undefined,
408
+ archived: session.archived
352
409
  };
353
410
  })));
354
- }
355
- catch (error) {
356
- this._logService.error('Error providing chat sessions:', error);
411
+ } catch (error) {
412
+ this._logService.error("Error providing chat sessions:", error);
357
413
  }
358
414
  return [];
359
415
  }
@@ -408,10 +464,12 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
408
464
  }
409
465
  }
410
466
  return session;
411
- }
412
- catch (error) {
467
+ } catch (error) {
413
468
  session.dispose();
414
- this._logService.error(`Error providing chat session content for handle ${providerHandle} and resource ${( sessionResource.toString())}:`, error);
469
+ this._logService.error(
470
+ `Error providing chat session content for handle ${providerHandle} and resource ${( sessionResource.toString())}:`,
471
+ error
472
+ );
415
473
  throw error;
416
474
  }
417
475
  }
@@ -423,7 +481,10 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
423
481
  provideChatSessionContent: (resource, token) => this._provideChatSessionContent(handle, resource, token)
424
482
  };
425
483
  this._sessionTypeToHandle.set(chatSessionScheme, handle);
426
- this._contentProvidersRegistrations.set(handle, this._chatSessionsService.registerChatSessionContentProvider(chatSessionScheme, provider));
484
+ this._contentProvidersRegistrations.set(
485
+ handle,
486
+ this._chatSessionsService.registerChatSessionContentProvider(chatSessionScheme, provider)
487
+ );
427
488
  this._refreshProviderOptions(handle, chatSessionScheme);
428
489
  }
429
490
  $unregisterChatSessionContentProvider(handle) {
@@ -445,7 +506,9 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
445
506
  const resource = URI.revive(sessionResource);
446
507
  const observableSession = this._activeSessions.get(resource);
447
508
  if (!observableSession) {
448
- this._logService.warn(`No session found for progress chunks: handle ${handle}, sessionResource ${resource}, requestId ${requestId}`);
509
+ this._logService.warn(
510
+ `No session found for progress chunks: handle ${handle}, sessionResource ${resource}, requestId ${requestId}`
511
+ );
449
512
  return;
450
513
  }
451
514
  const chatProgressParts = ( chunks.map(chunk => {
@@ -458,13 +521,14 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
458
521
  const resource = URI.revive(sessionResource);
459
522
  const observableSession = this._activeSessions.get(resource);
460
523
  if (!observableSession) {
461
- this._logService.warn(`No session found for progress completion: handle ${handle}, sessionResource ${resource}, requestId ${requestId}`);
524
+ this._logService.warn(
525
+ `No session found for progress completion: handle ${handle}, sessionResource ${resource}, requestId ${requestId}`
526
+ );
462
527
  return;
463
528
  }
464
529
  observableSession.handleProgressComplete(requestId);
465
530
  }
466
- $handleAnchorResolve(handle, sesssionResource, requestId, requestHandle, anchor) {
467
- }
531
+ $handleAnchorResolve(handle, sesssionResource, requestId, requestHandle, anchor) {}
468
532
  $onDidChangeChatSessionProviderOptions(handle) {
469
533
  let sessionType;
470
534
  for (const [type, h] of this._sessionTypeToHandle) {
@@ -474,7 +538,9 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
474
538
  }
475
539
  }
476
540
  if (!sessionType) {
477
- this._logService.warn(`No session type found for chat session content provider handle ${handle} when refreshing provider options`);
541
+ this._logService.warn(
542
+ `No session type found for chat session content provider handle ${handle} when refreshing provider options`
543
+ );
478
544
  return;
479
545
  }
480
546
  this._refreshProviderOptions(handle, sessionType);
@@ -482,9 +548,15 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
482
548
  _refreshProviderOptions(handle, chatSessionScheme) {
483
549
  this._proxy.$provideChatSessionProviderOptions(handle, CancellationToken.None).then(options => {
484
550
  if (options?.optionGroups && options.optionGroups.length) {
485
- this._chatSessionsService.setOptionGroupsForSessionType(chatSessionScheme, handle, options.optionGroups);
551
+ const groupsWithCallbacks = ( options.optionGroups.map(group => ({
552
+ ...group,
553
+ onSearch: group.searchable ? async (query, token) => {
554
+ return await this._proxy.$invokeOptionGroupSearch(handle, group.id, query, token);
555
+ } : undefined
556
+ })));
557
+ this._chatSessionsService.setOptionGroupsForSessionType(chatSessionScheme, handle, groupsWithCallbacks);
486
558
  }
487
- }).catch(err => this._logService.error('Error fetching chat session options', err));
559
+ }).catch(err => this._logService.error("Error fetching chat session options", err));
488
560
  }
489
561
  dispose() {
490
562
  for (const session of ( this._activeSessions.values())) {
@@ -501,32 +573,31 @@ let MainThreadChatSessions = class MainThreadChatSessions extends Disposable {
501
573
  if (!tooltip) {
502
574
  return undefined;
503
575
  }
504
- if (typeof tooltip === 'string') {
576
+ if (typeof tooltip === "string") {
505
577
  return tooltip;
506
578
  }
507
- if (typeof tooltip === 'object' && 'value' in tooltip) {
579
+ if (typeof tooltip === "object" && "value" in tooltip) {
508
580
  return MarkdownString.lift(tooltip);
509
581
  }
510
582
  return undefined;
511
583
  }
512
584
  async notifyOptionsChange(handle, sessionResource, updates) {
585
+ this._logService.trace(
586
+ `[MainThreadChatSessions] notifyOptionsChange: starting proxy call for handle ${handle}, sessionResource ${sessionResource}`
587
+ );
513
588
  try {
514
589
  await this._proxy.$provideHandleOptionsChange(handle, sessionResource, updates, CancellationToken.None);
515
- }
516
- catch (error) {
517
- this._logService.error(`Error notifying extension about options change for handle ${handle}, sessionResource ${sessionResource}:`, error);
590
+ this._logService.trace(
591
+ `[MainThreadChatSessions] notifyOptionsChange: proxy call completed for handle ${handle}, sessionResource ${sessionResource}`
592
+ );
593
+ } catch (error) {
594
+ this._logService.error(
595
+ `[MainThreadChatSessions] notifyOptionsChange: error for handle ${handle}, sessionResource ${sessionResource}:`,
596
+ error
597
+ );
518
598
  }
519
599
  }
520
600
  };
521
- MainThreadChatSessions = __decorate([
522
- extHostNamedCustomer(MainContext.MainThreadChatSessions),
523
- ( __param(1, IChatSessionsService)),
524
- ( __param(2, IChatService)),
525
- ( __param(3, IChatWidgetService)),
526
- ( __param(4, IDialogService)),
527
- ( __param(5, IEditorService)),
528
- ( __param(6, IEditorGroupsService)),
529
- ( __param(7, ILogService))
530
- ], MainThreadChatSessions);
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);
531
602
 
532
603
  export { MainThreadChatSessions, ObservableChatSession };
@@ -15,16 +15,13 @@ let MainThreadChatStatus = class MainThreadChatStatus extends Disposable {
15
15
  id,
16
16
  label: entry.title,
17
17
  description: entry.description,
18
- detail: entry.detail,
18
+ detail: entry.detail
19
19
  });
20
20
  }
21
21
  $disposeEntry(id) {
22
22
  this._chatStatusItemService.deleteEntry(id);
23
23
  }
24
24
  };
25
- MainThreadChatStatus = __decorate([
26
- extHostNamedCustomer(MainContext.MainThreadChatStatus),
27
- ( __param(1, IChatStatusItemService))
28
- ], MainThreadChatStatus);
25
+ MainThreadChatStatus = __decorate([extHostNamedCustomer(MainContext.MainThreadChatStatus), ( __param(1, IChatStatusItemService))], MainThreadChatStatus);
29
26
 
30
27
  export { MainThreadChatStatus };