@codingame/monaco-vscode-chat-service-override 33.0.8 → 34.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 (403) hide show
  1. package/index.js +19 -5
  2. package/package.json +5 -5
  3. package/vscode/src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.d.ts +32 -0
  4. package/vscode/src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.js +77 -0
  5. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.d.ts +84 -17
  6. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.js +235 -190
  7. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.d.ts +3 -2
  8. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +23 -4
  9. package/vscode/src/vs/platform/agentHost/common/agentHost.config.contribution.d.ts +1 -0
  10. package/vscode/src/vs/platform/agentHost/common/agentHost.config.contribution.js +22 -0
  11. package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.d.ts +107 -8
  12. package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.js +272 -49
  13. package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemService.js +2 -2
  14. package/vscode/src/vs/platform/agentHost/common/{agentHostPermissionService.d.ts → agentHostResourceService.d.ts} +26 -0
  15. package/vscode/src/vs/platform/agentHost/common/{agentHostPermissionService.js → agentHostResourceService.js} +11 -1
  16. package/vscode/src/vs/platform/agentHost/common/agentHostSchema.d.ts +13 -0
  17. package/vscode/src/vs/platform/agentHost/common/agentHostSchema.js +26 -18
  18. package/vscode/src/vs/platform/agentHost/common/agentHostStarter.config.contribution.d.ts +1 -0
  19. package/vscode/src/vs/platform/agentHost/common/agentHostStarter.config.contribution.js +119 -0
  20. package/vscode/src/vs/platform/agentHost/common/agentService.d.ts +135 -19
  21. package/vscode/src/vs/platform/agentHost/common/agentService.js +8 -2
  22. package/vscode/src/vs/platform/agentHost/common/ahpJsonlLogger.d.ts +5 -1
  23. package/vscode/src/vs/platform/agentHost/common/ahpJsonlLogger.js +85 -22
  24. package/vscode/src/vs/platform/agentHost/common/customAgents.d.ts +36 -0
  25. package/vscode/src/vs/platform/agentHost/common/customAgents.js +12 -0
  26. package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.d.ts +81 -0
  27. package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.js +103 -0
  28. package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.d.ts +86 -10
  29. package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.js +129 -37
  30. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-changeset/reducer.d.ts +12 -0
  31. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-changeset/reducer.js +72 -0
  32. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-root/reducer.d.ts +6 -0
  33. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-root/reducer.js +30 -0
  34. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-session/reducer.d.ts +6 -0
  35. package/vscode/src/vs/platform/agentHost/common/state/protocol/{reducers.js → channels-session/reducer.js} +99 -168
  36. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-terminal/reducer.d.ts +6 -0
  37. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-terminal/reducer.js +110 -0
  38. package/vscode/src/vs/platform/agentHost/common/state/protocol/{errors.d.ts → common/errors.d.ts} +13 -2
  39. package/vscode/src/vs/platform/agentHost/common/state/protocol/{errors.js → common/errors.js} +1 -2
  40. package/vscode/src/vs/platform/agentHost/common/state/protocol/common/reducer-helpers.d.ts +17 -0
  41. package/vscode/src/vs/platform/agentHost/common/state/protocol/common/reducer-helpers.js +9 -0
  42. package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.d.ts +33 -8
  43. package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.js +2 -3
  44. package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +36 -5
  45. package/vscode/src/vs/platform/agentHost/common/state/sessionActions.js +6 -3
  46. package/vscode/src/vs/platform/networkFilter/common/domainMatcher.d.ts +50 -0
  47. package/vscode/src/vs/platform/networkFilter/common/domainMatcher.js +138 -0
  48. package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +3 -3
  49. package/vscode/src/vs/platform/networkFilter/common/settings.d.ts +12 -0
  50. package/vscode/src/vs/platform/networkFilter/common/settings.js +14 -0
  51. package/vscode/src/vs/platform/sandbox/browser/sandboxHelperService.d.ts +4 -1
  52. package/vscode/src/vs/platform/sandbox/browser/sandboxHelperService.js +9 -0
  53. package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.d.ts +21 -0
  54. package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.js +28 -0
  55. package/vscode/src/vs/platform/sandbox/common/terminalSandboxCommandRules.d.ts +31 -0
  56. package/vscode/src/vs/platform/sandbox/common/terminalSandboxCommandRules.js +49 -0
  57. package/vscode/src/vs/platform/sandbox/common/terminalSandboxEngine.d.ts +182 -0
  58. package/vscode/src/vs/platform/sandbox/common/terminalSandboxEngine.js +784 -0
  59. package/vscode/src/vs/platform/sandbox/common/terminalSandboxReadAllowList.d.ts +18 -0
  60. package/vscode/src/vs/platform/sandbox/common/terminalSandboxReadAllowList.js +305 -0
  61. package/vscode/src/vs/platform/sandbox/common/terminalSandboxRuntimeConfigurationPerOperation.d.ts +7 -0
  62. package/vscode/src/vs/platform/sandbox/common/terminalSandboxRuntimeConfigurationPerOperation.js +120 -0
  63. package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.d.ts +100 -0
  64. package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.js +10 -0
  65. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +2 -2
  66. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +16 -16
  67. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +8 -8
  68. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +60 -60
  69. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
  70. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +12 -12
  71. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +8 -8
  72. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +7 -7
  73. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +106 -8
  74. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
  75. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.js +22 -36
  76. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
  77. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
  78. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
  79. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +21 -13
  80. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +12 -12
  81. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +38 -18
  82. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
  83. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +11 -11
  84. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
  85. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +18 -18
  86. package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +20 -20
  87. package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.d.ts +3 -2
  88. package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.js +9 -9
  89. package/vscode/src/vs/workbench/contrib/chat/browser/actions/openCopilotCliStateFileAction.js +5 -5
  90. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.d.ts +10 -0
  91. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.js +40 -11
  92. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +15 -9
  93. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +2 -2
  94. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +0 -1
  95. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +23 -17
  96. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +13 -13
  97. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationSyncProvider.d.ts +24 -0
  98. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationSyncProvider.js +55 -0
  99. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.d.ts +30 -0
  100. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.js +119 -0
  101. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.d.ts +13 -0
  102. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.js +32 -0
  103. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.d.ts +55 -0
  104. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.js +104 -0
  105. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModeSynchronizer.d.ts +1 -0
  106. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModeSynchronizer.js +177 -0
  107. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.d.ts +3 -3
  108. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +11 -11
  109. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolUtils.d.ts +6 -0
  110. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolUtils.js +14 -0
  111. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.d.ts +3 -0
  112. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.js +44 -5
  113. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.d.ts +60 -0
  114. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.js +103 -0
  115. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +4 -3
  116. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +70 -62
  117. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +9 -7
  118. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +1 -1
  119. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +1 -1
  120. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +4 -4
  121. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
  122. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +6 -5
  123. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +38 -28
  124. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +17 -17
  125. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
  126. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +4 -4
  127. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +22 -31
  128. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +2 -2
  129. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +15 -16
  130. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.d.ts +3 -3
  131. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +8 -2
  132. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +112 -113
  133. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +62 -68
  134. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +3 -2
  135. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +149 -145
  136. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.d.ts +3 -1
  137. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +6 -1
  138. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.js +25 -25
  139. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.js +2 -0
  140. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +2 -0
  141. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +5 -3
  142. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.d.ts +8 -1
  143. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.js +13 -12
  144. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.d.ts +8 -1
  145. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.js +15 -13
  146. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +1 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +78 -55
  148. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +140 -67
  149. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationWelcomePromptLaunchers.css +11 -21
  150. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +3 -1
  151. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +59 -57
  152. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +1 -1
  153. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +2 -0
  154. package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +440 -357
  155. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +32 -32
  156. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.js +99 -99
  157. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +6 -6
  158. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
  159. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +20 -20
  160. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +7 -7
  161. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +4 -4
  162. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +7 -7
  163. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +22 -22
  164. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +13 -13
  165. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
  166. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +24 -24
  167. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +8 -8
  168. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +23 -23
  169. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +33 -33
  170. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
  171. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +1 -1
  172. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +1 -1
  173. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
  174. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
  175. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +3 -3
  176. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
  177. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +2 -2
  178. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +1 -1
  179. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +1 -1
  180. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +3 -3
  181. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +1 -1
  182. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
  183. package/vscode/src/vs/workbench/contrib/chat/browser/chatGoalSummaryService.d.ts +21 -0
  184. package/vscode/src/vs/workbench/contrib/chat/browser/chatGoalSummaryService.js +115 -0
  185. package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +5 -2
  186. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +8 -8
  187. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +2 -2
  188. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +6 -0
  189. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +28 -1
  190. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +3 -1
  191. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +187 -106
  192. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +41 -0
  193. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +4 -4
  194. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +30 -30
  195. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.d.ts +66 -0
  196. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.js +346 -0
  197. package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +3 -2
  198. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.d.ts +0 -2
  199. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +72 -29
  200. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +10 -10
  201. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +6 -6
  202. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +26 -26
  203. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +12 -12
  204. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.d.ts +5 -1
  205. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +144 -67
  206. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +1 -0
  207. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +126 -80
  208. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.d.ts +1 -0
  209. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +32 -31
  210. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +4 -0
  211. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.d.ts +11 -0
  212. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +40 -33
  213. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.d.ts +5 -1
  214. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +25 -24
  215. package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +4 -4
  216. package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
  217. package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContext.contribution.js +5 -5
  218. package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +5 -5
  219. package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.js +4 -4
  220. package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
  221. package/vscode/src/vs/workbench/contrib/chat/browser/githubRepoFetcher.js +1 -19
  222. package/vscode/src/vs/workbench/contrib/chat/browser/hasByokModelsContribution.d.ts +12 -22
  223. package/vscode/src/vs/workbench/contrib/chat/browser/hasByokModelsContribution.js +14 -6
  224. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.d.ts +6 -3
  225. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +56 -18
  226. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorActions.js +4 -4
  227. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorContribution.js +5 -5
  228. package/vscode/src/vs/workbench/contrib/chat/browser/pluginAutoUpdate.d.ts +3 -3
  229. package/vscode/src/vs/workbench/contrib/chat/browser/pluginAutoUpdate.js +5 -6
  230. package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +3 -3
  231. package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +33 -36
  232. package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +3 -0
  233. package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +31 -16
  234. package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.d.ts +4 -4
  235. package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +16 -13
  236. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +6 -6
  237. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +27 -27
  238. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.d.ts +1 -1
  239. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +3 -3
  240. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
  241. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +2 -2
  242. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
  243. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +7 -7
  244. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
  245. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +3 -3
  246. package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +20 -20
  247. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +39 -39
  248. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +24 -23
  249. package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +5 -5
  250. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.d.ts +18 -0
  251. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +23 -1
  252. package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +6 -6
  253. package/vscode/src/vs/workbench/contrib/chat/browser/utilityModelContribution.js +5 -2
  254. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
  255. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +9 -9
  256. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +22 -13
  257. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +2 -2
  258. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +1 -1
  259. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +1 -1
  260. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +1 -1
  261. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +14 -3
  262. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +55 -24
  263. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +2 -2
  264. package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.d.ts +38 -0
  265. package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.js +47 -0
  266. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +54 -12
  267. package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +1 -0
  268. package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +6 -6
  269. package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.d.ts +39 -0
  270. package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.js +40 -4
  271. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +30 -8
  272. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +205 -46
  273. package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.d.ts +4 -3
  274. package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.js +8 -3
  275. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +57 -0
  276. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +153 -38
  277. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +12 -7
  278. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +70 -37
  279. package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.js +6 -28
  280. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +18 -18
  281. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +5 -5
  282. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +5 -5
  283. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +12 -12
  284. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +150 -150
  285. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
  286. package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarousel.contribution.js +10 -10
  287. package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditor.js +10 -10
  288. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +15 -15
  289. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +2 -2
  290. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +4 -4
  291. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +14 -14
  292. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +1 -1
  293. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +10 -10
  294. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +5 -5
  295. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
  296. package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
  297. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +17 -17
  298. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +1 -1
  299. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +21 -21
  300. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +1 -1
  301. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +4 -0
  302. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +21 -1
  303. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +2 -2
  304. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/agentHostSandboxForwarder.d.ts +55 -0
  305. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/agentHostSandboxForwarder.js +122 -0
  306. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.d.ts +2 -0
  307. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.js +41 -0
  308. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/commandFileWriteParser.d.ts +24 -0
  309. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.d.ts +26 -0
  310. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.js +142 -0
  311. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +52 -0
  312. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +232 -0
  313. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +65 -0
  314. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +225 -0
  315. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +27 -0
  316. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +143 -0
  317. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +37 -0
  318. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +205 -0
  319. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +40 -0
  320. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +174 -0
  321. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.d.ts +7 -0
  322. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +43 -0
  323. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +52 -0
  324. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +260 -0
  325. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.d.ts +44 -0
  326. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +98 -0
  327. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +1 -1
  328. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +3 -3
  329. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +14 -7
  330. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +42 -0
  331. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +226 -0
  332. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.d.ts +31 -0
  333. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.js +392 -0
  334. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.d.ts +45 -0
  335. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +243 -0
  336. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +54 -0
  337. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.js +10 -0
  338. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +20 -0
  339. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +310 -0
  340. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +27 -0
  341. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +177 -0
  342. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.d.ts +11 -0
  343. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.js +33 -0
  344. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/commandLinePresenter.d.ts +41 -0
  345. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.d.ts +19 -0
  346. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.js +37 -0
  347. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.d.ts +19 -0
  348. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.js +37 -0
  349. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.d.ts +19 -0
  350. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.js +44 -0
  351. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.d.ts +13 -0
  352. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.js +22 -0
  353. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineBackgroundDetachRewriter.d.ts +42 -0
  354. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineBackgroundDetachRewriter.js +102 -0
  355. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.d.ts +5 -0
  356. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +27 -0
  357. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.d.ts +14 -0
  358. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.js +29 -0
  359. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.d.ts +8 -0
  360. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.js +33 -0
  361. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +28 -0
  362. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.d.ts +15 -0
  363. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.js +55 -0
  364. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
  365. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.d.ts +3 -0
  366. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +31 -9
  367. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
  368. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +4 -4
  369. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +177 -0
  370. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +518 -0
  371. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +42 -0
  372. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.js +23 -0
  373. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/outputAnalyzer.d.ts +9 -0
  374. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.d.ts +1 -1
  375. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +3 -3
  376. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +297 -0
  377. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +2961 -0
  378. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.d.ts +29 -0
  379. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +63 -0
  380. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +14 -14
  381. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +14 -14
  382. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +7 -7
  383. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +14 -14
  384. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.d.ts +1 -1
  385. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +2 -2
  386. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.d.ts +17 -0
  387. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +118 -0
  388. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalToolAutoApprove.d.ts +22 -0
  389. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalToolAutoApprove.js +44 -0
  390. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +58 -0
  391. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +223 -0
  392. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/sandboxSettingsReader.d.ts +20 -0
  393. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/sandboxSettingsReader.js +81 -0
  394. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +63 -0
  395. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +349 -0
  396. package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.d.ts +75 -0
  397. package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.js +192 -0
  398. package/vscode/src/vs/workbench/services/agentHost/common/agentHostResourceService.d.ts +89 -0
  399. package/vscode/src/vs/workbench/services/agentHost/common/{agentHostPermissionService.js → agentHostResourceService.js} +226 -9
  400. package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.d.ts +0 -30
  401. package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.d.ts +0 -119
  402. package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.js +0 -552
  403. package/vscode/src/vs/workbench/services/agentHost/common/agentHostPermissionService.d.ts +0 -83
@@ -0,0 +1,225 @@
1
+
2
+ import { DeferredPromise, RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
3
+ import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
+
5
+ async function waitForIdle(onData, idleDurationMs) {
6
+ const store = ( new DisposableStore());
7
+ const deferred = ( new DeferredPromise());
8
+ const scheduler = store.add(( new RunOnceScheduler(() => deferred.complete(), idleDurationMs)));
9
+ store.add(onData(() => scheduler.schedule()));
10
+ scheduler.schedule();
11
+ return deferred.p.finally(() => store.dispose());
12
+ }
13
+ function detectsCommonPromptPattern(cursorLine) {
14
+ if (cursorLine.trim().length === 0) {
15
+ return {
16
+ detected: false,
17
+ reason: "Content is empty or contains only whitespace"
18
+ };
19
+ }
20
+ if (/PS\s+[A-Z]:\\.*>\s*$/.test(cursorLine)) {
21
+ return {
22
+ detected: true,
23
+ reason: `PowerShell prompt pattern detected: "${cursorLine}"`
24
+ };
25
+ }
26
+ if (/^[A-Z]:\\.*>\s*$/.test(cursorLine)) {
27
+ return {
28
+ detected: true,
29
+ reason: `Command Prompt pattern detected: "${cursorLine}"`
30
+ };
31
+ }
32
+ if (/\$\s*$/.test(cursorLine)) {
33
+ return {
34
+ detected: true,
35
+ reason: `Bash-style prompt pattern detected: "${cursorLine}"`
36
+ };
37
+ }
38
+ if (/#\s*$/.test(cursorLine)) {
39
+ return {
40
+ detected: true,
41
+ reason: `Root prompt pattern detected: "${cursorLine}"`
42
+ };
43
+ }
44
+ if (/^>>>\s*$/.test(cursorLine)) {
45
+ return {
46
+ detected: true,
47
+ reason: `Python REPL prompt pattern detected: "${cursorLine}"`
48
+ };
49
+ }
50
+ if (/\u276f\s*$/.test(cursorLine)) {
51
+ return {
52
+ detected: true,
53
+ reason: `Starship prompt pattern detected: "${cursorLine}"`
54
+ };
55
+ }
56
+ if (/[>%]\s*$/.test(cursorLine)) {
57
+ return {
58
+ detected: true,
59
+ reason: `Generic prompt pattern detected: "${cursorLine}"`
60
+ };
61
+ }
62
+ return {
63
+ detected: false,
64
+ reason: `No common prompt pattern found in last line: "${cursorLine}"`
65
+ };
66
+ }
67
+ async function waitForIdleWithPromptHeuristics(onData, instance, idlePollIntervalMs, extendedTimeoutMs) {
68
+ await waitForIdle(onData, idlePollIntervalMs);
69
+ const xterm = await instance.xtermReadyPromise;
70
+ if (!xterm) {
71
+ return {
72
+ detected: false,
73
+ reason: `Xterm not available, using ${idlePollIntervalMs}ms timeout`
74
+ };
75
+ }
76
+ const startTime = Date.now();
77
+ while (Date.now() - startTime < extendedTimeoutMs) {
78
+ try {
79
+ let content = "";
80
+ const buffer = xterm.raw.buffer.active;
81
+ const line = buffer.getLine(buffer.baseY + buffer.cursorY);
82
+ if (line) {
83
+ content = line.translateToString(true);
84
+ }
85
+ const promptResult = detectsCommonPromptPattern(content);
86
+ if (promptResult.detected) {
87
+ return promptResult;
88
+ }
89
+ } catch (error) {}
90
+ await waitForIdle(
91
+ onData,
92
+ Math.min(idlePollIntervalMs, extendedTimeoutMs - (Date.now() - startTime))
93
+ );
94
+ }
95
+ try {
96
+ let content = "";
97
+ const buffer = xterm.raw.buffer.active;
98
+ const line = buffer.getLine(buffer.baseY + buffer.cursorY);
99
+ if (line) {
100
+ content = line.translateToString(true) + "\n";
101
+ }
102
+ return {
103
+ detected: false,
104
+ reason: `Extended timeout reached without prompt detection. Last line: "${content.trim()}"`
105
+ };
106
+ } catch (error) {
107
+ return {
108
+ detected: false,
109
+ reason: `Extended timeout reached. Error reading terminal content: ${error}`
110
+ };
111
+ }
112
+ }
113
+ async function trackIdleOnPrompt(instance, idleDurationMs, store, promptFallbackMs, logService, options) {
114
+ const idleOnPrompt = ( new DeferredPromise());
115
+ const onData = instance.onData;
116
+ const log = logService ? msg => logService.info(`trackIdleOnPrompt: ${msg}`) : undefined;
117
+ let TerminalState;
118
+ (function(TerminalState) {
119
+ TerminalState[TerminalState["Initial"] = 0] = "Initial";
120
+ TerminalState[TerminalState["Prompt"] = 1] = "Prompt";
121
+ TerminalState[TerminalState["Executing"] = 2] = "Executing";
122
+ TerminalState[TerminalState["PromptAfterExecuting"] = 3] = "PromptAfterExecuting";
123
+ })(TerminalState || (TerminalState = {}));
124
+ const stateNames = {
125
+ [0 ]: "Initial",
126
+ [1 ]: "Prompt",
127
+ [2 ]: "Executing",
128
+ [3 ]: "PromptAfterExecuting"
129
+ };
130
+ let state = 0 ;
131
+ let dataEventCount = 0;
132
+ function setState(newState, reason) {
133
+ if (state !== newState) {
134
+ log?.(`State ${stateNames[state]} → ${stateNames[newState]} (${reason})`);
135
+ state = newState;
136
+ }
137
+ }
138
+ const scheduler = store.add(( new RunOnceScheduler(() => {
139
+ log?.(`Idle scheduler fired, completing (dataEvents=${dataEventCount})`);
140
+ idleOnPrompt.complete();
141
+ }, idleDurationMs)));
142
+ const promptFallbackScheduler = store.add(( new RunOnceScheduler(() => {
143
+ if (state === 2 || state === 3 ) {
144
+ promptFallbackScheduler.cancel();
145
+ return;
146
+ }
147
+ log?.(`Prompt fallback fired (dataEvents=${dataEventCount})`);
148
+ setState(3, "promptFallback");
149
+ scheduler.schedule();
150
+ }, promptFallbackMs ?? 1000)));
151
+ const disableFallbacks = options?.disableFallbacks ?? false;
152
+ const initialFallbackScheduler = store.add(( new RunOnceScheduler(() => {
153
+ if (state === 2 || state === 3 ) {
154
+ log?.(`Initial fallback fired but state is ${stateNames[state]}, skipping`);
155
+ return;
156
+ }
157
+ log?.(`Initial fallback fired, no data events received`);
158
+ setState(3, "initialFallback");
159
+ scheduler.schedule();
160
+ }, 10_000)));
161
+ if (!disableFallbacks) {
162
+ initialFallbackScheduler.schedule();
163
+ }
164
+ const executingFallbackScheduler = store.add(( new RunOnceScheduler(() => {
165
+ if (state === 2 ) {
166
+ log?.(
167
+ `Executing fallback fired after 30s data-idle (dataEvents=${dataEventCount})`
168
+ );
169
+ setState(3, "executingFallback");
170
+ scheduler.schedule();
171
+ }
172
+ }, 30_000)));
173
+ const hardCapScheduler = store.add(( new RunOnceScheduler(() => {
174
+ if (state === 0 || state === 1 ) {
175
+ log?.(
176
+ `Hard cap fired after 5min in state ${stateNames[state]} (dataEvents=${dataEventCount})`
177
+ );
178
+ setState(3, "hardCap");
179
+ scheduler.schedule();
180
+ }
181
+ }, 60_000)));
182
+ if (!disableFallbacks) {
183
+ hardCapScheduler.schedule();
184
+ }
185
+ store.add(onData(e => {
186
+ dataEventCount++;
187
+ initialFallbackScheduler.cancel();
188
+ const matches = e.matchAll(/(?:\x1b\]|\x9d)[16]33;(?<type>[ACD])(?:;.*)?(?:\x1b\\|\x07|\x9c)/g);
189
+ for (const match of matches) {
190
+ if (match.groups?.type === "A") {
191
+ if (state === 0 ) {
192
+ setState(1, "sequence A");
193
+ } else if (state === 2 ) {
194
+ setState(3, "sequence A after executing");
195
+ executingFallbackScheduler.cancel();
196
+ }
197
+ } else if (match.groups?.type === "C" || match.groups?.type === "D") {
198
+ setState(2, `sequence ${match.groups?.type}`);
199
+ if (!disableFallbacks) {
200
+ executingFallbackScheduler.schedule();
201
+ }
202
+ }
203
+ }
204
+ if (state === 3 ) {
205
+ promptFallbackScheduler.cancel();
206
+ executingFallbackScheduler.cancel();
207
+ scheduler.schedule();
208
+ } else {
209
+ scheduler.cancel();
210
+ if (state === 0 || state === 1 ) {
211
+ if (!disableFallbacks) {
212
+ promptFallbackScheduler.schedule();
213
+ }
214
+ } else {
215
+ promptFallbackScheduler.cancel();
216
+ if (!disableFallbacks) {
217
+ executingFallbackScheduler.schedule();
218
+ }
219
+ }
220
+ }
221
+ }));
222
+ return idleOnPrompt.p;
223
+ }
224
+
225
+ export { detectsCommonPromptPattern, trackIdleOnPrompt, waitForIdle, waitForIdleWithPromptHeuristics };
@@ -0,0 +1,27 @@
1
+ import type { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
+ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
3
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
4
+ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
5
+ import { ITerminalLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service";
6
+ import { type ITerminalExecuteStrategy, type ITerminalExecuteStrategyResult } from "./executeStrategy.js";
7
+ import type { IMarker as IXtermMarker } from "@xterm/xterm";
8
+ import { ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
9
+ /**
10
+ * This strategy is used when no shell integration is available. There are very few extension APIs
11
+ * available in this case. This uses similar strategies to the basic integration strategy, but
12
+ * with `sendText` instead of `shellIntegration.executeCommand` and relying on idle events instead
13
+ * of execution events.
14
+ */
15
+ export declare class NoneExecuteStrategy extends Disposable implements ITerminalExecuteStrategy {
16
+ private readonly _instance;
17
+ private readonly _hasReceivedUserInput;
18
+ private readonly _configurationService;
19
+ private readonly _logService;
20
+ readonly type = "none";
21
+ private readonly _startMarker;
22
+ private readonly _onDidCreateStartMarker;
23
+ onDidCreateStartMarker: Event<IXtermMarker | undefined>;
24
+ constructor(_instance: ITerminalInstance, _hasReceivedUserInput: () => boolean, _configurationService: IConfigurationService, _logService: ITerminalLogService);
25
+ execute(commandLine: string, token: CancellationToken, _commandId?: string, _commandLineForMetadata?: string): Promise<ITerminalExecuteStrategyResult>;
26
+ private _log;
27
+ }
@@ -0,0 +1,143 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
4
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
5
+ import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
7
+ import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
8
+ import { waitForIdle, waitForIdleWithPromptHeuristics } from './executeStrategy.js';
9
+ import { createAltBufferPromise, setupRecreatingStartMarker, stripCommandEchoAndPrompt } from './strategyHelpers.js';
10
+ import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
11
+ import { isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
12
+ import { isMultilineCommand } from '../runInTerminalHelpers.js';
13
+
14
+ let NoneExecuteStrategy = class NoneExecuteStrategy extends Disposable {
15
+ constructor(_instance, _hasReceivedUserInput, _configurationService, _logService) {
16
+ super();
17
+ this._instance = _instance;
18
+ this._hasReceivedUserInput = _hasReceivedUserInput;
19
+ this._configurationService = _configurationService;
20
+ this._logService = _logService;
21
+ this.type = "none";
22
+ this._startMarker = this._register(( new MutableDisposable()));
23
+ this._onDidCreateStartMarker = this._register(( new Emitter()));
24
+ this.onDidCreateStartMarker = this._onDidCreateStartMarker.event;
25
+ }
26
+ async execute(commandLine, token, _commandId, _commandLineForMetadata) {
27
+ const store = ( new DisposableStore());
28
+ try {
29
+ if (token.isCancellationRequested) {
30
+ throw ( new CancellationError());
31
+ }
32
+ this._log("Waiting for xterm");
33
+ const xterm = await this._instance.xtermReadyPromise;
34
+ if (!xterm) {
35
+ throw ( new Error("Xterm is not available"));
36
+ }
37
+ const alternateBufferPromise = createAltBufferPromise(xterm, store, this._log.bind(this));
38
+ const idlePollInterval = this._configurationService.getValue(TerminalChatAgentToolsSettingId.IdlePollInterval) ?? 1000;
39
+ this._log("Waiting for idle");
40
+ await waitForIdle(this._instance.onData, idlePollInterval);
41
+ if (token.isCancellationRequested) {
42
+ throw ( new CancellationError());
43
+ }
44
+ const markerRecreation = setupRecreatingStartMarker(
45
+ xterm,
46
+ this._startMarker,
47
+ m => this._onDidCreateStartMarker.fire(m),
48
+ store,
49
+ this._log.bind(this)
50
+ );
51
+ if (this._hasReceivedUserInput()) {
52
+ this._log("Sending Ctrl+U to clear any pending input before sending command");
53
+ await this._instance.sendText("\u0015", false);
54
+ await waitForIdle(this._instance.onData, 100);
55
+ }
56
+ this._log(`Executing command line \`${commandLine}\``);
57
+ markerRecreation.dispose();
58
+ const startLine = this._startMarker.value?.line;
59
+ const forceBracketedPasteMode = isMacintosh || isMultilineCommand(commandLine);
60
+ this._instance.sendText(commandLine, true, forceBracketedPasteMode);
61
+ if (startLine !== undefined) {
62
+ this._log("Waiting for cursor to move past start line");
63
+ const cursorMovedPromise = ( new Promise(resolve => {
64
+ const check = () => {
65
+ const buffer = xterm.raw.buffer.active;
66
+ const cursorLine = buffer.baseY + buffer.cursorY;
67
+ if (cursorLine > startLine) {
68
+ resolve();
69
+ }
70
+ };
71
+ const listener = this._instance.onData(() => check());
72
+ store.add(listener);
73
+ check();
74
+ }));
75
+ const cursorMoveTimeout = ( new Promise(resolve => {
76
+ const handle = setTimeout(() => resolve("timeout"), 1000);
77
+ store.add({
78
+ dispose: () => clearTimeout(handle)
79
+ });
80
+ }));
81
+ const raceResult = await Promise.race([cursorMovedPromise, cursorMoveTimeout]);
82
+ if (raceResult === "timeout") {
83
+ this._log(
84
+ "Cursor did not move past start line before timeout, proceeding with idle detection"
85
+ );
86
+ }
87
+ }
88
+ this._log("Waiting for idle with prompt heuristics");
89
+ const promptResultOrAltBuffer = await Promise.race([waitForIdleWithPromptHeuristics(
90
+ this._instance.onData,
91
+ this._instance,
92
+ idlePollInterval,
93
+ idlePollInterval * 10
94
+ ), alternateBufferPromise.then(() => "alternateBuffer")]);
95
+ if (promptResultOrAltBuffer === "alternateBuffer") {
96
+ this._log("Detected alternate buffer entry, skipping output capture");
97
+ return {
98
+ output: undefined,
99
+ additionalInformation: undefined,
100
+ exitCode: undefined,
101
+ error: "alternateBuffer",
102
+ didEnterAltBuffer: true
103
+ };
104
+ }
105
+ const promptResult = promptResultOrAltBuffer;
106
+ this._log(
107
+ `Prompt detection result: ${promptResult.detected ? "detected" : "not detected"} - ${promptResult.reason}`
108
+ );
109
+ if (token.isCancellationRequested) {
110
+ throw ( new CancellationError());
111
+ }
112
+ const endMarker = store.add(xterm.raw.registerMarker());
113
+ let output;
114
+ const additionalInformationLines = [];
115
+ try {
116
+ output = xterm.getContentsAsText(this._startMarker.value, endMarker);
117
+ this._log("Fetched output via markers");
118
+ if (output !== undefined) {
119
+ output = stripCommandEchoAndPrompt(output, commandLine, this._log.bind(this));
120
+ }
121
+ } catch {
122
+ this._log("Failed to fetch output via markers");
123
+ additionalInformationLines.push("Failed to retrieve command output");
124
+ }
125
+ if (output !== undefined && output.trim().length === 0) {
126
+ additionalInformationLines.push("Command produced no output");
127
+ }
128
+ return {
129
+ output,
130
+ additionalInformation: additionalInformationLines.length > 0 ? additionalInformationLines.join("\n") : undefined,
131
+ exitCode: undefined
132
+ };
133
+ } finally {
134
+ store.dispose();
135
+ }
136
+ }
137
+ _log(message) {
138
+ this._logService.debug(`RunInTerminalTool#None: ${message}`);
139
+ }
140
+ };
141
+ NoneExecuteStrategy = ( __decorate([( __param(2, IConfigurationService)), ( __param(3, ITerminalLogService))], NoneExecuteStrategy));
142
+
143
+ export { NoneExecuteStrategy };
@@ -0,0 +1,37 @@
1
+ import type { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
+ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
3
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
4
+ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
5
+ import type { ICommandDetectionCapability } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
6
+ import { ITerminalLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service";
7
+ import type { ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
8
+ import { type ITerminalExecuteStrategy, type ITerminalExecuteStrategyResult } from "./executeStrategy.js";
9
+ import type { IMarker as IXtermMarker } from "@xterm/xterm";
10
+ /**
11
+ * This strategy is used when the terminal has rich shell integration/command detection is
12
+ * available, meaning every sequence we rely upon should be exactly where we expect it to be. In
13
+ * particular (`633;`) `A, B, E, C, D` all happen in exactly that order. While things still could go
14
+ * wrong in this state, minimal verification is done in this mode since rich command detection is a
15
+ * strong signal that it's behaving correctly.
16
+ */
17
+ export declare class RichExecuteStrategy extends Disposable implements ITerminalExecuteStrategy {
18
+ private readonly _instance;
19
+ private readonly _commandDetection;
20
+ private readonly _isSyncMode;
21
+ private readonly _configurationService;
22
+ private readonly _logService;
23
+ readonly type = "rich";
24
+ private readonly _startMarker;
25
+ private readonly _onDidCreateStartMarker;
26
+ onDidCreateStartMarker: Event<IXtermMarker | undefined>;
27
+ /**
28
+ * Tracks per-execute() DisposableStores so they can be cleaned up if the
29
+ * strategy is disposed mid-flight, AND removed from this collection on
30
+ * successful completion to avoid accumulating stale references when
31
+ * execute() is invoked many times on the same strategy instance.
32
+ */
33
+ private readonly _executionStores;
34
+ constructor(_instance: ITerminalInstance, _commandDetection: ICommandDetectionCapability, _isSyncMode: boolean, _configurationService: IConfigurationService, _logService: ITerminalLogService);
35
+ execute(commandLine: string, token: CancellationToken, commandId?: string, commandLineForMetadata?: string): Promise<ITerminalExecuteStrategyResult>;
36
+ private _log;
37
+ }
@@ -0,0 +1,205 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
4
+ import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
5
+ import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
7
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
8
+ import { isMacintosh, isCI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
9
+ import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
10
+ import { trackIdleOnPrompt } from './executeStrategy.js';
11
+ import { createAltBufferPromise, setupRecreatingStartMarker, stripCommandEchoAndPrompt } from './strategyHelpers.js';
12
+ import { TerminalChatAgentToolsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration';
13
+ import { isMultilineCommand } from '../runInTerminalHelpers.js';
14
+
15
+ function isTerminalLaunchError(value) {
16
+ return typeof value === "object" && value !== null && "message" in value;
17
+ }
18
+ function formatExitCodeOrError(exitCodeOrError) {
19
+ if (isTerminalLaunchError(exitCodeOrError)) {
20
+ return `launch error: ${exitCodeOrError.message}${exitCodeOrError.code !== undefined ? `, code=${exitCodeOrError.code}` : ""}`;
21
+ }
22
+ return `code=${exitCodeOrError}`;
23
+ }
24
+ function extractExitCode(exitCodeOrError) {
25
+ if (isNumber(exitCodeOrError)) {
26
+ return exitCodeOrError;
27
+ }
28
+ if (isTerminalLaunchError(exitCodeOrError)) {
29
+ return exitCodeOrError.code;
30
+ }
31
+ return undefined;
32
+ }
33
+ let RichExecuteStrategy = class RichExecuteStrategy extends Disposable {
34
+ constructor(
35
+ _instance,
36
+ _commandDetection,
37
+ _isSyncMode,
38
+ _configurationService,
39
+ _logService
40
+ ) {
41
+ super();
42
+ this._instance = _instance;
43
+ this._commandDetection = _commandDetection;
44
+ this._isSyncMode = _isSyncMode;
45
+ this._configurationService = _configurationService;
46
+ this._logService = _logService;
47
+ this.type = "rich";
48
+ this._startMarker = this._register(( new MutableDisposable()));
49
+ this._onDidCreateStartMarker = this._register(( new Emitter()));
50
+ this.onDidCreateStartMarker = this._onDidCreateStartMarker.event;
51
+ this._executionStores = this._register(( new DisposableStore()));
52
+ }
53
+ async execute(commandLine, token, commandId, commandLineForMetadata) {
54
+ const store = ( new DisposableStore());
55
+ this._executionStores.add(store);
56
+ try {
57
+ if (this._instance.isDisposed) {
58
+ this._log("Terminal already disposed at strategy entry");
59
+ throw ( new Error("The terminal was closed"));
60
+ }
61
+ if (this._instance.exitCode !== undefined) {
62
+ this._log(
63
+ `Terminal pty already exited at strategy entry (code=${this._instance.exitCode})`
64
+ );
65
+ return {
66
+ output: undefined,
67
+ exitCode: this._instance.exitCode,
68
+ additionalInformation: `Command exited with code ${this._instance.exitCode}`
69
+ };
70
+ }
71
+ const idlePollInterval = this._configurationService.getValue(TerminalChatAgentToolsSettingId.IdlePollInterval) ?? 1000;
72
+ const staleMarker = this._commandDetection.executingCommandObject?.marker;
73
+ const onCommandFinishedFiltered = staleMarker ? Event.filter(
74
+ this._commandDetection.onCommandFinished,
75
+ e => e.marker !== staleMarker,
76
+ store
77
+ ) : this._commandDetection.onCommandFinished;
78
+ const onDone = Promise.race([Event.toPromise(onCommandFinishedFiltered, store).then(e => {
79
+ this._log("onDone via end event");
80
+ return {
81
+ "type": "success",
82
+ command: e
83
+ };
84
+ }), Event.toPromise(token.onCancellationRequested, store).then(() => {
85
+ this._log("onDone via cancellation");
86
+ }), Event.toPromise(this._instance.onDisposed, store).then(() => {
87
+ this._log("onDone via terminal disposal");
88
+ return {
89
+ type: "disposal"
90
+ };
91
+ }), Event.toPromise(this._instance.onExit, store).then(exitCodeOrError => {
92
+ this._log(`onDone via process exit (${formatExitCodeOrError(exitCodeOrError)})`);
93
+ return {
94
+ type: "processExit",
95
+ exitCodeOrError
96
+ };
97
+ }),
98
+ ...(this._isSyncMode ? [trackIdleOnPrompt(
99
+ this._instance,
100
+ idlePollInterval,
101
+ store,
102
+ idlePollInterval,
103
+ this._logService,
104
+ {
105
+ disableFallbacks: true
106
+ }
107
+ ).then(() => {
108
+ this._log("onDone via idle prompt");
109
+ })] : [])]);
110
+ this._log("Waiting for xterm");
111
+ const xterm = await this._instance.xtermReadyPromise;
112
+ if (!xterm) {
113
+ throw ( new Error("Xterm is not available"));
114
+ }
115
+ const alternateBufferPromise = createAltBufferPromise(xterm, store, this._log.bind(this));
116
+ const markerRecreation = setupRecreatingStartMarker(
117
+ xterm,
118
+ this._startMarker,
119
+ m => this._onDidCreateStartMarker.fire(m),
120
+ store,
121
+ this._log.bind(this)
122
+ );
123
+ this._log(`Executing command line \`${commandLine}\``);
124
+ markerRecreation.dispose();
125
+ const forceBracketedPasteMode = isMacintosh || isMultilineCommand(commandLine);
126
+ this._instance.runCommand(
127
+ commandLine,
128
+ true,
129
+ commandId,
130
+ forceBracketedPasteMode,
131
+ commandLineForMetadata
132
+ );
133
+ this._log("Waiting for done event");
134
+ const onDoneResult = await Promise.race([onDone, alternateBufferPromise.then(() => ({
135
+ type: "alternateBuffer"
136
+ }))]);
137
+ if (onDoneResult && onDoneResult.type === "disposal") {
138
+ throw ( new Error("The terminal was closed"));
139
+ }
140
+ if (onDoneResult && onDoneResult.type === "alternateBuffer") {
141
+ this._log("Detected alternate buffer entry, skipping output capture");
142
+ return {
143
+ output: undefined,
144
+ exitCode: undefined,
145
+ error: "alternateBuffer",
146
+ didEnterAltBuffer: true
147
+ };
148
+ }
149
+ const finishedCommand = onDoneResult && onDoneResult.type === "success" ? onDoneResult.command : undefined;
150
+ if (token.isCancellationRequested) {
151
+ throw ( new CancellationError());
152
+ }
153
+ const endMarker = store.add(xterm.raw.registerMarker());
154
+ let output;
155
+ const additionalInformationLines = [];
156
+ if (finishedCommand) {
157
+ const commandOutput = finishedCommand?.getOutput();
158
+ if (commandOutput !== undefined) {
159
+ this._log("Fetched output via finished command");
160
+ output = stripCommandEchoAndPrompt(commandOutput, commandLine, this._log.bind(this));
161
+ }
162
+ }
163
+ if (output === undefined) {
164
+ try {
165
+ output = xterm.getContentsAsText(this._startMarker.value, endMarker);
166
+ this._log("Fetched output via markers");
167
+ if (output !== undefined) {
168
+ output = stripCommandEchoAndPrompt(output, commandLine, this._log.bind(this));
169
+ }
170
+ } catch {
171
+ this._log("Failed to fetch output via markers");
172
+ additionalInformationLines.push("Failed to retrieve command output");
173
+ }
174
+ }
175
+ if (output !== undefined && output.trim().length === 0) {
176
+ additionalInformationLines.push("Command produced no output");
177
+ }
178
+ let exitCode = finishedCommand?.exitCode;
179
+ if (exitCode === undefined && onDoneResult && onDoneResult.type === "processExit") {
180
+ exitCode = extractExitCode(onDoneResult.exitCodeOrError);
181
+ }
182
+ if (isNumber(exitCode) && exitCode > 0) {
183
+ additionalInformationLines.push(`Command exited with code ${exitCode}`);
184
+ }
185
+ return {
186
+ output,
187
+ additionalInformation: additionalInformationLines.length > 0 ? additionalInformationLines.join("\n") : undefined,
188
+ exitCode
189
+ };
190
+ } finally {
191
+ this._executionStores.delete(store);
192
+ }
193
+ }
194
+ _log(message) {
195
+ const msg = `RunInTerminalTool#Rich: ${message}`;
196
+ if (isCI) {
197
+ this._logService.info(msg);
198
+ } else {
199
+ this._logService.debug(msg);
200
+ }
201
+ }
202
+ };
203
+ RichExecuteStrategy = ( __decorate([( __param(3, IConfigurationService)), ( __param(4, ITerminalLogService))], RichExecuteStrategy));
204
+
205
+ export { RichExecuteStrategy };