@codingame/monaco-vscode-chat-service-override 14.0.6 → 15.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 +14 -8
- package/package.json +20 -20
- package/vscode/src/vs/base/common/objectCache.d.ts +1 -1
- package/vscode/src/vs/base/common/objectCache.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +43 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +142 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +252 -260
- 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 +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +8 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +12 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +31 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +151 -69
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +379 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/{chatEditingService.d.ts → chatEditingServiceImpl.d.ts} +12 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +423 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +38 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +16 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +93 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +21 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +101 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +146 -126
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +386 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +8 -91
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +7 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +45 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +11 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +78 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +12 -10
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +26 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +85 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -27
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.d.ts +4 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.js +15 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +175 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +17 -17
- 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 +12 -12
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +31 -36
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +0 -505
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +0 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +0 -871
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +0 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -245
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.d.ts +0 -39
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.js +0 -314
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
3
|
+
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
4
|
+
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
5
|
+
import { KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
6
|
+
import { PromptsConfig } from '@codingame/monaco-vscode-52bb4d5b-ba1a-57fd-9bee-b28824214eac-common/vscode/vs/platform/prompts/common/config';
|
|
7
|
+
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
8
|
+
import { isPromptFile } from '@codingame/monaco-vscode-52bb4d5b-ba1a-57fd-9bee-b28824214eac-common/vscode/vs/platform/prompts/common/constants';
|
|
9
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
10
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
11
|
+
import { appendToCommandPalette } from '@codingame/monaco-vscode-9b5a5e82-d649-5455-b4bf-ef90d6afd294-common/vscode/vs/workbench/contrib/files/browser/fileActions.contribution';
|
|
12
|
+
import { isCodeEditor, isDiffEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
|
|
13
|
+
import { KeybindingsRegistry, KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
14
|
+
import { ATTACH_PROMPT_ACTION_ID } from '../../actions/chatAttachPromptAction/chatAttachPromptAction.js';
|
|
15
|
+
|
|
16
|
+
const COMMAND_ID = 'workbench.command.prompts.use';
|
|
17
|
+
const COMMAND_KEY_BINDING = KeyMod.CtrlCmd | KeyCode.Slash | KeyMod.Alt;
|
|
18
|
+
const command = async (accessor) => {
|
|
19
|
+
const commandService = accessor.get(ICommandService);
|
|
20
|
+
const viewsService = accessor.get(IViewsService);
|
|
21
|
+
const options = {
|
|
22
|
+
resource: getActivePromptUri(accessor),
|
|
23
|
+
widget: getFocusedChatWidget(accessor),
|
|
24
|
+
viewsService,
|
|
25
|
+
};
|
|
26
|
+
await commandService.executeCommand(ATTACH_PROMPT_ACTION_ID, options);
|
|
27
|
+
};
|
|
28
|
+
function getFocusedChatWidget(accessor) {
|
|
29
|
+
const chatWidgetService = accessor.get(IChatWidgetService);
|
|
30
|
+
const { lastFocusedWidget } = chatWidgetService;
|
|
31
|
+
if (!lastFocusedWidget) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (!lastFocusedWidget.hasInputFocus()) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return lastFocusedWidget;
|
|
38
|
+
}
|
|
39
|
+
function getActiveCodeEditor(accessor) {
|
|
40
|
+
const editorService = accessor.get(IEditorService);
|
|
41
|
+
const { activeTextEditorControl } = editorService;
|
|
42
|
+
if (isCodeEditor(activeTextEditorControl) && activeTextEditorControl.hasModel()) {
|
|
43
|
+
return activeTextEditorControl;
|
|
44
|
+
}
|
|
45
|
+
if (isDiffEditor(activeTextEditorControl)) {
|
|
46
|
+
const originalEditor = activeTextEditorControl.getOriginalEditor();
|
|
47
|
+
if (!originalEditor.hasModel()) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return originalEditor;
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const getActivePromptUri = (accessor) => {
|
|
55
|
+
const activeEditor = getActiveCodeEditor(accessor);
|
|
56
|
+
if (!activeEditor) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const { uri } = activeEditor.getModel();
|
|
60
|
+
if (isPromptFile(uri)) {
|
|
61
|
+
return uri;
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
};
|
|
65
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
66
|
+
id: COMMAND_ID,
|
|
67
|
+
weight: KeybindingWeight.WorkbenchContrib,
|
|
68
|
+
primary: COMMAND_KEY_BINDING,
|
|
69
|
+
handler: command,
|
|
70
|
+
when: PromptsConfig.enabledCtx,
|
|
71
|
+
});
|
|
72
|
+
appendToCommandPalette({
|
|
73
|
+
id: COMMAND_ID,
|
|
74
|
+
title: ( localize(4787, "Use Prompt")),
|
|
75
|
+
category: CHAT_CATEGORY,
|
|
76
|
+
}, PromptsConfig.enabledCtx);
|
|
77
|
+
|
|
78
|
+
export { COMMAND_ID, getActiveCodeEditor, getFocusedChatWidget };
|
package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js
CHANGED
|
@@ -8,12 +8,12 @@ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log
|
|
|
8
8
|
import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
|
|
9
9
|
import { checkProposedApiEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions';
|
|
10
10
|
import { ExtensionsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
11
|
-
import { ChatViewsWelcomeExtensions } from '@codingame/monaco-vscode-
|
|
11
|
+
import { ChatViewsWelcomeExtensions } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome';
|
|
12
12
|
|
|
13
13
|
const chatViewsWelcomeExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
14
14
|
extensionPoint: 'chatViewsWelcome',
|
|
15
15
|
jsonSchema: {
|
|
16
|
-
description: ( localize(
|
|
16
|
+
description: ( localize(4791, '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(4792, 'The icon for the welcome message.')),
|
|
25
25
|
},
|
|
26
26
|
title: {
|
|
27
27
|
type: 'string',
|
|
28
|
-
description: ( localize(
|
|
28
|
+
description: ( localize(4793, 'The title of the welcome message.')),
|
|
29
29
|
},
|
|
30
30
|
content: {
|
|
31
31
|
type: 'string',
|
|
32
32
|
description: ( localize(
|
|
33
|
-
|
|
33
|
+
4794,
|
|
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(4795, 'Condition when the welcome message is shown.')),
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
@@ -2,9 +2,11 @@ import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/c
|
|
|
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
4
|
import { TextEdit } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
|
|
5
|
+
import { ICellEditOperation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
5
6
|
import { ICodeMapperService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatCodeMapperService.service";
|
|
6
7
|
export interface ICodeMapperResponse {
|
|
7
8
|
textEdit: (resource: URI, textEdit: TextEdit[]) => void;
|
|
9
|
+
notebookEdit: (resource: URI, edit: ICellEditOperation[]) => void;
|
|
8
10
|
}
|
|
9
11
|
export interface ICodeMapperCodeBlock {
|
|
10
12
|
readonly code: string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum ChatEntitlement {
|
|
2
|
+
Unknown = 1,
|
|
3
|
+
Unresolved = 2,
|
|
4
|
+
Available = 3,
|
|
5
|
+
Unavailable = 4,
|
|
6
|
+
Limited = 5,
|
|
7
|
+
Pro = 6
|
|
8
|
+
}
|
|
9
|
+
export interface IChatEntitlements {
|
|
10
|
+
readonly entitlement: ChatEntitlement;
|
|
11
|
+
readonly quotas?: IQuotas;
|
|
12
|
+
}
|
|
13
|
+
export interface IQuotas {
|
|
14
|
+
readonly chatTotal?: number;
|
|
15
|
+
readonly completionsTotal?: number;
|
|
16
|
+
readonly chatRemaining?: number;
|
|
17
|
+
readonly completionsRemaining?: number;
|
|
18
|
+
readonly resetDate?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
var ChatEntitlement;
|
|
4
|
+
(function (ChatEntitlement) {
|
|
5
|
+
ChatEntitlement[ChatEntitlement["Unknown"] = 1] = "Unknown";
|
|
6
|
+
ChatEntitlement[ChatEntitlement["Unresolved"] = 2] = "Unresolved";
|
|
7
|
+
ChatEntitlement[ChatEntitlement["Available"] = 3] = "Available";
|
|
8
|
+
ChatEntitlement[ChatEntitlement["Unavailable"] = 4] = "Unavailable";
|
|
9
|
+
ChatEntitlement[ChatEntitlement["Limited"] = 5] = "Limited";
|
|
10
|
+
ChatEntitlement[ChatEntitlement["Pro"] = 6] = "Pro";
|
|
11
|
+
})(ChatEntitlement || (ChatEntitlement = {}));
|
|
12
|
+
|
|
13
|
+
export { ChatEntitlement };
|
package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { DeferredPromise } from "@codingame/monaco-vscode-api/vscode/vs/base/common/async";
|
|
2
2
|
import { IMarkdownString } from "@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent";
|
|
3
|
-
import { IChatToolInvocation, IChatToolInvocationSerialized } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService";
|
|
4
|
-
import { IToolConfirmationMessages } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService";
|
|
3
|
+
import { IChatTerminalToolInvocationData, IChatToolInvocation, IChatToolInvocationSerialized } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService";
|
|
4
|
+
import { IPreparedToolInvocation, IToolConfirmationMessages, IToolData, IToolResult } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService";
|
|
5
5
|
export declare class ChatToolInvocation implements IChatToolInvocation {
|
|
6
|
-
readonly invocationMessage: string | IMarkdownString;
|
|
7
|
-
readonly pastTenseMessage: string | IMarkdownString | undefined;
|
|
8
|
-
readonly tooltip: string | IMarkdownString | undefined;
|
|
9
|
-
private _confirmationMessages;
|
|
10
6
|
readonly kind: "toolInvocation";
|
|
11
7
|
private _isComplete;
|
|
12
8
|
get isComplete(): boolean;
|
|
13
9
|
private _isCompleteDeferred;
|
|
14
|
-
get
|
|
15
|
-
private _isCanceled;
|
|
16
|
-
get isCanceled(): boolean | undefined;
|
|
10
|
+
get isCompletePromise(): Promise<void>;
|
|
17
11
|
private _confirmDeferred;
|
|
18
12
|
get confirmed(): DeferredPromise<boolean>;
|
|
19
13
|
private _isConfirmed;
|
|
20
14
|
get isConfirmed(): boolean | undefined;
|
|
21
|
-
|
|
15
|
+
private _resultDetails;
|
|
16
|
+
get resultDetails(): IToolResult["toolResultDetails"] | undefined;
|
|
17
|
+
readonly invocationMessage: string | IMarkdownString;
|
|
18
|
+
pastTenseMessage: string | IMarkdownString | undefined;
|
|
19
|
+
private _confirmationMessages;
|
|
20
|
+
readonly presentation: IPreparedToolInvocation["presentation"];
|
|
21
|
+
readonly toolSpecificData?: IChatTerminalToolInvocationData;
|
|
22
|
+
constructor(preparedInvocation: IPreparedToolInvocation | undefined, toolData: IToolData);
|
|
23
|
+
complete(result: IToolResult | undefined): void;
|
|
22
24
|
get confirmationMessages(): IToolConfirmationMessages | undefined;
|
|
23
25
|
toJSON(): IChatToolInvocationSerialized;
|
|
24
26
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { DeferredPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
3
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
3
4
|
|
|
4
5
|
class ChatToolInvocation {
|
|
5
6
|
get isComplete() {
|
|
6
7
|
return this._isComplete;
|
|
7
8
|
}
|
|
8
|
-
get
|
|
9
|
-
return this._isCompleteDeferred;
|
|
10
|
-
}
|
|
11
|
-
get isCanceled() {
|
|
12
|
-
return this._isCanceled;
|
|
9
|
+
get isCompletePromise() {
|
|
10
|
+
return this._isCompleteDeferred.p;
|
|
13
11
|
}
|
|
14
12
|
get confirmed() {
|
|
15
13
|
return this._confirmDeferred;
|
|
@@ -17,16 +15,22 @@ class ChatToolInvocation {
|
|
|
17
15
|
get isConfirmed() {
|
|
18
16
|
return this._isConfirmed;
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this._confirmationMessages = _confirmationMessages;
|
|
18
|
+
get resultDetails() {
|
|
19
|
+
return this._resultDetails;
|
|
20
|
+
}
|
|
21
|
+
constructor(preparedInvocation, toolData) {
|
|
25
22
|
this.kind = 'toolInvocation';
|
|
26
23
|
this._isComplete = false;
|
|
27
24
|
this._isCompleteDeferred = ( new DeferredPromise());
|
|
28
25
|
this._confirmDeferred = ( new DeferredPromise());
|
|
29
|
-
|
|
26
|
+
const defaultMessage = ( localize(4842, "Using {0}", `"${toolData.displayName}"`));
|
|
27
|
+
const invocationMessage = preparedInvocation?.invocationMessage ?? defaultMessage;
|
|
28
|
+
this.invocationMessage = invocationMessage;
|
|
29
|
+
this.pastTenseMessage = preparedInvocation?.pastTenseMessage;
|
|
30
|
+
this._confirmationMessages = preparedInvocation?.confirmationMessages;
|
|
31
|
+
this.presentation = preparedInvocation?.presentation;
|
|
32
|
+
this.toolSpecificData = preparedInvocation?.toolSpecificData;
|
|
33
|
+
if (!this._confirmationMessages) {
|
|
30
34
|
this._isConfirmed = true;
|
|
31
35
|
this._confirmDeferred.complete(true);
|
|
32
36
|
}
|
|
@@ -38,17 +42,26 @@ class ChatToolInvocation {
|
|
|
38
42
|
this._isComplete = true;
|
|
39
43
|
});
|
|
40
44
|
}
|
|
45
|
+
complete(result) {
|
|
46
|
+
if (result?.toolResultMessage) {
|
|
47
|
+
this.pastTenseMessage = result.toolResultMessage;
|
|
48
|
+
}
|
|
49
|
+
this._resultDetails = result?.toolResultDetails;
|
|
50
|
+
this._isCompleteDeferred.complete();
|
|
51
|
+
}
|
|
41
52
|
get confirmationMessages() {
|
|
42
53
|
return this._confirmationMessages;
|
|
43
54
|
}
|
|
44
55
|
toJSON() {
|
|
45
56
|
return {
|
|
46
57
|
kind: 'toolInvocationSerialized',
|
|
58
|
+
presentation: this.presentation,
|
|
47
59
|
invocationMessage: this.invocationMessage,
|
|
48
60
|
pastTenseMessage: this.pastTenseMessage,
|
|
49
|
-
|
|
50
|
-
isConfirmed: this._isConfirmed ?? false,
|
|
61
|
+
isConfirmed: this._isConfirmed,
|
|
51
62
|
isComplete: this._isComplete,
|
|
63
|
+
resultDetails: this._resultDetails,
|
|
64
|
+
toolSpecificData: this.toolSpecificData,
|
|
52
65
|
};
|
|
53
66
|
}
|
|
54
67
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
3
|
+
import { IChatQuotasService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatQuotasService.service";
|
|
4
|
+
export interface IChatQuotas {
|
|
5
|
+
chatQuotaExceeded: boolean;
|
|
6
|
+
completionsQuotaExceeded: boolean;
|
|
7
|
+
quotaResetDate: Date | undefined;
|
|
8
|
+
chatTotal?: number;
|
|
9
|
+
completionsTotal?: number;
|
|
10
|
+
chatRemaining?: number;
|
|
11
|
+
completionsRemaining?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class ChatQuotasService extends Disposable implements IChatQuotasService {
|
|
14
|
+
private readonly contextKeyService;
|
|
15
|
+
_serviceBrand: undefined;
|
|
16
|
+
private readonly _onDidChangeQuotaExceeded;
|
|
17
|
+
readonly onDidChangeQuotaExceeded: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
18
|
+
private readonly _onDidChangeQuotaRemaining;
|
|
19
|
+
readonly onDidChangeQuotaRemaining: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
20
|
+
private _quotas;
|
|
21
|
+
get quotas(): IChatQuotas;
|
|
22
|
+
private readonly chatQuotaExceededContextKey;
|
|
23
|
+
private readonly completionsQuotaExceededContextKey;
|
|
24
|
+
private ExtensionQuotaContextKeys;
|
|
25
|
+
constructor(contextKeyService: IContextKeyService);
|
|
26
|
+
private registerListeners;
|
|
27
|
+
acceptQuotas(quotas: IChatQuotas): void;
|
|
28
|
+
private massageQuotas;
|
|
29
|
+
clearQuotas(): void;
|
|
30
|
+
private updateContextKeys;
|
|
31
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
6
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
7
|
+
|
|
8
|
+
let ChatQuotasService = class ChatQuotasService extends Disposable {
|
|
9
|
+
get quotas() { return this._quotas; }
|
|
10
|
+
constructor(contextKeyService) {
|
|
11
|
+
super();
|
|
12
|
+
this.contextKeyService = contextKeyService;
|
|
13
|
+
this._onDidChangeQuotaExceeded = this._register(( new Emitter()));
|
|
14
|
+
this.onDidChangeQuotaExceeded = this._onDidChangeQuotaExceeded.event;
|
|
15
|
+
this._onDidChangeQuotaRemaining = this._register(( new Emitter()));
|
|
16
|
+
this.onDidChangeQuotaRemaining = this._onDidChangeQuotaRemaining.event;
|
|
17
|
+
this._quotas = { chatQuotaExceeded: false, completionsQuotaExceeded: false, quotaResetDate: undefined };
|
|
18
|
+
this.chatQuotaExceededContextKey = ChatContextKeys.chatQuotaExceeded.bindTo(this.contextKeyService);
|
|
19
|
+
this.completionsQuotaExceededContextKey = ChatContextKeys.completionsQuotaExceeded.bindTo(this.contextKeyService);
|
|
20
|
+
this.ExtensionQuotaContextKeys = {
|
|
21
|
+
chatQuotaExceeded: 'github.copilot.chat.quotaExceeded',
|
|
22
|
+
completionsQuotaExceeded: 'github.copilot.completions.quotaExceeded',
|
|
23
|
+
};
|
|
24
|
+
this.registerListeners();
|
|
25
|
+
}
|
|
26
|
+
registerListeners() {
|
|
27
|
+
const chatQuotaExceededSet = ( new Set([this.ExtensionQuotaContextKeys.chatQuotaExceeded]));
|
|
28
|
+
const completionsQuotaExceededSet = ( new Set([this.ExtensionQuotaContextKeys.completionsQuotaExceeded]));
|
|
29
|
+
this._register(this.contextKeyService.onDidChangeContext(e => {
|
|
30
|
+
let changed = false;
|
|
31
|
+
if (e.affectsSome(chatQuotaExceededSet)) {
|
|
32
|
+
const newChatQuotaExceeded = this.contextKeyService.getContextKeyValue(this.ExtensionQuotaContextKeys.chatQuotaExceeded);
|
|
33
|
+
if (typeof newChatQuotaExceeded === 'boolean' && newChatQuotaExceeded !== this._quotas.chatQuotaExceeded) {
|
|
34
|
+
this._quotas.chatQuotaExceeded = newChatQuotaExceeded;
|
|
35
|
+
changed = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (e.affectsSome(completionsQuotaExceededSet)) {
|
|
39
|
+
const newCompletionsQuotaExceeded = this.contextKeyService.getContextKeyValue(this.ExtensionQuotaContextKeys.completionsQuotaExceeded);
|
|
40
|
+
if (typeof newCompletionsQuotaExceeded === 'boolean' && newCompletionsQuotaExceeded !== this._quotas.completionsQuotaExceeded) {
|
|
41
|
+
this._quotas.completionsQuotaExceeded = newCompletionsQuotaExceeded;
|
|
42
|
+
changed = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (changed) {
|
|
46
|
+
this.updateContextKeys();
|
|
47
|
+
this._onDidChangeQuotaExceeded.fire();
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
acceptQuotas(quotas) {
|
|
52
|
+
const oldQuota = this._quotas;
|
|
53
|
+
this._quotas = this.massageQuotas(quotas);
|
|
54
|
+
this.updateContextKeys();
|
|
55
|
+
if (oldQuota.chatQuotaExceeded !== this._quotas.chatQuotaExceeded ||
|
|
56
|
+
oldQuota.completionsQuotaExceeded !== this._quotas.completionsQuotaExceeded) {
|
|
57
|
+
this._onDidChangeQuotaExceeded.fire();
|
|
58
|
+
}
|
|
59
|
+
if (oldQuota.chatRemaining !== this._quotas.chatRemaining ||
|
|
60
|
+
oldQuota.completionsRemaining !== this._quotas.completionsRemaining) {
|
|
61
|
+
this._onDidChangeQuotaRemaining.fire();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
massageQuotas(quotas) {
|
|
65
|
+
return {
|
|
66
|
+
...quotas,
|
|
67
|
+
chatRemaining: typeof quotas.chatRemaining === 'number' ? Math.max(0, quotas.chatRemaining) : undefined,
|
|
68
|
+
completionsRemaining: typeof quotas.completionsRemaining === 'number' ? Math.max(0, quotas.completionsRemaining) : undefined
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
clearQuotas() {
|
|
72
|
+
if (this.quotas.chatQuotaExceeded || this.quotas.completionsQuotaExceeded) {
|
|
73
|
+
this.acceptQuotas({ chatQuotaExceeded: false, completionsQuotaExceeded: false, quotaResetDate: undefined });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
updateContextKeys() {
|
|
77
|
+
this.chatQuotaExceededContextKey.set(this._quotas.chatQuotaExceeded);
|
|
78
|
+
this.completionsQuotaExceededContextKey.set(this._quotas.completionsQuotaExceeded);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
ChatQuotasService = ( __decorate([
|
|
82
|
+
( __param(0, IContextKeyService))
|
|
83
|
+
], ChatQuotasService));
|
|
84
|
+
|
|
85
|
+
export { ChatQuotasService };
|
|
@@ -12,8 +12,8 @@ import { IWorkbenchAssignmentService } from "@codingame/monaco-vscode-api/vscode
|
|
|
12
12
|
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
13
13
|
import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents";
|
|
14
14
|
import { IChatAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service";
|
|
15
|
-
import { ChatModel, IChatModel, IChatRequestModel, IChatRequestVariableData, IExportableChatData, ISerializableChatData } from "@codingame/monaco-vscode-
|
|
16
|
-
import { IParsedChatRequest } from "@codingame/monaco-vscode-
|
|
15
|
+
import { ChatModel, IChatModel, IChatRequestModel, IChatRequestVariableData, IExportableChatData, ISerializableChatData } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatModel";
|
|
16
|
+
import { IParsedChatRequest } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes";
|
|
17
17
|
import { IChatCompleteResponse, IChatDetail, IChatSendRequestData, IChatSendRequestOptions, IChatTransferredSessionData, IChatUserActionEvent } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService";
|
|
18
18
|
import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service";
|
|
19
19
|
import { IChatSlashCommandService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSlashCommands.service";
|
|
@@ -37,6 +37,10 @@ export declare class ChatService extends Disposable implements IChatService {
|
|
|
37
37
|
private _deletedChatIds;
|
|
38
38
|
private _transferredSessionData;
|
|
39
39
|
get transferredSessionData(): IChatTransferredSessionData | undefined;
|
|
40
|
+
private readonly _onDidSubmitRequest;
|
|
41
|
+
readonly onDidSubmitRequest: Event<{
|
|
42
|
+
chatSessionId: string;
|
|
43
|
+
}>;
|
|
40
44
|
private readonly _onDidPerformUserAction;
|
|
41
45
|
readonly onDidPerformUserAction: Event<IChatUserActionEvent>;
|
|
42
46
|
private readonly _onDidDisposeSession;
|
|
@@ -25,9 +25,9 @@ import { IWorkbenchAssignmentService } from '@codingame/monaco-vscode-api/vscode
|
|
|
25
25
|
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
26
26
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
27
27
|
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
28
|
-
import { normalizeSerializableChatData, ChatModel, ChatRequestRemovalReason, updateRanges, toChatHistoryContent, ChatRequestModel } from '@codingame/monaco-vscode-
|
|
29
|
-
import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, chatSubcommandLeader, chatAgentLeader, ChatRequestSlashCommandPart, getPromptText } from '@codingame/monaco-vscode-
|
|
30
|
-
import { ChatRequestParser } from '@codingame/monaco-vscode-
|
|
28
|
+
import { normalizeSerializableChatData, ChatModel, ChatRequestRemovalReason, updateRanges, toChatHistoryContent, ChatRequestModel } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
29
|
+
import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, chatSubcommandLeader, chatAgentLeader, ChatRequestSlashCommandPart, getPromptText } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
30
|
+
import { ChatRequestParser } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatRequestParser';
|
|
31
31
|
import { ChatServiceTelemetry } from './chatServiceTelemetry.js';
|
|
32
32
|
import { IChatSlashCommandService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSlashCommands.service';
|
|
33
33
|
import { IChatVariablesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
|
|
@@ -77,6 +77,8 @@ let ChatService = class ChatService extends Disposable {
|
|
|
77
77
|
this._sessionModels = this._register(( new DisposableMap()));
|
|
78
78
|
this._pendingRequests = this._register(( new DisposableMap()));
|
|
79
79
|
this._deletedChatIds = ( new Set());
|
|
80
|
+
this._onDidSubmitRequest = this._register(( new Emitter()));
|
|
81
|
+
this.onDidSubmitRequest = this._onDidSubmitRequest.event;
|
|
80
82
|
this._onDidPerformUserAction = this._register(( new Emitter()));
|
|
81
83
|
this.onDidPerformUserAction = this._onDidPerformUserAction.event;
|
|
82
84
|
this._onDidDisposeSession = this._register(( new Emitter()));
|
|
@@ -100,7 +102,12 @@ let ChatService = class ChatService extends Disposable {
|
|
|
100
102
|
if (transferredChat) {
|
|
101
103
|
this.trace('constructor', `Transferred session ${transferredChat.sessionId}`);
|
|
102
104
|
this._persistedSessions[transferredChat.sessionId] = transferredChat;
|
|
103
|
-
this._transferredSessionData = {
|
|
105
|
+
this._transferredSessionData = {
|
|
106
|
+
sessionId: transferredChat.sessionId,
|
|
107
|
+
inputValue: transferredData.inputValue,
|
|
108
|
+
location: transferredData.location,
|
|
109
|
+
toolsAgentModeEnabled: transferredData.toolsAgentModeEnabled,
|
|
110
|
+
};
|
|
104
111
|
}
|
|
105
112
|
this._register(storageService.onWillSaveState(() => this.saveState()));
|
|
106
113
|
}
|
|
@@ -256,7 +263,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
256
263
|
const liveSessionItems = ( Array.from(( this._sessionModels.values()))
|
|
257
264
|
.filter(session => !session.isImported && session.initialLocation !== ChatAgentLocation.EditingSession)
|
|
258
265
|
.map(session => {
|
|
259
|
-
const title = session.title || ( localize(
|
|
266
|
+
const title = session.title || ( localize(4843, "New Chat"));
|
|
260
267
|
return {
|
|
261
268
|
sessionId: session.sessionId,
|
|
262
269
|
title,
|
|
@@ -326,10 +333,13 @@ let ChatService = class ChatService extends Disposable {
|
|
|
326
333
|
if (!sessionData) {
|
|
327
334
|
return undefined;
|
|
328
335
|
}
|
|
329
|
-
|
|
336
|
+
const session = this._startSession(sessionData, sessionData.initialLocation ?? ChatAgentLocation.Panel, CancellationToken.None);
|
|
337
|
+
const isTransferred = this.transferredSessionData?.sessionId === sessionId;
|
|
338
|
+
if (isTransferred) {
|
|
339
|
+
this.chatAgentService.toggleToolsAgentMode(this.transferredSessionData.toolsAgentModeEnabled);
|
|
330
340
|
this._transferredSessionData = undefined;
|
|
331
341
|
}
|
|
332
|
-
return
|
|
342
|
+
return session;
|
|
333
343
|
}
|
|
334
344
|
loadSessionFromContent(data) {
|
|
335
345
|
return this._startSession(data, data.initialLocation ?? ChatAgentLocation.Panel, CancellationToken.None);
|
|
@@ -354,7 +364,6 @@ let ChatService = class ChatService extends Disposable {
|
|
|
354
364
|
...options,
|
|
355
365
|
locationData: request.locationData,
|
|
356
366
|
attachedContext: request.attachedContext,
|
|
357
|
-
workingSet: request.workingSet,
|
|
358
367
|
hasInstructionAttachments: options?.hasInstructionAttachments ?? false,
|
|
359
368
|
};
|
|
360
369
|
await this._sendRequestAsync(model, model.sessionId, request.message, attempt, enableCommandDetection, defaultAgent, location, resendOptions).responseCompletePromise;
|
|
@@ -381,7 +390,12 @@ let ChatService = class ChatService extends Disposable {
|
|
|
381
390
|
for (let i = requests.length - 1; i >= 0; i -= 1) {
|
|
382
391
|
const request = requests[i];
|
|
383
392
|
if (request.shouldBeRemovedOnSend) {
|
|
384
|
-
|
|
393
|
+
if (request.shouldBeRemovedOnSend.afterUndoStop) {
|
|
394
|
+
request.response?.finalizeUndoState();
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
this.removeRequest(sessionId, request.id);
|
|
398
|
+
}
|
|
385
399
|
}
|
|
386
400
|
}
|
|
387
401
|
const location = options?.location ?? model.initialLocation;
|
|
@@ -480,7 +494,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
480
494
|
if (agentPart || (defaultAgent && !commandPart)) {
|
|
481
495
|
const prepareChatAgentRequest = async (agent, command, enableCommandDetection, chatRequest, isParticipantDetected) => {
|
|
482
496
|
const initVariableData = { variables: [] };
|
|
483
|
-
request = chatRequest ?? model.addRequest(parsedRequest, initVariableData, attempt, agent, command, options?.confirmation, options?.locationData, options?.attachedContext
|
|
497
|
+
request = chatRequest ?? model.addRequest(parsedRequest, initVariableData, attempt, agent, command, options?.confirmation, options?.locationData, options?.attachedContext);
|
|
484
498
|
let variableData;
|
|
485
499
|
let message;
|
|
486
500
|
if (chatRequest) {
|
|
@@ -488,12 +502,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
488
502
|
message = getPromptText(request.message).message;
|
|
489
503
|
}
|
|
490
504
|
else {
|
|
491
|
-
variableData =
|
|
492
|
-
for (const variable of variableData.variables) {
|
|
493
|
-
if (request.workingSet && variable.isFile && URI.isUri(variable.value)) {
|
|
494
|
-
request.workingSet.push(variable.value);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
505
|
+
variableData = this.chatVariablesService.resolveVariables(parsedRequest, request.attachedContext);
|
|
497
506
|
model.updateRequest(request, variableData);
|
|
498
507
|
const promptTextResult = getPromptText(request.message);
|
|
499
508
|
variableData = updateRanges(variableData, promptTextResult.diff);
|
|
@@ -516,9 +525,9 @@ let ChatService = class ChatService extends Disposable {
|
|
|
516
525
|
userSelectedModelId: options?.userSelectedModelId
|
|
517
526
|
};
|
|
518
527
|
};
|
|
519
|
-
if (this.configurationService.getValue('chat.detectParticipant.enabled') !== false && this.chatAgentService.hasChatParticipantDetectionProviders() && !agentPart && !commandPart && enableCommandDetection) {
|
|
528
|
+
if (this.configurationService.getValue('chat.detectParticipant.enabled') !== false && this.chatAgentService.hasChatParticipantDetectionProviders() && !agentPart && !commandPart && !agentSlashCommandPart && enableCommandDetection) {
|
|
520
529
|
const defaultAgentHistory = this.getHistoryEntriesFromModel(requests, model.sessionId, location, defaultAgent.id);
|
|
521
|
-
const chatAgentRequest = await prepareChatAgentRequest(defaultAgent,
|
|
530
|
+
const chatAgentRequest = await prepareChatAgentRequest(defaultAgent, undefined, enableCommandDetection, undefined, false);
|
|
522
531
|
const result = await this.chatAgentService.detectAgentOrCommand(chatAgentRequest, defaultAgentHistory, { location }, token);
|
|
523
532
|
if (result && this.chatAgentService.getAgent(result.agent.id)?.locations?.includes(location)) {
|
|
524
533
|
request.response?.setAgent(result.agent, result.command);
|
|
@@ -569,7 +578,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
569
578
|
else {
|
|
570
579
|
if (!rawResult) {
|
|
571
580
|
this.trace('sendRequest', `Provider returned no response for session ${model.sessionId}`);
|
|
572
|
-
rawResult = { errorDetails: { message: ( localize(
|
|
581
|
+
rawResult = { errorDetails: { message: ( localize(4844, "Provider returned null response")) } };
|
|
573
582
|
}
|
|
574
583
|
const result = rawResult.errorDetails?.responseIsFiltered ? 'filtered' :
|
|
575
584
|
rawResult.errorDetails && gotProgress ? 'errorWithOutput' :
|
|
@@ -644,6 +653,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
644
653
|
rawResponsePromise.finally(() => {
|
|
645
654
|
this._pendingRequests.deleteAndDispose(model.sessionId);
|
|
646
655
|
});
|
|
656
|
+
this._onDidSubmitRequest.fire({ chatSessionId: model.sessionId });
|
|
647
657
|
return {
|
|
648
658
|
responseCreatedPromise: responseCreated.p,
|
|
649
659
|
responseCompletePromise: rawResponsePromise,
|
|
@@ -666,11 +676,8 @@ let ChatService = class ChatService extends Disposable {
|
|
|
666
676
|
if (v.isTool) {
|
|
667
677
|
return 'toolInPrompt';
|
|
668
678
|
}
|
|
669
|
-
else if (v.isDynamic) {
|
|
670
|
-
return 'fileInPrompt';
|
|
671
|
-
}
|
|
672
679
|
else {
|
|
673
|
-
return '
|
|
680
|
+
return 'fileInPrompt';
|
|
674
681
|
}
|
|
675
682
|
}
|
|
676
683
|
else if (v.kind === 'command') {
|
|
@@ -688,7 +695,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
688
695
|
else if (v.isTool) {
|
|
689
696
|
return 'tool';
|
|
690
697
|
}
|
|
691
|
-
else
|
|
698
|
+
else {
|
|
692
699
|
if (URI.isUri(v.value)) {
|
|
693
700
|
return 'file';
|
|
694
701
|
}
|
|
@@ -699,9 +706,6 @@ let ChatService = class ChatService extends Disposable {
|
|
|
699
706
|
return 'otherAttachment';
|
|
700
707
|
}
|
|
701
708
|
}
|
|
702
|
-
else {
|
|
703
|
-
return 'variableAttachment';
|
|
704
|
-
}
|
|
705
709
|
}));
|
|
706
710
|
}
|
|
707
711
|
getHistoryEntriesFromModel(requests, sessionId, location, forAgentId) {
|
|
@@ -822,6 +826,8 @@ let ChatService = class ChatService extends Disposable {
|
|
|
822
826
|
timestampInMilliseconds: Date.now(),
|
|
823
827
|
toWorkspace: toWorkspace,
|
|
824
828
|
inputValue: transferredSessionData.inputValue,
|
|
829
|
+
location: transferredSessionData.location,
|
|
830
|
+
toolsAgentModeEnabled: transferredSessionData.toolsAgentModeEnabled,
|
|
825
831
|
});
|
|
826
832
|
this.storageService.store(globalChatKey, JSON.stringify(existingRaw), StorageScope.PROFILE, StorageTarget.MACHINE);
|
|
827
833
|
this.trace('transferChatSession', `Transferred session ${model.sessionId} to workspace ${( toWorkspace.toString())}`);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
4
3
|
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
5
4
|
import { ChatAgentVoteDirection, ChatCopyKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
6
5
|
|
|
@@ -40,15 +39,6 @@ let ChatServiceTelemetry = class ChatServiceTelemetry {
|
|
|
40
39
|
editsProposed: !!action.action.editsProposed,
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
|
-
else if (action.action.kind === 'command') {
|
|
44
|
-
const command = CommandsRegistry.getCommand(action.action.commandButton.command.id);
|
|
45
|
-
const commandId = command ? action.action.commandButton.command.id : 'INVALID';
|
|
46
|
-
this.telemetryService.publicLog2('interactiveSessionCommand', {
|
|
47
|
-
commandId,
|
|
48
|
-
agentId: action.agentId ?? '',
|
|
49
|
-
command: action.command,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
42
|
else if (action.action.kind === 'runInTerminal') {
|
|
53
43
|
this.telemetryService.publicLog2('interactiveSessionRunInTerminal', {
|
|
54
44
|
languageId: action.action.languageId ?? '',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { PROMPT_FILE_EXTENSION } from '@codingame/monaco-vscode-52bb4d5b-ba1a-57fd-9bee-b28824214eac-common/vscode/vs/platform/prompts/common/constants';
|
|
3
|
+
|
|
4
|
+
const DOCUMENTATION_URL = 'https://aka.ms/vscode-ghcp-prompt-snippets';
|
|
5
|
+
const LANGUAGE_SELECTOR = ( Object.freeze({
|
|
6
|
+
pattern: `**/*${PROMPT_FILE_EXTENSION}`,
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
export { DOCUMENTATION_URL, LANGUAGE_SELECTOR };
|