@codingame/monaco-vscode-chat-service-override 15.0.2 → 16.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 +11 -8
- package/package.json +29 -20
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +22 -0
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +9 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +80 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +17 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/{askToSelectPrompt.d.ts → askToSelectPrompt/askToSelectPrompt.d.ts} +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/askToSelectPrompt.js +79 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/constants.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/constants.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/attachPrompts.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/attachPrompts.js +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPlaceholderText.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPlaceholderText.js +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPromptPickItem.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPromptPickItem.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/handleButtonClick.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/handleButtonClick.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +163 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +22 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +9 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTransfer.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTransfer.js +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +242 -74
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditing.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditing.js +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +688 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +355 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +395 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +98 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +216 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +97 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +831 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +7 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +32 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +110 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +985 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +147 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +284 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +578 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.js +122 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.js +320 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.js +50 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +22 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +166 -62
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +6 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +704 -732
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +10 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +329 -236
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusItemService.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusItemService.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +14 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +217 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css +114 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditorController.css +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css +90 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +65 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +14 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +16 -8
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +175 -57
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +66 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +313 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +4 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatTransferService.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatTransferService.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +10 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +18 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkDiagnosticsProvider.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkDiagnosticsProvider.js +117 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +3 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +157 -65
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +39 -21
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +11 -10
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +47 -0
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceUtils.d.ts +5 -0
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceUtils.js +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +0 -142
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +0 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +0 -331
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +0 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +0 -85
- package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.js +0 -22
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
4
|
-
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
5
|
-
import { VSDataTransfer, createStringDataTransferItem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/dataTransfer';
|
|
6
|
-
import { HierarchicalKind } from '@codingame/monaco-vscode-api/vscode/vs/base/common/hierarchicalKind';
|
|
7
|
-
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
-
import { Mimes } from '@codingame/monaco-vscode-api/vscode/vs/base/common/mime';
|
|
9
|
-
import { joinPath, basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
10
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
11
|
-
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
|
|
12
|
-
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
13
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
14
|
-
import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
|
|
15
|
-
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
16
|
-
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
17
|
-
import { isProposedApiEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions';
|
|
18
|
-
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
19
|
-
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
20
|
-
import { ChatInputPart } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chatInputPart';
|
|
21
|
-
import { resizeImage } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/imageUtils';
|
|
22
|
-
|
|
23
|
-
const COPY_MIME_TYPES = 'application/vnd.code.additional-editor-data';
|
|
24
|
-
let PasteImageProvider = class PasteImageProvider {
|
|
25
|
-
constructor(chatWidgetService, extensionService, fileService, environmentService, logService) {
|
|
26
|
-
this.chatWidgetService = chatWidgetService;
|
|
27
|
-
this.extensionService = extensionService;
|
|
28
|
-
this.fileService = fileService;
|
|
29
|
-
this.environmentService = environmentService;
|
|
30
|
-
this.logService = logService;
|
|
31
|
-
this.kind = ( new HierarchicalKind('chat.attach.image'));
|
|
32
|
-
this.providedPasteEditKinds = [this.kind];
|
|
33
|
-
this.copyMimeTypes = [];
|
|
34
|
-
this.pasteMimeTypes = ['image/*'];
|
|
35
|
-
this.imagesFolder = joinPath(this.environmentService.workspaceStorageHome, 'vscode-chat-images');
|
|
36
|
-
this.cleanupOldImages();
|
|
37
|
-
}
|
|
38
|
-
async provideDocumentPasteEdits(model, ranges, dataTransfer, context, token) {
|
|
39
|
-
if (!( this.extensionService.extensions.some(ext => isProposedApiEnabled(ext, 'chatReferenceBinaryData')))) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const supportedMimeTypes = [
|
|
43
|
-
'image/png',
|
|
44
|
-
'image/jpeg',
|
|
45
|
-
'image/jpg',
|
|
46
|
-
'image/bmp',
|
|
47
|
-
'image/gif',
|
|
48
|
-
'image/tiff'
|
|
49
|
-
];
|
|
50
|
-
let mimeType;
|
|
51
|
-
let imageItem;
|
|
52
|
-
for (const type of supportedMimeTypes) {
|
|
53
|
-
imageItem = dataTransfer.get(type);
|
|
54
|
-
if (imageItem) {
|
|
55
|
-
mimeType = type;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (!imageItem || !mimeType) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const currClipboard = await imageItem.asFile()?.data();
|
|
63
|
-
if (token.isCancellationRequested || !currClipboard) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
67
|
-
if (!widget) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const attachedVariables = widget.attachmentModel.attachments;
|
|
71
|
-
const displayName = ( localize(4681, 'Pasted Image'));
|
|
72
|
-
let tempDisplayName = displayName;
|
|
73
|
-
for (let appendValue = 2; ( attachedVariables.some(attachment => attachment.name === tempDisplayName)); appendValue++) {
|
|
74
|
-
tempDisplayName = `${displayName} ${appendValue}`;
|
|
75
|
-
}
|
|
76
|
-
const fileReference = await this.createFileForMedia(currClipboard, mimeType);
|
|
77
|
-
if (token.isCancellationRequested || !fileReference) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const scaledImageData = await resizeImage(currClipboard);
|
|
81
|
-
if (token.isCancellationRequested || !scaledImageData) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const scaledImageContext = await getImageAttachContext(scaledImageData, mimeType, token, tempDisplayName, fileReference);
|
|
85
|
-
if (token.isCancellationRequested || !scaledImageContext) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
widget.attachmentModel.addContext(scaledImageContext);
|
|
89
|
-
const currentContextIds = widget.attachmentModel.getAttachmentIDs();
|
|
90
|
-
if (( currentContextIds.has(scaledImageContext.id))) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const edit = createCustomPasteEdit(model, scaledImageContext, mimeType, this.kind, ( localize(4682, 'Pasted Image Attachment')), this.chatWidgetService);
|
|
94
|
-
return createEditSession(edit);
|
|
95
|
-
}
|
|
96
|
-
async createFileForMedia(dataTransfer, mimeType) {
|
|
97
|
-
const exists = await this.fileService.exists(this.imagesFolder);
|
|
98
|
-
if (!exists) {
|
|
99
|
-
await this.fileService.createFolder(this.imagesFolder);
|
|
100
|
-
}
|
|
101
|
-
const ext = mimeType.split('/')[1] || 'png';
|
|
102
|
-
const filename = `image-${Date.now()}.${ext}`;
|
|
103
|
-
const fileUri = joinPath(this.imagesFolder, filename);
|
|
104
|
-
const buffer = VSBuffer.wrap(dataTransfer);
|
|
105
|
-
await this.fileService.writeFile(fileUri, buffer);
|
|
106
|
-
return fileUri;
|
|
107
|
-
}
|
|
108
|
-
async cleanupOldImages() {
|
|
109
|
-
const exists = await this.fileService.exists(this.imagesFolder);
|
|
110
|
-
if (!exists) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const duration = 7 * 24 * 60 * 60 * 1000;
|
|
114
|
-
const files = await this.fileService.resolve(this.imagesFolder);
|
|
115
|
-
if (!files.children) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
await Promise.all(( files.children.map(async (file) => {
|
|
119
|
-
try {
|
|
120
|
-
const timestamp = this.getTimestampFromFilename(file.name);
|
|
121
|
-
if (timestamp && (Date.now() - timestamp > duration)) {
|
|
122
|
-
await this.fileService.del(file.resource);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
catch (err) {
|
|
126
|
-
this.logService.error('Failed to clean up old images', err);
|
|
127
|
-
}
|
|
128
|
-
})));
|
|
129
|
-
}
|
|
130
|
-
getTimestampFromFilename(filename) {
|
|
131
|
-
const match = filename.match(/image-(\d+)\./);
|
|
132
|
-
if (match) {
|
|
133
|
-
return parseInt(match[1], 10);
|
|
134
|
-
}
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
PasteImageProvider = ( __decorate([
|
|
139
|
-
( __param(2, IFileService)),
|
|
140
|
-
( __param(3, IEnvironmentService)),
|
|
141
|
-
( __param(4, ILogService))
|
|
142
|
-
], PasteImageProvider));
|
|
143
|
-
async function getImageAttachContext(data, mimeType, token, displayName, resource) {
|
|
144
|
-
const imageHash = await imageToHash(data);
|
|
145
|
-
if (token.isCancellationRequested) {
|
|
146
|
-
return undefined;
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
kind: 'image',
|
|
150
|
-
value: data,
|
|
151
|
-
id: imageHash,
|
|
152
|
-
name: displayName,
|
|
153
|
-
isImage: true,
|
|
154
|
-
icon: Codicon.fileMedia,
|
|
155
|
-
mimeType,
|
|
156
|
-
isPasted: true,
|
|
157
|
-
references: [{ reference: resource, kind: 'reference' }]
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
async function imageToHash(data) {
|
|
161
|
-
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
|
162
|
-
const hashArray = Array.from(( new Uint8Array(hashBuffer)));
|
|
163
|
-
return ( hashArray.map(b => ( b.toString(16)).padStart(2, '0'))).join('');
|
|
164
|
-
}
|
|
165
|
-
function isImage(array) {
|
|
166
|
-
if (array.length < 4) {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
const identifier = {
|
|
170
|
-
png: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A],
|
|
171
|
-
jpeg: [0xFF, 0xD8, 0xFF],
|
|
172
|
-
bmp: [0x42, 0x4D],
|
|
173
|
-
gif: [0x47, 0x49, 0x46, 0x38],
|
|
174
|
-
tiff: [0x49, 0x49, 0x2A, 0x00]
|
|
175
|
-
};
|
|
176
|
-
return ( ( Object.values(identifier)).some((signature) => signature.every((byte, index) => array[index] === byte)));
|
|
177
|
-
}
|
|
178
|
-
class CopyTextProvider {
|
|
179
|
-
constructor() {
|
|
180
|
-
this.providedPasteEditKinds = [];
|
|
181
|
-
this.copyMimeTypes = [COPY_MIME_TYPES];
|
|
182
|
-
this.pasteMimeTypes = [];
|
|
183
|
-
}
|
|
184
|
-
async prepareDocumentPaste(model, ranges, dataTransfer, token) {
|
|
185
|
-
if (model.uri.scheme === ChatInputPart.INPUT_SCHEME) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
const customDataTransfer = ( new VSDataTransfer());
|
|
189
|
-
const data = { range: ranges[0], uri: model.uri.toJSON() };
|
|
190
|
-
customDataTransfer.append(COPY_MIME_TYPES, createStringDataTransferItem(JSON.stringify(data)));
|
|
191
|
-
return customDataTransfer;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
class PasteTextProvider {
|
|
195
|
-
constructor(chatWidgetService, modelService) {
|
|
196
|
-
this.chatWidgetService = chatWidgetService;
|
|
197
|
-
this.modelService = modelService;
|
|
198
|
-
this.kind = ( new HierarchicalKind('chat.attach.text'));
|
|
199
|
-
this.providedPasteEditKinds = [this.kind];
|
|
200
|
-
this.copyMimeTypes = [];
|
|
201
|
-
this.pasteMimeTypes = [COPY_MIME_TYPES];
|
|
202
|
-
}
|
|
203
|
-
async provideDocumentPasteEdits(model, ranges, dataTransfer, context, token) {
|
|
204
|
-
if (model.uri.scheme !== ChatInputPart.INPUT_SCHEME) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
const text = dataTransfer.get(Mimes.text);
|
|
208
|
-
const editorData = dataTransfer.get('vscode-editor-data');
|
|
209
|
-
const additionalEditorData = dataTransfer.get(COPY_MIME_TYPES);
|
|
210
|
-
if (!editorData || !text || !additionalEditorData) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
const textdata = await text.asString();
|
|
214
|
-
const metadata = JSON.parse(await editorData.asString());
|
|
215
|
-
const additionalData = JSON.parse(await additionalEditorData.asString());
|
|
216
|
-
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
217
|
-
if (!widget) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
const start = additionalData.range.startLineNumber;
|
|
221
|
-
const end = additionalData.range.endLineNumber;
|
|
222
|
-
if (start === end) {
|
|
223
|
-
const textModel = this.modelService.getModel(URI.revive(additionalData.uri));
|
|
224
|
-
if (!textModel) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
const lineContent = textModel.getLineContent(start);
|
|
228
|
-
if (lineContent !== textdata) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
const copiedContext = getCopiedContext(textdata, URI.revive(additionalData.uri), metadata.mode, additionalData.range);
|
|
233
|
-
if (token.isCancellationRequested || !copiedContext) {
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
const currentContextIds = widget.attachmentModel.getAttachmentIDs();
|
|
237
|
-
if (( currentContextIds.has(copiedContext.id))) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
const edit = createCustomPasteEdit(model, copiedContext, Mimes.text, this.kind, ( localize(4683, 'Pasted Code Attachment')), this.chatWidgetService);
|
|
241
|
-
edit.yieldTo = [{ kind: HierarchicalKind.Empty.append('text', 'plain') }];
|
|
242
|
-
return createEditSession(edit);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
function getCopiedContext(code, file, language, range) {
|
|
246
|
-
const fileName = basename(file);
|
|
247
|
-
const start = range.startLineNumber;
|
|
248
|
-
const end = range.endLineNumber;
|
|
249
|
-
const resultText = `Copied Selection of Code: \n\n\n From the file: ${fileName} From lines ${start} to ${end} \n \`\`\`${code}\`\`\``;
|
|
250
|
-
const pastedLines = start === end ? ( localize(4684, '1 line')) : ( localize(4685, '{0} lines', end + 1 - start));
|
|
251
|
-
return {
|
|
252
|
-
kind: 'paste',
|
|
253
|
-
value: resultText,
|
|
254
|
-
id: `${fileName}${start}${end}${range.startColumn}${range.endColumn}`,
|
|
255
|
-
name: `${fileName} ${pastedLines}`,
|
|
256
|
-
icon: Codicon.code,
|
|
257
|
-
pastedLines,
|
|
258
|
-
language,
|
|
259
|
-
fileName: ( file.toString()),
|
|
260
|
-
copiedFrom: {
|
|
261
|
-
uri: file,
|
|
262
|
-
range
|
|
263
|
-
},
|
|
264
|
-
code,
|
|
265
|
-
references: [{
|
|
266
|
-
reference: file,
|
|
267
|
-
kind: 'reference'
|
|
268
|
-
}]
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
function createCustomPasteEdit(model, context, handledMimeType, kind, title, chatWidgetService) {
|
|
272
|
-
const customEdit = {
|
|
273
|
-
resource: model.uri,
|
|
274
|
-
variable: context,
|
|
275
|
-
undo: () => {
|
|
276
|
-
const widget = chatWidgetService.getWidgetByInputUri(model.uri);
|
|
277
|
-
if (!widget) {
|
|
278
|
-
throw ( new Error('No widget found for undo'));
|
|
279
|
-
}
|
|
280
|
-
widget.attachmentModel.delete(context.id);
|
|
281
|
-
},
|
|
282
|
-
redo: () => {
|
|
283
|
-
const widget = chatWidgetService.getWidgetByInputUri(model.uri);
|
|
284
|
-
if (!widget) {
|
|
285
|
-
throw ( new Error('No widget found for redo'));
|
|
286
|
-
}
|
|
287
|
-
widget.attachmentModel.addContext(context);
|
|
288
|
-
},
|
|
289
|
-
metadata: { needsConfirmation: false, label: context.name }
|
|
290
|
-
};
|
|
291
|
-
return {
|
|
292
|
-
insertText: '',
|
|
293
|
-
title,
|
|
294
|
-
kind,
|
|
295
|
-
handledMimeType,
|
|
296
|
-
additionalEdit: {
|
|
297
|
-
edits: [customEdit],
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
function createEditSession(edit) {
|
|
302
|
-
return {
|
|
303
|
-
edits: [edit],
|
|
304
|
-
dispose: () => { },
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
let ChatPasteProvidersFeature = class ChatPasteProvidersFeature extends Disposable {
|
|
308
|
-
constructor(languageFeaturesService, chatWidgetService, extensionService, fileService, modelService, environmentService, logService) {
|
|
309
|
-
super();
|
|
310
|
-
this._register(languageFeaturesService.documentPasteEditProvider.register({ scheme: ChatInputPart.INPUT_SCHEME, pattern: '*', hasAccessToAllModels: true }, ( new PasteImageProvider(
|
|
311
|
-
chatWidgetService,
|
|
312
|
-
extensionService,
|
|
313
|
-
fileService,
|
|
314
|
-
environmentService,
|
|
315
|
-
logService
|
|
316
|
-
))));
|
|
317
|
-
this._register(languageFeaturesService.documentPasteEditProvider.register({ scheme: ChatInputPart.INPUT_SCHEME, pattern: '*', hasAccessToAllModels: true }, ( new PasteTextProvider(chatWidgetService, modelService))));
|
|
318
|
-
this._register(languageFeaturesService.documentPasteEditProvider.register('*', ( new CopyTextProvider())));
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
ChatPasteProvidersFeature = ( __decorate([
|
|
322
|
-
( __param(0, ILanguageFeaturesService)),
|
|
323
|
-
( __param(1, IChatWidgetService)),
|
|
324
|
-
( __param(2, IExtensionService)),
|
|
325
|
-
( __param(3, IFileService)),
|
|
326
|
-
( __param(4, IModelService)),
|
|
327
|
-
( __param(5, IEnvironmentService)),
|
|
328
|
-
( __param(6, ILogService))
|
|
329
|
-
], ChatPasteProvidersFeature));
|
|
330
|
-
|
|
331
|
-
export { ChatPasteProvidersFeature, CopyTextProvider, PasteImageProvider, PasteTextProvider, imageToHash, isImage };
|
package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
3
|
-
import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service";
|
|
4
|
-
import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
|
|
5
|
-
export declare class ChatRelatedFilesContribution extends Disposable implements IWorkbenchContribution {
|
|
6
|
-
private readonly chatEditingService;
|
|
7
|
-
private readonly chatWidgetService;
|
|
8
|
-
static readonly ID = "chat.relatedFilesWorkingSet";
|
|
9
|
-
private readonly chatEditingSessionDisposables;
|
|
10
|
-
private _currentRelatedFilesRetrievalOperation;
|
|
11
|
-
constructor(chatEditingService: IChatEditingService, chatWidgetService: IChatWidgetService);
|
|
12
|
-
private _updateRelatedFileSuggestions;
|
|
13
|
-
private _handleNewEditingSession;
|
|
14
|
-
dispose(): void;
|
|
15
|
-
}
|
package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
4
|
-
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
5
|
-
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
-
import { ResourceSet, ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
7
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
8
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
9
|
-
import { WorkingSetEntryState, WorkingSetEntryRemovalReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
10
|
-
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
11
|
-
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
12
|
-
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
13
|
-
|
|
14
|
-
let ChatRelatedFilesContribution = class ChatRelatedFilesContribution extends Disposable {
|
|
15
|
-
static { this.ID = 'chat.relatedFilesWorkingSet'; }
|
|
16
|
-
constructor(chatEditingService, chatWidgetService) {
|
|
17
|
-
super();
|
|
18
|
-
this.chatEditingService = chatEditingService;
|
|
19
|
-
this.chatWidgetService = chatWidgetService;
|
|
20
|
-
this.chatEditingSessionDisposables = ( new Map());
|
|
21
|
-
this._register(autorun((reader) => {
|
|
22
|
-
const sessions = this.chatEditingService.editingSessionsObs.read(reader);
|
|
23
|
-
sessions.forEach(session => {
|
|
24
|
-
const widget = this.chatWidgetService.getWidgetBySessionId(session.chatSessionId);
|
|
25
|
-
if (widget && !( this.chatEditingSessionDisposables.has(session.chatSessionId))) {
|
|
26
|
-
this._handleNewEditingSession(session, widget);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
_updateRelatedFileSuggestions(currentEditingSession, widget) {
|
|
32
|
-
if (this._currentRelatedFilesRetrievalOperation) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const workingSetEntries = currentEditingSession.entries.get();
|
|
36
|
-
if (workingSetEntries.length > 0 || widget.attachmentModel.fileAttachments.length === 0) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
this._currentRelatedFilesRetrievalOperation = this.chatEditingService.getRelatedFiles(currentEditingSession.chatSessionId, widget.getInput(), widget.attachmentModel.fileAttachments, CancellationToken.None)
|
|
40
|
-
.then((files) => {
|
|
41
|
-
if (!files?.length || !widget.viewModel?.sessionId) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const currentEditingSession = this.chatEditingService.getEditingSession(widget.viewModel.sessionId);
|
|
45
|
-
if (!currentEditingSession || currentEditingSession.entries.get().length) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const existingFiles = ( new ResourceSet(widget.attachmentModel.fileAttachments));
|
|
49
|
-
if (!existingFiles.size) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const newSuggestions = ( new ResourceMap());
|
|
53
|
-
for (const group of files) {
|
|
54
|
-
for (const file of group.files) {
|
|
55
|
-
if (newSuggestions.size >= 2) {
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
if (( existingFiles.has(file.uri))) {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
newSuggestions.set(file.uri, { group: group.group, description: file.description });
|
|
62
|
-
existingFiles.add(file.uri);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const existingSuggestedEntriesToRemove = [];
|
|
66
|
-
for (const entry of currentEditingSession.workingSet) {
|
|
67
|
-
if (entry[1].state === WorkingSetEntryState.Suggested && !( newSuggestions.has(entry[0]))) {
|
|
68
|
-
existingSuggestedEntriesToRemove.push(entry[0]);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
currentEditingSession?.remove(WorkingSetEntryRemovalReason.Programmatic, ...existingSuggestedEntriesToRemove);
|
|
72
|
-
for (const [uri, data] of newSuggestions) {
|
|
73
|
-
currentEditingSession.addFileToWorkingSet(uri, ( localize(4789, "{0} (Suggested)", data.description)), WorkingSetEntryState.Suggested);
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
.finally(() => {
|
|
77
|
-
this._currentRelatedFilesRetrievalOperation = undefined;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
_handleNewEditingSession(currentEditingSession, widget) {
|
|
81
|
-
const disposableStore = ( new DisposableStore());
|
|
82
|
-
disposableStore.add(currentEditingSession.onDidDispose(() => {
|
|
83
|
-
disposableStore.clear();
|
|
84
|
-
}));
|
|
85
|
-
this._updateRelatedFileSuggestions(currentEditingSession, widget);
|
|
86
|
-
const onDebouncedType = Event.debounce(widget.inputEditor.onDidChangeModelContent, () => null, 3000);
|
|
87
|
-
disposableStore.add(onDebouncedType(() => {
|
|
88
|
-
this._updateRelatedFileSuggestions(currentEditingSession, widget);
|
|
89
|
-
}));
|
|
90
|
-
disposableStore.add(widget.attachmentModel.onDidChangeContext(() => {
|
|
91
|
-
this._updateRelatedFileSuggestions(currentEditingSession, widget);
|
|
92
|
-
}));
|
|
93
|
-
disposableStore.add(currentEditingSession.onDidDispose(() => {
|
|
94
|
-
disposableStore.dispose();
|
|
95
|
-
}));
|
|
96
|
-
this.chatEditingSessionDisposables.set(currentEditingSession.chatSessionId, disposableStore);
|
|
97
|
-
}
|
|
98
|
-
dispose() {
|
|
99
|
-
for (const store of ( this.chatEditingSessionDisposables.values())) {
|
|
100
|
-
store.dispose();
|
|
101
|
-
}
|
|
102
|
-
super.dispose();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
ChatRelatedFilesContribution = ( __decorate([
|
|
106
|
-
( __param(0, IChatEditingService)),
|
|
107
|
-
( __param(1, IChatWidgetService))
|
|
108
|
-
], ChatRelatedFilesContribution));
|
|
109
|
-
|
|
110
|
-
export { ChatRelatedFilesContribution };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
|
|
2
|
-
|
|
3
|
-
var css = ".chat-editor-overlay-widget{align-items:center;background-color:var(--vscode-button-background);border:1px solid var(--vscode-contrastBorder);border-radius:5px;box-shadow:0 2px 8px var(--vscode-widget-shadow);color:var(--vscode-button-foreground);display:flex;overflow:hidden;padding:0;z-index:10}@keyframes pulse{0%{box-shadow:0 2px 8px 0 var(--vscode-widget-shadow)}50%{box-shadow:0 2px 8px 4px var(--vscode-widget-shadow)}to{box-shadow:0 2px 8px 0 var(--vscode-widget-shadow)}}.chat-editor-overlay-widget.busy{animation:pulse 2.3s ease-in infinite}.chat-editor-overlay-widget .chat-editor-overlay-progress{align-items:center;display:none;font-size:12px;font-variant-numeric:tabular-nums;overflow:hidden;padding:0 5px;white-space:nowrap}.chat-editor-overlay-widget.busy .chat-editor-overlay-progress{display:inline-flex}@keyframes ellipsis{0%{content:\"\"}25%{content:\".\"}50%{content:\"..\"}75%{content:\"...\"}to{content:\"\"}}.chat-editor-overlay-widget.busy.paused .chat-editor-overlay-progress{.codicon-loading{display:none}}.chat-editor-overlay-widget .action-item>.action-label{font-size:12px;padding:5px}.chat-editor-overlay-widget.busy .action-item>.action-label.busy:after{animation:ellipsis 1s steps(4) infinite;content:\"\";display:inline-flex;overflow:hidden;white-space:nowrap;width:3ch}.chat-editor-overlay-widget .action-item:first-child>.action-label{padding-left:7px}.chat-editor-overlay-widget .action-item:last-child>.action-label{padding-right:7px}.chat-editor-overlay-widget .action-item>.action-label.codicon,.chat-editor-overlay-widget.busy .chat-editor-overlay-progress .codicon{color:var(--vscode-button-foreground)}.chat-diff-change-content-widget .monaco-action-bar .action-item.disabled,.chat-editor-overlay-widget .monaco-action-bar .action-item.disabled{>.action-label,>.action-label.codicon,>.action-label.codicon:before,>.action-label:hover{color:var(--vscode-button-foreground);opacity:.7}}.chat-editor-overlay-widget .action-item.label-item{font-variant-numeric:tabular-nums}.chat-editor-overlay-widget .monaco-action-bar .action-item.label-item>.action-label,.chat-editor-overlay-widget .monaco-action-bar .action-item.label-item>.action-label:hover{color:var(--vscode-button-foreground);opacity:1}.chat-editor-overlay-widget .action-item.auto{overflow:hidden;position:relative}.chat-editor-overlay-widget .action-item.auto:before{background-color:var(--vscode-toolbar-hoverBackground);content:\"\";height:100%;left:var(--vscode-action-item-auto-timeout,-100%);position:absolute;top:0;transition:left .5s linear;width:100%}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
|
|
2
|
-
|
|
3
|
-
var css = ".chat-status-bar-entry-tooltip{margin-bottom:4px;margin-top:4px}.chat-status-bar-entry-tooltip hr{margin-bottom:8px;margin-top:8px}.chat-status-bar-entry-tooltip div.header{color:var(--vscode-descriptionForeground);font-weight:600;margin-bottom:4px}.chat-status-bar-entry-tooltip div.description{color:var(--vscode-descriptionForeground)}.chat-status-bar-entry-tooltip .settings{display:flex;flex-direction:column;gap:5px}.chat-status-bar-entry-tooltip .settings .setting{align-items:center;display:flex}.chat-status-bar-entry-tooltip .settings .setting .monaco-checkbox{height:14px;margin-right:5px;width:14px}.chat-status-bar-entry-tooltip .settings .setting .codicon{font-size:12px}.chat-status-bar-entry-tooltip .settings .setting .setting-label{cursor:pointer}.chat-status-bar-entry-tooltip .shortcuts{display:flex;flex-direction:column;gap:2px}.chat-status-bar-entry-tooltip .shortcuts .shortcut{display:flex;gap:10px;margin:-1px -3px;padding:1px 3px}.chat-status-bar-entry-tooltip .shortcuts .shortcut:hover{background-color:var(--vscode-toolbar-hoverBackground);border-radius:3px;outline:1px dashed var(--vscode-toolbar-hoverOutline);outline-offset:-1px}.chat-status-bar-entry-tooltip .shortcuts .shortcut .shortcut-label{cursor:pointer;flex:1}.chat-status-bar-entry-tooltip .shortcuts .shortcut .monaco-keybinding{cursor:pointer}.chat-status-bar-entry-tooltip .shortcuts .shortcut .monaco-keybinding>.monaco-keybinding-key{font-size:10px;padding:2px 4px}.chat-status-bar-entry-tooltip .quota-indicator{margin-bottom:6px}.chat-status-bar-entry-tooltip .quota-indicator .quota-label{display:flex;justify-content:space-between;margin-bottom:3px}.chat-status-bar-entry-tooltip .quota-indicator .quota-bar{background-color:var(--vscode-gauge-foreground);border:1px solid var(--vscode-gauge-border);border-radius:4px;height:4px;width:100%}.chat-status-bar-entry-tooltip .quota-indicator .quota-bar .quota-bit{background-color:var(--vscode-gauge-background);border-radius:4px;height:100%}.chat-status-bar-entry-tooltip .quota-indicator.warning .quota-bar{background-color:var(--vscode-gauge-warningForeground)}.chat-status-bar-entry-tooltip .quota-indicator.warning .quota-bar .quota-bit{background-color:var(--vscode-gauge-warningBackground)}.chat-status-bar-entry-tooltip .quota-indicator.error .quota-bar{background-color:var(--vscode-gauge-errorForeground)}.chat-status-bar-entry-tooltip .quota-indicator.error .quota-bar .quota-bit{background-color:var(--vscode-gauge-errorBackground)}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
|
|
2
|
-
|
|
3
|
-
var css = ".chat-welcome-view .chat-setup-view{text-align:center;p{width:100%}.chat-features-container{background-color:var(--vscode-chat-requestBackground);border:1px solid var(--vscode-chat-requestBorder);border-radius:2px;display:flex;justify-content:center;text-align:initial}.chat-feature-container{align-items:center;display:flex;gap:6px;padding:5px 10px}.chat-feature-container .codicon[class*=codicon-]{font-size:16px}.codicon[class*=codicon-]{font-size:13px;line-height:1.4em;vertical-align:bottom}.button-container{padding-top:20px}.monaco-button-dropdown,.monaco-button-dropdown .monaco-text-button{width:100%}}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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 };
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
4
|
-
import { 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 };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
3
|
-
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
4
|
-
import { ILanguageModelToolsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service";
|
|
5
|
-
export declare class BuiltinToolsContribution extends Disposable implements IWorkbenchContribution {
|
|
6
|
-
static readonly ID = "chat.builtinTools";
|
|
7
|
-
constructor(toolsService: ILanguageModelToolsService, instantiationService: IInstantiationService);
|
|
8
|
-
}
|
|
9
|
-
export interface IToolInputProcessor {
|
|
10
|
-
processInput(input: any): any;
|
|
11
|
-
}
|