@codingame/monaco-vscode-chat-service-override 7.0.11 → 7.1.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/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +86 -91
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +5 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +205 -115
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +61 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +4 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +10 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +10 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +24 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.js +29 -108
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +76 -67
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +9 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatContextAttachments.js +9 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +17 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +28 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +2 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +17 -55
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +54 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +3 -4
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelToolsService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +60 -25
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +6 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +6 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +24 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +9 -12
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +4 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +0 -17
|
@@ -26,7 +26,7 @@ let ChatAccessibilityService = class ChatAccessibilityService extends Disposable
|
|
|
26
26
|
acceptResponse(response, requestId) {
|
|
27
27
|
this._pendingSignalMap.deleteAndDispose(requestId);
|
|
28
28
|
const isPanelChat = typeof response !== 'string';
|
|
29
|
-
const responseContent = typeof response === 'string' ? response : response?.response.
|
|
29
|
+
const responseContent = typeof response === 'string' ? response : response?.response.toString();
|
|
30
30
|
this._accessibilitySignalService.playSignal(AccessibilitySignal.chatResponseReceived, { allowManyInParallel: true });
|
|
31
31
|
if (!response || !responseContent) {
|
|
32
32
|
return;
|
|
@@ -21,7 +21,7 @@ import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/edit
|
|
|
21
21
|
import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
|
|
22
22
|
import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
23
23
|
import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
24
|
-
import { clearChatEditor } from '
|
|
24
|
+
import { clearChatEditor } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatClear';
|
|
25
25
|
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
26
26
|
import { CHAT_PROVIDER_ID } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
|
|
27
27
|
|
|
@@ -36,11 +36,13 @@ let ChatEditor = class ChatEditor extends EditorPane {
|
|
|
36
36
|
this.contextKeyService = contextKeyService;
|
|
37
37
|
}
|
|
38
38
|
async clear() {
|
|
39
|
-
|
|
39
|
+
if (this.input) {
|
|
40
|
+
return this.instantiationService.invokeFunction(clearChatEditor, this.input);
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
createEditor(parent) {
|
|
42
44
|
this._scopedContextKeyService = this._register(this.contextKeyService.createScoped(parent));
|
|
43
|
-
const scopedInstantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService])));
|
|
45
|
+
const scopedInstantiationService = this._register(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService]))));
|
|
44
46
|
this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, { resource: true }, { supportsFileReferences: true }, {
|
|
45
47
|
listForeground: editorForeground,
|
|
46
48
|
listBackground: editorBackground,
|
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
|
-
import { AmbiguousCharacters, InvisibleCharacters } from 'vscode/vscode/vs/base/common/strings';
|
|
4
3
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
4
|
+
import { DisposableMap, DisposableStore, Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { AmbiguousCharacters, InvisibleCharacters } from 'vscode/vscode/vs/base/common/strings';
|
|
6
|
+
import { localize, localize2 } from 'vscode/vscode/vs/nls';
|
|
9
7
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
10
8
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
11
|
-
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
12
9
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
13
10
|
import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
14
11
|
import { Extensions, ViewContainerLocation } from 'vscode/vscode/vs/workbench/common/views';
|
|
15
12
|
import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
16
|
-
import {
|
|
13
|
+
import { CHAT_SIDEBAR_PANEL_ID, ChatViewPane } from './chatViewPane.js';
|
|
17
14
|
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
18
15
|
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
19
16
|
import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
20
17
|
import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
21
|
-
import 'vscode/vscode/vs/platform/notification/common/notification';
|
|
22
|
-
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
23
|
-
import { Action } from 'vscode/vscode/vs/base/common/actions';
|
|
24
|
-
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
25
|
-
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
26
18
|
|
|
27
|
-
const _moduleId = "vs/workbench/contrib/chat/browser/chatParticipantContributions";
|
|
28
19
|
const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
29
20
|
extensionPoint: 'chatParticipants',
|
|
30
21
|
jsonSchema: {
|
|
31
|
-
description: (
|
|
22
|
+
description: ( localize(7273, 'Contributes a chat participant')),
|
|
32
23
|
type: 'array',
|
|
33
24
|
items: {
|
|
34
25
|
additionalProperties: false,
|
|
@@ -37,55 +28,50 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
37
28
|
required: ['name', 'id'],
|
|
38
29
|
properties: {
|
|
39
30
|
id: {
|
|
40
|
-
description: (
|
|
31
|
+
description: ( localize(7274, "A unique id for this chat participant.")),
|
|
41
32
|
type: 'string'
|
|
42
33
|
},
|
|
43
34
|
name: {
|
|
44
|
-
description: (
|
|
45
|
-
|
|
46
|
-
2,
|
|
35
|
+
description: ( localize(
|
|
36
|
+
7275,
|
|
47
37
|
"User-facing name for this chat participant. The user will use '@' with this name to invoke the participant. Name must not contain whitespace."
|
|
48
38
|
)),
|
|
49
39
|
type: 'string',
|
|
50
40
|
pattern: '^[\\w0-9_-]+$'
|
|
51
41
|
},
|
|
52
42
|
fullName: {
|
|
53
|
-
markdownDescription: (
|
|
54
|
-
|
|
55
|
-
3,
|
|
43
|
+
markdownDescription: ( localize(
|
|
44
|
+
7276,
|
|
56
45
|
"The full name of this chat participant, which is shown as the label for responses coming from this participant. If not provided, {0} is used.",
|
|
57
46
|
'`name`'
|
|
58
47
|
)),
|
|
59
48
|
type: 'string'
|
|
60
49
|
},
|
|
61
50
|
description: {
|
|
62
|
-
description: (
|
|
51
|
+
description: ( localize(7277, "A description of this chat participant, shown in the UI.")),
|
|
63
52
|
type: 'string'
|
|
64
53
|
},
|
|
65
54
|
isSticky: {
|
|
66
|
-
description: (
|
|
67
|
-
|
|
68
|
-
5,
|
|
55
|
+
description: ( localize(
|
|
56
|
+
7278,
|
|
69
57
|
"Whether invoking the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message."
|
|
70
58
|
)),
|
|
71
59
|
type: 'boolean'
|
|
72
60
|
},
|
|
73
61
|
sampleRequest: {
|
|
74
|
-
description: (
|
|
75
|
-
|
|
76
|
-
6,
|
|
62
|
+
description: ( localize(
|
|
63
|
+
7279,
|
|
77
64
|
"When the user clicks this participant in `/help`, this text will be submitted to the participant."
|
|
78
65
|
)),
|
|
79
66
|
type: 'string'
|
|
80
67
|
},
|
|
81
68
|
when: {
|
|
82
|
-
description: (
|
|
69
|
+
description: ( localize(7280, "A condition which must be true to enable this participant.")),
|
|
83
70
|
type: 'string'
|
|
84
71
|
},
|
|
85
72
|
commands: {
|
|
86
|
-
markdownDescription: (
|
|
87
|
-
|
|
88
|
-
8,
|
|
73
|
+
markdownDescription: ( localize(
|
|
74
|
+
7281,
|
|
89
75
|
"Commands available for this chat participant, which the user can invoke with a `/`."
|
|
90
76
|
)),
|
|
91
77
|
type: 'array',
|
|
@@ -96,33 +82,30 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
96
82
|
required: ['name'],
|
|
97
83
|
properties: {
|
|
98
84
|
name: {
|
|
99
|
-
description: (
|
|
100
|
-
|
|
101
|
-
9,
|
|
85
|
+
description: ( localize(
|
|
86
|
+
7282,
|
|
102
87
|
"A short name by which this command is referred to in the UI, e.g. `fix` or * `explain` for commands that fix an issue or explain code. The name should be unique among the commands provided by this participant."
|
|
103
88
|
)),
|
|
104
89
|
type: 'string'
|
|
105
90
|
},
|
|
106
91
|
description: {
|
|
107
|
-
description: (
|
|
92
|
+
description: ( localize(7283, "A description of this command.")),
|
|
108
93
|
type: 'string'
|
|
109
94
|
},
|
|
110
95
|
when: {
|
|
111
|
-
description: (
|
|
96
|
+
description: ( localize(7284, "A condition which must be true to enable this command.")),
|
|
112
97
|
type: 'string'
|
|
113
98
|
},
|
|
114
99
|
sampleRequest: {
|
|
115
|
-
description: (
|
|
116
|
-
|
|
117
|
-
12,
|
|
100
|
+
description: ( localize(
|
|
101
|
+
7285,
|
|
118
102
|
"When the user clicks this command in `/help`, this text will be submitted to the participant."
|
|
119
103
|
)),
|
|
120
104
|
type: 'string'
|
|
121
105
|
},
|
|
122
106
|
isSticky: {
|
|
123
|
-
description: (
|
|
124
|
-
|
|
125
|
-
5,
|
|
107
|
+
description: ( localize(
|
|
108
|
+
7285,
|
|
126
109
|
"Whether invoking the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message."
|
|
127
110
|
)),
|
|
128
111
|
type: 'boolean'
|
|
@@ -141,74 +124,17 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
141
124
|
});
|
|
142
125
|
let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
143
126
|
static { this.ID = 'workbench.contrib.chatExtensionPointHandler'; }
|
|
144
|
-
constructor(_chatAgentService,
|
|
127
|
+
constructor(_chatAgentService, logService) {
|
|
145
128
|
this._chatAgentService = _chatAgentService;
|
|
146
|
-
this.productService = productService;
|
|
147
|
-
this.contextService = contextService;
|
|
148
129
|
this.logService = logService;
|
|
149
|
-
this.notificationService = notificationService;
|
|
150
|
-
this.commandService = commandService;
|
|
151
|
-
this.disposables = ( (new DisposableStore()));
|
|
152
130
|
this._participantRegistrationDisposables = ( (new DisposableMap()));
|
|
153
131
|
this.hasRegisteredDefaultParticipantView = false;
|
|
154
132
|
this._viewContainer = this.registerViewContainer();
|
|
155
|
-
this.registerListeners();
|
|
156
133
|
this.handleAndRegisterChatExtensions();
|
|
157
134
|
}
|
|
158
|
-
registerListeners() {
|
|
159
|
-
this.contextService.onDidChangeContext(e => {
|
|
160
|
-
if (!this.productService.chatWelcomeView) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const showWelcomeViewConfigKey = 'workbench.chat.experimental.showWelcomeView';
|
|
164
|
-
const keys = ( (new Set([showWelcomeViewConfigKey])));
|
|
165
|
-
if (e.affectsSome(keys)) {
|
|
166
|
-
const contextKeyExpr = ( (ContextKeyExpr.equals(showWelcomeViewConfigKey, true)));
|
|
167
|
-
const viewsRegistry = ( (Registry.as(Extensions.ViewsRegistry)));
|
|
168
|
-
if (this.contextService.contextMatchesRules(contextKeyExpr)) {
|
|
169
|
-
this._welcomeViewDescriptor = {
|
|
170
|
-
id: CHAT_VIEW_ID,
|
|
171
|
-
name: { original: this.productService.chatWelcomeView.welcomeViewTitle, value: this.productService.chatWelcomeView.welcomeViewTitle },
|
|
172
|
-
containerIcon: this._viewContainer.icon,
|
|
173
|
-
ctorDescriptor: ( (new SyncDescriptor(ChatViewPane))),
|
|
174
|
-
canToggleVisibility: false,
|
|
175
|
-
canMoveView: true,
|
|
176
|
-
order: 100
|
|
177
|
-
};
|
|
178
|
-
viewsRegistry.registerViews([this._welcomeViewDescriptor], this._viewContainer);
|
|
179
|
-
viewsRegistry.registerViewWelcomeContent(CHAT_VIEW_ID, {
|
|
180
|
-
content: this.productService.chatWelcomeView.welcomeViewContent,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
else if (this._welcomeViewDescriptor) {
|
|
184
|
-
viewsRegistry.deregisterViews([this._welcomeViewDescriptor], this._viewContainer);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}, null, this.disposables);
|
|
188
|
-
}
|
|
189
135
|
handleAndRegisterChatExtensions() {
|
|
190
136
|
chatParticipantExtensionPoint.setHandler((extensions, delta) => {
|
|
191
137
|
for (const extension of delta.added) {
|
|
192
|
-
if (( (extension.value.some(
|
|
193
|
-
participant => participant.id === 'github.copilot.default' && !participant.fullName
|
|
194
|
-
)))) {
|
|
195
|
-
this.notificationService.notify({
|
|
196
|
-
severity: Severity$1.Error,
|
|
197
|
-
message: ( localizeWithPath(
|
|
198
|
-
_moduleId,
|
|
199
|
-
13,
|
|
200
|
-
"Chat failed to load. Please ensure that the GitHub Copilot Chat extension is up to date."
|
|
201
|
-
)),
|
|
202
|
-
actions: {
|
|
203
|
-
primary: [
|
|
204
|
-
( (new Action('showExtension', ( localizeWithPath(_moduleId, 14, "Show Extension")), undefined, true, () => {
|
|
205
|
-
return this.commandService.executeCommand('workbench.extensions.action.showExtensionsWithIds', ['GitHub.copilot-chat']);
|
|
206
|
-
})))
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
138
|
for (const providerDescriptor of extension.value) {
|
|
213
139
|
if (!providerDescriptor.name.match(/^[\w0-9_-]+$/)) {
|
|
214
140
|
this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT register participant with invalid name: ${providerDescriptor.name}. Name must match /^[\\w0-9_-]+$/.`);
|
|
@@ -253,7 +179,6 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
253
179
|
name: providerDescriptor.name,
|
|
254
180
|
fullName: providerDescriptor.fullName,
|
|
255
181
|
isDefault: providerDescriptor.isDefault,
|
|
256
|
-
defaultImplicitVariables: providerDescriptor.defaultImplicitVariables,
|
|
257
182
|
locations: isNonEmptyArray(providerDescriptor.locations) ?
|
|
258
183
|
( (providerDescriptor.locations.map(ChatAgentLocation.fromRaw))) :
|
|
259
184
|
[ChatAgentLocation.Panel],
|
|
@@ -270,7 +195,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
270
195
|
});
|
|
271
196
|
}
|
|
272
197
|
registerViewContainer() {
|
|
273
|
-
const title = (
|
|
198
|
+
const title = ( localize2(7286, "Chat"));
|
|
274
199
|
const icon = Codicon.commentDiscussion;
|
|
275
200
|
const viewContainerId = CHAT_SIDEBAR_PANEL_ID;
|
|
276
201
|
const viewContainer = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
|
|
@@ -313,11 +238,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
313
238
|
};
|
|
314
239
|
ChatExtensionPointHandler = ( (__decorate([
|
|
315
240
|
( (__param(0, IChatAgentService))),
|
|
316
|
-
( (__param(1,
|
|
317
|
-
( (__param(2, IContextKeyService))),
|
|
318
|
-
( (__param(3, ILogService))),
|
|
319
|
-
( (__param(4, INotificationService))),
|
|
320
|
-
( (__param(5, ICommandService)))
|
|
241
|
+
( (__param(1, ILogService)))
|
|
321
242
|
], ChatExtensionPointHandler)));
|
|
322
243
|
function getParticipantKey(extensionId, participantName) {
|
|
323
244
|
return `${extensionId.value}_${participantName}`;
|
|
@@ -2,12 +2,12 @@ import { renderMarkdownAsPlaintext } from 'vscode/vscode/vs/base/browser/markdow
|
|
|
2
2
|
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
3
3
|
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
4
4
|
import { AccessibleViewType, AccessibleViewProviderId } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleView';
|
|
5
|
-
import { alertAccessibleViewFocusChange } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleViewRegistry';
|
|
6
5
|
import { AccessibilityVerbositySettingId } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
|
7
6
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
8
7
|
import { CONTEXT_IN_CHAT_SESSION } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
9
8
|
import { ChatWelcomeMessageModel } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
10
9
|
import { isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
|
|
10
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
11
11
|
|
|
12
12
|
class ChatResponseAccessibleView {
|
|
13
13
|
constructor() {
|
|
@@ -15,80 +15,89 @@ class ChatResponseAccessibleView {
|
|
|
15
15
|
this.name = 'panelChat';
|
|
16
16
|
this.type = AccessibleViewType.View;
|
|
17
17
|
this.when = CONTEXT_IN_CHAT_SESSION;
|
|
18
|
+
this._initialRender = true;
|
|
18
19
|
}
|
|
19
20
|
getProvider(accessor) {
|
|
20
21
|
const widgetService = accessor.get(IChatWidgetService);
|
|
21
22
|
const codeEditorService = accessor.get(ICodeEditorService);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
const widget = widgetService.lastFocusedWidget;
|
|
24
|
+
if (!widget) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const chatInputFocused = this._initialRender && !!codeEditorService.getFocusedCodeEditor() || false;
|
|
28
|
+
if (this._initialRender && chatInputFocused) {
|
|
29
|
+
widget.focusLastMessage();
|
|
30
|
+
this._initialRender = false;
|
|
31
|
+
}
|
|
32
|
+
if (!widget) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const verifiedWidget = widget;
|
|
36
|
+
const focusedItem = verifiedWidget.getFocus();
|
|
37
|
+
if (!focusedItem) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
return ( new ChatResponseAccessibleProvider(verifiedWidget, focusedItem, chatInputFocused));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
class ChatResponseAccessibleProvider extends Disposable {
|
|
44
|
+
constructor(_widget, item, _chatInputFocused) {
|
|
45
|
+
super();
|
|
46
|
+
this._widget = _widget;
|
|
47
|
+
this._chatInputFocused = _chatInputFocused;
|
|
48
|
+
this.id = AccessibleViewProviderId.Chat;
|
|
49
|
+
this.verbositySettingKey = AccessibilityVerbositySettingId.Chat;
|
|
50
|
+
this.options = { type: AccessibleViewType.View };
|
|
51
|
+
this._focusedItem = item;
|
|
52
|
+
}
|
|
53
|
+
provideContent() {
|
|
54
|
+
return this._getContent(this._focusedItem);
|
|
55
|
+
}
|
|
56
|
+
_getContent(item) {
|
|
57
|
+
const isWelcome = item instanceof ChatWelcomeMessageModel;
|
|
58
|
+
let responseContent = isResponseVM(item) ? ( item.response.toString()) : '';
|
|
59
|
+
if (isWelcome) {
|
|
60
|
+
const welcomeReplyContents = [];
|
|
61
|
+
for (const content of item.content) {
|
|
62
|
+
if (Array.isArray(content)) {
|
|
63
|
+
welcomeReplyContents.push(...( content.map(m => m.message)));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
welcomeReplyContents.push(content.value);
|
|
52
67
|
}
|
|
53
|
-
responseContent = welcomeReplyContents.join('\n');
|
|
54
|
-
}
|
|
55
|
-
if (!responseContent && 'errorDetails' in focusedItem && focusedItem.errorDetails) {
|
|
56
|
-
responseContent = focusedItem.errorDetails.message;
|
|
57
|
-
}
|
|
58
|
-
if (!responseContent) {
|
|
59
|
-
return;
|
|
60
68
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
responseContent = welcomeReplyContents.join('\n');
|
|
70
|
+
}
|
|
71
|
+
if (!responseContent && 'errorDetails' in item && item.errorDetails) {
|
|
72
|
+
responseContent = item.errorDetails.message;
|
|
73
|
+
}
|
|
74
|
+
return renderMarkdownAsPlaintext(( new MarkdownString(responseContent)), true);
|
|
75
|
+
}
|
|
76
|
+
onClose() {
|
|
77
|
+
this._widget.reveal(this._focusedItem);
|
|
78
|
+
if (this._chatInputFocused) {
|
|
79
|
+
this._widget.focusInput();
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this._widget.focus(this._focusedItem);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
provideNextContent() {
|
|
86
|
+
const next = this._widget.getSibling(this._focusedItem, 'next');
|
|
87
|
+
if (next) {
|
|
88
|
+
this._focusedItem = next;
|
|
89
|
+
return this._getContent(next);
|
|
90
|
+
}
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
providePreviousContent() {
|
|
94
|
+
const previous = this._widget.getSibling(this._focusedItem, 'previous');
|
|
95
|
+
if (previous) {
|
|
96
|
+
this._focusedItem = previous;
|
|
97
|
+
return this._getContent(previous);
|
|
89
98
|
}
|
|
99
|
+
return;
|
|
90
100
|
}
|
|
91
|
-
dispose() { }
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
export { ChatResponseAccessibleView };
|
|
@@ -37,7 +37,7 @@ let ChatVariablesService = class ChatVariablesService {
|
|
|
37
37
|
};
|
|
38
38
|
jobs.push(data.resolver(prompt.text, part.variableArg, model, variableProgressCallback, token).then(value => {
|
|
39
39
|
if (value) {
|
|
40
|
-
resolvedVariables[i] = { id: data.data.id, modelDescription: data.data.modelDescription, name: part.variableName, range: part.range, value, references };
|
|
40
|
+
resolvedVariables[i] = { id: data.data.id, modelDescription: data.data.modelDescription, name: part.variableName, range: part.range, value, references, fullName: data.data.fullName, icon: data.data.icon };
|
|
41
41
|
}
|
|
42
42
|
}).catch(onUnexpectedExternalError));
|
|
43
43
|
}
|
|
@@ -61,12 +61,12 @@ let ChatVariablesService = class ChatVariablesService {
|
|
|
61
61
|
};
|
|
62
62
|
jobs.push(data.resolver(prompt.text, '', model, variableProgressCallback, token).then(value => {
|
|
63
63
|
if (value) {
|
|
64
|
-
resolvedAttachedContext[i] = { id: data.data.id, modelDescription: data.data.modelDescription, name: attachment.name, range: attachment.range, value, references };
|
|
64
|
+
resolvedAttachedContext[i] = { id: data.data.id, modelDescription: data.data.modelDescription, name: attachment.name, fullName: attachment.fullName, range: attachment.range, value, references, icon: attachment.icon };
|
|
65
65
|
}
|
|
66
66
|
}).catch(onUnexpectedExternalError));
|
|
67
67
|
}
|
|
68
|
-
else if (attachment.isDynamic) {
|
|
69
|
-
resolvedAttachedContext[i] = {
|
|
68
|
+
else if (attachment.isDynamic || attachment.isTool) {
|
|
69
|
+
resolvedAttachedContext[i] = { ...attachment };
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
await Promise.allSettled(jobs);
|
|
@@ -90,9 +90,11 @@ let ChatVariablesService = class ChatVariablesService {
|
|
|
90
90
|
getVariable(name) {
|
|
91
91
|
return this._resolver.get(name.toLowerCase())?.data;
|
|
92
92
|
}
|
|
93
|
-
getVariables() {
|
|
93
|
+
getVariables(location) {
|
|
94
94
|
const all = ( Iterable.map(( this._resolver.values()), data => data.data));
|
|
95
|
-
return Iterable.filter(all, data =>
|
|
95
|
+
return Iterable.filter(all, data => {
|
|
96
|
+
return location !== ChatAgentLocation.Editor || !( ( new Set(['selection', 'editor'])).has(data.name));
|
|
97
|
+
});
|
|
96
98
|
}
|
|
97
99
|
getDynamicVariables(sessionId) {
|
|
98
100
|
const widget = this.chatWidgetService.getWidgetBySessionId(sessionId);
|
|
@@ -119,8 +121,7 @@ let ChatVariablesService = class ChatVariablesService {
|
|
|
119
121
|
if (location !== ChatAgentLocation.Panel) {
|
|
120
122
|
return;
|
|
121
123
|
}
|
|
122
|
-
await showChatView(this.viewsService);
|
|
123
|
-
const widget = this.chatWidgetService.lastFocusedWidget;
|
|
124
|
+
const widget = await showChatView(this.viewsService);
|
|
124
125
|
if (!widget || !widget.viewModel) {
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
@@ -107,7 +107,7 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
|
|
|
107
107
|
renderBody(parent) {
|
|
108
108
|
try {
|
|
109
109
|
super.renderBody(parent);
|
|
110
|
-
const scopedInstantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService])));
|
|
110
|
+
const scopedInstantiationService = this._register(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService]))));
|
|
111
111
|
const locationBasedColors = this.getLocationBasedColors();
|
|
112
112
|
this._widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, { viewId: this.id }, { supportsFileReferences: true }, {
|
|
113
113
|
listForeground: SIDE_BAR_FOREGROUND,
|
|
@@ -13,8 +13,10 @@ class ChatContextAttachments extends Disposable {
|
|
|
13
13
|
this._attachedContext = ( new Set());
|
|
14
14
|
this._onDidChangeInputState = this._register(( new Emitter()));
|
|
15
15
|
this.onDidChangeInputState = this._onDidChangeInputState.event;
|
|
16
|
-
this._register(this.widget.
|
|
17
|
-
|
|
16
|
+
this._register(this.widget.onDidChangeContext((e) => {
|
|
17
|
+
if (e.removed) {
|
|
18
|
+
this._removeContext(e.removed);
|
|
19
|
+
}
|
|
18
20
|
}));
|
|
19
21
|
this._register(this.widget.onDidSubmitAgent(() => {
|
|
20
22
|
this._clearAttachedContext();
|
|
@@ -46,9 +48,11 @@ class ChatContextAttachments extends Disposable {
|
|
|
46
48
|
this.widget.setContext(overwrite, ...attachments);
|
|
47
49
|
this._onDidChangeInputState.fire();
|
|
48
50
|
}
|
|
49
|
-
_removeContext(
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
_removeContext(attachments) {
|
|
52
|
+
if (attachments.length) {
|
|
53
|
+
attachments.forEach(this._attachedContext.delete, this._attachedContext);
|
|
54
|
+
this._onDidChangeInputState.fire();
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
_clearAttachedContext() {
|
|
54
58
|
this._attachedContext.clear();
|