@codingame/monaco-vscode-extensions-service-override 2.2.1 → 3.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 (22) hide show
  1. package/extensions.js +1 -82
  2. package/package.json +9 -9
  3. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +497 -0
  4. package/vscode/src/vs/workbench/api/browser/extensionHost.contribution.js +104 -0
  5. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +103 -0
  6. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -7
  7. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +23 -8
  8. package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +147 -10
  9. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +11 -2
  10. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +9 -6
  11. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +17 -3
  12. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +4 -1
  13. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +2 -2
  14. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +18 -0
  15. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +19 -3
  16. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +2 -2
  17. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +2 -2
  18. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +25 -20
  19. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +6 -8
  20. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +2 -10
  21. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +40 -0
  22. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +10 -10
@@ -0,0 +1,104 @@
1
+ import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
3
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
4
+ import { JSONValidationExtensionPoint } from 'vscode/vscode/vs/workbench/api/common/jsonValidationExtensionPoint';
5
+ import { ColorExtensionPoint } from 'vscode/vscode/vs/workbench/services/themes/common/colorExtensionPoint';
6
+ import { IconExtensionPoint } from 'vscode/vscode/vs/workbench/services/themes/common/iconExtensionPoint';
7
+ import { TokenClassificationExtensionPoints } from 'vscode/vscode/vs/workbench/services/themes/common/tokenClassificationExtensionPoint';
8
+ import { LanguageConfigurationFileHandler } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint';
9
+ import { StatusBarItemsExtensionPoint } from 'vscode/vscode/vs/workbench/api/browser/statusBarExtensionPoint';
10
+ import './mainThreadLocalization.js';
11
+ import './mainThreadBulkEdits.js';
12
+ import './mainThreadChatProvider.js';
13
+ import './mainThreadChatAgents2.js';
14
+ import './mainThreadChatVariables.js';
15
+ import './mainThreadCodeInsets.js';
16
+ import './mainThreadCLICommands.js';
17
+ import './mainThreadClipboard.js';
18
+ import './mainThreadCommands.js';
19
+ import './mainThreadConfiguration.js';
20
+ import './mainThreadConsole.js';
21
+ import './mainThreadDebugService.js';
22
+ import './mainThreadDecorations.js';
23
+ import './mainThreadDiagnostics.js';
24
+ import './mainThreadDialogs.js';
25
+ import './mainThreadDocumentContentProviders.js';
26
+ import './mainThreadDocuments.js';
27
+ import './mainThreadDocumentsAndEditors.js';
28
+ import 'vscode/vscode/vs/editor/common/config/editorOptions';
29
+ import 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetController2';
30
+ import 'vscode/vscode/vs/editor/contrib/editorState/browser/keybindingCancellation';
31
+ import 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetParser';
32
+ import './mainThreadEditors.js';
33
+ import './mainThreadEditorTabs.js';
34
+ import './mainThreadErrors.js';
35
+ import './mainThreadExtensionService.js';
36
+ import './mainThreadFileSystem.js';
37
+ import './mainThreadFileSystemEventService.js';
38
+ import './mainThreadLanguageFeatures.js';
39
+ import './mainThreadLanguages.js';
40
+ import './mainThreadLogService.js';
41
+ import './mainThreadMessageService.js';
42
+ import './mainThreadManagedSockets.js';
43
+ import './mainThreadOutputService.js';
44
+ import './mainThreadProgress.js';
45
+ import './mainThreadQuickDiff.js';
46
+ import './mainThreadQuickOpen.js';
47
+ import './mainThreadRemoteConnectionData.js';
48
+ import './mainThreadSaveParticipant.js';
49
+ import './mainThreadSpeech.js';
50
+ import './mainThreadEditSessionIdentityParticipant.js';
51
+ import './mainThreadSCM.js';
52
+ import './mainThreadSearch.js';
53
+ import './mainThreadStatusBar.js';
54
+ import './mainThreadStorage.js';
55
+ import './mainThreadTelemetry.js';
56
+ import './mainThreadTerminalService.js';
57
+ import './mainThreadTheming.js';
58
+ import './mainThreadTreeViews.js';
59
+ import './mainThreadDownloadService.js';
60
+ import './mainThreadUrls.js';
61
+ import './mainThreadUriOpeners.js';
62
+ import './mainThreadWindow.js';
63
+ import './mainThreadWebviewManager.js';
64
+ import './mainThreadWorkspace.js';
65
+ import './mainThreadComments.js';
66
+ import './mainThreadNotebook.js';
67
+ import './mainThreadNotebookKernels.js';
68
+ import './mainThreadNotebookDocumentsAndEditors.js';
69
+ import './mainThreadNotebookRenderers.js';
70
+ import './mainThreadNotebookSaveParticipant.js';
71
+ import './mainThreadInteractive.js';
72
+ import './mainThreadInlineChat.js';
73
+ import './mainThreadChat.js';
74
+ import './mainThreadTask.js';
75
+ import './mainThreadLabelService.js';
76
+ import './mainThreadTunnelService.js';
77
+ import './mainThreadAuthentication.js';
78
+ import './mainThreadTimeline.js';
79
+ import './mainThreadTesting.js';
80
+ import './mainThreadSecretState.js';
81
+ import './mainThreadShare.js';
82
+ import './mainThreadProfilContentHandlers.js';
83
+ import './mainThreadAiRelatedInformation.js';
84
+ import './mainThreadAiEmbeddingVector.js';
85
+ import './mainThreadIssueReporter.js';
86
+
87
+ let ExtensionPoints = class ExtensionPoints {
88
+ static { this.ID = 'workbench.contrib.extensionPoints'; }
89
+ constructor(instantiationService) {
90
+ this.instantiationService = instantiationService;
91
+ this.instantiationService.createInstance(JSONValidationExtensionPoint);
92
+ this.instantiationService.createInstance(ColorExtensionPoint);
93
+ this.instantiationService.createInstance(IconExtensionPoint);
94
+ this.instantiationService.createInstance(TokenClassificationExtensionPoints);
95
+ this.instantiationService.createInstance(LanguageConfigurationFileHandler);
96
+ this.instantiationService.createInstance(StatusBarItemsExtensionPoint);
97
+ }
98
+ };
99
+ ExtensionPoints = ( __decorate([
100
+ ( __param(0, IInstantiationService))
101
+ ], ExtensionPoints));
102
+ registerWorkbenchContribution2(ExtensionPoints.ID, ExtensionPoints, 1 );
103
+
104
+ export { ExtensionPoints };
@@ -0,0 +1,103 @@
1
+ import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { Schemas } from 'vscode/vscode/vs/base/common/network';
3
+ import { isWeb } from 'vscode/vscode/vs/base/common/platform';
4
+ import { isString } from 'vscode/vscode/vs/base/common/types';
5
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
6
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
7
+ import { CommandsRegistry, ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
8
+ import { IExtensionManagementService, IExtensionGalleryService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
9
+ import { ExtensionManagementCLI } from '../../../platform/extensionManagement/common/extensionManagementCLI.js';
10
+ import { getExtensionId } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
11
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
12
+ import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
13
+ import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
14
+ import { AbstractMessageLogger } from 'vscode/vscode/vs/platform/log/common/log';
15
+ import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
16
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
17
+ import { IExtensionManagementServerService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
18
+ import { IExtensionManifestPropertiesService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService';
19
+
20
+ CommandsRegistry.registerCommand('_remoteCLI.openExternal', function (accessor, uri) {
21
+ const openerService = accessor.get(IOpenerService);
22
+ return openerService.open(isString(uri) ? uri : URI.revive(uri), { openExternal: true, allowTunneling: true });
23
+ });
24
+ CommandsRegistry.registerCommand('_remoteCLI.windowOpen', function (accessor, toOpen, options) {
25
+ const commandService = accessor.get(ICommandService);
26
+ if (!toOpen.length) {
27
+ return commandService.executeCommand('_files.newWindow', options);
28
+ }
29
+ return commandService.executeCommand('_files.windowOpen', toOpen, options);
30
+ });
31
+ CommandsRegistry.registerCommand('_remoteCLI.getSystemStatus', function (accessor) {
32
+ const commandService = accessor.get(ICommandService);
33
+ return commandService.executeCommand('_issues.getSystemStatus');
34
+ });
35
+ CommandsRegistry.registerCommand('_remoteCLI.manageExtensions', async function (accessor, args) {
36
+ const instantiationService = accessor.get(IInstantiationService);
37
+ const extensionManagementServerService = accessor.get(IExtensionManagementServerService);
38
+ const remoteExtensionManagementService = extensionManagementServerService.remoteExtensionManagementServer?.extensionManagementService;
39
+ if (!remoteExtensionManagementService) {
40
+ return;
41
+ }
42
+ const lines = [];
43
+ const logger = new (class extends AbstractMessageLogger {
44
+ log(level, message) {
45
+ lines.push(message);
46
+ }
47
+ })();
48
+ const cliService = instantiationService.createChild(( new ServiceCollection([IExtensionManagementService, remoteExtensionManagementService]))).createInstance(RemoteExtensionManagementCLI, logger);
49
+ if (args.list) {
50
+ await cliService.listExtensions(!!args.list.showVersions, args.list.category, undefined);
51
+ }
52
+ else {
53
+ const revive = (inputs) => ( inputs.map(input => isString(input) ? input : URI.revive(input)));
54
+ if (Array.isArray(args.install) && args.install.length) {
55
+ try {
56
+ await cliService.installExtensions(revive(args.install), [], { isMachineScoped: true }, !!args.force);
57
+ }
58
+ catch (e) {
59
+ lines.push(e.message);
60
+ }
61
+ }
62
+ if (Array.isArray(args.uninstall) && args.uninstall.length) {
63
+ try {
64
+ await cliService.uninstallExtensions(revive(args.uninstall), !!args.force, undefined);
65
+ }
66
+ catch (e) {
67
+ lines.push(e.message);
68
+ }
69
+ }
70
+ }
71
+ return lines.join('\n');
72
+ });
73
+ let RemoteExtensionManagementCLI = class RemoteExtensionManagementCLI extends ExtensionManagementCLI {
74
+ constructor(logger, extensionManagementService, extensionGalleryService, labelService, envService, _extensionManifestPropertiesService) {
75
+ super(logger, extensionManagementService, extensionGalleryService);
76
+ this._extensionManifestPropertiesService = _extensionManifestPropertiesService;
77
+ const remoteAuthority = envService.remoteAuthority;
78
+ this._location = remoteAuthority ? labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority) : undefined;
79
+ }
80
+ get location() {
81
+ return this._location;
82
+ }
83
+ validateExtensionKind(manifest) {
84
+ if (!this._extensionManifestPropertiesService.canExecuteOnWorkspace(manifest)
85
+ && !(isWeb && this._extensionManifestPropertiesService.canExecuteOnWeb(manifest))) {
86
+ this.logger.info(( localizeWithPath(
87
+ 'vs/workbench/api/browser/mainThreadCLICommands',
88
+ 'cannot be installed',
89
+ "Cannot install the '{0}' extension because it is declared to not run in this setup.",
90
+ getExtensionId(manifest.publisher, manifest.name)
91
+ )));
92
+ return false;
93
+ }
94
+ return true;
95
+ }
96
+ };
97
+ RemoteExtensionManagementCLI = ( __decorate([
98
+ ( __param(1, IExtensionManagementService)),
99
+ ( __param(2, IExtensionGalleryService)),
100
+ ( __param(3, ILabelService)),
101
+ ( __param(4, IWorkbenchEnvironmentService)),
102
+ ( __param(5, IExtensionManifestPropertiesService))
103
+ ], RemoteExtensionManagementCLI));
@@ -34,7 +34,6 @@ let MainThreadChat = class MainThreadChat extends Disposable {
34
34
  }
35
35
  const unreg = this._chatService.registerProvider({
36
36
  id,
37
- displayName: registration.label,
38
37
  prepareSession: async (token) => {
39
38
  const session = await this._proxy.$prepareChat(handle, token);
40
39
  if (!session) {
@@ -58,12 +57,6 @@ let MainThreadChat = class MainThreadChat extends Disposable {
58
57
  }
59
58
  };
60
59
  },
61
- provideWelcomeMessage: (token) => {
62
- return this._proxy.$provideWelcomeMessage(handle, token);
63
- },
64
- provideSampleQuestions: (token) => {
65
- return this._proxy.$provideSampleQuestions(handle, token);
66
- },
67
60
  });
68
61
  this._providerRegistrations.set(handle, unreg);
69
62
  }
@@ -36,10 +36,10 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
36
36
  for (const [handle, agent] of this._agents) {
37
37
  if (agent.name === e.agentId) {
38
38
  if (e.action.kind === 'vote') {
39
- this._proxy.$acceptFeedback(handle, e.sessionId, e.requestId, e.action.direction);
39
+ this._proxy.$acceptFeedback(handle, e.result ?? {}, e.action.direction);
40
40
  }
41
41
  else {
42
- this._proxy.$acceptAction(handle, e.sessionId, e.requestId, e);
42
+ this._proxy.$acceptAction(handle, e.result || {}, e);
43
43
  }
44
44
  break;
45
45
  }
@@ -50,9 +50,11 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
50
50
  $unregisterAgent(handle) {
51
51
  this._agents.deleteAndDispose(handle);
52
52
  }
53
- $registerAgent(handle, name, metadata) {
53
+ $registerAgent(handle, extension, name, metadata) {
54
+ const lastSlashCommands = ( new WeakMap());
54
55
  const d = this._chatAgentService.registerAgent({
55
56
  id: name,
57
+ extensionId: extension,
56
58
  metadata: revive(metadata),
57
59
  invoke: async (request, progress, history, token) => {
58
60
  this._pendingProgress.set(request.requestId, progress);
@@ -63,17 +65,30 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
63
65
  this._pendingProgress.delete(request.requestId);
64
66
  }
65
67
  },
66
- provideFollowups: async (sessionId, token) => {
68
+ provideFollowups: async (request, result, token) => {
67
69
  if (!this._agents.get(handle)?.hasFollowups) {
68
70
  return [];
69
71
  }
70
- return this._proxy.$provideFollowups(handle, sessionId, token);
72
+ return this._proxy.$provideFollowups(request, handle, result, token);
71
73
  },
72
- provideSlashCommands: async (token) => {
74
+ getLastSlashCommands: (model) => {
75
+ return lastSlashCommands.get(model);
76
+ },
77
+ provideSlashCommands: async (model, history, token) => {
73
78
  if (!this._agents.get(handle)?.hasSlashCommands) {
74
79
  return [];
75
80
  }
76
- return this._proxy.$provideSlashCommands(handle, token);
81
+ const commands = await this._proxy.$provideSlashCommands(handle, { history }, token);
82
+ if (model) {
83
+ lastSlashCommands.set(model, commands);
84
+ }
85
+ return commands;
86
+ },
87
+ provideWelcomeMessage: (token) => {
88
+ return this._proxy.$provideWelcomeMessage(handle, token);
89
+ },
90
+ provideSampleQuestions: (token) => {
91
+ return this._proxy.$provideSampleQuestions(handle, token);
77
92
  }
78
93
  });
79
94
  this._agents.set(handle, {
@@ -111,7 +126,7 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
111
126
  if (query && !( triggerCharacters.some(c => query.startsWith(c)))) {
112
127
  return;
113
128
  }
114
- const parsedRequest = (await this._instantiationService.createInstance(ChatRequestParser).parseChatRequest(widget.viewModel.sessionId, model.getValue())).parts;
129
+ const parsedRequest = this._instantiationService.createInstance(ChatRequestParser).parseChatRequest(widget.viewModel.sessionId, model.getValue()).parts;
115
130
  const agentPart = parsedRequest.find((part) => part instanceof ChatRequestAgentPart);
116
131
  const thisAgentName = this._agents.get(handle)?.name;
117
132
  if (agentPart?.agent.id !== thisAgentName) {
@@ -1,37 +1,66 @@
1
1
  import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
2
+ import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
3
+ import { DisposableStore, DisposableMap, Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
5
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
4
6
  import { Progress } from 'vscode/vscode/vs/platform/progress/common/progress';
7
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
5
8
  import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
6
9
  import { IChatProviderService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatProvider';
10
+ import { IAuthenticationService, INTERNAL_AUTH_PROVIDER_PREFIX } from 'vscode/vscode/vs/workbench/services/authentication/common/authentication';
11
+ import { IExtensionFeaturesManagementService, Extensions } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures';
7
12
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
13
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
8
14
 
9
15
  let MainThreadChatProvider = class MainThreadChatProvider {
10
- constructor(extHostContext, _chatProviderService, _logService) {
16
+ constructor(extHostContext, _chatProviderService, _extensionFeaturesManagementService, _logService, _authenticationService, _extensionService) {
11
17
  this._chatProviderService = _chatProviderService;
18
+ this._extensionFeaturesManagementService = _extensionFeaturesManagementService;
12
19
  this._logService = _logService;
20
+ this._authenticationService = _authenticationService;
21
+ this._extensionService = _extensionService;
22
+ this._store = ( new DisposableStore());
13
23
  this._providerRegistrations = ( new DisposableMap());
14
24
  this._pendingProgress = ( new Map());
15
25
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChatProvider));
26
+ this._proxy.$updateLanguageModels({ added: _chatProviderService.getProviders() });
27
+ this._store.add(_chatProviderService.onDidChangeProviders(this._proxy.$updateLanguageModels, this._proxy));
16
28
  }
17
29
  dispose() {
18
30
  this._providerRegistrations.dispose();
31
+ this._store.dispose();
19
32
  }
20
33
  $registerProvider(handle, identifier, metadata) {
21
- const registration = this._chatProviderService.registerChatResponseProvider(identifier, {
34
+ const dipsosables = ( new DisposableStore());
35
+ dipsosables.add(this._chatProviderService.registerChatResponseProvider(identifier, {
22
36
  metadata,
23
- provideChatResponse: async (messages, options, progress, token) => {
37
+ provideChatResponse: async (messages, from, options, progress, token) => {
24
38
  const requestId = (Math.random() * 1e6) | 0;
25
39
  this._pendingProgress.set(requestId, progress);
26
40
  try {
27
- await this._proxy.$provideChatResponse(handle, requestId, messages, options, token);
41
+ await this._proxy.$provideLanguageModelResponse(handle, requestId, from, messages, options, token);
28
42
  }
29
43
  finally {
30
44
  this._pendingProgress.delete(requestId);
31
45
  }
32
46
  }
33
- });
34
- this._providerRegistrations.set(handle, registration);
47
+ }));
48
+ if (metadata.auth) {
49
+ dipsosables.add(this._registerAuthenticationProvider(metadata.extension, metadata.auth));
50
+ }
51
+ dipsosables.add(( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
52
+ id: `lm-${identifier}`,
53
+ label: ( localizeWithPath(
54
+ 'vs/workbench/api/browser/mainThreadChatProvider',
55
+ 'languageModels',
56
+ "Language Model ({0})",
57
+ `${identifier}`
58
+ )),
59
+ access: {
60
+ canToggle: false,
61
+ },
62
+ }));
63
+ this._providerRegistrations.set(handle, dipsosables);
35
64
  }
36
65
  async $handleProgressChunk(requestId, chunk) {
37
66
  this._pendingProgress.get(requestId)?.report(chunk);
@@ -39,26 +68,134 @@ let MainThreadChatProvider = class MainThreadChatProvider {
39
68
  $unregisterProvider(handle) {
40
69
  this._providerRegistrations.deleteAndDispose(handle);
41
70
  }
42
- async $prepareChatAccess(providerId) {
71
+ async $prepareChatAccess(extension, providerId, justification) {
72
+ const activate = this._extensionService.activateByEvent(`onLanguageModelAccess:${providerId}`);
73
+ const metadata = this._chatProviderService.lookupChatResponseProvider(providerId);
74
+ if (metadata) {
75
+ return metadata;
76
+ }
77
+ await Promise.race([
78
+ activate,
79
+ Event.toPromise(Event.filter(this._chatProviderService.onDidChangeProviders, e => Boolean(e.added?.includes(providerId))))
80
+ ]);
43
81
  return this._chatProviderService.lookupChatResponseProvider(providerId);
44
82
  }
45
83
  async $fetchResponse(extension, providerId, requestId, messages, options, token) {
84
+ await this._extensionFeaturesManagementService.getAccess(extension, `lm-${providerId}`);
46
85
  this._logService.debug('[CHAT] extension request STARTED', extension.value, requestId);
47
- const task = this._chatProviderService.fetchChatResponse(providerId, messages, options, ( new Progress(value => {
86
+ const task = this._chatProviderService.fetchChatResponse(providerId, extension, messages, options, ( new Progress(value => {
48
87
  this._proxy.$handleResponseFragment(requestId, value);
49
88
  })), token);
50
89
  task.catch(err => {
51
90
  this._logService.error('[CHAT] extension request ERRORED', err, extension.value, requestId);
91
+ throw err;
52
92
  }).finally(() => {
53
93
  this._logService.debug('[CHAT] extension request DONE', extension.value, requestId);
54
94
  });
55
95
  return task;
56
96
  }
97
+ _registerAuthenticationProvider(extension, auth) {
98
+ const authProviderId = INTERNAL_AUTH_PROVIDER_PREFIX + extension.value;
99
+ if (this._authenticationService.getProviderIds().includes(authProviderId)) {
100
+ return Disposable.None;
101
+ }
102
+ const accountLabel = auth.accountLabel ?? ( localizeWithPath(
103
+ 'vs/workbench/api/browser/mainThreadChatProvider',
104
+ 'languageModelsAccountId',
105
+ 'Language Models'
106
+ ));
107
+ const disposables = ( new DisposableStore());
108
+ this._authenticationService.registerAuthenticationProvider(authProviderId, ( new LanguageModelAccessAuthProvider(authProviderId, auth.providerLabel, accountLabel)));
109
+ disposables.add(toDisposable(() => {
110
+ this._authenticationService.unregisterAuthenticationProvider(authProviderId);
111
+ }));
112
+ disposables.add(this._authenticationService.onDidChangeSessions(async (e) => {
113
+ if (e.providerId === authProviderId) {
114
+ if (e.event.removed?.length) {
115
+ const allowedExtensions = this._authenticationService.readAllowedExtensions(authProviderId, accountLabel);
116
+ const extensionsToUpdateAccess = [];
117
+ for (const allowed of allowedExtensions) {
118
+ const from = await this._extensionService.getExtension(allowed.id);
119
+ this._authenticationService.updateAllowedExtension(authProviderId, authProviderId, allowed.id, allowed.name, false);
120
+ if (from) {
121
+ extensionsToUpdateAccess.push({
122
+ from: from.identifier,
123
+ to: extension,
124
+ enabled: false
125
+ });
126
+ }
127
+ }
128
+ this._proxy.$updateModelAccesslist(extensionsToUpdateAccess);
129
+ }
130
+ }
131
+ }));
132
+ disposables.add(this._authenticationService.onDidChangeExtensionSessionAccess(async (e) => {
133
+ const allowedExtensions = this._authenticationService.readAllowedExtensions(authProviderId, accountLabel);
134
+ const accessList = [];
135
+ for (const allowedExtension of allowedExtensions) {
136
+ const from = await this._extensionService.getExtension(allowedExtension.id);
137
+ if (from) {
138
+ accessList.push({
139
+ from: from.identifier,
140
+ to: extension,
141
+ enabled: allowedExtension.allowed ?? true
142
+ });
143
+ }
144
+ }
145
+ this._proxy.$updateModelAccesslist(accessList);
146
+ }));
147
+ return disposables;
148
+ }
57
149
  };
58
150
  MainThreadChatProvider = __decorate([
59
151
  extHostNamedCustomer(MainContext.MainThreadChatProvider),
60
152
  ( __param(1, IChatProviderService)),
61
- ( __param(2, ILogService))
153
+ ( __param(2, IExtensionFeaturesManagementService)),
154
+ ( __param(3, ILogService)),
155
+ ( __param(4, IAuthenticationService)),
156
+ ( __param(5, IExtensionService))
62
157
  ], MainThreadChatProvider);
158
+ class LanguageModelAccessAuthProvider {
159
+ constructor(id, label, _accountLabel) {
160
+ this.id = id;
161
+ this.label = label;
162
+ this._accountLabel = _accountLabel;
163
+ this.supportsMultipleAccounts = false;
164
+ this._onDidChangeSessions = ( new Emitter());
165
+ this.onDidChangeSessions = this._onDidChangeSessions.event;
166
+ }
167
+ async getSessions(scopes) {
168
+ if (scopes === undefined && !this._session) {
169
+ return [];
170
+ }
171
+ if (this._session) {
172
+ return [this._session];
173
+ }
174
+ return [await this.createSession(scopes || [], {})];
175
+ }
176
+ async createSession(scopes, options) {
177
+ this._session = this._createFakeSession(scopes);
178
+ this._onDidChangeSessions.fire({ added: [this._session], changed: [], removed: [] });
179
+ return this._session;
180
+ }
181
+ removeSession(sessionId) {
182
+ if (this._session) {
183
+ this._onDidChangeSessions.fire({ added: [], changed: [], removed: [this._session] });
184
+ this._session = undefined;
185
+ }
186
+ return Promise.resolve();
187
+ }
188
+ _createFakeSession(scopes) {
189
+ return {
190
+ id: 'fake-session',
191
+ account: {
192
+ id: this.id,
193
+ label: this._accountLabel,
194
+ },
195
+ accessToken: 'fake-access-token',
196
+ scopes,
197
+ };
198
+ }
199
+ }
63
200
 
64
201
  export { MainThreadChatProvider };
@@ -9,17 +9,26 @@ let MainThreadChatVariables = class MainThreadChatVariables {
9
9
  constructor(extHostContext, _chatVariablesService) {
10
10
  this._chatVariablesService = _chatVariablesService;
11
11
  this._variables = ( new DisposableMap());
12
+ this._pendingProgress = ( new Map());
12
13
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChatVariables));
13
14
  }
14
15
  dispose() {
15
16
  this._variables.clearAndDisposeAll();
16
17
  }
17
18
  $registerVariable(handle, data) {
18
- const registration = this._chatVariablesService.registerVariable(data, async (messageText, _arg, _model, token) => {
19
- return revive(await this._proxy.$resolveVariable(handle, messageText, token));
19
+ const registration = this._chatVariablesService.registerVariable(data, async (messageText, _arg, model, progress, token) => {
20
+ const varRequestId = `${model.sessionId}-${handle}`;
21
+ this._pendingProgress.set(varRequestId, progress);
22
+ const result = revive(await this._proxy.$resolveVariable(handle, varRequestId, messageText, token));
23
+ this._pendingProgress.delete(varRequestId);
24
+ return result;
20
25
  });
21
26
  this._variables.set(handle, registration);
22
27
  }
28
+ async $handleProgressChunk(requestId, progress) {
29
+ const revivedProgress = revive(progress);
30
+ this._pendingProgress.get(requestId)?.(revivedProgress);
31
+ }
23
32
  $unregisterVariable(handle) {
24
33
  this._variables.deleteAndDispose(handle);
25
34
  }
@@ -205,6 +205,9 @@ class MainThreadCommentController {
205
205
  this._features = _features;
206
206
  this._threads = ( new Map());
207
207
  }
208
+ async setActiveCommentAndThread(commentInfo) {
209
+ return this._proxy.$setActiveComment(this._handle, commentInfo ? { commentThreadHandle: commentInfo.thread.commentThreadHandle, uniqueIdInThread: commentInfo.comment?.uniqueIdInThread } : undefined);
210
+ }
208
211
  updateFeatures(features) {
209
212
  this._features = features;
210
213
  }
@@ -278,7 +281,7 @@ class MainThreadCommentController {
278
281
  });
279
282
  }
280
283
  updateInput(input) {
281
- const thread = this.activeCommentThread;
284
+ const thread = this.activeEditingCommentThread;
282
285
  if (thread && thread.input) {
283
286
  const commentInput = thread.input;
284
287
  commentInput.value = input;
@@ -384,19 +387,19 @@ let MainThreadComments = class MainThreadComments extends Disposable {
384
387
  this._viewDescriptorService = _viewDescriptorService;
385
388
  this._handlers = ( new Map());
386
389
  this._commentControllers = ( new Map());
387
- this._activeCommentThreadDisposables = this._register(( new DisposableStore()));
390
+ this._activeEditingCommentThreadDisposables = this._register(( new DisposableStore()));
388
391
  this._openViewListener = null;
389
392
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostComments));
390
393
  this._commentService.unregisterCommentController();
391
- this._register(this._commentService.onDidChangeActiveCommentThread(async (thread) => {
394
+ this._register(this._commentService.onDidChangeActiveEditingCommentThread(async (thread) => {
392
395
  const handle = thread.controllerHandle;
393
396
  const controller = this._commentControllers.get(handle);
394
397
  if (!controller) {
395
398
  return;
396
399
  }
397
- this._activeCommentThreadDisposables.clear();
398
- this._activeCommentThread = thread;
399
- controller.activeCommentThread = this._activeCommentThread;
400
+ this._activeEditingCommentThreadDisposables.clear();
401
+ this._activeEditingCommentThread = thread;
402
+ controller.activeEditingCommentThread = this._activeEditingCommentThread;
400
403
  }));
401
404
  }
402
405
  $registerCommentController(handle, id, label, extensionId) {
@@ -18,6 +18,7 @@ let MainThreadDebugService = class MainThreadDebugService {
18
18
  this._toDispose = ( new DisposableStore());
19
19
  this._debugAdaptersHandleCounter = 1;
20
20
  this._visualizerHandles = ( new Map());
21
+ this._visualizerTreeHandles = ( new Map());
21
22
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostDebugService));
22
23
  const sessionListeners = ( new DisposableMap());
23
24
  this._toDispose.add(sessionListeners);
@@ -83,6 +84,18 @@ let MainThreadDebugService = class MainThreadDebugService {
83
84
  }));
84
85
  this.sendBreakpointsAndListen();
85
86
  }
87
+ $registerDebugVisualizerTree(treeId, canEdit) {
88
+ this.visualizerService.registerTree(treeId, {
89
+ disposeItem: id => this._proxy.$disposeVisualizedTree(id),
90
+ getChildren: e => this._proxy.$getVisualizerTreeItemChildren(treeId, e),
91
+ getTreeItem: e => this._proxy.$getVisualizerTreeItem(treeId, e),
92
+ editItem: canEdit ? ((e, v) => this._proxy.$editVisualizerTreeItem(e, v)) : undefined
93
+ });
94
+ }
95
+ $unregisterDebugVisualizerTree(treeId) {
96
+ this._visualizerTreeHandles.get(treeId)?.dispose();
97
+ this._visualizerTreeHandles.delete(treeId);
98
+ }
86
99
  $registerDebugVisualizer(extensionId, id) {
87
100
  const handle = this.visualizerService.register({
88
101
  extensionId: ( new ExtensionIdentifier(extensionId)),
@@ -154,15 +167,16 @@ let MainThreadDebugService = class MainThreadDebugService {
154
167
  column: l.character > 0 ? l.character + 1 : undefined,
155
168
  condition: l.condition,
156
169
  hitCondition: l.hitCondition,
157
- logMessage: l.logMessage
170
+ logMessage: l.logMessage,
171
+ mode: l.mode,
158
172
  })));
159
173
  this.debugService.addBreakpoints(URI.revive(dto.uri), rawbps);
160
174
  }
161
175
  else if (dto.type === 'function') {
162
- this.debugService.addFunctionBreakpoint(dto.functionName, dto.id);
176
+ this.debugService.addFunctionBreakpoint(dto.functionName, dto.id, dto.mode);
163
177
  }
164
178
  else if (dto.type === 'data') {
165
- this.debugService.addDataBreakpoint(dto.label, dto.dataId, dto.canPersist, dto.accessTypes, dto.accessType);
179
+ this.debugService.addDataBreakpoint(dto.label, dto.dataId, dto.canPersist, dto.accessTypes, dto.accessType, dto.mode);
166
180
  }
167
181
  }
168
182
  return Promise.resolve();
@@ -42,7 +42,7 @@ class MainThreadTextEditorProperties {
42
42
  let lineNumbers;
43
43
  if (codeEditor) {
44
44
  const options = codeEditor.getOptions();
45
- const lineNumbersOpts = options.get(67 );
45
+ const lineNumbersOpts = options.get(68 );
46
46
  cursorStyle = options.get(28 );
47
47
  lineNumbers = lineNumbersOpts.renderType;
48
48
  }
@@ -290,6 +290,9 @@ class MainThreadTextEditor {
290
290
  case 2 :
291
291
  lineNumbers = 'relative';
292
292
  break;
293
+ case 3 :
294
+ lineNumbers = 'interval';
295
+ break;
293
296
  default:
294
297
  lineNumbers = 'off';
295
298
  }