@codingame/monaco-vscode-chat-service-override 19.1.4 → 20.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 +20 -8
- package/package.json +36 -31
- package/vscode/src/vs/base/common/policy.d.ts +14 -0
- package/vscode/src/vs/base/common/policy.js +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +53 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +54 -24
- 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 +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +37 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +23 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +83 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +421 -21
- 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 +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +215 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +9 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.js +18 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +20 -20
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +11 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +16 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +7 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +58 -326
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +33 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +12 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +39 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.js +380 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.js +4 -2
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +22 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +9 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +44 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +145 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +34 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +36 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.js +407 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.js +738 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +142 -151
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +54 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +23 -7
- 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/languageModelToolsService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +13 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/media/apple-dark.svg +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/apple-light.svg +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSessions.css +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +14 -14
- 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/promptToolsCodeLensProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.d.ts +1 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.js +52 -90
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +9 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +11 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +137 -30
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.js +44 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/configMigration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/filePromptContentsProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/promptContentsProviderBase.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/promptContentsProviderBase.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderDiagnosticsProvider.js +3 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderHovers.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkDiagnosticsProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptPathAutocompletion.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/providerInstanceManagerBase.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/basePromptParser.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/headerBase.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/instructionsHeader.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/applyTo.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/base/enum.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/base/string.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/tools.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/modeHeader.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/promptHeader.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/promptHeader.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/topError.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +2 -2
- 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/inlineChat/browser/inlineChat.contribution.js +9 -9
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +104 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +667 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +14 -14
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +1 -1
- 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/media/terminalChatWidget.css +56 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js +14 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +111 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +52 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +262 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.js +129 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatControllerHolder.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatControllerHolder.js +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +30 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +72 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +411 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.js +59 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/bufferOutputPolling.d.ts +51 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/bufferOutputPolling.js +163 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.js +164 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +101 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +52 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +71 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +94 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/getTerminalOutputTool.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/getTerminalOutputTool.js +44 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +18 -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 +13 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalTool.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalTool.js +603 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.js +113 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/createAndRunTaskTool.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/createAndRunTaskTool.js +227 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/getTaskOutputTool.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/getTaskOutputTool.js +88 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/runTaskTool.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/runTaskTool.js +140 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/taskHelpers.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/taskHelpers.js +80 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task.chatAgentTools.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task.chatAgentTools.contribution.js +40 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +36 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +114 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/google-mono-dark.svg +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/media/google-mono-light.svg +0 -3
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { equals, binarySearch2 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
-
import { findLast } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arraysFind';
|
|
5
3
|
import { Sequencer, timeout, SequencerByKey, DeferredPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
6
4
|
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
7
5
|
import { BugIndicatingError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
8
6
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
9
7
|
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
10
|
-
import { Disposable,
|
|
8
|
+
import { Disposable, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
11
9
|
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
12
10
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
13
11
|
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
14
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
15
12
|
import { IBulkEditService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService.service';
|
|
16
13
|
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
17
|
-
import { IEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service';
|
|
18
14
|
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
19
15
|
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
20
16
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
21
17
|
import { AccessibilitySignal } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
|
|
22
18
|
import { IAccessibilitySignalService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
|
|
23
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
24
19
|
import { EditorActivation } from '@codingame/monaco-vscode-api/vscode/vs/platform/editor/common/editor';
|
|
25
20
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
26
|
-
import {
|
|
27
|
-
import { DiffEditorInput } from '@codingame/monaco-vscode-9c72783f-914c-50be-b9ef-da16356d81a8-common/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
21
|
+
import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
28
22
|
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
29
23
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
30
|
-
import { MultiDiffEditorInput } from '@codingame/monaco-vscode-
|
|
24
|
+
import { MultiDiffEditorInput } from '@codingame/monaco-vscode-0af61f78-dfc5-57ba-8d32-66268c8de38d-common/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
31
25
|
import { CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
32
26
|
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
33
27
|
import { ChatEditingSessionState, ModifiedFileEntryState, getMultiDiffSourceUri, ChatEditKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
@@ -37,14 +31,11 @@ import { AbstractChatEditingModifiedFileEntry } from './chatEditingModifiedFileE
|
|
|
37
31
|
import { ChatEditingModifiedNotebookEntry } from './chatEditingModifiedNotebookEntry.js';
|
|
38
32
|
import { ChatEditingSessionStorage } from './chatEditingSessionStorage.js';
|
|
39
33
|
import { ChatEditingTextModelContentProvider } from './chatEditingTextModelContentProviders.js';
|
|
40
|
-
import {
|
|
34
|
+
import { ChatEditingTimeline } from './chatEditingTimeline.js';
|
|
41
35
|
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
42
|
-
import { derived, derivedOpts } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
43
|
-
import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
|
|
44
36
|
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
45
|
-
import {
|
|
37
|
+
import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
|
|
46
38
|
|
|
47
|
-
const POST_EDIT_STOP_ID = 'd19944f6-f46c-4e17-911b-79a8e843c7c0';
|
|
48
39
|
class ThrottledSequencer extends Sequencer {
|
|
49
40
|
constructor(_minDuration, _maxOverallDelay) {
|
|
50
41
|
super();
|
|
@@ -70,16 +61,6 @@ class ThrottledSequencer extends Sequencer {
|
|
|
70
61
|
});
|
|
71
62
|
}
|
|
72
63
|
}
|
|
73
|
-
function getMaxHistoryIndex(history) {
|
|
74
|
-
const lastHistory = history.at(-1);
|
|
75
|
-
return lastHistory ? lastHistory.startIndex + lastHistory.stops.length : 0;
|
|
76
|
-
}
|
|
77
|
-
function snapshotsEqualForDiff(a, b) {
|
|
78
|
-
if (!a || !b) {
|
|
79
|
-
return a === b;
|
|
80
|
-
}
|
|
81
|
-
return isEqual(a.snapshotUri, b.snapshotUri) && a.current === b.current;
|
|
82
|
-
}
|
|
83
64
|
function getCurrentAndNextStop(requestId, stopId, history) {
|
|
84
65
|
const snapshotIndex = history.findIndex(s => s.requestId === requestId);
|
|
85
66
|
if (snapshotIndex === -1) {
|
|
@@ -93,39 +74,12 @@ function getCurrentAndNextStop(requestId, stopId, history) {
|
|
|
93
74
|
const current = snapshot.stops[stopIndex].entries;
|
|
94
75
|
const next = stopIndex < snapshot.stops.length - 1
|
|
95
76
|
? snapshot.stops[stopIndex + 1].entries
|
|
96
|
-
:
|
|
77
|
+
: history[snapshotIndex + 1]?.stops[0].entries;
|
|
97
78
|
if (!next) {
|
|
98
79
|
return undefined;
|
|
99
80
|
}
|
|
100
81
|
return { current, next };
|
|
101
82
|
}
|
|
102
|
-
function getFirstAndLastStop(uri, history) {
|
|
103
|
-
let firstStopWithUri;
|
|
104
|
-
for (const snapshot of history) {
|
|
105
|
-
const stop = snapshot.stops.find(s => ( s.entries.has(uri)));
|
|
106
|
-
if (stop) {
|
|
107
|
-
firstStopWithUri = stop;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
let lastStopWithUri;
|
|
112
|
-
for (let i = history.length - 1; i >= 0; i--) {
|
|
113
|
-
const snapshot = history[i];
|
|
114
|
-
if (snapshot.postEdit?.has(uri)) {
|
|
115
|
-
lastStopWithUri = snapshot.postEdit;
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
const stop = findLast(snapshot.stops, s => ( s.entries.has(uri)));
|
|
119
|
-
if (stop) {
|
|
120
|
-
lastStopWithUri = stop.entries;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (!firstStopWithUri || !lastStopWithUri) {
|
|
125
|
-
return undefined;
|
|
126
|
-
}
|
|
127
|
-
return { current: firstStopWithUri.entries, next: lastStopWithUri };
|
|
128
|
-
}
|
|
129
83
|
let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
130
84
|
get entries() {
|
|
131
85
|
this._assertNotDisposed();
|
|
@@ -138,7 +92,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
138
92
|
this._assertNotDisposed();
|
|
139
93
|
return this._onDidDispose.event;
|
|
140
94
|
}
|
|
141
|
-
constructor(chatSessionId, isGlobalEditingSession, _lookupExternalEntry, _instantiationService, _modelService, _languageService, _textModelService, _bulkEditService, _editorGroupsService, _editorService, _chatService, _notebookService,
|
|
95
|
+
constructor(chatSessionId, isGlobalEditingSession, _lookupExternalEntry, _instantiationService, _modelService, _languageService, _textModelService, _bulkEditService, _editorGroupsService, _editorService, _chatService, _notebookService, _accessibilitySignalService) {
|
|
142
96
|
super();
|
|
143
97
|
this.chatSessionId = chatSessionId;
|
|
144
98
|
this.isGlobalEditingSession = isGlobalEditingSession;
|
|
@@ -152,33 +106,24 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
152
106
|
this._editorService = _editorService;
|
|
153
107
|
this._chatService = _chatService;
|
|
154
108
|
this._notebookService = _notebookService;
|
|
155
|
-
this._editorWorkerService = _editorWorkerService;
|
|
156
|
-
this._configurationService = _configurationService;
|
|
157
109
|
this._accessibilitySignalService = _accessibilitySignalService;
|
|
158
110
|
this._state = observableValue(this, ChatEditingSessionState.Initial);
|
|
159
|
-
this._linearHistory = observableValue(this, []);
|
|
160
|
-
this._linearHistoryIndex = observableValue(this, 0);
|
|
161
111
|
this._initialFileContents = ( new ResourceMap());
|
|
162
112
|
this._entriesObs = observableValue(this, []);
|
|
163
|
-
this.canUndo = derived((r) => {
|
|
164
|
-
if (this.state.read(r) !== ChatEditingSessionState.Idle) {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
const linearHistoryIndex = this._linearHistoryIndex.read(r);
|
|
168
|
-
return linearHistoryIndex > 0;
|
|
169
|
-
});
|
|
170
|
-
this.canRedo = derived((r) => {
|
|
171
|
-
if (this.state.read(r) !== ChatEditingSessionState.Idle) {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
const linearHistoryIndex = this._linearHistoryIndex.read(r);
|
|
175
|
-
return linearHistoryIndex < getMaxHistoryIndex(this._linearHistory.read(r));
|
|
176
|
-
});
|
|
177
113
|
this._onDidDispose = ( new Emitter());
|
|
178
|
-
this.
|
|
179
|
-
this._fullDiffs = ( new Map());
|
|
114
|
+
this._pendingSnapshot = observableValue(this, undefined);
|
|
180
115
|
this._streamingEditLocks = ( new SequencerByKey());
|
|
181
|
-
this.
|
|
116
|
+
this._timeline = _instantiationService.createInstance(ChatEditingTimeline);
|
|
117
|
+
this.canRedo = ( this._timeline.canRedo.map(
|
|
118
|
+
(hasHistory, reader) => hasHistory && this._state.read(reader) === ChatEditingSessionState.Idle
|
|
119
|
+
));
|
|
120
|
+
this.canUndo = ( this._timeline.canUndo.map(
|
|
121
|
+
(hasHistory, reader) => hasHistory && this._state.read(reader) === ChatEditingSessionState.Idle
|
|
122
|
+
));
|
|
123
|
+
this._register(autorun(reader => {
|
|
124
|
+
const disabled = this._timeline.requestDisablement.read(reader);
|
|
125
|
+
this._chatService.getSession(this.chatSessionId)?.setDisabledRequests(disabled);
|
|
126
|
+
}));
|
|
182
127
|
}
|
|
183
128
|
async init() {
|
|
184
129
|
const restoredSessionState = await this._instantiationService.createInstance(ChatEditingSessionStorage, this.chatSessionId).restoreState();
|
|
@@ -186,11 +131,10 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
186
131
|
for (const [uri, content] of restoredSessionState.initialFileContents) {
|
|
187
132
|
this._initialFileContents.set(uri, content);
|
|
188
133
|
}
|
|
189
|
-
this._pendingSnapshot = restoredSessionState.pendingSnapshot;
|
|
190
134
|
await this._restoreSnapshot(restoredSessionState.recentSnapshot, false);
|
|
191
|
-
transaction(
|
|
192
|
-
this.
|
|
193
|
-
this.
|
|
135
|
+
transaction(tx => {
|
|
136
|
+
this._pendingSnapshot.set(restoredSessionState.pendingSnapshot, tx);
|
|
137
|
+
this._timeline.restoreFromState({ history: restoredSessionState.linearHistory, index: restoredSessionState.linearHistoryIndex }, tx);
|
|
194
138
|
this._state.set(ChatEditingSessionState.Idle, tx);
|
|
195
139
|
});
|
|
196
140
|
}
|
|
@@ -217,182 +161,38 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
217
161
|
}
|
|
218
162
|
storeState() {
|
|
219
163
|
const storage = this._instantiationService.createInstance(ChatEditingSessionStorage, this.chatSessionId);
|
|
164
|
+
const timelineState = this._timeline.getStateForPersistence();
|
|
220
165
|
const state = {
|
|
221
166
|
initialFileContents: this._initialFileContents,
|
|
222
|
-
pendingSnapshot: this._pendingSnapshot,
|
|
167
|
+
pendingSnapshot: this._pendingSnapshot.get(),
|
|
223
168
|
recentSnapshot: this._createSnapshot(undefined, undefined),
|
|
224
|
-
linearHistoryIndex:
|
|
225
|
-
linearHistory:
|
|
169
|
+
linearHistoryIndex: timelineState.index,
|
|
170
|
+
linearHistory: timelineState.history,
|
|
226
171
|
};
|
|
227
172
|
return storage.storeState(state);
|
|
228
173
|
}
|
|
229
|
-
_findSnapshot(requestId) {
|
|
230
|
-
return this._linearHistory.get().find(s => s.requestId === requestId);
|
|
231
|
-
}
|
|
232
|
-
_findEditStop(requestId, undoStop) {
|
|
233
|
-
const snapshot = this._findSnapshot(requestId);
|
|
234
|
-
if (!snapshot) {
|
|
235
|
-
return undefined;
|
|
236
|
-
}
|
|
237
|
-
const idx = snapshot.stops.findIndex(s => s.stopId === undoStop);
|
|
238
|
-
return idx === -1 ? undefined : { stop: snapshot.stops[idx], snapshot, historyIndex: snapshot.startIndex + idx };
|
|
239
|
-
}
|
|
240
174
|
_ensurePendingSnapshot() {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const modelUris = modelUrisObservable.read(reader);
|
|
246
|
-
if (!modelUris) {
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
const store = reader.store.add(( new DisposableStore()));
|
|
250
|
-
const promise = Promise.all(( modelUris.map(u => this._textModelService.createModelReference(u)))).then(refs => {
|
|
251
|
-
if (store.isDisposed) {
|
|
252
|
-
refs.forEach(r => r.dispose());
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
refs.forEach(r => store.add(r));
|
|
256
|
-
}
|
|
257
|
-
return refs;
|
|
258
|
-
});
|
|
259
|
-
return ( new ObservablePromise(promise));
|
|
260
|
-
});
|
|
261
|
-
return derived((reader) => {
|
|
262
|
-
const refs2 = modelRefsPromise.read(reader)?.promiseResult.read(reader);
|
|
263
|
-
const refs = refs2?.data;
|
|
264
|
-
if (!refs) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const entries = entriesContent.read(reader);
|
|
268
|
-
if (entries?.before && ChatEditingModifiedNotebookEntry.canHandleSnapshot(entries.before)) {
|
|
269
|
-
const diffService = this._instantiationService.createInstance(ChatEditingModifiedNotebookDiff, entries.before, entries.after);
|
|
270
|
-
return ( new ObservablePromise(diffService.computeDiff()));
|
|
271
|
-
}
|
|
272
|
-
const ignoreTrimWhitespace = this._ignoreTrimWhitespaceObservable.read(reader);
|
|
273
|
-
const promise = this._editorWorkerService.computeDiff(refs[0].object.textEditorModel.uri, refs[1].object.textEditorModel.uri, { ignoreTrimWhitespace, computeMoves: false, maxComputationTimeMs: 3000 }, 'advanced').then((diff) => {
|
|
274
|
-
const entryDiff = {
|
|
275
|
-
originalURI: refs[0].object.textEditorModel.uri,
|
|
276
|
-
modifiedURI: refs[1].object.textEditorModel.uri,
|
|
277
|
-
identical: !!diff?.identical,
|
|
278
|
-
quitEarly: !diff || diff.quitEarly,
|
|
279
|
-
added: 0,
|
|
280
|
-
removed: 0,
|
|
281
|
-
};
|
|
282
|
-
if (diff) {
|
|
283
|
-
for (const change of diff.changes) {
|
|
284
|
-
entryDiff.removed += change.original.endLineNumberExclusive - change.original.startLineNumber;
|
|
285
|
-
entryDiff.added += change.modified.endLineNumberExclusive - change.modified.startLineNumber;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return entryDiff;
|
|
289
|
-
});
|
|
290
|
-
return ( new ObservablePromise(promise));
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
_createDiffBetweenStopsObservable(uri, requestId, stopId) {
|
|
294
|
-
const entries = derivedOpts({
|
|
295
|
-
equalsFn: (a, b) => snapshotsEqualForDiff(a?.before, b?.before) && snapshotsEqualForDiff(a?.after, b?.after),
|
|
296
|
-
}, reader => {
|
|
297
|
-
const stops = requestId ?
|
|
298
|
-
getCurrentAndNextStop(requestId, stopId, this._linearHistory.read(reader)) :
|
|
299
|
-
getFirstAndLastStop(uri, this._linearHistory.read(reader));
|
|
300
|
-
if (!stops) {
|
|
301
|
-
return undefined;
|
|
302
|
-
}
|
|
303
|
-
const before = stops.current.get(uri);
|
|
304
|
-
const after = stops.next.get(uri);
|
|
305
|
-
if (!before || !after) {
|
|
306
|
-
return undefined;
|
|
307
|
-
}
|
|
308
|
-
return { before, after };
|
|
309
|
-
});
|
|
310
|
-
const modelUrisObservable = derivedOpts({ equalsFn: (a, b) => equals(a, b, isEqual) }, reader => {
|
|
311
|
-
const entriesValue = entries.read(reader);
|
|
312
|
-
if (!entriesValue) {
|
|
313
|
-
return undefined;
|
|
314
|
-
}
|
|
315
|
-
return [entriesValue.before.snapshotUri, entriesValue.after.snapshotUri];
|
|
316
|
-
});
|
|
317
|
-
const diff = this._entryDiffBetweenTextStops(entries, modelUrisObservable);
|
|
318
|
-
return derived(reader => {
|
|
319
|
-
return diff.read(reader)?.promiseResult.read(reader)?.data || undefined;
|
|
320
|
-
});
|
|
175
|
+
const prev = this._pendingSnapshot.get();
|
|
176
|
+
if (!prev) {
|
|
177
|
+
this._pendingSnapshot.set(this._createSnapshot(undefined, undefined), undefined);
|
|
178
|
+
}
|
|
321
179
|
}
|
|
322
180
|
getEntryDiffBetweenStops(uri, requestId, stopId) {
|
|
323
|
-
|
|
324
|
-
const key = `${uri}\0${requestId}\0${stopId}`;
|
|
325
|
-
let observable = this._diffsBetweenStops.get(key);
|
|
326
|
-
if (!observable) {
|
|
327
|
-
observable = this._createDiffBetweenStopsObservable(uri, requestId, stopId);
|
|
328
|
-
this._diffsBetweenStops.set(key, observable);
|
|
329
|
-
}
|
|
330
|
-
return observable;
|
|
331
|
-
}
|
|
332
|
-
else {
|
|
333
|
-
const key = ( uri.toString());
|
|
334
|
-
let observable = this._fullDiffs.get(key);
|
|
335
|
-
if (!observable) {
|
|
336
|
-
observable = this._createDiffBetweenStopsObservable(uri, requestId, stopId);
|
|
337
|
-
this._fullDiffs.set(key, observable);
|
|
338
|
-
}
|
|
339
|
-
return observable;
|
|
340
|
-
}
|
|
181
|
+
return this._timeline.getEntryDiffBetweenStops(uri, requestId, stopId);
|
|
341
182
|
}
|
|
342
183
|
createSnapshot(requestId, undoStop, makeEmpty = undoStop !== undefined) {
|
|
343
|
-
|
|
344
|
-
const linearHistoryPtr = this._linearHistoryIndex.get();
|
|
345
|
-
const newLinearHistory = [];
|
|
346
|
-
for (const entry of this._linearHistory.get()) {
|
|
347
|
-
if (entry.startIndex >= linearHistoryPtr) {
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
else if (linearHistoryPtr - entry.startIndex < entry.stops.length) {
|
|
351
|
-
newLinearHistory.push({ requestId: entry.requestId, stops: entry.stops.slice(0, linearHistoryPtr - entry.startIndex), startIndex: entry.startIndex, postEdit: undefined });
|
|
352
|
-
}
|
|
353
|
-
else {
|
|
354
|
-
newLinearHistory.push(entry);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
const lastEntry = newLinearHistory.at(-1);
|
|
358
|
-
if (requestId && lastEntry?.requestId === requestId) {
|
|
359
|
-
if (lastEntry.postEdit && undoStop) {
|
|
360
|
-
const rebaseUri = (uri) => ( URI.parse(( uri.toString()).replaceAll(POST_EDIT_STOP_ID, undoStop)));
|
|
361
|
-
for (const [uri, prev] of lastEntry.postEdit.entries()) {
|
|
362
|
-
snapshot.entries.set(uri, { ...prev, snapshotUri: rebaseUri(prev.snapshotUri), resource: rebaseUri(prev.resource) });
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
newLinearHistory[newLinearHistory.length - 1] = { ...lastEntry, stops: [...lastEntry.stops, snapshot], postEdit: undefined };
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
newLinearHistory.push({ requestId, startIndex: lastEntry ? lastEntry.startIndex + lastEntry.stops.length : 0, stops: [snapshot], postEdit: undefined });
|
|
369
|
-
}
|
|
370
|
-
transaction((tx) => {
|
|
371
|
-
const last = newLinearHistory[newLinearHistory.length - 1];
|
|
372
|
-
this._linearHistory.set(newLinearHistory, tx);
|
|
373
|
-
this._linearHistoryIndex.set(last.startIndex + last.stops.length, tx);
|
|
374
|
-
});
|
|
184
|
+
this._timeline.pushSnapshot(requestId, undoStop, makeEmpty ? ChatEditingTimeline.createEmptySnapshot(undoStop) : this._createSnapshot(requestId, undoStop));
|
|
375
185
|
}
|
|
376
|
-
|
|
377
|
-
return {
|
|
378
|
-
stopId: undoStop,
|
|
379
|
-
entries: ( new ResourceMap()),
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
_createSnapshot(requestId, undoStop) {
|
|
186
|
+
_createSnapshot(requestId, stopId) {
|
|
383
187
|
const entries = ( new ResourceMap());
|
|
384
188
|
for (const entry of this._entriesObs.get()) {
|
|
385
|
-
entries.set(entry.modifiedURI, entry.createSnapshot(requestId,
|
|
189
|
+
entries.set(entry.modifiedURI, entry.createSnapshot(requestId, stopId));
|
|
386
190
|
}
|
|
387
|
-
return {
|
|
388
|
-
stopId: undoStop,
|
|
389
|
-
entries,
|
|
390
|
-
};
|
|
191
|
+
return { stopId, entries };
|
|
391
192
|
}
|
|
392
193
|
getSnapshot(requestId, undoStop, snapshotUri) {
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
: this._findEditStop(requestId, undoStop)?.stop.entries;
|
|
194
|
+
const stopRef = this._timeline.getSnapshotForRestore(requestId, undoStop);
|
|
195
|
+
const entries = stopRef?.stop.entries;
|
|
396
196
|
return entries && [...( entries.values())].find((e) => isEqual(e.snapshotUri, snapshotUri));
|
|
397
197
|
}
|
|
398
198
|
async getSnapshotModel(requestId, undoStop, snapshotUri) {
|
|
@@ -403,25 +203,25 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
403
203
|
return this._modelService.createModel(snapshotEntry.current, this._languageService.createById(snapshotEntry.languageId), snapshotUri, false);
|
|
404
204
|
}
|
|
405
205
|
getSnapshotUri(requestId, uri, stopId) {
|
|
406
|
-
const
|
|
206
|
+
const timelineState = this._timeline.getStateForPersistence();
|
|
207
|
+
const stops = getCurrentAndNextStop(requestId, stopId, timelineState.history);
|
|
407
208
|
return stops?.next.get(uri)?.snapshotUri;
|
|
408
209
|
}
|
|
409
210
|
async restoreSnapshot(requestId, stopId) {
|
|
410
211
|
if (requestId !== undefined) {
|
|
411
|
-
const stopRef = this.
|
|
212
|
+
const stopRef = this._timeline.getSnapshotForRestore(requestId, stopId);
|
|
412
213
|
if (stopRef) {
|
|
413
214
|
this._ensurePendingSnapshot();
|
|
414
|
-
this._linearHistoryIndex.set(stopRef.historyIndex, undefined);
|
|
415
215
|
await this._restoreSnapshot(stopRef.stop);
|
|
416
|
-
|
|
216
|
+
stopRef.apply();
|
|
417
217
|
}
|
|
418
218
|
}
|
|
419
219
|
else {
|
|
420
|
-
const pendingSnapshot = this._pendingSnapshot;
|
|
220
|
+
const pendingSnapshot = this._pendingSnapshot.get();
|
|
421
221
|
if (!pendingSnapshot) {
|
|
422
222
|
return;
|
|
423
223
|
}
|
|
424
|
-
this._pendingSnapshot
|
|
224
|
+
this._pendingSnapshot.set(undefined, undefined);
|
|
425
225
|
await this._restoreSnapshot(pendingSnapshot, undefined);
|
|
426
226
|
}
|
|
427
227
|
}
|
|
@@ -486,7 +286,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
486
286
|
}
|
|
487
287
|
const input = MultiDiffEditorInput.fromResourceMultiDiffEditorInput({
|
|
488
288
|
multiDiffSource: getMultiDiffSourceUri(this, previousChanges),
|
|
489
|
-
label: ( localize(
|
|
289
|
+
label: ( localize(4962, "Suggested Edits"))
|
|
490
290
|
}, this._instantiationService);
|
|
491
291
|
this._editorPane = await this._editorGroupsService.activeGroup.openEditor(input, { pinned: true, activation: EditorActivation.ACTIVATE });
|
|
492
292
|
}
|
|
@@ -570,104 +370,38 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
570
370
|
},
|
|
571
371
|
};
|
|
572
372
|
}
|
|
573
|
-
_getHistoryEntryByLinearIndex(index) {
|
|
574
|
-
const history = this._linearHistory.get();
|
|
575
|
-
const searchedIndex = binarySearch2(history.length, (e) => history[e].startIndex - index);
|
|
576
|
-
const entry = history[searchedIndex < 0 ? (~searchedIndex) - 1 : searchedIndex];
|
|
577
|
-
if (!entry || index - entry.startIndex >= entry.stops.length) {
|
|
578
|
-
return undefined;
|
|
579
|
-
}
|
|
580
|
-
return {
|
|
581
|
-
entry,
|
|
582
|
-
stop: entry.stops[index - entry.startIndex]
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
373
|
async undoInteraction() {
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
if (!previousSnapshot) {
|
|
374
|
+
const undo = this._timeline.getUndoSnapshot();
|
|
375
|
+
if (!undo) {
|
|
589
376
|
return;
|
|
590
377
|
}
|
|
591
378
|
this._ensurePendingSnapshot();
|
|
592
|
-
await this._restoreSnapshot(
|
|
593
|
-
|
|
594
|
-
this._updateRequestHiddenState();
|
|
379
|
+
await this._restoreSnapshot(undo.stop);
|
|
380
|
+
undo.apply();
|
|
595
381
|
}
|
|
596
382
|
async redoInteraction() {
|
|
597
|
-
const
|
|
598
|
-
const
|
|
599
|
-
if (newIndex > maxIndex) {
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
const nextSnapshot = newIndex === maxIndex ? this._pendingSnapshot : this._getHistoryEntryByLinearIndex(newIndex)?.stop;
|
|
383
|
+
const redo = this._timeline.getRedoSnapshot();
|
|
384
|
+
const nextSnapshot = redo?.stop || this._pendingSnapshot.get();
|
|
603
385
|
if (!nextSnapshot) {
|
|
604
386
|
return;
|
|
605
387
|
}
|
|
606
388
|
await this._restoreSnapshot(nextSnapshot);
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
const index = this._linearHistoryIndex.get();
|
|
613
|
-
const undoRequests = [];
|
|
614
|
-
for (const entry of history) {
|
|
615
|
-
if (!entry.requestId) ;
|
|
616
|
-
else if (entry.startIndex >= index) {
|
|
617
|
-
undoRequests.push({ requestId: entry.requestId });
|
|
618
|
-
}
|
|
619
|
-
else if (entry.startIndex + entry.stops.length > index) {
|
|
620
|
-
undoRequests.push({ requestId: entry.requestId, afterUndoStop: entry.stops[index - entry.startIndex].stopId });
|
|
621
|
-
}
|
|
389
|
+
if (redo) {
|
|
390
|
+
redo.apply();
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
this._pendingSnapshot.set(undefined, undefined);
|
|
622
394
|
}
|
|
623
|
-
this._chatService.getSession(this.chatSessionId)?.setDisabledRequests(undoRequests);
|
|
624
395
|
}
|
|
625
396
|
async _acceptStreamingEditsStart(responseModel, undoStop, resource) {
|
|
626
397
|
const entry = await this._getOrCreateModifiedFileEntry(resource, this._getTelemetryInfoForModel(responseModel));
|
|
627
398
|
transaction((tx) => {
|
|
628
399
|
this._state.set(ChatEditingSessionState.StreamingEdits, tx);
|
|
629
400
|
entry.acceptStreamingEditsStart(responseModel, tx);
|
|
630
|
-
this.ensureEditInUndoStopMatches(responseModel.requestId, undoStop, entry, false, tx);
|
|
401
|
+
this._timeline.ensureEditInUndoStopMatches(responseModel.requestId, undoStop, entry, false, tx);
|
|
631
402
|
});
|
|
632
403
|
}
|
|
633
|
-
ensureEditInUndoStopMatches(requestId, undoStop, entry, next, tx) {
|
|
634
|
-
const history = this._linearHistory.get();
|
|
635
|
-
const snapIndex = history.findIndex(s => s.requestId === requestId);
|
|
636
|
-
if (snapIndex === -1) {
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
const snap = history[snapIndex];
|
|
640
|
-
let stopIndex = snap.stops.findIndex(s => s.stopId === undoStop);
|
|
641
|
-
if (stopIndex === -1) {
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
if (next) {
|
|
645
|
-
if (stopIndex === snap.stops.length - 1) {
|
|
646
|
-
const postEdit = ( new ResourceMap(snap.postEdit || this._createEmptySnapshot(undefined).entries));
|
|
647
|
-
if (!snap.postEdit || !entry.equalsSnapshot(postEdit.get(entry.modifiedURI))) {
|
|
648
|
-
postEdit.set(entry.modifiedURI, entry.createSnapshot(requestId, POST_EDIT_STOP_ID));
|
|
649
|
-
const newHistory = history.slice();
|
|
650
|
-
newHistory[snapIndex] = { ...snap, postEdit };
|
|
651
|
-
this._linearHistory.set(newHistory, tx);
|
|
652
|
-
}
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
stopIndex++;
|
|
656
|
-
}
|
|
657
|
-
const stop = snap.stops[stopIndex];
|
|
658
|
-
if (entry.equalsSnapshot(stop.entries.get(entry.modifiedURI))) {
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
const newMap = ( new ResourceMap(stop.entries));
|
|
662
|
-
newMap.set(entry.modifiedURI, entry.createSnapshot(requestId, stop.stopId));
|
|
663
|
-
const newStop = snap.stops.slice();
|
|
664
|
-
newStop[stopIndex] = { ...stop, entries: newMap };
|
|
665
|
-
const newHistory = history.slice();
|
|
666
|
-
newHistory[snapIndex] = { ...snap, stops: newStop };
|
|
667
|
-
this._linearHistory.set(newHistory, tx);
|
|
668
|
-
}
|
|
669
404
|
async _acceptEdits(resource, textEdits, isLastEdits, responseModel) {
|
|
670
|
-
this._fullDiffs.delete(( resource.toString()));
|
|
671
405
|
const entry = await this._getOrCreateModifiedFileEntry(resource, this._getTelemetryInfoForModel(responseModel));
|
|
672
406
|
await entry.acceptAgentEdits(resource, textEdits, isLastEdits, responseModel);
|
|
673
407
|
}
|
|
@@ -689,7 +423,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
689
423
|
if (!entry) {
|
|
690
424
|
return;
|
|
691
425
|
}
|
|
692
|
-
this.ensureEditInUndoStopMatches(requestId, undoStop, entry, true, undefined);
|
|
426
|
+
this._timeline.ensureEditInUndoStopMatches(requestId, undoStop, entry, true, undefined);
|
|
693
427
|
return entry.acceptStreamingEditsEnd();
|
|
694
428
|
}
|
|
695
429
|
async _getOrCreateModifiedFileEntry(resource, telemetryInfo) {
|
|
@@ -773,9 +507,7 @@ ChatEditingSession = ( __decorate([
|
|
|
773
507
|
( __param(9, IEditorService)),
|
|
774
508
|
( __param(10, IChatService)),
|
|
775
509
|
( __param(11, INotebookService)),
|
|
776
|
-
( __param(12,
|
|
777
|
-
( __param(13, IConfigurationService)),
|
|
778
|
-
( __param(14, IAccessibilitySignalService))
|
|
510
|
+
( __param(12, IAccessibilitySignalService))
|
|
779
511
|
], ChatEditingSession));
|
|
780
512
|
|
|
781
513
|
export { ChatEditingSession };
|
package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ export interface IChatEditingSessionSnapshot {
|
|
|
28
28
|
readonly startIndex: number;
|
|
29
29
|
readonly requestId: string | undefined;
|
|
30
30
|
readonly stops: IChatEditingSessionStop[];
|
|
31
|
-
readonly postEdit: ResourceMap<ISnapshotEntry> | undefined;
|
|
32
31
|
}
|
|
33
32
|
export interface IChatEditingSessionStop {
|
|
34
33
|
stopId: string | undefined;
|