@codingame/monaco-vscode-chat-service-override 30.0.0 → 31.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 +21 -3
- package/package.json +5 -5
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.d.ts +125 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.js +393 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.d.ts +65 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +453 -0
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.d.ts +28 -0
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.js +81 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.d.ts +75 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.js +180 -0
- package/vscode/src/vs/platform/agentHost/common/agentService.d.ts +202 -51
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.d.ts +182 -0
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.js +282 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.d.ts +303 -32
- package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.js +14 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/errors.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/common/state/protocol/errors.js +9 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.d.ts +30 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.js +662 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +12 -5
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.js +9 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionCapabilities.d.ts +17 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionCapabilities.js +5 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.d.ts +5 -5
- package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.js +14 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionTransport.d.ts +42 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionTransport.js +7 -0
- package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.d.ts +118 -0
- package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.js +551 -0
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.d.ts +22 -0
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +59 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +17 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +113 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +81 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.js +47 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +15 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +13 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +15 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +58 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +24 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +29 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.js +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +65 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +4 -4
- 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 +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +28 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +80 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +20 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +30 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +131 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +363 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +31 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +374 -764
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.js +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +222 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +20 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +269 -123
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.js +249 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.js +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +5 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +14 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +113 -58
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +202 -68
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationWelcomePromptLaunchers.css +246 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +162 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.js +306 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +581 -257
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.d.ts +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +245 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +25 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +3 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +103 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowLayout.js +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +80 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.d.ts +20 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +128 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +23 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +28 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/media/chatDebug.css +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +10 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +4 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +4 -310
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +3 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +61 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatManagementEditor.css +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +31 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +46 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +17 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +96 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +21 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +15 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +315 -263
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +196 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +56 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipEligibilityTracker.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +8 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +26 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +48 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +26 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.d.ts +11 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +226 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/telemetry/chatModelCountTelemetry.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/telemetry/chatModelCountTelemetry.js +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +108 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +24 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.js +9 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +21 -80
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +26 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +46 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.js +60 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +32 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +152 -26
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +5 -9
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +265 -261
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.d.ts +28 -2
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.js +75 -7
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +9 -1
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.js +32 -4
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +10 -25
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +7 -52
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +58 -466
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +36 -18
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +168 -182
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +49 -29
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +491 -462
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +16 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +18 -12
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatArtifactsService.d.ts +24 -4
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatArtifactsService.js +145 -68
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.js +19 -17
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +5 -17
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +77 -157
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +17 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +21 -21
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +29 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +12 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +49 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +9 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +13 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +319 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +15 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +8 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +15 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +2 -2
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostFileSystemService.d.ts +21 -0
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostFileSystemService.js +35 -0
- package/vscode/src/vs/platform/agentHost/common/agentService.service.d.ts +0 -94
- package/vscode/src/vs/platform/agentHost/common/state/protocol/action-origin.generated.d.ts +0 -16
- package/vscode/src/vs/platform/agentHost/common/state/protocol/actions.d.ts +0 -578
- package/vscode/src/vs/platform/agentHost/common/state/protocol/messages.d.ts +0 -206
- package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.d.ts +0 -114
- package/vscode/src/vs/platform/agentHost/common/state/protocol/state.d.ts +0 -860
- package/vscode/src/vs/platform/agentHost/common/state/sessionState.d.ts +0 -27
- package/vscode/src/vs/platform/browserElements/common/browserElements.d.ts +0 -58
- package/vscode/src/vs/platform/browserElements/common/browserElements.js +0 -16
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.d.ts +0 -18
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.js +0 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/media/simpleBrowserOverlay.css +0 -85
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.js +0 -443
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +0 -132
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatUsageWidget.css +0 -69
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +0 -66
- package/vscode/src/vs/workbench/contrib/chat/common/chatArtifactExtraction.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/common/chatArtifactExtraction.js +0 -158
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.js +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/commandFileWriteParser.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.js +0 -142
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +0 -164
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +0 -163
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +0 -142
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +0 -137
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +0 -174
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +0 -39
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +0 -32
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +0 -249
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +0 -92
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +0 -209
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/awaitTerminalTool.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/awaitTerminalTool.js +0 -106
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.js +0 -392
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +0 -243
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +0 -52
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.js +0 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +0 -310
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +0 -168
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.js +0 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/commandLinePresenter.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.js +0 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.js +0 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.js +0 -44
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.js +0 -21
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +0 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.d.ts +0 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.js +0 -29
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.js +0 -33
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.js +0 -28
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +0 -118
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +0 -1019
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +0 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.js +0 -23
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/outputAnalyzer.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +0 -150
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +0 -1619
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +0 -118
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/toolIds.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/toolIds.js +0 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +0 -130
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +0 -122
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +0 -482
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { structuralEquals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/equals';
|
|
4
|
-
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { regExpLeadsToEndlessLoop, escapeRegExpCharacters } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
6
|
-
import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
7
|
-
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
8
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
9
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
|
-
import { ITerminalChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
11
|
-
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
12
|
-
import { isPowerShell } from '../../../runInTerminalHelpers.js';
|
|
13
|
-
import { NpmScriptAutoApprover } from './npmScriptAutoApprover.js';
|
|
14
|
-
|
|
15
|
-
const neverMatchRegex = /(?!.*)/;
|
|
16
|
-
const transientEnvVarRegex = /^[A-Z_][A-Z0-9_]*=/i;
|
|
17
|
-
let CommandLineAutoApprover = class CommandLineAutoApprover extends Disposable {
|
|
18
|
-
constructor(_configurationService, instantiationService, _terminalChatService) {
|
|
19
|
-
super();
|
|
20
|
-
this._configurationService = _configurationService;
|
|
21
|
-
this._terminalChatService = _terminalChatService;
|
|
22
|
-
this._denyListRules = [];
|
|
23
|
-
this._allowListRules = [];
|
|
24
|
-
this._allowListCommandLineRules = [];
|
|
25
|
-
this._denyListCommandLineRules = [];
|
|
26
|
-
this._npmScriptAutoApprover = this._register(instantiationService.createInstance(NpmScriptAutoApprover));
|
|
27
|
-
this.updateConfiguration();
|
|
28
|
-
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
|
29
|
-
if (e.affectsConfiguration(TerminalChatAgentToolsSettingId.AutoApprove) || e.affectsConfiguration(TerminalChatAgentToolsSettingId.IgnoreDefaultAutoApproveRules) || e.affectsConfiguration(TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible)) {
|
|
30
|
-
this.updateConfiguration();
|
|
31
|
-
}
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
updateConfiguration() {
|
|
35
|
-
let configValue = this._configurationService.getValue(TerminalChatAgentToolsSettingId.AutoApprove);
|
|
36
|
-
const configInspectValue = this._configurationService.inspect(TerminalChatAgentToolsSettingId.AutoApprove);
|
|
37
|
-
const deprecatedValue = this._configurationService.getValue(TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible);
|
|
38
|
-
if (deprecatedValue && typeof deprecatedValue === "object" && configValue && typeof configValue === "object") {
|
|
39
|
-
configValue = {
|
|
40
|
-
...configValue,
|
|
41
|
-
...deprecatedValue
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
const {
|
|
45
|
-
denyListRules,
|
|
46
|
-
allowListRules,
|
|
47
|
-
allowListCommandLineRules,
|
|
48
|
-
denyListCommandLineRules
|
|
49
|
-
} = this._mapAutoApproveConfigToRules(configValue, configInspectValue);
|
|
50
|
-
this._allowListRules = allowListRules;
|
|
51
|
-
this._denyListRules = denyListRules;
|
|
52
|
-
this._allowListCommandLineRules = allowListCommandLineRules;
|
|
53
|
-
this._denyListCommandLineRules = denyListCommandLineRules;
|
|
54
|
-
}
|
|
55
|
-
async isCommandAutoApproved(command, shell, os, cwd, chatSessionResource) {
|
|
56
|
-
if (transientEnvVarRegex.test(command)) {
|
|
57
|
-
return {
|
|
58
|
-
result: "denied",
|
|
59
|
-
reason: `Command '${command}' is denied because it contains transient environment variables`
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
for (const rule of this._denyListRules) {
|
|
63
|
-
if (this._commandMatchesRule(rule, command, shell, os)) {
|
|
64
|
-
return {
|
|
65
|
-
result: "denied",
|
|
66
|
-
rule,
|
|
67
|
-
reason: `Command '${command}' is denied by deny list rule: ${rule.sourceText}`
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
for (const rule of this._getSessionRules(chatSessionResource).allowListRules) {
|
|
72
|
-
if (this._commandMatchesRule(rule, command, shell, os)) {
|
|
73
|
-
return {
|
|
74
|
-
result: "approved",
|
|
75
|
-
rule,
|
|
76
|
-
reason: `Command '${command}' is approved by session allow list rule: ${rule.sourceText}`
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
for (const rule of this._allowListRules) {
|
|
81
|
-
if (this._commandMatchesRule(rule, command, shell, os)) {
|
|
82
|
-
return {
|
|
83
|
-
result: "approved",
|
|
84
|
-
rule,
|
|
85
|
-
reason: `Command '${command}' is approved by allow list rule: ${rule.sourceText}`
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const npmScriptResult = await this._npmScriptAutoApprover.isCommandAutoApproved(command, cwd);
|
|
90
|
-
if (npmScriptResult.isAutoApproved) {
|
|
91
|
-
return {
|
|
92
|
-
result: "approved",
|
|
93
|
-
rule: {
|
|
94
|
-
type: "npmScript",
|
|
95
|
-
npmScriptResult
|
|
96
|
-
},
|
|
97
|
-
reason: `Command '${command}' is approved as npm script '${npmScriptResult.scriptName}' is defined in package.json`
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
result: "noMatch",
|
|
102
|
-
reason: `Command '${command}' has no matching auto approve entries`
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
isCommandLineAutoApproved(commandLine, chatSessionResource) {
|
|
106
|
-
for (const rule of this._denyListCommandLineRules) {
|
|
107
|
-
if (rule.regex.test(commandLine)) {
|
|
108
|
-
return {
|
|
109
|
-
result: "denied",
|
|
110
|
-
rule,
|
|
111
|
-
reason: `Command line '${commandLine}' is denied by deny list rule: ${rule.sourceText}`
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
for (const rule of this._getSessionRules(chatSessionResource).allowListCommandLineRules) {
|
|
116
|
-
if (rule.regex.test(commandLine)) {
|
|
117
|
-
return {
|
|
118
|
-
result: "approved",
|
|
119
|
-
rule,
|
|
120
|
-
reason: `Command line '${commandLine}' is approved by session allow list rule: ${rule.sourceText}`
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
for (const rule of this._allowListCommandLineRules) {
|
|
125
|
-
if (rule.regex.test(commandLine)) {
|
|
126
|
-
return {
|
|
127
|
-
result: "approved",
|
|
128
|
-
rule,
|
|
129
|
-
reason: `Command line '${commandLine}' is approved by allow list rule: ${rule.sourceText}`
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
result: "noMatch",
|
|
135
|
-
reason: `Command line '${commandLine}' has no matching auto approve entries`
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
_getSessionRules(chatSessionResource) {
|
|
139
|
-
const denyListRules = [];
|
|
140
|
-
const allowListRules = [];
|
|
141
|
-
const allowListCommandLineRules = [];
|
|
142
|
-
const denyListCommandLineRules = [];
|
|
143
|
-
if (!chatSessionResource) {
|
|
144
|
-
return {
|
|
145
|
-
denyListRules,
|
|
146
|
-
allowListRules,
|
|
147
|
-
allowListCommandLineRules,
|
|
148
|
-
denyListCommandLineRules
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
const sessionRulesConfig = this._terminalChatService.getSessionAutoApproveRules(chatSessionResource);
|
|
152
|
-
for (const [key, value] of Object.entries(sessionRulesConfig)) {
|
|
153
|
-
if (typeof value === "boolean") {
|
|
154
|
-
const {
|
|
155
|
-
regex,
|
|
156
|
-
regexCaseInsensitive
|
|
157
|
-
} = this._convertAutoApproveEntryToRegex(key);
|
|
158
|
-
if (value === true) {
|
|
159
|
-
allowListRules.push({
|
|
160
|
-
regex,
|
|
161
|
-
regexCaseInsensitive,
|
|
162
|
-
sourceText: key,
|
|
163
|
-
sourceTarget: "session",
|
|
164
|
-
isDefaultRule: false
|
|
165
|
-
});
|
|
166
|
-
} else if (value === false) {
|
|
167
|
-
denyListRules.push({
|
|
168
|
-
regex,
|
|
169
|
-
regexCaseInsensitive,
|
|
170
|
-
sourceText: key,
|
|
171
|
-
sourceTarget: "session",
|
|
172
|
-
isDefaultRule: false
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
} else if (typeof value === "object" && value !== null) {
|
|
176
|
-
const objectValue = value;
|
|
177
|
-
if (typeof objectValue.approve === "boolean") {
|
|
178
|
-
const {
|
|
179
|
-
regex,
|
|
180
|
-
regexCaseInsensitive
|
|
181
|
-
} = this._convertAutoApproveEntryToRegex(key);
|
|
182
|
-
if (objectValue.approve === true) {
|
|
183
|
-
if (objectValue.matchCommandLine === true) {
|
|
184
|
-
allowListCommandLineRules.push({
|
|
185
|
-
regex,
|
|
186
|
-
regexCaseInsensitive,
|
|
187
|
-
sourceText: key,
|
|
188
|
-
sourceTarget: "session",
|
|
189
|
-
isDefaultRule: false
|
|
190
|
-
});
|
|
191
|
-
} else {
|
|
192
|
-
allowListRules.push({
|
|
193
|
-
regex,
|
|
194
|
-
regexCaseInsensitive,
|
|
195
|
-
sourceText: key,
|
|
196
|
-
sourceTarget: "session",
|
|
197
|
-
isDefaultRule: false
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
} else if (objectValue.approve === false) {
|
|
201
|
-
if (objectValue.matchCommandLine === true) {
|
|
202
|
-
denyListCommandLineRules.push({
|
|
203
|
-
regex,
|
|
204
|
-
regexCaseInsensitive,
|
|
205
|
-
sourceText: key,
|
|
206
|
-
sourceTarget: "session",
|
|
207
|
-
isDefaultRule: false
|
|
208
|
-
});
|
|
209
|
-
} else {
|
|
210
|
-
denyListRules.push({
|
|
211
|
-
regex,
|
|
212
|
-
regexCaseInsensitive,
|
|
213
|
-
sourceText: key,
|
|
214
|
-
sourceTarget: "session",
|
|
215
|
-
isDefaultRule: false
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return {
|
|
223
|
-
denyListRules,
|
|
224
|
-
allowListRules,
|
|
225
|
-
allowListCommandLineRules,
|
|
226
|
-
denyListCommandLineRules
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
_commandMatchesRule(rule, command, shell, os) {
|
|
230
|
-
const isPwsh = isPowerShell(shell, os);
|
|
231
|
-
if ((isPwsh ? rule.regexCaseInsensitive : rule.regex).test(command)) {
|
|
232
|
-
return true;
|
|
233
|
-
} else if (isPwsh && command.startsWith("(")) {
|
|
234
|
-
if (rule.regexCaseInsensitive.test(command.slice(1))) {
|
|
235
|
-
return true;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
_mapAutoApproveConfigToRules(config, configInspectValue) {
|
|
241
|
-
if (!config || typeof config !== "object") {
|
|
242
|
-
return {
|
|
243
|
-
denyListRules: [],
|
|
244
|
-
allowListRules: [],
|
|
245
|
-
allowListCommandLineRules: [],
|
|
246
|
-
denyListCommandLineRules: []
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
const denyListRules = [];
|
|
250
|
-
const allowListRules = [];
|
|
251
|
-
const allowListCommandLineRules = [];
|
|
252
|
-
const denyListCommandLineRules = [];
|
|
253
|
-
const ignoreDefaults = this._configurationService.getValue(TerminalChatAgentToolsSettingId.IgnoreDefaultAutoApproveRules) === true;
|
|
254
|
-
for (const [key, value] of Object.entries(config)) {
|
|
255
|
-
const defaultValue = configInspectValue?.default?.value;
|
|
256
|
-
const isDefaultRule = !!(isObject(defaultValue) && Object.prototype.hasOwnProperty.call(defaultValue, key) && structuralEquals(defaultValue[key], value));
|
|
257
|
-
function checkTarget(inspectValue) {
|
|
258
|
-
return (isObject(inspectValue) && Object.prototype.hasOwnProperty.call(inspectValue, key) && structuralEquals(inspectValue[key], value));
|
|
259
|
-
}
|
|
260
|
-
const sourceTarget = (checkTarget(configInspectValue.workspaceFolder) ? ConfigurationTarget.WORKSPACE_FOLDER : checkTarget(configInspectValue.workspaceValue) ? ConfigurationTarget.WORKSPACE : checkTarget(configInspectValue.userRemoteValue) ? ConfigurationTarget.USER_REMOTE : checkTarget(configInspectValue.userLocalValue) ? ConfigurationTarget.USER_LOCAL : checkTarget(configInspectValue.userValue) ? ConfigurationTarget.USER : checkTarget(configInspectValue.applicationValue) ? ConfigurationTarget.APPLICATION : ConfigurationTarget.DEFAULT);
|
|
261
|
-
if (ignoreDefaults && isDefaultRule && sourceTarget === ConfigurationTarget.DEFAULT) {
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
if (typeof value === "boolean") {
|
|
265
|
-
const {
|
|
266
|
-
regex,
|
|
267
|
-
regexCaseInsensitive
|
|
268
|
-
} = this._convertAutoApproveEntryToRegex(key);
|
|
269
|
-
if (value === true) {
|
|
270
|
-
allowListRules.push({
|
|
271
|
-
regex,
|
|
272
|
-
regexCaseInsensitive,
|
|
273
|
-
sourceText: key,
|
|
274
|
-
sourceTarget,
|
|
275
|
-
isDefaultRule
|
|
276
|
-
});
|
|
277
|
-
} else if (value === false) {
|
|
278
|
-
denyListRules.push({
|
|
279
|
-
regex,
|
|
280
|
-
regexCaseInsensitive,
|
|
281
|
-
sourceText: key,
|
|
282
|
-
sourceTarget,
|
|
283
|
-
isDefaultRule
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
} else if (typeof value === "object" && value !== null) {
|
|
287
|
-
const objectValue = value;
|
|
288
|
-
if (typeof objectValue.approve === "boolean") {
|
|
289
|
-
const {
|
|
290
|
-
regex,
|
|
291
|
-
regexCaseInsensitive
|
|
292
|
-
} = this._convertAutoApproveEntryToRegex(key);
|
|
293
|
-
if (objectValue.approve === true) {
|
|
294
|
-
if (objectValue.matchCommandLine === true) {
|
|
295
|
-
allowListCommandLineRules.push({
|
|
296
|
-
regex,
|
|
297
|
-
regexCaseInsensitive,
|
|
298
|
-
sourceText: key,
|
|
299
|
-
sourceTarget,
|
|
300
|
-
isDefaultRule
|
|
301
|
-
});
|
|
302
|
-
} else {
|
|
303
|
-
allowListRules.push({
|
|
304
|
-
regex,
|
|
305
|
-
regexCaseInsensitive,
|
|
306
|
-
sourceText: key,
|
|
307
|
-
sourceTarget,
|
|
308
|
-
isDefaultRule
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
} else if (objectValue.approve === false) {
|
|
312
|
-
if (objectValue.matchCommandLine === true) {
|
|
313
|
-
denyListCommandLineRules.push({
|
|
314
|
-
regex,
|
|
315
|
-
regexCaseInsensitive,
|
|
316
|
-
sourceText: key,
|
|
317
|
-
sourceTarget,
|
|
318
|
-
isDefaultRule
|
|
319
|
-
});
|
|
320
|
-
} else {
|
|
321
|
-
denyListRules.push({
|
|
322
|
-
regex,
|
|
323
|
-
regexCaseInsensitive,
|
|
324
|
-
sourceText: key,
|
|
325
|
-
sourceTarget,
|
|
326
|
-
isDefaultRule
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return {
|
|
334
|
-
denyListRules,
|
|
335
|
-
allowListRules,
|
|
336
|
-
allowListCommandLineRules,
|
|
337
|
-
denyListCommandLineRules
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
_convertAutoApproveEntryToRegex(value) {
|
|
341
|
-
const regex = this._doConvertAutoApproveEntryToRegex(value);
|
|
342
|
-
if (regex.flags.includes("i")) {
|
|
343
|
-
return {
|
|
344
|
-
regex,
|
|
345
|
-
regexCaseInsensitive: regex
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
regex,
|
|
350
|
-
regexCaseInsensitive: ( new RegExp(regex.source, regex.flags + "i"))
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
_doConvertAutoApproveEntryToRegex(value) {
|
|
354
|
-
const regexMatch = value.match(/^\/(?<pattern>.+)\/(?<flags>[dgimsuvy]*)$/);
|
|
355
|
-
const regexPattern = regexMatch?.groups?.pattern;
|
|
356
|
-
if (regexPattern) {
|
|
357
|
-
let flags = regexMatch.groups?.flags;
|
|
358
|
-
if (flags) {
|
|
359
|
-
flags = flags.replaceAll("g", "");
|
|
360
|
-
}
|
|
361
|
-
if (regexPattern === ".*") {
|
|
362
|
-
return ( new RegExp(regexPattern));
|
|
363
|
-
}
|
|
364
|
-
try {
|
|
365
|
-
const regex = ( new RegExp(regexPattern, flags || undefined));
|
|
366
|
-
if (regExpLeadsToEndlessLoop(regex)) {
|
|
367
|
-
return neverMatchRegex;
|
|
368
|
-
}
|
|
369
|
-
return regex;
|
|
370
|
-
} catch (error) {
|
|
371
|
-
return neverMatchRegex;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (value === "") {
|
|
375
|
-
return neverMatchRegex;
|
|
376
|
-
}
|
|
377
|
-
let sanitizedValue;
|
|
378
|
-
if (value.includes("/") || value.includes("\\")) {
|
|
379
|
-
let pattern = value.replace(/[/\\]/g, "%%PATH_SEP%%");
|
|
380
|
-
pattern = escapeRegExpCharacters(pattern);
|
|
381
|
-
pattern = pattern.replace(/%%PATH_SEP%%*/g, "[/\\\\]");
|
|
382
|
-
sanitizedValue = `^(?:\\.[/\\\\])?${pattern}`;
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
sanitizedValue = escapeRegExpCharacters(value);
|
|
386
|
-
}
|
|
387
|
-
return ( new RegExp(`^${sanitizedValue}\\b`));
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
CommandLineAutoApprover = ( __decorate([( __param(0, IConfigurationService)), ( __param(1, IInstantiationService)), ( __param(2, ITerminalChatService))], CommandLineAutoApprover));
|
|
391
|
-
|
|
392
|
-
export { CommandLineAutoApprover };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type IMarkdownString } from "@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent";
|
|
2
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
-
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
|
-
import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
5
|
-
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
6
|
-
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
7
|
-
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
8
|
-
export interface INpmScriptAutoApproveResult {
|
|
9
|
-
isAutoApproved: boolean;
|
|
10
|
-
scriptName?: string;
|
|
11
|
-
autoApproveInfo?: IMarkdownString;
|
|
12
|
-
}
|
|
13
|
-
export declare class NpmScriptAutoApprover extends Disposable {
|
|
14
|
-
private readonly _configurationService;
|
|
15
|
-
private readonly _fileService;
|
|
16
|
-
private readonly _uriIdentityService;
|
|
17
|
-
private readonly _workspaceContextService;
|
|
18
|
-
constructor(_configurationService: IConfigurationService, _fileService: IFileService, _uriIdentityService: IUriIdentityService, _workspaceContextService: IWorkspaceContextService);
|
|
19
|
-
/**
|
|
20
|
-
* Checks if a single command is an npm/yarn/pnpm script that exists in package.json.
|
|
21
|
-
* Returns auto-approve result if the command is a valid script.
|
|
22
|
-
*/
|
|
23
|
-
isCommandAutoApproved(command: string, cwd: URI | undefined): Promise<INpmScriptAutoApproveResult>;
|
|
24
|
-
/**
|
|
25
|
-
* Extracts script name from an npm/yarn/pnpm run command.
|
|
26
|
-
*/
|
|
27
|
-
private _extractScriptName;
|
|
28
|
-
/**
|
|
29
|
-
* Checks if a URI is within any workspace folder.
|
|
30
|
-
*/
|
|
31
|
-
private _isWithinWorkspace;
|
|
32
|
-
/**
|
|
33
|
-
* Finds and parses package.json to get the scripts section.
|
|
34
|
-
* Only looks within the workspace for security.
|
|
35
|
-
*/
|
|
36
|
-
private _getPackageJsonScripts;
|
|
37
|
-
/**
|
|
38
|
-
* Reads and parses the scripts section from a package.json file.
|
|
39
|
-
*/
|
|
40
|
-
private _readPackageJsonScripts;
|
|
41
|
-
/**
|
|
42
|
-
* Parses the scripts section from package.json content using jsonc-parser.
|
|
43
|
-
*/
|
|
44
|
-
private _parsePackageJsonScripts;
|
|
45
|
-
}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
4
|
-
import { visit } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
|
|
5
|
-
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
7
|
-
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
8
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
9
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
10
|
-
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
11
|
-
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
12
|
-
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
13
|
-
|
|
14
|
-
const npmRunPatterns = [
|
|
15
|
-
/^(?<command>npm)\s+(?:run(?:-script)?)\s+(?<scriptName>[^\s&|;]+)/i,
|
|
16
|
-
/^(?<command>npm)\s+(?<scriptName>test|start|stop|restart)\b/i,
|
|
17
|
-
/^(?<command>yarn)\s+(?:run\s+)?(?<scriptName>[^\s&|;]+)/i,
|
|
18
|
-
/^(?<command>pnpm)\s+(?:run\s+)?(?<scriptName>[^\s&|;]+)/i];
|
|
19
|
-
const yarnBuiltinCommands = ( new Set([
|
|
20
|
-
"add",
|
|
21
|
-
"audit",
|
|
22
|
-
"autoclean",
|
|
23
|
-
"bin",
|
|
24
|
-
"cache",
|
|
25
|
-
"check",
|
|
26
|
-
"config",
|
|
27
|
-
"create",
|
|
28
|
-
"dedupe",
|
|
29
|
-
"dlx",
|
|
30
|
-
"exec",
|
|
31
|
-
"explain",
|
|
32
|
-
"generate-lock-entry",
|
|
33
|
-
"global",
|
|
34
|
-
"help",
|
|
35
|
-
"import",
|
|
36
|
-
"info",
|
|
37
|
-
"init",
|
|
38
|
-
"install",
|
|
39
|
-
"licenses",
|
|
40
|
-
"link",
|
|
41
|
-
"list",
|
|
42
|
-
"login",
|
|
43
|
-
"logout",
|
|
44
|
-
"node",
|
|
45
|
-
"outdated",
|
|
46
|
-
"owner",
|
|
47
|
-
"pack",
|
|
48
|
-
"patch",
|
|
49
|
-
"patch-commit",
|
|
50
|
-
"plugin",
|
|
51
|
-
"policies",
|
|
52
|
-
"publish",
|
|
53
|
-
"rebuild",
|
|
54
|
-
"remove",
|
|
55
|
-
"run",
|
|
56
|
-
"search",
|
|
57
|
-
"set",
|
|
58
|
-
"stage",
|
|
59
|
-
"tag",
|
|
60
|
-
"team",
|
|
61
|
-
"unlink",
|
|
62
|
-
"unplug",
|
|
63
|
-
"up",
|
|
64
|
-
"upgrade",
|
|
65
|
-
"upgrade-interactive",
|
|
66
|
-
"version",
|
|
67
|
-
"versions",
|
|
68
|
-
"why",
|
|
69
|
-
"workspace",
|
|
70
|
-
"workspaces"
|
|
71
|
-
]));
|
|
72
|
-
const pnpmBuiltinCommands = ( new Set([
|
|
73
|
-
"add",
|
|
74
|
-
"audit",
|
|
75
|
-
"bin",
|
|
76
|
-
"config",
|
|
77
|
-
"dedupe",
|
|
78
|
-
"deploy",
|
|
79
|
-
"dlx",
|
|
80
|
-
"doctor",
|
|
81
|
-
"env",
|
|
82
|
-
"exec",
|
|
83
|
-
"fetch",
|
|
84
|
-
"import",
|
|
85
|
-
"init",
|
|
86
|
-
"install",
|
|
87
|
-
"install-test",
|
|
88
|
-
"licenses",
|
|
89
|
-
"link",
|
|
90
|
-
"list",
|
|
91
|
-
"ln",
|
|
92
|
-
"ls",
|
|
93
|
-
"outdated",
|
|
94
|
-
"pack",
|
|
95
|
-
"patch",
|
|
96
|
-
"patch-commit",
|
|
97
|
-
"patch-remove",
|
|
98
|
-
"prune",
|
|
99
|
-
"publish",
|
|
100
|
-
"rb",
|
|
101
|
-
"rebuild",
|
|
102
|
-
"remove",
|
|
103
|
-
"rm",
|
|
104
|
-
"root",
|
|
105
|
-
"run",
|
|
106
|
-
"server",
|
|
107
|
-
"setup",
|
|
108
|
-
"store",
|
|
109
|
-
"un",
|
|
110
|
-
"uninstall",
|
|
111
|
-
"unlink",
|
|
112
|
-
"up",
|
|
113
|
-
"update",
|
|
114
|
-
"why"
|
|
115
|
-
]));
|
|
116
|
-
let NpmScriptAutoApprover = class NpmScriptAutoApprover extends Disposable {
|
|
117
|
-
constructor(
|
|
118
|
-
_configurationService,
|
|
119
|
-
_fileService,
|
|
120
|
-
_uriIdentityService,
|
|
121
|
-
_workspaceContextService
|
|
122
|
-
) {
|
|
123
|
-
super();
|
|
124
|
-
this._configurationService = _configurationService;
|
|
125
|
-
this._fileService = _fileService;
|
|
126
|
-
this._uriIdentityService = _uriIdentityService;
|
|
127
|
-
this._workspaceContextService = _workspaceContextService;
|
|
128
|
-
}
|
|
129
|
-
async isCommandAutoApproved(command, cwd) {
|
|
130
|
-
const isNpmScriptAutoApproveEnabled = this._configurationService.getValue(TerminalChatAgentToolsSettingId.AutoApproveWorkspaceNpmScripts) === true;
|
|
131
|
-
if (!isNpmScriptAutoApproveEnabled) {
|
|
132
|
-
return {
|
|
133
|
-
isAutoApproved: false
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
const scriptName = this._extractScriptName(command);
|
|
137
|
-
if (!scriptName) {
|
|
138
|
-
return {
|
|
139
|
-
isAutoApproved: false
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
const packageJsonScripts = await this._getPackageJsonScripts(cwd);
|
|
143
|
-
if (!packageJsonScripts) {
|
|
144
|
-
return {
|
|
145
|
-
isAutoApproved: false
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
if (!( packageJsonScripts.scripts.has(scriptName))) {
|
|
149
|
-
return {
|
|
150
|
-
isAutoApproved: false
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
isAutoApproved: true,
|
|
155
|
-
scriptName,
|
|
156
|
-
autoApproveInfo: ( new MarkdownString(( localize(
|
|
157
|
-
13867,
|
|
158
|
-
"Auto approved as {0} is defined in package.json",
|
|
159
|
-
`\`${scriptName}\``
|
|
160
|
-
))))
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
_extractScriptName(command) {
|
|
164
|
-
const trimmedCommand = command.trim();
|
|
165
|
-
for (const pattern of npmRunPatterns) {
|
|
166
|
-
const match = trimmedCommand.match(pattern);
|
|
167
|
-
if (match?.groups?.scriptName) {
|
|
168
|
-
const {
|
|
169
|
-
command: pkgManager,
|
|
170
|
-
scriptName
|
|
171
|
-
} = match.groups;
|
|
172
|
-
if (pkgManager.toLowerCase() === "yarn" && ( yarnBuiltinCommands.has(scriptName.toLowerCase()))) {
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
if (pkgManager.toLowerCase() === "pnpm" && ( pnpmBuiltinCommands.has(scriptName.toLowerCase()))) {
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
return scriptName;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return undefined;
|
|
182
|
-
}
|
|
183
|
-
_isWithinWorkspace(uri) {
|
|
184
|
-
const workspaceFolders = this._workspaceContextService.getWorkspace().folders;
|
|
185
|
-
return ( workspaceFolders.some(folder => this._uriIdentityService.extUri.isEqualOrParent(uri, folder.uri)));
|
|
186
|
-
}
|
|
187
|
-
async _getPackageJsonScripts(cwd) {
|
|
188
|
-
if (!cwd || !this._isWithinWorkspace(cwd)) {
|
|
189
|
-
return undefined;
|
|
190
|
-
}
|
|
191
|
-
const packageJsonUri = URI.joinPath(cwd, "package.json");
|
|
192
|
-
const scripts = await this._readPackageJsonScripts(packageJsonUri);
|
|
193
|
-
if (scripts) {
|
|
194
|
-
return {
|
|
195
|
-
uri: packageJsonUri,
|
|
196
|
-
scripts
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
return undefined;
|
|
200
|
-
}
|
|
201
|
-
async _readPackageJsonScripts(packageJsonUri) {
|
|
202
|
-
try {
|
|
203
|
-
const exists = await this._fileService.exists(packageJsonUri);
|
|
204
|
-
if (!exists) {
|
|
205
|
-
return undefined;
|
|
206
|
-
}
|
|
207
|
-
const content = await this._fileService.readFile(packageJsonUri);
|
|
208
|
-
const text = ( content.value.toString());
|
|
209
|
-
return this._parsePackageJsonScripts(text);
|
|
210
|
-
} catch {
|
|
211
|
-
return undefined;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
_parsePackageJsonScripts(content) {
|
|
215
|
-
const scripts = ( new Set());
|
|
216
|
-
let inScripts = false;
|
|
217
|
-
let level = 0;
|
|
218
|
-
const visitor = {
|
|
219
|
-
onError() {},
|
|
220
|
-
onObjectBegin() {
|
|
221
|
-
level++;
|
|
222
|
-
},
|
|
223
|
-
onObjectEnd() {
|
|
224
|
-
if (inScripts && level === 2) {
|
|
225
|
-
inScripts = false;
|
|
226
|
-
}
|
|
227
|
-
level--;
|
|
228
|
-
},
|
|
229
|
-
onObjectProperty(property) {
|
|
230
|
-
if (level === 1 && property === "scripts") {
|
|
231
|
-
inScripts = true;
|
|
232
|
-
} else if (inScripts && level === 2) {
|
|
233
|
-
scripts.add(property);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
visit(content, visitor);
|
|
238
|
-
return scripts.size > 0 ? scripts : undefined;
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
NpmScriptAutoApprover = ( __decorate([( __param(0, IConfigurationService)), ( __param(1, IFileService)), ( __param(2, IUriIdentityService)), ( __param(3, IWorkspaceContextService))], NpmScriptAutoApprover));
|
|
242
|
-
|
|
243
|
-
export { NpmScriptAutoApprover };
|