@codingame/monaco-vscode-katex-common 25.1.2 → 26.0.1
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
package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js
ADDED
|
@@ -0,0 +1,1218 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { sep } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
4
|
+
import { raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
5
|
+
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
6
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
7
|
+
import { Emitter, AsyncEmitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
8
|
+
import { Disposable, DisposableMap, DisposableStore, combinedDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
9
|
+
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
10
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
11
|
+
import { joinPath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
12
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
13
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
14
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
15
|
+
import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
16
|
+
import { MenuId, MenuItemAction, MenuRegistry, registerAction2, Action2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
17
|
+
import { IMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service';
|
|
18
|
+
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
19
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
20
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
21
|
+
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
22
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
23
|
+
import { isDark } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/theme';
|
|
24
|
+
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
25
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
26
|
+
import { isProposedApiEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions';
|
|
27
|
+
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
28
|
+
import { ExtensionsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
29
|
+
import { ChatEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput';
|
|
30
|
+
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents.service';
|
|
31
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
32
|
+
import { isSessionInProgressStatus } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
|
|
33
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
34
|
+
import { ChatAgentLocation, ChatModeKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
35
|
+
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
36
|
+
import { IChatToolInvocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService';
|
|
37
|
+
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
38
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
39
|
+
import { renderAsPlaintext } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/markdownRenderer';
|
|
40
|
+
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
41
|
+
import { ChatViewId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
42
|
+
import { AgentSessionProviders, getAgentSessionProviderName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
|
|
43
|
+
import { BugIndicatingError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
44
|
+
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
45
|
+
import { LocalChatSessionUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
|
|
46
|
+
import { assertNever } from '@codingame/monaco-vscode-api/vscode/vs/base/common/assert';
|
|
47
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
48
|
+
import { autorun, autorunIterableDelta } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
49
|
+
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
50
|
+
import { observableSignalFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignalFromEvent';
|
|
51
|
+
|
|
52
|
+
const extensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
53
|
+
extensionPoint: "chatSessions",
|
|
54
|
+
jsonSchema: {
|
|
55
|
+
description: ( localize(5474, "Contributes chat session integrations to the chat widget.")),
|
|
56
|
+
type: "array",
|
|
57
|
+
items: {
|
|
58
|
+
type: "object",
|
|
59
|
+
additionalProperties: false,
|
|
60
|
+
properties: {
|
|
61
|
+
type: {
|
|
62
|
+
description: ( localize(5475, "Unique identifier for the type of chat session.")),
|
|
63
|
+
type: "string"
|
|
64
|
+
},
|
|
65
|
+
name: {
|
|
66
|
+
description: ( localize(
|
|
67
|
+
5476,
|
|
68
|
+
"Name of the dynamically registered chat participant (eg: @agent). Must not contain whitespace."
|
|
69
|
+
)),
|
|
70
|
+
type: "string",
|
|
71
|
+
pattern: "^[\\w-]+$"
|
|
72
|
+
},
|
|
73
|
+
displayName: {
|
|
74
|
+
description: ( localize(5477, "A longer name for this item which is used for display in menus.")),
|
|
75
|
+
type: "string"
|
|
76
|
+
},
|
|
77
|
+
description: {
|
|
78
|
+
description: ( localize(5478, "Description of the chat session for use in menus and tooltips.")),
|
|
79
|
+
type: "string"
|
|
80
|
+
},
|
|
81
|
+
when: {
|
|
82
|
+
description: ( localize(5479, "Condition which must be true to show this item.")),
|
|
83
|
+
type: "string"
|
|
84
|
+
},
|
|
85
|
+
icon: {
|
|
86
|
+
description: ( localize(
|
|
87
|
+
5480,
|
|
88
|
+
"Icon identifier (codicon ID) for the chat session editor tab. For example, \"$(github)\" or \"$(cloud)\"."
|
|
89
|
+
)),
|
|
90
|
+
anyOf: [{
|
|
91
|
+
type: "string"
|
|
92
|
+
}, {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
light: {
|
|
96
|
+
description: ( localize(5481, "Icon path when a light theme is used")),
|
|
97
|
+
type: "string"
|
|
98
|
+
},
|
|
99
|
+
dark: {
|
|
100
|
+
description: ( localize(5482, "Icon path when a dark theme is used")),
|
|
101
|
+
type: "string"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}]
|
|
105
|
+
},
|
|
106
|
+
order: {
|
|
107
|
+
description: ( localize(5483, "Order in which this item should be displayed.")),
|
|
108
|
+
type: "integer"
|
|
109
|
+
},
|
|
110
|
+
alternativeIds: {
|
|
111
|
+
description: ( localize(5484, "Alternative identifiers for backward compatibility.")),
|
|
112
|
+
type: "array",
|
|
113
|
+
items: {
|
|
114
|
+
type: "string"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
welcomeTitle: {
|
|
118
|
+
description: ( localize(
|
|
119
|
+
5485,
|
|
120
|
+
"Title text to display in the chat welcome view for this session type."
|
|
121
|
+
)),
|
|
122
|
+
type: "string"
|
|
123
|
+
},
|
|
124
|
+
welcomeMessage: {
|
|
125
|
+
description: ( localize(
|
|
126
|
+
5486,
|
|
127
|
+
"Message text (supports markdown) to display in the chat welcome view for this session type."
|
|
128
|
+
)),
|
|
129
|
+
type: "string"
|
|
130
|
+
},
|
|
131
|
+
welcomeTips: {
|
|
132
|
+
description: ( localize(
|
|
133
|
+
5487,
|
|
134
|
+
"Tips text (supports markdown and theme icons) to display in the chat welcome view for this session type."
|
|
135
|
+
)),
|
|
136
|
+
type: "string"
|
|
137
|
+
},
|
|
138
|
+
inputPlaceholder: {
|
|
139
|
+
description: ( localize(
|
|
140
|
+
5488,
|
|
141
|
+
"Placeholder text to display in the chat input box for this session type."
|
|
142
|
+
)),
|
|
143
|
+
type: "string"
|
|
144
|
+
},
|
|
145
|
+
capabilities: {
|
|
146
|
+
description: ( localize(5489, "Optional capabilities for this chat session.")),
|
|
147
|
+
type: "object",
|
|
148
|
+
additionalProperties: false,
|
|
149
|
+
properties: {
|
|
150
|
+
supportsFileAttachments: {
|
|
151
|
+
description: ( localize(
|
|
152
|
+
5490,
|
|
153
|
+
"Whether this chat session supports attaching files or file references."
|
|
154
|
+
)),
|
|
155
|
+
type: "boolean"
|
|
156
|
+
},
|
|
157
|
+
supportsToolAttachments: {
|
|
158
|
+
description: ( localize(
|
|
159
|
+
5491,
|
|
160
|
+
"Whether this chat session supports attaching tools or tool references."
|
|
161
|
+
)),
|
|
162
|
+
type: "boolean"
|
|
163
|
+
},
|
|
164
|
+
supportsMCPAttachments: {
|
|
165
|
+
description: ( localize(5492, "Whether this chat session supports attaching MCP resources.")),
|
|
166
|
+
type: "boolean"
|
|
167
|
+
},
|
|
168
|
+
supportsImageAttachments: {
|
|
169
|
+
description: ( localize(5493, "Whether this chat session supports attaching images.")),
|
|
170
|
+
type: "boolean"
|
|
171
|
+
},
|
|
172
|
+
supportsSearchResultAttachments: {
|
|
173
|
+
description: ( localize(5494, "Whether this chat session supports attaching search results.")),
|
|
174
|
+
type: "boolean"
|
|
175
|
+
},
|
|
176
|
+
supportsInstructionAttachments: {
|
|
177
|
+
description: ( localize(5495, "Whether this chat session supports attaching instructions.")),
|
|
178
|
+
type: "boolean"
|
|
179
|
+
},
|
|
180
|
+
supportsSourceControlAttachments: {
|
|
181
|
+
description: ( localize(
|
|
182
|
+
5496,
|
|
183
|
+
"Whether this chat session supports attaching source control changes."
|
|
184
|
+
)),
|
|
185
|
+
type: "boolean"
|
|
186
|
+
},
|
|
187
|
+
supportsProblemAttachments: {
|
|
188
|
+
description: ( localize(5497, "Whether this chat session supports attaching problems.")),
|
|
189
|
+
type: "boolean"
|
|
190
|
+
},
|
|
191
|
+
supportsSymbolAttachments: {
|
|
192
|
+
description: ( localize(5498, "Whether this chat session supports attaching symbols.")),
|
|
193
|
+
type: "boolean"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
commands: {
|
|
198
|
+
markdownDescription: ( localize(
|
|
199
|
+
5499,
|
|
200
|
+
"Commands available for this chat session, which the user can invoke with a `/`."
|
|
201
|
+
)),
|
|
202
|
+
type: "array",
|
|
203
|
+
items: {
|
|
204
|
+
additionalProperties: false,
|
|
205
|
+
type: "object",
|
|
206
|
+
defaultSnippets: [{
|
|
207
|
+
body: {
|
|
208
|
+
name: "",
|
|
209
|
+
description: ""
|
|
210
|
+
}
|
|
211
|
+
}],
|
|
212
|
+
required: ["name"],
|
|
213
|
+
properties: {
|
|
214
|
+
name: {
|
|
215
|
+
description: ( localize(
|
|
216
|
+
5500,
|
|
217
|
+
"A short name by which this command is referred to in the UI, e.g. `fix` or `explain` for commands that fix an issue or explain code. The name should be unique among the commands provided by this participant."
|
|
218
|
+
)),
|
|
219
|
+
type: "string"
|
|
220
|
+
},
|
|
221
|
+
description: {
|
|
222
|
+
description: ( localize(5501, "A description of this command.")),
|
|
223
|
+
type: "string"
|
|
224
|
+
},
|
|
225
|
+
when: {
|
|
226
|
+
description: ( localize(5502, "A condition which must be true to enable this command.")),
|
|
227
|
+
type: "string"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
canDelegate: {
|
|
233
|
+
description: ( localize(
|
|
234
|
+
5503,
|
|
235
|
+
"Whether delegation is supported. Default is false. Note that enabling this is experimental and may not be respected at all times."
|
|
236
|
+
)),
|
|
237
|
+
type: "boolean",
|
|
238
|
+
default: false
|
|
239
|
+
},
|
|
240
|
+
customAgentTarget: {
|
|
241
|
+
description: ( localize(
|
|
242
|
+
5504,
|
|
243
|
+
"When set, the chat session will show a filtered mode picker that prefers custom agents whose target property matches this value. Custom agents without a target property are still shown in all session types. This enables the use of standard agent/mode with contributed sessions."
|
|
244
|
+
)),
|
|
245
|
+
type: "string"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
required: ["type", "name", "displayName", "description"]
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
activationEventsGenerator: function*(contribs) {
|
|
252
|
+
for (const contrib of contribs) {
|
|
253
|
+
yield `onChatSession:${contrib.type}`;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
class ContributedChatSessionData extends Disposable {
|
|
258
|
+
getOption(optionId) {
|
|
259
|
+
return this._optionsCache.get(optionId);
|
|
260
|
+
}
|
|
261
|
+
setOption(optionId, value) {
|
|
262
|
+
this._optionsCache.set(optionId, value);
|
|
263
|
+
}
|
|
264
|
+
constructor(session, chatSessionType, resource, options, onWillDispose) {
|
|
265
|
+
super();
|
|
266
|
+
this.session = session;
|
|
267
|
+
this.chatSessionType = chatSessionType;
|
|
268
|
+
this.resource = resource;
|
|
269
|
+
this.options = options;
|
|
270
|
+
this.onWillDispose = onWillDispose;
|
|
271
|
+
this._optionsCache = ( new Map());
|
|
272
|
+
if (options) {
|
|
273
|
+
for (const [key, value] of Object.entries(options)) {
|
|
274
|
+
this._optionsCache.set(key, value);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
this._register(this.session.onWillDispose(() => {
|
|
278
|
+
this.onWillDispose(this.resource);
|
|
279
|
+
}));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
let ChatSessionsService = class ChatSessionsService extends Disposable {
|
|
283
|
+
get onDidChangeInProgress() {
|
|
284
|
+
return this._onDidChangeInProgress.event;
|
|
285
|
+
}
|
|
286
|
+
get onDidChangeContentProviderSchemes() {
|
|
287
|
+
return this._onDidChangeContentProviderSchemes.event;
|
|
288
|
+
}
|
|
289
|
+
get onDidChangeSessionOptions() {
|
|
290
|
+
return this._onDidChangeSessionOptions.event;
|
|
291
|
+
}
|
|
292
|
+
get onDidChangeOptionGroups() {
|
|
293
|
+
return this._onDidChangeOptionGroups.event;
|
|
294
|
+
}
|
|
295
|
+
get onRequestNotifyExtension() {
|
|
296
|
+
return this._onRequestNotifyExtension.event;
|
|
297
|
+
}
|
|
298
|
+
constructor(
|
|
299
|
+
_logService,
|
|
300
|
+
_chatAgentService,
|
|
301
|
+
_extensionService,
|
|
302
|
+
_contextKeyService,
|
|
303
|
+
_menuService,
|
|
304
|
+
_themeService,
|
|
305
|
+
_labelService
|
|
306
|
+
) {
|
|
307
|
+
super();
|
|
308
|
+
this._logService = _logService;
|
|
309
|
+
this._chatAgentService = _chatAgentService;
|
|
310
|
+
this._extensionService = _extensionService;
|
|
311
|
+
this._contextKeyService = _contextKeyService;
|
|
312
|
+
this._menuService = _menuService;
|
|
313
|
+
this._themeService = _themeService;
|
|
314
|
+
this._labelService = _labelService;
|
|
315
|
+
this._itemsProviders = ( new Map());
|
|
316
|
+
this._contributions = ( new Map());
|
|
317
|
+
this._contributionDisposables = this._register(( new DisposableMap()));
|
|
318
|
+
this._contentProviders = ( new Map());
|
|
319
|
+
this._alternativeIdMap = ( new Map());
|
|
320
|
+
this._contextKeys = ( new Set());
|
|
321
|
+
this._onDidChangeItemsProviders = this._register(( new Emitter()));
|
|
322
|
+
this.onDidChangeItemsProviders = this._onDidChangeItemsProviders.event;
|
|
323
|
+
this._onDidChangeSessionItems = this._register(( new Emitter()));
|
|
324
|
+
this.onDidChangeSessionItems = this._onDidChangeSessionItems.event;
|
|
325
|
+
this._onDidChangeAvailability = this._register(( new Emitter()));
|
|
326
|
+
this.onDidChangeAvailability = this._onDidChangeAvailability.event;
|
|
327
|
+
this._onDidChangeInProgress = this._register(( new Emitter()));
|
|
328
|
+
this._onDidChangeContentProviderSchemes = this._register(( new Emitter()));
|
|
329
|
+
this._onDidChangeSessionOptions = this._register(( new Emitter()));
|
|
330
|
+
this._onDidChangeOptionGroups = this._register(( new Emitter()));
|
|
331
|
+
this._onRequestNotifyExtension = this._register(( new AsyncEmitter()));
|
|
332
|
+
this.inProgressMap = ( new Map());
|
|
333
|
+
this._sessionTypeOptions = ( new Map());
|
|
334
|
+
this._sessionTypeIcons = ( new Map());
|
|
335
|
+
this._sessionTypeWelcomeTitles = ( new Map());
|
|
336
|
+
this._sessionTypeWelcomeMessages = ( new Map());
|
|
337
|
+
this._sessionTypeWelcomeTips = ( new Map());
|
|
338
|
+
this._sessionTypeInputPlaceholders = ( new Map());
|
|
339
|
+
this._sessions = ( new ResourceMap());
|
|
340
|
+
this._hasCanDelegateProvidersKey = ChatContextKeys.hasCanDelegateProviders.bindTo(this._contextKeyService);
|
|
341
|
+
this._register(extensionPoint.setHandler(extensions => {
|
|
342
|
+
for (const ext of extensions) {
|
|
343
|
+
if (!isProposedApiEnabled(ext.description, "chatSessionsProvider")) {
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
if (!Array.isArray(ext.value)) {
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
for (const contribution of ext.value) {
|
|
350
|
+
this._register(this.registerContribution(contribution, ext.description));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}));
|
|
354
|
+
this._register(Event.filter(
|
|
355
|
+
this._contextKeyService.onDidChangeContext,
|
|
356
|
+
e => e.affectsSome(this._contextKeys)
|
|
357
|
+
)(() => {
|
|
358
|
+
this._evaluateAvailability();
|
|
359
|
+
}));
|
|
360
|
+
const builtinSessionProviders = [AgentSessionProviders.Local];
|
|
361
|
+
const contributedSessionProviders = observableFromEvent(this.onDidChangeAvailability, () => Array.from(( this._contributions.keys())).filter(isAgentSessionProviderType)).recomputeInitiallyAndOnChange(this._store);
|
|
362
|
+
this._register(autorun(reader => {
|
|
363
|
+
const activatedProviders = [...builtinSessionProviders, ...contributedSessionProviders.read(reader)];
|
|
364
|
+
for (const provider of ( Object.values(AgentSessionProviders))) {
|
|
365
|
+
if (activatedProviders.includes(provider)) {
|
|
366
|
+
reader.store.add(
|
|
367
|
+
registerNewSessionInPlaceAction(provider, getAgentSessionProviderName(provider))
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}));
|
|
372
|
+
this._register(this.onDidChangeSessionItems(chatSessionType => {
|
|
373
|
+
this.updateInProgressStatus(chatSessionType).catch(error => {
|
|
374
|
+
this._logService.warn(`Failed to update progress status for '${chatSessionType}':`, error);
|
|
375
|
+
});
|
|
376
|
+
}));
|
|
377
|
+
this._register(this._labelService.registerFormatter({
|
|
378
|
+
scheme: Schemas.copilotPr,
|
|
379
|
+
formatting: {
|
|
380
|
+
label: "${authority}${path}",
|
|
381
|
+
separator: sep,
|
|
382
|
+
stripPathStartingSeparator: true
|
|
383
|
+
}
|
|
384
|
+
}));
|
|
385
|
+
}
|
|
386
|
+
reportInProgress(chatSessionType, count) {
|
|
387
|
+
let displayName;
|
|
388
|
+
if (chatSessionType === AgentSessionProviders.Local) {
|
|
389
|
+
displayName = ( localize(5505, "Local Agent"));
|
|
390
|
+
} else if (chatSessionType === AgentSessionProviders.Background) {
|
|
391
|
+
displayName = ( localize(5506, "Background Agent"));
|
|
392
|
+
} else if (chatSessionType === AgentSessionProviders.Cloud) {
|
|
393
|
+
displayName = ( localize(5507, "Cloud Agent"));
|
|
394
|
+
} else {
|
|
395
|
+
displayName = this._contributions.get(chatSessionType)?.contribution.displayName;
|
|
396
|
+
}
|
|
397
|
+
if (displayName) {
|
|
398
|
+
this.inProgressMap.set(displayName, count);
|
|
399
|
+
}
|
|
400
|
+
this._onDidChangeInProgress.fire();
|
|
401
|
+
}
|
|
402
|
+
getInProgress() {
|
|
403
|
+
return ( Array.from(this.inProgressMap.entries()).map(([displayName, count]) => ({
|
|
404
|
+
displayName,
|
|
405
|
+
count
|
|
406
|
+
})));
|
|
407
|
+
}
|
|
408
|
+
async updateInProgressStatus(chatSessionType) {
|
|
409
|
+
try {
|
|
410
|
+
const results = await this.getChatSessionItems([chatSessionType], CancellationToken.None);
|
|
411
|
+
const items = results.flatMap(r => r.items);
|
|
412
|
+
const inProgress = items.filter(item => item.status && isSessionInProgressStatus(item.status));
|
|
413
|
+
this.reportInProgress(chatSessionType, inProgress.length);
|
|
414
|
+
} catch (error) {
|
|
415
|
+
this._logService.warn(
|
|
416
|
+
`Failed to update in-progress status for chat session type '${chatSessionType}':`,
|
|
417
|
+
error
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
registerContribution(contribution, ext) {
|
|
422
|
+
if (( this._contributions.has(contribution.type))) {
|
|
423
|
+
return {
|
|
424
|
+
dispose: () => {}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
if (contribution.when) {
|
|
428
|
+
const whenExpr = ContextKeyExpr.deserialize(contribution.when);
|
|
429
|
+
if (whenExpr) {
|
|
430
|
+
for (const key of ( whenExpr.keys())) {
|
|
431
|
+
this._contextKeys.add(key);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
this._contributions.set(contribution.type, {
|
|
436
|
+
contribution,
|
|
437
|
+
extension: ext
|
|
438
|
+
});
|
|
439
|
+
if (contribution.alternativeIds) {
|
|
440
|
+
for (const altId of contribution.alternativeIds) {
|
|
441
|
+
if (( this._alternativeIdMap.has(altId))) {
|
|
442
|
+
this._logService.warn(
|
|
443
|
+
`Alternative ID '${altId}' is already mapped to '${this._alternativeIdMap.get(altId)}'. Remapping to '${contribution.type}'.`
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
this._alternativeIdMap.set(altId, contribution.type);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
let icon;
|
|
450
|
+
if (contribution.icon) {
|
|
451
|
+
if (typeof contribution.icon === "string") {
|
|
452
|
+
icon = contribution.icon.startsWith("$(") && contribution.icon.endsWith(")") ? ThemeIcon.fromString(contribution.icon) : ThemeIcon.fromId(contribution.icon);
|
|
453
|
+
} else {
|
|
454
|
+
icon = {
|
|
455
|
+
dark: joinPath(ext.extensionLocation, contribution.icon.dark),
|
|
456
|
+
light: joinPath(ext.extensionLocation, contribution.icon.light)
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (icon) {
|
|
461
|
+
this._sessionTypeIcons.set(contribution.type, icon);
|
|
462
|
+
}
|
|
463
|
+
if (contribution.welcomeTitle) {
|
|
464
|
+
this._sessionTypeWelcomeTitles.set(contribution.type, contribution.welcomeTitle);
|
|
465
|
+
}
|
|
466
|
+
if (contribution.welcomeMessage) {
|
|
467
|
+
this._sessionTypeWelcomeMessages.set(contribution.type, contribution.welcomeMessage);
|
|
468
|
+
}
|
|
469
|
+
if (contribution.welcomeTips) {
|
|
470
|
+
this._sessionTypeWelcomeTips.set(contribution.type, contribution.welcomeTips);
|
|
471
|
+
}
|
|
472
|
+
if (contribution.inputPlaceholder) {
|
|
473
|
+
this._sessionTypeInputPlaceholders.set(contribution.type, contribution.inputPlaceholder);
|
|
474
|
+
}
|
|
475
|
+
this._evaluateAvailability();
|
|
476
|
+
return {
|
|
477
|
+
dispose: () => {
|
|
478
|
+
this._contributions.delete(contribution.type);
|
|
479
|
+
if (contribution.alternativeIds) {
|
|
480
|
+
for (const altId of contribution.alternativeIds) {
|
|
481
|
+
if (this._alternativeIdMap.get(altId) === contribution.type) {
|
|
482
|
+
this._alternativeIdMap.delete(altId);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
this._sessionTypeIcons.delete(contribution.type);
|
|
487
|
+
this._sessionTypeWelcomeTitles.delete(contribution.type);
|
|
488
|
+
this._sessionTypeWelcomeMessages.delete(contribution.type);
|
|
489
|
+
this._sessionTypeWelcomeTips.delete(contribution.type);
|
|
490
|
+
this._sessionTypeInputPlaceholders.delete(contribution.type);
|
|
491
|
+
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
492
|
+
this._updateHasCanDelegateProvidersContextKey();
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
_isContributionAvailable(contribution) {
|
|
497
|
+
if (!contribution.when) {
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
const whenExpr = ContextKeyExpr.deserialize(contribution.when);
|
|
501
|
+
return !whenExpr || this._contextKeyService.contextMatchesRules(whenExpr);
|
|
502
|
+
}
|
|
503
|
+
_resolveToPrimaryType(sessionType) {
|
|
504
|
+
const contribution = this._contributions.get(sessionType)?.contribution;
|
|
505
|
+
if (contribution) {
|
|
506
|
+
if (this._isContributionAvailable(contribution)) {
|
|
507
|
+
return sessionType;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
const primaryType = this._alternativeIdMap.get(sessionType);
|
|
511
|
+
if (primaryType) {
|
|
512
|
+
const altContribution = this._contributions.get(primaryType)?.contribution;
|
|
513
|
+
if (altContribution && this._isContributionAvailable(altContribution)) {
|
|
514
|
+
return primaryType;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return undefined;
|
|
518
|
+
}
|
|
519
|
+
_registerMenuItems(contribution, extensionDescription) {
|
|
520
|
+
const contextKeyService = this._contextKeyService.createOverlay([["chatSessionType", contribution.type]]);
|
|
521
|
+
const rawMenuActions = this._menuService.getMenuActions(MenuId.AgentSessionsCreateSubMenu, contextKeyService);
|
|
522
|
+
const menuActions = ( rawMenuActions.map(value => value[1])).flat();
|
|
523
|
+
const disposables = ( new DisposableStore());
|
|
524
|
+
for (let i = 0; i < menuActions.length; i++) {
|
|
525
|
+
const action = menuActions[i];
|
|
526
|
+
if (action instanceof MenuItemAction) {
|
|
527
|
+
if (i === 0 && !contribution.canDelegate) {
|
|
528
|
+
disposables.add(
|
|
529
|
+
registerNewSessionExternalAction(contribution.type, contribution.displayName, action.item.id)
|
|
530
|
+
);
|
|
531
|
+
} else {
|
|
532
|
+
disposables.add(MenuRegistry.appendMenuItem(MenuId.ChatNewMenu, {
|
|
533
|
+
command: action.item,
|
|
534
|
+
group: "4_externally_contributed"
|
|
535
|
+
}));
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return {
|
|
540
|
+
dispose: () => disposables.dispose()
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
_registerCommands(contribution) {
|
|
544
|
+
const isAvailableInSessionTypePicker = isAgentSessionProviderType(contribution.type);
|
|
545
|
+
return combinedDisposable(registerAction2(class OpenChatSessionAction extends Action2 {
|
|
546
|
+
constructor() {
|
|
547
|
+
super({
|
|
548
|
+
id: `workbench.action.chat.openSessionWithPrompt.${contribution.type}`,
|
|
549
|
+
title: ( localize2(5508, "New {0} with Prompt", contribution.displayName)),
|
|
550
|
+
category: CHAT_CATEGORY,
|
|
551
|
+
icon: Codicon.plus,
|
|
552
|
+
f1: false,
|
|
553
|
+
precondition: ChatContextKeys.enabled
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
async run(accessor, chatOptions) {
|
|
557
|
+
const chatService = accessor.get(IChatService);
|
|
558
|
+
const {
|
|
559
|
+
type
|
|
560
|
+
} = contribution;
|
|
561
|
+
if (chatOptions) {
|
|
562
|
+
const resource = URI.revive(chatOptions.resource);
|
|
563
|
+
const ref = await chatService.loadSessionForResource(resource, ChatAgentLocation.Chat, CancellationToken.None);
|
|
564
|
+
await chatService.sendRequest(resource, chatOptions.prompt, {
|
|
565
|
+
agentIdSilent: type,
|
|
566
|
+
attachedContext: chatOptions.attachedContext
|
|
567
|
+
});
|
|
568
|
+
ref?.dispose();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}),
|
|
572
|
+
registerAction2(class OpenNewChatSessionEditorAction extends Action2 {
|
|
573
|
+
constructor() {
|
|
574
|
+
super({
|
|
575
|
+
id: `workbench.action.chat.openNewSessionEditor.${contribution.type}`,
|
|
576
|
+
title: ( localize2(5509, "New {0}", contribution.displayName)),
|
|
577
|
+
category: CHAT_CATEGORY,
|
|
578
|
+
icon: Codicon.plus,
|
|
579
|
+
f1: true,
|
|
580
|
+
precondition: ChatContextKeys.enabled
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
async run(accessor, chatOptions) {
|
|
584
|
+
const {
|
|
585
|
+
type,
|
|
586
|
+
displayName
|
|
587
|
+
} = contribution;
|
|
588
|
+
await openChatSession(accessor, {
|
|
589
|
+
type,
|
|
590
|
+
displayName,
|
|
591
|
+
position: ChatSessionPosition.Editor
|
|
592
|
+
}, chatOptions);
|
|
593
|
+
}
|
|
594
|
+
}),
|
|
595
|
+
registerAction2(class OpenNewChatSessionSidebarAction extends Action2 {
|
|
596
|
+
constructor() {
|
|
597
|
+
super({
|
|
598
|
+
id: `workbench.action.chat.openNewSessionSidebar.${contribution.type}`,
|
|
599
|
+
title: ( localize2(5510, "New {0}", contribution.displayName)),
|
|
600
|
+
category: CHAT_CATEGORY,
|
|
601
|
+
icon: Codicon.plus,
|
|
602
|
+
f1: false,
|
|
603
|
+
precondition: ChatContextKeys.enabled,
|
|
604
|
+
menu: !isAvailableInSessionTypePicker ? {
|
|
605
|
+
id: MenuId.ChatNewMenu,
|
|
606
|
+
group: "3_new_special"
|
|
607
|
+
} : undefined
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
async run(accessor, chatOptions) {
|
|
611
|
+
const {
|
|
612
|
+
type,
|
|
613
|
+
displayName
|
|
614
|
+
} = contribution;
|
|
615
|
+
await openChatSession(accessor, {
|
|
616
|
+
type,
|
|
617
|
+
displayName,
|
|
618
|
+
position: ChatSessionPosition.Sidebar
|
|
619
|
+
}, chatOptions);
|
|
620
|
+
}
|
|
621
|
+
}));
|
|
622
|
+
}
|
|
623
|
+
_evaluateAvailability() {
|
|
624
|
+
let hasChanges = false;
|
|
625
|
+
for (const {
|
|
626
|
+
contribution,
|
|
627
|
+
extension
|
|
628
|
+
} of ( this._contributions.values())) {
|
|
629
|
+
const isCurrentlyRegistered = ( this._contributionDisposables.has(contribution.type));
|
|
630
|
+
const shouldBeRegistered = this._isContributionAvailable(contribution);
|
|
631
|
+
if (isCurrentlyRegistered && !shouldBeRegistered) {
|
|
632
|
+
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
633
|
+
this._disposeSessionsForContribution(contribution.type);
|
|
634
|
+
hasChanges = true;
|
|
635
|
+
} else if (!isCurrentlyRegistered && shouldBeRegistered) {
|
|
636
|
+
this._enableContribution(contribution, extension);
|
|
637
|
+
hasChanges = true;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
if (hasChanges) {
|
|
641
|
+
this._onDidChangeAvailability.fire();
|
|
642
|
+
for (const provider of ( this._itemsProviders.values())) {
|
|
643
|
+
this._onDidChangeItemsProviders.fire(provider);
|
|
644
|
+
}
|
|
645
|
+
for (const {
|
|
646
|
+
contribution
|
|
647
|
+
} of ( this._contributions.values())) {
|
|
648
|
+
this._onDidChangeSessionItems.fire(contribution.type);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
this._updateHasCanDelegateProvidersContextKey();
|
|
652
|
+
}
|
|
653
|
+
_enableContribution(contribution, ext) {
|
|
654
|
+
const disposableStore = ( new DisposableStore());
|
|
655
|
+
this._contributionDisposables.set(contribution.type, disposableStore);
|
|
656
|
+
if (contribution.canDelegate) {
|
|
657
|
+
disposableStore.add(this._registerAgent(contribution, ext));
|
|
658
|
+
disposableStore.add(this._registerCommands(contribution));
|
|
659
|
+
}
|
|
660
|
+
disposableStore.add(this._registerMenuItems(contribution, ext));
|
|
661
|
+
}
|
|
662
|
+
_disposeSessionsForContribution(contributionId) {
|
|
663
|
+
const sessionsToDispose = [];
|
|
664
|
+
for (const [sessionResource, sessionData] of this._sessions) {
|
|
665
|
+
if (sessionData.chatSessionType === contributionId) {
|
|
666
|
+
sessionsToDispose.push(sessionResource);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (sessionsToDispose.length > 0) {
|
|
670
|
+
this._logService.info(
|
|
671
|
+
`Disposing ${sessionsToDispose.length} cached sessions for contribution '${contributionId}' due to when clause change`
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
for (const sessionKey of sessionsToDispose) {
|
|
675
|
+
const sessionData = this._sessions.get(sessionKey);
|
|
676
|
+
if (sessionData) {
|
|
677
|
+
sessionData.dispose();
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
_registerAgent(contribution, ext) {
|
|
682
|
+
const {
|
|
683
|
+
type: id,
|
|
684
|
+
name,
|
|
685
|
+
displayName,
|
|
686
|
+
description
|
|
687
|
+
} = contribution;
|
|
688
|
+
const storedIcon = this._sessionTypeIcons.get(id);
|
|
689
|
+
const icons = ThemeIcon.isThemeIcon(storedIcon) ? {
|
|
690
|
+
themeIcon: storedIcon,
|
|
691
|
+
icon: undefined,
|
|
692
|
+
iconDark: undefined
|
|
693
|
+
} : storedIcon ? {
|
|
694
|
+
icon: storedIcon.light,
|
|
695
|
+
iconDark: storedIcon.dark
|
|
696
|
+
} : {
|
|
697
|
+
themeIcon: Codicon.sendToRemoteAgent
|
|
698
|
+
};
|
|
699
|
+
const agentData = {
|
|
700
|
+
id,
|
|
701
|
+
name,
|
|
702
|
+
fullName: displayName,
|
|
703
|
+
description: description,
|
|
704
|
+
isDefault: false,
|
|
705
|
+
isCore: false,
|
|
706
|
+
isDynamic: true,
|
|
707
|
+
slashCommands: contribution.commands ?? [],
|
|
708
|
+
locations: [ChatAgentLocation.Chat],
|
|
709
|
+
modes: [ChatModeKind.Agent, ChatModeKind.Ask],
|
|
710
|
+
disambiguation: [],
|
|
711
|
+
metadata: {
|
|
712
|
+
...icons
|
|
713
|
+
},
|
|
714
|
+
capabilities: contribution.capabilities,
|
|
715
|
+
canAccessPreviousChatHistory: true,
|
|
716
|
+
extensionId: ext.identifier,
|
|
717
|
+
extensionVersion: ext.version,
|
|
718
|
+
extensionDisplayName: ext.displayName || ext.name,
|
|
719
|
+
extensionPublisherId: ext.publisher
|
|
720
|
+
};
|
|
721
|
+
return this._chatAgentService.registerAgent(id, agentData);
|
|
722
|
+
}
|
|
723
|
+
getAllChatSessionContributions() {
|
|
724
|
+
return Array.from(( this._contributions.values()), x => x.contribution).filter(contribution => this._isContributionAvailable(contribution));
|
|
725
|
+
}
|
|
726
|
+
_updateHasCanDelegateProvidersContextKey() {
|
|
727
|
+
const hasCanDelegate = this.getAllChatSessionContributions().filter(c => c.canDelegate);
|
|
728
|
+
const canDelegateEnabled = hasCanDelegate.length > 0;
|
|
729
|
+
this._logService.trace(
|
|
730
|
+
`[ChatSessionsService] hasCanDelegateProvidersAvailable=${canDelegateEnabled} (${( hasCanDelegate.map(c => c.type)).join(", ")})`
|
|
731
|
+
);
|
|
732
|
+
this._hasCanDelegateProvidersKey.set(canDelegateEnabled);
|
|
733
|
+
}
|
|
734
|
+
getChatSessionContribution(chatSessionType) {
|
|
735
|
+
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
736
|
+
if (!contribution) {
|
|
737
|
+
return undefined;
|
|
738
|
+
}
|
|
739
|
+
return this._isContributionAvailable(contribution) ? contribution : undefined;
|
|
740
|
+
}
|
|
741
|
+
async activateChatSessionItemProvider(chatViewType) {
|
|
742
|
+
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
743
|
+
const resolvedType = this._resolveToPrimaryType(chatViewType);
|
|
744
|
+
if (resolvedType) {
|
|
745
|
+
chatViewType = resolvedType;
|
|
746
|
+
}
|
|
747
|
+
const contribution = this._contributions.get(chatViewType)?.contribution;
|
|
748
|
+
if (contribution && !this._isContributionAvailable(contribution)) {
|
|
749
|
+
return undefined;
|
|
750
|
+
}
|
|
751
|
+
if (( this._itemsProviders.has(chatViewType))) {
|
|
752
|
+
return this._itemsProviders.get(chatViewType);
|
|
753
|
+
}
|
|
754
|
+
await this._extensionService.activateByEvent(`onChatSession:${chatViewType}`);
|
|
755
|
+
return this._itemsProviders.get(chatViewType);
|
|
756
|
+
}
|
|
757
|
+
async canResolveChatSession(chatSessionResource) {
|
|
758
|
+
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
759
|
+
const resolvedType = this._resolveToPrimaryType(chatSessionResource.scheme) || chatSessionResource.scheme;
|
|
760
|
+
const contribution = this._contributions.get(resolvedType)?.contribution;
|
|
761
|
+
if (contribution && !this._isContributionAvailable(contribution)) {
|
|
762
|
+
return false;
|
|
763
|
+
}
|
|
764
|
+
if (( this._contentProviders.has(chatSessionResource.scheme))) {
|
|
765
|
+
return true;
|
|
766
|
+
}
|
|
767
|
+
await this._extensionService.activateByEvent(`onChatSession:${chatSessionResource.scheme}`);
|
|
768
|
+
return ( this._contentProviders.has(chatSessionResource.scheme));
|
|
769
|
+
}
|
|
770
|
+
async getChatSessionItems(providersToResolve, token) {
|
|
771
|
+
const results = [];
|
|
772
|
+
const resolvedProviderTypes = ( new Set());
|
|
773
|
+
for (const contrib of this.getAllChatSessionContributions()) {
|
|
774
|
+
if (providersToResolve && !providersToResolve.includes(contrib.type)) {
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
const provider = await this.activateChatSessionItemProvider(contrib.type);
|
|
778
|
+
if (!provider) {
|
|
779
|
+
if (providersToResolve?.includes(contrib.type)) {
|
|
780
|
+
this._logService.trace(
|
|
781
|
+
`[ChatSessionsService] No enabled provider found for chat session type ${contrib.type}`
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
try {
|
|
787
|
+
const providerSessions = await raceCancellationError(provider.provideChatSessionItems(token), token);
|
|
788
|
+
this._logService.trace(
|
|
789
|
+
`[ChatSessionsService] Resolved ${providerSessions.length} sessions for provider ${provider.chatSessionType}`
|
|
790
|
+
);
|
|
791
|
+
results.push({
|
|
792
|
+
chatSessionType: provider.chatSessionType,
|
|
793
|
+
items: providerSessions
|
|
794
|
+
});
|
|
795
|
+
resolvedProviderTypes.add(provider.chatSessionType);
|
|
796
|
+
} catch (error) {
|
|
797
|
+
this._logService.error(
|
|
798
|
+
`[ChatSessionsService] Failed to resolve sessions for provider ${provider.chatSessionType}`,
|
|
799
|
+
error
|
|
800
|
+
);
|
|
801
|
+
continue;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
for (const [chatSessionType, provider] of this._itemsProviders) {
|
|
805
|
+
if (( resolvedProviderTypes.has(chatSessionType))) {
|
|
806
|
+
continue;
|
|
807
|
+
}
|
|
808
|
+
if (providersToResolve && !providersToResolve.includes(chatSessionType)) {
|
|
809
|
+
continue;
|
|
810
|
+
}
|
|
811
|
+
try {
|
|
812
|
+
const providerSessions = await raceCancellationError(provider.provideChatSessionItems(token), token);
|
|
813
|
+
this._logService.trace(
|
|
814
|
+
`[ChatSessionsService] Resolved ${providerSessions.length} sessions for built-in provider ${chatSessionType}`
|
|
815
|
+
);
|
|
816
|
+
results.push({
|
|
817
|
+
chatSessionType,
|
|
818
|
+
items: providerSessions
|
|
819
|
+
});
|
|
820
|
+
} catch (error) {
|
|
821
|
+
this._logService.error(
|
|
822
|
+
`[ChatSessionsService] Failed to resolve sessions for built-in provider ${chatSessionType}`,
|
|
823
|
+
error
|
|
824
|
+
);
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return results;
|
|
829
|
+
}
|
|
830
|
+
registerChatSessionItemProvider(provider) {
|
|
831
|
+
const chatSessionType = provider.chatSessionType;
|
|
832
|
+
this._itemsProviders.set(chatSessionType, provider);
|
|
833
|
+
this._onDidChangeItemsProviders.fire(provider);
|
|
834
|
+
const disposables = ( new DisposableStore());
|
|
835
|
+
disposables.add(provider.onDidChangeChatSessionItems(() => {
|
|
836
|
+
this._onDidChangeSessionItems.fire(chatSessionType);
|
|
837
|
+
}));
|
|
838
|
+
this.updateInProgressStatus(chatSessionType).catch(error => {
|
|
839
|
+
this._logService.warn(
|
|
840
|
+
`Failed to update initial progress status for '${chatSessionType}':`,
|
|
841
|
+
error
|
|
842
|
+
);
|
|
843
|
+
});
|
|
844
|
+
return {
|
|
845
|
+
dispose: () => {
|
|
846
|
+
disposables.dispose();
|
|
847
|
+
const provider = this._itemsProviders.get(chatSessionType);
|
|
848
|
+
if (provider) {
|
|
849
|
+
this._itemsProviders.delete(chatSessionType);
|
|
850
|
+
this._onDidChangeItemsProviders.fire(provider);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
registerChatSessionContentProvider(chatSessionType, provider) {
|
|
856
|
+
if (( this._contentProviders.has(chatSessionType))) {
|
|
857
|
+
throw ( new Error(`Content provider for ${chatSessionType} is already registered.`));
|
|
858
|
+
}
|
|
859
|
+
this._contentProviders.set(chatSessionType, provider);
|
|
860
|
+
this._onDidChangeContentProviderSchemes.fire({
|
|
861
|
+
added: [chatSessionType],
|
|
862
|
+
removed: []
|
|
863
|
+
});
|
|
864
|
+
return {
|
|
865
|
+
dispose: () => {
|
|
866
|
+
this._contentProviders.delete(chatSessionType);
|
|
867
|
+
this._onDidChangeContentProviderSchemes.fire({
|
|
868
|
+
added: [],
|
|
869
|
+
removed: [chatSessionType]
|
|
870
|
+
});
|
|
871
|
+
for (const [key, session] of this._sessions) {
|
|
872
|
+
if (session.chatSessionType === chatSessionType) {
|
|
873
|
+
session.dispose();
|
|
874
|
+
this._sessions.delete(key);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
registerChatModelChangeListeners(chatService, chatSessionType, onChange) {
|
|
881
|
+
const disposableStore = ( new DisposableStore());
|
|
882
|
+
const chatModelsICareAbout = ( chatService.chatModels.map(
|
|
883
|
+
models => Array.from(models).filter(model => model.sessionResource.scheme === chatSessionType)
|
|
884
|
+
));
|
|
885
|
+
const listeners = ( new ResourceMap());
|
|
886
|
+
const autoRunDisposable = autorunIterableDelta(reader => chatModelsICareAbout.read(reader), (
|
|
887
|
+
{
|
|
888
|
+
addedValues,
|
|
889
|
+
removedValues
|
|
890
|
+
}
|
|
891
|
+
) => {
|
|
892
|
+
removedValues.forEach(removed => {
|
|
893
|
+
const listener = listeners.get(removed.sessionResource);
|
|
894
|
+
if (listener) {
|
|
895
|
+
listeners.delete(removed.sessionResource);
|
|
896
|
+
listener.dispose();
|
|
897
|
+
}
|
|
898
|
+
});
|
|
899
|
+
addedValues.forEach(added => {
|
|
900
|
+
const requestChangeListener = ( added.lastRequestObs.map(
|
|
901
|
+
last => last?.response && observableSignalFromEvent("chatSessions.modelRequestChangeListener", last.response.onDidChange)
|
|
902
|
+
));
|
|
903
|
+
const modelChangeListener = observableSignalFromEvent("chatSessions.modelChangeListener", added.onDidChange);
|
|
904
|
+
listeners.set(added.sessionResource, autorun(reader => {
|
|
905
|
+
requestChangeListener.read(reader)?.read(reader);
|
|
906
|
+
modelChangeListener.read(reader);
|
|
907
|
+
onChange();
|
|
908
|
+
}));
|
|
909
|
+
});
|
|
910
|
+
});
|
|
911
|
+
disposableStore.add(toDisposable(() => {
|
|
912
|
+
for (const listener of ( listeners.values())) {
|
|
913
|
+
listener.dispose();
|
|
914
|
+
}
|
|
915
|
+
}));
|
|
916
|
+
disposableStore.add(autoRunDisposable);
|
|
917
|
+
return disposableStore;
|
|
918
|
+
}
|
|
919
|
+
getInProgressSessionDescription(chatModel) {
|
|
920
|
+
const requests = chatModel.getRequests();
|
|
921
|
+
if (requests.length === 0) {
|
|
922
|
+
return undefined;
|
|
923
|
+
}
|
|
924
|
+
const lastRequest = requests.at(-1);
|
|
925
|
+
const response = lastRequest?.response;
|
|
926
|
+
if (!response) {
|
|
927
|
+
return undefined;
|
|
928
|
+
}
|
|
929
|
+
if (response.isComplete) {
|
|
930
|
+
return undefined;
|
|
931
|
+
}
|
|
932
|
+
const responseParts = response.response.value;
|
|
933
|
+
let description = "";
|
|
934
|
+
for (let i = responseParts.length - 1; i >= 0; i--) {
|
|
935
|
+
const part = responseParts[i];
|
|
936
|
+
if (description) {
|
|
937
|
+
break;
|
|
938
|
+
}
|
|
939
|
+
if (part.kind === "confirmation" && typeof part.message === "string") {
|
|
940
|
+
description = part.message;
|
|
941
|
+
} else if (part.kind === "toolInvocation") {
|
|
942
|
+
const toolInvocation = part;
|
|
943
|
+
const state = toolInvocation.state.get();
|
|
944
|
+
description = toolInvocation.generatedTitle || toolInvocation.pastTenseMessage || toolInvocation.invocationMessage;
|
|
945
|
+
if (state.type === IChatToolInvocation.StateKind.WaitingForConfirmation) {
|
|
946
|
+
const confirmationTitle = state.confirmationMessages?.title;
|
|
947
|
+
const titleMessage = confirmationTitle && (typeof confirmationTitle === "string" ? confirmationTitle : confirmationTitle.value);
|
|
948
|
+
const descriptionValue = typeof description === "string" ? description : description.value;
|
|
949
|
+
description = titleMessage ?? ( localize(5511, "Waiting for confirmation: {0}", descriptionValue));
|
|
950
|
+
}
|
|
951
|
+
} else if (part.kind === "toolInvocationSerialized") {
|
|
952
|
+
description = part.invocationMessage;
|
|
953
|
+
} else if (part.kind === "progressMessage") {
|
|
954
|
+
description = part.content;
|
|
955
|
+
} else if (part.kind === "thinking") {
|
|
956
|
+
description = ( localize(5512, "Thinking..."));
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
return description ? renderAsPlaintext(description, {
|
|
960
|
+
useLinkFormatter: true
|
|
961
|
+
}) : "";
|
|
962
|
+
}
|
|
963
|
+
async getOrCreateChatSession(sessionResource, token) {
|
|
964
|
+
const existingSessionData = this._sessions.get(sessionResource);
|
|
965
|
+
if (existingSessionData) {
|
|
966
|
+
return existingSessionData.session;
|
|
967
|
+
}
|
|
968
|
+
if (!(await raceCancellationError(this.canResolveChatSession(sessionResource), token))) {
|
|
969
|
+
throw Error(`Can not find provider for ${sessionResource}`);
|
|
970
|
+
}
|
|
971
|
+
const resolvedType = this._resolveToPrimaryType(sessionResource.scheme) || sessionResource.scheme;
|
|
972
|
+
const provider = this._contentProviders.get(resolvedType);
|
|
973
|
+
if (!provider) {
|
|
974
|
+
throw Error(`Can not find provider for ${sessionResource}`);
|
|
975
|
+
}
|
|
976
|
+
const session = await raceCancellationError(provider.provideChatSessionContent(sessionResource, token), token);
|
|
977
|
+
const sessionData = ( new ContributedChatSessionData(
|
|
978
|
+
session,
|
|
979
|
+
sessionResource.scheme,
|
|
980
|
+
sessionResource,
|
|
981
|
+
session.options,
|
|
982
|
+
resource => {
|
|
983
|
+
sessionData.dispose();
|
|
984
|
+
this._sessions.delete(resource);
|
|
985
|
+
}
|
|
986
|
+
));
|
|
987
|
+
this._sessions.set(sessionResource, sessionData);
|
|
988
|
+
return session;
|
|
989
|
+
}
|
|
990
|
+
hasAnySessionOptions(sessionResource) {
|
|
991
|
+
const session = this._sessions.get(sessionResource);
|
|
992
|
+
return !!session && !!session.options && ( Object.keys(session.options)).length > 0;
|
|
993
|
+
}
|
|
994
|
+
getSessionOption(sessionResource, optionId) {
|
|
995
|
+
const session = this._sessions.get(sessionResource);
|
|
996
|
+
return session?.getOption(optionId);
|
|
997
|
+
}
|
|
998
|
+
setSessionOption(sessionResource, optionId, value) {
|
|
999
|
+
const session = this._sessions.get(sessionResource);
|
|
1000
|
+
return !!session?.setOption(optionId, value);
|
|
1001
|
+
}
|
|
1002
|
+
notifySessionItemsChanged(chatSessionType) {
|
|
1003
|
+
this._onDidChangeSessionItems.fire(chatSessionType);
|
|
1004
|
+
}
|
|
1005
|
+
setOptionGroupsForSessionType(chatSessionType, handle, optionGroups) {
|
|
1006
|
+
if (optionGroups) {
|
|
1007
|
+
this._sessionTypeOptions.set(chatSessionType, optionGroups);
|
|
1008
|
+
} else {
|
|
1009
|
+
this._sessionTypeOptions.delete(chatSessionType);
|
|
1010
|
+
}
|
|
1011
|
+
this._onDidChangeOptionGroups.fire(chatSessionType);
|
|
1012
|
+
}
|
|
1013
|
+
getOptionGroupsForSessionType(chatSessionType) {
|
|
1014
|
+
return this._sessionTypeOptions.get(chatSessionType);
|
|
1015
|
+
}
|
|
1016
|
+
async notifySessionOptionsChange(sessionResource, updates) {
|
|
1017
|
+
if (!updates.length) {
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
this._logService.trace(
|
|
1021
|
+
`[ChatSessionsService] notifySessionOptionsChange: starting for ${sessionResource}, ${updates.length} update(s): [${( updates.map(u => u.optionId)).join(", ")}]`
|
|
1022
|
+
);
|
|
1023
|
+
await this._onRequestNotifyExtension.fireAsync({
|
|
1024
|
+
sessionResource,
|
|
1025
|
+
updates
|
|
1026
|
+
}, CancellationToken.None);
|
|
1027
|
+
this._logService.trace(
|
|
1028
|
+
`[ChatSessionsService] notifySessionOptionsChange: fireAsync completed for ${sessionResource}`
|
|
1029
|
+
);
|
|
1030
|
+
for (const u of updates) {
|
|
1031
|
+
this.setSessionOption(sessionResource, u.optionId, u.value);
|
|
1032
|
+
}
|
|
1033
|
+
this._onDidChangeSessionOptions.fire(sessionResource);
|
|
1034
|
+
this._logService.trace(
|
|
1035
|
+
`[ChatSessionsService] notifySessionOptionsChange: finished for ${sessionResource}`
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
getIconForSessionType(chatSessionType) {
|
|
1039
|
+
const sessionTypeIcon = this._sessionTypeIcons.get(chatSessionType);
|
|
1040
|
+
if (ThemeIcon.isThemeIcon(sessionTypeIcon)) {
|
|
1041
|
+
return sessionTypeIcon;
|
|
1042
|
+
}
|
|
1043
|
+
if (isDark(this._themeService.getColorTheme().type)) {
|
|
1044
|
+
return sessionTypeIcon?.dark;
|
|
1045
|
+
} else {
|
|
1046
|
+
return sessionTypeIcon?.light;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
getWelcomeTitleForSessionType(chatSessionType) {
|
|
1050
|
+
return this._sessionTypeWelcomeTitles.get(chatSessionType);
|
|
1051
|
+
}
|
|
1052
|
+
getWelcomeMessageForSessionType(chatSessionType) {
|
|
1053
|
+
return this._sessionTypeWelcomeMessages.get(chatSessionType);
|
|
1054
|
+
}
|
|
1055
|
+
getInputPlaceholderForSessionType(chatSessionType) {
|
|
1056
|
+
return this._sessionTypeInputPlaceholders.get(chatSessionType);
|
|
1057
|
+
}
|
|
1058
|
+
getCapabilitiesForSessionType(chatSessionType) {
|
|
1059
|
+
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1060
|
+
return contribution?.capabilities;
|
|
1061
|
+
}
|
|
1062
|
+
getCustomAgentTargetForSessionType(chatSessionType) {
|
|
1063
|
+
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1064
|
+
return contribution?.customAgentTarget;
|
|
1065
|
+
}
|
|
1066
|
+
getContentProviderSchemes() {
|
|
1067
|
+
return Array.from(( this._contentProviders.keys()));
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
ChatSessionsService = ( __decorate([( __param(0, ILogService)), ( __param(1, IChatAgentService)), ( __param(2, IExtensionService)), ( __param(3, IContextKeyService)), ( __param(4, IMenuService)), ( __param(5, IThemeService)), ( __param(6, ILabelService))], ChatSessionsService));
|
|
1071
|
+
function registerNewSessionInPlaceAction(type, displayName) {
|
|
1072
|
+
return registerAction2(class NewChatSessionInPlaceAction extends Action2 {
|
|
1073
|
+
constructor() {
|
|
1074
|
+
super({
|
|
1075
|
+
id: `workbench.action.chat.openNewChatSessionInPlace.${type}`,
|
|
1076
|
+
title: ( localize2(5513, "New {0}", displayName)),
|
|
1077
|
+
category: CHAT_CATEGORY,
|
|
1078
|
+
f1: false,
|
|
1079
|
+
precondition: ChatContextKeys.enabled
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
async run(accessor, ...args) {
|
|
1083
|
+
if (args.length === 0) {
|
|
1084
|
+
throw ( new BugIndicatingError("Expected chat session position argument"));
|
|
1085
|
+
}
|
|
1086
|
+
const chatSessionPosition = args[0];
|
|
1087
|
+
if (chatSessionPosition !== ChatSessionPosition.Sidebar && chatSessionPosition !== ChatSessionPosition.Editor) {
|
|
1088
|
+
throw ( new BugIndicatingError(`Invalid chat session position argument: ${chatSessionPosition}`));
|
|
1089
|
+
}
|
|
1090
|
+
await openChatSession(accessor, {
|
|
1091
|
+
type: type,
|
|
1092
|
+
displayName: ( localize(5514, "Chat")),
|
|
1093
|
+
position: chatSessionPosition,
|
|
1094
|
+
replaceEditor: true
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
function registerNewSessionExternalAction(type, displayName, commandId) {
|
|
1100
|
+
return registerAction2(class NewChatSessionExternalAction extends Action2 {
|
|
1101
|
+
constructor() {
|
|
1102
|
+
super({
|
|
1103
|
+
id: `workbench.action.chat.openNewChatSessionExternal.${type}`,
|
|
1104
|
+
title: ( localize2(5515, "New {0}", displayName)),
|
|
1105
|
+
category: CHAT_CATEGORY,
|
|
1106
|
+
f1: false,
|
|
1107
|
+
precondition: ChatContextKeys.enabled
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
async run(accessor) {
|
|
1111
|
+
const commandService = accessor.get(ICommandService);
|
|
1112
|
+
await commandService.executeCommand(commandId);
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
var ChatSessionPosition;
|
|
1117
|
+
(function(ChatSessionPosition) {
|
|
1118
|
+
ChatSessionPosition["Editor"] = "editor";
|
|
1119
|
+
ChatSessionPosition["Sidebar"] = "sidebar";
|
|
1120
|
+
})(ChatSessionPosition || (ChatSessionPosition = {}));
|
|
1121
|
+
async function openChatSession(accessor, openOptions, chatSendOptions) {
|
|
1122
|
+
const viewsService = accessor.get(IViewsService);
|
|
1123
|
+
const chatService = accessor.get(IChatService);
|
|
1124
|
+
const logService = accessor.get(ILogService);
|
|
1125
|
+
const editorGroupService = accessor.get(IEditorGroupsService);
|
|
1126
|
+
const editorService = accessor.get(IEditorService);
|
|
1127
|
+
const resource = getResourceForNewChatSession(openOptions);
|
|
1128
|
+
try {
|
|
1129
|
+
switch (openOptions.position) {
|
|
1130
|
+
case ChatSessionPosition.Sidebar:
|
|
1131
|
+
{
|
|
1132
|
+
const view = await viewsService.openView(ChatViewId);
|
|
1133
|
+
if (openOptions.type === AgentSessionProviders.Local) {
|
|
1134
|
+
await view.widget.clear();
|
|
1135
|
+
} else {
|
|
1136
|
+
await view.loadSession(resource);
|
|
1137
|
+
}
|
|
1138
|
+
view.focus();
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1141
|
+
case ChatSessionPosition.Editor:
|
|
1142
|
+
{
|
|
1143
|
+
const options = {
|
|
1144
|
+
override: ChatEditorInput.EditorID,
|
|
1145
|
+
pinned: true,
|
|
1146
|
+
title: {
|
|
1147
|
+
fallback: ( localize(5516, "{0}", openOptions.displayName))
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
if (openOptions.replaceEditor) {
|
|
1151
|
+
const activeEditor = editorGroupService.activeGroup.activeEditor;
|
|
1152
|
+
if (!activeEditor || !(activeEditor instanceof ChatEditorInput)) {
|
|
1153
|
+
throw ( new Error("No active chat editor to replace"));
|
|
1154
|
+
}
|
|
1155
|
+
await editorService.replaceEditors([{
|
|
1156
|
+
editor: activeEditor,
|
|
1157
|
+
replacement: {
|
|
1158
|
+
resource,
|
|
1159
|
+
options
|
|
1160
|
+
}
|
|
1161
|
+
}], editorGroupService.activeGroup);
|
|
1162
|
+
} else {
|
|
1163
|
+
await editorService.openEditor({
|
|
1164
|
+
resource,
|
|
1165
|
+
options
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
break;
|
|
1169
|
+
}
|
|
1170
|
+
default:
|
|
1171
|
+
assertNever(
|
|
1172
|
+
openOptions.position,
|
|
1173
|
+
`Unknown chat session position: ${openOptions.position}`
|
|
1174
|
+
);
|
|
1175
|
+
}
|
|
1176
|
+
} catch (e) {
|
|
1177
|
+
logService.error(
|
|
1178
|
+
`Failed to open '${openOptions.type}' chat session with openOptions: ${JSON.stringify(openOptions)}`,
|
|
1179
|
+
e
|
|
1180
|
+
);
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
if (chatSendOptions) {
|
|
1184
|
+
try {
|
|
1185
|
+
await chatService.sendRequest(resource, chatSendOptions.prompt, {
|
|
1186
|
+
agentIdSilent: openOptions.type,
|
|
1187
|
+
attachedContext: chatSendOptions.attachedContext
|
|
1188
|
+
});
|
|
1189
|
+
} catch (e) {
|
|
1190
|
+
logService.error(
|
|
1191
|
+
`Failed to send initial request to '${openOptions.type}' chat session with contextOptions: ${JSON.stringify(chatSendOptions)}`,
|
|
1192
|
+
e
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
function getResourceForNewChatSession(options) {
|
|
1198
|
+
if (options.chatResource) {
|
|
1199
|
+
return URI.revive(options.chatResource);
|
|
1200
|
+
}
|
|
1201
|
+
const isRemoteSession = options.type !== AgentSessionProviders.Local;
|
|
1202
|
+
if (isRemoteSession) {
|
|
1203
|
+
return ( URI.from({
|
|
1204
|
+
scheme: options.type,
|
|
1205
|
+
path: `/untitled-${generateUuid()}`
|
|
1206
|
+
}));
|
|
1207
|
+
}
|
|
1208
|
+
const isEditorPosition = options.position === ChatSessionPosition.Editor;
|
|
1209
|
+
if (isEditorPosition) {
|
|
1210
|
+
return ChatEditorInput.getNewEditorUri();
|
|
1211
|
+
}
|
|
1212
|
+
return LocalChatSessionUri.forSession(generateUuid());
|
|
1213
|
+
}
|
|
1214
|
+
function isAgentSessionProviderType(type) {
|
|
1215
|
+
return ( Object.values(AgentSessionProviders)).includes(type);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
export { ChatSessionPosition, ChatSessionsService, getResourceForNewChatSession };
|