@codingame/monaco-vscode-chat-service-override 28.4.1 → 29.1.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 +18 -12
- package/package.json +5 -5
- package/vscode/src/vs/platform/agentHost/common/agentService.d.ts +300 -0
- package/vscode/src/vs/platform/agentHost/common/agentService.js +31 -0
- package/vscode/src/vs/platform/agentHost/common/agentService.service.d.ts +84 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/action-origin.generated.d.ts +16 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/actions.d.ts +488 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.d.ts +424 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/errors.d.ts +50 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/messages.d.ts +202 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.d.ts +114 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/state.d.ts +723 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +33 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.d.ts +40 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionState.d.ts +22 -0
- package/vscode/src/vs/platform/browserElements/common/browserElements.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +29 -15
- 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.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +4 -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 +76 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
- 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 +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +162 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +167 -4
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +52 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.d.ts +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.js +195 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +97 -88
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +78 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.d.ts +7 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +174 -170
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +7 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +118 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +13 -2
- 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.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +5 -10
- 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 +9 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.d.ts +23 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +341 -196
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/media/agenttitlebarstatuswidget.css +79 -7
- 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/agentSessions/localAgentSessionsController.d.ts +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.js +22 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +15 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +85 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +668 -214
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.js +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +306 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +84 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +651 -81
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.d.ts +31 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.js +9 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.js +7 -142
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationGroupHeaderRenderer.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationGroupHeaderRenderer.js +63 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +25 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +297 -123
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +153 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +111 -171
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +5 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +277 -186
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +31 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCollapsible.d.ts +3 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCollapsible.js +4 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.d.ts +18 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +112 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +16 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +41 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.d.ts +7 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +35 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.d.ts +1 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +8 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +13 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +29 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowLayout.js +14 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +79 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +125 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.d.ts +11 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +113 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.d.ts +18 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +54 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.d.ts +8 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +103 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +48 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.d.ts +28 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +62 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/media/chatDebug.css +21 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingDeletedFileEntry.js +2 -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 +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +1 -1
- 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 +17 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +43 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.d.ts +59 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +194 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +9 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +8 -4
- 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 +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +81 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +22 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +9 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +29 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +19 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +105 -172
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +80 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +56 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +70 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +33 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +21 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +362 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +15 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +90 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +146 -0
- 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.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 +10 -9
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +33 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +200 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +90 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +21 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +22 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +28 -13
- 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.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +20 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +68 -5
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +57 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +21 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +171 -57
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +206 -35
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.d.ts +7 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +11 -3
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +44 -22
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +450 -301
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +165 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +34 -20
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +209 -144
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.js +205 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalCustomizations.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalCustomizations.js +47 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalSkill.d.ts +30 -0
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +191 -159
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +6 -7
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +210 -233
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +19 -26
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +183 -193
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatArtifactsService.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatArtifactsService.js +75 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +8 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +97 -35
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.js +67 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +62 -23
- 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 +8 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +20 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +23 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +50 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +21 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +20 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +124 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +20 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +10 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +46 -31
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.d.ts +18 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +74 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/awaitTerminalTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +24 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.js +5 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +66 -64
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/outputAnalyzer.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +5 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +32 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +390 -114
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +21 -11
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +70 -51
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +61 -51
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +94 -76
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +19 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +112 -21
- package/vscode/src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackService.d.ts +0 -53
- package/vscode/src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackService.js +0 -219
- package/vscode/src/vs/sessions/contrib/chat/browser/aiCustomizationWorkspaceService.d.ts +0 -89
- package/vscode/src/vs/sessions/contrib/chat/browser/aiCustomizationWorkspaceService.js +0 -251
- package/vscode/src/vs/sessions/contrib/chat/browser/newSession.d.ts +0 -123
- package/vscode/src/vs/sessions/contrib/chat/browser/newSession.js +0 -278
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsConfigurationService.d.ts +0 -76
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsConfigurationService.js +0 -299
- package/vscode/src/vs/sessions/contrib/fileTreeView/browser/githubFileSystemProvider.d.ts +0 -67
- package/vscode/src/vs/sessions/contrib/fileTreeView/browser/githubFileSystemProvider.js +0 -263
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsManagementService.d.ts +0 -85
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsManagementService.js +0 -397
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.d.ts +0 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.js +0 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionResourceMatching.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionResourceMatching.js +0 -30
- package/vscode/src/vs/workbench/contrib/chat/common/aiCustomizationWorkspaceService.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/chat/common/aiCustomizationWorkspaceService.js +0 -28
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.d.ts +0 -190
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +0 -11
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +0 -16
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +0 -20
|
@@ -5,15 +5,17 @@ import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/
|
|
|
5
5
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
6
6
|
import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
7
7
|
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
8
|
-
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
9
|
-
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { MarkdownString, escapeMarkdownSyntaxTokens } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
9
|
+
import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
10
10
|
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
11
|
+
import { getMediaMime } from '@codingame/monaco-vscode-api/vscode/vs/base/common/mime';
|
|
11
12
|
import { basename, win32, posix } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
12
13
|
import { OS, OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
13
14
|
import { count } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
14
15
|
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
15
16
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
16
17
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
18
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
17
19
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
18
20
|
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
19
21
|
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
@@ -33,7 +35,7 @@ import { BasicExecuteStrategy } from '../executeStrategy/basicExecuteStrategy.js
|
|
|
33
35
|
import { NoneExecuteStrategy } from '../executeStrategy/noneExecuteStrategy.js';
|
|
34
36
|
import { RichExecuteStrategy } from '../executeStrategy/richExecuteStrategy.js';
|
|
35
37
|
import { getOutput } from '../outputHelpers.js';
|
|
36
|
-
import { isWindowsPowerShell, isPowerShell, isZsh, isFish, extractCdPrefix } from '../runInTerminalHelpers.js';
|
|
38
|
+
import { isWindowsPowerShell, isPowerShell, isZsh, isFish, normalizeTerminalCommandForDisplay, extractCdPrefix } from '../runInTerminalHelpers.js';
|
|
37
39
|
import { NodeCommandLinePresenter } from './commandLinePresenter/nodeCommandLinePresenter.js';
|
|
38
40
|
import { PythonCommandLinePresenter } from './commandLinePresenter/pythonCommandLinePresenter.js';
|
|
39
41
|
import { RubyCommandLinePresenter } from './commandLinePresenter/rubyCommandLinePresenter.js';
|
|
@@ -62,13 +64,15 @@ import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workb
|
|
|
62
64
|
import { TerminalChatCommandId } from '@codingame/monaco-vscode-xterm-common/vscode/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat';
|
|
63
65
|
import { clamp } from '@codingame/monaco-vscode-api/vscode/vs/base/common/numbers';
|
|
64
66
|
import { SandboxOutputAnalyzer } from './sandboxOutputAnalyzer.js';
|
|
67
|
+
import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
|
|
68
|
+
import { ITerminalSandboxService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.service';
|
|
65
69
|
|
|
66
70
|
var RunInTerminalTool_1;
|
|
67
71
|
const TOOL_REFERENCE_NAME = "runInTerminal";
|
|
68
72
|
const LEGACY_TOOL_REFERENCE_FULL_NAMES = ["runCommands/runInTerminal"];
|
|
69
|
-
function createPowerShellModelDescription(shell) {
|
|
73
|
+
function createPowerShellModelDescription(shell, isSandboxEnabled, networkDomains) {
|
|
70
74
|
const isWinPwsh = isWindowsPowerShell(shell);
|
|
71
|
-
|
|
75
|
+
const parts = [
|
|
72
76
|
`This tool allows you to execute ${isWinPwsh ? "Windows PowerShell 5.1" : "PowerShell"} commands in a persistent terminal session, preserving environment variables, working directory, and other context across multiple commands.`,
|
|
73
77
|
"",
|
|
74
78
|
"Command Execution:",
|
|
@@ -90,7 +94,12 @@ function createPowerShellModelDescription(shell) {
|
|
|
90
94
|
"Background Processes:",
|
|
91
95
|
"- For long-running tasks (e.g., servers), set isBackground=true",
|
|
92
96
|
"- Returns a terminal ID for checking status and runtime later",
|
|
93
|
-
"- Use Start-Job for background PowerShell jobs"
|
|
97
|
+
"- Use Start-Job for background PowerShell jobs"
|
|
98
|
+
];
|
|
99
|
+
if (isSandboxEnabled) {
|
|
100
|
+
parts.push(...createSandboxLines(networkDomains));
|
|
101
|
+
}
|
|
102
|
+
parts.push(
|
|
94
103
|
"",
|
|
95
104
|
"Output Management:",
|
|
96
105
|
"- Output is automatically truncated if longer than 60KB to prevent context overflow",
|
|
@@ -106,9 +115,40 @@ function createPowerShellModelDescription(shell) {
|
|
|
106
115
|
"- Use Test-Path to check file/directory existence",
|
|
107
116
|
"- Be specific with Select-Object properties to avoid excessive output",
|
|
108
117
|
"- Avoid printing credentials unless absolutely required"
|
|
109
|
-
|
|
118
|
+
);
|
|
119
|
+
return parts.join("\n");
|
|
120
|
+
}
|
|
121
|
+
function createSandboxLines(networkDomains) {
|
|
122
|
+
const lines = [
|
|
123
|
+
"",
|
|
124
|
+
"Sandboxing:",
|
|
125
|
+
"- ATTENTION: Terminal sandboxing is enabled, commands run in a sandbox by default",
|
|
126
|
+
"- When executing commands within the sandboxed environment, all operations requiring a temporary directory must utilize the $TMPDIR environment variable. The /tmp directory is not guaranteed to be accessible or writable and must be avoided",
|
|
127
|
+
"- Tools and scripts should respect the TMPDIR environment variable, which is automatically set to an appropriate path within the sandbox",
|
|
128
|
+
"- When a command fails due to sandbox restrictions, immediately re-run it with requestUnsandboxedExecution=true. Do NOT ask the user for permission — setting this flag automatically shows a confirmation prompt to the user",
|
|
129
|
+
"- Only set requestUnsandboxedExecution=true when there is evidence of failures caused by the sandbox, e.g. 'Operation not permitted' errors, network failures, or file access errors, etc",
|
|
130
|
+
"- When setting requestUnsandboxedExecution=true, also provide requestUnsandboxedExecutionReason explaining why the command needs unsandboxed access"
|
|
131
|
+
];
|
|
132
|
+
if (networkDomains) {
|
|
133
|
+
const deniedSet = ( new Set(networkDomains.deniedDomains));
|
|
134
|
+
const effectiveAllowed = networkDomains.allowedDomains.filter(d => !( deniedSet.has(d)));
|
|
135
|
+
if (effectiveAllowed.length === 0) {
|
|
136
|
+
lines.push("- All network access is blocked in the sandbox");
|
|
137
|
+
} else {
|
|
138
|
+
lines.push(
|
|
139
|
+
`- Only the following domains are accessible in the sandbox (all other network access is blocked): ${effectiveAllowed.join(", ")}`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
if (networkDomains.deniedDomains.length > 0) {
|
|
143
|
+
lines.push(
|
|
144
|
+
`- The following domains are explicitly blocked in the sandbox: ${networkDomains.deniedDomains.join(", ")}`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return lines;
|
|
110
149
|
}
|
|
111
|
-
|
|
150
|
+
function createGenericDescription(isSandboxEnabled, networkDomains) {
|
|
151
|
+
const parts = [`
|
|
112
152
|
Command Execution:
|
|
113
153
|
- Use && to chain simple commands on one line
|
|
114
154
|
- Prefer pipelines | over temporary files for data flow
|
|
@@ -128,7 +168,11 @@ Program Execution:
|
|
|
128
168
|
|
|
129
169
|
Background Processes:
|
|
130
170
|
- For long-running tasks (e.g., servers), set isBackground=true
|
|
131
|
-
- Returns a terminal ID for checking status and runtime later
|
|
171
|
+
- Returns a terminal ID for checking status and runtime later`];
|
|
172
|
+
if (isSandboxEnabled) {
|
|
173
|
+
parts.push(createSandboxLines(networkDomains).join("\n"));
|
|
174
|
+
}
|
|
175
|
+
parts.push(`
|
|
132
176
|
|
|
133
177
|
Output Management:
|
|
134
178
|
- Output is automatically truncated if longer than 60KB to prevent context overflow
|
|
@@ -140,20 +184,22 @@ Best Practices:
|
|
|
140
184
|
- Quote variables: "$var" instead of $var to handle spaces
|
|
141
185
|
- Use find with -exec or xargs for file operations
|
|
142
186
|
- Be specific with commands to avoid excessive output
|
|
143
|
-
- Avoid printing credentials unless absolutely required
|
|
144
|
-
|
|
187
|
+
- Avoid printing credentials unless absolutely required`);
|
|
188
|
+
return parts.join("");
|
|
189
|
+
}
|
|
190
|
+
function createBashModelDescription(isSandboxEnabled, networkDomains) {
|
|
145
191
|
return [
|
|
146
192
|
"This tool allows you to execute shell commands in a persistent bash terminal session, preserving environment variables, working directory, and other context across multiple commands.",
|
|
147
|
-
|
|
193
|
+
createGenericDescription(isSandboxEnabled, networkDomains),
|
|
148
194
|
"- Use [[ ]] for conditional tests instead of [ ]",
|
|
149
195
|
"- Prefer $() over backticks for command substitution",
|
|
150
196
|
"- Use set -e at start of complex commands to exit on errors"
|
|
151
197
|
].join("\n");
|
|
152
198
|
}
|
|
153
|
-
function createZshModelDescription() {
|
|
199
|
+
function createZshModelDescription(isSandboxEnabled, networkDomains) {
|
|
154
200
|
return [
|
|
155
201
|
"This tool allows you to execute shell commands in a persistent zsh terminal session, preserving environment variables, working directory, and other context across multiple commands.",
|
|
156
|
-
|
|
202
|
+
createGenericDescription(isSandboxEnabled, networkDomains),
|
|
157
203
|
"- Use type to check command type (builtin, function, alias)",
|
|
158
204
|
"- Use jobs, fg, bg for job control",
|
|
159
205
|
"- Use [[ ]] for conditional tests instead of [ ]",
|
|
@@ -162,10 +208,10 @@ function createZshModelDescription() {
|
|
|
162
208
|
"- Take advantage of zsh globbing features (**, extended globs)"
|
|
163
209
|
].join("\n");
|
|
164
210
|
}
|
|
165
|
-
function createFishModelDescription() {
|
|
211
|
+
function createFishModelDescription(isSandboxEnabled, networkDomains) {
|
|
166
212
|
return [
|
|
167
213
|
"This tool allows you to execute shell commands in a persistent fish terminal session, preserving environment variables, working directory, and other context across multiple commands.",
|
|
168
|
-
|
|
214
|
+
createGenericDescription(isSandboxEnabled, networkDomains),
|
|
169
215
|
"- Use type to check command type (builtin, function, alias)",
|
|
170
216
|
"- Use jobs, fg, bg for job control",
|
|
171
217
|
"- Use test expressions for conditionals (no [[ ]] syntax)",
|
|
@@ -177,26 +223,31 @@ function createFishModelDescription() {
|
|
|
177
223
|
}
|
|
178
224
|
async function createRunInTerminalToolData(accessor) {
|
|
179
225
|
const instantiationService = accessor.get(IInstantiationService);
|
|
226
|
+
const terminalSandboxService = accessor.get(ITerminalSandboxService);
|
|
180
227
|
const profileFetcher = instantiationService.createInstance(TerminalProfileFetcher);
|
|
181
|
-
const shell = await
|
|
182
|
-
|
|
228
|
+
const [shell, os, isSandboxEnabled] = await Promise.all([
|
|
229
|
+
profileFetcher.getCopilotShell(),
|
|
230
|
+
profileFetcher.osBackend,
|
|
231
|
+
terminalSandboxService.isEnabled()
|
|
232
|
+
]);
|
|
233
|
+
const networkDomains = isSandboxEnabled ? terminalSandboxService.getResolvedNetworkDomains() : undefined;
|
|
183
234
|
let modelDescription;
|
|
184
235
|
if (shell && os && isPowerShell(shell, os)) {
|
|
185
|
-
modelDescription = createPowerShellModelDescription(shell);
|
|
236
|
+
modelDescription = createPowerShellModelDescription(shell, isSandboxEnabled, networkDomains);
|
|
186
237
|
} else if (shell && os && isZsh(shell, os)) {
|
|
187
|
-
modelDescription = createZshModelDescription();
|
|
238
|
+
modelDescription = createZshModelDescription(isSandboxEnabled, networkDomains);
|
|
188
239
|
} else if (shell && os && isFish(shell, os)) {
|
|
189
|
-
modelDescription = createFishModelDescription();
|
|
240
|
+
modelDescription = createFishModelDescription(isSandboxEnabled, networkDomains);
|
|
190
241
|
} else {
|
|
191
|
-
modelDescription = createBashModelDescription();
|
|
242
|
+
modelDescription = createBashModelDescription(isSandboxEnabled, networkDomains);
|
|
192
243
|
}
|
|
193
244
|
return {
|
|
194
245
|
id: TerminalToolId.RunInTerminal,
|
|
195
246
|
toolReferenceName: TOOL_REFERENCE_NAME,
|
|
196
247
|
legacyToolReferenceFullNames: LEGACY_TOOL_REFERENCE_FULL_NAMES,
|
|
197
|
-
displayName: ( localize(
|
|
248
|
+
displayName: ( localize(13843, "Run in Terminal")),
|
|
198
249
|
modelDescription,
|
|
199
|
-
userDescription: ( localize(
|
|
250
|
+
userDescription: ( localize(13844, "Run commands in the terminal")),
|
|
200
251
|
source: ToolDataSource.Internal,
|
|
201
252
|
icon: Codicon.terminal,
|
|
202
253
|
inputSchema: {
|
|
@@ -220,8 +271,18 @@ async function createRunInTerminalToolData(accessor) {
|
|
|
220
271
|
},
|
|
221
272
|
timeout: {
|
|
222
273
|
type: "number",
|
|
223
|
-
description: "An optional timeout in milliseconds. When provided, the tool will stop tracking the command after this duration and return the output collected so far. Be conservative with the timeout duration, give enough time that the command would complete on a low-end machine. Use 0 for no timeout. If it's not clear how long the command will take then use 0 to avoid prematurely terminating it, never guess too low."
|
|
224
|
-
}
|
|
274
|
+
description: "An optional timeout in milliseconds. When provided, the tool will stop tracking the command after this duration and return the output collected so far with a timeout indicator. Be conservative with the timeout duration, give enough time that the command would complete on a low-end machine. Use 0 for no timeout. If it's not clear how long the command will take then use 0 to avoid prematurely terminating it, never guess too low."
|
|
275
|
+
},
|
|
276
|
+
...(isSandboxEnabled ? {
|
|
277
|
+
requestUnsandboxedExecution: {
|
|
278
|
+
type: "boolean",
|
|
279
|
+
description: "Request that this command run outside the terminal sandbox. Only set this when the command clearly needs unsandboxed access. The user will be prompted before the command runs unsandboxed."
|
|
280
|
+
},
|
|
281
|
+
requestUnsandboxedExecutionReason: {
|
|
282
|
+
type: "string",
|
|
283
|
+
description: "A short explanation of why this command must run outside the terminal sandbox. Only provide this when requestUnsandboxedExecution is true."
|
|
284
|
+
}
|
|
285
|
+
} : {})
|
|
225
286
|
},
|
|
226
287
|
required: ["command", "explanation", "goal", "isBackground", "timeout"]
|
|
227
288
|
}
|
|
@@ -234,7 +295,7 @@ var TerminalToolStorageKeysInternal;
|
|
|
234
295
|
const telemetryIgnoredSequences = [
|
|
235
296
|
"\u001b[I",
|
|
236
297
|
"\u001b[O"];
|
|
237
|
-
const altBufferMessage = "\n" + ( localize(
|
|
298
|
+
const altBufferMessage = "\n" + ( localize(13845, "The command opened the alternate buffer."));
|
|
238
299
|
let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
239
300
|
static {
|
|
240
301
|
RunInTerminalTool_1 = this;
|
|
@@ -261,9 +322,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
261
322
|
RunInTerminalTool_1._activeExecutions.delete(id);
|
|
262
323
|
return true;
|
|
263
324
|
}
|
|
325
|
+
get _enableCommandLineSandboxRewriting() {
|
|
326
|
+
return true;
|
|
327
|
+
}
|
|
264
328
|
constructor(
|
|
265
329
|
_chatService,
|
|
266
330
|
_configurationService,
|
|
331
|
+
_fileService,
|
|
267
332
|
_historyService,
|
|
268
333
|
_instantiationService,
|
|
269
334
|
_labelService,
|
|
@@ -273,12 +338,15 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
273
338
|
_terminalChatService,
|
|
274
339
|
_logService,
|
|
275
340
|
_terminalService,
|
|
341
|
+
_terminalSandboxService,
|
|
276
342
|
_workspaceContextService,
|
|
277
|
-
_chatWidgetService
|
|
343
|
+
_chatWidgetService,
|
|
344
|
+
_agentSessionsService
|
|
278
345
|
) {
|
|
279
346
|
super();
|
|
280
347
|
this._chatService = _chatService;
|
|
281
348
|
this._configurationService = _configurationService;
|
|
349
|
+
this._fileService = _fileService;
|
|
282
350
|
this._historyService = _historyService;
|
|
283
351
|
this._instantiationService = _instantiationService;
|
|
284
352
|
this._labelService = _labelService;
|
|
@@ -288,9 +356,14 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
288
356
|
this._terminalChatService = _terminalChatService;
|
|
289
357
|
this._logService = _logService;
|
|
290
358
|
this._terminalService = _terminalService;
|
|
359
|
+
this._terminalSandboxService = _terminalSandboxService;
|
|
291
360
|
this._workspaceContextService = _workspaceContextService;
|
|
292
361
|
this._chatWidgetService = _chatWidgetService;
|
|
362
|
+
this._agentSessionsService = _agentSessionsService;
|
|
363
|
+
this._archivedSessionListener = this._register(( new MutableDisposable()));
|
|
293
364
|
this._sessionTerminalAssociations = ( new ResourceMap());
|
|
365
|
+
this._sessionTerminalInstances = ( new ResourceMap());
|
|
366
|
+
this._terminalsBeingDisposedBySessionCleanup = ( new Set());
|
|
294
367
|
this._osBackend = this._remoteAgentService.getEnvironment().then(remoteEnv => remoteEnv?.os ?? OS);
|
|
295
368
|
this._terminalToolCreator = this._instantiationService.createInstance(ToolTerminalCreator);
|
|
296
369
|
this._treeSitterCommandParser = this._register(this._instantiationService.createInstance(TreeSitterCommandParser));
|
|
@@ -301,12 +374,16 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
301
374
|
this._register(this._instantiationService.createInstance(CommandLineCdPrefixRewriter)),
|
|
302
375
|
this._register(
|
|
303
376
|
this._instantiationService.createInstance(CommandLinePwshChainOperatorRewriter, this._treeSitterCommandParser)
|
|
304
|
-
)
|
|
305
|
-
this._register(
|
|
306
|
-
this._instantiationService.createInstance(CommandLinePreventHistoryRewriter)
|
|
307
|
-
),
|
|
308
|
-
this._register(this._instantiationService.createInstance(CommandLineSandboxRewriter))
|
|
377
|
+
)
|
|
309
378
|
];
|
|
379
|
+
if (this._enableCommandLineSandboxRewriting) {
|
|
380
|
+
this._commandLineRewriters.push(
|
|
381
|
+
this._register(this._instantiationService.createInstance(CommandLineSandboxRewriter))
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
this._commandLineRewriters.push(this._register(
|
|
385
|
+
this._instantiationService.createInstance(CommandLinePreventHistoryRewriter)
|
|
386
|
+
));
|
|
310
387
|
this._commandLineAnalyzers = [this._register(this._instantiationService.createInstance(
|
|
311
388
|
CommandLineFileWriteAnalyzer,
|
|
312
389
|
this._treeSitterCommandParser,
|
|
@@ -316,7 +393,12 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
316
393
|
this._treeSitterCommandParser,
|
|
317
394
|
this._telemetry,
|
|
318
395
|
(message, args) => this._logService.info(`RunInTerminalTool#CommandLineAutoApproveAnalyzer: ${message}`, args)
|
|
319
|
-
))
|
|
396
|
+
))];
|
|
397
|
+
if (this._enableCommandLineSandboxRewriting) {
|
|
398
|
+
this._commandLineAnalyzers.push(
|
|
399
|
+
this._register(this._instantiationService.createInstance(CommandLineSandboxAnalyzer))
|
|
400
|
+
);
|
|
401
|
+
}
|
|
320
402
|
this._commandLinePresenters = [
|
|
321
403
|
this._instantiationService.createInstance(SandboxedCommandLinePresenter),
|
|
322
404
|
( new NodeCommandLinePresenter()),
|
|
@@ -340,11 +422,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
340
422
|
);
|
|
341
423
|
this._restoreTerminalAssociations();
|
|
342
424
|
this._register(this._terminalService.onDidDisposeInstance(e => {
|
|
343
|
-
|
|
344
|
-
if (e === toolTerminal.instance) {
|
|
345
|
-
this._sessionTerminalAssociations.delete(sessionResource);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
425
|
+
this._removeTerminalAssociations(e);
|
|
348
426
|
}));
|
|
349
427
|
this._register(this._chatService.onDidDisposeSession(e => {
|
|
350
428
|
for (const resource of e.sessionResource) {
|
|
@@ -352,6 +430,20 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
352
430
|
}
|
|
353
431
|
}));
|
|
354
432
|
}
|
|
433
|
+
async handleToolStream(context, _token) {
|
|
434
|
+
const partialInput = context.rawInput;
|
|
435
|
+
if (partialInput && typeof partialInput === "object" && partialInput.command) {
|
|
436
|
+
const normalizedCommand = normalizeTerminalCommandForDisplay(partialInput.command).replace(/\r\n|\r|\n/g, " ");
|
|
437
|
+
const truncatedCommand = normalizedCommand.length > 80 ? normalizedCommand.substring(0, 77) + "..." : normalizedCommand;
|
|
438
|
+
const invocationMessage = partialInput.isBackground ? ( new MarkdownString(( localize(13846, "Running `{0}` in background", truncatedCommand)))) : ( new MarkdownString(( localize(13847, "Running `{0}`", truncatedCommand))));
|
|
439
|
+
return {
|
|
440
|
+
invocationMessage
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
return {
|
|
444
|
+
invocationMessage: ( localize(13848, "Running command"))
|
|
445
|
+
};
|
|
446
|
+
}
|
|
355
447
|
async prepareToolInvocation(context, token) {
|
|
356
448
|
const args = context.parameters;
|
|
357
449
|
const chatSessionResource = context.chatSessionResource;
|
|
@@ -362,7 +454,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
362
454
|
instance = toolTerminal.instance;
|
|
363
455
|
}
|
|
364
456
|
}
|
|
365
|
-
const [os, shell, cwd] = await Promise.all([this._osBackend, this._profileFetcher.getCopilotShell(), (async () => {
|
|
457
|
+
const [os, shell, cwd, isTerminalSandboxEnabled] = await Promise.all([this._osBackend, this._profileFetcher.getCopilotShell(), (async () => {
|
|
366
458
|
let cwd = await instance?.getCwdResource();
|
|
367
459
|
if (!cwd) {
|
|
368
460
|
const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot();
|
|
@@ -370,22 +462,28 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
370
462
|
cwd = workspaceFolder?.uri;
|
|
371
463
|
}
|
|
372
464
|
return cwd;
|
|
373
|
-
})()]);
|
|
465
|
+
})(), this._terminalSandboxService.isEnabled()]);
|
|
374
466
|
const language = os === OperatingSystem.Windows ? "pwsh" : "sh";
|
|
467
|
+
const requiresUnsandboxConfirmation = isTerminalSandboxEnabled && args.requestUnsandboxedExecution === true;
|
|
375
468
|
const terminalToolSessionId = generateUuid();
|
|
376
469
|
const terminalCommandId = `tool-${generateUuid()}`;
|
|
377
470
|
let rewrittenCommand = args.command;
|
|
378
471
|
let forDisplayCommand = undefined;
|
|
472
|
+
let isSandboxWrapped = false;
|
|
379
473
|
for (const rewriter of this._commandLineRewriters) {
|
|
380
474
|
const rewriteResult = await rewriter.rewrite({
|
|
381
475
|
commandLine: rewrittenCommand,
|
|
382
476
|
cwd,
|
|
383
477
|
shell,
|
|
384
|
-
os
|
|
478
|
+
os,
|
|
479
|
+
requestUnsandboxedExecution: requiresUnsandboxConfirmation
|
|
385
480
|
});
|
|
386
481
|
if (rewriteResult) {
|
|
387
482
|
rewrittenCommand = rewriteResult.rewritten;
|
|
388
|
-
forDisplayCommand = rewriteResult.forDisplay;
|
|
483
|
+
forDisplayCommand = rewriteResult.forDisplay ?? forDisplayCommand;
|
|
484
|
+
if (rewriteResult.isSandboxWrapped) {
|
|
485
|
+
isSandboxWrapped = true;
|
|
486
|
+
}
|
|
389
487
|
this._logService.info(
|
|
390
488
|
`RunInTerminalTool: Command rewritten by ${rewriter.constructor.name}: ${rewriteResult.reasoning}`
|
|
391
489
|
);
|
|
@@ -398,11 +496,14 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
398
496
|
commandLine: {
|
|
399
497
|
original: args.command,
|
|
400
498
|
toolEdited: rewrittenCommand === args.command ? undefined : rewrittenCommand,
|
|
401
|
-
forDisplay: forDisplayCommand
|
|
499
|
+
forDisplay: forDisplayCommand ?? normalizeTerminalCommandForDisplay(rewrittenCommand ?? args.command),
|
|
500
|
+
isSandboxWrapped
|
|
402
501
|
},
|
|
403
502
|
cwd,
|
|
404
503
|
language,
|
|
405
|
-
isBackground: args.isBackground
|
|
504
|
+
isBackground: args.isBackground,
|
|
505
|
+
requestUnsandboxedExecution: requiresUnsandboxConfirmation,
|
|
506
|
+
requestUnsandboxedExecutionReason: args.requestUnsandboxedExecutionReason
|
|
406
507
|
};
|
|
407
508
|
const alternativeRecommendation = getRecommendedToolsOverRunInTerminal(args.command, this._languageModelToolsService);
|
|
408
509
|
if (alternativeRecommendation) {
|
|
@@ -442,9 +543,12 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
442
543
|
shell,
|
|
443
544
|
treeSitterLanguage: isPowerShell(shell, os) ? TreeSitterCommandParserLanguage.PowerShell : TreeSitterCommandParserLanguage.Bash,
|
|
444
545
|
terminalToolSessionId,
|
|
445
|
-
chatSessionResource
|
|
546
|
+
chatSessionResource,
|
|
547
|
+
requiresUnsandboxConfirmation
|
|
446
548
|
};
|
|
447
|
-
const
|
|
549
|
+
const isSessionAutoApproved = chatSessionResource && this._isSessionAutoApproveLevel(chatSessionResource);
|
|
550
|
+
const commandLineAnalyzers = isSessionAutoApproved ? this._commandLineAnalyzers.filter(e => !(e instanceof CommandLineAutoApproveAnalyzer)) : this._commandLineAnalyzers;
|
|
551
|
+
const commandLineAnalyzerResults = await Promise.all(( commandLineAnalyzers.map(e => e.analyze(commandLineAnalyzerOptions))));
|
|
448
552
|
const disclaimersRaw = ( commandLineAnalyzerResults.map(e => e.disclaimers)).filter(e => !!e).flatMap(e => e);
|
|
449
553
|
let disclaimer;
|
|
450
554
|
if (disclaimersRaw.length > 0) {
|
|
@@ -476,7 +580,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
476
580
|
if (isFinalAutoApproved || (isAutoApproveEnabled && ( commandLineAnalyzerResults.some(e => e.autoApproveInfo)))) {
|
|
477
581
|
toolSpecificData.autoApproveInfo = commandLineAnalyzerResults.find(e => e.autoApproveInfo)?.autoApproveInfo;
|
|
478
582
|
}
|
|
479
|
-
const commandToDisplay = (toolSpecificData.commandLine.userEdited ?? toolSpecificData.commandLine.toolEdited ?? toolSpecificData.commandLine.original).trimStart();
|
|
583
|
+
const commandToDisplay = (toolSpecificData.commandLine.forDisplay ?? toolSpecificData.commandLine.userEdited ?? toolSpecificData.commandLine.toolEdited ?? toolSpecificData.commandLine.original).trimStart();
|
|
480
584
|
const extractedCd = extractCdPrefix(commandToDisplay, shell, os);
|
|
481
585
|
let confirmationTitle;
|
|
482
586
|
if (extractedCd && cwd) {
|
|
@@ -494,16 +598,16 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
494
598
|
cdPrefix
|
|
495
599
|
};
|
|
496
600
|
confirmationTitle = args.isBackground ? ( localize(
|
|
497
|
-
|
|
601
|
+
13849,
|
|
498
602
|
"Run `{0}` command in background within `{1}`?",
|
|
499
603
|
shellType,
|
|
500
604
|
directoryLabel
|
|
501
|
-
)) : ( localize(
|
|
605
|
+
)) : ( localize(13850, "Run `{0}` command within `{1}`?", shellType, directoryLabel));
|
|
502
606
|
} else {
|
|
503
607
|
toolSpecificData.confirmation = {
|
|
504
608
|
commandLine: commandToDisplay
|
|
505
609
|
};
|
|
506
|
-
confirmationTitle = args.isBackground ? ( localize(
|
|
610
|
+
confirmationTitle = args.isBackground ? ( localize(13851, "Run `{0}` command in background?", shellType)) : ( localize(13852, "Run `{0}` command?", shellType));
|
|
507
611
|
}
|
|
508
612
|
const commandForPresenter = extractedCd?.command ?? commandToDisplay;
|
|
509
613
|
let presenterInput = commandForPresenter;
|
|
@@ -523,13 +627,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
523
627
|
};
|
|
524
628
|
if (extractedCd && toolSpecificData.confirmation?.cwdLabel) {
|
|
525
629
|
confirmationTitle = args.isBackground ? ( localize(
|
|
526
|
-
|
|
630
|
+
13853,
|
|
527
631
|
"Run `{0}` command in `{1}` in background within `{2}`?",
|
|
528
632
|
presenterResult.languageDisplayName,
|
|
529
633
|
shellType,
|
|
530
634
|
toolSpecificData.confirmation.cwdLabel
|
|
531
635
|
)) : ( localize(
|
|
532
|
-
|
|
636
|
+
13854,
|
|
533
637
|
"Run `{0}` command in `{1}` within `{2}`?",
|
|
534
638
|
presenterResult.languageDisplayName,
|
|
535
639
|
shellType,
|
|
@@ -537,12 +641,12 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
537
641
|
));
|
|
538
642
|
} else {
|
|
539
643
|
confirmationTitle = args.isBackground ? ( localize(
|
|
540
|
-
|
|
644
|
+
13855,
|
|
541
645
|
"Run `{0}` command in `{1}` in background?",
|
|
542
646
|
presenterResult.languageDisplayName,
|
|
543
647
|
shellType
|
|
544
648
|
)) : ( localize(
|
|
545
|
-
|
|
649
|
+
13856,
|
|
546
650
|
"Run `{0}` command in `{1}`?",
|
|
547
651
|
presenterResult.languageDisplayName,
|
|
548
652
|
shellType
|
|
@@ -554,15 +658,31 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
554
658
|
presenterInput = presenterResult.commandLine;
|
|
555
659
|
}
|
|
556
660
|
}
|
|
557
|
-
|
|
661
|
+
if (requiresUnsandboxConfirmation) {
|
|
662
|
+
confirmationTitle = args.isBackground ? ( localize(13857, "Run `{0}` command outside the sandbox in background?", shellType)) : ( localize(13858, "Run `{0}` command outside the sandbox?", shellType));
|
|
663
|
+
}
|
|
558
664
|
const shouldShowConfirmation = (!isFinalAutoApproved && !isSessionAutoApproved) || context.forceConfirmationReason !== undefined;
|
|
665
|
+
const confirmationMessage = requiresUnsandboxConfirmation ? ( new MarkdownString(( localize(
|
|
666
|
+
13859,
|
|
667
|
+
"Explanation: {0}\n\nGoal: {1}\n\nReason for leaving the sandbox: {2}",
|
|
668
|
+
args.explanation,
|
|
669
|
+
args.goal,
|
|
670
|
+
args.requestUnsandboxedExecutionReason || ( localize(13860, "The model indicated that this command needs unsandboxed access."))
|
|
671
|
+
)))) : ( new MarkdownString(( localize(13861, "Explanation: {0}\n\nGoal: {1}", args.explanation, args.goal))));
|
|
559
672
|
const confirmationMessages = shouldShowConfirmation ? {
|
|
560
673
|
title: confirmationTitle,
|
|
561
|
-
message:
|
|
674
|
+
message: confirmationMessage,
|
|
562
675
|
disclaimer,
|
|
676
|
+
allowAutoConfirm: undefined,
|
|
563
677
|
terminalCustomActions: customActions
|
|
564
678
|
} : undefined;
|
|
679
|
+
const rawDisplayCommand = toolSpecificData.commandLine.forDisplay ?? toolSpecificData.commandLine.toolEdited ?? toolSpecificData.commandLine.original;
|
|
680
|
+
const displayCommand = rawDisplayCommand.length > 80 ? rawDisplayCommand.substring(0, 77) + "..." : rawDisplayCommand;
|
|
681
|
+
const escapedDisplayCommand = escapeMarkdownSyntaxTokens(displayCommand);
|
|
682
|
+
const invocationMessage = toolSpecificData.commandLine.isSandboxWrapped ? args.isBackground ? ( new MarkdownString(( localize(13862, "Running `{0}` in sandbox in background", escapedDisplayCommand)))) : ( new MarkdownString(( localize(13863, "Running `{0}` in sandbox", escapedDisplayCommand)))) : args.isBackground ? ( new MarkdownString(( localize(13864, "Running `{0}` in background", escapedDisplayCommand)))) : ( new MarkdownString(( localize(13865, "Running `{0}`", escapedDisplayCommand))));
|
|
565
683
|
return {
|
|
684
|
+
invocationMessage,
|
|
685
|
+
icon: toolSpecificData.commandLine.isSandboxWrapped ? Codicon.terminalSecure : Codicon.terminal,
|
|
566
686
|
confirmationMessages,
|
|
567
687
|
toolSpecificData
|
|
568
688
|
};
|
|
@@ -603,7 +723,9 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
603
723
|
const chatSessionResource = invocation.context.sessionResource;
|
|
604
724
|
const command = toolSpecificData.commandLine.userEdited ?? toolSpecificData.commandLine.toolEdited ?? toolSpecificData.commandLine.original;
|
|
605
725
|
const didUserEditCommand = (toolSpecificData.commandLine.userEdited !== undefined && toolSpecificData.commandLine.userEdited !== toolSpecificData.commandLine.original);
|
|
606
|
-
const didToolEditCommand = (!didUserEditCommand && toolSpecificData.commandLine.toolEdited !== undefined && toolSpecificData.commandLine.toolEdited !== toolSpecificData.commandLine.original
|
|
726
|
+
const didToolEditCommand = (!didUserEditCommand && toolSpecificData.commandLine.toolEdited !== undefined && toolSpecificData.commandLine.toolEdited !== toolSpecificData.commandLine.original &&
|
|
727
|
+
normalizeTerminalCommandForDisplay(toolSpecificData.commandLine.toolEdited).trim() !== normalizeTerminalCommandForDisplay(toolSpecificData.commandLine.original).trim());
|
|
728
|
+
const didSandboxWrapCommand = toolSpecificData.commandLine.isSandboxWrapped === true;
|
|
607
729
|
if (token.isCancellationRequested) {
|
|
608
730
|
throw ( new CancellationError());
|
|
609
731
|
}
|
|
@@ -645,6 +767,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
645
767
|
let didTimeout = false;
|
|
646
768
|
let didMoveToBackground = args.isBackground;
|
|
647
769
|
let timeoutPromise;
|
|
770
|
+
let timeoutRacePromise;
|
|
648
771
|
let outputMonitor;
|
|
649
772
|
let pollingResult;
|
|
650
773
|
const executeCancellation = store.add(( new CancellationTokenSource(token)));
|
|
@@ -653,12 +776,11 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
653
776
|
const shouldEnforceTimeout = this._configurationService.getValue(TerminalChatAgentToolsSettingId.EnforceTimeoutFromModel) === true;
|
|
654
777
|
if (shouldEnforceTimeout) {
|
|
655
778
|
timeoutPromise = timeout(timeoutValue);
|
|
656
|
-
timeoutPromise.then(() => {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
});
|
|
779
|
+
timeoutRacePromise = timeoutPromise.then(() => ({
|
|
780
|
+
type: "timeout"
|
|
781
|
+
})).catch(() => ({
|
|
782
|
+
type: "timeout"
|
|
783
|
+
}));
|
|
662
784
|
}
|
|
663
785
|
}
|
|
664
786
|
let continueInBackgroundResolve;
|
|
@@ -690,7 +812,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
690
812
|
if (toolTerminal.shellIntegrationQuality === ShellIntegrationQuality.None) {
|
|
691
813
|
toolResultMessage = "$(info) Enable [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) to improve command detection";
|
|
692
814
|
}
|
|
693
|
-
this._logService.
|
|
815
|
+
this._logService.info(
|
|
694
816
|
`RunInTerminalTool: Using \`${execution.strategy.type}\` execute strategy for command \`${command}\``
|
|
695
817
|
);
|
|
696
818
|
store.add(execution);
|
|
@@ -720,15 +842,28 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
720
842
|
const state = toolSpecificData.terminalCommandState ?? {};
|
|
721
843
|
state.timestamp = state.timestamp ?? timingStart;
|
|
722
844
|
toolSpecificData.terminalCommandState = state;
|
|
723
|
-
let resultText = (didUserEditCommand ? `Note: The user manually edited the command to \`${command}\`, and that command is now running in terminal with ID=${termId}` : didToolEditCommand ? `Note: The tool simplified the command to \`${command}\`, and that command is now running in terminal with ID=${termId}` : `Command is running in terminal with ID=${termId}`);
|
|
845
|
+
let resultText = (didSandboxWrapCommand ? `Command is now running in terminal with ID=${termId}` : didUserEditCommand ? `Note: The user manually edited the command to \`${command}\`, and that command is now running in terminal with ID=${termId}` : didToolEditCommand ? `Note: The tool simplified the command to \`${command}\`, and that command is now running in terminal with ID=${termId}` : `Command is running in terminal with ID=${termId}`);
|
|
846
|
+
const backgroundOutput = pollingResult?.modelOutputEvalResponse ?? pollingResult?.output;
|
|
847
|
+
const outputAnalyzerMessage = backgroundOutput ? await this._getOutputAnalyzerMessage(undefined, backgroundOutput, command, didSandboxWrapCommand) : undefined;
|
|
724
848
|
if (pollingResult && pollingResult.modelOutputEvalResponse) {
|
|
725
|
-
resultText += `\n\ The command became idle with output:\n
|
|
849
|
+
resultText += `\n\ The command became idle with output:\n`;
|
|
850
|
+
if (outputAnalyzerMessage) {
|
|
851
|
+
resultText += `${outputAnalyzerMessage}\n`;
|
|
852
|
+
}
|
|
853
|
+
resultText += pollingResult.modelOutputEvalResponse;
|
|
726
854
|
} else if (pollingResult) {
|
|
727
|
-
resultText += `\n\ The command is still running, with output:\n
|
|
855
|
+
resultText += `\n\ The command is still running, with output:\n`;
|
|
856
|
+
if (outputAnalyzerMessage) {
|
|
857
|
+
resultText += `${outputAnalyzerMessage}\n`;
|
|
858
|
+
}
|
|
859
|
+
resultText += pollingResult.output;
|
|
728
860
|
}
|
|
861
|
+
const endCwd = await toolTerminal.instance.getCwdResource();
|
|
729
862
|
return {
|
|
730
863
|
toolMetadata: {
|
|
731
|
-
exitCode: undefined
|
|
864
|
+
exitCode: undefined,
|
|
865
|
+
id: termId,
|
|
866
|
+
cwd: endCwd?.toString()
|
|
732
867
|
},
|
|
733
868
|
content: [{
|
|
734
869
|
kind: "text",
|
|
@@ -736,12 +871,16 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
736
871
|
}]
|
|
737
872
|
};
|
|
738
873
|
} else {
|
|
739
|
-
const
|
|
874
|
+
const raceCandidates = [executionPromise.then(result => ({
|
|
740
875
|
type: "completed",
|
|
741
876
|
result
|
|
742
877
|
})), continueInBackgroundPromise.then(() => ({
|
|
743
878
|
type: "background"
|
|
744
|
-
}))]
|
|
879
|
+
}))];
|
|
880
|
+
if (timeoutRacePromise) {
|
|
881
|
+
raceCandidates.push(timeoutRacePromise);
|
|
882
|
+
}
|
|
883
|
+
const raceResult = await Promise.race(raceCandidates);
|
|
745
884
|
if (raceResult.type === "background") {
|
|
746
885
|
this._logService.debug(
|
|
747
886
|
`RunInTerminalTool: Continue in background triggered, returning output collected so far`
|
|
@@ -750,6 +889,23 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
750
889
|
const backgroundOutput = execution.getOutput();
|
|
751
890
|
outputLineCount = backgroundOutput ? count(backgroundOutput.trim(), "\n") + 1 : 0;
|
|
752
891
|
terminalResult = backgroundOutput;
|
|
892
|
+
} else if (raceResult.type === "timeout") {
|
|
893
|
+
this._logService.debug(`RunInTerminalTool: Timeout reached, returning output collected so far`);
|
|
894
|
+
error = "timeout";
|
|
895
|
+
didTimeout = true;
|
|
896
|
+
didMoveToBackground = true;
|
|
897
|
+
toolTerminal.isBackground = true;
|
|
898
|
+
this._sessionTerminalAssociations.delete(chatSessionResource);
|
|
899
|
+
await this._associateProcessIdWithSession(
|
|
900
|
+
toolTerminal.instance,
|
|
901
|
+
chatSessionResource,
|
|
902
|
+
termId,
|
|
903
|
+
toolTerminal.shellIntegrationQuality,
|
|
904
|
+
true
|
|
905
|
+
);
|
|
906
|
+
const timeoutOutput = execution.getOutput();
|
|
907
|
+
outputLineCount = timeoutOutput ? count(timeoutOutput.trim(), "\n") + 1 : 0;
|
|
908
|
+
terminalResult = timeoutOutput ?? "";
|
|
753
909
|
} else {
|
|
754
910
|
const executeResult = raceResult.result;
|
|
755
911
|
toolTerminal.receivedUserInput = false;
|
|
@@ -763,10 +919,13 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
763
919
|
toolResultMessage = altBufferMessage;
|
|
764
920
|
outputLineCount = 0;
|
|
765
921
|
error = executeResult.error ?? "alternateBuffer";
|
|
922
|
+
const altBufferCwd = await toolTerminal.instance.getCwdResource();
|
|
766
923
|
altBufferResult = {
|
|
767
924
|
toolResultMessage,
|
|
768
925
|
toolMetadata: {
|
|
769
|
-
exitCode: undefined
|
|
926
|
+
exitCode: undefined,
|
|
927
|
+
id: termId,
|
|
928
|
+
cwd: altBufferCwd?.toString()
|
|
770
929
|
},
|
|
771
930
|
content: [{
|
|
772
931
|
kind: "text",
|
|
@@ -786,7 +945,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
786
945
|
}
|
|
787
946
|
toolSpecificData.terminalCommandState = state;
|
|
788
947
|
}
|
|
789
|
-
this._logService.
|
|
948
|
+
this._logService.info(
|
|
790
949
|
`RunInTerminalTool: Finished \`${execution.strategy.type}\` execute strategy with exitCode \`${executeResult.exitCode}\`, result.length \`${executeResult.output?.length}\`, error \`${executeResult.error}\``
|
|
791
950
|
);
|
|
792
951
|
outputLineCount = executeResult.output === undefined ? 0 : count(executeResult.output.trim(), "\n") + 1;
|
|
@@ -807,6 +966,9 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
807
966
|
if (didTimeout && e instanceof CancellationError) {
|
|
808
967
|
this._logService.debug(`RunInTerminalTool: Timeout reached, returning output collected so far`);
|
|
809
968
|
error = "timeout";
|
|
969
|
+
didMoveToBackground = true;
|
|
970
|
+
toolTerminal.isBackground = true;
|
|
971
|
+
this._sessionTerminalAssociations.delete(chatSessionResource);
|
|
810
972
|
const timeoutOutput = getOutput(toolTerminal.instance, undefined);
|
|
811
973
|
outputLineCount = timeoutOutput ? count(timeoutOutput.trim(), "\n") + 1 : 0;
|
|
812
974
|
terminalResult = timeoutOutput ?? "";
|
|
@@ -872,41 +1034,43 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
872
1034
|
return altBufferResult;
|
|
873
1035
|
}
|
|
874
1036
|
const resultText = [];
|
|
875
|
-
if (
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
1037
|
+
if (!didSandboxWrapCommand) {
|
|
1038
|
+
if (didUserEditCommand) {
|
|
1039
|
+
resultText.push(
|
|
1040
|
+
`Note: The user manually edited the command to \`${command}\`, and this is the output of running that command instead:\n`
|
|
1041
|
+
);
|
|
1042
|
+
} else if (didToolEditCommand) {
|
|
1043
|
+
resultText.push(
|
|
1044
|
+
`Note: The tool simplified the command to \`${command}\`, and this is the output of running that command instead:\n`
|
|
1045
|
+
);
|
|
1046
|
+
}
|
|
1047
|
+
if (didMoveToBackground && !args.isBackground) {
|
|
1048
|
+
resultText.push(
|
|
1049
|
+
`Note: This terminal execution was moved to the background using the ID ${termId}\n`
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
883
1052
|
}
|
|
884
|
-
if (
|
|
1053
|
+
if (didTimeout && timeoutValue !== undefined && timeoutValue > 0) {
|
|
885
1054
|
resultText.push(
|
|
886
|
-
`Note:
|
|
1055
|
+
`Note: Command timed out after ${timeoutValue}ms. Output collected so far is shown below and the command may still be running in terminal ID ${termId}.\n\n`
|
|
887
1056
|
);
|
|
888
1057
|
}
|
|
889
|
-
|
|
890
|
-
for (const analyzer of this._outputAnalyzers) {
|
|
891
|
-
const message = await analyzer.analyze({
|
|
892
|
-
exitCode,
|
|
893
|
-
exitResult: terminalResult,
|
|
894
|
-
commandLine: command
|
|
895
|
-
});
|
|
896
|
-
if (message) {
|
|
897
|
-
outputAnalyzerMessage = message;
|
|
898
|
-
break;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
1058
|
+
const outputAnalyzerMessage = await this._getOutputAnalyzerMessage(exitCode, terminalResult, command, didSandboxWrapCommand);
|
|
901
1059
|
if (outputAnalyzerMessage) {
|
|
902
1060
|
resultText.push(`${outputAnalyzerMessage}\n`);
|
|
903
1061
|
}
|
|
904
1062
|
resultText.push(terminalResult);
|
|
905
1063
|
const isError = exitCode !== undefined && exitCode !== 0;
|
|
1064
|
+
const endCwd = await toolTerminal.instance.getCwdResource();
|
|
1065
|
+
const imageContent = await this._extractImagesFromOutput(terminalResult, endCwd);
|
|
906
1066
|
return {
|
|
907
1067
|
toolResultMessage,
|
|
908
1068
|
toolMetadata: {
|
|
909
|
-
exitCode: exitCode
|
|
1069
|
+
exitCode: exitCode,
|
|
1070
|
+
id: termId,
|
|
1071
|
+
cwd: endCwd?.toString(),
|
|
1072
|
+
timedOut: didTimeout || undefined,
|
|
1073
|
+
timeoutMs: didTimeout ? timeoutValue : undefined
|
|
910
1074
|
},
|
|
911
1075
|
toolResultDetails: isError ? {
|
|
912
1076
|
input: command,
|
|
@@ -920,9 +1084,67 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
920
1084
|
content: [{
|
|
921
1085
|
kind: "text",
|
|
922
1086
|
value: resultText.join("")
|
|
923
|
-
}]
|
|
1087
|
+
}, ...imageContent]
|
|
924
1088
|
};
|
|
925
1089
|
}
|
|
1090
|
+
async _getOutputAnalyzerMessage(exitCode, exitResult, commandLine, isSandboxWrapped) {
|
|
1091
|
+
for (const analyzer of this._outputAnalyzers) {
|
|
1092
|
+
const message = await analyzer.analyze({
|
|
1093
|
+
exitCode,
|
|
1094
|
+
exitResult,
|
|
1095
|
+
commandLine,
|
|
1096
|
+
isSandboxWrapped
|
|
1097
|
+
});
|
|
1098
|
+
if (message) {
|
|
1099
|
+
return message;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
return undefined;
|
|
1103
|
+
}
|
|
1104
|
+
static {
|
|
1105
|
+
this._maxImageFileSize = 5 * 1024 * 1024;
|
|
1106
|
+
}
|
|
1107
|
+
async _extractImagesFromOutput(output, cwd) {
|
|
1108
|
+
const normalizedOutput = output.replace(/\r?\n/g, "");
|
|
1109
|
+
const pathPattern = /(?:[^\s]*[\/\\][^\s]*\.(?:png|jpe?g|gif|webp|bmp))/gi;
|
|
1110
|
+
const matches = ( new Set());
|
|
1111
|
+
for (const match of normalizedOutput.matchAll(pathPattern)) {
|
|
1112
|
+
matches.add(match[0]);
|
|
1113
|
+
}
|
|
1114
|
+
if (matches.size === 0) {
|
|
1115
|
+
return [];
|
|
1116
|
+
}
|
|
1117
|
+
const results = [];
|
|
1118
|
+
for (const filePath of matches) {
|
|
1119
|
+
try {
|
|
1120
|
+
const mimeType = getMediaMime(filePath);
|
|
1121
|
+
if (!mimeType || !mimeType.startsWith("image/")) {
|
|
1122
|
+
continue;
|
|
1123
|
+
}
|
|
1124
|
+
let fileUri;
|
|
1125
|
+
if (/^\/|^[A-Za-z]:[\\\/]/.test(filePath)) {
|
|
1126
|
+
fileUri = URI.file(filePath);
|
|
1127
|
+
} else if (cwd) {
|
|
1128
|
+
fileUri = URI.joinPath(cwd, filePath);
|
|
1129
|
+
} else {
|
|
1130
|
+
continue;
|
|
1131
|
+
}
|
|
1132
|
+
const stat = await this._fileService.stat(fileUri).catch(() => undefined);
|
|
1133
|
+
if (!stat || stat.isDirectory || stat.size > RunInTerminalTool_1._maxImageFileSize) {
|
|
1134
|
+
continue;
|
|
1135
|
+
}
|
|
1136
|
+
const fileContent = await this._fileService.readFile(fileUri);
|
|
1137
|
+
results.push({
|
|
1138
|
+
kind: "data",
|
|
1139
|
+
value: {
|
|
1140
|
+
mimeType,
|
|
1141
|
+
data: fileContent.value
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
} catch {}
|
|
1145
|
+
}
|
|
1146
|
+
return results;
|
|
1147
|
+
}
|
|
926
1148
|
_handleTerminalVisibility(toolTerminal, chatSessionResource) {
|
|
927
1149
|
const chatSessionOpenInWidget = !!this._chatWidgetService.getWidgetBySessionResource(chatSessionResource);
|
|
928
1150
|
if (this._configurationService.getValue(TerminalChatAgentToolsSettingId.OutputLocation) === "terminal" && chatSessionOpenInWidget) {
|
|
@@ -952,7 +1174,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
952
1174
|
this._terminalChatService.registerTerminalInstanceWithToolSession(terminalToolSessionId, toolTerminal.instance);
|
|
953
1175
|
this._terminalChatService.registerTerminalInstanceWithChatSession(chatSessionResource, toolTerminal.instance);
|
|
954
1176
|
this._registerInputListener(toolTerminal);
|
|
955
|
-
this.
|
|
1177
|
+
this._addSessionTerminalAssociation(chatSessionResource, toolTerminal);
|
|
956
1178
|
if (token.isCancellationRequested) {
|
|
957
1179
|
toolTerminal.instance.dispose();
|
|
958
1180
|
throw ( new CancellationError());
|
|
@@ -989,7 +1211,7 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
989
1211
|
shellIntegrationQuality: association.shellIntegrationQuality,
|
|
990
1212
|
isBackground: association.isBackground
|
|
991
1213
|
};
|
|
992
|
-
this.
|
|
1214
|
+
this._addSessionTerminalAssociation(chatSessionResource, toolTerminal);
|
|
993
1215
|
this._terminalChatService.registerTerminalInstanceWithChatSession(chatSessionResource, instance);
|
|
994
1216
|
this._register(instance.onDisposed(() => {
|
|
995
1217
|
this._removeProcessIdAssociation(instance.processId);
|
|
@@ -1076,27 +1298,74 @@ let RunInTerminalTool = class RunInTerminalTool extends Disposable {
|
|
|
1076
1298
|
}
|
|
1077
1299
|
}
|
|
1078
1300
|
_cleanupSessionTerminals(chatSessionResource) {
|
|
1301
|
+
const sessionTerminals = this._sessionTerminalInstances.get(chatSessionResource);
|
|
1079
1302
|
const toolTerminal = this._sessionTerminalAssociations.get(chatSessionResource);
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1303
|
+
const terminalsToDispose = sessionTerminals ?? (toolTerminal ? ( new Set([toolTerminal.instance])) : undefined);
|
|
1304
|
+
if (!terminalsToDispose || terminalsToDispose.size === 0) {
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
this._logService.debug(
|
|
1308
|
+
`RunInTerminalTool: Cleaning up ${terminalsToDispose.size} terminal(s) for ended chat session ${chatSessionResource}`
|
|
1309
|
+
);
|
|
1310
|
+
this._sessionTerminalAssociations.delete(chatSessionResource);
|
|
1311
|
+
this._sessionTerminalInstances.delete(chatSessionResource);
|
|
1312
|
+
for (const terminal of terminalsToDispose) {
|
|
1313
|
+
this._terminalsBeingDisposedBySessionCleanup.add(terminal);
|
|
1314
|
+
terminal.dispose();
|
|
1315
|
+
}
|
|
1316
|
+
const terminalToRemove = [];
|
|
1317
|
+
for (const [termId, execution] of RunInTerminalTool_1._activeExecutions.entries()) {
|
|
1318
|
+
if (( terminalsToDispose.has(execution.instance))) {
|
|
1319
|
+
execution.dispose();
|
|
1320
|
+
terminalToRemove.push(termId);
|
|
1092
1321
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1322
|
+
}
|
|
1323
|
+
for (const termId of terminalToRemove) {
|
|
1324
|
+
RunInTerminalTool_1._activeExecutions.delete(termId);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
_addSessionTerminalAssociation(chatSessionResource, toolTerminal) {
|
|
1328
|
+
this._ensureArchivedSessionListener();
|
|
1329
|
+
let sessionTerminals = this._sessionTerminalInstances.get(chatSessionResource);
|
|
1330
|
+
if (!sessionTerminals) {
|
|
1331
|
+
sessionTerminals = ( new Set());
|
|
1332
|
+
this._sessionTerminalInstances.set(chatSessionResource, sessionTerminals);
|
|
1333
|
+
}
|
|
1334
|
+
sessionTerminals.add(toolTerminal.instance);
|
|
1335
|
+
if (!toolTerminal.isBackground) {
|
|
1336
|
+
this._sessionTerminalAssociations.set(chatSessionResource, toolTerminal);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
_ensureArchivedSessionListener() {
|
|
1340
|
+
if (this._archivedSessionListener.value) {
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
this._archivedSessionListener.value = this._agentSessionsService.onDidChangeSessionArchivedState(session => {
|
|
1344
|
+
if (session.isArchived()) {
|
|
1345
|
+
this._cleanupSessionTerminals(session.resource);
|
|
1346
|
+
}
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
_removeTerminalAssociations(terminal) {
|
|
1350
|
+
if (this._terminalsBeingDisposedBySessionCleanup.delete(terminal)) {
|
|
1351
|
+
return;
|
|
1352
|
+
}
|
|
1353
|
+
for (const [sessionResource, toolTerminal] of this._sessionTerminalAssociations.entries()) {
|
|
1354
|
+
if (terminal === toolTerminal.instance) {
|
|
1355
|
+
this._sessionTerminalAssociations.delete(sessionResource);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
for (const [sessionResource, sessionTerminals] of this._sessionTerminalInstances.entries()) {
|
|
1359
|
+
if (!sessionTerminals.delete(terminal)) {
|
|
1360
|
+
continue;
|
|
1361
|
+
}
|
|
1362
|
+
if (sessionTerminals.size === 0) {
|
|
1363
|
+
this._sessionTerminalInstances.delete(sessionResource);
|
|
1095
1364
|
}
|
|
1096
1365
|
}
|
|
1097
1366
|
}
|
|
1098
1367
|
};
|
|
1099
|
-
RunInTerminalTool = RunInTerminalTool_1 = ( __decorate([( __param(0, IChatService)), ( __param(1, IConfigurationService)), ( __param(2,
|
|
1368
|
+
RunInTerminalTool = RunInTerminalTool_1 = ( __decorate([( __param(0, IChatService)), ( __param(1, IConfigurationService)), ( __param(2, IFileService)), ( __param(3, IHistoryService)), ( __param(4, IInstantiationService)), ( __param(5, ILabelService)), ( __param(6, ILanguageModelToolsService)), ( __param(7, IRemoteAgentService)), ( __param(8, IStorageService)), ( __param(9, ITerminalChatService)), ( __param(10, ITerminalLogService)), ( __param(11, ITerminalService)), ( __param(12, ITerminalSandboxService)), ( __param(13, IWorkspaceContextService)), ( __param(14, IChatWidgetService)), ( __param(15, IAgentSessionsService))], RunInTerminalTool));
|
|
1100
1369
|
let ActiveTerminalExecution = class ActiveTerminalExecution extends Disposable {
|
|
1101
1370
|
get completionPromise() {
|
|
1102
1371
|
return this._completionDeferred.p;
|
|
@@ -1200,6 +1469,13 @@ let TerminalProfileFetcher = class TerminalProfileFetcher {
|
|
|
1200
1469
|
profileName: "PowerShell"
|
|
1201
1470
|
};
|
|
1202
1471
|
}
|
|
1472
|
+
if (defaultProfile.path === "/bin/sh") {
|
|
1473
|
+
return {
|
|
1474
|
+
...defaultProfile,
|
|
1475
|
+
path: "/bin/bash",
|
|
1476
|
+
profileName: "bash"
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1203
1479
|
return {
|
|
1204
1480
|
...defaultProfile,
|
|
1205
1481
|
icon: undefined
|