@codingame/monaco-vscode-chat-service-override 17.2.0 → 18.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 +7 -4
- package/package.json +36 -30
- package/vscode/src/vs/base/common/objectCache.d.ts +2 -2
- package/vscode/src/vs/base/common/objectCache.js +3 -3
- package/vscode/src/vs/platform/browserElements/common/browserElements.d.ts +10 -0
- package/vscode/src/vs/platform/browserElements/common/browserElements.js +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +40 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +158 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +256 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +234 -572
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +29 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +107 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +344 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +84 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatAttachInstructionsAction.d.ts +18 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatAttachInstructionsAction.js +137 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatModeActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatModeActions.js +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatRunPromptAction.js +40 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatSaveToPromptAction.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatSaveToPromptAction.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/promptFilePickers.d.ts +15 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/promptFilePickers.js +171 -101
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/attachInstructions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/attachInstructions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/runPrompt.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/index.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/index.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +176 -69
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +15 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +22 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +35 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +80 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +11 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +12 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +13 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +15 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +3 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +10 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +18 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +118 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +46 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +379 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +31 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +382 -152
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +99 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +9 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +10 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +18 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +95 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +92 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/media/github.svg +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/google.svg +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/simpleBrowserOverlay.css +10 -4
- 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 +111 -111
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +36 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +5 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +91 -17
- 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 +1 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +4 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +95 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +348 -0
- 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 +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +93 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +46 -36
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/configMigration.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/configMigration.js +21 -11
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/index.js +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/index.js +3 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptHeaderDiagnosticsProvider.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptHeaderDiagnosticsProvider.js +12 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptLinkDiagnosticsProvider.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptLinkDiagnosticsProvider.js +1 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptLinkProvider.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptPathAutocompletion.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceBase.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceBase.js +9 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceManagerBase.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceManagerBase.js +12 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +21 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +111 -124
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +22 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +159 -97
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/treeUtils.d.ts +15 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/treeUtils.js +2 -14
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +8 -2
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +198 -33
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +28 -18
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/attachInstructionsCommand.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/attachInstructionsCommand.js +0 -73
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterDecoration.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterDecoration.js +0 -74
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterMarkerDecoration.d.ts +0 -14
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterMarkerDecoration.js +0 -40
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/decorationBase.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/decorationBase.js +0 -40
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/index.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/index.js +0 -9
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/reactiveDecorationBase.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/reactiveDecorationBase.js +0 -68
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/types.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/promptDecorationsProvider.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/promptDecorationsProvider.js +0 -121
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/types.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/types.js +0 -13
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { VSBuffer, decodeBase64 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
4
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
5
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { newWriteableStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stream';
|
|
7
|
+
import { FileSystemProviderCapabilities, FileType, createFileSystemProviderError, FileSystemProviderErrorCode } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
8
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
9
|
+
import { ChatResponseResource } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
10
|
+
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
11
|
+
import { isToolResultInputOutputDetails } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService';
|
|
12
|
+
|
|
13
|
+
let ChatResponseResourceFileSystemProvider = class ChatResponseResourceFileSystemProvider extends Disposable {
|
|
14
|
+
static { this.ID = 'workbench.contrib.chatResponseResourceFileSystemProvider'; }
|
|
15
|
+
constructor(chatService, _fileService) {
|
|
16
|
+
super();
|
|
17
|
+
this.chatService = chatService;
|
|
18
|
+
this._fileService = _fileService;
|
|
19
|
+
this.onDidChangeCapabilities = Event.None;
|
|
20
|
+
this.onDidChangeFile = Event.None;
|
|
21
|
+
this.capabilities = FileSystemProviderCapabilities.None
|
|
22
|
+
| FileSystemProviderCapabilities.Readonly
|
|
23
|
+
| FileSystemProviderCapabilities.PathCaseSensitive
|
|
24
|
+
| FileSystemProviderCapabilities.FileReadStream
|
|
25
|
+
| FileSystemProviderCapabilities.FileAtomicRead
|
|
26
|
+
| FileSystemProviderCapabilities.FileReadWrite;
|
|
27
|
+
this._register(this._fileService.registerProvider(ChatResponseResource.scheme, this));
|
|
28
|
+
}
|
|
29
|
+
readFile(resource) {
|
|
30
|
+
return Promise.resolve(this.lookupURI(resource));
|
|
31
|
+
}
|
|
32
|
+
readFileStream(resource) {
|
|
33
|
+
const stream = newWriteableStream(data => VSBuffer.concat(( data.map(data => VSBuffer.wrap(data)))).buffer);
|
|
34
|
+
stream.end(this.lookupURI(resource));
|
|
35
|
+
return stream;
|
|
36
|
+
}
|
|
37
|
+
stat(resource) {
|
|
38
|
+
const r = this.lookupURI(resource);
|
|
39
|
+
return Promise.resolve({
|
|
40
|
+
type: FileType.File,
|
|
41
|
+
ctime: 0,
|
|
42
|
+
mtime: 0,
|
|
43
|
+
size: r.length,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
delete() {
|
|
47
|
+
throw createFileSystemProviderError('fs is readonly', FileSystemProviderErrorCode.NoPermissions);
|
|
48
|
+
}
|
|
49
|
+
watch() {
|
|
50
|
+
return Disposable.None;
|
|
51
|
+
}
|
|
52
|
+
mkdir() {
|
|
53
|
+
throw createFileSystemProviderError('fs is readonly', FileSystemProviderErrorCode.NoPermissions);
|
|
54
|
+
}
|
|
55
|
+
readdir() {
|
|
56
|
+
return Promise.resolve([]);
|
|
57
|
+
}
|
|
58
|
+
rename() {
|
|
59
|
+
throw createFileSystemProviderError('fs is readonly', FileSystemProviderErrorCode.NoPermissions);
|
|
60
|
+
}
|
|
61
|
+
writeFile() {
|
|
62
|
+
throw createFileSystemProviderError('fs is readonly', FileSystemProviderErrorCode.NoPermissions);
|
|
63
|
+
}
|
|
64
|
+
lookupURI(uri) {
|
|
65
|
+
const parsed = ChatResponseResource.parseUri(uri);
|
|
66
|
+
if (!parsed) {
|
|
67
|
+
throw createFileSystemProviderError(`File not found`, FileSystemProviderErrorCode.FileNotFound);
|
|
68
|
+
}
|
|
69
|
+
const { sessionId, requestId, toolCallId } = parsed;
|
|
70
|
+
const result = this.chatService.getSession(sessionId)
|
|
71
|
+
?.getRequests()
|
|
72
|
+
.find(r => r.id === requestId)
|
|
73
|
+
?.response?.entireResponse.value
|
|
74
|
+
.find((r) => (r.kind === 'toolInvocation' || r.kind === 'toolInvocationSerialized') && r.toolCallId === toolCallId);
|
|
75
|
+
if (!result) {
|
|
76
|
+
throw createFileSystemProviderError(`File not found`, FileSystemProviderErrorCode.FileNotFound);
|
|
77
|
+
}
|
|
78
|
+
if (!isToolResultInputOutputDetails(result.resultDetails)) {
|
|
79
|
+
throw createFileSystemProviderError(`Tool does not have I/O`, FileSystemProviderErrorCode.FileNotFound);
|
|
80
|
+
}
|
|
81
|
+
const part = result.resultDetails.output.at(parsed.index);
|
|
82
|
+
if (!part) {
|
|
83
|
+
throw createFileSystemProviderError(`Tool does not have part`, FileSystemProviderErrorCode.FileNotFound);
|
|
84
|
+
}
|
|
85
|
+
return part.isText ? ( new TextEncoder()).encode(part.value) : decodeBase64(part.value).buffer;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
ChatResponseResourceFileSystemProvider = ( __decorate([
|
|
89
|
+
( __param(0, IChatService)),
|
|
90
|
+
( __param(1, IFileService))
|
|
91
|
+
], ChatResponseResourceFileSystemProvider));
|
|
92
|
+
|
|
93
|
+
export { ChatResponseResourceFileSystemProvider };
|
|
@@ -18,6 +18,7 @@ import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/c
|
|
|
18
18
|
import { IChatSlashCommandService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSlashCommands.service";
|
|
19
19
|
import { IChatTransferService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatTransferService.service";
|
|
20
20
|
import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants";
|
|
21
|
+
import { ILanguageModelsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service";
|
|
21
22
|
export declare class ChatService extends Disposable implements IChatService {
|
|
22
23
|
private readonly storageService;
|
|
23
24
|
private readonly logService;
|
|
@@ -30,6 +31,7 @@ export declare class ChatService extends Disposable implements IChatService {
|
|
|
30
31
|
private readonly configurationService;
|
|
31
32
|
private readonly experimentService;
|
|
32
33
|
private readonly chatTransferService;
|
|
34
|
+
private readonly languageModelsService;
|
|
33
35
|
_serviceBrand: undefined;
|
|
34
36
|
private readonly _sessionModels;
|
|
35
37
|
private readonly _pendingRequests;
|
|
@@ -46,7 +48,7 @@ export declare class ChatService extends Disposable implements IChatService {
|
|
|
46
48
|
private readonly _onDidDisposeSession;
|
|
47
49
|
readonly onDidDisposeSession: Event<{
|
|
48
50
|
sessionId: string;
|
|
49
|
-
reason: "
|
|
51
|
+
reason: "cleared";
|
|
50
52
|
}>;
|
|
51
53
|
private readonly _sessionFollowupCancelTokens;
|
|
52
54
|
private readonly _chatServiceTelemetry;
|
|
@@ -54,7 +56,7 @@ export declare class ChatService extends Disposable implements IChatService {
|
|
|
54
56
|
private get useFileStorage();
|
|
55
57
|
get edits2Enabled(): boolean;
|
|
56
58
|
private get isEmptyWindow();
|
|
57
|
-
constructor(storageService: IStorageService, logService: ILogService, extensionService: IExtensionService, instantiationService: IInstantiationService, telemetryService: ITelemetryService, workspaceContextService: IWorkspaceContextService, chatSlashCommandService: IChatSlashCommandService, chatAgentService: IChatAgentService, configurationService: IConfigurationService, experimentService: IWorkbenchAssignmentService, chatTransferService: IChatTransferService);
|
|
59
|
+
constructor(storageService: IStorageService, logService: ILogService, extensionService: IExtensionService, instantiationService: IInstantiationService, telemetryService: ITelemetryService, workspaceContextService: IWorkspaceContextService, chatSlashCommandService: IChatSlashCommandService, chatAgentService: IChatAgentService, configurationService: IConfigurationService, experimentService: IWorkbenchAssignmentService, chatTransferService: IChatTransferService, languageModelsService: ILanguageModelsService);
|
|
58
60
|
isEnabled(location: ChatAgentLocation): boolean;
|
|
59
61
|
private saveState;
|
|
60
62
|
private syncEmptyWindowChats;
|
|
@@ -80,6 +82,7 @@ export declare class ChatService extends Disposable implements IChatService {
|
|
|
80
82
|
private parseChatRequest;
|
|
81
83
|
private refreshFollowupsCancellationToken;
|
|
82
84
|
private _sendRequestAsync;
|
|
85
|
+
private resolveModelId;
|
|
83
86
|
private prepareContext;
|
|
84
87
|
private checkAgentAllowed;
|
|
85
88
|
private attachmentKindsForTelemetry;
|
|
@@ -34,6 +34,7 @@ import { IChatSlashCommandService } from '@codingame/monaco-vscode-api/vscode/vs
|
|
|
34
34
|
import { IChatTransferService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatTransferService.service';
|
|
35
35
|
import { ChatConfiguration, ChatAgentLocation, ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
36
36
|
import { ChatMessageRole } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
37
|
+
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
37
38
|
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
|
|
38
39
|
|
|
39
40
|
const serializedChatKey = 'interactive.sessions';
|
|
@@ -73,7 +74,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
73
74
|
const workspace = this.workspaceContextService.getWorkspace();
|
|
74
75
|
return !workspace.configuration && workspace.folders.length === 0;
|
|
75
76
|
}
|
|
76
|
-
constructor(storageService, logService, extensionService, instantiationService, telemetryService, workspaceContextService, chatSlashCommandService, chatAgentService, configurationService, experimentService, chatTransferService) {
|
|
77
|
+
constructor(storageService, logService, extensionService, instantiationService, telemetryService, workspaceContextService, chatSlashCommandService, chatAgentService, configurationService, experimentService, chatTransferService, languageModelsService) {
|
|
77
78
|
super();
|
|
78
79
|
this.storageService = storageService;
|
|
79
80
|
this.logService = logService;
|
|
@@ -86,6 +87,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
86
87
|
this.configurationService = configurationService;
|
|
87
88
|
this.experimentService = experimentService;
|
|
88
89
|
this.chatTransferService = chatTransferService;
|
|
90
|
+
this.languageModelsService = languageModelsService;
|
|
89
91
|
this._sessionModels = this._register(( new DisposableMap()));
|
|
90
92
|
this._pendingRequests = this._register(( new DisposableMap()));
|
|
91
93
|
this._deletedChatIds = ( new Set());
|
|
@@ -278,7 +280,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
278
280
|
const liveSessionItems = ( Array.from(( this._sessionModels.values()))
|
|
279
281
|
.filter(session => !session.isImported)
|
|
280
282
|
.map(session => {
|
|
281
|
-
const title = session.title || ( localize(
|
|
283
|
+
const title = session.title || ( localize(5162, "New Chat"));
|
|
282
284
|
return {
|
|
283
285
|
sessionId: session.sessionId,
|
|
284
286
|
title,
|
|
@@ -312,7 +314,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
312
314
|
const liveSessionItems = ( Array.from(( this._sessionModels.values()))
|
|
313
315
|
.filter(session => !session.isImported)
|
|
314
316
|
.map(session => {
|
|
315
|
-
const title = session.title || ( localize(
|
|
317
|
+
const title = session.title || ( localize(5162, "New Chat"));
|
|
316
318
|
return {
|
|
317
319
|
sessionId: session.sessionId,
|
|
318
320
|
title,
|
|
@@ -355,19 +357,9 @@ let ChatService = class ChatService extends Disposable {
|
|
|
355
357
|
this.initializeSession(model, token);
|
|
356
358
|
return model;
|
|
357
359
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
model.startInitialize();
|
|
362
|
-
this.activateDefaultAgent(model.initialLocation).catch(e => this.logService.error(e));
|
|
363
|
-
model.initialize();
|
|
364
|
-
}
|
|
365
|
-
catch (err) {
|
|
366
|
-
this.trace('startSession', `initializeSession failed: ${err}`);
|
|
367
|
-
model.setInitializationError(err);
|
|
368
|
-
this._sessionModels.deleteAndDispose(model.sessionId);
|
|
369
|
-
this._onDidDisposeSession.fire({ sessionId: model.sessionId, reason: 'initializationFailed' });
|
|
370
|
-
}
|
|
360
|
+
initializeSession(model, token) {
|
|
361
|
+
this.trace('initializeSession', `Initialize session ${model.sessionId}`);
|
|
362
|
+
this.activateDefaultAgent(model.initialLocation).catch(e => this.logService.error(e));
|
|
371
363
|
}
|
|
372
364
|
async activateDefaultAgent(location) {
|
|
373
365
|
await this.extensionService.whenInstalledExtensionsRegistered();
|
|
@@ -375,7 +367,13 @@ let ChatService = class ChatService extends Disposable {
|
|
|
375
367
|
if (!defaultAgentData) {
|
|
376
368
|
throw ( new ErrorNoTelemetry('No default agent contributed'));
|
|
377
369
|
}
|
|
378
|
-
|
|
370
|
+
if (!defaultAgentData.isCore) {
|
|
371
|
+
await this.extensionService.activateById(defaultAgentData.extensionId, {
|
|
372
|
+
activationEvent: `onChatParticipant:${defaultAgentData.id}`,
|
|
373
|
+
extensionId: defaultAgentData.extensionId,
|
|
374
|
+
startup: false
|
|
375
|
+
});
|
|
376
|
+
}
|
|
379
377
|
const defaultAgent = this.chatAgentService.getActivatedAgents().find(agent => agent.id === defaultAgentData.id);
|
|
380
378
|
if (!defaultAgent) {
|
|
381
379
|
throw ( new ErrorNoTelemetry('No default agent registered'));
|
|
@@ -422,7 +420,6 @@ let ChatService = class ChatService extends Disposable {
|
|
|
422
420
|
if (!model && model !== request.session) {
|
|
423
421
|
throw ( new Error(`Unknown session: ${request.session.sessionId}`));
|
|
424
422
|
}
|
|
425
|
-
await model.waitForInitialization();
|
|
426
423
|
const cts = this._pendingRequests.get(request.session.sessionId);
|
|
427
424
|
if (cts) {
|
|
428
425
|
this.trace('resendRequest', `Session ${request.session.sessionId} already has a pending request, cancelling...`);
|
|
@@ -450,7 +447,6 @@ let ChatService = class ChatService extends Disposable {
|
|
|
450
447
|
if (!model) {
|
|
451
448
|
throw ( new Error(`Unknown session: ${sessionId}`));
|
|
452
449
|
}
|
|
453
|
-
await model.waitForInitialization();
|
|
454
450
|
if (( this._pendingRequests.has(sessionId))) {
|
|
455
451
|
this.trace('sendRequest', `Session ${sessionId} already has a pending request`);
|
|
456
452
|
return;
|
|
@@ -524,13 +520,17 @@ let ChatService = class ChatService extends Disposable {
|
|
|
524
520
|
return;
|
|
525
521
|
}
|
|
526
522
|
gotProgress = true;
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
523
|
+
for (let i = 0; i < progress.length; i++) {
|
|
524
|
+
const isLast = i === progress.length - 1;
|
|
525
|
+
const progressItem = progress[i];
|
|
526
|
+
if (progressItem.kind === 'markdownContent') {
|
|
527
|
+
this.trace('sendRequest', `Provider returned progress for session ${model.sessionId}, ${progressItem.content.value.length} chars`);
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
this.trace('sendRequest', `Provider returned progress: ${JSON.stringify(progressItem)}`);
|
|
531
|
+
}
|
|
532
|
+
model.acceptResponseProgress(request, progressItem, !isLast);
|
|
532
533
|
}
|
|
533
|
-
model.acceptResponseProgress(request, progress);
|
|
534
534
|
completeResponseCreated();
|
|
535
535
|
};
|
|
536
536
|
let detectedAgent;
|
|
@@ -552,7 +552,8 @@ let ChatService = class ChatService extends Disposable {
|
|
|
552
552
|
numCodeBlocks: getCodeBlocks(request.response?.response.toString() ?? '').length,
|
|
553
553
|
isParticipantDetected: !!detectedAgent,
|
|
554
554
|
enableCommandDetection,
|
|
555
|
-
attachmentKinds: this.attachmentKindsForTelemetry(request.variableData)
|
|
555
|
+
attachmentKinds: this.attachmentKindsForTelemetry(request.variableData),
|
|
556
|
+
model: this.resolveModelId(options?.userSelectedModelId),
|
|
556
557
|
});
|
|
557
558
|
model.cancelRequest(request);
|
|
558
559
|
});
|
|
@@ -593,7 +594,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
593
594
|
rejectedConfirmationData: options?.rejectedConfirmationData,
|
|
594
595
|
userSelectedModelId: options?.userSelectedModelId,
|
|
595
596
|
userSelectedTools: options?.userSelectedTools,
|
|
596
|
-
|
|
597
|
+
modeInstructions: options?.modeInstructions,
|
|
597
598
|
toolSelectionIsExclusive: options?.toolSelectionIsExclusive,
|
|
598
599
|
editedFileEvents: request.editedFileEvents
|
|
599
600
|
};
|
|
@@ -639,7 +640,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
639
640
|
}
|
|
640
641
|
const message = parsedRequest.text;
|
|
641
642
|
const commandResult = await this.chatSlashCommandService.executeCommand(commandPart.slashCommand.command, message.substring(commandPart.slashCommand.command.length + 1).trimStart(), ( new Progress(p => {
|
|
642
|
-
progressCallback(p);
|
|
643
|
+
progressCallback([p]);
|
|
643
644
|
})), history, location, token);
|
|
644
645
|
agentOrCommandFollowups = Promise.resolve(commandResult?.followUp);
|
|
645
646
|
rawResult = {};
|
|
@@ -647,13 +648,13 @@ let ChatService = class ChatService extends Disposable {
|
|
|
647
648
|
else {
|
|
648
649
|
throw ( new Error(`Cannot handle request`));
|
|
649
650
|
}
|
|
650
|
-
if (token.isCancellationRequested) {
|
|
651
|
+
if (token.isCancellationRequested && !rawResult) {
|
|
651
652
|
return;
|
|
652
653
|
}
|
|
653
654
|
else {
|
|
654
655
|
if (!rawResult) {
|
|
655
656
|
this.trace('sendRequest', `Provider returned no response for session ${model.sessionId}`);
|
|
656
|
-
rawResult = { errorDetails: { message: ( localize(
|
|
657
|
+
rawResult = { errorDetails: { message: ( localize(5163, "Provider returned null response")) } };
|
|
657
658
|
}
|
|
658
659
|
const result = rawResult.errorDetails?.responseIsFiltered ? 'filtered' :
|
|
659
660
|
rawResult.errorDetails && gotProgress ? 'errorWithOutput' :
|
|
@@ -674,7 +675,8 @@ let ChatService = class ChatService extends Disposable {
|
|
|
674
675
|
location,
|
|
675
676
|
citations: request.response?.codeCitations.length ?? 0,
|
|
676
677
|
numCodeBlocks: getCodeBlocks(request.response?.response.toString() ?? '').length,
|
|
677
|
-
attachmentKinds: this.attachmentKindsForTelemetry(request.variableData)
|
|
678
|
+
attachmentKinds: this.attachmentKindsForTelemetry(request.variableData),
|
|
679
|
+
model: this.resolveModelId(options?.userSelectedModelId),
|
|
678
680
|
});
|
|
679
681
|
model.setResponse(request, rawResult);
|
|
680
682
|
completeResponseCreated();
|
|
@@ -709,7 +711,8 @@ let ChatService = class ChatService extends Disposable {
|
|
|
709
711
|
numCodeBlocks: 0,
|
|
710
712
|
enableCommandDetection,
|
|
711
713
|
isParticipantDetected: !!detectedAgent,
|
|
712
|
-
attachmentKinds: this.attachmentKindsForTelemetry(request.variableData)
|
|
714
|
+
attachmentKinds: this.attachmentKindsForTelemetry(request.variableData),
|
|
715
|
+
model: this.resolveModelId(options?.userSelectedModelId)
|
|
713
716
|
});
|
|
714
717
|
this.logService.error(`Error while handling chat request: ${toErrorMessage(err, true)}`);
|
|
715
718
|
if (request) {
|
|
@@ -734,6 +737,9 @@ let ChatService = class ChatService extends Disposable {
|
|
|
734
737
|
responseCompletePromise: rawResponsePromise,
|
|
735
738
|
};
|
|
736
739
|
}
|
|
740
|
+
resolveModelId(userSelectedModelId) {
|
|
741
|
+
return userSelectedModelId && this.languageModelsService.lookupLanguageModel(userSelectedModelId)?.id;
|
|
742
|
+
}
|
|
737
743
|
prepareContext(attachedContextVariables) {
|
|
738
744
|
attachedContextVariables ??= [];
|
|
739
745
|
attachedContextVariables.sort((a, b) => {
|
|
@@ -767,6 +773,9 @@ let ChatService = class ChatService extends Disposable {
|
|
|
767
773
|
if (v.kind === 'tool') {
|
|
768
774
|
return 'toolInPrompt';
|
|
769
775
|
}
|
|
776
|
+
else if (v.kind === 'toolset') {
|
|
777
|
+
return 'toolsetInPrompt';
|
|
778
|
+
}
|
|
770
779
|
else {
|
|
771
780
|
return 'fileInPrompt';
|
|
772
781
|
}
|
|
@@ -786,6 +795,9 @@ let ChatService = class ChatService extends Disposable {
|
|
|
786
795
|
else if (v.kind === 'tool') {
|
|
787
796
|
return 'tool';
|
|
788
797
|
}
|
|
798
|
+
else if (v.kind === 'toolset') {
|
|
799
|
+
return 'toolset';
|
|
800
|
+
}
|
|
789
801
|
else {
|
|
790
802
|
if (URI.isUri(v.value)) {
|
|
791
803
|
return 'file';
|
|
@@ -829,7 +841,6 @@ let ChatService = class ChatService extends Disposable {
|
|
|
829
841
|
if (!model) {
|
|
830
842
|
throw ( new Error(`Unknown session: ${sessionId}`));
|
|
831
843
|
}
|
|
832
|
-
await model.waitForInitialization();
|
|
833
844
|
const pendingRequest = this._pendingRequests.get(sessionId);
|
|
834
845
|
if (pendingRequest?.requestId === requestId) {
|
|
835
846
|
pendingRequest.cancel();
|
|
@@ -845,7 +856,6 @@ let ChatService = class ChatService extends Disposable {
|
|
|
845
856
|
if (!target) {
|
|
846
857
|
throw ( new Error(`Unknown session: ${sessionId}`));
|
|
847
858
|
}
|
|
848
|
-
await target.waitForInitialization();
|
|
849
859
|
const oldOwner = request.session;
|
|
850
860
|
target.adoptRequest(request);
|
|
851
861
|
if (request.response && !request.response.isComplete) {
|
|
@@ -862,7 +872,6 @@ let ChatService = class ChatService extends Disposable {
|
|
|
862
872
|
if (!model) {
|
|
863
873
|
throw ( new Error(`Unknown session: ${sessionId}`));
|
|
864
874
|
}
|
|
865
|
-
await model.waitForInitialization();
|
|
866
875
|
const parsedRequest = typeof message === 'string' ?
|
|
867
876
|
this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(sessionId, message) :
|
|
868
877
|
message;
|
|
@@ -966,7 +975,8 @@ ChatService = ( __decorate([
|
|
|
966
975
|
( __param(7, IChatAgentService)),
|
|
967
976
|
( __param(8, IConfigurationService)),
|
|
968
977
|
( __param(9, IWorkbenchAssignmentService)),
|
|
969
|
-
( __param(10, IChatTransferService))
|
|
978
|
+
( __param(10, IChatTransferService)),
|
|
979
|
+
( __param(11, ILanguageModelsService))
|
|
970
980
|
], ChatService));
|
|
971
981
|
function getCodeBlocks(text) {
|
|
972
982
|
const lines = text.split('\n');
|
|
@@ -51,7 +51,7 @@ let ChatSessionStore = class ChatSessionStore extends Disposable {
|
|
|
51
51
|
}
|
|
52
52
|
e.join(this.storeTask, {
|
|
53
53
|
id: 'join.chatSessionStore',
|
|
54
|
-
label: ( localize(
|
|
54
|
+
label: ( localize(5164, "Saving chat history"))
|
|
55
55
|
});
|
|
56
56
|
}));
|
|
57
57
|
}
|
|
@@ -324,7 +324,7 @@ function isChatSessionIndex(data) {
|
|
|
324
324
|
}
|
|
325
325
|
function getSessionMetadata(session) {
|
|
326
326
|
const title = session instanceof ChatModel ?
|
|
327
|
-
(session.title || ( localize(
|
|
327
|
+
(session.title || ( localize(5165, "New Chat"))) :
|
|
328
328
|
session.customTitle ?? ChatModel.getDefaultTitle(session.requests);
|
|
329
329
|
return {
|
|
330
330
|
sessionId: session.sessionId,
|
package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/configMigration.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
1
2
|
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
2
3
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
3
4
|
export declare class ConfigMigration implements IWorkbenchContribution {
|
|
4
|
-
|
|
5
|
+
private readonly logService;
|
|
6
|
+
private readonly configService;
|
|
7
|
+
constructor(logService: ILogService, configService: IConfigurationService);
|
|
8
|
+
private migrateConfig;
|
|
5
9
|
}
|
package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/configMigration.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { assert } from '@codingame/monaco-vscode-api/vscode/vs/base/common/assert';
|
|
4
|
-
import {
|
|
4
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
5
|
+
import { asBoolean } from '@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/config';
|
|
5
6
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
6
|
-
import { CONFIG_KEY, PROMPT_LOCATIONS_CONFIG_KEY } from '@codingame/monaco-vscode-
|
|
7
|
+
import { CONFIG_KEY, PROMPT_LOCATIONS_CONFIG_KEY } from '@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/prompts';
|
|
7
8
|
|
|
8
9
|
let ConfigMigration = class ConfigMigration {
|
|
9
|
-
constructor(configService) {
|
|
10
|
-
|
|
10
|
+
constructor(logService, configService) {
|
|
11
|
+
this.logService = logService;
|
|
12
|
+
this.configService = configService;
|
|
13
|
+
this.migrateConfig()
|
|
14
|
+
.catch((error) => {
|
|
15
|
+
this.logService.warn('failed to migrate config setting value.', error);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async migrateConfig() {
|
|
19
|
+
const value = await this.configService.getValue(CONFIG_KEY);
|
|
11
20
|
if ((value === undefined) || (value === null)) {
|
|
12
21
|
return;
|
|
13
22
|
}
|
|
@@ -26,8 +35,8 @@ let ConfigMigration = class ConfigMigration {
|
|
|
26
35
|
}
|
|
27
36
|
locationsValue[trimmedValue] = true;
|
|
28
37
|
}
|
|
29
|
-
configService.updateValue(CONFIG_KEY, true);
|
|
30
|
-
configService.updateValue(PROMPT_LOCATIONS_CONFIG_KEY, locationsValue);
|
|
38
|
+
await this.configService.updateValue(CONFIG_KEY, true);
|
|
39
|
+
await this.configService.updateValue(PROMPT_LOCATIONS_CONFIG_KEY, locationsValue);
|
|
31
40
|
return;
|
|
32
41
|
}
|
|
33
42
|
if (typeof value === 'object') {
|
|
@@ -43,20 +52,21 @@ let ConfigMigration = class ConfigMigration {
|
|
|
43
52
|
}
|
|
44
53
|
locationsValue[trimmedValue] = enabled;
|
|
45
54
|
}
|
|
46
|
-
configService.updateValue(CONFIG_KEY, true);
|
|
47
|
-
configService.updateValue(PROMPT_LOCATIONS_CONFIG_KEY, locationsValue);
|
|
55
|
+
await this.configService.updateValue(CONFIG_KEY, true);
|
|
56
|
+
await this.configService.updateValue(PROMPT_LOCATIONS_CONFIG_KEY, locationsValue);
|
|
48
57
|
return;
|
|
49
58
|
}
|
|
50
59
|
if (typeof value === 'string') {
|
|
51
60
|
assert(asBoolean(value) === undefined, `String value must not be a boolean, got '${value}'.`);
|
|
52
|
-
configService.updateValue(CONFIG_KEY, true);
|
|
53
|
-
configService.updateValue(PROMPT_LOCATIONS_CONFIG_KEY, { [value]: true });
|
|
61
|
+
await this.configService.updateValue(CONFIG_KEY, true);
|
|
62
|
+
await this.configService.updateValue(PROMPT_LOCATIONS_CONFIG_KEY, { [value]: true });
|
|
54
63
|
return;
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
66
|
};
|
|
58
67
|
ConfigMigration = ( __decorate([
|
|
59
|
-
( __param(0,
|
|
68
|
+
( __param(0, ILogService)),
|
|
69
|
+
( __param(1, IConfigurationService))
|
|
60
70
|
], ConfigMigration));
|
|
61
71
|
|
|
62
72
|
export { ConfigMigration };
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
import { ConfigMigration } from './configMigration.js';
|
|
3
|
-
import './languageFeatures/index.js';
|
|
3
|
+
import { LANGUAGE_FEATURE_CONTRIBUTIONS } from './languageFeatures/index.js';
|
|
4
4
|
import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
|
|
5
5
|
import { LifecyclePhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
6
6
|
import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
7
7
|
|
|
8
8
|
const registerPromptFileContributions = () => {
|
|
9
|
+
registerContributions(LANGUAGE_FEATURE_CONTRIBUTIONS);
|
|
9
10
|
registerContribution(ConfigMigration);
|
|
10
11
|
};
|
|
11
12
|
const registerContribution = (contribution) => {
|
|
12
13
|
( Registry.as(Extensions.Workbench))
|
|
13
14
|
.registerWorkbenchContribution(contribution, LifecyclePhase.Eventually);
|
|
14
15
|
};
|
|
16
|
+
const registerContributions = (contributions) => {
|
|
17
|
+
contributions
|
|
18
|
+
.forEach(registerContribution);
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
export { registerPromptFileContributions };
|
|
@@ -4,14 +4,15 @@ import { isWindows } from '@codingame/monaco-vscode-api/vscode/vs/base/common/pl
|
|
|
4
4
|
import { PromptPathAutocompletion } from './providers/promptPathAutocompletion.js';
|
|
5
5
|
import { PromptLinkDiagnosticsInstanceManager } from './providers/promptLinkDiagnosticsProvider.js';
|
|
6
6
|
import { PromptHeaderDiagnosticsInstanceManager } from './providers/promptHeaderDiagnosticsProvider.js';
|
|
7
|
-
import { PromptDecorationsProviderInstanceManager } from './providers/decorationsProvider/promptDecorationsProvider.js';
|
|
8
7
|
|
|
9
8
|
const CONTRIBUTIONS = [
|
|
10
9
|
PromptLinkProvider,
|
|
11
10
|
PromptLinkDiagnosticsInstanceManager,
|
|
12
11
|
PromptHeaderDiagnosticsInstanceManager,
|
|
13
|
-
PromptDecorationsProviderInstanceManager,
|
|
14
12
|
];
|
|
15
13
|
if (isWindows === false) {
|
|
16
14
|
CONTRIBUTIONS.push(PromptPathAutocompletion);
|
|
17
15
|
}
|
|
16
|
+
const LANGUAGE_FEATURE_CONTRIBUTIONS = ( Object.freeze(CONTRIBUTIONS));
|
|
17
|
+
|
|
18
|
+
export { LANGUAGE_FEATURE_CONTRIBUTIONS };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/types.service";
|
|
2
2
|
import { ProviderInstanceBase } from "./providerInstanceBase.js";
|
|
3
3
|
import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
4
|
-
import {
|
|
4
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
5
|
+
import { ProviderInstanceManagerBase, TProviderClass } from "./providerInstanceManagerBase.js";
|
|
5
6
|
import { IMarkerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service";
|
|
6
7
|
declare class PromptHeaderDiagnosticsProvider extends ProviderInstanceBase {
|
|
7
8
|
private readonly markerService;
|
|
8
9
|
constructor(model: ITextModel, promptsService: IPromptsService, markerService: IMarkerService);
|
|
9
|
-
protected onPromptSettled():
|
|
10
|
+
protected onPromptSettled(_error: Error | undefined, token: CancellationToken): this;
|
|
10
11
|
toString(): string;
|
|
11
12
|
}
|
|
12
13
|
export declare class PromptHeaderDiagnosticsInstanceManager extends ProviderInstanceManagerBase<PromptHeaderDiagnosticsProvider> {
|
|
13
|
-
protected get InstanceClass():
|
|
14
|
+
protected get InstanceClass(): TProviderClass<PromptHeaderDiagnosticsProvider>;
|
|
14
15
|
}
|
|
15
16
|
export {};
|
|
@@ -14,22 +14,26 @@ let PromptHeaderDiagnosticsProvider = class PromptHeaderDiagnosticsProvider exte
|
|
|
14
14
|
super(model, promptsService);
|
|
15
15
|
this.markerService = markerService;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
await this.parser.allSettled();
|
|
17
|
+
onPromptSettled(_error, token) {
|
|
19
18
|
this.markerService.remove(MARKERS_OWNER_ID, [this.model.uri]);
|
|
20
19
|
const { header } = this.parser;
|
|
21
20
|
if (header === undefined) {
|
|
22
21
|
return this;
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
header.settled.then(() => {
|
|
24
|
+
if (token.isCancellationRequested) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const markers = [];
|
|
28
|
+
for (const diagnostic of header.diagnostics) {
|
|
29
|
+
markers.push(toMarker(diagnostic));
|
|
30
|
+
}
|
|
31
|
+
this.markerService.changeOne(MARKERS_OWNER_ID, this.model.uri, markers);
|
|
32
|
+
});
|
|
29
33
|
return this;
|
|
30
34
|
}
|
|
31
35
|
toString() {
|
|
32
|
-
return `prompt-
|
|
36
|
+
return `prompt-header-diagnostics:${this.model.uri.path}`;
|
|
33
37
|
}
|
|
34
38
|
};
|
|
35
39
|
PromptHeaderDiagnosticsProvider = ( __decorate([
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/types.service";
|
|
2
2
|
import { ProviderInstanceBase } from "./providerInstanceBase.js";
|
|
3
3
|
import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
4
|
-
import { ProviderInstanceManagerBase } from "./providerInstanceManagerBase.js";
|
|
4
|
+
import { ProviderInstanceManagerBase, TProviderClass } from "./providerInstanceManagerBase.js";
|
|
5
5
|
import { IMarkerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service";
|
|
6
6
|
declare class PromptLinkDiagnosticsProvider extends ProviderInstanceBase {
|
|
7
7
|
private readonly markerService;
|
|
8
8
|
constructor(model: ITextModel, promptsService: IPromptsService, markerService: IMarkerService);
|
|
9
|
-
protected onPromptSettled():
|
|
9
|
+
protected onPromptSettled(): this;
|
|
10
10
|
toString(): string;
|
|
11
11
|
}
|
|
12
12
|
export declare class PromptLinkDiagnosticsInstanceManager extends ProviderInstanceManagerBase<PromptLinkDiagnosticsProvider> {
|
|
13
|
-
protected get InstanceClass():
|
|
13
|
+
protected get InstanceClass(): TProviderClass<PromptLinkDiagnosticsProvider>;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -15,8 +15,7 @@ let PromptLinkDiagnosticsProvider = class PromptLinkDiagnosticsProvider extends
|
|
|
15
15
|
super(model, promptsService);
|
|
16
16
|
this.markerService = markerService;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
await this.parser.allSettled();
|
|
18
|
+
onPromptSettled() {
|
|
20
19
|
this.markerService.remove(MARKERS_OWNER_ID, [this.model.uri]);
|
|
21
20
|
const markers = [];
|
|
22
21
|
for (const link of this.parser.references) {
|
|
@@ -5,7 +5,7 @@ import { assert } from '@codingame/monaco-vscode-api/vscode/vs/base/common/asser
|
|
|
5
5
|
import { assertDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
6
6
|
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
7
|
import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
8
|
-
import {
|
|
8
|
+
import { ALL_PROMPTS_LANGUAGE_SELECTOR } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/constants';
|
|
9
9
|
import { FolderReference, NotPromptFile } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/promptFileReferenceErrors';
|
|
10
10
|
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
|
|
11
11
|
|
|
@@ -14,12 +14,12 @@ let PromptLinkProvider = class PromptLinkProvider extends Disposable {
|
|
|
14
14
|
super();
|
|
15
15
|
this.promptsService = promptsService;
|
|
16
16
|
this.languageService = languageService;
|
|
17
|
-
this._register(this.languageService.linkProvider.register(
|
|
17
|
+
this._register(this.languageService.linkProvider.register(ALL_PROMPTS_LANGUAGE_SELECTOR, this));
|
|
18
18
|
}
|
|
19
19
|
async provideLinks(model, token) {
|
|
20
20
|
assert(!token.isCancellationRequested, ( new CancellationError()));
|
|
21
21
|
const parser = this.promptsService.getSyntaxParserFor(model);
|
|
22
|
-
assert(
|
|
22
|
+
assert(parser.isDisposed === false, 'Prompt parser must not be disposed.');
|
|
23
23
|
const { references } = await parser
|
|
24
24
|
.start()
|
|
25
25
|
.settled();
|