@codingame/monaco-vscode-chat-service-override 22.1.8 → 23.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 +16 -7
- package/package.json +43 -41
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +57 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +26 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +51 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/{chatClearActions.d.ts → chatNewActions.d.ts} +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/{chatClearActions.js → chatNewActions.js} +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.d.ts +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.js +101 -98
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +35 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +43 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +33 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.js +154 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.js +347 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +85 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +250 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsview.css +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +97 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +290 -231
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +7 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.js +113 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimeline.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.d.ts +102 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.js +646 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +46 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +17 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +44 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +25 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +46 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +45 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +30 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +60 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.d.ts +117 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.js +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +60 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +29 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +365 -143
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +3 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +7 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +58 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +6 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.js +7 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +13 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +38 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +11 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +83 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +91 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +64 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +370 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +349 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +787 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +109 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatManagementEditor.css +122 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +211 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatUsageWidget.css +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +21 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +54 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +31 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +16 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.d.ts +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.js +29 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.js +37 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.d.ts +15 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.js +96 -131
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.d.ts +12 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.js +66 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.js +77 -71
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.d.ts +91 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.js +458 -138
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +212 -150
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +96 -89
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +15 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +33 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.js +688 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +15 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +126 -135
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditorController.css +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSessions.css +38 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/simpleBrowserOverlay.css +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +28 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.js +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +24 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +15 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +25 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +89 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +30 -29
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +10 -19
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +61 -43
- package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +7 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +28 -28
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +254 -165
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +4 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.d.ts +10 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.js +20 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +13 -17
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +9 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.js +51 -21
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.d.ts +7 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +74 -20
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptDocumentSemanticTokensProvider.js +11 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +83 -53
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +136 -78
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +18 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +357 -157
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileContributions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +55 -28
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +235 -108
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +12 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +50 -4
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +27 -27
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js +11 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +12 -14
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +18 -30
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +62 -139
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +16 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js +3 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +119 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.js +6 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +192 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +21 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.js +8 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +18 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +4 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +18 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +31 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +24 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +33 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +42 -13
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +14 -21
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +227 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +133 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +36 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.js +33 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.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/monitoring/outputMonitor.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +75 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +71 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +28 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +366 -363
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +18 -18
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +9 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +123 -0
- package/vscode/src/vs/base/common/yaml.d.ts +0 -74
- package/vscode/src/vs/base/common/yaml.js +0 -597
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +0 -239
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.d.ts +0 -102
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.js +0 -435
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.d.ts +0 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.js +0 -67
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +0 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +0 -380
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.d.ts +0 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.js +0 -137
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +0 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +0 -176
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +0 -206
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +0 -79
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +0 -145
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +0 -306
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.js +0 -102
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/newPromptsParser.d.ts +0 -97
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/newPromptsParser.js +0 -247
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +0 -118
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +0 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandSimplifier.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandSimplifier.js +0 -55
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.js +0 -66
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
5
|
+
import { win32, posix } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
6
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
7
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
9
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-de235d7f-e72a-5adb-9256-acf6c64eb6f2-common/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
10
|
+
import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
11
|
+
import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
12
|
+
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
13
|
+
|
|
14
|
+
let CommandLineFileWriteAnalyzer = class CommandLineFileWriteAnalyzer extends Disposable {
|
|
15
|
+
constructor(_treeSitterCommandParser, _log, _configurationService, _labelService, _workspaceContextService) {
|
|
16
|
+
super();
|
|
17
|
+
this._treeSitterCommandParser = _treeSitterCommandParser;
|
|
18
|
+
this._log = _log;
|
|
19
|
+
this._configurationService = _configurationService;
|
|
20
|
+
this._labelService = _labelService;
|
|
21
|
+
this._workspaceContextService = _workspaceContextService;
|
|
22
|
+
}
|
|
23
|
+
async analyze(options) {
|
|
24
|
+
let fileWrites;
|
|
25
|
+
try {
|
|
26
|
+
fileWrites = await this._getFileWrites(options);
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
console.error(e);
|
|
30
|
+
this._log('Failed to get file writes via grammar', options.treeSitterLanguage);
|
|
31
|
+
return {
|
|
32
|
+
isAutoApproveAllowed: false
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return this._getResult(options, fileWrites);
|
|
36
|
+
}
|
|
37
|
+
async _getFileWrites(options) {
|
|
38
|
+
let fileWrites = [];
|
|
39
|
+
const capturedFileWrites = await this._treeSitterCommandParser.getFileWrites(options.treeSitterLanguage, options.commandLine);
|
|
40
|
+
if (capturedFileWrites.length) {
|
|
41
|
+
const cwd = options.cwd;
|
|
42
|
+
if (cwd) {
|
|
43
|
+
this._log('Detected cwd', ( cwd.toString()));
|
|
44
|
+
fileWrites = ( capturedFileWrites.map(e => {
|
|
45
|
+
const isAbsolute = options.os === OperatingSystem.Windows ? win32.isAbsolute(e) : posix.isAbsolute(e);
|
|
46
|
+
if (isAbsolute) {
|
|
47
|
+
return URI.file(e);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return URI.joinPath(cwd, e);
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this._log('Cwd could not be detected');
|
|
56
|
+
fileWrites = capturedFileWrites;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
this._log('File writes detected', ( fileWrites.map(e => ( e.toString()))));
|
|
60
|
+
return fileWrites;
|
|
61
|
+
}
|
|
62
|
+
_getResult(options, fileWrites) {
|
|
63
|
+
let isAutoApproveAllowed = true;
|
|
64
|
+
if (fileWrites.length > 0) {
|
|
65
|
+
const blockDetectedFileWrites = this._configurationService.getValue(TerminalChatAgentToolsSettingId.BlockDetectedFileWrites);
|
|
66
|
+
switch (blockDetectedFileWrites) {
|
|
67
|
+
case 'all': {
|
|
68
|
+
isAutoApproveAllowed = false;
|
|
69
|
+
this._log('File writes blocked due to "all" setting');
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case 'outsideWorkspace': {
|
|
73
|
+
const workspaceFolders = this._workspaceContextService.getWorkspace().folders;
|
|
74
|
+
if (workspaceFolders.length > 0) {
|
|
75
|
+
for (const fileWrite of fileWrites) {
|
|
76
|
+
if (isString(fileWrite)) {
|
|
77
|
+
const isAbsolute = options.os === OperatingSystem.Windows ? win32.isAbsolute(fileWrite) : posix.isAbsolute(fileWrite);
|
|
78
|
+
if (!isAbsolute) {
|
|
79
|
+
isAutoApproveAllowed = false;
|
|
80
|
+
this._log('File write blocked due to unknown terminal cwd', fileWrite);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const fileUri = URI.isUri(fileWrite) ? fileWrite : URI.file(fileWrite);
|
|
85
|
+
if (fileUri.fsPath.match(/[$\(\){}]/)) {
|
|
86
|
+
isAutoApproveAllowed = false;
|
|
87
|
+
this._log('File write blocked due to likely containing a variable', ( fileUri.toString()));
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
const isInsideWorkspace = ( workspaceFolders.some(folder => folder.uri.scheme === fileUri.scheme &&
|
|
91
|
+
(fileUri.path.startsWith(folder.uri.path + '/') || fileUri.path === folder.uri.path)));
|
|
92
|
+
if (!isInsideWorkspace) {
|
|
93
|
+
isAutoApproveAllowed = false;
|
|
94
|
+
this._log('File write blocked outside workspace', ( fileUri.toString()));
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
isAutoApproveAllowed = false;
|
|
101
|
+
this._log('File writes blocked - no workspace folders');
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const disclaimers = [];
|
|
108
|
+
if (fileWrites.length > 0) {
|
|
109
|
+
const fileWritesList = ( fileWrites.map(fw => `\`${URI.isUri(fw) ? this._labelService.getUriLabel(fw) : fw}\``)).join(', ');
|
|
110
|
+
if (!isAutoApproveAllowed) {
|
|
111
|
+
disclaimers.push(( localize(
|
|
112
|
+
11843,
|
|
113
|
+
'File write operations detected that cannot be auto approved: {0}',
|
|
114
|
+
fileWritesList
|
|
115
|
+
)));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
disclaimers.push(( localize(11844, 'File write operations detected: {0}', fileWritesList)));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
isAutoApproveAllowed,
|
|
123
|
+
disclaimers,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
CommandLineFileWriteAnalyzer = ( __decorate([
|
|
128
|
+
( __param(2, IConfigurationService)),
|
|
129
|
+
( __param(3, ILabelService)),
|
|
130
|
+
( __param(4, IWorkspaceContextService))
|
|
131
|
+
], CommandLineFileWriteAnalyzer));
|
|
132
|
+
|
|
133
|
+
export { CommandLineFileWriteAnalyzer };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import type { ICommandLineRewriter, ICommandLineRewriterOptions, ICommandLineRewriterResult } from "./commandLineRewriter.js";
|
|
3
|
+
export declare class CommandLineCdPrefixRewriter extends Disposable implements ICommandLineRewriter {
|
|
4
|
+
rewrite(options: ICommandLineRewriterOptions): ICommandLineRewriterResult | undefined;
|
|
5
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
4
|
+
import { isPowerShell } from '../../runInTerminalHelpers.js';
|
|
5
|
+
|
|
6
|
+
class CommandLineCdPrefixRewriter extends Disposable {
|
|
7
|
+
rewrite(options) {
|
|
8
|
+
if (!options.cwd) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const isPwsh = isPowerShell(options.shell, options.os);
|
|
12
|
+
const cdPrefixMatch = options.commandLine.match(isPwsh
|
|
13
|
+
? /^(?:cd(?: \/d)?|Set-Location(?: -Path)?) (?<dir>[^\s]+) ?(?:&&|;)\s+(?<suffix>.+)$/i
|
|
14
|
+
: /^cd (?<dir>[^\s]+) &&\s+(?<suffix>.+)$/);
|
|
15
|
+
const cdDir = cdPrefixMatch?.groups?.dir;
|
|
16
|
+
const cdSuffix = cdPrefixMatch?.groups?.suffix;
|
|
17
|
+
if (cdDir && cdSuffix) {
|
|
18
|
+
let cdDirPath = cdDir;
|
|
19
|
+
if (cdDirPath.startsWith('"') && cdDirPath.endsWith('"')) {
|
|
20
|
+
cdDirPath = cdDirPath.slice(1, -1);
|
|
21
|
+
}
|
|
22
|
+
cdDirPath = cdDirPath.replace(/(?:[\\\/])$/, '');
|
|
23
|
+
let cwdFsPath = options.cwd.fsPath.replace(/(?:[\\\/])$/, '');
|
|
24
|
+
if (options.os === OperatingSystem.Windows) {
|
|
25
|
+
cdDirPath = cdDirPath.toLowerCase();
|
|
26
|
+
cwdFsPath = cwdFsPath.toLowerCase();
|
|
27
|
+
}
|
|
28
|
+
if (cdDirPath === cwdFsPath) {
|
|
29
|
+
return { rewritten: cdSuffix, reasoning: 'Removed redundant cd command' };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { CommandLineCdPrefixRewriter };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import type { TreeSitterCommandParser } from "../../treeSitterCommandParser.js";
|
|
3
|
+
import type { ICommandLineRewriter, ICommandLineRewriterOptions, ICommandLineRewriterResult } from "./commandLineRewriter.js";
|
|
4
|
+
export declare class CommandLinePwshChainOperatorRewriter extends Disposable implements ICommandLineRewriter {
|
|
5
|
+
private readonly _treeSitterCommandParser;
|
|
6
|
+
constructor(_treeSitterCommandParser: TreeSitterCommandParser);
|
|
7
|
+
rewrite(options: ICommandLineRewriterOptions): Promise<ICommandLineRewriterResult | undefined>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { isPowerShell } from '../../runInTerminalHelpers.js';
|
|
4
|
+
|
|
5
|
+
class CommandLinePwshChainOperatorRewriter extends Disposable {
|
|
6
|
+
constructor(_treeSitterCommandParser) {
|
|
7
|
+
super();
|
|
8
|
+
this._treeSitterCommandParser = _treeSitterCommandParser;
|
|
9
|
+
}
|
|
10
|
+
async rewrite(options) {
|
|
11
|
+
if (isPowerShell(options.shell, options.os)) {
|
|
12
|
+
let doubleAmpersandCaptures;
|
|
13
|
+
try {
|
|
14
|
+
doubleAmpersandCaptures = await this._treeSitterCommandParser.extractPwshDoubleAmpersandChainOperators(options.commandLine);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
}
|
|
18
|
+
if (doubleAmpersandCaptures && doubleAmpersandCaptures.length > 0) {
|
|
19
|
+
let rewritten = options.commandLine;
|
|
20
|
+
for (const capture of doubleAmpersandCaptures.reverse()) {
|
|
21
|
+
rewritten = `${rewritten.substring(0, capture.node.startIndex)};${rewritten.substring(capture.node.endIndex)}`;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
rewritten,
|
|
25
|
+
reasoning: '&& re-written to ;'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { CommandLinePwshChainOperatorRewriter };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MaybePromise } from "@codingame/monaco-vscode-api/vscode/vs/base/common/async";
|
|
2
|
+
import type { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import type { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
4
|
+
import type { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
5
|
+
export interface ICommandLineRewriter extends IDisposable {
|
|
6
|
+
rewrite(options: ICommandLineRewriterOptions): MaybePromise<ICommandLineRewriterResult | undefined>;
|
|
7
|
+
}
|
|
8
|
+
export interface ICommandLineRewriterOptions {
|
|
9
|
+
commandLine: string;
|
|
10
|
+
cwd: URI | undefined;
|
|
11
|
+
shell: string;
|
|
12
|
+
os: OperatingSystem;
|
|
13
|
+
}
|
|
14
|
+
export interface ICommandLineRewriterResult {
|
|
15
|
+
rewritten: string;
|
|
16
|
+
reasoning: string;
|
|
17
|
+
}
|
|
@@ -3,14 +3,14 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
|
|
|
3
3
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
4
4
|
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
6
|
-
import { TerminalCapability } from '@codingame/monaco-vscode-
|
|
6
|
+
import { TerminalCapability } from '@codingame/monaco-vscode-10af0e5d-64cb-56de-b584-29ab4a355d15-common/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
7
7
|
import { ToolDataSource } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService';
|
|
8
8
|
import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
9
9
|
|
|
10
10
|
const GetTerminalLastCommandToolData = {
|
|
11
11
|
id: 'terminal_last_command',
|
|
12
12
|
toolReferenceName: 'terminalLastCommand',
|
|
13
|
-
displayName: ( localize(
|
|
13
|
+
displayName: ( localize(11845, 'Get Terminal Last Command')),
|
|
14
14
|
modelDescription: 'Get the last command run in the active terminal.',
|
|
15
15
|
source: ToolDataSource.Internal,
|
|
16
16
|
icon: Codicon.terminal,
|
|
@@ -22,8 +22,8 @@ let GetTerminalLastCommandTool = class GetTerminalLastCommandTool extends Dispos
|
|
|
22
22
|
}
|
|
23
23
|
async prepareToolInvocation(context, token) {
|
|
24
24
|
return {
|
|
25
|
-
invocationMessage: ( localize(
|
|
26
|
-
pastTenseMessage: ( localize(
|
|
25
|
+
invocationMessage: ( localize(11846, "Getting last terminal command")),
|
|
26
|
+
pastTenseMessage: ( localize(11847, "Got last terminal command")),
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
async invoke(invocation, _countTokens, _progress, token) {
|
|
@@ -8,7 +8,7 @@ import { RunInTerminalTool } from './runInTerminalTool.js';
|
|
|
8
8
|
const GetTerminalOutputToolData = {
|
|
9
9
|
id: 'get_terminal_output',
|
|
10
10
|
toolReferenceName: 'getTerminalOutput',
|
|
11
|
-
displayName: ( localize(
|
|
11
|
+
displayName: ( localize(11848, 'Get Terminal Output')),
|
|
12
12
|
modelDescription: 'Get the output of a terminal command previously started with run_in_terminal',
|
|
13
13
|
icon: Codicon.terminal,
|
|
14
14
|
source: ToolDataSource.Internal,
|
|
@@ -28,8 +28,8 @@ const GetTerminalOutputToolData = {
|
|
|
28
28
|
class GetTerminalOutputTool extends Disposable {
|
|
29
29
|
async prepareToolInvocation(context, token) {
|
|
30
30
|
return {
|
|
31
|
-
invocationMessage: ( localize(
|
|
32
|
-
pastTenseMessage: ( localize(
|
|
31
|
+
invocationMessage: ( localize(11849, "Checking background terminal output")),
|
|
32
|
+
pastTenseMessage: ( localize(11850, "Checked background terminal output")),
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
async invoke(invocation, _countTokens, _progress, token) {
|
|
@@ -9,7 +9,7 @@ import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workben
|
|
|
9
9
|
const GetTerminalSelectionToolData = {
|
|
10
10
|
id: 'terminal_selection',
|
|
11
11
|
toolReferenceName: 'terminalSelection',
|
|
12
|
-
displayName: ( localize(
|
|
12
|
+
displayName: ( localize(11851, 'Get Terminal Selection')),
|
|
13
13
|
modelDescription: 'Get the current selection in the active terminal.',
|
|
14
14
|
source: ToolDataSource.Internal,
|
|
15
15
|
icon: Codicon.terminal,
|
|
@@ -21,8 +21,8 @@ let GetTerminalSelectionTool = class GetTerminalSelectionTool extends Disposable
|
|
|
21
21
|
}
|
|
22
22
|
async prepareToolInvocation(context, token) {
|
|
23
23
|
return {
|
|
24
|
-
invocationMessage: ( localize(
|
|
25
|
-
pastTenseMessage: ( localize(
|
|
24
|
+
invocationMessage: ( localize(11852, "Reading terminal selection")),
|
|
25
|
+
pastTenseMessage: ( localize(11853, "Read terminal selection")),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
async invoke(invocation, _countTokens, _progress, token) {
|
|
@@ -9,6 +9,7 @@ import { ITaskService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/c
|
|
|
9
9
|
import { IExecution, IPollingResult, OutputMonitorState } from "./types.js";
|
|
10
10
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
11
11
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
12
|
+
import { ITerminalService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
|
|
12
13
|
export interface IOutputMonitor extends Disposable {
|
|
13
14
|
readonly pollingResult: IPollingResult & {
|
|
14
15
|
pollDurationMs: number;
|
|
@@ -35,6 +36,7 @@ export declare class OutputMonitor extends Disposable implements IOutputMonitor
|
|
|
35
36
|
private readonly _chatWidgetService;
|
|
36
37
|
private readonly _configurationService;
|
|
37
38
|
private readonly _logService;
|
|
39
|
+
private readonly _terminalService;
|
|
38
40
|
private _state;
|
|
39
41
|
get state(): OutputMonitorState;
|
|
40
42
|
private _lastPromptMarker;
|
|
@@ -48,7 +50,7 @@ export declare class OutputMonitor extends Disposable implements IOutputMonitor
|
|
|
48
50
|
get outputMonitorTelemetryCounters(): Readonly<IOutputMonitorTelemetryCounters>;
|
|
49
51
|
private readonly _onDidFinishCommand;
|
|
50
52
|
readonly onDidFinishCommand: Event<void>;
|
|
51
|
-
constructor(_execution: IExecution, _pollFn: ((execution: IExecution, token: CancellationToken, taskService: ITaskService) => Promise<IPollingResult | undefined>) | undefined, invocationContext: IToolInvocationContext | undefined, token: CancellationToken, command: string, _languageModelsService: ILanguageModelsService, _taskService: ITaskService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _configurationService: IConfigurationService, _logService: ILogService);
|
|
53
|
+
constructor(_execution: IExecution, _pollFn: ((execution: IExecution, token: CancellationToken, taskService: ITaskService) => Promise<IPollingResult | undefined>) | undefined, invocationContext: IToolInvocationContext | undefined, token: CancellationToken, command: string, _languageModelsService: ILanguageModelsService, _taskService: ITaskService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _configurationService: IConfigurationService, _logService: ILogService, _terminalService: ITerminalService);
|
|
52
54
|
private _startMonitoring;
|
|
53
55
|
private _handleIdleState;
|
|
54
56
|
private _handleTimeoutState;
|
|
@@ -64,5 +66,7 @@ export declare class OutputMonitor extends Disposable implements IOutputMonitor
|
|
|
64
66
|
private _selectAndHandleOption;
|
|
65
67
|
private _requestFreeFormTerminalInput;
|
|
66
68
|
private _confirmRunInTerminal;
|
|
69
|
+
private _showInstance;
|
|
67
70
|
private _createElicitationPart;
|
|
71
|
+
private _getLanguageModel;
|
|
68
72
|
}
|
|
@@ -9,7 +9,7 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
9
9
|
import { ExtensionIdentifier } from '@codingame/monaco-vscode-api/vscode/vs/platform/extensions/common/extensions';
|
|
10
10
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
11
11
|
import { ChatElicitationRequestPart } from '@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common/vscode/vs/workbench/contrib/chat/browser/chatElicitationRequestPart';
|
|
12
|
-
import { ChatModel } from '@codingame/monaco-vscode-
|
|
12
|
+
import { ChatModel } from '@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
13
13
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
14
14
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
15
15
|
import { ChatMessageRole } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
@@ -19,14 +19,16 @@ import { detectsInputRequiredPattern } from '../../executeStrategy/executeStrate
|
|
|
19
19
|
import { OutputMonitorState, PollingConsts } from './types.js';
|
|
20
20
|
import { getTextResponseFromStream } from './utils.js';
|
|
21
21
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
22
|
-
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-
|
|
22
|
+
import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-de235d7f-e72a-5adb-9256-acf6c64eb6f2-common/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
|
|
23
23
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
24
|
+
import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
25
|
+
import { LocalChatSessionUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatUri';
|
|
24
26
|
|
|
25
27
|
let OutputMonitor = class OutputMonitor extends Disposable {
|
|
26
28
|
get state() { return this._state; }
|
|
27
29
|
get pollingResult() { return this._pollingResult; }
|
|
28
30
|
get outputMonitorTelemetryCounters() { return this._outputMonitorTelemetryCounters; }
|
|
29
|
-
constructor(_execution, _pollFn, invocationContext, token, command, _languageModelsService, _taskService, _chatService, _chatWidgetService, _configurationService, _logService) {
|
|
31
|
+
constructor(_execution, _pollFn, invocationContext, token, command, _languageModelsService, _taskService, _chatService, _chatWidgetService, _configurationService, _logService, _terminalService) {
|
|
30
32
|
super();
|
|
31
33
|
this._execution = _execution;
|
|
32
34
|
this._pollFn = _pollFn;
|
|
@@ -36,6 +38,7 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
36
38
|
this._chatWidgetService = _chatWidgetService;
|
|
37
39
|
this._configurationService = _configurationService;
|
|
38
40
|
this._logService = _logService;
|
|
41
|
+
this._terminalService = _terminalService;
|
|
39
42
|
this._state = OutputMonitorState.PollingForIdle;
|
|
40
43
|
this._outputMonitorTelemetryCounters = {
|
|
41
44
|
inputToolManualAcceptCount: 0,
|
|
@@ -209,21 +212,16 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
209
212
|
let waited = 0;
|
|
210
213
|
let consecutiveIdleEvents = 0;
|
|
211
214
|
let hasReceivedData = false;
|
|
212
|
-
|
|
213
|
-
|
|
215
|
+
const onDataDisposable = execution.instance.onData((_data) => {
|
|
216
|
+
hasReceivedData = true;
|
|
217
|
+
});
|
|
214
218
|
try {
|
|
215
219
|
while (!token.isCancellationRequested && waited < maxWaitMs) {
|
|
216
220
|
const waitTime = Math.min(currentInterval, maxWaitMs - waited);
|
|
217
221
|
await timeout(waitTime, token);
|
|
218
222
|
waited += waitTime;
|
|
219
223
|
currentInterval = Math.min(currentInterval * 2, maxInterval);
|
|
220
|
-
|
|
221
|
-
currentOutput = execution.getOutput();
|
|
222
|
-
onDataDisposable = execution.instance.onData((data) => {
|
|
223
|
-
hasReceivedData = true;
|
|
224
|
-
currentOutput += data;
|
|
225
|
-
});
|
|
226
|
-
}
|
|
224
|
+
const currentOutput = execution.getOutput();
|
|
227
225
|
const promptResult = detectsInputRequiredPattern(currentOutput);
|
|
228
226
|
if (promptResult) {
|
|
229
227
|
this._state = OutputMonitorState.Idle;
|
|
@@ -239,12 +237,9 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
239
237
|
const recentlyIdle = consecutiveIdleEvents >= PollingConsts.MinIdleEvents;
|
|
240
238
|
const isActive = execution.isActive ? await execution.isActive() : undefined;
|
|
241
239
|
this._logService.trace(`OutputMonitor: waitForIdle check: waited=${waited}ms, recentlyIdle=${recentlyIdle}, isActive=${isActive}`);
|
|
242
|
-
if (recentlyIdle && isActive === true) {
|
|
243
|
-
consecutiveIdleEvents = 0;
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
240
|
if (recentlyIdle || isActive === false) {
|
|
247
|
-
|
|
241
|
+
this._state = OutputMonitorState.Idle;
|
|
242
|
+
return this._state;
|
|
248
243
|
}
|
|
249
244
|
}
|
|
250
245
|
}
|
|
@@ -260,18 +255,18 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
260
255
|
if (token.isCancellationRequested || this._state === OutputMonitorState.Cancelled) {
|
|
261
256
|
return { promise: Promise.resolve(false) };
|
|
262
257
|
}
|
|
263
|
-
const result = this._createElicitationPart(token, context?.sessionId, ( new MarkdownString(( localize(
|
|
264
|
-
|
|
258
|
+
const result = this._createElicitationPart(token, context?.sessionId, ( new MarkdownString(( localize(11854, "Continue waiting for `{0}`?", command)))), ( new MarkdownString(( localize(
|
|
259
|
+
11855,
|
|
265
260
|
"This will continue to poll for output to determine when the terminal becomes idle for up to 2 minutes."
|
|
266
|
-
)))), '', ( localize(
|
|
261
|
+
)))), '', ( localize(11856, 'Yes')), ( localize(11857, 'No')), async () => true, async () => { this._state = OutputMonitorState.Cancelled; return false; });
|
|
267
262
|
return { promise: result.promise.then(p => p ?? false), part: result.part };
|
|
268
263
|
}
|
|
269
264
|
async _assessOutputForErrors(buffer, token) {
|
|
270
|
-
const
|
|
271
|
-
if (!
|
|
265
|
+
const model = await this._getLanguageModel();
|
|
266
|
+
if (!model) {
|
|
272
267
|
return 'No models available';
|
|
273
268
|
}
|
|
274
|
-
const response = await this._languageModelsService.sendChatRequest(
|
|
269
|
+
const response = await this._languageModelsService.sendChatRequest(model, ( new ExtensionIdentifier('core')), [{ role: ChatMessageRole.User, content: [{ type: 'text', value: `Evaluate this terminal output to determine if there were errors. If there are errors, return them. Otherwise, return undefined: ${buffer}.` }] }], {}, token);
|
|
275
270
|
try {
|
|
276
271
|
const responseFromStream = getTextResponseFromStream(response);
|
|
277
272
|
await Promise.all([response.result, responseFromStream]);
|
|
@@ -285,12 +280,12 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
285
280
|
if (token.isCancellationRequested) {
|
|
286
281
|
return;
|
|
287
282
|
}
|
|
288
|
-
const
|
|
289
|
-
if (!
|
|
283
|
+
const model = await this._getLanguageModel();
|
|
284
|
+
if (!model) {
|
|
290
285
|
return undefined;
|
|
291
286
|
}
|
|
292
287
|
const lastFiveLines = execution.getOutput(this._lastPromptMarker).trimEnd().split('\n').slice(-5).join('\n');
|
|
293
|
-
const promptText = `Analyze the following terminal output. If it contains a prompt requesting user input (such as a confirmation, selection, or yes/no question) and that prompt has NOT already been answered, extract the prompt text. The prompt may ask to choose from a set. If so, extract the possible options as a JSON object with keys 'prompt', 'options' (an array of strings or an object with option to description mappings), and 'freeFormInput': false. If no options are provided, and free form input is requested, for example: Password:, return the word freeFormInput. For example, if the options are "[Y] Yes [A] Yes to All [N] No [L] No to All [C] Cancel", the option to description mappings would be {"Y": "Yes", "A": "Yes to All", "N": "No", "L": "No to All", "C": "Cancel"}. If there is no such prompt, return null. If the option is ambiguous
|
|
288
|
+
const promptText = `Analyze the following terminal output. If it contains a prompt requesting user input (such as a confirmation, selection, or yes/no question) and that prompt has NOT already been answered, extract the prompt text. The prompt may ask to choose from a set. If so, extract the possible options as a JSON object with keys 'prompt', 'options' (an array of strings or an object with option to description mappings), and 'freeFormInput': false. If no options are provided, and free form input is requested, for example: Password:, return the word freeFormInput. For example, if the options are "[Y] Yes [A] Yes to All [N] No [L] No to All [C] Cancel", the option to description mappings would be {"Y": "Yes", "A": "Yes to All", "N": "No", "L": "No to All", "C": "Cancel"}. If there is no such prompt, return null. If the option is ambiguous or non-specific (like "any key" or "some key"), return null.
|
|
294
289
|
Examples:
|
|
295
290
|
1. Output: "Do you want to overwrite? (y/n)"
|
|
296
291
|
Response: {"prompt": "Do you want to overwrite?", "options": ["y", "n"], "freeFormInput": false}
|
|
@@ -310,6 +305,12 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
310
305
|
6. Output: "Continue [y/N]"
|
|
311
306
|
Response: {"prompt": "Continue", "options": ["y", "N"], "freeFormInput": false}
|
|
312
307
|
|
|
308
|
+
7. Output: "Press any key to close the terminal."
|
|
309
|
+
Response: null
|
|
310
|
+
|
|
311
|
+
8. Output: "Terminal will be reused by tasks, press any key to close it."
|
|
312
|
+
Response: null
|
|
313
|
+
|
|
313
314
|
Alternatively, the prompt may request free form input, for example:
|
|
314
315
|
1. Output: "Enter your username:"
|
|
315
316
|
Response: {"prompt": "Enter your username:", "freeFormInput": true, "options": []}
|
|
@@ -318,7 +319,7 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
318
319
|
Now, analyze this output:
|
|
319
320
|
${lastFiveLines}
|
|
320
321
|
`;
|
|
321
|
-
const response = await this._languageModelsService.sendChatRequest(
|
|
322
|
+
const response = await this._languageModelsService.sendChatRequest(model, ( new ExtensionIdentifier('core')), [{ role: ChatMessageRole.User, content: [{ type: 'text', value: promptText }] }], {}, token);
|
|
322
323
|
const responseText = await getTextResponseFromStream(response);
|
|
323
324
|
try {
|
|
324
325
|
const match = responseText.match(/\{[\s\S]*\}/);
|
|
@@ -332,11 +333,25 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
332
333
|
if (this._lastPrompt === obj.prompt) {
|
|
333
334
|
return;
|
|
334
335
|
}
|
|
336
|
+
const NON_SPECIFIC_OPTIONS = ( new Set(['any key', 'some key', 'a key']));
|
|
337
|
+
const isNonSpecificOption = (option) => {
|
|
338
|
+
const lowerOption = option.toLowerCase().trim();
|
|
339
|
+
return ( NON_SPECIFIC_OPTIONS.has(lowerOption));
|
|
340
|
+
};
|
|
335
341
|
if (Array.isArray(obj.options) && obj.options.every(isString)) {
|
|
336
|
-
|
|
342
|
+
const filteredOptions = obj.options.filter(opt => !isNonSpecificOption(opt));
|
|
343
|
+
if (filteredOptions.length === 0) {
|
|
344
|
+
return undefined;
|
|
345
|
+
}
|
|
346
|
+
return { prompt: obj.prompt, options: filteredOptions, detectedRequestForFreeFormInput: obj.freeFormInput };
|
|
337
347
|
}
|
|
338
348
|
else if (isObject(obj.options) && ( Object.values(obj.options)).every(isString)) {
|
|
339
|
-
|
|
349
|
+
const keys = ( Object.keys(obj.options)).filter(key => !isNonSpecificOption(key));
|
|
350
|
+
if (keys.length === 0) {
|
|
351
|
+
return undefined;
|
|
352
|
+
}
|
|
353
|
+
const descriptions = ( keys.map(key => obj.options[key]));
|
|
354
|
+
return { prompt: obj.prompt, options: keys, descriptions, detectedRequestForFreeFormInput: obj.freeFormInput };
|
|
340
355
|
}
|
|
341
356
|
}
|
|
342
357
|
}
|
|
@@ -391,11 +406,14 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
391
406
|
return description ? { suggestedOption: { description, option: validOption }, sentToTerminal } : { suggestedOption: validOption, sentToTerminal };
|
|
392
407
|
}
|
|
393
408
|
async _requestFreeFormTerminalInput(token, execution, confirmationPrompt) {
|
|
394
|
-
const { promise: userPrompt, part } = this._createElicitationPart(token, execution.sessionId, ( new MarkdownString(( localize(
|
|
395
|
-
|
|
409
|
+
const { promise: userPrompt, part } = this._createElicitationPart(token, execution.sessionId, ( new MarkdownString(( localize(11858, "The terminal is awaiting input.")))), ( new MarkdownString(( localize(
|
|
410
|
+
11859,
|
|
396
411
|
"{0}\nPlease provide the required input to the terminal.\n\n",
|
|
397
412
|
confirmationPrompt.prompt
|
|
398
|
-
)))), '', ( localize(
|
|
413
|
+
)))), '', ( localize(11860, 'Focus terminal')), undefined, async () => {
|
|
414
|
+
this._showInstance(execution.instance.instanceId);
|
|
415
|
+
return true;
|
|
416
|
+
});
|
|
399
417
|
const inputPromise = ( new Promise(resolve => {
|
|
400
418
|
const inputDataDisposable = this._register(execution.instance.onDidInputData((data) => {
|
|
401
419
|
if (!data || data === '\r' || data === '\n' || data === '\r\n') {
|
|
@@ -412,13 +430,13 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
412
430
|
async _confirmRunInTerminal(token, suggestedOption, execution, confirmationPrompt) {
|
|
413
431
|
const suggestedOptionValue = typeof suggestedOption === 'string' ? suggestedOption : suggestedOption.option;
|
|
414
432
|
let inputDataDisposable = Disposable.None;
|
|
415
|
-
const { promise: userPrompt, part } = this._createElicitationPart(token, execution.sessionId, ( new MarkdownString(( localize(
|
|
416
|
-
|
|
433
|
+
const { promise: userPrompt, part } = this._createElicitationPart(token, execution.sessionId, ( new MarkdownString(( localize(11861, "The terminal is awaiting input.")))), ( new MarkdownString(( localize(
|
|
434
|
+
11862,
|
|
417
435
|
"{0}\n Do you want to send `{1}`{2} followed by `Enter` to the terminal?",
|
|
418
436
|
confirmationPrompt.prompt,
|
|
419
437
|
suggestedOptionValue,
|
|
420
438
|
typeof suggestedOption === 'string' ? '' : suggestedOption.description ? ' (' + suggestedOption.description + ')' : ''
|
|
421
|
-
)))), '', ( localize(
|
|
439
|
+
)))), '', ( localize(11863, 'Allow')), ( localize(11864, 'Focus Terminal')), async (value) => {
|
|
422
440
|
let option = undefined;
|
|
423
441
|
if (value === true) {
|
|
424
442
|
option = suggestedOptionValue;
|
|
@@ -430,6 +448,7 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
430
448
|
this._outputMonitorTelemetryCounters.inputToolManualChars += option?.length || 0;
|
|
431
449
|
return option;
|
|
432
450
|
}, async () => {
|
|
451
|
+
this._showInstance(execution.instance.instanceId);
|
|
433
452
|
this._state = OutputMonitorState.Cancelled;
|
|
434
453
|
this._outputMonitorTelemetryCounters.inputToolManualRejectCount++;
|
|
435
454
|
inputDataDisposable.dispose();
|
|
@@ -449,8 +468,19 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
449
468
|
}
|
|
450
469
|
return optionToRun;
|
|
451
470
|
}
|
|
471
|
+
_showInstance(instanceId) {
|
|
472
|
+
if (!instanceId) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
const instance = this._terminalService.getInstanceFromId(instanceId);
|
|
476
|
+
if (!instance) {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
this._terminalService.setActiveInstance(instance);
|
|
480
|
+
this._terminalService.revealActiveTerminal(true);
|
|
481
|
+
}
|
|
452
482
|
_createElicitationPart(token, sessionId, title, detail, subtitle, acceptLabel, rejectLabel, onAccept, onReject, moreActions) {
|
|
453
|
-
const chatModel = sessionId && this._chatService.getSession(sessionId);
|
|
483
|
+
const chatModel = sessionId && this._chatService.getSession(LocalChatSessionUri.forSession(sessionId));
|
|
454
484
|
if (!(chatModel instanceof ChatModel)) {
|
|
455
485
|
throw ( new Error('No model'));
|
|
456
486
|
}
|
|
@@ -490,6 +520,13 @@ let OutputMonitor = class OutputMonitor extends Disposable {
|
|
|
490
520
|
this._register(token.onCancellationRequested(() => part.hide()));
|
|
491
521
|
return { promise, part };
|
|
492
522
|
}
|
|
523
|
+
async _getLanguageModel() {
|
|
524
|
+
let models = await this._languageModelsService.selectLanguageModels({ vendor: 'copilot', id: 'copilot-fast' });
|
|
525
|
+
if (!models.length) {
|
|
526
|
+
models = await this._languageModelsService.selectLanguageModels({ vendor: 'copilot', family: 'gpt-4o-mini' });
|
|
527
|
+
}
|
|
528
|
+
return models.length ? models[0] : undefined;
|
|
529
|
+
}
|
|
493
530
|
};
|
|
494
531
|
OutputMonitor = ( __decorate([
|
|
495
532
|
( __param(5, ILanguageModelsService)),
|
|
@@ -497,7 +534,8 @@ OutputMonitor = ( __decorate([
|
|
|
497
534
|
( __param(7, IChatService)),
|
|
498
535
|
( __param(8, IChatWidgetService)),
|
|
499
536
|
( __param(9, IConfigurationService)),
|
|
500
|
-
( __param(10, ILogService))
|
|
537
|
+
( __param(10, ILogService)),
|
|
538
|
+
( __param(11, ITerminalService))
|
|
501
539
|
], OutputMonitor));
|
|
502
540
|
function getMoreActions(suggestedOption, confirmationPrompt) {
|
|
503
541
|
const moreActions = [];
|
|
@@ -12,6 +12,7 @@ export interface IExecution {
|
|
|
12
12
|
getOutput: (marker?: XtermMarker) => string;
|
|
13
13
|
isActive?: () => Promise<boolean>;
|
|
14
14
|
task?: Task | Pick<Task, "configurationProperties">;
|
|
15
|
+
dependencyTasks?: Task[];
|
|
15
16
|
instance: Pick<ITerminalInstance, "sendText" | "instanceId" | "onDidInputData" | "onData" | "focus" | "registerMarker">;
|
|
16
17
|
sessionId: string | undefined;
|
|
17
18
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { CountTokensCallback, IPreparedToolInvocation, IToolData, IToolInvocation, IToolInvocationPreparationContext, IToolResult, ToolProgress } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService";
|
|
3
|
+
import { RunInTerminalTool } from "./runInTerminalTool.js";
|
|
4
|
+
export declare const ConfirmTerminalCommandToolData: IToolData;
|
|
5
|
+
export declare class ConfirmTerminalCommandTool extends RunInTerminalTool {
|
|
6
|
+
prepareToolInvocation(context: IToolInvocationPreparationContext, token: CancellationToken): Promise<IPreparedToolInvocation | undefined>;
|
|
7
|
+
invoke(invocation: IToolInvocation, countTokens: CountTokensCallback, progress: ToolProgress, token: CancellationToken): Promise<IToolResult>;
|
|
8
|
+
}
|