@codingame/monaco-vscode-chat-service-override 13.1.7 → 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.
- package/index.js +9 -9
- package/package.json +20 -20
- package/vscode/src/vs/base/common/objectCache.d.ts +13 -0
- package/vscode/src/vs/base/common/objectCache.js +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +12 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +95 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +81 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +144 -66
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +17 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +8 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +11 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +168 -167
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +116 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.js +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.d.ts +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +105 -70
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +17 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +154 -83
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +150 -130
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +13 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +11 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +449 -229
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +7 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +11 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +7 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +76 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +5 -18
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +4 -122
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +6 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +42 -11
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +24 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +73 -17
- package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.js +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +9 -6
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.js +314 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +34 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +0 -334
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +0 -46
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +0 -168
|
@@ -1,49 +1,48 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { Sequencer, timeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
|
+
import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
4
5
|
import { BugIndicatingError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
5
6
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
-
import {
|
|
7
|
+
import { StringSHA1 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/hash';
|
|
8
|
+
import { Disposable, DisposableMap, dispose, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
9
|
import { ResourceMap, ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
8
|
-
import {
|
|
10
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
11
|
+
import { observableValue, transaction, asyncTransaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
|
|
9
12
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
10
|
-
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
13
|
+
import { autorun, autorunDelta, autorunIterableDelta } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
11
14
|
import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
12
15
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
13
16
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
|
|
17
|
+
import { isEqual, joinPath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
14
18
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
15
19
|
import { isDiffEditor, isCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
|
|
16
20
|
import { IBulkEditService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService';
|
|
21
|
+
import { OffsetEdit } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/offsetEdit';
|
|
17
22
|
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language';
|
|
18
23
|
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model';
|
|
19
24
|
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService';
|
|
20
25
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
21
|
-
import { IFileDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
22
26
|
import { EditorActivation } from '@codingame/monaco-vscode-api/vscode/vs/platform/editor/common/editor';
|
|
27
|
+
import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
|
|
23
28
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
24
29
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
30
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
25
31
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
26
|
-
import {
|
|
32
|
+
import { SaveReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
33
|
+
import { DiffEditorInput } from '@codingame/monaco-vscode-4a28f637-7c3c-5e48-a77c-1b7538b38850-common/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
27
34
|
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
28
35
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
36
|
+
import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
37
|
+
import { MultiDiffEditorInput } from '@codingame/monaco-vscode-168b98e5-dc20-5807-b1f9-798f1f92b37f-common/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
38
|
+
import { isNotebookEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
39
|
+
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
31
40
|
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
32
|
-
import { ChatEditingSessionState, ChatEditingSessionChangeType, WorkingSetEntryState, WorkingSetEntryRemovalReason, ChatEditKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
33
|
-
import { ChatEditingMultiDiffSourceResolver } from './chatEditingService.js';
|
|
34
|
-
import { ChatEditingModifiedFileEntry } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry';
|
|
35
|
-
import { ChatEditingTextModelContentProvider } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders';
|
|
36
|
-
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
37
|
-
import { isEqual, joinPath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
38
|
-
import { StringSHA1 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/hash';
|
|
39
|
-
import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
|
|
40
|
-
import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
41
|
-
import { OffsetEdit } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/offsetEdit';
|
|
42
|
-
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
41
|
+
import { ChatEditingSessionState, ChatEditingSessionChangeType, WorkingSetEntryState, WorkingSetEntryRemovalReason, getMultiDiffSourceUri, ChatEditKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
43
42
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
44
|
-
import {
|
|
43
|
+
import { ChatEditingModifiedFileEntry } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry';
|
|
45
44
|
import { ChatEditingModifiedNotebookEntry } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry';
|
|
46
|
-
import {
|
|
45
|
+
import { ChatEditingTextModelContentProvider } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders';
|
|
47
46
|
|
|
48
47
|
const STORAGE_CONTENTS_FOLDER = 'contents';
|
|
49
48
|
const STORAGE_STATE_FILE = 'state.json';
|
|
@@ -96,14 +95,15 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
96
95
|
this._assertNotDisposed();
|
|
97
96
|
return this._onDidDispose.event;
|
|
98
97
|
}
|
|
99
|
-
get
|
|
100
|
-
this.
|
|
101
|
-
return Boolean(this._editorPane && this._editorPane.isVisible());
|
|
98
|
+
get isToolsAgentSession() {
|
|
99
|
+
return this._isToolsAgentSession;
|
|
102
100
|
}
|
|
103
|
-
constructor(chatSessionId, editingSessionFileLimitPromise, _instantiationService, _modelService, _languageService, _textModelService, _bulkEditService, _editorGroupsService, _editorService,
|
|
101
|
+
constructor(chatSessionId, isGlobalEditingSession, editingSessionFileLimitPromise, _lookupExternalEntry, _instantiationService, _modelService, _languageService, _textModelService, _bulkEditService, _editorGroupsService, _editorService, _chatService, _notebookService, _textFileService, _chatAgentService) {
|
|
104
102
|
super();
|
|
105
103
|
this.chatSessionId = chatSessionId;
|
|
104
|
+
this.isGlobalEditingSession = isGlobalEditingSession;
|
|
106
105
|
this.editingSessionFileLimitPromise = editingSessionFileLimitPromise;
|
|
106
|
+
this._lookupExternalEntry = _lookupExternalEntry;
|
|
107
107
|
this._instantiationService = _instantiationService;
|
|
108
108
|
this._modelService = _modelService;
|
|
109
109
|
this._languageService = _languageService;
|
|
@@ -111,17 +111,14 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
111
111
|
this._bulkEditService = _bulkEditService;
|
|
112
112
|
this._editorGroupsService = _editorGroupsService;
|
|
113
113
|
this._editorService = _editorService;
|
|
114
|
-
this._workspaceContextService = _workspaceContextService;
|
|
115
|
-
this._fileService = _fileService;
|
|
116
|
-
this._dialogService = _dialogService;
|
|
117
|
-
this._chatAgentService = _chatAgentService;
|
|
118
114
|
this._chatService = _chatService;
|
|
119
115
|
this._notebookService = _notebookService;
|
|
116
|
+
this._textFileService = _textFileService;
|
|
117
|
+
this._chatAgentService = _chatAgentService;
|
|
120
118
|
this._state = observableValue(this, ChatEditingSessionState.Initial);
|
|
121
119
|
this._linearHistory = observableValue(this, []);
|
|
122
120
|
this._linearHistoryIndex = observableValue(this, 0);
|
|
123
121
|
this._initialFileContents = ( new ResourceMap());
|
|
124
|
-
this._filesToSkipCreating = ( new ResourceSet());
|
|
125
122
|
this._entriesObs = observableValue(this, []);
|
|
126
123
|
this._sequencer = ( new ThrottledSequencer(15, 1000));
|
|
127
124
|
this._workingSet = ( new ResourceMap());
|
|
@@ -146,15 +143,13 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
146
143
|
const linearHistoryIndex = this._linearHistoryIndex.read(r);
|
|
147
144
|
return ( linearHistory.slice(linearHistoryIndex).map(s => s.requestId)).filter((r) => !!r);
|
|
148
145
|
});
|
|
149
|
-
this._onDidChange = ( new Emitter());
|
|
146
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
150
147
|
this._onDidDispose = ( new Emitter());
|
|
148
|
+
this._isToolsAgentSession = false;
|
|
151
149
|
}
|
|
152
150
|
async init() {
|
|
153
151
|
const restoredSessionState = await this._instantiationService.createInstance(ChatEditingSessionStorage, this.chatSessionId).restoreState();
|
|
154
152
|
if (restoredSessionState) {
|
|
155
|
-
for (const uri of restoredSessionState.filesToSkipCreating) {
|
|
156
|
-
this._filesToSkipCreating.add(uri);
|
|
157
|
-
}
|
|
158
153
|
for (const [uri, content] of restoredSessionState.initialFileContents) {
|
|
159
154
|
this._initialFileContents.set(uri, content);
|
|
160
155
|
}
|
|
@@ -165,6 +160,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
165
160
|
this._state.set(ChatEditingSessionState.Idle, undefined);
|
|
166
161
|
}
|
|
167
162
|
this._trackCurrentEditorsInWorkingSet();
|
|
163
|
+
this._triggerSaveParticipantsOnAccept();
|
|
168
164
|
this._register(this._editorService.onDidVisibleEditorsChange(() => {
|
|
169
165
|
this._trackCurrentEditorsInWorkingSet();
|
|
170
166
|
}));
|
|
@@ -185,7 +181,6 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
185
181
|
storeState() {
|
|
186
182
|
const storage = this._instantiationService.createInstance(ChatEditingSessionStorage, this.chatSessionId);
|
|
187
183
|
const state = {
|
|
188
|
-
filesToSkipCreating: [...this._filesToSkipCreating],
|
|
189
184
|
initialFileContents: this._initialFileContents,
|
|
190
185
|
pendingSnapshot: this._pendingSnapshot,
|
|
191
186
|
recentSnapshot: this._createSnapshot(undefined),
|
|
@@ -194,6 +189,31 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
194
189
|
};
|
|
195
190
|
return storage.storeState(state);
|
|
196
191
|
}
|
|
192
|
+
_triggerSaveParticipantsOnAccept() {
|
|
193
|
+
const im = this._register(( new DisposableMap()));
|
|
194
|
+
const attachToEntry = (entry) => {
|
|
195
|
+
return autorunDelta(entry.state, ({ lastValue, newValue }) => {
|
|
196
|
+
if (newValue === WorkingSetEntryState.Accepted && lastValue === WorkingSetEntryState.Modified) {
|
|
197
|
+
if (!this._textFileService.isDirty(entry.modifiedURI)) {
|
|
198
|
+
this._textFileService.save(entry.modifiedURI, {
|
|
199
|
+
reason: SaveReason.EXPLICIT,
|
|
200
|
+
force: true,
|
|
201
|
+
ignoreErrorHandler: true,
|
|
202
|
+
}).catch(() => {
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
this._register(autorunIterableDelta(reader => this._entriesObs.read(reader), ({ addedValues, removedValues }) => {
|
|
209
|
+
for (const entry of addedValues) {
|
|
210
|
+
im.set(entry, attachToEntry(entry));
|
|
211
|
+
}
|
|
212
|
+
for (const entry of removedValues) {
|
|
213
|
+
im.deleteAndDispose(entry);
|
|
214
|
+
}
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
197
217
|
_trackCurrentEditorsInWorkingSet(e) {
|
|
198
218
|
const existingTransientEntries = ( new ResourceSet());
|
|
199
219
|
for (const file of ( this._workingSet.keys())) {
|
|
@@ -225,7 +245,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
225
245
|
if (( existingTransientEntries.has(uri))) {
|
|
226
246
|
existingTransientEntries.delete(uri);
|
|
227
247
|
}
|
|
228
|
-
else if (!( this._workingSet.has(uri)) && !( this._removedTransientEntries.has(uri))) {
|
|
248
|
+
else if ((!( this._workingSet.has(uri)) || this._workingSet.get(uri)?.state === WorkingSetEntryState.Suggested) && !( this._removedTransientEntries.has(uri))) {
|
|
229
249
|
activeEditors.add(uri);
|
|
230
250
|
}
|
|
231
251
|
});
|
|
@@ -234,7 +254,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
234
254
|
didChange = this._workingSet.delete(entry) || didChange;
|
|
235
255
|
}
|
|
236
256
|
for (const entry of activeEditors) {
|
|
237
|
-
this._workingSet.set(entry, { state: WorkingSetEntryState.Transient, description: ( localize(
|
|
257
|
+
this._workingSet.set(entry, { state: WorkingSetEntryState.Transient, description: ( localize(4503, "Open Editor")) });
|
|
238
258
|
didChange = true;
|
|
239
259
|
}
|
|
240
260
|
if (didChange) {
|
|
@@ -249,7 +269,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
249
269
|
if (requestId) {
|
|
250
270
|
for (const [uri, data] of this._workingSet) {
|
|
251
271
|
if (data.state !== WorkingSetEntryState.Suggested) {
|
|
252
|
-
this._workingSet.set(uri, { state: WorkingSetEntryState.Sent });
|
|
272
|
+
this._workingSet.set(uri, { state: WorkingSetEntryState.Sent, isMarkedReadonly: data.isMarkedReadonly });
|
|
253
273
|
}
|
|
254
274
|
}
|
|
255
275
|
const linearHistory = this._linearHistory.get();
|
|
@@ -360,6 +380,22 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
360
380
|
}
|
|
361
381
|
this._onDidChange.fire(ChatEditingSessionChangeType.WorkingSet);
|
|
362
382
|
}
|
|
383
|
+
markIsReadonly(resource, isReadonly) {
|
|
384
|
+
const entry = this._workingSet.get(resource);
|
|
385
|
+
if (entry) {
|
|
386
|
+
if (entry.state === WorkingSetEntryState.Transient || entry.state === WorkingSetEntryState.Suggested) {
|
|
387
|
+
entry.state = WorkingSetEntryState.Attached;
|
|
388
|
+
}
|
|
389
|
+
entry.isMarkedReadonly = isReadonly ?? !entry.isMarkedReadonly;
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
this._workingSet.set(resource, {
|
|
393
|
+
state: WorkingSetEntryState.Attached,
|
|
394
|
+
isMarkedReadonly: isReadonly ?? true
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
this._onDidChange.fire(ChatEditingSessionChangeType.WorkingSet);
|
|
398
|
+
}
|
|
363
399
|
_assertNotDisposed() {
|
|
364
400
|
if (this._state.get() === ChatEditingSessionState.Disposed) {
|
|
365
401
|
throw ( new BugIndicatingError(`Cannot access a disposed editing session`));
|
|
@@ -403,8 +439,8 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
403
439
|
}
|
|
404
440
|
}
|
|
405
441
|
const input = MultiDiffEditorInput.fromResourceMultiDiffEditorInput({
|
|
406
|
-
multiDiffSource:
|
|
407
|
-
label: ( localize(
|
|
442
|
+
multiDiffSource: getMultiDiffSourceUri(),
|
|
443
|
+
label: ( localize(4504, "Suggested Edits"))
|
|
408
444
|
}, this._instantiationService);
|
|
409
445
|
this._editorPane = await this._editorGroupsService.activeGroup.openEditor(input, { pinned: true, activation: EditorActivation.ACTIVATE });
|
|
410
446
|
}
|
|
@@ -433,12 +469,12 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
433
469
|
}
|
|
434
470
|
dispose() {
|
|
435
471
|
this._assertNotDisposed();
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
472
|
+
this._chatService.cancelCurrentRequestForSession(this.chatSessionId);
|
|
473
|
+
dispose(this._entriesObs.get());
|
|
439
474
|
super.dispose();
|
|
440
475
|
this._state.set(ChatEditingSessionState.Disposed, undefined);
|
|
441
476
|
this._onDidDispose.fire();
|
|
477
|
+
this._onDidDispose.dispose();
|
|
442
478
|
}
|
|
443
479
|
getVirtualModel(documentId) {
|
|
444
480
|
this._assertNotDisposed();
|
|
@@ -455,6 +491,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
455
491
|
if (this._state.get() === ChatEditingSessionState.Disposed) {
|
|
456
492
|
return;
|
|
457
493
|
}
|
|
494
|
+
this._isToolsAgentSession = !!responseModel.agent?.isToolsAgent;
|
|
458
495
|
this._sequencer.queue(() => this._acceptTextEdits(resource, textEdits, isLastEdits, responseModel));
|
|
459
496
|
}
|
|
460
497
|
resolve() {
|
|
@@ -463,6 +500,38 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
463
500
|
}
|
|
464
501
|
this._sequencer.queue(() => this._resolve());
|
|
465
502
|
}
|
|
503
|
+
_trackUntitledWorkingSetEntry(resource) {
|
|
504
|
+
if (resource.scheme !== Schemas.untitled) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
const untitled = this._textFileService.untitled.get(resource);
|
|
508
|
+
if (!untitled) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const store = ( new DisposableStore());
|
|
512
|
+
store.add(this.onDidChange(e => {
|
|
513
|
+
if (e === ChatEditingSessionChangeType.WorkingSet && !this._workingSet.get(resource)) {
|
|
514
|
+
store.dispose();
|
|
515
|
+
}
|
|
516
|
+
}));
|
|
517
|
+
store.add(this._textFileService.untitled.onDidSave(e => {
|
|
518
|
+
const existing = this._workingSet.get(resource);
|
|
519
|
+
if (isEqual(e.source, resource) && existing) {
|
|
520
|
+
this._workingSet.delete(resource);
|
|
521
|
+
this._workingSet.set(e.target, existing);
|
|
522
|
+
store.dispose();
|
|
523
|
+
this._onDidChange.fire(ChatEditingSessionChangeType.WorkingSet);
|
|
524
|
+
}
|
|
525
|
+
}));
|
|
526
|
+
store.add(this._editorService.onDidCloseEditor((e) => {
|
|
527
|
+
if (isEqual(e.editor.resource, resource)) {
|
|
528
|
+
this._workingSet.delete(resource);
|
|
529
|
+
store.dispose();
|
|
530
|
+
this._onDidChange.fire(ChatEditingSessionChangeType.WorkingSet);
|
|
531
|
+
}
|
|
532
|
+
}));
|
|
533
|
+
this._store.add(store);
|
|
534
|
+
}
|
|
466
535
|
addFileToWorkingSet(resource, description, proposedState) {
|
|
467
536
|
const state = this._workingSet.get(resource);
|
|
468
537
|
if (proposedState === WorkingSetEntryState.Suggested) {
|
|
@@ -470,10 +539,12 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
470
539
|
return;
|
|
471
540
|
}
|
|
472
541
|
this._workingSet.set(resource, { description, state: WorkingSetEntryState.Suggested });
|
|
542
|
+
this._trackUntitledWorkingSetEntry(resource);
|
|
473
543
|
this._onDidChange.fire(ChatEditingSessionChangeType.WorkingSet);
|
|
474
544
|
}
|
|
475
545
|
else if (state === undefined || state.state === WorkingSetEntryState.Transient || state.state === WorkingSetEntryState.Suggested) {
|
|
476
546
|
this._workingSet.set(resource, { description, state: WorkingSetEntryState.Attached });
|
|
547
|
+
this._trackUntitledWorkingSetEntry(resource);
|
|
477
548
|
this._onDidChange.fire(ChatEditingSessionChangeType.WorkingSet);
|
|
478
549
|
}
|
|
479
550
|
}
|
|
@@ -515,24 +586,9 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
515
586
|
});
|
|
516
587
|
}
|
|
517
588
|
async _acceptTextEdits(resource, textEdits, isLastEdits, responseModel) {
|
|
518
|
-
if (
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
if (!this._entriesObs.get().find(e => isEqual(e.modifiedURI, resource)) && this._entriesObs.get().length >= (await this.editingSessionFileLimitPromise)) {
|
|
589
|
+
if (!this._chatAgentService.toolsAgentModeEnabled && !this._entriesObs.get().find(e => isEqual(e.modifiedURI, resource)) && this._entriesObs.get().length >= (await this.editingSessionFileLimitPromise)) {
|
|
522
590
|
return;
|
|
523
591
|
}
|
|
524
|
-
if (resource.scheme !== Schemas.untitled && !this._workspaceContextService.getWorkspaceFolder(resource) && !(await this._fileService.exists(resource))) {
|
|
525
|
-
const saveLocation = await this._dialogService.showSaveDialog({ title: ( localize(
|
|
526
|
-
4406,
|
|
527
|
-
'{0} wants to create a file. Choose where it should be saved.',
|
|
528
|
-
this._chatAgentService.getDefaultAgent(ChatAgentLocation.EditingSession)?.fullName ?? 'Chat'
|
|
529
|
-
)) });
|
|
530
|
-
if (!saveLocation) {
|
|
531
|
-
this._filesToSkipCreating.add(resource);
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
resource = saveLocation;
|
|
535
|
-
}
|
|
536
592
|
const telemetryInfo = new class {
|
|
537
593
|
get agentId() { return responseModel.agent?.id; }
|
|
538
594
|
get command() { return responseModel.slashCommand?.name; }
|
|
@@ -544,9 +600,18 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
544
600
|
entry.acceptAgentEdits(textEdits, isLastEdits);
|
|
545
601
|
}
|
|
546
602
|
async _resolve() {
|
|
547
|
-
|
|
603
|
+
await asyncTransaction(async (tx) => {
|
|
604
|
+
const entriesWithoutChange = ( new ResourceMap());
|
|
548
605
|
for (const entry of this._entriesObs.get()) {
|
|
549
|
-
entry.acceptStreamingEditsEnd(tx);
|
|
606
|
+
await entry.acceptStreamingEditsEnd(tx);
|
|
607
|
+
if (entry.diffInfo.get().identical) {
|
|
608
|
+
entriesWithoutChange.set(entry.modifiedURI, entry);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
if (entriesWithoutChange.size > 0) {
|
|
612
|
+
const newEntries = this._entriesObs.get().filter(e => !( entriesWithoutChange.has(e.modifiedURI)));
|
|
613
|
+
this._entriesObs.set(newEntries, tx);
|
|
614
|
+
dispose(( entriesWithoutChange.values()));
|
|
550
615
|
}
|
|
551
616
|
this._state.set(ChatEditingSessionState.Idle, tx);
|
|
552
617
|
});
|
|
@@ -560,19 +625,30 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
560
625
|
}
|
|
561
626
|
return existingEntry;
|
|
562
627
|
}
|
|
563
|
-
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
566
|
-
|
|
628
|
+
let entry;
|
|
629
|
+
const existingExternalEntry = this._lookupExternalEntry(resource);
|
|
630
|
+
if (existingExternalEntry) {
|
|
631
|
+
entry = existingExternalEntry;
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
const initialContent = this._initialFileContents.get(resource);
|
|
635
|
+
entry = await this._createModifiedFileEntry(resource, responseModel, false, initialContent);
|
|
636
|
+
if (!initialContent) {
|
|
637
|
+
this._initialFileContents.set(resource, entry.initialContent);
|
|
638
|
+
}
|
|
567
639
|
}
|
|
568
|
-
|
|
640
|
+
const listener = entry.onDidDelete(() => {
|
|
569
641
|
const newEntries = this._entriesObs.get().filter(e => !isEqual(e.modifiedURI, entry.modifiedURI));
|
|
570
642
|
this._entriesObs.set(newEntries, undefined);
|
|
571
643
|
this._workingSet.delete(entry.modifiedURI);
|
|
572
644
|
this._editorService.closeEditors(this._editorService.findEditors(entry.modifiedURI));
|
|
573
|
-
|
|
645
|
+
if (!existingExternalEntry) {
|
|
646
|
+
entry.dispose();
|
|
647
|
+
}
|
|
648
|
+
this._store.delete(listener);
|
|
574
649
|
this._onDidChange.fire(ChatEditingSessionChangeType.WorkingSet);
|
|
575
|
-
})
|
|
650
|
+
});
|
|
651
|
+
this._store.add(listener);
|
|
576
652
|
const entriesArr = [...this._entriesObs.get(), entry];
|
|
577
653
|
this._entriesObs.set(entriesArr, undefined);
|
|
578
654
|
this._onDidChange.fire(ChatEditingSessionChangeType.WorkingSet);
|
|
@@ -605,19 +681,17 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
605
681
|
}
|
|
606
682
|
};
|
|
607
683
|
ChatEditingSession = ( __decorate([
|
|
608
|
-
( __param(
|
|
609
|
-
( __param(
|
|
610
|
-
( __param(
|
|
611
|
-
( __param(
|
|
612
|
-
( __param(
|
|
613
|
-
( __param(
|
|
614
|
-
( __param(
|
|
615
|
-
( __param(
|
|
616
|
-
( __param(
|
|
617
|
-
( __param(
|
|
618
|
-
( __param(
|
|
619
|
-
( __param(13, IChatService)),
|
|
620
|
-
( __param(14, INotebookService))
|
|
684
|
+
( __param(4, IInstantiationService)),
|
|
685
|
+
( __param(5, IModelService)),
|
|
686
|
+
( __param(6, ILanguageService)),
|
|
687
|
+
( __param(7, ITextModelService)),
|
|
688
|
+
( __param(8, IBulkEditService)),
|
|
689
|
+
( __param(9, IEditorGroupsService)),
|
|
690
|
+
( __param(10, IEditorService)),
|
|
691
|
+
( __param(11, IChatService)),
|
|
692
|
+
( __param(12, INotebookService)),
|
|
693
|
+
( __param(13, ITextFileService)),
|
|
694
|
+
( __param(14, IChatAgentService))
|
|
621
695
|
], ChatEditingSession));
|
|
622
696
|
let ChatEditingSessionStorage = class ChatEditingSessionStorage {
|
|
623
697
|
constructor(chatSessionId, _fileService, _environmentService, _logService, _workspaceContextService) {
|
|
@@ -679,7 +753,6 @@ let ChatEditingSessionStorage = class ChatEditingSessionStorage {
|
|
|
679
753
|
return undefined;
|
|
680
754
|
}
|
|
681
755
|
const linearHistory = await Promise.all(( data.linearHistory.map(deserializeChatEditingSessionSnapshot)));
|
|
682
|
-
const filesToSkipCreating = ( data.filesToSkipCreating.map((uriStr) => ( URI.parse(uriStr))));
|
|
683
756
|
const initialFileContents = ( new ResourceMap());
|
|
684
757
|
for (const fileContentDTO of data.initialFileContents) {
|
|
685
758
|
initialFileContents.set(( URI.parse(fileContentDTO[0])), await getFileContent(fileContentDTO[1]));
|
|
@@ -687,7 +760,6 @@ let ChatEditingSessionStorage = class ChatEditingSessionStorage {
|
|
|
687
760
|
const pendingSnapshot = data.pendingSnapshot ? await deserializeChatEditingSessionSnapshot(data.pendingSnapshot) : undefined;
|
|
688
761
|
const recentSnapshot = await deserializeChatEditingSessionSnapshot(data.recentSnapshot);
|
|
689
762
|
return {
|
|
690
|
-
filesToSkipCreating,
|
|
691
763
|
initialFileContents,
|
|
692
764
|
pendingSnapshot,
|
|
693
765
|
recentSnapshot,
|
|
@@ -764,7 +836,6 @@ let ChatEditingSessionStorage = class ChatEditingSessionStorage {
|
|
|
764
836
|
initialFileContents: serializeResourceMap(state.initialFileContents, value => addFileContent(value)),
|
|
765
837
|
pendingSnapshot: state.pendingSnapshot ? serializeChatEditingSessionSnapshot(state.pendingSnapshot) : undefined,
|
|
766
838
|
recentSnapshot: serializeChatEditingSessionSnapshot(state.recentSnapshot),
|
|
767
|
-
filesToSkipCreating: ( state.filesToSkipCreating.map(uri => ( uri.toString()))),
|
|
768
839
|
};
|
|
769
840
|
this._logService.debug(`chatEditingSession: Storing editing session at ${( storageFolder.toString())}: ${fileContents.size} files`);
|
|
770
841
|
for (const [hash, content] of fileContents) {
|
|
@@ -7,10 +7,10 @@ import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
7
7
|
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
8
8
|
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
9
9
|
import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
|
|
10
|
-
import { EditorPane } from "@codingame/monaco-vscode-
|
|
10
|
+
import { EditorPane } from "@codingame/monaco-vscode-d0fb86d3-2a47-594e-955b-9a24631a7124-common/vscode/vs/workbench/browser/parts/editor/editorPane";
|
|
11
11
|
import { IEditorOpenContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
|
|
12
|
-
import { ChatEditorInput } from "@codingame/monaco-vscode-
|
|
13
|
-
import { IExportableChatData, ISerializableChatData } from "@codingame/monaco-vscode-
|
|
12
|
+
import { ChatEditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatEditorInput";
|
|
13
|
+
import { IExportableChatData, ISerializableChatData } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel";
|
|
14
14
|
import { IEditorGroup } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService";
|
|
15
15
|
export interface IChatEditorOptions extends IEditorOptions {
|
|
16
16
|
target?: {
|
|
@@ -18,13 +18,13 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/misc
|
|
|
18
18
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
19
19
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
|
|
20
20
|
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
21
|
-
import { EditorPane } from '@codingame/monaco-vscode-
|
|
22
|
-
import { Memento } from '@codingame/monaco-vscode-
|
|
23
|
-
import { clearChatEditor } from '@codingame/monaco-vscode-
|
|
24
|
-
import { ChatEditorInput } from '@codingame/monaco-vscode-
|
|
21
|
+
import { EditorPane } from '@codingame/monaco-vscode-d0fb86d3-2a47-594e-955b-9a24631a7124-common/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
22
|
+
import { Memento } from '@codingame/monaco-vscode-91789cdf-e3cb-5a04-aaeb-6f7df7d3d231-common/vscode/vs/workbench/common/memento';
|
|
23
|
+
import { clearChatEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatClear';
|
|
24
|
+
import { ChatEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
25
25
|
import { ChatWidget } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
26
26
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
27
|
-
import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-
|
|
27
|
+
import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
|
|
28
28
|
import { EDITOR_DRAG_AND_DROP_BACKGROUND } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
|
|
29
29
|
|
|
30
30
|
let ChatEditor = class ChatEditor extends EditorPane {
|
|
@@ -9,13 +9,9 @@ export declare class ChatExtensionPointHandler implements IWorkbenchContribution
|
|
|
9
9
|
private readonly _chatAgentService;
|
|
10
10
|
private readonly logService;
|
|
11
11
|
static readonly ID = "workbench.contrib.chatExtensionPointHandler";
|
|
12
|
-
private _viewContainer;
|
|
13
12
|
private _participantRegistrationDisposables;
|
|
14
13
|
constructor(_chatAgentService: IChatAgentService, logService: ILogService);
|
|
15
14
|
private handleAndRegisterChatExtensions;
|
|
16
|
-
private registerViewContainer;
|
|
17
|
-
private registerDefaultParticipantView;
|
|
18
|
-
private registerChatEditingView;
|
|
19
15
|
}
|
|
20
16
|
export declare class ChatCompatibilityNotifier extends Disposable implements IWorkbenchContribution {
|
|
21
17
|
private readonly productService;
|