@codingame/monaco-vscode-katex-common 26.2.2 → 28.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 +10 -4
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +37 -11
- package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +3 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +15 -4
- package/vscode/src/vs/platform/mcp/common/modelContextProtocolApps.d.ts +576 -0
- package/vscode/src/vs/{workbench/contrib → platform}/mcp/common/modelContextProtocolApps.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +176 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +127 -64
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +12 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +106 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +105 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +13 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +69 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +35 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +187 -78
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +138 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +23 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +394 -87
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +28 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +38 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +113 -116
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +16 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +30 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +250 -132
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +1 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +4 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +9 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +7 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +22 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.js +11 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.d.ts +59 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.js +29 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.js +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +7 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +26 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +53 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +8 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +24 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.js +11 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +62 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +414 -129
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +19 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +263 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +14 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +98 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +11 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +252 -80
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.d.ts +29 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +246 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +39 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +36 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +3 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +6 -260
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.d.ts +5 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +42 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatCodeBlockPill.css +12 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +65 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatHookContentPart.css +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +356 -415
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +14 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +102 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +68 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/codeBlockPart.css +48 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +47 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +57 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +24 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.js +103 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +15 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +44 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +85 -89
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +3 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +15 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +41 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +13 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +21 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +341 -88
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +13 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.js +440 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +24 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +437 -241
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +77 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +521 -284
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +7 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +664 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.d.ts +104 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.js +127 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +12 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +57 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +4 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +89 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +87 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +213 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +15 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +7 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +563 -140
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +35 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +26 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +26 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +145 -79
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +36 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +35 -15
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +127 -30
- 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 +20 -14
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +6 -6
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +96 -34
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +11 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +68 -27
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +125 -13
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +8 -11
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +54 -45
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +11 -10
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +172 -112
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +2 -44
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +28 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +84 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +9 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +58 -41
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.d.ts +1 -548
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +6 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +0 -187
|
@@ -144,6 +144,7 @@ export declare class ChatListWidget extends Disposable {
|
|
|
144
144
|
private _lastItem;
|
|
145
145
|
private _mostRecentlyFocusedItemIndex;
|
|
146
146
|
private _scrollLock;
|
|
147
|
+
private _suppressAutoScroll;
|
|
147
148
|
private _settingChangeCounter;
|
|
148
149
|
private _visibleChangeCount;
|
|
149
150
|
private readonly _container;
|
|
@@ -240,6 +241,11 @@ export declare class ChatListWidget extends Disposable {
|
|
|
240
241
|
* Scroll the list to reveal the last item.
|
|
241
242
|
*/
|
|
242
243
|
scrollToEnd(): void;
|
|
244
|
+
/**
|
|
245
|
+
* Suppress auto-scroll behavior temporarily. While suppressed,
|
|
246
|
+
* _withPersistedAutoScroll will not scroll to bottom after operations.
|
|
247
|
+
*/
|
|
248
|
+
set suppressAutoScroll(value: boolean);
|
|
243
249
|
private _withPersistedAutoScroll;
|
|
244
250
|
/**
|
|
245
251
|
* Focus the list.
|
|
@@ -105,6 +105,7 @@ let ChatListWidget = class ChatListWidget extends Disposable {
|
|
|
105
105
|
this._visible = true;
|
|
106
106
|
this._mostRecentlyFocusedItemIndex = -1;
|
|
107
107
|
this._scrollLock = true;
|
|
108
|
+
this._suppressAutoScroll = false;
|
|
108
109
|
this._settingChangeCounter = 0;
|
|
109
110
|
this._visibleChangeCount = 0;
|
|
110
111
|
this._bodyDimension = null;
|
|
@@ -310,19 +311,19 @@ let ChatListWidget = class ChatListWidget extends Disposable {
|
|
|
310
311
|
collapsible: false
|
|
311
312
|
})));
|
|
312
313
|
const editing = this._viewModel.editing;
|
|
313
|
-
const checkpoint = this._viewModel.model?.checkpoint;
|
|
314
314
|
this._withPersistedAutoScroll(() => {
|
|
315
315
|
this._tree.setChildren(null, treeItems, {
|
|
316
316
|
diffIdentityProvider: {
|
|
317
317
|
getId: element => {
|
|
318
318
|
const baseId = (isRequestVM(element) || isResponseVM(element)) ? element.dataId : element.id;
|
|
319
319
|
const disablement = (isRequestVM(element) || isResponseVM(element)) ? element.shouldBeRemovedOnSend : undefined;
|
|
320
|
+
const isEditTarget = isRequestVM(element) && editing?.id === element.id;
|
|
321
|
+
const isBlocked = (isRequestVM(element) || isResponseVM(element)) ? element.shouldBeBlocked.get() : false;
|
|
320
322
|
return (
|
|
321
323
|
baseId +
|
|
322
324
|
`${isResponseVM(element) && element.renderData ? `_${this._visibleChangeCount}` : ""}` + (isResponseVM(element) ? `_${element.contentReferences.length}` : "") +
|
|
323
325
|
`_${disablement ? `${disablement.afterUndoStop || "1"}` : "0"}` +
|
|
324
|
-
`_${editing ? "1" : "0"}` +
|
|
325
|
-
`_${checkpoint ? "1" : "0"}` +
|
|
326
|
+
`_${isEditTarget ? "edit" : ""}` + `_${isBlocked ? "blocked" : ""}` + (isRequestVM(element) ? `_${editing ? "1" : "0"}` : "") +
|
|
326
327
|
`_setting${this._settingChangeCounter}` + (isRequestVM(element) && element.contentReferences ? `_${element.contentReferences?.length}` : "")
|
|
327
328
|
);
|
|
328
329
|
}
|
|
@@ -417,7 +418,14 @@ let ChatListWidget = class ChatListWidget extends Disposable {
|
|
|
417
418
|
}
|
|
418
419
|
}
|
|
419
420
|
}
|
|
421
|
+
set suppressAutoScroll(value) {
|
|
422
|
+
this._suppressAutoScroll = value;
|
|
423
|
+
}
|
|
420
424
|
_withPersistedAutoScroll(fn) {
|
|
425
|
+
if (this._suppressAutoScroll) {
|
|
426
|
+
fn();
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
421
429
|
const wasScrolledToBottom = this.isScrolledToBottom;
|
|
422
430
|
fn();
|
|
423
431
|
if (wasScrolledToBottom) {
|
|
@@ -473,9 +481,10 @@ let ChatListWidget = class ChatListWidget extends Disposable {
|
|
|
473
481
|
this._container.style.removeProperty("--chat-current-response-min-height");
|
|
474
482
|
} else {
|
|
475
483
|
const secondToLastItem = this._viewModel?.getItems().at(-2);
|
|
484
|
+
const maxRequestShownHeight = 200;
|
|
476
485
|
const secondToLastItemHeight = Math.min(
|
|
477
486
|
(isRequestVM(secondToLastItem) || isResponseVM(secondToLastItem)) ? secondToLastItem.currentRenderedHeight ?? 150 : 150,
|
|
478
|
-
|
|
487
|
+
maxRequestShownHeight
|
|
479
488
|
);
|
|
480
489
|
const lastItemMinHeight = Math.max(contentHeight - (secondToLastItemHeight + 10), 0);
|
|
481
490
|
this._container.style.setProperty("--chat-current-response-min-height", lastItemMinHeight + "px");
|
package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
|
+
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
5
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
6
|
+
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
7
|
+
import { IChatQuestionCarousel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService";
|
|
8
|
+
import { ILanguageModelsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service";
|
|
9
|
+
/**
|
|
10
|
+
* Encapsulates the logic for automatically replying to question carousels,
|
|
11
|
+
* including opt-in state management, LLM-based answer resolution, fallback
|
|
12
|
+
* answer generation, and answer parsing/merging.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ChatQuestionCarouselAutoReply extends Disposable {
|
|
15
|
+
private readonly configService;
|
|
16
|
+
private readonly dialogService;
|
|
17
|
+
private readonly logService;
|
|
18
|
+
private readonly storageService;
|
|
19
|
+
private readonly languageModelsService;
|
|
20
|
+
constructor(configService: IConfigurationService, dialogService: IDialogService, logService: ILogService, storageService: IStorageService, languageModelsService: ILanguageModelsService);
|
|
21
|
+
shouldAutoReply(): Promise<boolean>;
|
|
22
|
+
autoReply(carousel: IChatQuestionCarousel, submit: (answers: Map<string, unknown> | undefined) => Promise<void>, modelName: string | undefined, requestMessageText: string | undefined, token: CancellationToken): Promise<void>;
|
|
23
|
+
private checkOptIn;
|
|
24
|
+
private getModelId;
|
|
25
|
+
private buildPrompt;
|
|
26
|
+
private requestAnswers;
|
|
27
|
+
private parseAnswers;
|
|
28
|
+
private mergeAnswers;
|
|
29
|
+
private hasDefaultValue;
|
|
30
|
+
private resolveAnswerFromRaw;
|
|
31
|
+
private matchQuestionOption;
|
|
32
|
+
buildFallbackCarouselAnswers(carousel: IChatQuestionCarousel, requestMessageText: string | undefined): Map<string, unknown>;
|
|
33
|
+
private getFallbackAnswerForQuestion;
|
|
34
|
+
private tryParseJsonObject;
|
|
35
|
+
}
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
4
|
+
import { toErrorMessage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errorMessage';
|
|
5
|
+
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
6
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
8
|
+
import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
9
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
10
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
11
|
+
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
12
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
13
|
+
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
14
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
15
|
+
import { ChatConfiguration } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
16
|
+
import { ChatMessageRole, getTextResponseFromStream } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
17
|
+
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
18
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
19
|
+
|
|
20
|
+
var AutoReplyStorageKeys;
|
|
21
|
+
(function(AutoReplyStorageKeys) {
|
|
22
|
+
AutoReplyStorageKeys["AutoReplyOptIn"] = "chat.autoReply.optIn";
|
|
23
|
+
})(AutoReplyStorageKeys || (AutoReplyStorageKeys = {}));
|
|
24
|
+
let ChatQuestionCarouselAutoReply = class ChatQuestionCarouselAutoReply extends Disposable {
|
|
25
|
+
constructor(
|
|
26
|
+
configService,
|
|
27
|
+
dialogService,
|
|
28
|
+
logService,
|
|
29
|
+
storageService,
|
|
30
|
+
languageModelsService
|
|
31
|
+
) {
|
|
32
|
+
super();
|
|
33
|
+
this.configService = configService;
|
|
34
|
+
this.dialogService = dialogService;
|
|
35
|
+
this.logService = logService;
|
|
36
|
+
this.storageService = storageService;
|
|
37
|
+
this.languageModelsService = languageModelsService;
|
|
38
|
+
this._register(Event.runAndSubscribe(this.configService.onDidChangeConfiguration, e => {
|
|
39
|
+
if (!e || e.affectsConfiguration(ChatConfiguration.AutoReply)) {
|
|
40
|
+
if (this.configService.getValue(ChatConfiguration.AutoReply) !== true) {
|
|
41
|
+
this.storageService.remove(AutoReplyStorageKeys.AutoReplyOptIn, StorageScope.APPLICATION);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
async shouldAutoReply() {
|
|
47
|
+
if (!this.configService.getValue(ChatConfiguration.AutoReply)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return this.checkOptIn();
|
|
51
|
+
}
|
|
52
|
+
async autoReply(carousel, submit, modelName, requestMessageText, token) {
|
|
53
|
+
if (token.isCancellationRequested || carousel.isUsed || carousel.questions.length === 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const fallbackAnswers = this.buildFallbackCarouselAnswers(carousel, requestMessageText);
|
|
57
|
+
let resolvedAnswers = fallbackAnswers;
|
|
58
|
+
const modelId = await this.getModelId(modelName);
|
|
59
|
+
if (modelId && !token.isCancellationRequested) {
|
|
60
|
+
try {
|
|
61
|
+
const parsedAnswers = await this.requestAnswers(modelId, carousel, requestMessageText, token);
|
|
62
|
+
if (parsedAnswers.size > 0) {
|
|
63
|
+
resolvedAnswers = this.mergeAnswers(carousel, parsedAnswers, fallbackAnswers);
|
|
64
|
+
}
|
|
65
|
+
} catch (err) {
|
|
66
|
+
this.logService.debug("#ChatQuestionCarousel: Failed to resolve auto reply", toErrorMessage(err));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (token.isCancellationRequested || carousel.isUsed) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
await submit(resolvedAnswers);
|
|
73
|
+
}
|
|
74
|
+
async checkOptIn() {
|
|
75
|
+
const optedIn = this.storageService.getBoolean(AutoReplyStorageKeys.AutoReplyOptIn, StorageScope.APPLICATION, false);
|
|
76
|
+
if (optedIn) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
const promptResult = await this.dialogService.prompt({
|
|
80
|
+
type: Severity.Warning,
|
|
81
|
+
message: ( localize(6755, "Enable chat auto reply?")),
|
|
82
|
+
buttons: [{
|
|
83
|
+
label: ( localize(6756, "Enable")),
|
|
84
|
+
run: () => true
|
|
85
|
+
}, {
|
|
86
|
+
label: ( localize(6757, "Disable")),
|
|
87
|
+
run: () => false
|
|
88
|
+
}],
|
|
89
|
+
custom: {
|
|
90
|
+
icon: Codicon.warning,
|
|
91
|
+
disableCloseAction: true,
|
|
92
|
+
markdownDetails: [{
|
|
93
|
+
markdown: ( new MarkdownString(( localize(
|
|
94
|
+
6758,
|
|
95
|
+
"Chat auto reply answers question carousels using the current model and may make unintended choices. Review your settings and outputs carefully."
|
|
96
|
+
))))
|
|
97
|
+
}]
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (promptResult.result !== true) {
|
|
101
|
+
await this.configService.updateValue(ChatConfiguration.AutoReply, false);
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
this.storageService.store(
|
|
105
|
+
AutoReplyStorageKeys.AutoReplyOptIn,
|
|
106
|
+
true,
|
|
107
|
+
StorageScope.APPLICATION,
|
|
108
|
+
StorageTarget.USER
|
|
109
|
+
);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
async getModelId(modelName) {
|
|
113
|
+
if (!modelName) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
let models = await this.languageModelsService.selectLanguageModels({
|
|
117
|
+
id: modelName
|
|
118
|
+
});
|
|
119
|
+
if (models.length > 0) {
|
|
120
|
+
return models[0];
|
|
121
|
+
}
|
|
122
|
+
if (modelName.startsWith("copilot/")) {
|
|
123
|
+
models = await this.languageModelsService.selectLanguageModels({
|
|
124
|
+
vendor: "copilot",
|
|
125
|
+
family: modelName.replace(/^copilot\//, "")
|
|
126
|
+
});
|
|
127
|
+
return models[0];
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
buildPrompt(carousel, requestMessageText, strict) {
|
|
132
|
+
const questions = ( carousel.questions.map(question => ({
|
|
133
|
+
id: question.id,
|
|
134
|
+
type: question.type,
|
|
135
|
+
title: question.title,
|
|
136
|
+
message: typeof question.message === "string" ? question.message : question.message?.value,
|
|
137
|
+
options: question.options?.map(option => ({
|
|
138
|
+
id: option.id,
|
|
139
|
+
label: option.label
|
|
140
|
+
})) ?? [],
|
|
141
|
+
allowFreeformInput: question.allowFreeformInput ?? false
|
|
142
|
+
})));
|
|
143
|
+
const contextLines = [];
|
|
144
|
+
if (requestMessageText) {
|
|
145
|
+
contextLines.push(`Original user request: ${JSON.stringify(requestMessageText)}`);
|
|
146
|
+
}
|
|
147
|
+
return [
|
|
148
|
+
"Choose default answers for the following questions.",
|
|
149
|
+
"Return a JSON object keyed by question id.",
|
|
150
|
+
"For text questions, the value should be a string.",
|
|
151
|
+
"For singleSelect questions, the value should be { \"selectedId\": string } or { \"freeform\": string }.",
|
|
152
|
+
"For multiSelect questions, the value should be { \"selectedIds\": string[] } and may include { \"freeform\": string }.",
|
|
153
|
+
"If a question allows freeform input and has no options, return a freeform answer based on the user request when possible.",
|
|
154
|
+
"Use option ids from the provided options.",
|
|
155
|
+
...contextLines,
|
|
156
|
+
"Questions:",
|
|
157
|
+
JSON.stringify(questions),
|
|
158
|
+
strict ? "Return ONLY valid JSON. Do not include markdown or explanations." : undefined
|
|
159
|
+
].filter(Boolean).join("\n");
|
|
160
|
+
}
|
|
161
|
+
async requestAnswers(modelId, carousel, requestMessageText, token) {
|
|
162
|
+
const prompt = this.buildPrompt(carousel, requestMessageText, false);
|
|
163
|
+
const response = await this.languageModelsService.sendChatRequest(modelId, undefined, [{
|
|
164
|
+
role: ChatMessageRole.User,
|
|
165
|
+
content: [{
|
|
166
|
+
type: "text",
|
|
167
|
+
value: prompt
|
|
168
|
+
}]
|
|
169
|
+
}], {}, token);
|
|
170
|
+
const responseText = await getTextResponseFromStream(response);
|
|
171
|
+
const parsedAnswers = this.parseAnswers(responseText, carousel);
|
|
172
|
+
if (parsedAnswers.size > 0 || token.isCancellationRequested) {
|
|
173
|
+
return parsedAnswers;
|
|
174
|
+
}
|
|
175
|
+
const retryPrompt = this.buildPrompt(carousel, requestMessageText, true);
|
|
176
|
+
const retryResponse = await this.languageModelsService.sendChatRequest(modelId, undefined, [{
|
|
177
|
+
role: ChatMessageRole.User,
|
|
178
|
+
content: [{
|
|
179
|
+
type: "text",
|
|
180
|
+
value: retryPrompt
|
|
181
|
+
}]
|
|
182
|
+
}], {}, token);
|
|
183
|
+
const retryText = await getTextResponseFromStream(retryResponse);
|
|
184
|
+
return this.parseAnswers(retryText, carousel);
|
|
185
|
+
}
|
|
186
|
+
parseAnswers(responseText, carousel) {
|
|
187
|
+
const parsed = this.tryParseJsonObject(responseText);
|
|
188
|
+
if (!parsed) {
|
|
189
|
+
return ( new Map());
|
|
190
|
+
}
|
|
191
|
+
const answers = ( new Map());
|
|
192
|
+
for (const question of carousel.questions) {
|
|
193
|
+
const rawAnswer = parsed[question.id];
|
|
194
|
+
const resolved = this.resolveAnswerFromRaw(question, rawAnswer);
|
|
195
|
+
if (resolved !== undefined) {
|
|
196
|
+
answers.set(question.id, resolved);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return answers;
|
|
200
|
+
}
|
|
201
|
+
mergeAnswers(carousel, resolvedAnswers, fallbackAnswers) {
|
|
202
|
+
const merged = ( new Map());
|
|
203
|
+
for (const question of carousel.questions) {
|
|
204
|
+
const fallback = fallbackAnswers.get(question.id);
|
|
205
|
+
if (this.hasDefaultValue(question) && fallback !== undefined) {
|
|
206
|
+
merged.set(question.id, fallback);
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (( resolvedAnswers.has(question.id))) {
|
|
210
|
+
merged.set(question.id, resolvedAnswers.get(question.id));
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (fallback !== undefined) {
|
|
214
|
+
merged.set(question.id, fallback);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return merged;
|
|
218
|
+
}
|
|
219
|
+
hasDefaultValue(question) {
|
|
220
|
+
switch (question.type) {
|
|
221
|
+
case "text":
|
|
222
|
+
return question.defaultValue !== undefined;
|
|
223
|
+
case "singleSelect":
|
|
224
|
+
return typeof question.defaultValue === "string";
|
|
225
|
+
case "multiSelect":
|
|
226
|
+
return Array.isArray(question.defaultValue) ? question.defaultValue.length > 0 : typeof question.defaultValue === "string";
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
resolveAnswerFromRaw(question, raw) {
|
|
230
|
+
switch (question.type) {
|
|
231
|
+
case "text":
|
|
232
|
+
{
|
|
233
|
+
if (typeof raw === "string") {
|
|
234
|
+
const value = raw.trim();
|
|
235
|
+
return value.length > 0 ? value : undefined;
|
|
236
|
+
}
|
|
237
|
+
if (raw && typeof raw === "object" && hasKey(raw, {
|
|
238
|
+
value: true
|
|
239
|
+
}) && typeof raw.value === "string") {
|
|
240
|
+
const value = raw.value.trim();
|
|
241
|
+
return value.length > 0 ? value : undefined;
|
|
242
|
+
}
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
case "singleSelect":
|
|
246
|
+
{
|
|
247
|
+
let selectedInput;
|
|
248
|
+
let freeformInput;
|
|
249
|
+
if (typeof raw === "string") {
|
|
250
|
+
selectedInput = raw;
|
|
251
|
+
} else if (raw && typeof raw === "object") {
|
|
252
|
+
if (hasKey(raw, {
|
|
253
|
+
selectedId: true
|
|
254
|
+
}) && typeof raw.selectedId === "string") {
|
|
255
|
+
selectedInput = raw.selectedId;
|
|
256
|
+
} else if (hasKey(raw, {
|
|
257
|
+
selectedLabel: true
|
|
258
|
+
}) && typeof raw.selectedLabel === "string") {
|
|
259
|
+
selectedInput = raw.selectedLabel;
|
|
260
|
+
}
|
|
261
|
+
if (hasKey(raw, {
|
|
262
|
+
freeform: true
|
|
263
|
+
}) && typeof raw.freeform === "string") {
|
|
264
|
+
freeformInput = raw.freeform;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (freeformInput && freeformInput.trim().length > 0) {
|
|
268
|
+
return {
|
|
269
|
+
selectedValue: undefined,
|
|
270
|
+
freeformValue: freeformInput.trim()
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
const match = selectedInput ? this.matchQuestionOption(question, selectedInput) : undefined;
|
|
274
|
+
if (match) {
|
|
275
|
+
return {
|
|
276
|
+
selectedValue: match.value,
|
|
277
|
+
freeformValue: undefined
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
return undefined;
|
|
281
|
+
}
|
|
282
|
+
case "multiSelect":
|
|
283
|
+
{
|
|
284
|
+
let selectedInputs = [];
|
|
285
|
+
let freeformInput;
|
|
286
|
+
if (Array.isArray(raw)) {
|
|
287
|
+
selectedInputs = raw.filter(item => typeof item === "string");
|
|
288
|
+
} else if (typeof raw === "string") {
|
|
289
|
+
selectedInputs = ( raw.split(",").map(item => item.trim())).filter(item => item.length > 0);
|
|
290
|
+
} else if (raw && typeof raw === "object") {
|
|
291
|
+
if (hasKey(raw, {
|
|
292
|
+
selectedIds: true
|
|
293
|
+
})) {
|
|
294
|
+
const selectedIdsValue = raw.selectedIds;
|
|
295
|
+
if (Array.isArray(selectedIdsValue)) {
|
|
296
|
+
selectedInputs = selectedIdsValue.filter(item => typeof item === "string");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (hasKey(raw, {
|
|
300
|
+
freeform: true
|
|
301
|
+
}) && typeof raw.freeform === "string") {
|
|
302
|
+
freeformInput = raw.freeform;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const selectedValues = ( selectedInputs.map(input => this.matchQuestionOption(question, input)?.value)).filter(value => value !== undefined);
|
|
306
|
+
const freeformValue = freeformInput?.trim();
|
|
307
|
+
if (selectedValues.length > 0 || (freeformValue && freeformValue.length > 0)) {
|
|
308
|
+
return {
|
|
309
|
+
selectedValues,
|
|
310
|
+
freeformValue
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
return undefined;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
matchQuestionOption(question, rawInput) {
|
|
318
|
+
const options = question.options ?? [];
|
|
319
|
+
if (!options.length) {
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
const normalized = rawInput.trim().toLowerCase();
|
|
323
|
+
const numeric = Number.parseInt(normalized, 10);
|
|
324
|
+
if (!Number.isNaN(numeric) && numeric > 0 && numeric <= options.length) {
|
|
325
|
+
const option = options[numeric - 1];
|
|
326
|
+
return {
|
|
327
|
+
id: option.id,
|
|
328
|
+
value: option.value
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
const exactId = options.find(option => option.id.toLowerCase() === normalized);
|
|
332
|
+
if (exactId) {
|
|
333
|
+
return {
|
|
334
|
+
id: exactId.id,
|
|
335
|
+
value: exactId.value
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
const exactLabel = options.find(option => option.label.toLowerCase() === normalized);
|
|
339
|
+
if (exactLabel) {
|
|
340
|
+
return {
|
|
341
|
+
id: exactLabel.id,
|
|
342
|
+
value: exactLabel.value
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
const partialLabel = options.find(option => option.label.toLowerCase().includes(normalized));
|
|
346
|
+
if (partialLabel) {
|
|
347
|
+
return {
|
|
348
|
+
id: partialLabel.id,
|
|
349
|
+
value: partialLabel.value
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
buildFallbackCarouselAnswers(carousel, requestMessageText) {
|
|
355
|
+
const answers = ( new Map());
|
|
356
|
+
for (const question of carousel.questions) {
|
|
357
|
+
const answer = this.getFallbackAnswerForQuestion(question, requestMessageText);
|
|
358
|
+
if (answer !== undefined) {
|
|
359
|
+
answers.set(question.id, answer);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return answers;
|
|
363
|
+
}
|
|
364
|
+
getFallbackAnswerForQuestion(question, requestMessageText) {
|
|
365
|
+
const fallbackFreeform = requestMessageText?.trim() || ( localize(6759, "OK"));
|
|
366
|
+
switch (question.type) {
|
|
367
|
+
case "text":
|
|
368
|
+
return question.defaultValue ?? fallbackFreeform;
|
|
369
|
+
case "singleSelect":
|
|
370
|
+
{
|
|
371
|
+
const defaultOptionId = typeof question.defaultValue === "string" ? question.defaultValue : undefined;
|
|
372
|
+
const defaultOption = defaultOptionId ? question.options?.find(opt => opt.id === defaultOptionId) : undefined;
|
|
373
|
+
if (defaultOption) {
|
|
374
|
+
return {
|
|
375
|
+
selectedValue: defaultOption.value,
|
|
376
|
+
freeformValue: undefined
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
if (question.options && question.options.length > 0) {
|
|
380
|
+
return {
|
|
381
|
+
selectedValue: question.options[0].value,
|
|
382
|
+
freeformValue: undefined
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
if (question.allowFreeformInput) {
|
|
386
|
+
return {
|
|
387
|
+
selectedValue: undefined,
|
|
388
|
+
freeformValue: fallbackFreeform
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
return undefined;
|
|
392
|
+
}
|
|
393
|
+
case "multiSelect":
|
|
394
|
+
{
|
|
395
|
+
const defaultIds = Array.isArray(question.defaultValue) ? question.defaultValue : (typeof question.defaultValue === "string" ? [question.defaultValue] : []);
|
|
396
|
+
const selectedValues = question.options?.filter(opt => defaultIds.includes(opt.id)).map(opt => opt.value).filter(value => value !== undefined) ?? [];
|
|
397
|
+
if (selectedValues.length > 0) {
|
|
398
|
+
return {
|
|
399
|
+
selectedValues,
|
|
400
|
+
freeformValue: undefined
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
if (question.options && question.options.length > 0) {
|
|
404
|
+
return {
|
|
405
|
+
selectedValues: [question.options[0].value],
|
|
406
|
+
freeformValue: undefined
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
if (question.allowFreeformInput) {
|
|
410
|
+
return {
|
|
411
|
+
selectedValues: [],
|
|
412
|
+
freeformValue: fallbackFreeform
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
return undefined;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
tryParseJsonObject(text) {
|
|
420
|
+
const trimmed = text.trim();
|
|
421
|
+
if (!trimmed) {
|
|
422
|
+
return undefined;
|
|
423
|
+
}
|
|
424
|
+
const start = trimmed.indexOf("{");
|
|
425
|
+
const end = trimmed.lastIndexOf("}");
|
|
426
|
+
const candidate = start >= 0 && end > start ? trimmed.slice(start, end + 1) : trimmed;
|
|
427
|
+
try {
|
|
428
|
+
const parsed = JSON.parse(candidate);
|
|
429
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
430
|
+
return parsed;
|
|
431
|
+
}
|
|
432
|
+
} catch {
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
435
|
+
return undefined;
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
ChatQuestionCarouselAutoReply = ( __decorate([( __param(0, IConfigurationService)), ( __param(1, IDialogService)), ( __param(2, ILogService)), ( __param(3, IStorageService)), ( __param(4, ILanguageModelsService))], ChatQuestionCarouselAutoReply));
|
|
439
|
+
|
|
440
|
+
export { ChatQuestionCarouselAutoReply };
|