@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
|
@@ -0,0 +1,39 @@
|
|
|
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 { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
4
|
+
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
5
|
+
import { IStatusbarService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service";
|
|
6
|
+
import { IChatQuotasService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatQuotasService.service";
|
|
7
|
+
import { IChatEntitlementsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEntitlementsService.service";
|
|
8
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
9
|
+
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
10
|
+
import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
|
|
11
|
+
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
12
|
+
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
13
|
+
import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
|
|
14
|
+
export declare class ChatStatusBarEntry extends Disposable implements IWorkbenchContribution {
|
|
15
|
+
private readonly statusbarService;
|
|
16
|
+
private readonly chatQuotasService;
|
|
17
|
+
private readonly chatEntitlementsService;
|
|
18
|
+
private readonly contextKeyService;
|
|
19
|
+
private readonly keybindingService;
|
|
20
|
+
private readonly configurationService;
|
|
21
|
+
private readonly commandService;
|
|
22
|
+
private readonly hoverService;
|
|
23
|
+
private readonly editorService;
|
|
24
|
+
private readonly productService;
|
|
25
|
+
private readonly languageService;
|
|
26
|
+
static readonly ID = "chat.statusBarEntry";
|
|
27
|
+
private entry;
|
|
28
|
+
private readonly entryDisposables;
|
|
29
|
+
private dateFormatter;
|
|
30
|
+
constructor(statusbarService: IStatusbarService, chatQuotasService: IChatQuotasService, chatEntitlementsService: IChatEntitlementsService, contextKeyService: IContextKeyService, keybindingService: IKeybindingService, configurationService: IConfigurationService, commandService: ICommandService, hoverService: IHoverService, editorService: IEditorService, productService: IProductService, languageService: ILanguageService);
|
|
31
|
+
private create;
|
|
32
|
+
private registerListeners;
|
|
33
|
+
private getEntryProps;
|
|
34
|
+
private createQuotaIndicator;
|
|
35
|
+
private createShortcuts;
|
|
36
|
+
private createSettings;
|
|
37
|
+
private createCodeCompletionsSetting;
|
|
38
|
+
dispose(): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import './media/chatStatus.css.js';
|
|
4
|
+
import { safeIntl } from '@codingame/monaco-vscode-api/vscode/vs/base/common/date';
|
|
5
|
+
import { Disposable, MutableDisposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { language, OS } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
8
|
+
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
9
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
10
|
+
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
11
|
+
import { StatusbarAlignment, ShowTooltipCommand } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
12
|
+
import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
|
|
13
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
14
|
+
import { IChatQuotasService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatQuotasService.service';
|
|
15
|
+
import { TOGGLE_CHAT_ACTION_ID, OPEN_CHAT_QUOTA_EXCEEDED_DIALOG, quotaToButtonMessage, CHAT_SETUP_ACTION_LABEL, CHAT_OPEN_ACTION_ID } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
16
|
+
import { $, EventHelper, append, EventType, addDisposableListener } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
17
|
+
import { IChatEntitlementsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEntitlementsService.service';
|
|
18
|
+
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
19
|
+
import { KeybindingLabel } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/keybindingLabel/keybindingLabel';
|
|
20
|
+
import { defaultKeybindingLabelStyles, defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
21
|
+
import { Checkbox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/toggle/toggle';
|
|
22
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
23
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
24
|
+
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
25
|
+
import { registerColor, transparent } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
|
|
26
|
+
import { contrastBorder } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
|
|
27
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
28
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
|
|
29
|
+
import { inputValidationInfoBorder, inputValidationWarningBorder, inputValidationErrorBorder } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
|
|
30
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
|
|
31
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
|
|
32
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
33
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
|
|
34
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
35
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
|
|
36
|
+
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
37
|
+
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
38
|
+
import { CTX_INLINE_CHAT_POSSIBLE } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
39
|
+
import { EditorContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorContextKeys';
|
|
40
|
+
import { Color } from '@codingame/monaco-vscode-api/vscode/vs/base/common/color';
|
|
41
|
+
import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
|
|
42
|
+
import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
43
|
+
import { Gesture, EventType as EventType$1 } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/touch';
|
|
44
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
45
|
+
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
46
|
+
import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
47
|
+
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
48
|
+
|
|
49
|
+
var ChatStatusBarEntry_1;
|
|
50
|
+
const gaugeBackground = registerColor('gauge.background', {
|
|
51
|
+
dark: inputValidationInfoBorder,
|
|
52
|
+
light: inputValidationInfoBorder,
|
|
53
|
+
hcDark: contrastBorder,
|
|
54
|
+
hcLight: contrastBorder
|
|
55
|
+
}, ( localize(4715, "Gauge background color.")));
|
|
56
|
+
registerColor('gauge.foreground', {
|
|
57
|
+
dark: ( transparent(gaugeBackground, 0.3)),
|
|
58
|
+
light: ( transparent(gaugeBackground, 0.3)),
|
|
59
|
+
hcDark: Color.white,
|
|
60
|
+
hcLight: Color.white
|
|
61
|
+
}, ( localize(4716, "Gauge foreground color.")));
|
|
62
|
+
registerColor('gauge.border', {
|
|
63
|
+
dark: null,
|
|
64
|
+
light: null,
|
|
65
|
+
hcDark: contrastBorder,
|
|
66
|
+
hcLight: contrastBorder
|
|
67
|
+
}, ( localize(4717, "Gauge border color.")));
|
|
68
|
+
const gaugeWarningBackground = registerColor('gauge.warningBackground', {
|
|
69
|
+
dark: inputValidationWarningBorder,
|
|
70
|
+
light: inputValidationWarningBorder,
|
|
71
|
+
hcDark: contrastBorder,
|
|
72
|
+
hcLight: contrastBorder
|
|
73
|
+
}, ( localize(4718, "Gauge warning background color.")));
|
|
74
|
+
registerColor('gauge.warningForeground', {
|
|
75
|
+
dark: ( transparent(gaugeWarningBackground, 0.3)),
|
|
76
|
+
light: ( transparent(gaugeWarningBackground, 0.3)),
|
|
77
|
+
hcDark: Color.white,
|
|
78
|
+
hcLight: Color.white
|
|
79
|
+
}, ( localize(4719, "Gauge warning foreground color.")));
|
|
80
|
+
const gaugeErrorBackground = registerColor('gauge.errorBackground', {
|
|
81
|
+
dark: inputValidationErrorBorder,
|
|
82
|
+
light: inputValidationErrorBorder,
|
|
83
|
+
hcDark: contrastBorder,
|
|
84
|
+
hcLight: contrastBorder
|
|
85
|
+
}, ( localize(4720, "Gauge error background color.")));
|
|
86
|
+
registerColor('gauge.errorForeground', {
|
|
87
|
+
dark: ( transparent(gaugeErrorBackground, 0.3)),
|
|
88
|
+
light: ( transparent(gaugeErrorBackground, 0.3)),
|
|
89
|
+
hcDark: Color.white,
|
|
90
|
+
hcLight: Color.white
|
|
91
|
+
}, ( localize(4721, "Gauge error foreground color.")));
|
|
92
|
+
let ChatStatusBarEntry = class ChatStatusBarEntry extends Disposable {
|
|
93
|
+
static { ChatStatusBarEntry_1 = this; }
|
|
94
|
+
static { this.ID = 'chat.statusBarEntry'; }
|
|
95
|
+
constructor(statusbarService, chatQuotasService, chatEntitlementsService, contextKeyService, keybindingService, configurationService, commandService, hoverService, editorService, productService, languageService) {
|
|
96
|
+
super();
|
|
97
|
+
this.statusbarService = statusbarService;
|
|
98
|
+
this.chatQuotasService = chatQuotasService;
|
|
99
|
+
this.chatEntitlementsService = chatEntitlementsService;
|
|
100
|
+
this.contextKeyService = contextKeyService;
|
|
101
|
+
this.keybindingService = keybindingService;
|
|
102
|
+
this.configurationService = configurationService;
|
|
103
|
+
this.commandService = commandService;
|
|
104
|
+
this.hoverService = hoverService;
|
|
105
|
+
this.editorService = editorService;
|
|
106
|
+
this.productService = productService;
|
|
107
|
+
this.languageService = languageService;
|
|
108
|
+
this.entry = undefined;
|
|
109
|
+
this.entryDisposables = this._register(( new MutableDisposable()));
|
|
110
|
+
this.dateFormatter = ( new Lazy(
|
|
111
|
+
() => safeIntl.DateTimeFormat(language, { year: 'numeric', month: 'long', day: 'numeric' })
|
|
112
|
+
));
|
|
113
|
+
this.create();
|
|
114
|
+
this.registerListeners();
|
|
115
|
+
}
|
|
116
|
+
async create() {
|
|
117
|
+
if (this.configurationService.getValue('chat.experimental.statusIndicator.enabled') === true) {
|
|
118
|
+
this.entry ||= this.statusbarService.addEntry(this.getEntryProps(), ChatStatusBarEntry_1.ID, StatusbarAlignment.RIGHT, { location: { id: 'status.editor.mode', priority: 100.1 }, alignment: StatusbarAlignment.RIGHT });
|
|
119
|
+
this.statusbarService.updateEntryVisibility(`${this.productService.defaultChatAgent?.extensionId}.status`, false);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.entry?.dispose();
|
|
123
|
+
this.entry = undefined;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
registerListeners() {
|
|
127
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
128
|
+
if (e.affectsConfiguration('chat.experimental.statusIndicator.enabled')) {
|
|
129
|
+
this.create();
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
const contextKeysSet = ( new Set([
|
|
133
|
+
ChatContextKeys.Setup.limited.key,
|
|
134
|
+
ChatContextKeys.Setup.installed.key,
|
|
135
|
+
ChatContextKeys.Setup.canSignUp.key,
|
|
136
|
+
ChatContextKeys.Setup.signedOut.key
|
|
137
|
+
]));
|
|
138
|
+
this._register(this.contextKeyService.onDidChangeContext(e => {
|
|
139
|
+
if (!this.entry) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (e.affectsSome(contextKeysSet)) {
|
|
143
|
+
this.entry.update(this.getEntryProps());
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
146
|
+
this._register(this.chatQuotasService.onDidChangeQuotaExceeded(() => this.entry?.update(this.getEntryProps())));
|
|
147
|
+
}
|
|
148
|
+
getEntryProps() {
|
|
149
|
+
const disposables = ( new DisposableStore());
|
|
150
|
+
this.entryDisposables.value = disposables;
|
|
151
|
+
let text = '$(copilot)';
|
|
152
|
+
let ariaLabel = ( localize(4722, "Copilot Status"));
|
|
153
|
+
let command = TOGGLE_CHAT_ACTION_ID;
|
|
154
|
+
let tooltip;
|
|
155
|
+
let kind;
|
|
156
|
+
const { chatQuotaExceeded, completionsQuotaExceeded } = this.chatQuotasService.quotas;
|
|
157
|
+
if (chatQuotaExceeded || completionsQuotaExceeded) {
|
|
158
|
+
let quotaWarning;
|
|
159
|
+
if (chatQuotaExceeded && !completionsQuotaExceeded) {
|
|
160
|
+
quotaWarning = ( localize(4723, "Chat limit reached"));
|
|
161
|
+
}
|
|
162
|
+
else if (completionsQuotaExceeded && !chatQuotaExceeded) {
|
|
163
|
+
quotaWarning = ( localize(4724, "Completions limit reached"));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
quotaWarning = ( localize(4725, "Limit reached"));
|
|
167
|
+
}
|
|
168
|
+
text = `$(copilot-warning) ${quotaWarning}`;
|
|
169
|
+
ariaLabel = quotaWarning;
|
|
170
|
+
command = OPEN_CHAT_QUOTA_EXCEEDED_DIALOG;
|
|
171
|
+
tooltip = quotaToButtonMessage({ chatQuotaExceeded, completionsQuotaExceeded });
|
|
172
|
+
kind = 'prominent';
|
|
173
|
+
}
|
|
174
|
+
else if (this.contextKeyService.getContextKeyValue(ChatContextKeys.Setup.installed.key) === false ||
|
|
175
|
+
this.contextKeyService.getContextKeyValue(ChatContextKeys.Setup.canSignUp.key) === true) {
|
|
176
|
+
tooltip = CHAT_SETUP_ACTION_LABEL.value;
|
|
177
|
+
}
|
|
178
|
+
else if (this.contextKeyService.getContextKeyValue(ChatContextKeys.Setup.signedOut.key) === true) {
|
|
179
|
+
text = '$(copilot-not-connected)';
|
|
180
|
+
ariaLabel = ( localize(4726, "Sign in to Use Copilot..."));
|
|
181
|
+
tooltip = ( localize(4726, "Sign in to Use Copilot..."));
|
|
182
|
+
}
|
|
183
|
+
else if (this.contextKeyService.getContextKeyValue(ChatContextKeys.Setup.limited.key) === true) {
|
|
184
|
+
tooltip = () => {
|
|
185
|
+
const container = $('div.chat-status-bar-entry-tooltip');
|
|
186
|
+
{
|
|
187
|
+
const { chatTotal, chatRemaining, completionsTotal, completionsRemaining, quotaResetDate } = this.chatQuotasService.quotas;
|
|
188
|
+
container.appendChild($('div.header', undefined, ( localize(4727, "Copilot Free Usage"))));
|
|
189
|
+
const chatQuotaIndicator = this.createQuotaIndicator(container, chatTotal, chatRemaining, ( localize(4728, "Chat messages")));
|
|
190
|
+
const completionsQuotaIndicator = this.createQuotaIndicator(container, completionsTotal, completionsRemaining, ( localize(4729, "Code completions")));
|
|
191
|
+
container.appendChild($('div.description', undefined, ( localize(
|
|
192
|
+
4730,
|
|
193
|
+
"Limits will reset on {0}.",
|
|
194
|
+
this.dateFormatter.value.format(quotaResetDate)
|
|
195
|
+
))));
|
|
196
|
+
const cts = ( new CancellationTokenSource());
|
|
197
|
+
disposables.add(toDisposable(() => cts.dispose(true)));
|
|
198
|
+
this.chatEntitlementsService.resolve(cts.token).then(() => {
|
|
199
|
+
if (cts.token.isCancellationRequested) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const { chatTotal, chatRemaining, completionsTotal, completionsRemaining } = this.chatQuotasService.quotas;
|
|
203
|
+
chatQuotaIndicator(chatTotal, chatRemaining);
|
|
204
|
+
completionsQuotaIndicator(completionsTotal, completionsRemaining);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
{
|
|
208
|
+
container.appendChild($('hr'));
|
|
209
|
+
container.appendChild($('div.header', undefined, ( localize(4731, "Settings"))));
|
|
210
|
+
this.createSettings(container, disposables);
|
|
211
|
+
}
|
|
212
|
+
{
|
|
213
|
+
container.appendChild($('hr'));
|
|
214
|
+
container.appendChild($('div.header', undefined, ( localize(4732, "Keybindings"))));
|
|
215
|
+
this.createShortcuts(container, disposables);
|
|
216
|
+
}
|
|
217
|
+
return container;
|
|
218
|
+
};
|
|
219
|
+
command = ShowTooltipCommand;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
tooltip = () => {
|
|
223
|
+
const container = $('div.chat-status-bar-entry-tooltip');
|
|
224
|
+
{
|
|
225
|
+
container.appendChild($('div.header', undefined, ( localize(4731, "Settings"))));
|
|
226
|
+
this.createSettings(container, disposables);
|
|
227
|
+
}
|
|
228
|
+
{
|
|
229
|
+
container.appendChild($('hr'));
|
|
230
|
+
container.appendChild($('div.header', undefined, ( localize(4732, "Keybindings"))));
|
|
231
|
+
this.createShortcuts(container, disposables);
|
|
232
|
+
}
|
|
233
|
+
return container;
|
|
234
|
+
};
|
|
235
|
+
command = ShowTooltipCommand;
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
name: ( localize(4722, "Copilot Status")),
|
|
239
|
+
text,
|
|
240
|
+
ariaLabel,
|
|
241
|
+
command,
|
|
242
|
+
showInAllWindows: true,
|
|
243
|
+
kind,
|
|
244
|
+
tooltip
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
createQuotaIndicator(container, total, remaining, label) {
|
|
248
|
+
const quotaText = $('span');
|
|
249
|
+
const quotaBit = $('div.quota-bit');
|
|
250
|
+
const quotaIndicator = container.appendChild($('div.quota-indicator', undefined, $('div.quota-label', undefined, $('span', undefined, label), quotaText), $('div.quota-bar', undefined, quotaBit)));
|
|
251
|
+
const update = (total, remaining) => {
|
|
252
|
+
quotaIndicator.classList.remove('error');
|
|
253
|
+
quotaIndicator.classList.remove('warning');
|
|
254
|
+
if (typeof total === 'number' && typeof remaining === 'number') {
|
|
255
|
+
let usedPercentage = Math.round(((total - remaining) / total) * 100);
|
|
256
|
+
if (total !== remaining && usedPercentage === 0) {
|
|
257
|
+
usedPercentage = 1;
|
|
258
|
+
}
|
|
259
|
+
quotaText.textContent = ( localize(4733, "{0}%", usedPercentage));
|
|
260
|
+
quotaBit.style.width = `${usedPercentage}%`;
|
|
261
|
+
if (usedPercentage >= 90) {
|
|
262
|
+
quotaIndicator.classList.add('error');
|
|
263
|
+
}
|
|
264
|
+
else if (usedPercentage >= 75) {
|
|
265
|
+
quotaIndicator.classList.add('warning');
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
update(total, remaining);
|
|
270
|
+
return update;
|
|
271
|
+
}
|
|
272
|
+
createShortcuts(container, disposables) {
|
|
273
|
+
const shortcuts = container.appendChild($('div.shortcuts'));
|
|
274
|
+
const entries = coalesce([
|
|
275
|
+
{ text: ( localize(4734, "Chat")), id: CHAT_OPEN_ACTION_ID },
|
|
276
|
+
{ text: ( localize(4735, "Copilot Edits")), id: 'workbench.action.chat.openEditSession' },
|
|
277
|
+
this.contextKeyService.contextMatchesRules(( ContextKeyExpr.and(CTX_INLINE_CHAT_POSSIBLE, EditorContextKeys.writable, ( EditorContextKeys.editorSimpleInput.negate())))) ? { text: ( localize(4736, "Inline Chat")), id: 'inlineChat.start' } : undefined,
|
|
278
|
+
{ text: ( localize(4737, "Quick Chat")), id: 'workbench.action.quickchat.toggle' },
|
|
279
|
+
]);
|
|
280
|
+
const onTrigger = (commandId, e) => {
|
|
281
|
+
EventHelper.stop(e, true);
|
|
282
|
+
this.hoverService.hideHover(true);
|
|
283
|
+
this.commandService.executeCommand(commandId);
|
|
284
|
+
};
|
|
285
|
+
for (const entry of entries) {
|
|
286
|
+
const keys = this.keybindingService.lookupKeybinding(entry.id);
|
|
287
|
+
if (!keys) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
const shortcut = append(shortcuts, $('div.shortcut', { tabIndex: 0, role: 'button', 'aria-label': entry.text }));
|
|
291
|
+
append(shortcut, $('span.shortcut-label', undefined, entry.text));
|
|
292
|
+
const shortcutKey = disposables.add(( new KeybindingLabel(shortcut, OS, { ...defaultKeybindingLabelStyles })));
|
|
293
|
+
shortcutKey.set(keys);
|
|
294
|
+
disposables.add(Gesture.addTarget(shortcut));
|
|
295
|
+
[EventType.CLICK, EventType$1.Tap].forEach(eventType => {
|
|
296
|
+
disposables.add(addDisposableListener(shortcut, eventType, e => onTrigger(entry.id, e)));
|
|
297
|
+
});
|
|
298
|
+
disposables.add(addDisposableListener(shortcut, EventType.KEY_DOWN, e => {
|
|
299
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
300
|
+
if ((event.equals(KeyCode.Enter) || event.equals(KeyCode.Space))) {
|
|
301
|
+
onTrigger(entry.id, e);
|
|
302
|
+
}
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
return shortcuts;
|
|
306
|
+
}
|
|
307
|
+
createSettings(container, disposables) {
|
|
308
|
+
const language = this.editorService.activeTextEditorLanguageId;
|
|
309
|
+
const settings = container.appendChild($('div.settings'));
|
|
310
|
+
{
|
|
311
|
+
const globalSetting = append(settings, $('div.setting'));
|
|
312
|
+
this.createCodeCompletionsSetting(globalSetting, ( localize(4738, "Code completions (all files)")), '*', disposables);
|
|
313
|
+
if (language) {
|
|
314
|
+
const languageSetting = append(settings, $('div.setting'));
|
|
315
|
+
this.createCodeCompletionsSetting(languageSetting, ( localize(
|
|
316
|
+
4739,
|
|
317
|
+
"Code completions ({0})",
|
|
318
|
+
this.languageService.getLanguageName(language) ?? language
|
|
319
|
+
)), language, disposables);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return settings;
|
|
323
|
+
}
|
|
324
|
+
createCodeCompletionsSetting(container, label, language, disposables) {
|
|
325
|
+
const settingId = 'github.copilot.enable';
|
|
326
|
+
const readSetting = () => {
|
|
327
|
+
const result = this.configurationService.getValue(settingId);
|
|
328
|
+
if (!isObject(result)) {
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
if (typeof result[language] !== 'undefined') {
|
|
332
|
+
return Boolean(result[language]);
|
|
333
|
+
}
|
|
334
|
+
return Boolean(result['*']);
|
|
335
|
+
};
|
|
336
|
+
const writeSetting = (checkbox) => {
|
|
337
|
+
let result = this.configurationService.getValue(settingId);
|
|
338
|
+
if (!isObject(result)) {
|
|
339
|
+
result = Object.create(null);
|
|
340
|
+
}
|
|
341
|
+
return this.configurationService.updateValue(settingId, { ...result, [language]: checkbox.checked });
|
|
342
|
+
};
|
|
343
|
+
const settingCheckbox = disposables.add(( new Checkbox(label, readSetting(), defaultCheckboxStyles)));
|
|
344
|
+
container.appendChild(settingCheckbox.domNode);
|
|
345
|
+
const settingLabel = append(container, $('span.setting-label', undefined, label));
|
|
346
|
+
disposables.add(Gesture.addTarget(settingLabel));
|
|
347
|
+
[EventType.CLICK, EventType$1.Tap].forEach(eventType => {
|
|
348
|
+
disposables.add(addDisposableListener(settingLabel, eventType, e => {
|
|
349
|
+
if (settingCheckbox?.enabled) {
|
|
350
|
+
EventHelper.stop(e, true);
|
|
351
|
+
settingCheckbox.checked = !settingCheckbox.checked;
|
|
352
|
+
writeSetting(settingCheckbox);
|
|
353
|
+
settingCheckbox.focus();
|
|
354
|
+
}
|
|
355
|
+
}));
|
|
356
|
+
});
|
|
357
|
+
disposables.add(settingCheckbox.onChange(() => {
|
|
358
|
+
writeSetting(settingCheckbox);
|
|
359
|
+
}));
|
|
360
|
+
disposables.add(this.configurationService.onDidChangeConfiguration(e => {
|
|
361
|
+
if (e.affectsConfiguration(settingId)) {
|
|
362
|
+
settingCheckbox.checked = readSetting();
|
|
363
|
+
}
|
|
364
|
+
}));
|
|
365
|
+
}
|
|
366
|
+
dispose() {
|
|
367
|
+
super.dispose();
|
|
368
|
+
this.entry?.dispose();
|
|
369
|
+
this.entry = undefined;
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
ChatStatusBarEntry = ChatStatusBarEntry_1 = ( __decorate([
|
|
373
|
+
( __param(0, IStatusbarService)),
|
|
374
|
+
( __param(1, IChatQuotasService)),
|
|
375
|
+
( __param(2, IChatEntitlementsService)),
|
|
376
|
+
( __param(3, IContextKeyService)),
|
|
377
|
+
( __param(4, IKeybindingService)),
|
|
378
|
+
( __param(5, IConfigurationService)),
|
|
379
|
+
( __param(6, ICommandService)),
|
|
380
|
+
( __param(7, IHoverService)),
|
|
381
|
+
( __param(8, IEditorService)),
|
|
382
|
+
( __param(9, IProductService)),
|
|
383
|
+
( __param(10, ILanguageService))
|
|
384
|
+
], ChatStatusBarEntry));
|
|
385
|
+
|
|
386
|
+
export { ChatStatusBarEntry };
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
-
import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
1
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
2
|
import { Location } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
|
|
5
3
|
import { IViewsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service";
|
|
6
4
|
import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents";
|
|
7
|
-
import {
|
|
8
|
-
import { IParsedChatRequest } from "@codingame/monaco-vscode-
|
|
9
|
-
import {
|
|
5
|
+
import { IChatRequestVariableData, IChatRequestVariableEntry } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatModel";
|
|
6
|
+
import { IParsedChatRequest } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes";
|
|
7
|
+
import { IDynamicVariable } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariables";
|
|
10
8
|
import { IChatVariablesService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariables.service";
|
|
11
9
|
import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
|
|
12
10
|
export declare class ChatVariablesService implements IChatVariablesService {
|
|
13
11
|
private readonly chatWidgetService;
|
|
14
12
|
private readonly viewsService;
|
|
15
13
|
_serviceBrand: undefined;
|
|
16
|
-
private _resolver;
|
|
17
14
|
constructor(chatWidgetService: IChatWidgetService, viewsService: IViewsService);
|
|
18
|
-
resolveVariables(prompt: IParsedChatRequest, attachedContextVariables: IChatRequestVariableEntry[] | undefined
|
|
19
|
-
resolveVariable(variableName: string, promptText: string, model: IChatModel, progress: (part: IChatVariableResolverProgress) => void, token: CancellationToken): Promise<IChatRequestVariableValue | undefined>;
|
|
20
|
-
hasVariable(name: string): boolean;
|
|
21
|
-
getVariable(name: string): IChatVariableData | undefined;
|
|
22
|
-
getVariables(location: ChatAgentLocation): Iterable<Readonly<IChatVariableData>>;
|
|
15
|
+
resolveVariables(prompt: IParsedChatRequest, attachedContextVariables: IChatRequestVariableEntry[] | undefined): IChatRequestVariableData;
|
|
23
16
|
getDynamicVariables(sessionId: string): ReadonlyArray<IDynamicVariable>;
|
|
24
|
-
registerVariable(data: IChatVariableData, resolver: IChatVariableResolver): IDisposable;
|
|
25
17
|
attachContext(name: string, value: string | URI | Location, location: ChatAgentLocation): Promise<void>;
|
|
26
18
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
-
import { onUnexpectedExternalError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
5
|
-
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
6
|
-
import { toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
-
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
8
4
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
9
5
|
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
10
6
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
11
|
-
import {
|
|
12
|
-
import { showEditsView, showChatView } from '@codingame/monaco-vscode-
|
|
7
|
+
import { ChatRequestDynamicVariablePart, ChatRequestToolPart } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
8
|
+
import { showEditsView, showChatView } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
13
9
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
14
10
|
import { ChatDynamicVariableModel } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
|
|
15
11
|
|
|
@@ -17,88 +13,24 @@ let ChatVariablesService = class ChatVariablesService {
|
|
|
17
13
|
constructor(chatWidgetService, viewsService) {
|
|
18
14
|
this.chatWidgetService = chatWidgetService;
|
|
19
15
|
this.viewsService = viewsService;
|
|
20
|
-
this._resolver = ( new Map());
|
|
21
16
|
}
|
|
22
|
-
|
|
17
|
+
resolveVariables(prompt, attachedContextVariables) {
|
|
23
18
|
let resolvedVariables = [];
|
|
24
|
-
const jobs = [];
|
|
25
19
|
prompt.parts
|
|
26
20
|
.forEach((part, i) => {
|
|
27
|
-
if (part instanceof
|
|
28
|
-
|
|
29
|
-
if (data) {
|
|
30
|
-
const references = [];
|
|
31
|
-
const variableProgressCallback = (item) => {
|
|
32
|
-
if (item.kind === 'reference') {
|
|
33
|
-
references.push(item);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
progress(item);
|
|
37
|
-
};
|
|
38
|
-
jobs.push(data.resolver(prompt.text, part.variableArg, model, variableProgressCallback, token).then(value => {
|
|
39
|
-
if (value) {
|
|
40
|
-
resolvedVariables[i] = { id: data.data.id, modelDescription: data.data.modelDescription, name: part.variableName, range: part.range, value, references, fullName: data.data.fullName, icon: data.data.icon };
|
|
41
|
-
}
|
|
42
|
-
}).catch(onUnexpectedExternalError));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else if (part instanceof ChatRequestDynamicVariablePart) {
|
|
46
|
-
resolvedVariables[i] = { id: part.id, name: part.referenceText, range: part.range, value: part.data, fullName: part.fullName, icon: part.icon, isFile: part.isFile };
|
|
47
|
-
}
|
|
48
|
-
else if (part instanceof ChatRequestToolPart) {
|
|
49
|
-
resolvedVariables[i] = { id: part.toolId, name: part.toolName, range: part.range, value: undefined, isTool: true, icon: ThemeIcon.isThemeIcon(part.icon) ? part.icon : undefined, fullName: part.displayName };
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const resolvedAttachedContext = [];
|
|
53
|
-
attachedContextVariables
|
|
54
|
-
?.forEach((attachment, i) => {
|
|
55
|
-
const data = this._resolver.get(attachment.name?.toLowerCase());
|
|
56
|
-
if (data) {
|
|
57
|
-
const references = [];
|
|
58
|
-
const variableProgressCallback = (item) => {
|
|
59
|
-
if (item.kind === 'reference') {
|
|
60
|
-
references.push(item);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
progress(item);
|
|
64
|
-
};
|
|
65
|
-
jobs.push(data.resolver(prompt.text, '', model, variableProgressCallback, token).then(value => {
|
|
66
|
-
if (value) {
|
|
67
|
-
resolvedAttachedContext[i] = { id: data.data.id, modelDescription: data.data.modelDescription, name: attachment.name, fullName: attachment.fullName, range: attachment.range, value, references, icon: attachment.icon };
|
|
68
|
-
}
|
|
69
|
-
}).catch(onUnexpectedExternalError));
|
|
70
|
-
}
|
|
71
|
-
else if (attachment.isDynamic || attachment.isTool) {
|
|
72
|
-
resolvedAttachedContext[i] = attachment;
|
|
21
|
+
if (part instanceof ChatRequestDynamicVariablePart || part instanceof ChatRequestToolPart) {
|
|
22
|
+
resolvedVariables[i] = part.toVariableEntry();
|
|
73
23
|
}
|
|
74
24
|
});
|
|
75
|
-
await Promise.allSettled(jobs);
|
|
76
25
|
resolvedVariables = coalesce(resolvedVariables);
|
|
77
26
|
resolvedVariables.sort((a, b) => b.range.start - a.range.start);
|
|
78
|
-
|
|
27
|
+
if (attachedContextVariables) {
|
|
28
|
+
resolvedVariables.push(...attachedContextVariables);
|
|
29
|
+
}
|
|
79
30
|
return {
|
|
80
31
|
variables: resolvedVariables,
|
|
81
32
|
};
|
|
82
33
|
}
|
|
83
|
-
async resolveVariable(variableName, promptText, model, progress, token) {
|
|
84
|
-
const data = this._resolver.get(variableName.toLowerCase());
|
|
85
|
-
if (!data) {
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
return (await data.resolver(promptText, undefined, model, progress, token));
|
|
89
|
-
}
|
|
90
|
-
hasVariable(name) {
|
|
91
|
-
return ( this._resolver.has(name.toLowerCase()));
|
|
92
|
-
}
|
|
93
|
-
getVariable(name) {
|
|
94
|
-
return this._resolver.get(name.toLowerCase())?.data;
|
|
95
|
-
}
|
|
96
|
-
getVariables(location) {
|
|
97
|
-
const all = ( Iterable.map(( this._resolver.values()), data => data.data));
|
|
98
|
-
return Iterable.filter(all, data => {
|
|
99
|
-
return location !== ChatAgentLocation.Editor || !( ( new Set(['selection', 'editor'])).has(data.name));
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
34
|
getDynamicVariables(sessionId) {
|
|
103
35
|
const widget = this.chatWidgetService.getWidgetBySessionId(sessionId);
|
|
104
36
|
if (!widget || !widget.viewModel || !widget.supportsFileReferences) {
|
|
@@ -110,16 +42,6 @@ let ChatVariablesService = class ChatVariablesService {
|
|
|
110
42
|
}
|
|
111
43
|
return model.variables;
|
|
112
44
|
}
|
|
113
|
-
registerVariable(data, resolver) {
|
|
114
|
-
const key = data.name.toLowerCase();
|
|
115
|
-
if (( this._resolver.has(key))) {
|
|
116
|
-
throw ( new Error(`A chat variable with the name '${data.name}' already exists.`));
|
|
117
|
-
}
|
|
118
|
-
this._resolver.set(key, { data, resolver });
|
|
119
|
-
return toDisposable(() => {
|
|
120
|
-
this._resolver.delete(key);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
45
|
async attachContext(name, value, location) {
|
|
124
46
|
if (location !== ChatAgentLocation.Panel && location !== ChatAgentLocation.EditingSession) {
|
|
125
47
|
return;
|
|
@@ -137,11 +59,6 @@ let ChatVariablesService = class ChatVariablesService {
|
|
|
137
59
|
widget.attachmentModel.addFile(uri, range);
|
|
138
60
|
return;
|
|
139
61
|
}
|
|
140
|
-
const resolved = this._resolver.get(key);
|
|
141
|
-
if (!resolved) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
widget.attachmentModel.addContext({ ...resolved.data, value });
|
|
145
62
|
}
|
|
146
63
|
};
|
|
147
64
|
ChatVariablesService = ( __decorate([
|
|
@@ -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-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/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;
|