@codingame/monaco-vscode-extensions-service-override 1.83.16 → 1.85.0-next.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 +2 -2
- package/localExtensionHost.d.ts +1 -0
- package/package.json +4 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +4 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +9 -88
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +216 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +3 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +7 -6
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +8 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +4 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +6 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +16 -9
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +3 -75
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +102 -11
- package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +6 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +16 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +25 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +36 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +34 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +4 -11
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +136 -28
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +2 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +67 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +8 -10
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +25 -10
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +8 -13
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +141 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +342 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1197 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +117 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +543 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +292 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +169 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +111 -73
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +195 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +260 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +26 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +6 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +6 -5
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +8 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +6 -4
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +6 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +24 -10
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +113 -34
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +17 -8
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +5 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +18 -8
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +2 -1
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +7 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +5 -5
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +2 -1
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +7 -4
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +17 -12
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +17 -148
- package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +161 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +2 -0
- package/vscode/src/vs/platform/files/common/watcher.js +0 -71
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents.js +0 -52
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSlashCommands.js +0 -49
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +0 -25
package/extensions.js
CHANGED
|
@@ -44,8 +44,7 @@ import 'vscode/vscode/vs/workbench/api/browser/statusBarExtensionPoint';
|
|
|
44
44
|
import './vscode/src/vs/workbench/api/browser/mainThreadLocalization.js';
|
|
45
45
|
import './vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js';
|
|
46
46
|
import './vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js';
|
|
47
|
-
import './vscode/src/vs/workbench/api/browser/
|
|
48
|
-
import './vscode/src/vs/workbench/api/browser/mainThreadChatAgents.js';
|
|
47
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js';
|
|
49
48
|
import './vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js';
|
|
50
49
|
import './vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js';
|
|
51
50
|
import './vscode/src/vs/workbench/api/browser/mainThreadClipboard.js';
|
|
@@ -76,6 +75,7 @@ import './vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js';
|
|
|
76
75
|
import './vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js';
|
|
77
76
|
import './vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js';
|
|
78
77
|
import './vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js';
|
|
78
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadSpeech.js';
|
|
79
79
|
import './vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js';
|
|
80
80
|
import './vscode/src/vs/workbench/api/browser/mainThreadSCM.js';
|
|
81
81
|
import './vscode/src/vs/workbench/api/browser/mainThreadSearch.js';
|
package/localExtensionHost.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ declare class LocalExtensionHost implements IExtensionHost {
|
|
|
27
27
|
extensions: ExtensionHostExtensions | null;
|
|
28
28
|
private readonly _extensionHostLogsLocation;
|
|
29
29
|
private _protocolPromise;
|
|
30
|
+
pid: null;
|
|
30
31
|
constructor(runningLocation: LocalProcessRunningLocation, startup: ExtensionHostStartup, _initDataProvider: IWebWorkerExtensionHostDataProvider, _telemetryService: ITelemetryService, _contextService: IWorkspaceContextService, _labelService: ILabelService, _logService: ILogService, _loggerService: ILoggerService, _environmentService: IBrowserWorkbenchEnvironmentService, _productService: IProductService, _userDataProfilesService: IUserDataProfilesService);
|
|
31
32
|
onExit: Event<any>;
|
|
32
33
|
start(): Promise<IMessagePassingProtocol>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-extensions-service-override",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.85.0-next.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.
|
|
22
|
-
"monaco-editor": "0.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.85.0-next.1",
|
|
22
|
+
"monaco-editor": "0.45.0",
|
|
23
23
|
"vscode-semver": "npm:semver@=5.5.0",
|
|
24
|
-
"@codingame/monaco-vscode-files-service-override": "1.
|
|
24
|
+
"@codingame/monaco-vscode-files-service-override": "1.85.0-next.1"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -257,8 +257,10 @@ let MainThreadAuthentication = class MainThreadAuthentication extends Disposable
|
|
|
257
257
|
throw new Error('User did not consent to login.');
|
|
258
258
|
}
|
|
259
259
|
let session;
|
|
260
|
-
if (sessions?.length && !options.forceNewSession
|
|
261
|
-
session =
|
|
260
|
+
if (sessions?.length && !options.forceNewSession) {
|
|
261
|
+
session = supportsMultipleAccounts
|
|
262
|
+
? await this.authenticationService.selectSession(providerId, extensionId, extensionName, scopes, sessions)
|
|
263
|
+
: sessions[0];
|
|
262
264
|
}
|
|
263
265
|
else {
|
|
264
266
|
let sessionToRecreate;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { DeferredPromise } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
3
2
|
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
3
|
import { Disposable, DisposableMap } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
-
import { revive } from 'monaco-editor/esm/vs/base/common/marshalling.js';
|
|
6
4
|
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
7
5
|
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
8
6
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
9
7
|
import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService';
|
|
10
|
-
import { isCompleteInteractiveProgressTreeData } from '../../contrib/chat/common/chatModel.js';
|
|
11
8
|
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
12
9
|
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
13
10
|
|
|
@@ -18,13 +15,12 @@ let MainThreadChat = class MainThreadChat extends Disposable {
|
|
|
18
15
|
this._chatWidgetService = _chatWidgetService;
|
|
19
16
|
this.chatContribService = chatContribService;
|
|
20
17
|
this._providerRegistrations = this._register(( new DisposableMap()));
|
|
21
|
-
this._activeRequestProgressCallbacks = ( new Map());
|
|
22
18
|
this._stateEmitters = ( new Map());
|
|
23
|
-
this._responsePartHandlePool = 0;
|
|
24
|
-
this._activeResponsePartPromises = ( new Map());
|
|
25
19
|
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChat));
|
|
26
20
|
this._register(this._chatService.onDidPerformUserAction(e => {
|
|
27
|
-
|
|
21
|
+
if (!e.agentId) {
|
|
22
|
+
this._proxy.$onDidPerformUserAction(e);
|
|
23
|
+
}
|
|
28
24
|
}));
|
|
29
25
|
}
|
|
30
26
|
$transferChatSession(sessionId, toWorkspace) {
|
|
@@ -44,14 +40,13 @@ let MainThreadChat = class MainThreadChat extends Disposable {
|
|
|
44
40
|
const unreg = this._chatService.registerProvider({
|
|
45
41
|
id,
|
|
46
42
|
displayName: registration.label,
|
|
47
|
-
prepareSession: async (
|
|
48
|
-
const session = await this._proxy.$prepareChat(handle,
|
|
43
|
+
prepareSession: async (token) => {
|
|
44
|
+
const session = await this._proxy.$prepareChat(handle, token);
|
|
49
45
|
if (!session) {
|
|
50
46
|
return undefined;
|
|
51
47
|
}
|
|
52
|
-
const responderAvatarIconUri = session.responderAvatarIconUri
|
|
53
|
-
URI.revive(session.responderAvatarIconUri)
|
|
54
|
-
registration.extensionIcon;
|
|
48
|
+
const responderAvatarIconUri = session.responderAvatarIconUri &&
|
|
49
|
+
URI.revive(session.responderAvatarIconUri);
|
|
55
50
|
const emitter = ( new Emitter());
|
|
56
51
|
this._stateEmitters.set(session.id, emitter);
|
|
57
52
|
return {
|
|
@@ -61,7 +56,6 @@ let MainThreadChat = class MainThreadChat extends Disposable {
|
|
|
61
56
|
responderUsername: session.responderUsername,
|
|
62
57
|
responderAvatarIconUri,
|
|
63
58
|
inputPlaceholder: session.inputPlaceholder,
|
|
64
|
-
onDidChangeState: emitter.event,
|
|
65
59
|
dispose: () => {
|
|
66
60
|
emitter.dispose();
|
|
67
61
|
this._stateEmitters.delete(session.id);
|
|
@@ -69,91 +63,18 @@ let MainThreadChat = class MainThreadChat extends Disposable {
|
|
|
69
63
|
}
|
|
70
64
|
};
|
|
71
65
|
},
|
|
72
|
-
resolveRequest: async (session, context, token) => {
|
|
73
|
-
const dto = await this._proxy.$resolveRequest(handle, session.id, context, token);
|
|
74
|
-
return {
|
|
75
|
-
session,
|
|
76
|
-
...dto
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
provideReply: async (request, progress, token) => {
|
|
80
|
-
const id = `${handle}_${request.session.id}`;
|
|
81
|
-
this._activeRequestProgressCallbacks.set(id, progress);
|
|
82
|
-
try {
|
|
83
|
-
const requestDto = {
|
|
84
|
-
message: request.message,
|
|
85
|
-
variables: request.variables
|
|
86
|
-
};
|
|
87
|
-
const dto = await this._proxy.$provideReply(handle, request.session.id, requestDto, token);
|
|
88
|
-
return {
|
|
89
|
-
session: request.session,
|
|
90
|
-
...dto
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
finally {
|
|
94
|
-
this._activeRequestProgressCallbacks.delete(id);
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
66
|
provideWelcomeMessage: (token) => {
|
|
98
67
|
return this._proxy.$provideWelcomeMessage(handle, token);
|
|
99
68
|
},
|
|
100
|
-
|
|
101
|
-
return this._proxy.$
|
|
69
|
+
provideSampleQuestions: (token) => {
|
|
70
|
+
return this._proxy.$provideSampleQuestions(handle, token);
|
|
102
71
|
},
|
|
103
|
-
provideFollowups: (session, token) => {
|
|
104
|
-
return this._proxy.$provideFollowups(handle, session.id, token);
|
|
105
|
-
},
|
|
106
|
-
removeRequest: (session, requestId) => {
|
|
107
|
-
return this._proxy.$removeRequest(handle, session.id, requestId);
|
|
108
|
-
}
|
|
109
72
|
});
|
|
110
73
|
this._providerRegistrations.set(handle, unreg);
|
|
111
74
|
}
|
|
112
|
-
async $acceptResponseProgress(handle, sessionId, progress, responsePartHandle) {
|
|
113
|
-
const id = `${handle}_${sessionId}`;
|
|
114
|
-
if ('placeholder' in progress) {
|
|
115
|
-
const responsePartId = `${id}_${++this._responsePartHandlePool}`;
|
|
116
|
-
const deferredContentPromise = ( new DeferredPromise());
|
|
117
|
-
this._activeResponsePartPromises.set(responsePartId, deferredContentPromise);
|
|
118
|
-
this._activeRequestProgressCallbacks.get(id)?.({ ...progress, resolvedContent: deferredContentPromise.p });
|
|
119
|
-
return this._responsePartHandlePool;
|
|
120
|
-
}
|
|
121
|
-
else if (responsePartHandle) {
|
|
122
|
-
const responsePartId = `${id}_${responsePartHandle}`;
|
|
123
|
-
const deferredContentPromise = this._activeResponsePartPromises.get(responsePartId);
|
|
124
|
-
if (deferredContentPromise && isCompleteInteractiveProgressTreeData(progress)) {
|
|
125
|
-
const withRevivedUris = revive(progress);
|
|
126
|
-
deferredContentPromise.complete(withRevivedUris);
|
|
127
|
-
this._activeResponsePartPromises.delete(responsePartId);
|
|
128
|
-
}
|
|
129
|
-
else if (deferredContentPromise && 'content' in progress) {
|
|
130
|
-
deferredContentPromise.complete(progress.content);
|
|
131
|
-
this._activeResponsePartPromises.delete(responsePartId);
|
|
132
|
-
}
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (isCompleteInteractiveProgressTreeData(progress)) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if ('documents' in progress) {
|
|
139
|
-
const usedContext = {
|
|
140
|
-
documents: ( progress.documents.map(({ uri, version, ranges }) => ({
|
|
141
|
-
uri: URI.revive(uri),
|
|
142
|
-
version,
|
|
143
|
-
ranges,
|
|
144
|
-
}))),
|
|
145
|
-
};
|
|
146
|
-
this._activeRequestProgressCallbacks.get(id)?.(usedContext);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
this._activeRequestProgressCallbacks.get(id)?.(progress);
|
|
150
|
-
}
|
|
151
75
|
async $acceptChatState(sessionId, state) {
|
|
152
76
|
this._stateEmitters.get(sessionId)?.fire(state);
|
|
153
77
|
}
|
|
154
|
-
$addRequest(context) {
|
|
155
|
-
this._chatService.addRequest(context);
|
|
156
|
-
}
|
|
157
78
|
async $sendRequestToProvider(providerId, message) {
|
|
158
79
|
const widget = await this._chatWidgetService.revealViewForProvider(providerId);
|
|
159
80
|
if (widget && widget.viewModel) {
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { DeferredPromise } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
3
|
+
import { Disposable, DisposableMap } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
import { revive } from 'monaco-editor/esm/vs/base/common/marshalling.js';
|
|
5
|
+
import { escapeRegExpCharacters } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
6
|
+
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
7
|
+
import { getWordAtText } from 'monaco-editor/esm/vs/editor/common/core/wordHelper.js';
|
|
8
|
+
import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
|
|
9
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
10
|
+
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
11
|
+
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
12
|
+
import { ChatInputPart } from '../../contrib/chat/browser/chatInputPart.js';
|
|
13
|
+
import { AddDynamicVariableAction } from '../../contrib/chat/browser/contrib/chatDynamicVariables.js';
|
|
14
|
+
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
15
|
+
import { ChatRequestAgentPart } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
16
|
+
import { ChatRequestParser } from '../../contrib/chat/common/chatRequestParser.js';
|
|
17
|
+
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
18
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
19
|
+
|
|
20
|
+
let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
|
|
21
|
+
constructor(extHostContext, _chatAgentService, _chatService, _languageFeaturesService, _chatWidgetService, _instantiationService) {
|
|
22
|
+
super();
|
|
23
|
+
this._chatAgentService = _chatAgentService;
|
|
24
|
+
this._chatService = _chatService;
|
|
25
|
+
this._languageFeaturesService = _languageFeaturesService;
|
|
26
|
+
this._chatWidgetService = _chatWidgetService;
|
|
27
|
+
this._instantiationService = _instantiationService;
|
|
28
|
+
this._agents = this._register(( new DisposableMap()));
|
|
29
|
+
this._agentCompletionProviders = this._register(( new DisposableMap()));
|
|
30
|
+
this._pendingProgress = ( new Map());
|
|
31
|
+
this._responsePartHandlePool = 0;
|
|
32
|
+
this._activeResponsePartPromises = ( new Map());
|
|
33
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChatAgents2));
|
|
34
|
+
this._register(this._chatService.onDidDisposeSession(e => {
|
|
35
|
+
this._proxy.$releaseSession(e.sessionId);
|
|
36
|
+
}));
|
|
37
|
+
this._register(this._chatService.onDidPerformUserAction(e => {
|
|
38
|
+
if (typeof e.agentId === 'string') {
|
|
39
|
+
for (const [handle, agent] of this._agents) {
|
|
40
|
+
if (agent.name === e.agentId) {
|
|
41
|
+
if (e.action.kind === 'vote') {
|
|
42
|
+
this._proxy.$acceptFeedback(handle, e.sessionId, e.requestId, e.action.direction);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this._proxy.$acceptAction(handle, e.sessionId, e.requestId, e);
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
$unregisterAgent(handle) {
|
|
54
|
+
this._agents.deleteAndDispose(handle);
|
|
55
|
+
}
|
|
56
|
+
$registerAgent(handle, name, metadata) {
|
|
57
|
+
const d = this._chatAgentService.registerAgent({
|
|
58
|
+
id: name,
|
|
59
|
+
metadata: revive(metadata),
|
|
60
|
+
invoke: async (request, progress, history, token) => {
|
|
61
|
+
this._pendingProgress.set(request.requestId, progress);
|
|
62
|
+
try {
|
|
63
|
+
return (await this._proxy.$invokeAgent(handle, request.sessionId, request.requestId, request, { history }, token)) ?? {};
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
this._pendingProgress.delete(request.requestId);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
provideFollowups: async (sessionId, token) => {
|
|
70
|
+
if (!this._agents.get(handle)?.hasFollowups) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
return this._proxy.$provideFollowups(handle, sessionId, token);
|
|
74
|
+
},
|
|
75
|
+
provideSlashCommands: async (token) => {
|
|
76
|
+
if (!this._agents.get(handle)?.hasSlashCommands) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
return this._proxy.$provideSlashCommands(handle, token);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
this._agents.set(handle, {
|
|
83
|
+
name,
|
|
84
|
+
dispose: d.dispose,
|
|
85
|
+
hasSlashCommands: metadata.hasSlashCommands,
|
|
86
|
+
hasFollowups: metadata.hasFollowups
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
$updateAgent(handle, metadataUpdate) {
|
|
90
|
+
const data = this._agents.get(handle);
|
|
91
|
+
if (!data) {
|
|
92
|
+
throw new Error(`No agent with handle ${handle} registered`);
|
|
93
|
+
}
|
|
94
|
+
data.hasSlashCommands = metadataUpdate.hasSlashCommands;
|
|
95
|
+
data.hasFollowups = metadataUpdate.hasFollowups;
|
|
96
|
+
this._chatAgentService.updateAgent(data.name, revive(metadataUpdate));
|
|
97
|
+
}
|
|
98
|
+
async $handleProgressChunk(requestId, progress, responsePartHandle) {
|
|
99
|
+
if (progress.kind === 'asyncContent') {
|
|
100
|
+
const handle = ++this._responsePartHandlePool;
|
|
101
|
+
const responsePartId = `${requestId}_${handle}`;
|
|
102
|
+
const deferredContentPromise = ( new DeferredPromise());
|
|
103
|
+
this._activeResponsePartPromises.set(responsePartId, deferredContentPromise);
|
|
104
|
+
this._pendingProgress.get(requestId)?.({ ...progress, resolvedContent: deferredContentPromise.p });
|
|
105
|
+
return handle;
|
|
106
|
+
}
|
|
107
|
+
else if (typeof responsePartHandle === 'number') {
|
|
108
|
+
const responsePartId = `${requestId}_${responsePartHandle}`;
|
|
109
|
+
const deferredContentPromise = this._activeResponsePartPromises.get(responsePartId);
|
|
110
|
+
if (deferredContentPromise && progress.kind === 'treeData') {
|
|
111
|
+
const withRevivedUris = revive(progress);
|
|
112
|
+
deferredContentPromise.complete(withRevivedUris);
|
|
113
|
+
this._activeResponsePartPromises.delete(responsePartId);
|
|
114
|
+
}
|
|
115
|
+
else if (deferredContentPromise && progress.kind === 'content') {
|
|
116
|
+
deferredContentPromise.complete(progress.content);
|
|
117
|
+
this._activeResponsePartPromises.delete(responsePartId);
|
|
118
|
+
}
|
|
119
|
+
return responsePartHandle;
|
|
120
|
+
}
|
|
121
|
+
if (progress.kind === 'treeData') {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const revivedProgress = revive(progress);
|
|
125
|
+
this._pendingProgress.get(requestId)?.(revivedProgress);
|
|
126
|
+
}
|
|
127
|
+
$registerAgentCompletionsProvider(handle, triggerCharacters) {
|
|
128
|
+
this._agentCompletionProviders.set(handle, this._languageFeaturesService.completionProvider.register({ scheme: ChatInputPart.INPUT_SCHEME, hasAccessToAllModels: true }, {
|
|
129
|
+
_debugDisplayName: 'chatAgentCompletions:' + handle,
|
|
130
|
+
triggerCharacters,
|
|
131
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
132
|
+
const widget = this._chatWidgetService.getWidgetByInputUri(model.uri);
|
|
133
|
+
if (!widget || !widget.viewModel) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const triggerCharsPart = ( triggerCharacters.map(c => escapeRegExpCharacters(c))).join('');
|
|
137
|
+
const wordRegex = ( new RegExp(`[${triggerCharsPart}]\\S*`, 'g'));
|
|
138
|
+
const query = getWordAtText(position.column, wordRegex, model.getLineContent(position.lineNumber), 0)?.word ?? '';
|
|
139
|
+
if (query && !( triggerCharacters.some(c => query.startsWith(c)))) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const parsedRequest = (await this._instantiationService.createInstance(ChatRequestParser).parseChatRequest(widget.viewModel.sessionId, model.getValue())).parts;
|
|
143
|
+
const agentPart = parsedRequest.find((part) => part instanceof ChatRequestAgentPart);
|
|
144
|
+
const thisAgentName = this._agents.get(handle)?.name;
|
|
145
|
+
if (agentPart?.agent.id !== thisAgentName) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const range = computeCompletionRanges(model, position, wordRegex);
|
|
149
|
+
if (!range) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
const result = await this._proxy.$invokeCompletionProvider(handle, query, token);
|
|
153
|
+
const variableItems = ( result.map(v => {
|
|
154
|
+
const insertText = v.insertText ?? (typeof v.label === 'string' ? v.label : v.label.label);
|
|
155
|
+
const rangeAfterInsert = ( new Range(
|
|
156
|
+
range.insert.startLineNumber,
|
|
157
|
+
range.insert.startColumn,
|
|
158
|
+
range.insert.endLineNumber,
|
|
159
|
+
range.insert.startColumn + insertText.length
|
|
160
|
+
));
|
|
161
|
+
return {
|
|
162
|
+
label: v.label,
|
|
163
|
+
range,
|
|
164
|
+
insertText: insertText + ' ',
|
|
165
|
+
kind: 18 ,
|
|
166
|
+
detail: v.detail,
|
|
167
|
+
documentation: v.documentation,
|
|
168
|
+
command: { id: AddDynamicVariableAction.ID, title: '', arguments: [{ widget, range: rangeAfterInsert, variableData: v.values }] }
|
|
169
|
+
};
|
|
170
|
+
}));
|
|
171
|
+
return {
|
|
172
|
+
suggestions: variableItems
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
$unregisterAgentCompletionsProvider(handle) {
|
|
178
|
+
this._agentCompletionProviders.deleteAndDispose(handle);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
MainThreadChatAgents2 = __decorate([
|
|
182
|
+
extHostNamedCustomer(MainContext.MainThreadChatAgents2),
|
|
183
|
+
( __param(1, IChatAgentService)),
|
|
184
|
+
( __param(2, IChatService)),
|
|
185
|
+
( __param(3, ILanguageFeaturesService)),
|
|
186
|
+
( __param(4, IChatWidgetService)),
|
|
187
|
+
( __param(5, IInstantiationService))
|
|
188
|
+
], MainThreadChatAgents2);
|
|
189
|
+
function computeCompletionRanges(model, position, reg) {
|
|
190
|
+
const varWord = getWordAtText(position.column, reg, model.getLineContent(position.lineNumber), 0);
|
|
191
|
+
if (!varWord && model.getWordUntilPosition(position).word) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let insert;
|
|
195
|
+
let replace;
|
|
196
|
+
if (!varWord) {
|
|
197
|
+
insert = replace = Range.fromPositions(position);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
insert = ( new Range(
|
|
201
|
+
position.lineNumber,
|
|
202
|
+
varWord.startColumn,
|
|
203
|
+
position.lineNumber,
|
|
204
|
+
position.column
|
|
205
|
+
));
|
|
206
|
+
replace = ( new Range(
|
|
207
|
+
position.lineNumber,
|
|
208
|
+
varWord.startColumn,
|
|
209
|
+
position.lineNumber,
|
|
210
|
+
varWord.endColumn
|
|
211
|
+
));
|
|
212
|
+
}
|
|
213
|
+
return { insert, replace };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { MainThreadChatAgents2 };
|
|
@@ -39,6 +39,9 @@ let MainThreadChatProvider = class MainThreadChatProvider {
|
|
|
39
39
|
$unregisterProvider(handle) {
|
|
40
40
|
this._providerRegistrations.deleteAndDispose(handle);
|
|
41
41
|
}
|
|
42
|
+
async $prepareChatAccess(providerId) {
|
|
43
|
+
return this._chatProviderService.lookupChatResponseProvider(providerId);
|
|
44
|
+
}
|
|
42
45
|
async $fetchResponse(extension, providerId, requestId, messages, options, token) {
|
|
43
46
|
this._logService.debug('[CHAT] extension request STARTED', extension.value, requestId);
|
|
44
47
|
const task = this._chatProviderService.fetchChatResponse(providerId, messages, options, ( new Progress(value => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { DisposableMap } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import { revive } from 'monaco-editor/esm/vs/base/common/marshalling.js';
|
|
3
4
|
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
4
5
|
import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables';
|
|
5
6
|
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
6
7
|
|
|
7
|
-
let
|
|
8
|
+
let MainThreadChatVariables = class MainThreadChatVariables {
|
|
8
9
|
constructor(extHostContext, _chatVariablesService) {
|
|
9
10
|
this._chatVariablesService = _chatVariablesService;
|
|
10
11
|
this._variables = ( new DisposableMap());
|
|
@@ -14,8 +15,8 @@ let MainThreadChatSlashCommands = class MainThreadChatSlashCommands {
|
|
|
14
15
|
this._variables.clearAndDisposeAll();
|
|
15
16
|
}
|
|
16
17
|
$registerVariable(handle, data) {
|
|
17
|
-
const registration = this._chatVariablesService.registerVariable(data, (messageText, _arg, _model, token) => {
|
|
18
|
-
return this._proxy.$resolveVariable(handle, messageText, token);
|
|
18
|
+
const registration = this._chatVariablesService.registerVariable(data, async (messageText, _arg, _model, token) => {
|
|
19
|
+
return revive(await this._proxy.$resolveVariable(handle, messageText, token));
|
|
19
20
|
});
|
|
20
21
|
this._variables.set(handle, registration);
|
|
21
22
|
}
|
|
@@ -23,9 +24,9 @@ let MainThreadChatSlashCommands = class MainThreadChatSlashCommands {
|
|
|
23
24
|
this._variables.deleteAndDispose(handle);
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
+
MainThreadChatVariables = __decorate([
|
|
27
28
|
extHostNamedCustomer(MainContext.MainThreadChatVariables),
|
|
28
29
|
( __param(1, IChatVariablesService))
|
|
29
|
-
],
|
|
30
|
+
], MainThreadChatVariables);
|
|
30
31
|
|
|
31
|
-
export {
|
|
32
|
+
export { MainThreadChatVariables };
|
|
@@ -6,6 +6,7 @@ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCu
|
|
|
6
6
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
7
7
|
import { SerializableObjectWithBuffers } from 'vscode/vscode/vs/workbench/services/extensions/common/proxyIdentifier';
|
|
8
8
|
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
9
|
+
import { isString } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
9
10
|
|
|
10
11
|
let MainThreadCommands = class MainThreadCommands {
|
|
11
12
|
constructor(extHostContext, _commandService, _extensionService) {
|
|
@@ -20,11 +21,11 @@ let MainThreadCommands = class MainThreadCommands {
|
|
|
20
21
|
this._generateCommandsDocumentationRegistration.dispose();
|
|
21
22
|
}
|
|
22
23
|
async _generateCommandsDocumentation() {
|
|
23
|
-
const result = await this._proxy.$
|
|
24
|
+
const result = await this._proxy.$getContributedCommandMetadata();
|
|
24
25
|
const commands = CommandsRegistry.getCommands();
|
|
25
26
|
for (const [id, command] of commands) {
|
|
26
|
-
if (command.
|
|
27
|
-
result[id] = command.
|
|
27
|
+
if (command.metadata) {
|
|
28
|
+
result[id] = command.metadata;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
const all = [];
|
|
@@ -76,7 +77,10 @@ function _generateMarkdown(description) {
|
|
|
76
77
|
return description;
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
79
|
-
const
|
|
80
|
+
const descriptionString = isString(description.description)
|
|
81
|
+
? description.description
|
|
82
|
+
: description.description.original;
|
|
83
|
+
const parts = [descriptionString];
|
|
80
84
|
parts.push('\n\n');
|
|
81
85
|
if (description.args) {
|
|
82
86
|
for (const arg of description.args) {
|
|
@@ -8,7 +8,7 @@ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCu
|
|
|
8
8
|
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
|
|
9
9
|
import { CommentsPanel } from '../../contrib/comments/browser/commentsView.js';
|
|
10
10
|
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
11
|
-
import { COMMENTS_VIEW_ID, COMMENTS_VIEW_TITLE,
|
|
11
|
+
import { COMMENTS_VIEW_ID, COMMENTS_VIEW_TITLE, COMMENTS_VIEW_STORAGE_ID } from '../../contrib/comments/browser/commentsTreeViewer.js';
|
|
12
12
|
import { IViewsService, IViewDescriptorService, Extensions } from 'vscode/vscode/vs/workbench/common/views';
|
|
13
13
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
14
14
|
import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
@@ -358,7 +358,7 @@ class MainThreadCommentController {
|
|
|
358
358
|
return ret;
|
|
359
359
|
}
|
|
360
360
|
createCommentThreadTemplate(resource, range) {
|
|
361
|
-
this._proxy.$createCommentThreadTemplate(this.handle, resource, range);
|
|
361
|
+
return this._proxy.$createCommentThreadTemplate(this.handle, resource, range);
|
|
362
362
|
}
|
|
363
363
|
async updateCommentThreadTemplate(threadHandle, range) {
|
|
364
364
|
await this._proxy.$updateCommentThreadTemplate(this.handle, threadHandle, range);
|
|
@@ -399,7 +399,7 @@ let MainThreadComments = class MainThreadComments extends Disposable {
|
|
|
399
399
|
}));
|
|
400
400
|
}
|
|
401
401
|
$registerCommentController(handle, id, label, extensionId) {
|
|
402
|
-
const providerId = `${
|
|
402
|
+
const providerId = `${id}-${extensionId}`;
|
|
403
403
|
this._handlers.set(handle, providerId);
|
|
404
404
|
const provider = ( new MainThreadCommentController(this._proxy, this._commentService, handle, providerId, id, label, {}));
|
|
405
405
|
this._commentService.registerCommentController(providerId, provider);
|
|
@@ -461,7 +461,7 @@ let MainThreadComments = class MainThreadComments extends Disposable {
|
|
|
461
461
|
if (!commentsViewAlreadyRegistered) {
|
|
462
462
|
const VIEW_CONTAINER = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
|
|
463
463
|
id: COMMENTS_VIEW_ID,
|
|
464
|
-
title:
|
|
464
|
+
title: COMMENTS_VIEW_TITLE,
|
|
465
465
|
ctorDescriptor: ( new SyncDescriptor(
|
|
466
466
|
ViewPaneContainer,
|
|
467
467
|
[COMMENTS_VIEW_ID, { mergeViewWithContainerWhenSingleView: true }]
|
|
@@ -13,7 +13,7 @@ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/service
|
|
|
13
13
|
import { extUri, toLocalResource } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
14
14
|
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService';
|
|
15
15
|
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
16
|
-
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
16
|
+
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
17
17
|
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
18
18
|
import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
19
19
|
import { ErrorNoTelemetry } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
@@ -222,15 +222,19 @@ let MainThreadDocuments = class MainThreadDocuments extends Disposable {
|
|
|
222
222
|
return await this._doCreateUntitled(Boolean(uri.path) ? uri : undefined);
|
|
223
223
|
}
|
|
224
224
|
async _doCreateUntitled(associatedResource, languageId, initialValue) {
|
|
225
|
-
const model =
|
|
225
|
+
const model = this._textFileService.untitled.create({
|
|
226
226
|
associatedResource,
|
|
227
227
|
languageId,
|
|
228
228
|
initialValue
|
|
229
229
|
});
|
|
230
230
|
const resource = model.resource;
|
|
231
|
+
const ref = await this._textModelResolverService.createModelReference(resource);
|
|
231
232
|
if (!( this._modelTrackers.has(resource))) {
|
|
233
|
+
ref.dispose();
|
|
232
234
|
throw new Error(`expected URI ${resource.toString()} to have come to LIFE`);
|
|
233
235
|
}
|
|
236
|
+
this._modelReferenceCollection.add(resource, ref, ref.object.textEditorModel.getValueLength());
|
|
237
|
+
Event.once(model.onDidRevert)(() => this._modelReferenceCollection.remove(resource));
|
|
234
238
|
this._proxy.$acceptDirtyStateChanged(resource, true);
|
|
235
239
|
return resource;
|
|
236
240
|
}
|