@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.
Files changed (230) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +10 -4
  3. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +37 -11
  4. package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +3 -0
  5. package/vscode/src/vs/platform/actions/browser/buttonbar.js +15 -4
  6. package/vscode/src/vs/platform/mcp/common/modelContextProtocolApps.d.ts +576 -0
  7. package/vscode/src/vs/{workbench/contrib → platform}/mcp/common/modelContextProtocolApps.js +1 -0
  8. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +15 -15
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +5 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +176 -17
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +5 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +127 -64
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +1 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +12 -11
  16. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.d.ts +26 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +106 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +9 -9
  19. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +14 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +105 -29
  21. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +13 -1
  22. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +69 -43
  23. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +2 -2
  24. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +35 -7
  25. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +187 -78
  26. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +138 -32
  27. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +23 -6
  28. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +394 -87
  29. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +1 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +28 -13
  31. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +38 -19
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +113 -116
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +16 -15
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +2 -2
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +8 -8
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +14 -14
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +5 -5
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +1 -1
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +2 -1
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +30 -11
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +250 -132
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +4 -4
  43. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +1 -16
  44. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +4 -110
  45. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
  46. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.d.ts +1 -1
  47. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
  48. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.d.ts +1 -1
  49. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
  50. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +3 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +9 -4
  52. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +2 -4
  53. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +7 -10
  54. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
  56. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +4 -2
  57. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +22 -4
  58. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +3 -2
  59. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.js +11 -3
  60. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -1
  61. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
  62. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +1 -1
  63. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
  64. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -1
  65. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
  66. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.d.ts +59 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.js +29 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.d.ts +0 -2
  69. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +0 -6
  70. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.d.ts +1 -1
  71. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +2 -2
  72. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +4 -2
  74. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.js +6 -3
  75. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.d.ts +1 -1
  76. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +1 -1
  77. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
  78. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.d.ts +3 -2
  79. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +7 -6
  80. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +0 -1
  81. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +26 -27
  82. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +4 -1
  83. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +53 -20
  84. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.d.ts +15 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.js +55 -0
  86. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +1 -1
  87. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +8 -7
  88. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +1 -1
  89. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
  90. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +3 -2
  91. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +24 -10
  92. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +4 -4
  93. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.js +11 -6
  94. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +62 -7
  95. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +414 -129
  96. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +1 -1
  97. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
  98. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +4 -3
  99. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +19 -12
  100. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.d.ts +22 -0
  101. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +263 -0
  102. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +14 -5
  103. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +98 -26
  104. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +5 -5
  105. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +1 -1
  106. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.js +1 -0
  107. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +1 -1
  108. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
  109. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +11 -2
  110. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +252 -80
  111. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.d.ts +29 -1
  112. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +246 -8
  113. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +4 -0
  114. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +39 -18
  115. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +6 -4
  116. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +36 -23
  117. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +3 -13
  118. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +6 -260
  119. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +1 -1
  120. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
  121. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +1 -1
  122. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
  123. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.d.ts +5 -7
  124. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +42 -37
  125. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatCodeBlockPill.css +12 -3
  126. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +65 -18
  127. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatHookContentPart.css +9 -6
  128. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +2 -2
  129. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +356 -415
  130. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +14 -7
  131. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +102 -7
  132. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +68 -19
  133. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/codeBlockPart.css +48 -15
  134. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +5 -2
  135. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +47 -23
  136. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +1 -1
  137. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
  138. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +1 -2
  139. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +0 -5
  140. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +8 -1
  141. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +57 -4
  142. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +5 -1
  143. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +24 -8
  144. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +1 -1
  145. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.d.ts +18 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.js +103 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +1 -1
  148. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +15 -18
  149. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +44 -1
  150. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +85 -89
  151. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +3 -5
  152. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +15 -17
  153. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +4 -2
  154. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +41 -2
  155. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +1 -1
  156. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
  157. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +3 -3
  158. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +2 -2
  159. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +6 -5
  160. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +1 -1
  161. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +13 -1
  162. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +1 -1
  163. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.js +2 -1
  164. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
  165. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +21 -5
  166. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +341 -88
  167. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +6 -0
  168. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +13 -4
  169. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.d.ts +35 -0
  170. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.js +440 -0
  171. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +24 -10
  172. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +437 -241
  173. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
  174. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +77 -17
  175. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +521 -284
  176. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +1 -1
  177. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +7 -1
  178. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +71 -0
  179. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +664 -0
  180. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.d.ts +104 -0
  181. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.js +127 -0
  182. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +12 -1
  183. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +57 -16
  184. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +4 -7
  185. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +89 -49
  186. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +1 -0
  187. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.d.ts +28 -0
  188. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +87 -0
  189. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +22 -0
  190. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +213 -0
  191. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +1 -0
  192. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +15 -17
  193. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +7 -4
  194. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +563 -140
  195. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +35 -26
  196. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +2 -2
  197. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +26 -23
  198. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +26 -6
  199. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +145 -79
  200. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +36 -50
  201. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +35 -15
  202. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.d.ts +7 -0
  203. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +127 -30
  204. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.d.ts +1 -0
  205. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +20 -14
  206. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +6 -6
  207. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +96 -34
  208. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +11 -2
  209. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +68 -27
  210. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +5 -0
  211. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +125 -13
  212. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +8 -11
  213. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +54 -45
  214. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +11 -10
  215. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +172 -112
  216. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
  217. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
  218. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +2 -44
  219. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +28 -4
  220. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +84 -3
  221. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +9 -2
  222. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +58 -41
  223. package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
  224. package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.d.ts +1 -548
  225. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
  226. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
  227. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
  228. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
  229. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +6 -10
  230. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +0 -187
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { $ as $$1, clearNode, h, append, addStandardDisposableListener, EventType, DisposableResizeObserver, setVisibility, isKeyboardEvent, getActiveElement, getWindow, addDisposableListener, getTotalWidth, reset } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
3
+ import { $ as $$1, clearNode, h, append, addStandardDisposableListener, EventType, DisposableResizeObserver, setVisibility, isKeyboardEvent, getActiveElement, getWindow, addDisposableListener, getTotalWidth } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
4
  import { DEFAULT_FONT_FAMILY } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/fonts';
5
5
  import { hasModifierKeys } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
6
6
  import { BaseActionViewItem, ActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
@@ -8,7 +8,6 @@ import { status } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/a
8
8
  import { ButtonWithIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
9
9
  import { createInstantHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
10
10
  import { HoverPosition } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverWidget';
11
- import { renderLabelWithIcons } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
12
11
  import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
13
12
  import { RunOnceScheduler, DeferredPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
14
13
  import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
@@ -17,7 +16,7 @@ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/even
17
16
  import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
18
17
  import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
19
18
  import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
20
- 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';
21
20
  import { ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
22
21
  import { MarshalledId } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
23
22
  import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
@@ -26,7 +25,6 @@ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/in
26
25
  import { isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
27
26
  import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
28
27
  import { ScrollbarVisibility } from '@codingame/monaco-vscode-api/vscode/vs/base/common/scrollable';
29
- import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
30
28
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
31
29
  import { EditorExtensionsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions';
32
30
  import { CodeEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
@@ -77,25 +75,27 @@ import { AccessibilityCommandId } from '@codingame/monaco-vscode-api/vscode/vs/w
77
75
  import { getSimpleEditorOptions, getSimpleCodeEditorWidgetOptions, setupSimpleEditorSelectionStyling } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
78
76
  import { InlineChatConfigKeys } from '../../../../inlineChat/common/inlineChat.js';
79
77
  import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
80
- import { ChatRequestVariableSet, isImageVariableEntry, isNotebookOutputVariableEntry, isPromptFileVariableEntry, isPromptTextVariableEntry, isElementVariableEntry, isPasteVariableEntry, isSCMHistoryItemVariableEntry, isSCMHistoryItemChangeVariableEntry, isSCMHistoryItemChangeRangeVariableEntry, isStringVariableEntry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
81
- import { ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes';
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 { getModeNameForTelemetry, ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes';
82
80
  import { IChatModeService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes.service';
83
81
  import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
84
82
  import { agentOptionId, localChatSessionType, isIChatSessionFileChange2 } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
85
83
  import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
86
- 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';
87
85
  import { ModifiedFileEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/editing/chatEditingService';
88
86
  import { ILanguageModelChatMetadata } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
89
87
  import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
88
+ import { shouldResetOnModelListChange, shouldRestorePersistedModel, shouldRestoreLateArrivingModel, resolveModelFromSyncState, shouldResetModelToDefault, mergeModelsWithCache, filterModelsForSession, hasModelsTargetingSession, isModelValidForSession, findDefaultModel } from './chatModelSelectionLogic.js';
90
89
  import { getChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
91
90
  import { isResponseVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel';
92
91
  import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents.service';
93
92
  import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
94
93
  import { ChatHistoryNavigator } from '../../../common/widget/chatWidgetHistoryService.js';
95
- import { ChatSubmitAction, OpenModelPickerAction, OpenModePickerAction, OpenSessionTargetPickerAction, OpenDelegationPickerAction, OpenWorkspacePickerAction, ChatSessionPrimaryPickerAction } from '../../actions/chatExecuteActions.js';
94
+ import { ChatSubmitAction, OpenModelPickerAction, OpenModePickerAction, OpenSessionTargetPickerAction, OpenDelegationPickerAction, OpenWorkspacePickerAction, ChatSessionPrimaryPickerAction, OpenPermissionPickerAction } from '../../actions/chatExecuteActions.js';
96
95
  import { getAgentSessionProvider, AgentSessionProviders } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
97
96
  import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
98
97
  import { ChatAttachmentModel } from '../../attachments/chatAttachmentModel.js';
98
+ import { IChatAttachmentWidgetRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgetRegistry.service';
99
99
  import { ToolSetOrToolItemAttachmentWidget, NotebookCellOutputChatAttachmentWidget, PromptFileAttachmentWidget, PromptTextAttachmentWidget, FileAttachmentWidget, TerminalCommandAttachmentWidget, ImageAttachmentWidget, ElementChatAttachmentWidget, PasteAttachmentWidget, SCMHistoryItemAttachmentWidget, SCMHistoryItemChangeAttachmentWidget, SCMHistoryItemChangeRangeAttachmentWidget, DefaultChatAttachmentWidget } from '../../attachments/chatAttachmentWidgets.js';
100
100
  import { ChatImplicitContexts } from '../../attachments/chatImplicitContext.js';
101
101
  import { ImplicitContextAttachmentWidget } from '../../attachments/implicitContextAttachment.js';
@@ -113,21 +113,34 @@ import { ChatFollowups } from './chatFollowups.js';
113
113
  import { ChatInputPartWidgetController } from './chatInputPartWidgets.js';
114
114
  import { ChatSelectedTools } from './chatSelectedTools.js';
115
115
  import { DelegationSessionPickerActionItem } from './delegationSessionPickerActionItem.js';
116
- import { ModelPickerActionItem } from './modelPickerActionItem.js';
117
116
  import { ModePickerActionItem } from './modePickerActionItem.js';
117
+ import { PermissionPickerActionItem } from './permissionPickerActionItem.js';
118
118
  import { SessionTypePickerActionItem } from './sessionTargetPickerActionItem.js';
119
119
  import { WorkspacePickerActionItem } from './workspacePickerActionItem.js';
120
120
  import { ChatContextUsageWidget } from '../../widgetHosts/viewPane/chatContextUsageWidget.js';
121
- 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';
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")
@@ -185,6 +198,12 @@ let ChatInputPart = class ChatInputPart extends Disposable {
185
198
  get implicitContext() {
186
199
  return this._implicitContext;
187
200
  }
201
+ get inputContainerElement() {
202
+ return this.inputContainer;
203
+ }
204
+ get gettingStartedTipContainerElement() {
205
+ return this.chatGettingStartedTipContainer;
206
+ }
188
207
  get inputEditor() {
189
208
  return this._inputEditor;
190
209
  }
@@ -201,6 +220,9 @@ let ChatInputPart = class ChatInputPart extends Disposable {
201
220
  get currentModeObs() {
202
221
  return this._currentModeObservable;
203
222
  }
223
+ get currentPermissionLevelObs() {
224
+ return this._currentPermissionLevel;
225
+ }
204
226
  get currentModeInfo() {
205
227
  const mode = this._currentModeObservable.get();
206
228
  const modeId = mode.isBuiltin ? this.currentModeKind : "custom";
@@ -209,13 +231,17 @@ let ChatInputPart = class ChatInputPart extends Disposable {
209
231
  kind: this.currentModeKind,
210
232
  isBuiltin: mode.isBuiltin,
211
233
  modeInstructions: modeInstructions ? {
234
+ uri: mode.uri?.get(),
212
235
  name: mode.name.get(),
213
236
  content: modeInstructions.content,
214
237
  toolReferences: this.toolService.toToolReferences(modeInstructions.toolReferences),
215
- metadata: modeInstructions.metadata
238
+ metadata: modeInstructions.metadata,
239
+ isBuiltin: mode.isBuiltin
216
240
  } : undefined,
217
241
  modeId: modeId,
218
- applyCodeBlockSuggestionId: undefined
242
+ modeName: getModeNameForTelemetry(mode),
243
+ applyCodeBlockSuggestionId: undefined,
244
+ permissionLevel: this._currentPermissionLevel.get()
219
245
  };
220
246
  }
221
247
  get selectedElements() {
@@ -265,7 +291,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
265
291
  agentSessionsService,
266
292
  workspaceContextService,
267
293
  layoutService,
268
- viewDescriptorService
294
+ viewDescriptorService,
295
+ _chatAttachmentWidgetRegistry
269
296
  ) {
270
297
  super();
271
298
  this.location = location;
@@ -297,13 +324,21 @@ let ChatInputPart = class ChatInputPart extends Disposable {
297
324
  this.workspaceContextService = workspaceContextService;
298
325
  this.layoutService = layoutService;
299
326
  this.viewDescriptorService = viewDescriptorService;
327
+ this._chatAttachmentWidgetRegistry = _chatAttachmentWidgetRegistry;
300
328
  this._workingSetCollapsed = observableValue("chatInputPart.workingSetCollapsed", true);
329
+ this._stableInputPartWidth = observableValue("chatInputPart.stableInputPartWidth", 0);
301
330
  this._chatInputTodoListWidget = this._register(( new MutableDisposable()));
302
- this._chatQuestionCarouselWidget = this._register(( new MutableDisposable()));
303
- this._chatQuestionCarouselDisposables = this._register(( new DisposableStore()));
331
+ this._chatQuestionCarouselWidgets = this._register(( new DisposableMap()));
332
+ this._questionCarouselResponseIds = ( new Map());
333
+ this._questionCarouselSessionResources = ( new Map());
304
334
  this._chatEditingTodosDisposables = this._register(( new DisposableStore()));
305
335
  this._onDidLoadInputState = this._register(( new Emitter()));
306
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)));
307
342
  this._onDidFocus = this._register(( new Emitter()));
308
343
  this.onDidFocus = this._onDidFocus.event;
309
344
  this._onDidBlur = this._register(( new Emitter()));
@@ -314,7 +349,6 @@ let ChatInputPart = class ChatInputPart extends Disposable {
314
349
  this.onDidAcceptFollowup = this._onDidAcceptFollowup.event;
315
350
  this._onDidClickOverlay = this._register(( new Emitter()));
316
351
  this.onDidClickOverlay = this._onDidClickOverlay.event;
317
- this._implicitContextWidget = this._register(( new MutableDisposable()));
318
352
  this._indexOfLastAttachedContextDeletedWithKeyboard = -1;
319
353
  this._indexOfLastOpenedContext = -1;
320
354
  this._onDidChangeVisibility = this._register(( new Emitter()));
@@ -343,6 +377,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
343
377
  this._attemptedWorkingSetEntriesCount = 0;
344
378
  this._chatSessionIsEmpty = false;
345
379
  this._pendingDelegationTarget = undefined;
380
+ this._currentSessionType = undefined;
346
381
  this._syncTextDebounced = this._register(( new RunOnceScheduler(() => this._syncInputStateToModel(), 150)));
347
382
  this._emptyInputState = this._register(
348
383
  emptyInputState(StorageScope.WORKSPACE, StorageTarget.USER, this.storageService)
@@ -351,6 +386,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
351
386
  onDidChangeVisibility: this._onDidChangeVisibility.event
352
387
  }));
353
388
  this._currentModeObservable = observableValue("currentMode", this.options.defaultMode ?? ChatMode.Agent);
389
+ this._currentPermissionLevel = observableValue("permissionLevel", ChatPermissionLevel.Default);
354
390
  this._register(this.editorService.onDidActiveEditorChange(() => {
355
391
  this._indexOfLastOpenedContext = -1;
356
392
  this.refreshChatSessionPickers();
@@ -390,11 +426,16 @@ let ChatInputPart = class ChatInputPart extends Disposable {
390
426
  this.instantiationService.createInstance(ChatDragAndDrop, () => this._widget, this._attachmentModel, styles)
391
427
  );
392
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;
393
431
  this.inputEditorHasText = ChatContextKeys.inputHasText.bindTo(contextKeyService);
394
432
  this.chatCursorAtTop = ChatContextKeys.inputCursorAtTop.bindTo(contextKeyService);
395
433
  this.inputEditorHasFocus = ChatContextKeys.inputHasFocus.bindTo(contextKeyService);
434
+ this._hasQuestionCarouselContextKey = ChatContextKeys.Editing.hasQuestionCarousel.bindTo(contextKeyService);
396
435
  this.chatModeKindKey = ChatContextKeys.chatModeKind.bindTo(contextKeyService);
397
436
  this.chatModeNameKey = ChatContextKeys.chatModeName.bindTo(contextKeyService);
437
+ this.chatModelIdKey = ChatContextKeys.chatModelId.bindTo(contextKeyService);
438
+ this.permissionLevelKey = ChatContextKeys.chatPermissionLevel.bindTo(contextKeyService);
398
439
  this.withinEditSessionKey = ChatContextKeys.withinEditSessionDiff.bindTo(contextKeyService);
399
440
  this.filePartOfEditSessionKey = ChatContextKeys.filePartOfEditSession.bindTo(contextKeyService);
400
441
  this.chatSessionHasOptions = ChatContextKeys.chatSessionHasModels.bindTo(contextKeyService);
@@ -407,6 +448,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
407
448
  }
408
449
  }
409
450
  this.chatSessionHasCustomAgentTarget = ChatContextKeys.chatSessionHasCustomAgentTarget.bindTo(contextKeyService);
451
+ this.chatSessionHasTargetedModels = ChatContextKeys.chatSessionHasTargetedModels.bindTo(contextKeyService);
410
452
  this.history = this._register(
411
453
  this.instantiationService.createInstance(ChatHistoryNavigator, this.location)
412
454
  );
@@ -439,16 +481,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
439
481
  ));
440
482
  this._hasFileAttachmentContextKey = ChatContextKeys.hasFileAttachments.bindTo(contextKeyService);
441
483
  this.initSelectedModel();
442
- this._register(this.languageModelsService.onDidChangeLanguageModels(vendor => {
443
- this.storageService.store(
444
- CachedLanguageModelsKey,
445
- this.storageService.getObject(CachedLanguageModelsKey, StorageScope.APPLICATION, []).filter(m => !m.identifier.startsWith(vendor)),
446
- StorageScope.APPLICATION,
447
- StorageTarget.MACHINE
448
- );
449
- const selectedModel = this._currentLanguageModel ? this.getModels().find(m => m.identifier === this._currentLanguageModel.get()?.identifier) : undefined;
450
- const selectedModelNotAvailable = this._currentLanguageModel && (!selectedModel?.metadata.isUserSelectable);
451
- if (!this.currentLanguageModel || selectedModelNotAvailable) {
484
+ this._register(this.languageModelsService.onDidChangeLanguageModels(() => {
485
+ if (shouldResetOnModelListChange(this._currentLanguageModel.get()?.identifier, this.getModels())) {
452
486
  this.setCurrentLanguageModelToDefault();
453
487
  }
454
488
  }));
@@ -463,6 +497,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
463
497
  }));
464
498
  this._register(autorun(reader => {
465
499
  const lm = this._currentLanguageModel.read(reader);
500
+ this.chatModelIdKey.set(lm?.metadata.id.toLowerCase() ?? "");
466
501
  if (lm?.metadata.name) {
467
502
  this.accessibilityService.alert(lm.metadata.name);
468
503
  }
@@ -489,12 +524,21 @@ let ChatInputPart = class ChatInputPart extends Disposable {
489
524
  if (sessionResource) {
490
525
  const ctx = this.chatService.getChatSessionFromInternalUri(sessionResource);
491
526
  if (ctx) {
492
- this.chatSessionsService.notifySessionOptionsChange(ctx.chatSessionResource, [{
493
- optionId: agentOptionId,
494
- value: mode.isBuiltin ? "" : modeName
495
- }]).catch(
496
- err => this.logService.error("Failed to notify extension of agent change:", err)
497
- );
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
+ }
498
542
  }
499
543
  }
500
544
  }));
@@ -502,7 +546,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
502
546
  }
503
547
  setImplicitContextEnablement() {
504
548
  if (this.implicitContext && this.configurationService.getValue("chat.implicitContext.suggestedContext")) {
505
- this.implicitContext.setEnabled(this._currentModeObservable.get().kind !== ChatMode.Agent.kind);
549
+ this.implicitContext.setEnabled(this._currentModeObservable.get().name.get().toLowerCase() === "ask");
506
550
  }
507
551
  }
508
552
  setIsWithinEditSession(inInsideDiff, isFilePartOfEditSession) {
@@ -510,38 +554,39 @@ let ChatInputPart = class ChatInputPart extends Disposable {
510
554
  this.filePartOfEditSessionKey.set(isFilePartOfEditSession);
511
555
  }
512
556
  getSelectedModelStorageKey() {
557
+ const sessionType = this._currentSessionType;
558
+ if (sessionType && this.hasModelsTargetingSessionType()) {
559
+ return `chat.currentLanguageModel.${this.location}.${sessionType}`;
560
+ }
513
561
  return `chat.currentLanguageModel.${this.location}`;
514
562
  }
515
563
  getSelectedModelIsDefaultStorageKey() {
564
+ const sessionType = this._currentSessionType;
565
+ if (sessionType && this.hasModelsTargetingSessionType()) {
566
+ return `chat.currentLanguageModel.${this.location}.${sessionType}.isDefault`;
567
+ }
516
568
  return `chat.currentLanguageModel.${this.location}.isDefault`;
517
569
  }
518
570
  initSelectedModel() {
519
571
  const persistedSelection = this.storageService.get(this.getSelectedModelStorageKey(), StorageScope.APPLICATION);
520
- const persistedAsDefault = this.storageService.getBoolean(
521
- this.getSelectedModelIsDefaultStorageKey(),
522
- StorageScope.APPLICATION,
523
- persistedSelection === "copilot/gpt-4.1"
524
- );
572
+ const persistedAsDefault = this.storageService.getBoolean(this.getSelectedModelIsDefaultStorageKey(), StorageScope.APPLICATION, true);
525
573
  if (persistedSelection) {
526
- const model = this.getModels().find(m => m.identifier === persistedSelection);
527
- if (model) {
528
- if (!persistedAsDefault || model.metadata.isDefaultForLocation[this.location]) {
529
- this.setCurrentLanguageModel(model);
530
- this.checkModelSupported();
531
- }
532
- } 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) {
533
579
  this._waitForPersistedLanguageModel.value = this.languageModelsService.onDidChangeLanguageModels(e => {
534
580
  const persistedModel = this.languageModelsService.lookupLanguageModel(persistedSelection);
535
581
  if (persistedModel) {
536
582
  this._waitForPersistedLanguageModel.clear();
537
- if (!persistedAsDefault || persistedModel.isDefaultForLocation[this.location]) {
538
- if (persistedModel.isUserSelectable) {
539
- this.setCurrentLanguageModel({
540
- metadata: persistedModel,
541
- identifier: persistedSelection
542
- });
543
- this.checkModelSupported();
544
- }
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();
545
590
  }
546
591
  } else {
547
592
  this.setCurrentLanguageModelToDefault();
@@ -552,11 +597,6 @@ let ChatInputPart = class ChatInputPart extends Disposable {
552
597
  this._register(this._onDidChangeCurrentChatMode.event(() => {
553
598
  this.checkModelSupported();
554
599
  }));
555
- this._register(this.configurationService.onDidChangeConfiguration(e => {
556
- if (e.affectsConfiguration(ChatConfiguration.Edits2Enabled)) {
557
- this.checkModelSupported();
558
- }
559
- }));
560
600
  }
561
601
  setEditing(enabled, editingSentRequest) {
562
602
  this.currentlyEditingInputKey?.set(enabled);
@@ -601,6 +641,14 @@ let ChatInputPart = class ChatInputPart extends Disposable {
601
641
  openModePicker() {
602
642
  this.modeWidget?.show();
603
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
+ }
604
652
  openSessionTargetPicker() {
605
653
  this.sessionTargetWidget?.show();
606
654
  }
@@ -675,6 +723,11 @@ let ChatInputPart = class ChatInputPart extends Disposable {
675
723
  this._modelSyncDisposables.clear();
676
724
  this.selectedToolsModel.resetSessionEnablementState();
677
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
+ }
678
731
  if (chatSessionIsEmpty) {
679
732
  this._setEmptyModelState();
680
733
  }
@@ -720,9 +773,24 @@ let ChatInputPart = class ChatInputPart extends Disposable {
720
773
  }
721
774
  }
722
775
  if (state?.selectedModel) {
723
- const lm = this._currentLanguageModel.get();
724
- if (!lm || lm.identifier !== state.selectedModel.identifier) {
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
788
+ }
789
+ );
790
+ if (syncResult.action === "apply") {
725
791
  this.setCurrentLanguageModel(state.selectedModel);
792
+ } else if (syncResult.action === "default") {
793
+ this.setCurrentLanguageModelToDefault();
726
794
  }
727
795
  }
728
796
  const currentAttachments = this._attachmentModel.attachments;
@@ -779,7 +847,13 @@ let ChatInputPart = class ChatInputPart extends Disposable {
779
847
  }
780
848
  checkModelSupported() {
781
849
  const lm = this._currentLanguageModel.get();
782
- if (lm && (!this.modelSupportedForDefaultAgent(lm) || !this.modelSupportedForInlineChat(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)) {
783
857
  this.setCurrentLanguageModelToDefault();
784
858
  }
785
859
  }
@@ -787,7 +861,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
787
861
  if (!this.options.supportsChangingModes) {
788
862
  return;
789
863
  }
790
- 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;
791
865
  this.setChatMode2(mode2, storeSelection);
792
866
  }
793
867
  setChatMode2(mode, storeSelection = true) {
@@ -798,27 +872,15 @@ let ChatInputPart = class ChatInputPart extends Disposable {
798
872
  this._onDidChangeCurrentChatMode.fire();
799
873
  this._syncInputStateToModel();
800
874
  }
801
- modelSupportedForDefaultAgent(model) {
802
- if (this.currentModeKind === ChatModeKind.Agent || (this.currentModeKind === ChatModeKind.Edit && this.configurationService.getValue(ChatConfiguration.Edits2Enabled))) {
803
- return ILanguageModelChatMetadata.suitableForAgentMode(model.metadata);
804
- }
805
- return true;
806
- }
807
- modelSupportedForInlineChat(model) {
808
- if (this.location !== ChatAgentLocation.EditorInline || !this.configurationService.getValue(InlineChatConfigKeys.EnableV2)) {
809
- return true;
810
- }
811
- return !!model.metadata.capabilities?.toolCalling;
812
- }
813
- getModels() {
875
+ getAllMergedModels() {
814
876
  const cachedModels = this.storageService.getObject(CachedLanguageModelsKey, StorageScope.APPLICATION, []);
815
- let models = ( this.languageModelsService.getLanguageModelIds().map(modelId => ({
877
+ const liveModels = ( this.languageModelsService.getLanguageModelIds().map(modelId => ({
816
878
  identifier: modelId,
817
879
  metadata: this.languageModelsService.lookupLanguageModel(modelId)
818
880
  })));
819
- if (models.length === 0 || ( models.some(m => m.metadata.isDefaultForLocation[this.location])) === false) {
820
- models = cachedModels;
821
- } else {
881
+ const contributedVendors = ( new Set(( this.languageModelsService.getVendors().map(v => v.vendor))));
882
+ const models = mergeModelsWithCache(liveModels, cachedModels, contributedVendors);
883
+ if (liveModels.length > 0) {
822
884
  this.storageService.store(
823
885
  CachedLanguageModelsKey,
824
886
  models,
@@ -826,14 +888,85 @@ let ChatInputPart = class ChatInputPart extends Disposable {
826
888
  StorageTarget.MACHINE
827
889
  );
828
890
  }
891
+ return models;
892
+ }
893
+ getModels() {
894
+ const models = this.getAllMergedModels();
829
895
  models.sort((a, b) => a.metadata.name.localeCompare(b.metadata.name));
830
- return models.filter(
831
- entry => 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)
832
902
  );
833
903
  }
904
+ getCurrentSessionType() {
905
+ const delegateSessionType = this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();
906
+ if (delegateSessionType) {
907
+ return delegateSessionType;
908
+ }
909
+ const sessionResource = this._widget?.viewModel?.model.sessionResource;
910
+ const ctx = sessionResource ? this.chatService.getChatSessionFromInternalUri(sessionResource) : undefined;
911
+ return ctx?.chatSessionType;
912
+ }
913
+ hasModelsTargetingSessionType() {
914
+ return hasModelsTargetingSession(this.getAllMergedModels(), this.getCurrentSessionType());
915
+ }
916
+ isModelValidForCurrentSession(model) {
917
+ return isModelValidForSession(model, this.getAllMergedModels(), this.getCurrentSessionType());
918
+ }
919
+ checkModelInSessionPool() {
920
+ const lm = this._currentLanguageModel.get();
921
+ if (lm && !this.isModelValidForCurrentSession(lm)) {
922
+ this.setCurrentLanguageModelToDefault();
923
+ }
924
+ }
925
+ preselectModelFromSessionHistory() {
926
+ const sessionResource = this._widget?.viewModel?.model.sessionResource;
927
+ const ctx = sessionResource ? this.chatService.getChatSessionFromInternalUri(sessionResource) : undefined;
928
+ const requiresCustomModels = ctx && this.chatSessionsService.requiresCustomModelsForSessionType(ctx.chatSessionType);
929
+ if (!requiresCustomModels) {
930
+ return;
931
+ }
932
+ const requests = this._widget?.viewModel?.model.getRequests();
933
+ if (!requests || requests.length === 0) {
934
+ return;
935
+ }
936
+ let lastModelId;
937
+ for (let i = requests.length - 1; i >= 0; i--) {
938
+ if (requests[i].modelId) {
939
+ lastModelId = requests[i].modelId;
940
+ break;
941
+ }
942
+ }
943
+ if (!lastModelId) {
944
+ return;
945
+ }
946
+ const tryMatch = () => {
947
+ const models = this.getModels();
948
+ let match = models.find(m => m.identifier === lastModelId);
949
+ if (!match) {
950
+ match = models.find(m => m.metadata.id === lastModelId);
951
+ }
952
+ return match;
953
+ };
954
+ const match = tryMatch();
955
+ if (match) {
956
+ this.setCurrentLanguageModel(match);
957
+ return;
958
+ }
959
+ this._waitForPersistedLanguageModel.value = this.languageModelsService.onDidChangeLanguageModels(() => {
960
+ const found = tryMatch();
961
+ if (found) {
962
+ this._waitForPersistedLanguageModel.clear();
963
+ this.setCurrentLanguageModel(found);
964
+ }
965
+ });
966
+ }
834
967
  setCurrentLanguageModelToDefault() {
835
968
  const allModels = this.getModels();
836
- const defaultModel = allModels.find(m => m.metadata.isDefaultForLocation[this.location]) || allModels.find(m => m.metadata.isUserSelectable);
969
+ const defaultModel = findDefaultModel(allModels, this.location);
837
970
  if (defaultModel) {
838
971
  this.setCurrentLanguageModel(defaultModel);
839
972
  }
@@ -864,40 +997,40 @@ let ChatInputPart = class ChatInputPart extends Disposable {
864
997
  }
865
998
  const mode = this._currentModeObservable.get();
866
999
  const modelName = this._currentLanguageModel.get()?.metadata.name;
867
- const modelInfo = modelName ? ( localize(6155, ", {0}. ", modelName)) : "";
1000
+ const modelInfo = modelName ? ( localize(6776, ", {0}. ", modelName)) : "";
868
1001
  let modeLabel = "";
869
1002
  if (!mode.isBuiltin) {
870
1003
  const mode = this.currentModeObs.get();
871
- modeLabel = ( localize(6156, "({0}), {1}", mode.label.get(), mode.description.get()));
1004
+ modeLabel = ( localize(6777, "({0}), {1}", mode.label.get(), mode.description.get()));
872
1005
  } else {
873
1006
  switch (this.currentModeKind) {
874
1007
  case ChatModeKind.Agent:
875
- modeLabel = ( localize(6157, "(Agent), edit files in your workspace."));
1008
+ modeLabel = ( localize(6778, "(Agent), edit files in your workspace."));
876
1009
  break;
877
1010
  case ChatModeKind.Edit:
878
- modeLabel = ( localize(6158, "(Edit), edit files in your workspace."));
1011
+ modeLabel = ( localize(6779, "(Edit), edit files in your workspace."));
879
1012
  break;
880
1013
  case ChatModeKind.Ask:
881
1014
  default:
882
- modeLabel = ( localize(6159, "(Ask), ask questions or type / for topics."));
1015
+ modeLabel = ( localize(6780, "(Ask), ask questions or type / for topics."));
883
1016
  break;
884
1017
  }
885
1018
  }
886
1019
  if (verbose) {
887
1020
  return kbLabel ? ( localize(
888
- 6160,
1021
+ 6781,
889
1022
  "Chat Input {0}{1} Press Enter to send out the request. Use {2} for Chat Accessibility Help.",
890
1023
  modeLabel,
891
1024
  modelInfo,
892
1025
  kbLabel
893
1026
  )) : ( localize(
894
- 6161,
1027
+ 6782,
895
1028
  "Chat Input {0}{1} Press Enter to send out the request. Use the Chat Accessibility Help command for more information.",
896
1029
  modeLabel,
897
1030
  modelInfo
898
1031
  ));
899
1032
  } else {
900
- return localize(6162, "Chat Input {0}{1}.", modeLabel, modelInfo);
1033
+ return localize(6783, "Chat Input {0}{1}.", modeLabel, modelInfo);
901
1034
  }
902
1035
  }
903
1036
  validateCurrentChatMode() {
@@ -1028,6 +1161,15 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1028
1161
  hasFocus() {
1029
1162
  return this._inputEditor.hasWidgetFocus();
1030
1163
  }
1164
+ focusTodoList() {
1165
+ return this._chatInputTodoListWidget.value?.focus() ?? false;
1166
+ }
1167
+ isTodoListFocused() {
1168
+ return this._chatInputTodoListWidget.value?.hasFocus() ?? false;
1169
+ }
1170
+ hasVisibleTodos() {
1171
+ return this._chatInputTodoListWidget.value?.hasTodos() ?? false;
1172
+ }
1031
1173
  async acceptInput(isUserQuery) {
1032
1174
  if (isUserQuery) {
1033
1175
  const userQuery = this.getCurrentInputState();
@@ -1130,6 +1272,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1130
1272
  const ctx = sessionResource ? this.chatService.getChatSessionFromInternalUri(sessionResource) : undefined;
1131
1273
  const customAgentTarget = ctx && this.chatSessionsService.getCustomAgentTargetForSessionType(ctx.chatSessionType);
1132
1274
  this.chatSessionHasCustomAgentTarget.set(customAgentTarget !== Target.Undefined);
1275
+ const requiresCustomModels = ctx && this.chatSessionsService.requiresCustomModelsForSessionType(ctx.chatSessionType);
1276
+ this.chatSessionHasTargetedModels.set(!!requiresCustomModels);
1133
1277
  if (customAgentTarget) {
1134
1278
  const agentOption = this.chatSessionsService.getSessionOption(ctx.chatSessionResource, agentOptionId);
1135
1279
  if (typeof agentOption !== "undefined") {
@@ -1321,6 +1465,9 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1321
1465
  this._widgetController.value = this.instantiationService.createInstance(ChatInputPartWidgetController, this.chatInputWidgetsContainer);
1322
1466
  }
1323
1467
  }
1468
+ showContextUsageDetails() {
1469
+ return this.contextUsageWidget?.showDetails() ?? false;
1470
+ }
1324
1471
  updateContextUsageWidget() {
1325
1472
  this._contextUsageDisposables.clear();
1326
1473
  const model = this._widget?.viewModel?.model;
@@ -1330,7 +1477,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1330
1477
  const store = ( new DisposableStore());
1331
1478
  this._contextUsageDisposables.value = store;
1332
1479
  store.add(model.onDidChange(e => {
1333
- if (e.kind === "completedRequest") {
1480
+ if (e.kind === "addRequest" || e.kind === "completedRequest") {
1334
1481
  this.contextUsageWidget?.update(model.lastRequest);
1335
1482
  }
1336
1483
  }));
@@ -1346,13 +1493,31 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1346
1493
  this.updateWidgetLockStateFromSessionType(initialSessionType);
1347
1494
  }
1348
1495
  }
1349
- this._register(widget.onDidChangeViewModel(() => {
1496
+ this._register(widget.onDidChangeViewModel(e => {
1350
1497
  this._pendingDelegationTarget = undefined;
1351
1498
  this.updateAgentSessionTypeContextKey();
1352
1499
  this.refreshChatSessionPickers();
1353
1500
  this.tryUpdateWidgetController();
1354
1501
  this.updateContextUsageWidget();
1355
- this.clearQuestionCarousel();
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)) {
1512
+ this.clearQuestionCarousel();
1513
+ }
1514
+ const newSessionType = this.getCurrentSessionType();
1515
+ if (e.currentSessionResource && newSessionType !== this._currentSessionType) {
1516
+ this._currentSessionType = newSessionType;
1517
+ this.initSelectedModel();
1518
+ this.checkModelInSessionPool();
1519
+ }
1520
+ this.preselectModelFromSessionHistory();
1356
1521
  }));
1357
1522
  let elements;
1358
1523
  if (this.options.renderStyle === "compact") {
@@ -1361,18 +1526,22 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1361
1526
  h(".chat-input-widgets-container@chatInputWidgetsContainer"),
1362
1527
  h(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),
1363
1528
  h(".chat-editing-session@chatEditingSessionWidgetContainer"),
1529
+ h(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),
1364
1530
  h(
1365
1531
  ".interactive-input-and-side-toolbar@inputAndSideToolbar",
1366
1532
  [h(".chat-input-container@inputContainer", [
1367
- h(".chat-context-usage-container@contextUsageWidgetContainer"),
1368
1533
  h(".chat-editor-container@editorContainer"),
1369
1534
  h(".chat-input-toolbars@inputToolbars")
1370
1535
  ])]
1371
1536
  ),
1372
- h(".chat-attachments-container@attachmentsContainer", [
1373
- h(".chat-attachment-toolbar@attachmentToolbar"),
1374
- h(".chat-attached-context@attachedContextContainer")
1375
- ]),
1537
+ h(
1538
+ ".chat-secondary-toolbar@secondaryToolbar",
1539
+ [h(".chat-context-usage-container@contextUsageWidgetContainer")]
1540
+ ),
1541
+ h(
1542
+ ".chat-attachments-container@attachmentsContainer",
1543
+ [h(".chat-attached-context@attachedContextContainer")]
1544
+ ),
1376
1545
  h(".interactive-input-followups@followupsContainer")
1377
1546
  ])]);
1378
1547
  } else {
@@ -1382,17 +1551,17 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1382
1551
  h(".chat-input-widgets-container@chatInputWidgetsContainer"),
1383
1552
  h(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),
1384
1553
  h(".chat-editing-session@chatEditingSessionWidgetContainer"),
1554
+ h(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),
1385
1555
  h(
1386
1556
  ".interactive-input-and-side-toolbar@inputAndSideToolbar",
1387
- [h(".chat-input-container@inputContainer", [
1388
- h(".chat-context-usage-container@contextUsageWidgetContainer"),
1389
- h(".chat-attachments-container@attachmentsContainer", [
1390
- h(".chat-attachment-toolbar@attachmentToolbar"),
1391
- h(".chat-attached-context@attachedContextContainer")
1392
- ]),
1393
- h(".chat-editor-container@editorContainer"),
1394
- h(".chat-input-toolbars@inputToolbars")
1395
- ])]
1557
+ [h(".chat-input-container@inputContainer", [h(
1558
+ ".chat-attachments-container@attachmentsContainer",
1559
+ [h(".chat-attached-context@attachedContextContainer")]
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")]
1396
1565
  )
1397
1566
  ]);
1398
1567
  }
@@ -1405,16 +1574,25 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1405
1574
  this.followupsContainer = elements.followupsContainer;
1406
1575
  const inputAndSideToolbar = elements.inputAndSideToolbar;
1407
1576
  const inputContainer = elements.inputContainer;
1577
+ this.inputContainer = inputContainer;
1408
1578
  const editorContainer = elements.editorContainer;
1409
1579
  this.attachmentsContainer = elements.attachmentsContainer;
1410
1580
  this.attachedContextContainer = elements.attachedContextContainer;
1411
1581
  const toolbarsContainer = elements.inputToolbars;
1412
- const attachmentToolbarContainer = elements.attachmentToolbar;
1582
+ this.secondaryToolbarContainer = elements.secondaryToolbar;
1583
+ if (this.options.isSessionsWindow || this.options.renderStyle === "compact") {
1584
+ this.secondaryToolbarContainer.style.display = "none";
1585
+ }
1413
1586
  this.chatEditingSessionWidgetContainer = elements.chatEditingSessionWidgetContainer;
1414
1587
  this.chatInputTodoListWidgetContainer = elements.chatInputTodoListWidgetContainer;
1588
+ this.chatGettingStartedTipContainer = elements.chatGettingStartedTipContainer;
1589
+ this.chatGettingStartedTipContainer.style.display = "none";
1415
1590
  this.chatQuestionCarouselContainer = elements.chatQuestionCarouselContainer;
1416
1591
  this.chatInputWidgetsContainer = elements.chatInputWidgetsContainer;
1417
1592
  this.contextUsageWidgetContainer = elements.contextUsageWidgetContainer;
1593
+ if (this.options.isSessionsWindow || this.options.renderStyle === "compact") {
1594
+ toolbarsContainer.prepend(this.contextUsageWidgetContainer);
1595
+ }
1418
1596
  this.contextUsageWidget = this._register(this.instantiationService.createInstance(ChatContextUsageWidget));
1419
1597
  this.contextUsageWidgetContainer.appendChild(this.contextUsageWidget.domNode);
1420
1598
  if (this.options.enableImplicitContext && !this._implicitContext) {
@@ -1460,14 +1638,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1460
1638
  options.ariaLabel = this._getAriaLabel();
1461
1639
  options.fontFamily = DEFAULT_FONT_FAMILY;
1462
1640
  options.fontSize = 13;
1463
- options.lineHeight = 20;
1464
- options.padding = this.options.renderStyle === "compact" ? {
1465
- top: 2,
1466
- bottom: 2
1467
- } : {
1468
- top: 8,
1469
- bottom: 8
1470
- };
1641
+ options.lineHeight = INPUT_EDITOR_LINE_HEIGHT;
1642
+ options.padding = this.options.renderStyle === "compact" ? INPUT_EDITOR_PADDING.compact : INPUT_EDITOR_PADDING.default;
1471
1643
  options.cursorWidth = 1;
1472
1644
  options.wrappingStrategy = "advanced";
1473
1645
  options.bracketPairColorization = {
@@ -1483,9 +1655,13 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1483
1655
  showStatusBar: false,
1484
1656
  insertMode: "insert"
1485
1657
  };
1486
- options.scrollbar = {
1658
+ options.scrollbar = this.options.renderStyle === "compact" ? {
1487
1659
  ...(options.scrollbar ?? {}),
1488
1660
  vertical: "hidden"
1661
+ } : {
1662
+ ...(options.scrollbar ?? {}),
1663
+ vertical: "auto",
1664
+ verticalScrollbarSize: 7
1489
1665
  };
1490
1666
  options.stickyScroll = {
1491
1667
  enabled: false
@@ -1562,10 +1738,9 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1562
1738
  actionContext: {
1563
1739
  widget
1564
1740
  },
1565
- onlyShowIconsForDefaultActions: observableFromEvent(
1566
- this._inputEditor.onDidLayoutChange,
1567
- l => (l?.width ?? this._inputEditor.getLayoutInfo().width) < 650
1568
- ).recomputeInitiallyAndOnChange(this._store),
1741
+ hideChevrons: derived(
1742
+ reader => this._stableInputPartWidth.read(reader) < CHAT_INPUT_PICKER_COLLAPSE_WIDTH
1743
+ ),
1569
1744
  hoverPosition: {
1570
1745
  forcePosition: true,
1571
1746
  hoverPosition: location === ChatWidgetLocation.SidebarRight && !isMaximized ? HoverPosition.LEFT : HoverPosition.RIGHT
@@ -1594,7 +1769,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1594
1769
  enabled: true,
1595
1770
  kind: "last",
1596
1771
  minItems: 1,
1597
- actionMinWidth: 40
1772
+ actionMinWidth: 22
1598
1773
  },
1599
1774
  actionViewItemProvider: (action, options) => {
1600
1775
  if (action.id === OpenModelPickerAction.ID && action instanceof MenuItemAction) {
@@ -1608,9 +1783,13 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1608
1783
  this.setCurrentLanguageModel(model);
1609
1784
  this.renderAttachedContext();
1610
1785
  },
1611
- getModels: () => this.getModels()
1786
+ getModels: () => this.getModels(),
1787
+ canManageModels: () => {
1788
+ const sessionType = this.getCurrentSessionType();
1789
+ return !sessionType || sessionType === localChatSessionType;
1790
+ }
1612
1791
  };
1613
- return this.modelWidget = this.instantiationService.createInstance(ModelPickerActionItem, action, undefined, itemDelegate, pickerOptions);
1792
+ return this.modelWidget = this.instantiationService.createInstance(EnhancedModelPickerActionItem, action, itemDelegate, pickerOptions);
1614
1793
  } else if (action.id === OpenModePickerAction.ID && action instanceof MenuItemAction) {
1615
1794
  const delegate = {
1616
1795
  currentMode: this._currentModeObservable,
@@ -1660,16 +1839,12 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1660
1839
  pickerOptions
1661
1840
  );
1662
1841
  } else {
1663
- const empty = ( new BaseActionViewItem(undefined, action));
1664
- if (empty.element) {
1665
- empty.element.style.display = "none";
1666
- }
1667
- return empty;
1842
+ return ( new HiddenActionViewItem(action));
1668
1843
  }
1669
1844
  } else if (action.id === ChatSessionPrimaryPickerAction.ID && action instanceof MenuItemAction) {
1670
1845
  const widgets = this.createChatSessionPickerWidgets(action);
1671
1846
  if (widgets.length === 0) {
1672
- return undefined;
1847
+ return ( new HiddenActionViewItem(action));
1673
1848
  }
1674
1849
  return this.instantiationService.createInstance(ChatSessionPickersContainerActionItem, action, widgets);
1675
1850
  }
@@ -1686,7 +1861,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1686
1861
  const container = toolbarElement.querySelector(".chat-sessionPicker-container");
1687
1862
  this.chatSessionPickerContainer = container;
1688
1863
  if (this.cachedWidth && typeof this.cachedInputToolbarWidth === "number" && this.cachedInputToolbarWidth !== this.inputActionsToolbar.getItemsWidth()) {
1689
- this.layout(this.cachedWidth);
1864
+ this._toolbarRelayoutScheduler.schedule();
1690
1865
  }
1691
1866
  }));
1692
1867
  this.executeToolbar = this._register(this.instantiationService.createInstance(
@@ -1708,7 +1883,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1708
1883
  };
1709
1884
  this._register(this.executeToolbar.onDidChangeMenuItems(() => {
1710
1885
  if (this.cachedWidth && typeof this.cachedExecuteToolbarWidth === "number" && this.cachedExecuteToolbarWidth !== this.executeToolbar.getItemsWidth()) {
1711
- this.layout(this.cachedWidth);
1886
+ this._toolbarRelayoutScheduler.schedule();
1712
1887
  }
1713
1888
  }));
1714
1889
  if (this.options.menus.inputSideToolbar) {
@@ -1730,6 +1905,80 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1730
1905
  widget
1731
1906
  };
1732
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
+ };
1733
1982
  let inputModel = this.modelService.getModel(this.inputUri);
1734
1983
  if (!inputModel) {
1735
1984
  inputModel = this.modelService.createModel("", null, this.inputUri, true);
@@ -1779,43 +2028,13 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1779
2028
  this._register(this.themeService.onDidFileIconThemeChange(() => {
1780
2029
  this.renderAttachedContext();
1781
2030
  }));
1782
- this.addFilesToolbar = this._register(this.instantiationService.createInstance(
1783
- MenuWorkbenchToolBar,
1784
- attachmentToolbarContainer,
1785
- MenuId.ChatInputAttachmentToolbar,
1786
- {
1787
- telemetrySource: this.options.menus.telemetrySource,
1788
- label: true,
1789
- menuOptions: {
1790
- shouldForwardArgs: true,
1791
- renderShortTitle: true
1792
- },
1793
- hiddenItemStrategy: HiddenItemStrategy.NoHide,
1794
- hoverDelegate,
1795
- actionViewItemProvider: (action, options) => {
1796
- if (action.id === "workbench.action.chat.attachContext") {
1797
- const viewItem = this.instantiationService.createInstance(AddFilesButton, this._attachmentModel, action, options);
1798
- viewItem.setShowLabel(
1799
- this._attachmentModel.size === 0 && !this._implicitContextWidget.value?.hasRenderedContexts
1800
- );
1801
- this.addFilesButton = viewItem;
1802
- return this.addFilesButton;
1803
- }
1804
- return undefined;
1805
- }
1806
- }
1807
- ));
1808
- this.addFilesToolbar.context = {
1809
- widget,
1810
- placeholder: ( localize(6163, "Search for files and context to add to your request"))
1811
- };
1812
2031
  this.renderAttachedContext();
1813
2032
  const inputResizeObserver = this._register(new DisposableResizeObserver(() => {
1814
2033
  const newHeight = this.container.offsetHeight;
1815
2034
  this.height.set(newHeight, undefined);
1816
2035
  }));
1817
2036
  this._register(inputResizeObserver.observe(this.container));
1818
- if (this.options.renderStyle === "compact" && this.options.isQuickChat) {
2037
+ if (this.options.renderStyle === "compact") {
1819
2038
  const toolbarsResizeObserver = this._register(new DisposableResizeObserver(() => {
1820
2039
  if (this.cachedWidth) {
1821
2040
  this.layout(this.cachedWidth);
@@ -1847,16 +2066,47 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1847
2066
  })
1848
2067
  );
1849
2068
  const attachments = [...this.attachmentModel.attachments.entries()];
1850
- const hasAttachments = Boolean(attachments.length) || Boolean(this.implicitContext?.hasValue);
2069
+ const hasAttachments = Boolean(attachments.length);
2070
+ let hasImplicitContext = false;
2071
+ const isSuggestedEnabled = this.configurationService.getValue("chat.implicitContext.suggestedContext");
2072
+ const hasVisibleImplicitContext = isSuggestedEnabled ? this._implicitContext?.hasValue ?? false : this._implicitContext?.values.some(v => v.enabled || v.isSelection) ?? false;
2073
+ if (this._implicitContext && hasVisibleImplicitContext) {
2074
+ const isAttachmentAlreadyAttached = (targetUri, targetRange, targetHandle) => {
2075
+ return ( this._attachmentModel.attachments.some(a => {
2076
+ const aUri = URI.isUri(a.value) ? a.value : isLocation(a.value) ? a.value.uri : undefined;
2077
+ const aRange = isLocation(a.value) ? a.value.range : undefined;
2078
+ if (targetHandle !== undefined && isStringVariableEntry(a) && a.handle === targetHandle) {
2079
+ return true;
2080
+ }
2081
+ if (targetUri && aUri && isEqual(targetUri, aUri)) {
2082
+ if (targetRange && aRange) {
2083
+ return Range.equalsRange(targetRange, aRange);
2084
+ }
2085
+ return !targetRange && !aRange;
2086
+ }
2087
+ return false;
2088
+ }));
2089
+ };
2090
+ const implicitContextWidget = this.instantiationService.createInstance(
2091
+ ImplicitContextAttachmentWidget,
2092
+ () => this._widget,
2093
+ isAttachmentAlreadyAttached,
2094
+ this._implicitContext,
2095
+ this._contextResourceLabels,
2096
+ this._attachmentModel,
2097
+ container
2098
+ );
2099
+ store.add(implicitContextWidget);
2100
+ hasImplicitContext = implicitContextWidget.hasRenderedContexts;
2101
+ }
1851
2102
  setVisibility(Boolean(
1852
- this.options.renderInputToolbarBelowInput || hasAttachments || (this.addFilesToolbar && !this.addFilesToolbar.isEmpty())
2103
+ this.options.renderInputToolbarBelowInput || hasAttachments || hasImplicitContext
1853
2104
  ), this.attachmentsContainer);
1854
- setVisibility(hasAttachments, this.attachedContextContainer);
2105
+ setVisibility(hasAttachments || hasImplicitContext, this.attachedContextContainer);
1855
2106
  if (!attachments.length) {
1856
2107
  this._indexOfLastAttachedContextDeletedWithKeyboard = -1;
1857
2108
  this._indexOfLastOpenedContext = -1;
1858
2109
  }
1859
- const isSuggestedEnabled = this.configurationService.getValue("chat.implicitContext.suggestedContext");
1860
2110
  for (const [index, attachment] of attachments) {
1861
2111
  const resource = URI.isUri(attachment.value) ? attachment.value : isLocation(attachment.value) ? attachment.value.uri : undefined;
1862
2112
  const range = isLocation(attachment.value) ? attachment.value.range : undefined;
@@ -1984,7 +2234,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
1984
2234
  this._contextResourceLabels
1985
2235
  );
1986
2236
  } else {
1987
- attachmentWidget = this.instantiationService.createInstance(
2237
+ attachmentWidget = this._chatAttachmentWidgetRegistry.createWidget(attachment, options, container) ?? this.instantiationService.createInstance(
1988
2238
  DefaultChatAttachmentWidget,
1989
2239
  resource,
1990
2240
  range,
@@ -2010,53 +2260,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2010
2260
  this.handleAttachmentOpen(index, attachment);
2011
2261
  }));
2012
2262
  }
2013
- if (isSuggestedEnabled && this.implicitContext?.hasValue) {
2014
- this._implicitContextWidget.value = this.instantiationService.createInstance(
2015
- ImplicitContextAttachmentWidget,
2016
- () => this._widget,
2017
- (targetUri, targetRange, targetHandle) => this.isAttachmentAlreadyAttached(targetUri, targetRange, targetHandle, ( attachments.map(([, a]) => a))),
2018
- this.implicitContext,
2019
- this._contextResourceLabels,
2020
- this._attachmentModel,
2021
- container
2022
- );
2023
- } else {
2024
- this._implicitContextWidget.clear();
2025
- }
2026
- this.addFilesButton?.setShowLabel(
2027
- this._attachmentModel.size === 0 && !this._implicitContextWidget.value?.hasRenderedContexts
2028
- );
2029
2263
  this._indexOfLastOpenedContext = -1;
2030
2264
  }
2031
- isAttachmentAlreadyAttached(targetUri, targetRange, targetHandle, attachments) {
2032
- return ( attachments.some(attachment => {
2033
- let uri;
2034
- let range;
2035
- let handle;
2036
- if (URI.isUri(attachment.value)) {
2037
- uri = attachment.value;
2038
- } else if (isLocation(attachment.value)) {
2039
- uri = attachment.value.uri;
2040
- range = attachment.value.range;
2041
- } else if (isStringVariableEntry(attachment)) {
2042
- uri = attachment.uri;
2043
- handle = attachment.handle;
2044
- }
2045
- if ((handle !== undefined && targetHandle === undefined) || (handle === undefined && targetHandle !== undefined)) {
2046
- return false;
2047
- }
2048
- if (handle !== undefined && targetHandle !== undefined && handle !== targetHandle) {
2049
- return false;
2050
- }
2051
- if (!uri || !isEqual(uri, targetUri)) {
2052
- return false;
2053
- }
2054
- if (targetRange) {
2055
- return range && Range.equalsRange(range, targetRange);
2056
- }
2057
- return true;
2058
- }));
2059
- }
2060
2265
  handleAttachmentDeletion(e, index, attachment) {
2061
2266
  if (isKeyboardEvent(e)) {
2062
2267
  this._indexOfLastAttachedContextDeletedWithKeyboard = index;
@@ -2089,17 +2294,12 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2089
2294
  if (!e.equals(KeyCode.LeftArrow) && !e.equals(KeyCode.RightArrow)) {
2090
2295
  return;
2091
2296
  }
2092
- const toolbar = this.addFilesToolbar?.getElement().querySelector(".action-label");
2093
- if (!toolbar) {
2094
- return;
2095
- }
2096
2297
  const attachments = Array.from(
2097
2298
  this.attachedContextContainer.querySelectorAll(".chat-attached-context-attachment")
2098
2299
  );
2099
2300
  if (!attachments.length) {
2100
2301
  return;
2101
2302
  }
2102
- attachments.unshift(toolbar);
2103
2303
  const activeElement = getActiveElement(getWindow(this.attachmentsContainer).document);
2104
2304
  const currentIndex = attachments.findIndex(attachment => attachment === activeElement);
2105
2305
  let newIndex = currentIndex;
@@ -2132,37 +2332,81 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2132
2332
  this._chatInputTodoListWidget.value?.clear(sessionResource, force);
2133
2333
  }
2134
2334
  renderQuestionCarousel(carousel, context, options) {
2135
- if (this._chatQuestionCarouselWidget.value) {
2136
- const existingCarousel = this._chatQuestionCarouselWidget.value;
2137
- const existingResolveId = existingCarousel.carousel.resolveId;
2138
- if (existingResolveId && carousel.resolveId && existingResolveId === carousel.resolveId) {
2139
- return existingCarousel;
2140
- }
2141
- this.clearQuestionCarousel();
2142
- }
2143
- this._currentQuestionCarouselResponseId = isResponseVM(context.element) ? context.element.requestId : undefined;
2144
- const part = this._chatQuestionCarouselDisposables.add(
2145
- this.instantiationService.createInstance(ChatQuestionCarouselPart, carousel, context, options)
2146
- );
2147
- this._chatQuestionCarouselWidget.value = part;
2148
- clearNode(this.chatQuestionCarouselContainer);
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;
2339
+ }
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);
2346
+ this._hasQuestionCarouselContextKey?.set(true);
2149
2347
  append(this.chatQuestionCarouselContainer, part.domNode);
2150
2348
  return part;
2151
2349
  }
2152
- clearQuestionCarousel(responseId) {
2153
- if (responseId && this._currentQuestionCarouselResponseId !== responseId) {
2154
- 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);
2155
2376
  }
2156
- this._chatQuestionCarouselDisposables.clear();
2157
- this._chatQuestionCarouselWidget.clear();
2158
- this._currentQuestionCarouselResponseId = undefined;
2159
- clearNode(this.chatQuestionCarouselContainer);
2160
- }
2161
- get questionCarouselResponseId() {
2162
- return this._currentQuestionCarouselResponseId;
2377
+ this._hasQuestionCarouselContextKey?.set(this._chatQuestionCarouselWidgets.size > 0);
2163
2378
  }
2164
2379
  get questionCarousel() {
2165
- 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;
2386
+ }
2387
+ focusQuestionCarousel() {
2388
+ const carousel = this.questionCarousel;
2389
+ if (carousel) {
2390
+ carousel.focus();
2391
+ return true;
2392
+ }
2393
+ return false;
2394
+ }
2395
+ isQuestionCarouselFocused() {
2396
+ for (const part of ( this._chatQuestionCarouselWidgets.values())) {
2397
+ if (part.hasFocus()) {
2398
+ return true;
2399
+ }
2400
+ }
2401
+ return false;
2402
+ }
2403
+ navigateToPreviousQuestion() {
2404
+ const carousel = this.questionCarousel;
2405
+ return carousel?.navigateToPreviousQuestion() ?? false;
2406
+ }
2407
+ navigateToNextQuestion() {
2408
+ const carousel = this.questionCarousel;
2409
+ return carousel?.navigateToNextQuestion() ?? false;
2166
2410
  }
2167
2411
  setWorkingSetCollapsed(collapsed) {
2168
2412
  this._workingSetCollapsed.set(collapsed, undefined);
@@ -2281,7 +2525,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2281
2525
  const button = this._chatEditsActionsDisposables.add(( new ButtonWithIcon(overviewTitle, {
2282
2526
  supportIcons: true,
2283
2527
  secondary: true,
2284
- ariaLabel: ( localize(6164, "Toggle changed files."))
2528
+ ariaLabel: ( localize(6784, "Toggle changed files."))
2285
2529
  })));
2286
2530
  const topLevelStats = derived(reader => {
2287
2531
  const entries = editSessionEntriesObs.read(reader);
@@ -2323,12 +2567,17 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2323
2567
  {
2324
2568
  telemetrySource: this.options.menus.telemetrySource,
2325
2569
  small: true,
2326
- menuOptions: {
2327
- arg: sessionResource && (isSessionMenu ? sessionResource : {
2570
+ menuOptions: sessionResource ? (isSessionMenu ? {
2571
+ args: [
2572
+ sessionResource,
2573
+ this.agentSessionsService.getSession(sessionResource)?.metadata
2574
+ ]
2575
+ } : {
2576
+ arg: {
2328
2577
  $mid: MarshalledId.ChatViewContext,
2329
2578
  sessionResource
2330
- })
2331
- },
2579
+ }
2580
+ }) : undefined,
2332
2581
  disableWhileRunning: isSessionMenu,
2333
2582
  buttonConfigProvider: action => {
2334
2583
  if (action.id === ChatEditingShowChangesAction.ID || action.id === ViewPreviousEditsAction.Id || action.id === ViewAllSessionChangesAction.ID) {
@@ -2350,10 +2599,10 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2350
2599
  removed,
2351
2600
  shouldShowEditingSession
2352
2601
  } = topLevelStats.read(reader);
2353
- const buttonLabel = files === 1 ? ( localize(6165, "1 file changed")) : ( localize(6166, "{0} files changed", files));
2602
+ const buttonLabel = files === 1 ? ( localize(6785, "1 file changed")) : ( localize(6786, "{0} files changed", files));
2354
2603
  button.label = buttonLabel;
2355
2604
  button.element.setAttribute("aria-label", ( localize(
2356
- 6167,
2605
+ 6787,
2357
2606
  "{0}, {1} lines added, {2} lines removed",
2358
2607
  buttonLabel,
2359
2608
  added,
@@ -2469,6 +2718,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2469
2718
  }
2470
2719
  layout(width) {
2471
2720
  this.cachedWidth = width;
2721
+ this._stableInputPartWidth.set(width, undefined);
2472
2722
  return this._layout(width);
2473
2723
  }
2474
2724
  _layout(width, allowRecurse = true) {
@@ -2477,7 +2727,10 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2477
2727
  this.followupsContainer.style.width = `${followupsWidth}px`;
2478
2728
  const initialEditorScrollWidth = this._inputEditor.getScrollWidth();
2479
2729
  const newEditorWidth = width - data.inputPartHorizontalPadding - data.editorBorder - data.inputPartHorizontalPaddingInside - data.toolbarsWidth - data.sideToolbarWidth;
2480
- 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);
2481
2734
  const newDimension = {
2482
2735
  width: newEditorWidth,
2483
2736
  height: inputEditorHeight
@@ -2493,16 +2746,19 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2493
2746
  getLayoutData() {
2494
2747
  const inputSideToolbarWidth = this.inputSideToolbarContainer ? getTotalWidth(this.inputSideToolbarContainer) : 0;
2495
2748
  const getToolbarsWidthCompact = () => {
2749
+ const toolbarItemGap = 4;
2496
2750
  const executeToolbarWidth = this.cachedExecuteToolbarWidth = this.executeToolbar.getItemsWidth();
2497
2751
  const inputToolbarWidth = this.cachedInputToolbarWidth = this.inputActionsToolbar.getItemsWidth();
2498
- const executeToolbarPadding = (this.executeToolbar.getItemsLength() - 1) * 4;
2499
- const inputToolbarPadding = this.inputActionsToolbar.getItemsLength() ? (this.inputActionsToolbar.getItemsLength() - 1) * 4 : 0;
2500
- return executeToolbarWidth + executeToolbarPadding + (this.options.renderInputToolbarBelowInput ? 0 : inputToolbarWidth + inputToolbarPadding);
2752
+ const executeToolbarPadding = (this.executeToolbar.getItemsLength() - 1) * toolbarItemGap;
2753
+ const inputToolbarPadding = this.inputActionsToolbar.getItemsLength() ? (this.inputActionsToolbar.getItemsLength() - 1) * toolbarItemGap : 0;
2754
+ const contextUsageWidth = getTotalWidth(this.contextUsageWidgetContainer);
2755
+ const inputToolbarsPadding = 12;
2756
+ return executeToolbarWidth + executeToolbarPadding + contextUsageWidth + (this.options.renderInputToolbarBelowInput ? 0 : inputToolbarWidth + inputToolbarPadding + inputToolbarsPadding);
2501
2757
  };
2502
2758
  return {
2503
2759
  editorBorder: 2,
2504
- inputPartHorizontalPadding: this.options.renderStyle === "compact" ? 16 : 32,
2505
- inputPartHorizontalPaddingInside: 12,
2760
+ inputPartHorizontalPadding: this.options.renderStyle === "compact" ? 16 : 24,
2761
+ inputPartHorizontalPaddingInside: this.options.renderStyle === "compact" ? 12 : 10,
2506
2762
  toolbarsWidth: this.options.renderStyle === "compact" ? getToolbarsWidthCompact() : 0,
2507
2763
  sideToolbarWidth: inputSideToolbarWidth > 0 ? inputSideToolbarWidth + 4 : 0
2508
2764
  };
@@ -2542,7 +2798,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
2542
2798
  };
2543
2799
  }
2544
2800
  };
2545
- ChatInputPart = ChatInputPart_1 = ( __decorate([( __param(4, IModelService)), ( __param(5, IInstantiationService)), ( __param(6, IContextKeyService)), ( __param(7, IConfigurationService)), ( __param(8, IKeybindingService)), ( __param(9, IAccessibilityService)), ( __param(10, ILanguageModelsService)), ( __param(11, ILogService)), ( __param(12, IFileService)), ( __param(13, IEditorService)), ( __param(14, IThemeService)), ( __param(15, ITextModelService)), ( __param(16, IStorageService)), ( __param(17, IChatAgentService)), ( __param(18, ISharedWebContentExtractorService)), ( __param(19, IWorkbenchAssignmentService)), ( __param(20, IChatEntitlementService)), ( __param(21, IChatModeService)), ( __param(22, ILanguageModelToolsService)), ( __param(23, IChatService)), ( __param(24, IChatSessionsService)), ( __param(25, IChatContextService)), ( __param(26, IAgentSessionsService)), ( __param(27, IWorkspaceContextService)), ( __param(28, IWorkbenchLayoutService)), ( __param(29, IViewDescriptorService))], ChatInputPart));
2801
+ ChatInputPart = ChatInputPart_1 = ( __decorate([( __param(4, IModelService)), ( __param(5, IInstantiationService)), ( __param(6, IContextKeyService)), ( __param(7, IConfigurationService)), ( __param(8, IKeybindingService)), ( __param(9, IAccessibilityService)), ( __param(10, ILanguageModelsService)), ( __param(11, ILogService)), ( __param(12, IFileService)), ( __param(13, IEditorService)), ( __param(14, IThemeService)), ( __param(15, ITextModelService)), ( __param(16, IStorageService)), ( __param(17, IChatAgentService)), ( __param(18, ISharedWebContentExtractorService)), ( __param(19, IWorkbenchAssignmentService)), ( __param(20, IChatEntitlementService)), ( __param(21, IChatModeService)), ( __param(22, ILanguageModelToolsService)), ( __param(23, IChatService)), ( __param(24, IChatSessionsService)), ( __param(25, IChatContextService)), ( __param(26, IAgentSessionsService)), ( __param(27, IWorkspaceContextService)), ( __param(28, IWorkbenchLayoutService)), ( __param(29, IViewDescriptorService)), ( __param(30, IChatAttachmentWidgetRegistry))], ChatInputPart));
2546
2802
  function getLastPosition(model) {
2547
2803
  return {
2548
2804
  lineNumber: model.getLineCount(),
@@ -2571,32 +2827,13 @@ class ChatSessionPickersContainerActionItem extends ActionViewItem {
2571
2827
  super.dispose();
2572
2828
  }
2573
2829
  }
2574
- class AddFilesButton extends ActionViewItem {
2575
- constructor(context, action, options) {
2576
- super(context, action, {
2577
- ...options,
2578
- icon: false,
2579
- label: true,
2580
- keybindingNotRenderedWithLabel: true
2581
- });
2582
- }
2583
- setShowLabel(show) {
2584
- this.showLabel = show;
2585
- this.updateLabel();
2830
+ class HiddenActionViewItem extends BaseActionViewItem {
2831
+ constructor(action) {
2832
+ super(undefined, action);
2586
2833
  }
2587
2834
  render(container) {
2588
- container.classList.add("chat-attachment-button");
2589
2835
  super.render(container);
2590
- this.updateLabel();
2591
- }
2592
- updateLabel() {
2593
- if (!this.label) {
2594
- return;
2595
- }
2596
- assertType(this.label);
2597
- this.label.classList.toggle("has-label", this.showLabel);
2598
- const message = this.showLabel ? `$(attach) ${this.action.label}` : `$(attach)`;
2599
- reset(this.label, ...renderLabelWithIcons(message));
2836
+ container.style.display = "none";
2600
2837
  }
2601
2838
  }
2602
2839