@codingame/monaco-vscode-chat-service-override 33.0.9 → 34.0.1

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,784 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
4
+ import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
5
+ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { win32, posix } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
7
+ import { OS, OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
8
+ import { arch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/process';
9
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
10
+ import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
11
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
12
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
13
+ import { matchesDomainPattern, normalizeDomain } from '../../networkFilter/common/domainMatcher.js';
14
+ import { AgentNetworkDomainSettingId } from '../../networkFilter/common/settings.js';
15
+ import { AgentSandboxSettingId, AgentSandboxEnabledValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/sandbox/common/settings';
16
+ import { IWindowsMxcTerminalSandboxRuntime } from '@codingame/monaco-vscode-api/vscode/vs/platform/sandbox/common/terminalSandboxMxcRuntime.service';
17
+ import { getTerminalSandboxReadAllowListForCommands } from './terminalSandboxReadAllowList.js';
18
+ import { getTerminalSandboxRuntimeConfigurationForCommands } from './terminalSandboxRuntimeConfigurationPerOperation.js';
19
+ import { TerminalSandboxPrerequisiteCheck } from './terminalSandboxService.js';
20
+
21
+ var TerminalSandboxEngine_1;
22
+ let TerminalSandboxEngine = class TerminalSandboxEngine extends Disposable {
23
+ static {
24
+ TerminalSandboxEngine_1 = this;
25
+ }
26
+ static {
27
+ this._urlRegex = /(?:https?|wss?):\/\/[^\s'"`|&;<>]+/gi;
28
+ }
29
+ static {
30
+ this._sshRemoteRegex = /(?:^|[\s'"`])(?:[^\s@:'"`]+@)?([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(?::[^\s'"`|&;<>]+)(?=$|[\s'"`|&;<>])/gi;
31
+ }
32
+ static {
33
+ this._hostRegex = /(?:^|[\s'"`(=])([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(?::\d+)?(?=(?:\/[^\s'"`|&;<>]*)?(?:$|[\s'"`)\]|,;|&<>]))/gi;
34
+ }
35
+ constructor(_host, _fileService, _logService, _windowsMxcRuntime) {
36
+ super();
37
+ this._host = _host;
38
+ this._fileService = _fileService;
39
+ this._logService = _logService;
40
+ this._windowsMxcRuntime = _windowsMxcRuntime;
41
+ this._sandboxSettingsId = generateUuid();
42
+ this._runtimeResolved = false;
43
+ this._runAsNode = false;
44
+ this._needsForceUpdateConfigFile = true;
45
+ this._commandAllowListKeywords = [];
46
+ this._commandAllowListCommandDetails = [];
47
+ this._commandAllowNetwork = false;
48
+ this._os = OS;
49
+ this._defaultWritePaths = [];
50
+ this._buildSandboxPayload = (commandLine, policy, workingDirectory, containerName, containment) => {
51
+ return this._host.buildWindowsMxcSandboxPayload(commandLine, policy, workingDirectory, containerName, containment);
52
+ };
53
+ this._pathJoin = (...segments) => {
54
+ const path = this._os === OperatingSystem.Windows ? win32 : posix;
55
+ return path.join(...segments);
56
+ };
57
+ this._register(Event.runAndSubscribe(this._host.onDidChangeSandboxSettings, () => {
58
+ this.setNeedsForceUpdateConfigFile();
59
+ }));
60
+ this._register(this._host.onDidChangeRoots(() => this.setNeedsForceUpdateConfigFile()));
61
+ }
62
+ async isEnabled(precheckInputs) {
63
+ return this._isSandboxConfiguredEnabled(precheckInputs);
64
+ }
65
+ async isSandboxAllowNetworkEnabled(precheckInputs) {
66
+ if (!(await this._isSandboxConfiguredEnabled(precheckInputs))) {
67
+ return false;
68
+ }
69
+ return this._isSandboxAllowNetworkConfigured();
70
+ }
71
+ areUnsandboxedCommandsAllowed() {
72
+ return this._areUnsandboxedCommandsAllowed();
73
+ }
74
+ areRetryWithAllowNetworkRequestsAllowed() {
75
+ return this._areRetryWithAllowNetworkRequestsAllowed();
76
+ }
77
+ isAutoApproveUnsandboxedCommands() {
78
+ return this._areUnsandboxedCommandsAllowed() && this._getSettingValue(AgentSandboxSettingId.AgentSandboxAutoApproveUnsandboxedCommands) === true;
79
+ }
80
+ async getOS() {
81
+ this._os = await this._host.getOS();
82
+ return this._os;
83
+ }
84
+ getTempDir() {
85
+ return this._tempDir;
86
+ }
87
+ setNeedsForceUpdateConfigFile() {
88
+ this._needsForceUpdateConfigFile = true;
89
+ }
90
+ getResolvedNetworkDomains() {
91
+ const allowedDomains = this._getSettingValue(AgentNetworkDomainSettingId.AllowedNetworkDomains) ?? [];
92
+ const deniedDomains = this._getSettingValue(AgentNetworkDomainSettingId.DeniedNetworkDomains) ?? [];
93
+ return {
94
+ allowedDomains,
95
+ deniedDomains
96
+ };
97
+ }
98
+ async wrapCommand(
99
+ command,
100
+ requestUnsandboxedExecution,
101
+ shell,
102
+ cwd,
103
+ commandDetails,
104
+ requestAllowNetwork
105
+ ) {
106
+ const allowUnsandboxedCommands = this._areUnsandboxedCommandsAllowed();
107
+ const retryWithAllowNetworkRequests = this._areRetryWithAllowNetworkRequestsAllowed();
108
+ const shouldInspectBlockedDomains = requestUnsandboxedExecution !== true && requestAllowNetwork !== true && (retryWithAllowNetworkRequests || allowUnsandboxedCommands);
109
+ const blockedDomainResult = shouldInspectBlockedDomains ? this._getBlockedDomains(command) : {
110
+ blockedDomains: [],
111
+ deniedDomains: []
112
+ };
113
+ const requiresPreflightAllowNetwork = retryWithAllowNetworkRequests && blockedDomainResult.blockedDomains.length > 0;
114
+ const allowNetworkForCommand = requestUnsandboxedExecution !== true && ((requestAllowNetwork === true && retryWithAllowNetworkRequests) || requiresPreflightAllowNetwork);
115
+ const normalizedCommandDetails = this._normalizeCommandDetails(commandDetails ?? []);
116
+ const normalizedCommandKeywords = this._normalizeCommandKeywords(( normalizedCommandDetails.map(c => c.keyword)));
117
+ const currentReadAllowListPaths = getTerminalSandboxReadAllowListForCommands(
118
+ this._os,
119
+ this._commandAllowListKeywords,
120
+ this._commandAllowListCommandDetails
121
+ );
122
+ const nextReadAllowListPaths = getTerminalSandboxReadAllowListForCommands(this._os, normalizedCommandKeywords, normalizedCommandDetails);
123
+ const currentRuntimeConfiguration = getTerminalSandboxRuntimeConfigurationForCommands(this._os, this._commandAllowListCommandDetails);
124
+ const nextRuntimeConfiguration = getTerminalSandboxRuntimeConfigurationForCommands(this._os, normalizedCommandDetails);
125
+ const shouldRefreshConfig = this._commandAllowListKeywords.length === 0 || this._needsForceUpdateConfigFile || !this._areStringArraysEqual(this._commandAllowListKeywords, normalizedCommandKeywords) || !this._areStringArraysEqual(currentReadAllowListPaths, nextReadAllowListPaths) || !this._areObjectsEqual(currentRuntimeConfiguration, nextRuntimeConfiguration) || this._commandCwd?.toString() !== cwd?.toString() || this._commandAllowNetwork !== allowNetworkForCommand || (this._os === OperatingSystem.Windows && (this._commandLine !== command || this._commandShell !== shell));
126
+ if (shouldRefreshConfig) {
127
+ this._commandAllowListKeywords = normalizedCommandKeywords;
128
+ this._commandAllowListCommandDetails = normalizedCommandDetails;
129
+ this._commandCwd = cwd;
130
+ this._commandLine = command;
131
+ this._commandShell = shell;
132
+ this._commandAllowNetwork = allowNetworkForCommand;
133
+ await this.getSandboxConfigPath(true);
134
+ }
135
+ if (!this._sandboxConfigPath || !this._tempDir) {
136
+ throw ( new Error("Sandbox config path or temp dir not initialized"));
137
+ }
138
+ if (!requestUnsandboxedExecution && !retryWithAllowNetworkRequests && allowUnsandboxedCommands && blockedDomainResult.blockedDomains.length > 0) {
139
+ return {
140
+ command: this._wrapUnsandboxedCommand(command, shell),
141
+ isSandboxWrapped: false,
142
+ blockedDomains: blockedDomainResult.blockedDomains,
143
+ deniedDomains: blockedDomainResult.deniedDomains,
144
+ requiresUnsandboxConfirmation: true
145
+ };
146
+ }
147
+ if (requestUnsandboxedExecution && allowUnsandboxedCommands) {
148
+ return {
149
+ command: this._wrapUnsandboxedCommand(command, shell),
150
+ isSandboxWrapped: false
151
+ };
152
+ }
153
+ const allowNetworkConfirmationMetadata = requiresPreflightAllowNetwork ? {
154
+ blockedDomains: blockedDomainResult.blockedDomains,
155
+ deniedDomains: blockedDomainResult.deniedDomains
156
+ } : undefined;
157
+ if (this._os === OperatingSystem.Windows) {
158
+ if (!this._mxcPath) {
159
+ throw ( new Error("MXC executable path not resolved"));
160
+ }
161
+ return {
162
+ command: this._windowsMxcRuntime.wrapCommand(this._mxcPath, this._sandboxConfigPath),
163
+ isSandboxWrapped: true,
164
+ requiresAllowNetworkConfirmation: allowNetworkForCommand && !this._isSandboxAllowNetworkConfigured() ? true : undefined,
165
+ ...allowNetworkConfirmationMetadata
166
+ };
167
+ }
168
+ if (!this._execPath) {
169
+ throw ( new Error("Executable path not set to run sandbox commands"));
170
+ }
171
+ if (!this._srtPath) {
172
+ throw ( new Error("Sandbox runtime path not resolved"));
173
+ }
174
+ if (!this._rgPath) {
175
+ throw ( new Error("Ripgrep path not resolved"));
176
+ }
177
+ const commandToRunInSandbox = this._getSandboxCommandWithPreservedCwd(command, cwd);
178
+ const sandboxRuntimeCommand = `PATH="$PATH:${this._pathDirname(this._rgPath)}" TMPDIR="${this._tempDir.path}" CLAUDE_TMPDIR="${this._tempDir.path}" "${this._execPath}" "${this._srtPath}" --settings "${this._sandboxConfigPath}" -c ${this._quoteShellArgument(commandToRunInSandbox)}`;
179
+ if (this._runAsNode) {
180
+ const nodeSandboxRuntimeCommand = `ELECTRON_RUN_AS_NODE=1 ${sandboxRuntimeCommand}`;
181
+ return {
182
+ command: this._wrapSandboxRuntimeCommandForLaunch(nodeSandboxRuntimeCommand, cwd),
183
+ isSandboxWrapped: true,
184
+ requiresAllowNetworkConfirmation: allowNetworkForCommand && !this._isSandboxAllowNetworkConfigured() ? true : undefined,
185
+ ...allowNetworkConfirmationMetadata
186
+ };
187
+ }
188
+ return {
189
+ command: this._wrapSandboxRuntimeCommandForLaunch(sandboxRuntimeCommand, cwd),
190
+ isSandboxWrapped: true,
191
+ requiresAllowNetworkConfirmation: allowNetworkForCommand && !this._isSandboxAllowNetworkConfigured() ? true : undefined,
192
+ ...allowNetworkConfirmationMetadata
193
+ };
194
+ }
195
+ async checkForSandboxingPrereqs(forceRefresh = false, precheckInputs) {
196
+ if (!(await this._isSandboxConfiguredEnabled(precheckInputs))) {
197
+ return {
198
+ enabled: false,
199
+ sandboxConfigPath: undefined,
200
+ failedCheck: undefined
201
+ };
202
+ }
203
+ const sandboxConfigPath = await this.getSandboxConfigPath(forceRefresh, precheckInputs);
204
+ if (!sandboxConfigPath) {
205
+ return {
206
+ enabled: true,
207
+ sandboxConfigPath,
208
+ failedCheck: TerminalSandboxPrerequisiteCheck.Config
209
+ };
210
+ }
211
+ if (!(await this._checkSandboxDependencies(forceRefresh))) {
212
+ return {
213
+ enabled: true,
214
+ sandboxConfigPath,
215
+ failedCheck: TerminalSandboxPrerequisiteCheck.Dependencies,
216
+ missingDependencies: await this.getMissingSandboxDependencies()
217
+ };
218
+ }
219
+ return {
220
+ enabled: true,
221
+ sandboxConfigPath,
222
+ failedCheck: undefined
223
+ };
224
+ }
225
+ async getSandboxConfigPath(forceRefresh = false, precheckInputs) {
226
+ if (!(await this._isSandboxConfiguredEnabled(precheckInputs))) {
227
+ return undefined;
228
+ }
229
+ await this._resolveRuntimeInfo();
230
+ if (!this._sandboxConfigPath || forceRefresh || this._needsForceUpdateConfigFile) {
231
+ this._sandboxConfigPath = await this._createSandboxConfig();
232
+ this._needsForceUpdateConfigFile = false;
233
+ }
234
+ return this._sandboxConfigPath;
235
+ }
236
+ async getMissingSandboxDependencies() {
237
+ const os = await this.getOS();
238
+ if (os === OperatingSystem.Windows) {
239
+ return [];
240
+ }
241
+ if (!this._sandboxDependencyStatus || !this._sandboxDependencyStatus.bubblewrapInstalled || !this._sandboxDependencyStatus.socatInstalled) {
242
+ this._sandboxDependencyStatus = await this._host.checkSandboxDependencies();
243
+ }
244
+ const missing = [];
245
+ if (this._sandboxDependencyStatus && !this._sandboxDependencyStatus.bubblewrapInstalled) {
246
+ missing.push("bubblewrap");
247
+ }
248
+ if (this._sandboxDependencyStatus && !this._sandboxDependencyStatus.socatInstalled) {
249
+ missing.push("socat");
250
+ }
251
+ return missing;
252
+ }
253
+ async cleanupTempDir() {
254
+ if (!this._tempDir) {
255
+ return;
256
+ }
257
+ try {
258
+ await this._fileService.del(this._tempDir, {
259
+ recursive: true,
260
+ useTrash: false
261
+ });
262
+ } catch (error) {
263
+ this._logService.warn("TerminalSandboxEngine: Failed to delete sandbox temp dir", error);
264
+ }
265
+ }
266
+ async _checkSandboxDependencies(forceRefresh = false) {
267
+ const os = await this.getOS();
268
+ if (os === OperatingSystem.Windows) {
269
+ return true;
270
+ }
271
+ if (!forceRefresh && this._sandboxDependencyStatus) {
272
+ return this._sandboxDependencyStatus.bubblewrapInstalled && this._sandboxDependencyStatus.socatInstalled;
273
+ }
274
+ const status = await this._host.checkSandboxDependencies();
275
+ this._sandboxDependencyStatus = status;
276
+ if (status && !status.bubblewrapInstalled) {
277
+ this._logService.warn("TerminalSandboxEngine: bubblewrap (bwrap) is not installed");
278
+ }
279
+ if (status && !status.socatInstalled) {
280
+ this._logService.warn("TerminalSandboxEngine: socat is not installed");
281
+ }
282
+ return status ? status.bubblewrapInstalled && status.socatInstalled : true;
283
+ }
284
+ _quoteShellArgument(value) {
285
+ return `'${value.replace(/'/g, `'\\''`)}'`;
286
+ }
287
+ _getSandboxCommandWithPreservedCwd(command, cwd) {
288
+ if (this._os !== OperatingSystem.Linux || !cwd?.path || cwd.path === this._tempDir?.path) {
289
+ return command;
290
+ }
291
+ return `cd ${this._quoteShellArgument(cwd.path)} && ${command}`;
292
+ }
293
+ _wrapSandboxRuntimeCommandForLaunch(sandboxRuntimeCommand, cwd) {
294
+ const tempDirPath = this._tempDir?.path;
295
+ return this._os === OperatingSystem.Linux && cwd?.path && tempDirPath && cwd.path !== tempDirPath ? `cd ${this._quoteShellArgument(tempDirPath)}; ${sandboxRuntimeCommand}` : sandboxRuntimeCommand;
296
+ }
297
+ _wrapUnsandboxedCommand(command, shell) {
298
+ if (this._os === OperatingSystem.Windows) {
299
+ return this._windowsMxcRuntime.wrapUnsandboxedCommand(command);
300
+ }
301
+ if (!this._tempDir?.path) {
302
+ return command;
303
+ }
304
+ if (!shell) {
305
+ return `(TMPDIR="${this._tempDir.path}"; export TMPDIR; ${command})`;
306
+ }
307
+ return `env TMPDIR="${this._tempDir.path}" ${this._quoteShellArgument(shell)} -c ${this._quoteShellArgument(command)}`;
308
+ }
309
+ _getBlockedDomains(command) {
310
+ if (this._isSandboxAllowNetworkConfigured()) {
311
+ return {
312
+ blockedDomains: [],
313
+ deniedDomains: []
314
+ };
315
+ }
316
+ const domains = this._extractDomains(command);
317
+ if (domains.length === 0) {
318
+ return {
319
+ blockedDomains: [],
320
+ deniedDomains: []
321
+ };
322
+ }
323
+ const {
324
+ allowedDomains,
325
+ deniedDomains
326
+ } = this.getResolvedNetworkDomains();
327
+ const blockedDomains = ( new Set());
328
+ const explicitlyDeniedDomains = ( new Set());
329
+ for (const domain of domains) {
330
+ if (( deniedDomains.some(pattern => matchesDomainPattern(domain, pattern)))) {
331
+ blockedDomains.add(domain);
332
+ explicitlyDeniedDomains.add(domain);
333
+ continue;
334
+ }
335
+ if (!( allowedDomains.some(pattern => matchesDomainPattern(domain, pattern)))) {
336
+ blockedDomains.add(domain);
337
+ }
338
+ }
339
+ return {
340
+ blockedDomains: [...blockedDomains],
341
+ deniedDomains: [...explicitlyDeniedDomains]
342
+ };
343
+ }
344
+ _extractDomains(command) {
345
+ const domains = ( new Set());
346
+ let match;
347
+ TerminalSandboxEngine_1._urlRegex.lastIndex = 0;
348
+ while ((match = TerminalSandboxEngine_1._urlRegex.exec(command)) !== null) {
349
+ const domain = this._extractDomainFromUrl(match[0]);
350
+ if (domain) {
351
+ domains.add(domain);
352
+ }
353
+ }
354
+ TerminalSandboxEngine_1._sshRemoteRegex.lastIndex = 0;
355
+ while ((match = TerminalSandboxEngine_1._sshRemoteRegex.exec(command)) !== null) {
356
+ const domain = normalizeDomain(match[1], true);
357
+ if (domain) {
358
+ domains.add(domain);
359
+ }
360
+ }
361
+ TerminalSandboxEngine_1._hostRegex.lastIndex = 0;
362
+ while ((match = TerminalSandboxEngine_1._hostRegex.exec(command)) !== null) {
363
+ const domain = normalizeDomain(match[1]);
364
+ if (domain) {
365
+ domains.add(domain);
366
+ }
367
+ }
368
+ return [...domains];
369
+ }
370
+ _extractDomainFromUrl(value) {
371
+ try {
372
+ const authority = ( URI.parse(value)).authority;
373
+ return normalizeDomain(authority, true);
374
+ } catch {
375
+ return undefined;
376
+ }
377
+ }
378
+ _normalizeCommandKeywords(commandKeywords) {
379
+ return [...( new Set(( commandKeywords.map(keyword => keyword.toLowerCase()))))].sort();
380
+ }
381
+ _normalizeCommandDetails(commandDetails) {
382
+ const seen = ( new Set());
383
+ const result = [];
384
+ for (const command of commandDetails) {
385
+ const normalizedCommand = {
386
+ keyword: command.keyword.toLowerCase(),
387
+ args: [...command.args]
388
+ };
389
+ const key = JSON.stringify(normalizedCommand);
390
+ if (!( seen.has(key))) {
391
+ seen.add(key);
392
+ result.push(normalizedCommand);
393
+ }
394
+ }
395
+ return result.sort(
396
+ (a, b) => a.keyword.localeCompare(b.keyword) || a.args.join("\u0000").localeCompare(b.args.join("\u0000"))
397
+ );
398
+ }
399
+ _areStringArraysEqual(a, b) {
400
+ return a.length === b.length && a.every((keyword, index) => keyword === b[index]);
401
+ }
402
+ _areObjectsEqual(a, b) {
403
+ return JSON.stringify(a) === JSON.stringify(b);
404
+ }
405
+ _isSandboxAllowedByPrecheckInputs(precheckInputs) {
406
+ return precheckInputs?.isDefaultApprovalPermissionEnabled !== false;
407
+ }
408
+ async _isSandboxConfiguredEnabled(precheckInputs) {
409
+ if (!this._isSandboxAllowedByPrecheckInputs(precheckInputs)) {
410
+ return false;
411
+ }
412
+ await this.getOS();
413
+ if (this._os === OperatingSystem.Windows) {
414
+ return this._getSandboxConfiguredWindowsEnabledValue() === AgentSandboxEnabledValue.AllowNetwork;
415
+ }
416
+ const value = this._getSandboxConfiguredEnabledValue();
417
+ return value === AgentSandboxEnabledValue.On || value === AgentSandboxEnabledValue.AllowNetwork;
418
+ }
419
+ async _resolveRuntimeInfo() {
420
+ if (this._runtimeResolved) {
421
+ return;
422
+ }
423
+ this._runtimeResolved = true;
424
+ const runtimeInfo = await this._host.getRuntimeInfo();
425
+ this._appRoot = runtimeInfo.appRoot;
426
+ this._execPath = runtimeInfo.execPath;
427
+ this._runAsNode = runtimeInfo.runAsNode ?? false;
428
+ this._userHome = await this._host.getUserHome();
429
+ this._srtPath = this._pathJoin(
430
+ this._appRoot,
431
+ "node_modules",
432
+ "@vscode",
433
+ "sandbox-runtime",
434
+ "dist",
435
+ "cli.js"
436
+ );
437
+ const rgPlatform = this._os === OperatingSystem.Windows ? "win32" : this._os === OperatingSystem.Macintosh ? "darwin" : "linux";
438
+ const rgBinary = this._os === OperatingSystem.Windows ? "rg.exe" : "rg";
439
+ this._rgPath = this._pathJoin(
440
+ this._appRoot,
441
+ "node_modules",
442
+ "@vscode",
443
+ "ripgrep-universal",
444
+ "bin",
445
+ `${rgPlatform}-${arch}`,
446
+ rgBinary
447
+ );
448
+ this._mxcPath = this._windowsMxcRuntime.getExecutablePath(this._appRoot, runtimeInfo.arch);
449
+ }
450
+ async _createSandboxConfig() {
451
+ if ((await this.isEnabled()) && !this._tempDir) {
452
+ await this._initTempDir();
453
+ }
454
+ if (!this._tempDir) {
455
+ return undefined;
456
+ }
457
+ const allowNetwork = this._commandAllowNetwork || (await this.isSandboxAllowNetworkEnabled());
458
+ const linuxFileSystemSetting = this._os === OperatingSystem.Linux ? this._getSettingValue(AgentSandboxSettingId.AgentSandboxLinuxFileSystem) ?? {} : {};
459
+ const macFileSystemSetting = this._os === OperatingSystem.Macintosh ? this._getSettingValue(AgentSandboxSettingId.AgentSandboxMacFileSystem) ?? {} : {};
460
+ const windowsFileSystemSetting = this._os === OperatingSystem.Windows ? this._getSettingValue(AgentSandboxSettingId.AgentSandboxWindowsFileSystem) ?? {} : {};
461
+ const windowsSchemaVersion = this._os === OperatingSystem.Windows ? this._getSettingValue(AgentSandboxSettingId.AgentSandboxWindowsSchemaVersion) : undefined;
462
+ const runtimeSetting = this._getSettingValue(AgentSandboxSettingId.AgentSandboxAdvancedRuntime) ?? {};
463
+ const commandRuntimeSetting = getTerminalSandboxRuntimeConfigurationForCommands(this._os, this._commandAllowListCommandDetails);
464
+ const commandRuntimeAllowReadPaths = this._getCommandRuntimeFileSystemPaths(commandRuntimeSetting, "allowRead");
465
+ const commandRuntimeAllowWritePaths = this._getCommandRuntimeFileSystemPaths(commandRuntimeSetting, "allowWrite");
466
+ const configFileUri = URI.joinPath(this._tempDir, `vscode-sandbox-settings-${this._sandboxSettingsId}.json`);
467
+ let allowWritePaths = [];
468
+ let allowReadPaths = [];
469
+ let denyReadPaths = [];
470
+ let denyWritePaths;
471
+ if (this._os === OperatingSystem.Windows) {
472
+ const filesystemPolicy = await this._getWindowsMxcFilesystemPolicy();
473
+ const env = await this._getWindowsMxcEnvironment();
474
+ allowWritePaths = await this._resolveFileSystemPaths([
475
+ ...(await this._updateAllowWritePathsWithWorkspaceFolders(windowsFileSystemSetting.allowWrite)),
476
+ ...filesystemPolicy.readwritePaths
477
+ ]);
478
+ allowReadPaths = await this._resolveFileSystemPaths([
479
+ ...(windowsFileSystemSetting.allowRead ?? []),
480
+ ...filesystemPolicy.readonlyPaths
481
+ ]);
482
+ denyReadPaths = await this._resolveFileSystemPaths(windowsFileSystemSetting.denyRead ?? []);
483
+ this._windowsMxcEnvironment = env;
484
+ } else if (this._os === OperatingSystem.Macintosh) {
485
+ allowWritePaths = await this._resolveFileSystemPaths(
486
+ await this._updateAllowWritePathsWithWorkspaceFolders(macFileSystemSetting.allowWrite, commandRuntimeAllowWritePaths)
487
+ );
488
+ allowReadPaths = await this._resolveFileSystemPaths(await this._updateAllowReadPathsWithAllowWrite(
489
+ macFileSystemSetting.allowRead,
490
+ allowWritePaths,
491
+ commandRuntimeAllowReadPaths
492
+ ));
493
+ denyReadPaths = await this._resolveFileSystemPaths(this._updateDenyReadPathsWithHome(macFileSystemSetting.denyRead));
494
+ denyWritePaths = macFileSystemSetting.denyWrite ? await this._resolveFileSystemPaths(macFileSystemSetting.denyWrite) : undefined;
495
+ } else if (this._os === OperatingSystem.Linux) {
496
+ allowWritePaths = await this._resolveFileSystemPaths(
497
+ await this._updateAllowWritePathsWithWorkspaceFolders(linuxFileSystemSetting.allowWrite, commandRuntimeAllowWritePaths)
498
+ );
499
+ allowReadPaths = await this._resolveFileSystemPaths(await this._updateAllowReadPathsWithAllowWrite(
500
+ linuxFileSystemSetting.allowRead,
501
+ allowWritePaths,
502
+ commandRuntimeAllowReadPaths
503
+ ));
504
+ denyReadPaths = await this._resolveFileSystemPaths(this._updateDenyReadPathsWithHome(linuxFileSystemSetting.denyRead));
505
+ denyWritePaths = await this._resolveFileSystemPaths(linuxFileSystemSetting.denyWrite);
506
+ }
507
+ const sandboxSettings = this._os === OperatingSystem.Windows ? await this._windowsMxcRuntime.createConfig({
508
+ command: this._commandLine ?? "",
509
+ shell: this._commandShell,
510
+ cwd: this._commandCwd ?? this._getDefaultWindowsMxcCwd(),
511
+ tempDir: this._tempDir,
512
+ schemaVersion: windowsSchemaVersion,
513
+ allowNetwork,
514
+ networkDomains: this.getResolvedNetworkDomains(),
515
+ allowReadPaths,
516
+ allowWritePaths,
517
+ denyReadPaths,
518
+ env: this._windowsMxcEnvironment ?? []
519
+ }, this._buildSandboxPayload) : {
520
+ network: allowNetwork ? {
521
+ allowedDomains: [],
522
+ deniedDomains: [],
523
+ enabled: false
524
+ } : this.getResolvedNetworkDomains(),
525
+ filesystem: {
526
+ denyRead: denyReadPaths,
527
+ allowRead: allowReadPaths,
528
+ allowWrite: allowWritePaths,
529
+ denyWrite: denyWritePaths
530
+ }
531
+ };
532
+ if (this._os !== OperatingSystem.Windows) {
533
+ this._mergeAdditionalSandboxConfigProperties(
534
+ sandboxSettings,
535
+ allowNetwork ? this._withoutNetworkRuntimeSetting(runtimeSetting) : runtimeSetting
536
+ );
537
+ this._mergeAdditionalSandboxConfigProperties(sandboxSettings, commandRuntimeSetting);
538
+ }
539
+ this._sandboxConfigPath = this._getUriPath(configFileUri);
540
+ await this._fileService.createFile(
541
+ configFileUri,
542
+ VSBuffer.fromString(JSON.stringify(sandboxSettings, null, "\t")),
543
+ {
544
+ overwrite: true
545
+ }
546
+ );
547
+ return this._sandboxConfigPath;
548
+ }
549
+ _getCommandRuntimeFileSystemPaths(runtimeSetting, key) {
550
+ const filesystem = runtimeSetting.filesystem;
551
+ if (!this._isObjectForSandboxConfigMerge(filesystem)) {
552
+ return [];
553
+ }
554
+ const paths = filesystem[key];
555
+ if (!Array.isArray(paths)) {
556
+ return [];
557
+ }
558
+ return paths.filter(path => typeof path === "string");
559
+ }
560
+ _withoutNetworkRuntimeSetting(runtimeSetting) {
561
+ const sanitizedRuntimeSetting = {
562
+ ...runtimeSetting
563
+ };
564
+ delete sanitizedRuntimeSetting.network;
565
+ return sanitizedRuntimeSetting;
566
+ }
567
+ _mergeAdditionalSandboxConfigProperties(target, additional) {
568
+ for (const [key, value] of Object.entries(additional)) {
569
+ if (!Object.prototype.hasOwnProperty.call(target, key)) {
570
+ target[key] = value;
571
+ continue;
572
+ }
573
+ const existingValue = target[key];
574
+ if (this._isObjectForSandboxConfigMerge(existingValue) && this._isObjectForSandboxConfigMerge(value)) {
575
+ this._mergeAdditionalSandboxConfigProperties(existingValue, value);
576
+ }
577
+ }
578
+ }
579
+ _isObjectForSandboxConfigMerge(value) {
580
+ return typeof value === "object" && value !== null && !Array.isArray(value);
581
+ }
582
+ async _getWindowsMxcFilesystemPolicy() {
583
+ if (!this._windowsMxcFilesystemPolicy) {
584
+ this._windowsMxcFilesystemPolicy = (await this._host.getWindowsMxcFilesystemPolicy()) ?? {
585
+ readonlyPaths: [],
586
+ readwritePaths: []
587
+ };
588
+ }
589
+ return this._windowsMxcFilesystemPolicy;
590
+ }
591
+ async _getWindowsMxcEnvironment() {
592
+ if (!this._windowsMxcEnvironment) {
593
+ this._windowsMxcEnvironment = (await this._host.getWindowsMxcEnvironment()) ?? [];
594
+ }
595
+ return this._windowsMxcEnvironment;
596
+ }
597
+ _pathDirname(path) {
598
+ return (this._os === OperatingSystem.Windows ? win32 : posix).dirname(path);
599
+ }
600
+ _getUriPath(uri) {
601
+ return this._os === OperatingSystem.Windows ? this._windowsMxcRuntime.toWindowsPath(uri) : uri.path;
602
+ }
603
+ async _initTempDir() {
604
+ if (!(await this.isEnabled())) {
605
+ return;
606
+ }
607
+ this._needsForceUpdateConfigFile = true;
608
+ this._tempDir = await this._host.getSandboxTempDir();
609
+ if (this._tempDir) {
610
+ await this._fileService.createFolder(this._tempDir);
611
+ this._defaultWritePaths.push(this._getUriPath(this._tempDir));
612
+ } else {
613
+ this._logService.warn(
614
+ "TerminalSandboxEngine: Cannot create sandbox settings file because no tmpDir is available in this environment"
615
+ );
616
+ }
617
+ }
618
+ async _updateAllowWritePathsWithWorkspaceFolders(configuredAllowWrite, commandRuntimeAllowWrite = []) {
619
+ const writeRootPaths = ( this._host.getWriteRoots().map(folder => this._getUriPath(folder)));
620
+ return [...( new Set([
621
+ ...writeRootPaths,
622
+ ...this._defaultWritePaths,
623
+ ...(await this._getWorkspaceStorageReadPaths()),
624
+ ...(configuredAllowWrite ?? []),
625
+ ...commandRuntimeAllowWrite
626
+ ]))];
627
+ }
628
+ _updateDenyReadPathsWithHome(configuredDenyRead) {
629
+ if (this._os === OperatingSystem.Windows) {
630
+ return [...( new Set(configuredDenyRead ?? []))];
631
+ }
632
+ const userHome = this._userHome ? this._getUriPath(this._userHome) : undefined;
633
+ return [...( new Set([...(configuredDenyRead ?? []), ...(userHome ? [userHome] : [])]))];
634
+ }
635
+ async _updateAllowReadPathsWithAllowWrite(configuredAllowRead, allowWrite, commandRuntimeAllowRead = []) {
636
+ return [...( new Set([
637
+ ...(configuredAllowRead ?? []),
638
+ ...getTerminalSandboxReadAllowListForCommands(
639
+ this._os,
640
+ this._commandAllowListKeywords,
641
+ this._commandAllowListCommandDetails
642
+ ),
643
+ ...commandRuntimeAllowRead,
644
+ ...this._getSandboxRuntimeReadPaths(),
645
+ ...(await this._getWorkspaceStorageReadPaths()),
646
+ ...allowWrite
647
+ ]))];
648
+ }
649
+ async _resolveFileSystemPaths(paths) {
650
+ const resolvedPaths = await Promise.all(( (paths ?? []).map(path => this._resolveFileSystemPath(path))));
651
+ return [...( new Set(resolvedPaths.flat()))];
652
+ }
653
+ async _resolveFileSystemPath(path) {
654
+ const expandedPath = this._os === OperatingSystem.Linux ? this._expandHomePath(path) : path;
655
+ if (!this._isAbsoluteFileSystemPath(expandedPath)) {
656
+ return [expandedPath];
657
+ }
658
+ try {
659
+ const realpath = await this._fileService.realpath(this._toFileSystemResource(expandedPath));
660
+ const resolvedPath = realpath ? this._getUriPath(realpath) : undefined;
661
+ return resolvedPath && resolvedPath !== expandedPath ? [expandedPath, resolvedPath] : [expandedPath];
662
+ } catch {
663
+ return [expandedPath];
664
+ }
665
+ }
666
+ _isAbsoluteFileSystemPath(path) {
667
+ return (this._os === OperatingSystem.Windows ? win32 : posix).isAbsolute(path);
668
+ }
669
+ _toFileSystemResource(path) {
670
+ if (this._os === OperatingSystem.Windows) {
671
+ return this._toWindowsFileSystemResource(path);
672
+ }
673
+ return this._userHome?.with({
674
+ path
675
+ }) ?? this._tempDir?.with({
676
+ path
677
+ }) ?? this._host.getWriteRoots()[0]?.with({
678
+ path
679
+ }) ?? URI.file(path);
680
+ }
681
+ _toWindowsFileSystemResource(path) {
682
+ const normalizedPath = path.replace(/\\/g, "/");
683
+ if (/^\/\/[^/]/.test(normalizedPath)) {
684
+ const firstPathSeparator = normalizedPath.indexOf("/", 2);
685
+ if (firstPathSeparator === -1) {
686
+ return ( URI.from({
687
+ scheme: "file",
688
+ authority: normalizedPath.slice(2),
689
+ path: "/"
690
+ }));
691
+ }
692
+ return ( URI.from({
693
+ scheme: "file",
694
+ authority: normalizedPath.slice(2, firstPathSeparator),
695
+ path: normalizedPath.slice(firstPathSeparator) || "/"
696
+ }));
697
+ }
698
+ if (/^[a-zA-Z]:($|\/)/.test(normalizedPath)) {
699
+ return ( URI.from({
700
+ scheme: "file",
701
+ path: `/${normalizedPath[0].toLowerCase()}${normalizedPath.slice(1)}`
702
+ }));
703
+ }
704
+ if (/^\/[a-zA-Z]:($|\/)/.test(normalizedPath)) {
705
+ return ( URI.from({
706
+ scheme: "file",
707
+ path: `/${normalizedPath[1].toLowerCase()}${normalizedPath.slice(2)}`
708
+ }));
709
+ }
710
+ return ( URI.from({
711
+ scheme: "file",
712
+ path: normalizedPath
713
+ }));
714
+ }
715
+ _expandHomePath(path) {
716
+ const userHome = this._userHome?.path;
717
+ if (!userHome) {
718
+ return path;
719
+ }
720
+ if (path === "~") {
721
+ return userHome;
722
+ }
723
+ if (path.startsWith("~/")) {
724
+ return this._pathJoin(userHome, path.slice(2));
725
+ }
726
+ return path;
727
+ }
728
+ _getSandboxRuntimeReadPaths() {
729
+ if (!this._appRoot) {
730
+ return [];
731
+ }
732
+ if (this._os === OperatingSystem.Windows) {
733
+ return this._windowsMxcRuntime.getRuntimeReadPaths(this._appRoot, this._mxcPath);
734
+ }
735
+ const paths = [this._appRoot];
736
+ if (this._execPath) {
737
+ for (const path of [this._execPath, this._pathDirname(this._execPath)]) {
738
+ if (!this._isPathUnderAppRoot(path)) {
739
+ paths.push(path);
740
+ }
741
+ }
742
+ }
743
+ return paths;
744
+ }
745
+ _isPathUnderAppRoot(path) {
746
+ if (!this._appRoot) {
747
+ return false;
748
+ }
749
+ return path === this._appRoot || path.startsWith(
750
+ `${this._appRoot}${this._os === OperatingSystem.Windows ? win32.sep : posix.sep}`
751
+ );
752
+ }
753
+ async _getWorkspaceStorageReadPaths() {
754
+ const root = await this._host.getWorkspaceStorageReadRoot();
755
+ return root ? [this._getUriPath(root)] : [];
756
+ }
757
+ _getDefaultWindowsMxcCwd() {
758
+ return this._host.getWriteRoots()[0];
759
+ }
760
+ _getSandboxConfiguredEnabledValue() {
761
+ return this._getSettingValue(AgentSandboxSettingId.AgentSandboxEnabled) ?? AgentSandboxEnabledValue.Off;
762
+ }
763
+ _getSandboxConfiguredWindowsEnabledValue() {
764
+ return this._getSettingValue(AgentSandboxSettingId.AgentSandboxWindowsEnabled) ?? AgentSandboxEnabledValue.Off;
765
+ }
766
+ _isSandboxAllowNetworkConfigured() {
767
+ if (this._os === OperatingSystem.Windows) {
768
+ return this._getSandboxConfiguredWindowsEnabledValue() === AgentSandboxEnabledValue.AllowNetwork;
769
+ }
770
+ return this._getSandboxConfiguredEnabledValue() === AgentSandboxEnabledValue.AllowNetwork;
771
+ }
772
+ _areUnsandboxedCommandsAllowed() {
773
+ return this._getSettingValue(AgentSandboxSettingId.AgentSandboxAllowUnsandboxedCommands) === true;
774
+ }
775
+ _areRetryWithAllowNetworkRequestsAllowed() {
776
+ return this._getSettingValue(AgentSandboxSettingId.AgentSandboxRetryWithAllowNetworkRequests) === true;
777
+ }
778
+ _getSettingValue(settingId) {
779
+ return this._host.getSandboxSetting(settingId);
780
+ }
781
+ };
782
+ TerminalSandboxEngine = TerminalSandboxEngine_1 = ( __decorate([( __param(1, IFileService)), ( __param(2, ILogService)), ( __param(3, IWindowsMxcTerminalSandboxRuntime))], TerminalSandboxEngine));
783
+
784
+ export { TerminalSandboxEngine };