@codingame/monaco-vscode-katex-common 27.0.0 → 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.
Files changed (181) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +2 -0
  3. package/vscode/src/vs/platform/actions/browser/buttonbar.js +2 -2
  4. package/vscode/src/vs/platform/mcp/common/modelContextProtocolApps.d.ts +30 -2
  5. package/vscode/src/vs/platform/mcp/common/modelContextProtocolApps.js +1 -0
  6. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +15 -15
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +17 -11
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +5 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +90 -43
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +10 -10
  12. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.d.ts +26 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +106 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
  15. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +6 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +63 -10
  17. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +1 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +13 -10
  19. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +2 -2
  20. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +28 -2
  21. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +133 -28
  22. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +69 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +55 -46
  24. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +10 -10
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +38 -37
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +5 -5
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +1 -1
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +1 -1
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +2 -2
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +72 -57
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +4 -4
  35. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +1 -16
  36. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +4 -110
  37. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
  38. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.d.ts +1 -1
  39. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
  40. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.d.ts +1 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
  42. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.d.ts +1 -1
  45. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +1 -1
  47. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +1 -1
  48. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -1
  49. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
  50. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
  52. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -1
  53. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
  54. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.d.ts +59 -0
  55. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.js +29 -0
  56. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.d.ts +1 -1
  57. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +2 -2
  58. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +1 -1
  59. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +1 -1
  60. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.d.ts +1 -1
  61. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +1 -1
  62. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
  63. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.d.ts +1 -1
  64. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +3 -3
  65. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +13 -13
  66. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +1 -1
  67. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +8 -6
  68. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.d.ts +15 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.js +55 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +1 -1
  71. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +6 -6
  72. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
  74. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +1 -1
  75. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +6 -4
  76. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +1 -1
  77. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +26 -6
  78. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +290 -126
  79. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +1 -1
  80. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
  81. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +1 -1
  82. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +9 -7
  83. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.d.ts +22 -0
  84. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +263 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +1 -1
  86. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +6 -6
  87. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +5 -5
  88. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +1 -1
  89. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +1 -1
  90. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
  91. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +1 -1
  92. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +22 -13
  93. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +12 -18
  94. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +17 -17
  95. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +1 -1
  96. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +2 -2
  97. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +3 -13
  98. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +6 -260
  99. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +1 -1
  100. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
  101. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +1 -1
  102. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
  103. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
  104. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +17 -0
  105. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +129 -117
  106. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +0 -1
  107. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +1 -1
  108. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +1 -1
  109. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +1 -1
  110. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
  111. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +1 -1
  112. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +8 -1
  113. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +56 -3
  114. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +5 -1
  115. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +20 -4
  116. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +1 -1
  117. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.d.ts +1 -1
  118. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +1 -1
  119. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +15 -15
  120. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +43 -1
  121. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +42 -41
  122. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +2 -4
  123. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +14 -14
  124. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +1 -1
  125. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +1 -1
  126. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
  127. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +3 -3
  128. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +1 -1
  129. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +5 -5
  130. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +1 -1
  131. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +1 -1
  132. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
  133. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +4 -2
  134. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +61 -39
  135. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.js +7 -8
  136. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +1 -10
  137. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +81 -191
  138. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
  139. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +31 -17
  140. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +334 -181
  141. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +1 -1
  142. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +7 -1
  143. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +3 -0
  144. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +51 -55
  145. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.d.ts +104 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.js +127 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +5 -5
  148. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +2 -1
  149. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +16 -9
  150. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +2 -1
  151. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +22 -0
  152. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +213 -0
  153. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +1 -0
  154. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +10 -16
  155. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +6 -4
  156. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +174 -10
  157. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +2 -12
  158. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +12 -16
  159. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +1 -0
  160. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +5 -1
  161. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +36 -50
  162. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +19 -4
  163. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +22 -6
  164. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +15 -15
  165. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +3 -1
  166. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +24 -4
  167. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +3 -3
  168. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +5 -5
  169. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
  170. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
  171. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +2 -2
  172. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +1 -1
  173. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +3 -3
  174. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +1 -1
  175. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +38 -46
  176. package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
  177. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
  178. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
  179. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
  180. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
  181. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +6 -10
@@ -16,7 +16,7 @@ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/even
16
16
  import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
17
17
  import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
18
18
  import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
19
- import { Disposable, MutableDisposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
19
+ import { Disposable, MutableDisposable, DisposableMap, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
20
20
  import { ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
21
21
  import { MarshalledId } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
22
22
  import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
@@ -76,23 +76,23 @@ import { getSimpleEditorOptions, getSimpleCodeEditorWidgetOptions, setupSimpleEd
76
76
  import { InlineChatConfigKeys } from '../../../../inlineChat/common/inlineChat.js';
77
77
  import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
78
78
  import { ChatRequestVariableSet, isImageVariableEntry, isStringVariableEntry, isNotebookOutputVariableEntry, isPromptFileVariableEntry, isPromptTextVariableEntry, isElementVariableEntry, isPasteVariableEntry, isSCMHistoryItemVariableEntry, isSCMHistoryItemChangeVariableEntry, isSCMHistoryItemChangeRangeVariableEntry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
79
- import { ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes';
79
+ import { getModeNameForTelemetry, ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes';
80
80
  import { IChatModeService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes.service';
81
81
  import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
82
82
  import { agentOptionId, localChatSessionType, isIChatSessionFileChange2 } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
83
83
  import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
84
- import { ChatAgentLocation, ChatModeKind, ChatConfiguration, validateChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
84
+ import { ChatAgentLocation, ChatModeKind, ChatPermissionLevel, ChatConfiguration, isAutoApproveLevel, validateChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
85
85
  import { ModifiedFileEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/editing/chatEditingService';
86
86
  import { ILanguageModelChatMetadata } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
87
87
  import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
88
- import { ChatQuestionCarouselData } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatQuestionCarouselData';
88
+ import { shouldResetOnModelListChange, shouldRestorePersistedModel, shouldRestoreLateArrivingModel, resolveModelFromSyncState, shouldResetModelToDefault, mergeModelsWithCache, filterModelsForSession, hasModelsTargetingSession, isModelValidForSession, findDefaultModel } from './chatModelSelectionLogic.js';
89
89
  import { getChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
90
90
  import { isResponseVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel';
91
91
  import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents.service';
92
92
  import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
93
93
  import { ChatHistoryNavigator } from '../../../common/widget/chatWidgetHistoryService.js';
94
- import { ChatSubmitAction, OpenModelPickerAction, OpenModePickerAction, OpenSessionTargetPickerAction, OpenDelegationPickerAction, OpenWorkspacePickerAction, ChatSessionPrimaryPickerAction } from '../../actions/chatExecuteActions.js';
95
- import { AgentSessionProviders, getAgentSessionProvider } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
94
+ import { ChatSubmitAction, OpenModelPickerAction, OpenModePickerAction, OpenSessionTargetPickerAction, OpenDelegationPickerAction, OpenWorkspacePickerAction, ChatSessionPrimaryPickerAction, OpenPermissionPickerAction } from '../../actions/chatExecuteActions.js';
95
+ import { getAgentSessionProvider, AgentSessionProviders } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
96
96
  import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
97
97
  import { ChatAttachmentModel } from '../../attachments/chatAttachmentModel.js';
98
98
  import { IChatAttachmentWidgetRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgetRegistry.service';
@@ -114,20 +114,33 @@ import { ChatInputPartWidgetController } from './chatInputPartWidgets.js';
114
114
  import { ChatSelectedTools } from './chatSelectedTools.js';
115
115
  import { DelegationSessionPickerActionItem } from './delegationSessionPickerActionItem.js';
116
116
  import { ModePickerActionItem } from './modePickerActionItem.js';
117
+ import { PermissionPickerActionItem } from './permissionPickerActionItem.js';
117
118
  import { SessionTypePickerActionItem } from './sessionTargetPickerActionItem.js';
118
119
  import { WorkspacePickerActionItem } from './workspacePickerActionItem.js';
119
120
  import { ChatContextUsageWidget } from '../../widgetHosts/viewPane/chatContextUsageWidget.js';
120
- import { Target } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService';
121
+ import { Target } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
121
122
  import { EnhancedModelPickerActionItem } from './modelPickerActionItem2.js';
122
123
  import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
123
124
  import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
125
+ import { derived, derivedOpts } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
124
126
  import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
125
- import { derivedOpts, derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
126
127
 
127
128
  var ChatInputPart_1;
128
129
  const $ = $$1;
129
130
  const INPUT_EDITOR_MAX_HEIGHT = 250;
131
+ const INPUT_EDITOR_LINE_HEIGHT = 20;
132
+ const INPUT_EDITOR_PADDING = {
133
+ compact: {
134
+ top: 2,
135
+ bottom: 2
136
+ },
137
+ default: {
138
+ top: 12,
139
+ bottom: 12
140
+ }
141
+ };
130
142
  const CachedLanguageModelsKey = "chat.cachedLanguageModels.v2";
143
+ const CHAT_INPUT_PICKER_COLLAPSE_WIDTH = 320;
131
144
  var ChatWidgetLocation;
132
145
  (function(ChatWidgetLocation) {
133
146
  ChatWidgetLocation["SidebarLeft"] = "sidebarLeft";
@@ -164,7 +177,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
164
177
  get attachmentModel() {
165
178
  return this._attachmentModel;
166
179
  }
167
- getAttachedContext(sessionResource) {
180
+ getAttachedContext() {
168
181
  const contextArr = ( new ChatRequestVariableSet());
169
182
  contextArr.add(
170
183
  ...this.attachmentModel.attachments,
@@ -172,8 +185,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
172
185
  );
173
186
  return contextArr;
174
187
  }
175
- getAttachedAndImplicitContext(sessionResource) {
176
- const contextArr = this.getAttachedContext(sessionResource);
188
+ getAttachedAndImplicitContext() {
189
+ const contextArr = this.getAttachedContext();
177
190
  if (this.implicitContext) {
178
191
  const implicitChatVariables = this.implicitContext.enabledBaseEntries(
179
192
  this.configurationService.getValue("chat.implicitContext.suggestedContext")
@@ -207,6 +220,9 @@ let ChatInputPart = class ChatInputPart extends Disposable {
207
220
  get currentModeObs() {
208
221
  return this._currentModeObservable;
209
222
  }
223
+ get currentPermissionLevelObs() {
224
+ return this._currentPermissionLevel;
225
+ }
210
226
  get currentModeInfo() {
211
227
  const mode = this._currentModeObservable.get();
212
228
  const modeId = mode.isBuiltin ? this.currentModeKind : "custom";
@@ -215,13 +231,17 @@ let ChatInputPart = class ChatInputPart extends Disposable {
215
231
  kind: this.currentModeKind,
216
232
  isBuiltin: mode.isBuiltin,
217
233
  modeInstructions: modeInstructions ? {
234
+ uri: mode.uri?.get(),
218
235
  name: mode.name.get(),
219
236
  content: modeInstructions.content,
220
237
  toolReferences: this.toolService.toToolReferences(modeInstructions.toolReferences),
221
- metadata: modeInstructions.metadata
238
+ metadata: modeInstructions.metadata,
239
+ isBuiltin: mode.isBuiltin
222
240
  } : undefined,
223
241
  modeId: modeId,
224
- applyCodeBlockSuggestionId: undefined
242
+ modeName: getModeNameForTelemetry(mode),
243
+ applyCodeBlockSuggestionId: undefined,
244
+ permissionLevel: this._currentPermissionLevel.get()
225
245
  };
226
246
  }
227
247
  get selectedElements() {
@@ -306,12 +326,19 @@ let ChatInputPart = class ChatInputPart extends Disposable {
306
326
  this.viewDescriptorService = viewDescriptorService;
307
327
  this._chatAttachmentWidgetRegistry = _chatAttachmentWidgetRegistry;
308
328
  this._workingSetCollapsed = observableValue("chatInputPart.workingSetCollapsed", true);
329
+ this._stableInputPartWidth = observableValue("chatInputPart.stableInputPartWidth", 0);
309
330
  this._chatInputTodoListWidget = this._register(( new MutableDisposable()));
310
- this._chatQuestionCarouselWidget = this._register(( new MutableDisposable()));
311
- this._chatQuestionCarouselDisposables = this._register(( new DisposableStore()));
331
+ this._chatQuestionCarouselWidgets = this._register(( new DisposableMap()));
332
+ this._questionCarouselResponseIds = ( new Map());
333
+ this._questionCarouselSessionResources = ( new Map());
312
334
  this._chatEditingTodosDisposables = this._register(( new DisposableStore()));
313
335
  this._onDidLoadInputState = this._register(( new Emitter()));
314
336
  this.onDidLoadInputState = this._onDidLoadInputState.event;
337
+ this._toolbarRelayoutScheduler = this._register(( new RunOnceScheduler(() => {
338
+ if (typeof this.cachedWidth === "number") {
339
+ this.layout(this.cachedWidth);
340
+ }
341
+ }, 0)));
315
342
  this._onDidFocus = this._register(( new Emitter()));
316
343
  this.onDidFocus = this._onDidFocus.event;
317
344
  this._onDidBlur = this._register(( new Emitter()));
@@ -359,6 +386,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
359
386
  onDidChangeVisibility: this._onDidChangeVisibility.event
360
387
  }));
361
388
  this._currentModeObservable = observableValue("currentMode", this.options.defaultMode ?? ChatMode.Agent);
389
+ this._currentPermissionLevel = observableValue("permissionLevel", ChatPermissionLevel.Default);
362
390
  this._register(this.editorService.onDidActiveEditorChange(() => {
363
391
  this._indexOfLastOpenedContext = -1;
364
392
  this.refreshChatSessionPickers();
@@ -398,6 +426,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
398
426
  this.instantiationService.createInstance(ChatDragAndDrop, () => this._widget, this._attachmentModel, styles)
399
427
  );
400
428
  this.inputEditorMaxHeight = this.options.renderStyle === "compact" ? INPUT_EDITOR_MAX_HEIGHT / 3 : INPUT_EDITOR_MAX_HEIGHT;
429
+ const padding = this.options.renderStyle === "compact" ? INPUT_EDITOR_PADDING.compact : INPUT_EDITOR_PADDING.default;
430
+ this.inputEditorMinHeight = this.options.inputEditorMinLines ? this.options.inputEditorMinLines * INPUT_EDITOR_LINE_HEIGHT + padding.top + padding.bottom : undefined;
401
431
  this.inputEditorHasText = ChatContextKeys.inputHasText.bindTo(contextKeyService);
402
432
  this.chatCursorAtTop = ChatContextKeys.inputCursorAtTop.bindTo(contextKeyService);
403
433
  this.inputEditorHasFocus = ChatContextKeys.inputHasFocus.bindTo(contextKeyService);
@@ -405,6 +435,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
405
435
  this.chatModeKindKey = ChatContextKeys.chatModeKind.bindTo(contextKeyService);
406
436
  this.chatModeNameKey = ChatContextKeys.chatModeName.bindTo(contextKeyService);
407
437
  this.chatModelIdKey = ChatContextKeys.chatModelId.bindTo(contextKeyService);
438
+ this.permissionLevelKey = ChatContextKeys.chatPermissionLevel.bindTo(contextKeyService);
408
439
  this.withinEditSessionKey = ChatContextKeys.withinEditSessionDiff.bindTo(contextKeyService);
409
440
  this.filePartOfEditSessionKey = ChatContextKeys.filePartOfEditSession.bindTo(contextKeyService);
410
441
  this.chatSessionHasOptions = ChatContextKeys.chatSessionHasModels.bindTo(contextKeyService);
@@ -451,8 +482,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
451
482
  this._hasFileAttachmentContextKey = ChatContextKeys.hasFileAttachments.bindTo(contextKeyService);
452
483
  this.initSelectedModel();
453
484
  this._register(this.languageModelsService.onDidChangeLanguageModels(() => {
454
- const selectedModel = this._currentLanguageModel ? this.getModels().find(m => m.identifier === this._currentLanguageModel.get()?.identifier) : undefined;
455
- if (!this.currentLanguageModel || !selectedModel) {
485
+ if (shouldResetOnModelListChange(this._currentLanguageModel.get()?.identifier, this.getModels())) {
456
486
  this.setCurrentLanguageModelToDefault();
457
487
  }
458
488
  }));
@@ -494,12 +524,21 @@ let ChatInputPart = class ChatInputPart extends Disposable {
494
524
  if (sessionResource) {
495
525
  const ctx = this.chatService.getChatSessionFromInternalUri(sessionResource);
496
526
  if (ctx) {
497
- this.chatSessionsService.notifySessionOptionsChange(ctx.chatSessionResource, [{
498
- optionId: agentOptionId,
499
- value: mode.isBuiltin ? "" : modeName
500
- }]).catch(
501
- err => this.logService.error("Failed to notify extension of agent change:", err)
502
- );
527
+ let needsUpdate = true;
528
+ const agentOption = this.chatSessionsService.getSessionOption(ctx.chatSessionResource, agentOptionId);
529
+ if (typeof agentOption !== "undefined") {
530
+ const agentId = (typeof agentOption === "string" ? agentOption : agentOption.id) || ChatMode.Agent.id;
531
+ const isDefaultAgent = agentId === ChatMode.Agent.id;
532
+ needsUpdate = isDefaultAgent ? mode.id !== ChatMode.Agent.id : mode.label.read(undefined) !== agentId;
533
+ }
534
+ if (needsUpdate) {
535
+ this.chatSessionsService.notifySessionOptionsChange(ctx.chatSessionResource, [{
536
+ optionId: agentOptionId,
537
+ value: mode.isBuiltin ? "" : modeName
538
+ }]).catch(
539
+ err => this.logService.error("Failed to notify extension of agent change:", err)
540
+ );
541
+ }
503
542
  }
504
543
  }
505
544
  }));
@@ -532,25 +571,22 @@ let ChatInputPart = class ChatInputPart extends Disposable {
532
571
  const persistedSelection = this.storageService.get(this.getSelectedModelStorageKey(), StorageScope.APPLICATION);
533
572
  const persistedAsDefault = this.storageService.getBoolean(this.getSelectedModelIsDefaultStorageKey(), StorageScope.APPLICATION, true);
534
573
  if (persistedSelection) {
535
- const model = this.getModels().find(m => m.identifier === persistedSelection);
536
- if (model) {
537
- if (!persistedAsDefault || model.metadata.isDefaultForLocation[this.location]) {
538
- this.setCurrentLanguageModel(model);
539
- this.checkModelSupported();
540
- }
541
- } else {
574
+ const result = shouldRestorePersistedModel(persistedSelection, persistedAsDefault, this.getModels(), this.location);
575
+ if (result.shouldRestore && result.model) {
576
+ this.setCurrentLanguageModel(result.model);
577
+ this.checkModelSupported();
578
+ } else if (!result.model) {
542
579
  this._waitForPersistedLanguageModel.value = this.languageModelsService.onDidChangeLanguageModels(e => {
543
580
  const persistedModel = this.languageModelsService.lookupLanguageModel(persistedSelection);
544
581
  if (persistedModel) {
545
582
  this._waitForPersistedLanguageModel.clear();
546
- if (!persistedAsDefault || persistedModel.isDefaultForLocation[this.location]) {
547
- if (persistedModel.isUserSelectable) {
548
- this.setCurrentLanguageModel({
549
- metadata: persistedModel,
550
- identifier: persistedSelection
551
- });
552
- this.checkModelSupported();
553
- }
583
+ const lateModel = {
584
+ metadata: persistedModel,
585
+ identifier: persistedSelection
586
+ };
587
+ if (shouldRestoreLateArrivingModel(persistedSelection, persistedAsDefault, lateModel, this.location)) {
588
+ this.setCurrentLanguageModel(lateModel);
589
+ this.checkModelSupported();
554
590
  }
555
591
  } else {
556
592
  this.setCurrentLanguageModelToDefault();
@@ -561,11 +597,6 @@ let ChatInputPart = class ChatInputPart extends Disposable {
561
597
  this._register(this._onDidChangeCurrentChatMode.event(() => {
562
598
  this.checkModelSupported();
563
599
  }));
564
- this._register(this.configurationService.onDidChangeConfiguration(e => {
565
- if (e.affectsConfiguration(ChatConfiguration.Edits2Enabled)) {
566
- this.checkModelSupported();
567
- }
568
- }));
569
600
  }
570
601
  setEditing(enabled, editingSentRequest) {
571
602
  this.currentlyEditingInputKey?.set(enabled);
@@ -610,6 +641,14 @@ let ChatInputPart = class ChatInputPart extends Disposable {
610
641
  openModePicker() {
611
642
  this.modeWidget?.show();
612
643
  }
644
+ openPermissionPicker() {
645
+ this.permissionWidget?.show();
646
+ }
647
+ setPermissionLevel(level) {
648
+ this._currentPermissionLevel.set(level, undefined);
649
+ this.permissionLevelKey.set(level);
650
+ this.permissionWidget?.refresh();
651
+ }
613
652
  openSessionTargetPicker() {
614
653
  this.sessionTargetWidget?.show();
615
654
  }
@@ -684,6 +723,11 @@ let ChatInputPart = class ChatInputPart extends Disposable {
684
723
  this._modelSyncDisposables.clear();
685
724
  this.selectedToolsModel.resetSessionEnablementState();
686
725
  this._chatSessionIsEmpty = chatSessionIsEmpty;
726
+ if (chatSessionIsEmpty && !this.configurationService.getValue(ChatConfiguration.GlobalAutoApprove) && !isAutoApproveLevel(this._currentPermissionLevel.get())) {
727
+ this._currentPermissionLevel.set(ChatPermissionLevel.Default, undefined);
728
+ this.permissionLevelKey.set(ChatPermissionLevel.Default);
729
+ this.permissionWidget?.refresh();
730
+ }
687
731
  if (chatSessionIsEmpty) {
688
732
  this._setEmptyModelState();
689
733
  }
@@ -729,13 +773,24 @@ let ChatInputPart = class ChatInputPart extends Disposable {
729
773
  }
730
774
  }
731
775
  if (state?.selectedModel) {
732
- const lm = this._currentLanguageModel.get();
733
- if (!lm || lm.identifier !== state.selectedModel.identifier) {
734
- if (this.isModelValidForCurrentSession(state.selectedModel)) {
735
- this.setCurrentLanguageModel(state.selectedModel);
736
- } else {
737
- this.setCurrentLanguageModelToDefault();
776
+ const allModels = this.getAllMergedModels();
777
+ const sessionType = this.getCurrentSessionType();
778
+ const syncResult = resolveModelFromSyncState(
779
+ state.selectedModel,
780
+ this._currentLanguageModel.get(),
781
+ allModels,
782
+ sessionType,
783
+ {
784
+ location: this.location,
785
+ currentModeKind: this.currentModeKind,
786
+ isInlineChatV2Enabled: !!this.configurationService.getValue(InlineChatConfigKeys.EnableV2),
787
+ sessionType
738
788
  }
789
+ );
790
+ if (syncResult.action === "apply") {
791
+ this.setCurrentLanguageModel(state.selectedModel);
792
+ } else if (syncResult.action === "default") {
793
+ this.setCurrentLanguageModelToDefault();
739
794
  }
740
795
  }
741
796
  const currentAttachments = this._attachmentModel.attachments;
@@ -792,7 +847,13 @@ let ChatInputPart = class ChatInputPart extends Disposable {
792
847
  }
793
848
  checkModelSupported() {
794
849
  const lm = this._currentLanguageModel.get();
795
- if (lm && (!this.modelSupportedForDefaultAgent(lm) || !this.modelSupportedForInlineChat(lm) || !this.isModelValidForCurrentSession(lm))) {
850
+ const allModels = this.getAllMergedModels();
851
+ if (shouldResetModelToDefault(lm, this.getModels(), {
852
+ location: this.location,
853
+ currentModeKind: this.currentModeKind,
854
+ isInlineChatV2Enabled: !!this.configurationService.getValue(InlineChatConfigKeys.EnableV2),
855
+ sessionType: this.getCurrentSessionType()
856
+ }, allModels)) {
796
857
  this.setCurrentLanguageModelToDefault();
797
858
  }
798
859
  }
@@ -800,7 +861,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
800
861
  if (!this.options.supportsChangingModes) {
801
862
  return;
802
863
  }
803
- const mode2 = this.chatModeService.findModeById(mode) ?? this.chatModeService.findModeById(ChatModeKind.Agent) ?? ChatMode.Ask;
864
+ const mode2 = this.chatModeService.findModeById(mode) ?? this.chatModeService.findModeByName(mode) ?? this.chatModeService.findModeById(ChatModeKind.Agent) ?? ChatMode.Ask;
804
865
  this.setChatMode2(mode2, storeSelection);
805
866
  }
806
867
  setChatMode2(mode, storeSelection = true) {
@@ -811,47 +872,33 @@ let ChatInputPart = class ChatInputPart extends Disposable {
811
872
  this._onDidChangeCurrentChatMode.fire();
812
873
  this._syncInputStateToModel();
813
874
  }
814
- modelSupportedForDefaultAgent(model) {
815
- if (this.currentModeKind === ChatModeKind.Agent || (this.currentModeKind === ChatModeKind.Edit && this.configurationService.getValue(ChatConfiguration.Edits2Enabled))) {
816
- return ILanguageModelChatMetadata.suitableForAgentMode(model.metadata);
817
- }
818
- return true;
819
- }
820
- modelSupportedForInlineChat(model) {
821
- if (this.location !== ChatAgentLocation.EditorInline || !this.configurationService.getValue(InlineChatConfigKeys.EnableV2)) {
822
- return true;
823
- }
824
- return !!model.metadata.capabilities?.toolCalling;
825
- }
826
- getModels() {
875
+ getAllMergedModels() {
827
876
  const cachedModels = this.storageService.getObject(CachedLanguageModelsKey, StorageScope.APPLICATION, []);
828
877
  const liveModels = ( this.languageModelsService.getLanguageModelIds().map(modelId => ({
829
878
  identifier: modelId,
830
879
  metadata: this.languageModelsService.lookupLanguageModel(modelId)
831
880
  })));
832
- let models;
881
+ const contributedVendors = ( new Set(( this.languageModelsService.getVendors().map(v => v.vendor))));
882
+ const models = mergeModelsWithCache(liveModels, cachedModels, contributedVendors);
833
883
  if (liveModels.length > 0) {
834
- const liveVendors = ( new Set(( liveModels.map(m => m.metadata.vendor))));
835
- const contributedVendors = ( new Set(( this.languageModelsService.getVendors().map(v => v.vendor))));
836
- models = [...liveModels, ...cachedModels.filter(m => !( liveVendors.has(m.metadata.vendor)) && ( contributedVendors.has(m.metadata.vendor)))];
837
884
  this.storageService.store(
838
885
  CachedLanguageModelsKey,
839
886
  models,
840
887
  StorageScope.APPLICATION,
841
888
  StorageTarget.MACHINE
842
889
  );
843
- } else {
844
- models = cachedModels;
845
890
  }
891
+ return models;
892
+ }
893
+ getModels() {
894
+ const models = this.getAllMergedModels();
846
895
  models.sort((a, b) => a.metadata.name.localeCompare(b.metadata.name));
847
- const sessionType = this.getCurrentSessionType();
848
- if (sessionType && sessionType !== AgentSessionProviders.Local) {
849
- return models.filter(
850
- entry => entry.metadata?.targetChatSessionType === sessionType && entry.metadata?.isUserSelectable
851
- );
852
- }
853
- return models.filter(
854
- entry => !entry.metadata?.targetChatSessionType && entry.metadata?.isUserSelectable && this.modelSupportedForDefaultAgent(entry) && this.modelSupportedForInlineChat(entry)
896
+ return filterModelsForSession(
897
+ models,
898
+ this.getCurrentSessionType(),
899
+ this.currentModeKind,
900
+ this.location,
901
+ !!this.configurationService.getValue(InlineChatConfigKeys.EnableV2)
855
902
  );
856
903
  }
857
904
  getCurrentSessionType() {
@@ -864,20 +911,10 @@ let ChatInputPart = class ChatInputPart extends Disposable {
864
911
  return ctx?.chatSessionType;
865
912
  }
866
913
  hasModelsTargetingSessionType() {
867
- const sessionType = this.getCurrentSessionType();
868
- if (!sessionType) {
869
- return false;
870
- }
871
- return ( this.languageModelsService.getLanguageModelIds().some(modelId => {
872
- const metadata = this.languageModelsService.lookupLanguageModel(modelId);
873
- return metadata?.targetChatSessionType === sessionType;
874
- }));
914
+ return hasModelsTargetingSession(this.getAllMergedModels(), this.getCurrentSessionType());
875
915
  }
876
916
  isModelValidForCurrentSession(model) {
877
- if (this.hasModelsTargetingSessionType()) {
878
- return model.metadata.targetChatSessionType === this.getCurrentSessionType();
879
- }
880
- return !model.metadata.targetChatSessionType;
917
+ return isModelValidForSession(model, this.getAllMergedModels(), this.getCurrentSessionType());
881
918
  }
882
919
  checkModelInSessionPool() {
883
920
  const lm = this._currentLanguageModel.get();
@@ -929,7 +966,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
929
966
  }
930
967
  setCurrentLanguageModelToDefault() {
931
968
  const allModels = this.getModels();
932
- const defaultModel = allModels.find(m => m.metadata.isDefaultForLocation[this.location]) || allModels[0];
969
+ const defaultModel = findDefaultModel(allModels, this.location);
933
970
  if (defaultModel) {
934
971
  this.setCurrentLanguageModel(defaultModel);
935
972
  }
@@ -960,40 +997,40 @@ let ChatInputPart = class ChatInputPart extends Disposable {
960
997
  }
961
998
  const mode = this._currentModeObservable.get();
962
999
  const modelName = this._currentLanguageModel.get()?.metadata.name;
963
- const modelInfo = modelName ? ( localize(6689, ", {0}. ", modelName)) : "";
1000
+ const modelInfo = modelName ? ( localize(6776, ", {0}. ", modelName)) : "";
964
1001
  let modeLabel = "";
965
1002
  if (!mode.isBuiltin) {
966
1003
  const mode = this.currentModeObs.get();
967
- modeLabel = ( localize(6690, "({0}), {1}", mode.label.get(), mode.description.get()));
1004
+ modeLabel = ( localize(6777, "({0}), {1}", mode.label.get(), mode.description.get()));
968
1005
  } else {
969
1006
  switch (this.currentModeKind) {
970
1007
  case ChatModeKind.Agent:
971
- modeLabel = ( localize(6691, "(Agent), edit files in your workspace."));
1008
+ modeLabel = ( localize(6778, "(Agent), edit files in your workspace."));
972
1009
  break;
973
1010
  case ChatModeKind.Edit:
974
- modeLabel = ( localize(6692, "(Edit), edit files in your workspace."));
1011
+ modeLabel = ( localize(6779, "(Edit), edit files in your workspace."));
975
1012
  break;
976
1013
  case ChatModeKind.Ask:
977
1014
  default:
978
- modeLabel = ( localize(6693, "(Ask), ask questions or type / for topics."));
1015
+ modeLabel = ( localize(6780, "(Ask), ask questions or type / for topics."));
979
1016
  break;
980
1017
  }
981
1018
  }
982
1019
  if (verbose) {
983
1020
  return kbLabel ? ( localize(
984
- 6694,
1021
+ 6781,
985
1022
  "Chat Input {0}{1} Press Enter to send out the request. Use {2} for Chat Accessibility Help.",
986
1023
  modeLabel,
987
1024
  modelInfo,
988
1025
  kbLabel
989
1026
  )) : ( localize(
990
- 6695,
1027
+ 6782,
991
1028
  "Chat Input {0}{1} Press Enter to send out the request. Use the Chat Accessibility Help command for more information.",
992
1029
  modeLabel,
993
1030
  modelInfo
994
1031
  ));
995
1032
  } else {
996
- return localize(6696, "Chat Input {0}{1}.", modeLabel, modelInfo);
1033
+ return localize(6783, "Chat Input {0}{1}.", modeLabel, modelInfo);
997
1034
  }
998
1035
  }
999
1036
  validateCurrentChatMode() {
@@ -1462,15 +1499,24 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1462
1499
  this.refreshChatSessionPickers();
1463
1500
  this.tryUpdateWidgetController();
1464
1501
  this.updateContextUsageWidget();
1465
- if (this._currentQuestionCarouselSessionResource && (!e.currentSessionResource || !isEqual(this._currentQuestionCarouselSessionResource, e.currentSessionResource))) {
1502
+ let hasMatchingResource = false;
1503
+ if (e.currentSessionResource) {
1504
+ for (const r of ( this._questionCarouselSessionResources.values())) {
1505
+ if (isEqual(r, e.currentSessionResource)) {
1506
+ hasMatchingResource = true;
1507
+ break;
1508
+ }
1509
+ }
1510
+ }
1511
+ if (this._questionCarouselSessionResources.size > 0 && (!e.currentSessionResource || !hasMatchingResource)) {
1466
1512
  this.clearQuestionCarousel();
1467
1513
  }
1468
1514
  const newSessionType = this.getCurrentSessionType();
1469
- if (newSessionType !== this._currentSessionType) {
1515
+ if (e.currentSessionResource && newSessionType !== this._currentSessionType) {
1470
1516
  this._currentSessionType = newSessionType;
1471
1517
  this.initSelectedModel();
1518
+ this.checkModelInSessionPool();
1472
1519
  }
1473
- this.checkModelInSessionPool();
1474
1520
  this.preselectModelFromSessionHistory();
1475
1521
  }));
1476
1522
  let elements;
@@ -1481,13 +1527,17 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1481
1527
  h(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),
1482
1528
  h(".chat-editing-session@chatEditingSessionWidgetContainer"),
1483
1529
  h(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),
1484
- h(".interactive-input-and-side-toolbar@inputAndSideToolbar", [h(
1485
- ".chat-input-container@inputContainer",
1486
- [h(".chat-editor-container@editorContainer"), h(
1487
- ".chat-input-toolbars@inputToolbars",
1488
- [h(".chat-context-usage-container@contextUsageWidgetContainer")]
1489
- )]
1490
- )]),
1530
+ h(
1531
+ ".interactive-input-and-side-toolbar@inputAndSideToolbar",
1532
+ [h(".chat-input-container@inputContainer", [
1533
+ h(".chat-editor-container@editorContainer"),
1534
+ h(".chat-input-toolbars@inputToolbars")
1535
+ ])]
1536
+ ),
1537
+ h(
1538
+ ".chat-secondary-toolbar@secondaryToolbar",
1539
+ [h(".chat-context-usage-container@contextUsageWidgetContainer")]
1540
+ ),
1491
1541
  h(
1492
1542
  ".chat-attachments-container@attachmentsContainer",
1493
1543
  [h(".chat-attached-context@attachedContextContainer")]
@@ -1507,10 +1557,11 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1507
1557
  [h(".chat-input-container@inputContainer", [h(
1508
1558
  ".chat-attachments-container@attachmentsContainer",
1509
1559
  [h(".chat-attached-context@attachedContextContainer")]
1510
- ), h(".chat-editor-container@editorContainer"), h(
1511
- ".chat-input-toolbars@inputToolbars",
1512
- [h(".chat-context-usage-container@contextUsageWidgetContainer")]
1513
- )])]
1560
+ ), h(".chat-editor-container@editorContainer"), h(".chat-input-toolbars@inputToolbars")])]
1561
+ ),
1562
+ h(
1563
+ ".chat-secondary-toolbar@secondaryToolbar",
1564
+ [h(".chat-context-usage-container@contextUsageWidgetContainer")]
1514
1565
  )
1515
1566
  ]);
1516
1567
  }
@@ -1528,6 +1579,10 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1528
1579
  this.attachmentsContainer = elements.attachmentsContainer;
1529
1580
  this.attachedContextContainer = elements.attachedContextContainer;
1530
1581
  const toolbarsContainer = elements.inputToolbars;
1582
+ this.secondaryToolbarContainer = elements.secondaryToolbar;
1583
+ if (this.options.isSessionsWindow || this.options.renderStyle === "compact") {
1584
+ this.secondaryToolbarContainer.style.display = "none";
1585
+ }
1531
1586
  this.chatEditingSessionWidgetContainer = elements.chatEditingSessionWidgetContainer;
1532
1587
  this.chatInputTodoListWidgetContainer = elements.chatInputTodoListWidgetContainer;
1533
1588
  this.chatGettingStartedTipContainer = elements.chatGettingStartedTipContainer;
@@ -1535,6 +1590,9 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1535
1590
  this.chatQuestionCarouselContainer = elements.chatQuestionCarouselContainer;
1536
1591
  this.chatInputWidgetsContainer = elements.chatInputWidgetsContainer;
1537
1592
  this.contextUsageWidgetContainer = elements.contextUsageWidgetContainer;
1593
+ if (this.options.isSessionsWindow || this.options.renderStyle === "compact") {
1594
+ toolbarsContainer.prepend(this.contextUsageWidgetContainer);
1595
+ }
1538
1596
  this.contextUsageWidget = this._register(this.instantiationService.createInstance(ChatContextUsageWidget));
1539
1597
  this.contextUsageWidgetContainer.appendChild(this.contextUsageWidget.domNode);
1540
1598
  if (this.options.enableImplicitContext && !this._implicitContext) {
@@ -1580,14 +1638,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1580
1638
  options.ariaLabel = this._getAriaLabel();
1581
1639
  options.fontFamily = DEFAULT_FONT_FAMILY;
1582
1640
  options.fontSize = 13;
1583
- options.lineHeight = 20;
1584
- options.padding = this.options.renderStyle === "compact" ? {
1585
- top: 2,
1586
- bottom: 2
1587
- } : {
1588
- top: 8,
1589
- bottom: 8
1590
- };
1641
+ options.lineHeight = INPUT_EDITOR_LINE_HEIGHT;
1642
+ options.padding = this.options.renderStyle === "compact" ? INPUT_EDITOR_PADDING.compact : INPUT_EDITOR_PADDING.default;
1591
1643
  options.cursorWidth = 1;
1592
1644
  options.wrappingStrategy = "advanced";
1593
1645
  options.bracketPairColorization = {
@@ -1603,9 +1655,13 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1603
1655
  showStatusBar: false,
1604
1656
  insertMode: "insert"
1605
1657
  };
1606
- options.scrollbar = {
1658
+ options.scrollbar = this.options.renderStyle === "compact" ? {
1607
1659
  ...(options.scrollbar ?? {}),
1608
1660
  vertical: "hidden"
1661
+ } : {
1662
+ ...(options.scrollbar ?? {}),
1663
+ vertical: "auto",
1664
+ verticalScrollbarSize: 7
1609
1665
  };
1610
1666
  options.stickyScroll = {
1611
1667
  enabled: false
@@ -1682,10 +1738,9 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1682
1738
  actionContext: {
1683
1739
  widget
1684
1740
  },
1685
- onlyShowIconsForDefaultActions: observableFromEvent(
1686
- this._inputEditor.onDidLayoutChange,
1687
- l => (l?.width ?? this._inputEditor.getLayoutInfo().width) < 650
1688
- ).recomputeInitiallyAndOnChange(this._store),
1741
+ hideChevrons: derived(
1742
+ reader => this._stableInputPartWidth.read(reader) < CHAT_INPUT_PICKER_COLLAPSE_WIDTH
1743
+ ),
1689
1744
  hoverPosition: {
1690
1745
  forcePosition: true,
1691
1746
  hoverPosition: location === ChatWidgetLocation.SidebarRight && !isMaximized ? HoverPosition.LEFT : HoverPosition.RIGHT
@@ -1714,7 +1769,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1714
1769
  enabled: true,
1715
1770
  kind: "last",
1716
1771
  minItems: 1,
1717
- actionMinWidth: 40
1772
+ actionMinWidth: 22
1718
1773
  },
1719
1774
  actionViewItemProvider: (action, options) => {
1720
1775
  if (action.id === OpenModelPickerAction.ID && action instanceof MenuItemAction) {
@@ -1784,16 +1839,12 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1784
1839
  pickerOptions
1785
1840
  );
1786
1841
  } else {
1787
- const empty = ( new BaseActionViewItem(undefined, action));
1788
- if (empty.element) {
1789
- empty.element.style.display = "none";
1790
- }
1791
- return empty;
1842
+ return ( new HiddenActionViewItem(action));
1792
1843
  }
1793
1844
  } else if (action.id === ChatSessionPrimaryPickerAction.ID && action instanceof MenuItemAction) {
1794
1845
  const widgets = this.createChatSessionPickerWidgets(action);
1795
1846
  if (widgets.length === 0) {
1796
- return undefined;
1847
+ return ( new HiddenActionViewItem(action));
1797
1848
  }
1798
1849
  return this.instantiationService.createInstance(ChatSessionPickersContainerActionItem, action, widgets);
1799
1850
  }
@@ -1810,7 +1861,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1810
1861
  const container = toolbarElement.querySelector(".chat-sessionPicker-container");
1811
1862
  this.chatSessionPickerContainer = container;
1812
1863
  if (this.cachedWidth && typeof this.cachedInputToolbarWidth === "number" && this.cachedInputToolbarWidth !== this.inputActionsToolbar.getItemsWidth()) {
1813
- this.layout(this.cachedWidth);
1864
+ this._toolbarRelayoutScheduler.schedule();
1814
1865
  }
1815
1866
  }));
1816
1867
  this.executeToolbar = this._register(this.instantiationService.createInstance(
@@ -1832,7 +1883,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1832
1883
  };
1833
1884
  this._register(this.executeToolbar.onDidChangeMenuItems(() => {
1834
1885
  if (this.cachedWidth && typeof this.cachedExecuteToolbarWidth === "number" && this.cachedExecuteToolbarWidth !== this.executeToolbar.getItemsWidth()) {
1835
- this.layout(this.cachedWidth);
1886
+ this._toolbarRelayoutScheduler.schedule();
1836
1887
  }
1837
1888
  }));
1838
1889
  if (this.options.menus.inputSideToolbar) {
@@ -1854,6 +1905,80 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1854
1905
  widget
1855
1906
  };
1856
1907
  }
1908
+ this.secondaryToolbar = this._register(this.instantiationService.createInstance(
1909
+ MenuWorkbenchToolBar,
1910
+ this.secondaryToolbarContainer,
1911
+ MenuId.ChatInputSecondary,
1912
+ {
1913
+ telemetrySource: this.options.menus.telemetrySource,
1914
+ menuOptions: {
1915
+ shouldForwardArgs: true
1916
+ },
1917
+ hiddenItemStrategy: HiddenItemStrategy.NoHide,
1918
+ hoverDelegate,
1919
+ actionViewItemProvider: (action, options) => {
1920
+ if ((action.id === OpenSessionTargetPickerAction.ID || action.id === OpenDelegationPickerAction.ID) && action instanceof MenuItemAction) {
1921
+ const getActiveSessionType = () => {
1922
+ const sessionResource = this._widget?.viewModel?.sessionResource;
1923
+ return sessionResource ? getAgentSessionProvider(sessionResource) : undefined;
1924
+ };
1925
+ const delegate = this.options.sessionTypePickerDelegate ?? {
1926
+ getActiveSessionProvider: () => {
1927
+ return getActiveSessionType();
1928
+ },
1929
+ getPendingDelegationTarget: () => {
1930
+ return this._pendingDelegationTarget;
1931
+ },
1932
+ setPendingDelegationTarget: provider => {
1933
+ const isActive = getActiveSessionType() === provider;
1934
+ this._pendingDelegationTarget = isActive ? undefined : provider;
1935
+ this.updateWidgetLockStateFromSessionType(provider);
1936
+ this.updateAgentSessionTypeContextKey();
1937
+ this.refreshChatSessionPickers();
1938
+ }
1939
+ };
1940
+ const isWelcomeViewMode = !!this.options.sessionTypePickerDelegate?.setActiveSessionProvider;
1941
+ const Picker = (action.id === OpenSessionTargetPickerAction.ID || isWelcomeViewMode) ? SessionTypePickerActionItem : DelegationSessionPickerActionItem;
1942
+ return this.sessionTargetWidget = this.instantiationService.createInstance(
1943
+ Picker,
1944
+ action,
1945
+ location === ChatWidgetLocation.Editor ? "editor" : "sidebar",
1946
+ delegate,
1947
+ pickerOptions
1948
+ );
1949
+ } else if (action.id === OpenWorkspacePickerAction.ID && action instanceof MenuItemAction) {
1950
+ if (this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY && this.options.workspacePickerDelegate) {
1951
+ return this.instantiationService.createInstance(
1952
+ WorkspacePickerActionItem,
1953
+ action,
1954
+ this.options.workspacePickerDelegate,
1955
+ pickerOptions
1956
+ );
1957
+ } else {
1958
+ const empty = ( new BaseActionViewItem(undefined, action));
1959
+ if (empty.element) {
1960
+ empty.element.style.display = "none";
1961
+ }
1962
+ return empty;
1963
+ }
1964
+ } else if (action.id === OpenPermissionPickerAction.ID && action instanceof MenuItemAction) {
1965
+ const delegate = {
1966
+ currentPermissionLevel: this._currentPermissionLevel,
1967
+ setPermissionLevel: level => {
1968
+ this._currentPermissionLevel.set(level, undefined);
1969
+ this.permissionLevelKey.set(level);
1970
+ }
1971
+ };
1972
+ return this.permissionWidget = this.instantiationService.createInstance(PermissionPickerActionItem, action, delegate, pickerOptions);
1973
+ }
1974
+ return undefined;
1975
+ }
1976
+ }
1977
+ ));
1978
+ this.secondaryToolbar.getElement().classList.add("chat-secondary-input-toolbar");
1979
+ this.secondaryToolbar.context = {
1980
+ widget
1981
+ };
1857
1982
  let inputModel = this.modelService.getModel(this.inputUri);
1858
1983
  if (!inputModel) {
1859
1984
  inputModel = this.modelService.createModel("", null, this.inputUri, true);
@@ -2207,50 +2332,60 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2207
2332
  this._chatInputTodoListWidget.value?.clear(sessionResource, force);
2208
2333
  }
2209
2334
  renderQuestionCarousel(carousel, context, options) {
2210
- if (this._chatQuestionCarouselWidget.value) {
2211
- const existingCarousel = this._chatQuestionCarouselWidget.value;
2212
- const existingResolveId = existingCarousel.carousel.resolveId;
2213
- if (existingResolveId && carousel.resolveId && existingResolveId === carousel.resolveId) {
2214
- return existingCarousel;
2215
- }
2216
- const oldCarousel = existingCarousel.carousel;
2217
- if (oldCarousel instanceof ChatQuestionCarouselData && !oldCarousel.completion.isSettled) {
2218
- oldCarousel.completion.complete({
2219
- answers: undefined
2220
- });
2221
- }
2222
- this.clearQuestionCarousel();
2335
+ const carouselKey = carousel.resolveId ?? `${isResponseVM(context.element) ? context.element.requestId : ""}_${context.contentIndex}`;
2336
+ const existing = this._chatQuestionCarouselWidgets.get(carouselKey);
2337
+ if (existing) {
2338
+ return existing;
2223
2339
  }
2224
- this._currentQuestionCarouselResponseId = isResponseVM(context.element) ? context.element.requestId : undefined;
2225
- this._currentQuestionCarouselSessionResource = isResponseVM(context.element) ? context.element.sessionResource : undefined;
2226
- const part = this._chatQuestionCarouselDisposables.add(
2227
- this.instantiationService.createInstance(ChatQuestionCarouselPart, carousel, context, options)
2228
- );
2229
- this._chatQuestionCarouselWidget.value = part;
2340
+ if (isResponseVM(context.element)) {
2341
+ this._questionCarouselResponseIds.set(carouselKey, context.element.requestId);
2342
+ this._questionCarouselSessionResources.set(carouselKey, context.element.sessionResource);
2343
+ }
2344
+ const part = this.instantiationService.createInstance(ChatQuestionCarouselPart, carousel, context, options);
2345
+ this._chatQuestionCarouselWidgets.set(carouselKey, part);
2230
2346
  this._hasQuestionCarouselContextKey?.set(true);
2231
- clearNode(this.chatQuestionCarouselContainer);
2232
2347
  append(this.chatQuestionCarouselContainer, part.domNode);
2233
2348
  return part;
2234
2349
  }
2235
- clearQuestionCarousel(responseId) {
2236
- if (responseId && this._currentQuestionCarouselResponseId !== responseId) {
2237
- return;
2350
+ clearQuestionCarousel(responseId, resolveId) {
2351
+ if (resolveId !== undefined) {
2352
+ const part = this._chatQuestionCarouselWidgets.get(resolveId);
2353
+ if (part) {
2354
+ part.domNode.remove();
2355
+ this._chatQuestionCarouselWidgets.deleteAndDispose(resolveId);
2356
+ }
2357
+ this._questionCarouselResponseIds.delete(resolveId);
2358
+ this._questionCarouselSessionResources.delete(resolveId);
2359
+ } else if (responseId !== undefined) {
2360
+ for (const [key, rid] of this._questionCarouselResponseIds) {
2361
+ if (rid === responseId) {
2362
+ const part = this._chatQuestionCarouselWidgets.get(key);
2363
+ if (part) {
2364
+ part.domNode.remove();
2365
+ this._chatQuestionCarouselWidgets.deleteAndDispose(key);
2366
+ }
2367
+ this._questionCarouselResponseIds.delete(key);
2368
+ this._questionCarouselSessionResources.delete(key);
2369
+ }
2370
+ }
2371
+ } else {
2372
+ this._chatQuestionCarouselWidgets.clearAndDisposeAll();
2373
+ this._questionCarouselResponseIds.clear();
2374
+ this._questionCarouselSessionResources.clear();
2375
+ clearNode(this.chatQuestionCarouselContainer);
2238
2376
  }
2239
- this._chatQuestionCarouselDisposables.clear();
2240
- this._chatQuestionCarouselWidget.clear();
2241
- this._currentQuestionCarouselResponseId = undefined;
2242
- this._currentQuestionCarouselSessionResource = undefined;
2243
- this._hasQuestionCarouselContextKey?.set(false);
2244
- clearNode(this.chatQuestionCarouselContainer);
2245
- }
2246
- get questionCarouselResponseId() {
2247
- return this._currentQuestionCarouselResponseId;
2377
+ this._hasQuestionCarouselContextKey?.set(this._chatQuestionCarouselWidgets.size > 0);
2248
2378
  }
2249
2379
  get questionCarousel() {
2250
- return this._chatQuestionCarouselWidget.value;
2380
+ for (const part of ( this._chatQuestionCarouselWidgets.values())) {
2381
+ if (part.hasFocus()) {
2382
+ return part;
2383
+ }
2384
+ }
2385
+ return this._chatQuestionCarouselWidgets.size > 0 ? ( this._chatQuestionCarouselWidgets.values()).next().value : undefined;
2251
2386
  }
2252
2387
  focusQuestionCarousel() {
2253
- const carousel = this._chatQuestionCarouselWidget.value;
2388
+ const carousel = this.questionCarousel;
2254
2389
  if (carousel) {
2255
2390
  carousel.focus();
2256
2391
  return true;
@@ -2258,15 +2393,19 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2258
2393
  return false;
2259
2394
  }
2260
2395
  isQuestionCarouselFocused() {
2261
- const carousel = this._chatQuestionCarouselWidget.value;
2262
- return carousel?.hasFocus() ?? false;
2396
+ for (const part of ( this._chatQuestionCarouselWidgets.values())) {
2397
+ if (part.hasFocus()) {
2398
+ return true;
2399
+ }
2400
+ }
2401
+ return false;
2263
2402
  }
2264
2403
  navigateToPreviousQuestion() {
2265
- const carousel = this._chatQuestionCarouselWidget.value;
2404
+ const carousel = this.questionCarousel;
2266
2405
  return carousel?.navigateToPreviousQuestion() ?? false;
2267
2406
  }
2268
2407
  navigateToNextQuestion() {
2269
- const carousel = this._chatQuestionCarouselWidget.value;
2408
+ const carousel = this.questionCarousel;
2270
2409
  return carousel?.navigateToNextQuestion() ?? false;
2271
2410
  }
2272
2411
  setWorkingSetCollapsed(collapsed) {
@@ -2386,7 +2525,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2386
2525
  const button = this._chatEditsActionsDisposables.add(( new ButtonWithIcon(overviewTitle, {
2387
2526
  supportIcons: true,
2388
2527
  secondary: true,
2389
- ariaLabel: ( localize(6697, "Toggle changed files."))
2528
+ ariaLabel: ( localize(6784, "Toggle changed files."))
2390
2529
  })));
2391
2530
  const topLevelStats = derived(reader => {
2392
2531
  const entries = editSessionEntriesObs.read(reader);
@@ -2460,10 +2599,10 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2460
2599
  removed,
2461
2600
  shouldShowEditingSession
2462
2601
  } = topLevelStats.read(reader);
2463
- const buttonLabel = files === 1 ? ( localize(6698, "1 file changed")) : ( localize(6699, "{0} files changed", files));
2602
+ const buttonLabel = files === 1 ? ( localize(6785, "1 file changed")) : ( localize(6786, "{0} files changed", files));
2464
2603
  button.label = buttonLabel;
2465
2604
  button.element.setAttribute("aria-label", ( localize(
2466
- 6700,
2605
+ 6787,
2467
2606
  "{0}, {1} lines added, {2} lines removed",
2468
2607
  buttonLabel,
2469
2608
  added,
@@ -2579,6 +2718,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2579
2718
  }
2580
2719
  layout(width) {
2581
2720
  this.cachedWidth = width;
2721
+ this._stableInputPartWidth.set(width, undefined);
2582
2722
  return this._layout(width);
2583
2723
  }
2584
2724
  _layout(width, allowRecurse = true) {
@@ -2587,7 +2727,10 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2587
2727
  this.followupsContainer.style.width = `${followupsWidth}px`;
2588
2728
  const initialEditorScrollWidth = this._inputEditor.getScrollWidth();
2589
2729
  const newEditorWidth = width - data.inputPartHorizontalPadding - data.editorBorder - data.inputPartHorizontalPaddingInside - data.toolbarsWidth - data.sideToolbarWidth;
2590
- const inputEditorHeight = Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight);
2730
+ const inputEditorHeight = this.inputEditorMinHeight ? Math.max(
2731
+ this.inputEditorMinHeight,
2732
+ Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight)
2733
+ ) : Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight);
2591
2734
  const newDimension = {
2592
2735
  width: newEditorWidth,
2593
2736
  height: inputEditorHeight
@@ -2603,18 +2746,19 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2603
2746
  getLayoutData() {
2604
2747
  const inputSideToolbarWidth = this.inputSideToolbarContainer ? getTotalWidth(this.inputSideToolbarContainer) : 0;
2605
2748
  const getToolbarsWidthCompact = () => {
2749
+ const toolbarItemGap = 4;
2606
2750
  const executeToolbarWidth = this.cachedExecuteToolbarWidth = this.executeToolbar.getItemsWidth();
2607
2751
  const inputToolbarWidth = this.cachedInputToolbarWidth = this.inputActionsToolbar.getItemsWidth();
2608
- const executeToolbarPadding = (this.executeToolbar.getItemsLength() - 1) * 4;
2609
- const inputToolbarPadding = this.inputActionsToolbar.getItemsLength() ? (this.inputActionsToolbar.getItemsLength() - 1) * 4 : 0;
2752
+ const executeToolbarPadding = (this.executeToolbar.getItemsLength() - 1) * toolbarItemGap;
2753
+ const inputToolbarPadding = this.inputActionsToolbar.getItemsLength() ? (this.inputActionsToolbar.getItemsLength() - 1) * toolbarItemGap : 0;
2610
2754
  const contextUsageWidth = getTotalWidth(this.contextUsageWidgetContainer);
2611
2755
  const inputToolbarsPadding = 12;
2612
2756
  return executeToolbarWidth + executeToolbarPadding + contextUsageWidth + (this.options.renderInputToolbarBelowInput ? 0 : inputToolbarWidth + inputToolbarPadding + inputToolbarsPadding);
2613
2757
  };
2614
2758
  return {
2615
2759
  editorBorder: 2,
2616
- inputPartHorizontalPadding: this.options.renderStyle === "compact" ? 16 : 32,
2617
- inputPartHorizontalPaddingInside: 12,
2760
+ inputPartHorizontalPadding: this.options.renderStyle === "compact" ? 16 : 24,
2761
+ inputPartHorizontalPaddingInside: this.options.renderStyle === "compact" ? 12 : 10,
2618
2762
  toolbarsWidth: this.options.renderStyle === "compact" ? getToolbarsWidthCompact() : 0,
2619
2763
  sideToolbarWidth: inputSideToolbarWidth > 0 ? inputSideToolbarWidth + 4 : 0
2620
2764
  };
@@ -2683,5 +2827,14 @@ class ChatSessionPickersContainerActionItem extends ActionViewItem {
2683
2827
  super.dispose();
2684
2828
  }
2685
2829
  }
2830
+ class HiddenActionViewItem extends BaseActionViewItem {
2831
+ constructor(action) {
2832
+ super(undefined, action);
2833
+ }
2834
+ render(container) {
2835
+ super.render(container);
2836
+ container.style.display = "none";
2837
+ }
2838
+ }
2686
2839
 
2687
2840
  export { ChatInputPart, ChatWidgetLocation };