@codingame/monaco-vscode-chat-service-override 28.4.1 → 29.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 +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
|
@@ -187,7 +187,7 @@ let TerminalChatWidget = class TerminalChatWidget extends Disposable {
|
|
|
187
187
|
}
|
|
188
188
|
_resetPlaceholder() {
|
|
189
189
|
const defaultAgent = this._chatAgentService.getDefaultAgent(ChatAgentLocation.Terminal);
|
|
190
|
-
this.inlineChatWidget.placeholder = defaultAgent?.description ?? ( localize(
|
|
190
|
+
this.inlineChatWidget.placeholder = defaultAgent?.description ?? ( localize(13791, "Ask about commands"));
|
|
191
191
|
}
|
|
192
192
|
async reveal() {
|
|
193
193
|
await this._createSession();
|
|
@@ -366,7 +366,7 @@ let TerminalChatWidget = class TerminalChatWidget extends Disposable {
|
|
|
366
366
|
if (!model?.sessionResource) {
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
|
-
this._chatService.cancelCurrentRequestForSession(model?.sessionResource, "terminalChat");
|
|
369
|
+
void this._chatService.cancelCurrentRequestForSession(model?.sessionResource, "terminalChat");
|
|
370
370
|
}
|
|
371
371
|
async viewInChat() {
|
|
372
372
|
const widget = await this._chatWidgetService.revealWidget();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
3
3
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
4
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
5
|
import type { ICommandDetectionCapability } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
|
|
5
6
|
import { ITerminalLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service";
|
|
6
7
|
import { type ITerminalExecuteStrategy, type ITerminalExecuteStrategyResult } from "./executeStrategy.js";
|
|
@@ -32,12 +33,13 @@ export declare class BasicExecuteStrategy extends Disposable implements ITermina
|
|
|
32
33
|
private readonly _instance;
|
|
33
34
|
private readonly _hasReceivedUserInput;
|
|
34
35
|
private readonly _commandDetection;
|
|
36
|
+
private readonly _configurationService;
|
|
35
37
|
private readonly _logService;
|
|
36
38
|
readonly type = "basic";
|
|
37
39
|
private readonly _startMarker;
|
|
38
40
|
private readonly _onDidCreateStartMarker;
|
|
39
41
|
onDidCreateStartMarker: Event<IXtermMarker | undefined>;
|
|
40
|
-
constructor(_instance: ITerminalInstance, _hasReceivedUserInput: () => boolean, _commandDetection: ICommandDetectionCapability, _logService: ITerminalLogService);
|
|
42
|
+
constructor(_instance: ITerminalInstance, _hasReceivedUserInput: () => boolean, _commandDetection: ICommandDetectionCapability, _configurationService: IConfigurationService, _logService: ITerminalLogService);
|
|
41
43
|
execute(commandLine: string, token: CancellationToken, commandId?: string): Promise<ITerminalExecuteStrategyResult>;
|
|
42
44
|
private _log;
|
|
43
45
|
}
|
|
@@ -4,16 +4,25 @@ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/c
|
|
|
4
4
|
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
5
5
|
import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
6
|
import { isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
7
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
7
8
|
import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
|
|
8
9
|
import { trackIdleOnPrompt, waitForIdle } from './executeStrategy.js';
|
|
9
|
-
import { createAltBufferPromise, setupRecreatingStartMarker } from './strategyHelpers.js';
|
|
10
|
+
import { createAltBufferPromise, setupRecreatingStartMarker, stripCommandEchoAndPrompt } from './strategyHelpers.js';
|
|
11
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
10
12
|
|
|
11
13
|
let BasicExecuteStrategy = class BasicExecuteStrategy extends Disposable {
|
|
12
|
-
constructor(
|
|
14
|
+
constructor(
|
|
15
|
+
_instance,
|
|
16
|
+
_hasReceivedUserInput,
|
|
17
|
+
_commandDetection,
|
|
18
|
+
_configurationService,
|
|
19
|
+
_logService
|
|
20
|
+
) {
|
|
13
21
|
super();
|
|
14
22
|
this._instance = _instance;
|
|
15
23
|
this._hasReceivedUserInput = _hasReceivedUserInput;
|
|
16
24
|
this._commandDetection = _commandDetection;
|
|
25
|
+
this._configurationService = _configurationService;
|
|
17
26
|
this._logService = _logService;
|
|
18
27
|
this.type = "basic";
|
|
19
28
|
this._startMarker = this._register(( new MutableDisposable()));
|
|
@@ -23,7 +32,8 @@ let BasicExecuteStrategy = class BasicExecuteStrategy extends Disposable {
|
|
|
23
32
|
async execute(commandLine, token, commandId) {
|
|
24
33
|
const store = ( new DisposableStore());
|
|
25
34
|
try {
|
|
26
|
-
const
|
|
35
|
+
const idlePollInterval = this._configurationService.getValue(TerminalChatAgentToolsSettingId.IdlePollInterval) ?? 1000;
|
|
36
|
+
const idlePromptPromise = trackIdleOnPrompt(this._instance, idlePollInterval, store, idlePollInterval);
|
|
27
37
|
const onDone = Promise.race([
|
|
28
38
|
Event.toPromise(this._commandDetection.onCommandFinished, store).then(e => {
|
|
29
39
|
this._log("onDone 1 of 2 via end event, waiting for short idle prompt");
|
|
@@ -44,7 +54,7 @@ let BasicExecuteStrategy = class BasicExecuteStrategy extends Disposable {
|
|
|
44
54
|
type: "disposal"
|
|
45
55
|
};
|
|
46
56
|
}),
|
|
47
|
-
trackIdleOnPrompt(this._instance,
|
|
57
|
+
trackIdleOnPrompt(this._instance, idlePollInterval * 3, store, idlePollInterval).then(() => {
|
|
48
58
|
this._log("onDone long idle prompt");
|
|
49
59
|
})
|
|
50
60
|
]);
|
|
@@ -55,8 +65,8 @@ let BasicExecuteStrategy = class BasicExecuteStrategy extends Disposable {
|
|
|
55
65
|
}
|
|
56
66
|
const alternateBufferPromise = createAltBufferPromise(xterm, store, this._log.bind(this));
|
|
57
67
|
this._log("Waiting for idle");
|
|
58
|
-
await waitForIdle(this._instance.onData,
|
|
59
|
-
setupRecreatingStartMarker(
|
|
68
|
+
await waitForIdle(this._instance.onData, idlePollInterval);
|
|
69
|
+
const markerRecreation = setupRecreatingStartMarker(
|
|
60
70
|
xterm,
|
|
61
71
|
this._startMarker,
|
|
62
72
|
m => this._onDidCreateStartMarker.fire(m),
|
|
@@ -74,6 +84,7 @@ let BasicExecuteStrategy = class BasicExecuteStrategy extends Disposable {
|
|
|
74
84
|
);
|
|
75
85
|
}
|
|
76
86
|
this._log(`Executing command line \`${commandLine}\``);
|
|
87
|
+
markerRecreation.dispose();
|
|
77
88
|
this._instance.sendText(commandLine, true);
|
|
78
89
|
this._log("Waiting for done event");
|
|
79
90
|
const onDoneResult = await Promise.race([onDone, alternateBufferPromise.then(() => ({
|
|
@@ -100,7 +111,7 @@ let BasicExecuteStrategy = class BasicExecuteStrategy extends Disposable {
|
|
|
100
111
|
this._log(`No finished command surfaced for requested=${commandId}`);
|
|
101
112
|
}
|
|
102
113
|
this._log("Waiting for idle");
|
|
103
|
-
await waitForIdle(this._instance.onData,
|
|
114
|
+
await waitForIdle(this._instance.onData, idlePollInterval);
|
|
104
115
|
if (token.isCancellationRequested) {
|
|
105
116
|
throw ( new CancellationError());
|
|
106
117
|
}
|
|
@@ -111,13 +122,16 @@ let BasicExecuteStrategy = class BasicExecuteStrategy extends Disposable {
|
|
|
111
122
|
const commandOutput = finishedCommand?.getOutput();
|
|
112
123
|
if (commandOutput !== undefined) {
|
|
113
124
|
this._log("Fetched output via finished command");
|
|
114
|
-
output = commandOutput;
|
|
125
|
+
output = stripCommandEchoAndPrompt(commandOutput, commandLine, this._log.bind(this));
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
128
|
if (output === undefined) {
|
|
118
129
|
try {
|
|
119
130
|
output = xterm.getContentsAsText(this._startMarker.value, endMarker);
|
|
120
131
|
this._log("Fetched output via markers");
|
|
132
|
+
if (output !== undefined) {
|
|
133
|
+
output = stripCommandEchoAndPrompt(output, commandLine, this._log.bind(this));
|
|
134
|
+
}
|
|
121
135
|
} catch {
|
|
122
136
|
this._log("Failed to fetch output via markers");
|
|
123
137
|
additionalInformationLines.push("Failed to retrieve command output");
|
|
@@ -143,6 +157,6 @@ let BasicExecuteStrategy = class BasicExecuteStrategy extends Disposable {
|
|
|
143
157
|
this._logService.debug(`RunInTerminalTool#Basic: ${message}`);
|
|
144
158
|
}
|
|
145
159
|
};
|
|
146
|
-
BasicExecuteStrategy = ( __decorate([( __param(3, ITerminalLogService))], BasicExecuteStrategy));
|
|
160
|
+
BasicExecuteStrategy = ( __decorate([( __param(3, IConfigurationService)), ( __param(4, ITerminalLogService))], BasicExecuteStrategy));
|
|
147
161
|
|
|
148
162
|
export { BasicExecuteStrategy };
|
|
@@ -47,4 +47,4 @@ export declare function waitForIdleWithPromptHeuristics(onData: Event<unknown>,
|
|
|
47
47
|
* Tracks the terminal for being idle on a prompt input. This must be called before `executeCommand`
|
|
48
48
|
* is called.
|
|
49
49
|
*/
|
|
50
|
-
export declare function trackIdleOnPrompt(instance: ITerminalInstance, idleDurationMs: number, store: DisposableStore): Promise<void>;
|
|
50
|
+
export declare function trackIdleOnPrompt(instance: ITerminalInstance, idleDurationMs: number, store: DisposableStore, promptFallbackMs?: number): Promise<void>;
|
|
@@ -110,7 +110,7 @@ async function waitForIdleWithPromptHeuristics(onData, instance, idlePollInterva
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
async function trackIdleOnPrompt(instance, idleDurationMs, store) {
|
|
113
|
+
async function trackIdleOnPrompt(instance, idleDurationMs, store, promptFallbackMs) {
|
|
114
114
|
const idleOnPrompt = ( new DeferredPromise());
|
|
115
115
|
const onData = instance.onData;
|
|
116
116
|
const scheduler = store.add(( new RunOnceScheduler(() => {
|
|
@@ -124,7 +124,7 @@ async function trackIdleOnPrompt(instance, idleDurationMs, store) {
|
|
|
124
124
|
}
|
|
125
125
|
state = 3 ;
|
|
126
126
|
scheduler.schedule();
|
|
127
|
-
}, 1000)));
|
|
127
|
+
}, promptFallbackMs ?? 1000)));
|
|
128
128
|
let TerminalState;
|
|
129
129
|
(function(TerminalState) {
|
|
130
130
|
TerminalState[TerminalState["Initial"] = 0] = "Initial";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
3
3
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
4
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
5
|
import { ITerminalLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service";
|
|
5
6
|
import { type ITerminalExecuteStrategy, type ITerminalExecuteStrategyResult } from "./executeStrategy.js";
|
|
6
7
|
import type { IMarker as IXtermMarker } from "@xterm/xterm";
|
|
@@ -14,12 +15,13 @@ import { ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbe
|
|
|
14
15
|
export declare class NoneExecuteStrategy extends Disposable implements ITerminalExecuteStrategy {
|
|
15
16
|
private readonly _instance;
|
|
16
17
|
private readonly _hasReceivedUserInput;
|
|
18
|
+
private readonly _configurationService;
|
|
17
19
|
private readonly _logService;
|
|
18
20
|
readonly type = "none";
|
|
19
21
|
private readonly _startMarker;
|
|
20
22
|
private readonly _onDidCreateStartMarker;
|
|
21
23
|
onDidCreateStartMarker: Event<IXtermMarker | undefined>;
|
|
22
|
-
constructor(_instance: ITerminalInstance, _hasReceivedUserInput: () => boolean, _logService: ITerminalLogService);
|
|
24
|
+
constructor(_instance: ITerminalInstance, _hasReceivedUserInput: () => boolean, _configurationService: IConfigurationService, _logService: ITerminalLogService);
|
|
23
25
|
execute(commandLine: string, token: CancellationToken, commandId?: string): Promise<ITerminalExecuteStrategyResult>;
|
|
24
26
|
private _log;
|
|
25
27
|
}
|
|
@@ -3,15 +3,18 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
|
|
|
3
3
|
import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
4
4
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
5
5
|
import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
6
7
|
import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
|
|
7
8
|
import { waitForIdle, waitForIdleWithPromptHeuristics } from './executeStrategy.js';
|
|
8
|
-
import { createAltBufferPromise, setupRecreatingStartMarker } from './strategyHelpers.js';
|
|
9
|
+
import { createAltBufferPromise, setupRecreatingStartMarker, stripCommandEchoAndPrompt } from './strategyHelpers.js';
|
|
10
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
9
11
|
|
|
10
12
|
let NoneExecuteStrategy = class NoneExecuteStrategy extends Disposable {
|
|
11
|
-
constructor(_instance, _hasReceivedUserInput, _logService) {
|
|
13
|
+
constructor(_instance, _hasReceivedUserInput, _configurationService, _logService) {
|
|
12
14
|
super();
|
|
13
15
|
this._instance = _instance;
|
|
14
16
|
this._hasReceivedUserInput = _hasReceivedUserInput;
|
|
17
|
+
this._configurationService = _configurationService;
|
|
15
18
|
this._logService = _logService;
|
|
16
19
|
this.type = "none";
|
|
17
20
|
this._startMarker = this._register(( new MutableDisposable()));
|
|
@@ -30,12 +33,13 @@ let NoneExecuteStrategy = class NoneExecuteStrategy extends Disposable {
|
|
|
30
33
|
throw ( new Error("Xterm is not available"));
|
|
31
34
|
}
|
|
32
35
|
const alternateBufferPromise = createAltBufferPromise(xterm, store, this._log.bind(this));
|
|
36
|
+
const idlePollInterval = this._configurationService.getValue(TerminalChatAgentToolsSettingId.IdlePollInterval) ?? 1000;
|
|
33
37
|
this._log("Waiting for idle");
|
|
34
|
-
await waitForIdle(this._instance.onData,
|
|
38
|
+
await waitForIdle(this._instance.onData, idlePollInterval);
|
|
35
39
|
if (token.isCancellationRequested) {
|
|
36
40
|
throw ( new CancellationError());
|
|
37
41
|
}
|
|
38
|
-
setupRecreatingStartMarker(
|
|
42
|
+
const markerRecreation = setupRecreatingStartMarker(
|
|
39
43
|
xterm,
|
|
40
44
|
this._startMarker,
|
|
41
45
|
m => this._onDidCreateStartMarker.fire(m),
|
|
@@ -48,12 +52,43 @@ let NoneExecuteStrategy = class NoneExecuteStrategy extends Disposable {
|
|
|
48
52
|
await waitForIdle(this._instance.onData, 100);
|
|
49
53
|
}
|
|
50
54
|
this._log(`Executing command line \`${commandLine}\``);
|
|
55
|
+
markerRecreation.dispose();
|
|
56
|
+
const startLine = this._startMarker.value?.line;
|
|
51
57
|
this._instance.sendText(commandLine, true);
|
|
58
|
+
if (startLine !== undefined) {
|
|
59
|
+
this._log("Waiting for cursor to move past start line");
|
|
60
|
+
const cursorMovedPromise = ( new Promise(resolve => {
|
|
61
|
+
const check = () => {
|
|
62
|
+
const buffer = xterm.raw.buffer.active;
|
|
63
|
+
const cursorLine = buffer.baseY + buffer.cursorY;
|
|
64
|
+
if (cursorLine > startLine) {
|
|
65
|
+
resolve();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const listener = this._instance.onData(() => check());
|
|
69
|
+
store.add(listener);
|
|
70
|
+
check();
|
|
71
|
+
}));
|
|
72
|
+
const cursorMoveTimeout = ( new Promise(resolve => {
|
|
73
|
+
const handle = setTimeout(() => resolve("timeout"), 5000);
|
|
74
|
+
store.add({
|
|
75
|
+
dispose: () => clearTimeout(handle)
|
|
76
|
+
});
|
|
77
|
+
}));
|
|
78
|
+
const raceResult = await Promise.race([cursorMovedPromise, cursorMoveTimeout]);
|
|
79
|
+
if (raceResult === "timeout") {
|
|
80
|
+
this._log(
|
|
81
|
+
"Cursor did not move past start line before timeout, proceeding with idle detection"
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
52
85
|
this._log("Waiting for idle with prompt heuristics");
|
|
53
|
-
const promptResultOrAltBuffer = await Promise.race([
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
86
|
+
const promptResultOrAltBuffer = await Promise.race([waitForIdleWithPromptHeuristics(
|
|
87
|
+
this._instance.onData,
|
|
88
|
+
this._instance,
|
|
89
|
+
idlePollInterval,
|
|
90
|
+
idlePollInterval * 10
|
|
91
|
+
), alternateBufferPromise.then(() => "alternateBuffer")]);
|
|
57
92
|
if (promptResultOrAltBuffer === "alternateBuffer") {
|
|
58
93
|
this._log("Detected alternate buffer entry, skipping output capture");
|
|
59
94
|
return {
|
|
@@ -77,10 +112,16 @@ let NoneExecuteStrategy = class NoneExecuteStrategy extends Disposable {
|
|
|
77
112
|
try {
|
|
78
113
|
output = xterm.getContentsAsText(this._startMarker.value, endMarker);
|
|
79
114
|
this._log("Fetched output via markers");
|
|
115
|
+
if (output !== undefined) {
|
|
116
|
+
output = stripCommandEchoAndPrompt(output, commandLine, this._log.bind(this));
|
|
117
|
+
}
|
|
80
118
|
} catch {
|
|
81
119
|
this._log("Failed to fetch output via markers");
|
|
82
120
|
additionalInformationLines.push("Failed to retrieve command output");
|
|
83
121
|
}
|
|
122
|
+
if (output !== undefined && output.trim().length === 0) {
|
|
123
|
+
additionalInformationLines.push("Command produced no output");
|
|
124
|
+
}
|
|
84
125
|
return {
|
|
85
126
|
output,
|
|
86
127
|
additionalInformation: additionalInformationLines.length > 0 ? additionalInformationLines.join("\n") : undefined,
|
|
@@ -94,6 +135,6 @@ let NoneExecuteStrategy = class NoneExecuteStrategy extends Disposable {
|
|
|
94
135
|
this._logService.debug(`RunInTerminalTool#None: ${message}`);
|
|
95
136
|
}
|
|
96
137
|
};
|
|
97
|
-
NoneExecuteStrategy = ( __decorate([( __param(2, ITerminalLogService))], NoneExecuteStrategy));
|
|
138
|
+
NoneExecuteStrategy = ( __decorate([( __param(2, IConfigurationService)), ( __param(3, ITerminalLogService))], NoneExecuteStrategy));
|
|
98
139
|
|
|
99
140
|
export { NoneExecuteStrategy };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
3
3
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
4
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
5
|
import type { ICommandDetectionCapability } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
|
|
5
6
|
import { ITerminalLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service";
|
|
6
7
|
import type { ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
|
|
@@ -16,12 +17,13 @@ import type { IMarker as IXtermMarker } from "@xterm/xterm";
|
|
|
16
17
|
export declare class RichExecuteStrategy extends Disposable implements ITerminalExecuteStrategy {
|
|
17
18
|
private readonly _instance;
|
|
18
19
|
private readonly _commandDetection;
|
|
20
|
+
private readonly _configurationService;
|
|
19
21
|
private readonly _logService;
|
|
20
22
|
readonly type = "rich";
|
|
21
23
|
private readonly _startMarker;
|
|
22
24
|
private readonly _onDidCreateStartMarker;
|
|
23
25
|
onDidCreateStartMarker: Event<IXtermMarker | undefined>;
|
|
24
|
-
constructor(_instance: ITerminalInstance, _commandDetection: ICommandDetectionCapability, _logService: ITerminalLogService);
|
|
26
|
+
constructor(_instance: ITerminalInstance, _commandDetection: ICommandDetectionCapability, _configurationService: IConfigurationService, _logService: ITerminalLogService);
|
|
25
27
|
execute(commandLine: string, token: CancellationToken, commandId?: string): Promise<ITerminalExecuteStrategyResult>;
|
|
26
28
|
private _log;
|
|
27
29
|
}
|
|
@@ -4,15 +4,19 @@ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/c
|
|
|
4
4
|
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
5
5
|
import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
6
|
import { isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
7
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
|
+
import { isCI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
9
|
import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
|
|
8
10
|
import { trackIdleOnPrompt } from './executeStrategy.js';
|
|
9
|
-
import { createAltBufferPromise, setupRecreatingStartMarker } from './strategyHelpers.js';
|
|
11
|
+
import { createAltBufferPromise, setupRecreatingStartMarker, stripCommandEchoAndPrompt } from './strategyHelpers.js';
|
|
12
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
10
13
|
|
|
11
14
|
let RichExecuteStrategy = class RichExecuteStrategy extends Disposable {
|
|
12
|
-
constructor(_instance, _commandDetection, _logService) {
|
|
15
|
+
constructor(_instance, _commandDetection, _configurationService, _logService) {
|
|
13
16
|
super();
|
|
14
17
|
this._instance = _instance;
|
|
15
18
|
this._commandDetection = _commandDetection;
|
|
19
|
+
this._configurationService = _configurationService;
|
|
16
20
|
this._logService = _logService;
|
|
17
21
|
this.type = "rich";
|
|
18
22
|
this._startMarker = this._register(( new MutableDisposable()));
|
|
@@ -28,6 +32,7 @@ let RichExecuteStrategy = class RichExecuteStrategy extends Disposable {
|
|
|
28
32
|
throw ( new Error("Xterm is not available"));
|
|
29
33
|
}
|
|
30
34
|
const alternateBufferPromise = createAltBufferPromise(xterm, store, this._log.bind(this));
|
|
35
|
+
const idlePollInterval = this._configurationService.getValue(TerminalChatAgentToolsSettingId.IdlePollInterval) ?? 1000;
|
|
31
36
|
const onDone = Promise.race([
|
|
32
37
|
Event.toPromise(this._commandDetection.onCommandFinished, store).then(e => {
|
|
33
38
|
this._log("onDone via end event");
|
|
@@ -45,11 +50,11 @@ let RichExecuteStrategy = class RichExecuteStrategy extends Disposable {
|
|
|
45
50
|
type: "disposal"
|
|
46
51
|
};
|
|
47
52
|
}),
|
|
48
|
-
trackIdleOnPrompt(this._instance,
|
|
53
|
+
trackIdleOnPrompt(this._instance, idlePollInterval, store, idlePollInterval).then(() => {
|
|
49
54
|
this._log("onDone via idle prompt");
|
|
50
55
|
})
|
|
51
56
|
]);
|
|
52
|
-
setupRecreatingStartMarker(
|
|
57
|
+
const markerRecreation = setupRecreatingStartMarker(
|
|
53
58
|
xterm,
|
|
54
59
|
this._startMarker,
|
|
55
60
|
m => this._onDidCreateStartMarker.fire(m),
|
|
@@ -57,6 +62,7 @@ let RichExecuteStrategy = class RichExecuteStrategy extends Disposable {
|
|
|
57
62
|
this._log.bind(this)
|
|
58
63
|
);
|
|
59
64
|
this._log(`Executing command line \`${commandLine}\``);
|
|
65
|
+
markerRecreation.dispose();
|
|
60
66
|
this._instance.runCommand(commandLine, true, commandId);
|
|
61
67
|
this._log("Waiting for done event");
|
|
62
68
|
const onDoneResult = await Promise.race([onDone, alternateBufferPromise.then(() => ({
|
|
@@ -85,13 +91,16 @@ let RichExecuteStrategy = class RichExecuteStrategy extends Disposable {
|
|
|
85
91
|
const commandOutput = finishedCommand?.getOutput();
|
|
86
92
|
if (commandOutput !== undefined) {
|
|
87
93
|
this._log("Fetched output via finished command");
|
|
88
|
-
output = commandOutput;
|
|
94
|
+
output = stripCommandEchoAndPrompt(commandOutput, commandLine, this._log.bind(this));
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
if (output === undefined) {
|
|
92
98
|
try {
|
|
93
99
|
output = xterm.getContentsAsText(this._startMarker.value, endMarker);
|
|
94
100
|
this._log("Fetched output via markers");
|
|
101
|
+
if (output !== undefined) {
|
|
102
|
+
output = stripCommandEchoAndPrompt(output, commandLine, this._log.bind(this));
|
|
103
|
+
}
|
|
95
104
|
} catch {
|
|
96
105
|
this._log("Failed to fetch output via markers");
|
|
97
106
|
additionalInformationLines.push("Failed to retrieve command output");
|
|
@@ -114,9 +123,14 @@ let RichExecuteStrategy = class RichExecuteStrategy extends Disposable {
|
|
|
114
123
|
}
|
|
115
124
|
}
|
|
116
125
|
_log(message) {
|
|
117
|
-
|
|
126
|
+
const msg = `RunInTerminalTool#Rich: ${message}`;
|
|
127
|
+
if (isCI) {
|
|
128
|
+
this._logService.info(msg);
|
|
129
|
+
} else {
|
|
130
|
+
this._logService.debug(msg);
|
|
131
|
+
}
|
|
118
132
|
}
|
|
119
133
|
};
|
|
120
|
-
RichExecuteStrategy = ( __decorate([( __param(2, ITerminalLogService))], RichExecuteStrategy));
|
|
134
|
+
RichExecuteStrategy = ( __decorate([( __param(2, IConfigurationService)), ( __param(3, ITerminalLogService))], RichExecuteStrategy));
|
|
121
135
|
|
|
122
136
|
export { RichExecuteStrategy };
|
|
@@ -9,7 +9,7 @@ export declare function setupRecreatingStartMarker(xterm: {
|
|
|
9
9
|
raw: {
|
|
10
10
|
registerMarker(): IXtermMarker | undefined;
|
|
11
11
|
};
|
|
12
|
-
}, startMarker: MutableDisposable<IXtermMarker>, fire: (marker: IXtermMarker | undefined) => void, store: DisposableStore, log?: (message: string) => void):
|
|
12
|
+
}, startMarker: MutableDisposable<IXtermMarker>, fire: (marker: IXtermMarker | undefined) => void, store: DisposableStore, log?: (message: string) => void): IDisposable;
|
|
13
13
|
export declare function createAltBufferPromise(xterm: {
|
|
14
14
|
raw: {
|
|
15
15
|
buffer: {
|
|
@@ -19,3 +19,22 @@ export declare function createAltBufferPromise(xterm: {
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
}, store: DisposableStore, log?: (message: string) => void): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Strips the command echo and trailing prompt lines from marker-based terminal output.
|
|
24
|
+
* Without shell integration (or when `getOutput()` is unavailable), `getContentsAsText`
|
|
25
|
+
* captures the entire terminal buffer between the start and end markers, which includes:
|
|
26
|
+
* 1. The command echo line (what `sendText` wrote)
|
|
27
|
+
* 2. The actual command output
|
|
28
|
+
* 3. The next shell prompt line(s)
|
|
29
|
+
*
|
|
30
|
+
* This function removes (1) and (3) to isolate the actual output.
|
|
31
|
+
*/
|
|
32
|
+
export declare function stripCommandEchoAndPrompt(output: string, commandLine: string, log?: (message: string) => void): string;
|
|
33
|
+
export declare function findCommandEcho(output: string, commandLine: string, allowSuffixMatch?: boolean): {
|
|
34
|
+
contentBefore: string;
|
|
35
|
+
linesAfter: string[];
|
|
36
|
+
} | undefined;
|
|
37
|
+
export declare function stripNewLinesAndBuildMapping(output: string): {
|
|
38
|
+
strippedOutput: string;
|
|
39
|
+
indexMapping: number[];
|
|
40
|
+
};
|
|
@@ -27,6 +27,7 @@ function setupRecreatingStartMarker(xterm, startMarker, fire, store, log) {
|
|
|
27
27
|
fire(undefined);
|
|
28
28
|
}));
|
|
29
29
|
store.add(startMarker);
|
|
30
|
+
return toDisposable(() => markerListener.dispose());
|
|
30
31
|
}
|
|
31
32
|
function createAltBufferPromise(xterm, store, log) {
|
|
32
33
|
const deferred = ( new DeferredPromise());
|
|
@@ -47,5 +48,127 @@ function createAltBufferPromise(xterm, store, log) {
|
|
|
47
48
|
}
|
|
48
49
|
return deferred.p;
|
|
49
50
|
}
|
|
51
|
+
function stripCommandEchoAndPrompt(output, commandLine, log) {
|
|
52
|
+
log?.(
|
|
53
|
+
`stripCommandEchoAndPrompt input: output length=${output.length}, commandLine length=${commandLine.length}`
|
|
54
|
+
);
|
|
55
|
+
const result = _stripCommandEchoAndPromptOnce(output, commandLine, log);
|
|
56
|
+
if (result.trim().length > 0 && findCommandEcho(result, commandLine)) {
|
|
57
|
+
return _stripCommandEchoAndPromptOnce(result, commandLine, log);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
function _stripCommandEchoAndPromptOnce(output, commandLine, log) {
|
|
62
|
+
const echoResult = findCommandEcho(output, commandLine, true);
|
|
63
|
+
const lines = echoResult ? echoResult.linesAfter : output.split("\n");
|
|
64
|
+
const startIndex = 0;
|
|
65
|
+
const promptBefore = echoResult?.contentBefore ?? "";
|
|
66
|
+
const isUnixAt = /\w+@[\w.-]+:/.test(promptBefore);
|
|
67
|
+
const isUnixHost = !isUnixAt && /[\w.-]+:\S/.test(promptBefore);
|
|
68
|
+
const isUnix = isUnixAt || isUnixHost;
|
|
69
|
+
const isPowerShell = /^PS\s/i.test(promptBefore);
|
|
70
|
+
const isCmd = !isPowerShell && /^[A-Z]:\\/.test(promptBefore);
|
|
71
|
+
const isStarship = /\u276f/.test(promptBefore);
|
|
72
|
+
const isPython = />>>/.test(promptBefore);
|
|
73
|
+
const knownPrompt = isUnix || isPowerShell || isCmd || isStarship || isPython;
|
|
74
|
+
let endIndex = lines.length;
|
|
75
|
+
let trailingStrippedCount = 0;
|
|
76
|
+
const maxTrailingPromptLines = 2;
|
|
77
|
+
while (endIndex > startIndex) {
|
|
78
|
+
const line = lines[endIndex - 1].trimEnd();
|
|
79
|
+
if (line.length === 0) {
|
|
80
|
+
endIndex--;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (trailingStrippedCount >= maxTrailingPromptLines) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
const isCompletePrompt =
|
|
87
|
+
((!knownPrompt || isUnixAt) && /^\s*\w+@[\w.-]+:.*[#$]\s*$/.test(line)) || ((!knownPrompt || isUnixHost) && /^\s*[\w.-]+:\S.*\s\w+[#$]\s*$/.test(line)) || ((!knownPrompt || isPowerShell) && /^PS\s+[A-Z]:\\.*>\s*$/.test(line)) || ((!knownPrompt || isCmd) && /^[A-Z]:\\.*>\s*$/.test(line)) || ((!knownPrompt || isStarship) && /\u276f\s*$/.test(line)) || ((!knownPrompt || isPython) && /^>>>\s*$/.test(line));
|
|
88
|
+
const isPromptFragment =
|
|
89
|
+
((!knownPrompt || isUnix) && /^\s*[\w/.-]+[#$]\s*$/.test(line)) || ((!knownPrompt || isUnix) && /^\[\s*[\w.-]+(@[\w.-]+)?:[~\/]/.test(line)) || ((!knownPrompt || isUnix) && trailingStrippedCount > 0 && /^\s*[\w][-\w.]*(@[\w.-]+)?:\S/.test(line)) || ((!knownPrompt || isUnix) && /\]\s*[#$]\s*$/.test(line));
|
|
90
|
+
if (isCompletePrompt) {
|
|
91
|
+
endIndex--;
|
|
92
|
+
trailingStrippedCount++;
|
|
93
|
+
break;
|
|
94
|
+
} else if (isPromptFragment) {
|
|
95
|
+
endIndex--;
|
|
96
|
+
trailingStrippedCount++;
|
|
97
|
+
} else {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const result = lines.slice(startIndex, endIndex).join("\n");
|
|
102
|
+
log?.(
|
|
103
|
+
`stripCommandEchoAndPrompt result: length=${result.length} (startIndex=${startIndex}, endIndex=${endIndex}, totalLines=${lines.length})`
|
|
104
|
+
);
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
function findCommandEcho(output, commandLine, allowSuffixMatch) {
|
|
108
|
+
const trimmedCommand = commandLine.trim();
|
|
109
|
+
if (trimmedCommand.length === 0) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
const {
|
|
113
|
+
strippedOutput,
|
|
114
|
+
indexMapping
|
|
115
|
+
} = stripNewLinesAndBuildMapping(output);
|
|
116
|
+
const matchIndex = strippedOutput.indexOf(trimmedCommand);
|
|
117
|
+
let matchEndInStripped;
|
|
118
|
+
let contentBefore;
|
|
119
|
+
if (matchIndex !== -1) {
|
|
120
|
+
contentBefore = strippedOutput.substring(0, matchIndex).trim();
|
|
121
|
+
matchEndInStripped = matchIndex + trimmedCommand.length - 1;
|
|
122
|
+
} else if (allowSuffixMatch) {
|
|
123
|
+
let suffixLen = 0;
|
|
124
|
+
for (let len = trimmedCommand.length - 1; len >= 1; len--) {
|
|
125
|
+
const suffix = trimmedCommand.substring(trimmedCommand.length - len);
|
|
126
|
+
if (strippedOutput.startsWith(suffix)) {
|
|
127
|
+
const charBefore = trimmedCommand[trimmedCommand.length - len - 1];
|
|
128
|
+
if (charBefore !== undefined && charBefore !== " " && charBefore !== "\t") {
|
|
129
|
+
suffixLen = len;
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (suffixLen === 0) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
contentBefore = "";
|
|
138
|
+
matchEndInStripped = suffixLen - 1;
|
|
139
|
+
} else {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
const originalEnd = indexMapping[matchEndInStripped];
|
|
143
|
+
const lines = output.split("\n");
|
|
144
|
+
let echoEndLine = 0;
|
|
145
|
+
let offset = 0;
|
|
146
|
+
for (let i = 0; i < lines.length; i++) {
|
|
147
|
+
const lineEnd = offset + lines[i].length;
|
|
148
|
+
if (offset <= originalEnd && originalEnd <= lineEnd) {
|
|
149
|
+
echoEndLine = i + 1;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
offset = lineEnd + 1;
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
contentBefore,
|
|
156
|
+
linesAfter: lines.slice(echoEndLine)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function stripNewLinesAndBuildMapping(output) {
|
|
160
|
+
const indexMapping = [];
|
|
161
|
+
const strippedChars = [];
|
|
162
|
+
for (let i = 0; i < output.length; i++) {
|
|
163
|
+
if (output[i] !== "\n") {
|
|
164
|
+
strippedChars.push(output[i]);
|
|
165
|
+
indexMapping.push(i);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
strippedOutput: strippedChars.join(""),
|
|
170
|
+
indexMapping
|
|
171
|
+
};
|
|
172
|
+
}
|
|
50
173
|
|
|
51
|
-
export { createAltBufferPromise, setupRecreatingStartMarker };
|
|
174
|
+
export { createAltBufferPromise, findCommandEcho, setupRecreatingStartMarker, stripCommandEchoAndPrompt, stripNewLinesAndBuildMapping };
|
package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js
CHANGED
|
@@ -4,17 +4,32 @@ import { truncateOutputKeepingTail } from './runInTerminalHelpers.js';
|
|
|
4
4
|
const MAX_OUTPUT_LENGTH = 16000;
|
|
5
5
|
function getOutput(instance, startMarker) {
|
|
6
6
|
if (!instance.xterm || !instance.xterm.raw) {
|
|
7
|
-
return
|
|
7
|
+
return '';
|
|
8
8
|
}
|
|
9
9
|
const buffer = instance.xterm.raw.buffer.active;
|
|
10
|
-
|
|
10
|
+
let startLine = Math.max(startMarker?.line ?? 0, 0);
|
|
11
|
+
while (startLine > 0 && buffer.getLine(startLine)?.isWrapped) {
|
|
12
|
+
startLine--;
|
|
13
|
+
}
|
|
11
14
|
const endLine = buffer.length;
|
|
12
|
-
const lines =
|
|
15
|
+
const lines = [];
|
|
16
|
+
let currentLine = '';
|
|
13
17
|
for (let y = startLine; y < endLine; y++) {
|
|
14
18
|
const line = buffer.getLine(y);
|
|
15
|
-
|
|
19
|
+
if (!line) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const isWrapped = !!buffer.getLine(y + 1)?.isWrapped;
|
|
23
|
+
currentLine += line.translateToString(!isWrapped);
|
|
24
|
+
if (!isWrapped) {
|
|
25
|
+
lines.push(currentLine);
|
|
26
|
+
currentLine = '';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (currentLine) {
|
|
30
|
+
lines.push(currentLine);
|
|
16
31
|
}
|
|
17
|
-
let output = lines.join(
|
|
32
|
+
let output = lines.join('\n');
|
|
18
33
|
if (output.length > MAX_OUTPUT_LENGTH) {
|
|
19
34
|
output = truncateOutputKeepingTail(output, MAX_OUTPUT_LENGTH);
|
|
20
35
|
}
|
|
@@ -9,6 +9,11 @@ export declare function isFish(envShell: string, os: OperatingSystem): boolean;
|
|
|
9
9
|
export declare const TRUNCATION_MESSAGE = "\n\n[... PREVIOUS OUTPUT TRUNCATED ...]\n\n";
|
|
10
10
|
export declare function truncateOutputKeepingTail(output: string, maxLength: number): string;
|
|
11
11
|
export declare function sanitizeTerminalOutput(output: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Normalizes command text for UI display by removing unnecessary quote and forward slash
|
|
14
|
+
* escaping artifacts (for example: \" \' \/) commonly produced in streamed tool-call JSON.
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeTerminalCommandForDisplay(commandLine: string): string;
|
|
12
17
|
export declare function generateAutoApproveActions(commandLine: string, subCommands: string[], autoApproveResult: {
|
|
13
18
|
subCommandResults: ICommandApprovalResultWithReason[];
|
|
14
19
|
commandLineResult: ICommandApprovalResultWithReason;
|