@codingame/monaco-vscode-chat-service-override 37.1.0 → 37.2.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 +15 -5
- package/package.json +5 -5
- package/vscode/src/vs/platform/agentHost/browser/agentHostEnablementService.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.d.ts +104 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +827 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.d.ts +15 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.js +71 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.d.ts +16 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.js +95 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.d.ts +22 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.js +286 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatInputNotification.d.ts +10 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatInputNotification.js +38 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatQuota.d.ts +9 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatQuota.js +22 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +130 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +907 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatStatus.d.ts +10 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatStatus.js +28 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.d.ts +27 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +167 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.d.ts +46 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +356 -0
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationContentExpander.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationItemProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationSyncProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostExistingSessionHarnessPickerEnablement.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPromptCacheNotification.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.js +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSettings.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSignedOutModelsNotification.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettings.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/openSessionLinkOpener.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationPresentation.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigration.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationCategories.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPromoNotification.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +1 -1
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +10 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputReferenceDecorations.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.d.ts +253 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.d.ts +300 -0
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +272 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +178 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +78 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +51 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.d.ts +67 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.js +195 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +67 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +294 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +212 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +955 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.js +122 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +65 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +698 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +78 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +77 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +120 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +23 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.d.ts +92 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.js +335 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +235 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +1673 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +202 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +872 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.js +239 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.js +143 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +298 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +177 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.d.ts +73 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +577 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +90 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +130 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.js +53 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.js +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.js +91 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +518 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +231 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCache.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCache.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCompressor.js +1 -1
|
@@ -0,0 +1,955 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { ThrottledDelayer, runWhenGlobalIdle } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
|
+
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
|
+
import { isCancellationError, onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
6
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
7
|
+
import { parse } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
|
|
8
|
+
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
9
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
10
|
+
import { revive } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshalling';
|
|
11
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
12
|
+
import { joinPath, isEqualOrParent, isEqual, normalizePath, relativePath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
13
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
14
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
15
|
+
import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
|
|
16
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
17
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
18
|
+
import { IMeteredConnectionService } from '@codingame/monaco-vscode-api/vscode/vs/platform/meteredConnection/common/meteredConnection.service';
|
|
19
|
+
import { observableMemento } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/observableMemento';
|
|
20
|
+
import { asJson } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request';
|
|
21
|
+
import { IRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service';
|
|
22
|
+
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
23
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
24
|
+
import { AutoUpdateConfigurationKey } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
25
|
+
import { IExtensionsWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/common/extensions.service';
|
|
26
|
+
import { ChatConfiguration } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
27
|
+
import { IAgentPluginRepositoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.service';
|
|
28
|
+
import { FileBackedInstalledPluginsStore } from './fileBackedInstalledPluginsStore.js';
|
|
29
|
+
import { IWorkspacePluginSettingsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.service';
|
|
30
|
+
import { IWorkspaceTrustManagementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
31
|
+
import { readAgentPluginManifest } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentPlugins/common/agentPluginParser';
|
|
32
|
+
import { readConfiguredMarketplaces, parseMarketplaceReferences, deduplicateMarketplaceReferences, parseMarketplaceReference, parseMarketplaceObjectEntry, MarketplaceReferenceKind } from './marketplaceReference.js';
|
|
33
|
+
import { getStrictKnownMarketplaces, isMarketplaceReferenceAllowed } from './strictKnownMarketplaces.js';
|
|
34
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
35
|
+
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
36
|
+
import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
37
|
+
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
38
|
+
|
|
39
|
+
var MarketplaceType;
|
|
40
|
+
(function(MarketplaceType) {
|
|
41
|
+
MarketplaceType["Copilot"] = "copilot";
|
|
42
|
+
MarketplaceType["Claude"] = "claude";
|
|
43
|
+
MarketplaceType["OpenPlugin"] = "openPlugin";
|
|
44
|
+
})(MarketplaceType || (MarketplaceType = {}));
|
|
45
|
+
var PluginSourceKind;
|
|
46
|
+
(function(PluginSourceKind) {
|
|
47
|
+
PluginSourceKind["RelativePath"] = "relativePath";
|
|
48
|
+
PluginSourceKind["GitHub"] = "github";
|
|
49
|
+
PluginSourceKind["GitUrl"] = "url";
|
|
50
|
+
PluginSourceKind["Npm"] = "npm";
|
|
51
|
+
PluginSourceKind["Pip"] = "pip";
|
|
52
|
+
})(PluginSourceKind || (PluginSourceKind = {}));
|
|
53
|
+
const MARKETPLACE_DEFINITIONS = [{
|
|
54
|
+
type: MarketplaceType.OpenPlugin,
|
|
55
|
+
path: "marketplace.json"
|
|
56
|
+
}, {
|
|
57
|
+
type: MarketplaceType.OpenPlugin,
|
|
58
|
+
path: ".plugin/marketplace.json"
|
|
59
|
+
}, {
|
|
60
|
+
type: MarketplaceType.Copilot,
|
|
61
|
+
path: ".github/plugin/marketplace.json"
|
|
62
|
+
}, {
|
|
63
|
+
type: MarketplaceType.Claude,
|
|
64
|
+
path: ".claude-plugin/marketplace.json"
|
|
65
|
+
}];
|
|
66
|
+
const SINGLE_PLUGIN_MANIFEST_DEFINITIONS = [{
|
|
67
|
+
type: MarketplaceType.OpenPlugin,
|
|
68
|
+
path: ".plugin/plugin.json"
|
|
69
|
+
}, {
|
|
70
|
+
type: MarketplaceType.Claude,
|
|
71
|
+
path: ".claude-plugin/plugin.json"
|
|
72
|
+
}, {
|
|
73
|
+
type: MarketplaceType.Copilot,
|
|
74
|
+
path: "plugin.json"
|
|
75
|
+
}];
|
|
76
|
+
const GITHUB_MARKETPLACE_CACHE_TTL_MS = 8 * 60 * 60 * 1000;
|
|
77
|
+
const GITHUB_MARKETPLACE_CACHE_STORAGE_KEY = "chat.plugins.marketplaces.githubCache.v1";
|
|
78
|
+
const PLUGIN_UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
79
|
+
const PLUGIN_UPDATE_LAST_CHECK_STORAGE_KEY = "chat.plugins.lastUpdateCheck.v1";
|
|
80
|
+
function ensureSourceDescriptor(plugin) {
|
|
81
|
+
if (plugin.sourceDescriptor) {
|
|
82
|
+
return plugin;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
...plugin,
|
|
86
|
+
sourceDescriptor: {
|
|
87
|
+
kind: PluginSourceKind.RelativePath,
|
|
88
|
+
path: plugin.source
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const trustedMarketplacesMemento = observableMemento({
|
|
93
|
+
defaultValue: [],
|
|
94
|
+
key: "chat.plugins.trustedMarketplaces.v1",
|
|
95
|
+
toStorage: value => JSON.stringify(value),
|
|
96
|
+
fromStorage: value => {
|
|
97
|
+
const parsed = JSON.parse(value);
|
|
98
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const lastFetchedPluginsMemento = observableMemento({
|
|
102
|
+
defaultValue: {
|
|
103
|
+
plugins: [],
|
|
104
|
+
fetchedAt: 0
|
|
105
|
+
},
|
|
106
|
+
key: "chat.plugins.lastFetchedPlugins.v2",
|
|
107
|
+
toStorage: value => JSON.stringify(value),
|
|
108
|
+
fromStorage: value => {
|
|
109
|
+
const parsed = JSON.parse(value);
|
|
110
|
+
if (parsed && Array.isArray(parsed.plugins)) {
|
|
111
|
+
return parsed;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
plugins: [],
|
|
115
|
+
fetchedAt: 0
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
let PluginMarketplaceService = class PluginMarketplaceService extends Disposable {
|
|
120
|
+
constructor(
|
|
121
|
+
_configurationService,
|
|
122
|
+
_requestService,
|
|
123
|
+
environmentService,
|
|
124
|
+
_fileService,
|
|
125
|
+
_pluginRepositoryService,
|
|
126
|
+
_logService,
|
|
127
|
+
_storageService,
|
|
128
|
+
_workspacePluginSettingsService,
|
|
129
|
+
_workspaceTrustService,
|
|
130
|
+
_extensionsWorkbenchService,
|
|
131
|
+
_meteredConnectionService
|
|
132
|
+
) {
|
|
133
|
+
super();
|
|
134
|
+
this._configurationService = _configurationService;
|
|
135
|
+
this._requestService = _requestService;
|
|
136
|
+
this._fileService = _fileService;
|
|
137
|
+
this._pluginRepositoryService = _pluginRepositoryService;
|
|
138
|
+
this._logService = _logService;
|
|
139
|
+
this._storageService = _storageService;
|
|
140
|
+
this._workspacePluginSettingsService = _workspacePluginSettingsService;
|
|
141
|
+
this._workspaceTrustService = _workspaceTrustService;
|
|
142
|
+
this._extensionsWorkbenchService = _extensionsWorkbenchService;
|
|
143
|
+
this._meteredConnectionService = _meteredConnectionService;
|
|
144
|
+
this._gitHubMarketplaceCache = ( new Lazy(() => this._loadPersistedGitHubMarketplaceCache()));
|
|
145
|
+
this._pluginMetadata = ( new Map());
|
|
146
|
+
this._marketplacesWithUpdates = observableValue("marketplacesWithUpdates", ( new Set()));
|
|
147
|
+
this._updateCheckDelayer = this._register(( new ThrottledDelayer(PLUGIN_UPDATE_CHECK_INTERVAL_MS)));
|
|
148
|
+
this._updateChecksInitialized = false;
|
|
149
|
+
this._updateCheckRunning = false;
|
|
150
|
+
this.marketplacesWithUpdates = this._marketplacesWithUpdates;
|
|
151
|
+
const oldCacheRoot = joinPath(environmentService.cacheHome, "agentPlugins");
|
|
152
|
+
this._installedPluginsStore = this._register(( new FileBackedInstalledPluginsStore(
|
|
153
|
+
_pluginRepositoryService.agentPluginsHome,
|
|
154
|
+
oldCacheRoot,
|
|
155
|
+
_fileService,
|
|
156
|
+
_logService,
|
|
157
|
+
_storageService
|
|
158
|
+
)));
|
|
159
|
+
this._trustedMarketplacesStore = this._register(
|
|
160
|
+
trustedMarketplacesMemento(StorageScope.APPLICATION, StorageTarget.MACHINE, _storageService)
|
|
161
|
+
);
|
|
162
|
+
this._lastFetchedPluginsStore = this._register(
|
|
163
|
+
lastFetchedPluginsMemento(StorageScope.APPLICATION, StorageTarget.MACHINE, _storageService)
|
|
164
|
+
);
|
|
165
|
+
this.lastFetchedPlugins = ( this._lastFetchedPluginsStore.map(s => {
|
|
166
|
+
const revived = revive(s);
|
|
167
|
+
return ( revived.plugins.map(ensureSourceDescriptor));
|
|
168
|
+
}));
|
|
169
|
+
this.installedPlugins = ( this._installedPluginsStore.value.map(entries => {
|
|
170
|
+
const result = [];
|
|
171
|
+
for (const e of entries) {
|
|
172
|
+
const plugin = this._pluginMetadata.get(( e.pluginUri.toString()));
|
|
173
|
+
if (plugin) {
|
|
174
|
+
result.push({
|
|
175
|
+
pluginUri: e.pluginUri,
|
|
176
|
+
plugin
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return result;
|
|
181
|
+
}));
|
|
182
|
+
const workspaceTrusted = observableFromEvent(
|
|
183
|
+
this,
|
|
184
|
+
this._workspaceTrustService.onDidChangeTrust,
|
|
185
|
+
() => this._workspaceTrustService.isWorkspaceTrusted()
|
|
186
|
+
);
|
|
187
|
+
this.recommendedPlugins = derived(reader => {
|
|
188
|
+
if (!workspaceTrusted.read(reader)) {
|
|
189
|
+
return ( new Set());
|
|
190
|
+
}
|
|
191
|
+
const enabledMap = this._workspacePluginSettingsService.enabledPlugins.read(reader);
|
|
192
|
+
const keys = ( new Set());
|
|
193
|
+
for (const [key, value] of enabledMap) {
|
|
194
|
+
if (value) {
|
|
195
|
+
keys.add(key);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return keys;
|
|
199
|
+
});
|
|
200
|
+
this.onDidChangeMarketplaces = Event.any(Event.filter(
|
|
201
|
+
_configurationService.onDidChangeConfiguration,
|
|
202
|
+
e => e.affectsConfiguration(ChatConfiguration.PluginsEnabled) || e.affectsConfiguration(ChatConfiguration.PluginMarketplaces) || e.affectsConfiguration(ChatConfiguration.ExtraMarketplaces)
|
|
203
|
+
), Event.fromObservableLight(this._workspacePluginSettingsService.extraMarketplaces), ( Event.map(this._workspaceTrustService.onDidChangeTrust, () => {})));
|
|
204
|
+
this._register(runWhenGlobalIdle(() => {
|
|
205
|
+
this._updateChecksInitialized = true;
|
|
206
|
+
this._scheduleUpdateCheck();
|
|
207
|
+
this._register(Event.filter(
|
|
208
|
+
_configurationService.onDidChangeConfiguration,
|
|
209
|
+
e => e.affectsConfiguration(AutoUpdateConfigurationKey) || e.affectsConfiguration(ChatConfiguration.ExtraMarketplaces) || e.affectsConfiguration(ChatConfiguration.StrictMarketplaces)
|
|
210
|
+
)(() => {
|
|
211
|
+
this._marketplacesWithUpdates.set(( new Set()), undefined);
|
|
212
|
+
this._scheduleUpdateCheck(0);
|
|
213
|
+
}));
|
|
214
|
+
this._register(
|
|
215
|
+
this._meteredConnectionService.onDidChangeIsConnectionMetered(isMetered => {
|
|
216
|
+
if (isMetered) {
|
|
217
|
+
this._updateCheckDelayer.cancel();
|
|
218
|
+
} else if (!this._updateCheckRunning && !this._updateCheckDelayer.isTriggered()) {
|
|
219
|
+
this._scheduleUpdateCheck();
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
}));
|
|
224
|
+
this._register(autorun(reader => {
|
|
225
|
+
const entries = this._installedPluginsStore.value.read(reader);
|
|
226
|
+
const unhydrated = entries.filter(e => !( this._pluginMetadata.has(( e.pluginUri.toString()))));
|
|
227
|
+
if (unhydrated.length > 0) {
|
|
228
|
+
this._hydratePluginMetadata(unhydrated);
|
|
229
|
+
}
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
clearUpdatesAvailable(marketplaceIds) {
|
|
233
|
+
const remaining = marketplaceIds ? ( new Set([...this._marketplacesWithUpdates.get()].filter(id => !( marketplaceIds.has(id))))) : ( new Set());
|
|
234
|
+
this._marketplacesWithUpdates.set(remaining, undefined);
|
|
235
|
+
if (remaining.size === 0 && this._updateChecksInitialized && !this._updateCheckRunning && !this._updateCheckDelayer.isTriggered()) {
|
|
236
|
+
this._scheduleUpdateCheck();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async fetchMarketplacePlugins(token, marketplaceIds, options) {
|
|
240
|
+
if (!this._configurationService.getValue(ChatConfiguration.PluginsEnabled)) {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
const {
|
|
244
|
+
effectiveValues
|
|
245
|
+
} = readConfiguredMarketplaces(this._configurationService);
|
|
246
|
+
const configRefs = parseMarketplaceReferences(effectiveValues);
|
|
247
|
+
let allRefs;
|
|
248
|
+
if (this._workspaceTrustService.isWorkspaceTrusted()) {
|
|
249
|
+
const workspaceEntries = this._workspacePluginSettingsService.extraMarketplaces.get();
|
|
250
|
+
allRefs = deduplicateMarketplaceReferences(( workspaceEntries.map(e => e.reference)), configRefs);
|
|
251
|
+
} else {
|
|
252
|
+
allRefs = configRefs;
|
|
253
|
+
}
|
|
254
|
+
for (const value of effectiveValues) {
|
|
255
|
+
const parsed = typeof value === "string" ? parseMarketplaceReference(value) : (value && typeof value === "object" ? parseMarketplaceObjectEntry(value) : undefined);
|
|
256
|
+
if (!parsed) {
|
|
257
|
+
this._logService.debug(
|
|
258
|
+
`[PluginMarketplaceService] Ignoring invalid marketplace entry: ${String(value)}`
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const refsToFetch = allRefs.filter(ref => (!marketplaceIds || ( marketplaceIds.has(ref.canonicalId))) && this._isMarketplaceAllowedByStrictPolicy(ref));
|
|
263
|
+
const results = await Promise.all(( refsToFetch.map(ref => {
|
|
264
|
+
if (ref.kind === MarketplaceReferenceKind.GitHubShorthand && ref.githubRepo) {
|
|
265
|
+
return this._fetchFromGitHubRepo(ref, ref.githubRepo, token, options);
|
|
266
|
+
}
|
|
267
|
+
return this._fetchFromClonedRepo(ref, token, options);
|
|
268
|
+
})));
|
|
269
|
+
const plugins = results.flat();
|
|
270
|
+
if (token.isCancellationRequested) {
|
|
271
|
+
return plugins;
|
|
272
|
+
}
|
|
273
|
+
const storedPlugins = marketplaceIds ? [...this.lastFetchedPlugins.get().filter(plugin => !( marketplaceIds.has(plugin.marketplaceReference.canonicalId))), ...plugins] : plugins;
|
|
274
|
+
this._lastFetchedPluginsStore.set({
|
|
275
|
+
plugins: storedPlugins,
|
|
276
|
+
fetchedAt: Date.now()
|
|
277
|
+
}, undefined);
|
|
278
|
+
return plugins;
|
|
279
|
+
}
|
|
280
|
+
async _fetchFromGitHubRepo(reference, repo, token, options) {
|
|
281
|
+
const cache = this._gitHubMarketplaceCache.value;
|
|
282
|
+
const cached = options?.refresh ? undefined : this._getCachedGitHubMarketplacePlugins(cache, reference.canonicalId);
|
|
283
|
+
if (cached) {
|
|
284
|
+
return ( cached.map(c => {
|
|
285
|
+
const plugin = ensureSourceDescriptor(c);
|
|
286
|
+
return {
|
|
287
|
+
...plugin,
|
|
288
|
+
marketplace: reference.displayLabel,
|
|
289
|
+
marketplaceReference: reference,
|
|
290
|
+
readmeUri: getMarketplaceReadmeUri(plugin.sourceDescriptor, reference, plugin.source)
|
|
291
|
+
};
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
let repoMayBePrivate = true;
|
|
295
|
+
const plugins = await this._readPluginsFromDefinitions(reference, async defPath => {
|
|
296
|
+
if (token.isCancellationRequested) {
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
const ref = encodeURIComponent(reference.ref ?? "main");
|
|
300
|
+
const url = `https://raw.githubusercontent.com/${repo}/${ref}/${defPath}`;
|
|
301
|
+
try {
|
|
302
|
+
const context = await this._requestService.request({
|
|
303
|
+
type: "GET",
|
|
304
|
+
url,
|
|
305
|
+
callSite: "pluginMarketplaceService.fetchPluginList"
|
|
306
|
+
}, token);
|
|
307
|
+
const statusCode = context.res.statusCode;
|
|
308
|
+
if (statusCode !== 200) {
|
|
309
|
+
repoMayBePrivate &&= statusCode !== undefined && statusCode >= 400 && statusCode < 500;
|
|
310
|
+
this._logService.debug(
|
|
311
|
+
`[PluginMarketplaceService] ${url} returned status ${statusCode}, skipping`
|
|
312
|
+
);
|
|
313
|
+
return undefined;
|
|
314
|
+
}
|
|
315
|
+
return (await asJson(context)) ?? undefined;
|
|
316
|
+
} catch (err) {
|
|
317
|
+
this._logService.debug(
|
|
318
|
+
`[PluginMarketplaceService] Failed to fetch marketplace.json from ${url}:`,
|
|
319
|
+
err
|
|
320
|
+
);
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
if (plugins.length > 0) {
|
|
325
|
+
cache.set(reference.canonicalId, {
|
|
326
|
+
plugins,
|
|
327
|
+
expiresAt: Date.now() + GITHUB_MARKETPLACE_CACHE_TTL_MS,
|
|
328
|
+
referenceRawValue: reference.rawValue
|
|
329
|
+
});
|
|
330
|
+
this._savePersistedGitHubMarketplaceCache(cache);
|
|
331
|
+
return plugins;
|
|
332
|
+
}
|
|
333
|
+
if (repoMayBePrivate) {
|
|
334
|
+
this._logService.debug(
|
|
335
|
+
`[PluginMarketplaceService] ${repo} may be private, attempting clone-based marketplace discovery`
|
|
336
|
+
);
|
|
337
|
+
if (cache.delete(reference.canonicalId)) {
|
|
338
|
+
this._savePersistedGitHubMarketplaceCache(cache);
|
|
339
|
+
}
|
|
340
|
+
return this._fetchFromClonedRepo(reference, token, options);
|
|
341
|
+
}
|
|
342
|
+
this._logService.debug(`[PluginMarketplaceService] No marketplace.json found in ${repo}`);
|
|
343
|
+
return [];
|
|
344
|
+
}
|
|
345
|
+
_getCachedGitHubMarketplacePlugins(cache, cacheKey) {
|
|
346
|
+
const cached = cache.get(cacheKey);
|
|
347
|
+
if (!cached) {
|
|
348
|
+
return undefined;
|
|
349
|
+
}
|
|
350
|
+
if (cached.expiresAt <= Date.now()) {
|
|
351
|
+
cache.delete(cacheKey);
|
|
352
|
+
this._savePersistedGitHubMarketplaceCache(cache);
|
|
353
|
+
return undefined;
|
|
354
|
+
}
|
|
355
|
+
return [...cached.plugins];
|
|
356
|
+
}
|
|
357
|
+
_loadPersistedGitHubMarketplaceCache() {
|
|
358
|
+
const cache = ( new Map());
|
|
359
|
+
const now = Date.now();
|
|
360
|
+
const stored = this._storageService.getObject(GITHUB_MARKETPLACE_CACHE_STORAGE_KEY, StorageScope.APPLICATION);
|
|
361
|
+
if (!stored) {
|
|
362
|
+
return cache;
|
|
363
|
+
}
|
|
364
|
+
const revived = revive(stored);
|
|
365
|
+
for (const [cacheKey, entry] of Object.entries(revived)) {
|
|
366
|
+
if (!entry || !Array.isArray(entry.plugins) || typeof entry.expiresAt !== "number" || entry.expiresAt <= now || typeof entry.referenceRawValue !== "string") {
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
const reference = parseMarketplaceReference(entry.referenceRawValue);
|
|
370
|
+
if (!reference) {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
const plugins = ( entry.plugins.map(plugin => ensureSourceDescriptor({
|
|
374
|
+
...plugin,
|
|
375
|
+
marketplace: reference.displayLabel,
|
|
376
|
+
marketplaceReference: reference
|
|
377
|
+
})));
|
|
378
|
+
cache.set(cacheKey, {
|
|
379
|
+
plugins,
|
|
380
|
+
expiresAt: entry.expiresAt,
|
|
381
|
+
referenceRawValue: entry.referenceRawValue
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
return cache;
|
|
385
|
+
}
|
|
386
|
+
_savePersistedGitHubMarketplaceCache(cache) {
|
|
387
|
+
const serialized = {};
|
|
388
|
+
for (const [cacheKey, entry] of cache) {
|
|
389
|
+
if (!entry.plugins.length || entry.expiresAt <= Date.now()) {
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
serialized[cacheKey] = {
|
|
393
|
+
expiresAt: entry.expiresAt,
|
|
394
|
+
referenceRawValue: entry.referenceRawValue,
|
|
395
|
+
plugins: entry.plugins
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
if (( Object.keys(serialized)).length === 0) {
|
|
399
|
+
this._storageService.remove(GITHUB_MARKETPLACE_CACHE_STORAGE_KEY, StorageScope.APPLICATION);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
this._storageService.store(
|
|
403
|
+
GITHUB_MARKETPLACE_CACHE_STORAGE_KEY,
|
|
404
|
+
JSON.stringify(serialized),
|
|
405
|
+
StorageScope.APPLICATION,
|
|
406
|
+
StorageTarget.MACHINE
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
getMarketplacePluginMetadata(pluginUri) {
|
|
410
|
+
return this._pluginMetadata.get(( pluginUri.toString())) ?? [...this._pluginMetadata.entries()].find(([key]) => isEqualOrParent(pluginUri, ( URI.parse(key))))?.[1];
|
|
411
|
+
}
|
|
412
|
+
addInstalledPlugin(pluginUri, plugin) {
|
|
413
|
+
this._pluginMetadata.set(( pluginUri.toString()), plugin);
|
|
414
|
+
const entry = {
|
|
415
|
+
pluginUri,
|
|
416
|
+
marketplace: plugin.marketplaceReference.rawValue,
|
|
417
|
+
name: plugin.name
|
|
418
|
+
};
|
|
419
|
+
const current = this._installedPluginsStore.get();
|
|
420
|
+
const existing = current.find(e => isEqual(e.pluginUri, pluginUri));
|
|
421
|
+
if (existing) {
|
|
422
|
+
this._installedPluginsStore.set(( current.map(c => c === existing ? entry : c)), undefined);
|
|
423
|
+
} else {
|
|
424
|
+
this._installedPluginsStore.set([...current, entry], undefined);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
removeInstalledPlugin(pluginUri) {
|
|
428
|
+
this._pluginMetadata.delete(( pluginUri.toString()));
|
|
429
|
+
const current = this._installedPluginsStore.get();
|
|
430
|
+
this._installedPluginsStore.set(current.filter(e => !isEqual(e.pluginUri, pluginUri)), undefined);
|
|
431
|
+
}
|
|
432
|
+
isMarketplaceTrusted(ref) {
|
|
433
|
+
const allowlist = getStrictKnownMarketplaces(this._configurationService.getValue(ChatConfiguration.StrictMarketplaces));
|
|
434
|
+
if (allowlist !== undefined) {
|
|
435
|
+
return isMarketplaceReferenceAllowed(allowlist, ref);
|
|
436
|
+
}
|
|
437
|
+
return this._trustedMarketplacesStore.get().includes(ref.canonicalId);
|
|
438
|
+
}
|
|
439
|
+
isStrictMarketplacePolicyActive() {
|
|
440
|
+
return getStrictKnownMarketplaces(this._configurationService.getValue(ChatConfiguration.StrictMarketplaces)) !== undefined;
|
|
441
|
+
}
|
|
442
|
+
isMarketplaceAutoUpdateEnabled(ref) {
|
|
443
|
+
const {
|
|
444
|
+
extraValues
|
|
445
|
+
} = readConfiguredMarketplaces(this._configurationService);
|
|
446
|
+
const managedRef = parseMarketplaceReferences(extraValues).find(candidate => candidate.canonicalId === ref.canonicalId);
|
|
447
|
+
return managedRef?.autoUpdate ?? this._extensionsWorkbenchService.getAutoUpdateValue() !== "off";
|
|
448
|
+
}
|
|
449
|
+
_isMarketplaceAllowedByStrictPolicy(ref) {
|
|
450
|
+
return !this.isStrictMarketplacePolicyActive() || this.isMarketplaceTrusted(ref);
|
|
451
|
+
}
|
|
452
|
+
async _hydratePluginMetadata(entries) {
|
|
453
|
+
let hydrated = 0;
|
|
454
|
+
for (const entry of entries) {
|
|
455
|
+
const key = ( entry.pluginUri.toString());
|
|
456
|
+
if (( this._pluginMetadata.has(key))) {
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
const reference = parseMarketplaceReference(entry.marketplace);
|
|
460
|
+
if (!reference) {
|
|
461
|
+
this._logService.debug(
|
|
462
|
+
`[PluginMarketplaceService] Cannot parse marketplace reference '${entry.marketplace}' for ${key}`
|
|
463
|
+
);
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
try {
|
|
467
|
+
const plugins = await this._readPluginsForInstalledEntry(reference, CancellationToken.None);
|
|
468
|
+
const match = plugins.length === 0 ? await this.readSinglePluginManifest(entry.pluginUri, reference) : plugins.find(
|
|
469
|
+
p => entry.name ? p.name === entry.name : isEqual(this._pluginRepositoryService.getPluginInstallUri(p), entry.pluginUri)
|
|
470
|
+
);
|
|
471
|
+
if (match) {
|
|
472
|
+
this._pluginMetadata.set(key, match);
|
|
473
|
+
hydrated++;
|
|
474
|
+
}
|
|
475
|
+
} catch (err) {
|
|
476
|
+
this._logService.debug(`[PluginMarketplaceService] Failed to hydrate metadata for ${key}:`, err);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
if (hydrated > 0) {
|
|
480
|
+
const current = this._installedPluginsStore.get();
|
|
481
|
+
this._installedPluginsStore.set([...current], undefined);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
async _readPluginsForInstalledEntry(reference, token) {
|
|
485
|
+
if (reference.kind === MarketplaceReferenceKind.GitHubShorthand && reference.githubRepo) {
|
|
486
|
+
return this._fetchFromGitHubRepo(reference, reference.githubRepo, token);
|
|
487
|
+
}
|
|
488
|
+
return this._readPluginsFromDirectory(
|
|
489
|
+
this._pluginRepositoryService.getRepositoryUri(reference),
|
|
490
|
+
reference,
|
|
491
|
+
token
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
_parseMarketplacePlugins(json, reference, marketplaceType, repoDir) {
|
|
495
|
+
if (!json.plugins || !Array.isArray(json.plugins)) {
|
|
496
|
+
return [];
|
|
497
|
+
}
|
|
498
|
+
return json.plugins.filter(p => typeof p.name === "string" && !!p.name).flatMap(p => {
|
|
499
|
+
const sourceDescriptor = parsePluginSource(p.source, json.metadata?.pluginRoot, {
|
|
500
|
+
pluginName: p.name,
|
|
501
|
+
logService: this._logService,
|
|
502
|
+
logPrefix: "[PluginMarketplaceService]"
|
|
503
|
+
});
|
|
504
|
+
if (!sourceDescriptor) {
|
|
505
|
+
return [];
|
|
506
|
+
}
|
|
507
|
+
const source = sourceDescriptor.kind === PluginSourceKind.RelativePath ? sourceDescriptor.path : "";
|
|
508
|
+
return [{
|
|
509
|
+
name: p.name,
|
|
510
|
+
description: p.description ?? "",
|
|
511
|
+
version: p.version ?? "",
|
|
512
|
+
source,
|
|
513
|
+
sourceDescriptor,
|
|
514
|
+
marketplace: reference.displayLabel,
|
|
515
|
+
marketplaceReference: reference,
|
|
516
|
+
marketplaceType,
|
|
517
|
+
readmeUri: getMarketplaceReadmeUri(sourceDescriptor, reference, source, repoDir)
|
|
518
|
+
}];
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
trustMarketplace(ref) {
|
|
522
|
+
const current = this._trustedMarketplacesStore.get();
|
|
523
|
+
if (!current.includes(ref.canonicalId)) {
|
|
524
|
+
this._trustedMarketplacesStore.set([...current, ref.canonicalId], undefined);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
_hasAutoUpdateEnabledMarketplace() {
|
|
528
|
+
if (this._extensionsWorkbenchService.getAutoUpdateValue() !== "off") {
|
|
529
|
+
return true;
|
|
530
|
+
}
|
|
531
|
+
const {
|
|
532
|
+
extraValues
|
|
533
|
+
} = readConfiguredMarketplaces(this._configurationService);
|
|
534
|
+
return ( parseMarketplaceReferences(extraValues).some(ref => ref.autoUpdate === true));
|
|
535
|
+
}
|
|
536
|
+
_scheduleUpdateCheck(delayOverride) {
|
|
537
|
+
this._updateCheckDelayer.cancel();
|
|
538
|
+
if (this._store.isDisposed || this._meteredConnectionService.isConnectionMetered || this._marketplacesWithUpdates.get().size > 0 || !this._hasAutoUpdateEnabledMarketplace()) {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
const lastCheck = this._storageService.getNumber(PLUGIN_UPDATE_LAST_CHECK_STORAGE_KEY, StorageScope.APPLICATION, 0);
|
|
542
|
+
const elapsed = Date.now() - lastCheck;
|
|
543
|
+
const delay = delayOverride ?? Math.max(0, PLUGIN_UPDATE_CHECK_INTERVAL_MS - elapsed);
|
|
544
|
+
this._updateCheckDelayer.trigger(async () => {
|
|
545
|
+
this._updateCheckRunning = true;
|
|
546
|
+
try {
|
|
547
|
+
await this._doRunUpdateCheck();
|
|
548
|
+
} finally {
|
|
549
|
+
this._updateCheckRunning = false;
|
|
550
|
+
if (!this._updateCheckDelayer.isTriggered()) {
|
|
551
|
+
this._scheduleUpdateCheck(PLUGIN_UPDATE_CHECK_INTERVAL_MS);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}, delay).catch(error => {
|
|
555
|
+
if (!isCancellationError(error)) {
|
|
556
|
+
onUnexpectedError(error);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
async _doRunUpdateCheck() {
|
|
561
|
+
if (this._meteredConnectionService.isConnectionMetered) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
try {
|
|
565
|
+
const installed = this.installedPlugins.get();
|
|
566
|
+
if (installed.length === 0) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
const seenMarketplaces = ( new Set());
|
|
570
|
+
const marketplacesWithUpdates = ( new Set());
|
|
571
|
+
for (const entry of installed) {
|
|
572
|
+
const ref = entry.plugin.marketplaceReference;
|
|
573
|
+
if (( seenMarketplaces.has(ref.canonicalId)) || !this.isMarketplaceAutoUpdateEnabled(ref) || !this._isMarketplaceAllowedByStrictPolicy(ref)) {
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
seenMarketplaces.add(ref.canonicalId);
|
|
577
|
+
try {
|
|
578
|
+
const behind = await this._pluginRepositoryService.fetchRepository(ref);
|
|
579
|
+
if (behind) {
|
|
580
|
+
marketplacesWithUpdates.add(ref.canonicalId);
|
|
581
|
+
}
|
|
582
|
+
} catch (err) {
|
|
583
|
+
this._logService.debug(
|
|
584
|
+
`[PluginMarketplaceService] Update check failed for ${ref.displayLabel}:`,
|
|
585
|
+
err
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
this._marketplacesWithUpdates.set(marketplacesWithUpdates, undefined);
|
|
590
|
+
this._storageService.store(
|
|
591
|
+
PLUGIN_UPDATE_LAST_CHECK_STORAGE_KEY,
|
|
592
|
+
Date.now(),
|
|
593
|
+
StorageScope.APPLICATION,
|
|
594
|
+
StorageTarget.MACHINE
|
|
595
|
+
);
|
|
596
|
+
} catch (err) {
|
|
597
|
+
this._logService.debug("[PluginMarketplaceService] Periodic update check failed:", err);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
async _fetchFromClonedRepo(reference, token, options) {
|
|
601
|
+
let repoDir;
|
|
602
|
+
try {
|
|
603
|
+
repoDir = await this._pluginRepositoryService.ensureRepository(reference, {
|
|
604
|
+
refreshIfOlderThanMs: options?.refresh ? 0 : GITHUB_MARKETPLACE_CACHE_TTL_MS,
|
|
605
|
+
token
|
|
606
|
+
});
|
|
607
|
+
} catch (err) {
|
|
608
|
+
this._logService.debug(
|
|
609
|
+
`[PluginMarketplaceService] Failed to prepare marketplace repository ${reference.rawValue}:`,
|
|
610
|
+
err
|
|
611
|
+
);
|
|
612
|
+
options?.onMarketplaceError?.(reference, err);
|
|
613
|
+
return [];
|
|
614
|
+
}
|
|
615
|
+
return this._readPluginsFromDirectory(repoDir, reference, token);
|
|
616
|
+
}
|
|
617
|
+
async readPluginsFromDirectory(repoDir, reference) {
|
|
618
|
+
return this._readPluginsFromDirectory(repoDir, reference);
|
|
619
|
+
}
|
|
620
|
+
async readSinglePluginManifest(repoDir, reference) {
|
|
621
|
+
if (reference.kind !== MarketplaceReferenceKind.GitHubShorthand && reference.kind !== MarketplaceReferenceKind.GitUri) {
|
|
622
|
+
return undefined;
|
|
623
|
+
}
|
|
624
|
+
const sourceDescriptor = reference.kind === MarketplaceReferenceKind.GitHubShorthand ? {
|
|
625
|
+
kind: PluginSourceKind.GitHub,
|
|
626
|
+
repo: reference.githubRepo
|
|
627
|
+
} : {
|
|
628
|
+
kind: PluginSourceKind.GitUrl,
|
|
629
|
+
url: reference.cloneUrl
|
|
630
|
+
};
|
|
631
|
+
const agentManifest = await readAgentPluginManifest(repoDir, this._fileService);
|
|
632
|
+
if (agentManifest) {
|
|
633
|
+
return {
|
|
634
|
+
name: agentManifest.name ?? reference.displayLabel,
|
|
635
|
+
description: agentManifest.description ?? "",
|
|
636
|
+
version: agentManifest.version ?? "",
|
|
637
|
+
source: "",
|
|
638
|
+
sourceDescriptor,
|
|
639
|
+
marketplace: reference.displayLabel,
|
|
640
|
+
marketplaceReference: reference,
|
|
641
|
+
marketplaceType: MarketplaceType.OpenPlugin
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
for (const def of SINGLE_PLUGIN_MANIFEST_DEFINITIONS) {
|
|
645
|
+
const manifestUri = joinPath(repoDir, def.path);
|
|
646
|
+
let manifest;
|
|
647
|
+
try {
|
|
648
|
+
const contents = await this._fileService.readFile(manifestUri);
|
|
649
|
+
const parsed = parse(( contents.value.toString()));
|
|
650
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
651
|
+
manifest = parsed;
|
|
652
|
+
}
|
|
653
|
+
} catch {
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
if (!manifest) {
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
const manifestName = typeof manifest["name"] === "string" && manifest["name"] ? manifest["name"] : reference.displayLabel;
|
|
660
|
+
const manifestDescription = typeof manifest["description"] === "string" ? manifest["description"] : "";
|
|
661
|
+
const manifestVersion = typeof manifest["version"] === "string" ? manifest["version"] : "";
|
|
662
|
+
return {
|
|
663
|
+
name: manifestName,
|
|
664
|
+
description: manifestDescription,
|
|
665
|
+
version: manifestVersion,
|
|
666
|
+
source: "",
|
|
667
|
+
sourceDescriptor,
|
|
668
|
+
marketplace: reference.displayLabel,
|
|
669
|
+
marketplaceReference: reference,
|
|
670
|
+
marketplaceType: def.type
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
this._logService.debug(
|
|
674
|
+
`[PluginMarketplaceService] No single-plugin manifest found in ${reference.rawValue}`
|
|
675
|
+
);
|
|
676
|
+
return undefined;
|
|
677
|
+
}
|
|
678
|
+
async isPluginDirectory(repoDir) {
|
|
679
|
+
if (await readAgentPluginManifest(repoDir, this._fileService)) {
|
|
680
|
+
return true;
|
|
681
|
+
}
|
|
682
|
+
for (const def of SINGLE_PLUGIN_MANIFEST_DEFINITIONS) {
|
|
683
|
+
if (await this._fileService.exists(joinPath(repoDir, def.path))) {
|
|
684
|
+
return true;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
async _readPluginsFromDirectory(repoDir, reference, token) {
|
|
690
|
+
return this._readPluginsFromDefinitions(reference, async defPath => {
|
|
691
|
+
if (token?.isCancellationRequested) {
|
|
692
|
+
return undefined;
|
|
693
|
+
}
|
|
694
|
+
const definitionUri = joinPath(repoDir, defPath);
|
|
695
|
+
try {
|
|
696
|
+
const contents = await this._fileService.readFile(definitionUri);
|
|
697
|
+
return parse(( contents.value.toString()));
|
|
698
|
+
} catch {
|
|
699
|
+
return undefined;
|
|
700
|
+
}
|
|
701
|
+
}, repoDir);
|
|
702
|
+
}
|
|
703
|
+
async _readPluginsFromDefinitions(reference, readJson, repoDir) {
|
|
704
|
+
for (const def of MARKETPLACE_DEFINITIONS) {
|
|
705
|
+
const json = await readJson(def.path);
|
|
706
|
+
if (!json?.plugins || !Array.isArray(json.plugins)) {
|
|
707
|
+
continue;
|
|
708
|
+
}
|
|
709
|
+
return this._parseMarketplacePlugins(json, reference, def.type, repoDir);
|
|
710
|
+
}
|
|
711
|
+
this._logService.debug(
|
|
712
|
+
`[PluginMarketplaceService] No marketplace.json found in ${reference.rawValue}`
|
|
713
|
+
);
|
|
714
|
+
return [];
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
PluginMarketplaceService = ( __decorate([( __param(0, IConfigurationService)), ( __param(1, IRequestService)), ( __param(2, IEnvironmentService)), ( __param(3, IFileService)), ( __param(4, IAgentPluginRepositoryService)), ( __param(5, ILogService)), ( __param(6, IStorageService)), ( __param(7, IWorkspacePluginSettingsService)), ( __param(8, IWorkspaceTrustManagementService)), ( __param(9, IExtensionsWorkbenchService)), ( __param(10, IMeteredConnectionService))], PluginMarketplaceService));
|
|
718
|
+
function normalizeMarketplacePath(value) {
|
|
719
|
+
let normalized = value.trim().replace(/\\/g, "/");
|
|
720
|
+
normalized = normalized.replace(/^\.?\/+/, "").replace(/\/+$/g, "");
|
|
721
|
+
return normalized;
|
|
722
|
+
}
|
|
723
|
+
function resolvePluginSource(pluginRoot, source) {
|
|
724
|
+
const normalizedRoot = pluginRoot ? normalizeMarketplacePath(pluginRoot) : "";
|
|
725
|
+
const normalizedSource = normalizeMarketplacePath(source);
|
|
726
|
+
const repoRoot = URI.file("/");
|
|
727
|
+
const pluginRootUri = normalizedRoot ? normalizePath(joinPath(repoRoot, normalizedRoot)) : repoRoot;
|
|
728
|
+
if (normalizedRoot && (normalizedSource === normalizedRoot || normalizedSource.startsWith(`${normalizedRoot}/`))) {
|
|
729
|
+
return normalizedSource;
|
|
730
|
+
}
|
|
731
|
+
const resolvedUri = normalizePath(joinPath(pluginRootUri, normalizedSource));
|
|
732
|
+
return relativePath(repoRoot, resolvedUri) ?? undefined;
|
|
733
|
+
}
|
|
734
|
+
function parsePluginSource(rawSource, pluginRoot, logContext) {
|
|
735
|
+
if (rawSource === undefined || rawSource === null) {
|
|
736
|
+
const resolved = resolvePluginSource(pluginRoot, "");
|
|
737
|
+
if (resolved === undefined) {
|
|
738
|
+
return undefined;
|
|
739
|
+
}
|
|
740
|
+
return {
|
|
741
|
+
kind: PluginSourceKind.RelativePath,
|
|
742
|
+
path: resolved
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
if (typeof rawSource === "string") {
|
|
746
|
+
const resolved = resolvePluginSource(pluginRoot, rawSource);
|
|
747
|
+
if (resolved === undefined) {
|
|
748
|
+
return undefined;
|
|
749
|
+
}
|
|
750
|
+
return {
|
|
751
|
+
kind: PluginSourceKind.RelativePath,
|
|
752
|
+
path: resolved
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
if (typeof rawSource !== "object" || typeof rawSource.source !== "string") {
|
|
756
|
+
logContext.logService.warn(
|
|
757
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': source object is missing a 'source' discriminant`
|
|
758
|
+
);
|
|
759
|
+
return undefined;
|
|
760
|
+
}
|
|
761
|
+
switch (rawSource.source) {
|
|
762
|
+
case "github":
|
|
763
|
+
{
|
|
764
|
+
if (typeof rawSource.repo !== "string" || !rawSource.repo) {
|
|
765
|
+
logContext.logService.warn(
|
|
766
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': github source is missing required 'repo' field`
|
|
767
|
+
);
|
|
768
|
+
return undefined;
|
|
769
|
+
}
|
|
770
|
+
if (!isValidGitHubRepo(rawSource.repo)) {
|
|
771
|
+
logContext.logService.warn(
|
|
772
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': github source repo must be in 'owner/repo' format`
|
|
773
|
+
);
|
|
774
|
+
return undefined;
|
|
775
|
+
}
|
|
776
|
+
if (!isOptionalString(rawSource.ref)) {
|
|
777
|
+
logContext.logService.warn(
|
|
778
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': github source 'ref' must be a string when provided`
|
|
779
|
+
);
|
|
780
|
+
return undefined;
|
|
781
|
+
}
|
|
782
|
+
if (!isOptionalGitSha(rawSource.sha)) {
|
|
783
|
+
logContext.logService.warn(
|
|
784
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': github source 'sha' must be a full 40-character commit hash when provided`
|
|
785
|
+
);
|
|
786
|
+
return undefined;
|
|
787
|
+
}
|
|
788
|
+
if (!isOptionalString(rawSource.path)) {
|
|
789
|
+
logContext.logService.warn(
|
|
790
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': github source 'path' must be a string when provided`
|
|
791
|
+
);
|
|
792
|
+
return undefined;
|
|
793
|
+
}
|
|
794
|
+
return {
|
|
795
|
+
kind: PluginSourceKind.GitHub,
|
|
796
|
+
repo: rawSource.repo,
|
|
797
|
+
ref: rawSource.ref,
|
|
798
|
+
sha: rawSource.sha,
|
|
799
|
+
path: rawSource.path
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
case "url":
|
|
803
|
+
case "git-subdir":
|
|
804
|
+
{
|
|
805
|
+
if (typeof rawSource.url !== "string" || !rawSource.url) {
|
|
806
|
+
logContext.logService.warn(
|
|
807
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': ${rawSource.source} source is missing required 'url' field`
|
|
808
|
+
);
|
|
809
|
+
return undefined;
|
|
810
|
+
}
|
|
811
|
+
if (rawSource.source === "url" && !rawSource.url.toLowerCase().endsWith(".git")) {
|
|
812
|
+
logContext.logService.warn(
|
|
813
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': url source must end with '.git'`
|
|
814
|
+
);
|
|
815
|
+
return undefined;
|
|
816
|
+
}
|
|
817
|
+
if (!isOptionalString(rawSource.ref)) {
|
|
818
|
+
logContext.logService.warn(
|
|
819
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': ${rawSource.source} source 'ref' must be a string when provided`
|
|
820
|
+
);
|
|
821
|
+
return undefined;
|
|
822
|
+
}
|
|
823
|
+
if (!isOptionalGitSha(rawSource.sha)) {
|
|
824
|
+
logContext.logService.warn(
|
|
825
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': ${rawSource.source} source 'sha' must be a full 40-character commit hash when provided`
|
|
826
|
+
);
|
|
827
|
+
return undefined;
|
|
828
|
+
}
|
|
829
|
+
if (rawSource.source === "git-subdir") {
|
|
830
|
+
if (typeof rawSource.path !== "string" || !rawSource.path) {
|
|
831
|
+
logContext.logService.warn(
|
|
832
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': git-subdir source is missing required 'path' field`
|
|
833
|
+
);
|
|
834
|
+
return undefined;
|
|
835
|
+
}
|
|
836
|
+
} else if (!isOptionalString(rawSource.path)) {
|
|
837
|
+
logContext.logService.warn(
|
|
838
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': url source 'path' must be a string when provided`
|
|
839
|
+
);
|
|
840
|
+
return undefined;
|
|
841
|
+
}
|
|
842
|
+
return {
|
|
843
|
+
kind: PluginSourceKind.GitUrl,
|
|
844
|
+
url: rawSource.url,
|
|
845
|
+
ref: rawSource.ref,
|
|
846
|
+
sha: rawSource.sha,
|
|
847
|
+
path: rawSource.path
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
case "npm":
|
|
851
|
+
{
|
|
852
|
+
if (typeof rawSource.package !== "string" || !rawSource.package) {
|
|
853
|
+
logContext.logService.warn(
|
|
854
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': npm source is missing required 'package' field`
|
|
855
|
+
);
|
|
856
|
+
return undefined;
|
|
857
|
+
}
|
|
858
|
+
if (!isOptionalString(rawSource.version) || !isOptionalString(rawSource.registry)) {
|
|
859
|
+
logContext.logService.warn(
|
|
860
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': npm source 'version' and 'registry' must be strings when provided`
|
|
861
|
+
);
|
|
862
|
+
return undefined;
|
|
863
|
+
}
|
|
864
|
+
return {
|
|
865
|
+
kind: PluginSourceKind.Npm,
|
|
866
|
+
package: rawSource.package,
|
|
867
|
+
version: rawSource.version,
|
|
868
|
+
registry: rawSource.registry
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
case "pip":
|
|
872
|
+
{
|
|
873
|
+
if (typeof rawSource.package !== "string" || !rawSource.package) {
|
|
874
|
+
logContext.logService.warn(
|
|
875
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': pip source is missing required 'package' field`
|
|
876
|
+
);
|
|
877
|
+
return undefined;
|
|
878
|
+
}
|
|
879
|
+
if (!isOptionalString(rawSource.version) || !isOptionalString(rawSource.registry)) {
|
|
880
|
+
logContext.logService.warn(
|
|
881
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': pip source 'version' and 'registry' must be strings when provided`
|
|
882
|
+
);
|
|
883
|
+
return undefined;
|
|
884
|
+
}
|
|
885
|
+
return {
|
|
886
|
+
kind: PluginSourceKind.Pip,
|
|
887
|
+
package: rawSource.package,
|
|
888
|
+
version: rawSource.version,
|
|
889
|
+
registry: rawSource.registry
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
default:
|
|
893
|
+
logContext.logService.warn(
|
|
894
|
+
`${logContext.logPrefix} Skipping plugin '${logContext.pluginName}': unknown source kind '${rawSource.source}'`
|
|
895
|
+
);
|
|
896
|
+
return undefined;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
function isOptionalString(value) {
|
|
900
|
+
return value === undefined || typeof value === "string";
|
|
901
|
+
}
|
|
902
|
+
function isOptionalGitSha(value) {
|
|
903
|
+
return value === undefined || (typeof value === "string" && /^[0-9a-fA-F]{40}$/.test(value));
|
|
904
|
+
}
|
|
905
|
+
function isValidGitHubRepo(repo) {
|
|
906
|
+
return /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo);
|
|
907
|
+
}
|
|
908
|
+
function hasSourceChanged(installed, marketplace) {
|
|
909
|
+
if (installed.kind !== marketplace.kind) {
|
|
910
|
+
return true;
|
|
911
|
+
}
|
|
912
|
+
switch (installed.kind) {
|
|
913
|
+
case PluginSourceKind.GitHub:
|
|
914
|
+
return installed.ref !== marketplace.ref || installed.sha !== marketplace.sha || installed.path !== marketplace.path;
|
|
915
|
+
case PluginSourceKind.GitUrl:
|
|
916
|
+
return installed.ref !== marketplace.ref || installed.sha !== marketplace.sha || installed.path !== marketplace.path;
|
|
917
|
+
case PluginSourceKind.Npm:
|
|
918
|
+
return installed.version !== marketplace.version;
|
|
919
|
+
case PluginSourceKind.Pip:
|
|
920
|
+
return installed.version !== marketplace.version;
|
|
921
|
+
default:
|
|
922
|
+
return false;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
function getMarketplaceReadmeUri(sourceDescriptor, reference, source, repoDir) {
|
|
926
|
+
if (sourceDescriptor.kind === PluginSourceKind.GitHub) {
|
|
927
|
+
const ref = sourceDescriptor.sha ?? sourceDescriptor.ref ?? "main";
|
|
928
|
+
const normalizedPath = sourceDescriptor.path?.trim().replace(/^\.?\/+|\/+$/g, "");
|
|
929
|
+
const readmePath = normalizedPath ? `${normalizedPath}/README.md` : "README.md";
|
|
930
|
+
return ( URI.parse(`https://github.com/${sourceDescriptor.repo}/blob/${ref}/${readmePath}`));
|
|
931
|
+
}
|
|
932
|
+
if (sourceDescriptor.kind === PluginSourceKind.GitUrl && sourceDescriptor.url.startsWith("https://github.com/")) {
|
|
933
|
+
const repo = sourceDescriptor.url.replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "");
|
|
934
|
+
const ref = sourceDescriptor.sha ?? sourceDescriptor.ref ?? "main";
|
|
935
|
+
const normalizedPath = sourceDescriptor.path?.trim().replace(/^\.?\/+|\/+$/g, "");
|
|
936
|
+
const readmePath = normalizedPath ? `${normalizedPath}/README.md` : "README.md";
|
|
937
|
+
return ( URI.parse(`https://github.com/${repo}/blob/${ref}/${readmePath}`));
|
|
938
|
+
}
|
|
939
|
+
if (repoDir) {
|
|
940
|
+
return getMarketplaceReadmeFileUri(repoDir, source);
|
|
941
|
+
}
|
|
942
|
+
if (!reference.githubRepo) {
|
|
943
|
+
return undefined;
|
|
944
|
+
}
|
|
945
|
+
const normalizedSource = source.trim().replace(/^\.?\/+|\/+$/g, "");
|
|
946
|
+
const readmePath = normalizedSource ? `${normalizedSource}/README.md` : "README.md";
|
|
947
|
+
const ref = reference.ref ?? "main";
|
|
948
|
+
return ( URI.parse(`https://github.com/${reference.githubRepo}/blob/${ref}/${readmePath}`));
|
|
949
|
+
}
|
|
950
|
+
function getMarketplaceReadmeFileUri(repoDir, source) {
|
|
951
|
+
const normalizedSource = source.trim().replace(/^\.?\/+|\/+$/g, "");
|
|
952
|
+
return normalizedSource ? joinPath(repoDir, normalizedSource, "README.md") : joinPath(repoDir, "README.md");
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
export { MarketplaceReferenceKind, MarketplaceType, PluginMarketplaceService, PluginSourceKind, deduplicateMarketplaceReferences, hasSourceChanged, parseMarketplaceReference, parseMarketplaceReferences, parsePluginSource, readConfiguredMarketplaces };
|