@codingame/monaco-vscode-chat-service-override 3.2.3 → 4.1.0

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.
Files changed (32) hide show
  1. package/chat.js +16 -14
  2. package/package.json +2 -2
  3. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.js +16 -0
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/external/vscode-marked/lib/marked.esm.js +0 -2200
  6. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +0 -17
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +0 -115
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +0 -501
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +0 -82
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +0 -77
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +0 -110
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +0 -171
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +0 -271
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +0 -299
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +0 -60
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.js +0 -179
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +0 -87
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +0 -271
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +0 -74
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -174
  22. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatHistoryVariables.js +0 -26
  23. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +0 -580
  24. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +0 -36
  25. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +0 -601
  26. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +0 -43
  27. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +0 -41
  28. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +0 -814
  29. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +0 -72
  30. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +0 -236
  31. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +0 -223
  32. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl.js +0 -33
@@ -1,271 +0,0 @@
1
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
2
- import marked_1 from '../../../../../../../../external/vscode-marked/lib/marked.esm.js';
3
- import { IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
4
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
5
- import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
6
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
- import { ResourceNotebookCellEdit } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
8
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
9
- import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
10
- import { CONTEXT_RESPONSE_VOTE, CONTEXT_RESPONSE, CONTEXT_CHAT_RESPONSE_SUPPORT_ISSUE_REPORTING, CONTEXT_RESPONSE_FILTERED, CONTEXT_IN_CHAT_SESSION, CONTEXT_IN_CHAT_INPUT, CONTEXT_REQUEST } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
11
- import { IChatService, InteractiveSessionVoteDirection } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
12
- import { isResponseVM, isRequestVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
13
- import { NOTEBOOK_EDITOR_ID, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
14
- import { NOTEBOOK_IS_ACTIVE_EDITOR } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
15
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
16
-
17
- function registerChatTitleActions() {
18
- registerAction2(class MarkHelpfulAction extends Action2 {
19
- constructor() {
20
- super({
21
- id: 'workbench.action.chat.markHelpful',
22
- title: ( localize2WithPath(
23
- 'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
24
- 'interactive.helpful.label',
25
- "Helpful"
26
- )),
27
- f1: false,
28
- category: CHAT_CATEGORY,
29
- icon: Codicon.thumbsup,
30
- toggled: ( CONTEXT_RESPONSE_VOTE.isEqualTo('up')),
31
- menu: {
32
- id: MenuId.ChatMessageTitle,
33
- group: 'navigation',
34
- order: 1,
35
- when: CONTEXT_RESPONSE
36
- }
37
- });
38
- }
39
- run(accessor, ...args) {
40
- const item = args[0];
41
- if (!isResponseVM(item)) {
42
- return;
43
- }
44
- const chatService = accessor.get(IChatService);
45
- chatService.notifyUserAction({
46
- providerId: item.providerId,
47
- agentId: item.agent?.id,
48
- sessionId: item.sessionId,
49
- requestId: item.requestId,
50
- result: item.result,
51
- action: {
52
- kind: 'vote',
53
- direction: InteractiveSessionVoteDirection.Up,
54
- }
55
- });
56
- item.setVote(InteractiveSessionVoteDirection.Up);
57
- }
58
- });
59
- registerAction2(class MarkUnhelpfulAction extends Action2 {
60
- constructor() {
61
- super({
62
- id: 'workbench.action.chat.markUnhelpful',
63
- title: ( localize2WithPath(
64
- 'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
65
- 'interactive.unhelpful.label',
66
- "Unhelpful"
67
- )),
68
- f1: false,
69
- category: CHAT_CATEGORY,
70
- icon: Codicon.thumbsdown,
71
- toggled: ( CONTEXT_RESPONSE_VOTE.isEqualTo('down')),
72
- menu: {
73
- id: MenuId.ChatMessageTitle,
74
- group: 'navigation',
75
- order: 2,
76
- when: CONTEXT_RESPONSE
77
- }
78
- });
79
- }
80
- run(accessor, ...args) {
81
- const item = args[0];
82
- if (!isResponseVM(item)) {
83
- return;
84
- }
85
- const chatService = accessor.get(IChatService);
86
- chatService.notifyUserAction({
87
- providerId: item.providerId,
88
- agentId: item.agent?.id,
89
- sessionId: item.sessionId,
90
- requestId: item.requestId,
91
- result: item.result,
92
- action: {
93
- kind: 'vote',
94
- direction: InteractiveSessionVoteDirection.Down,
95
- }
96
- });
97
- item.setVote(InteractiveSessionVoteDirection.Down);
98
- }
99
- });
100
- registerAction2(class ReportIssueForBugAction extends Action2 {
101
- constructor() {
102
- super({
103
- id: 'workbench.action.chat.reportIssueForBug',
104
- title: ( localize2WithPath(
105
- 'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
106
- 'interactive.reportIssueForBug.label',
107
- "Report Issue"
108
- )),
109
- f1: false,
110
- category: CHAT_CATEGORY,
111
- icon: Codicon.report,
112
- menu: {
113
- id: MenuId.ChatMessageTitle,
114
- group: 'navigation',
115
- order: 3,
116
- when: ( ContextKeyExpr.and(CONTEXT_CHAT_RESPONSE_SUPPORT_ISSUE_REPORTING, CONTEXT_RESPONSE))
117
- }
118
- });
119
- }
120
- run(accessor, ...args) {
121
- const item = args[0];
122
- if (!isResponseVM(item)) {
123
- return;
124
- }
125
- const chatService = accessor.get(IChatService);
126
- chatService.notifyUserAction({
127
- providerId: item.providerId,
128
- agentId: item.agent?.id,
129
- sessionId: item.sessionId,
130
- requestId: item.requestId,
131
- result: item.result,
132
- action: {
133
- kind: 'bug'
134
- }
135
- });
136
- }
137
- });
138
- registerAction2(class InsertToNotebookAction extends Action2 {
139
- constructor() {
140
- super({
141
- id: 'workbench.action.chat.insertIntoNotebook',
142
- title: ( localize2WithPath(
143
- 'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
144
- 'interactive.insertIntoNotebook.label',
145
- "Insert into Notebook"
146
- )),
147
- f1: false,
148
- category: CHAT_CATEGORY,
149
- icon: Codicon.insert,
150
- menu: {
151
- id: MenuId.ChatMessageTitle,
152
- group: 'navigation',
153
- isHiddenByDefault: true,
154
- when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, CONTEXT_RESPONSE, ( CONTEXT_RESPONSE_FILTERED.negate())))
155
- }
156
- });
157
- }
158
- async run(accessor, ...args) {
159
- const item = args[0];
160
- if (!isResponseVM(item)) {
161
- return;
162
- }
163
- const editorService = accessor.get(IEditorService);
164
- if (editorService.activeEditorPane?.getId() === NOTEBOOK_EDITOR_ID) {
165
- const notebookEditor = editorService.activeEditorPane.getControl();
166
- if (!notebookEditor.hasModel()) {
167
- return;
168
- }
169
- if (notebookEditor.isReadOnly) {
170
- return;
171
- }
172
- const value = item.response.asString();
173
- const splitContents = splitMarkdownAndCodeBlocks(value);
174
- const focusRange = notebookEditor.getFocus();
175
- const index = Math.max(focusRange.end, 0);
176
- const bulkEditService = accessor.get(IBulkEditService);
177
- await bulkEditService.apply([
178
- ( new ResourceNotebookCellEdit(notebookEditor.textModel.uri, {
179
- editType: 1 ,
180
- index: index,
181
- count: 0,
182
- cells: ( splitContents.map(content => {
183
- const kind = content.type === 'markdown' ? CellKind.Markup : CellKind.Code;
184
- const language = content.type === 'markdown' ? 'markdown' : content.language;
185
- const mime = content.type === 'markdown' ? 'text/markdown' : `text/x-${content.language}`;
186
- return {
187
- cellKind: kind,
188
- language,
189
- mime,
190
- source: content.content,
191
- outputs: [],
192
- metadata: {}
193
- };
194
- }))
195
- }))
196
- ], { quotableLabel: 'Insert into Notebook' });
197
- }
198
- }
199
- });
200
- registerAction2(class RemoveAction extends Action2 {
201
- constructor() {
202
- super({
203
- id: 'workbench.action.chat.remove',
204
- title: ( localize2WithPath(
205
- 'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
206
- 'chat.remove.label',
207
- "Remove Request and Response"
208
- )),
209
- f1: false,
210
- category: CHAT_CATEGORY,
211
- icon: Codicon.x,
212
- keybinding: {
213
- primary: 20 ,
214
- mac: {
215
- primary: 2048 | 1 ,
216
- },
217
- when: ( ContextKeyExpr.and(CONTEXT_IN_CHAT_SESSION, ( CONTEXT_IN_CHAT_INPUT.negate()))),
218
- weight: 200 ,
219
- },
220
- menu: {
221
- id: MenuId.ChatMessageTitle,
222
- group: 'navigation',
223
- order: 2,
224
- when: CONTEXT_REQUEST
225
- }
226
- });
227
- }
228
- run(accessor, ...args) {
229
- let item = args[0];
230
- if (!isRequestVM(item)) {
231
- const chatWidgetService = accessor.get(IChatWidgetService);
232
- const widget = chatWidgetService.lastFocusedWidget;
233
- item = widget?.getFocus();
234
- }
235
- const requestId = isRequestVM(item) ? item.id :
236
- isResponseVM(item) ? item.requestId : undefined;
237
- if (requestId) {
238
- const chatService = accessor.get(IChatService);
239
- chatService.removeRequest(item.sessionId, requestId);
240
- }
241
- }
242
- });
243
- }
244
- function splitMarkdownAndCodeBlocks(markdown) {
245
- const lexer = new marked_1.Lexer();
246
- const tokens = lexer.lex(markdown);
247
- const splitContent = [];
248
- let markdownPart = '';
249
- tokens.forEach((token) => {
250
- if (token.type === 'code') {
251
- if (markdownPart.trim()) {
252
- splitContent.push({ type: 'markdown', content: markdownPart });
253
- markdownPart = '';
254
- }
255
- splitContent.push({
256
- type: 'code',
257
- language: token.lang || '',
258
- content: token.text,
259
- });
260
- }
261
- else {
262
- markdownPart += token.raw;
263
- }
264
- });
265
- if (markdownPart.trim()) {
266
- splitContent.push({ type: 'markdown', content: markdownPart });
267
- }
268
- return splitContent;
269
- }
270
-
271
- export { registerChatTitleActions };
@@ -1,299 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
4
- import { isMacintosh } from 'vscode/vscode/vs/base/common/platform';
5
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
6
- import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
7
- import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
8
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
9
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
10
- import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
11
- import { Extensions as Extensions$1, registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
12
- import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
13
- import { registerChatActions } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
14
- import { registerChatCodeBlockActions } from './actions/chatCodeblockActions.js';
15
- import { registerChatCopyActions } from './actions/chatCopyActions.js';
16
- import { registerChatExecuteActions, SubmitAction } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatExecuteActions';
17
- import { registerQuickChatActions } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions';
18
- import { registerChatTitleActions } from './actions/chatTitleActions.js';
19
- import { registerChatExportActions } from './actions/chatImportExport.js';
20
- import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
21
- import { ChatEditor } from './chatEditor.js';
22
- import { ChatEditorInput, ChatEditorInputSerializer } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
23
- import './contrib/chatInputEditorContrib.js';
24
- import './contrib/chatHistoryVariables.js';
25
- import { RegisteredEditorPriority, IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
26
- import { registerMoveActions } from './actions/chatMoveActions.js';
27
- import { registerNewChatActions, ACTION_ID_NEW_CHAT } from './actions/chatClearActions.js';
28
- import { IAccessibleViewService } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleView';
29
- import { isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
30
- import { CONTEXT_IN_CHAT_SESSION } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
31
- import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
32
- import { ChatWelcomeMessageModel } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
33
- import { isMarkdownString, MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
34
- import { IChatSlashCommandService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatSlashCommands';
35
- import { alertFocusChange } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityContributions';
36
- import { AccessibleViewAction } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleViewActions';
37
- import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
38
- import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables';
39
- import { registerChatFileTreeActions } from './actions/chatFileTreeActions.js';
40
- import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
41
- import { chatAgentLeader, chatSubcommandLeader, chatVariableLeader } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
42
- import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
43
-
44
- const configurationRegistry = ( Registry.as(Extensions.Configuration));
45
- configurationRegistry.registerConfiguration({
46
- id: 'chatSidebar',
47
- title: ( localizeWithPath(
48
- 'vs/workbench/contrib/chat/browser/chat.contribution',
49
- 'interactiveSessionConfigurationTitle',
50
- "Chat"
51
- )),
52
- type: 'object',
53
- properties: {
54
- 'chat.editor.fontSize': {
55
- type: 'number',
56
- description: ( localizeWithPath(
57
- 'vs/workbench/contrib/chat/browser/chat.contribution',
58
- 'interactiveSession.editor.fontSize',
59
- "Controls the font size in pixels in chat codeblocks."
60
- )),
61
- default: isMacintosh ? 12 : 14,
62
- },
63
- 'chat.editor.fontFamily': {
64
- type: 'string',
65
- description: ( localizeWithPath(
66
- 'vs/workbench/contrib/chat/browser/chat.contribution',
67
- 'interactiveSession.editor.fontFamily',
68
- "Controls the font family in chat codeblocks."
69
- )),
70
- default: 'default'
71
- },
72
- 'chat.editor.fontWeight': {
73
- type: 'string',
74
- description: ( localizeWithPath(
75
- 'vs/workbench/contrib/chat/browser/chat.contribution',
76
- 'interactiveSession.editor.fontWeight',
77
- "Controls the font weight in chat codeblocks."
78
- )),
79
- default: 'default'
80
- },
81
- 'chat.editor.wordWrap': {
82
- type: 'string',
83
- description: ( localizeWithPath(
84
- 'vs/workbench/contrib/chat/browser/chat.contribution',
85
- 'interactiveSession.editor.wordWrap',
86
- "Controls whether lines should wrap in chat codeblocks."
87
- )),
88
- default: 'off',
89
- enum: ['on', 'off']
90
- },
91
- 'chat.editor.lineHeight': {
92
- type: 'number',
93
- description: ( localizeWithPath(
94
- 'vs/workbench/contrib/chat/browser/chat.contribution',
95
- 'interactiveSession.editor.lineHeight',
96
- "Controls the line height in pixels in chat codeblocks. Use 0 to compute the line height from the font size."
97
- )),
98
- default: 0
99
- }
100
- }
101
- });
102
- ( Registry.as(EditorExtensions.EditorPane)).registerEditorPane(EditorPaneDescriptor.create(ChatEditor, ChatEditorInput.EditorID, ( localizeWithPath('vs/workbench/contrib/chat/browser/chat.contribution', 'chat', "Chat"))), [
103
- ( new SyncDescriptor(ChatEditorInput))
104
- ]);
105
- let ChatResolverContribution = class ChatResolverContribution extends Disposable {
106
- static { this.ID = 'workbench.contrib.chatResolver'; }
107
- constructor(editorResolverService, instantiationService) {
108
- super();
109
- this._register(editorResolverService.registerEditor(`${Schemas.vscodeChatSesssion}:**/**`, {
110
- id: ChatEditorInput.EditorID,
111
- label: ( localizeWithPath('vs/workbench/contrib/chat/browser/chat.contribution', 'chat', "Chat")),
112
- priority: RegisteredEditorPriority.builtin
113
- }, {
114
- singlePerResource: true,
115
- canSupportResource: resource => resource.scheme === Schemas.vscodeChatSesssion
116
- }, {
117
- createEditorInput: ({ resource, options }) => {
118
- return { editor: instantiationService.createInstance(ChatEditorInput, resource, options), options };
119
- }
120
- }));
121
- }
122
- };
123
- ChatResolverContribution = ( __decorate([
124
- ( __param(0, IEditorResolverService)),
125
- ( __param(1, IInstantiationService))
126
- ], ChatResolverContribution));
127
- class ChatAccessibleViewContribution extends Disposable {
128
- constructor() {
129
- super();
130
- this._register(AccessibleViewAction.addImplementation(100, 'panelChat', accessor => {
131
- const accessibleViewService = accessor.get(IAccessibleViewService);
132
- const widgetService = accessor.get(IChatWidgetService);
133
- const codeEditorService = accessor.get(ICodeEditorService);
134
- return renderAccessibleView(accessibleViewService, widgetService, codeEditorService, true);
135
- function renderAccessibleView(accessibleViewService, widgetService, codeEditorService, initialRender) {
136
- const widget = widgetService.lastFocusedWidget;
137
- if (!widget) {
138
- return false;
139
- }
140
- const chatInputFocused = initialRender && !!codeEditorService.getFocusedCodeEditor();
141
- if (initialRender && chatInputFocused) {
142
- widget.focusLastMessage();
143
- }
144
- if (!widget) {
145
- return false;
146
- }
147
- const verifiedWidget = widget;
148
- const focusedItem = verifiedWidget.getFocus();
149
- if (!focusedItem) {
150
- return false;
151
- }
152
- widget.focus(focusedItem);
153
- const isWelcome = focusedItem instanceof ChatWelcomeMessageModel;
154
- let responseContent = isResponseVM(focusedItem) ? focusedItem.response.asString() : undefined;
155
- if (isWelcome) {
156
- const welcomeReplyContents = [];
157
- for (const content of focusedItem.content) {
158
- if (Array.isArray(content)) {
159
- welcomeReplyContents.push(...( content.map(m => m.message)));
160
- }
161
- else {
162
- welcomeReplyContents.push(content.value);
163
- }
164
- }
165
- responseContent = welcomeReplyContents.join('\n');
166
- }
167
- if (!responseContent && 'errorDetails' in focusedItem && focusedItem.errorDetails) {
168
- responseContent = focusedItem.errorDetails.message;
169
- }
170
- if (!responseContent) {
171
- return false;
172
- }
173
- const responses = verifiedWidget.viewModel?.getItems().filter(i => isResponseVM(i));
174
- const length = responses?.length;
175
- const responseIndex = responses?.findIndex(i => i === focusedItem);
176
- accessibleViewService.show({
177
- id: "panelChat" ,
178
- verbositySettingKey: "accessibility.verbosity.panelChat" ,
179
- provideContent() { return responseContent; },
180
- onClose() {
181
- verifiedWidget.reveal(focusedItem);
182
- if (chatInputFocused) {
183
- verifiedWidget.focusInput();
184
- }
185
- else {
186
- verifiedWidget.focus(focusedItem);
187
- }
188
- },
189
- next() {
190
- verifiedWidget.moveFocus(focusedItem, 'next');
191
- alertFocusChange(responseIndex, length, 'next');
192
- renderAccessibleView(accessibleViewService, widgetService, codeEditorService);
193
- },
194
- previous() {
195
- verifiedWidget.moveFocus(focusedItem, 'previous');
196
- alertFocusChange(responseIndex, length, 'previous');
197
- renderAccessibleView(accessibleViewService, widgetService, codeEditorService);
198
- },
199
- options: { type: "view" }
200
- });
201
- return true;
202
- }
203
- }, CONTEXT_IN_CHAT_SESSION));
204
- }
205
- }
206
- let ChatSlashStaticSlashCommandsContribution = class ChatSlashStaticSlashCommandsContribution extends Disposable {
207
- constructor(slashCommandService, commandService, chatAgentService, chatVariablesService) {
208
- super();
209
- this._store.add(slashCommandService.registerSlashCommand({
210
- command: 'clear',
211
- detail: ( localizeWithPath(
212
- 'vs/workbench/contrib/chat/browser/chat.contribution',
213
- 'clear',
214
- "Start a new chat"
215
- )),
216
- sortText: 'z2_clear',
217
- executeImmediately: true
218
- }, async () => {
219
- commandService.executeCommand(ACTION_ID_NEW_CHAT);
220
- }));
221
- this._store.add(slashCommandService.registerSlashCommand({
222
- command: 'help',
223
- detail: '',
224
- sortText: 'z1_help',
225
- executeImmediately: true
226
- }, async (prompt, progress) => {
227
- const defaultAgent = chatAgentService.getDefaultAgent();
228
- const agents = chatAgentService.getAgents();
229
- if (defaultAgent?.metadata.helpTextPrefix) {
230
- if (isMarkdownString(defaultAgent.metadata.helpTextPrefix)) {
231
- progress.report({ content: defaultAgent.metadata.helpTextPrefix, kind: 'markdownContent' });
232
- }
233
- else {
234
- progress.report({ content: defaultAgent.metadata.helpTextPrefix, kind: 'content' });
235
- }
236
- progress.report({ content: '\n\n', kind: 'content' });
237
- }
238
- const agentText = (await Promise.all(( agents
239
- .filter(a => a.id !== defaultAgent?.id)
240
- .map(async (a) => {
241
- const agentWithLeader = `${chatAgentLeader}${a.id}`;
242
- const actionArg = { inputValue: `${agentWithLeader} ${a.metadata.sampleRequest}` };
243
- const urlSafeArg = encodeURIComponent(JSON.stringify(actionArg));
244
- const agentLine = `* [\`${agentWithLeader}\`](command:${SubmitAction.ID}?${urlSafeArg}) - ${a.metadata.description}`;
245
- const commands = await a.provideSlashCommands(undefined, [], CancellationToken.None);
246
- const commandText = ( commands.map(c => {
247
- const actionArg = { inputValue: `${agentWithLeader} ${chatSubcommandLeader}${c.name} ${c.sampleRequest ?? ''}` };
248
- const urlSafeArg = encodeURIComponent(JSON.stringify(actionArg));
249
- return `\t* [\`${chatSubcommandLeader}${c.name}\`](command:${SubmitAction.ID}?${urlSafeArg}) - ${c.description}`;
250
- })).join('\n');
251
- return (agentLine + '\n' + commandText).trim();
252
- })))).join('\n');
253
- progress.report({ content: ( new MarkdownString(agentText, { isTrusted: { enabledCommands: [SubmitAction.ID] } })), kind: 'markdownContent' });
254
- if (defaultAgent?.metadata.helpTextVariablesPrefix) {
255
- progress.report({ content: '\n\n', kind: 'content' });
256
- if (isMarkdownString(defaultAgent.metadata.helpTextVariablesPrefix)) {
257
- progress.report({ content: defaultAgent.metadata.helpTextVariablesPrefix, kind: 'markdownContent' });
258
- }
259
- else {
260
- progress.report({ content: defaultAgent.metadata.helpTextVariablesPrefix, kind: 'content' });
261
- }
262
- const variableText = ( Array.from(chatVariablesService.getVariables())
263
- .map(v => `* \`${chatVariableLeader}${v.name}\` - ${v.description}`))
264
- .join('\n');
265
- progress.report({ content: '\n' + variableText, kind: 'content' });
266
- }
267
- if (defaultAgent?.metadata.helpTextPostfix) {
268
- progress.report({ content: '\n\n', kind: 'content' });
269
- if (isMarkdownString(defaultAgent.metadata.helpTextPostfix)) {
270
- progress.report({ content: defaultAgent.metadata.helpTextPostfix, kind: 'markdownContent' });
271
- }
272
- else {
273
- progress.report({ content: defaultAgent.metadata.helpTextPostfix, kind: 'content' });
274
- }
275
- }
276
- }));
277
- }
278
- };
279
- ChatSlashStaticSlashCommandsContribution = ( __decorate([
280
- ( __param(0, IChatSlashCommandService)),
281
- ( __param(1, ICommandService)),
282
- ( __param(2, IChatAgentService)),
283
- ( __param(3, IChatVariablesService))
284
- ], ChatSlashStaticSlashCommandsContribution));
285
- const workbenchContributionsRegistry = ( Registry.as(Extensions$1.Workbench));
286
- registerWorkbenchContribution2(ChatResolverContribution.ID, ChatResolverContribution, 1 );
287
- workbenchContributionsRegistry.registerWorkbenchContribution(ChatAccessibleViewContribution, 4 );
288
- workbenchContributionsRegistry.registerWorkbenchContribution(ChatSlashStaticSlashCommandsContribution, 4 );
289
- ( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(ChatEditorInput.TypeID, ChatEditorInputSerializer);
290
- registerChatActions();
291
- registerChatCopyActions();
292
- registerChatCodeBlockActions();
293
- registerChatFileTreeActions();
294
- registerChatTitleActions();
295
- registerChatExecuteActions();
296
- registerQuickChatActions();
297
- registerChatExportActions();
298
- registerMoveActions();
299
- registerNewChatActions();
@@ -1,60 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { status } from 'vscode/vscode/vs/base/browser/ui/aria/aria';
3
- import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
4
- import { Disposable, DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { AccessibilitySignal, IAccessibilitySignalService } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
6
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
7
-
8
- let ChatAccessibilityService = class ChatAccessibilityService extends Disposable {
9
- constructor(_accessibilitySignalService, _instantiationService) {
10
- super();
11
- this._accessibilitySignalService = _accessibilitySignalService;
12
- this._instantiationService = _instantiationService;
13
- this._pendingCueMap = this._register(( new DisposableMap()));
14
- this._requestId = 0;
15
- }
16
- acceptRequest() {
17
- this._requestId++;
18
- this._accessibilitySignalService.playSignal(AccessibilitySignal.chatRequestSent, { allowManyInParallel: true });
19
- this._pendingCueMap.set(this._requestId, this._instantiationService.createInstance(AudioCueScheduler));
20
- return this._requestId;
21
- }
22
- acceptResponse(response, requestId) {
23
- this._pendingCueMap.deleteAndDispose(requestId);
24
- const isPanelChat = typeof response !== 'string';
25
- const responseContent = typeof response === 'string' ? response : response?.response.asString();
26
- this._accessibilitySignalService.playSignal(AccessibilitySignal.chatResponseReceived, { allowManyInParallel: true });
27
- if (!response) {
28
- return;
29
- }
30
- const errorDetails = isPanelChat && response.errorDetails ? ` ${response.errorDetails.message}` : '';
31
- status(responseContent + errorDetails);
32
- }
33
- };
34
- ChatAccessibilityService = ( __decorate([
35
- ( __param(0, IAccessibilitySignalService)),
36
- ( __param(1, IInstantiationService))
37
- ], ChatAccessibilityService));
38
- const CHAT_RESPONSE_PENDING_AUDIO_CUE_LOOP_MS = 5000;
39
- const CHAT_RESPONSE_PENDING_ALLOWANCE_MS = 4000;
40
- let AudioCueScheduler = class AudioCueScheduler extends Disposable {
41
- constructor(_accessibilitySignalService) {
42
- super();
43
- this._accessibilitySignalService = _accessibilitySignalService;
44
- this._scheduler = ( new RunOnceScheduler(() => {
45
- this._audioCueLoop = this._accessibilitySignalService.playSignalLoop(AccessibilitySignal.chatResponsePending, CHAT_RESPONSE_PENDING_AUDIO_CUE_LOOP_MS);
46
- }, CHAT_RESPONSE_PENDING_ALLOWANCE_MS));
47
- this._scheduler.schedule();
48
- }
49
- dispose() {
50
- super.dispose();
51
- this._audioCueLoop?.dispose();
52
- this._scheduler.cancel();
53
- this._scheduler.dispose();
54
- }
55
- };
56
- AudioCueScheduler = ( __decorate([
57
- ( __param(0, IAccessibilitySignalService))
58
- ], AudioCueScheduler));
59
-
60
- export { ChatAccessibilityService };