@codingame/monaco-vscode-chat-service-override 19.1.4 → 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/index.js +20 -8
  2. package/package.json +36 -31
  3. package/vscode/src/vs/base/common/policy.d.ts +14 -0
  4. package/vscode/src/vs/base/common/policy.js +11 -0
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +53 -43
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +54 -24
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +14 -14
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +15 -15
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +37 -25
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -2
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +1 -1
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +23 -11
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +9 -9
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +1 -1
  19. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +11 -11
  20. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +83 -14
  21. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +421 -21
  22. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +1 -1
  23. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +20 -20
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +215 -104
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +3 -1
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +9 -3
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.d.ts +3 -1
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.js +18 -6
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +4 -4
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +20 -20
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +14 -14
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +1 -1
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +6 -3
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +4 -2
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +9 -6
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +1 -1
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +11 -8
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +5 -3
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +16 -11
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +7 -23
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +58 -326
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +0 -1
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +33 -30
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +12 -1
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +39 -17
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.d.ts +55 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.js +380 -0
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +3 -2
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +1 -1
  52. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +5 -5
  53. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.js +4 -2
  54. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +1 -1
  56. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +22 -22
  57. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +9 -4
  58. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +44 -10
  59. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.d.ts +38 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +145 -0
  61. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +34 -34
  62. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +7 -7
  63. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
  64. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +3 -3
  65. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
  66. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +36 -11
  67. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.d.ts +49 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.js +407 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.d.ts +12 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.js +738 -0
  71. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +1 -1
  72. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +142 -151
  73. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +1 -1
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +54 -54
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +20 -0
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +4 -3
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +5 -4
  78. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
  79. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +23 -7
  80. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
  81. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
  82. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +1 -0
  83. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +13 -8
  84. package/vscode/src/vs/workbench/contrib/chat/browser/media/apple-dark.svg +3 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/media/apple-light.svg +3 -0
  86. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSessions.css +28 -0
  87. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +7 -7
  88. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +2 -2
  89. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +14 -14
  90. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +8 -8
  91. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +10 -10
  92. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +1 -1
  93. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +11 -11
  94. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +1 -1
  95. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +19 -19
  96. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +1 -1
  97. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +14 -14
  98. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionContribution.js +1 -1
  99. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +3 -3
  100. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +4 -4
  101. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +10 -10
  102. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +11 -11
  103. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.d.ts +1 -7
  104. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.js +52 -90
  105. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +15 -15
  106. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
  107. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +2 -2
  108. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +6 -2
  109. package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +9 -6
  110. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +11 -6
  111. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +137 -30
  112. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +8 -0
  113. package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +1 -1
  114. package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +3 -3
  115. package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.d.ts +27 -0
  116. package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.js +44 -0
  117. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/configMigration.js +1 -1
  118. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/filePromptContentsProvider.js +2 -2
  119. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/promptContentsProviderBase.d.ts +1 -1
  120. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/promptContentsProviderBase.js +1 -1
  121. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +1 -1
  122. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderDiagnosticsProvider.js +3 -5
  123. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderHovers.js +14 -14
  124. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkDiagnosticsProvider.js +1 -1
  125. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptPathAutocompletion.js +1 -1
  126. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/providerInstanceManagerBase.js +2 -2
  127. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/basePromptParser.js +1 -1
  128. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/headerBase.js +4 -4
  129. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/instructionsHeader.d.ts +1 -1
  130. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/applyTo.js +3 -3
  131. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/base/enum.js +1 -1
  132. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/base/string.js +1 -1
  133. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/metadata/tools.js +4 -4
  134. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/modeHeader.d.ts +1 -1
  135. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/promptHeader.d.ts +1 -1
  136. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/promptHeader/promptHeader.js +1 -1
  137. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/topError.js +9 -9
  138. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +1 -1
  139. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +8 -8
  140. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +1 -1
  141. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +2 -2
  142. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +27 -27
  143. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
  144. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  145. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +9 -9
  146. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
  147. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +4 -4
  148. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +104 -0
  149. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +667 -0
  150. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +14 -14
  151. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +1 -1
  152. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +1 -1
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
  154. package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
  155. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/media/terminalChatWidget.css +56 -0
  156. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.d.ts +1 -0
  157. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js +14 -0
  158. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.d.ts +11 -0
  159. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +111 -0
  160. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.d.ts +10 -0
  161. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +52 -0
  162. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.d.ts +1 -0
  163. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +262 -0
  164. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.d.ts +35 -0
  165. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.js +129 -0
  166. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatControllerHolder.d.ts +3 -0
  167. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatControllerHolder.js +8 -0
  168. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.d.ts +9 -0
  169. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +30 -0
  170. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +72 -0
  171. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +411 -0
  172. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.d.ts +3 -0
  173. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.js +59 -0
  174. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/bufferOutputPolling.d.ts +51 -0
  175. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/bufferOutputPolling.js +163 -0
  176. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.d.ts +24 -0
  177. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.js +164 -0
  178. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +14 -0
  179. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +101 -0
  180. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +16 -0
  181. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +52 -0
  182. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +12 -0
  183. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +71 -0
  184. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +14 -0
  185. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +94 -0
  186. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/getTerminalOutputTool.d.ts +11 -0
  187. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/getTerminalOutputTool.js +44 -0
  188. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.d.ts +3 -0
  189. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +18 -0
  190. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +3 -0
  191. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +13 -0
  192. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalTool.d.ts +55 -0
  193. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalTool.js +603 -0
  194. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.d.ts +3 -0
  195. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.js +113 -0
  196. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/createAndRunTaskTool.d.ts +21 -0
  197. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/createAndRunTaskTool.js +227 -0
  198. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/getTaskOutputTool.d.ts +19 -0
  199. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/getTaskOutputTool.js +88 -0
  200. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/runTaskTool.d.ts +21 -0
  201. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/runTaskTool.js +140 -0
  202. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/taskHelpers.d.ts +22 -0
  203. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task/taskHelpers.js +80 -0
  204. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task.chatAgentTools.contribution.d.ts +1 -0
  205. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/task.chatAgentTools.contribution.js +40 -0
  206. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.d.ts +1 -0
  207. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +36 -0
  208. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +20 -0
  209. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +114 -0
  210. package/vscode/src/vs/workbench/contrib/chat/browser/media/google-mono-dark.svg +0 -3
  211. package/vscode/src/vs/workbench/contrib/chat/browser/media/google-mono-light.svg +0 -3
@@ -0,0 +1,667 @@
1
+
2
+ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
3
+ import { KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
4
+ import { isCodeEditor, isDiffEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
5
+ import { EditorAction2 } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions';
6
+ import { EmbeddedDiffEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/embeddedDiffEditorWidget';
7
+ import { EmbeddedCodeEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
8
+ import { EditorContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorContextKeys';
9
+ import { InlineChatController, InlineChatRunOptions, InlineChatController1, InlineChatController2 } from '@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
10
+ import { ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_HAS_AGENT, CTX_INLINE_CHAT_HAS_AGENT2, CTX_INLINE_CHAT_POSSIBLE, ACTION_START, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_STASHED_SESSION, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, MENU_INLINE_CHAT_WIDGET_STATUS, MENU_INLINE_CHAT_ZONE, CTX_INLINE_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_RESPONSE_TYPE, InlineChatResponseType, ACTION_DISCARD_CHANGES, ACTION_REGENERATE_RESPONSE, MENU_INLINE_CHAT_SIDE, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, ACTION_TOGGLE_DIFF } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
11
+ import { ctxRequestCount, ctxHasEditorModification, ctxHasRequestInProgress, ctxIsGlobalEditingSession } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys';
12
+ import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
13
+ import { Action2, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
14
+ import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
15
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
16
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
17
+ import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
18
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
19
+ import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
20
+ import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility';
21
+ import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
22
+ import { registerIcon } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/iconRegistry';
23
+ import { IPreferencesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/preferences/common/preferences.service';
24
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
25
+ import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
26
+ import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
27
+ import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
28
+ import { IInlineChatSessionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
29
+
30
+ CommandsRegistry.registerCommandAlias('interactiveEditor.start', 'inlineChat.start');
31
+ CommandsRegistry.registerCommandAlias('interactive.acceptChanges', ACTION_ACCEPT_CHANGES);
32
+ const START_INLINE_CHAT = registerIcon('start-inline-chat', Codicon.sparkle, ( localize(7653, 'Icon which spawns the inline chat from the editor toolbar.')));
33
+ class StartSessionAction extends Action2 {
34
+ constructor() {
35
+ super({
36
+ id: ACTION_START,
37
+ title: ( localize2(7654, 'Editor Inline Chat')),
38
+ category: AbstractInline1ChatAction.category,
39
+ f1: true,
40
+ precondition: ( ContextKeyExpr.and(( ContextKeyExpr.or(CTX_INLINE_CHAT_HAS_AGENT, CTX_INLINE_CHAT_HAS_AGENT2)), CTX_INLINE_CHAT_POSSIBLE, EditorContextKeys.writable, ( EditorContextKeys.editorSimpleInput.negate()))),
41
+ keybinding: {
42
+ when: EditorContextKeys.focus,
43
+ weight: KeybindingWeight.WorkbenchContrib,
44
+ primary: KeyMod.CtrlCmd | KeyCode.KeyI
45
+ },
46
+ icon: START_INLINE_CHAT,
47
+ menu: [{
48
+ id: MenuId.ChatTitleBarMenu,
49
+ group: 'a_open',
50
+ order: 3,
51
+ }, {
52
+ id: MenuId.ChatTextEditorMenu,
53
+ group: 'a_open',
54
+ order: 1
55
+ }]
56
+ });
57
+ }
58
+ run(accessor, ...args) {
59
+ const codeEditorService = accessor.get(ICodeEditorService);
60
+ const editor = codeEditorService.getActiveCodeEditor();
61
+ if (!editor || editor.isSimpleWidget) {
62
+ return;
63
+ }
64
+ return editor.invokeWithinContext((editorAccessor) => {
65
+ const kbService = editorAccessor.get(IContextKeyService);
66
+ const logService = editorAccessor.get(ILogService);
67
+ const enabled = kbService.contextMatchesRules(this.desc.precondition ?? undefined);
68
+ if (!enabled) {
69
+ logService.debug(`[EditorAction2] NOT running command because its precondition is FALSE`, this.desc.id, this.desc.precondition?.serialize());
70
+ return;
71
+ }
72
+ return this._runEditorCommand(editorAccessor, editor, ...args);
73
+ });
74
+ }
75
+ _runEditorCommand(accessor, editor, ..._args) {
76
+ const ctrl = InlineChatController.get(editor);
77
+ if (!ctrl) {
78
+ return;
79
+ }
80
+ let options;
81
+ const arg = _args[0];
82
+ if (arg && InlineChatRunOptions.isInlineChatRunOptions(arg)) {
83
+ options = arg;
84
+ }
85
+ InlineChatController.get(editor)?.run({ ...options });
86
+ }
87
+ }
88
+ class FocusInlineChat extends EditorAction2 {
89
+ constructor() {
90
+ super({
91
+ id: 'inlineChat.focus',
92
+ title: ( localize2(7655, "Focus Input")),
93
+ f1: true,
94
+ category: AbstractInline1ChatAction.category,
95
+ precondition: ( ContextKeyExpr.and(EditorContextKeys.editorTextFocus, CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_FOCUSED.negate()), ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()))),
96
+ keybinding: [{
97
+ weight: KeybindingWeight.EditorCore + 10,
98
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.isEqualTo('above')), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
99
+ primary: KeyMod.CtrlCmd | KeyCode.DownArrow,
100
+ }, {
101
+ weight: KeybindingWeight.EditorCore + 10,
102
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.isEqualTo('below')), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
103
+ primary: KeyMod.CtrlCmd | KeyCode.UpArrow,
104
+ }]
105
+ });
106
+ }
107
+ runEditorCommand(_accessor, editor, ..._args) {
108
+ InlineChatController.get(editor)?.focus();
109
+ }
110
+ }
111
+ class UnstashSessionAction extends EditorAction2 {
112
+ constructor() {
113
+ super({
114
+ id: 'inlineChat.unstash',
115
+ title: ( localize2(7656, "Resume Last Dismissed Inline Chat")),
116
+ category: AbstractInline1ChatAction.category,
117
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_STASHED_SESSION, EditorContextKeys.writable)),
118
+ keybinding: {
119
+ weight: KeybindingWeight.WorkbenchContrib,
120
+ primary: KeyMod.CtrlCmd | KeyCode.KeyZ,
121
+ }
122
+ });
123
+ }
124
+ async runEditorCommand(_accessor, editor, ..._args) {
125
+ const ctrl = InlineChatController1.get(editor);
126
+ if (ctrl) {
127
+ const session = ctrl.unstashLastSession();
128
+ if (session) {
129
+ ctrl.run({
130
+ existingSession: session,
131
+ });
132
+ }
133
+ }
134
+ }
135
+ }
136
+ class AbstractInline1ChatAction extends EditorAction2 {
137
+ static { this.category = ( localize2(7657, "Inline Chat")); }
138
+ constructor(desc) {
139
+ const massageMenu = (menu) => {
140
+ if (Array.isArray(menu)) {
141
+ for (const entry of menu) {
142
+ entry.when = ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT, entry.when));
143
+ }
144
+ }
145
+ else if (menu) {
146
+ menu.when = ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT, menu.when));
147
+ }
148
+ };
149
+ if (Array.isArray(desc.menu)) {
150
+ massageMenu(desc.menu);
151
+ }
152
+ else {
153
+ massageMenu(desc.menu);
154
+ }
155
+ super({
156
+ ...desc,
157
+ category: AbstractInline1ChatAction.category,
158
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT, desc.precondition))
159
+ });
160
+ }
161
+ runEditorCommand(accessor, editor, ..._args) {
162
+ const editorService = accessor.get(IEditorService);
163
+ const logService = accessor.get(ILogService);
164
+ let ctrl = InlineChatController1.get(editor);
165
+ if (!ctrl) {
166
+ const { activeTextEditorControl } = editorService;
167
+ if (isCodeEditor(activeTextEditorControl)) {
168
+ editor = activeTextEditorControl;
169
+ }
170
+ else if (isDiffEditor(activeTextEditorControl)) {
171
+ editor = activeTextEditorControl.getModifiedEditor();
172
+ }
173
+ ctrl = InlineChatController1.get(editor);
174
+ }
175
+ if (!ctrl) {
176
+ logService.warn('[IE] NO controller found for action', this.desc.id, editor.getModel()?.uri);
177
+ return;
178
+ }
179
+ if (editor instanceof EmbeddedCodeEditorWidget) {
180
+ editor = editor.getParentEditor();
181
+ }
182
+ if (!ctrl) {
183
+ for (const diffEditor of accessor.get(ICodeEditorService).listDiffEditors()) {
184
+ if (diffEditor.getOriginalEditor() === editor || diffEditor.getModifiedEditor() === editor) {
185
+ if (diffEditor instanceof EmbeddedDiffEditorWidget) {
186
+ this.runEditorCommand(accessor, diffEditor.getParentEditor(), ..._args);
187
+ }
188
+ }
189
+ }
190
+ return;
191
+ }
192
+ this.runInlineChatCommand(accessor, ctrl, editor, ..._args);
193
+ }
194
+ }
195
+ class ArrowOutUpAction extends AbstractInline1ChatAction {
196
+ constructor() {
197
+ super({
198
+ id: 'inlineChat.arrowOutUp',
199
+ title: ( localize(7658, 'Cursor Up')),
200
+ precondition: ( ContextKeyExpr.and(
201
+ CTX_INLINE_CHAT_FOCUSED,
202
+ CTX_INLINE_CHAT_INNER_CURSOR_FIRST,
203
+ ( EditorContextKeys.isEmbeddedDiffEditor.negate()),
204
+ ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate())
205
+ )),
206
+ keybinding: {
207
+ weight: KeybindingWeight.EditorCore,
208
+ primary: KeyMod.CtrlCmd | KeyCode.UpArrow
209
+ }
210
+ });
211
+ }
212
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
213
+ ctrl.arrowOut(true);
214
+ }
215
+ }
216
+ class ArrowOutDownAction extends AbstractInline1ChatAction {
217
+ constructor() {
218
+ super({
219
+ id: 'inlineChat.arrowOutDown',
220
+ title: ( localize(7659, 'Cursor Down')),
221
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST, ( EditorContextKeys.isEmbeddedDiffEditor.negate()), ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()))),
222
+ keybinding: {
223
+ weight: KeybindingWeight.EditorCore,
224
+ primary: KeyMod.CtrlCmd | KeyCode.DownArrow
225
+ }
226
+ });
227
+ }
228
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
229
+ ctrl.arrowOut(false);
230
+ }
231
+ }
232
+ class AcceptChanges extends AbstractInline1ChatAction {
233
+ constructor() {
234
+ super({
235
+ id: ACTION_ACCEPT_CHANGES,
236
+ title: ( localize2(7660, "Accept Changes")),
237
+ shortTitle: ( localize(7661, 'Accept')),
238
+ icon: Codicon.check,
239
+ f1: true,
240
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE)),
241
+ keybinding: [{
242
+ weight: KeybindingWeight.WorkbenchContrib + 10,
243
+ primary: KeyMod.CtrlCmd | KeyCode.Enter,
244
+ }],
245
+ menu: [{
246
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
247
+ group: '0_main',
248
+ order: 1,
249
+ when: ( ContextKeyExpr.and(( ChatContextKeys.inputHasText.toNegated()), ( CTX_INLINE_CHAT_REQUEST_IN_PROGRESS.toNegated()), ( CTX_INLINE_CHAT_RESPONSE_TYPE.isEqualTo(InlineChatResponseType.MessagesAndEdits)))),
250
+ }, {
251
+ id: MENU_INLINE_CHAT_ZONE,
252
+ group: 'navigation',
253
+ order: 1,
254
+ }]
255
+ });
256
+ }
257
+ async runInlineChatCommand(_accessor, ctrl, _editor, hunk) {
258
+ ctrl.acceptHunk(hunk);
259
+ }
260
+ }
261
+ class DiscardHunkAction extends AbstractInline1ChatAction {
262
+ constructor() {
263
+ super({
264
+ id: ACTION_DISCARD_CHANGES,
265
+ title: ( localize(7662, 'Discard')),
266
+ icon: Codicon.chromeClose,
267
+ precondition: CTX_INLINE_CHAT_VISIBLE,
268
+ menu: [{
269
+ id: MENU_INLINE_CHAT_ZONE,
270
+ group: 'navigation',
271
+ order: 2
272
+ }],
273
+ keybinding: {
274
+ weight: KeybindingWeight.EditorContrib,
275
+ primary: KeyCode.Escape,
276
+ when: ( CTX_INLINE_CHAT_RESPONSE_TYPE.isEqualTo(InlineChatResponseType.MessagesAndEdits))
277
+ }
278
+ });
279
+ }
280
+ async runInlineChatCommand(_accessor, ctrl, _editor, hunk) {
281
+ return ctrl.discardHunk(hunk);
282
+ }
283
+ }
284
+ class RerunAction extends AbstractInline1ChatAction {
285
+ constructor() {
286
+ super({
287
+ id: ACTION_REGENERATE_RESPONSE,
288
+ title: ( localize2(7663, "Rerun Request")),
289
+ shortTitle: ( localize(7664, 'Rerun')),
290
+ f1: false,
291
+ icon: Codicon.refresh,
292
+ precondition: CTX_INLINE_CHAT_VISIBLE,
293
+ menu: {
294
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
295
+ group: '0_main',
296
+ order: 5,
297
+ when: ( ContextKeyExpr.and(( ChatContextKeys.inputHasText.toNegated()), ( CTX_INLINE_CHAT_REQUEST_IN_PROGRESS.negate()), ( CTX_INLINE_CHAT_RESPONSE_TYPE.notEqualsTo(InlineChatResponseType.None))))
298
+ },
299
+ keybinding: {
300
+ weight: KeybindingWeight.WorkbenchContrib,
301
+ primary: KeyMod.CtrlCmd | KeyCode.KeyR
302
+ }
303
+ });
304
+ }
305
+ async runInlineChatCommand(accessor, ctrl, _editor, ..._args) {
306
+ const chatService = accessor.get(IChatService);
307
+ const chatWidgetService = accessor.get(IChatWidgetService);
308
+ const model = ctrl.chatWidget.viewModel?.model;
309
+ if (!model) {
310
+ return;
311
+ }
312
+ const lastRequest = model.getRequests().at(-1);
313
+ if (lastRequest) {
314
+ const widget = chatWidgetService.getWidgetBySessionId(model.sessionId);
315
+ await chatService.resendRequest(lastRequest, {
316
+ noCommandDetection: false,
317
+ attempt: lastRequest.attempt + 1,
318
+ location: ctrl.chatWidget.location,
319
+ userSelectedModelId: widget?.input.currentLanguageModel
320
+ });
321
+ }
322
+ }
323
+ }
324
+ class CloseAction extends AbstractInline1ChatAction {
325
+ constructor() {
326
+ super({
327
+ id: 'inlineChat.close',
328
+ title: ( localize(7665, 'Close')),
329
+ icon: Codicon.close,
330
+ precondition: CTX_INLINE_CHAT_VISIBLE,
331
+ keybinding: {
332
+ weight: KeybindingWeight.EditorContrib + 1,
333
+ primary: KeyCode.Escape,
334
+ },
335
+ menu: [{
336
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
337
+ group: '0_main',
338
+ order: 1,
339
+ when: ( CTX_INLINE_CHAT_REQUEST_IN_PROGRESS.negate())
340
+ }, {
341
+ id: MENU_INLINE_CHAT_SIDE,
342
+ group: 'navigation',
343
+ when: ( CTX_INLINE_CHAT_RESPONSE_TYPE.isEqualTo(InlineChatResponseType.None))
344
+ }]
345
+ });
346
+ }
347
+ async runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
348
+ ctrl.cancelSession();
349
+ }
350
+ }
351
+ class ConfigureInlineChatAction extends AbstractInline1ChatAction {
352
+ constructor() {
353
+ super({
354
+ id: 'inlineChat.configure',
355
+ title: ( localize2(7666, 'Configure Inline Chat')),
356
+ icon: Codicon.settingsGear,
357
+ precondition: CTX_INLINE_CHAT_VISIBLE,
358
+ f1: true,
359
+ menu: {
360
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
361
+ group: 'zzz',
362
+ order: 5
363
+ }
364
+ });
365
+ }
366
+ async runInlineChatCommand(accessor, ctrl, _editor, ..._args) {
367
+ accessor.get(IPreferencesService).openSettings({ query: 'inlineChat' });
368
+ }
369
+ }
370
+ class MoveToNextHunk extends AbstractInline1ChatAction {
371
+ constructor() {
372
+ super({
373
+ id: 'inlineChat.moveToNextHunk',
374
+ title: ( localize2(7667, 'Move to Next Change')),
375
+ precondition: CTX_INLINE_CHAT_VISIBLE,
376
+ f1: true,
377
+ keybinding: {
378
+ weight: KeybindingWeight.WorkbenchContrib,
379
+ primary: KeyCode.F7
380
+ }
381
+ });
382
+ }
383
+ runInlineChatCommand(accessor, ctrl, editor, ...args) {
384
+ ctrl.moveHunk(true);
385
+ }
386
+ }
387
+ class MoveToPreviousHunk extends AbstractInline1ChatAction {
388
+ constructor() {
389
+ super({
390
+ id: 'inlineChat.moveToPreviousHunk',
391
+ title: ( localize2(7668, 'Move to Previous Change')),
392
+ f1: true,
393
+ precondition: CTX_INLINE_CHAT_VISIBLE,
394
+ keybinding: {
395
+ weight: KeybindingWeight.WorkbenchContrib,
396
+ primary: KeyMod.Shift | KeyCode.F7
397
+ }
398
+ });
399
+ }
400
+ runInlineChatCommand(accessor, ctrl, editor, ...args) {
401
+ ctrl.moveHunk(false);
402
+ }
403
+ }
404
+ class ViewInChatAction extends AbstractInline1ChatAction {
405
+ constructor() {
406
+ super({
407
+ id: ACTION_VIEW_IN_CHAT,
408
+ title: ( localize(7669, 'View in Chat')),
409
+ icon: Codicon.commentDiscussion,
410
+ precondition: CTX_INLINE_CHAT_VISIBLE,
411
+ menu: [{
412
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
413
+ group: 'more',
414
+ order: 1,
415
+ when: ( CTX_INLINE_CHAT_RESPONSE_TYPE.notEqualsTo(InlineChatResponseType.Messages))
416
+ }, {
417
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
418
+ group: '0_main',
419
+ order: 1,
420
+ when: ( ContextKeyExpr.and(( ChatContextKeys.inputHasText.toNegated()), ( CTX_INLINE_CHAT_RESPONSE_TYPE.isEqualTo(InlineChatResponseType.Messages)), ( CTX_INLINE_CHAT_REQUEST_IN_PROGRESS.negate())))
421
+ }],
422
+ keybinding: {
423
+ weight: KeybindingWeight.WorkbenchContrib,
424
+ primary: KeyMod.CtrlCmd | KeyCode.DownArrow,
425
+ when: ChatContextKeys.inChatInput
426
+ }
427
+ });
428
+ }
429
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
430
+ return ctrl.viewInChat();
431
+ }
432
+ }
433
+ class ToggleDiffForChange extends AbstractInline1ChatAction {
434
+ constructor() {
435
+ super({
436
+ id: ACTION_TOGGLE_DIFF,
437
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_CHANGE_HAS_DIFF)),
438
+ title: ( localize2(7670, 'Toggle Changes')),
439
+ icon: Codicon.diffSingle,
440
+ toggled: {
441
+ condition: CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF,
442
+ },
443
+ menu: [{
444
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
445
+ group: 'zzz',
446
+ order: 1,
447
+ }, {
448
+ id: MENU_INLINE_CHAT_ZONE,
449
+ group: 'navigation',
450
+ when: CTX_INLINE_CHAT_CHANGE_HAS_DIFF,
451
+ order: 2
452
+ }]
453
+ });
454
+ }
455
+ runInlineChatCommand(_accessor, ctrl, _editor, hunkInfo) {
456
+ ctrl.toggleDiff(hunkInfo);
457
+ }
458
+ }
459
+ class AbstractInline2ChatAction extends EditorAction2 {
460
+ static { this.category = ( localize2(7657, "Inline Chat")); }
461
+ constructor(desc) {
462
+ const massageMenu = (menu) => {
463
+ if (Array.isArray(menu)) {
464
+ for (const entry of menu) {
465
+ entry.when = ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT2, entry.when));
466
+ }
467
+ }
468
+ else if (menu) {
469
+ menu.when = ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT2, menu.when));
470
+ }
471
+ };
472
+ if (Array.isArray(desc.menu)) {
473
+ massageMenu(desc.menu);
474
+ }
475
+ else {
476
+ massageMenu(desc.menu);
477
+ }
478
+ super({
479
+ ...desc,
480
+ category: AbstractInline2ChatAction.category,
481
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT2, desc.precondition))
482
+ });
483
+ }
484
+ runEditorCommand(accessor, editor, ..._args) {
485
+ const editorService = accessor.get(IEditorService);
486
+ const logService = accessor.get(ILogService);
487
+ let ctrl = InlineChatController2.get(editor);
488
+ if (!ctrl) {
489
+ const { activeTextEditorControl } = editorService;
490
+ if (isCodeEditor(activeTextEditorControl)) {
491
+ editor = activeTextEditorControl;
492
+ }
493
+ else if (isDiffEditor(activeTextEditorControl)) {
494
+ editor = activeTextEditorControl.getModifiedEditor();
495
+ }
496
+ ctrl = InlineChatController2.get(editor);
497
+ }
498
+ if (!ctrl) {
499
+ logService.warn('[IE] NO controller found for action', this.desc.id, editor.getModel()?.uri);
500
+ return;
501
+ }
502
+ if (editor instanceof EmbeddedCodeEditorWidget) {
503
+ editor = editor.getParentEditor();
504
+ }
505
+ if (!ctrl) {
506
+ for (const diffEditor of accessor.get(ICodeEditorService).listDiffEditors()) {
507
+ if (diffEditor.getOriginalEditor() === editor || diffEditor.getModifiedEditor() === editor) {
508
+ if (diffEditor instanceof EmbeddedDiffEditorWidget) {
509
+ this.runEditorCommand(accessor, diffEditor.getParentEditor(), ..._args);
510
+ }
511
+ }
512
+ }
513
+ return;
514
+ }
515
+ this.runInlineChatCommand(accessor, ctrl, editor, ..._args);
516
+ }
517
+ }
518
+ class KeepOrUndoSessionAction extends AbstractInline2ChatAction {
519
+ constructor(id, _keep) {
520
+ super({
521
+ id,
522
+ title: _keep
523
+ ? ( localize2(7671, "Keep"))
524
+ : ( localize2(7672, "Undo")),
525
+ f1: true,
526
+ icon: _keep ? Codicon.check : Codicon.discard,
527
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( ctxHasRequestInProgress.negate()))),
528
+ keybinding: [{
529
+ weight: KeybindingWeight.WorkbenchContrib + 10,
530
+ primary: _keep
531
+ ? KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyY
532
+ : KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyN
533
+ }],
534
+ menu: [{
535
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
536
+ group: '0_main',
537
+ order: 1,
538
+ when: ( ContextKeyExpr.and(
539
+ CTX_INLINE_CHAT_HAS_AGENT2,
540
+ ContextKeyExpr.greater(ctxRequestCount.key, 0),
541
+ ctxHasEditorModification
542
+ )),
543
+ }]
544
+ });
545
+ this._keep = _keep;
546
+ }
547
+ async runInlineChatCommand(accessor, _ctrl, editor, ..._args) {
548
+ const inlineChatSessions = accessor.get(IInlineChatSessionService);
549
+ if (!editor.hasModel()) {
550
+ return;
551
+ }
552
+ const textModel = editor.getModel();
553
+ const session = inlineChatSessions.getSession2(textModel.uri);
554
+ if (session) {
555
+ if (this._keep) {
556
+ await session.editingSession.accept();
557
+ }
558
+ else {
559
+ await session.editingSession.reject();
560
+ }
561
+ session.dispose();
562
+ }
563
+ }
564
+ }
565
+ class KeepSessionAction2 extends KeepOrUndoSessionAction {
566
+ constructor() {
567
+ super('inlineChat2.keep', true);
568
+ }
569
+ }
570
+ class UndoSessionAction2 extends KeepOrUndoSessionAction {
571
+ constructor() {
572
+ super('inlineChat2.undo', false);
573
+ }
574
+ }
575
+ class CloseSessionAction2 extends AbstractInline2ChatAction {
576
+ constructor() {
577
+ super({
578
+ id: 'inlineChat2.close',
579
+ title: ( localize2(7673, "Close")),
580
+ f1: true,
581
+ icon: Codicon.close,
582
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( ctxHasRequestInProgress.negate()), ( ContextKeyExpr.or(( ctxRequestCount.isEqualTo(0)), ( ctxHasEditorModification.negate()))))),
583
+ keybinding: [{
584
+ when: ( ctxRequestCount.isEqualTo(0)),
585
+ weight: KeybindingWeight.WorkbenchContrib,
586
+ primary: KeyMod.CtrlCmd | KeyCode.KeyI,
587
+ }, {
588
+ weight: KeybindingWeight.WorkbenchContrib,
589
+ primary: KeyCode.Escape,
590
+ }],
591
+ menu: [{
592
+ id: MENU_INLINE_CHAT_SIDE,
593
+ group: 'navigation',
594
+ when: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT2, ( ctxRequestCount.isEqualTo(0)))),
595
+ }, {
596
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
597
+ group: '0_main',
598
+ order: 1,
599
+ when: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT2, ( ctxHasEditorModification.negate()))),
600
+ }]
601
+ });
602
+ }
603
+ runInlineChatCommand(accessor, _ctrl, editor, ...args) {
604
+ const inlineChatSessions = accessor.get(IInlineChatSessionService);
605
+ if (editor.hasModel()) {
606
+ const textModel = editor.getModel();
607
+ inlineChatSessions.getSession2(textModel.uri)?.dispose();
608
+ }
609
+ }
610
+ }
611
+ class RevealWidget extends AbstractInline2ChatAction {
612
+ constructor() {
613
+ super({
614
+ id: 'inlineChat2.reveal',
615
+ title: ( localize2(7674, "Toggle Inline Chat")),
616
+ f1: true,
617
+ icon: Codicon.copilot,
618
+ precondition: ( ContextKeyExpr.and(( ctxIsGlobalEditingSession.negate()), ContextKeyExpr.greaterEquals(ctxRequestCount.key, 1))),
619
+ toggled: {
620
+ condition: CTX_INLINE_CHAT_VISIBLE,
621
+ },
622
+ keybinding: {
623
+ weight: KeybindingWeight.WorkbenchContrib,
624
+ primary: KeyMod.CtrlCmd | KeyCode.KeyI
625
+ },
626
+ menu: {
627
+ id: MenuId.ChatEditingEditorContent,
628
+ when: ( ContextKeyExpr.and(ContextKeyExpr.greaterEquals(ctxRequestCount.key, 1), ( ctxIsGlobalEditingSession.negate()))),
629
+ group: 'navigate',
630
+ order: 4,
631
+ }
632
+ });
633
+ }
634
+ runInlineChatCommand(_accessor, ctrl, _editor) {
635
+ ctrl.toggleWidgetUntilNextRequest();
636
+ ctrl.markActiveController();
637
+ }
638
+ }
639
+ class CancelRequestAction extends AbstractInline2ChatAction {
640
+ constructor() {
641
+ super({
642
+ id: 'inlineChat2.cancelRequest',
643
+ title: ( localize2(7675, "Cancel Request")),
644
+ f1: true,
645
+ icon: Codicon.stopCircle,
646
+ precondition: ( ContextKeyExpr.and(( ctxIsGlobalEditingSession.negate()), ctxHasRequestInProgress)),
647
+ toggled: CTX_INLINE_CHAT_VISIBLE,
648
+ menu: {
649
+ id: MenuId.ChatEditingEditorContent,
650
+ when: ( ContextKeyExpr.and(( ctxIsGlobalEditingSession.negate()), ctxHasRequestInProgress)),
651
+ group: 'a_request',
652
+ order: 1,
653
+ }
654
+ });
655
+ }
656
+ runInlineChatCommand(accessor, ctrl, _editor) {
657
+ const chatService = accessor.get(IChatService);
658
+ const { viewModel } = ctrl.widget.chatWidget;
659
+ if (viewModel) {
660
+ ctrl.toggleWidgetUntilNextRequest();
661
+ ctrl.markActiveController();
662
+ chatService.cancelCurrentRequestForSession(viewModel.sessionId);
663
+ }
664
+ }
665
+ }
666
+
667
+ export { AbstractInline1ChatAction, AcceptChanges, ArrowOutDownAction, ArrowOutUpAction, CancelRequestAction, CloseAction, CloseSessionAction2, ConfigureInlineChatAction, DiscardHunkAction, FocusInlineChat, KeepSessionAction2, MoveToNextHunk, MoveToPreviousHunk, RerunAction, RevealWidget, START_INLINE_CHAT, StartSessionAction, ToggleDiffForChange, UndoSessionAction2, UnstashSessionAction, ViewInChatAction };