@codingame/monaco-vscode-chat-service-override 25.1.2 → 26.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 +24 -3
- package/package.json +5 -5
- package/vscode/src/vs/platform/browserElements/common/browserElements.d.ts +23 -3
- package/vscode/src/vs/platform/browserElements/common/browserElements.js +13 -6
- package/vscode/src/vs/platform/domWidget/browser/domWidget.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +42 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +218 -74
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatTerminalOutputAccessibleView.js +6 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +14 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +165 -168
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +27 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +141 -140
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +189 -121
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +14 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCustomizationDiagnosticsAction.d.ts +60 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCustomizationDiagnosticsAction.js +435 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +28 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +10 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +37 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +54 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +73 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +71 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +151 -89
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +12 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +39 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +90 -125
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +263 -143
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTransfer.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +188 -126
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +37 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +21 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +392 -226
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +31 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +25 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +319 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +215 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.d.ts +179 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +951 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/media/agentsessionprojection.css +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/media/agenttitlebarstatuswidget.css +388 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/media/unifiedQuickAccess.css +195 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.d.ts +120 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +394 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +95 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsProvider.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsProvider.js +31 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +49 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatVariables.js +4 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/media/simpleBrowserOverlay.css +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.js +188 -151
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +1012 -639
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.js +256 -151
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +182 -101
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingDeletedFileEntry.d.ts +79 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingDeletedFileEntry.js +193 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +9 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +253 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +4 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +69 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +52 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +5 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +274 -155
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +2 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +130 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +12 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +385 -160
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +53 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +112 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +19 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditorController.css +31 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +39 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNewNotebookContentEdits.js +10 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +25 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +265 -203
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.js +29 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.js +114 -60
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.js +16 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +44 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +119 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +152 -136
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +12 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +51 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +323 -217
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +653 -401
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +52 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +22 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +43 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +182 -136
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +548 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +222 -138
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +151 -113
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +453 -217
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +162 -88
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/media/chatSetup.css +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.js +1 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +309 -233
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +55 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusItemService.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +109 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +35 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.d.ts +9 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.js +73 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +333 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +39 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionContribution.js +9 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +23 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.js +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +20 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +65 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +48 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +20 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +155 -159
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.d.ts +24 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +521 -246
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +107 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +28 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownAnchorService.js +10 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputStateCache.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputStateCache.js +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatLayoutService.js +4 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.js +56 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.js +37 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatEditorInputContentProvider.js +5 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +1284 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +179 -125
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +9 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/editorHoverWrapper.js +7 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +96 -78
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +58 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +25 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +484 -292
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.d.ts +1 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +65 -92
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatViewPane.css +16 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatViewTitleControl.css +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +331 -189
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.js +81 -93
- package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js +1 -3
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatToolInvocation.d.ts +36 -8
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatToolInvocation.js +169 -31
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +141 -0
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +218 -144
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatTransferService.js +20 -10
- package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.d.ts +109 -0
- package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.js +349 -0
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.js +9 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +139 -36
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +3 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.js +64 -51
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +49 -34
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptDocumentSemanticTokensProvider.js +21 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +125 -97
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +91 -131
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkProvider.js +8 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +488 -222
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileContributions.js +32 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +58 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +717 -200
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +79 -18
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +371 -130
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatTodoListService.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatTodoListService.js +3 -7
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +79 -61
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatResponseResourceFileSystemProvider.js +27 -21
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js +7 -10
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +26 -32
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +8 -60
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +115 -426
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +127 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +1 -37
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +21 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +51 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +334 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +424 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +195 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +368 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +7 -0
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +23 -25
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/common/remoteCodingAgentsService.js +7 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +34 -38
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +8 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +103 -95
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.js +28 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +4 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +12 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +65 -54
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +86 -60
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.js +13 -26
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/commandFileWriteParser.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.js +142 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +56 -46
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +63 -31
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +35 -30
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +44 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +3 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +70 -50
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +26 -394
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +85 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +68 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +67 -45
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/awaitTerminalTool.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/awaitTerminalTool.js +106 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.js +177 -97
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +136 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +128 -112
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +51 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.js +25 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/commandLinePresenter.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.js +37 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.js +37 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.js +44 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.js +21 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +5 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.js +2 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.js +29 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +30 -31
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +16 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +19 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +58 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +31 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +325 -199
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +33 -38
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +45 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +746 -456
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +145 -98
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +88 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +120 -51
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +25 -28
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +58 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/toolIds.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/toolIds.js +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +47 -28
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +171 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +0 -58
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +0 -213
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +0 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +0 -243
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +0 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +0 -166
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +0 -607
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +0 -255
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +0 -46
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +0 -396
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +0 -379
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +0 -117
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +0 -141
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +0 -961
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +0 -447
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +0 -251
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +0 -42
package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js
ADDED
|
@@ -0,0 +1,1284 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
+
import { decodeBase64 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
5
|
+
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
6
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
7
|
+
import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
|
|
8
|
+
import { isPatternInWord } from '@codingame/monaco-vscode-api/vscode/vs/base/common/filters';
|
|
9
|
+
import { Disposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
10
|
+
import { ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
11
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
12
|
+
import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
13
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
14
|
+
import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
15
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
16
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
17
|
+
import { isCodeEditor, getCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
|
|
18
|
+
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
|
|
19
|
+
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
20
|
+
import { getWordAtText } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/wordHelper';
|
|
21
|
+
import { CompletionItemKind, SymbolKinds } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
22
|
+
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
|
|
23
|
+
import { IOutlineModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/documentSymbols/browser/outlineModel.service';
|
|
24
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
25
|
+
import { Action2, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
26
|
+
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
27
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
28
|
+
import { FileKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
29
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
30
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
31
|
+
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
32
|
+
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
33
|
+
import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
|
|
34
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
35
|
+
import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
36
|
+
import { EditorsOrder, isDiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
37
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
38
|
+
import { IHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service';
|
|
39
|
+
import { LifecyclePhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
40
|
+
import { ISearchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/search/common/search.service';
|
|
41
|
+
import { McpPromptArgumentPick } from '../../../../../mcp/browser/mcpPromptArgumentPick.js';
|
|
42
|
+
import { McpResourceURI } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
43
|
+
import { IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
44
|
+
import { searchFilesAndFolders } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/search/browser/searchChatContext';
|
|
45
|
+
import { getFullyQualifiedId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents';
|
|
46
|
+
import { IChatAgentService, IChatAgentNameService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents.service';
|
|
47
|
+
import { getAttachableImageExtension } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel';
|
|
48
|
+
import { ChatRequestAgentPart, chatSubcommandLeader, chatAgentLeader, ChatRequestAgentSubcommandPart, ChatRequestSlashPromptPart, ChatRequestTextPart, chatVariableLeader, ChatRequestToolPart, ChatRequestToolSetPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/requestParser/chatParserTypes';
|
|
49
|
+
import { IChatSlashCommandService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatSlashCommands.service';
|
|
50
|
+
import { ChatAgentLocation, ChatModeKind, isSupportedChatFileScheme } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
51
|
+
import { isToolSet } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService';
|
|
52
|
+
import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
|
|
53
|
+
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
|
|
54
|
+
import { ChatSubmitAction } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/actions/chatExecuteActions';
|
|
55
|
+
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
56
|
+
import { resizeImage } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatImageUtils';
|
|
57
|
+
import { ChatDynamicVariableModel } from '@codingame/monaco-vscode-xterm-addons-common/vscode/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables';
|
|
58
|
+
|
|
59
|
+
var BuiltinDynamicCompletions_1, ToolCompletions_1;
|
|
60
|
+
let SlashCommandCompletions = class SlashCommandCompletions extends Disposable {
|
|
61
|
+
constructor(
|
|
62
|
+
languageFeaturesService,
|
|
63
|
+
chatWidgetService,
|
|
64
|
+
chatSlashCommandService,
|
|
65
|
+
promptsService,
|
|
66
|
+
mcpService
|
|
67
|
+
) {
|
|
68
|
+
super();
|
|
69
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
70
|
+
this.chatWidgetService = chatWidgetService;
|
|
71
|
+
this.chatSlashCommandService = chatSlashCommandService;
|
|
72
|
+
this.promptsService = promptsService;
|
|
73
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
74
|
+
scheme: Schemas.vscodeChatInput,
|
|
75
|
+
hasAccessToAllModels: true
|
|
76
|
+
}, {
|
|
77
|
+
_debugDisplayName: "globalSlashCommands",
|
|
78
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
79
|
+
provideCompletionItems: async (model, position, _context, _token) => {
|
|
80
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
81
|
+
if (!widget || !widget.viewModel) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
if (widget.lockedAgentId) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const range = computeCompletionRanges(model, position, /\/\w*/g);
|
|
88
|
+
if (!range) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const parsedRequest = widget.parsedInput.parts;
|
|
95
|
+
const usedAgent = parsedRequest.find(p => p instanceof ChatRequestAgentPart);
|
|
96
|
+
if (usedAgent) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const slashCommands = this.chatSlashCommandService.getCommands(widget.location, widget.input.currentModeKind);
|
|
100
|
+
if (!slashCommands) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
suggestions: ( slashCommands.map((c, i) => {
|
|
105
|
+
const withSlash = `/${c.command}`;
|
|
106
|
+
return {
|
|
107
|
+
label: withSlash,
|
|
108
|
+
insertText: c.executeImmediately ? "" : `${withSlash} `,
|
|
109
|
+
documentation: c.detail,
|
|
110
|
+
range,
|
|
111
|
+
sortText: c.sortText ?? "a".repeat(i + 1),
|
|
112
|
+
kind: CompletionItemKind.Text,
|
|
113
|
+
command: c.executeImmediately ? {
|
|
114
|
+
id: ChatSubmitAction.ID,
|
|
115
|
+
title: withSlash,
|
|
116
|
+
arguments: [{
|
|
117
|
+
widget,
|
|
118
|
+
inputValue: `${withSlash} `
|
|
119
|
+
}]
|
|
120
|
+
} : undefined
|
|
121
|
+
};
|
|
122
|
+
}))
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
127
|
+
scheme: Schemas.vscodeChatInput,
|
|
128
|
+
hasAccessToAllModels: true
|
|
129
|
+
}, {
|
|
130
|
+
_debugDisplayName: "globalSlashCommandsAt",
|
|
131
|
+
triggerCharacters: [chatAgentLeader],
|
|
132
|
+
provideCompletionItems: async (model, position, _context, _token) => {
|
|
133
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
134
|
+
if (!widget || !widget.viewModel) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const range = computeCompletionRanges(model, position, /@\w*/g);
|
|
138
|
+
if (!range) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const slashCommands = this.chatSlashCommandService.getCommands(widget.location, widget.input.currentModeKind);
|
|
145
|
+
if (!slashCommands) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
if (widget.lockedAgentId) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
suggestions: ( slashCommands.map((c, i) => {
|
|
153
|
+
const withSlash = `${chatSubcommandLeader}${c.command}`;
|
|
154
|
+
return {
|
|
155
|
+
label: withSlash,
|
|
156
|
+
insertText: c.executeImmediately ? "" : `${withSlash} `,
|
|
157
|
+
documentation: c.detail,
|
|
158
|
+
range,
|
|
159
|
+
filterText: `${chatAgentLeader}${c.command}`,
|
|
160
|
+
sortText: c.sortText ?? "z".repeat(i + 1),
|
|
161
|
+
kind: CompletionItemKind.Text,
|
|
162
|
+
command: c.executeImmediately ? {
|
|
163
|
+
id: ChatSubmitAction.ID,
|
|
164
|
+
title: withSlash,
|
|
165
|
+
arguments: [{
|
|
166
|
+
widget,
|
|
167
|
+
inputValue: `${withSlash} `
|
|
168
|
+
}]
|
|
169
|
+
} : undefined
|
|
170
|
+
};
|
|
171
|
+
}))
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}));
|
|
175
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
176
|
+
scheme: Schemas.vscodeChatInput,
|
|
177
|
+
hasAccessToAllModels: true
|
|
178
|
+
}, {
|
|
179
|
+
_debugDisplayName: "promptSlashCommands",
|
|
180
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
181
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
182
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
183
|
+
if (!widget || !widget.viewModel) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
const range = computeCompletionRanges(model, position, /\/\w*/g);
|
|
187
|
+
if (!range) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const parsedRequest = widget.parsedInput.parts;
|
|
194
|
+
const usedAgent = parsedRequest.find(p => p instanceof ChatRequestAgentPart);
|
|
195
|
+
if (usedAgent) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const promptCommands = await this.promptsService.getPromptSlashCommands(token);
|
|
199
|
+
if (promptCommands.length === 0) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
if (widget.lockedAgentId) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
suggestions: ( promptCommands.map((c, i) => {
|
|
207
|
+
const label = `/${c.name}`;
|
|
208
|
+
const description = c.description;
|
|
209
|
+
return {
|
|
210
|
+
label: {
|
|
211
|
+
label,
|
|
212
|
+
description
|
|
213
|
+
},
|
|
214
|
+
insertText: `${label} `,
|
|
215
|
+
documentation: c.description,
|
|
216
|
+
range,
|
|
217
|
+
sortText: "a".repeat(i + 1),
|
|
218
|
+
kind: CompletionItemKind.Text
|
|
219
|
+
};
|
|
220
|
+
}))
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}));
|
|
224
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
225
|
+
scheme: Schemas.vscodeChatInput,
|
|
226
|
+
hasAccessToAllModels: true
|
|
227
|
+
}, {
|
|
228
|
+
_debugDisplayName: "mcpPromptSlashCommands",
|
|
229
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
230
|
+
provideCompletionItems: async (model, position, _context, _token) => {
|
|
231
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
232
|
+
if (!widget || !widget.viewModel) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
const range = computeCompletionRanges(model, position, /\/[a-z0-9_.-]*/g);
|
|
236
|
+
if (!range) {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (widget.lockedAgentId) {
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
suggestions: mcpService.servers.get().flatMap(server => ( server.prompts.get().map(prompt => {
|
|
247
|
+
const label = `/mcp.${prompt.id}`;
|
|
248
|
+
return {
|
|
249
|
+
label: {
|
|
250
|
+
label,
|
|
251
|
+
description: prompt.description
|
|
252
|
+
},
|
|
253
|
+
command: {
|
|
254
|
+
id: StartParameterizedPromptAction.ID,
|
|
255
|
+
title: prompt.name,
|
|
256
|
+
arguments: [model, server, prompt, `${label} `]
|
|
257
|
+
},
|
|
258
|
+
insertText: `${label} `,
|
|
259
|
+
range,
|
|
260
|
+
kind: CompletionItemKind.Text
|
|
261
|
+
};
|
|
262
|
+
})))
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
SlashCommandCompletions = ( __decorate([( __param(0, ILanguageFeaturesService)), ( __param(1, IChatWidgetService)), ( __param(2, IChatSlashCommandService)), ( __param(3, IPromptsService)), ( __param(4, IMcpService))], SlashCommandCompletions));
|
|
269
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(SlashCommandCompletions, LifecyclePhase.Eventually);
|
|
270
|
+
let AgentCompletions = class AgentCompletions extends Disposable {
|
|
271
|
+
constructor(
|
|
272
|
+
languageFeaturesService,
|
|
273
|
+
chatWidgetService,
|
|
274
|
+
chatAgentService,
|
|
275
|
+
chatAgentNameService,
|
|
276
|
+
chatSessionsService
|
|
277
|
+
) {
|
|
278
|
+
super();
|
|
279
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
280
|
+
this.chatWidgetService = chatWidgetService;
|
|
281
|
+
this.chatAgentService = chatAgentService;
|
|
282
|
+
this.chatAgentNameService = chatAgentNameService;
|
|
283
|
+
this.chatSessionsService = chatSessionsService;
|
|
284
|
+
const subCommandProvider = {
|
|
285
|
+
_debugDisplayName: "chatAgentSubcommand",
|
|
286
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
287
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
288
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
289
|
+
if (!widget || !widget.viewModel) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const range = computeCompletionRanges(model, position, /\/\w*/g);
|
|
293
|
+
if (!range) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const usedAgent = this.getCurrentAgentForWidget(widget);
|
|
297
|
+
if (!usedAgent || usedAgent.command) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
suggestions: ( usedAgent.agent.slashCommands.map((c, i) => {
|
|
302
|
+
const withSlash = `/${c.name}`;
|
|
303
|
+
return {
|
|
304
|
+
label: withSlash,
|
|
305
|
+
insertText: `${withSlash} `,
|
|
306
|
+
documentation: c.description,
|
|
307
|
+
range,
|
|
308
|
+
kind: CompletionItemKind.Text
|
|
309
|
+
};
|
|
310
|
+
}))
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
315
|
+
scheme: Schemas.vscodeChatInput,
|
|
316
|
+
hasAccessToAllModels: true
|
|
317
|
+
}, subCommandProvider));
|
|
318
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
319
|
+
scheme: Schemas.vscodeChatInput,
|
|
320
|
+
hasAccessToAllModels: true
|
|
321
|
+
}, {
|
|
322
|
+
_debugDisplayName: "chatAgentAndSubcommand",
|
|
323
|
+
triggerCharacters: [chatAgentLeader],
|
|
324
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
325
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
326
|
+
const viewModel = widget?.viewModel;
|
|
327
|
+
if (!widget || !viewModel) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
if (widget.lockedAgentId) {
|
|
331
|
+
return null;
|
|
332
|
+
}
|
|
333
|
+
const range = computeCompletionRanges(model, position, /(@|\/)\w*/g);
|
|
334
|
+
if (!range) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const agents = this.chatAgentService.getAgents().filter(a => a.locations.includes(widget.location));
|
|
341
|
+
const chatSessionContributions = this.chatSessionsService.getAllChatSessionContributions();
|
|
342
|
+
const chatSessionAgentIds = ( new Set(( chatSessionContributions.map(contribution => contribution.type))));
|
|
343
|
+
const agentsForSlashCommands = agents.filter(a => !( chatSessionAgentIds.has(a.id)));
|
|
344
|
+
const getFilterText = (agent, command) => {
|
|
345
|
+
const dummyPrefix = agent.id === "github.copilot.terminalPanel" ? `0000` : ``;
|
|
346
|
+
return `${chatAgentLeader}${dummyPrefix}${agent.name}.${command}`;
|
|
347
|
+
};
|
|
348
|
+
const justAgents = ( agents.filter(a => !a.isDefault).map(agent => {
|
|
349
|
+
const {
|
|
350
|
+
label: agentLabel,
|
|
351
|
+
isDupe
|
|
352
|
+
} = this.getAgentCompletionDetails(agent);
|
|
353
|
+
const detail = agent.description;
|
|
354
|
+
return {
|
|
355
|
+
label: isDupe ? {
|
|
356
|
+
label: agentLabel,
|
|
357
|
+
description: agent.description,
|
|
358
|
+
detail: ` (${agent.publisherDisplayName})`
|
|
359
|
+
} : agentLabel,
|
|
360
|
+
documentation: detail,
|
|
361
|
+
filterText: `${chatAgentLeader}${agent.name}`,
|
|
362
|
+
insertText: `${agentLabel} `,
|
|
363
|
+
range,
|
|
364
|
+
kind: CompletionItemKind.Text,
|
|
365
|
+
sortText: `${chatAgentLeader}${agent.name}`,
|
|
366
|
+
command: {
|
|
367
|
+
id: AssignSelectedAgentAction.ID,
|
|
368
|
+
title: AssignSelectedAgentAction.ID,
|
|
369
|
+
arguments: [{
|
|
370
|
+
agent,
|
|
371
|
+
widget
|
|
372
|
+
}]
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}));
|
|
376
|
+
return {
|
|
377
|
+
suggestions: justAgents.concat(coalesce(agentsForSlashCommands.flatMap(agent => ( agent.slashCommands.map((c, i) => {
|
|
378
|
+
if (agent.isDefault && this.chatAgentService.getDefaultAgent(widget.location, widget.input.currentModeKind)?.id !== agent.id) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const {
|
|
382
|
+
label: agentLabel,
|
|
383
|
+
isDupe
|
|
384
|
+
} = this.getAgentCompletionDetails(agent);
|
|
385
|
+
const label = `${agentLabel} ${chatSubcommandLeader}${c.name}`;
|
|
386
|
+
const item = {
|
|
387
|
+
label: isDupe ? {
|
|
388
|
+
label,
|
|
389
|
+
description: c.description,
|
|
390
|
+
detail: isDupe ? ` (${agent.publisherDisplayName})` : undefined
|
|
391
|
+
} : label,
|
|
392
|
+
documentation: c.description,
|
|
393
|
+
filterText: getFilterText(agent, c.name),
|
|
394
|
+
commitCharacters: [" "],
|
|
395
|
+
insertText: label + " ",
|
|
396
|
+
range,
|
|
397
|
+
kind: CompletionItemKind.Text,
|
|
398
|
+
sortText: `x${chatAgentLeader}${agent.name}${c.name}`,
|
|
399
|
+
command: {
|
|
400
|
+
id: AssignSelectedAgentAction.ID,
|
|
401
|
+
title: AssignSelectedAgentAction.ID,
|
|
402
|
+
arguments: [{
|
|
403
|
+
agent,
|
|
404
|
+
widget
|
|
405
|
+
}]
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
if (agent.isDefault) {
|
|
409
|
+
const label = `${chatSubcommandLeader}${c.name}`;
|
|
410
|
+
item.label = label;
|
|
411
|
+
item.insertText = `${label} `;
|
|
412
|
+
item.documentation = c.description;
|
|
413
|
+
}
|
|
414
|
+
return item;
|
|
415
|
+
})))))
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}));
|
|
419
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
420
|
+
scheme: Schemas.vscodeChatInput,
|
|
421
|
+
hasAccessToAllModels: true
|
|
422
|
+
}, {
|
|
423
|
+
_debugDisplayName: "chatAgentAndSubcommand",
|
|
424
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
425
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
426
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
427
|
+
const viewModel = widget?.viewModel;
|
|
428
|
+
if (!widget || !viewModel) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (widget.lockedAgentId) {
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
const range = computeCompletionRanges(model, position, /(@|\/)\w*/g);
|
|
435
|
+
if (!range) {
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
const agents =
|
|
442
|
+
this.chatAgentService.getAgents().filter(
|
|
443
|
+
a => a.locations.includes(widget.location) && a.modes.includes(widget.input.currentModeKind)
|
|
444
|
+
).filter(a => !this.chatSessionsService.getChatSessionContribution(a.id));
|
|
445
|
+
return {
|
|
446
|
+
suggestions: coalesce(agents.flatMap(agent => ( agent.slashCommands.map((c, i) => {
|
|
447
|
+
if (agent.isDefault && this.chatAgentService.getDefaultAgent(widget.location, widget.input.currentModeKind)?.id !== agent.id) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const {
|
|
451
|
+
label: agentLabel,
|
|
452
|
+
isDupe
|
|
453
|
+
} = this.getAgentCompletionDetails(agent);
|
|
454
|
+
const withSlash = `${chatSubcommandLeader}${c.name}`;
|
|
455
|
+
const extraSortText = agent.id === "github.copilot.terminalPanel" ? `z` : ``;
|
|
456
|
+
const sortText = `${chatSubcommandLeader}${extraSortText}${agent.name}${c.name}`;
|
|
457
|
+
const item = {
|
|
458
|
+
label: {
|
|
459
|
+
label: withSlash,
|
|
460
|
+
description: agentLabel,
|
|
461
|
+
detail: isDupe ? ` (${agent.publisherDisplayName})` : undefined
|
|
462
|
+
},
|
|
463
|
+
commitCharacters: [" "],
|
|
464
|
+
insertText: `${agentLabel} ${withSlash} `,
|
|
465
|
+
documentation: `(${agentLabel}) ${c.description ?? ""}`,
|
|
466
|
+
range,
|
|
467
|
+
kind: CompletionItemKind.Text,
|
|
468
|
+
sortText,
|
|
469
|
+
command: {
|
|
470
|
+
id: AssignSelectedAgentAction.ID,
|
|
471
|
+
title: AssignSelectedAgentAction.ID,
|
|
472
|
+
arguments: [{
|
|
473
|
+
agent,
|
|
474
|
+
widget
|
|
475
|
+
}]
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
if (agent.isDefault) {
|
|
479
|
+
const label = `${chatSubcommandLeader}${c.name}`;
|
|
480
|
+
item.label = label;
|
|
481
|
+
item.insertText = `${label} `;
|
|
482
|
+
item.documentation = c.description;
|
|
483
|
+
}
|
|
484
|
+
return item;
|
|
485
|
+
}))))
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
}));
|
|
489
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
490
|
+
scheme: Schemas.vscodeChatInput,
|
|
491
|
+
hasAccessToAllModels: true
|
|
492
|
+
}, {
|
|
493
|
+
_debugDisplayName: "installChatExtensions",
|
|
494
|
+
triggerCharacters: [chatAgentLeader],
|
|
495
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
496
|
+
if (!model.getLineContent(1).startsWith(chatAgentLeader)) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
500
|
+
if (widget?.location !== ChatAgentLocation.Chat || widget.input.currentModeKind !== ChatModeKind.Ask) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (widget.lockedAgentId) {
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
506
|
+
const range = computeCompletionRanges(model, position, /(@|\/)\w*/g);
|
|
507
|
+
if (!range) {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
const label = ( localize(6091, "Install Chat Extensions..."));
|
|
514
|
+
const item = {
|
|
515
|
+
label,
|
|
516
|
+
insertText: "",
|
|
517
|
+
range,
|
|
518
|
+
kind: CompletionItemKind.Text,
|
|
519
|
+
command: {
|
|
520
|
+
id: "workbench.extensions.search",
|
|
521
|
+
title: "",
|
|
522
|
+
arguments: ["@tag:chat-participant"]
|
|
523
|
+
},
|
|
524
|
+
filterText: chatAgentLeader + label,
|
|
525
|
+
sortText: "zzz"
|
|
526
|
+
};
|
|
527
|
+
return {
|
|
528
|
+
suggestions: [item]
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
}));
|
|
532
|
+
}
|
|
533
|
+
getCurrentAgentForWidget(widget) {
|
|
534
|
+
if (widget.lockedAgentId) {
|
|
535
|
+
const usedAgent = this.chatAgentService.getAgent(widget.lockedAgentId);
|
|
536
|
+
return usedAgent && {
|
|
537
|
+
agent: usedAgent
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
const parsedRequest = widget.parsedInput.parts;
|
|
541
|
+
const usedAgentIdx = parsedRequest.findIndex(p => p instanceof ChatRequestAgentPart);
|
|
542
|
+
if (usedAgentIdx < 0) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const usedAgent = parsedRequest[usedAgentIdx];
|
|
546
|
+
const usedOtherCommand = parsedRequest.find(
|
|
547
|
+
p => p instanceof ChatRequestAgentSubcommandPart || p instanceof ChatRequestSlashPromptPart
|
|
548
|
+
);
|
|
549
|
+
if (usedOtherCommand) {
|
|
550
|
+
return {
|
|
551
|
+
agent: usedAgent.agent,
|
|
552
|
+
command: usedOtherCommand instanceof ChatRequestAgentSubcommandPart ? usedOtherCommand.command.name : undefined
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
for (const partAfterAgent of parsedRequest.slice(usedAgentIdx + 1)) {
|
|
556
|
+
if (!(partAfterAgent instanceof ChatRequestTextPart) || !partAfterAgent.text.trim().match(/^(\/\w*)?$/)) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
agent: usedAgent.agent
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
getAgentCompletionDetails(agent) {
|
|
565
|
+
const isAllowed = this.chatAgentNameService.getAgentNameRestriction(agent);
|
|
566
|
+
const agentLabel = `${chatAgentLeader}${isAllowed ? agent.name : getFullyQualifiedId(agent)}`;
|
|
567
|
+
const isDupe = isAllowed && this.chatAgentService.agentHasDupeName(agent.id);
|
|
568
|
+
return {
|
|
569
|
+
label: agentLabel,
|
|
570
|
+
isDupe
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
AgentCompletions = ( __decorate([( __param(0, ILanguageFeaturesService)), ( __param(1, IChatWidgetService)), ( __param(2, IChatAgentService)), ( __param(3, IChatAgentNameService)), ( __param(4, IChatSessionsService))], AgentCompletions));
|
|
575
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(AgentCompletions, LifecyclePhase.Eventually);
|
|
576
|
+
class AssignSelectedAgentAction extends Action2 {
|
|
577
|
+
static {
|
|
578
|
+
this.ID = "workbench.action.chat.assignSelectedAgent";
|
|
579
|
+
}
|
|
580
|
+
constructor() {
|
|
581
|
+
super({
|
|
582
|
+
id: AssignSelectedAgentAction.ID,
|
|
583
|
+
title: ""
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
async run(accessor, ...args) {
|
|
587
|
+
const arg = args[0];
|
|
588
|
+
if (!arg || !arg.widget || !arg.agent) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (!arg.agent.modes.includes(arg.widget.input.currentModeKind)) {
|
|
592
|
+
arg.widget.input.setChatMode(arg.agent.modes[0]);
|
|
593
|
+
}
|
|
594
|
+
arg.widget.lastSelectedAgent = arg.agent;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
registerAction2(AssignSelectedAgentAction);
|
|
598
|
+
class StartParameterizedPromptAction extends Action2 {
|
|
599
|
+
static {
|
|
600
|
+
this.ID = "workbench.action.chat.startParameterizedPrompt";
|
|
601
|
+
}
|
|
602
|
+
constructor() {
|
|
603
|
+
super({
|
|
604
|
+
id: StartParameterizedPromptAction.ID,
|
|
605
|
+
title: ""
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
async run(accessor, model, server, prompt, textToReplace) {
|
|
609
|
+
if (!model || !prompt) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
613
|
+
const notificationService = accessor.get(INotificationService);
|
|
614
|
+
const widgetService = accessor.get(IChatWidgetService);
|
|
615
|
+
const fileService = accessor.get(IFileService);
|
|
616
|
+
const chatWidget = await widgetService.revealWidget(true);
|
|
617
|
+
if (!chatWidget) {
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
const lastPosition = model.getFullModelRange().collapseToEnd();
|
|
621
|
+
const getPromptIndex = () => model.findMatches(textToReplace, true, false, true, null, false)[0];
|
|
622
|
+
const replaceTextWith = value => model.applyEdits([{
|
|
623
|
+
range: getPromptIndex()?.range || lastPosition,
|
|
624
|
+
text: value
|
|
625
|
+
}]);
|
|
626
|
+
const store = ( new DisposableStore());
|
|
627
|
+
const cts = store.add(( new CancellationTokenSource()));
|
|
628
|
+
store.add(chatWidget.input.startGenerating());
|
|
629
|
+
store.add(model.onDidChangeContent(() => {
|
|
630
|
+
if (getPromptIndex()) {
|
|
631
|
+
cts.cancel();
|
|
632
|
+
}
|
|
633
|
+
}));
|
|
634
|
+
model.changeDecorations(accessor => {
|
|
635
|
+
const id = accessor.addDecoration(lastPosition, {
|
|
636
|
+
description: "mcp-prompt-spinner",
|
|
637
|
+
showIfCollapsed: true,
|
|
638
|
+
after: {
|
|
639
|
+
content: " ",
|
|
640
|
+
inlineClassNameAffectsLetterSpacing: true,
|
|
641
|
+
inlineClassName: ThemeIcon.asClassName(ThemeIcon.modify(Codicon.loading, "spin")) + " chat-prompt-spinner"
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
store.add(toDisposable(() => {
|
|
645
|
+
model.changeDecorations(a => a.removeDecoration(id));
|
|
646
|
+
}));
|
|
647
|
+
});
|
|
648
|
+
const pick = store.add(instantiationService.createInstance(McpPromptArgumentPick, prompt));
|
|
649
|
+
try {
|
|
650
|
+
await server.start();
|
|
651
|
+
const args = await pick.createArgs();
|
|
652
|
+
if (!args) {
|
|
653
|
+
replaceTextWith("");
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
let messages;
|
|
657
|
+
try {
|
|
658
|
+
messages = await prompt.resolve(args, cts.token);
|
|
659
|
+
} catch (e) {
|
|
660
|
+
if (!cts.token.isCancellationRequested) {
|
|
661
|
+
notificationService.error(( localize(6092, "Error resolving prompt: {0}", String(e))));
|
|
662
|
+
}
|
|
663
|
+
replaceTextWith("");
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
const toAttach = [];
|
|
667
|
+
const attachBlob = async (mimeType, contents, uriStr, isText = false) => {
|
|
668
|
+
let validURI;
|
|
669
|
+
if (uriStr) {
|
|
670
|
+
for (const uri of [( URI.parse(uriStr)), McpResourceURI.fromServer(server.definition, uriStr)]) {
|
|
671
|
+
try {
|
|
672
|
+
validURI ||= (await fileService.exists(uri)) ? uri : undefined;
|
|
673
|
+
} catch {}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (isText) {
|
|
677
|
+
if (validURI) {
|
|
678
|
+
toAttach.push({
|
|
679
|
+
id: generateUuid(),
|
|
680
|
+
kind: "file",
|
|
681
|
+
value: validURI,
|
|
682
|
+
name: basename(validURI)
|
|
683
|
+
});
|
|
684
|
+
} else {
|
|
685
|
+
toAttach.push({
|
|
686
|
+
id: generateUuid(),
|
|
687
|
+
kind: "generic",
|
|
688
|
+
value: contents,
|
|
689
|
+
name: ( localize(6093, "Prompt Resource"))
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
} else if (mimeType && getAttachableImageExtension(mimeType)) {
|
|
693
|
+
const resized = await resizeImage(contents).catch(() => decodeBase64(contents).buffer);
|
|
694
|
+
chatWidget.attachmentModel.addContext({
|
|
695
|
+
id: generateUuid(),
|
|
696
|
+
name: ( localize(6094, "Prompt Image")),
|
|
697
|
+
fullName: ( localize(6094, "Prompt Image")),
|
|
698
|
+
value: resized,
|
|
699
|
+
kind: "image",
|
|
700
|
+
references: validURI && [{
|
|
701
|
+
reference: validURI,
|
|
702
|
+
kind: "reference"
|
|
703
|
+
}]
|
|
704
|
+
});
|
|
705
|
+
} else if (validURI) {
|
|
706
|
+
toAttach.push({
|
|
707
|
+
id: generateUuid(),
|
|
708
|
+
kind: "file",
|
|
709
|
+
value: validURI,
|
|
710
|
+
name: basename(validURI)
|
|
711
|
+
});
|
|
712
|
+
} else
|
|
713
|
+
{}
|
|
714
|
+
};
|
|
715
|
+
const hasMultipleRoles = ( messages.some(m => m.role !== messages[0].role));
|
|
716
|
+
let input = "";
|
|
717
|
+
for (const message of messages) {
|
|
718
|
+
switch (message.content.type) {
|
|
719
|
+
case "text":
|
|
720
|
+
if (input) {
|
|
721
|
+
input += "\n\n";
|
|
722
|
+
}
|
|
723
|
+
if (hasMultipleRoles) {
|
|
724
|
+
input += `--${message.role.toUpperCase()}\n`;
|
|
725
|
+
}
|
|
726
|
+
input += message.content.text;
|
|
727
|
+
break;
|
|
728
|
+
case "resource":
|
|
729
|
+
if ("text" in message.content.resource) {
|
|
730
|
+
await attachBlob(
|
|
731
|
+
message.content.resource.mimeType,
|
|
732
|
+
message.content.resource.text,
|
|
733
|
+
message.content.resource.uri,
|
|
734
|
+
true
|
|
735
|
+
);
|
|
736
|
+
} else {
|
|
737
|
+
await attachBlob(
|
|
738
|
+
message.content.resource.mimeType,
|
|
739
|
+
message.content.resource.blob,
|
|
740
|
+
message.content.resource.uri
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
break;
|
|
744
|
+
case "image":
|
|
745
|
+
case "audio":
|
|
746
|
+
await attachBlob(message.content.mimeType, message.content.data);
|
|
747
|
+
break;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
if (toAttach.length) {
|
|
751
|
+
chatWidget.attachmentModel.addContext(...toAttach);
|
|
752
|
+
}
|
|
753
|
+
replaceTextWith(input);
|
|
754
|
+
} finally {
|
|
755
|
+
store.dispose();
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
registerAction2(StartParameterizedPromptAction);
|
|
760
|
+
class ReferenceArgument {
|
|
761
|
+
constructor(widget, variable) {
|
|
762
|
+
this.widget = widget;
|
|
763
|
+
this.variable = variable;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
let BuiltinDynamicCompletions = class BuiltinDynamicCompletions extends Disposable {
|
|
767
|
+
static {
|
|
768
|
+
BuiltinDynamicCompletions_1 = this;
|
|
769
|
+
}
|
|
770
|
+
static {
|
|
771
|
+
this.addReferenceCommand = "_addReferenceCmd";
|
|
772
|
+
}
|
|
773
|
+
static {
|
|
774
|
+
this.VariableNameDef = ( new RegExp(`${chatVariableLeader}[\\w:-]*`, "g"));
|
|
775
|
+
}
|
|
776
|
+
constructor(
|
|
777
|
+
historyService,
|
|
778
|
+
workspaceContextService,
|
|
779
|
+
searchService,
|
|
780
|
+
labelService,
|
|
781
|
+
languageFeaturesService,
|
|
782
|
+
chatWidgetService,
|
|
783
|
+
outlineService,
|
|
784
|
+
editorService,
|
|
785
|
+
configurationService,
|
|
786
|
+
codeEditorService,
|
|
787
|
+
chatAgentService,
|
|
788
|
+
instantiationService
|
|
789
|
+
) {
|
|
790
|
+
super();
|
|
791
|
+
this.historyService = historyService;
|
|
792
|
+
this.workspaceContextService = workspaceContextService;
|
|
793
|
+
this.searchService = searchService;
|
|
794
|
+
this.labelService = labelService;
|
|
795
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
796
|
+
this.chatWidgetService = chatWidgetService;
|
|
797
|
+
this.outlineService = outlineService;
|
|
798
|
+
this.editorService = editorService;
|
|
799
|
+
this.configurationService = configurationService;
|
|
800
|
+
this.codeEditorService = codeEditorService;
|
|
801
|
+
this.chatAgentService = chatAgentService;
|
|
802
|
+
this.instantiationService = instantiationService;
|
|
803
|
+
const fileWordPattern = ( new RegExp(`${chatVariableLeader}[^\\s]*`, "g"));
|
|
804
|
+
this.registerVariableCompletions("fileAndFolder", async (
|
|
805
|
+
{
|
|
806
|
+
widget,
|
|
807
|
+
range
|
|
808
|
+
},
|
|
809
|
+
token
|
|
810
|
+
) => {
|
|
811
|
+
if (!widget.supportsFileReferences) {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
const result = {
|
|
815
|
+
suggestions: []
|
|
816
|
+
};
|
|
817
|
+
if (widget.lockedAgentId) {
|
|
818
|
+
const agent = this.chatAgentService.getAgent(widget.lockedAgentId);
|
|
819
|
+
if (agent && !agent.capabilities?.supportsFileAttachments) {
|
|
820
|
+
return result;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
await this.addFileAndFolderEntries(widget, result, range, token);
|
|
824
|
+
return result;
|
|
825
|
+
}, fileWordPattern);
|
|
826
|
+
this.registerVariableCompletions("selection", (
|
|
827
|
+
{
|
|
828
|
+
widget,
|
|
829
|
+
range
|
|
830
|
+
},
|
|
831
|
+
token
|
|
832
|
+
) => {
|
|
833
|
+
if (!widget.supportsFileReferences) {
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
if (widget.location === ChatAgentLocation.EditorInline) {
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
const active = this.findActiveCodeEditor();
|
|
840
|
+
if (!isCodeEditor(active)) {
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
const currentResource = active.getModel()?.uri;
|
|
844
|
+
const currentSelection = active.getSelection();
|
|
845
|
+
if (!currentSelection || !currentResource || currentSelection.isEmpty()) {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
const basename = this.labelService.getUriBasenameLabel(currentResource);
|
|
849
|
+
const text = `${chatVariableLeader}file:${basename}:${currentSelection.startLineNumber}-${currentSelection.endLineNumber}`;
|
|
850
|
+
const fullRangeText = `:${currentSelection.startLineNumber}:${currentSelection.startColumn}-${currentSelection.endLineNumber}:${currentSelection.endColumn}`;
|
|
851
|
+
const description = this.labelService.getUriLabel(currentResource, {
|
|
852
|
+
relative: true
|
|
853
|
+
}) + fullRangeText;
|
|
854
|
+
const result = {
|
|
855
|
+
suggestions: []
|
|
856
|
+
};
|
|
857
|
+
result.suggestions.push({
|
|
858
|
+
label: {
|
|
859
|
+
label: `${chatVariableLeader}selection`,
|
|
860
|
+
description
|
|
861
|
+
},
|
|
862
|
+
filterText: `${chatVariableLeader}selection`,
|
|
863
|
+
insertText: range.varWord?.endColumn === range.replace.endColumn ? `${text} ` : text,
|
|
864
|
+
range,
|
|
865
|
+
kind: CompletionItemKind.Text,
|
|
866
|
+
sortText: "z",
|
|
867
|
+
command: {
|
|
868
|
+
id: BuiltinDynamicCompletions_1.addReferenceCommand,
|
|
869
|
+
title: "",
|
|
870
|
+
arguments: [( new ReferenceArgument(widget, {
|
|
871
|
+
id: "vscode.selection",
|
|
872
|
+
isFile: true,
|
|
873
|
+
range: {
|
|
874
|
+
startLineNumber: range.replace.startLineNumber,
|
|
875
|
+
startColumn: range.replace.startColumn,
|
|
876
|
+
endLineNumber: range.replace.endLineNumber,
|
|
877
|
+
endColumn: range.replace.startColumn + text.length
|
|
878
|
+
},
|
|
879
|
+
data: {
|
|
880
|
+
range: currentSelection,
|
|
881
|
+
uri: currentResource
|
|
882
|
+
}
|
|
883
|
+
}))]
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
return result;
|
|
887
|
+
});
|
|
888
|
+
this.registerVariableCompletions("symbol", (
|
|
889
|
+
{
|
|
890
|
+
widget,
|
|
891
|
+
range,
|
|
892
|
+
position,
|
|
893
|
+
model
|
|
894
|
+
},
|
|
895
|
+
token
|
|
896
|
+
) => {
|
|
897
|
+
if (!widget.supportsFileReferences) {
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
900
|
+
const result = {
|
|
901
|
+
suggestions: []
|
|
902
|
+
};
|
|
903
|
+
const range2 = computeCompletionRanges(model, position, ( new RegExp(`${chatVariableLeader}[^\\s]*`, "g")), true);
|
|
904
|
+
if (range2) {
|
|
905
|
+
this.addSymbolEntries(widget, result, range2, token);
|
|
906
|
+
}
|
|
907
|
+
return result;
|
|
908
|
+
});
|
|
909
|
+
this._register(
|
|
910
|
+
CommandsRegistry.registerCommand(BuiltinDynamicCompletions_1.addReferenceCommand, (_services, arg) => {
|
|
911
|
+
assertType(arg instanceof ReferenceArgument);
|
|
912
|
+
return this.cmdAddReference(arg);
|
|
913
|
+
})
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
findActiveCodeEditor() {
|
|
917
|
+
const codeEditor = this.codeEditorService.getActiveCodeEditor();
|
|
918
|
+
if (codeEditor) {
|
|
919
|
+
const model = codeEditor.getModel();
|
|
920
|
+
if (model?.uri.scheme === Schemas.vscodeNotebookCell) {
|
|
921
|
+
return undefined;
|
|
922
|
+
}
|
|
923
|
+
if (model) {
|
|
924
|
+
return codeEditor;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
for (const codeOrDiffEditor of this.editorService.getVisibleTextEditorControls(EditorsOrder.MOST_RECENTLY_ACTIVE)) {
|
|
928
|
+
const codeEditor = getCodeEditor(codeOrDiffEditor);
|
|
929
|
+
if (!codeEditor) {
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
932
|
+
const model = codeEditor.getModel();
|
|
933
|
+
if (model) {
|
|
934
|
+
return codeEditor;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return undefined;
|
|
938
|
+
}
|
|
939
|
+
registerVariableCompletions(
|
|
940
|
+
debugName,
|
|
941
|
+
provider,
|
|
942
|
+
wordPattern = BuiltinDynamicCompletions_1.VariableNameDef
|
|
943
|
+
) {
|
|
944
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
945
|
+
scheme: Schemas.vscodeChatInput,
|
|
946
|
+
hasAccessToAllModels: true
|
|
947
|
+
}, {
|
|
948
|
+
_debugDisplayName: `chatVarCompletions-${debugName}`,
|
|
949
|
+
triggerCharacters: [chatVariableLeader],
|
|
950
|
+
provideCompletionItems: async (model, position, context, token) => {
|
|
951
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
952
|
+
if (!widget) {
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
const range = computeCompletionRanges(model, position, wordPattern, true);
|
|
956
|
+
if (range) {
|
|
957
|
+
return provider({
|
|
958
|
+
model,
|
|
959
|
+
position,
|
|
960
|
+
widget,
|
|
961
|
+
range,
|
|
962
|
+
context
|
|
963
|
+
}, token);
|
|
964
|
+
}
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
}));
|
|
968
|
+
}
|
|
969
|
+
async addFileAndFolderEntries(widget, result, info, token) {
|
|
970
|
+
const makeCompletionItem = (resource, kind, description, boostPriority) => {
|
|
971
|
+
const basename = this.labelService.getUriBasenameLabel(resource);
|
|
972
|
+
const text = `${chatVariableLeader}file:${basename}`;
|
|
973
|
+
const uriLabel = this.labelService.getUriLabel(resource, {
|
|
974
|
+
relative: true
|
|
975
|
+
});
|
|
976
|
+
const labelDescription = description ? ( localize(6095, "{0} ({1})", uriLabel, description)) : uriLabel;
|
|
977
|
+
const sortText = boostPriority ? " " : "!";
|
|
978
|
+
return {
|
|
979
|
+
label: {
|
|
980
|
+
label: basename,
|
|
981
|
+
description: labelDescription
|
|
982
|
+
},
|
|
983
|
+
filterText: `${chatVariableLeader}${basename}`,
|
|
984
|
+
insertText: info.varWord?.endColumn === info.replace.endColumn ? `${text} ` : text,
|
|
985
|
+
range: info,
|
|
986
|
+
kind: kind === FileKind.FILE ? CompletionItemKind.File : CompletionItemKind.Folder,
|
|
987
|
+
sortText,
|
|
988
|
+
command: {
|
|
989
|
+
id: BuiltinDynamicCompletions_1.addReferenceCommand,
|
|
990
|
+
title: "",
|
|
991
|
+
arguments: [( new ReferenceArgument(widget, {
|
|
992
|
+
id: ( resource.toString()),
|
|
993
|
+
isFile: kind === FileKind.FILE,
|
|
994
|
+
isDirectory: kind === FileKind.FOLDER,
|
|
995
|
+
range: {
|
|
996
|
+
startLineNumber: info.replace.startLineNumber,
|
|
997
|
+
startColumn: info.replace.startColumn,
|
|
998
|
+
endLineNumber: info.replace.endLineNumber,
|
|
999
|
+
endColumn: info.replace.startColumn + text.length
|
|
1000
|
+
},
|
|
1001
|
+
data: resource
|
|
1002
|
+
}))]
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
let pattern;
|
|
1007
|
+
if (info.varWord?.word && info.varWord.word.startsWith(chatVariableLeader)) {
|
|
1008
|
+
pattern = info.varWord.word.toLowerCase().slice(1);
|
|
1009
|
+
}
|
|
1010
|
+
const seen = ( new ResourceSet());
|
|
1011
|
+
const len = result.suggestions.length;
|
|
1012
|
+
for (const [i, item] of this.historyService.getHistory().entries()) {
|
|
1013
|
+
const resource = isDiffEditorInput(item) ? item.modified.resource : item.resource;
|
|
1014
|
+
if (!resource || ( seen.has(resource)) || !this.instantiationService.invokeFunction(accessor => isSupportedChatFileScheme(accessor, resource.scheme))) {
|
|
1015
|
+
continue;
|
|
1016
|
+
}
|
|
1017
|
+
if (pattern) {
|
|
1018
|
+
const basename = this.labelService.getUriBasenameLabel(resource).toLowerCase();
|
|
1019
|
+
if (!isPatternInWord(pattern, 0, pattern.length, basename, 0, basename.length)) {
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
seen.add(resource);
|
|
1024
|
+
const newLen = result.suggestions.push(makeCompletionItem(resource, FileKind.FILE, i === 0 ? ( localize(6096, "Active file")) : undefined, i === 0));
|
|
1025
|
+
if (newLen - len >= 5) {
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
if (pattern) {
|
|
1030
|
+
const cacheKey = this.updateCacheKey();
|
|
1031
|
+
const workspaces = ( this.workspaceContextService.getWorkspace().folders.map(folder => folder.uri));
|
|
1032
|
+
for (const workspace of workspaces) {
|
|
1033
|
+
const {
|
|
1034
|
+
folders,
|
|
1035
|
+
files
|
|
1036
|
+
} = await searchFilesAndFolders(
|
|
1037
|
+
workspace,
|
|
1038
|
+
pattern,
|
|
1039
|
+
true,
|
|
1040
|
+
token,
|
|
1041
|
+
cacheKey.key,
|
|
1042
|
+
this.configurationService,
|
|
1043
|
+
this.searchService
|
|
1044
|
+
);
|
|
1045
|
+
for (const file of files) {
|
|
1046
|
+
if (!( seen.has(file))) {
|
|
1047
|
+
result.suggestions.push(makeCompletionItem(file, FileKind.FILE));
|
|
1048
|
+
seen.add(file);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
for (const folder of folders) {
|
|
1052
|
+
if (!( seen.has(folder))) {
|
|
1053
|
+
result.suggestions.push(makeCompletionItem(folder, FileKind.FOLDER));
|
|
1054
|
+
seen.add(folder);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
result.incomplete = true;
|
|
1060
|
+
}
|
|
1061
|
+
addSymbolEntries(widget, result, info, token) {
|
|
1062
|
+
const timeoutMs = 100;
|
|
1063
|
+
const stopwatch = ( new StopWatch());
|
|
1064
|
+
const makeSymbolCompletionItem = (symbolItem, pattern) => {
|
|
1065
|
+
const text = `${chatVariableLeader}sym:${symbolItem.name}`;
|
|
1066
|
+
const resource = symbolItem.location.uri;
|
|
1067
|
+
const uriLabel = this.labelService.getUriLabel(resource, {
|
|
1068
|
+
relative: true
|
|
1069
|
+
});
|
|
1070
|
+
const sortText = pattern ? "{" : "|" ;
|
|
1071
|
+
return {
|
|
1072
|
+
label: {
|
|
1073
|
+
label: symbolItem.name,
|
|
1074
|
+
description: uriLabel
|
|
1075
|
+
},
|
|
1076
|
+
filterText: `${chatVariableLeader}${symbolItem.name}`,
|
|
1077
|
+
insertText: info.varWord?.endColumn === info.replace.endColumn ? `${text} ` : text,
|
|
1078
|
+
range: info,
|
|
1079
|
+
kind: SymbolKinds.toCompletionKind(symbolItem.kind),
|
|
1080
|
+
sortText,
|
|
1081
|
+
command: {
|
|
1082
|
+
id: BuiltinDynamicCompletions_1.addReferenceCommand,
|
|
1083
|
+
title: "",
|
|
1084
|
+
arguments: [( new ReferenceArgument(widget, {
|
|
1085
|
+
id: `vscode.symbol/${JSON.stringify(symbolItem.location)}`,
|
|
1086
|
+
fullName: symbolItem.name,
|
|
1087
|
+
range: {
|
|
1088
|
+
startLineNumber: info.replace.startLineNumber,
|
|
1089
|
+
startColumn: info.replace.startColumn,
|
|
1090
|
+
endLineNumber: info.replace.endLineNumber,
|
|
1091
|
+
endColumn: info.replace.startColumn + text.length
|
|
1092
|
+
},
|
|
1093
|
+
data: symbolItem.location,
|
|
1094
|
+
icon: SymbolKinds.toIcon(symbolItem.kind)
|
|
1095
|
+
}))]
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
};
|
|
1099
|
+
let pattern;
|
|
1100
|
+
if (info.varWord?.word && info.varWord.word.startsWith(chatVariableLeader)) {
|
|
1101
|
+
pattern = info.varWord.word.toLowerCase().slice(1);
|
|
1102
|
+
}
|
|
1103
|
+
const symbolsToAdd = [];
|
|
1104
|
+
for (const outlineModel of this.outlineService.getCachedModels()) {
|
|
1105
|
+
const symbols = outlineModel.asListOfDocumentSymbols();
|
|
1106
|
+
for (const symbol of symbols) {
|
|
1107
|
+
symbolsToAdd.push({
|
|
1108
|
+
symbol,
|
|
1109
|
+
uri: outlineModel.uri
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
let timedOut = false;
|
|
1114
|
+
for (const symbol of symbolsToAdd) {
|
|
1115
|
+
if (stopwatch.elapsed() > timeoutMs || token.isCancellationRequested) {
|
|
1116
|
+
timedOut = true;
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
result.suggestions.push(makeSymbolCompletionItem({
|
|
1120
|
+
...symbol.symbol,
|
|
1121
|
+
location: {
|
|
1122
|
+
uri: symbol.uri,
|
|
1123
|
+
range: symbol.symbol.range
|
|
1124
|
+
}
|
|
1125
|
+
}, pattern ?? ""));
|
|
1126
|
+
}
|
|
1127
|
+
result.incomplete = !!pattern || timedOut;
|
|
1128
|
+
}
|
|
1129
|
+
updateCacheKey() {
|
|
1130
|
+
if (this.cacheKey && Date.now() - this.cacheKey.time > 60000) {
|
|
1131
|
+
this.searchService.clearCache(this.cacheKey.key);
|
|
1132
|
+
this.cacheKey = undefined;
|
|
1133
|
+
}
|
|
1134
|
+
if (!this.cacheKey) {
|
|
1135
|
+
this.cacheKey = {
|
|
1136
|
+
key: generateUuid(),
|
|
1137
|
+
time: Date.now()
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
this.cacheKey.time = Date.now();
|
|
1141
|
+
return this.cacheKey;
|
|
1142
|
+
}
|
|
1143
|
+
cmdAddReference(arg) {
|
|
1144
|
+
arg.widget.getContrib(ChatDynamicVariableModel.ID)?.addReference(arg.variable);
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
BuiltinDynamicCompletions = BuiltinDynamicCompletions_1 = ( __decorate([( __param(0, IHistoryService)), ( __param(1, IWorkspaceContextService)), ( __param(2, ISearchService)), ( __param(3, ILabelService)), ( __param(4, ILanguageFeaturesService)), ( __param(5, IChatWidgetService)), ( __param(6, IOutlineModelService)), ( __param(7, IEditorService)), ( __param(8, IConfigurationService)), ( __param(9, ICodeEditorService)), ( __param(10, IChatAgentService)), ( __param(11, IInstantiationService))], BuiltinDynamicCompletions));
|
|
1148
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(BuiltinDynamicCompletions, LifecyclePhase.Eventually);
|
|
1149
|
+
function computeCompletionRanges(model, position, reg, onlyOnWordStart = false) {
|
|
1150
|
+
const varWord = getWordAtText(position.column, reg, model.getLineContent(position.lineNumber), 0);
|
|
1151
|
+
if (!varWord && model.getWordUntilPosition(position).word) {
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
if (!varWord && position.column > 1) {
|
|
1155
|
+
const textBefore = model.getValueInRange(( new Range(
|
|
1156
|
+
position.lineNumber,
|
|
1157
|
+
position.column - 1,
|
|
1158
|
+
position.lineNumber,
|
|
1159
|
+
position.column
|
|
1160
|
+
)));
|
|
1161
|
+
if (textBefore !== " ") {
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
if (varWord && onlyOnWordStart) {
|
|
1166
|
+
const wordBefore = model.getWordUntilPosition({
|
|
1167
|
+
lineNumber: position.lineNumber,
|
|
1168
|
+
column: varWord.startColumn
|
|
1169
|
+
});
|
|
1170
|
+
if (wordBefore.word) {
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
let insert;
|
|
1175
|
+
let replace;
|
|
1176
|
+
if (!varWord) {
|
|
1177
|
+
insert = replace = Range.fromPositions(position);
|
|
1178
|
+
} else {
|
|
1179
|
+
insert = ( new Range(
|
|
1180
|
+
position.lineNumber,
|
|
1181
|
+
varWord.startColumn,
|
|
1182
|
+
position.lineNumber,
|
|
1183
|
+
position.column
|
|
1184
|
+
));
|
|
1185
|
+
replace = ( new Range(
|
|
1186
|
+
position.lineNumber,
|
|
1187
|
+
varWord.startColumn,
|
|
1188
|
+
position.lineNumber,
|
|
1189
|
+
varWord.endColumn
|
|
1190
|
+
));
|
|
1191
|
+
}
|
|
1192
|
+
return {
|
|
1193
|
+
insert,
|
|
1194
|
+
replace,
|
|
1195
|
+
varWord
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
function isEmptyUpToCompletionWord(model, rangeResult) {
|
|
1199
|
+
const startToCompletionWordStart = ( new Range(1, 1, rangeResult.replace.startLineNumber, rangeResult.replace.startColumn));
|
|
1200
|
+
return !!model.getValueInRange(startToCompletionWordStart).match(/^\s*$/);
|
|
1201
|
+
}
|
|
1202
|
+
let ToolCompletions = class ToolCompletions extends Disposable {
|
|
1203
|
+
static {
|
|
1204
|
+
ToolCompletions_1 = this;
|
|
1205
|
+
}
|
|
1206
|
+
static {
|
|
1207
|
+
this.VariableNameDef = ( new RegExp(`(?<=^|\\s)${chatVariableLeader}\\w*`, "g"));
|
|
1208
|
+
}
|
|
1209
|
+
constructor(languageFeaturesService, chatWidgetService, chatAgentService) {
|
|
1210
|
+
super();
|
|
1211
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
1212
|
+
this.chatWidgetService = chatWidgetService;
|
|
1213
|
+
this.chatAgentService = chatAgentService;
|
|
1214
|
+
this._register(this.languageFeaturesService.completionProvider.register({
|
|
1215
|
+
scheme: Schemas.vscodeChatInput,
|
|
1216
|
+
hasAccessToAllModels: true
|
|
1217
|
+
}, {
|
|
1218
|
+
_debugDisplayName: "chatVariables",
|
|
1219
|
+
triggerCharacters: [chatVariableLeader],
|
|
1220
|
+
provideCompletionItems: async (model, position, _context, _token) => {
|
|
1221
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
1222
|
+
if (!widget) {
|
|
1223
|
+
return null;
|
|
1224
|
+
}
|
|
1225
|
+
if (widget.lockedAgentId) {
|
|
1226
|
+
const agent = this.chatAgentService.getAgent(widget.lockedAgentId);
|
|
1227
|
+
if (agent && !agent.capabilities?.supportsToolAttachments) {
|
|
1228
|
+
return null;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
const range = computeCompletionRanges(model, position, ToolCompletions_1.VariableNameDef, true);
|
|
1232
|
+
if (!range) {
|
|
1233
|
+
return null;
|
|
1234
|
+
}
|
|
1235
|
+
const usedNames = ( new Set());
|
|
1236
|
+
for (const part of widget.parsedInput.parts) {
|
|
1237
|
+
if (part instanceof ChatRequestToolPart) {
|
|
1238
|
+
usedNames.add(part.toolName);
|
|
1239
|
+
} else if (part instanceof ChatRequestToolSetPart) {
|
|
1240
|
+
usedNames.add(part.name);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
const suggestions = [];
|
|
1244
|
+
const iter = widget.input.selectedToolsModel.entriesMap.get();
|
|
1245
|
+
for (const [item, enabled] of iter) {
|
|
1246
|
+
if (!enabled) {
|
|
1247
|
+
continue;
|
|
1248
|
+
}
|
|
1249
|
+
let detail;
|
|
1250
|
+
let documentation;
|
|
1251
|
+
let name;
|
|
1252
|
+
if (isToolSet(item)) {
|
|
1253
|
+
detail = item.description;
|
|
1254
|
+
name = item.referenceName;
|
|
1255
|
+
} else {
|
|
1256
|
+
const source = item.source;
|
|
1257
|
+
detail = ( localize(6097, "{0}: {1}", source.label, item.displayName));
|
|
1258
|
+
name = item.toolReferenceName ?? item.displayName;
|
|
1259
|
+
documentation = item.userDescription ?? item.modelDescription;
|
|
1260
|
+
}
|
|
1261
|
+
if (( usedNames.has(name))) {
|
|
1262
|
+
continue;
|
|
1263
|
+
}
|
|
1264
|
+
const withLeader = `${chatVariableLeader}${name}`;
|
|
1265
|
+
suggestions.push({
|
|
1266
|
+
label: withLeader,
|
|
1267
|
+
range,
|
|
1268
|
+
detail,
|
|
1269
|
+
documentation,
|
|
1270
|
+
insertText: withLeader + " ",
|
|
1271
|
+
kind: CompletionItemKind.Tool
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
return {
|
|
1275
|
+
suggestions
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
}));
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
ToolCompletions = ToolCompletions_1 = ( __decorate([( __param(0, ILanguageFeaturesService)), ( __param(1, IChatWidgetService)), ( __param(2, IChatAgentService))], ToolCompletions));
|
|
1282
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ToolCompletions, LifecyclePhase.Eventually);
|
|
1283
|
+
|
|
1284
|
+
export { computeCompletionRanges };
|