@codingame/monaco-vscode-katex-common 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 (262) hide show
  1. package/empty.js +1 -0
  2. package/package.json +45 -0
  3. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +37 -0
  4. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +127 -0
  5. package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +27 -0
  6. package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +81 -0
  7. package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +44 -0
  8. package/vscode/src/vs/platform/actions/browser/buttonbar.js +172 -0
  9. package/vscode/src/vs/platform/editor/browser/editor.d.ts +12 -0
  10. package/vscode/src/vs/platform/editor/browser/editor.js +51 -0
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +41 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +295 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.d.ts +2 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +60 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +65 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +650 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +2 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +364 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +38 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +207 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.d.ts +17 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.js +216 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.d.ts +24 -0
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.js +114 -0
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.d.ts +34 -0
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.js +141 -0
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.d.ts +169 -0
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.js +951 -0
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.d.ts +19 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.js +109 -0
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.d.ts +12 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.js +47 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.d.ts +13 -0
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.js +49 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.d.ts +27 -0
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.js +160 -0
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.d.ts +40 -0
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.js +286 -0
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.d.ts +13 -0
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.js +49 -0
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.d.ts +34 -0
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.js +101 -0
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.d.ts +14 -0
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.js +30 -0
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.d.ts +11 -0
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.js +37 -0
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.d.ts +17 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.js +69 -0
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.d.ts +116 -0
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.js +417 -0
  51. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.d.ts +20 -0
  52. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.js +66 -0
  53. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.d.ts +25 -0
  54. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.js +123 -0
  55. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.d.ts +18 -0
  56. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.js +60 -0
  57. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.d.ts +16 -0
  58. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.js +46 -0
  59. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.d.ts +19 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.js +57 -0
  61. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.d.ts +94 -0
  62. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.js +567 -0
  63. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.d.ts +34 -0
  64. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.js +224 -0
  65. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.d.ts +34 -0
  66. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.js +259 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.d.ts +38 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.js +160 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.d.ts +16 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.js +55 -0
  71. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.d.ts +17 -0
  72. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.js +117 -0
  73. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.d.ts +66 -0
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.js +528 -0
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.d.ts +31 -0
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.js +160 -0
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.d.ts +17 -0
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.js +49 -0
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.d.ts +18 -0
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.js +91 -0
  81. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.d.ts +13 -0
  82. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.js +6 -0
  83. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.d.ts +54 -0
  84. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.js +429 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.d.ts +40 -0
  86. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.js +347 -0
  87. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.d.ts +56 -0
  88. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.js +164 -0
  89. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.d.ts +32 -0
  90. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.js +224 -0
  91. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.d.ts +35 -0
  92. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.js +173 -0
  93. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatConfirmationWidget.css +341 -0
  94. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatExtensionsContent.css +27 -0
  95. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMarkdownPart.css +23 -0
  96. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMcpServersInteractionContent.css +14 -0
  97. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatPullRequestContent.css +75 -0
  98. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css +221 -0
  99. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatThinkingContent.css +162 -0
  100. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +41 -0
  101. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +94 -0
  102. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +15 -0
  103. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +96 -0
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +18 -0
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +147 -0
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +14 -0
  107. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.js +23 -0
  108. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +68 -0
  109. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +353 -0
  110. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +100 -0
  111. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +1085 -0
  112. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +39 -0
  113. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +275 -0
  114. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +32 -0
  115. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +119 -0
  116. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +19 -0
  117. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +36 -0
  118. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +21 -0
  119. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.js +130 -0
  120. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +25 -0
  121. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +225 -0
  122. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +24 -0
  123. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.js +101 -0
  124. package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.d.ts +42 -0
  125. package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.js +127 -0
  126. package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.d.ts +43 -0
  127. package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.js +388 -0
  128. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +49 -0
  129. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +721 -0
  130. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.d.ts +13 -0
  131. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +52 -0
  132. package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.d.ts +39 -0
  133. package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.js +409 -0
  134. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.d.ts +334 -0
  135. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +2008 -0
  136. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.d.ts +52 -0
  137. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.js +93 -0
  138. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.d.ts +217 -0
  139. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1573 -0
  140. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.d.ts +43 -0
  141. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +249 -0
  142. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.d.ts +50 -0
  143. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +84 -0
  144. package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.d.ts +32 -0
  145. package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.js +174 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +31 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +101 -0
  148. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.d.ts +19 -0
  149. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.js +76 -0
  150. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionAction.css +39 -0
  151. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.d.ts +292 -0
  152. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +2014 -0
  153. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css +171 -0
  154. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.d.ts +173 -0
  155. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +797 -0
  156. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.d.ts +54 -0
  157. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.js +345 -0
  158. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.d.ts +10 -0
  159. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +1069 -0
  160. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +34 -0
  161. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +139 -0
  162. package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css +2880 -0
  163. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatAgentHover.css +87 -0
  164. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatCodeBlockPill.css +139 -0
  165. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatInlineAnchorWidget.css +61 -0
  166. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewWelcome.css +209 -0
  167. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.d.ts +28 -0
  168. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.js +135 -0
  169. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.d.ts +28 -0
  170. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.js +147 -0
  171. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +71 -0
  172. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +279 -0
  173. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.d.ts +28 -0
  174. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +28 -0
  175. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.d.ts +13 -0
  176. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +38 -0
  177. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +55 -0
  178. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +176 -0
  179. package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.d.ts +45 -0
  180. package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.js +207 -0
  181. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +48 -0
  182. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +373 -0
  183. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +171 -0
  184. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +1442 -0
  185. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +199 -0
  186. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +482 -0
  187. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +28 -0
  188. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +37 -0
  189. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +95 -0
  190. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +497 -0
  191. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +76 -0
  192. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +464 -0
  193. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +124 -0
  194. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +562 -0
  195. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +42 -0
  196. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +279 -0
  197. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +411 -0
  198. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +13 -0
  199. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +66 -0
  200. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +61 -0
  201. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +154 -0
  202. package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.d.ts +19 -0
  203. package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +201 -0
  204. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +41 -0
  205. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +372 -0
  206. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +4 -0
  207. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +58 -0
  208. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +26 -0
  209. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +594 -0
  210. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +8 -0
  211. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +55 -0
  212. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +273 -0
  213. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1746 -0
  214. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +50 -0
  215. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +269 -0
  216. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +258 -0
  217. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +806 -0
  218. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +41 -0
  219. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +116 -0
  220. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +17 -0
  221. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +62 -0
  222. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +27 -0
  223. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +40 -0
  224. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +23 -0
  225. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +295 -0
  226. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +51 -0
  227. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +241 -0
  228. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +24 -0
  229. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +146 -0
  230. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +28 -0
  231. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +90 -0
  232. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +10 -0
  233. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +41 -0
  234. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +21 -0
  235. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +42 -0
  236. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +25 -0
  237. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +77 -0
  238. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +469 -0
  239. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +149 -0
  240. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +823 -0
  241. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +180 -0
  242. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +29 -0
  243. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +102 -0
  244. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +567 -0
  245. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +30 -0
  246. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +189 -0
  247. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +75 -0
  248. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +439 -0
  249. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
  250. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +263 -0
  251. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
  252. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +48 -0
  253. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +13 -0
  254. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +39 -0
  255. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +19 -0
  256. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +89 -0
  257. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +26 -0
  258. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +92 -0
  259. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
  260. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +108 -0
  261. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +34 -0
  262. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +145 -0
@@ -0,0 +1,1085 @@
1
+
2
+ import { registerCss } from '@codingame/monaco-vscode-api/css';
3
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
+ import { h, addDisposableListener, EventType, clearNode, getActiveWindow, getComputedStyle } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
5
+ import { ActionBar } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionbar';
6
+ import { MarkdownString, isMarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
7
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
8
+ import { migrateLegacyTerminalToolSpecificData } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chat';
9
+ import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
10
+ import { ChatQueryTitlePart } from '../chatConfirmationWidget.js';
11
+ import { ChatMarkdownContentPart } from '../chatMarkdownContentPart.js';
12
+ import { ChatProgressSubPart } from '../chatProgressContentPart.js';
13
+ import { BaseChatToolInvocationSubPart } from './chatToolInvocationSubPart.js';
14
+ import * as chatTerminalToolProgressPart from '../media/chatTerminalToolProgressPart.css';
15
+ import { Action } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
16
+ import { ITerminalChatService, ITerminalService, ITerminalConfigurationService, ITerminalEditorService, ITerminalGroupService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
17
+ import { Disposable, MutableDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
18
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
19
+ import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
20
+ import { getTerminalCommandDecorationTooltip, getTerminalCommandDecorationState, DecorationSelector } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationStyles';
21
+ import { DomScrollableElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
22
+ import { ScrollbarVisibility } from '@codingame/monaco-vscode-api/vscode/vs/base/common/scrollable';
23
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
24
+ import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
25
+ import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
26
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
27
+ import { stripIcons } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iconLabels';
28
+ import { IAccessibleViewService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/browser/accessibleView.service';
29
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
30
+ import { AccessibilityVerbositySettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
31
+ import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
32
+ import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
33
+ import { DetachedTerminalCommandMirror } from '../../../../terminal/browser/chatTerminalCommandMirror.js';
34
+ import { DetachedProcessInfo } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/detachedTerminal';
35
+ import { TerminalLocation } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal';
36
+ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
37
+ import { TerminalContribCommandId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/terminalContribExports';
38
+ import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
39
+ import { isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
40
+ import { removeAnsiEscapeCodes } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
41
+ import { Color } from '@codingame/monaco-vscode-api/vscode/vs/base/common/color';
42
+ import { TERMINAL_BACKGROUND_COLOR } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry';
43
+ import { PANEL_BACKGROUND } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
44
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
45
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
46
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
47
+ import { editorBackground } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
48
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
49
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
50
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
51
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
52
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
53
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
54
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
55
+ import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
56
+
57
+ registerCss(chatTerminalToolProgressPart);
58
+ const MIN_OUTPUT_ROWS = 1;
59
+ const MAX_OUTPUT_ROWS = 10;
60
+ const expandedStateByInvocation = ( new WeakMap());
61
+ let TerminalCommandDecoration = class TerminalCommandDecoration extends Disposable {
62
+ constructor(_options, _hoverService) {
63
+ super();
64
+ this._options = _options;
65
+ this._hoverService = _hoverService;
66
+ const decorationElements = h('span.chat-terminal-command-decoration@decoration', { role: 'img', tabIndex: 0 });
67
+ this._element = decorationElements.decoration;
68
+ this._attachElementToContainer();
69
+ }
70
+ _attachElementToContainer() {
71
+ const container = this._options.getCommandBlock();
72
+ if (!container) {
73
+ return;
74
+ }
75
+ const decoration = this._element;
76
+ if (!decoration.isConnected || decoration.parentElement !== container) {
77
+ const icon = this._options.getIconElement();
78
+ if (icon && icon.parentElement === container) {
79
+ icon.insertAdjacentElement('afterend', decoration);
80
+ }
81
+ else {
82
+ container.insertBefore(decoration, container.firstElementChild ?? null);
83
+ }
84
+ }
85
+ this._register(this._hoverService.setupDelayedHover(decoration, () => ({
86
+ content: this._getHoverText()
87
+ })));
88
+ this._attachInteractionHandlers(decoration);
89
+ }
90
+ _getHoverText() {
91
+ const command = this._options.getResolvedCommand();
92
+ const storedState = this._options.terminalData.terminalCommandState;
93
+ return getTerminalCommandDecorationTooltip(command, storedState) || '';
94
+ }
95
+ update(command) {
96
+ this._attachElementToContainer();
97
+ const decoration = this._element;
98
+ const resolvedCommand = command ?? this._options.getResolvedCommand();
99
+ this._apply(decoration, resolvedCommand);
100
+ }
101
+ _apply(decoration, command) {
102
+ const terminalData = this._options.terminalData;
103
+ let storedState = terminalData.terminalCommandState;
104
+ if (command) {
105
+ const existingState = terminalData.terminalCommandState ?? {};
106
+ terminalData.terminalCommandState = {
107
+ ...existingState,
108
+ exitCode: command.exitCode,
109
+ timestamp: command.timestamp ?? existingState.timestamp,
110
+ duration: command.duration ?? existingState.duration
111
+ };
112
+ storedState = terminalData.terminalCommandState;
113
+ }
114
+ else if (!storedState) {
115
+ const now = Date.now();
116
+ terminalData.terminalCommandState = { exitCode: undefined, timestamp: now };
117
+ storedState = terminalData.terminalCommandState;
118
+ }
119
+ const decorationState = getTerminalCommandDecorationState(command, storedState);
120
+ const tooltip = getTerminalCommandDecorationTooltip(command, storedState);
121
+ decoration.className = `chat-terminal-command-decoration ${DecorationSelector.CommandDecoration}`;
122
+ decoration.classList.add(DecorationSelector.Codicon);
123
+ for (const className of decorationState.classNames) {
124
+ decoration.classList.add(className);
125
+ }
126
+ decoration.classList.add(...ThemeIcon.asClassNameArray(decorationState.icon));
127
+ const isInteractive = !decoration.classList.contains(DecorationSelector.Default);
128
+ decoration.tabIndex = isInteractive ? 0 : -1;
129
+ if (isInteractive) {
130
+ decoration.removeAttribute('aria-disabled');
131
+ }
132
+ else {
133
+ decoration.setAttribute('aria-disabled', 'true');
134
+ }
135
+ const hoverText = tooltip || decorationState.hoverMessage;
136
+ if (hoverText) {
137
+ decoration.setAttribute('aria-label', hoverText);
138
+ }
139
+ else {
140
+ decoration.removeAttribute('aria-label');
141
+ }
142
+ }
143
+ _attachInteractionHandlers(decoration) {
144
+ if (this._interactionElement === decoration) {
145
+ return;
146
+ }
147
+ this._interactionElement = decoration;
148
+ }
149
+ };
150
+ TerminalCommandDecoration = ( __decorate([
151
+ ( __param(1, IHoverService))
152
+ ], TerminalCommandDecoration));
153
+ let ChatTerminalToolProgressPart = class ChatTerminalToolProgressPart extends BaseChatToolInvocationSubPart {
154
+ get codeblocks() {
155
+ return this.markdownPart?.codeblocks ?? [];
156
+ }
157
+ get elementIndex() {
158
+ return this._elementIndex;
159
+ }
160
+ get contentIndex() {
161
+ return this._contentIndex;
162
+ }
163
+ constructor(toolInvocation, terminalData, context, renderer, editorPool, currentWidthDelegate, codeBlockStartIndex, codeBlockModelCollection, _instantiationService, _terminalChatService, _terminalService, _contextKeyService, _chatWidgetService, _keybindingService) {
164
+ super(toolInvocation);
165
+ this._instantiationService = _instantiationService;
166
+ this._terminalChatService = _terminalChatService;
167
+ this._terminalService = _terminalService;
168
+ this._contextKeyService = _contextKeyService;
169
+ this._chatWidgetService = _chatWidgetService;
170
+ this._keybindingService = _keybindingService;
171
+ this._showOutputAction = this._register(( new MutableDisposable()));
172
+ this._showOutputActionAdded = false;
173
+ this._focusAction = this._register(( new MutableDisposable()));
174
+ this._elementIndex = context.elementIndex;
175
+ this._contentIndex = context.contentIndex;
176
+ this._sessionResource = context.element.sessionResource;
177
+ terminalData = migrateLegacyTerminalToolSpecificData(terminalData);
178
+ this._terminalData = terminalData;
179
+ this._terminalCommandUri = terminalData.terminalCommandUri ? URI.revive(terminalData.terminalCommandUri) : undefined;
180
+ this._storedCommandId = this._terminalCommandUri ? ( new URLSearchParams(this._terminalCommandUri.query ?? '')).get('command') ?? undefined : undefined;
181
+ this._isSerializedInvocation = (toolInvocation.kind === 'toolInvocationSerialized');
182
+ const elements = h('.chat-terminal-content-part@container', [
183
+ h('.chat-terminal-content-title@title', [
184
+ h('.chat-terminal-command-block@commandBlock')
185
+ ]),
186
+ h('.chat-terminal-content-message@message')
187
+ ]);
188
+ this._titleElement = elements.title;
189
+ const command = terminalData.commandLine.userEdited ?? terminalData.commandLine.toolEdited ?? terminalData.commandLine.original;
190
+ this._commandText = command;
191
+ this._terminalOutputContextKey = ChatContextKeys.inChatTerminalToolOutput.bindTo(this._contextKeyService);
192
+ this._decoration = this._register(this._instantiationService.createInstance(TerminalCommandDecoration, {
193
+ terminalData: this._terminalData,
194
+ getCommandBlock: () => elements.commandBlock,
195
+ getIconElement: () => undefined,
196
+ getResolvedCommand: () => this._getResolvedCommand()
197
+ }));
198
+ const titlePart = this._register(_instantiationService.createInstance(ChatQueryTitlePart, elements.commandBlock, ( new MarkdownString([
199
+ `\`\`\`${terminalData.language}`,
200
+ `${command.replaceAll('```', '\\`\\`\\`')}`,
201
+ `\`\`\``
202
+ ].join('\n'), { supportThemeIcons: true })), undefined));
203
+ this._register(titlePart.onDidChangeHeight(() => {
204
+ this._decoration.update();
205
+ this._onDidChangeHeight.fire();
206
+ }));
207
+ this._outputView = this._register(this._instantiationService.createInstance(ChatTerminalToolOutputSection, () => this._onDidChangeHeight.fire(), () => this._ensureTerminalInstance(), () => this._getResolvedCommand(), () => this._terminalData.terminalCommandOutput, () => this._commandText, () => this._terminalData.terminalTheme));
208
+ elements.container.append(this._outputView.domNode);
209
+ this._register(this._outputView.onDidFocus(() => this._handleOutputFocus()));
210
+ this._register(this._outputView.onDidBlur(e => this._handleOutputBlur(e)));
211
+ this._register(toDisposable(() => this._handleDispose()));
212
+ this._register(this._keybindingService.onDidUpdateKeybindings(() => {
213
+ this._focusAction.value?.refreshKeybindingTooltip();
214
+ this._showOutputAction.value?.refreshKeybindingTooltip();
215
+ }));
216
+ const actionBarEl = h('.chat-terminal-action-bar@actionBar');
217
+ elements.title.append(actionBarEl.root);
218
+ this._actionBar = this._register(( new ActionBar(actionBarEl.actionBar, {})));
219
+ this._initializeTerminalActions();
220
+ this._terminalService.whenConnected.then(() => this._initializeTerminalActions());
221
+ let pastTenseMessage;
222
+ if (toolInvocation.pastTenseMessage) {
223
+ pastTenseMessage = `${typeof toolInvocation.pastTenseMessage === 'string' ? toolInvocation.pastTenseMessage : toolInvocation.pastTenseMessage.value}`;
224
+ }
225
+ const markdownContent = ( new MarkdownString(pastTenseMessage, {
226
+ supportThemeIcons: true,
227
+ isTrusted: isMarkdownString(toolInvocation.pastTenseMessage) ? toolInvocation.pastTenseMessage.isTrusted : false,
228
+ }));
229
+ const chatMarkdownContent = {
230
+ kind: 'markdownContent',
231
+ content: markdownContent,
232
+ };
233
+ const codeBlockRenderOptions = {
234
+ hideToolbar: true,
235
+ reserveWidth: 19,
236
+ verticalPadding: 5,
237
+ editorOptions: {
238
+ wordWrap: 'on'
239
+ }
240
+ };
241
+ const markdownOptions = {
242
+ codeBlockRenderOptions,
243
+ accessibilityOptions: pastTenseMessage ? {
244
+ statusMessage: ( localize(5150, '{0}', stripIcons(pastTenseMessage)))
245
+ } : undefined
246
+ };
247
+ this.markdownPart = this._register(_instantiationService.createInstance(ChatMarkdownContentPart, chatMarkdownContent, context, editorPool, false, codeBlockStartIndex, renderer, {}, currentWidthDelegate(), codeBlockModelCollection, markdownOptions));
248
+ this._register(this.markdownPart.onDidChangeHeight(() => this._onDidChangeHeight.fire()));
249
+ elements.message.append(this.markdownPart.domNode);
250
+ const progressPart = this._register(_instantiationService.createInstance(ChatProgressSubPart, elements.container, this.getIcon(), terminalData.autoApproveInfo));
251
+ this.domNode = progressPart.domNode;
252
+ this._decoration.update();
253
+ if (expandedStateByInvocation.get(toolInvocation)) {
254
+ void this._toggleOutput(true);
255
+ }
256
+ this._register(this._terminalChatService.registerProgressPart(this));
257
+ }
258
+ async _initializeTerminalActions() {
259
+ if (this._store.isDisposed) {
260
+ return;
261
+ }
262
+ const terminalToolSessionId = this._terminalData.terminalToolSessionId;
263
+ if (!terminalToolSessionId) {
264
+ this._addActions();
265
+ return;
266
+ }
267
+ const attachInstance = async (instance) => {
268
+ if (this._store.isDisposed) {
269
+ return;
270
+ }
271
+ if (!instance) {
272
+ if (this._isSerializedInvocation) {
273
+ this._clearCommandAssociation();
274
+ }
275
+ this._addActions(undefined, terminalToolSessionId);
276
+ return;
277
+ }
278
+ const isNewInstance = this._terminalInstance !== instance;
279
+ if (isNewInstance) {
280
+ this._terminalInstance = instance;
281
+ this._registerInstanceListener(instance);
282
+ }
283
+ this._addActions(instance, terminalToolSessionId);
284
+ };
285
+ const initialInstance = await this._terminalChatService.getTerminalInstanceByToolSessionId(terminalToolSessionId);
286
+ await attachInstance(initialInstance);
287
+ if (!initialInstance) {
288
+ this._addActions(undefined, terminalToolSessionId);
289
+ }
290
+ if (this._store.isDisposed) {
291
+ return;
292
+ }
293
+ if (!this._terminalSessionRegistration) {
294
+ const listener = this._terminalChatService.onDidRegisterTerminalInstanceWithToolSession(async (instance) => {
295
+ const registeredInstance = await this._terminalChatService.getTerminalInstanceByToolSessionId(terminalToolSessionId);
296
+ if (instance !== registeredInstance) {
297
+ return;
298
+ }
299
+ this._terminalSessionRegistration?.dispose();
300
+ this._terminalSessionRegistration = undefined;
301
+ await attachInstance(instance);
302
+ });
303
+ this._terminalSessionRegistration = this._store.add(listener);
304
+ }
305
+ }
306
+ _addActions(terminalInstance, terminalToolSessionId) {
307
+ if (this._store.isDisposed) {
308
+ return;
309
+ }
310
+ const actionBar = this._actionBar;
311
+ this._removeFocusAction();
312
+ const resolvedCommand = this._getResolvedCommand(terminalInstance);
313
+ if (terminalInstance) {
314
+ const isTerminalHidden = terminalInstance && terminalToolSessionId ? this._terminalChatService.isBackgroundTerminal(terminalToolSessionId) : false;
315
+ const focusAction = this._instantiationService.createInstance(FocusChatInstanceAction, terminalInstance, resolvedCommand, this._terminalCommandUri, this._storedCommandId, isTerminalHidden);
316
+ this._focusAction.value = focusAction;
317
+ actionBar.push(focusAction, { icon: true, label: false, index: 0 });
318
+ }
319
+ this._ensureShowOutputAction(resolvedCommand);
320
+ this._decoration.update(resolvedCommand);
321
+ }
322
+ _getResolvedCommand(instance) {
323
+ const target = instance ?? this._terminalInstance;
324
+ if (!target) {
325
+ return undefined;
326
+ }
327
+ return this._resolveCommand(target);
328
+ }
329
+ _ensureShowOutputAction(command) {
330
+ if (this._store.isDisposed) {
331
+ return;
332
+ }
333
+ const resolvedCommand = command ?? this._getResolvedCommand();
334
+ const hasSnapshot = !!this._terminalData.terminalCommandOutput;
335
+ if (!resolvedCommand && !hasSnapshot) {
336
+ return;
337
+ }
338
+ let showOutputAction = this._showOutputAction.value;
339
+ if (!showOutputAction) {
340
+ showOutputAction = this._instantiationService.createInstance(ToggleChatTerminalOutputAction, () => this._toggleOutputFromAction());
341
+ this._showOutputAction.value = showOutputAction;
342
+ const exitCode = resolvedCommand?.exitCode ?? this._terminalData.terminalCommandState?.exitCode;
343
+ if (exitCode) {
344
+ this._toggleOutput(true);
345
+ }
346
+ }
347
+ showOutputAction.syncPresentation(this._outputView.isExpanded);
348
+ const actionBar = this._actionBar;
349
+ if (this._showOutputActionAdded) {
350
+ const existingIndex = actionBar.viewItems.findIndex(item => item.action === showOutputAction);
351
+ if (existingIndex >= 0 && existingIndex !== actionBar.length() - 1) {
352
+ actionBar.pull(existingIndex);
353
+ this._showOutputActionAdded = false;
354
+ }
355
+ else if (existingIndex >= 0) {
356
+ return;
357
+ }
358
+ }
359
+ if (this._showOutputActionAdded) {
360
+ return;
361
+ }
362
+ actionBar.push([showOutputAction], { icon: true, label: false });
363
+ this._showOutputActionAdded = true;
364
+ }
365
+ _clearCommandAssociation(options) {
366
+ this._terminalCommandUri = undefined;
367
+ this._storedCommandId = undefined;
368
+ if (options?.clearPersistentData) {
369
+ if (this._terminalData.terminalCommandUri) {
370
+ delete this._terminalData.terminalCommandUri;
371
+ }
372
+ if (this._terminalData.terminalToolSessionId) {
373
+ delete this._terminalData.terminalToolSessionId;
374
+ }
375
+ }
376
+ this._decoration.update();
377
+ }
378
+ _registerInstanceListener(terminalInstance) {
379
+ const commandDetectionListener = this._register(( new MutableDisposable()));
380
+ const tryResolveCommand = async () => {
381
+ const resolvedCommand = this._resolveCommand(terminalInstance);
382
+ this._addActions(terminalInstance, this._terminalData.terminalToolSessionId);
383
+ return resolvedCommand;
384
+ };
385
+ const attachCommandDetection = async (commandDetection) => {
386
+ commandDetectionListener.clear();
387
+ if (!commandDetection) {
388
+ await tryResolveCommand();
389
+ return;
390
+ }
391
+ commandDetectionListener.value = commandDetection.onCommandFinished(() => {
392
+ this._addActions(terminalInstance, this._terminalData.terminalToolSessionId);
393
+ const resolvedCommand = this._getResolvedCommand(terminalInstance);
394
+ if (resolvedCommand?.endMarker) {
395
+ commandDetectionListener.clear();
396
+ }
397
+ });
398
+ const resolvedImmediately = await tryResolveCommand();
399
+ if (resolvedImmediately?.endMarker) {
400
+ commandDetectionListener.clear();
401
+ return;
402
+ }
403
+ };
404
+ attachCommandDetection(terminalInstance.capabilities.get(TerminalCapability.CommandDetection));
405
+ this._register(terminalInstance.capabilities.onDidAddCommandDetectionCapability(cd => attachCommandDetection(cd)));
406
+ const instanceListener = this._register(terminalInstance.onDisposed(() => {
407
+ if (this._terminalInstance === terminalInstance) {
408
+ this._terminalInstance = undefined;
409
+ }
410
+ this._clearCommandAssociation({ clearPersistentData: true });
411
+ commandDetectionListener.clear();
412
+ if (!this._store.isDisposed) {
413
+ this._actionBar.clear();
414
+ }
415
+ this._removeFocusAction();
416
+ this._showOutputActionAdded = false;
417
+ this._showOutputAction.clear();
418
+ this._addActions(undefined, this._terminalData.terminalToolSessionId);
419
+ instanceListener.dispose();
420
+ }));
421
+ }
422
+ _removeFocusAction() {
423
+ if (this._store.isDisposed) {
424
+ return;
425
+ }
426
+ const actionBar = this._actionBar;
427
+ const focusAction = this._focusAction.value;
428
+ if (actionBar && focusAction) {
429
+ const existingIndex = actionBar.viewItems.findIndex(item => item.action === focusAction);
430
+ if (existingIndex >= 0) {
431
+ actionBar.pull(existingIndex);
432
+ }
433
+ }
434
+ this._focusAction.clear();
435
+ }
436
+ async _toggleOutput(expanded) {
437
+ const didChange = await this._outputView.toggle(expanded);
438
+ const isExpanded = this._outputView.isExpanded;
439
+ this._titleElement.classList.toggle('chat-terminal-content-title-no-bottom-radius', isExpanded);
440
+ this._showOutputAction.value?.syncPresentation(isExpanded);
441
+ if (didChange) {
442
+ expandedStateByInvocation.set(this.toolInvocation, isExpanded);
443
+ }
444
+ return didChange;
445
+ }
446
+ async _ensureTerminalInstance() {
447
+ if (this._terminalInstance?.isDisposed) {
448
+ this._terminalInstance = undefined;
449
+ }
450
+ if (!this._terminalInstance && this._terminalData.terminalToolSessionId) {
451
+ this._terminalInstance = await this._terminalChatService.getTerminalInstanceByToolSessionId(this._terminalData.terminalToolSessionId);
452
+ if (this._terminalInstance?.isDisposed) {
453
+ this._terminalInstance = undefined;
454
+ }
455
+ }
456
+ return this._terminalInstance;
457
+ }
458
+ _handleOutputFocus() {
459
+ this._terminalOutputContextKey.set(true);
460
+ this._terminalChatService.setFocusedProgressPart(this);
461
+ this._outputView.updateAriaLabel();
462
+ }
463
+ _handleOutputBlur(event) {
464
+ const nextTarget = event.relatedTarget;
465
+ if (this._outputView.containsElement(nextTarget)) {
466
+ return;
467
+ }
468
+ this._terminalOutputContextKey.reset();
469
+ this._terminalChatService.clearFocusedProgressPart(this);
470
+ }
471
+ _handleDispose() {
472
+ this._terminalOutputContextKey.reset();
473
+ this._terminalChatService.clearFocusedProgressPart(this);
474
+ }
475
+ getCommandAndOutputAsText() {
476
+ return this._outputView.getCommandAndOutputAsText();
477
+ }
478
+ focusOutput() {
479
+ this._outputView.focus();
480
+ }
481
+ _focusChatInput() {
482
+ const widget = this._chatWidgetService.getWidgetBySessionResource(this._sessionResource);
483
+ widget?.focusInput();
484
+ }
485
+ async focusTerminal() {
486
+ if (this._focusAction.value) {
487
+ await this._focusAction.value.run();
488
+ return;
489
+ }
490
+ if (this._terminalCommandUri) {
491
+ this._terminalService.openResource(this._terminalCommandUri);
492
+ }
493
+ }
494
+ async toggleOutputFromKeyboard() {
495
+ if (!this._outputView.isExpanded) {
496
+ await this._toggleOutput(true);
497
+ this.focusOutput();
498
+ return;
499
+ }
500
+ await this._collapseOutputAndFocusInput();
501
+ }
502
+ async _toggleOutputFromAction() {
503
+ if (!this._outputView.isExpanded) {
504
+ await this._toggleOutput(true);
505
+ return;
506
+ }
507
+ await this._toggleOutput(false);
508
+ }
509
+ async _collapseOutputAndFocusInput() {
510
+ if (this._outputView.isExpanded) {
511
+ await this._toggleOutput(false);
512
+ }
513
+ this._focusChatInput();
514
+ }
515
+ _resolveCommand(instance) {
516
+ if (instance.isDisposed) {
517
+ return undefined;
518
+ }
519
+ const commandDetection = instance.capabilities.get(TerminalCapability.CommandDetection);
520
+ const commands = commandDetection?.commands;
521
+ if (!commands || commands.length === 0) {
522
+ return undefined;
523
+ }
524
+ return commands.find(c => c.id === this._terminalData.terminalCommandId);
525
+ }
526
+ };
527
+ ChatTerminalToolProgressPart = ( __decorate([
528
+ ( __param(8, IInstantiationService)),
529
+ ( __param(9, ITerminalChatService)),
530
+ ( __param(10, ITerminalService)),
531
+ ( __param(11, IContextKeyService)),
532
+ ( __param(12, IChatWidgetService)),
533
+ ( __param(13, IKeybindingService))
534
+ ], ChatTerminalToolProgressPart));
535
+ let ChatTerminalToolOutputSection = class ChatTerminalToolOutputSection extends Disposable {
536
+ get isExpanded() {
537
+ return this.domNode.classList.contains('expanded');
538
+ }
539
+ get onDidFocus() { return this._onDidFocusEmitter.event; }
540
+ get onDidBlur() { return this._onDidBlurEmitter.event; }
541
+ constructor(_onDidChangeHeight, _ensureTerminalInstance, _resolveCommand, _getTerminalCommandOutput, _getCommandText, _getStoredTheme, _accessibleViewService, _instantiationService, _terminalConfigurationService, _themeService, _contextKeyService) {
542
+ super();
543
+ this._onDidChangeHeight = _onDidChangeHeight;
544
+ this._ensureTerminalInstance = _ensureTerminalInstance;
545
+ this._resolveCommand = _resolveCommand;
546
+ this._getTerminalCommandOutput = _getTerminalCommandOutput;
547
+ this._getCommandText = _getCommandText;
548
+ this._getStoredTheme = _getStoredTheme;
549
+ this._accessibleViewService = _accessibleViewService;
550
+ this._instantiationService = _instantiationService;
551
+ this._terminalConfigurationService = _terminalConfigurationService;
552
+ this._themeService = _themeService;
553
+ this._contextKeyService = _contextKeyService;
554
+ this._onDidFocusEmitter = this._register(( new Emitter()));
555
+ this._onDidBlurEmitter = this._register(( new Emitter()));
556
+ const containerElements = h('.chat-terminal-output-container@container', [
557
+ h('.chat-terminal-output-body@body', [
558
+ h('.chat-terminal-output-content@content', [
559
+ h('.chat-terminal-output-terminal@terminal'),
560
+ h('.chat-terminal-output-empty@empty')
561
+ ])
562
+ ])
563
+ ]);
564
+ this.domNode = containerElements.container;
565
+ this.domNode.classList.add('collapsed');
566
+ this._outputBody = containerElements.body;
567
+ this._contentContainer = containerElements.content;
568
+ this._terminalContainer = containerElements.terminal;
569
+ this._emptyElement = containerElements.empty;
570
+ this._contentContainer.appendChild(this._emptyElement);
571
+ this._register(addDisposableListener(this.domNode, EventType.FOCUS_IN, () => this._onDidFocusEmitter.fire()));
572
+ this._register(addDisposableListener(this.domNode, EventType.FOCUS_OUT, event => this._onDidBlurEmitter.fire(event)));
573
+ const resizeObserver = ( new ResizeObserver(() => this._handleResize()));
574
+ resizeObserver.observe(this.domNode);
575
+ this._register(toDisposable(() => resizeObserver.disconnect()));
576
+ this._applyBackgroundColor();
577
+ this._register(this._themeService.onDidColorThemeChange(() => this._applyBackgroundColor()));
578
+ }
579
+ async toggle(expanded) {
580
+ const currentlyExpanded = this.isExpanded;
581
+ if (expanded === currentlyExpanded) {
582
+ if (expanded) {
583
+ await this._updateTerminalContent();
584
+ }
585
+ return false;
586
+ }
587
+ this._setExpanded(expanded);
588
+ if (!expanded) {
589
+ this._renderedOutputHeight = undefined;
590
+ this._onDidChangeHeight();
591
+ return true;
592
+ }
593
+ if (!this._scrollableContainer) {
594
+ await this._createScrollableContainer();
595
+ }
596
+ await this._updateTerminalContent();
597
+ this._layoutOutput();
598
+ this._scrollOutputToBottom();
599
+ this._scheduleOutputRelayout();
600
+ return true;
601
+ }
602
+ focus() {
603
+ this._scrollableContainer?.getDomNode().focus();
604
+ }
605
+ containsElement(element) {
606
+ return !!element && this.domNode.contains(element);
607
+ }
608
+ updateAriaLabel() {
609
+ if (!this._scrollableContainer) {
610
+ return;
611
+ }
612
+ const command = this._resolveCommand();
613
+ const commandText = command?.command ?? this._getCommandText();
614
+ if (!commandText) {
615
+ return;
616
+ }
617
+ const ariaLabel = ( localize(5151, 'Terminal output for {0}', commandText));
618
+ const scrollableDomNode = this._scrollableContainer.getDomNode();
619
+ scrollableDomNode.setAttribute('role', 'region');
620
+ const accessibleViewHint = this._accessibleViewService.getOpenAriaHint(AccessibilityVerbositySettingId.TerminalChatOutput);
621
+ const label = accessibleViewHint
622
+ ? ariaLabel + ', ' + accessibleViewHint
623
+ : ariaLabel;
624
+ scrollableDomNode.setAttribute('aria-label', label);
625
+ }
626
+ getCommandAndOutputAsText() {
627
+ const command = this._resolveCommand();
628
+ const commandText = command?.command ?? this._getCommandText();
629
+ if (!commandText) {
630
+ return undefined;
631
+ }
632
+ const commandHeader = ( localize(5152, 'Command: {0}', commandText));
633
+ if (command) {
634
+ const rawOutput = command.getOutput();
635
+ if (!rawOutput || rawOutput.trim().length === 0) {
636
+ return `${commandHeader}\n${( localize(5153, 'No output was produced by the command.'))}`;
637
+ }
638
+ const lines = rawOutput.split('\n');
639
+ return `${commandHeader}\n${lines.join('\n').trimEnd()}`;
640
+ }
641
+ const snapshot = this._getTerminalCommandOutput();
642
+ if (!snapshot) {
643
+ return `${commandHeader}\n${( localize(5154, 'Command output is no longer available.'))}`;
644
+ }
645
+ const plain = removeAnsiEscapeCodes((snapshot.text ?? ''));
646
+ if (!plain.trim().length) {
647
+ return `${commandHeader}\n${( localize(5153, 'No output was produced by the command.'))}`;
648
+ }
649
+ let outputText = plain.trimEnd();
650
+ if (snapshot.truncated) {
651
+ outputText += `\n${( localize(5155, 'Output truncated.'))}`;
652
+ }
653
+ return `${commandHeader}\n${outputText}`;
654
+ }
655
+ _setExpanded(expanded) {
656
+ this.domNode.classList.toggle('expanded', expanded);
657
+ this.domNode.classList.toggle('collapsed', !expanded);
658
+ }
659
+ async _createScrollableContainer() {
660
+ this._scrollableContainer = this._register(( new DomScrollableElement(this._outputBody, {
661
+ vertical: ScrollbarVisibility.Hidden,
662
+ horizontal: ScrollbarVisibility.Auto,
663
+ handleMouseWheel: true
664
+ })));
665
+ const scrollableDomNode = this._scrollableContainer.getDomNode();
666
+ scrollableDomNode.tabIndex = 0;
667
+ this.domNode.appendChild(scrollableDomNode);
668
+ this.updateAriaLabel();
669
+ }
670
+ async _updateTerminalContent() {
671
+ const liveTerminalInstance = await this._resolveLiveTerminal();
672
+ const command = liveTerminalInstance ? this._resolveCommand() : undefined;
673
+ const snapshot = this._getTerminalCommandOutput();
674
+ if (liveTerminalInstance && command) {
675
+ const handled = await this._renderLiveOutput(liveTerminalInstance, command);
676
+ if (handled) {
677
+ return;
678
+ }
679
+ }
680
+ this._disposeLiveMirror();
681
+ if (snapshot) {
682
+ await this._renderSnapshotOutput(snapshot);
683
+ return;
684
+ }
685
+ this._renderUnavailableMessage(liveTerminalInstance);
686
+ }
687
+ async _renderLiveOutput(liveTerminalInstance, command) {
688
+ if (this._mirror) {
689
+ return true;
690
+ }
691
+ await liveTerminalInstance.xtermReadyPromise;
692
+ if (liveTerminalInstance.isDisposed || !liveTerminalInstance.xterm) {
693
+ this._disposeLiveMirror();
694
+ return false;
695
+ }
696
+ this._mirror = this._register(this._instantiationService.createInstance(DetachedTerminalCommandMirror, liveTerminalInstance.xterm, command));
697
+ await this._mirror.attach(this._terminalContainer);
698
+ const result = await this._mirror.renderCommand();
699
+ if (!result || result.lineCount === 0) {
700
+ this._showEmptyMessage(( localize(5153, 'No output was produced by the command.')));
701
+ }
702
+ else {
703
+ this._hideEmptyMessage();
704
+ }
705
+ this._layoutOutput(result?.lineCount ?? 0);
706
+ return true;
707
+ }
708
+ async _renderSnapshotOutput(snapshot) {
709
+ if (this._snapshotMirror) {
710
+ this._layoutOutput(snapshot.lineCount ?? 0);
711
+ return;
712
+ }
713
+ clearNode(this._terminalContainer);
714
+ this._snapshotMirror = this._register(this._instantiationService.createInstance(DetachedTerminalSnapshotMirror, snapshot, this._getStoredTheme));
715
+ await this._snapshotMirror.attach(this._terminalContainer);
716
+ this._snapshotMirror.setOutput(snapshot);
717
+ const result = await this._snapshotMirror.render();
718
+ const hasText = !!snapshot.text && snapshot.text.length > 0;
719
+ if (hasText) {
720
+ this._hideEmptyMessage();
721
+ }
722
+ else {
723
+ this._showEmptyMessage(( localize(5153, 'No output was produced by the command.')));
724
+ }
725
+ const lineCount = result?.lineCount ?? snapshot.lineCount ?? 0;
726
+ this._layoutOutput(lineCount);
727
+ }
728
+ _renderUnavailableMessage(liveTerminalInstance) {
729
+ clearNode(this._terminalContainer);
730
+ this._lastRenderedLineCount = undefined;
731
+ if (!liveTerminalInstance) {
732
+ this._showEmptyMessage(( localize(5156, 'Terminal is no longer available.')));
733
+ }
734
+ else {
735
+ this._showEmptyMessage(( localize(5157, 'Command information is not available.')));
736
+ }
737
+ }
738
+ async _resolveLiveTerminal() {
739
+ const instance = await this._ensureTerminalInstance();
740
+ return instance && !instance.isDisposed ? instance : undefined;
741
+ }
742
+ _showEmptyMessage(message) {
743
+ this._emptyElement.textContent = message;
744
+ this._terminalContainer.classList.add('chat-terminal-output-terminal-no-output');
745
+ this.domNode.classList.add('chat-terminal-output-container-no-output');
746
+ }
747
+ _hideEmptyMessage() {
748
+ this._emptyElement.textContent = '';
749
+ this._terminalContainer.classList.remove('chat-terminal-output-terminal-no-output');
750
+ this.domNode.classList.remove('chat-terminal-output-container-no-output');
751
+ }
752
+ _disposeLiveMirror() {
753
+ if (this._mirror) {
754
+ this._mirror.dispose();
755
+ this._mirror = undefined;
756
+ }
757
+ }
758
+ _scheduleOutputRelayout() {
759
+ getActiveWindow().requestAnimationFrame(() => {
760
+ this._layoutOutput();
761
+ this._scrollOutputToBottom();
762
+ });
763
+ }
764
+ _handleResize() {
765
+ if (!this._scrollableContainer) {
766
+ return;
767
+ }
768
+ if (this.isExpanded) {
769
+ this._layoutOutput();
770
+ this._scrollOutputToBottom();
771
+ }
772
+ else {
773
+ this._scrollableContainer.scanDomNode();
774
+ }
775
+ }
776
+ _layoutOutput(lineCount) {
777
+ if (!this._scrollableContainer) {
778
+ return;
779
+ }
780
+ if (lineCount !== undefined) {
781
+ this._lastRenderedLineCount = lineCount;
782
+ }
783
+ else {
784
+ lineCount = this._lastRenderedLineCount;
785
+ }
786
+ this._scrollableContainer.scanDomNode();
787
+ if (!this.isExpanded || lineCount === undefined) {
788
+ return;
789
+ }
790
+ const scrollableDomNode = this._scrollableContainer.getDomNode();
791
+ const rowHeight = this._computeRowHeightPx();
792
+ const padding = this._getOutputPadding();
793
+ const minHeight = rowHeight * MIN_OUTPUT_ROWS + padding;
794
+ const maxHeight = rowHeight * MAX_OUTPUT_ROWS + padding;
795
+ const contentHeight = this._getOutputContentHeight(lineCount, rowHeight, padding);
796
+ const clampedHeight = Math.min(contentHeight, maxHeight);
797
+ const measuredBodyHeight = Math.max(this._outputBody.clientHeight, minHeight);
798
+ const appliedHeight = Math.min(clampedHeight, measuredBodyHeight);
799
+ scrollableDomNode.style.height = appliedHeight < maxHeight ? `${appliedHeight}px` : '';
800
+ this._scrollableContainer.scanDomNode();
801
+ if (this._renderedOutputHeight !== appliedHeight) {
802
+ this._renderedOutputHeight = appliedHeight;
803
+ this._onDidChangeHeight();
804
+ }
805
+ }
806
+ _scrollOutputToBottom() {
807
+ if (!this._scrollableContainer) {
808
+ return;
809
+ }
810
+ const dimensions = this._scrollableContainer.getScrollDimensions();
811
+ this._scrollableContainer.setScrollPosition({ scrollTop: dimensions.scrollHeight });
812
+ }
813
+ _getOutputContentHeight(lineCount, rowHeight, padding) {
814
+ const contentRows = Math.max(lineCount, MIN_OUTPUT_ROWS);
815
+ const adjustedRows = contentRows + (lineCount > MAX_OUTPUT_ROWS ? 1 : 0);
816
+ return (adjustedRows * rowHeight) + padding;
817
+ }
818
+ _getOutputPadding() {
819
+ const style = getComputedStyle(this._outputBody);
820
+ const paddingTop = Number.parseFloat(style.paddingTop || '0');
821
+ const paddingBottom = Number.parseFloat(style.paddingBottom || '0');
822
+ return paddingTop + paddingBottom;
823
+ }
824
+ _computeRowHeightPx() {
825
+ const window = getActiveWindow();
826
+ const font = this._terminalConfigurationService.getFont(window);
827
+ const hasCharHeight = isNumber(font.charHeight) && font.charHeight > 0;
828
+ const hasFontSize = isNumber(font.fontSize) && font.fontSize > 0;
829
+ const hasLineHeight = isNumber(font.lineHeight) && font.lineHeight > 0;
830
+ const charHeight = (hasCharHeight ? font.charHeight : (hasFontSize ? font.fontSize : 1)) ?? 1;
831
+ const lineHeight = hasLineHeight ? font.lineHeight : 1;
832
+ const rowHeight = Math.ceil(charHeight * lineHeight);
833
+ return Math.max(rowHeight, 1);
834
+ }
835
+ _applyBackgroundColor() {
836
+ const theme = this._themeService.getColorTheme();
837
+ const isInEditor = ChatContextKeys.inChatEditor.getValue(this._contextKeyService);
838
+ const backgroundColor = theme.getColor(isInEditor ? editorBackground : PANEL_BACKGROUND);
839
+ if (backgroundColor) {
840
+ this.domNode.style.backgroundColor = ( backgroundColor.toString());
841
+ }
842
+ }
843
+ };
844
+ ChatTerminalToolOutputSection = ( __decorate([
845
+ ( __param(6, IAccessibleViewService)),
846
+ ( __param(7, IInstantiationService)),
847
+ ( __param(8, ITerminalConfigurationService)),
848
+ ( __param(9, IThemeService)),
849
+ ( __param(10, IContextKeyService))
850
+ ], ChatTerminalToolOutputSection));
851
+ let DetachedTerminalSnapshotMirror = class DetachedTerminalSnapshotMirror extends Disposable {
852
+ constructor(output, _getTheme, _terminalService, _contextKeyService) {
853
+ super();
854
+ this._getTheme = _getTheme;
855
+ this._terminalService = _terminalService;
856
+ this._contextKeyService = _contextKeyService;
857
+ this._dirty = true;
858
+ this._output = output;
859
+ }
860
+ setOutput(output) {
861
+ this._output = output;
862
+ this._dirty = true;
863
+ }
864
+ async attach(container) {
865
+ const terminal = await this._getTerminal();
866
+ container.classList.add('chat-terminal-output-terminal');
867
+ if (this._attachedContainer !== container || container.firstChild === null) {
868
+ terminal.attachToElement(container);
869
+ this._attachedContainer = container;
870
+ }
871
+ this._container = container;
872
+ this._applyTheme(container);
873
+ }
874
+ async render() {
875
+ const output = this._output;
876
+ if (!output) {
877
+ return undefined;
878
+ }
879
+ if (!this._dirty) {
880
+ return { lineCount: this._lastRenderedLineCount ?? output.lineCount };
881
+ }
882
+ const terminal = await this._getTerminal();
883
+ terminal.xterm.clearBuffer();
884
+ terminal.xterm.clearSearchDecorations?.();
885
+ if (this._container) {
886
+ this._applyTheme(this._container);
887
+ }
888
+ const text = output.text ?? '';
889
+ const lineCount = output.lineCount ?? this._estimateLineCount(text);
890
+ if (!text) {
891
+ this._dirty = false;
892
+ this._lastRenderedLineCount = lineCount;
893
+ return { lineCount: 0 };
894
+ }
895
+ await ( new Promise(resolve => terminal.xterm.write(text, resolve)));
896
+ this._dirty = false;
897
+ this._lastRenderedLineCount = lineCount;
898
+ return { lineCount };
899
+ }
900
+ _estimateLineCount(text) {
901
+ if (!text) {
902
+ return 0;
903
+ }
904
+ const sanitized = text.replace(/\r/g, '');
905
+ const segments = sanitized.split('\n');
906
+ const count = sanitized.endsWith('\n') ? segments.length - 1 : segments.length;
907
+ return Math.max(count, 1);
908
+ }
909
+ _applyTheme(container) {
910
+ const theme = this._getTheme();
911
+ if (!theme) {
912
+ container.style.removeProperty('background-color');
913
+ container.style.removeProperty('color');
914
+ return;
915
+ }
916
+ if (theme.background) {
917
+ container.style.backgroundColor = theme.background;
918
+ }
919
+ if (theme.foreground) {
920
+ container.style.color = theme.foreground;
921
+ }
922
+ }
923
+ async _getTerminal() {
924
+ if (!this._detachedTerminal) {
925
+ this._detachedTerminal = this._createTerminal();
926
+ }
927
+ return this._detachedTerminal;
928
+ }
929
+ async _createTerminal() {
930
+ const terminal = await this._terminalService.createDetachedTerminal({
931
+ cols: 80,
932
+ rows: 10,
933
+ readonly: true,
934
+ processInfo: ( new DetachedProcessInfo({ initialCwd: '' })),
935
+ disableOverviewRuler: true,
936
+ colorProvider: {
937
+ getBackgroundColor: theme => {
938
+ const storedBackground = this._getTheme()?.background;
939
+ if (storedBackground) {
940
+ const color = ( Color.fromHex(storedBackground));
941
+ if (color) {
942
+ return color;
943
+ }
944
+ }
945
+ const terminalBackground = theme.getColor(TERMINAL_BACKGROUND_COLOR);
946
+ if (terminalBackground) {
947
+ return terminalBackground;
948
+ }
949
+ const isInEditor = ChatContextKeys.inChatEditor.getValue(this._contextKeyService);
950
+ return theme.getColor(isInEditor ? editorBackground : PANEL_BACKGROUND);
951
+ }
952
+ }
953
+ });
954
+ return this._register(terminal);
955
+ }
956
+ };
957
+ DetachedTerminalSnapshotMirror = ( __decorate([
958
+ ( __param(2, ITerminalService)),
959
+ ( __param(3, IContextKeyService))
960
+ ], DetachedTerminalSnapshotMirror));
961
+ let ToggleChatTerminalOutputAction = class ToggleChatTerminalOutputAction extends Action {
962
+ constructor(_toggle, _keybindingService, _telemetryService) {
963
+ super(TerminalContribCommandId.ToggleChatTerminalOutput, ( localize(5158, 'Show Output')), ThemeIcon.asClassName(Codicon.chevronRight), true);
964
+ this._toggle = _toggle;
965
+ this._keybindingService = _keybindingService;
966
+ this._telemetryService = _telemetryService;
967
+ this._expanded = false;
968
+ this._updateTooltip();
969
+ }
970
+ async run() {
971
+ this._telemetryService.publicLog2('terminal/chatToggleOutput', {
972
+ previousExpanded: this._expanded
973
+ });
974
+ await this._toggle();
975
+ }
976
+ syncPresentation(expanded) {
977
+ this._expanded = expanded;
978
+ this._updatePresentation();
979
+ this._updateTooltip();
980
+ }
981
+ refreshKeybindingTooltip() {
982
+ this._updateTooltip();
983
+ }
984
+ _updatePresentation() {
985
+ if (this._expanded) {
986
+ this.label = ( localize(5159, 'Hide Output'));
987
+ this.class = ThemeIcon.asClassName(Codicon.chevronDown);
988
+ }
989
+ else {
990
+ this.label = ( localize(5158, 'Show Output'));
991
+ this.class = ThemeIcon.asClassName(Codicon.chevronRight);
992
+ }
993
+ }
994
+ _updateTooltip() {
995
+ const keybinding = this._keybindingService.lookupKeybinding(TerminalContribCommandId.FocusMostRecentChatTerminalOutput);
996
+ const label = keybinding?.getLabel();
997
+ this.tooltip = label ? `${this.label} (${label})` : this.label;
998
+ }
999
+ };
1000
+ ToggleChatTerminalOutputAction = ( __decorate([
1001
+ ( __param(1, IKeybindingService)),
1002
+ ( __param(2, ITelemetryService))
1003
+ ], ToggleChatTerminalOutputAction));
1004
+ let FocusChatInstanceAction = class FocusChatInstanceAction extends Action {
1005
+ constructor(_instance, _command, _commandUri, _commandId, isTerminalHidden, _terminalService, _terminalEditorService, _terminalGroupService, _keybindingService, _telemetryService) {
1006
+ super(TerminalContribCommandId.FocusChatInstanceAction, isTerminalHidden ? ( localize(5160, 'Show and Focus Terminal')) : ( localize(5161, 'Focus Terminal')), ThemeIcon.asClassName(Codicon.openInProduct), true);
1007
+ this._instance = _instance;
1008
+ this._command = _command;
1009
+ this._commandUri = _commandUri;
1010
+ this._commandId = _commandId;
1011
+ this._terminalService = _terminalService;
1012
+ this._terminalEditorService = _terminalEditorService;
1013
+ this._terminalGroupService = _terminalGroupService;
1014
+ this._keybindingService = _keybindingService;
1015
+ this._telemetryService = _telemetryService;
1016
+ this._updateTooltip();
1017
+ }
1018
+ async run() {
1019
+ this.label = ( localize(5161, 'Focus Terminal'));
1020
+ this._updateTooltip();
1021
+ let target = 'none';
1022
+ let location = 'panel';
1023
+ if (this._instance) {
1024
+ target = 'instance';
1025
+ location = this._instance.target === TerminalLocation.Editor ? 'editor' : 'panel';
1026
+ }
1027
+ else if (this._commandUri) {
1028
+ target = 'commandUri';
1029
+ }
1030
+ this._telemetryService.publicLog2('terminal/chatFocusInstance', {
1031
+ target,
1032
+ location
1033
+ });
1034
+ if (this._instance) {
1035
+ this._terminalService.setActiveInstance(this._instance);
1036
+ if (this._instance.target === TerminalLocation.Editor) {
1037
+ this._terminalEditorService.openEditor(this._instance);
1038
+ }
1039
+ else {
1040
+ await this._terminalGroupService.showPanel(true);
1041
+ }
1042
+ this._terminalService.setActiveInstance(this._instance);
1043
+ await this._instance.focusWhenReady(true);
1044
+ const command = this._resolveCommand();
1045
+ if (command) {
1046
+ this._instance.xterm?.markTracker.revealCommand(command);
1047
+ }
1048
+ return;
1049
+ }
1050
+ if (this._commandUri) {
1051
+ this._terminalService.openResource(this._commandUri);
1052
+ }
1053
+ }
1054
+ refreshKeybindingTooltip() {
1055
+ this._updateTooltip();
1056
+ }
1057
+ _resolveCommand() {
1058
+ if (this._command && !this._command.endMarker?.isDisposed) {
1059
+ return this._command;
1060
+ }
1061
+ if (!this._instance || !this._commandId) {
1062
+ return this._command;
1063
+ }
1064
+ const commandDetection = this._instance.capabilities.get(TerminalCapability.CommandDetection);
1065
+ const resolved = commandDetection?.commands.find(c => c.id === this._commandId);
1066
+ if (resolved) {
1067
+ this._command = resolved;
1068
+ }
1069
+ return this._command;
1070
+ }
1071
+ _updateTooltip() {
1072
+ const keybinding = this._keybindingService.lookupKeybinding(TerminalContribCommandId.FocusMostRecentChatTerminal);
1073
+ const label = keybinding?.getLabel();
1074
+ this.tooltip = label ? `${this.label} (${label})` : this.label;
1075
+ }
1076
+ };
1077
+ FocusChatInstanceAction = ( __decorate([
1078
+ ( __param(5, ITerminalService)),
1079
+ ( __param(6, ITerminalEditorService)),
1080
+ ( __param(7, ITerminalGroupService)),
1081
+ ( __param(8, IKeybindingService)),
1082
+ ( __param(9, ITelemetryService))
1083
+ ], FocusChatInstanceAction));
1084
+
1085
+ export { ChatTerminalToolProgressPart, FocusChatInstanceAction, ToggleChatTerminalOutputAction };