@codingame/monaco-vscode-extensions-service-override 1.85.0 → 1.85.2
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 +3 -3
- package/package.json +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +8 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +2 -2
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +1 -1
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +0 -141
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +0 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +0 -342
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +0 -1197
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +0 -117
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +0 -83
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +0 -543
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +0 -292
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +0 -169
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +0 -255
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +0 -195
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +0 -260
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +0 -26
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +0 -63
- package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +0 -51
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +0 -649
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +0 -302
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +0 -62
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +0 -251
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +0 -109
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +0 -335
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +0 -101
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +0 -57
- package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +0 -3
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +0 -144
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +0 -482
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +0 -92
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +0 -56
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +0 -110
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +0 -260
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +0 -616
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +0 -309
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +0 -38
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +0 -167
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +0 -80
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +0 -70
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +0 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -108
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +0 -506
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +0 -132
- package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +0 -79
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { asArray } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
2
|
-
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
-
import { isMarkdownString, MarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
4
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
-
import { basename } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
6
|
-
|
|
7
|
-
class ChatRequestModel {
|
|
8
|
-
static { this.nextId = 0; }
|
|
9
|
-
get id() {
|
|
10
|
-
return this._id;
|
|
11
|
-
}
|
|
12
|
-
get username() {
|
|
13
|
-
return this.session.requesterUsername;
|
|
14
|
-
}
|
|
15
|
-
get avatarIconUri() {
|
|
16
|
-
return this.session.requesterAvatarIconUri;
|
|
17
|
-
}
|
|
18
|
-
constructor(session, message) {
|
|
19
|
-
this.session = session;
|
|
20
|
-
this.message = message;
|
|
21
|
-
this._id = 'request_' + ChatRequestModel.nextId++;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
class Response {
|
|
25
|
-
get onDidChangeValue() {
|
|
26
|
-
return this._onDidChangeValue.event;
|
|
27
|
-
}
|
|
28
|
-
get value() {
|
|
29
|
-
return this._responseParts;
|
|
30
|
-
}
|
|
31
|
-
constructor(value) {
|
|
32
|
-
this._onDidChangeValue = ( new Emitter());
|
|
33
|
-
this._responseParts = ( asArray(value).map((v) => (isMarkdownString(v) ?
|
|
34
|
-
{ content: v, kind: 'markdownContent' } :
|
|
35
|
-
'kind' in v ? v : { kind: 'treeData', treeData: v })));
|
|
36
|
-
this._updateRepr(true);
|
|
37
|
-
}
|
|
38
|
-
asString() {
|
|
39
|
-
return this._responseRepr;
|
|
40
|
-
}
|
|
41
|
-
clear() {
|
|
42
|
-
this._responseParts = [];
|
|
43
|
-
this._updateRepr(true);
|
|
44
|
-
}
|
|
45
|
-
updateContent(progress, quiet) {
|
|
46
|
-
if (progress.kind === 'content' || progress.kind === 'markdownContent') {
|
|
47
|
-
const responsePartLength = this._responseParts.length - 1;
|
|
48
|
-
const lastResponsePart = this._responseParts[responsePartLength];
|
|
49
|
-
if (!lastResponsePart || lastResponsePart.kind !== 'markdownContent') {
|
|
50
|
-
if (progress.kind === 'content') {
|
|
51
|
-
this._responseParts.push({ content: ( new MarkdownString(progress.content)), kind: 'markdownContent' });
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
this._responseParts.push(progress);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else if (progress.kind === 'markdownContent') {
|
|
58
|
-
const lastPartEnabledCommands = typeof lastResponsePart.content.isTrusted === 'object' ?
|
|
59
|
-
lastResponsePart.content.isTrusted.enabledCommands :
|
|
60
|
-
[];
|
|
61
|
-
const thisPartEnabledCommands = typeof progress.content.isTrusted === 'object' ?
|
|
62
|
-
progress.content.isTrusted.enabledCommands :
|
|
63
|
-
[];
|
|
64
|
-
const enabledCommands = [...lastPartEnabledCommands, ...thisPartEnabledCommands];
|
|
65
|
-
this._responseParts[responsePartLength] = { content: ( new MarkdownString(
|
|
66
|
-
lastResponsePart.content.value + progress.content.value,
|
|
67
|
-
{ isTrusted: { enabledCommands } }
|
|
68
|
-
)), kind: 'markdownContent' };
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this._responseParts[responsePartLength] = { content: ( new MarkdownString(
|
|
72
|
-
lastResponsePart.content.value + progress.content,
|
|
73
|
-
lastResponsePart.content
|
|
74
|
-
)), kind: 'markdownContent' };
|
|
75
|
-
}
|
|
76
|
-
this._updateRepr(quiet);
|
|
77
|
-
}
|
|
78
|
-
else if (progress.kind === 'asyncContent') {
|
|
79
|
-
const responsePosition = this._responseParts.push(progress) - 1;
|
|
80
|
-
this._updateRepr(quiet);
|
|
81
|
-
progress.resolvedContent?.then((content) => {
|
|
82
|
-
if (typeof content === 'string') {
|
|
83
|
-
this._responseParts[responsePosition] = { content: ( new MarkdownString(content)), kind: 'markdownContent' };
|
|
84
|
-
}
|
|
85
|
-
else if (isMarkdownString(content)) {
|
|
86
|
-
this._responseParts[responsePosition] = { content, kind: 'markdownContent' };
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
this._responseParts[responsePosition] = content;
|
|
90
|
-
}
|
|
91
|
-
this._updateRepr(quiet);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
else if (progress.kind === 'treeData' || progress.kind === 'inlineReference' || progress.kind === 'markdownVuln') {
|
|
95
|
-
this._responseParts.push(progress);
|
|
96
|
-
this._updateRepr(quiet);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
_updateRepr(quiet) {
|
|
100
|
-
this._responseRepr = ( this._responseParts.map(part => {
|
|
101
|
-
if (part.kind === 'treeData') {
|
|
102
|
-
return '';
|
|
103
|
-
}
|
|
104
|
-
else if (part.kind === 'inlineReference') {
|
|
105
|
-
return basename('uri' in part.inlineReference ? part.inlineReference.uri : part.inlineReference);
|
|
106
|
-
}
|
|
107
|
-
else if (part.kind === 'asyncContent') {
|
|
108
|
-
return part.content;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
return part.content.value;
|
|
112
|
-
}
|
|
113
|
-
})).join('\n\n');
|
|
114
|
-
if (!quiet) {
|
|
115
|
-
this._onDidChangeValue.fire();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
class ChatResponseModel extends Disposable {
|
|
120
|
-
static { this.nextId = 0; }
|
|
121
|
-
get id() {
|
|
122
|
-
return this._id;
|
|
123
|
-
}
|
|
124
|
-
get isComplete() {
|
|
125
|
-
return this._isComplete;
|
|
126
|
-
}
|
|
127
|
-
get isCanceled() {
|
|
128
|
-
return this._isCanceled;
|
|
129
|
-
}
|
|
130
|
-
get vote() {
|
|
131
|
-
return this._vote;
|
|
132
|
-
}
|
|
133
|
-
get followups() {
|
|
134
|
-
return this._followups;
|
|
135
|
-
}
|
|
136
|
-
get response() {
|
|
137
|
-
return this._response;
|
|
138
|
-
}
|
|
139
|
-
get errorDetails() {
|
|
140
|
-
return this._errorDetails;
|
|
141
|
-
}
|
|
142
|
-
get providerId() {
|
|
143
|
-
return this.session.providerId;
|
|
144
|
-
}
|
|
145
|
-
get username() {
|
|
146
|
-
return this.session.responderUsername;
|
|
147
|
-
}
|
|
148
|
-
get avatarIconUri() {
|
|
149
|
-
return this.session.responderAvatarIconUri;
|
|
150
|
-
}
|
|
151
|
-
get agent() {
|
|
152
|
-
return this._agent;
|
|
153
|
-
}
|
|
154
|
-
get slashCommand() {
|
|
155
|
-
return this._slashCommand;
|
|
156
|
-
}
|
|
157
|
-
get usedContext() {
|
|
158
|
-
return this._usedContext;
|
|
159
|
-
}
|
|
160
|
-
get contentReferences() {
|
|
161
|
-
return this._contentReferences;
|
|
162
|
-
}
|
|
163
|
-
get progressMessages() {
|
|
164
|
-
return this._progressMessages;
|
|
165
|
-
}
|
|
166
|
-
constructor(_response, session, agent, requestId, _isComplete = false, _isCanceled = false, _vote, _errorDetails, followups) {
|
|
167
|
-
super();
|
|
168
|
-
this.session = session;
|
|
169
|
-
this.requestId = requestId;
|
|
170
|
-
this._isComplete = _isComplete;
|
|
171
|
-
this._isCanceled = _isCanceled;
|
|
172
|
-
this._vote = _vote;
|
|
173
|
-
this._errorDetails = _errorDetails;
|
|
174
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
175
|
-
this.onDidChange = this._onDidChange.event;
|
|
176
|
-
this._contentReferences = [];
|
|
177
|
-
this._progressMessages = [];
|
|
178
|
-
this._agent = agent;
|
|
179
|
-
this._followups = followups ? [...followups] : undefined;
|
|
180
|
-
this._response = ( new Response(_response));
|
|
181
|
-
this._register(this._response.onDidChangeValue(() => this._onDidChange.fire()));
|
|
182
|
-
this._id = 'response_' + ChatResponseModel.nextId++;
|
|
183
|
-
}
|
|
184
|
-
updateContent(responsePart, quiet) {
|
|
185
|
-
this._response.updateContent(responsePart, quiet);
|
|
186
|
-
}
|
|
187
|
-
applyProgress(progress) {
|
|
188
|
-
if (progress.kind === 'usedContext') {
|
|
189
|
-
this._usedContext = progress;
|
|
190
|
-
}
|
|
191
|
-
else if (progress.kind === 'reference') {
|
|
192
|
-
this._contentReferences.push(progress);
|
|
193
|
-
this._onDidChange.fire();
|
|
194
|
-
}
|
|
195
|
-
else if (progress.kind === 'progressMessage') {
|
|
196
|
-
this._progressMessages.push(progress);
|
|
197
|
-
this._onDidChange.fire();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
setAgent(agent, slashCommand) {
|
|
201
|
-
this._agent = agent;
|
|
202
|
-
this._slashCommand = slashCommand;
|
|
203
|
-
this._onDidChange.fire();
|
|
204
|
-
}
|
|
205
|
-
setErrorDetails(errorDetails) {
|
|
206
|
-
this._errorDetails = errorDetails;
|
|
207
|
-
this._onDidChange.fire();
|
|
208
|
-
}
|
|
209
|
-
complete(errorDetails) {
|
|
210
|
-
if (errorDetails?.responseIsRedacted) {
|
|
211
|
-
this._response.clear();
|
|
212
|
-
}
|
|
213
|
-
this._isComplete = true;
|
|
214
|
-
this._onDidChange.fire();
|
|
215
|
-
}
|
|
216
|
-
cancel() {
|
|
217
|
-
this._isComplete = true;
|
|
218
|
-
this._isCanceled = true;
|
|
219
|
-
this._onDidChange.fire();
|
|
220
|
-
}
|
|
221
|
-
setFollowups(followups) {
|
|
222
|
-
this._followups = followups;
|
|
223
|
-
this._onDidChange.fire();
|
|
224
|
-
}
|
|
225
|
-
setVote(vote) {
|
|
226
|
-
this._vote = vote;
|
|
227
|
-
this._onDidChange.fire();
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
var ChatModelInitState;
|
|
231
|
-
( (function(ChatModelInitState) {
|
|
232
|
-
ChatModelInitState[ChatModelInitState["Created"] = 0] = "Created";
|
|
233
|
-
ChatModelInitState[ChatModelInitState["Initializing"] = 1] = "Initializing";
|
|
234
|
-
ChatModelInitState[ChatModelInitState["Initialized"] = 2] = "Initialized";
|
|
235
|
-
})(ChatModelInitState || (ChatModelInitState = {})));
|
|
236
|
-
class ChatWelcomeMessageModel {
|
|
237
|
-
static { this.nextId = 0; }
|
|
238
|
-
get id() {
|
|
239
|
-
return this._id;
|
|
240
|
-
}
|
|
241
|
-
constructor(session, content, sampleQuestions) {
|
|
242
|
-
this.session = session;
|
|
243
|
-
this.content = content;
|
|
244
|
-
this.sampleQuestions = sampleQuestions;
|
|
245
|
-
this._id = 'welcome_' + ChatWelcomeMessageModel.nextId++;
|
|
246
|
-
}
|
|
247
|
-
get username() {
|
|
248
|
-
return this.session.responderUsername;
|
|
249
|
-
}
|
|
250
|
-
get avatarIconUri() {
|
|
251
|
-
return this.session.responderAvatarIconUri;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export { ChatModelInitState, ChatRequestModel, ChatResponseModel, ChatWelcomeMessageModel, Response };
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
3
|
-
import { OffsetRange } from 'monaco-editor/esm/vs/editor/common/core/offsetRange.js';
|
|
4
|
-
import { Position } from 'monaco-editor/esm/vs/editor/common/core/position.js';
|
|
5
|
-
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
6
|
-
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
7
|
-
import { chatVariableLeader, chatAgentLeader, chatSubcommandLeader, ChatRequestTextPart, ChatRequestAgentPart, ChatRequestVariablePart, ChatRequestSlashCommandPart, ChatRequestAgentSubcommandPart, ChatRequestDynamicVariablePart } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
8
|
-
import { IChatSlashCommandService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatSlashCommands';
|
|
9
|
-
import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables';
|
|
10
|
-
|
|
11
|
-
const agentReg = /^@([\w_\-]+)(?=(\s|$|\b))/i;
|
|
12
|
-
const variableReg = /^#([\w_\-]+)(:\d+)?(?=(\s|$|\b))/i;
|
|
13
|
-
const slashReg = /\/([\w_\-]+)(?=(\s|$|\b))/i;
|
|
14
|
-
let ChatRequestParser = class ChatRequestParser {
|
|
15
|
-
constructor(agentService, variableService, slashCommandService) {
|
|
16
|
-
this.agentService = agentService;
|
|
17
|
-
this.variableService = variableService;
|
|
18
|
-
this.slashCommandService = slashCommandService;
|
|
19
|
-
}
|
|
20
|
-
async parseChatRequest(sessionId, message) {
|
|
21
|
-
const parts = [];
|
|
22
|
-
const references = this.variableService.getDynamicVariables(sessionId);
|
|
23
|
-
let lineNumber = 1;
|
|
24
|
-
let column = 1;
|
|
25
|
-
for (let i = 0; i < message.length; i++) {
|
|
26
|
-
const previousChar = message.charAt(i - 1);
|
|
27
|
-
const char = message.charAt(i);
|
|
28
|
-
let newPart;
|
|
29
|
-
if (previousChar.match(/\s/) || i === 0) {
|
|
30
|
-
if (char === chatVariableLeader) {
|
|
31
|
-
newPart = this.tryToParseVariable(message.slice(i), i, ( new Position(lineNumber, column)), parts);
|
|
32
|
-
}
|
|
33
|
-
else if (char === chatAgentLeader) {
|
|
34
|
-
newPart = this.tryToParseAgent(message.slice(i), message, i, ( new Position(lineNumber, column)), parts);
|
|
35
|
-
}
|
|
36
|
-
else if (char === chatSubcommandLeader) {
|
|
37
|
-
newPart = await this.tryToParseSlashCommand(sessionId, message.slice(i), message, i, ( new Position(lineNumber, column)), parts);
|
|
38
|
-
}
|
|
39
|
-
if (!newPart) {
|
|
40
|
-
newPart = this.tryToParseDynamicVariable(message.slice(i), i, ( new Position(lineNumber, column)), references);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (newPart) {
|
|
44
|
-
if (i !== 0) {
|
|
45
|
-
const previousPart = parts.at(-1);
|
|
46
|
-
const previousPartEnd = previousPart?.range.endExclusive ?? 0;
|
|
47
|
-
const previousPartEditorRangeEndLine = previousPart?.editorRange.endLineNumber ?? 1;
|
|
48
|
-
const previousPartEditorRangeEndCol = previousPart?.editorRange.endColumn ?? 1;
|
|
49
|
-
parts.push(( new ChatRequestTextPart(( new OffsetRange(previousPartEnd, i)), ( new Range(
|
|
50
|
-
previousPartEditorRangeEndLine,
|
|
51
|
-
previousPartEditorRangeEndCol,
|
|
52
|
-
lineNumber,
|
|
53
|
-
column
|
|
54
|
-
)), message.slice(previousPartEnd, i))));
|
|
55
|
-
}
|
|
56
|
-
parts.push(newPart);
|
|
57
|
-
}
|
|
58
|
-
if (char === '\n') {
|
|
59
|
-
lineNumber++;
|
|
60
|
-
column = 1;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
column++;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const lastPart = parts.at(-1);
|
|
67
|
-
const lastPartEnd = lastPart?.range.endExclusive ?? 0;
|
|
68
|
-
if (lastPartEnd < message.length) {
|
|
69
|
-
parts.push(( new ChatRequestTextPart(( new OffsetRange(lastPartEnd, message.length)), ( new Range(
|
|
70
|
-
lastPart?.editorRange.endLineNumber ?? 1,
|
|
71
|
-
lastPart?.editorRange.endColumn ?? 1,
|
|
72
|
-
lineNumber,
|
|
73
|
-
column
|
|
74
|
-
)), message.slice(lastPartEnd, message.length))));
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
parts,
|
|
78
|
-
text: message,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
tryToParseAgent(message, fullMessage, offset, position, parts) {
|
|
82
|
-
const nextVariableMatch = message.match(agentReg);
|
|
83
|
-
if (!nextVariableMatch) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const [full, name] = nextVariableMatch;
|
|
87
|
-
const varRange = ( new OffsetRange(offset, offset + full.length));
|
|
88
|
-
const varEditorRange = ( new Range(
|
|
89
|
-
position.lineNumber,
|
|
90
|
-
position.column,
|
|
91
|
-
position.lineNumber,
|
|
92
|
-
position.column + full.length
|
|
93
|
-
));
|
|
94
|
-
const agent = this.agentService.getAgent(name);
|
|
95
|
-
if (!agent) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (( parts.some(p => p instanceof ChatRequestAgentPart))) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (( parts.some(
|
|
102
|
-
p => (p instanceof ChatRequestTextPart && p.text.trim() !== '') || !(p instanceof ChatRequestAgentPart)
|
|
103
|
-
))) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const previousPart = parts.at(-1);
|
|
107
|
-
const previousPartEnd = previousPart?.range.endExclusive ?? 0;
|
|
108
|
-
const textSincePreviousPart = fullMessage.slice(previousPartEnd, offset);
|
|
109
|
-
if (textSincePreviousPart.trim() !== '') {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
return ( new ChatRequestAgentPart(varRange, varEditorRange, agent));
|
|
113
|
-
}
|
|
114
|
-
tryToParseVariable(message, offset, position, parts) {
|
|
115
|
-
const nextVariableMatch = message.match(variableReg);
|
|
116
|
-
if (!nextVariableMatch) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const [full, name] = nextVariableMatch;
|
|
120
|
-
const variableArg = nextVariableMatch[2] ?? '';
|
|
121
|
-
const varRange = ( new OffsetRange(offset, offset + full.length));
|
|
122
|
-
const varEditorRange = ( new Range(
|
|
123
|
-
position.lineNumber,
|
|
124
|
-
position.column,
|
|
125
|
-
position.lineNumber,
|
|
126
|
-
position.column + full.length
|
|
127
|
-
));
|
|
128
|
-
if (this.variableService.hasVariable(name)) {
|
|
129
|
-
return ( new ChatRequestVariablePart(varRange, varEditorRange, name, variableArg));
|
|
130
|
-
}
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
async tryToParseSlashCommand(sessionId, remainingMessage, fullMessage, offset, position, parts) {
|
|
134
|
-
const nextSlashMatch = remainingMessage.match(slashReg);
|
|
135
|
-
if (!nextSlashMatch) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (( parts.some(p => p instanceof ChatRequestSlashCommandPart))) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const [full, command] = nextSlashMatch;
|
|
142
|
-
const slashRange = ( new OffsetRange(offset, offset + full.length));
|
|
143
|
-
const slashEditorRange = ( new Range(
|
|
144
|
-
position.lineNumber,
|
|
145
|
-
position.column,
|
|
146
|
-
position.lineNumber,
|
|
147
|
-
position.column + full.length
|
|
148
|
-
));
|
|
149
|
-
const usedAgent = parts.find((p) => p instanceof ChatRequestAgentPart);
|
|
150
|
-
if (usedAgent) {
|
|
151
|
-
if (( parts.some(
|
|
152
|
-
p => (p instanceof ChatRequestTextPart && p.text.trim() !== '') || !(p instanceof ChatRequestAgentPart) && !(p instanceof ChatRequestTextPart)
|
|
153
|
-
))) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const previousPart = parts.at(-1);
|
|
157
|
-
const previousPartEnd = previousPart?.range.endExclusive ?? 0;
|
|
158
|
-
const textSincePreviousPart = fullMessage.slice(previousPartEnd, offset);
|
|
159
|
-
if (textSincePreviousPart.trim() !== '') {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const subCommands = await usedAgent.agent.provideSlashCommands(CancellationToken.None);
|
|
163
|
-
const subCommand = subCommands.find(c => c.name === command);
|
|
164
|
-
if (subCommand) {
|
|
165
|
-
return ( new ChatRequestAgentSubcommandPart(slashRange, slashEditorRange, subCommand));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
const slashCommands = this.slashCommandService.getCommands();
|
|
170
|
-
const slashCommand = slashCommands.find(c => c.command === command);
|
|
171
|
-
if (slashCommand) {
|
|
172
|
-
return ( new ChatRequestSlashCommandPart(slashRange, slashEditorRange, slashCommand));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
tryToParseDynamicVariable(message, offset, position, references) {
|
|
178
|
-
const refAtThisPosition = references.find(r => r.range.startLineNumber === position.lineNumber &&
|
|
179
|
-
r.range.startColumn === position.column);
|
|
180
|
-
if (refAtThisPosition) {
|
|
181
|
-
const length = refAtThisPosition.range.endColumn - refAtThisPosition.range.startColumn;
|
|
182
|
-
const text = message.substring(0, length);
|
|
183
|
-
const range = ( new OffsetRange(offset, offset + length));
|
|
184
|
-
return ( new ChatRequestDynamicVariablePart(range, refAtThisPosition.range, text, refAtThisPosition.data));
|
|
185
|
-
}
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
ChatRequestParser = ( __decorate([
|
|
190
|
-
( __param(0, IChatAgentService)),
|
|
191
|
-
( __param(1, IChatVariablesService)),
|
|
192
|
-
( __param(2, IChatSlashCommandService))
|
|
193
|
-
], ChatRequestParser));
|
|
194
|
-
|
|
195
|
-
export { ChatRequestParser };
|