@codingame/monaco-vscode-chat-service-override 13.1.6 → 14.0.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 (78) hide show
  1. package/index.js +9 -9
  2. package/package.json +20 -20
  3. package/vscode/src/vs/base/common/objectCache.d.ts +13 -0
  4. package/vscode/src/vs/base/common/objectCache.js +39 -0
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +12 -5
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +95 -23
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +10 -1
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +81 -19
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +144 -66
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +6 -3
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +17 -11
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +8 -7
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +10 -10
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +11 -8
  19. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +168 -167
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +116 -54
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +11 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.js +34 -0
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.d.ts +11 -11
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +105 -70
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +17 -16
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +154 -83
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +3 -3
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +5 -5
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +0 -4
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +150 -130
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +13 -7
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +3 -3
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +11 -6
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +449 -229
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +2 -2
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +2 -2
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +7 -6
  42. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +2 -2
  45. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +11 -9
  46. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +7 -1
  47. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +76 -13
  48. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css.js +1 -1
  49. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
  50. package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +5 -18
  51. package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +4 -122
  52. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +3 -1
  53. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +5 -4
  54. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +6 -3
  55. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +42 -11
  56. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +13 -0
  57. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +49 -0
  58. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.d.ts +14 -0
  59. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.js +69 -0
  60. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +10 -0
  61. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +24 -0
  62. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +73 -17
  63. package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.d.ts +11 -0
  64. package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.js +22 -0
  65. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
  66. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  67. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +9 -6
  68. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.d.ts +2 -2
  69. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.d.ts +2 -2
  70. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.d.ts +39 -0
  71. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.js +314 -0
  72. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +34 -19
  73. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.d.ts +0 -3
  74. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +0 -334
  75. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +0 -31
  76. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +0 -46
  77. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.d.ts +0 -29
  78. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +0 -168
@@ -1,334 +0,0 @@
1
-
2
- import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
3
- import { KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
4
- import { localize2, localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
5
- import { AccessibilitySignal } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
6
- import { IAccessibilitySignalService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
7
- import { registerAction2, Action2, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
8
- import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
9
- import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
10
- import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
11
- import { ActiveEditorContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
12
- import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
13
- import { isChatViewTitleActionContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatActions';
14
- import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
15
- import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
16
- import { WorkingSetEntryState, hasUndecidedChatEditingResourceContextKey, hasAppliedChatEditsContextKey } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
17
- import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
18
- import { ChatViewId, EditsViewId } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/chat';
19
- import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
20
- import { ChatEditorInput } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
21
- import { CHAT_CATEGORY } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
22
- import { clearChatEditor } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/actions/chatClear';
23
-
24
- const ACTION_ID_NEW_CHAT = `workbench.action.chat.newChat`;
25
- const ACTION_ID_NEW_EDIT_SESSION = `workbench.action.chat.newEditSession`;
26
- function registerNewChatActions() {
27
- registerAction2(class NewChatEditorAction extends Action2 {
28
- constructor() {
29
- super({
30
- id: 'workbench.action.chatEditor.newChat',
31
- title: ( localize2(4195, "New Chat")),
32
- icon: Codicon.plus,
33
- f1: false,
34
- precondition: ChatContextKeys.enabled,
35
- menu: [{
36
- id: MenuId.EditorTitle,
37
- group: 'navigation',
38
- order: 0,
39
- when: ( ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID)),
40
- }]
41
- });
42
- }
43
- async run(accessor, ...args) {
44
- announceChatCleared(accessor.get(IAccessibilitySignalService));
45
- await clearChatEditor(accessor);
46
- }
47
- });
48
- registerAction2(class GlobalClearChatAction extends Action2 {
49
- constructor() {
50
- super({
51
- id: ACTION_ID_NEW_CHAT,
52
- title: ( localize2(4195, "New Chat")),
53
- category: CHAT_CATEGORY,
54
- icon: Codicon.plus,
55
- precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ChatContextKeys.location.notEqualsTo(ChatAgentLocation.EditingSession)))),
56
- f1: true,
57
- keybinding: {
58
- weight: KeybindingWeight.WorkbenchContrib,
59
- primary: KeyMod.CtrlCmd | KeyCode.KeyL,
60
- mac: {
61
- primary: KeyMod.WinCtrl | KeyCode.KeyL
62
- },
63
- when: ChatContextKeys.inChatSession
64
- },
65
- menu: [{
66
- id: MenuId.ChatContext,
67
- group: 'z_clear'
68
- },
69
- {
70
- id: MenuId.ViewTitle,
71
- when: ( ContextKeyExpr.equals('view', ChatViewId)),
72
- group: 'navigation',
73
- order: -1
74
- }]
75
- });
76
- }
77
- async run(accessor, ...args) {
78
- const context = args[0];
79
- const accessibilitySignalService = accessor.get(IAccessibilitySignalService);
80
- const widgetService = accessor.get(IChatWidgetService);
81
- let widget = widgetService.lastFocusedWidget;
82
- if (isChatViewTitleActionContext(context)) {
83
- widget = widgetService.getWidgetBySessionId(context.sessionId);
84
- }
85
- if (widget) {
86
- announceChatCleared(accessibilitySignalService);
87
- widget.clear();
88
- widget.focusInput();
89
- }
90
- }
91
- });
92
- registerAction2(class NewEditSessionAction extends Action2 {
93
- constructor() {
94
- super({
95
- id: ACTION_ID_NEW_EDIT_SESSION,
96
- title: ( localize2(4196, "New Edit Session")),
97
- category: CHAT_CATEGORY,
98
- icon: Codicon.plus,
99
- precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered)),
100
- f1: true,
101
- menu: [{
102
- id: MenuId.ChatContext,
103
- group: 'z_clear'
104
- },
105
- {
106
- id: MenuId.ViewTitle,
107
- when: ( ContextKeyExpr.equals('view', EditsViewId)),
108
- group: 'navigation',
109
- order: -1
110
- }],
111
- keybinding: {
112
- weight: KeybindingWeight.WorkbenchContrib,
113
- primary: KeyMod.CtrlCmd | KeyCode.KeyL,
114
- mac: {
115
- primary: KeyMod.WinCtrl | KeyCode.KeyL
116
- },
117
- when: ( ContextKeyExpr.and(ChatContextKeys.inChatSession, ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession))))
118
- }
119
- });
120
- }
121
- async _handleCurrentEditingSession(chatEditingService, dialogService) {
122
- const currentEditingSession = chatEditingService.currentEditingSessionObs.get();
123
- const currentEdits = currentEditingSession?.entries.get();
124
- const currentEditCount = currentEdits?.length;
125
- if (currentEditingSession && currentEditCount) {
126
- const undecidedEdits = currentEdits.filter((edit) => edit.state.get() === WorkingSetEntryState.Modified);
127
- if (undecidedEdits.length) {
128
- const { result } = await dialogService.prompt({
129
- title: ( localize(4197, "Start new editing session?")),
130
- message: ( localize(
131
- 4198,
132
- "Starting a new editing session will end your current session. Do you want to accept pending edits to {0} files?",
133
- undecidedEdits.length
134
- )),
135
- type: 'info',
136
- cancelButton: true,
137
- buttons: [
138
- {
139
- label: ( localize(4199, "Accept & Continue")),
140
- run: async () => {
141
- await currentEditingSession.accept();
142
- return true;
143
- }
144
- },
145
- {
146
- label: ( localize(4200, "Discard & Continue")),
147
- run: async () => {
148
- await currentEditingSession.reject();
149
- return true;
150
- }
151
- }
152
- ],
153
- });
154
- return Boolean(result);
155
- }
156
- }
157
- return true;
158
- }
159
- async run(accessor, ...args) {
160
- const context = args[0];
161
- const accessibilitySignalService = accessor.get(IAccessibilitySignalService);
162
- const widgetService = accessor.get(IChatWidgetService);
163
- const chatEditingService = accessor.get(IChatEditingService);
164
- const dialogService = accessor.get(IDialogService);
165
- const viewsService = accessor.get(IViewsService);
166
- if (!(await this._handleCurrentEditingSession(chatEditingService, dialogService))) {
167
- return;
168
- }
169
- if (isChatViewTitleActionContext(context)) {
170
- announceChatCleared(accessibilitySignalService);
171
- const widget = widgetService.getWidgetBySessionId(context.sessionId);
172
- if (widget) {
173
- chatEditingService.currentEditingSessionObs.get()?.stop(true);
174
- widget.clear();
175
- widget.attachmentModel.clear();
176
- widget.focusInput();
177
- }
178
- }
179
- else {
180
- const chatView = await viewsService.openView(EditsViewId);
181
- const widget = chatView.widget;
182
- announceChatCleared(accessibilitySignalService);
183
- chatEditingService.currentEditingSessionObs.get()?.stop(true);
184
- widget.clear();
185
- widget.attachmentModel.clear();
186
- widget.focusInput();
187
- }
188
- }
189
- });
190
- registerAction2(class GlobalEditsDoneAction extends Action2 {
191
- constructor() {
192
- super({
193
- id: 'workbench.action.chat.done',
194
- title: ( localize2(4201, "Done")),
195
- category: CHAT_CATEGORY,
196
- precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered)),
197
- f1: false,
198
- menu: [{
199
- id: MenuId.ChatEditingWidgetToolbar,
200
- when: ( ContextKeyExpr.and(( hasUndecidedChatEditingResourceContextKey.negate()), hasAppliedChatEditsContextKey, ChatContextKeys.editingParticipantRegistered, ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession)))),
201
- group: 'navigation',
202
- order: 0
203
- }]
204
- });
205
- }
206
- async run(accessor, ...args) {
207
- const context = args[0];
208
- const accessibilitySignalService = accessor.get(IAccessibilitySignalService);
209
- const widgetService = accessor.get(IChatWidgetService);
210
- if (isChatViewTitleActionContext(context)) {
211
- announceChatCleared(accessibilitySignalService);
212
- const widget = widgetService.getWidgetBySessionId(context.sessionId);
213
- if (widget) {
214
- widget.clear();
215
- widget.attachmentModel.clear();
216
- widget.focusInput();
217
- }
218
- }
219
- else {
220
- const viewsService = accessor.get(IViewsService);
221
- const chatView = await viewsService.openView(EditsViewId);
222
- const widget = chatView.widget;
223
- announceChatCleared(accessibilitySignalService);
224
- widget.clear();
225
- widget.attachmentModel.clear();
226
- widget.focusInput();
227
- }
228
- }
229
- });
230
- registerAction2(class UndoChatEditInteractionAction extends Action2 {
231
- constructor() {
232
- super({
233
- id: 'workbench.action.chat.undoEdit',
234
- title: ( localize2(4202, "Undo Last Edit")),
235
- category: CHAT_CATEGORY,
236
- icon: Codicon.discard,
237
- precondition: ( ContextKeyExpr.and(
238
- ChatContextKeys.chatEditingCanUndo,
239
- ChatContextKeys.enabled,
240
- ChatContextKeys.editingParticipantRegistered
241
- )),
242
- f1: true,
243
- menu: [{
244
- id: MenuId.ViewTitle,
245
- when: ( ContextKeyExpr.equals('view', EditsViewId)),
246
- group: 'navigation',
247
- order: -3
248
- }]
249
- });
250
- }
251
- async run(accessor, ...args) {
252
- const chatEditingService = accessor.get(IChatEditingService);
253
- const currentEditingSession = chatEditingService.currentEditingSession;
254
- if (!currentEditingSession) {
255
- return;
256
- }
257
- await currentEditingSession.undoInteraction();
258
- }
259
- });
260
- registerAction2(class RedoChatEditInteractionAction extends Action2 {
261
- constructor() {
262
- super({
263
- id: 'workbench.action.chat.redoEdit',
264
- title: ( localize2(4203, "Redo Last Edit")),
265
- category: CHAT_CATEGORY,
266
- icon: Codicon.redo,
267
- precondition: ( ContextKeyExpr.and(
268
- ChatContextKeys.chatEditingCanRedo,
269
- ChatContextKeys.enabled,
270
- ChatContextKeys.editingParticipantRegistered
271
- )),
272
- f1: true,
273
- menu: [{
274
- id: MenuId.ViewTitle,
275
- when: ( ContextKeyExpr.equals('view', EditsViewId)),
276
- group: 'navigation',
277
- order: -2
278
- }]
279
- });
280
- }
281
- async run(accessor, ...args) {
282
- const chatEditingService = accessor.get(IChatEditingService);
283
- const currentEditingSession = chatEditingService.currentEditingSession;
284
- if (!currentEditingSession) {
285
- return;
286
- }
287
- await chatEditingService.currentEditingSession?.redoInteraction();
288
- }
289
- });
290
- registerAction2(class GlobalOpenEditsAction extends Action2 {
291
- constructor() {
292
- super({
293
- id: 'workbench.action.chat.openEditSession',
294
- title: ( localize2(4204, "Open {0}", 'Copilot Edits')),
295
- category: CHAT_CATEGORY,
296
- icon: Codicon.goToEditingSession,
297
- precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered)),
298
- f1: true,
299
- menu: [{
300
- id: MenuId.ViewTitle,
301
- when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', ChatViewId)), ChatContextKeys.editingParticipantRegistered, ( ContextKeyExpr.equals(`view.${EditsViewId}.visible`, false)), ( ContextKeyExpr.or(( ContextKeyExpr.and(( ContextKeyExpr.equals(`workbench.panel.chat.defaultViewContainerLocation`, true)), ( ContextKeyExpr.equals(`workbench.panel.chatEditing.defaultViewContainerLocation`, false)))), ( ContextKeyExpr.and(( ContextKeyExpr.equals(`workbench.panel.chat.defaultViewContainerLocation`, false)), ( ContextKeyExpr.equals(`workbench.panel.chatEditing.defaultViewContainerLocation`, true)))))))),
302
- group: 'navigation',
303
- order: 1
304
- }, {
305
- id: MenuId.ChatCommandCenter,
306
- group: 'a_open',
307
- order: 2
308
- }, {
309
- id: MenuId.ChatEditingEditorContent,
310
- group: 'navigate',
311
- order: 4,
312
- }],
313
- keybinding: {
314
- weight: KeybindingWeight.WorkbenchContrib,
315
- primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyI,
316
- linux: {
317
- primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.KeyI
318
- },
319
- when: ( ContextKeyExpr.and(( ContextKeyExpr.notEquals('view', EditsViewId)), ChatContextKeys.editingParticipantRegistered))
320
- }
321
- });
322
- }
323
- async run(accessor, ...args) {
324
- const viewsService = accessor.get(IViewsService);
325
- const chatView = await viewsService.openView(EditsViewId);
326
- chatView.widget.focusInput();
327
- }
328
- });
329
- }
330
- function announceChatCleared(accessibilitySignalService) {
331
- accessibilitySignalService.playSignal(AccessibilitySignal.clear);
332
- }
333
-
334
- export { ACTION_ID_NEW_CHAT, ACTION_ID_NEW_EDIT_SESSION, registerNewChatActions };
@@ -1,31 +0,0 @@
1
- import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
2
- import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
- import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
4
- import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents";
5
- import { WorkingSetEntryState } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService";
6
- import { IChatRequestVariableEntry } from "@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/chatModel";
7
- import { IChatWidgetHistoryService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatWidgetHistoryService.service";
8
- export interface IChatHistoryEntry {
9
- text: string;
10
- state?: IChatInputState;
11
- }
12
- export interface IChatInputState {
13
- [key: string]: any;
14
- chatContextAttachments?: ReadonlyArray<IChatRequestVariableEntry>;
15
- chatWorkingSet?: ReadonlyArray<{
16
- uri: URI;
17
- state: WorkingSetEntryState;
18
- }>;
19
- }
20
- export declare class ChatWidgetHistoryService implements IChatWidgetHistoryService {
21
- _serviceBrand: undefined;
22
- private memento;
23
- private viewState;
24
- private readonly _onDidClearHistory;
25
- readonly onDidClearHistory: Event<void>;
26
- constructor(storageService: IStorageService);
27
- getHistory(location: ChatAgentLocation): IChatHistoryEntry[];
28
- private getKey;
29
- saveHistory(location: ChatAgentLocation, history: IChatHistoryEntry[]): void;
30
- clearHistory(): void;
31
- }
@@ -1,46 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
4
- import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
5
- import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
6
- import { Memento } from '@codingame/monaco-vscode-9e888134-1a6f-58d9-b0e6-0fc047448366-common/vscode/vs/workbench/common/memento';
7
- import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
8
- import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
9
-
10
- let ChatWidgetHistoryService = class ChatWidgetHistoryService {
11
- constructor(storageService) {
12
- this._onDidClearHistory = ( new Emitter());
13
- this.onDidClearHistory = this._onDidClearHistory.event;
14
- this.memento = ( new Memento('interactive-session', storageService));
15
- const loadedState = this.memento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
16
- for (const provider in loadedState.history) {
17
- loadedState.history[provider] = ( loadedState.history[provider].map(entry => typeof entry === 'string' ? { text: entry } : entry));
18
- }
19
- this.viewState = loadedState;
20
- }
21
- getHistory(location) {
22
- const key = this.getKey(location);
23
- return this.viewState.history?.[key] ?? [];
24
- }
25
- getKey(location) {
26
- return location === ChatAgentLocation.Panel ? CHAT_PROVIDER_ID : location;
27
- }
28
- saveHistory(location, history) {
29
- if (!this.viewState.history) {
30
- this.viewState.history = {};
31
- }
32
- const key = this.getKey(location);
33
- this.viewState.history[key] = history;
34
- this.memento.saveMemento();
35
- }
36
- clearHistory() {
37
- this.viewState.history = {};
38
- this.memento.saveMemento();
39
- this._onDidClearHistory.fire();
40
- }
41
- };
42
- ChatWidgetHistoryService = ( __decorate([
43
- ( __param(0, IStorageService))
44
- ], ChatWidgetHistoryService));
45
-
46
- export { ChatWidgetHistoryService };
@@ -1,29 +0,0 @@
1
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
2
- import { Session } from "@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSession";
3
- import { IInlineChatSessionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service";
4
- import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
5
- import { IFilesConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service";
6
- import { ITextFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service";
7
- import { IInlineChatSavingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSavingService.service";
8
- import { IWorkingCopyFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service";
9
- import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
10
- import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
11
- export declare class InlineChatSavingServiceImpl implements IInlineChatSavingService {
12
- private readonly _fileConfigService;
13
- private readonly _editorGroupService;
14
- private readonly _textFileService;
15
- private readonly _configService;
16
- private readonly _workingCopyFileService;
17
- private readonly _dialogService;
18
- private readonly _labelService;
19
- readonly _serviceBrand: undefined;
20
- private readonly _store;
21
- private readonly _saveParticipant;
22
- private readonly _sessionData;
23
- constructor(_fileConfigService: IFilesConfigurationService, _editorGroupService: IEditorGroupsService, _textFileService: ITextFileService, _inlineChatSessionService: IInlineChatSessionService, _configService: IConfigurationService, _workingCopyFileService: IWorkingCopyFileService, _dialogService: IDialogService, _labelService: ILabelService);
24
- dispose(): void;
25
- markChanged(session: Session): void;
26
- private _installSaveParticpant;
27
- private _participate;
28
- private _isDisabled;
29
- }
@@ -1,168 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { Queue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
4
- import { DisposableStore, MutableDisposable, dispose, combinedDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
6
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
7
- import { SaveReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
8
- import { IInlineChatSessionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
9
- import { InlineChatConfigKeys } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
10
- import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
11
- import { IFilesConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
12
- import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
13
- import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
14
- import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
15
- import { CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
16
- import { IWorkingCopyFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
17
- import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
18
- import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
19
- import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
20
- import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
21
-
22
- const key = 'chat.editing.alwaysSaveWithGeneratedChanges';
23
- let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
24
- constructor(_fileConfigService, _editorGroupService, _textFileService, _inlineChatSessionService, _configService, _workingCopyFileService, _dialogService, _labelService) {
25
- this._fileConfigService = _fileConfigService;
26
- this._editorGroupService = _editorGroupService;
27
- this._textFileService = _textFileService;
28
- this._configService = _configService;
29
- this._workingCopyFileService = _workingCopyFileService;
30
- this._dialogService = _dialogService;
31
- this._labelService = _labelService;
32
- this._store = ( new DisposableStore());
33
- this._saveParticipant = this._store.add(( new MutableDisposable()));
34
- this._sessionData = ( new Map());
35
- this._store.add(Event.any(_inlineChatSessionService.onDidEndSession, _inlineChatSessionService.onDidStashSession)(e => {
36
- this._sessionData.get(e.session)?.dispose();
37
- }));
38
- this._store.add(_configService.onDidChangeConfiguration(e => {
39
- if (!e.affectsConfiguration(key) && !e.affectsConfiguration(InlineChatConfigKeys.AcceptedOrDiscardBeforeSave)) {
40
- return;
41
- }
42
- if (this._isDisabled()) {
43
- dispose(( this._sessionData.values()));
44
- this._sessionData.clear();
45
- }
46
- }));
47
- }
48
- dispose() {
49
- this._store.dispose();
50
- dispose(( this._sessionData.values()));
51
- }
52
- markChanged(session) {
53
- if (this._isDisabled()) {
54
- return;
55
- }
56
- if (!( this._sessionData.has(session))) {
57
- let uri = session.targetUri;
58
- if (uri.scheme === Schemas.vscodeNotebookCell) {
59
- const data = CellUri.parse(uri);
60
- if (!data) {
61
- return;
62
- }
63
- uri = data?.notebook;
64
- }
65
- if (this._sessionData.size === 0) {
66
- this._installSaveParticpant();
67
- }
68
- const saveConfigOverride = this._fileConfigService.disableAutoSave(uri);
69
- this._sessionData.set(session, {
70
- resourceUri: uri,
71
- groupCandidate: this._editorGroupService.activeGroup,
72
- session,
73
- dispose: () => {
74
- saveConfigOverride.dispose();
75
- this._sessionData.delete(session);
76
- if (this._sessionData.size === 0) {
77
- this._saveParticipant.clear();
78
- }
79
- }
80
- });
81
- }
82
- }
83
- _installSaveParticpant() {
84
- const queue = ( new Queue());
85
- const d1 = this._textFileService.files.addSaveParticipant({
86
- participate: (model, ctx, progress, token) => {
87
- return queue.queue(() => this._participate(ctx.savedFrom ?? model.textEditorModel?.uri, ctx.reason, progress, token));
88
- }
89
- });
90
- const d2 = this._workingCopyFileService.addSaveParticipant({
91
- participate: (workingCopy, ctx, progress, token) => {
92
- return queue.queue(() => this._participate(ctx.savedFrom ?? workingCopy.resource, ctx.reason, progress, token));
93
- }
94
- });
95
- this._saveParticipant.value = combinedDisposable(d1, d2, queue);
96
- }
97
- async _participate(uri, reason, progress, token) {
98
- if (reason !== SaveReason.EXPLICIT) {
99
- return;
100
- }
101
- if (this._isDisabled()) {
102
- return;
103
- }
104
- const sessions = ( new Map());
105
- for (const [session, data] of this._sessionData) {
106
- if (uri?.toString() === ( data.resourceUri.toString())) {
107
- sessions.set(session, data);
108
- }
109
- }
110
- if (sessions.size === 0) {
111
- return;
112
- }
113
- let message;
114
- if (sessions.size === 1) {
115
- const session = Iterable.first(( sessions.values())).session;
116
- const agentName = session.agent.fullName;
117
- const filelabel = this._labelService.getUriBasenameLabel(session.textModelN.uri);
118
- message = ( localize(
119
- 6793,
120
- "Do you want to save the changes {0} made in {1}?",
121
- agentName,
122
- filelabel
123
- ));
124
- }
125
- else {
126
- const labels = Array.from(( Iterable.map(( sessions.values()), i => this._labelService.getUriBasenameLabel(i.session.textModelN.uri))));
127
- message = ( localize(
128
- 6794,
129
- "Do you want to save the changes inline chat made in {0}?",
130
- labels.join(', ')
131
- ));
132
- }
133
- const result = await this._dialogService.confirm({
134
- message,
135
- detail: ( localize(
136
- 6795,
137
- "AI-generated changes may be incorrect and should be reviewed before saving."
138
- )),
139
- primaryButton: ( localize(6796, "Save")),
140
- cancelButton: ( localize(6797, "Cancel")),
141
- checkbox: {
142
- label: ( localize(6798, "Always save with AI-generated changes without asking")),
143
- checked: false
144
- }
145
- });
146
- if (!result.confirmed) {
147
- throw ( new CancellationError());
148
- }
149
- if (result.checkboxChecked) {
150
- this._configService.updateValue(key, true);
151
- }
152
- }
153
- _isDisabled() {
154
- return this._configService.getValue(InlineChatConfigKeys.AcceptedOrDiscardBeforeSave) === true || this._configService.getValue(key);
155
- }
156
- };
157
- InlineChatSavingServiceImpl = ( __decorate([
158
- ( __param(0, IFilesConfigurationService)),
159
- ( __param(1, IEditorGroupsService)),
160
- ( __param(2, ITextFileService)),
161
- ( __param(3, IInlineChatSessionService)),
162
- ( __param(4, IConfigurationService)),
163
- ( __param(5, IWorkingCopyFileService)),
164
- ( __param(6, IDialogService)),
165
- ( __param(7, ILabelService))
166
- ], InlineChatSavingServiceImpl));
167
-
168
- export { InlineChatSavingServiceImpl };