@codingame/monaco-vscode-chat-service-override 8.0.4 → 9.0.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/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +24 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +73 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +47 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +27 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.js +179 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +2 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +14 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +14 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatContextAttachments.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +37 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +253 -67
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelToolsService.js +59 -18
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +51 -20
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +28 -49
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +130 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +10 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +0 -258
|
@@ -22,7 +22,7 @@ function registerMoveActions() {
|
|
|
22
22
|
constructor() {
|
|
23
23
|
super({
|
|
24
24
|
id: `workbench.action.chat.openInEditor`,
|
|
25
|
-
title: ( localize2(
|
|
25
|
+
title: ( localize2(7126, "Open Chat in Editor")),
|
|
26
26
|
category: CHAT_CATEGORY,
|
|
27
27
|
precondition: CONTEXT_CHAT_ENABLED,
|
|
28
28
|
f1: true,
|
|
@@ -42,7 +42,7 @@ function registerMoveActions() {
|
|
|
42
42
|
constructor() {
|
|
43
43
|
super({
|
|
44
44
|
id: `workbench.action.chat.openInNewWindow`,
|
|
45
|
-
title: ( localize2(
|
|
45
|
+
title: ( localize2(7127, "Open Chat in New Window")),
|
|
46
46
|
category: CHAT_CATEGORY,
|
|
47
47
|
precondition: CONTEXT_CHAT_ENABLED,
|
|
48
48
|
f1: true,
|
|
@@ -62,7 +62,7 @@ function registerMoveActions() {
|
|
|
62
62
|
constructor() {
|
|
63
63
|
super({
|
|
64
64
|
id: `workbench.action.chat.openInSidebar`,
|
|
65
|
-
title: ( localize2(
|
|
65
|
+
title: ( localize2(7128, "Open Chat in Side Bar")),
|
|
66
66
|
category: CHAT_CATEGORY,
|
|
67
67
|
precondition: CONTEXT_CHAT_ENABLED,
|
|
68
68
|
f1: true,
|
|
@@ -93,7 +93,8 @@ async function executeMoveToAction(accessor, moveTo, chatView) {
|
|
|
93
93
|
const sessionId = viewModel.sessionId;
|
|
94
94
|
const viewState = widget.getViewState();
|
|
95
95
|
widget.clear();
|
|
96
|
-
|
|
96
|
+
const options = { target: { sessionId }, pinned: true, viewState: viewState };
|
|
97
|
+
await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
|
|
97
98
|
}
|
|
98
99
|
async function moveToSidebar(accessor) {
|
|
99
100
|
const viewsService = accessor.get(IViewsService);
|
|
@@ -18,77 +18,77 @@ import { ChatAccessibilityHelp } from './actions/chatAccessibilityHelp.js';
|
|
|
18
18
|
import { registerChatActions } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
19
19
|
import { ACTION_ID_NEW_CHAT, registerNewChatActions } from './actions/chatClearActions.js';
|
|
20
20
|
import { registerChatCodeBlockActions, registerChatCodeCompareBlockActions } from './actions/chatCodeblockActions.js';
|
|
21
|
+
import { registerChatContextActions } from './actions/chatContextActions.js';
|
|
21
22
|
import { registerChatCopyActions } from './actions/chatCopyActions.js';
|
|
23
|
+
import { registerChatDeveloperActions } from './actions/chatDeveloperActions.js';
|
|
22
24
|
import { SubmitAction, registerChatExecuteActions } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatExecuteActions';
|
|
23
25
|
import { registerChatFileTreeActions } from './actions/chatFileTreeActions.js';
|
|
24
26
|
import { registerChatExportActions } from './actions/chatImportExport.js';
|
|
25
27
|
import { registerMoveActions } from './actions/chatMoveActions.js';
|
|
26
28
|
import { registerQuickChatActions } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions';
|
|
27
|
-
import { registerChatTitleActions } from '
|
|
29
|
+
import { registerChatTitleActions } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatTitleActions';
|
|
28
30
|
import './chatAccessibilityService.js';
|
|
29
31
|
import { ChatEditor } from './chatEditor.js';
|
|
30
32
|
import { ChatEditorInput, ChatEditorInputSerializer } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
31
33
|
import { agentToMarkdown, agentSlashCommandToMarkdown } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer';
|
|
32
|
-
import { ChatExtensionPointHandler } from './chatParticipantContributions.js';
|
|
34
|
+
import { ChatExtensionPointHandler, ChatCompatibilityNotifier } from './chatParticipantContributions.js';
|
|
33
35
|
import './chatQuick.js';
|
|
34
36
|
import { ChatResponseAccessibleView } from './chatResponseAccessibleView.js';
|
|
35
37
|
import './chatVariables.js';
|
|
36
38
|
import 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
37
|
-
import './contrib/chatInputEditorContrib.js';
|
|
38
39
|
import './contrib/chatContextAttachments.js';
|
|
39
40
|
import './contrib/chatInputCompletions.js';
|
|
41
|
+
import './contrib/chatInputEditorContrib.js';
|
|
40
42
|
import './contrib/chatInputEditorHover.js';
|
|
41
43
|
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
42
44
|
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
43
45
|
import { chatVariableLeader } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
44
46
|
import '../common/chatServiceImpl.js';
|
|
45
|
-
import '../common/languageModelToolsService.js';
|
|
46
47
|
import '../common/chatSlashCommands.js';
|
|
47
48
|
import { IChatSlashCommandService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatSlashCommands.service';
|
|
48
49
|
import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
|
|
49
50
|
import '../common/chatWidgetHistoryService.js';
|
|
50
51
|
import 'vscode/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
51
52
|
import '../common/languageModelStats.js';
|
|
53
|
+
import '../common/languageModelToolsService.js';
|
|
54
|
+
import { LanguageModelToolsExtensionPointHandler } from '../common/tools/languageModelToolsContribution.js';
|
|
52
55
|
import '../common/voiceChatService.js';
|
|
53
56
|
import { RegisteredEditorPriority } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
54
57
|
import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService.service';
|
|
55
58
|
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
56
59
|
import 'vscode/vscode/vs/workbench/contrib/chat/common/chatColors';
|
|
57
|
-
import { registerChatContextActions } from './actions/chatContextActions.js';
|
|
58
|
-
import { registerChatDeveloperActions } from './actions/chatDeveloperActions.js';
|
|
59
|
-
import { LanguageModelToolsExtensionPointHandler } from '../common/tools/languageModelToolsContribution.js';
|
|
60
60
|
|
|
61
61
|
const configurationRegistry = ( (Registry.as(Extensions.Configuration)));
|
|
62
62
|
configurationRegistry.registerConfiguration({
|
|
63
63
|
id: 'chatSidebar',
|
|
64
|
-
title: ( localize(
|
|
64
|
+
title: ( localize(3062, "Chat")),
|
|
65
65
|
type: 'object',
|
|
66
66
|
properties: {
|
|
67
67
|
'chat.editor.fontSize': {
|
|
68
68
|
type: 'number',
|
|
69
|
-
description: ( localize(
|
|
69
|
+
description: ( localize(3063, "Controls the font size in pixels in chat codeblocks.")),
|
|
70
70
|
default: isMacintosh ? 12 : 14,
|
|
71
71
|
},
|
|
72
72
|
'chat.editor.fontFamily': {
|
|
73
73
|
type: 'string',
|
|
74
|
-
description: ( localize(
|
|
74
|
+
description: ( localize(3064, "Controls the font family in chat codeblocks.")),
|
|
75
75
|
default: 'default'
|
|
76
76
|
},
|
|
77
77
|
'chat.editor.fontWeight': {
|
|
78
78
|
type: 'string',
|
|
79
|
-
description: ( localize(
|
|
79
|
+
description: ( localize(3065, "Controls the font weight in chat codeblocks.")),
|
|
80
80
|
default: 'default'
|
|
81
81
|
},
|
|
82
82
|
'chat.editor.wordWrap': {
|
|
83
83
|
type: 'string',
|
|
84
|
-
description: ( localize(
|
|
84
|
+
description: ( localize(3066, "Controls whether lines should wrap in chat codeblocks.")),
|
|
85
85
|
default: 'off',
|
|
86
86
|
enum: ['on', 'off']
|
|
87
87
|
},
|
|
88
88
|
'chat.editor.lineHeight': {
|
|
89
89
|
type: 'number',
|
|
90
90
|
description: ( localize(
|
|
91
|
-
|
|
91
|
+
3067,
|
|
92
92
|
"Controls the line height in pixels in chat codeblocks. Use 0 to compute the line height from the font size."
|
|
93
93
|
)),
|
|
94
94
|
default: 0
|
|
@@ -96,7 +96,7 @@ configurationRegistry.registerConfiguration({
|
|
|
96
96
|
'chat.experimental.implicitContext': {
|
|
97
97
|
type: 'boolean',
|
|
98
98
|
description: ( localize(
|
|
99
|
-
|
|
99
|
+
3068,
|
|
100
100
|
"Controls whether a checkbox is shown to allow the user to determine which implicit context is included with a chat participant's prompt."
|
|
101
101
|
)),
|
|
102
102
|
deprecated: true,
|
|
@@ -104,22 +104,27 @@ configurationRegistry.registerConfiguration({
|
|
|
104
104
|
},
|
|
105
105
|
'chat.experimental.variables.editor': {
|
|
106
106
|
type: 'boolean',
|
|
107
|
-
description: ( localize(
|
|
107
|
+
description: ( localize(3069, "Enables variables for editor chat.")),
|
|
108
108
|
default: true
|
|
109
109
|
},
|
|
110
110
|
'chat.experimental.variables.notebook': {
|
|
111
111
|
type: 'boolean',
|
|
112
|
-
description: ( localize(
|
|
112
|
+
description: ( localize(3070, "Enables variables for notebook chat.")),
|
|
113
113
|
default: false
|
|
114
114
|
},
|
|
115
115
|
'chat.experimental.variables.terminal': {
|
|
116
116
|
type: 'boolean',
|
|
117
|
-
description: ( localize(
|
|
117
|
+
description: ( localize(3071, "Enables variables for terminal chat.")),
|
|
118
118
|
default: false
|
|
119
119
|
},
|
|
120
|
+
'chat.experimental.detectParticipant.enabled': {
|
|
121
|
+
type: 'boolean',
|
|
122
|
+
description: ( localize(3072, "Enables chat participant autodetection for panel chat.")),
|
|
123
|
+
default: null
|
|
124
|
+
},
|
|
120
125
|
}
|
|
121
126
|
});
|
|
122
|
-
( (Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(ChatEditor, ChatEditorInput.EditorID, ( localize(
|
|
127
|
+
( (Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(ChatEditor, ChatEditorInput.EditorID, ( localize(3073, "Chat"))), [
|
|
123
128
|
( (new SyncDescriptor(ChatEditorInput)))
|
|
124
129
|
]);
|
|
125
130
|
let ChatResolverContribution = class ChatResolverContribution extends Disposable {
|
|
@@ -128,7 +133,7 @@ let ChatResolverContribution = class ChatResolverContribution extends Disposable
|
|
|
128
133
|
super();
|
|
129
134
|
this._register(editorResolverService.registerEditor(`${Schemas.vscodeChatSesssion}:**/**`, {
|
|
130
135
|
id: ChatEditorInput.EditorID,
|
|
131
|
-
label: ( localize(
|
|
136
|
+
label: ( localize(3073, "Chat")),
|
|
132
137
|
priority: RegisteredEditorPriority.builtin
|
|
133
138
|
}, {
|
|
134
139
|
singlePerResource: true,
|
|
@@ -151,7 +156,7 @@ let ChatSlashStaticSlashCommandsContribution = class ChatSlashStaticSlashCommand
|
|
|
151
156
|
super();
|
|
152
157
|
this._store.add(slashCommandService.registerSlashCommand({
|
|
153
158
|
command: 'clear',
|
|
154
|
-
detail: ( localize(
|
|
159
|
+
detail: ( localize(3074, "Start a new chat")),
|
|
155
160
|
sortText: 'z2_clear',
|
|
156
161
|
executeImmediately: true,
|
|
157
162
|
locations: [ChatAgentLocation.Panel]
|
|
@@ -200,7 +205,7 @@ let ChatSlashStaticSlashCommandsContribution = class ChatSlashStaticSlashCommand
|
|
|
200
205
|
}
|
|
201
206
|
const variables = [
|
|
202
207
|
...chatVariablesService.getVariables(ChatAgentLocation.Panel),
|
|
203
|
-
{ name: 'file', description: ( localize(
|
|
208
|
+
{ name: 'file', description: ( localize(3075, "Choose a file in the workspace")) }
|
|
204
209
|
];
|
|
205
210
|
const variableText = ( (variables
|
|
206
211
|
.map(v => `* \`${chatVariableLeader}${v.name}\` - ${v.description}`)))
|
|
@@ -232,6 +237,7 @@ workbenchContributionsRegistry.registerWorkbenchContribution(ChatSlashStaticSlas
|
|
|
232
237
|
( (Registry.as(EditorExtensions.EditorFactory))).registerEditorSerializer(ChatEditorInput.TypeID, ChatEditorInputSerializer);
|
|
233
238
|
registerWorkbenchContribution2(ChatExtensionPointHandler.ID, ChatExtensionPointHandler, WorkbenchPhase.BlockStartup);
|
|
234
239
|
registerWorkbenchContribution2(LanguageModelToolsExtensionPointHandler.ID, LanguageModelToolsExtensionPointHandler, WorkbenchPhase.BlockRestore);
|
|
240
|
+
registerWorkbenchContribution2(ChatCompatibilityNotifier.ID, ChatCompatibilityNotifier, WorkbenchPhase.Eventually);
|
|
235
241
|
registerChatActions();
|
|
236
242
|
registerChatCopyActions();
|
|
237
243
|
registerChatCodeBlockActions();
|
|
@@ -7,13 +7,17 @@ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/c
|
|
|
7
7
|
import { AccessibilityProgressSignalScheduler } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/progressAccessibilitySignalScheduler';
|
|
8
8
|
import { renderStringAsPlaintext } from 'vscode/vscode/vs/base/browser/markdownRenderer';
|
|
9
9
|
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
10
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
11
|
+
import 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
|
12
|
+
import { AccessibilityVoiceSettingId } from 'vscode/vscode/vs/workbench/contrib/speech/common/speechService';
|
|
10
13
|
|
|
11
14
|
const CHAT_RESPONSE_PENDING_ALLOWANCE_MS = 4000;
|
|
12
15
|
let ChatAccessibilityService = class ChatAccessibilityService extends Disposable {
|
|
13
|
-
constructor(_accessibilitySignalService, _instantiationService) {
|
|
16
|
+
constructor(_accessibilitySignalService, _instantiationService, _configurationService) {
|
|
14
17
|
super();
|
|
15
18
|
this._accessibilitySignalService = _accessibilitySignalService;
|
|
16
19
|
this._instantiationService = _instantiationService;
|
|
20
|
+
this._configurationService = _configurationService;
|
|
17
21
|
this._pendingSignalMap = this._register(( new DisposableMap()));
|
|
18
22
|
this._requestId = 0;
|
|
19
23
|
}
|
|
@@ -33,12 +37,15 @@ let ChatAccessibilityService = class ChatAccessibilityService extends Disposable
|
|
|
33
37
|
}
|
|
34
38
|
const errorDetails = isPanelChat && response.errorDetails ? ` ${response.errorDetails.message}` : '';
|
|
35
39
|
const plainTextResponse = renderStringAsPlaintext(( new MarkdownString(responseContent)));
|
|
36
|
-
|
|
40
|
+
if (this._configurationService.getValue(AccessibilityVoiceSettingId.AutoSynthesize) !== 'on') {
|
|
41
|
+
status(plainTextResponse + errorDetails);
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
};
|
|
39
45
|
ChatAccessibilityService = ( __decorate([
|
|
40
46
|
( __param(0, IAccessibilitySignalService)),
|
|
41
|
-
( __param(1, IInstantiationService))
|
|
47
|
+
( __param(1, IInstantiationService)),
|
|
48
|
+
( __param(2, IConfigurationService))
|
|
42
49
|
], ChatAccessibilityService));
|
|
43
50
|
|
|
44
51
|
export { ChatAccessibilityService };
|
|
@@ -19,9 +19,9 @@ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
|
19
19
|
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
20
20
|
import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
21
21
|
import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
|
|
22
|
+
import { clearChatEditor } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatClear';
|
|
22
23
|
import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
23
24
|
import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
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
|
|
|
@@ -43,7 +43,7 @@ let ChatEditor = class ChatEditor extends EditorPane {
|
|
|
43
43
|
createEditor(parent) {
|
|
44
44
|
this._scopedContextKeyService = this._register(this.contextKeyService.createScoped(parent));
|
|
45
45
|
const scopedInstantiationService = this._register(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService]))));
|
|
46
|
-
this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel,
|
|
46
|
+
this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, undefined, { supportsFileReferences: true }, {
|
|
47
47
|
listForeground: editorForeground,
|
|
48
48
|
listBackground: editorBackground,
|
|
49
49
|
inputEditorBackground: inputBackground,
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
|
|
2
|
+
import { isNonEmptyArray, coalesce } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
3
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
4
|
-
import { DisposableMap, DisposableStore,
|
|
4
|
+
import { DisposableMap, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { AmbiguousCharacters, InvisibleCharacters } from 'vscode/vscode/vs/base/common/strings';
|
|
6
6
|
import { localize, localize2 } from 'vscode/vscode/vs/nls';
|
|
7
|
+
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
8
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
7
9
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
8
10
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
11
|
+
import 'vscode/vscode/vs/platform/notification/common/notification';
|
|
12
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
9
13
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
10
14
|
import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
11
15
|
import { Extensions, ViewContainerLocation } from 'vscode/vscode/vs/workbench/common/views';
|
|
@@ -13,13 +17,17 @@ import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/ch
|
|
|
13
17
|
import { CHAT_SIDEBAR_PANEL_ID, ChatViewPane } from './chatViewPane.js';
|
|
14
18
|
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
15
19
|
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
20
|
+
import { CONTEXT_CHAT_PANEL_PARTICIPANT_REGISTERED, CONTEXT_CHAT_EXTENSION_INVALID } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
21
|
+
import { showExtensionsWithIdsCommandId } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsActions';
|
|
22
|
+
import { IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions.service';
|
|
16
23
|
import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
17
24
|
import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
25
|
+
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
18
26
|
|
|
19
27
|
const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
20
28
|
extensionPoint: 'chatParticipants',
|
|
21
29
|
jsonSchema: {
|
|
22
|
-
description: ( localize(
|
|
30
|
+
description: ( localize(7136, 'Contributes a chat participant')),
|
|
23
31
|
type: 'array',
|
|
24
32
|
items: {
|
|
25
33
|
additionalProperties: false,
|
|
@@ -28,50 +36,86 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
28
36
|
required: ['name', 'id'],
|
|
29
37
|
properties: {
|
|
30
38
|
id: {
|
|
31
|
-
description: ( localize(
|
|
39
|
+
description: ( localize(7137, "A unique id for this chat participant.")),
|
|
32
40
|
type: 'string'
|
|
33
41
|
},
|
|
34
42
|
name: {
|
|
35
43
|
description: ( localize(
|
|
36
|
-
|
|
44
|
+
7138,
|
|
37
45
|
"User-facing name for this chat participant. The user will use '@' with this name to invoke the participant. Name must not contain whitespace."
|
|
38
46
|
)),
|
|
39
47
|
type: 'string',
|
|
40
|
-
pattern: '^[\\
|
|
48
|
+
pattern: '^[\\w-]+$'
|
|
41
49
|
},
|
|
42
50
|
fullName: {
|
|
43
51
|
markdownDescription: ( localize(
|
|
44
|
-
|
|
52
|
+
7139,
|
|
45
53
|
"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.",
|
|
46
54
|
'`name`'
|
|
47
55
|
)),
|
|
48
56
|
type: 'string'
|
|
49
57
|
},
|
|
50
58
|
description: {
|
|
51
|
-
description: ( localize(
|
|
59
|
+
description: ( localize(7140, "A description of this chat participant, shown in the UI.")),
|
|
52
60
|
type: 'string'
|
|
53
61
|
},
|
|
54
62
|
isSticky: {
|
|
55
63
|
description: ( localize(
|
|
56
|
-
|
|
64
|
+
7141,
|
|
57
65
|
"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."
|
|
58
66
|
)),
|
|
59
67
|
type: 'boolean'
|
|
60
68
|
},
|
|
61
69
|
sampleRequest: {
|
|
62
70
|
description: ( localize(
|
|
63
|
-
|
|
71
|
+
7142,
|
|
64
72
|
"When the user clicks this participant in `/help`, this text will be submitted to the participant."
|
|
65
73
|
)),
|
|
66
74
|
type: 'string'
|
|
67
75
|
},
|
|
68
76
|
when: {
|
|
69
|
-
description: ( localize(
|
|
77
|
+
description: ( localize(7143, "A condition which must be true to enable this participant.")),
|
|
70
78
|
type: 'string'
|
|
71
79
|
},
|
|
80
|
+
disambiguation: {
|
|
81
|
+
description: ( localize(
|
|
82
|
+
7144,
|
|
83
|
+
"Metadata to help with automatically routing user questions to this chat participant. You must add `contribChatParticipantDetection` to `enabledApiProposals` to use this API."
|
|
84
|
+
)),
|
|
85
|
+
type: 'array',
|
|
86
|
+
items: {
|
|
87
|
+
additionalProperties: false,
|
|
88
|
+
type: 'object',
|
|
89
|
+
defaultSnippets: [{ body: { categoryName: '', description: '', examples: [] } }],
|
|
90
|
+
required: ['categoryName', 'description', 'examples'],
|
|
91
|
+
properties: {
|
|
92
|
+
categoryName: {
|
|
93
|
+
markdownDescription: ( localize(
|
|
94
|
+
7145,
|
|
95
|
+
"A detailed name for this category, e.g. `workspace_questions` or `web_questions`."
|
|
96
|
+
)),
|
|
97
|
+
type: 'string'
|
|
98
|
+
},
|
|
99
|
+
description: {
|
|
100
|
+
description: ( localize(
|
|
101
|
+
7146,
|
|
102
|
+
"A detailed description of the kinds of questions that are suitable for this chat participant."
|
|
103
|
+
)),
|
|
104
|
+
type: 'string'
|
|
105
|
+
},
|
|
106
|
+
examples: {
|
|
107
|
+
description: ( localize(
|
|
108
|
+
7147,
|
|
109
|
+
"A list of representative example questions that are suitable for this chat participant."
|
|
110
|
+
)),
|
|
111
|
+
type: 'array'
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
72
116
|
commands: {
|
|
73
117
|
markdownDescription: ( localize(
|
|
74
|
-
|
|
118
|
+
7148,
|
|
75
119
|
"Commands available for this chat participant, which the user can invoke with a `/`."
|
|
76
120
|
)),
|
|
77
121
|
type: 'array',
|
|
@@ -83,36 +127,80 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
83
127
|
properties: {
|
|
84
128
|
name: {
|
|
85
129
|
description: ( localize(
|
|
86
|
-
|
|
130
|
+
7149,
|
|
87
131
|
"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."
|
|
88
132
|
)),
|
|
89
133
|
type: 'string'
|
|
90
134
|
},
|
|
91
135
|
description: {
|
|
92
|
-
description: ( localize(
|
|
136
|
+
description: ( localize(7150, "A description of this command.")),
|
|
93
137
|
type: 'string'
|
|
94
138
|
},
|
|
95
139
|
when: {
|
|
96
|
-
description: ( localize(
|
|
140
|
+
description: ( localize(7151, "A condition which must be true to enable this command.")),
|
|
97
141
|
type: 'string'
|
|
98
142
|
},
|
|
99
143
|
sampleRequest: {
|
|
100
144
|
description: ( localize(
|
|
101
|
-
|
|
145
|
+
7152,
|
|
102
146
|
"When the user clicks this command in `/help`, this text will be submitted to the participant."
|
|
103
147
|
)),
|
|
104
148
|
type: 'string'
|
|
105
149
|
},
|
|
106
150
|
isSticky: {
|
|
107
151
|
description: ( localize(
|
|
108
|
-
|
|
152
|
+
7141,
|
|
109
153
|
"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."
|
|
110
154
|
)),
|
|
111
155
|
type: 'boolean'
|
|
112
156
|
},
|
|
157
|
+
disambiguation: {
|
|
158
|
+
description: ( localize(
|
|
159
|
+
7153,
|
|
160
|
+
"Metadata to help with automatically routing user questions to this chat command. You must add `contribChatParticipantDetection` to `enabledApiProposals` to use this API."
|
|
161
|
+
)),
|
|
162
|
+
type: 'array',
|
|
163
|
+
items: {
|
|
164
|
+
additionalProperties: false,
|
|
165
|
+
type: 'object',
|
|
166
|
+
defaultSnippets: [{ body: { categoryName: '', description: '', examples: [] } }],
|
|
167
|
+
required: ['categoryName', 'description', 'examples'],
|
|
168
|
+
properties: {
|
|
169
|
+
categoryName: {
|
|
170
|
+
markdownDescription: ( localize(
|
|
171
|
+
7154,
|
|
172
|
+
"A detailed name for this category, e.g. `workspace_questions` or `web_questions`."
|
|
173
|
+
)),
|
|
174
|
+
type: 'string'
|
|
175
|
+
},
|
|
176
|
+
description: {
|
|
177
|
+
description: ( localize(
|
|
178
|
+
7155,
|
|
179
|
+
"A detailed description of the kinds of questions that are suitable for this chat command."
|
|
180
|
+
)),
|
|
181
|
+
type: 'string'
|
|
182
|
+
},
|
|
183
|
+
examples: {
|
|
184
|
+
description: ( localize(
|
|
185
|
+
7156,
|
|
186
|
+
"A list of representative example questions that are suitable for this chat command."
|
|
187
|
+
)),
|
|
188
|
+
type: 'array'
|
|
189
|
+
},
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
113
193
|
}
|
|
114
194
|
}
|
|
115
195
|
},
|
|
196
|
+
supportsToolReferences: {
|
|
197
|
+
description: ( localize(
|
|
198
|
+
7157,
|
|
199
|
+
"Whether this participant supports {0}.",
|
|
200
|
+
'ChatRequest#toolReferences'
|
|
201
|
+
)),
|
|
202
|
+
type: 'boolean'
|
|
203
|
+
}
|
|
116
204
|
}
|
|
117
205
|
}
|
|
118
206
|
},
|
|
@@ -128,16 +216,16 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
128
216
|
this._chatAgentService = _chatAgentService;
|
|
129
217
|
this.logService = logService;
|
|
130
218
|
this._participantRegistrationDisposables = ( (new DisposableMap()));
|
|
131
|
-
this.hasRegisteredDefaultParticipantView = false;
|
|
132
219
|
this._viewContainer = this.registerViewContainer();
|
|
220
|
+
this.registerDefaultParticipantView();
|
|
133
221
|
this.handleAndRegisterChatExtensions();
|
|
134
222
|
}
|
|
135
223
|
handleAndRegisterChatExtensions() {
|
|
136
224
|
chatParticipantExtensionPoint.setHandler((extensions, delta) => {
|
|
137
225
|
for (const extension of delta.added) {
|
|
138
226
|
for (const providerDescriptor of extension.value) {
|
|
139
|
-
if (!providerDescriptor.name
|
|
140
|
-
this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT register participant with invalid name: ${providerDescriptor.name}. Name must match /^[\\
|
|
227
|
+
if (!providerDescriptor.name?.match(/^[\w-]+$/)) {
|
|
228
|
+
this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT register participant with invalid name: ${providerDescriptor.name}. Name must match /^[\\w-]+$/.`);
|
|
141
229
|
continue;
|
|
142
230
|
}
|
|
143
231
|
if (providerDescriptor.fullName && AmbiguousCharacters.getInstance(( (new Set()))).containsAmbiguousCharacter(providerDescriptor.fullName)) {
|
|
@@ -160,10 +248,31 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
160
248
|
this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT register participant without both id and name.`);
|
|
161
249
|
continue;
|
|
162
250
|
}
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
251
|
+
const participantsAndCommandsDisambiguation = [];
|
|
252
|
+
let hasLoggedParticipantDetectionApiWarning = false;
|
|
253
|
+
if (providerDescriptor.disambiguation?.length) {
|
|
254
|
+
if (isProposedApiEnabled(extension.description, 'contribChatParticipantDetection')) {
|
|
255
|
+
participantsAndCommandsDisambiguation.push(...providerDescriptor.disambiguation);
|
|
256
|
+
}
|
|
257
|
+
else if (!hasLoggedParticipantDetectionApiWarning) {
|
|
258
|
+
this.logService.warn(`'${extension.description.identifier.value}' must add API proposal: 'contribChatParticipantDetection' to 'enabledApiProposals' to contribute disambiguation metadata.`);
|
|
259
|
+
hasLoggedParticipantDetectionApiWarning = true;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (providerDescriptor.commands) {
|
|
263
|
+
for (const command of providerDescriptor.commands) {
|
|
264
|
+
if (command.disambiguation?.length) {
|
|
265
|
+
if (isProposedApiEnabled(extension.description, 'contribChatParticipantDetection')) {
|
|
266
|
+
participantsAndCommandsDisambiguation.push(...command.disambiguation);
|
|
267
|
+
}
|
|
268
|
+
else if (!hasLoggedParticipantDetectionApiWarning) {
|
|
269
|
+
this.logService.warn(`'${extension.description.identifier.value}' must add API proposal: 'contribChatParticipantDetection' to 'enabledApiProposals' to contribute disambiguation metadata.`);
|
|
270
|
+
hasLoggedParticipantDetectionApiWarning = true;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
166
274
|
}
|
|
275
|
+
const store = ( (new DisposableStore()));
|
|
167
276
|
store.add(this._chatAgentService.registerAgent(providerDescriptor.id, {
|
|
168
277
|
extensionId: extension.description.identifier,
|
|
169
278
|
publisherDisplayName: extension.description.publisherDisplayName ?? extension.description.publisher,
|
|
@@ -182,20 +291,22 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
182
291
|
locations: isNonEmptyArray(providerDescriptor.locations) ?
|
|
183
292
|
( (providerDescriptor.locations.map(ChatAgentLocation.fromRaw))) :
|
|
184
293
|
[ChatAgentLocation.Panel],
|
|
185
|
-
slashCommands: providerDescriptor.commands ?? []
|
|
294
|
+
slashCommands: providerDescriptor.commands ?? [],
|
|
295
|
+
disambiguation: coalesce(participantsAndCommandsDisambiguation.flat()),
|
|
296
|
+
supportsToolReferences: providerDescriptor.supportsToolReferences,
|
|
186
297
|
}));
|
|
187
298
|
this._participantRegistrationDisposables.set(getParticipantKey(extension.description.identifier, providerDescriptor.id), store);
|
|
188
299
|
}
|
|
189
300
|
}
|
|
190
301
|
for (const extension of delta.removed) {
|
|
191
302
|
for (const providerDescriptor of extension.value) {
|
|
192
|
-
this._participantRegistrationDisposables.deleteAndDispose(getParticipantKey(extension.description.identifier, providerDescriptor.
|
|
303
|
+
this._participantRegistrationDisposables.deleteAndDispose(getParticipantKey(extension.description.identifier, providerDescriptor.id));
|
|
193
304
|
}
|
|
194
305
|
}
|
|
195
306
|
});
|
|
196
307
|
}
|
|
197
308
|
registerViewContainer() {
|
|
198
|
-
const title = ( localize2(
|
|
309
|
+
const title = ( localize2(7158, "Chat"));
|
|
199
310
|
const icon = Codicon.commentDiscussion;
|
|
200
311
|
const viewContainerId = CHAT_SIDEBAR_PANEL_ID;
|
|
201
312
|
const viewContainer = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
|
|
@@ -212,12 +323,8 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
212
323
|
}, ViewContainerLocation.Sidebar);
|
|
213
324
|
return viewContainer;
|
|
214
325
|
}
|
|
215
|
-
registerDefaultParticipantView(
|
|
216
|
-
|
|
217
|
-
this.logService.warn(`Tried to register a second default chat participant view for "${defaultParticipantDescriptor.id}"`);
|
|
218
|
-
return Disposable.None;
|
|
219
|
-
}
|
|
220
|
-
const name = defaultParticipantDescriptor.fullName ?? defaultParticipantDescriptor.name;
|
|
326
|
+
registerDefaultParticipantView() {
|
|
327
|
+
const name = 'GitHub Copilot';
|
|
221
328
|
const viewDescriptor = [{
|
|
222
329
|
id: CHAT_VIEW_ID,
|
|
223
330
|
containerIcon: this._viewContainer.icon,
|
|
@@ -227,11 +334,10 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
227
334
|
canToggleVisibility: false,
|
|
228
335
|
canMoveView: true,
|
|
229
336
|
ctorDescriptor: ( (new SyncDescriptor(ChatViewPane))),
|
|
337
|
+
when: ( (ContextKeyExpr.or(CONTEXT_CHAT_PANEL_PARTICIPANT_REGISTERED, CONTEXT_CHAT_EXTENSION_INVALID)))
|
|
230
338
|
}];
|
|
231
|
-
this.hasRegisteredDefaultParticipantView = true;
|
|
232
339
|
( (Registry.as(Extensions.ViewsRegistry))).registerViews(viewDescriptor, this._viewContainer);
|
|
233
340
|
return toDisposable(() => {
|
|
234
|
-
this.hasRegisteredDefaultParticipantView = false;
|
|
235
341
|
( (Registry.as(Extensions.ViewsRegistry))).deregisterViews(viewDescriptor, this._viewContainer);
|
|
236
342
|
});
|
|
237
343
|
}
|
|
@@ -243,5 +349,43 @@ ChatExtensionPointHandler = ( (__decorate([
|
|
|
243
349
|
function getParticipantKey(extensionId, participantName) {
|
|
244
350
|
return `${extensionId.value}_${participantName}`;
|
|
245
351
|
}
|
|
352
|
+
let ChatCompatibilityNotifier = class ChatCompatibilityNotifier {
|
|
353
|
+
static { this.ID = 'workbench.contrib.chatCompatNotifier'; }
|
|
354
|
+
constructor(extensionsWorkbenchService, contextKeyService, chatAgentService, productService) {
|
|
355
|
+
const isInvalid = CONTEXT_CHAT_EXTENSION_INVALID.bindTo(contextKeyService);
|
|
356
|
+
extensionsWorkbenchService.queryLocal().then(exts => {
|
|
357
|
+
const chat = exts.find(ext => ext.identifier.id === 'github.copilot-chat');
|
|
358
|
+
if (chat?.local?.validations.some(v => v[0] === Severity$1.Error)) {
|
|
359
|
+
const showExtensionLabel = ( localize(7159, "Show Extension"));
|
|
360
|
+
const mainMessage = ( localize(
|
|
361
|
+
7160,
|
|
362
|
+
"Chat failed to load because the installed version of the {0} extension is not compatible with this version of {1}. Please ensure that the GitHub Copilot Chat extension is up to date.",
|
|
363
|
+
'GitHub Copilot Chat',
|
|
364
|
+
productService.nameLong
|
|
365
|
+
));
|
|
366
|
+
const commandButton = `[${showExtensionLabel}](command:${showExtensionsWithIdsCommandId}?${encodeURIComponent(JSON.stringify([['GitHub.copilot-chat']]))})`;
|
|
367
|
+
const versionMessage = `GitHub Copilot Chat version: ${chat.version}`;
|
|
368
|
+
const viewsRegistry = ( (Registry.as(Extensions.ViewsRegistry)));
|
|
369
|
+
viewsRegistry.registerViewWelcomeContent(CHAT_VIEW_ID, {
|
|
370
|
+
content: [mainMessage, commandButton, versionMessage].join('\n\n'),
|
|
371
|
+
when: CONTEXT_CHAT_EXTENSION_INVALID,
|
|
372
|
+
});
|
|
373
|
+
isInvalid.set(true);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
const listener = chatAgentService.onDidChangeAgents(() => {
|
|
377
|
+
if (chatAgentService.getDefaultAgent(ChatAgentLocation.Panel)) {
|
|
378
|
+
isInvalid.set(false);
|
|
379
|
+
listener.dispose();
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
ChatCompatibilityNotifier = ( (__decorate([
|
|
385
|
+
( (__param(0, IExtensionsWorkbenchService))),
|
|
386
|
+
( (__param(1, IContextKeyService))),
|
|
387
|
+
( (__param(2, IChatAgentService))),
|
|
388
|
+
( (__param(3, IProductService)))
|
|
389
|
+
], ChatCompatibilityNotifier)));
|
|
246
390
|
|
|
247
|
-
export { ChatExtensionPointHandler };
|
|
391
|
+
export { ChatCompatibilityNotifier, ChatExtensionPointHandler };
|