@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
|
@@ -1,42 +1,52 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { Sequencer, timeout, SequencerByKey, DeferredPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
|
+
import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
4
5
|
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
6
|
import { BugIndicatingError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
6
7
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
8
|
+
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
7
9
|
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
8
|
-
import { Disposable, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
10
|
+
import { Disposable, DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
9
11
|
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
10
12
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
11
13
|
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
14
|
+
import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
15
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
16
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
12
17
|
import { IBulkEditService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService.service';
|
|
18
|
+
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
13
19
|
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
14
20
|
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
15
21
|
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
16
22
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
17
23
|
import { AccessibilitySignal } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
|
|
18
24
|
import { IAccessibilitySignalService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
|
|
25
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
19
26
|
import { EditorActivation } from '@codingame/monaco-vscode-api/vscode/vs/platform/editor/common/editor';
|
|
20
27
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
28
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
21
29
|
import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
22
30
|
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
23
31
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
24
|
-
import { MultiDiffEditorInput } from '@codingame/monaco-vscode-
|
|
32
|
+
import { MultiDiffEditorInput } from '@codingame/monaco-vscode-bc6f260d-ec63-5c95-9446-1ca7d0872719-common/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
25
33
|
import { CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
26
34
|
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
27
35
|
import { ChatEditingSessionState, ModifiedFileEntryState, getMultiDiffSourceUri, ChatEditKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
28
36
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
29
37
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
38
|
+
import { ChatEditingCheckpointTimelineImpl } from './chatEditingCheckpointTimelineImpl.js';
|
|
30
39
|
import { ChatEditingModifiedDocumentEntry } from './chatEditingModifiedDocumentEntry.js';
|
|
31
40
|
import { AbstractChatEditingModifiedFileEntry } from './chatEditingModifiedFileEntry.js';
|
|
32
41
|
import { ChatEditingModifiedNotebookEntry } from './chatEditingModifiedNotebookEntry.js';
|
|
42
|
+
import { FileOperationType } from './chatEditingOperations.js';
|
|
33
43
|
import { ChatEditingSessionStorage } from './chatEditingSessionStorage.js';
|
|
34
44
|
import { ChatEditingTextModelContentProvider } from './chatEditingTextModelContentProviders.js';
|
|
35
|
-
import { ChatEditingTimeline } from './chatEditingTimeline.js';
|
|
36
45
|
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
37
46
|
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
38
47
|
import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
|
|
39
48
|
|
|
49
|
+
var ChatEditingSession_1;
|
|
40
50
|
var NotExistBehavior;
|
|
41
51
|
(function (NotExistBehavior) {
|
|
42
52
|
NotExistBehavior[NotExistBehavior["Create"] = 0] = "Create";
|
|
@@ -67,26 +77,39 @@ class ThrottledSequencer extends Sequencer {
|
|
|
67
77
|
});
|
|
68
78
|
}
|
|
69
79
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
function createOpeningEditCodeBlock(uri, isNotebook) {
|
|
81
|
+
return [
|
|
82
|
+
{
|
|
83
|
+
kind: 'markdownContent',
|
|
84
|
+
content: ( new MarkdownString('\n````\n'))
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
kind: 'codeblockUri',
|
|
88
|
+
uri,
|
|
89
|
+
isEdit: true
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
kind: 'markdownContent',
|
|
93
|
+
content: ( new MarkdownString('\n````\n'))
|
|
94
|
+
},
|
|
95
|
+
isNotebook
|
|
96
|
+
? {
|
|
97
|
+
kind: 'notebookEdit',
|
|
98
|
+
uri,
|
|
99
|
+
edits: [],
|
|
100
|
+
done: false,
|
|
101
|
+
isExternalEdit: true
|
|
102
|
+
}
|
|
103
|
+
: {
|
|
104
|
+
kind: 'textEdit',
|
|
105
|
+
uri,
|
|
106
|
+
edits: [],
|
|
107
|
+
done: false,
|
|
108
|
+
isExternalEdit: true
|
|
109
|
+
},
|
|
110
|
+
];
|
|
88
111
|
}
|
|
89
|
-
let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
112
|
+
let ChatEditingSession = ChatEditingSession_1 = class ChatEditingSession extends Disposable {
|
|
90
113
|
get entries() {
|
|
91
114
|
return this._entriesObs;
|
|
92
115
|
}
|
|
@@ -97,9 +120,10 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
97
120
|
this._assertNotDisposed();
|
|
98
121
|
return this._onDidDispose.event;
|
|
99
122
|
}
|
|
100
|
-
constructor(chatSessionId, isGlobalEditingSession, _lookupExternalEntry, _instantiationService, _modelService, _languageService, _textModelService, _bulkEditService, _editorGroupsService, _editorService, _chatService, _notebookService, _accessibilitySignalService) {
|
|
123
|
+
constructor(chatSessionId, chatSessionResource, isGlobalEditingSession, _lookupExternalEntry, _instantiationService, _modelService, _languageService, _textModelService, _bulkEditService, _editorGroupsService, _editorService, _chatService, _notebookService, _accessibilitySignalService, _logService, configurationService) {
|
|
101
124
|
super();
|
|
102
125
|
this.chatSessionId = chatSessionId;
|
|
126
|
+
this.chatSessionResource = chatSessionResource;
|
|
103
127
|
this.isGlobalEditingSession = isGlobalEditingSession;
|
|
104
128
|
this._lookupExternalEntry = _lookupExternalEntry;
|
|
105
129
|
this._instantiationService = _instantiationService;
|
|
@@ -112,13 +136,16 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
112
136
|
this._chatService = _chatService;
|
|
113
137
|
this._notebookService = _notebookService;
|
|
114
138
|
this._accessibilitySignalService = _accessibilitySignalService;
|
|
139
|
+
this._logService = _logService;
|
|
140
|
+
this.configurationService = configurationService;
|
|
115
141
|
this._state = observableValue(this, ChatEditingSessionState.Initial);
|
|
116
142
|
this._initialFileContents = ( new ResourceMap());
|
|
143
|
+
this._baselineCreationLocks = ( new SequencerByKey());
|
|
144
|
+
this._streamingEditLocks = ( new SequencerByKey());
|
|
145
|
+
this._externalEditOperations = ( new Map());
|
|
117
146
|
this._entriesObs = observableValue(this, []);
|
|
118
147
|
this._onDidDispose = ( new Emitter());
|
|
119
|
-
this.
|
|
120
|
-
this._streamingEditLocks = ( new SequencerByKey());
|
|
121
|
-
this._timeline = _instantiationService.createInstance(ChatEditingTimeline);
|
|
148
|
+
this._timeline = this._instantiationService.createInstance(ChatEditingCheckpointTimelineImpl, chatSessionId, this._getTimelineDelegate());
|
|
122
149
|
this.canRedo = ( this._timeline.canRedo.map(
|
|
123
150
|
(hasHistory, reader) => hasHistory && this._state.read(reader) === ChatEditingSessionState.Idle
|
|
124
151
|
));
|
|
@@ -127,31 +154,67 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
127
154
|
));
|
|
128
155
|
this._register(autorun(reader => {
|
|
129
156
|
const disabled = this._timeline.requestDisablement.read(reader);
|
|
130
|
-
this._chatService.getSession(this.
|
|
157
|
+
this._chatService.getSession(this.chatSessionResource)?.setDisabledRequests(disabled);
|
|
131
158
|
}));
|
|
132
159
|
}
|
|
133
|
-
|
|
134
|
-
|
|
160
|
+
_getTimelineDelegate() {
|
|
161
|
+
return {
|
|
162
|
+
createFile: (uri, content) => {
|
|
163
|
+
return this._bulkEditService.apply({
|
|
164
|
+
edits: [{
|
|
165
|
+
newResource: uri,
|
|
166
|
+
options: {
|
|
167
|
+
overwrite: true,
|
|
168
|
+
contents: content ? Promise.resolve(VSBuffer.fromString(content)) : undefined,
|
|
169
|
+
},
|
|
170
|
+
}],
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
deleteFile: async (uri) => {
|
|
174
|
+
const entries = this._entriesObs.get().filter(e => !isEqual(e.modifiedURI, uri));
|
|
175
|
+
this._entriesObs.set(entries, undefined);
|
|
176
|
+
await this._bulkEditService.apply({ edits: [{ oldResource: uri, options: { ignoreIfNotExists: true } }] });
|
|
177
|
+
},
|
|
178
|
+
renameFile: async (fromUri, toUri) => {
|
|
179
|
+
const entries = this._entriesObs.get();
|
|
180
|
+
const previousEntry = entries.find(e => isEqual(e.modifiedURI, fromUri));
|
|
181
|
+
if (previousEntry) {
|
|
182
|
+
const newEntry = await this._getOrCreateModifiedFileEntry(toUri, NotExistBehavior.Create, previousEntry.telemetryInfo, this._getCurrentTextOrNotebookSnapshot(previousEntry));
|
|
183
|
+
previousEntry.dispose();
|
|
184
|
+
this._entriesObs.set(( entries.map(e => e === previousEntry ? newEntry : e)), undefined);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
setContents: async (uri, content, telemetryInfo) => {
|
|
188
|
+
const entry = await this._getOrCreateModifiedFileEntry(uri, NotExistBehavior.Create, telemetryInfo);
|
|
189
|
+
if (entry instanceof ChatEditingModifiedNotebookEntry) {
|
|
190
|
+
await entry.restoreModifiedModelFromSnapshot(content);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
await entry.acceptAgentEdits(uri, [{ range: ( new Range(1, 1, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)), text: content }], true, undefined);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
async init(transferFrom) {
|
|
199
|
+
let restoredSessionState = await this._instantiationService.createInstance(ChatEditingSessionStorage, this.chatSessionId).restoreState();
|
|
200
|
+
if (!restoredSessionState && transferFrom instanceof ChatEditingSession_1) {
|
|
201
|
+
restoredSessionState = transferFrom._getStoredState(this.chatSessionId);
|
|
202
|
+
}
|
|
135
203
|
if (restoredSessionState) {
|
|
136
204
|
for (const [uri, content] of restoredSessionState.initialFileContents) {
|
|
137
205
|
this._initialFileContents.set(uri, content);
|
|
138
206
|
}
|
|
139
|
-
await this.
|
|
207
|
+
await this._initEntries(restoredSessionState.recentSnapshot);
|
|
140
208
|
transaction(tx => {
|
|
141
|
-
|
|
142
|
-
|
|
209
|
+
if (restoredSessionState.timeline) {
|
|
210
|
+
this._timeline.restoreFromState(restoredSessionState.timeline, tx);
|
|
211
|
+
}
|
|
143
212
|
this._state.set(ChatEditingSessionState.Idle, tx);
|
|
144
213
|
});
|
|
145
214
|
}
|
|
146
215
|
else {
|
|
147
216
|
this._state.set(ChatEditingSessionState.Idle, undefined);
|
|
148
217
|
}
|
|
149
|
-
this._register(autorun(reader => {
|
|
150
|
-
const entries = this.entries.read(reader);
|
|
151
|
-
entries.forEach(entry => {
|
|
152
|
-
entry.state.read(reader);
|
|
153
|
-
});
|
|
154
|
-
}));
|
|
155
218
|
}
|
|
156
219
|
_getEntry(uri) {
|
|
157
220
|
uri = CellUri.parse(uri)?.notebook ?? uri;
|
|
@@ -166,21 +229,19 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
166
229
|
}
|
|
167
230
|
storeState() {
|
|
168
231
|
const storage = this._instantiationService.createInstance(ChatEditingSessionStorage, this.chatSessionId);
|
|
169
|
-
|
|
232
|
+
return storage.storeState(this._getStoredState());
|
|
233
|
+
}
|
|
234
|
+
_getStoredState(sessionId = this.chatSessionId) {
|
|
235
|
+
const entries = ( new ResourceMap());
|
|
236
|
+
for (const entry of this._entriesObs.get()) {
|
|
237
|
+
entries.set(entry.modifiedURI, entry.createSnapshot(sessionId, undefined, undefined));
|
|
238
|
+
}
|
|
170
239
|
const state = {
|
|
171
240
|
initialFileContents: this._initialFileContents,
|
|
172
|
-
|
|
173
|
-
recentSnapshot:
|
|
174
|
-
linearHistoryIndex: timelineState.index,
|
|
175
|
-
linearHistory: timelineState.history,
|
|
241
|
+
timeline: this._timeline.getStateForPersistence(),
|
|
242
|
+
recentSnapshot: { entries, stopId: undefined },
|
|
176
243
|
};
|
|
177
|
-
return
|
|
178
|
-
}
|
|
179
|
-
_ensurePendingSnapshot() {
|
|
180
|
-
const prev = this._pendingSnapshot.get();
|
|
181
|
-
if (!prev) {
|
|
182
|
-
this._pendingSnapshot.set(this._createSnapshot(undefined, undefined), undefined);
|
|
183
|
-
}
|
|
244
|
+
return state;
|
|
184
245
|
}
|
|
185
246
|
getEntryDiffBetweenStops(uri, requestId, stopId) {
|
|
186
247
|
return this._timeline.getEntryDiffBetweenStops(uri, requestId, stopId);
|
|
@@ -188,70 +249,36 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
188
249
|
getEntryDiffBetweenRequests(uri, startRequestId, stopRequestId) {
|
|
189
250
|
return this._timeline.getEntryDiffBetweenRequests(uri, startRequestId, stopRequestId);
|
|
190
251
|
}
|
|
191
|
-
createSnapshot(requestId, undoStop
|
|
192
|
-
|
|
252
|
+
createSnapshot(requestId, undoStop) {
|
|
253
|
+
const label = undoStop ? `Request ${requestId} - Stop ${undoStop}` : `Request ${requestId}`;
|
|
254
|
+
this._timeline.createCheckpoint(requestId, undoStop, label);
|
|
193
255
|
}
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
entries.set(entry.modifiedURI, entry.createSnapshot(requestId, stopId));
|
|
198
|
-
}
|
|
199
|
-
return { stopId, entries };
|
|
200
|
-
}
|
|
201
|
-
getSnapshot(requestId, undoStop, snapshotUri) {
|
|
202
|
-
const stopRef = this._timeline.getSnapshotForRestore(requestId, undoStop);
|
|
203
|
-
const entries = stopRef?.stop.entries;
|
|
204
|
-
return entries && [...( entries.values())].find((e) => isEqual(e.snapshotUri, snapshotUri));
|
|
256
|
+
async getSnapshotContents(requestId, uri, stopId) {
|
|
257
|
+
const content = await this._timeline.getContentAtStop(requestId, uri, stopId);
|
|
258
|
+
return typeof content === 'string' ? VSBuffer.fromString(content) : content;
|
|
205
259
|
}
|
|
206
260
|
async getSnapshotModel(requestId, undoStop, snapshotUri) {
|
|
207
|
-
|
|
208
|
-
|
|
261
|
+
await this._baselineCreationLocks.peek(snapshotUri.path);
|
|
262
|
+
const content = await this._timeline.getContentAtStop(requestId, snapshotUri, undoStop);
|
|
263
|
+
if (content === undefined) {
|
|
209
264
|
return null;
|
|
210
265
|
}
|
|
211
|
-
|
|
266
|
+
const contentStr = typeof content === 'string' ? content : ( content.toString());
|
|
267
|
+
const model = this._modelService.createModel(contentStr, this._languageService.createByFilepathOrFirstLine(snapshotUri), snapshotUri, false);
|
|
268
|
+
const store = ( new DisposableStore());
|
|
269
|
+
store.add(model.onWillDispose(() => store.dispose()));
|
|
270
|
+
store.add(this._timeline.onDidChangeContentsAtStop(requestId, snapshotUri, undoStop, c => model.setValue(c)));
|
|
271
|
+
return model;
|
|
212
272
|
}
|
|
213
273
|
getSnapshotUri(requestId, uri, stopId) {
|
|
214
|
-
|
|
215
|
-
const stops = getCurrentAndNextStop(requestId, stopId, timelineState.history);
|
|
216
|
-
return stops?.next.get(uri)?.snapshotUri;
|
|
274
|
+
return this._timeline.getContentURIAtStop(requestId, uri, stopId);
|
|
217
275
|
}
|
|
218
276
|
async restoreSnapshot(requestId, stopId) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
this._ensurePendingSnapshot();
|
|
223
|
-
await this._restoreSnapshot(stopRef.stop);
|
|
224
|
-
stopRef.apply();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
const pendingSnapshot = this._pendingSnapshot.get();
|
|
229
|
-
if (!pendingSnapshot) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
this._pendingSnapshot.set(undefined, undefined);
|
|
233
|
-
await this._restoreSnapshot(pendingSnapshot, undefined);
|
|
277
|
+
const checkpointId = this._timeline.getCheckpointIdForRequest(requestId, stopId);
|
|
278
|
+
if (checkpointId) {
|
|
279
|
+
await this._timeline.navigateToCheckpoint(checkpointId);
|
|
234
280
|
}
|
|
235
281
|
}
|
|
236
|
-
async _restoreSnapshot({ entries }, restoreResolvedToDisk = true) {
|
|
237
|
-
for (const entry of this._entriesObs.get()) {
|
|
238
|
-
const snapshotEntry = entries.get(entry.modifiedURI);
|
|
239
|
-
if (!snapshotEntry) {
|
|
240
|
-
await entry.resetToInitialContent();
|
|
241
|
-
entry.dispose();
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
const entriesArr = [];
|
|
245
|
-
for (const snapshotEntry of ( entries.values())) {
|
|
246
|
-
const entry = await this._getOrCreateModifiedFileEntry(snapshotEntry.resource, restoreResolvedToDisk ? NotExistBehavior.Create : NotExistBehavior.Abort, snapshotEntry.telemetryInfo);
|
|
247
|
-
if (entry) {
|
|
248
|
-
const restoreToDisk = snapshotEntry.state === ModifiedFileEntryState.Modified || restoreResolvedToDisk;
|
|
249
|
-
await entry.restoreFromSnapshot(snapshotEntry, restoreToDisk);
|
|
250
|
-
entriesArr.push(entry);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
this._entriesObs.set(entriesArr, undefined);
|
|
254
|
-
}
|
|
255
282
|
_assertNotDisposed() {
|
|
256
283
|
if (this._state.get() === ChatEditingSessionState.Disposed) {
|
|
257
284
|
throw ( new BugIndicatingError(`Cannot access a disposed editing session`));
|
|
@@ -271,10 +298,18 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
271
298
|
this._assertNotDisposed();
|
|
272
299
|
const applicableEntries = this._entriesObs.get()
|
|
273
300
|
.filter(e => uris.length === 0 || ( uris.some(u => isEqual(u, e.modifiedURI))))
|
|
274
|
-
.filter(e => !e.isCurrentlyBeingModifiedBy.get())
|
|
275
|
-
|
|
276
|
-
|
|
301
|
+
.filter(e => !e.isCurrentlyBeingModifiedBy.get())
|
|
302
|
+
.filter(e => e.state.get() === ModifiedFileEntryState.Modified);
|
|
303
|
+
if (applicableEntries.length === 0) {
|
|
304
|
+
return 0;
|
|
277
305
|
}
|
|
306
|
+
const method = action === 'accept' ? 'acceptDeferred' : 'rejectDeferred';
|
|
307
|
+
const transitionCallbacks = await Promise.all(( applicableEntries.map(entry => entry[method]().catch(err => {
|
|
308
|
+
this._logService.error(`Error calling ${method} on entry ${entry.modifiedURI}`, err);
|
|
309
|
+
}))));
|
|
310
|
+
transaction(tx => {
|
|
311
|
+
transitionCallbacks.forEach(callback => callback?.(tx));
|
|
312
|
+
});
|
|
278
313
|
return applicableEntries.length;
|
|
279
314
|
}
|
|
280
315
|
async show(previousChanges) {
|
|
@@ -290,7 +325,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
290
325
|
}
|
|
291
326
|
const input = MultiDiffEditorInput.fromResourceMultiDiffEditorInput({
|
|
292
327
|
multiDiffSource: getMultiDiffSourceUri(this, previousChanges),
|
|
293
|
-
label: ( localize(
|
|
328
|
+
label: ( localize(5184, "Suggested Edits"))
|
|
294
329
|
}, this._instantiationService);
|
|
295
330
|
this._editorPane = await this._editorGroupsService.activeGroup.openEditor(input, { pinned: true, activation: EditorActivation.ACTIVATE });
|
|
296
331
|
}
|
|
@@ -314,7 +349,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
314
349
|
}
|
|
315
350
|
dispose() {
|
|
316
351
|
this._assertNotDisposed();
|
|
317
|
-
this._chatService.cancelCurrentRequestForSession(this.
|
|
352
|
+
this._chatService.cancelCurrentRequestForSession(this.chatSessionResource);
|
|
318
353
|
dispose(this._entriesObs.get());
|
|
319
354
|
super.dispose();
|
|
320
355
|
this._state.set(ChatEditingSessionState.Disposed, undefined);
|
|
@@ -329,6 +364,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
329
364
|
const startPromise = ( new DeferredPromise());
|
|
330
365
|
const sequencer = ( new ThrottledSequencer(15, 1000));
|
|
331
366
|
sequencer.queue(() => startPromise.p);
|
|
367
|
+
this._baselineCreationLocks.queue(resource.path, () => startPromise.p);
|
|
332
368
|
this._streamingEditLocks.queue(( resource.toString()), async () => {
|
|
333
369
|
if (!this.isDisposed) {
|
|
334
370
|
await this._acceptStreamingEditsStart(responseModel, inUndoStop, resource);
|
|
@@ -374,39 +410,206 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
374
410
|
},
|
|
375
411
|
};
|
|
376
412
|
}
|
|
377
|
-
async
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
413
|
+
async startExternalEdits(responseModel, operationId, resources) {
|
|
414
|
+
const snapshots = ( new ResourceMap());
|
|
415
|
+
const acquiredLockPromises = [];
|
|
416
|
+
const releaseLockPromises = [];
|
|
417
|
+
const undoStopId = generateUuid();
|
|
418
|
+
const progress = [{
|
|
419
|
+
kind: 'undoStop',
|
|
420
|
+
id: undoStopId,
|
|
421
|
+
}];
|
|
422
|
+
const telemetryInfo = this._getTelemetryInfoForModel(responseModel);
|
|
423
|
+
for (const resource of resources) {
|
|
424
|
+
const releaseLock = ( new DeferredPromise());
|
|
425
|
+
releaseLockPromises.push(releaseLock);
|
|
426
|
+
const acquiredLock = ( new DeferredPromise());
|
|
427
|
+
acquiredLockPromises.push(acquiredLock);
|
|
428
|
+
this._streamingEditLocks.queue(( resource.toString()), async () => {
|
|
429
|
+
if (this.isDisposed) {
|
|
430
|
+
acquiredLock.complete();
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const entry = await this._getOrCreateModifiedFileEntry(resource, NotExistBehavior.Abort, telemetryInfo);
|
|
434
|
+
if (entry) {
|
|
435
|
+
await this._acceptStreamingEditsStart(responseModel, undoStopId, resource);
|
|
436
|
+
}
|
|
437
|
+
const notebookUri = CellUri.parse(resource)?.notebook || resource;
|
|
438
|
+
progress.push(...createOpeningEditCodeBlock(resource, this._notebookService.hasSupportedNotebooks(notebookUri)));
|
|
439
|
+
await entry?.save();
|
|
440
|
+
snapshots.set(resource, entry && this._getCurrentTextOrNotebookSnapshot(entry));
|
|
441
|
+
entry?.startExternalEdit();
|
|
442
|
+
acquiredLock.complete();
|
|
443
|
+
return releaseLock.p;
|
|
444
|
+
});
|
|
381
445
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
446
|
+
await Promise.all(( acquiredLockPromises.map(p => p.p)));
|
|
447
|
+
this.createSnapshot(responseModel.requestId, undoStopId);
|
|
448
|
+
this._externalEditOperations.set(operationId, {
|
|
449
|
+
responseModel,
|
|
450
|
+
snapshots,
|
|
451
|
+
undoStopId,
|
|
452
|
+
releaseLocks: () => releaseLockPromises.forEach(p => p.complete())
|
|
453
|
+
});
|
|
454
|
+
return progress;
|
|
455
|
+
}
|
|
456
|
+
async stopExternalEdits(responseModel, operationId) {
|
|
457
|
+
const operation = this._externalEditOperations.get(operationId);
|
|
458
|
+
if (!operation) {
|
|
459
|
+
this._logService.warn(`stopExternalEdits called for unknown operation ${operationId}`);
|
|
460
|
+
return [];
|
|
461
|
+
}
|
|
462
|
+
this._externalEditOperations.delete(operationId);
|
|
463
|
+
const progress = [];
|
|
464
|
+
try {
|
|
465
|
+
for (const [resource, beforeSnapshot] of operation.snapshots) {
|
|
466
|
+
let entry = this._getEntry(resource);
|
|
467
|
+
if (!entry && beforeSnapshot === undefined) {
|
|
468
|
+
entry = await this._getOrCreateModifiedFileEntry(resource, NotExistBehavior.Abort, this._getTelemetryInfoForModel(responseModel), '');
|
|
469
|
+
if (entry) {
|
|
470
|
+
entry.startExternalEdit();
|
|
471
|
+
entry.acceptStreamingEditsStart(responseModel, operation.undoStopId, undefined);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (!entry) {
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
await entry.revertToDisk();
|
|
478
|
+
const afterSnapshot = this._getCurrentTextOrNotebookSnapshot(entry);
|
|
479
|
+
let edits = [];
|
|
480
|
+
if (beforeSnapshot === undefined) {
|
|
481
|
+
this._timeline.recordFileOperation({
|
|
482
|
+
type: FileOperationType.Create,
|
|
483
|
+
uri: resource,
|
|
484
|
+
requestId: responseModel.requestId,
|
|
485
|
+
epoch: this._timeline.incrementEpoch(),
|
|
486
|
+
initialContent: afterSnapshot,
|
|
487
|
+
telemetryInfo: entry.telemetryInfo,
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
edits = await entry.computeEditsFromSnapshots(beforeSnapshot, afterSnapshot);
|
|
492
|
+
this._recordEditOperations(entry, resource, edits, responseModel);
|
|
493
|
+
}
|
|
494
|
+
progress.push(entry instanceof ChatEditingModifiedNotebookEntry ? {
|
|
495
|
+
kind: 'notebookEdit',
|
|
496
|
+
uri: resource,
|
|
497
|
+
edits: edits,
|
|
498
|
+
done: true,
|
|
499
|
+
isExternalEdit: true
|
|
500
|
+
} : {
|
|
501
|
+
kind: 'textEdit',
|
|
502
|
+
uri: resource,
|
|
503
|
+
edits: edits,
|
|
504
|
+
done: true,
|
|
505
|
+
isExternalEdit: true
|
|
506
|
+
});
|
|
507
|
+
await entry.acceptStreamingEditsEnd();
|
|
508
|
+
entry.stopExternalEdit();
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
finally {
|
|
512
|
+
operation.releaseLocks();
|
|
513
|
+
const hasOtherTasks = ( Iterable.some(( this._streamingEditLocks.keys()), k => !( operation.snapshots.has(( URI.parse(k))))));
|
|
514
|
+
if (!hasOtherTasks) {
|
|
515
|
+
this._state.set(ChatEditingSessionState.Idle, undefined);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return progress;
|
|
519
|
+
}
|
|
520
|
+
async undoInteraction() {
|
|
521
|
+
await this._timeline.undoToLastCheckpoint();
|
|
385
522
|
}
|
|
386
523
|
async redoInteraction() {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
524
|
+
await this._timeline.redoToNextCheckpoint();
|
|
525
|
+
}
|
|
526
|
+
_recordEditOperations(entry, resource, edits, responseModel) {
|
|
527
|
+
const isNotebookEdits = edits.length > 0 && hasKey(edits[0], { cells: true });
|
|
528
|
+
if (isNotebookEdits) {
|
|
529
|
+
const notebookEdits = edits;
|
|
530
|
+
this._timeline.recordFileOperation({
|
|
531
|
+
type: FileOperationType.NotebookEdit,
|
|
532
|
+
uri: resource,
|
|
533
|
+
requestId: responseModel.requestId,
|
|
534
|
+
epoch: this._timeline.incrementEpoch(),
|
|
535
|
+
cellEdits: notebookEdits
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
let cellIndex;
|
|
540
|
+
if (entry instanceof ChatEditingModifiedNotebookEntry) {
|
|
541
|
+
const cellUri = CellUri.parse(resource);
|
|
542
|
+
if (cellUri) {
|
|
543
|
+
const i = entry.getIndexOfCellHandle(cellUri.handle);
|
|
544
|
+
if (i !== -1) {
|
|
545
|
+
cellIndex = i;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const textEdits = edits;
|
|
550
|
+
this._timeline.recordFileOperation({
|
|
551
|
+
type: FileOperationType.TextEdit,
|
|
552
|
+
uri: resource,
|
|
553
|
+
requestId: responseModel.requestId,
|
|
554
|
+
epoch: this._timeline.incrementEpoch(),
|
|
555
|
+
edits: textEdits,
|
|
556
|
+
cellIndex,
|
|
557
|
+
});
|
|
391
558
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
559
|
+
}
|
|
560
|
+
_getCurrentTextOrNotebookSnapshot(entry) {
|
|
561
|
+
if (entry instanceof ChatEditingModifiedNotebookEntry) {
|
|
562
|
+
return entry.getCurrentSnapshot();
|
|
563
|
+
}
|
|
564
|
+
else if (entry instanceof ChatEditingModifiedDocumentEntry) {
|
|
565
|
+
return entry.getCurrentContents();
|
|
395
566
|
}
|
|
396
567
|
else {
|
|
397
|
-
|
|
568
|
+
throw ( new Error(`unknown entry type for ${entry.modifiedURI}`));
|
|
398
569
|
}
|
|
399
570
|
}
|
|
400
571
|
async _acceptStreamingEditsStart(responseModel, undoStop, resource) {
|
|
401
572
|
const entry = await this._getOrCreateModifiedFileEntry(resource, NotExistBehavior.Create, this._getTelemetryInfoForModel(responseModel));
|
|
573
|
+
if (!this._timeline.hasFileBaseline(resource, responseModel.requestId)) {
|
|
574
|
+
this._timeline.recordFileBaseline({
|
|
575
|
+
uri: resource,
|
|
576
|
+
requestId: responseModel.requestId,
|
|
577
|
+
content: this._getCurrentTextOrNotebookSnapshot(entry),
|
|
578
|
+
epoch: this._timeline.incrementEpoch(),
|
|
579
|
+
telemetryInfo: entry.telemetryInfo,
|
|
580
|
+
notebookViewType: entry instanceof ChatEditingModifiedNotebookEntry ? entry.viewType : undefined,
|
|
581
|
+
});
|
|
582
|
+
}
|
|
402
583
|
transaction((tx) => {
|
|
403
584
|
this._state.set(ChatEditingSessionState.StreamingEdits, tx);
|
|
404
|
-
entry.acceptStreamingEditsStart(responseModel, tx);
|
|
405
|
-
this._timeline.ensureEditInUndoStopMatches(responseModel.requestId, undoStop, entry, false, tx);
|
|
585
|
+
entry.acceptStreamingEditsStart(responseModel, undoStop, tx);
|
|
406
586
|
});
|
|
587
|
+
return entry;
|
|
588
|
+
}
|
|
589
|
+
async _initEntries({ entries }) {
|
|
590
|
+
for (const entry of this._entriesObs.get()) {
|
|
591
|
+
const snapshotEntry = entries.get(entry.modifiedURI);
|
|
592
|
+
if (!snapshotEntry) {
|
|
593
|
+
await entry.resetToInitialContent();
|
|
594
|
+
entry.dispose();
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const entriesArr = [];
|
|
598
|
+
for (const snapshotEntry of ( entries.values())) {
|
|
599
|
+
const entry = await this._getOrCreateModifiedFileEntry(snapshotEntry.resource, NotExistBehavior.Abort, snapshotEntry.telemetryInfo);
|
|
600
|
+
if (entry) {
|
|
601
|
+
const restoreToDisk = snapshotEntry.state === ModifiedFileEntryState.Modified;
|
|
602
|
+
await entry.restoreFromSnapshot(snapshotEntry, restoreToDisk);
|
|
603
|
+
entriesArr.push(entry);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
this._entriesObs.set(entriesArr, undefined);
|
|
407
607
|
}
|
|
408
608
|
async _acceptEdits(resource, textEdits, isLastEdits, responseModel) {
|
|
409
609
|
const entry = await this._getOrCreateModifiedFileEntry(resource, NotExistBehavior.Create, this._getTelemetryInfoForModel(responseModel));
|
|
610
|
+
if (textEdits.length > 0) {
|
|
611
|
+
this._recordEditOperations(entry, resource, textEdits, responseModel);
|
|
612
|
+
}
|
|
410
613
|
await entry.acceptAgentEdits(resource, textEdits, isLastEdits, responseModel);
|
|
411
614
|
}
|
|
412
615
|
_getTelemetryInfoForModel(responseModel) {
|
|
@@ -426,7 +629,7 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
426
629
|
else if (responseModel.session.initialLocation === ChatAgentLocation.EditorInline) {
|
|
427
630
|
return 'inlineChat';
|
|
428
631
|
}
|
|
429
|
-
return
|
|
632
|
+
return undefined;
|
|
430
633
|
}
|
|
431
634
|
};
|
|
432
635
|
}
|
|
@@ -439,10 +642,11 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
439
642
|
if (!entry) {
|
|
440
643
|
return;
|
|
441
644
|
}
|
|
442
|
-
|
|
645
|
+
const label = undoStop ? `Request ${requestId} - Stop ${undoStop}` : `Request ${requestId}`;
|
|
646
|
+
this._timeline.createCheckpoint(requestId, undoStop, label);
|
|
443
647
|
return entry.acceptStreamingEditsEnd();
|
|
444
648
|
}
|
|
445
|
-
async _getOrCreateModifiedFileEntry(resource, ifNotExists, telemetryInfo) {
|
|
649
|
+
async _getOrCreateModifiedFileEntry(resource, ifNotExists, telemetryInfo, _initialContent) {
|
|
446
650
|
resource = CellUri.parse(resource)?.notebook ?? resource;
|
|
447
651
|
const existingEntry = this._entriesObs.get().find(e => isEqual(e.modifiedURI, resource));
|
|
448
652
|
if (existingEntry) {
|
|
@@ -460,13 +664,13 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
460
664
|
}
|
|
461
665
|
}
|
|
462
666
|
else {
|
|
463
|
-
const initialContent = this._initialFileContents.get(resource);
|
|
667
|
+
const initialContent = _initialContent ?? this._initialFileContents.get(resource);
|
|
464
668
|
const maybeEntry = await this._createModifiedFileEntry(resource, telemetryInfo, ifNotExists, initialContent);
|
|
465
669
|
if (!maybeEntry) {
|
|
466
670
|
return undefined;
|
|
467
671
|
}
|
|
468
672
|
entry = maybeEntry;
|
|
469
|
-
if (
|
|
673
|
+
if (initialContent === undefined) {
|
|
470
674
|
this._initialFileContents.set(resource, entry.initialContent);
|
|
471
675
|
}
|
|
472
676
|
}
|
|
@@ -485,7 +689,13 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
485
689
|
return entry;
|
|
486
690
|
}
|
|
487
691
|
async _createModifiedFileEntry(resource, telemetryInfo, ifNotExists, initialContent) {
|
|
488
|
-
const multiDiffEntryDelegate = {
|
|
692
|
+
const multiDiffEntryDelegate = {
|
|
693
|
+
collapse: (transaction) => this._collapse(resource, transaction),
|
|
694
|
+
recordOperation: (operation) => {
|
|
695
|
+
operation.epoch = this._timeline.incrementEpoch();
|
|
696
|
+
this._timeline.recordFileOperation(operation);
|
|
697
|
+
},
|
|
698
|
+
};
|
|
489
699
|
const notebookUri = CellUri.parse(resource)?.notebook || resource;
|
|
490
700
|
const doCreate = async (chatKind) => {
|
|
491
701
|
if (this._notebookService.hasSupportedNotebooks(notebookUri)) {
|
|
@@ -504,7 +714,17 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
504
714
|
return undefined;
|
|
505
715
|
}
|
|
506
716
|
await this._bulkEditService.apply({ edits: [{ newResource: resource }] });
|
|
507
|
-
this.
|
|
717
|
+
if (this.configurationService.getValue('accessibility.openChatEditedFiles')) {
|
|
718
|
+
this._editorService.openEditor({ resource, options: { inactive: true, preserveFocus: true, pinned: true } });
|
|
719
|
+
}
|
|
720
|
+
this._timeline.recordFileOperation({
|
|
721
|
+
type: FileOperationType.Create,
|
|
722
|
+
uri: resource,
|
|
723
|
+
requestId: telemetryInfo.requestId,
|
|
724
|
+
epoch: this._timeline.incrementEpoch(),
|
|
725
|
+
initialContent: initialContent || '',
|
|
726
|
+
telemetryInfo,
|
|
727
|
+
});
|
|
508
728
|
if (this._notebookService.hasSupportedNotebooks(notebookUri)) {
|
|
509
729
|
return await ChatEditingModifiedNotebookEntry.create(resource, multiDiffEntryDelegate, telemetryInfo, ChatEditKind.Created, initialContent, this._instantiationService);
|
|
510
730
|
}
|
|
@@ -522,17 +742,19 @@ let ChatEditingSession = class ChatEditingSession extends Disposable {
|
|
|
522
742
|
}
|
|
523
743
|
}
|
|
524
744
|
};
|
|
525
|
-
ChatEditingSession = ( __decorate([
|
|
526
|
-
( __param(
|
|
527
|
-
( __param(
|
|
528
|
-
( __param(
|
|
529
|
-
( __param(
|
|
530
|
-
( __param(
|
|
531
|
-
( __param(
|
|
532
|
-
( __param(
|
|
533
|
-
( __param(
|
|
534
|
-
( __param(
|
|
535
|
-
( __param(
|
|
745
|
+
ChatEditingSession = ChatEditingSession_1 = ( __decorate([
|
|
746
|
+
( __param(4, IInstantiationService)),
|
|
747
|
+
( __param(5, IModelService)),
|
|
748
|
+
( __param(6, ILanguageService)),
|
|
749
|
+
( __param(7, ITextModelService)),
|
|
750
|
+
( __param(8, IBulkEditService)),
|
|
751
|
+
( __param(9, IEditorGroupsService)),
|
|
752
|
+
( __param(10, IEditorService)),
|
|
753
|
+
( __param(11, IChatService)),
|
|
754
|
+
( __param(12, INotebookService)),
|
|
755
|
+
( __param(13, IAccessibilitySignalService)),
|
|
756
|
+
( __param(14, ILogService)),
|
|
757
|
+
( __param(15, IConfigurationService))
|
|
536
758
|
], ChatEditingSession));
|
|
537
759
|
|
|
538
760
|
export { ChatEditingSession };
|