@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.
- 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
|
@@ -4,8 +4,8 @@ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
|
4
4
|
import { Location } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
|
|
5
5
|
import { IViewsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service";
|
|
6
6
|
import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents";
|
|
7
|
-
import { IChatModel, IChatRequestVariableData, IChatRequestVariableEntry } from "@codingame/monaco-vscode-
|
|
8
|
-
import { IParsedChatRequest } from "@codingame/monaco-vscode-
|
|
7
|
+
import { IChatModel, IChatRequestVariableData, IChatRequestVariableEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel";
|
|
8
|
+
import { IParsedChatRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes";
|
|
9
9
|
import { IChatRequestVariableValue, IChatVariableData, IChatVariableResolver, IChatVariableResolverProgress, IDynamicVariable } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariables";
|
|
10
10
|
import { IChatVariablesService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariables.service";
|
|
11
11
|
import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
|
|
@@ -8,8 +8,8 @@ import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/th
|
|
|
8
8
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
9
9
|
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
10
10
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
11
|
-
import { ChatRequestVariablePart, ChatRequestDynamicVariablePart, ChatRequestToolPart } from '@codingame/monaco-vscode-
|
|
12
|
-
import { showEditsView, showChatView } from '@codingame/monaco-vscode-
|
|
11
|
+
import { ChatRequestVariablePart, ChatRequestDynamicVariablePart, ChatRequestToolPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
12
|
+
import { showEditsView, showChatView } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
13
13
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
14
14
|
import { ChatDynamicVariableModel } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
|
|
15
15
|
|
|
@@ -30,15 +30,15 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quic
|
|
|
30
30
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
|
|
31
31
|
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
32
32
|
import { ViewPane } from '@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
33
|
-
import { Memento } from '@codingame/monaco-vscode-
|
|
33
|
+
import { Memento } from '@codingame/monaco-vscode-91789cdf-e3cb-5a04-aaeb-6f7df7d3d231-common/vscode/vs/workbench/common/memento';
|
|
34
34
|
import { SIDE_BAR_FOREGROUND } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
|
|
35
35
|
import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
|
|
36
36
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
37
37
|
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
38
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
39
|
+
import { ChatModelInitState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
40
|
+
import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
|
|
40
41
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
41
|
-
import { SetupWelcomeViewKeys, SetupWelcomeViewCondition } from './chatSetup.js';
|
|
42
42
|
import { ChatWidget } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
43
43
|
import { ChatViewWelcomeController } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController';
|
|
44
44
|
|
|
@@ -86,7 +86,7 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
|
|
|
86
86
|
this._onDidChangeViewWelcomeState.fire();
|
|
87
87
|
}));
|
|
88
88
|
this._register(this.contextKeyService.onDidChangeContext(e => {
|
|
89
|
-
if (e.affectsSome(
|
|
89
|
+
if (e.affectsSome(ChatContextKeys.SetupViewKeys)) {
|
|
90
90
|
this._onDidChangeViewWelcomeState.fire();
|
|
91
91
|
}
|
|
92
92
|
}));
|
|
@@ -113,7 +113,7 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
|
|
|
113
113
|
this.updateActions();
|
|
114
114
|
}
|
|
115
115
|
shouldShowWelcome() {
|
|
116
|
-
const showSetup = this.contextKeyService.contextMatchesRules(
|
|
116
|
+
const showSetup = this.contextKeyService.contextMatchesRules(ChatContextKeys.SetupViewCondition);
|
|
117
117
|
const noPersistedSessions = !this.chatService.hasSessions();
|
|
118
118
|
const shouldShow = this.didUnregisterProvider || !this._widget?.viewModel && noPersistedSessions || this.defaultParticipantRegistrationFailed || showSetup;
|
|
119
119
|
this.logService.trace(`ChatViewPane#shouldShowWelcome(${this.chatOptions.location}) = ${shouldShow}: didUnregister=${this.didUnregisterProvider} || noViewModel:${!this._widget?.viewModel} && noPersistedSessions=${noPersistedSessions} || defaultParticipantRegistrationFailed=${this.defaultParticipantRegistrationFailed} || showSetup=${showSetup}`);
|
|
@@ -151,6 +151,7 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
|
|
|
151
151
|
},
|
|
152
152
|
enableImplicitContext: this.chatOptions.location === ChatAgentLocation.Panel,
|
|
153
153
|
editorOverflowWidgetsDomNode: editorOverflowNode,
|
|
154
|
+
enableWorkingSet: this.chatOptions.location === ChatAgentLocation.EditingSession ? 'explicit' : undefined
|
|
154
155
|
}, {
|
|
155
156
|
listForeground: SIDE_BAR_FOREGROUND,
|
|
156
157
|
listBackground: locationBasedColors.background,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { ICodeBlockActionContextProvider } from "@codingame/monaco-vscode-
|
|
2
|
+
import { ICodeBlockActionContextProvider } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat";
|
|
3
3
|
import { IChatCodeBlockContextProviderService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
|
|
4
4
|
export declare class ChatCodeBlockContextProviderService implements IChatCodeBlockContextProviderService {
|
|
5
5
|
_serviceBrand: undefined;
|
|
@@ -21,7 +21,7 @@ import { ChatWidget } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0
|
|
|
21
21
|
import { dynamicVariableDecorationType } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
|
|
22
22
|
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
23
23
|
import { chatSlashCommandBackground, chatSlashCommandForeground } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/common/chatColors';
|
|
24
|
-
import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, ChatRequestTextPart, ChatRequestVariablePart, ChatRequestToolPart, chatAgentLeader, chatSubcommandLeader } from '@codingame/monaco-vscode-
|
|
24
|
+
import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, ChatRequestTextPart, ChatRequestVariablePart, ChatRequestToolPart, chatAgentLeader, chatSubcommandLeader } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
25
25
|
import { ChatRequestParser } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/chatRequestParser';
|
|
26
26
|
|
|
27
27
|
const decorationDescription = 'chat';
|
|
@@ -8,7 +8,7 @@ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
8
8
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
9
9
|
import { ChatAgentHover, getChatAgentHoverOptions } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatAgentHover';
|
|
10
10
|
import { ChatEditorHoverWrapper } from './editorHoverWrapper.js';
|
|
11
|
-
import { extractAgentAndCommand } from '@codingame/monaco-vscode-
|
|
11
|
+
import { extractAgentAndCommand } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
12
12
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
13
13
|
|
|
14
14
|
let ChatAgentHoverParticipant = class ChatAgentHoverParticipant {
|
|
@@ -58,7 +58,7 @@ let ChatAgentHoverParticipant = class ChatAgentHoverParticipant {
|
|
|
58
58
|
return ( new RenderedHoverParts([renderedHoverPart]));
|
|
59
59
|
}
|
|
60
60
|
getAccessibleContent(hoverPart) {
|
|
61
|
-
return localize(
|
|
61
|
+
return localize(4702, 'There is a chat agent hover part here.');
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
ChatAgentHoverParticipant = ( __decorate([
|
package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js
CHANGED
|
@@ -4,6 +4,10 @@ import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/c
|
|
|
4
4
|
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
5
5
|
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
6
|
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
7
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
8
|
+
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
9
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
10
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
|
|
7
11
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
8
12
|
import { WorkingSetEntryState, WorkingSetEntryRemovalReason, ChatEditingSessionChangeType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
9
13
|
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
@@ -16,10 +20,12 @@ let ChatRelatedFilesContribution = class ChatRelatedFilesContribution extends Di
|
|
|
16
20
|
this.chatEditingService = chatEditingService;
|
|
17
21
|
this.chatWidgetService = chatWidgetService;
|
|
18
22
|
this.chatEditingSessionDisposables = ( new DisposableStore());
|
|
19
|
-
this.
|
|
20
|
-
this._register(this.chatEditingService.onDidCreateEditingSession(() => {
|
|
23
|
+
this._register(autorun(r => {
|
|
21
24
|
this.chatEditingSessionDisposables.clear();
|
|
22
|
-
this.
|
|
25
|
+
const session = this.chatEditingService.currentEditingSessionObs.read(r);
|
|
26
|
+
if (session) {
|
|
27
|
+
this._handleNewEditingSession(session);
|
|
28
|
+
}
|
|
23
29
|
}));
|
|
24
30
|
}
|
|
25
31
|
_updateRelatedFileSuggestions() {
|
|
@@ -65,18 +71,14 @@ let ChatRelatedFilesContribution = class ChatRelatedFilesContribution extends Di
|
|
|
65
71
|
}
|
|
66
72
|
currentEditingSession?.remove(WorkingSetEntryRemovalReason.Programmatic, ...existingSuggestedEntriesToRemove);
|
|
67
73
|
for (const [uri, data] of newSuggestions) {
|
|
68
|
-
currentEditingSession.addFileToWorkingSet(uri, ( localize(
|
|
74
|
+
currentEditingSession.addFileToWorkingSet(uri, ( localize(4703, "{0} (Suggested)", data.description)), WorkingSetEntryState.Suggested);
|
|
69
75
|
}
|
|
70
76
|
})
|
|
71
77
|
.finally(() => {
|
|
72
78
|
this._currentRelatedFilesRetrievalOperation = undefined;
|
|
73
79
|
});
|
|
74
80
|
}
|
|
75
|
-
_handleNewEditingSession() {
|
|
76
|
-
const currentEditingSession = this.chatEditingService.currentEditingSessionObs.get();
|
|
77
|
-
if (!currentEditingSession) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
81
|
+
_handleNewEditingSession(currentEditingSession) {
|
|
80
82
|
const widget = this.chatWidgetService.getWidgetBySessionId(currentEditingSession.chatSessionId);
|
|
81
83
|
if (!widget || widget.viewModel?.sessionId !== currentEditingSession.chatSessionId) {
|
|
82
84
|
return;
|
|
@@ -2,6 +2,7 @@ import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/c
|
|
|
2
2
|
import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
3
|
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
4
4
|
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
5
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
5
6
|
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
6
7
|
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
7
8
|
import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service";
|
|
@@ -13,13 +14,15 @@ export declare class LanguageModelToolsService extends Disposable implements ILa
|
|
|
13
14
|
private readonly _chatService;
|
|
14
15
|
private readonly _dialogService;
|
|
15
16
|
private readonly _telemetryService;
|
|
17
|
+
private readonly _logService;
|
|
16
18
|
_serviceBrand: undefined;
|
|
17
19
|
private _onDidChangeTools;
|
|
18
20
|
readonly onDidChangeTools: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
19
21
|
private _onDidChangeToolsScheduler;
|
|
20
22
|
private _tools;
|
|
21
23
|
private _toolContextKeys;
|
|
22
|
-
|
|
24
|
+
private _callsByRequestId;
|
|
25
|
+
constructor(_extensionService: IExtensionService, _contextKeyService: IContextKeyService, _chatService: IChatService, _dialogService: IDialogService, _telemetryService: ITelemetryService, _logService: ILogService);
|
|
23
26
|
registerToolData(toolData: IToolData): IDisposable;
|
|
24
27
|
private _refreshAllToolContextKeys;
|
|
25
28
|
registerToolImplementation(id: string, tool: IToolImpl): IDisposable;
|
|
@@ -28,4 +31,7 @@ export declare class LanguageModelToolsService extends Disposable implements ILa
|
|
|
28
31
|
private _getToolEntry;
|
|
29
32
|
getToolByName(name: string): IToolData | undefined;
|
|
30
33
|
invokeTool(dto: IToolInvocation, countTokens: CountTokensCallback, token: CancellationToken): Promise<IToolResult>;
|
|
34
|
+
private cleanupCallDisposables;
|
|
35
|
+
cancelToolCallsForRequest(requestId: string): void;
|
|
36
|
+
dispose(): void;
|
|
31
37
|
}
|
|
@@ -2,31 +2,35 @@
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { renderStringAsPlaintext } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/markdownRenderer';
|
|
4
4
|
import { RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
5
|
+
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
6
|
import { CancellationError, isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
6
7
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
7
8
|
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
8
|
-
import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
9
|
+
import { Disposable, toDisposable, DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
9
10
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
10
11
|
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
11
12
|
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
13
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
12
14
|
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
13
15
|
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
14
16
|
import { ChatToolInvocation } from '../common/chatProgressTypes/chatToolInvocation.js';
|
|
15
17
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
16
18
|
|
|
17
19
|
let LanguageModelToolsService = class LanguageModelToolsService extends Disposable {
|
|
18
|
-
constructor(_extensionService, _contextKeyService, _chatService, _dialogService, _telemetryService) {
|
|
20
|
+
constructor(_extensionService, _contextKeyService, _chatService, _dialogService, _telemetryService, _logService) {
|
|
19
21
|
super();
|
|
20
22
|
this._extensionService = _extensionService;
|
|
21
23
|
this._contextKeyService = _contextKeyService;
|
|
22
24
|
this._chatService = _chatService;
|
|
23
25
|
this._dialogService = _dialogService;
|
|
24
26
|
this._telemetryService = _telemetryService;
|
|
27
|
+
this._logService = _logService;
|
|
25
28
|
this._onDidChangeTools = ( new Emitter());
|
|
26
29
|
this.onDidChangeTools = this._onDidChangeTools.event;
|
|
27
30
|
this._onDidChangeToolsScheduler = ( new RunOnceScheduler(() => this._onDidChangeTools.fire(), 750));
|
|
28
31
|
this._tools = ( new Map());
|
|
29
32
|
this._toolContextKeys = ( new Set());
|
|
33
|
+
this._callsByRequestId = ( new Map());
|
|
30
34
|
this._register(this._contextKeyService.onDidChangeContext(e => {
|
|
31
35
|
if (e.affectsSome(this._toolContextKeys)) {
|
|
32
36
|
this._onDidChangeToolsScheduler.schedule();
|
|
@@ -90,6 +94,7 @@ let LanguageModelToolsService = class LanguageModelToolsService extends Disposab
|
|
|
90
94
|
return undefined;
|
|
91
95
|
}
|
|
92
96
|
async invokeTool(dto, countTokens, token) {
|
|
97
|
+
this._logService.trace(`[LanguageModelToolsService#invokeTool] Invoking tool ${dto.toolId} with parameters ${JSON.stringify(dto.parameters)}`);
|
|
93
98
|
let tool = this._tools.get(dto.toolId);
|
|
94
99
|
if (!tool) {
|
|
95
100
|
throw ( new Error(`Tool ${dto.toolId} was not contributed`));
|
|
@@ -102,24 +107,51 @@ let LanguageModelToolsService = class LanguageModelToolsService extends Disposab
|
|
|
102
107
|
}
|
|
103
108
|
}
|
|
104
109
|
let toolInvocation;
|
|
110
|
+
let requestId;
|
|
111
|
+
let store;
|
|
105
112
|
try {
|
|
106
113
|
if (dto.context) {
|
|
114
|
+
store = ( new DisposableStore());
|
|
107
115
|
const model = this._chatService.getSession(dto.context?.sessionId);
|
|
116
|
+
if (!model) {
|
|
117
|
+
throw ( new Error(`Tool called for unknown chat session`));
|
|
118
|
+
}
|
|
108
119
|
const request = model.getRequests().at(-1);
|
|
120
|
+
requestId = request.id;
|
|
121
|
+
if (!( this._callsByRequestId.has(requestId))) {
|
|
122
|
+
this._callsByRequestId.set(requestId, []);
|
|
123
|
+
}
|
|
124
|
+
this._callsByRequestId.get(requestId).push(store);
|
|
125
|
+
const source = ( new CancellationTokenSource());
|
|
126
|
+
store.add(toDisposable(() => {
|
|
127
|
+
source.dispose(true);
|
|
128
|
+
}));
|
|
129
|
+
store.add(token.onCancellationRequested(() => {
|
|
130
|
+
toolInvocation?.confirmed.complete(false);
|
|
131
|
+
source.cancel();
|
|
132
|
+
}));
|
|
133
|
+
store.add(source.token.onCancellationRequested(() => {
|
|
134
|
+
toolInvocation?.confirmed.complete(false);
|
|
135
|
+
}));
|
|
136
|
+
token = source.token;
|
|
109
137
|
const prepared = tool.impl.prepareToolInvocation ?
|
|
110
138
|
await tool.impl.prepareToolInvocation(dto.parameters, token)
|
|
111
139
|
: undefined;
|
|
112
|
-
const defaultMessage = ( localize(
|
|
140
|
+
const defaultMessage = ( localize(4705, "Using {0}", `"${tool.data.displayName}"`));
|
|
113
141
|
const invocationMessage = prepared?.invocationMessage ?? defaultMessage;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
142
|
+
if (tool.data.id !== 'vscode_editFile') {
|
|
143
|
+
toolInvocation = ( new ChatToolInvocation(
|
|
144
|
+
invocationMessage,
|
|
145
|
+
prepared?.pastTenseMessage,
|
|
146
|
+
prepared?.tooltip,
|
|
147
|
+
prepared?.confirmationMessages
|
|
148
|
+
));
|
|
149
|
+
model.acceptResponseProgress(request, toolInvocation);
|
|
150
|
+
if (prepared?.confirmationMessages) {
|
|
151
|
+
const userConfirmed = await toolInvocation.confirmed.p;
|
|
152
|
+
if (!userConfirmed) {
|
|
153
|
+
throw ( new CancellationError());
|
|
154
|
+
}
|
|
123
155
|
}
|
|
124
156
|
}
|
|
125
157
|
}
|
|
@@ -134,6 +166,9 @@ let LanguageModelToolsService = class LanguageModelToolsService extends Disposab
|
|
|
134
166
|
}
|
|
135
167
|
}
|
|
136
168
|
}
|
|
169
|
+
if (token.isCancellationRequested) {
|
|
170
|
+
throw ( new CancellationError());
|
|
171
|
+
}
|
|
137
172
|
const result = await tool.impl.invoke(dto, countTokens, token);
|
|
138
173
|
this._telemetryService.publicLog2('languageModelToolInvoked', {
|
|
139
174
|
result: 'success',
|
|
@@ -155,15 +190,43 @@ let LanguageModelToolsService = class LanguageModelToolsService extends Disposab
|
|
|
155
190
|
}
|
|
156
191
|
finally {
|
|
157
192
|
toolInvocation?.isCompleteDeferred.complete();
|
|
193
|
+
if (requestId && store) {
|
|
194
|
+
this.cleanupCallDisposables(requestId, store);
|
|
195
|
+
}
|
|
158
196
|
}
|
|
159
197
|
}
|
|
198
|
+
cleanupCallDisposables(requestId, store) {
|
|
199
|
+
const disposables = this._callsByRequestId.get(requestId);
|
|
200
|
+
if (disposables) {
|
|
201
|
+
const index = disposables.indexOf(store);
|
|
202
|
+
if (index > -1) {
|
|
203
|
+
disposables.splice(index, 1);
|
|
204
|
+
}
|
|
205
|
+
if (disposables.length === 0) {
|
|
206
|
+
this._callsByRequestId.delete(requestId);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
store.dispose();
|
|
210
|
+
}
|
|
211
|
+
cancelToolCallsForRequest(requestId) {
|
|
212
|
+
const calls = this._callsByRequestId.get(requestId);
|
|
213
|
+
if (calls) {
|
|
214
|
+
calls.forEach(call => call.dispose());
|
|
215
|
+
this._callsByRequestId.delete(requestId);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
dispose() {
|
|
219
|
+
super.dispose();
|
|
220
|
+
this._callsByRequestId.forEach(calls => dispose(calls));
|
|
221
|
+
}
|
|
160
222
|
};
|
|
161
223
|
LanguageModelToolsService = ( __decorate([
|
|
162
224
|
( __param(0, IExtensionService)),
|
|
163
225
|
( __param(1, IContextKeyService)),
|
|
164
226
|
( __param(2, IChatService)),
|
|
165
227
|
( __param(3, IDialogService)),
|
|
166
|
-
( __param(4, ITelemetryService))
|
|
228
|
+
( __param(4, ITelemetryService)),
|
|
229
|
+
( __param(5, ILogService))
|
|
167
230
|
], LanguageModelToolsService));
|
|
168
231
|
|
|
169
232
|
export { LanguageModelToolsService };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
|
|
2
2
|
|
|
3
|
-
var css = ".chat-welcome-view .chat-setup-view{text-align:center;p{width:100%}.chat-features-container{background-color:var(--vscode-chat-requestBackground);border:1px solid var(--vscode-chat-requestBorder);border-radius:2px;text-align:initial}.chat-feature-container{align-items:center;display:flex;gap:6px;padding:5px 10px}.chat-feature-container .codicon[class*=codicon-]{font-size:16px}.codicon[class*=codicon-]{font-size:13px;line-height:1.4em;vertical-align:bottom}.button-container{padding-top:20px}.monaco-button-dropdown,.monaco-button-dropdown .monaco-text-button{width:100%}
|
|
3
|
+
var css = ".chat-welcome-view .chat-setup-view{text-align:center;p{width:100%}.chat-features-container{background-color:var(--vscode-chat-requestBackground);border:1px solid var(--vscode-chat-requestBorder);border-radius:2px;display:flex;justify-content:center;text-align:initial}.chat-feature-container{align-items:center;display:flex;gap:6px;padding:5px 10px}.chat-feature-container .codicon[class*=codicon-]{font-size:16px}.codicon[class*=codicon-]{font-size:13px;line-height:1.4em;vertical-align:bottom}.button-container{padding-top:20px}.monaco-button-dropdown,.monaco-button-dropdown .monaco-text-button{width:100%}}";
|
|
4
4
|
n(css,{});
|
|
5
5
|
|
|
6
6
|
export { css, css as default };
|
package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js
CHANGED
|
@@ -13,7 +13,7 @@ import { ChatViewsWelcomeExtensions } from '@codingame/monaco-vscode-c465110a-57
|
|
|
13
13
|
const chatViewsWelcomeExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
14
14
|
extensionPoint: 'chatViewsWelcome',
|
|
15
15
|
jsonSchema: {
|
|
16
|
-
description: ( localize(
|
|
16
|
+
description: ( localize(4709, 'Contributes a welcome message to a chat view')),
|
|
17
17
|
type: 'array',
|
|
18
18
|
items: {
|
|
19
19
|
additionalProperties: false,
|
|
@@ -21,22 +21,22 @@ const chatViewsWelcomeExtensionPoint = ExtensionsRegistry.registerExtensionPoint
|
|
|
21
21
|
properties: {
|
|
22
22
|
icon: {
|
|
23
23
|
type: 'string',
|
|
24
|
-
description: ( localize(
|
|
24
|
+
description: ( localize(4710, 'The icon for the welcome message.')),
|
|
25
25
|
},
|
|
26
26
|
title: {
|
|
27
27
|
type: 'string',
|
|
28
|
-
description: ( localize(
|
|
28
|
+
description: ( localize(4711, 'The title of the welcome message.')),
|
|
29
29
|
},
|
|
30
30
|
content: {
|
|
31
31
|
type: 'string',
|
|
32
32
|
description: ( localize(
|
|
33
|
-
|
|
33
|
+
4712,
|
|
34
34
|
'The content of the welcome message. The first command link will be rendered as a button.'
|
|
35
35
|
)),
|
|
36
36
|
},
|
|
37
37
|
when: {
|
|
38
38
|
type: 'string',
|
|
39
|
-
description: ( localize(
|
|
39
|
+
description: ( localize(4713, 'Condition when the welcome message is shown.')),
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
3
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
|
-
import {
|
|
5
|
-
import { IChatAgentResult } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents";
|
|
4
|
+
import { TextEdit } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
|
|
6
5
|
import { ICodeMapperService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatCodeMapperService.service";
|
|
7
|
-
import { IChatResponseModel } from "@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/chatModel";
|
|
8
|
-
import { IChatContentReference } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService";
|
|
9
6
|
export interface ICodeMapperResponse {
|
|
10
7
|
textEdit: (resource: URI, textEdit: TextEdit[]) => void;
|
|
11
8
|
}
|
|
@@ -14,31 +11,21 @@ export interface ICodeMapperCodeBlock {
|
|
|
14
11
|
readonly resource: URI;
|
|
15
12
|
readonly markdownBeforeBlock?: string;
|
|
16
13
|
}
|
|
17
|
-
export interface ConversationRequest {
|
|
18
|
-
readonly type: "request";
|
|
19
|
-
readonly message: string;
|
|
20
|
-
}
|
|
21
|
-
export interface ConversationResponse {
|
|
22
|
-
readonly type: "response";
|
|
23
|
-
readonly message: string;
|
|
24
|
-
readonly result?: IChatAgentResult;
|
|
25
|
-
readonly references?: DocumentContextItem[];
|
|
26
|
-
}
|
|
27
14
|
export interface ICodeMapperRequest {
|
|
28
15
|
readonly codeBlocks: ICodeMapperCodeBlock[];
|
|
29
|
-
readonly
|
|
16
|
+
readonly chatRequestId?: string;
|
|
17
|
+
readonly location?: string;
|
|
30
18
|
}
|
|
31
19
|
export interface ICodeMapperResult {
|
|
32
20
|
readonly errorMessage?: string;
|
|
33
21
|
}
|
|
34
22
|
export interface ICodeMapperProvider {
|
|
23
|
+
readonly displayName: string;
|
|
35
24
|
mapCode(request: ICodeMapperRequest, response: ICodeMapperResponse, token: CancellationToken): Promise<ICodeMapperResult | undefined>;
|
|
36
25
|
}
|
|
37
26
|
export declare class CodeMapperService implements ICodeMapperService {
|
|
38
27
|
_serviceBrand: undefined;
|
|
39
|
-
|
|
28
|
+
readonly providers: ICodeMapperProvider[];
|
|
40
29
|
registerCodeMapperProvider(handle: number, provider: ICodeMapperProvider): IDisposable;
|
|
41
30
|
mapCode(request: ICodeMapperRequest, response: ICodeMapperResponse, token: CancellationToken): Promise<ICodeMapperResult | undefined>;
|
|
42
|
-
mapCodeFromResponse(responseModel: IChatResponseModel, response: ICodeMapperResponse, token: CancellationToken): Promise<ICodeMapperResult | undefined>;
|
|
43
31
|
}
|
|
44
|
-
export declare function getReferencesAsDocumentContext(res: readonly IChatContentReference[]): DocumentContextItem[];
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import { CharCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/charCode';
|
|
3
|
-
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
4
|
-
import { splitLinesIncludeSeparators } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
5
|
-
import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
6
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
7
|
-
import { isLocation } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
8
2
|
|
|
9
3
|
class CodeMapperService {
|
|
10
4
|
constructor() {
|
|
@@ -24,125 +18,13 @@ class CodeMapperService {
|
|
|
24
18
|
async mapCode(request, response, token) {
|
|
25
19
|
for (const provider of this.providers) {
|
|
26
20
|
const result = await provider.mapCode(request, response, token);
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
21
|
+
if (token.isCancellationRequested) {
|
|
22
|
+
return undefined;
|
|
29
23
|
}
|
|
24
|
+
return result;
|
|
30
25
|
}
|
|
31
26
|
return undefined;
|
|
32
27
|
}
|
|
33
|
-
async mapCodeFromResponse(responseModel, response, token) {
|
|
34
|
-
const fenceLanguageRegex = /^`{3,}/;
|
|
35
|
-
const codeBlocks = [];
|
|
36
|
-
const currentBlock = [];
|
|
37
|
-
const markdownBeforeBlock = [];
|
|
38
|
-
let currentBlockUri = undefined;
|
|
39
|
-
let fence = undefined;
|
|
40
|
-
for (const lineOrUri of iterateLinesOrUris(responseModel)) {
|
|
41
|
-
if (isString(lineOrUri)) {
|
|
42
|
-
const fenceLanguageIdMatch = lineOrUri.match(fenceLanguageRegex);
|
|
43
|
-
if (fenceLanguageIdMatch) {
|
|
44
|
-
if (fence !== undefined && fenceLanguageIdMatch[0] === fence) {
|
|
45
|
-
fence = undefined;
|
|
46
|
-
if (currentBlockUri) {
|
|
47
|
-
codeBlocks.push({ code: currentBlock.join(''), resource: currentBlockUri, markdownBeforeBlock: markdownBeforeBlock.join('') });
|
|
48
|
-
currentBlock.length = 0;
|
|
49
|
-
markdownBeforeBlock.length = 0;
|
|
50
|
-
currentBlockUri = undefined;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
fence = fenceLanguageIdMatch[0];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
if (fence !== undefined) {
|
|
59
|
-
currentBlock.push(lineOrUri);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
markdownBeforeBlock.push(lineOrUri);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
currentBlockUri = lineOrUri;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const conversation = [];
|
|
71
|
-
for (const request of responseModel.session.getRequests()) {
|
|
72
|
-
const response = request.response;
|
|
73
|
-
if (!response || response === responseModel) {
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
conversation.push({
|
|
77
|
-
type: 'request',
|
|
78
|
-
message: request.message.text
|
|
79
|
-
});
|
|
80
|
-
conversation.push({
|
|
81
|
-
type: 'response',
|
|
82
|
-
message: response.response.getMarkdown(),
|
|
83
|
-
result: response.result,
|
|
84
|
-
references: getReferencesAsDocumentContext(response.contentReferences)
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return this.mapCode({ codeBlocks, conversation }, response, token);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function iterateLinesOrUris(responseModel) {
|
|
91
|
-
return {
|
|
92
|
-
*[Symbol.iterator]() {
|
|
93
|
-
let lastIncompleteLine = undefined;
|
|
94
|
-
for (const part of responseModel.response.value) {
|
|
95
|
-
if (part.kind === 'markdownContent' || part.kind === 'markdownVuln') {
|
|
96
|
-
const lines = splitLinesIncludeSeparators(part.content.value);
|
|
97
|
-
if (lines.length > 0) {
|
|
98
|
-
if (lastIncompleteLine !== undefined) {
|
|
99
|
-
lines[0] = lastIncompleteLine + lines[0];
|
|
100
|
-
}
|
|
101
|
-
lastIncompleteLine = isLineIncomplete(lines[lines.length - 1]) ? lines.pop() : undefined;
|
|
102
|
-
for (const line of lines) {
|
|
103
|
-
yield line;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
else if (part.kind === 'codeblockUri') {
|
|
108
|
-
yield part.uri;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (lastIncompleteLine !== undefined) {
|
|
112
|
-
yield lastIncompleteLine;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function isLineIncomplete(line) {
|
|
118
|
-
const lastChar = line.charCodeAt(line.length - 1);
|
|
119
|
-
return lastChar !== CharCode.LineFeed && lastChar !== CharCode.CarriageReturn;
|
|
120
|
-
}
|
|
121
|
-
function getReferencesAsDocumentContext(res) {
|
|
122
|
-
const map = ( new ResourceMap());
|
|
123
|
-
for (const r of res) {
|
|
124
|
-
let uri;
|
|
125
|
-
let range;
|
|
126
|
-
if (URI.isUri(r.reference)) {
|
|
127
|
-
uri = r.reference;
|
|
128
|
-
}
|
|
129
|
-
else if (isLocation(r.reference)) {
|
|
130
|
-
uri = r.reference.uri;
|
|
131
|
-
range = r.reference.range;
|
|
132
|
-
}
|
|
133
|
-
if (uri) {
|
|
134
|
-
const item = map.get(uri);
|
|
135
|
-
if (item) {
|
|
136
|
-
if (range) {
|
|
137
|
-
item.ranges.push(range);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
map.set(uri, { uri, version: -1, ranges: range ? [range] : [] });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return [...( map.values())];
|
|
146
28
|
}
|
|
147
29
|
|
|
148
|
-
export { CodeMapperService
|
|
30
|
+
export { CodeMapperService };
|
package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { IChatToolInvocation, IChatToolInvocationSerialized } from "@codingame/m
|
|
|
4
4
|
import { IToolConfirmationMessages } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService";
|
|
5
5
|
export declare class ChatToolInvocation implements IChatToolInvocation {
|
|
6
6
|
readonly invocationMessage: string | IMarkdownString;
|
|
7
|
+
readonly pastTenseMessage: string | IMarkdownString | undefined;
|
|
8
|
+
readonly tooltip: string | IMarkdownString | undefined;
|
|
7
9
|
private _confirmationMessages;
|
|
8
10
|
readonly kind: "toolInvocation";
|
|
9
11
|
private _isComplete;
|
|
@@ -16,7 +18,7 @@ export declare class ChatToolInvocation implements IChatToolInvocation {
|
|
|
16
18
|
get confirmed(): DeferredPromise<boolean>;
|
|
17
19
|
private _isConfirmed;
|
|
18
20
|
get isConfirmed(): boolean | undefined;
|
|
19
|
-
constructor(invocationMessage: string | IMarkdownString, _confirmationMessages: IToolConfirmationMessages | undefined);
|
|
21
|
+
constructor(invocationMessage: string | IMarkdownString, pastTenseMessage: string | IMarkdownString | undefined, tooltip: string | IMarkdownString | undefined, _confirmationMessages: IToolConfirmationMessages | undefined);
|
|
20
22
|
get confirmationMessages(): IToolConfirmationMessages | undefined;
|
|
21
23
|
toJSON(): IChatToolInvocationSerialized;
|
|
22
24
|
}
|