@codingame/monaco-vscode-chat-service-override 22.1.9 → 23.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 +17 -8
- package/package.json +43 -40
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +57 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +26 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +51 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/{chatClearActions.d.ts → chatNewActions.d.ts} +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/{chatClearActions.js → chatNewActions.js} +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.d.ts +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.js +101 -98
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +35 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +43 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +34 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.js +154 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.js +347 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +85 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +250 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsview.css +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +97 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +290 -231
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +7 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.js +113 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimeline.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.d.ts +102 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.js +646 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +46 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +17 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +44 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +25 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +46 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +45 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +30 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +60 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.d.ts +117 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.js +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +60 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +29 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +365 -143
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +3 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +7 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +58 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +6 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.js +7 -11
- 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 +13 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +38 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +11 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +83 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +91 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +64 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +370 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +349 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +787 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +109 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatManagementEditor.css +122 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +211 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatUsageWidget.css +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +21 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +54 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +31 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +16 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.d.ts +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.js +29 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.js +37 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.d.ts +15 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.js +96 -131
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.d.ts +12 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.js +66 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.js +77 -71
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.d.ts +91 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.js +458 -138
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +212 -150
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +96 -89
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +15 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +33 -17
- 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 +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.js +688 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +15 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +126 -135
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditorController.css +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSessions.css +38 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/simpleBrowserOverlay.css +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +28 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.js +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +24 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +15 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +25 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +89 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +30 -29
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +10 -19
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +61 -43
- package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +7 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +28 -28
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +254 -165
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +4 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.d.ts +10 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.js +20 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +13 -17
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +9 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.js +51 -21
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.d.ts +7 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +74 -20
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptDocumentSemanticTokensProvider.js +11 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +83 -53
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +136 -78
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +18 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +357 -157
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileContributions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +55 -28
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +235 -108
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +12 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +50 -4
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +27 -27
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js +11 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +13 -15
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +20 -32
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +63 -140
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +17 -16
- 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/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js +3 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +119 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.js +6 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +192 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +21 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.js +8 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +18 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +4 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +18 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +31 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +24 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +33 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +42 -13
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +14 -21
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +227 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +133 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +36 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.js +33 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +75 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +71 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +28 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +366 -363
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +18 -18
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +9 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +123 -0
- package/vscode/src/vs/base/common/yaml.d.ts +0 -74
- package/vscode/src/vs/base/common/yaml.js +0 -597
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +0 -239
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.d.ts +0 -102
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.js +0 -435
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.d.ts +0 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.js +0 -67
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +0 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +0 -380
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.d.ts +0 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.js +0 -137
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +0 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +0 -176
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +0 -206
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +0 -79
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +0 -145
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +0 -306
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.js +0 -102
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/newPromptsParser.d.ts +0 -97
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/newPromptsParser.js +0 -247
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +0 -118
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +0 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandSimplifier.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandSimplifier.js +0 -55
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.js +0 -66
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { splitGlobAware, parse, isEmptyPattern } from '@codingame/monaco-vscode-api/vscode/vs/base/common/glob';
|
|
4
4
|
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
5
|
+
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
5
6
|
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
6
7
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
7
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
8
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
9
9
|
import { MarkerSeverity } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers';
|
|
10
10
|
import { IMarkerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service';
|
|
@@ -13,30 +13,53 @@ import { ChatModeKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/c
|
|
|
13
13
|
import { ILanguageModelChatMetadata } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
14
14
|
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
15
15
|
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
|
|
16
|
-
import { PromptsType, getPromptsTypeForLanguageId } from '@codingame/monaco-vscode-
|
|
17
|
-
import {
|
|
16
|
+
import { PromptsType, getPromptsTypeForLanguageId } from '@codingame/monaco-vscode-8d4ef243-d8c1-540d-9f11-38df46f54c9f-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
17
|
+
import { PromptHeaderAttributes, PROMPT_NAME_REGEXP, Target, GithubPromptHeaderAttributes } from '@codingame/monaco-vscode-8d4ef243-d8c1-540d-9f11-38df46f54c9f-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';
|
|
18
18
|
import { Disposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
19
19
|
import { Delayer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
20
20
|
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
21
21
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
22
22
|
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
|
|
23
23
|
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
24
|
+
import { LEGACY_MODE_FILE_EXTENSION, AGENTS_SOURCE_FOLDER } from '@codingame/monaco-vscode-8d4ef243-d8c1-540d-9f11-38df46f54c9f-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
|
|
25
|
+
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
24
26
|
|
|
25
27
|
const MARKERS_OWNER_ID = 'prompts-diagnostics-provider';
|
|
26
28
|
let PromptValidator = class PromptValidator {
|
|
27
|
-
constructor(languageModelsService, languageModelToolsService, chatModeService, fileService, labelService) {
|
|
29
|
+
constructor(languageModelsService, languageModelToolsService, chatModeService, fileService, labelService, promptsService) {
|
|
28
30
|
this.languageModelsService = languageModelsService;
|
|
29
31
|
this.languageModelToolsService = languageModelToolsService;
|
|
30
32
|
this.chatModeService = chatModeService;
|
|
31
33
|
this.fileService = fileService;
|
|
32
34
|
this.labelService = labelService;
|
|
35
|
+
this.promptsService = promptsService;
|
|
33
36
|
}
|
|
34
37
|
async validate(promptAST, promptType, report) {
|
|
35
38
|
promptAST.header?.errors.forEach(error => report(toMarker(error.message, error.range, MarkerSeverity.Error)));
|
|
36
39
|
this.validateHeader(promptAST, promptType, report);
|
|
37
|
-
await this.validateBody(promptAST, report);
|
|
40
|
+
await this.validateBody(promptAST, promptType, report);
|
|
41
|
+
await this.validateFileName(promptAST, promptType, report);
|
|
38
42
|
}
|
|
39
|
-
async
|
|
43
|
+
async validateFileName(promptAST, promptType, report) {
|
|
44
|
+
if (promptType === PromptsType.agent && promptAST.uri.path.endsWith(LEGACY_MODE_FILE_EXTENSION)) {
|
|
45
|
+
const location = this.promptsService.getAgentFileURIFromModeFile(promptAST.uri);
|
|
46
|
+
if (location && (await this.fileService.canCreateFile(location))) {
|
|
47
|
+
report(toMarker(( localize(
|
|
48
|
+
5871,
|
|
49
|
+
"Chat modes have been renamed to agents. Please move this file to {0}",
|
|
50
|
+
(location.toString())
|
|
51
|
+
)), ( new Range(1, 1, 1, 4)), MarkerSeverity.Warning));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
report(toMarker(( localize(
|
|
55
|
+
5872,
|
|
56
|
+
"Chat modes have been renamed to agents. Please move the file to {0}",
|
|
57
|
+
AGENTS_SOURCE_FOLDER
|
|
58
|
+
)), ( new Range(1, 1, 1, 4)), MarkerSeverity.Warning));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async validateBody(promptAST, promptType, report) {
|
|
40
63
|
const body = promptAST.body;
|
|
41
64
|
if (!body) {
|
|
42
65
|
return;
|
|
@@ -45,25 +68,29 @@ let PromptValidator = class PromptValidator {
|
|
|
45
68
|
for (const ref of body.fileReferences) {
|
|
46
69
|
const resolved = body.resolveFilePath(ref.content);
|
|
47
70
|
if (!resolved) {
|
|
48
|
-
report(toMarker(( localize(
|
|
71
|
+
report(toMarker(( localize(5873, "Invalid file reference '{0}'.", ref.content)), ref.range, MarkerSeverity.Warning));
|
|
49
72
|
continue;
|
|
50
73
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
if (promptAST.uri.scheme === resolved.scheme) {
|
|
75
|
+
fileReferenceChecks.push((async () => {
|
|
76
|
+
try {
|
|
77
|
+
const exists = await this.fileService.exists(resolved);
|
|
78
|
+
if (exists) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
56
81
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
82
|
+
catch {
|
|
83
|
+
}
|
|
84
|
+
const loc = this.labelService.getUriLabel(resolved);
|
|
85
|
+
report(toMarker(( localize(5874, "File '{0}' not found at '{1}'.", ref.content, loc)), ref.range, MarkerSeverity.Warning));
|
|
86
|
+
})());
|
|
87
|
+
}
|
|
63
88
|
}
|
|
64
|
-
|
|
89
|
+
const isGitHubTarget = isGithubTarget(promptType, promptAST.header?.target);
|
|
90
|
+
if (body.variableReferences.length && !isGitHubTarget) {
|
|
65
91
|
const headerTools = promptAST.header?.tools;
|
|
66
|
-
const
|
|
92
|
+
const headerTarget = promptAST.header?.target;
|
|
93
|
+
const headerToolsMap = headerTools ? this.languageModelToolsService.toToolAndToolSetEnablementMap(headerTools, headerTarget) : undefined;
|
|
67
94
|
const available = ( new Set(this.languageModelToolsService.getQualifiedToolNames()));
|
|
68
95
|
const deprecatedNames = this.languageModelToolsService.getDeprecatedQualifiedToolNames();
|
|
69
96
|
for (const variable of body.variableReferences) {
|
|
@@ -71,21 +98,21 @@ let PromptValidator = class PromptValidator {
|
|
|
71
98
|
if (( deprecatedNames.has(variable.name))) {
|
|
72
99
|
const currentName = deprecatedNames.get(variable.name);
|
|
73
100
|
report(toMarker(( localize(
|
|
74
|
-
|
|
101
|
+
5875,
|
|
75
102
|
"Tool or toolset '{0}' has been renamed, use '{1}' instead.",
|
|
76
103
|
variable.name,
|
|
77
104
|
currentName
|
|
78
105
|
)), variable.range, MarkerSeverity.Info));
|
|
79
106
|
}
|
|
80
107
|
else {
|
|
81
|
-
report(toMarker(( localize(
|
|
108
|
+
report(toMarker(( localize(5876, "Unknown tool or toolset '{0}'.", variable.name)), variable.range, MarkerSeverity.Warning));
|
|
82
109
|
}
|
|
83
110
|
}
|
|
84
111
|
else if (headerToolsMap) {
|
|
85
112
|
const tool = this.languageModelToolsService.getToolByQualifiedName(variable.name);
|
|
86
113
|
if (tool && headerToolsMap.get(tool) === false) {
|
|
87
114
|
report(toMarker(( localize(
|
|
88
|
-
|
|
115
|
+
5877,
|
|
89
116
|
"Tool or toolset '{0}' also needs to be enabled in the header.",
|
|
90
117
|
variable.name
|
|
91
118
|
)), variable.range, MarkerSeverity.Warning));
|
|
@@ -100,83 +127,150 @@ let PromptValidator = class PromptValidator {
|
|
|
100
127
|
if (!header) {
|
|
101
128
|
return;
|
|
102
129
|
}
|
|
103
|
-
const validAttributeNames = getValidAttributeNames(promptType, true);
|
|
104
130
|
const attributes = header.attributes;
|
|
131
|
+
const isGitHubTarget = isGithubTarget(promptType, header.target);
|
|
132
|
+
this.checkForInvalidArguments(attributes, promptType, isGitHubTarget, report);
|
|
133
|
+
this.validateName(attributes, isGitHubTarget, report);
|
|
134
|
+
this.validateDescription(attributes, report);
|
|
135
|
+
this.validateArgumentHint(attributes, report);
|
|
136
|
+
switch (promptType) {
|
|
137
|
+
case PromptsType.prompt: {
|
|
138
|
+
const agent = this.validateAgent(attributes, report);
|
|
139
|
+
this.validateTools(attributes, agent?.kind ?? ChatModeKind.Agent, header.target, report);
|
|
140
|
+
this.validateModel(attributes, agent?.kind ?? ChatModeKind.Agent, report);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case PromptsType.instructions:
|
|
144
|
+
this.validateApplyTo(attributes, report);
|
|
145
|
+
this.validateExcludeAgent(attributes, report);
|
|
146
|
+
break;
|
|
147
|
+
case PromptsType.agent: {
|
|
148
|
+
this.validateTarget(attributes, report);
|
|
149
|
+
this.validateTools(attributes, ChatModeKind.Agent, header.target, report);
|
|
150
|
+
if (!isGitHubTarget) {
|
|
151
|
+
this.validateModel(attributes, ChatModeKind.Agent, report);
|
|
152
|
+
this.validateHandoffs(attributes, report);
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
checkForInvalidArguments(attributes, promptType, isGitHubTarget, report) {
|
|
159
|
+
const validAttributeNames = getValidAttributeNames(promptType, true, isGitHubTarget);
|
|
160
|
+
const validGithubCopilotAttributeNames = ( new Lazy(() => ( new Set(getValidAttributeNames(promptType, false, true)))));
|
|
105
161
|
for (const attribute of attributes) {
|
|
106
162
|
if (!validAttributeNames.includes(attribute.key)) {
|
|
107
|
-
const supportedNames =
|
|
163
|
+
const supportedNames = ( new Lazy(
|
|
164
|
+
() => getValidAttributeNames(promptType, false, isGitHubTarget).sort().join(', ')
|
|
165
|
+
));
|
|
108
166
|
switch (promptType) {
|
|
109
167
|
case PromptsType.prompt:
|
|
110
168
|
report(toMarker(( localize(
|
|
111
|
-
|
|
169
|
+
5878,
|
|
112
170
|
"Attribute '{0}' is not supported in prompt files. Supported: {1}.",
|
|
113
171
|
attribute.key,
|
|
114
|
-
supportedNames
|
|
172
|
+
supportedNames.value
|
|
115
173
|
)), attribute.range, MarkerSeverity.Warning));
|
|
116
174
|
break;
|
|
117
|
-
case PromptsType.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
175
|
+
case PromptsType.agent:
|
|
176
|
+
if (isGitHubTarget) {
|
|
177
|
+
report(toMarker(( localize(
|
|
178
|
+
5879,
|
|
179
|
+
"Attribute '{0}' is not supported in custom GitHub Copilot agent files. Supported: {1}.",
|
|
180
|
+
attribute.key,
|
|
181
|
+
supportedNames.value
|
|
182
|
+
)), attribute.range, MarkerSeverity.Warning));
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
if (( validGithubCopilotAttributeNames.value.has(attribute.key))) {
|
|
186
|
+
report(toMarker(( localize(
|
|
187
|
+
5880,
|
|
188
|
+
"Attribute '{0}' is ignored when running locally in VS Code.",
|
|
189
|
+
attribute.key
|
|
190
|
+
)), attribute.range, MarkerSeverity.Info));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
report(toMarker(( localize(
|
|
194
|
+
5881,
|
|
195
|
+
"Attribute '{0}' is not supported in VS Code agent files. Supported: {1}.",
|
|
196
|
+
attribute.key,
|
|
197
|
+
supportedNames.value
|
|
198
|
+
)), attribute.range, MarkerSeverity.Warning));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
124
201
|
break;
|
|
125
202
|
case PromptsType.instructions:
|
|
126
203
|
report(toMarker(( localize(
|
|
127
|
-
|
|
204
|
+
5882,
|
|
128
205
|
"Attribute '{0}' is not supported in instructions files. Supported: {1}.",
|
|
129
206
|
attribute.key,
|
|
130
|
-
supportedNames
|
|
207
|
+
supportedNames.value
|
|
131
208
|
)), attribute.range, MarkerSeverity.Warning));
|
|
132
209
|
break;
|
|
133
210
|
}
|
|
134
211
|
}
|
|
135
212
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
213
|
+
}
|
|
214
|
+
validateName(attributes, isGitHubTarget, report) {
|
|
215
|
+
const nameAttribute = attributes.find(attr => attr.key === PromptHeaderAttributes.name);
|
|
216
|
+
if (!nameAttribute) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (nameAttribute.value.type !== 'string') {
|
|
220
|
+
report(toMarker(( localize(5883, "The 'name' attribute must be a string.")), nameAttribute.range, MarkerSeverity.Error));
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (nameAttribute.value.value.trim().length === 0) {
|
|
224
|
+
report(toMarker(( localize(5884, "The 'name' attribute must not be empty.")), nameAttribute.value.range, MarkerSeverity.Error));
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (!PROMPT_NAME_REGEXP.test(nameAttribute.value.value)) {
|
|
228
|
+
report(toMarker(( localize(
|
|
229
|
+
5885,
|
|
230
|
+
"The 'name' attribute can only consist of letters, digits, underscores, hyphens, and periods."
|
|
231
|
+
)), nameAttribute.value.range, MarkerSeverity.Error));
|
|
152
232
|
}
|
|
153
233
|
}
|
|
154
234
|
validateDescription(attributes, report) {
|
|
155
|
-
const descriptionAttribute = attributes.find(attr => attr.key ===
|
|
235
|
+
const descriptionAttribute = attributes.find(attr => attr.key === PromptHeaderAttributes.description);
|
|
156
236
|
if (!descriptionAttribute) {
|
|
157
237
|
return;
|
|
158
238
|
}
|
|
159
239
|
if (descriptionAttribute.value.type !== 'string') {
|
|
160
|
-
report(toMarker(( localize(
|
|
240
|
+
report(toMarker(( localize(5886, "The 'description' attribute must be a string.")), descriptionAttribute.range, MarkerSeverity.Error));
|
|
161
241
|
return;
|
|
162
242
|
}
|
|
163
243
|
if (descriptionAttribute.value.value.trim().length === 0) {
|
|
164
|
-
report(toMarker(( localize(
|
|
244
|
+
report(toMarker(( localize(5887, "The 'description' attribute should not be empty.")), descriptionAttribute.value.range, MarkerSeverity.Error));
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
validateArgumentHint(attributes, report) {
|
|
249
|
+
const argumentHintAttribute = attributes.find(attr => attr.key === PromptHeaderAttributes.argumentHint);
|
|
250
|
+
if (!argumentHintAttribute) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (argumentHintAttribute.value.type !== 'string') {
|
|
254
|
+
report(toMarker(( localize(5888, "The 'argument-hint' attribute must be a string.")), argumentHintAttribute.range, MarkerSeverity.Error));
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (argumentHintAttribute.value.value.trim().length === 0) {
|
|
258
|
+
report(toMarker(( localize(5889, "The 'argument-hint' attribute should not be empty.")), argumentHintAttribute.value.range, MarkerSeverity.Error));
|
|
165
259
|
return;
|
|
166
260
|
}
|
|
167
261
|
}
|
|
168
|
-
validateModel(attributes,
|
|
169
|
-
const attribute = attributes.find(attr => attr.key ===
|
|
262
|
+
validateModel(attributes, agentKind, report) {
|
|
263
|
+
const attribute = attributes.find(attr => attr.key === PromptHeaderAttributes.model);
|
|
170
264
|
if (!attribute) {
|
|
171
265
|
return;
|
|
172
266
|
}
|
|
173
267
|
if (attribute.value.type !== 'string') {
|
|
174
|
-
report(toMarker(( localize(
|
|
268
|
+
report(toMarker(( localize(5890, "The 'model' attribute must be a string.")), attribute.value.range, MarkerSeverity.Error));
|
|
175
269
|
return;
|
|
176
270
|
}
|
|
177
271
|
const modelName = attribute.value.value.trim();
|
|
178
272
|
if (modelName.length === 0) {
|
|
179
|
-
report(toMarker(( localize(
|
|
273
|
+
report(toMarker(( localize(5891, "The 'model' attribute must be a non-empty string.")), attribute.value.range, MarkerSeverity.Error));
|
|
180
274
|
return;
|
|
181
275
|
}
|
|
182
276
|
const languageModes = this.languageModelsService.getLanguageModelIds();
|
|
@@ -185,10 +279,10 @@ let PromptValidator = class PromptValidator {
|
|
|
185
279
|
}
|
|
186
280
|
const modelMetadata = this.findModelByName(languageModes, modelName);
|
|
187
281
|
if (!modelMetadata) {
|
|
188
|
-
report(toMarker(( localize(
|
|
282
|
+
report(toMarker(( localize(5892, "Unknown model '{0}'.", modelName)), attribute.value.range, MarkerSeverity.Warning));
|
|
189
283
|
}
|
|
190
|
-
else if (
|
|
191
|
-
report(toMarker(( localize(
|
|
284
|
+
else if (agentKind === ChatModeKind.Agent && !ILanguageModelChatMetadata.suitableForAgentMode(modelMetadata)) {
|
|
285
|
+
report(toMarker(( localize(5893, "Model '{0}' is not suited for agent mode.", modelName)), attribute.value.range, MarkerSeverity.Warning));
|
|
192
286
|
}
|
|
193
287
|
}
|
|
194
288
|
findModelByName(languageModes, modelName) {
|
|
@@ -200,118 +294,227 @@ let PromptValidator = class PromptValidator {
|
|
|
200
294
|
}
|
|
201
295
|
return undefined;
|
|
202
296
|
}
|
|
203
|
-
|
|
204
|
-
const
|
|
297
|
+
validateAgent(attributes, report) {
|
|
298
|
+
const agentAttribute = attributes.find(attr => attr.key === PromptHeaderAttributes.agent);
|
|
299
|
+
const modeAttribute = attributes.find(attr => attr.key === PromptHeaderAttributes.mode);
|
|
300
|
+
if (modeAttribute) {
|
|
301
|
+
if (agentAttribute) {
|
|
302
|
+
report(toMarker(( localize(
|
|
303
|
+
5894,
|
|
304
|
+
"The 'mode' attribute has been deprecated. The 'agent' attribute is used instead."
|
|
305
|
+
)), modeAttribute.range, MarkerSeverity.Warning));
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
report(toMarker(( localize(
|
|
309
|
+
5895,
|
|
310
|
+
"The 'mode' attribute has been deprecated. Please rename it to 'agent'."
|
|
311
|
+
)), modeAttribute.range, MarkerSeverity.Error));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const attribute = attributes.find(attr => attr.key === PromptHeaderAttributes.agent) ?? modeAttribute;
|
|
205
315
|
if (!attribute) {
|
|
206
316
|
return undefined;
|
|
207
317
|
}
|
|
208
318
|
if (attribute.value.type !== 'string') {
|
|
209
|
-
report(toMarker(( localize(
|
|
319
|
+
report(toMarker(( localize(5896, "The '{0}' attribute must be a string.", attribute.key)), attribute.value.range, MarkerSeverity.Error));
|
|
210
320
|
return undefined;
|
|
211
321
|
}
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
214
|
-
report(toMarker(( localize(
|
|
322
|
+
const agentValue = attribute.value.value;
|
|
323
|
+
if (agentValue.trim().length === 0) {
|
|
324
|
+
report(toMarker(( localize(5897, "The '{0}' attribute must be a non-empty string.", attribute.key)), attribute.value.range, MarkerSeverity.Error));
|
|
215
325
|
return undefined;
|
|
216
326
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
327
|
+
return this.validateAgentValue(attribute.value, report);
|
|
328
|
+
}
|
|
329
|
+
validateAgentValue(value, report) {
|
|
330
|
+
const agents = this.chatModeService.getModes();
|
|
331
|
+
const availableAgents = [];
|
|
332
|
+
for (const agent of Iterable.concat(agents.builtin, agents.custom)) {
|
|
333
|
+
if (agent.name.get() === value.value) {
|
|
334
|
+
return agent;
|
|
222
335
|
}
|
|
223
|
-
|
|
336
|
+
availableAgents.push(agent.name.get());
|
|
224
337
|
}
|
|
225
338
|
const errorMessage = ( localize(
|
|
226
|
-
|
|
227
|
-
"Unknown
|
|
228
|
-
|
|
229
|
-
|
|
339
|
+
5898,
|
|
340
|
+
"Unknown agent '{0}'. Available agents: {1}.",
|
|
341
|
+
value.value,
|
|
342
|
+
availableAgents.join(', ')
|
|
230
343
|
));
|
|
231
|
-
report(toMarker(errorMessage,
|
|
344
|
+
report(toMarker(errorMessage, value.range, MarkerSeverity.Warning));
|
|
232
345
|
return undefined;
|
|
233
346
|
}
|
|
234
|
-
validateTools(attributes,
|
|
235
|
-
const attribute = attributes.find(attr => attr.key ===
|
|
347
|
+
validateTools(attributes, agentKind, target, report) {
|
|
348
|
+
const attribute = attributes.find(attr => attr.key === PromptHeaderAttributes.tools);
|
|
236
349
|
if (!attribute) {
|
|
237
350
|
return;
|
|
238
351
|
}
|
|
239
|
-
if (
|
|
352
|
+
if (agentKind !== ChatModeKind.Agent) {
|
|
240
353
|
report(toMarker(( localize(
|
|
241
|
-
|
|
242
|
-
"The 'tools' attribute is only supported
|
|
354
|
+
5899,
|
|
355
|
+
"The 'tools' attribute is only supported when using agents. Attribute will be ignored."
|
|
243
356
|
)), attribute.range, MarkerSeverity.Warning));
|
|
244
357
|
}
|
|
245
358
|
switch (attribute.value.type) {
|
|
246
359
|
case 'array':
|
|
247
|
-
|
|
360
|
+
if (target === Target.GitHubCopilot) ;
|
|
361
|
+
else {
|
|
362
|
+
this.validateVSCodeTools(attribute.value, target, report);
|
|
363
|
+
}
|
|
248
364
|
break;
|
|
249
365
|
default:
|
|
250
|
-
report(toMarker(( localize(
|
|
366
|
+
report(toMarker(( localize(5900, "The 'tools' attribute must be an array.")), attribute.value.range, MarkerSeverity.Error));
|
|
251
367
|
}
|
|
252
368
|
}
|
|
253
|
-
|
|
369
|
+
validateVSCodeTools(valueItem, target, report) {
|
|
254
370
|
if (valueItem.items.length > 0) {
|
|
255
371
|
const available = ( new Set(this.languageModelToolsService.getQualifiedToolNames()));
|
|
256
372
|
const deprecatedNames = this.languageModelToolsService.getDeprecatedQualifiedToolNames();
|
|
257
373
|
for (const item of valueItem.items) {
|
|
258
374
|
if (item.type !== 'string') {
|
|
259
|
-
report(toMarker(( localize(
|
|
375
|
+
report(toMarker(( localize(5901, "Each tool name in the 'tools' attribute must be a string.")), item.range, MarkerSeverity.Error));
|
|
260
376
|
}
|
|
261
|
-
else if (item.value
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
377
|
+
else if (item.value) {
|
|
378
|
+
const toolName = target === undefined ? this.languageModelToolsService.mapGithubToolName(item.value) : item.value;
|
|
379
|
+
if (!( available.has(toolName))) {
|
|
380
|
+
if (( deprecatedNames.has(toolName))) {
|
|
381
|
+
const currentName = deprecatedNames.get(toolName);
|
|
382
|
+
report(toMarker(( localize(
|
|
383
|
+
5902,
|
|
384
|
+
"Tool or toolset '{0}' has been renamed, use '{1}' instead.",
|
|
385
|
+
toolName,
|
|
386
|
+
currentName
|
|
387
|
+
)), item.range, MarkerSeverity.Info));
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
report(toMarker(( localize(5903, "Unknown tool '{0}'.", toolName)), item.range, MarkerSeverity.Warning));
|
|
391
|
+
}
|
|
273
392
|
}
|
|
274
393
|
}
|
|
275
394
|
}
|
|
276
395
|
}
|
|
277
396
|
}
|
|
278
397
|
validateApplyTo(attributes, report) {
|
|
279
|
-
const attribute = attributes.find(attr => attr.key ===
|
|
398
|
+
const attribute = attributes.find(attr => attr.key === PromptHeaderAttributes.applyTo);
|
|
280
399
|
if (!attribute) {
|
|
281
400
|
return;
|
|
282
401
|
}
|
|
283
402
|
if (attribute.value.type !== 'string') {
|
|
284
|
-
report(toMarker(( localize(
|
|
403
|
+
report(toMarker(( localize(5904, "The 'applyTo' attribute must be a string.")), attribute.value.range, MarkerSeverity.Error));
|
|
285
404
|
return;
|
|
286
405
|
}
|
|
287
406
|
const pattern = attribute.value.value;
|
|
288
407
|
try {
|
|
289
408
|
const patterns = splitGlobAware(pattern, ',');
|
|
290
409
|
if (patterns.length === 0) {
|
|
291
|
-
report(toMarker(( localize(
|
|
410
|
+
report(toMarker(( localize(5905, "The 'applyTo' attribute must be a valid glob pattern.")), attribute.value.range, MarkerSeverity.Error));
|
|
292
411
|
return;
|
|
293
412
|
}
|
|
294
413
|
for (const pattern of patterns) {
|
|
295
414
|
const globPattern = parse(pattern);
|
|
296
415
|
if (isEmptyPattern(globPattern)) {
|
|
297
|
-
report(toMarker(( localize(
|
|
416
|
+
report(toMarker(( localize(5905, "The 'applyTo' attribute must be a valid glob pattern.")), attribute.value.range, MarkerSeverity.Error));
|
|
298
417
|
return;
|
|
299
418
|
}
|
|
300
419
|
}
|
|
301
420
|
}
|
|
302
421
|
catch (_error) {
|
|
303
|
-
report(toMarker(( localize(
|
|
422
|
+
report(toMarker(( localize(5905, "The 'applyTo' attribute must be a valid glob pattern.")), attribute.value.range, MarkerSeverity.Error));
|
|
304
423
|
}
|
|
305
424
|
}
|
|
306
425
|
validateExcludeAgent(attributes, report) {
|
|
307
|
-
const attribute = attributes.find(attr => attr.key ===
|
|
426
|
+
const attribute = attributes.find(attr => attr.key === PromptHeaderAttributes.excludeAgent);
|
|
427
|
+
if (!attribute) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (attribute.value.type !== 'array') {
|
|
431
|
+
report(toMarker(( localize(5906, "The 'excludeAgent' attribute must be an array.")), attribute.value.range, MarkerSeverity.Error));
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
validateHandoffs(attributes, report) {
|
|
436
|
+
const attribute = attributes.find(attr => attr.key === PromptHeaderAttributes.handOffs);
|
|
308
437
|
if (!attribute) {
|
|
309
438
|
return;
|
|
310
439
|
}
|
|
311
440
|
if (attribute.value.type !== 'array') {
|
|
312
|
-
report(toMarker(( localize(
|
|
441
|
+
report(toMarker(( localize(5907, "The 'handoffs' attribute must be an array.")), attribute.value.range, MarkerSeverity.Error));
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
for (const item of attribute.value.items) {
|
|
445
|
+
if (item.type !== 'object') {
|
|
446
|
+
report(toMarker(( localize(
|
|
447
|
+
5908,
|
|
448
|
+
"Each handoff in the 'handoffs' attribute must be an object with 'label', 'agent', 'prompt' and optional 'send'."
|
|
449
|
+
)), item.range, MarkerSeverity.Error));
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
const required = ( new Set(['label', 'agent', 'prompt']));
|
|
453
|
+
for (const prop of item.properties) {
|
|
454
|
+
switch (prop.key.value) {
|
|
455
|
+
case 'label':
|
|
456
|
+
if (prop.value.type !== 'string' || prop.value.value.trim().length === 0) {
|
|
457
|
+
report(toMarker(( localize(5909, "The 'label' property in a handoff must be a non-empty string.")), prop.value.range, MarkerSeverity.Error));
|
|
458
|
+
}
|
|
459
|
+
break;
|
|
460
|
+
case 'agent':
|
|
461
|
+
if (prop.value.type !== 'string' || prop.value.value.trim().length === 0) {
|
|
462
|
+
report(toMarker(( localize(5910, "The 'agent' property in a handoff must be a non-empty string.")), prop.value.range, MarkerSeverity.Error));
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
this.validateAgentValue(prop.value, report);
|
|
466
|
+
}
|
|
467
|
+
break;
|
|
468
|
+
case 'prompt':
|
|
469
|
+
if (prop.value.type !== 'string') {
|
|
470
|
+
report(toMarker(( localize(5911, "The 'prompt' property in a handoff must be a string.")), prop.value.range, MarkerSeverity.Error));
|
|
471
|
+
}
|
|
472
|
+
break;
|
|
473
|
+
case 'send':
|
|
474
|
+
if (prop.value.type !== 'boolean') {
|
|
475
|
+
report(toMarker(( localize(5912, "The 'send' property in a handoff must be a boolean.")), prop.value.range, MarkerSeverity.Error));
|
|
476
|
+
}
|
|
477
|
+
break;
|
|
478
|
+
default:
|
|
479
|
+
report(toMarker(( localize(
|
|
480
|
+
5913,
|
|
481
|
+
"Unknown property '{0}' in handoff object. Supported properties are 'label', 'agent', 'prompt' and optional 'send'.",
|
|
482
|
+
prop.key.value
|
|
483
|
+
)), prop.value.range, MarkerSeverity.Warning));
|
|
484
|
+
}
|
|
485
|
+
required.delete(prop.key.value);
|
|
486
|
+
}
|
|
487
|
+
if (required.size > 0) {
|
|
488
|
+
report(toMarker(( localize(
|
|
489
|
+
5914,
|
|
490
|
+
"Missing required properties {0} in handoff object.",
|
|
491
|
+
( Array.from(required).map(s => `'${s}'`)).join(', ')
|
|
492
|
+
)), item.range, MarkerSeverity.Error));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
validateTarget(attributes, report) {
|
|
497
|
+
const attribute = attributes.find(attr => attr.key === PromptHeaderAttributes.target);
|
|
498
|
+
if (!attribute) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (attribute.value.type !== 'string') {
|
|
502
|
+
report(toMarker(( localize(5915, "The 'target' attribute must be a string.")), attribute.value.range, MarkerSeverity.Error));
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
const targetValue = attribute.value.value.trim();
|
|
506
|
+
if (targetValue.length === 0) {
|
|
507
|
+
report(toMarker(( localize(5916, "The 'target' attribute must be a non-empty string.")), attribute.value.range, MarkerSeverity.Error));
|
|
313
508
|
return;
|
|
314
509
|
}
|
|
510
|
+
const validTargets = ['github-copilot', 'vscode'];
|
|
511
|
+
if (!validTargets.includes(targetValue)) {
|
|
512
|
+
report(toMarker(( localize(
|
|
513
|
+
5917,
|
|
514
|
+
"The 'target' attribute must be one of: {0}.",
|
|
515
|
+
validTargets.join(', ')
|
|
516
|
+
)), attribute.value.range, MarkerSeverity.Error));
|
|
517
|
+
}
|
|
315
518
|
}
|
|
316
519
|
};
|
|
317
520
|
PromptValidator = ( __decorate([
|
|
@@ -319,32 +522,45 @@ PromptValidator = ( __decorate([
|
|
|
319
522
|
( __param(1, ILanguageModelToolsService)),
|
|
320
523
|
( __param(2, IChatModeService)),
|
|
321
524
|
( __param(3, IFileService)),
|
|
322
|
-
( __param(4, ILabelService))
|
|
525
|
+
( __param(4, ILabelService)),
|
|
526
|
+
( __param(5, IPromptsService))
|
|
323
527
|
], PromptValidator));
|
|
324
|
-
const
|
|
325
|
-
[PromptsType.prompt]: [
|
|
326
|
-
[PromptsType.instructions]: [
|
|
327
|
-
[PromptsType.
|
|
528
|
+
const allAttributeNames = {
|
|
529
|
+
[PromptsType.prompt]: [PromptHeaderAttributes.name, PromptHeaderAttributes.description, PromptHeaderAttributes.model, PromptHeaderAttributes.tools, PromptHeaderAttributes.mode, PromptHeaderAttributes.agent, PromptHeaderAttributes.argumentHint],
|
|
530
|
+
[PromptsType.instructions]: [PromptHeaderAttributes.name, PromptHeaderAttributes.description, PromptHeaderAttributes.applyTo, PromptHeaderAttributes.excludeAgent],
|
|
531
|
+
[PromptsType.agent]: [PromptHeaderAttributes.name, PromptHeaderAttributes.description, PromptHeaderAttributes.model, PromptHeaderAttributes.tools, PromptHeaderAttributes.advancedOptions, PromptHeaderAttributes.handOffs, PromptHeaderAttributes.argumentHint, PromptHeaderAttributes.target]
|
|
328
532
|
};
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
[PromptsType.
|
|
332
|
-
[PromptsType.
|
|
533
|
+
const githubCopilotAgentAttributeNames = [PromptHeaderAttributes.name, PromptHeaderAttributes.description, PromptHeaderAttributes.tools, PromptHeaderAttributes.target, GithubPromptHeaderAttributes.mcpServers];
|
|
534
|
+
const recommendedAttributeNames = {
|
|
535
|
+
[PromptsType.prompt]: allAttributeNames[PromptsType.prompt].filter(name => !isNonRecommendedAttribute(name)),
|
|
536
|
+
[PromptsType.instructions]: allAttributeNames[PromptsType.instructions].filter(name => !isNonRecommendedAttribute(name)),
|
|
537
|
+
[PromptsType.agent]: allAttributeNames[PromptsType.agent].filter(name => !isNonRecommendedAttribute(name))
|
|
333
538
|
};
|
|
334
|
-
function getValidAttributeNames(promptType,
|
|
335
|
-
|
|
539
|
+
function getValidAttributeNames(promptType, includeNonRecommended, isGitHubTarget) {
|
|
540
|
+
if (isGitHubTarget && promptType === PromptsType.agent) {
|
|
541
|
+
return githubCopilotAgentAttributeNames;
|
|
542
|
+
}
|
|
543
|
+
return includeNonRecommended ? allAttributeNames[promptType] : recommendedAttributeNames[promptType];
|
|
336
544
|
}
|
|
337
|
-
function
|
|
338
|
-
return attributeName ===
|
|
545
|
+
function isNonRecommendedAttribute(attributeName) {
|
|
546
|
+
return attributeName === PromptHeaderAttributes.advancedOptions || attributeName === PromptHeaderAttributes.excludeAgent || attributeName === PromptHeaderAttributes.mode;
|
|
547
|
+
}
|
|
548
|
+
const knownGithubCopilotTools = {
|
|
549
|
+
'shell': ( localize(5918, 'Execute shell commands')),
|
|
550
|
+
'edit': ( localize(5919, 'Edit files')),
|
|
551
|
+
'search': ( localize(5920, 'Search in files')),
|
|
552
|
+
'custom-agent': ( localize(5921, 'Call custom agents'))
|
|
553
|
+
};
|
|
554
|
+
function isGithubTarget(promptType, target) {
|
|
555
|
+
return promptType === PromptsType.agent && target === Target.GitHubCopilot;
|
|
339
556
|
}
|
|
340
557
|
function toMarker(message, range, severity = MarkerSeverity.Error) {
|
|
341
558
|
return { severity, message, ...range };
|
|
342
559
|
}
|
|
343
560
|
let PromptValidatorContribution = class PromptValidatorContribution extends Disposable {
|
|
344
|
-
constructor(modelService, instantiationService,
|
|
561
|
+
constructor(modelService, instantiationService, markerService, promptsService, languageModelsService, languageModelToolsService, chatModeService) {
|
|
345
562
|
super();
|
|
346
563
|
this.modelService = modelService;
|
|
347
|
-
this.configService = configService;
|
|
348
564
|
this.markerService = markerService;
|
|
349
565
|
this.promptsService = promptsService;
|
|
350
566
|
this.languageModelsService = languageModelsService;
|
|
@@ -353,46 +569,31 @@ let PromptValidatorContribution = class PromptValidatorContribution extends Disp
|
|
|
353
569
|
this.localDisposables = this._register(( new DisposableStore()));
|
|
354
570
|
this.validator = instantiationService.createInstance(PromptValidator);
|
|
355
571
|
this.updateRegistration();
|
|
356
|
-
this._register(this.configService.onDidChangeConfiguration(e => {
|
|
357
|
-
if (e.affectsConfiguration(PromptsConfig.KEY)) {
|
|
358
|
-
this.updateRegistration();
|
|
359
|
-
}
|
|
360
|
-
}));
|
|
361
572
|
}
|
|
362
573
|
updateRegistration() {
|
|
363
574
|
this.localDisposables.clear();
|
|
364
|
-
if (!PromptsConfig.enabled(this.configService)) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
575
|
const trackers = ( new ResourceMap());
|
|
368
576
|
this.localDisposables.add(toDisposable(() => {
|
|
369
577
|
trackers.forEach(tracker => tracker.dispose());
|
|
578
|
+
trackers.clear();
|
|
370
579
|
}));
|
|
371
|
-
|
|
372
|
-
const validateAll = () => {
|
|
373
|
-
validateAllDelayer.trigger(async () => {
|
|
374
|
-
this.modelService.getModels().forEach(model => {
|
|
375
|
-
const promptType = getPromptsTypeForLanguageId(model.getLanguageId());
|
|
376
|
-
if (promptType) {
|
|
377
|
-
trackers.set(model.uri, ( new ModelTracker(model, promptType, this.validator, this.promptsService, this.markerService)));
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
});
|
|
381
|
-
};
|
|
382
|
-
this.localDisposables.add(this.modelService.onModelAdded((model) => {
|
|
580
|
+
this.modelService.getModels().forEach(model => {
|
|
383
581
|
const promptType = getPromptsTypeForLanguageId(model.getLanguageId());
|
|
384
582
|
if (promptType) {
|
|
385
583
|
trackers.set(model.uri, ( new ModelTracker(model, promptType, this.validator, this.promptsService, this.markerService)));
|
|
386
584
|
}
|
|
585
|
+
});
|
|
586
|
+
this.localDisposables.add(this.modelService.onModelAdded((model) => {
|
|
587
|
+
const promptType = getPromptsTypeForLanguageId(model.getLanguageId());
|
|
588
|
+
if (promptType && !( trackers.has(model.uri))) {
|
|
589
|
+
trackers.set(model.uri, ( new ModelTracker(model, promptType, this.validator, this.promptsService, this.markerService)));
|
|
590
|
+
}
|
|
387
591
|
}));
|
|
388
592
|
this.localDisposables.add(this.modelService.onModelRemoved((model) => {
|
|
389
|
-
const
|
|
390
|
-
if (
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
tracker.dispose();
|
|
394
|
-
trackers.delete(model.uri);
|
|
395
|
-
}
|
|
593
|
+
const tracker = trackers.get(model.uri);
|
|
594
|
+
if (tracker) {
|
|
595
|
+
tracker.dispose();
|
|
596
|
+
trackers.delete(model.uri);
|
|
396
597
|
}
|
|
397
598
|
}));
|
|
398
599
|
this.localDisposables.add(this.modelService.onModelLanguageChanged((event) => {
|
|
@@ -407,21 +608,20 @@ let PromptValidatorContribution = class PromptValidatorContribution extends Disp
|
|
|
407
608
|
trackers.set(model.uri, ( new ModelTracker(model, promptType, this.validator, this.promptsService, this.markerService)));
|
|
408
609
|
}
|
|
409
610
|
}));
|
|
611
|
+
const validateAll = () => trackers.forEach(tracker => tracker.validate());
|
|
410
612
|
this.localDisposables.add(this.languageModelToolsService.onDidChangeTools(() => validateAll()));
|
|
411
613
|
this.localDisposables.add(this.chatModeService.onDidChangeChatModes(() => validateAll()));
|
|
412
614
|
this.localDisposables.add(this.languageModelsService.onDidChangeLanguageModels(() => validateAll()));
|
|
413
|
-
validateAll();
|
|
414
615
|
}
|
|
415
616
|
};
|
|
416
617
|
PromptValidatorContribution = ( __decorate([
|
|
417
618
|
( __param(0, IModelService)),
|
|
418
619
|
( __param(1, IInstantiationService)),
|
|
419
|
-
( __param(2,
|
|
420
|
-
( __param(3,
|
|
421
|
-
( __param(4,
|
|
422
|
-
( __param(5,
|
|
423
|
-
( __param(6,
|
|
424
|
-
( __param(7, IChatModeService))
|
|
620
|
+
( __param(2, IMarkerService)),
|
|
621
|
+
( __param(3, IPromptsService)),
|
|
622
|
+
( __param(4, ILanguageModelsService)),
|
|
623
|
+
( __param(5, ILanguageModelToolsService)),
|
|
624
|
+
( __param(6, IChatModeService))
|
|
425
625
|
], PromptValidatorContribution));
|
|
426
626
|
let ModelTracker = class ModelTracker extends Disposable {
|
|
427
627
|
constructor(textModel, promptType, validator, promptsService, markerService) {
|
|
@@ -453,4 +653,4 @@ ModelTracker = ( __decorate([
|
|
|
453
653
|
( __param(4, IMarkerService))
|
|
454
654
|
], ModelTracker));
|
|
455
655
|
|
|
456
|
-
export { PromptValidator, PromptValidatorContribution, getValidAttributeNames,
|
|
656
|
+
export { PromptValidator, PromptValidatorContribution, getValidAttributeNames, isGithubTarget, isNonRecommendedAttribute, knownGithubCopilotTools };
|