@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,55 @@
1
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
+ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
3
+ import { IChatModelInputState } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel";
4
+ import { IChatWidgetHistoryService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatWidgetHistoryService.service";
5
+ import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants";
6
+ export type ChatHistoryChange = {
7
+ kind: "append";
8
+ entry: IChatModelInputState;
9
+ } | {
10
+ kind: "clear";
11
+ };
12
+ export declare const ChatInputHistoryMaxEntries = 40;
13
+ export declare class ChatWidgetHistoryService extends Disposable implements IChatWidgetHistoryService {
14
+ _serviceBrand: undefined;
15
+ private memento;
16
+ private viewState;
17
+ private readonly _onDidChangeHistory;
18
+ private changed;
19
+ readonly onDidChangeHistory: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<ChatHistoryChange>;
20
+ constructor(storageService: IStorageService);
21
+ getHistory(location: ChatAgentLocation): IChatModelInputState[];
22
+ private migrateHistoryEntry;
23
+ private getKey;
24
+ append(location: ChatAgentLocation, history: IChatModelInputState): void;
25
+ clearHistory(): void;
26
+ }
27
+ export declare class ChatHistoryNavigator extends Disposable {
28
+ private readonly location;
29
+ private readonly chatWidgetHistoryService;
30
+ /**
31
+ * Index of our point in history. Goes 1 past the length of `_history`
32
+ */
33
+ private _currentIndex;
34
+ private _history;
35
+ private _overlay;
36
+ get values(): readonly IChatModelInputState[];
37
+ constructor(location: ChatAgentLocation, chatWidgetHistoryService: IChatWidgetHistoryService);
38
+ isAtEnd(): boolean;
39
+ isAtStart(): boolean;
40
+ /**
41
+ * Replaces a history entry at the current index in this view of the history.
42
+ * Allows editing of old history entries while preventing accidental navigation
43
+ * from losing the edits.
44
+ */
45
+ overlay(entry: IChatModelInputState): void;
46
+ resetCursor(): void;
47
+ previous(): IChatModelInputState;
48
+ next(): IChatModelInputState;
49
+ current(): IChatModelInputState;
50
+ /**
51
+ * Appends a new entry to the navigator. Resets the state back to the end
52
+ * and clears any overlayed entries.
53
+ */
54
+ append(entry: IChatModelInputState): void;
55
+ }
@@ -0,0 +1,176 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
4
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
5
+ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
7
+ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
8
+ import { Memento } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/memento';
9
+ import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
10
+ import { IChatWidgetHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatWidgetHistoryService.service';
11
+ import { ChatModeKind, ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
12
+
13
+ let ChatWidgetHistoryService = class ChatWidgetHistoryService extends Disposable {
14
+ constructor(storageService) {
15
+ super();
16
+ this._onDidChangeHistory = this._register(( new Emitter()));
17
+ this.changed = false;
18
+ this.onDidChangeHistory = this._onDidChangeHistory.event;
19
+ this.memento = ( new Memento('interactive-session', storageService));
20
+ const loadedState = this.memento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
21
+ this.viewState = loadedState;
22
+ this._register(storageService.onWillSaveState(() => {
23
+ if (this.changed) {
24
+ this.memento.saveMemento();
25
+ this.changed = false;
26
+ }
27
+ }));
28
+ }
29
+ getHistory(location) {
30
+ const key = this.getKey(location);
31
+ const history = this.viewState.history?.[key] ?? [];
32
+ return ( history.map(entry => this.migrateHistoryEntry(entry)));
33
+ }
34
+ migrateHistoryEntry(entry) {
35
+ if (entry.inputText !== undefined) {
36
+ return entry;
37
+ }
38
+ const oldEntry = entry;
39
+ const oldState = oldEntry.state ?? {};
40
+ let modeId;
41
+ let modeKind;
42
+ if (oldState.chatMode) {
43
+ if (typeof oldState.chatMode === 'string') {
44
+ modeId = oldState.chatMode;
45
+ modeKind = ( Object.values(ChatModeKind)).includes(oldState.chatMode)
46
+ ? oldState.chatMode
47
+ : undefined;
48
+ }
49
+ else if (typeof oldState.chatMode === 'object' && oldState.chatMode !== null) {
50
+ const oldMode = oldState.chatMode;
51
+ modeId = oldMode.id ?? ChatModeKind.Ask;
52
+ modeKind = oldMode.id && ( Object.values(ChatModeKind)).includes(oldMode.id)
53
+ ? oldMode.id
54
+ : undefined;
55
+ }
56
+ else {
57
+ modeId = ChatModeKind.Ask;
58
+ modeKind = ChatModeKind.Ask;
59
+ }
60
+ }
61
+ else {
62
+ modeId = ChatModeKind.Ask;
63
+ modeKind = ChatModeKind.Ask;
64
+ }
65
+ return {
66
+ inputText: oldEntry.text ?? '',
67
+ attachments: oldState.chatContextAttachments ?? [],
68
+ mode: {
69
+ id: modeId,
70
+ kind: modeKind
71
+ },
72
+ contrib: oldEntry.state || {},
73
+ selectedModel: undefined,
74
+ selections: []
75
+ };
76
+ }
77
+ getKey(location) {
78
+ return location === ChatAgentLocation.Chat ? CHAT_PROVIDER_ID : location;
79
+ }
80
+ append(location, history) {
81
+ this.viewState.history ??= {};
82
+ const key = this.getKey(location);
83
+ this.viewState.history[key] = this.getHistory(location).concat(history).slice(-40);
84
+ this.changed = true;
85
+ this._onDidChangeHistory.fire({ kind: 'append', entry: history });
86
+ }
87
+ clearHistory() {
88
+ this.viewState.history = {};
89
+ this.changed = true;
90
+ this._onDidChangeHistory.fire({ kind: 'clear' });
91
+ }
92
+ };
93
+ ChatWidgetHistoryService = ( __decorate([
94
+ ( __param(0, IStorageService))
95
+ ], ChatWidgetHistoryService));
96
+ let ChatHistoryNavigator = class ChatHistoryNavigator extends Disposable {
97
+ get values() {
98
+ return this.chatWidgetHistoryService.getHistory(this.location);
99
+ }
100
+ constructor(location, chatWidgetHistoryService) {
101
+ super();
102
+ this.location = location;
103
+ this.chatWidgetHistoryService = chatWidgetHistoryService;
104
+ this._overlay = [];
105
+ this._history = this.chatWidgetHistoryService.getHistory(this.location);
106
+ this._currentIndex = this._history.length;
107
+ this._register(this.chatWidgetHistoryService.onDidChangeHistory(e => {
108
+ if (e.kind === 'append') {
109
+ const prevLength = this._history.length;
110
+ this._history = this.chatWidgetHistoryService.getHistory(this.location);
111
+ const newLength = this._history.length;
112
+ if (prevLength === newLength) {
113
+ this._overlay.shift();
114
+ if (this._currentIndex < this._history.length) {
115
+ this._currentIndex = Math.max(this._currentIndex - 1, 0);
116
+ }
117
+ }
118
+ else if (this._currentIndex === prevLength) {
119
+ this._currentIndex = newLength;
120
+ }
121
+ }
122
+ else if (e.kind === 'clear') {
123
+ this._history = [];
124
+ this._currentIndex = 0;
125
+ this._overlay = [];
126
+ }
127
+ }));
128
+ }
129
+ isAtEnd() {
130
+ return this._currentIndex === Math.max(this._history.length, this._overlay.length);
131
+ }
132
+ isAtStart() {
133
+ return this._currentIndex === 0;
134
+ }
135
+ overlay(entry) {
136
+ this._overlay[this._currentIndex] = entry;
137
+ }
138
+ resetCursor() {
139
+ this._currentIndex = this._history.length;
140
+ }
141
+ previous() {
142
+ this._currentIndex = Math.max(this._currentIndex - 1, 0);
143
+ return this.current();
144
+ }
145
+ next() {
146
+ this._currentIndex = Math.min(this._currentIndex + 1, this._history.length);
147
+ return this.current();
148
+ }
149
+ current() {
150
+ return this._overlay[this._currentIndex] ?? this._history[this._currentIndex];
151
+ }
152
+ append(entry) {
153
+ this._overlay = [];
154
+ this._currentIndex = this._history.length;
155
+ if (!entriesEqual(this._history.at(-1), entry)) {
156
+ this.chatWidgetHistoryService.append(this.location, entry);
157
+ }
158
+ }
159
+ };
160
+ ChatHistoryNavigator = ( __decorate([
161
+ ( __param(1, IChatWidgetHistoryService))
162
+ ], ChatHistoryNavigator));
163
+ function entriesEqual(a, b) {
164
+ if (!a || !b) {
165
+ return false;
166
+ }
167
+ if (a.inputText !== b.inputText) {
168
+ return false;
169
+ }
170
+ if (!equals(a.attachments, b.attachments, (x, y) => x.id === y.id)) {
171
+ return false;
172
+ }
173
+ return true;
174
+ }
175
+
176
+ export { ChatHistoryNavigator, ChatWidgetHistoryService };
@@ -0,0 +1,45 @@
1
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
+ import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
4
+ import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
5
+ import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
6
+ import { IMarkdownVulnerability } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/annotations";
7
+ import { IChatRequestViewModel, IChatResponseViewModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatViewModel";
8
+ interface CodeBlockContent {
9
+ readonly text: string;
10
+ readonly languageId?: string;
11
+ readonly isComplete: boolean;
12
+ }
13
+ export interface CodeBlockEntry {
14
+ readonly model: Promise<ITextModel>;
15
+ readonly vulns: readonly IMarkdownVulnerability[];
16
+ readonly codemapperUri?: URI;
17
+ readonly isEdit?: boolean;
18
+ }
19
+ export declare class CodeBlockModelCollection extends Disposable {
20
+ private readonly tag;
21
+ private readonly languageService;
22
+ private readonly textModelService;
23
+ private readonly _models;
24
+ /**
25
+ * Max number of models to keep in memory.
26
+ *
27
+ * Currently always maintains the most recently created models.
28
+ */
29
+ private readonly maxModelCount;
30
+ constructor(tag: string | undefined, languageService: ILanguageService, textModelService: ITextModelService);
31
+ dispose(): void;
32
+ get(sessionResource: URI, chat: IChatRequestViewModel | IChatResponseViewModel, codeBlockIndex: number): CodeBlockEntry | undefined;
33
+ getOrCreate(sessionResource: URI, chat: IChatRequestViewModel | IChatResponseViewModel, codeBlockIndex: number): CodeBlockEntry;
34
+ private delete;
35
+ clear(): void;
36
+ updateSync(sessionResource: URI, chat: IChatRequestViewModel | IChatResponseViewModel, codeBlockIndex: number, content: CodeBlockContent): CodeBlockEntry;
37
+ markCodeBlockCompleted(sessionResource: URI, chat: IChatRequestViewModel | IChatResponseViewModel, codeBlockIndex: number): void;
38
+ update(sessionResource: URI, chat: IChatRequestViewModel | IChatResponseViewModel, codeBlockIndex: number, content: CodeBlockContent): Promise<CodeBlockEntry>;
39
+ private updateInternalCodeBlockEntry;
40
+ private trySetTextModelLanguage;
41
+ private getKey;
42
+ private getCodeBlockUri;
43
+ private getUriMetaData;
44
+ }
45
+ export {};
@@ -0,0 +1,207 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { encodeBase64, VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
4
+ import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
5
+ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
7
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
8
+ import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
9
+ import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
10
+ import { PLAINTEXT_LANGUAGE_ID } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/modesRegistry';
11
+ import { EndOfLinePreference } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
12
+ import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
13
+ import { extractVulnerabilitiesFromText, extractCodeblockUrisFromText } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/annotations';
14
+ import { isResponseVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatViewModel';
15
+
16
+ let CodeBlockModelCollection = class CodeBlockModelCollection extends Disposable {
17
+ constructor(tag, languageService, textModelService) {
18
+ super();
19
+ this.tag = tag;
20
+ this.languageService = languageService;
21
+ this.textModelService = textModelService;
22
+ this._models = ( new Map());
23
+ this.maxModelCount = 100;
24
+ this._register(this.languageService.onDidChange(async () => {
25
+ for (const entry of ( this._models.values())) {
26
+ if (!entry.inLanguageId) {
27
+ continue;
28
+ }
29
+ const model = (await entry.model).object;
30
+ const existingLanguageId = model.getLanguageId();
31
+ if (!existingLanguageId || existingLanguageId === PLAINTEXT_LANGUAGE_ID) {
32
+ this.trySetTextModelLanguage(entry.inLanguageId, model.textEditorModel);
33
+ }
34
+ }
35
+ }));
36
+ }
37
+ dispose() {
38
+ super.dispose();
39
+ this.clear();
40
+ }
41
+ get(sessionResource, chat, codeBlockIndex) {
42
+ const entry = this._models.get(this.getKey(sessionResource, chat, codeBlockIndex));
43
+ if (!entry) {
44
+ return;
45
+ }
46
+ return {
47
+ model: entry.model.then(ref => ref.object.textEditorModel),
48
+ vulns: entry.vulns,
49
+ codemapperUri: entry.codemapperUri,
50
+ isEdit: entry.isEdit,
51
+ };
52
+ }
53
+ getOrCreate(sessionResource, chat, codeBlockIndex) {
54
+ const existing = this.get(sessionResource, chat, codeBlockIndex);
55
+ if (existing) {
56
+ return existing;
57
+ }
58
+ const uri = this.getCodeBlockUri(sessionResource, chat, codeBlockIndex);
59
+ const model = this.textModelService.createModelReference(uri);
60
+ this._models.set(this.getKey(sessionResource, chat, codeBlockIndex), {
61
+ model: model,
62
+ vulns: [],
63
+ inLanguageId: undefined,
64
+ codemapperUri: undefined,
65
+ });
66
+ while (this._models.size > this.maxModelCount) {
67
+ const first = Iterable.first(( this._models.keys()));
68
+ if (!first) {
69
+ break;
70
+ }
71
+ this.delete(first);
72
+ }
73
+ return { model: model.then(x => x.object.textEditorModel), vulns: [], codemapperUri: undefined };
74
+ }
75
+ delete(key) {
76
+ const entry = this._models.get(key);
77
+ if (!entry) {
78
+ return;
79
+ }
80
+ entry.model.then(ref => ref.dispose());
81
+ this._models.delete(key);
82
+ }
83
+ clear() {
84
+ this._models.forEach(async (entry) => await entry.model.then(ref => ref.dispose()));
85
+ this._models.clear();
86
+ }
87
+ updateSync(sessionResource, chat, codeBlockIndex, content) {
88
+ const entry = this.getOrCreate(sessionResource, chat, codeBlockIndex);
89
+ this.updateInternalCodeBlockEntry(content, sessionResource, chat, codeBlockIndex);
90
+ return this.get(sessionResource, chat, codeBlockIndex) ?? entry;
91
+ }
92
+ markCodeBlockCompleted(sessionResource, chat, codeBlockIndex) {
93
+ const entry = this._models.get(this.getKey(sessionResource, chat, codeBlockIndex));
94
+ if (!entry) {
95
+ return;
96
+ }
97
+ }
98
+ async update(sessionResource, chat, codeBlockIndex, content) {
99
+ const entry = this.getOrCreate(sessionResource, chat, codeBlockIndex);
100
+ const newText = this.updateInternalCodeBlockEntry(content, sessionResource, chat, codeBlockIndex);
101
+ const textModel = await entry.model;
102
+ if (!textModel || textModel.isDisposed()) {
103
+ return entry;
104
+ }
105
+ if (content.languageId) {
106
+ this.trySetTextModelLanguage(content.languageId, textModel);
107
+ }
108
+ const currentText = textModel.getValue(EndOfLinePreference.LF);
109
+ if (newText === currentText) {
110
+ return entry;
111
+ }
112
+ if (newText.startsWith(currentText)) {
113
+ const text = newText.slice(currentText.length);
114
+ const lastLine = textModel.getLineCount();
115
+ const lastCol = textModel.getLineMaxColumn(lastLine);
116
+ textModel.applyEdits([{ range: ( new Range(lastLine, lastCol, lastLine, lastCol)), text }]);
117
+ }
118
+ else {
119
+ textModel.setValue(newText);
120
+ }
121
+ return entry;
122
+ }
123
+ updateInternalCodeBlockEntry(content, sessionResource, chat, codeBlockIndex) {
124
+ const entry = this._models.get(this.getKey(sessionResource, chat, codeBlockIndex));
125
+ if (entry) {
126
+ entry.inLanguageId = content.languageId;
127
+ }
128
+ const extractedVulns = extractVulnerabilitiesFromText(content.text);
129
+ let newText = fixCodeText(extractedVulns.newText, content.languageId);
130
+ if (entry) {
131
+ entry.vulns = extractedVulns.vulnerabilities;
132
+ }
133
+ const codeblockUri = extractCodeblockUrisFromText(newText);
134
+ if (codeblockUri) {
135
+ if (entry) {
136
+ entry.codemapperUri = codeblockUri.uri;
137
+ entry.isEdit = codeblockUri.isEdit;
138
+ }
139
+ newText = codeblockUri.textWithoutResult;
140
+ }
141
+ if (content.isComplete) {
142
+ this.markCodeBlockCompleted(sessionResource, chat, codeBlockIndex);
143
+ }
144
+ return newText;
145
+ }
146
+ trySetTextModelLanguage(inLanguageId, textModel) {
147
+ const vscodeLanguageId = this.languageService.getLanguageIdByLanguageName(inLanguageId);
148
+ if (vscodeLanguageId && vscodeLanguageId !== textModel.getLanguageId()) {
149
+ textModel.setLanguage(vscodeLanguageId);
150
+ }
151
+ }
152
+ getKey(sessionResource, chat, index) {
153
+ return `${( sessionResource.toString())}/${chat.id}/${index}`;
154
+ }
155
+ getCodeBlockUri(sessionResource, chat, index) {
156
+ const metadata = this.getUriMetaData(chat);
157
+ const indexPart = this.tag ? `${this.tag}-${index}` : `${index}`;
158
+ const encodedSessionId = encodeBase64(VSBuffer.wrap(( new TextEncoder()).encode(( sessionResource.toString()))), false, true);
159
+ return ( URI.from({
160
+ scheme: Schemas.vscodeChatCodeBlock,
161
+ authority: encodedSessionId,
162
+ path: `/${chat.id}/${indexPart}`,
163
+ fragment: metadata ? JSON.stringify(metadata) : undefined,
164
+ }));
165
+ }
166
+ getUriMetaData(chat) {
167
+ if (!isResponseVM(chat)) {
168
+ return undefined;
169
+ }
170
+ return {
171
+ references: ( chat.contentReferences.map(ref => {
172
+ if (typeof ref.reference === 'string') {
173
+ return;
174
+ }
175
+ const uriOrLocation = 'variableName' in ref.reference ?
176
+ ref.reference.value :
177
+ ref.reference;
178
+ if (!uriOrLocation) {
179
+ return;
180
+ }
181
+ if (URI.isUri(uriOrLocation)) {
182
+ return {
183
+ uri: uriOrLocation.toJSON()
184
+ };
185
+ }
186
+ return {
187
+ uri: uriOrLocation.uri.toJSON(),
188
+ range: uriOrLocation.range,
189
+ };
190
+ }))
191
+ };
192
+ }
193
+ };
194
+ CodeBlockModelCollection = ( __decorate([
195
+ ( __param(1, ILanguageService)),
196
+ ( __param(2, ITextModelService))
197
+ ], CodeBlockModelCollection));
198
+ function fixCodeText(text, languageId) {
199
+ if (languageId === 'php') {
200
+ if (!text.trim().startsWith('<?')) {
201
+ return `<?php\n${text}`;
202
+ }
203
+ }
204
+ return text;
205
+ }
206
+
207
+ export { CodeBlockModelCollection };
@@ -0,0 +1,48 @@
1
+ import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
+ import { ResourceSet } from "@codingame/monaco-vscode-api/vscode/vs/base/common/map";
3
+ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
4
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
5
+ import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
6
+ import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
7
+ import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
8
+ import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
9
+ import { ChatRequestVariableSet } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariableEntries";
10
+ import { IToolAndToolSetEnablementMap } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService";
11
+ import { ILanguageModelToolsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service";
12
+ import { IPromptPath } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService";
13
+ import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service";
14
+ export type InstructionsCollectionEvent = {
15
+ applyingInstructionsCount: number;
16
+ referencedInstructionsCount: number;
17
+ agentInstructionsCount: number;
18
+ listedInstructionsCount: number;
19
+ totalInstructionsCount: number;
20
+ };
21
+ export declare function newInstructionsCollectionEvent(): InstructionsCollectionEvent;
22
+ export declare class ComputeAutomaticInstructions {
23
+ private readonly _enabledTools;
24
+ private readonly _promptsService;
25
+ readonly _logService: ILogService;
26
+ private readonly _labelService;
27
+ private readonly _configurationService;
28
+ private readonly _workspaceService;
29
+ private readonly _fileService;
30
+ private readonly _telemetryService;
31
+ private readonly _languageModelToolsService;
32
+ private _parseResults;
33
+ constructor(_enabledTools: IToolAndToolSetEnablementMap | undefined, _promptsService: IPromptsService, _logService: ILogService, _labelService: ILabelService, _configurationService: IConfigurationService, _workspaceService: IWorkspaceContextService, _fileService: IFileService, _telemetryService: ITelemetryService, _languageModelToolsService: ILanguageModelToolsService);
34
+ private _parseInstructionsFile;
35
+ collect(variables: ChatRequestVariableSet, token: CancellationToken): Promise<void>;
36
+ private sendTelemetry;
37
+ /** public for testing */
38
+ addApplyingInstructions(instructionFiles: readonly IPromptPath[], context: {
39
+ files: ResourceSet;
40
+ instructions: ResourceSet;
41
+ }, variables: ChatRequestVariableSet, telemetryEvent: InstructionsCollectionEvent, token: CancellationToken): Promise<void>;
42
+ private _getContext;
43
+ private _addAgentInstructions;
44
+ private _matches;
45
+ private _getTool;
46
+ private _getInstructionsWithPatternsList;
47
+ private _addReferencedInstructions;
48
+ }