@codingame/monaco-vscode-chat-service-override 23.2.2 → 24.1.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 (273) hide show
  1. package/index.js +13 -10
  2. package/package.json +5 -41
  3. package/vscode/src/vs/platform/domWidget/browser/domWidget.d.ts +52 -0
  4. package/vscode/src/vs/platform/domWidget/browser/domWidget.js +53 -0
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +10 -10
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +61 -50
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.d.ts +18 -0
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +152 -0
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +14 -14
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +37 -28
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +9 -9
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -2
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +3 -5
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +7 -11
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +10 -10
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +12 -14
  19. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +21 -18
  20. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +27 -18
  21. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +4 -4
  22. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +1 -1
  23. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +11 -11
  24. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.d.ts +6 -27
  25. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.js +44 -208
  26. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +17 -17
  27. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +17 -17
  28. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +1 -1
  29. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +23 -24
  30. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.d.ts +1 -0
  31. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +140 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +85 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +358 -0
  34. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +55 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +222 -0
  36. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +37 -0
  37. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +241 -0
  38. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.d.ts +13 -0
  39. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +27 -0
  40. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.d.ts +11 -19
  41. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.js +67 -230
  42. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +65 -33
  43. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +186 -62
  44. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsProvider.d.ts +23 -0
  45. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsProvider.js +140 -0
  46. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsview.css +2 -7
  47. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +115 -29
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +389 -166
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +9 -6
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +22 -16
  51. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.d.ts +1 -1
  52. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.js +8 -8
  53. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
  54. package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.d.ts +10 -3
  55. package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.js +63 -3
  56. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimeline.d.ts +7 -3
  57. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.d.ts +14 -5
  58. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.js +173 -32
  59. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +1 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +66 -17
  61. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +32 -29
  62. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +12 -12
  63. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +4 -2
  64. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +9 -6
  65. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +2 -2
  66. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +6 -4
  67. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +4 -4
  68. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +8 -18
  69. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.d.ts +1 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.js +12 -1
  71. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +5 -6
  72. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +15 -24
  73. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +13 -11
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +66 -50
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +3 -2
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +6 -5
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +3 -1
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +7 -0
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +2 -2
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +6 -7
  81. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.d.ts +3 -3
  82. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +4 -4
  83. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +2 -2
  84. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +1 -1
  85. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.d.ts +1 -1
  86. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +15 -4
  87. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.d.ts +1 -1
  88. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +3 -4
  89. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +30 -37
  90. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +13 -10
  91. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +23 -32
  92. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +8 -9
  93. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +1 -1
  94. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +20 -19
  95. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +4 -4
  96. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +47 -15
  97. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +270 -143
  98. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +3 -2
  99. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +310 -170
  100. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +10 -10
  101. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +12 -2
  102. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.d.ts +1 -1
  103. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +4 -4
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +42 -42
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +3 -1
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +35 -25
  107. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
  108. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +4 -4
  109. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.d.ts +1 -4
  110. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.js +22 -26
  111. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.d.ts +18 -14
  112. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.js +80 -72
  113. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.d.ts +2 -8
  114. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.js +48 -77
  115. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.d.ts +16 -17
  116. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.js +257 -77
  117. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.d.ts +55 -0
  118. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +34 -0
  119. package/vscode/src/vs/workbench/contrib/chat/browser/{chatSetup.d.ts → chatSetup/chatSetupContributions.d.ts} +4 -11
  120. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +622 -0
  121. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +53 -0
  122. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +359 -0
  123. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.d.ts +89 -0
  124. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +667 -0
  125. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +37 -0
  126. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +260 -0
  127. package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/chatSetup.css +4 -6
  128. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.d.ts +4 -0
  129. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.js +21 -0
  130. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +55 -0
  131. package/vscode/src/vs/workbench/contrib/chat/browser/{chatStatus.js → chatStatus/chatStatusDashboard.js} +193 -325
  132. package/vscode/src/vs/workbench/contrib/chat/browser/{chatStatus.d.ts → chatStatus/chatStatusEntry.d.ts} +1 -1
  133. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +190 -0
  134. package/vscode/src/vs/workbench/contrib/chat/browser/{chatStatusItemService.d.ts → chatStatus/chatStatusItemService.d.ts} +1 -1
  135. package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatStatus/media}/chatStatus.css +22 -1
  136. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusWidget.d.ts +25 -0
  137. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusWidget.js +108 -0
  138. package/vscode/src/vs/workbench/contrib/chat/browser/chatTerminalOutputAccessibleView.d.ts +10 -0
  139. package/vscode/src/vs/workbench/contrib/chat/browser/chatTerminalOutputAccessibleView.js +34 -0
  140. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +1 -1
  141. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +57 -18
  142. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +478 -146
  143. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewTitleControl.d.ts +43 -0
  144. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewTitleControl.js +204 -0
  145. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidgetService.d.ts +44 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidgetService.js +187 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
  148. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +108 -62
  149. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
  150. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
  151. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.d.ts +1 -1
  152. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.js +37 -32
  153. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +37 -20
  154. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +232 -97
  155. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatusWidget.css +57 -0
  156. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewPane.css +142 -0
  157. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewTitleControl.css +39 -0
  158. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +51 -35
  159. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionContribution.js +1 -1
  160. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +5 -4
  161. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.js +2 -2
  162. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +5 -5
  163. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +12 -12
  164. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +19 -21
  165. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.d.ts +1 -1
  166. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +8 -8
  167. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +16 -16
  168. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
  169. package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +1 -1
  170. package/vscode/src/vs/workbench/contrib/chat/common/chatModelStore.d.ts +49 -0
  171. package/vscode/src/vs/workbench/contrib/chat/common/chatModelStore.js +100 -0
  172. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +1 -0
  173. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +2 -1
  174. package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +3 -4
  175. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +41 -15
  176. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +208 -162
  177. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.d.ts +3 -3
  178. package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +15 -7
  179. package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +61 -7
  180. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +3 -2
  181. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +2 -2
  182. package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.js +1 -1
  183. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +10 -10
  184. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +2 -2
  185. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.js +3 -3
  186. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.d.ts +5 -1
  187. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +60 -43
  188. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptDocumentSemanticTokensProvider.js +1 -1
  189. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +27 -4
  190. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +37 -47
  191. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +5 -3
  192. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +120 -87
  193. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileContributions.js +1 -1
  194. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +49 -42
  195. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +293 -187
  196. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +17 -5
  197. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +43 -9
  198. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +2 -0
  199. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +48 -29
  200. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
  201. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  202. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +8 -13
  203. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
  204. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +2 -2
  205. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +3 -3
  206. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +36 -41
  207. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
  208. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +2 -2
  209. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
  210. package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
  211. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js +1 -1
  212. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +18 -18
  213. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +1 -1
  214. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +142 -38
  215. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.d.ts +1 -1
  216. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.js +3 -7
  217. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +1 -1
  218. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +19 -2
  219. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +78 -6
  220. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +7 -11
  221. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +26 -44
  222. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.js +3 -3
  223. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +1 -1
  224. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +9 -0
  225. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +0 -1
  226. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +23 -17
  227. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +1 -1
  228. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +4 -2
  229. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +2 -0
  230. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +26 -5
  231. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +3 -1
  232. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +32 -4
  233. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +15 -29
  234. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +10 -7
  235. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +12 -0
  236. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +3 -1
  237. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +38 -19
  238. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +1 -0
  239. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +32 -7
  240. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +5 -4
  241. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +4 -3
  242. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +4 -3
  243. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +1 -0
  244. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +128 -62
  245. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +2 -2
  246. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +12 -2
  247. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +5 -2
  248. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +68 -22
  249. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +20 -22
  250. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +13 -12
  251. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +20 -19
  252. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.d.ts +1 -1
  253. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
  254. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.d.ts +12 -0
  255. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +72 -0
  256. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +1 -2
  257. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +5 -17
  258. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.d.ts +0 -53
  259. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.js +0 -154
  260. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.d.ts +0 -7
  261. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.js +0 -13
  262. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.d.ts +0 -25
  263. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.js +0 -135
  264. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.d.ts +0 -35
  265. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.js +0 -216
  266. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +0 -1617
  267. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +0 -44
  268. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +0 -313
  269. /package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/apple-dark.svg +0 -0
  270. /package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/apple-light.svg +0 -0
  271. /package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/github.svg +0 -0
  272. /package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatSetup/media}/google.svg +0 -0
  273. /package/vscode/src/vs/workbench/contrib/chat/browser/{chatStatusItemService.js → chatStatus/chatStatusItemService.js} +0 -0
@@ -1,10 +1,17 @@
1
1
 
2
+ import { registerCss } from '@codingame/monaco-vscode-api/css';
2
3
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { getWindow, $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
+ import * as chatViewPane from './media/chatViewPane.css';
5
+ import { $, append, setVisibility, getWindow, addDisposableListener, EventType, EventHelper } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
6
+ import { StandardMouseEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/mouseEvent';
4
7
  import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
5
- import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
+ import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
9
+ import { MutableDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
10
  import { MarshalledId } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
7
- import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
11
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
12
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
13
+ import { MenuWorkbenchToolBar } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/toolbar';
14
+ import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
8
15
  import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
9
16
  import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
10
17
  import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
@@ -12,7 +19,6 @@ import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/h
12
19
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
13
20
  import { ServiceCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/serviceCollection';
14
21
  import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
15
- import { ILayoutService } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service';
16
22
  import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
17
23
  import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
18
24
  import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
@@ -29,28 +35,49 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/mini
29
35
  import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
30
36
  import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
31
37
  import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
38
+ import { ChatViewTitleControl } from './chatViewTitleControl.js';
32
39
  import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
33
- import { ViewPane } from '@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/parts/views/viewPane';
34
- import { Memento } from '@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common/vscode/vs/workbench/common/memento';
40
+ import { ViewPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/views/viewPane';
41
+ import { Memento } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/memento';
35
42
  import { SIDE_BAR_FOREGROUND } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
36
43
  import { ViewContainerLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
37
44
  import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
45
+ import { StartupKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
46
+ import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
38
47
  import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
39
48
  import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
40
- import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
49
+ import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
41
50
  import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
51
+ import { localChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
42
52
  import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
43
- import { ChatAgentLocation, ChatModeKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
44
- import { ChatWidget } from '@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
45
- import { ChatViewWelcomeController } from '@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common/vscode/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController';
46
- import { LocalChatSessionUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatUri';
53
+ import { LocalChatSessionUri, getChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatUri';
54
+ import { ChatConfiguration, ChatAgentLocation, ChatModeKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
55
+ import { showCloseActiveChatNotification } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatCloseNotification';
56
+ import { AgentSessionsControl } from './agentSessions/agentSessionsControl.js';
57
+ import { AgentSessionsListDelegate } from './agentSessions/agentSessionsViewer.js';
58
+ import { ChatWidget } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
59
+ import { ChatViewWelcomeController } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController';
60
+ import { Position } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
61
+ import { IWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service';
62
+ import { AgentSessionsViewerOrientation, AgentSessionsViewerPosition } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
63
+ import { Link } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/browser/link';
64
+ import { IProgressService } from '@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress.service';
65
+ import { ChatViewId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
66
+ import { disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
67
+ import { AgentSessionsFilter } from './agentSessions/agentSessionsFilter.js';
68
+ import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
69
+ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
47
70
 
48
- const CHAT_SIDEBAR_PANEL_ID = 'workbench.panel.chat';
71
+ var ChatViewPane_1;
72
+ registerCss(chatViewPane);
49
73
  let ChatViewPane = class ChatViewPane extends ViewPane {
74
+ static { ChatViewPane_1 = this; }
75
+ static { this.SESSIONS_LIMIT = 3; }
76
+ static { this.SESSIONS_SIDEBAR_WIDTH = 300; }
77
+ static { this.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH = 300 + this.SESSIONS_SIDEBAR_WIDTH; }
50
78
  get widget() { return this._widget; }
51
- constructor(chatOptions, options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, hoverService, storageService, chatService, chatAgentService, logService, layoutService, chatSessionsService, telemetryService) {
79
+ constructor(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, hoverService, storageService, chatService, chatAgentService, logService, layoutService, chatSessionsService, telemetryService, lifecycleService, progressService, agentSessionsService) {
52
80
  super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, hoverService);
53
- this.chatOptions = chatOptions;
54
81
  this.storageService = storageService;
55
82
  this.chatService = chatService;
56
83
  this.chatAgentService = chatAgentService;
@@ -58,110 +85,278 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
58
85
  this.layoutService = layoutService;
59
86
  this.chatSessionsService = chatSessionsService;
60
87
  this.telemetryService = telemetryService;
61
- this.modelDisposables = this._register(( new DisposableStore()));
62
- this.memento = ( new Memento('interactive-session-view-' + CHAT_PROVIDER_ID, this.storageService));
88
+ this.progressService = progressService;
89
+ this.agentSessionsService = agentSessionsService;
90
+ this.sessionsCount = 0;
91
+ this.sessionsViewerLimited = true;
92
+ this.sessionsViewerOrientation = AgentSessionsViewerOrientation.Stacked;
93
+ this.sessionsViewerPosition = AgentSessionsViewerPosition.Right;
94
+ this.modelRef = this._register(( new MutableDisposable()));
95
+ this.memento = ( new Memento(`interactive-session-view-${CHAT_PROVIDER_ID}`, this.storageService));
63
96
  this.viewState = this.memento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
64
- if (this.chatOptions.location === ChatAgentLocation.Chat && !this.viewState.hasMigratedCurrentSession) {
65
- const editsMemento = ( new Memento(
66
- 'interactive-session-view-' + CHAT_PROVIDER_ID + `-edits`,
67
- this.storageService
68
- ));
69
- const lastEditsState = editsMemento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
70
- if (lastEditsState.sessionId) {
71
- this.logService.trace(`ChatViewPane: last edits session was ${lastEditsState.sessionId}`);
72
- if (!this.chatService.isPersistedSessionEmpty(LocalChatSessionUri.forSession(lastEditsState.sessionId))) {
73
- this.logService.info(`ChatViewPane: migrating ${lastEditsState.sessionId} to unified view`);
74
- this.viewState.sessionId = lastEditsState.sessionId;
75
- this.viewState.inputValue = lastEditsState.inputValue;
76
- this.viewState.inputState = {
77
- ...lastEditsState.inputState,
78
- chatMode: lastEditsState.inputState?.chatMode ?? ChatModeKind.Edit
79
- };
80
- this.viewState.hasMigratedCurrentSession = true;
81
- }
82
- }
97
+ if (lifecycleService.startupKind !== StartupKind.ReloadedWindow &&
98
+ this.configurationService.getValue(ChatConfiguration.RestoreLastPanelSession) === false) {
99
+ this.viewState.sessionId = undefined;
83
100
  }
84
- this._register(this.chatAgentService.onDidChangeAgents(() => {
85
- if (this.chatAgentService.getDefaultAgent(this.chatOptions?.location)) {
86
- if (!this._widget?.viewModel && !this._restoringSession) {
87
- const info = this.getTransferredOrPersistedSessionInfo();
88
- this._restoringSession =
89
- (info.sessionId ? this.chatService.getOrRestoreSession(LocalChatSessionUri.forSession(info.sessionId)) : Promise.resolve(undefined)).then(async (model) => {
90
- if (!this._widget) {
91
- return;
92
- }
93
- const wasVisible = this._widget.visible;
94
- try {
95
- this._widget.setVisible(false);
96
- await this.updateModel(model, info.inputValue || info.mode ? { inputState: { chatMode: info.mode }, inputValue: info.inputValue } : undefined);
97
- }
98
- finally {
99
- this.widget.setVisible(wasVisible);
101
+ this.chatViewLocationContext = ChatContextKeys.panelLocation.bindTo(contextKeyService);
102
+ this.sessionsViewerLimitedContext = ChatContextKeys.agentSessionsViewerLimited.bindTo(contextKeyService);
103
+ this.sessionsViewerOrientationContext = ChatContextKeys.agentSessionsViewerOrientation.bindTo(contextKeyService);
104
+ this.sessionsViewerPositionContext = ChatContextKeys.agentSessionsViewerPosition.bindTo(contextKeyService);
105
+ this.updateContextKeys(false);
106
+ this.registerListeners();
107
+ }
108
+ updateContextKeys(fromEvent) {
109
+ const viewLocation = this.viewDescriptorService.getViewLocationById(this.id);
110
+ const sideBarPosition = this.layoutService.getSideBarPosition();
111
+ const panelPosition = this.layoutService.getPanelPosition();
112
+ let sideSessionsOnRightPosition;
113
+ switch (viewLocation) {
114
+ case ViewContainerLocation.Sidebar:
115
+ sideSessionsOnRightPosition = sideBarPosition === Position.RIGHT;
116
+ break;
117
+ case ViewContainerLocation.Panel:
118
+ sideSessionsOnRightPosition = panelPosition !== Position.LEFT;
119
+ break;
120
+ default:
121
+ sideSessionsOnRightPosition = sideBarPosition === Position.LEFT;
122
+ break;
123
+ }
124
+ this.sessionsViewerPosition = sideSessionsOnRightPosition ? AgentSessionsViewerPosition.Right : AgentSessionsViewerPosition.Left;
125
+ this.sessionsViewerLimitedContext.set(this.sessionsViewerLimited);
126
+ this.chatViewLocationContext.set(viewLocation ?? ViewContainerLocation.AuxiliaryBar);
127
+ this.sessionsViewerOrientationContext.set(this.sessionsViewerOrientation);
128
+ this.sessionsViewerPositionContext.set(this.sessionsViewerPosition);
129
+ if (fromEvent && this.lastDimensions) {
130
+ this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
131
+ }
132
+ }
133
+ updateViewPaneClasses(fromEvent) {
134
+ const welcomeEnabled = this.configurationService.getValue(ChatConfiguration.ChatViewWelcomeEnabled) !== false;
135
+ this.viewPaneContainer?.classList.toggle('chat-view-welcome-enabled', welcomeEnabled);
136
+ if (fromEvent && this.lastDimensions) {
137
+ this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
138
+ }
139
+ }
140
+ registerListeners() {
141
+ this._register(this.chatAgentService.onDidChangeAgents(() => this.onDidChangeAgents()));
142
+ this._register(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('workbench.sideBar.location'))(() => this.updateContextKeys(true)));
143
+ this._register(this.layoutService.onDidChangePanelPosition(() => this.updateContextKeys(true)));
144
+ this._register(Event.filter(this.viewDescriptorService.onDidChangeContainerLocation, e => e.viewContainer === this.viewDescriptorService.getViewContainerByViewId(this.id))(() => this.updateContextKeys(true)));
145
+ this._register(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration(ChatConfiguration.ChatViewWelcomeEnabled))(() => this.updateViewPaneClasses(true)));
146
+ }
147
+ onDidChangeAgents() {
148
+ if (this.chatAgentService.getDefaultAgent(ChatAgentLocation.Chat)) {
149
+ if (!this._widget?.viewModel && !this.restoringSession) {
150
+ const info = this.getTransferredOrPersistedSessionInfo();
151
+ this.restoringSession =
152
+ (info.sessionId ? this.chatService.getOrRestoreSession(LocalChatSessionUri.forSession(info.sessionId)) : Promise.resolve(undefined)).then(async (modelRef) => {
153
+ if (!this._widget) {
154
+ return;
155
+ }
156
+ const wasVisible = this._widget.visible;
157
+ try {
158
+ this._widget.setVisible(false);
159
+ if (info.inputState && modelRef) {
160
+ modelRef.object.inputModel.setState(info.inputState);
100
161
  }
101
- });
102
- this._restoringSession.finally(() => this._restoringSession = undefined);
103
- }
162
+ await this.showModel(modelRef);
163
+ }
164
+ finally {
165
+ this._widget.setVisible(wasVisible);
166
+ }
167
+ });
168
+ this.restoringSession.finally(() => this.restoringSession = undefined);
104
169
  }
105
- this._onDidChangeViewWelcomeState.fire();
106
- }));
107
- ChatContextKeys.panelLocation.bindTo(contextKeyService).set(viewDescriptorService.getViewLocationById(options.id) ?? ViewContainerLocation.AuxiliaryBar);
170
+ }
171
+ this._onDidChangeViewWelcomeState.fire();
172
+ }
173
+ getTransferredOrPersistedSessionInfo() {
174
+ if (this.chatService.transferredSessionData?.location === ChatAgentLocation.Chat) {
175
+ const sessionId = this.chatService.transferredSessionData.sessionId;
176
+ return {
177
+ sessionId,
178
+ inputState: this.chatService.transferredSessionData.inputState,
179
+ };
180
+ }
181
+ return { sessionId: this.viewState.sessionId };
108
182
  }
109
183
  getActionsContext() {
110
- return this.widget?.viewModel ? {
111
- sessionResource: this.widget.viewModel.sessionResource,
184
+ return this._widget?.viewModel ? {
185
+ sessionResource: this._widget.viewModel.sessionResource,
112
186
  $mid: MarshalledId.ChatViewContext
113
187
  } : undefined;
114
188
  }
115
- async updateModel(model, viewState) {
116
- this.modelDisposables.clear();
117
- model = model ?? (this.chatService.transferredSessionData?.sessionId && this.chatService.transferredSessionData?.location === this.chatOptions.location
118
- ? await this.chatService.getOrRestoreSession(LocalChatSessionUri.forSession(this.chatService.transferredSessionData.sessionId))
119
- : this.chatService.startSession(this.chatOptions.location, CancellationToken.None));
120
- if (!model) {
121
- throw ( new Error('Could not start chat session'));
122
- }
123
- if (viewState) {
124
- this.updateViewState(viewState);
125
- }
126
- this.viewState.sessionId = model.sessionId;
127
- this._widget.setModel(model, { ...this.viewState });
189
+ async showModel(modelRef, startNewSession = true) {
190
+ if (this.modelRef.value?.object.requestInProgress.get()) {
191
+ const closingSessionResource = this.modelRef.value.object.sessionResource;
192
+ this.instantiationService.invokeFunction(showCloseActiveChatNotification, closingSessionResource);
193
+ }
194
+ const oldModelResource = this.modelRef.value?.object.sessionResource;
195
+ this.modelRef.value = undefined;
196
+ let ref;
197
+ if (startNewSession) {
198
+ ref = modelRef ?? (this.chatService.transferredSessionData?.sessionId && this.chatService.transferredSessionData?.location === ChatAgentLocation.Chat
199
+ ? await this.chatService.getOrRestoreSession(LocalChatSessionUri.forSession(this.chatService.transferredSessionData.sessionId))
200
+ : this.chatService.startSession(ChatAgentLocation.Chat));
201
+ if (!ref) {
202
+ throw ( new Error('Could not start chat session'));
203
+ }
204
+ }
205
+ this.modelRef.value = ref;
206
+ const model = ref?.object;
207
+ if (model) {
208
+ await this.updateWidgetLockState(model.sessionResource);
209
+ this.viewState.sessionId = model.sessionId;
210
+ }
211
+ this._widget.setModel(model);
212
+ this.titleControl?.update(model);
128
213
  this.updateActions();
214
+ if (oldModelResource) {
215
+ this.agentSessionsService.model.getSession(oldModelResource)?.setRead(true);
216
+ }
217
+ return model;
129
218
  }
130
219
  shouldShowWelcome() {
131
220
  const noPersistedSessions = !this.chatService.hasSessions();
132
- const hasCoreAgent = ( this.chatAgentService.getAgents().some(
133
- agent => agent.isCore && agent.locations.includes(this.chatOptions.location)
134
- ));
135
- const hasDefaultAgent = this.chatAgentService.getDefaultAgent(this.chatOptions.location) !== undefined;
221
+ const hasCoreAgent = ( this.chatAgentService.getAgents().some(agent => agent.isCore && agent.locations.includes(ChatAgentLocation.Chat)));
222
+ const hasDefaultAgent = this.chatAgentService.getDefaultAgent(ChatAgentLocation.Chat) !== undefined;
136
223
  const shouldShow = !hasCoreAgent && (!hasDefaultAgent || !this._widget?.viewModel && noPersistedSessions);
137
- this.logService.trace(`ChatViewPane#shouldShowWelcome(${this.chatOptions.location}) = ${shouldShow}: hasCoreAgent=${hasCoreAgent} hasDefaultAgent=${hasDefaultAgent} || noViewModel=${!this._widget?.viewModel} && noPersistedSessions=${noPersistedSessions}`);
224
+ this.logService.trace(`ChatViewPane#shouldShowWelcome() = ${shouldShow}: hasCoreAgent=${hasCoreAgent} hasDefaultAgent=${hasDefaultAgent} || noViewModel=${!this._widget?.viewModel} && noPersistedSessions=${noPersistedSessions}`);
138
225
  return !!shouldShow;
139
226
  }
140
- getTransferredOrPersistedSessionInfo() {
141
- if (this.chatService.transferredSessionData?.location === this.chatOptions.location) {
142
- const sessionId = this.chatService.transferredSessionData.sessionId;
143
- return {
144
- sessionId,
145
- inputValue: this.chatService.transferredSessionData.inputValue,
146
- mode: this.chatService.transferredSessionData.mode
227
+ renderBody(parent) {
228
+ super.renderBody(parent);
229
+ this.telemetryService.publicLog2('chatViewPaneOpened');
230
+ this.viewPaneContainer = parent;
231
+ this.viewPaneContainer.classList.add('chat-viewpane');
232
+ this.updateViewPaneClasses(false);
233
+ this.createControls(parent);
234
+ this.setupContextMenu(parent);
235
+ this.applyModel();
236
+ }
237
+ createControls(parent) {
238
+ const sessionsControl = this.createSessionsControl(parent);
239
+ const welcomeController = this.welcomeController = this._register(this.instantiationService.createInstance(ChatViewWelcomeController, parent, this, ChatAgentLocation.Chat));
240
+ const chatWidget = this.createChatControl(parent);
241
+ this.registerControlsListeners(sessionsControl, chatWidget, welcomeController);
242
+ this.updateSessionsControlVisibility();
243
+ }
244
+ createSessionsControl(parent) {
245
+ const that = this;
246
+ const sessionsContainer = this.sessionsContainer = parent.appendChild($('.agent-sessions-container'));
247
+ const sessionsTitleContainer = this.sessionsTitleContainer = append(sessionsContainer, $('.agent-sessions-title-container'));
248
+ const sessionsTitle = this.sessionsTitle = append(sessionsTitleContainer, $('span.agent-sessions-title'));
249
+ sessionsTitle.textContent = this.sessionsViewerLimited ? ( localize(5646, "Recent Sessions")) : ( localize(5647, "All Sessions"));
250
+ const sessionsToolbarContainer = append(sessionsTitleContainer, $('.agent-sessions-toolbar'));
251
+ const sessionsToolbar = this._register(this.instantiationService.createInstance(MenuWorkbenchToolBar, sessionsToolbarContainer, MenuId.AgentSessionsToolbar, {
252
+ menuOptions: { shouldForwardArgs: true }
253
+ }));
254
+ const sessionsFilter = this._register(this.instantiationService.createInstance(AgentSessionsFilter, {
255
+ filterMenuId: MenuId.AgentSessionsViewerFilterSubMenu,
256
+ limitResults: () => {
257
+ return that.sessionsViewerLimited ? ChatViewPane_1.SESSIONS_LIMIT : undefined;
258
+ },
259
+ overrideExclude(session) {
260
+ if (that.sessionsViewerLimited) {
261
+ if (session.isArchived()) {
262
+ return true;
263
+ }
264
+ return false;
265
+ }
266
+ return undefined;
267
+ },
268
+ notifyResults(count) {
269
+ that.notifySessionsControlCountChanged(count);
270
+ }
271
+ }));
272
+ this._register(Event.runAndSubscribe(sessionsFilter.onDidChange, () => {
273
+ sessionsToolbarContainer.classList.toggle('filtered', !sessionsFilter.isDefault());
274
+ }));
275
+ this.sessionsControlContainer = append(sessionsContainer, $('.agent-sessions-control-container'));
276
+ const sessionsControl = this.sessionsControl = this._register(this.instantiationService.createInstance(AgentSessionsControl, this.sessionsControlContainer, {
277
+ allowOpenSessionsInPanel: true,
278
+ filter: sessionsFilter
279
+ }));
280
+ this._register(this.onDidChangeBodyVisibility(visible => sessionsControl.setVisible(visible)));
281
+ sessionsToolbar.context = sessionsControl;
282
+ this.sessionsLinkContainer = append(sessionsContainer, $('.agent-sessions-link-container'));
283
+ this.sessionsLink = this._register(this.instantiationService.createInstance(Link, this.sessionsLinkContainer, {
284
+ label: this.sessionsViewerLimited ? ( localize(5648, "Show All Sessions")) : ( localize(5649, "Show Recent Sessions")),
285
+ href: '',
286
+ }, {
287
+ opener: () => {
288
+ this.sessionsViewerLimited = !this.sessionsViewerLimited;
289
+ this.notifySessionsControlLimitedChanged(true);
290
+ sessionsControl.focus();
291
+ }
292
+ }));
293
+ return sessionsControl;
294
+ }
295
+ notifySessionsControlLimitedChanged(triggerLayout) {
296
+ this.sessionsViewerLimitedContext.set(this.sessionsViewerLimited);
297
+ if (this.sessionsTitle) {
298
+ this.sessionsTitle.textContent = this.sessionsViewerLimited ? ( localize(5646, "Recent Sessions")) : ( localize(5647, "All Sessions"));
299
+ }
300
+ if (this.sessionsLink) {
301
+ this.sessionsLink.link = {
302
+ label: this.sessionsViewerLimited ? ( localize(5648, "Show All Sessions")) : ( localize(5649, "Show Recent Sessions")),
303
+ href: ''
147
304
  };
148
305
  }
306
+ this.sessionsControl?.update();
307
+ if (triggerLayout && this.lastDimensions) {
308
+ this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
309
+ }
310
+ }
311
+ notifySessionsControlCountChanged(newSessionsCount) {
312
+ const countChanged = typeof newSessionsCount === 'number' && newSessionsCount !== this.sessionsCount;
313
+ this.sessionsCount = newSessionsCount ?? this.sessionsCount;
314
+ const { changed: visibilityChanged, visible } = this.updateSessionsControlVisibility();
315
+ if (visibilityChanged || (countChanged && visible)) {
316
+ if (this.lastDimensions) {
317
+ this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
318
+ }
319
+ }
320
+ }
321
+ updateSessionsControlVisibility() {
322
+ if (!this.sessionsContainer || !this.viewPaneContainer) {
323
+ return { changed: false, visible: false };
324
+ }
325
+ let newSessionsContainerVisible;
326
+ if (!this.configurationService.getValue(ChatConfiguration.ChatViewSessionsEnabled)) {
327
+ newSessionsContainerVisible = false;
328
+ }
149
329
  else {
150
- return { sessionId: this.viewState.sessionId };
330
+ if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked) {
331
+ newSessionsContainerVisible =
332
+ (!this._widget || this._widget?.isEmpty()) &&
333
+ !this.welcomeController?.isShowingWelcome.get() &&
334
+ (this.sessionsCount > 0 || !this.sessionsViewerLimited);
335
+ }
336
+ else {
337
+ newSessionsContainerVisible = !!this.lastDimensions && this.lastDimensions.width >= ChatViewPane_1.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH;
338
+ }
151
339
  }
340
+ this.viewPaneContainer.classList.toggle('has-sessions-control', newSessionsContainerVisible);
341
+ const sessionsContainerVisible = this.sessionsContainer.style.display !== 'none';
342
+ setVisibility(newSessionsContainerVisible, this.sessionsContainer);
343
+ return {
344
+ changed: sessionsContainerVisible !== newSessionsContainerVisible,
345
+ visible: newSessionsContainerVisible
346
+ };
152
347
  }
153
- async renderBody(parent) {
154
- super.renderBody(parent);
155
- this._register(this.instantiationService.createInstance(ChatViewWelcomeController, parent, this, this.chatOptions.location));
156
- this.telemetryService.publicLog2('chatViewPaneOpened');
157
- const scopedInstantiationService = this._register(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService]))));
348
+ createChatControl(parent) {
349
+ const chatControlsContainer = append(parent, $('.chat-controls-container'));
158
350
  const locationBasedColors = this.getLocationBasedColors();
159
- const editorOverflowNode = this.layoutService.getContainer(getWindow(parent)).appendChild($('.chat-editor-overflow.monaco-editor'));
160
- this._register({ dispose: () => editorOverflowNode.remove() });
161
- this._widget = this._register(scopedInstantiationService.createInstance(ChatWidget, this.chatOptions.location, { viewId: this.id }, {
351
+ const editorOverflowWidgetsDomNode = this.layoutService.getContainer(getWindow(chatControlsContainer)).appendChild($('.chat-editor-overflow.monaco-editor'));
352
+ this._register(toDisposable(() => editorOverflowWidgetsDomNode.remove()));
353
+ this.createChatTitleControl(chatControlsContainer);
354
+ const scopedInstantiationService = this._register(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService]))));
355
+ this._widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Chat, { viewId: this.id }, {
162
356
  autoScroll: mode => mode !== ChatModeKind.Ask,
163
- renderFollowups: this.chatOptions.location === ChatAgentLocation.Chat,
357
+ renderFollowups: true,
164
358
  supportsFileReferences: true,
359
+ clear: () => this.clear(),
165
360
  rendererOptions: {
166
361
  renderTextEditsAsSummary: (uri) => {
167
362
  return true;
@@ -169,8 +364,8 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
169
364
  referencesExpandedWhenEmptyResponse: false,
170
365
  progressMessageAtBottomOfResponse: mode => mode !== ChatModeKind.Ask,
171
366
  },
172
- editorOverflowWidgetsDomNode: editorOverflowNode,
173
- enableImplicitContext: this.chatOptions.location === ChatAgentLocation.Chat,
367
+ editorOverflowWidgetsDomNode,
368
+ enableImplicitContext: true,
174
369
  enableWorkingSet: 'explicit',
175
370
  supportsChangingModes: true,
176
371
  }, {
@@ -180,43 +375,74 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
180
375
  inputEditorBackground: locationBasedColors.background,
181
376
  resultEditorBackground: editorBackground,
182
377
  }));
183
- this._register(this.onDidChangeBodyVisibility(visible => {
184
- this._widget.setVisible(visible);
378
+ this._widget.render(chatControlsContainer);
379
+ const updateWidgetVisibility = (reader) => this._widget.setVisible(this.isBodyVisible() && !this.welcomeController?.isShowingWelcome.read(reader));
380
+ this._register(this.onDidChangeBodyVisibility(() => updateWidgetVisibility()));
381
+ this._register(autorun(reader => updateWidgetVisibility(reader)));
382
+ return this._widget;
383
+ }
384
+ createChatTitleControl(parent) {
385
+ this.titleControl = this._register(this.instantiationService.createInstance(ChatViewTitleControl, parent, {
386
+ updateTitle: title => this.updateTitle(title),
387
+ focusChat: () => this._widget.focusInput()
388
+ }));
389
+ this._register(this.titleControl.onDidChangeHeight(() => {
390
+ if (this.lastDimensions) {
391
+ this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
392
+ }
185
393
  }));
186
- this._register(this._widget.onDidClear(() => this.clear()));
187
- this._widget.render(parent);
188
- const info = this.getTransferredOrPersistedSessionInfo();
189
- const model = info.sessionId ? await this.chatService.getOrRestoreSession(LocalChatSessionUri.forSession(info.sessionId)) : undefined;
190
- await this.updateModel(model, info.inputValue || info.mode ? { inputState: { chatMode: info.mode }, inputValue: info.inputValue } : undefined);
191
394
  }
192
- acceptInput(query) {
193
- this._widget.acceptInput(query);
395
+ registerControlsListeners(sessionsControl, chatWidget, welcomeController) {
396
+ this._register(Event.any(chatWidget.onDidChangeEmptyState, Event.fromObservable(welcomeController.isShowingWelcome), Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration(ChatConfiguration.ChatViewSessionsEnabled)))(() => {
397
+ if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked) {
398
+ sessionsControl.clearFocus();
399
+ }
400
+ this.notifySessionsControlCountChanged();
401
+ }));
402
+ this._register(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration(ChatConfiguration.ChatViewSessionsOrientation))(() => {
403
+ if (this.lastDimensions) {
404
+ this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
405
+ }
406
+ }));
194
407
  }
195
- async clear() {
196
- if (this.widget.viewModel) {
197
- await this.chatService.clearSession(this.widget.viewModel.sessionResource);
408
+ setupContextMenu(parent) {
409
+ this._register(addDisposableListener(parent, EventType.CONTEXT_MENU, e => {
410
+ EventHelper.stop(e, true);
411
+ this.contextMenuService.showContextMenu({
412
+ menuId: MenuId.ChatWelcomeContext,
413
+ contextKeyService: this.contextKeyService,
414
+ getAnchor: () => ( new StandardMouseEvent(getWindow(parent), e))
415
+ });
416
+ }));
417
+ }
418
+ async applyModel() {
419
+ const info = this.getTransferredOrPersistedSessionInfo();
420
+ const modelRef = info.sessionId ? await this.chatService.getOrRestoreSession(LocalChatSessionUri.forSession(info.sessionId)) : undefined;
421
+ if (modelRef && info.inputState) {
422
+ modelRef.object.inputModel.setState(info.inputState);
198
423
  }
424
+ await this.showModel(modelRef);
425
+ }
426
+ async clear() {
199
427
  this.updateViewState();
200
- await this.updateModel(undefined);
428
+ await this.showModel(undefined);
201
429
  this.updateActions();
202
430
  }
203
- async loadSession(sessionId, viewState) {
204
- if (this.widget.viewModel) {
205
- await this.chatService.clearSession(this.widget.viewModel.sessionResource);
206
- }
207
- if (sessionId.scheme === Schemas.vscodeLocalChatSession) {
208
- const parsed = LocalChatSessionUri.parse(sessionId);
209
- if (parsed?.chatSessionType) {
210
- await this.chatSessionsService.canResolveChatSession(sessionId);
211
- const contributions = this.chatSessionsService.getAllChatSessionContributions();
212
- const contribution = contributions.find((c) => c.type === parsed.chatSessionType);
213
- if (contribution) {
214
- this.widget.lockToCodingAgent(contribution.name, contribution.displayName, contribution.type);
215
- }
431
+ async loadSession(sessionResource) {
432
+ return this.progressService.withProgress({ location: ChatViewId, delay: 200 }, async () => {
433
+ let queue = Promise.resolve();
434
+ const clearWidget = disposableTimeout(() => {
435
+ queue = this.showModel(undefined, false).then(() => { });
436
+ }, 100);
437
+ const sessionType = getChatSessionType(sessionResource);
438
+ if (sessionType !== localChatSessionType) {
439
+ await this.chatSessionsService.canResolveChatSession(sessionResource);
216
440
  }
217
- }
218
- const newModel = await this.chatService.loadSessionForResource(sessionId, ChatAgentLocation.Chat, CancellationToken.None);
219
- await this.updateModel(newModel, viewState);
441
+ const newModelRef = await this.chatService.loadSessionForResource(sessionResource, ChatAgentLocation.Chat, CancellationToken.None);
442
+ clearWidget.dispose();
443
+ await queue;
444
+ return this.showModel(newModelRef);
445
+ });
220
446
  }
221
447
  focusInput() {
222
448
  this._widget.focusInput();
@@ -227,7 +453,74 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
227
453
  }
228
454
  layoutBody(height, width) {
229
455
  super.layoutBody(height, width);
230
- this._widget.layout(height, width);
456
+ this.lastDimensions = { height, width };
457
+ let remainingHeight = height;
458
+ let remainingWidth = width;
459
+ const { heightReduction, widthReduction } = this.layoutSessionsControl(remainingHeight, remainingWidth);
460
+ remainingHeight -= heightReduction;
461
+ remainingWidth -= widthReduction;
462
+ remainingHeight -= this.titleControl?.getHeight() ?? 0;
463
+ this._widget.layout(remainingHeight, remainingWidth);
464
+ }
465
+ layoutSessionsControl(height, width) {
466
+ let heightReduction = 0;
467
+ let widthReduction = 0;
468
+ if (!this.sessionsContainer || !this.sessionsControlContainer || !this.sessionsControl || !this.viewPaneContainer || !this.sessionsTitleContainer || !this.sessionsLinkContainer || !this.sessionsTitle || !this.sessionsLink) {
469
+ return { heightReduction, widthReduction };
470
+ }
471
+ const configuredSessionsViewerOrientation = this.configurationService.getValue(ChatConfiguration.ChatViewSessionsOrientation);
472
+ const oldSessionsViewerOrientation = this.sessionsViewerOrientation;
473
+ let newSessionsViewerOrientation;
474
+ switch (configuredSessionsViewerOrientation) {
475
+ case 'stacked':
476
+ newSessionsViewerOrientation = AgentSessionsViewerOrientation.Stacked;
477
+ break;
478
+ default:
479
+ newSessionsViewerOrientation = width >= ChatViewPane_1.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH ? AgentSessionsViewerOrientation.SideBySide : AgentSessionsViewerOrientation.Stacked;
480
+ }
481
+ this.sessionsViewerOrientation = newSessionsViewerOrientation;
482
+ if (newSessionsViewerOrientation === AgentSessionsViewerOrientation.SideBySide) {
483
+ this.viewPaneContainer.classList.add('sessions-control-orientation-sidebyside');
484
+ this.viewPaneContainer.classList.toggle('sessions-control-position-left', this.sessionsViewerPosition === AgentSessionsViewerPosition.Left);
485
+ this.sessionsViewerOrientationContext.set(AgentSessionsViewerOrientation.SideBySide);
486
+ }
487
+ else {
488
+ this.viewPaneContainer.classList.remove('sessions-control-orientation-sidebyside');
489
+ this.viewPaneContainer.classList.remove('sessions-control-position-left');
490
+ this.sessionsViewerOrientationContext.set(AgentSessionsViewerOrientation.Stacked);
491
+ }
492
+ if (oldSessionsViewerOrientation !== this.sessionsViewerOrientation) {
493
+ const oldSessionsViewerLimited = this.sessionsViewerLimited;
494
+ this.sessionsViewerLimited = this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked;
495
+ if (oldSessionsViewerLimited !== this.sessionsViewerLimited) {
496
+ this.notifySessionsControlLimitedChanged(false );
497
+ }
498
+ }
499
+ this.updateSessionsControlVisibility();
500
+ const availableSessionsHeight = height - this.sessionsTitleContainer.offsetHeight - this.sessionsLinkContainer.offsetHeight;
501
+ if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.SideBySide) {
502
+ this.sessionsControlContainer.style.height = `${availableSessionsHeight}px`;
503
+ this.sessionsControlContainer.style.width = `${ChatViewPane_1.SESSIONS_SIDEBAR_WIDTH}px`;
504
+ this.sessionsControl.layout(availableSessionsHeight, ChatViewPane_1.SESSIONS_SIDEBAR_WIDTH);
505
+ heightReduction = 0;
506
+ widthReduction = this.sessionsContainer.offsetWidth;
507
+ }
508
+ else {
509
+ let sessionsHeight;
510
+ if (this.sessionsViewerLimited) {
511
+ sessionsHeight = this.sessionsCount * AgentSessionsListDelegate.ITEM_HEIGHT;
512
+ }
513
+ else {
514
+ sessionsHeight = ((ChatViewPane_1.SESSIONS_LIMIT + 2) ) * AgentSessionsListDelegate.ITEM_HEIGHT;
515
+ }
516
+ sessionsHeight = Math.min(availableSessionsHeight, sessionsHeight);
517
+ this.sessionsControlContainer.style.height = `${sessionsHeight}px`;
518
+ this.sessionsControlContainer.style.width = ``;
519
+ this.sessionsControl.layout(sessionsHeight, width);
520
+ heightReduction = this.sessionsContainer.offsetHeight;
521
+ widthReduction = 0;
522
+ }
523
+ return { heightReduction, widthReduction };
231
524
  }
232
525
  saveState() {
233
526
  if (this._widget?.viewModel) {
@@ -239,28 +532,67 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
239
532
  }
240
533
  updateViewState(viewState) {
241
534
  const newViewState = viewState ?? this._widget.getViewState();
242
- for (const [key, value] of Object.entries(newViewState)) {
243
- this.viewState[key] = value;
535
+ if (newViewState) {
536
+ for (const [key, value] of Object.entries(newViewState)) {
537
+ this.viewState[key] = value;
538
+ }
539
+ }
540
+ }
541
+ async updateWidgetLockState(sessionResource) {
542
+ const sessionType = getChatSessionType(sessionResource);
543
+ if (sessionType === localChatSessionType) {
544
+ this._widget.unlockFromCodingAgent();
545
+ return;
546
+ }
547
+ let canResolve = false;
548
+ try {
549
+ canResolve = await this.chatSessionsService.canResolveChatSession(sessionResource);
550
+ }
551
+ catch (error) {
552
+ this.logService.warn(`Failed to resolve chat session '${( sessionResource.toString())}' for locking`, error);
553
+ }
554
+ if (!canResolve) {
555
+ this._widget.unlockFromCodingAgent();
556
+ return;
557
+ }
558
+ const contribution = this.chatSessionsService.getChatSessionContribution(sessionType);
559
+ if (contribution) {
560
+ this._widget.lockToCodingAgent(contribution.name, contribution.displayName, contribution.type);
561
+ }
562
+ else {
563
+ this._widget.unlockFromCodingAgent();
564
+ }
565
+ }
566
+ get singleViewPaneContainerTitle() {
567
+ if (this.titleControl) {
568
+ const titleControlTitle = this.titleControl.getSingleViewPaneContainerTitle();
569
+ if (titleControlTitle) {
570
+ return titleControlTitle;
571
+ }
244
572
  }
573
+ return super.singleViewPaneContainerTitle;
245
574
  }
246
575
  };
247
- ChatViewPane = ( __decorate([
248
- ( __param(2, IKeybindingService)),
249
- ( __param(3, IContextMenuService)),
250
- ( __param(4, IConfigurationService)),
251
- ( __param(5, IContextKeyService)),
252
- ( __param(6, IViewDescriptorService)),
253
- ( __param(7, IInstantiationService)),
254
- ( __param(8, IOpenerService)),
255
- ( __param(9, IThemeService)),
256
- ( __param(10, IHoverService)),
257
- ( __param(11, IStorageService)),
258
- ( __param(12, IChatService)),
259
- ( __param(13, IChatAgentService)),
260
- ( __param(14, ILogService)),
261
- ( __param(15, ILayoutService)),
262
- ( __param(16, IChatSessionsService)),
263
- ( __param(17, ITelemetryService))
576
+ ChatViewPane = ChatViewPane_1 = ( __decorate([
577
+ ( __param(1, IKeybindingService)),
578
+ ( __param(2, IContextMenuService)),
579
+ ( __param(3, IConfigurationService)),
580
+ ( __param(4, IContextKeyService)),
581
+ ( __param(5, IViewDescriptorService)),
582
+ ( __param(6, IInstantiationService)),
583
+ ( __param(7, IOpenerService)),
584
+ ( __param(8, IThemeService)),
585
+ ( __param(9, IHoverService)),
586
+ ( __param(10, IStorageService)),
587
+ ( __param(11, IChatService)),
588
+ ( __param(12, IChatAgentService)),
589
+ ( __param(13, ILogService)),
590
+ ( __param(14, IWorkbenchLayoutService)),
591
+ ( __param(15, IChatSessionsService)),
592
+ ( __param(16, ITelemetryService)),
593
+ ( __param(17, ILifecycleService)),
594
+ ( __param(18, IProgressService)),
595
+ ( __param(19, IAgentSessionsService))
264
596
  ], ChatViewPane));
265
597
 
266
- export { CHAT_SIDEBAR_PANEL_ID, ChatViewPane };
598
+ export { ChatViewPane };