@codingame/monaco-vscode-katex-common 25.1.1 → 26.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/package.json +2 -2
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +23 -2
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +64 -27
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +3 -1
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +31 -28
- package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +2 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +71 -50
- package/vscode/src/vs/platform/editor/browser/editor.js +17 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +112 -129
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +110 -85
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +21 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +308 -216
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +153 -148
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +247 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +347 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +287 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +89 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +188 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +677 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentSessionHoverWidget.css +98 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +263 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel.js +34 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +19 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +762 -359
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +22 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +188 -99
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +9 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +166 -113
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +12 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +279 -213
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +533 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +382 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.d.ts +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +509 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +130 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +276 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +24 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +128 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +153 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +1218 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionPickerActionItem.css +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +193 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +93 -89
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +42 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +58 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +18 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +17 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +132 -68
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +68 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +14 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +36 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.js +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.js +15 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +22 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +34 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +198 -135
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.js +38 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +29 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.js +41 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.js +23 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +20 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +291 -152
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +227 -162
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownDecorationsRenderer.js +68 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +76 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +2 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +96 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +74 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.js +11 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +107 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +814 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +34 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +8 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +236 -197
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +123 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +492 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +75 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.js +31 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +42 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +55 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +714 -148
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +2 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +143 -153
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +14 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +79 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +10 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +209 -77
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +9 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +71 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +248 -190
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +1 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatPullRequestContent.css +5 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +493 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatSubagentContent.css +63 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +121 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +51 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +46 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +99 -67
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +112 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +634 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +132 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.js +15 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +196 -149
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +577 -193
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +119 -86
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +10 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +165 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +5 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +75 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +30 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +1 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +102 -106
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +44 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +122 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +39 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +1110 -597
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +291 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +485 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatOptions.js +38 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +9 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +650 -689
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +21 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +102 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +1253 -790
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.js +51 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +102 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +16 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +192 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +11 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +99 -66
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +188 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +115 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +129 -167
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +16 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +143 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +206 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +152 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +67 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +170 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +80 -19
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatWidgetHistoryService.js +20 -28
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.js +22 -19
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +122 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +19 -104
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +316 -1040
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +162 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +98 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +416 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +1 -6
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +194 -215
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +74 -104
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +45 -91
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +22 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +98 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +96 -68
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveCommon.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveCommon.js +11 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +150 -0
- package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +141 -147
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.d.ts +64 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.js +200 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.d.ts +548 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.js +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +338 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +364 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/interactiveEditor.css +21 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/media/interactive.css +36 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.d.ts +110 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +692 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +158 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +80 -21
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +440 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib.d.ts +0 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib.js +0 -139
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +0 -1081
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +0 -199
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +0 -482
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +0 -37
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +0 -94
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +0 -495
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +0 -72
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +0 -454
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +0 -66
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +0 -372
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +0 -58
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +0 -594
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +0 -273
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1746
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -269
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +0 -258
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -806
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -116
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +0 -62
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +0 -295
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +0 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +0 -241
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +0 -146
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +0 -90
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +0 -42
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +0 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +0 -469
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +0 -149
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -823
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +0 -180
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +0 -102
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -567
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -189
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +0 -75
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +0 -439
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +0 -263
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +0 -48
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +0 -89
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +0 -33
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -108
|
@@ -2,39 +2,27 @@
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { renderAsPlaintext } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/markdownRenderer';
|
|
4
4
|
import { alert } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { toErrorMessage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errorMessage';
|
|
5
|
+
import { raceCancellation } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
6
|
+
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
8
7
|
import { onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
9
|
-
import {
|
|
8
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
10
9
|
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
11
|
-
import { DisposableStore
|
|
10
|
+
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
12
11
|
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
13
|
-
import { MovingAverage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/numbers';
|
|
14
12
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
15
13
|
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
16
|
-
import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
|
|
17
14
|
import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
18
15
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
19
|
-
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
20
|
-
import { isCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
|
|
21
16
|
import { observableCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/observableCodeEditor';
|
|
22
17
|
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
|
|
23
|
-
import { EditorOption } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/config/editorOptions';
|
|
24
18
|
import { Position } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/position';
|
|
25
19
|
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
26
|
-
import { Selection
|
|
27
|
-
import { TextEdit, VersionedExtensionId } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
28
|
-
import { IEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service';
|
|
20
|
+
import { Selection } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/selection';
|
|
29
21
|
import { IMarkerDecorationsService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/markerDecorations.service';
|
|
30
|
-
import { DefaultModelSHA1Computer } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/modelService';
|
|
31
|
-
import { InlineCompletionsController } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController';
|
|
32
|
-
import { MessageController } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/message/browser/messageController';
|
|
33
22
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
34
23
|
import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
35
24
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
36
25
|
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
37
|
-
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
38
26
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
39
27
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
40
28
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
@@ -43,946 +31,64 @@ import { ISharedWebContentExtractorService } from '@codingame/monaco-vscode-api/
|
|
|
43
31
|
import { SIDE_GROUP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService';
|
|
44
32
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
45
33
|
import { IChatAttachmentResolveService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.service';
|
|
46
|
-
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
47
34
|
import { ModifiedFileEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/editing/chatEditingService';
|
|
48
|
-
import { ChatRequestRemovalReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel';
|
|
49
35
|
import { ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes';
|
|
50
36
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
51
37
|
import { IDiagnosticVariableEntryFilterData } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
|
|
52
38
|
import { isResponseVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel';
|
|
53
39
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
54
|
-
import { isILanguageModelChatSelector } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
40
|
+
import { isILanguageModelChatSelector, ILanguageModelChatMetadata } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
55
41
|
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
56
42
|
import { isNotebookContainingCellEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookEditor';
|
|
57
43
|
import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
|
|
58
44
|
import { CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
59
45
|
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
46
|
+
import { CTX_INLINE_CHAT_VISIBLE, InlineChatConfigKeys } from '../common/inlineChat.js';
|
|
47
|
+
import { InlineChatAffordance } from './inlineChatAffordance.js';
|
|
48
|
+
import { InlineChatInputWidget, InlineChatSessionOverlayWidget } from './inlineChatOverlayWidget.js';
|
|
63
49
|
import { IInlineChatSessionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
|
|
64
|
-
import { InlineChatError } from './inlineChatSessionServiceImpl.js';
|
|
65
|
-
import { LiveStrategy, HunkAction } from './inlineChatStrategies.js';
|
|
66
50
|
import { InlineChatZoneWidget } from './inlineChatZoneWidget.js';
|
|
67
51
|
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
68
52
|
import { observableSignalFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignalFromEvent';
|
|
69
53
|
import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
70
54
|
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
71
|
-
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
72
55
|
import { waitForState } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils/utilsCancellation';
|
|
56
|
+
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
73
57
|
|
|
74
|
-
var
|
|
75
|
-
var State;
|
|
76
|
-
(function (State) {
|
|
77
|
-
State["CREATE_SESSION"] = "CREATE_SESSION";
|
|
78
|
-
State["INIT_UI"] = "INIT_UI";
|
|
79
|
-
State["WAIT_FOR_INPUT"] = "WAIT_FOR_INPUT";
|
|
80
|
-
State["SHOW_REQUEST"] = "SHOW_REQUEST";
|
|
81
|
-
State["PAUSE"] = "PAUSE";
|
|
82
|
-
State["CANCEL"] = "CANCEL";
|
|
83
|
-
State["ACCEPT"] = "DONE";
|
|
84
|
-
})(State || (State = {}));
|
|
85
|
-
var Message;
|
|
86
|
-
(function (Message) {
|
|
87
|
-
Message[Message["NONE"] = 0] = "NONE";
|
|
88
|
-
Message[Message["ACCEPT_SESSION"] = 1] = "ACCEPT_SESSION";
|
|
89
|
-
Message[Message["CANCEL_SESSION"] = 2] = "CANCEL_SESSION";
|
|
90
|
-
Message[Message["PAUSE_SESSION"] = 4] = "PAUSE_SESSION";
|
|
91
|
-
Message[Message["CANCEL_REQUEST"] = 8] = "CANCEL_REQUEST";
|
|
92
|
-
Message[Message["CANCEL_INPUT"] = 16] = "CANCEL_INPUT";
|
|
93
|
-
Message[Message["ACCEPT_INPUT"] = 32] = "ACCEPT_INPUT";
|
|
94
|
-
})(Message || (Message = {}));
|
|
58
|
+
var InlineChatController_1;
|
|
95
59
|
class InlineChatRunOptions {
|
|
96
60
|
static isInlineChatRunOptions(options) {
|
|
97
|
-
if (typeof options !==
|
|
61
|
+
if (typeof options !== "object" || options === null) {
|
|
98
62
|
return false;
|
|
99
63
|
}
|
|
100
|
-
const {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
64
|
+
const {
|
|
65
|
+
initialSelection,
|
|
66
|
+
initialRange,
|
|
67
|
+
message,
|
|
68
|
+
autoSend,
|
|
69
|
+
position,
|
|
70
|
+
attachments,
|
|
71
|
+
modelSelector,
|
|
72
|
+
resolveOnResponse
|
|
73
|
+
} = options;
|
|
74
|
+
if (typeof message !== "undefined" && typeof message !== "string" || typeof autoSend !== "undefined" && typeof autoSend !== "boolean" || typeof initialRange !== "undefined" && !Range.isIRange(initialRange) || typeof initialSelection !== "undefined" && !Selection.isISelection(initialSelection) || typeof position !== "undefined" && !Position.isIPosition(position) || typeof attachments !== "undefined" && (!Array.isArray(attachments) || !attachments.every(item => item instanceof URI)) || typeof modelSelector !== "undefined" && !isILanguageModelChatSelector(modelSelector) || typeof resolveOnResponse !== "undefined" && typeof resolveOnResponse !== "boolean") {
|
|
110
75
|
return false;
|
|
111
76
|
}
|
|
112
77
|
return true;
|
|
113
78
|
}
|
|
114
79
|
}
|
|
115
|
-
class InlineChatController {
|
|
116
|
-
static { this.ID = 'editor.contrib.inlineChatController'; }
|
|
117
|
-
static get(editor) {
|
|
118
|
-
return editor.getContribution(InlineChatController.ID);
|
|
119
|
-
}
|
|
120
|
-
constructor(editor) {
|
|
121
|
-
this._delegate = InlineChatController2.get(editor);
|
|
122
|
-
}
|
|
123
|
-
dispose() {
|
|
124
|
-
}
|
|
125
|
-
get isActive() {
|
|
126
|
-
return this._delegate.isActive;
|
|
127
|
-
}
|
|
128
|
-
async run(arg) {
|
|
129
|
-
return this._delegate.run(arg);
|
|
130
|
-
}
|
|
131
|
-
focus() {
|
|
132
|
-
return this._delegate.focus();
|
|
133
|
-
}
|
|
134
|
-
get widget() {
|
|
135
|
-
return this._delegate.widget;
|
|
136
|
-
}
|
|
137
|
-
getWidgetPosition() {
|
|
138
|
-
return this._delegate.getWidgetPosition();
|
|
139
|
-
}
|
|
140
|
-
acceptSession() {
|
|
141
|
-
return this._delegate.acceptSession();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
80
|
function getEditorId(editor, model) {
|
|
145
81
|
return `${editor.getId()},${model.id}`;
|
|
146
82
|
}
|
|
147
|
-
let
|
|
148
|
-
static
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
get chatWidget() {
|
|
152
|
-
return this._ui.value.widget.chatWidget;
|
|
153
|
-
}
|
|
154
|
-
constructor(_editor, _instaService, _inlineChatSessionService, _editorWorkerService, _logService, _configurationService, _dialogService, contextKeyService, _chatService, _editorService, notebookEditorService, _webContentExtractorService, _fileService, _chatAttachmentResolveService) {
|
|
155
|
-
this._editor = _editor;
|
|
156
|
-
this._instaService = _instaService;
|
|
157
|
-
this._inlineChatSessionService = _inlineChatSessionService;
|
|
158
|
-
this._editorWorkerService = _editorWorkerService;
|
|
159
|
-
this._logService = _logService;
|
|
160
|
-
this._configurationService = _configurationService;
|
|
161
|
-
this._dialogService = _dialogService;
|
|
162
|
-
this._chatService = _chatService;
|
|
163
|
-
this._editorService = _editorService;
|
|
164
|
-
this._webContentExtractorService = _webContentExtractorService;
|
|
165
|
-
this._fileService = _fileService;
|
|
166
|
-
this._chatAttachmentResolveService = _chatAttachmentResolveService;
|
|
167
|
-
this._isDisposed = false;
|
|
168
|
-
this._store = ( new DisposableStore());
|
|
169
|
-
this._messages = this._store.add(( new Emitter()));
|
|
170
|
-
this._onDidEnterState = this._store.add(( new Emitter()));
|
|
171
|
-
this._sessionStore = this._store.add(( new DisposableStore()));
|
|
172
|
-
this._stashedSession = this._store.add(( new MutableDisposable()));
|
|
173
|
-
this._ctxVisible = CTX_INLINE_CHAT_VISIBLE.bindTo(contextKeyService);
|
|
174
|
-
this._ctxEditing = CTX_INLINE_CHAT_EDITING.bindTo(contextKeyService);
|
|
175
|
-
this._ctxResponseType = CTX_INLINE_CHAT_RESPONSE_TYPE.bindTo(contextKeyService);
|
|
176
|
-
this._ctxRequestInProgress = CTX_INLINE_CHAT_REQUEST_IN_PROGRESS.bindTo(contextKeyService);
|
|
177
|
-
this._ctxResponse = ChatContextKeys.isResponse.bindTo(contextKeyService);
|
|
178
|
-
ChatContextKeys.responseHasError.bindTo(contextKeyService);
|
|
179
|
-
this._ui = ( new Lazy(() => {
|
|
180
|
-
const location = {
|
|
181
|
-
location: ChatAgentLocation.EditorInline,
|
|
182
|
-
resolveData: () => {
|
|
183
|
-
assertType(this._editor.hasModel());
|
|
184
|
-
assertType(this._session);
|
|
185
|
-
return {
|
|
186
|
-
type: ChatAgentLocation.EditorInline,
|
|
187
|
-
id: getEditorId(this._editor, this._session.textModelN),
|
|
188
|
-
selection: this._editor.getSelection(),
|
|
189
|
-
document: this._session.textModelN.uri,
|
|
190
|
-
wholeRange: this._session?.wholeRange.trackedInitialRange,
|
|
191
|
-
close: () => this.cancelSession(),
|
|
192
|
-
delegateSessionResource: this._delegateSession?.chatSessionResource,
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
const notebookEditor = notebookEditorService.getNotebookForPossibleCell(this._editor);
|
|
197
|
-
if (!!notebookEditor) {
|
|
198
|
-
location.location = ChatAgentLocation.Notebook;
|
|
199
|
-
}
|
|
200
|
-
const clear = async () => {
|
|
201
|
-
const r = this.joinCurrentRun();
|
|
202
|
-
this.cancelSession();
|
|
203
|
-
await r;
|
|
204
|
-
this.run();
|
|
205
|
-
};
|
|
206
|
-
const zone = _instaService.createInstance(InlineChatZoneWidget, location, undefined, { editor: this._editor, notebookEditor }, clear);
|
|
207
|
-
this._store.add(zone);
|
|
208
|
-
return zone;
|
|
209
|
-
}));
|
|
210
|
-
this._store.add(this._editor.onDidChangeModel(async (e) => {
|
|
211
|
-
if (this._session || !e.newModelUrl) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const existingSession = this._inlineChatSessionService.getSession(this._editor, e.newModelUrl);
|
|
215
|
-
if (!existingSession) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
this._log('session RESUMING after model change', e);
|
|
219
|
-
await this.run({ existingSession });
|
|
220
|
-
}));
|
|
221
|
-
this._store.add(this._inlineChatSessionService.onDidEndSession(e => {
|
|
222
|
-
if (e.session === this._session && e.endedByExternalCause) {
|
|
223
|
-
this._log('session ENDED by external cause');
|
|
224
|
-
this.acceptSession();
|
|
225
|
-
}
|
|
226
|
-
}));
|
|
227
|
-
this._store.add(this._inlineChatSessionService.onDidMoveSession(async (e) => {
|
|
228
|
-
if (e.editor === this._editor) {
|
|
229
|
-
this._log('session RESUMING after move', e);
|
|
230
|
-
await this.run({ existingSession: e.session });
|
|
231
|
-
}
|
|
232
|
-
}));
|
|
233
|
-
this._log(`NEW controller`);
|
|
234
|
-
}
|
|
235
|
-
dispose() {
|
|
236
|
-
if (this._currentRun) {
|
|
237
|
-
this._messages.fire(this._session?.chatModel.hasRequests
|
|
238
|
-
? Message.PAUSE_SESSION
|
|
239
|
-
: Message.CANCEL_SESSION);
|
|
240
|
-
}
|
|
241
|
-
this._store.dispose();
|
|
242
|
-
this._isDisposed = true;
|
|
243
|
-
this._log('DISPOSED controller');
|
|
244
|
-
}
|
|
245
|
-
_log(message, ...more) {
|
|
246
|
-
if (message instanceof Error) {
|
|
247
|
-
this._logService.error(message, ...more);
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
this._logService.trace(`[IE] (editor:${this._editor.getId()}) ${message}`, ...more);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
get widget() {
|
|
254
|
-
return this._ui.value.widget;
|
|
255
|
-
}
|
|
256
|
-
getId() {
|
|
257
|
-
return INLINE_CHAT_ID;
|
|
258
|
-
}
|
|
259
|
-
getWidgetPosition() {
|
|
260
|
-
return this._ui.value.position;
|
|
261
|
-
}
|
|
262
|
-
async run(options = {}) {
|
|
263
|
-
let lastState;
|
|
264
|
-
const d = this._onDidEnterState.event(e => lastState = e);
|
|
265
|
-
try {
|
|
266
|
-
this.acceptSession();
|
|
267
|
-
if (this._currentRun) {
|
|
268
|
-
await this._currentRun;
|
|
269
|
-
}
|
|
270
|
-
if (options.initialSelection) {
|
|
271
|
-
this._editor.setSelection(options.initialSelection);
|
|
272
|
-
}
|
|
273
|
-
this._stashedSession.clear();
|
|
274
|
-
this._currentRun = this._nextState(State.CREATE_SESSION, options);
|
|
275
|
-
await this._currentRun;
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
this._log('error during run', error);
|
|
279
|
-
onUnexpectedError(error);
|
|
280
|
-
if (this._session) {
|
|
281
|
-
this._inlineChatSessionService.releaseSession(this._session);
|
|
282
|
-
}
|
|
283
|
-
this[State.PAUSE]();
|
|
284
|
-
}
|
|
285
|
-
finally {
|
|
286
|
-
this._currentRun = undefined;
|
|
287
|
-
d.dispose();
|
|
288
|
-
}
|
|
289
|
-
return lastState !== State.CANCEL;
|
|
290
|
-
}
|
|
291
|
-
async _nextState(state, options) {
|
|
292
|
-
let nextState = state;
|
|
293
|
-
while (nextState && !this._isDisposed) {
|
|
294
|
-
this._log('setState to ', nextState);
|
|
295
|
-
const p = this[nextState](options);
|
|
296
|
-
this._onDidEnterState.fire(nextState);
|
|
297
|
-
nextState = await p;
|
|
298
|
-
}
|
|
83
|
+
let InlineChatController = class InlineChatController {
|
|
84
|
+
static {
|
|
85
|
+
InlineChatController_1 = this;
|
|
299
86
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
assertType(this._editor.hasModel());
|
|
303
|
-
let session = options.existingSession;
|
|
304
|
-
let initPosition;
|
|
305
|
-
if (options.position) {
|
|
306
|
-
initPosition = Position.lift(options.position).delta(-1);
|
|
307
|
-
delete options.position;
|
|
308
|
-
}
|
|
309
|
-
const widgetPosition = this._showWidget(session?.headless, true, initPosition);
|
|
310
|
-
let errorMessage = ( localize(8330, "Failed to start editor chat"));
|
|
311
|
-
if (!session) {
|
|
312
|
-
const createSessionCts = ( new CancellationTokenSource());
|
|
313
|
-
const msgListener = Event.once(this._messages.event)(m => {
|
|
314
|
-
this._log('state=_createSession) message received', m);
|
|
315
|
-
if (m === Message.ACCEPT_INPUT) {
|
|
316
|
-
options.autoSend = true;
|
|
317
|
-
this._ui.value.widget.updateInfo(( localize(8331, "Getting ready...")));
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
createSessionCts.cancel();
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
try {
|
|
324
|
-
session = await this._inlineChatSessionService.createSession(this._editor, { wholeRange: options.initialRange }, createSessionCts.token);
|
|
325
|
-
}
|
|
326
|
-
catch (error) {
|
|
327
|
-
if (error instanceof InlineChatError || error?.name === InlineChatError.code) {
|
|
328
|
-
errorMessage = error.message;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
createSessionCts.dispose();
|
|
332
|
-
msgListener.dispose();
|
|
333
|
-
if (createSessionCts.token.isCancellationRequested) {
|
|
334
|
-
if (session) {
|
|
335
|
-
this._inlineChatSessionService.releaseSession(session);
|
|
336
|
-
}
|
|
337
|
-
return State.CANCEL;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
delete options.initialRange;
|
|
341
|
-
delete options.existingSession;
|
|
342
|
-
if (!session) {
|
|
343
|
-
MessageController.get(this._editor)?.showMessage(errorMessage, widgetPosition);
|
|
344
|
-
this._log('Failed to start editor chat');
|
|
345
|
-
return State.CANCEL;
|
|
346
|
-
}
|
|
347
|
-
this._strategy = this._instaService.createInstance(LiveStrategy, session, this._editor, this._ui.value, session.headless);
|
|
348
|
-
this._session = session;
|
|
349
|
-
return State.INIT_UI;
|
|
87
|
+
static {
|
|
88
|
+
this.ID = "editor.contrib.inlineChatController";
|
|
350
89
|
}
|
|
351
|
-
async [State.INIT_UI](options) {
|
|
352
|
-
assertType(this._session);
|
|
353
|
-
assertType(this._strategy);
|
|
354
|
-
InlineCompletionsController.get(this._editor)?.reject();
|
|
355
|
-
this._sessionStore.clear();
|
|
356
|
-
const wholeRangeDecoration = this._editor.createDecorationsCollection();
|
|
357
|
-
const handleWholeRangeChange = () => {
|
|
358
|
-
const newDecorations = this._strategy?.getWholeRangeDecoration() ?? [];
|
|
359
|
-
wholeRangeDecoration.set(newDecorations);
|
|
360
|
-
this._ctxEditing.set(!this._session?.wholeRange.trackedInitialRange.isEmpty());
|
|
361
|
-
};
|
|
362
|
-
this._sessionStore.add(toDisposable(() => {
|
|
363
|
-
wholeRangeDecoration.clear();
|
|
364
|
-
this._ctxEditing.reset();
|
|
365
|
-
}));
|
|
366
|
-
this._sessionStore.add(this._session.wholeRange.onDidChange(handleWholeRangeChange));
|
|
367
|
-
handleWholeRangeChange();
|
|
368
|
-
this._ui.value.widget.setChatModel(this._session.chatModel);
|
|
369
|
-
this._updatePlaceholder();
|
|
370
|
-
const isModelEmpty = !this._session.chatModel.hasRequests;
|
|
371
|
-
this._ui.value.widget.updateToolbar(true);
|
|
372
|
-
this._ui.value.widget.toggleStatus(!isModelEmpty);
|
|
373
|
-
this._showWidget(this._session.headless, isModelEmpty);
|
|
374
|
-
this._sessionStore.add(this._editor.onDidChangeModel((e) => {
|
|
375
|
-
const msg = this._session?.chatModel.hasRequests
|
|
376
|
-
? Message.PAUSE_SESSION
|
|
377
|
-
: Message.CANCEL_SESSION;
|
|
378
|
-
this._log('model changed, pause or cancel session', msg, e);
|
|
379
|
-
this._messages.fire(msg);
|
|
380
|
-
}));
|
|
381
|
-
const filePartOfEditSessions = this._chatService.editingSessions.filter(session => ( session.entries.get().some(e => e.state.get() === ModifiedFileEntryState.Modified && ( e.modifiedURI.toString()) === ( this._session.textModelN.uri.toString()))));
|
|
382
|
-
const withinEditSession = filePartOfEditSessions.find(session => ( session.entries.get().some(
|
|
383
|
-
e => e.state.get() === ModifiedFileEntryState.Modified && e.hasModificationAt({
|
|
384
|
-
range: this._session.wholeRange.trackedInitialRange,
|
|
385
|
-
uri: this._session.textModelN.uri
|
|
386
|
-
})
|
|
387
|
-
)));
|
|
388
|
-
const chatWidget = this._ui.value.widget.chatWidget;
|
|
389
|
-
this._delegateSession = withinEditSession || filePartOfEditSessions[0];
|
|
390
|
-
chatWidget.input.setIsWithinEditSession(!!withinEditSession, filePartOfEditSessions.length > 0);
|
|
391
|
-
this._sessionStore.add(this._editor.onDidChangeModelContent(e => {
|
|
392
|
-
if (this._session?.hunkData.ignoreTextModelNChanges || this._ui.value.widget.hasFocus()) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
const wholeRange = this._session.wholeRange;
|
|
396
|
-
let shouldFinishSession = false;
|
|
397
|
-
if (this._configurationService.getValue(InlineChatConfigKeys.FinishOnType)) {
|
|
398
|
-
for (const { range } of e.changes) {
|
|
399
|
-
shouldFinishSession = !Range.areIntersectingOrTouching(range, wholeRange.value);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
this._session.recordExternalEditOccurred(shouldFinishSession);
|
|
403
|
-
if (shouldFinishSession) {
|
|
404
|
-
this._log('text changed outside of whole range, FINISH session');
|
|
405
|
-
this.acceptSession();
|
|
406
|
-
}
|
|
407
|
-
}));
|
|
408
|
-
this._sessionStore.add(this._session.chatModel.onDidChange(async (e) => {
|
|
409
|
-
if (e.kind === 'removeRequest') {
|
|
410
|
-
await this._session.undoChangesUntil(e.requestId);
|
|
411
|
-
}
|
|
412
|
-
}));
|
|
413
|
-
const editState = this._createChatTextEditGroupState();
|
|
414
|
-
let didEdit = false;
|
|
415
|
-
for (const request of this._session.chatModel.getRequests()) {
|
|
416
|
-
if (!request.response || request.response.result?.errorDetails) {
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
for (const part of request.response.response.value) {
|
|
420
|
-
if (part.kind !== 'textEditGroup' || !isEqual(part.uri, this._session.textModelN.uri)) {
|
|
421
|
-
continue;
|
|
422
|
-
}
|
|
423
|
-
if (part.state?.applied) {
|
|
424
|
-
continue;
|
|
425
|
-
}
|
|
426
|
-
for (const edit of part.edits) {
|
|
427
|
-
this._makeChanges(edit, undefined, !didEdit);
|
|
428
|
-
didEdit = true;
|
|
429
|
-
}
|
|
430
|
-
part.state ??= editState;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
if (didEdit) {
|
|
434
|
-
const diff = await this._editorWorkerService.computeDiff(this._session.textModel0.uri, this._session.textModelN.uri, { computeMoves: false, maxComputationTimeMs: Number.MAX_SAFE_INTEGER, ignoreTrimWhitespace: false }, 'advanced');
|
|
435
|
-
this._session.wholeRange.fixup(diff?.changes ?? []);
|
|
436
|
-
await this._session.hunkData.recompute(editState, diff);
|
|
437
|
-
this._updateCtxResponseType();
|
|
438
|
-
}
|
|
439
|
-
options.position = await this._strategy.renderChanges();
|
|
440
|
-
if (this._session.chatModel.requestInProgress.get()) {
|
|
441
|
-
return State.SHOW_REQUEST;
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
return State.WAIT_FOR_INPUT;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
async [State.WAIT_FOR_INPUT](options) {
|
|
448
|
-
assertType(this._session);
|
|
449
|
-
assertType(this._strategy);
|
|
450
|
-
this._updatePlaceholder();
|
|
451
|
-
if (options.message) {
|
|
452
|
-
this._updateInput(options.message);
|
|
453
|
-
alert(options.message);
|
|
454
|
-
delete options.message;
|
|
455
|
-
this._showWidget(this._session.headless, false);
|
|
456
|
-
}
|
|
457
|
-
let message = Message.NONE;
|
|
458
|
-
let request;
|
|
459
|
-
const barrier = ( new Barrier());
|
|
460
|
-
const store = ( new DisposableStore());
|
|
461
|
-
store.add(this._session.chatModel.onDidChange(e => {
|
|
462
|
-
if (e.kind === 'addRequest') {
|
|
463
|
-
request = e.request;
|
|
464
|
-
message = Message.ACCEPT_INPUT;
|
|
465
|
-
barrier.open();
|
|
466
|
-
}
|
|
467
|
-
}));
|
|
468
|
-
store.add(this._strategy.onDidAccept(() => this.acceptSession()));
|
|
469
|
-
store.add(this._strategy.onDidDiscard(() => this.cancelSession()));
|
|
470
|
-
store.add(this.chatWidget.onDidHide(() => this.cancelSession()));
|
|
471
|
-
store.add(Event.once(this._messages.event)(m => {
|
|
472
|
-
this._log('state=_waitForInput) message received', m);
|
|
473
|
-
message = m;
|
|
474
|
-
barrier.open();
|
|
475
|
-
}));
|
|
476
|
-
if (options.attachments) {
|
|
477
|
-
await Promise.all(( options.attachments.map(async (attachment) => {
|
|
478
|
-
await this._ui.value.widget.chatWidget.attachmentModel.addFile(attachment);
|
|
479
|
-
})));
|
|
480
|
-
delete options.attachments;
|
|
481
|
-
}
|
|
482
|
-
if (options.autoSend) {
|
|
483
|
-
delete options.autoSend;
|
|
484
|
-
this._showWidget(this._session.headless, false);
|
|
485
|
-
this._ui.value.widget.chatWidget.acceptInput();
|
|
486
|
-
}
|
|
487
|
-
await barrier.wait();
|
|
488
|
-
store.dispose();
|
|
489
|
-
if (message & (Message.CANCEL_INPUT | Message.CANCEL_SESSION)) {
|
|
490
|
-
return State.CANCEL;
|
|
491
|
-
}
|
|
492
|
-
if (message & Message.PAUSE_SESSION) {
|
|
493
|
-
return State.PAUSE;
|
|
494
|
-
}
|
|
495
|
-
if (message & Message.ACCEPT_SESSION) {
|
|
496
|
-
this._ui.value.widget.selectAll();
|
|
497
|
-
return State.ACCEPT;
|
|
498
|
-
}
|
|
499
|
-
if (!request?.message.text) {
|
|
500
|
-
return State.WAIT_FOR_INPUT;
|
|
501
|
-
}
|
|
502
|
-
return State.SHOW_REQUEST;
|
|
503
|
-
}
|
|
504
|
-
async [State.SHOW_REQUEST](options) {
|
|
505
|
-
assertType(this._session);
|
|
506
|
-
assertType(this._strategy);
|
|
507
|
-
assertType(this._session.chatModel.requestInProgress.get());
|
|
508
|
-
this._ctxRequestInProgress.set(true);
|
|
509
|
-
const { chatModel } = this._session;
|
|
510
|
-
const request = chatModel.lastRequest;
|
|
511
|
-
assertType(request);
|
|
512
|
-
assertType(request.response);
|
|
513
|
-
this._showWidget(this._session.headless, false);
|
|
514
|
-
this._ui.value.widget.selectAll();
|
|
515
|
-
this._ui.value.widget.updateInfo('');
|
|
516
|
-
this._ui.value.widget.toggleStatus(true);
|
|
517
|
-
const { response } = request;
|
|
518
|
-
const responsePromise = ( new DeferredPromise());
|
|
519
|
-
const store = ( new DisposableStore());
|
|
520
|
-
const progressiveEditsCts = store.add(( new CancellationTokenSource()));
|
|
521
|
-
const progressiveEditsAvgDuration = ( new MovingAverage());
|
|
522
|
-
const progressiveEditsClock = StopWatch.create();
|
|
523
|
-
const progressiveEditsQueue = ( new Queue());
|
|
524
|
-
const origDeco = this._editor.getOption(EditorOption.renderValidationDecorations);
|
|
525
|
-
this._editor.updateOptions({
|
|
526
|
-
renderValidationDecorations: 'off'
|
|
527
|
-
});
|
|
528
|
-
store.add(toDisposable(() => {
|
|
529
|
-
this._editor.updateOptions({
|
|
530
|
-
renderValidationDecorations: origDeco
|
|
531
|
-
});
|
|
532
|
-
}));
|
|
533
|
-
let next = State.WAIT_FOR_INPUT;
|
|
534
|
-
store.add(Event.once(this._messages.event)(message => {
|
|
535
|
-
this._log('state=_makeRequest) message received', message);
|
|
536
|
-
this._chatService.cancelCurrentRequestForSession(chatModel.sessionResource);
|
|
537
|
-
if (message & Message.CANCEL_SESSION) {
|
|
538
|
-
next = State.CANCEL;
|
|
539
|
-
}
|
|
540
|
-
else if (message & Message.PAUSE_SESSION) {
|
|
541
|
-
next = State.PAUSE;
|
|
542
|
-
}
|
|
543
|
-
else if (message & Message.ACCEPT_SESSION) {
|
|
544
|
-
next = State.ACCEPT;
|
|
545
|
-
}
|
|
546
|
-
}));
|
|
547
|
-
store.add(chatModel.onDidChange(async (e) => {
|
|
548
|
-
if (e.kind === 'removeRequest' && e.requestId === request.id) {
|
|
549
|
-
progressiveEditsCts.cancel();
|
|
550
|
-
responsePromise.complete();
|
|
551
|
-
if (e.reason === ChatRequestRemovalReason.Resend) {
|
|
552
|
-
next = State.SHOW_REQUEST;
|
|
553
|
-
}
|
|
554
|
-
else {
|
|
555
|
-
next = State.CANCEL;
|
|
556
|
-
}
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
if (e.kind === 'move') {
|
|
560
|
-
assertType(this._session);
|
|
561
|
-
const log = (msg, ...args) => this._log('state=_showRequest) moving inline chat', msg, ...args);
|
|
562
|
-
log('move was requested', e.target, e.range);
|
|
563
|
-
const initialSelection = Selection.fromRange(Range.lift(e.range), SelectionDirection.LTR);
|
|
564
|
-
const editorPane = await this._editorService.openEditor({ resource: e.target, options: { selection: initialSelection } }, SIDE_GROUP);
|
|
565
|
-
if (!editorPane) {
|
|
566
|
-
log('opening editor failed');
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
const newEditor = editorPane.getControl();
|
|
570
|
-
if (!isCodeEditor(newEditor) || !newEditor.hasModel()) {
|
|
571
|
-
log('new editor is either missing or not a code editor or does not have a model');
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
if (this._inlineChatSessionService.getSession(newEditor, e.target)) {
|
|
575
|
-
log('new editor ALREADY has a session');
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
const newSession = await this._inlineChatSessionService.createSession(newEditor, {
|
|
579
|
-
session: this._session,
|
|
580
|
-
}, CancellationToken.None);
|
|
581
|
-
InlineChatController1_1.get(newEditor)?.run({ existingSession: newSession });
|
|
582
|
-
next = State.CANCEL;
|
|
583
|
-
responsePromise.complete();
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
}));
|
|
587
|
-
store.add(this._ui.value.widget.chatWidget.inputEditor.onDidChangeModelContent(() => {
|
|
588
|
-
this._chatService.cancelCurrentRequestForSession(chatModel.sessionResource);
|
|
589
|
-
}));
|
|
590
|
-
let lastLength = 0;
|
|
591
|
-
let isFirstChange = true;
|
|
592
|
-
const editState = this._createChatTextEditGroupState();
|
|
593
|
-
let localEditGroup;
|
|
594
|
-
const handleResponse = () => {
|
|
595
|
-
this._updateCtxResponseType();
|
|
596
|
-
if (!localEditGroup) {
|
|
597
|
-
localEditGroup = response.response.value.find(part => part.kind === 'textEditGroup' && isEqual(part.uri, this._session?.textModelN.uri));
|
|
598
|
-
}
|
|
599
|
-
if (localEditGroup) {
|
|
600
|
-
localEditGroup.state ??= editState;
|
|
601
|
-
const edits = localEditGroup.edits;
|
|
602
|
-
const newEdits = edits.slice(lastLength);
|
|
603
|
-
if (newEdits.length > 0) {
|
|
604
|
-
this._log(`${this._session?.textModelN.uri.toString()} received ${newEdits.length} edits`);
|
|
605
|
-
lastLength = edits.length;
|
|
606
|
-
progressiveEditsAvgDuration.update(progressiveEditsClock.elapsed());
|
|
607
|
-
progressiveEditsClock.reset();
|
|
608
|
-
progressiveEditsQueue.queue(async () => {
|
|
609
|
-
const startThen = this._session.wholeRange.value.getStartPosition();
|
|
610
|
-
for (const edits of newEdits) {
|
|
611
|
-
await this._makeChanges(edits, {
|
|
612
|
-
duration: progressiveEditsAvgDuration.value,
|
|
613
|
-
token: progressiveEditsCts.token
|
|
614
|
-
}, isFirstChange);
|
|
615
|
-
isFirstChange = false;
|
|
616
|
-
}
|
|
617
|
-
const startNow = this._session.wholeRange.value.getStartPosition();
|
|
618
|
-
if (!startNow.equals(startThen) || !this._ui.value.position?.equals(startNow)) {
|
|
619
|
-
this._showWidget(this._session.headless, false, startNow.delta(-1));
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
if (response.isCanceled) {
|
|
625
|
-
progressiveEditsCts.cancel();
|
|
626
|
-
responsePromise.complete();
|
|
627
|
-
}
|
|
628
|
-
else if (response.isComplete) {
|
|
629
|
-
responsePromise.complete();
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
store.add(response.onDidChange(handleResponse));
|
|
633
|
-
handleResponse();
|
|
634
|
-
await responsePromise.p;
|
|
635
|
-
await progressiveEditsQueue.whenIdle();
|
|
636
|
-
if (response.result?.errorDetails && !response.result.errorDetails.responseIsFiltered) {
|
|
637
|
-
await this._session.undoChangesUntil(response.requestId);
|
|
638
|
-
}
|
|
639
|
-
store.dispose();
|
|
640
|
-
const diff = await this._editorWorkerService.computeDiff(this._session.textModel0.uri, this._session.textModelN.uri, { computeMoves: false, maxComputationTimeMs: Number.MAX_SAFE_INTEGER, ignoreTrimWhitespace: false }, 'advanced');
|
|
641
|
-
this._session.wholeRange.fixup(diff?.changes ?? []);
|
|
642
|
-
await this._session.hunkData.recompute(editState, diff);
|
|
643
|
-
this._ctxRequestInProgress.set(false);
|
|
644
|
-
let newPosition;
|
|
645
|
-
if (response.result?.errorDetails) {
|
|
646
|
-
alert(response.result.errorDetails.message);
|
|
647
|
-
}
|
|
648
|
-
else if (response.response.value.length === 0) {
|
|
649
|
-
const status = ( localize(8332, "No results, please refine your input and try again"));
|
|
650
|
-
this._ui.value.widget.updateStatus(status, { classes: ['warn'] });
|
|
651
|
-
alert(status);
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
this._ui.value.widget.updateStatus('');
|
|
655
|
-
alert(( localize(8333, "Response was empty")));
|
|
656
|
-
}
|
|
657
|
-
const position = await this._strategy.renderChanges();
|
|
658
|
-
if (position) {
|
|
659
|
-
const selection = this._editor.getSelection();
|
|
660
|
-
if (selection?.containsPosition(position)) {
|
|
661
|
-
if (position.lineNumber - selection.startLineNumber > 8) {
|
|
662
|
-
newPosition = position;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
else {
|
|
666
|
-
newPosition = position;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
this._showWidget(this._session.headless, false, newPosition);
|
|
670
|
-
return next;
|
|
671
|
-
}
|
|
672
|
-
async [State.PAUSE]() {
|
|
673
|
-
this._resetWidget();
|
|
674
|
-
this._strategy?.dispose?.();
|
|
675
|
-
this._session = undefined;
|
|
676
|
-
}
|
|
677
|
-
async [State.ACCEPT]() {
|
|
678
|
-
assertType(this._session);
|
|
679
|
-
assertType(this._strategy);
|
|
680
|
-
this._sessionStore.clear();
|
|
681
|
-
try {
|
|
682
|
-
await this._strategy.apply();
|
|
683
|
-
}
|
|
684
|
-
catch (err) {
|
|
685
|
-
this._dialogService.error(( localize(8334, "Failed to apply changes.", toErrorMessage(err))));
|
|
686
|
-
this._log('FAILED to apply changes');
|
|
687
|
-
this._log(err);
|
|
688
|
-
}
|
|
689
|
-
this._resetWidget();
|
|
690
|
-
this._inlineChatSessionService.releaseSession(this._session);
|
|
691
|
-
this._strategy?.dispose();
|
|
692
|
-
this._strategy = undefined;
|
|
693
|
-
this._session = undefined;
|
|
694
|
-
}
|
|
695
|
-
async [State.CANCEL]() {
|
|
696
|
-
this._resetWidget();
|
|
697
|
-
if (this._session) {
|
|
698
|
-
assertType(this._strategy);
|
|
699
|
-
this._sessionStore.clear();
|
|
700
|
-
const shouldStash = !this._session.isUnstashed && this._session.chatModel.hasRequests && this._session.hunkData.size === this._session.hunkData.pending;
|
|
701
|
-
let undoCancelEdits = [];
|
|
702
|
-
try {
|
|
703
|
-
undoCancelEdits = this._strategy.cancel();
|
|
704
|
-
}
|
|
705
|
-
catch (err) {
|
|
706
|
-
this._dialogService.error(( localize(8335, "Failed to discard changes.", toErrorMessage(err))));
|
|
707
|
-
this._log('FAILED to discard changes');
|
|
708
|
-
this._log(err);
|
|
709
|
-
}
|
|
710
|
-
this._stashedSession.clear();
|
|
711
|
-
if (shouldStash) {
|
|
712
|
-
this._stashedSession.value = this._inlineChatSessionService.stashSession(this._session, this._editor, undoCancelEdits);
|
|
713
|
-
}
|
|
714
|
-
else {
|
|
715
|
-
this._inlineChatSessionService.releaseSession(this._session);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
this._strategy?.dispose();
|
|
719
|
-
this._strategy = undefined;
|
|
720
|
-
this._session = undefined;
|
|
721
|
-
}
|
|
722
|
-
_showWidget(headless = false, initialRender = false, position) {
|
|
723
|
-
assertType(this._editor.hasModel());
|
|
724
|
-
this._ctxVisible.set(true);
|
|
725
|
-
let widgetPosition;
|
|
726
|
-
if (position) {
|
|
727
|
-
widgetPosition = position;
|
|
728
|
-
}
|
|
729
|
-
else if (this._ui.rawValue?.position) {
|
|
730
|
-
if (this._ui.rawValue?.position.lineNumber === 1) {
|
|
731
|
-
widgetPosition = this._ui.rawValue?.position.delta(-1);
|
|
732
|
-
}
|
|
733
|
-
else {
|
|
734
|
-
widgetPosition = this._ui.rawValue?.position;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
else {
|
|
738
|
-
widgetPosition = this._editor.getSelection().getStartPosition().delta(-1);
|
|
739
|
-
}
|
|
740
|
-
if (this._session && !position && (this._session.hasChangedText || this._session.chatModel.hasRequests)) {
|
|
741
|
-
widgetPosition = this._session.wholeRange.trackedInitialRange.getStartPosition().delta(-1);
|
|
742
|
-
}
|
|
743
|
-
if (initialRender && (this._editor.getOption(EditorOption.stickyScroll)).enabled) {
|
|
744
|
-
this._editor.revealLine(widgetPosition.lineNumber);
|
|
745
|
-
}
|
|
746
|
-
if (!headless) {
|
|
747
|
-
if (this._ui.rawValue?.position) {
|
|
748
|
-
this._ui.value.updatePositionAndHeight(widgetPosition);
|
|
749
|
-
}
|
|
750
|
-
else {
|
|
751
|
-
this._ui.value.show(widgetPosition);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
return widgetPosition;
|
|
755
|
-
}
|
|
756
|
-
_resetWidget() {
|
|
757
|
-
this._sessionStore.clear();
|
|
758
|
-
this._ctxVisible.reset();
|
|
759
|
-
this._ui.rawValue?.hide();
|
|
760
|
-
if (this._editor.hasWidgetFocus()) {
|
|
761
|
-
this._editor.focus();
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
_updateCtxResponseType() {
|
|
765
|
-
if (!this._session) {
|
|
766
|
-
this._ctxResponseType.set(InlineChatResponseType.None);
|
|
767
|
-
return;
|
|
768
|
-
}
|
|
769
|
-
const hasLocalEdit = (response) => {
|
|
770
|
-
return ( response.value.some(
|
|
771
|
-
part => part.kind === 'textEditGroup' && isEqual(part.uri, this._session?.textModelN.uri)
|
|
772
|
-
));
|
|
773
|
-
};
|
|
774
|
-
let responseType = InlineChatResponseType.None;
|
|
775
|
-
for (const request of this._session.chatModel.getRequests()) {
|
|
776
|
-
if (!request.response) {
|
|
777
|
-
continue;
|
|
778
|
-
}
|
|
779
|
-
responseType = InlineChatResponseType.Messages;
|
|
780
|
-
if (hasLocalEdit(request.response.response)) {
|
|
781
|
-
responseType = InlineChatResponseType.MessagesAndEdits;
|
|
782
|
-
break;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
this._ctxResponseType.set(responseType);
|
|
786
|
-
this._ctxResponse.set(responseType !== InlineChatResponseType.None);
|
|
787
|
-
}
|
|
788
|
-
_createChatTextEditGroupState() {
|
|
789
|
-
assertType(this._session);
|
|
790
|
-
const sha1 = ( new DefaultModelSHA1Computer());
|
|
791
|
-
const textModel0Sha1 = sha1.canComputeSHA1(this._session.textModel0)
|
|
792
|
-
? sha1.computeSHA1(this._session.textModel0)
|
|
793
|
-
: generateUuid();
|
|
794
|
-
return {
|
|
795
|
-
sha1: textModel0Sha1,
|
|
796
|
-
applied: 0
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
async _makeChanges(edits, opts, undoStopBefore) {
|
|
800
|
-
assertType(this._session);
|
|
801
|
-
assertType(this._strategy);
|
|
802
|
-
const moreMinimalEdits = await raceCancellation(this._editorWorkerService.computeMoreMinimalEdits(this._session.textModelN.uri, edits), opts?.token || CancellationToken.None);
|
|
803
|
-
this._log('edits from PROVIDER and after making them MORE MINIMAL', this._session.agent.extensionId, edits, moreMinimalEdits);
|
|
804
|
-
if (moreMinimalEdits?.length === 0) {
|
|
805
|
-
return;
|
|
806
|
-
}
|
|
807
|
-
const actualEdits = !opts && moreMinimalEdits ? moreMinimalEdits : edits;
|
|
808
|
-
const editOperations = ( actualEdits.map(TextEdit.asEditOperation));
|
|
809
|
-
const editsObserver = {
|
|
810
|
-
start: () => this._session.hunkData.ignoreTextModelNChanges = true,
|
|
811
|
-
stop: () => this._session.hunkData.ignoreTextModelNChanges = false,
|
|
812
|
-
};
|
|
813
|
-
const metadata = this._getMetadata();
|
|
814
|
-
if (opts) {
|
|
815
|
-
await this._strategy.makeProgressiveChanges(editOperations, editsObserver, opts, undoStopBefore, metadata);
|
|
816
|
-
}
|
|
817
|
-
else {
|
|
818
|
-
await this._strategy.makeChanges(editOperations, editsObserver, undoStopBefore, metadata);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
_getMetadata() {
|
|
822
|
-
const lastRequest = this._session?.chatModel.lastRequest;
|
|
823
|
-
return {
|
|
824
|
-
extensionId: VersionedExtensionId.tryCreate(this._session?.agent.extensionId.value, this._session?.agent.extensionVersion),
|
|
825
|
-
modelId: lastRequest?.modelId,
|
|
826
|
-
requestId: lastRequest?.id,
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
_updatePlaceholder() {
|
|
830
|
-
this._ui.value.widget.placeholder = this._session?.agent.description ?? ( localize(8336, 'Ask or edit in context'));
|
|
831
|
-
}
|
|
832
|
-
_updateInput(text, selectAll = true) {
|
|
833
|
-
this._ui.value.widget.chatWidget.setInput(text);
|
|
834
|
-
if (selectAll) {
|
|
835
|
-
const newSelection = ( new Selection(1, 1, Number.MAX_SAFE_INTEGER, 1));
|
|
836
|
-
this._ui.value.widget.chatWidget.inputEditor.setSelection(newSelection);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
arrowOut(up) {
|
|
840
|
-
if (this._ui.value.position && this._editor.hasModel()) {
|
|
841
|
-
const { column } = this._editor.getPosition();
|
|
842
|
-
const { lineNumber } = this._ui.value.position;
|
|
843
|
-
const newLine = up ? lineNumber : lineNumber + 1;
|
|
844
|
-
this._editor.setPosition({ lineNumber: newLine, column });
|
|
845
|
-
this._editor.focus();
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
focus() {
|
|
849
|
-
this._ui.value.widget.focus();
|
|
850
|
-
}
|
|
851
|
-
async viewInChat() {
|
|
852
|
-
if (!this._strategy || !this._session) {
|
|
853
|
-
return;
|
|
854
|
-
}
|
|
855
|
-
let someApplied = false;
|
|
856
|
-
let lastEdit;
|
|
857
|
-
const uri = this._editor.getModel()?.uri;
|
|
858
|
-
const requests = this._session.chatModel.getRequests();
|
|
859
|
-
for (const request of requests) {
|
|
860
|
-
if (!request.response) {
|
|
861
|
-
continue;
|
|
862
|
-
}
|
|
863
|
-
for (const part of request.response.response.value) {
|
|
864
|
-
if (part.kind === 'textEditGroup' && isEqual(part.uri, uri)) {
|
|
865
|
-
someApplied = someApplied || Boolean(part.state?.applied);
|
|
866
|
-
lastEdit = part;
|
|
867
|
-
part.edits = [];
|
|
868
|
-
part.state = undefined;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
const doEdits = this._strategy.cancel();
|
|
873
|
-
if (someApplied) {
|
|
874
|
-
assertType(lastEdit);
|
|
875
|
-
lastEdit.edits = [doEdits];
|
|
876
|
-
}
|
|
877
|
-
await this._instaService.invokeFunction(moveToPanelChat, this._session?.chatModel, false);
|
|
878
|
-
this.cancelSession();
|
|
879
|
-
}
|
|
880
|
-
acceptSession() {
|
|
881
|
-
const response = this._session?.chatModel.getRequests().at(-1)?.response;
|
|
882
|
-
if (response) {
|
|
883
|
-
this._chatService.notifyUserAction({
|
|
884
|
-
sessionResource: response.session.sessionResource,
|
|
885
|
-
requestId: response.requestId,
|
|
886
|
-
agentId: response.agent?.id,
|
|
887
|
-
command: response.slashCommand?.name,
|
|
888
|
-
result: response.result,
|
|
889
|
-
action: {
|
|
890
|
-
kind: 'inlineChat',
|
|
891
|
-
action: 'accepted'
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
}
|
|
895
|
-
this._messages.fire(Message.ACCEPT_SESSION);
|
|
896
|
-
}
|
|
897
|
-
acceptHunk(hunkInfo) {
|
|
898
|
-
return this._strategy?.performHunkAction(hunkInfo, HunkAction.Accept);
|
|
899
|
-
}
|
|
900
|
-
discardHunk(hunkInfo) {
|
|
901
|
-
return this._strategy?.performHunkAction(hunkInfo, HunkAction.Discard);
|
|
902
|
-
}
|
|
903
|
-
toggleDiff(hunkInfo) {
|
|
904
|
-
return this._strategy?.performHunkAction(hunkInfo, HunkAction.ToggleDiff);
|
|
905
|
-
}
|
|
906
|
-
moveHunk(next) {
|
|
907
|
-
this.focus();
|
|
908
|
-
this._strategy?.performHunkAction(undefined, next ? HunkAction.MoveNext : HunkAction.MovePrev);
|
|
909
|
-
}
|
|
910
|
-
async cancelSession() {
|
|
911
|
-
const response = this._session?.chatModel.lastRequest?.response;
|
|
912
|
-
if (response) {
|
|
913
|
-
this._chatService.notifyUserAction({
|
|
914
|
-
sessionResource: response.session.sessionResource,
|
|
915
|
-
requestId: response.requestId,
|
|
916
|
-
agentId: response.agent?.id,
|
|
917
|
-
command: response.slashCommand?.name,
|
|
918
|
-
result: response.result,
|
|
919
|
-
action: {
|
|
920
|
-
kind: 'inlineChat',
|
|
921
|
-
action: 'discarded'
|
|
922
|
-
}
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
this._resetWidget();
|
|
926
|
-
this._messages.fire(Message.CANCEL_SESSION);
|
|
927
|
-
}
|
|
928
|
-
reportIssue() {
|
|
929
|
-
const response = this._session?.chatModel.lastRequest?.response;
|
|
930
|
-
if (response) {
|
|
931
|
-
this._chatService.notifyUserAction({
|
|
932
|
-
sessionResource: response.session.sessionResource,
|
|
933
|
-
requestId: response.requestId,
|
|
934
|
-
agentId: response.agent?.id,
|
|
935
|
-
command: response.slashCommand?.name,
|
|
936
|
-
result: response.result,
|
|
937
|
-
action: { kind: 'bug' }
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
unstashLastSession() {
|
|
942
|
-
const result = this._stashedSession.value?.unstash();
|
|
943
|
-
return result;
|
|
944
|
-
}
|
|
945
|
-
joinCurrentRun() {
|
|
946
|
-
return this._currentRun;
|
|
947
|
-
}
|
|
948
|
-
get isActive() {
|
|
949
|
-
return Boolean(this._currentRun);
|
|
950
|
-
}
|
|
951
|
-
async createImageAttachment(attachment) {
|
|
952
|
-
if (attachment.scheme === Schemas.file) {
|
|
953
|
-
if (await this._fileService.canHandleResource(attachment)) {
|
|
954
|
-
return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(attachment);
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
else if (attachment.scheme === Schemas.http || attachment.scheme === Schemas.https) {
|
|
958
|
-
const extractedImages = await this._webContentExtractorService.readImage(attachment, CancellationToken.None);
|
|
959
|
-
if (extractedImages) {
|
|
960
|
-
return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(attachment, extractedImages);
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
return undefined;
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
InlineChatController1 = InlineChatController1_1 = ( __decorate([
|
|
967
|
-
( __param(1, IInstantiationService)),
|
|
968
|
-
( __param(2, IInlineChatSessionService)),
|
|
969
|
-
( __param(3, IEditorWorkerService)),
|
|
970
|
-
( __param(4, ILogService)),
|
|
971
|
-
( __param(5, IConfigurationService)),
|
|
972
|
-
( __param(6, IDialogService)),
|
|
973
|
-
( __param(7, IContextKeyService)),
|
|
974
|
-
( __param(8, IChatService)),
|
|
975
|
-
( __param(9, IEditorService)),
|
|
976
|
-
( __param(10, INotebookEditorService)),
|
|
977
|
-
( __param(11, ISharedWebContentExtractorService)),
|
|
978
|
-
( __param(12, IFileService)),
|
|
979
|
-
( __param(13, IChatAttachmentResolveService))
|
|
980
|
-
], InlineChatController1));
|
|
981
|
-
let InlineChatController2 = class InlineChatController2 {
|
|
982
|
-
static { InlineChatController2_1 = this; }
|
|
983
|
-
static { this.ID = 'editor.contrib.inlineChatController2'; }
|
|
984
90
|
static get(editor) {
|
|
985
|
-
return editor.getContribution(
|
|
91
|
+
return editor.getContribution(InlineChatController_1.ID) ?? undefined;
|
|
986
92
|
}
|
|
987
93
|
get widget() {
|
|
988
94
|
return this._zone.value.widget;
|
|
@@ -990,23 +96,52 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
990
96
|
get isActive() {
|
|
991
97
|
return Boolean(this._currentSession.get());
|
|
992
98
|
}
|
|
993
|
-
constructor(
|
|
99
|
+
constructor(
|
|
100
|
+
_editor,
|
|
101
|
+
_instaService,
|
|
102
|
+
_notebookEditorService,
|
|
103
|
+
_inlineChatSessionService,
|
|
104
|
+
codeEditorService,
|
|
105
|
+
contextKeyService,
|
|
106
|
+
_configurationService,
|
|
107
|
+
_webContentExtractorService,
|
|
108
|
+
_fileService,
|
|
109
|
+
_chatAttachmentResolveService,
|
|
110
|
+
_editorService,
|
|
111
|
+
_markerDecorationsService,
|
|
112
|
+
_languageModelService,
|
|
113
|
+
_logService
|
|
114
|
+
) {
|
|
994
115
|
this._editor = _editor;
|
|
995
116
|
this._instaService = _instaService;
|
|
996
117
|
this._notebookEditorService = _notebookEditorService;
|
|
997
118
|
this._inlineChatSessionService = _inlineChatSessionService;
|
|
119
|
+
this._configurationService = _configurationService;
|
|
998
120
|
this._webContentExtractorService = _webContentExtractorService;
|
|
999
121
|
this._fileService = _fileService;
|
|
1000
122
|
this._chatAttachmentResolveService = _chatAttachmentResolveService;
|
|
1001
123
|
this._editorService = _editorService;
|
|
1002
124
|
this._markerDecorationsService = _markerDecorationsService;
|
|
1003
125
|
this._languageModelService = _languageModelService;
|
|
126
|
+
this._logService = _logService;
|
|
1004
127
|
this._store = ( new DisposableStore());
|
|
1005
128
|
this._isActiveController = observableValue(this, false);
|
|
129
|
+
const editorObs = observableCodeEditor(_editor);
|
|
1006
130
|
const ctxInlineChatVisible = CTX_INLINE_CHAT_VISIBLE.bindTo(contextKeyService);
|
|
1007
|
-
const notebookAgentConfig = observableConfigValue(InlineChatConfigKeys.notebookAgent, false,
|
|
131
|
+
const notebookAgentConfig = observableConfigValue(InlineChatConfigKeys.notebookAgent, false, this._configurationService);
|
|
132
|
+
this._renderMode = observableConfigValue(InlineChatConfigKeys.RenderMode, "zone", this._configurationService);
|
|
133
|
+
const overlayWidget = this._store.add(this._instaService.createInstance(InlineChatInputWidget, editorObs));
|
|
134
|
+
const sessionOverlayWidget = this._store.add(
|
|
135
|
+
this._instaService.createInstance(InlineChatSessionOverlayWidget, editorObs)
|
|
136
|
+
);
|
|
137
|
+
this._gutterIndicator = this._store.add(
|
|
138
|
+
this._instaService.createInstance(InlineChatAffordance, this._editor, overlayWidget)
|
|
139
|
+
);
|
|
1008
140
|
this._zone = ( new Lazy(() => {
|
|
1009
|
-
assertType(
|
|
141
|
+
assertType(
|
|
142
|
+
this._editor.hasModel(),
|
|
143
|
+
"[Illegal State] widget should only be created when the editor has a model"
|
|
144
|
+
);
|
|
1010
145
|
const location = {
|
|
1011
146
|
location: ChatAgentLocation.EditorInline,
|
|
1012
147
|
resolveData: () => {
|
|
@@ -1018,12 +153,7 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1018
153
|
id: getEditorId(this._editor, this._editor.getModel()),
|
|
1019
154
|
selection: this._editor.getSelection(),
|
|
1020
155
|
document,
|
|
1021
|
-
wholeRange
|
|
1022
|
-
close: () => { },
|
|
1023
|
-
delegateSessionResource: chatService.editingSessions.find(session => ( session.entries.get().some(e => e.hasModificationAt({
|
|
1024
|
-
range: wholeRange,
|
|
1025
|
-
uri: document
|
|
1026
|
-
}))))?.chatSessionResource,
|
|
156
|
+
wholeRange
|
|
1027
157
|
};
|
|
1028
158
|
}
|
|
1029
159
|
};
|
|
@@ -1035,13 +165,13 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1035
165
|
assertType(this._editor.hasModel());
|
|
1036
166
|
return {
|
|
1037
167
|
type: ChatAgentLocation.Notebook,
|
|
1038
|
-
sessionInputUri: this._editor.getModel().uri
|
|
168
|
+
sessionInputUri: this._editor.getModel().uri
|
|
1039
169
|
};
|
|
1040
170
|
};
|
|
1041
171
|
}
|
|
1042
172
|
}
|
|
1043
173
|
const result = this._instaService.createInstance(InlineChatZoneWidget, location, {
|
|
1044
|
-
enableWorkingSet:
|
|
174
|
+
enableWorkingSet: "implicit",
|
|
1045
175
|
enableImplicitContext: false,
|
|
1046
176
|
renderInputOnTop: false,
|
|
1047
177
|
renderInputToolbarBelowInput: true,
|
|
@@ -1052,21 +182,24 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1052
182
|
return !!item.model.isPendingConfirmation.get();
|
|
1053
183
|
},
|
|
1054
184
|
menus: {
|
|
1055
|
-
telemetrySource:
|
|
185
|
+
telemetrySource: "inlineChatWidget",
|
|
1056
186
|
executeToolbar: MenuId.ChatEditorInlineExecute,
|
|
1057
187
|
inputSideToolbar: MenuId.ChatEditorInlineInputSide
|
|
1058
188
|
},
|
|
1059
189
|
defaultMode: ChatMode.Ask
|
|
1060
|
-
}, {
|
|
1061
|
-
|
|
190
|
+
}, {
|
|
191
|
+
editor: this._editor,
|
|
192
|
+
notebookEditor
|
|
193
|
+
}, () => Promise.resolve());
|
|
194
|
+
this._store.add(result);
|
|
195
|
+
result.domNode.classList.add("inline-chat-2");
|
|
1062
196
|
return result;
|
|
1063
197
|
}));
|
|
1064
|
-
const editorObs = observableCodeEditor(_editor);
|
|
1065
198
|
const sessionsSignal = observableSignalFromEvent(this, _inlineChatSessionService.onDidChangeSessions);
|
|
1066
199
|
this._currentSession = derived(r => {
|
|
1067
200
|
sessionsSignal.read(r);
|
|
1068
201
|
const model = editorObs.model.read(r);
|
|
1069
|
-
const session = model && _inlineChatSessionService.
|
|
202
|
+
const session = model && _inlineChatSessionService.getSessionByTextModel(model.uri);
|
|
1070
203
|
return session ?? undefined;
|
|
1071
204
|
});
|
|
1072
205
|
let lastSession = undefined;
|
|
@@ -1086,7 +219,7 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1086
219
|
lastSession = session;
|
|
1087
220
|
let foundOne = false;
|
|
1088
221
|
for (const editor of codeEditorService.listCodeEditors()) {
|
|
1089
|
-
if (Boolean(
|
|
222
|
+
if (Boolean(InlineChatController_1.get(editor)?._isActiveController.read(undefined))) {
|
|
1090
223
|
foundOne = true;
|
|
1091
224
|
break;
|
|
1092
225
|
}
|
|
@@ -1102,25 +235,26 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1102
235
|
const isActive = this._isActiveController.read(r);
|
|
1103
236
|
if (!session || !isActive || !model) {
|
|
1104
237
|
visibleSessionObs.set(undefined, undefined);
|
|
1105
|
-
}
|
|
1106
|
-
else {
|
|
238
|
+
} else {
|
|
1107
239
|
visibleSessionObs.set(session, undefined);
|
|
1108
240
|
}
|
|
1109
241
|
}));
|
|
1110
242
|
const defaultPlaceholderObs = ( visibleSessionObs.map((session, r) => {
|
|
1111
|
-
return session?.initialSelection.isEmpty()
|
|
1112
|
-
? ( localize(8337, "Generate code"))
|
|
1113
|
-
: ( localize(8338, "Modify selected code"));
|
|
243
|
+
return session?.initialSelection.isEmpty() ? ( localize(8630, "Generate code")) : ( localize(8631, "Modify selected code"));
|
|
1114
244
|
}));
|
|
1115
245
|
this._store.add(autorun(r => {
|
|
1116
246
|
const session = visibleSessionObs.read(r);
|
|
247
|
+
const renderMode = this._renderMode.read(r);
|
|
1117
248
|
if (!session) {
|
|
1118
249
|
this._zone.rawValue?.hide();
|
|
1119
250
|
this._zone.rawValue?.widget.chatWidget.setModel(undefined);
|
|
1120
251
|
_editor.focus();
|
|
1121
252
|
ctxInlineChatVisible.reset();
|
|
1122
|
-
}
|
|
1123
|
-
|
|
253
|
+
} else if (renderMode === "hover") {
|
|
254
|
+
this._zone.value.widget.chatWidget.setModel(session.chatModel);
|
|
255
|
+
this._zone.rawValue?.hide();
|
|
256
|
+
ctxInlineChatVisible.set(true);
|
|
257
|
+
} else {
|
|
1124
258
|
ctxInlineChatVisible.set(true);
|
|
1125
259
|
this._zone.value.widget.chatWidget.setModel(session.chatModel);
|
|
1126
260
|
if (!this._zone.value.position) {
|
|
@@ -1132,6 +266,23 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1132
266
|
this._zone.value.widget.focus();
|
|
1133
267
|
}
|
|
1134
268
|
}));
|
|
269
|
+
this._store.add(autorun(r => {
|
|
270
|
+
const session = visibleSessionObs.read(r);
|
|
271
|
+
const renderMode = this._renderMode.read(r);
|
|
272
|
+
if (!session || renderMode !== "hover") {
|
|
273
|
+
sessionOverlayWidget.hide();
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const lastRequest = session.chatModel.lastRequestObs.read(r);
|
|
277
|
+
const isInProgress = lastRequest?.response?.isInProgress.read(r);
|
|
278
|
+
const entry = session.editingSession.readEntry(session.uri, r);
|
|
279
|
+
const isNotSettled = entry ? entry.state.read(r) === ModifiedFileEntryState.Modified : false;
|
|
280
|
+
if (isInProgress || isNotSettled) {
|
|
281
|
+
sessionOverlayWidget.show(session);
|
|
282
|
+
} else {
|
|
283
|
+
sessionOverlayWidget.hide();
|
|
284
|
+
}
|
|
285
|
+
}));
|
|
1135
286
|
this._store.add(autorun(r => {
|
|
1136
287
|
const session = visibleSessionObs.read(r);
|
|
1137
288
|
if (session) {
|
|
@@ -1147,7 +298,9 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1147
298
|
return true;
|
|
1148
299
|
});
|
|
1149
300
|
for (const entry of otherEntries) {
|
|
1150
|
-
this._editorService.openEditor({
|
|
301
|
+
this._editorService.openEditor({
|
|
302
|
+
resource: entry.modifiedURI
|
|
303
|
+
}, SIDE_GROUP).catch(onUnexpectedError);
|
|
1151
304
|
}
|
|
1152
305
|
}
|
|
1153
306
|
}));
|
|
@@ -1155,34 +308,41 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1155
308
|
if (!session) {
|
|
1156
309
|
return;
|
|
1157
310
|
}
|
|
1158
|
-
const lastRequest = observableFromEvent(
|
|
311
|
+
const lastRequest = observableFromEvent(
|
|
312
|
+
this,
|
|
313
|
+
session.chatModel.onDidChange,
|
|
314
|
+
() => session.chatModel.getRequests().at(-1)
|
|
315
|
+
).read(r);
|
|
1159
316
|
return lastRequest?.response;
|
|
1160
317
|
}));
|
|
1161
318
|
const lastResponseProgressObs = ( lastResponseObs.map((response, r) => {
|
|
1162
319
|
if (!response) {
|
|
1163
320
|
return;
|
|
1164
321
|
}
|
|
1165
|
-
return observableFromEvent(
|
|
322
|
+
return observableFromEvent(
|
|
323
|
+
this,
|
|
324
|
+
response.onDidChange,
|
|
325
|
+
() => response.response.value.findLast(part => part.kind === "progressMessage")
|
|
326
|
+
).read(r);
|
|
1166
327
|
}));
|
|
1167
328
|
this._store.add(autorun(r => {
|
|
1168
329
|
const response = lastResponseObs.read(r);
|
|
1169
|
-
this._zone.rawValue?.widget.updateInfo(
|
|
330
|
+
this._zone.rawValue?.widget.updateInfo("");
|
|
1170
331
|
if (!response?.isInProgress.read(r)) {
|
|
1171
332
|
if (response?.result?.errorDetails) {
|
|
1172
333
|
this._zone.rawValue?.widget.updateInfo(`$(error) ${response.result.errorDetails.message}`);
|
|
1173
334
|
alert(response.result.errorDetails.message);
|
|
1174
335
|
}
|
|
1175
|
-
this._zone.rawValue?.widget.domNode.classList.toggle(
|
|
336
|
+
this._zone.rawValue?.widget.domNode.classList.toggle("request-in-progress", false);
|
|
1176
337
|
this._zone.rawValue?.widget.chatWidget.setInputPlaceholder(defaultPlaceholderObs.read(r));
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
this._zone.rawValue?.widget.domNode.classList.toggle('request-in-progress', true);
|
|
338
|
+
} else {
|
|
339
|
+
this._zone.rawValue?.widget.domNode.classList.toggle("request-in-progress", true);
|
|
1180
340
|
let placeholder = response.request?.message.text;
|
|
1181
341
|
const lastProgress = lastResponseProgressObs.read(r);
|
|
1182
342
|
if (lastProgress) {
|
|
1183
343
|
placeholder = renderAsPlaintext(lastProgress.content);
|
|
1184
344
|
}
|
|
1185
|
-
this._zone.rawValue?.widget.chatWidget.setInputPlaceholder(placeholder || ( localize(
|
|
345
|
+
this._zone.rawValue?.widget.chatWidget.setInputPlaceholder(placeholder || ( localize(8632, "Working...")));
|
|
1186
346
|
}
|
|
1187
347
|
}));
|
|
1188
348
|
this._store.add(autorun(r => {
|
|
@@ -1198,12 +358,16 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1198
358
|
this._store.add(autorun(r => {
|
|
1199
359
|
const session = visibleSessionObs.read(r);
|
|
1200
360
|
const entry = session?.editingSession.readEntry(session.uri, r);
|
|
1201
|
-
const pane = this._editorService.visibleEditorPanes.find(
|
|
361
|
+
const pane = this._editorService.visibleEditorPanes.find(
|
|
362
|
+
candidate => candidate.getControl() === this._editor || isNotebookContainingCellEditor(candidate, this._editor)
|
|
363
|
+
);
|
|
1202
364
|
if (pane && entry) {
|
|
1203
365
|
entry?.getEditorIntegration(pane);
|
|
1204
366
|
}
|
|
1205
367
|
if (entry?.diffInfo && this._zone.value.position) {
|
|
1206
|
-
const {
|
|
368
|
+
const {
|
|
369
|
+
position
|
|
370
|
+
} = this._zone.value;
|
|
1207
371
|
const diff = entry.diffInfo.read(r);
|
|
1208
372
|
for (const change of diff.changes) {
|
|
1209
373
|
if (change.modified.contains(position.lineNumber)) {
|
|
@@ -1226,63 +390,83 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1226
390
|
async run(arg) {
|
|
1227
391
|
assertType(this._editor.hasModel());
|
|
1228
392
|
const uri = this._editor.getModel().uri;
|
|
1229
|
-
const existingSession = this._inlineChatSessionService.
|
|
393
|
+
const existingSession = this._inlineChatSessionService.getSessionByTextModel(uri);
|
|
1230
394
|
if (existingSession) {
|
|
1231
395
|
await existingSession.editingSession.accept();
|
|
1232
396
|
existingSession.dispose();
|
|
1233
397
|
}
|
|
1234
|
-
this.
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
for (const [range, marker] of this._markerDecorationsService.getLiveMarkers(uri)) {
|
|
1238
|
-
if (range.intersectRanges(this._editor.getSelection())) {
|
|
1239
|
-
const filter = IDiagnosticVariableEntryFilterData.fromMarker(marker);
|
|
1240
|
-
entries.push(IDiagnosticVariableEntryFilterData.toEntry(filter));
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
if (entries.length > 0) {
|
|
1244
|
-
this._zone.value.widget.chatWidget.attachmentModel.addContext(...entries);
|
|
1245
|
-
this._zone.value.widget.chatWidget.input.setValue(entries.length > 1
|
|
1246
|
-
? ( localize(8340, "Fix the attached problems"))
|
|
1247
|
-
: ( localize(8341, "Fix the attached problem")), true);
|
|
1248
|
-
this._zone.value.widget.chatWidget.inputEditor.setSelection(( new Selection(1, 1, Number.MAX_SAFE_INTEGER, 1)));
|
|
398
|
+
if (!arg?.message && this._configurationService.getValue(InlineChatConfigKeys.RenderMode) === "hover") {
|
|
399
|
+
await this._gutterIndicator.showMenuAtSelection();
|
|
400
|
+
return true;
|
|
1249
401
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
402
|
+
this._isActiveController.set(true, undefined);
|
|
403
|
+
const session = this._inlineChatSessionService.createSession(this._editor);
|
|
404
|
+
const sessionStore = ( new DisposableStore());
|
|
405
|
+
try {
|
|
406
|
+
await this._applyModelDefaults(session, sessionStore);
|
|
407
|
+
const entries = [];
|
|
408
|
+
for (const [range, marker] of this._markerDecorationsService.getLiveMarkers(uri)) {
|
|
409
|
+
if (range.intersectRanges(this._editor.getSelection())) {
|
|
410
|
+
const filter = IDiagnosticVariableEntryFilterData.fromMarker(marker);
|
|
411
|
+
entries.push(IDiagnosticVariableEntryFilterData.toEntry(filter));
|
|
412
|
+
}
|
|
1256
413
|
}
|
|
1257
|
-
if (
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
delete arg.attachments;
|
|
414
|
+
if (entries.length > 0) {
|
|
415
|
+
this._zone.value.widget.chatWidget.attachmentModel.addContext(...entries);
|
|
416
|
+
this._zone.value.widget.chatWidget.input.setValue(entries.length > 1 ? ( localize(8633, "Fix the attached problems")) : ( localize(8634, "Fix the attached problem")), true);
|
|
417
|
+
this._zone.value.widget.chatWidget.inputEditor.setSelection(( new Selection(1, 1, Number.MAX_SAFE_INTEGER, 1)));
|
|
1262
418
|
}
|
|
1263
|
-
if (arg.
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
throw ( new Error(
|
|
1267
|
-
`No language models found matching selector: ${JSON.stringify(arg.modelSelector)}.`
|
|
1268
|
-
));
|
|
419
|
+
if (arg && InlineChatRunOptions.isInlineChatRunOptions(arg)) {
|
|
420
|
+
if (arg.initialRange) {
|
|
421
|
+
this._editor.revealRange(arg.initialRange);
|
|
1269
422
|
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
throw ( new Error(`Language model not loaded: ${id}.`));
|
|
423
|
+
if (arg.initialSelection) {
|
|
424
|
+
this._editor.setSelection(arg.initialSelection);
|
|
1273
425
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
426
|
+
if (arg.attachments) {
|
|
427
|
+
await Promise.all(( arg.attachments.map(async attachment => {
|
|
428
|
+
await this._zone.value.widget.chatWidget.attachmentModel.addFile(attachment);
|
|
429
|
+
})));
|
|
430
|
+
delete arg.attachments;
|
|
431
|
+
}
|
|
432
|
+
if (arg.modelSelector) {
|
|
433
|
+
const id = (await this._languageModelService.selectLanguageModels(arg.modelSelector)).sort().at(0);
|
|
434
|
+
if (!id) {
|
|
435
|
+
throw ( new Error(
|
|
436
|
+
`No language models found matching selector: ${JSON.stringify(arg.modelSelector)}.`
|
|
437
|
+
));
|
|
438
|
+
}
|
|
439
|
+
const model = this._languageModelService.lookupLanguageModel(id);
|
|
440
|
+
if (!model) {
|
|
441
|
+
throw ( new Error(`Language model not loaded: ${id}.`));
|
|
442
|
+
}
|
|
443
|
+
this._zone.value.widget.chatWidget.input.setCurrentLanguageModel({
|
|
444
|
+
metadata: model,
|
|
445
|
+
identifier: id
|
|
446
|
+
});
|
|
1280
447
|
}
|
|
448
|
+
if (arg.message) {
|
|
449
|
+
this._zone.value.widget.chatWidget.setInput(arg.message);
|
|
450
|
+
if (arg.autoSend) {
|
|
451
|
+
await this._zone.value.widget.chatWidget.acceptInput();
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (!arg?.resolveOnResponse) {
|
|
456
|
+
await Event.toPromise(session.editingSession.onDidDispose);
|
|
457
|
+
const rejected = session.editingSession.getEntry(uri)?.state.get() === ModifiedFileEntryState.Rejected;
|
|
458
|
+
return !rejected;
|
|
459
|
+
} else {
|
|
460
|
+
const modifiedObs = derived(r => {
|
|
461
|
+
const entry = session.editingSession.readEntry(uri, r);
|
|
462
|
+
return entry?.state.read(r) === ModifiedFileEntryState.Modified && !entry?.isCurrentlyBeingModifiedBy.read(r);
|
|
463
|
+
});
|
|
464
|
+
await waitForState(modifiedObs, state => state === true);
|
|
465
|
+
return true;
|
|
1281
466
|
}
|
|
467
|
+
} finally {
|
|
468
|
+
sessionStore.dispose();
|
|
1282
469
|
}
|
|
1283
|
-
await Event.toPromise(session.editingSession.onDidDispose);
|
|
1284
|
-
const rejected = session.editingSession.getEntry(uri)?.state.get() === ModifiedFileEntryState.Rejected;
|
|
1285
|
-
return !rejected;
|
|
1286
470
|
}
|
|
1287
471
|
async acceptSession() {
|
|
1288
472
|
const session = this._currentSession.get();
|
|
@@ -1300,6 +484,61 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1300
484
|
await session.editingSession.reject();
|
|
1301
485
|
session.dispose();
|
|
1302
486
|
}
|
|
487
|
+
async _selectVendorDefaultModel(session) {
|
|
488
|
+
const model = this._zone.value.widget.chatWidget.input.selectedLanguageModel.get();
|
|
489
|
+
if (model && !model.metadata.isDefaultForLocation[session.chatModel.initialLocation]) {
|
|
490
|
+
const ids = await this._languageModelService.selectLanguageModels({
|
|
491
|
+
vendor: model.metadata.vendor
|
|
492
|
+
});
|
|
493
|
+
for (const identifier of ids) {
|
|
494
|
+
const candidate = this._languageModelService.lookupLanguageModel(identifier);
|
|
495
|
+
if (candidate?.isDefaultForLocation[session.chatModel.initialLocation]) {
|
|
496
|
+
this._zone.value.widget.chatWidget.input.setCurrentLanguageModel({
|
|
497
|
+
metadata: candidate,
|
|
498
|
+
identifier
|
|
499
|
+
});
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
async _applyModelDefaults(session, sessionStore) {
|
|
506
|
+
const userSelectedModel = InlineChatController_1._userSelectedModel;
|
|
507
|
+
const defaultModelSetting = this._configurationService.getValue(InlineChatConfigKeys.DefaultModel);
|
|
508
|
+
let modelApplied = false;
|
|
509
|
+
if (userSelectedModel) {
|
|
510
|
+
modelApplied = this._zone.value.widget.chatWidget.input.switchModelByQualifiedName([userSelectedModel]);
|
|
511
|
+
if (!modelApplied) {
|
|
512
|
+
InlineChatController_1._userSelectedModel = undefined;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
if (!modelApplied && defaultModelSetting) {
|
|
516
|
+
modelApplied = this._zone.value.widget.chatWidget.input.switchModelByQualifiedName([defaultModelSetting]);
|
|
517
|
+
if (!modelApplied) {
|
|
518
|
+
this._logService.warn(
|
|
519
|
+
`inlineChat.defaultModel setting value '${defaultModelSetting}' did not match any available model. Falling back to vendor default.`
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (!modelApplied) {
|
|
524
|
+
await this._selectVendorDefaultModel(session);
|
|
525
|
+
}
|
|
526
|
+
let initialModelId;
|
|
527
|
+
sessionStore.add(autorun(r => {
|
|
528
|
+
const newModel = this._zone.value.widget.chatWidget.input.selectedLanguageModel.read(r);
|
|
529
|
+
if (!newModel) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (!initialModelId) {
|
|
533
|
+
initialModelId = newModel.identifier;
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (initialModelId !== newModel.identifier) {
|
|
537
|
+
InlineChatController_1._userSelectedModel = ILanguageModelChatMetadata.asQualifiedName(newModel.metadata);
|
|
538
|
+
initialModelId = newModel.identifier;
|
|
539
|
+
}
|
|
540
|
+
}));
|
|
541
|
+
}
|
|
1303
542
|
async createImageAttachment(attachment) {
|
|
1304
543
|
const value = this._currentSession.get();
|
|
1305
544
|
if (!value) {
|
|
@@ -1309,8 +548,7 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1309
548
|
if (await this._fileService.canHandleResource(attachment)) {
|
|
1310
549
|
return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(attachment);
|
|
1311
550
|
}
|
|
1312
|
-
}
|
|
1313
|
-
else if (attachment.scheme === Schemas.http || attachment.scheme === Schemas.https) {
|
|
551
|
+
} else if (attachment.scheme === Schemas.http || attachment.scheme === Schemas.https) {
|
|
1314
552
|
const extractedImages = await this._webContentExtractorService.readImage(attachment, CancellationToken.None);
|
|
1315
553
|
if (extractedImages) {
|
|
1316
554
|
return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(attachment, extractedImages);
|
|
@@ -1319,21 +557,7 @@ let InlineChatController2 = class InlineChatController2 {
|
|
|
1319
557
|
return undefined;
|
|
1320
558
|
}
|
|
1321
559
|
};
|
|
1322
|
-
|
|
1323
|
-
( __param(1, IInstantiationService)),
|
|
1324
|
-
( __param(2, INotebookEditorService)),
|
|
1325
|
-
( __param(3, IInlineChatSessionService)),
|
|
1326
|
-
( __param(4, ICodeEditorService)),
|
|
1327
|
-
( __param(5, IContextKeyService)),
|
|
1328
|
-
( __param(6, IConfigurationService)),
|
|
1329
|
-
( __param(7, ISharedWebContentExtractorService)),
|
|
1330
|
-
( __param(8, IFileService)),
|
|
1331
|
-
( __param(9, IChatAttachmentResolveService)),
|
|
1332
|
-
( __param(10, IEditorService)),
|
|
1333
|
-
( __param(11, IMarkerDecorationsService)),
|
|
1334
|
-
( __param(12, ILanguageModelsService)),
|
|
1335
|
-
( __param(13, IChatService))
|
|
1336
|
-
], InlineChatController2));
|
|
560
|
+
InlineChatController = InlineChatController_1 = ( __decorate([( __param(1, IInstantiationService)), ( __param(2, INotebookEditorService)), ( __param(3, IInlineChatSessionService)), ( __param(4, ICodeEditorService)), ( __param(5, IContextKeyService)), ( __param(6, IConfigurationService)), ( __param(7, ISharedWebContentExtractorService)), ( __param(8, IFileService)), ( __param(9, IChatAttachmentResolveService)), ( __param(10, IEditorService)), ( __param(11, IMarkerDecorationsService)), ( __param(12, ILanguageModelsService)), ( __param(13, ILogService))], InlineChatController));
|
|
1337
561
|
async function reviewEdits(accessor, editor, stream, token, applyCodeBlockSuggestionId) {
|
|
1338
562
|
if (!editor.hasModel()) {
|
|
1339
563
|
return false;
|
|
@@ -1345,23 +569,43 @@ async function reviewEdits(accessor, editor, stream, token, applyCodeBlockSugges
|
|
|
1345
569
|
chatModel.startEditingSession(true);
|
|
1346
570
|
const store = ( new DisposableStore());
|
|
1347
571
|
store.add(chatModelRef);
|
|
1348
|
-
const chatRequest = chatModel?.addRequest({
|
|
572
|
+
const chatRequest = chatModel?.addRequest({
|
|
573
|
+
text: "",
|
|
574
|
+
parts: []
|
|
575
|
+
}, {
|
|
576
|
+
variables: []
|
|
577
|
+
}, 0, {
|
|
1349
578
|
kind: undefined,
|
|
1350
|
-
modeId:
|
|
579
|
+
modeId: "applyCodeBlock",
|
|
1351
580
|
modeInstructions: undefined,
|
|
1352
581
|
isBuiltin: true,
|
|
1353
|
-
applyCodeBlockSuggestionId
|
|
582
|
+
applyCodeBlockSuggestionId
|
|
1354
583
|
});
|
|
1355
584
|
assertType(chatRequest.response);
|
|
1356
|
-
chatRequest.response.updateContent({
|
|
585
|
+
chatRequest.response.updateContent({
|
|
586
|
+
kind: "textEdit",
|
|
587
|
+
uri,
|
|
588
|
+
edits: [],
|
|
589
|
+
done: false
|
|
590
|
+
});
|
|
1357
591
|
for await (const chunk of stream) {
|
|
1358
592
|
if (token.isCancellationRequested) {
|
|
1359
593
|
chatRequest.response.cancel();
|
|
1360
594
|
break;
|
|
1361
595
|
}
|
|
1362
|
-
chatRequest.response.updateContent({
|
|
596
|
+
chatRequest.response.updateContent({
|
|
597
|
+
kind: "textEdit",
|
|
598
|
+
uri,
|
|
599
|
+
edits: chunk,
|
|
600
|
+
done: false
|
|
601
|
+
});
|
|
1363
602
|
}
|
|
1364
|
-
chatRequest.response.updateContent({
|
|
603
|
+
chatRequest.response.updateContent({
|
|
604
|
+
kind: "textEdit",
|
|
605
|
+
uri,
|
|
606
|
+
edits: [],
|
|
607
|
+
done: true
|
|
608
|
+
});
|
|
1365
609
|
if (!token.isCancellationRequested) {
|
|
1366
610
|
chatRequest.response.complete();
|
|
1367
611
|
}
|
|
@@ -1387,13 +631,27 @@ async function reviewNotebookEdits(accessor, uri, stream, token) {
|
|
|
1387
631
|
chatModel.startEditingSession(true);
|
|
1388
632
|
const store = ( new DisposableStore());
|
|
1389
633
|
store.add(chatModelRef);
|
|
1390
|
-
const chatRequest = chatModel?.addRequest({
|
|
634
|
+
const chatRequest = chatModel?.addRequest({
|
|
635
|
+
text: "",
|
|
636
|
+
parts: []
|
|
637
|
+
}, {
|
|
638
|
+
variables: []
|
|
639
|
+
}, 0);
|
|
1391
640
|
assertType(chatRequest.response);
|
|
1392
641
|
if (isNotebook) {
|
|
1393
|
-
chatRequest.response.updateContent({
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
642
|
+
chatRequest.response.updateContent({
|
|
643
|
+
kind: "notebookEdit",
|
|
644
|
+
uri,
|
|
645
|
+
edits: [],
|
|
646
|
+
done: false
|
|
647
|
+
});
|
|
648
|
+
} else {
|
|
649
|
+
chatRequest.response.updateContent({
|
|
650
|
+
kind: "textEdit",
|
|
651
|
+
uri,
|
|
652
|
+
edits: [],
|
|
653
|
+
done: false
|
|
654
|
+
});
|
|
1397
655
|
}
|
|
1398
656
|
for await (const chunk of stream) {
|
|
1399
657
|
if (token.isCancellationRequested) {
|
|
@@ -1401,17 +659,35 @@ async function reviewNotebookEdits(accessor, uri, stream, token) {
|
|
|
1401
659
|
break;
|
|
1402
660
|
}
|
|
1403
661
|
if (chunk.every(isCellEditOperation)) {
|
|
1404
|
-
chatRequest.response.updateContent({
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
662
|
+
chatRequest.response.updateContent({
|
|
663
|
+
kind: "notebookEdit",
|
|
664
|
+
uri,
|
|
665
|
+
edits: chunk,
|
|
666
|
+
done: false
|
|
667
|
+
});
|
|
668
|
+
} else {
|
|
669
|
+
chatRequest.response.updateContent({
|
|
670
|
+
kind: "textEdit",
|
|
671
|
+
uri: chunk[0],
|
|
672
|
+
edits: chunk[1],
|
|
673
|
+
done: false
|
|
674
|
+
});
|
|
1408
675
|
}
|
|
1409
676
|
}
|
|
1410
677
|
if (isNotebook) {
|
|
1411
|
-
chatRequest.response.updateContent({
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
678
|
+
chatRequest.response.updateContent({
|
|
679
|
+
kind: "notebookEdit",
|
|
680
|
+
uri,
|
|
681
|
+
edits: [],
|
|
682
|
+
done: true
|
|
683
|
+
});
|
|
684
|
+
} else {
|
|
685
|
+
chatRequest.response.updateContent({
|
|
686
|
+
kind: "textEdit",
|
|
687
|
+
uri,
|
|
688
|
+
edits: [],
|
|
689
|
+
done: true
|
|
690
|
+
});
|
|
1415
691
|
}
|
|
1416
692
|
if (!token.isCancellationRequested) {
|
|
1417
693
|
chatRequest.response.complete();
|
|
@@ -1439,4 +715,4 @@ function isCellEditOperation(edit) {
|
|
|
1439
715
|
return true;
|
|
1440
716
|
}
|
|
1441
717
|
|
|
1442
|
-
export { InlineChatController,
|
|
718
|
+
export { InlineChatController, InlineChatRunOptions, reviewEdits, reviewNotebookEdits };
|