@codingame/monaco-vscode-extensions-service-override 6.0.3 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions.js +1 -7
- package/package.json +3 -3
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +17 -19
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +2 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +0 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +28 -6
- package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +1 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +2 -6
- package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +3 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +16 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +38 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +58 -19
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +83 -32
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +1 -1
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +0 -11
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +103 -51
- package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +54 -16
package/extensions.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
3
3
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
4
|
-
import { toExtensionDescription } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
5
4
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
6
5
|
import { ILogService, ILoggerService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
7
6
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
@@ -45,6 +44,7 @@ import './vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js';
|
|
|
45
44
|
import './vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js';
|
|
46
45
|
import './vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js';
|
|
47
46
|
import './vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js';
|
|
47
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js';
|
|
48
48
|
import './vscode/src/vs/workbench/api/browser/mainThreadEmbeddings.js';
|
|
49
49
|
import './vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js';
|
|
50
50
|
import './vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js';
|
|
@@ -215,12 +215,6 @@ let ExtensionServiceOverride = class ExtensionServiceOverride extends ExtensionS
|
|
|
215
215
|
async deltaExtensions(toAdd, toRemove) {
|
|
216
216
|
await this._handleDeltaExtensions(new DeltaExtensionsQueueItem(toAdd, toRemove));
|
|
217
217
|
}
|
|
218
|
-
async _scanSingleExtension(extension) {
|
|
219
|
-
if (extension.location.scheme === CustomSchemas.extensionFile) {
|
|
220
|
-
return toExtensionDescription(extension);
|
|
221
|
-
}
|
|
222
|
-
return super._scanSingleExtension(extension);
|
|
223
|
-
}
|
|
224
218
|
};
|
|
225
219
|
ExtensionServiceOverride = __decorate([
|
|
226
220
|
( __param(1, IInstantiationService)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-extensions-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
30
|
-
"@codingame/monaco-vscode-files-service-override": "
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@7.0.1",
|
|
30
|
+
"@codingame/monaco-vscode-files-service-override": "7.0.1"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -145,7 +145,7 @@ let ExtensionManagementCLI = class ExtensionManagementCLI {
|
|
|
145
145
|
if (areSameExtensions(oldVersion.identifier, newVersion.identifier) && semverExports.gt(newVersion.version, oldVersion.manifest.version)) {
|
|
146
146
|
extensionsToUpdate.push({
|
|
147
147
|
extension: newVersion,
|
|
148
|
-
options: { operation: InstallOperation.Update, installPreReleaseVersion: oldVersion.preRelease, profileLocation }
|
|
148
|
+
options: { operation: InstallOperation.Update, installPreReleaseVersion: oldVersion.preRelease, profileLocation, isApplicationScoped: oldVersion.isApplicationScoped }
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -255,7 +255,7 @@ let ExtensionManagementCLI = class ExtensionManagementCLI {
|
|
|
255
255
|
}
|
|
256
256
|
extensionsToInstall.push({
|
|
257
257
|
extension: gallery,
|
|
258
|
-
options: { ...installOptions, installGivenVersion: !!version },
|
|
258
|
+
options: { ...installOptions, installGivenVersion: !!version, isApplicationScoped: installedExtension?.isApplicationScoped },
|
|
259
259
|
});
|
|
260
260
|
}))));
|
|
261
261
|
if (extensionsToInstall.length) {
|
|
@@ -29,8 +29,8 @@ class MainThreadAuthenticationProvider extends Disposable {
|
|
|
29
29
|
this.notificationService = notificationService;
|
|
30
30
|
this.onDidChangeSessions = onDidChangeSessionsEmitter.event;
|
|
31
31
|
}
|
|
32
|
-
async getSessions(scopes) {
|
|
33
|
-
return this._proxy.$getSessions(this.id, scopes);
|
|
32
|
+
async getSessions(scopes, options) {
|
|
33
|
+
return this._proxy.$getSessions(this.id, scopes, options);
|
|
34
34
|
}
|
|
35
35
|
createSession(scopes, options) {
|
|
36
36
|
return this._proxy.$createSession(this.id, scopes, options);
|
|
@@ -145,7 +145,7 @@ let MainThreadAuthentication = class MainThreadAuthentication extends Disposable
|
|
|
145
145
|
return result ?? false;
|
|
146
146
|
}
|
|
147
147
|
async doGetSession(providerId, scopes, extensionId, extensionName, options) {
|
|
148
|
-
const sessions = await this.authenticationService.getSessions(providerId, scopes, true);
|
|
148
|
+
const sessions = await this.authenticationService.getSessions(providerId, scopes, options.account, true);
|
|
149
149
|
const provider = this.authenticationService.getProvider(providerId);
|
|
150
150
|
if (options.forceNewSession && options.createIfNone) {
|
|
151
151
|
throw ( (new Error(
|
|
@@ -193,20 +193,17 @@ let MainThreadAuthentication = class MainThreadAuthentication extends Disposable
|
|
|
193
193
|
}
|
|
194
194
|
let session;
|
|
195
195
|
if (sessions?.length && !options.forceNewSession) {
|
|
196
|
-
session = provider.supportsMultipleAccounts
|
|
196
|
+
session = provider.supportsMultipleAccounts && !options.account
|
|
197
197
|
? await this.authenticationExtensionsService.selectSession(providerId, extensionId, extensionName, scopes, sessions)
|
|
198
198
|
: sessions[0];
|
|
199
199
|
}
|
|
200
200
|
else {
|
|
201
|
-
let
|
|
202
|
-
if (
|
|
203
|
-
sessionToRecreate = options.forceNewSession.sessionToRecreate;
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
201
|
+
let account = options.account;
|
|
202
|
+
if (!account) {
|
|
206
203
|
const sessionIdToRecreate = this.authenticationExtensionsService.getSessionPreference(providerId, extensionId, scopes);
|
|
207
|
-
|
|
204
|
+
account = sessionIdToRecreate ? sessions.find(session => session.id === sessionIdToRecreate)?.account : undefined;
|
|
208
205
|
}
|
|
209
|
-
session = await this.authenticationService.createSession(providerId, scopes, { activateImmediate: true,
|
|
206
|
+
session = await this.authenticationService.createSession(providerId, scopes, { activateImmediate: true, account });
|
|
210
207
|
}
|
|
211
208
|
this.authenticationAccessService.updateAllowedExtensions(providerId, session.account.label, [{ id: extensionId, name: extensionName, allowed: true }]);
|
|
212
209
|
this.authenticationExtensionsService.updateSessionPreference(providerId, extensionId, session);
|
|
@@ -231,16 +228,17 @@ let MainThreadAuthentication = class MainThreadAuthentication extends Disposable
|
|
|
231
228
|
}
|
|
232
229
|
return session;
|
|
233
230
|
}
|
|
234
|
-
async $
|
|
235
|
-
const sessions = await this.authenticationService.getSessions(providerId
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
231
|
+
async $getAccounts(providerId) {
|
|
232
|
+
const sessions = await this.authenticationService.getSessions(providerId);
|
|
233
|
+
const accounts = ( (new Array()));
|
|
234
|
+
const seenAccounts = ( (new Set()));
|
|
235
|
+
for (const session of sessions) {
|
|
236
|
+
if (!( (seenAccounts.has(session.account.label)))) {
|
|
237
|
+
seenAccounts.add(session.account.label);
|
|
238
|
+
accounts.push(session.account);
|
|
241
239
|
}
|
|
242
240
|
}
|
|
243
|
-
return
|
|
241
|
+
return accounts;
|
|
244
242
|
}
|
|
245
243
|
sendProviderUsageTelemetry(extensionId, providerId) {
|
|
246
244
|
this.telemetryService.publicLog2('authentication.providerUsage', { providerId, extensionId });
|
|
@@ -160,7 +160,8 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
|
|
|
160
160
|
$updateAgent(handle, metadataUpdate) {
|
|
161
161
|
const data = this._agents.get(handle);
|
|
162
162
|
if (!data) {
|
|
163
|
-
|
|
163
|
+
this._logService.error(`MainThreadChatAgents2#$updateAgent: No agent with handle ${handle} registered`);
|
|
164
|
+
return;
|
|
164
165
|
}
|
|
165
166
|
data.hasFollowups = metadataUpdate.hasFollowups;
|
|
166
167
|
this._chatAgentService.updateAgent(data.id, revive(metadataUpdate));
|
|
@@ -32,9 +32,6 @@ let MainThreadChatVariables = class MainThreadChatVariables {
|
|
|
32
32
|
$unregisterVariable(handle) {
|
|
33
33
|
this._variables.deleteAndDispose(handle);
|
|
34
34
|
}
|
|
35
|
-
$attachContext(name, value, location) {
|
|
36
|
-
this._chatVariablesService.attachContext(name, revive(value), location);
|
|
37
|
-
}
|
|
38
35
|
};
|
|
39
36
|
MainThreadChatVariables = __decorate([
|
|
40
37
|
extHostNamedCustomer(MainContext.MainThreadChatVariables),
|
|
@@ -19,6 +19,9 @@ import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
|
19
19
|
import { MarshalledId } from 'vscode/vscode/vs/base/common/marshallingIds';
|
|
20
20
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
21
21
|
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
22
|
+
import { revealCommentThread } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsController';
|
|
23
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
24
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
22
25
|
|
|
23
26
|
const _moduleId = "vs/workbench/api/browser/mainThreadComments";
|
|
24
27
|
class MainThreadCommentThread {
|
|
@@ -108,7 +111,7 @@ class MainThreadCommentThread {
|
|
|
108
111
|
get isTemplate() {
|
|
109
112
|
return this._isTemplate;
|
|
110
113
|
}
|
|
111
|
-
constructor(commentThreadHandle, controllerHandle, extensionId, threadId, resource, _range, _canReply, _isTemplate, editorId) {
|
|
114
|
+
constructor(commentThreadHandle, controllerHandle, extensionId, threadId, resource, _range, comments, _canReply, _isTemplate, editorId) {
|
|
112
115
|
this.commentThreadHandle = commentThreadHandle;
|
|
113
116
|
this.controllerHandle = controllerHandle;
|
|
114
117
|
this.extensionId = extensionId;
|
|
@@ -137,6 +140,9 @@ class MainThreadCommentThread {
|
|
|
137
140
|
if (_isTemplate) {
|
|
138
141
|
this.comments = [];
|
|
139
142
|
}
|
|
143
|
+
else if (comments) {
|
|
144
|
+
this._comments = comments;
|
|
145
|
+
}
|
|
140
146
|
}
|
|
141
147
|
batchUpdate(changes) {
|
|
142
148
|
const modified = (value) => Object.prototype.hasOwnProperty.call(changes, value);
|
|
@@ -232,7 +238,7 @@ class MainThreadCommentController {
|
|
|
232
238
|
updateFeatures(features) {
|
|
233
239
|
this._features = features;
|
|
234
240
|
}
|
|
235
|
-
createCommentThread(extensionId, commentThreadHandle, threadId, resource, range, isTemplate, editorId) {
|
|
241
|
+
createCommentThread(extensionId, commentThreadHandle, threadId, resource, range, comments, isTemplate, editorId) {
|
|
236
242
|
const thread = ( (new MainThreadCommentThread(
|
|
237
243
|
commentThreadHandle,
|
|
238
244
|
this.handle,
|
|
@@ -240,6 +246,7 @@ class MainThreadCommentController {
|
|
|
240
246
|
threadId,
|
|
241
247
|
(URI.revive(resource).toString()),
|
|
242
248
|
range,
|
|
249
|
+
comments,
|
|
243
250
|
true,
|
|
244
251
|
isTemplate,
|
|
245
252
|
editorId
|
|
@@ -411,11 +418,13 @@ class MainThreadCommentController {
|
|
|
411
418
|
}
|
|
412
419
|
const commentsViewIcon = registerIcon('comments-view-icon', Codicon.commentDiscussion, ( localizeWithPath(_moduleId, 0, 'View icon of the comments view.')));
|
|
413
420
|
let MainThreadComments = class MainThreadComments extends Disposable {
|
|
414
|
-
constructor(extHostContext, _commentService, _viewsService, _viewDescriptorService) {
|
|
421
|
+
constructor(extHostContext, _commentService, _viewsService, _viewDescriptorService, _uriIdentityService, _editorService) {
|
|
415
422
|
super();
|
|
416
423
|
this._commentService = _commentService;
|
|
417
424
|
this._viewsService = _viewsService;
|
|
418
425
|
this._viewDescriptorService = _viewDescriptorService;
|
|
426
|
+
this._uriIdentityService = _uriIdentityService;
|
|
427
|
+
this._editorService = _editorService;
|
|
419
428
|
this._handlers = ( (new Map()));
|
|
420
429
|
this._commentControllers = ( (new Map()));
|
|
421
430
|
this._activeEditingCommentThreadDisposables = this._register(( (new DisposableStore())));
|
|
@@ -464,12 +473,12 @@ let MainThreadComments = class MainThreadComments extends Disposable {
|
|
|
464
473
|
}
|
|
465
474
|
provider.updateFeatures(features);
|
|
466
475
|
}
|
|
467
|
-
$createCommentThread(handle, commentThreadHandle, threadId, resource, range, extensionId, isTemplate, editorId) {
|
|
476
|
+
$createCommentThread(handle, commentThreadHandle, threadId, resource, range, comments, extensionId, isTemplate, editorId) {
|
|
468
477
|
const provider = this._commentControllers.get(handle);
|
|
469
478
|
if (!provider) {
|
|
470
479
|
return undefined;
|
|
471
480
|
}
|
|
472
|
-
return provider.createCommentThread(extensionId.value, commentThreadHandle, threadId, resource, range, isTemplate, editorId);
|
|
481
|
+
return provider.createCommentThread(extensionId.value, commentThreadHandle, threadId, resource, range, comments, isTemplate, editorId);
|
|
473
482
|
}
|
|
474
483
|
$updateCommentThread(handle, commentThreadHandle, threadId, resource, changes) {
|
|
475
484
|
const provider = this._commentControllers.get(handle);
|
|
@@ -492,6 +501,17 @@ let MainThreadComments = class MainThreadComments extends Disposable {
|
|
|
492
501
|
}
|
|
493
502
|
provider.updateCommentingRanges(resourceHints);
|
|
494
503
|
}
|
|
504
|
+
async $revealCommentThread(handle, commentThreadHandle, options) {
|
|
505
|
+
const provider = this._commentControllers.get(handle);
|
|
506
|
+
if (!provider) {
|
|
507
|
+
return Promise.resolve();
|
|
508
|
+
}
|
|
509
|
+
const thread = provider.getAllComments().find(thread => thread.commentThreadHandle === commentThreadHandle);
|
|
510
|
+
if (!thread || !thread.isDocumentCommentThread()) {
|
|
511
|
+
return Promise.resolve();
|
|
512
|
+
}
|
|
513
|
+
revealCommentThread(this._commentService, this._editorService, this._uriIdentityService, thread, undefined, options.focusReply, undefined, options.preserveFocus);
|
|
514
|
+
}
|
|
495
515
|
registerView(commentsViewAlreadyRegistered) {
|
|
496
516
|
if (!commentsViewAlreadyRegistered) {
|
|
497
517
|
const VIEW_CONTAINER = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
|
|
@@ -570,7 +590,9 @@ MainThreadComments = __decorate([
|
|
|
570
590
|
extHostNamedCustomer(MainContext.MainThreadComments),
|
|
571
591
|
( (__param(1, ICommentService))),
|
|
572
592
|
( (__param(2, IViewsService))),
|
|
573
|
-
( (__param(3, IViewDescriptorService)))
|
|
593
|
+
( (__param(3, IViewDescriptorService))),
|
|
594
|
+
( (__param(4, IUriIdentityService))),
|
|
595
|
+
( (__param(5, IEditorService)))
|
|
574
596
|
], MainThreadComments);
|
|
575
597
|
|
|
576
598
|
export { MainThreadCommentController, MainThreadCommentThread, MainThreadComments };
|
|
@@ -274,6 +274,7 @@ let MainThreadDebugService = class MainThreadDebugService {
|
|
|
274
274
|
compact: options.compact,
|
|
275
275
|
compoundRoot: parentSession?.compoundRoot,
|
|
276
276
|
saveBeforeRestart: saveBeforeStart,
|
|
277
|
+
testRun: options.testRun,
|
|
277
278
|
suppressDebugStatusbar: options.suppressDebugStatusbar,
|
|
278
279
|
suppressDebugToolbar: options.suppressDebugToolbar,
|
|
279
280
|
suppressDebugView: options.suppressDebugView,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import {
|
|
2
|
+
import { transformErrorFromSerialization, onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
|
|
3
3
|
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
4
4
|
import { MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
5
5
|
|
|
@@ -8,11 +8,7 @@ let MainThreadErrors = class MainThreadErrors {
|
|
|
8
8
|
}
|
|
9
9
|
$onUnexpectedError(err) {
|
|
10
10
|
if (err && err.$isError) {
|
|
11
|
-
|
|
12
|
-
err = err.noTelemetry ? ( new ErrorNoTelemetry()) : ( new Error());
|
|
13
|
-
err.message = message;
|
|
14
|
-
err.name = name;
|
|
15
|
-
err.stack = stack;
|
|
11
|
+
err = transformErrorFromSerialization(err);
|
|
16
12
|
}
|
|
17
13
|
onUnexpectedError(err);
|
|
18
14
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { Action } from 'vscode/vscode/vs/base/common/actions';
|
|
3
3
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
|
+
import { transformErrorFromSerialization } from 'vscode/vscode/vs/base/common/errors';
|
|
4
5
|
import { FileAccess } from 'vscode/vscode/vs/base/common/network';
|
|
5
6
|
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
6
7
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
@@ -54,19 +55,13 @@ let MainThreadExtensionService = class MainThreadExtensionService {
|
|
|
54
55
|
this._internalExtensionService._onDidActivateExtension(extensionId, codeLoadingTime, activateCallTime, activateResolvedTime, activationReason);
|
|
55
56
|
}
|
|
56
57
|
$onExtensionRuntimeError(extensionId, data) {
|
|
57
|
-
const error = (
|
|
58
|
-
error.name = data.name;
|
|
59
|
-
error.message = data.message;
|
|
60
|
-
error.stack = data.stack;
|
|
58
|
+
const error = transformErrorFromSerialization(data);
|
|
61
59
|
this._internalExtensionService._onExtensionRuntimeError(extensionId, error);
|
|
62
60
|
console.error(`[${extensionId.value}]${error.message}`);
|
|
63
61
|
console.error(error.stack);
|
|
64
62
|
}
|
|
65
63
|
async $onExtensionActivationError(extensionId, data, missingExtensionDependency) {
|
|
66
|
-
const error = (
|
|
67
|
-
error.name = data.name;
|
|
68
|
-
error.message = data.message;
|
|
69
|
-
error.stack = data.stack;
|
|
64
|
+
const error = transformErrorFromSerialization(data);
|
|
70
65
|
this._internalExtensionService._onDidActivateExtensionError(extensionId, error);
|
|
71
66
|
if (missingExtensionDependency) {
|
|
72
67
|
const extension = await this._extensionService.getExtension(extensionId.value);
|
|
@@ -497,6 +497,9 @@ let MainThreadLanguageFeatures = MainThreadLanguageFeatures_1 = class MainThread
|
|
|
497
497
|
provideInlineCompletions: async (model, position, context, token) => {
|
|
498
498
|
return this._proxy.$provideInlineCompletions(handle, model.uri, position, context, token);
|
|
499
499
|
},
|
|
500
|
+
provideInlineEdits: async (model, range, context, token) => {
|
|
501
|
+
return this._proxy.$provideInlineEdits(handle, model.uri, range, context, token);
|
|
502
|
+
},
|
|
500
503
|
handleItemDidShow: async (completions, item, updatedInsertText) => {
|
|
501
504
|
if (supportsHandleEvents) {
|
|
502
505
|
await this._proxy.$handleInlineCompletionDidShow(handle, completions.pid, item.idx, updatedInsertText);
|
|
@@ -936,14 +939,19 @@ let MainThreadDocumentOnDropEditProvider = class MainThreadDocumentOnDropEditPro
|
|
|
936
939
|
if (!edits) {
|
|
937
940
|
return;
|
|
938
941
|
}
|
|
939
|
-
return
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
942
|
+
return {
|
|
943
|
+
edits: ( edits.map(edit => {
|
|
944
|
+
return {
|
|
945
|
+
...edit,
|
|
946
|
+
yieldTo: edit.yieldTo?.map(x => ({ kind: ( new HierarchicalKind(x)) })),
|
|
947
|
+
kind: edit.kind ? ( new HierarchicalKind(edit.kind)) : undefined,
|
|
948
|
+
additionalEdit: reviveWorkspaceEditDto(edit.additionalEdit, this._uriIdentService, dataId => this.resolveDocumentOnDropFileData(request.id, dataId)),
|
|
949
|
+
};
|
|
950
|
+
})),
|
|
951
|
+
dispose: () => {
|
|
952
|
+
this._proxy.$releaseDocumentOnDropEdits(this._handle, request.id);
|
|
953
|
+
},
|
|
954
|
+
};
|
|
947
955
|
}
|
|
948
956
|
finally {
|
|
949
957
|
request.dispose();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable, DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
4
|
+
import { ILanguageModelToolsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
|
|
5
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
6
|
+
|
|
7
|
+
let MainThreadLanguageModelTools = class MainThreadLanguageModelTools extends Disposable {
|
|
8
|
+
constructor(extHostContext, _languageModelToolsService) {
|
|
9
|
+
super();
|
|
10
|
+
this._languageModelToolsService = _languageModelToolsService;
|
|
11
|
+
this._tools = this._register(( new DisposableMap()));
|
|
12
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostLanguageModelTools));
|
|
13
|
+
this._register(this._languageModelToolsService.onDidChangeTools(e => this._proxy.$acceptToolDelta(e)));
|
|
14
|
+
}
|
|
15
|
+
async $getTools() {
|
|
16
|
+
return Array.from(this._languageModelToolsService.getTools());
|
|
17
|
+
}
|
|
18
|
+
$invokeTool(name, parameters, token) {
|
|
19
|
+
return this._languageModelToolsService.invokeTool(name, parameters, token);
|
|
20
|
+
}
|
|
21
|
+
$registerTool(name) {
|
|
22
|
+
const disposable = this._languageModelToolsService.registerToolImplementation(name, {
|
|
23
|
+
invoke: async (parameters, token) => {
|
|
24
|
+
return await this._proxy.$invokeTool(name, parameters, token);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
this._tools.set(name, disposable);
|
|
28
|
+
}
|
|
29
|
+
$unregisterTool(name) {
|
|
30
|
+
this._tools.deleteAndDispose(name);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
MainThreadLanguageModelTools = __decorate([
|
|
34
|
+
extHostNamedCustomer(MainContext.MainThreadLanguageModelTools),
|
|
35
|
+
( __param(1, ILanguageModelToolsService))
|
|
36
|
+
], MainThreadLanguageModelTools);
|
|
37
|
+
|
|
38
|
+
export { MainThreadLanguageModelTools };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { DeferredPromise, AsyncIterableSource } from 'vscode/vscode/vs/base/common/async';
|
|
3
|
+
import { transformErrorFromSerialization, transformErrorForSerialization } from 'vscode/vscode/vs/base/common/errors';
|
|
2
4
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
5
|
import { DisposableStore, DisposableMap, Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
6
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
5
7
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
6
|
-
import { Progress } from 'vscode/vscode/vs/platform/progress/common/progress';
|
|
7
8
|
import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
8
9
|
import { ILanguageModelStatsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModelStats.service';
|
|
9
10
|
import { ILanguageModelsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
@@ -39,15 +40,22 @@ let MainThreadLanguageModels = class MainThreadLanguageModels {
|
|
|
39
40
|
const dipsosables = ( (new DisposableStore()));
|
|
40
41
|
dipsosables.add(this._chatProviderService.registerLanguageModelChat(identifier, {
|
|
41
42
|
metadata,
|
|
42
|
-
|
|
43
|
+
sendChatRequest: async (messages, from, options, token) => {
|
|
43
44
|
const requestId = (Math.random() * 1e6) | 0;
|
|
44
|
-
|
|
45
|
+
const defer = ( (new DeferredPromise()));
|
|
46
|
+
const stream = ( (new AsyncIterableSource()));
|
|
45
47
|
try {
|
|
46
|
-
|
|
48
|
+
this._pendingProgress.set(requestId, { defer, stream });
|
|
49
|
+
await this._proxy.$startChatRequest(handle, requestId, from, messages, options, token);
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
catch (err) {
|
|
49
52
|
this._pendingProgress.delete(requestId);
|
|
53
|
+
throw err;
|
|
50
54
|
}
|
|
55
|
+
return {
|
|
56
|
+
result: defer.p,
|
|
57
|
+
stream: stream.asyncIterable
|
|
58
|
+
};
|
|
51
59
|
},
|
|
52
60
|
provideTokenCount: (str, token) => {
|
|
53
61
|
return this._proxy.$provideTokenLength(handle, str, token);
|
|
@@ -58,8 +66,28 @@ let MainThreadLanguageModels = class MainThreadLanguageModels {
|
|
|
58
66
|
}
|
|
59
67
|
this._providerRegistrations.set(handle, dipsosables);
|
|
60
68
|
}
|
|
61
|
-
async $
|
|
62
|
-
this._pendingProgress.get(requestId)
|
|
69
|
+
async $reportResponsePart(requestId, chunk) {
|
|
70
|
+
const data = this._pendingProgress.get(requestId);
|
|
71
|
+
this._logService.trace('[LM] report response PART', Boolean(data), requestId, chunk);
|
|
72
|
+
if (data) {
|
|
73
|
+
data.stream.emitOne(chunk);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async $reportResponseDone(requestId, err) {
|
|
77
|
+
const data = this._pendingProgress.get(requestId);
|
|
78
|
+
this._logService.trace('[LM] report response DONE', Boolean(data), requestId, err);
|
|
79
|
+
if (data) {
|
|
80
|
+
this._pendingProgress.delete(requestId);
|
|
81
|
+
if (err) {
|
|
82
|
+
const error = transformErrorFromSerialization(err);
|
|
83
|
+
data.stream.reject(error);
|
|
84
|
+
data.defer.error(error);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
data.stream.resolve();
|
|
88
|
+
data.defer.complete(undefined);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
63
91
|
}
|
|
64
92
|
$unregisterProvider(handle) {
|
|
65
93
|
this._providerRegistrations.deleteAndDispose(handle);
|
|
@@ -70,18 +98,29 @@ let MainThreadLanguageModels = class MainThreadLanguageModels {
|
|
|
70
98
|
$whenLanguageModelChatRequestMade(identifier, extensionId, participant, tokenCount) {
|
|
71
99
|
this._languageModelStatsService.update(identifier, extensionId, participant, tokenCount);
|
|
72
100
|
}
|
|
73
|
-
async $
|
|
74
|
-
this._logService.
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
101
|
+
async $tryStartChatRequest(extension, providerId, requestId, messages, options, token) {
|
|
102
|
+
this._logService.trace('[CHAT] request STARTED', extension.value, requestId);
|
|
103
|
+
const response = await this._chatProviderService.sendChatRequest(providerId, extension, messages, options, token);
|
|
104
|
+
const streaming = (async () => {
|
|
105
|
+
try {
|
|
106
|
+
for await (const part of response.stream) {
|
|
107
|
+
this._logService.trace('[CHAT] request PART', extension.value, requestId, part);
|
|
108
|
+
await this._proxy.$acceptResponsePart(requestId, part);
|
|
109
|
+
}
|
|
110
|
+
this._logService.trace('[CHAT] request DONE', extension.value, requestId);
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
this._logService.error('[CHAT] extension request ERRORED in STREAM', err, extension.value, requestId);
|
|
114
|
+
this._proxy.$acceptResponseDone(requestId, transformErrorForSerialization(err));
|
|
115
|
+
}
|
|
116
|
+
})();
|
|
117
|
+
Promise.allSettled([response.result, streaming]).then(() => {
|
|
82
118
|
this._logService.debug('[CHAT] extension request DONE', extension.value, requestId);
|
|
119
|
+
this._proxy.$acceptResponseDone(requestId, undefined);
|
|
120
|
+
}, err => {
|
|
121
|
+
this._logService.error('[CHAT] extension request ERRORED', err, extension.value, requestId);
|
|
122
|
+
this._proxy.$acceptResponseDone(requestId, transformErrorForSerialization(err));
|
|
83
123
|
});
|
|
84
|
-
return task;
|
|
85
124
|
}
|
|
86
125
|
$countTokens(provider, value, token) {
|
|
87
126
|
return this._chatProviderService.computeTokenLength(provider, value, token);
|
|
@@ -140,9 +179,9 @@ class LanguageModelAccessAuthProvider {
|
|
|
140
179
|
if (this._session) {
|
|
141
180
|
return [this._session];
|
|
142
181
|
}
|
|
143
|
-
return [await this.createSession(scopes || []
|
|
182
|
+
return [await this.createSession(scopes || [])];
|
|
144
183
|
}
|
|
145
|
-
async createSession(scopes
|
|
184
|
+
async createSession(scopes) {
|
|
146
185
|
this._session = this._createFakeSession(scopes);
|
|
147
186
|
this._onDidChangeSessions.fire({ added: [this._session], changed: [], removed: [] });
|
|
148
187
|
return this._session;
|