@codingame/monaco-vscode-chat-service-override 22.1.9 → 23.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 (277) hide show
  1. package/index.js +17 -8
  2. package/package.json +43 -40
  3. package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +1 -1
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +6 -6
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +57 -48
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +19 -19
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +1 -1
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +26 -17
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +51 -5
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -2
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +2 -2
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +7 -7
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +19 -19
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/{chatClearActions.d.ts → chatNewActions.d.ts} +2 -1
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/{chatClearActions.js → chatNewActions.js} +32 -32
  19. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +4 -4
  20. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +9 -9
  21. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.d.ts +9 -9
  22. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.js +101 -98
  23. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +35 -24
  24. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +43 -25
  25. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +1 -1
  26. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +34 -33
  27. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.d.ts +53 -0
  28. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionViewModel.js +154 -0
  29. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.d.ts +7 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.js +13 -0
  31. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.d.ts +44 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsView.js +347 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +85 -0
  34. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +250 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsview.css +24 -0
  36. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +97 -0
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +290 -231
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +2 -2
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +7 -10
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.d.ts +1 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentResolveService.js +6 -6
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.d.ts +24 -0
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatContextService.js +113 -0
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimeline.d.ts +31 -0
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.d.ts +102 -0
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.js +646 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +2 -3
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +46 -26
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +17 -4
  51. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +44 -34
  52. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +14 -14
  53. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +25 -6
  54. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +46 -10
  55. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +45 -6
  56. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +30 -10
  57. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +10 -3
  58. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +60 -9
  59. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.d.ts +117 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingOperations.js +12 -0
  61. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +6 -4
  62. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +60 -55
  63. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +29 -16
  64. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +365 -143
  65. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +2 -3
  66. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +3 -30
  67. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +7 -3
  68. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +58 -22
  69. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +1 -1
  70. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +5 -4
  71. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.d.ts +3 -3
  72. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +3 -3
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +5 -5
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +6 -18
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.d.ts +1 -3
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.js +7 -11
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.d.ts +1 -1
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +13 -1
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +38 -33
  81. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +11 -6
  82. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +83 -24
  83. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.d.ts +1 -0
  84. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +91 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +64 -0
  86. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +370 -0
  87. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.d.ts +25 -0
  88. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +56 -0
  89. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +61 -0
  90. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +349 -0
  91. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +43 -0
  92. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +787 -0
  93. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.d.ts +17 -0
  94. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +109 -0
  95. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatManagementEditor.css +122 -0
  96. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +211 -0
  97. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatUsageWidget.css +69 -0
  98. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.d.ts +1 -1
  99. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +21 -20
  100. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +54 -54
  101. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
  102. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +31 -22
  103. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +16 -6
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.d.ts +6 -3
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.js +29 -21
  107. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.d.ts +5 -2
  108. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.js +37 -33
  109. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.d.ts +15 -12
  110. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/chatSessionsView.js +96 -131
  111. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.d.ts +12 -7
  112. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.js +66 -34
  113. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.d.ts +5 -3
  114. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.js +77 -71
  115. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.d.ts +91 -18
  116. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.js +458 -138
  117. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +3 -1
  118. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +212 -150
  119. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +96 -89
  120. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +3 -2
  121. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +5 -5
  122. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +3 -4
  123. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +15 -16
  124. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
  125. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +33 -17
  126. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
  127. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
  128. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.d.ts +27 -0
  129. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsConfirmationService.js +688 -0
  130. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +15 -10
  131. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +126 -135
  132. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css +6 -1
  133. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditorController.css +2 -1
  134. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSessions.css +38 -1
  135. package/vscode/src/vs/workbench/contrib/chat/browser/media/simpleBrowserOverlay.css +14 -14
  136. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.d.ts +1 -1
  137. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +28 -26
  138. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionContribution.js +1 -1
  139. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +3 -3
  140. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.js +9 -6
  141. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +24 -13
  142. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +15 -14
  143. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +25 -23
  144. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.d.ts +21 -0
  145. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +89 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +16 -16
  147. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +30 -29
  148. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +10 -19
  149. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +61 -43
  150. package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +7 -4
  151. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +28 -28
  152. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +254 -165
  153. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.d.ts +4 -4
  154. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +2 -2
  155. package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +1 -1
  156. package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +4 -6
  157. package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.d.ts +10 -6
  158. package/vscode/src/vs/workbench/contrib/chat/common/chatTodoListService.js +20 -12
  159. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +13 -17
  160. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +9 -8
  161. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.d.ts +1 -0
  162. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.js +51 -21
  163. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.d.ts +7 -3
  164. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +74 -20
  165. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptDocumentSemanticTokensProvider.js +11 -6
  166. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.d.ts +1 -2
  167. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +83 -53
  168. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.d.ts +2 -1
  169. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +136 -78
  170. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkProvider.js +4 -4
  171. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +18 -10
  172. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +357 -157
  173. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptFileContributions.js +1 -1
  174. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +55 -28
  175. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +235 -108
  176. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +12 -2
  177. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +50 -4
  178. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +27 -27
  179. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
  180. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  181. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.d.ts +3 -1
  182. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js +11 -7
  183. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +13 -15
  184. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
  185. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +2 -2
  186. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +20 -32
  187. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +63 -140
  188. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
  189. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +17 -16
  190. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +1 -1
  191. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +1 -1
  192. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
  193. package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
  194. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js +3 -0
  195. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
  196. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +119 -15
  197. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.js +6 -4
  198. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +47 -0
  199. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +192 -0
  200. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +7 -5
  201. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +21 -16
  202. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.js +8 -3
  203. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +2 -2
  204. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +18 -27
  205. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +5 -2
  206. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +3 -1
  207. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +1 -1
  208. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +4 -25
  209. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +2 -2
  210. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +18 -27
  211. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +12 -0
  212. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +31 -0
  213. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +3 -0
  214. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +24 -8
  215. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +8 -0
  216. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +1 -1
  217. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +33 -4
  218. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +42 -13
  219. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +14 -21
  220. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +23 -0
  221. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +18 -0
  222. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +227 -0
  223. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +17 -0
  224. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +133 -0
  225. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.d.ts +5 -0
  226. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +36 -0
  227. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.d.ts +8 -0
  228. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.js +33 -0
  229. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +17 -0
  230. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +4 -4
  231. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +3 -3
  232. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
  233. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +5 -1
  234. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +75 -37
  235. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +1 -0
  236. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.d.ts +8 -0
  237. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +71 -0
  238. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +28 -15
  239. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +366 -363
  240. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +18 -18
  241. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +9 -9
  242. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +16 -16
  243. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
  244. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +19 -0
  245. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +123 -0
  246. package/vscode/src/vs/base/common/yaml.d.ts +0 -74
  247. package/vscode/src/vs/base/common/yaml.js +0 -597
  248. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +0 -8
  249. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +0 -239
  250. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.d.ts +0 -102
  251. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTimeline.js +0 -435
  252. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.d.ts +0 -14
  253. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.js +0 -67
  254. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +0 -49
  255. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +0 -380
  256. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.d.ts +0 -37
  257. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.js +0 -137
  258. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +0 -44
  259. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +0 -176
  260. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +0 -4
  261. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +0 -206
  262. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +0 -7
  263. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +0 -79
  264. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +0 -8
  265. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +0 -145
  266. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +0 -65
  267. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +0 -306
  268. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.d.ts +0 -12
  269. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveToPromptAction.js +0 -102
  270. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/newPromptsParser.d.ts +0 -97
  271. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/newPromptsParser.js +0 -247
  272. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +0 -118
  273. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +0 -10
  274. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandSimplifier.d.ts +0 -10
  275. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandSimplifier.js +0 -55
  276. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.d.ts +0 -2
  277. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.js +0 -66
@@ -0,0 +1,688 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Toggle } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/toggle/toggle';
4
+ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
5
+ import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
6
+ import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
7
+ import { LRUCache } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
8
+ import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
9
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
10
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
11
+ import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
12
+ import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
13
+ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
14
+ import { asCssVariable } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
15
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
16
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
17
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
18
+ import { inputActiveOptionBackground, inputActiveOptionForeground, inputActiveOptionBorder } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
19
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
20
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
21
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
22
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
23
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
24
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
25
+ import { ToolConfirmKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService';
26
+
27
+ const RUN_WITHOUT_APPROVAL = ( localize(5571, "without approval"));
28
+ const CONTINUE_WITHOUT_REVIEWING_RESULTS = ( localize(5572, "without reviewing result"));
29
+ class GenericConfirmStore extends Disposable {
30
+ constructor(_storageKey, _instantiationService) {
31
+ super();
32
+ this._storageKey = _storageKey;
33
+ this._instantiationService = _instantiationService;
34
+ this._memoryStore = ( new Set());
35
+ this._workspaceStore = ( new Lazy(
36
+ () => this._register(this._instantiationService.createInstance(ToolConfirmStore, StorageScope.WORKSPACE, this._storageKey))
37
+ ));
38
+ this._profileStore = ( new Lazy(
39
+ () => this._register(this._instantiationService.createInstance(ToolConfirmStore, StorageScope.PROFILE, this._storageKey))
40
+ ));
41
+ }
42
+ setAutoConfirmation(id, scope) {
43
+ this._workspaceStore.value.setAutoConfirm(id, false);
44
+ this._profileStore.value.setAutoConfirm(id, false);
45
+ this._memoryStore.delete(id);
46
+ if (scope === 'workspace') {
47
+ this._workspaceStore.value.setAutoConfirm(id, true);
48
+ }
49
+ else if (scope === 'profile') {
50
+ this._profileStore.value.setAutoConfirm(id, true);
51
+ }
52
+ else if (scope === 'session') {
53
+ this._memoryStore.add(id);
54
+ }
55
+ }
56
+ getAutoConfirmation(id) {
57
+ if (this._workspaceStore.value.getAutoConfirm(id)) {
58
+ return 'workspace';
59
+ }
60
+ if (this._profileStore.value.getAutoConfirm(id)) {
61
+ return 'profile';
62
+ }
63
+ if (( this._memoryStore.has(id))) {
64
+ return 'session';
65
+ }
66
+ return 'never';
67
+ }
68
+ getAutoConfirmationIn(id, scope) {
69
+ if (scope === 'workspace') {
70
+ return this._workspaceStore.value.getAutoConfirm(id);
71
+ }
72
+ else if (scope === 'profile') {
73
+ return this._profileStore.value.getAutoConfirm(id);
74
+ }
75
+ else {
76
+ return ( this._memoryStore.has(id));
77
+ }
78
+ }
79
+ reset() {
80
+ this._workspaceStore.value.reset();
81
+ this._profileStore.value.reset();
82
+ this._memoryStore.clear();
83
+ }
84
+ checkAutoConfirmation(id) {
85
+ if (this._workspaceStore.value.getAutoConfirm(id)) {
86
+ return { type: ToolConfirmKind.LmServicePerTool, scope: 'workspace' };
87
+ }
88
+ if (this._profileStore.value.getAutoConfirm(id)) {
89
+ return { type: ToolConfirmKind.LmServicePerTool, scope: 'profile' };
90
+ }
91
+ if (( this._memoryStore.has(id))) {
92
+ return { type: ToolConfirmKind.LmServicePerTool, scope: 'session' };
93
+ }
94
+ return undefined;
95
+ }
96
+ getAllConfirmed() {
97
+ const all = ( new Set());
98
+ for (const key of this._workspaceStore.value.getAll()) {
99
+ all.add(key);
100
+ }
101
+ for (const key of this._profileStore.value.getAll()) {
102
+ all.add(key);
103
+ }
104
+ for (const key of this._memoryStore) {
105
+ all.add(key);
106
+ }
107
+ return all;
108
+ }
109
+ }
110
+ let ToolConfirmStore = class ToolConfirmStore extends Disposable {
111
+ constructor(_scope, _storageKey, storageService) {
112
+ super();
113
+ this._scope = _scope;
114
+ this._storageKey = _storageKey;
115
+ this.storageService = storageService;
116
+ this._autoConfirmTools = ( new LRUCache(100));
117
+ this._didChange = false;
118
+ const stored = storageService.getObject(this._storageKey, this._scope);
119
+ if (stored) {
120
+ for (const key of stored) {
121
+ this._autoConfirmTools.set(key, true);
122
+ }
123
+ }
124
+ this._register(storageService.onWillSaveState(() => {
125
+ if (this._didChange) {
126
+ this.storageService.store(this._storageKey, [...( this._autoConfirmTools.keys())], this._scope, StorageTarget.MACHINE);
127
+ this._didChange = false;
128
+ }
129
+ }));
130
+ }
131
+ reset() {
132
+ this._autoConfirmTools.clear();
133
+ this._didChange = true;
134
+ }
135
+ getAutoConfirm(id) {
136
+ if (this._autoConfirmTools.get(id)) {
137
+ this._didChange = true;
138
+ return true;
139
+ }
140
+ return false;
141
+ }
142
+ setAutoConfirm(id, autoConfirm) {
143
+ if (autoConfirm) {
144
+ this._autoConfirmTools.set(id, true);
145
+ }
146
+ else {
147
+ this._autoConfirmTools.delete(id);
148
+ }
149
+ this._didChange = true;
150
+ }
151
+ getAll() {
152
+ return [...( this._autoConfirmTools.keys())];
153
+ }
154
+ };
155
+ ToolConfirmStore = ( __decorate([
156
+ ( __param(2, IStorageService))
157
+ ], ToolConfirmStore));
158
+ let LanguageModelToolsConfirmationService = class LanguageModelToolsConfirmationService extends Disposable {
159
+ constructor(_instantiationService, _quickInputService) {
160
+ super();
161
+ this._instantiationService = _instantiationService;
162
+ this._quickInputService = _quickInputService;
163
+ this._contributions = ( new Map());
164
+ this._preExecutionToolConfirmStore = this._register(( new GenericConfirmStore('chat/autoconfirm', this._instantiationService)));
165
+ this._postExecutionToolConfirmStore = this._register(( new GenericConfirmStore('chat/autoconfirm-post', this._instantiationService)));
166
+ this._preExecutionServerConfirmStore = this._register(( new GenericConfirmStore('chat/servers/autoconfirm', this._instantiationService)));
167
+ this._postExecutionServerConfirmStore = this._register(( new GenericConfirmStore('chat/servers/autoconfirm-post', this._instantiationService)));
168
+ }
169
+ getPreConfirmAction(ref) {
170
+ const contribution = this._contributions.get(ref.toolId);
171
+ if (contribution?.getPreConfirmAction) {
172
+ const result = contribution.getPreConfirmAction(ref);
173
+ if (result) {
174
+ return result;
175
+ }
176
+ }
177
+ if (contribution && contribution.canUseDefaultApprovals === false) {
178
+ return undefined;
179
+ }
180
+ const toolResult = this._preExecutionToolConfirmStore.checkAutoConfirmation(ref.toolId);
181
+ if (toolResult) {
182
+ return toolResult;
183
+ }
184
+ if (ref.source.type === 'mcp') {
185
+ const serverResult = this._preExecutionServerConfirmStore.checkAutoConfirmation(ref.source.definitionId);
186
+ if (serverResult) {
187
+ return serverResult;
188
+ }
189
+ }
190
+ return undefined;
191
+ }
192
+ getPostConfirmAction(ref) {
193
+ const contribution = this._contributions.get(ref.toolId);
194
+ if (contribution?.getPostConfirmAction) {
195
+ const result = contribution.getPostConfirmAction(ref);
196
+ if (result) {
197
+ return result;
198
+ }
199
+ }
200
+ if (contribution && contribution.canUseDefaultApprovals === false) {
201
+ return undefined;
202
+ }
203
+ const toolResult = this._postExecutionToolConfirmStore.checkAutoConfirmation(ref.toolId);
204
+ if (toolResult) {
205
+ return toolResult;
206
+ }
207
+ if (ref.source.type === 'mcp') {
208
+ const serverResult = this._postExecutionServerConfirmStore.checkAutoConfirmation(ref.source.definitionId);
209
+ if (serverResult) {
210
+ return serverResult;
211
+ }
212
+ }
213
+ return undefined;
214
+ }
215
+ getPreConfirmActions(ref) {
216
+ const actions = [];
217
+ const contribution = this._contributions.get(ref.toolId);
218
+ if (contribution?.getPreConfirmActions) {
219
+ actions.push(...contribution.getPreConfirmActions(ref));
220
+ }
221
+ if (contribution && contribution.canUseDefaultApprovals === false) {
222
+ return actions;
223
+ }
224
+ actions.push({
225
+ label: ( localize(5573, 'Allow in this Session')),
226
+ detail: ( localize(5574, 'Allow this tool to run in this session without confirmation.')),
227
+ divider: !!actions.length,
228
+ select: async () => {
229
+ this._preExecutionToolConfirmStore.setAutoConfirmation(ref.toolId, 'session');
230
+ return true;
231
+ }
232
+ }, {
233
+ label: ( localize(5575, 'Allow in this Workspace')),
234
+ detail: ( localize(5576, 'Allow this tool to run in this workspace without confirmation.')),
235
+ select: async () => {
236
+ this._preExecutionToolConfirmStore.setAutoConfirmation(ref.toolId, 'workspace');
237
+ return true;
238
+ }
239
+ }, {
240
+ label: ( localize(5577, 'Always Allow')),
241
+ detail: ( localize(5578, 'Always allow this tool to run without confirmation.')),
242
+ select: async () => {
243
+ this._preExecutionToolConfirmStore.setAutoConfirmation(ref.toolId, 'profile');
244
+ return true;
245
+ }
246
+ });
247
+ if (ref.source.type === 'mcp') {
248
+ const { serverLabel, definitionId } = ref.source;
249
+ actions.push({
250
+ label: ( localize(5579, 'Allow Tools from {0} in this Session', serverLabel)),
251
+ detail: ( localize(
252
+ 5580,
253
+ 'Allow all tools from this server to run in this session without confirmation.'
254
+ )),
255
+ divider: true,
256
+ select: async () => {
257
+ this._preExecutionServerConfirmStore.setAutoConfirmation(definitionId, 'session');
258
+ return true;
259
+ }
260
+ }, {
261
+ label: ( localize(5581, 'Allow Tools from {0} in this Workspace', serverLabel)),
262
+ detail: ( localize(
263
+ 5582,
264
+ 'Allow all tools from this server to run in this workspace without confirmation.'
265
+ )),
266
+ select: async () => {
267
+ this._preExecutionServerConfirmStore.setAutoConfirmation(definitionId, 'workspace');
268
+ return true;
269
+ }
270
+ }, {
271
+ label: ( localize(5583, 'Always Allow Tools from {0}', serverLabel)),
272
+ detail: ( localize(
273
+ 5584,
274
+ 'Always allow all tools from this server to run without confirmation.'
275
+ )),
276
+ select: async () => {
277
+ this._preExecutionServerConfirmStore.setAutoConfirmation(definitionId, 'profile');
278
+ return true;
279
+ }
280
+ });
281
+ }
282
+ return actions;
283
+ }
284
+ getPostConfirmActions(ref) {
285
+ const actions = [];
286
+ const contribution = this._contributions.get(ref.toolId);
287
+ if (contribution?.getPostConfirmActions) {
288
+ actions.push(...contribution.getPostConfirmActions(ref));
289
+ }
290
+ if (contribution && contribution.canUseDefaultApprovals === false) {
291
+ return actions;
292
+ }
293
+ actions.push({
294
+ label: ( localize(5585, 'Allow Without Review in this Session')),
295
+ detail: ( localize(
296
+ 5586,
297
+ 'Allow results from this tool to be sent without confirmation in this session.'
298
+ )),
299
+ divider: !!actions.length,
300
+ select: async () => {
301
+ this._postExecutionToolConfirmStore.setAutoConfirmation(ref.toolId, 'session');
302
+ return true;
303
+ }
304
+ }, {
305
+ label: ( localize(5587, 'Allow Without Review in this Workspace')),
306
+ detail: ( localize(
307
+ 5588,
308
+ 'Allow results from this tool to be sent without confirmation in this workspace.'
309
+ )),
310
+ select: async () => {
311
+ this._postExecutionToolConfirmStore.setAutoConfirmation(ref.toolId, 'workspace');
312
+ return true;
313
+ }
314
+ }, {
315
+ label: ( localize(5589, 'Always Allow Without Review')),
316
+ detail: ( localize(
317
+ 5590,
318
+ 'Always allow results from this tool to be sent without confirmation.'
319
+ )),
320
+ select: async () => {
321
+ this._postExecutionToolConfirmStore.setAutoConfirmation(ref.toolId, 'profile');
322
+ return true;
323
+ }
324
+ });
325
+ if (ref.source.type === 'mcp') {
326
+ const { serverLabel, definitionId } = ref.source;
327
+ actions.push({
328
+ label: ( localize(5591, 'Allow Tools from {0} Without Review in this Session', serverLabel)),
329
+ detail: ( localize(
330
+ 5592,
331
+ 'Allow results from all tools from this server to be sent without confirmation in this session.'
332
+ )),
333
+ divider: true,
334
+ select: async () => {
335
+ this._postExecutionServerConfirmStore.setAutoConfirmation(definitionId, 'session');
336
+ return true;
337
+ }
338
+ }, {
339
+ label: ( localize(5593, 'Allow Tools from {0} Without Review in this Workspace', serverLabel)),
340
+ detail: ( localize(
341
+ 5594,
342
+ 'Allow results from all tools from this server to be sent without confirmation in this workspace.'
343
+ )),
344
+ select: async () => {
345
+ this._postExecutionServerConfirmStore.setAutoConfirmation(definitionId, 'workspace');
346
+ return true;
347
+ }
348
+ }, {
349
+ label: ( localize(5595, 'Always Allow Tools from {0} Without Review', serverLabel)),
350
+ detail: ( localize(
351
+ 5596,
352
+ 'Always allow results from all tools from this server to be sent without confirmation.'
353
+ )),
354
+ select: async () => {
355
+ this._postExecutionServerConfirmStore.setAutoConfirmation(definitionId, 'profile');
356
+ return true;
357
+ }
358
+ });
359
+ }
360
+ return actions;
361
+ }
362
+ registerConfirmationContribution(toolName, contribution) {
363
+ this._contributions.set(toolName, contribution);
364
+ return {
365
+ dispose: () => {
366
+ this._contributions.delete(toolName);
367
+ }
368
+ };
369
+ }
370
+ manageConfirmationPreferences(tools, options) {
371
+ const trackServerTool = (serverId, label, toolId, serversWithTools) => {
372
+ if (!( serversWithTools.has(serverId))) {
373
+ serversWithTools.set(serverId, { label, tools: ( new Set()) });
374
+ }
375
+ serversWithTools.get(serverId).tools.add(toolId);
376
+ };
377
+ const addServerToolFromSource = (source, toolId, serversWithTools) => {
378
+ if (source.type === 'mcp') {
379
+ trackServerTool(source.definitionId, source.serverLabel || source.label, toolId, serversWithTools);
380
+ }
381
+ else if (source.type === 'extension') {
382
+ trackServerTool(source.extensionId.value, source.label, toolId, serversWithTools);
383
+ }
384
+ };
385
+ const relevantTools = ( new Set());
386
+ const serversWithTools = ( new Map());
387
+ for (const tool of tools) {
388
+ if (tool.canRequestPreApproval || tool.canRequestPostApproval || ( this._contributions.has(tool.id))) {
389
+ relevantTools.add(tool.id);
390
+ addServerToolFromSource(tool.source, tool.id, serversWithTools);
391
+ }
392
+ }
393
+ for (const id of this._preExecutionToolConfirmStore.getAllConfirmed()) {
394
+ if (!( relevantTools.has(id))) {
395
+ const tool = tools.find(t => t.id === id);
396
+ if (tool) {
397
+ relevantTools.add(id);
398
+ addServerToolFromSource(tool.source, id, serversWithTools);
399
+ }
400
+ }
401
+ }
402
+ for (const id of this._postExecutionToolConfirmStore.getAllConfirmed()) {
403
+ if (!( relevantTools.has(id))) {
404
+ const tool = tools.find(t => t.id === id);
405
+ if (tool) {
406
+ relevantTools.add(id);
407
+ addServerToolFromSource(tool.source, id, serversWithTools);
408
+ }
409
+ }
410
+ }
411
+ if (relevantTools.size === 0) {
412
+ return;
413
+ }
414
+ let currentScope = options?.defaultScope ?? 'workspace';
415
+ const buildTreeItems = () => {
416
+ const treeItems = [];
417
+ for (const [serverId, serverInfo] of serversWithTools) {
418
+ const serverChildren = [];
419
+ const hasAnyPre = ( Array.from(serverInfo.tools).some(toolId => {
420
+ const tool = tools.find(t => t.id === toolId);
421
+ return tool?.canRequestPreApproval;
422
+ }));
423
+ const hasAnyPost = ( Array.from(serverInfo.tools).some(toolId => {
424
+ const tool = tools.find(t => t.id === toolId);
425
+ return tool?.canRequestPostApproval;
426
+ }));
427
+ const serverPreConfirmed = this._preExecutionServerConfirmStore.getAutoConfirmationIn(serverId, currentScope);
428
+ const serverPostConfirmed = this._postExecutionServerConfirmStore.getAutoConfirmationIn(serverId, currentScope);
429
+ for (const toolId of serverInfo.tools) {
430
+ const tool = tools.find(t => t.id === toolId);
431
+ if (!tool) {
432
+ continue;
433
+ }
434
+ const toolChildren = [];
435
+ const hasPre = !serverPreConfirmed && (tool.canRequestPreApproval || this._preExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope));
436
+ const hasPost = !serverPostConfirmed && (tool.canRequestPostApproval || this._postExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope));
437
+ if (hasPre && hasPost) {
438
+ toolChildren.push({
439
+ type: 'tool-pre',
440
+ toolId: tool.id,
441
+ label: RUN_WITHOUT_APPROVAL,
442
+ checked: this._preExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope)
443
+ });
444
+ toolChildren.push({
445
+ type: 'tool-post',
446
+ toolId: tool.id,
447
+ label: CONTINUE_WITHOUT_REVIEWING_RESULTS,
448
+ checked: this._postExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope)
449
+ });
450
+ }
451
+ const preApproval = this._preExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope);
452
+ const postApproval = this._postExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope);
453
+ let checked;
454
+ let description;
455
+ if (hasPre && hasPost) {
456
+ checked = preApproval && postApproval ? true : (!preApproval && !postApproval ? false : 'mixed');
457
+ }
458
+ else if (hasPre) {
459
+ checked = preApproval;
460
+ description = RUN_WITHOUT_APPROVAL;
461
+ }
462
+ else if (hasPost) {
463
+ checked = postApproval;
464
+ description = CONTINUE_WITHOUT_REVIEWING_RESULTS;
465
+ }
466
+ else {
467
+ continue;
468
+ }
469
+ serverChildren.push({
470
+ type: 'tool',
471
+ toolId: tool.id,
472
+ label: tool.displayName || tool.id,
473
+ description,
474
+ checked,
475
+ collapsed: true,
476
+ children: toolChildren.length > 0 ? toolChildren : undefined
477
+ });
478
+ }
479
+ serverChildren.sort((a, b) => a.label.localeCompare(b.label));
480
+ if (hasAnyPost) {
481
+ serverChildren.unshift({
482
+ type: 'server-post',
483
+ serverId,
484
+ iconClass: ThemeIcon.asClassName(Codicon.play),
485
+ label: ( localize(5597, "Continue without reviewing any tool results")),
486
+ checked: serverPostConfirmed
487
+ });
488
+ }
489
+ if (hasAnyPre) {
490
+ serverChildren.unshift({
491
+ type: 'server-pre',
492
+ serverId,
493
+ iconClass: ThemeIcon.asClassName(Codicon.play),
494
+ label: ( localize(5598, "Run any tool without approval")),
495
+ checked: serverPreConfirmed
496
+ });
497
+ }
498
+ const serverHasPre = this._preExecutionServerConfirmStore.getAutoConfirmationIn(serverId, currentScope);
499
+ const serverHasPost = this._postExecutionServerConfirmStore.getAutoConfirmationIn(serverId, currentScope);
500
+ let serverChecked;
501
+ if (hasAnyPre && hasAnyPost) {
502
+ serverChecked = serverHasPre && serverHasPost ? true : (!serverHasPre && !serverHasPost ? false : 'mixed');
503
+ }
504
+ else if (hasAnyPre) {
505
+ serverChecked = serverHasPre;
506
+ }
507
+ else if (hasAnyPost) {
508
+ serverChecked = serverHasPost;
509
+ }
510
+ else {
511
+ serverChecked = false;
512
+ }
513
+ const existingItem = quickTree.itemTree.find(i => i.serverId === serverId);
514
+ treeItems.push({
515
+ type: 'server',
516
+ serverId,
517
+ label: serverInfo.label,
518
+ checked: serverChecked,
519
+ children: serverChildren,
520
+ collapsed: existingItem ? quickTree.isCollapsed(existingItem) : true,
521
+ pickable: false
522
+ });
523
+ }
524
+ const sortedTools = tools.slice().sort((a, b) => a.displayName.localeCompare(b.displayName));
525
+ for (const tool of sortedTools) {
526
+ if (!( relevantTools.has(tool.id))) {
527
+ continue;
528
+ }
529
+ if (tool.source.type === 'mcp' || tool.source.type === 'extension') {
530
+ continue;
531
+ }
532
+ const contributed = this._contributions.get(tool.id);
533
+ const toolChildren = [];
534
+ const manageActions = contributed?.getManageActions?.();
535
+ if (manageActions) {
536
+ toolChildren.push(...( manageActions.map(action => ({
537
+ type: 'manage',
538
+ ...action,
539
+ }))));
540
+ }
541
+ let checked = false;
542
+ let description;
543
+ let pickable = false;
544
+ if (contributed?.canUseDefaultApprovals !== false) {
545
+ pickable = true;
546
+ const hasPre = tool.canRequestPreApproval || this._preExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope);
547
+ const hasPost = tool.canRequestPostApproval || this._postExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope);
548
+ if (hasPre && hasPost) {
549
+ toolChildren.push({
550
+ type: 'tool-pre',
551
+ toolId: tool.id,
552
+ label: RUN_WITHOUT_APPROVAL,
553
+ checked: this._preExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope)
554
+ });
555
+ toolChildren.push({
556
+ type: 'tool-post',
557
+ toolId: tool.id,
558
+ label: CONTINUE_WITHOUT_REVIEWING_RESULTS,
559
+ checked: this._postExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope)
560
+ });
561
+ }
562
+ const preApproval = this._preExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope);
563
+ const postApproval = this._postExecutionToolConfirmStore.getAutoConfirmationIn(tool.id, currentScope);
564
+ if (hasPre && hasPost) {
565
+ checked = preApproval && postApproval ? true : (!preApproval && !postApproval ? false : 'mixed');
566
+ }
567
+ else if (hasPre) {
568
+ checked = preApproval;
569
+ description = RUN_WITHOUT_APPROVAL;
570
+ }
571
+ else if (hasPost) {
572
+ checked = postApproval;
573
+ description = CONTINUE_WITHOUT_REVIEWING_RESULTS;
574
+ }
575
+ else {
576
+ checked = false;
577
+ }
578
+ }
579
+ treeItems.push({
580
+ type: 'tool',
581
+ toolId: tool.id,
582
+ label: tool.displayName || tool.id,
583
+ description,
584
+ checked,
585
+ pickable,
586
+ collapsed: true,
587
+ children: toolChildren.length > 0 ? toolChildren : undefined
588
+ });
589
+ }
590
+ return treeItems;
591
+ };
592
+ const disposables = ( new DisposableStore());
593
+ const quickTree = disposables.add(this._quickInputService.createQuickTree());
594
+ quickTree.ignoreFocusOut = true;
595
+ quickTree.sortByLabel = false;
596
+ if (currentScope !== 'session') {
597
+ const scopeToggle = disposables.add(( new Toggle({
598
+ title: ( localize(5599, "Configure for this workspace only")),
599
+ icon: Codicon.folder,
600
+ isChecked: currentScope === 'workspace',
601
+ inputActiveOptionBorder: asCssVariable(inputActiveOptionBorder),
602
+ inputActiveOptionForeground: asCssVariable(inputActiveOptionForeground),
603
+ inputActiveOptionBackground: asCssVariable(inputActiveOptionBackground)
604
+ })));
605
+ quickTree.toggles = [scopeToggle];
606
+ disposables.add(scopeToggle.onChange(() => {
607
+ currentScope = currentScope === 'workspace' ? 'profile' : 'workspace';
608
+ updatePlaceholder();
609
+ quickTree.setItemTree(buildTreeItems());
610
+ }));
611
+ }
612
+ const updatePlaceholder = () => {
613
+ if (currentScope === 'session') {
614
+ quickTree.placeholder = ( localize(5600, "Configure session tool approvals"));
615
+ }
616
+ else {
617
+ quickTree.placeholder = currentScope === 'workspace'
618
+ ? ( localize(5601, "Configure workspace tool approvals"))
619
+ : ( localize(5602, "Configure global tool approvals"));
620
+ }
621
+ };
622
+ updatePlaceholder();
623
+ quickTree.setItemTree(buildTreeItems());
624
+ disposables.add(quickTree.onDidChangeCheckboxState(item => {
625
+ const newState = item.checked ? currentScope : 'never';
626
+ if (item.type === 'server' && item.serverId) {
627
+ const serverInfo = serversWithTools.get(item.serverId);
628
+ if (serverInfo) {
629
+ this._preExecutionServerConfirmStore.setAutoConfirmation(item.serverId, newState);
630
+ this._postExecutionServerConfirmStore.setAutoConfirmation(item.serverId, newState);
631
+ }
632
+ }
633
+ else if (item.type === 'tool' && item.toolId) {
634
+ const tool = tools.find(t => t.id === item.toolId);
635
+ if (tool?.canRequestPostApproval || newState === 'never') {
636
+ this._postExecutionToolConfirmStore.setAutoConfirmation(item.toolId, newState);
637
+ }
638
+ if (tool?.canRequestPreApproval || newState === 'never') {
639
+ this._preExecutionToolConfirmStore.setAutoConfirmation(item.toolId, newState);
640
+ }
641
+ }
642
+ else if (item.type === 'tool-pre' && item.toolId) {
643
+ this._preExecutionToolConfirmStore.setAutoConfirmation(item.toolId, newState);
644
+ }
645
+ else if (item.type === 'tool-post' && item.toolId) {
646
+ this._postExecutionToolConfirmStore.setAutoConfirmation(item.toolId, newState);
647
+ }
648
+ else if (item.type === 'server-pre' && item.serverId) {
649
+ this._preExecutionServerConfirmStore.setAutoConfirmation(item.serverId, newState);
650
+ quickTree.setItemTree(buildTreeItems());
651
+ }
652
+ else if (item.type === 'server-post' && item.serverId) {
653
+ this._postExecutionServerConfirmStore.setAutoConfirmation(item.serverId, newState);
654
+ quickTree.setItemTree(buildTreeItems());
655
+ }
656
+ else if (item.type === 'manage') {
657
+ item.onDidChangeChecked?.(!!item.checked);
658
+ }
659
+ }));
660
+ disposables.add(quickTree.onDidTriggerItemButton(i => {
661
+ if (i.item.type === 'manage') {
662
+ i.item.onDidTriggerItemButton?.(i.button);
663
+ }
664
+ }));
665
+ disposables.add(quickTree.onDidAccept(() => {
666
+ quickTree.hide();
667
+ }));
668
+ disposables.add(quickTree.onDidHide(() => {
669
+ disposables.dispose();
670
+ }));
671
+ quickTree.show();
672
+ }
673
+ resetToolAutoConfirmation() {
674
+ this._preExecutionToolConfirmStore.reset();
675
+ this._postExecutionToolConfirmStore.reset();
676
+ this._preExecutionServerConfirmStore.reset();
677
+ this._postExecutionServerConfirmStore.reset();
678
+ for (const contribution of ( this._contributions.values())) {
679
+ contribution.reset?.();
680
+ }
681
+ }
682
+ };
683
+ LanguageModelToolsConfirmationService = ( __decorate([
684
+ ( __param(0, IInstantiationService)),
685
+ ( __param(1, IQuickInputService))
686
+ ], LanguageModelToolsConfirmationService));
687
+
688
+ export { LanguageModelToolsConfirmationService };