@codingame/monaco-vscode-chat-service-override 37.1.0 → 37.2.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 (205) hide show
  1. package/index.js +15 -5
  2. package/package.json +5 -5
  3. package/vscode/src/vs/platform/agentHost/browser/agentHostEnablementService.js +1 -1
  4. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.d.ts +104 -0
  5. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +827 -0
  6. package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.d.ts +15 -0
  7. package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.js +71 -0
  8. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.d.ts +16 -0
  9. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.js +95 -0
  10. package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.d.ts +22 -0
  11. package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.js +286 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadChatInputNotification.d.ts +10 -0
  13. package/vscode/src/vs/workbench/api/browser/mainThreadChatInputNotification.js +38 -0
  14. package/vscode/src/vs/workbench/api/browser/mainThreadChatQuota.d.ts +9 -0
  15. package/vscode/src/vs/workbench/api/browser/mainThreadChatQuota.js +22 -0
  16. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +130 -0
  17. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +907 -0
  18. package/vscode/src/vs/workbench/api/browser/mainThreadChatStatus.d.ts +10 -0
  19. package/vscode/src/vs/workbench/api/browser/mainThreadChatStatus.js +28 -0
  20. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.d.ts +27 -0
  21. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +167 -0
  22. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.d.ts +46 -0
  23. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +356 -0
  24. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +1 -1
  25. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +1 -1
  26. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +2 -2
  27. package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.js +1 -1
  28. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.d.ts +2 -2
  30. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +1 -1
  31. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +2 -2
  32. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +1 -1
  33. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationContentExpander.d.ts +1 -1
  34. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationItemProvider.d.ts +1 -1
  35. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationSyncProvider.d.ts +1 -1
  36. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.d.ts +1 -1
  37. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostExistingSessionHarnessPickerEnablement.js +1 -1
  38. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.d.ts +1 -1
  39. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +1 -1
  40. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPromptCacheNotification.js +1 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.js +5 -3
  42. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSettings.contribution.js +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSignedOutModelsNotification.js +2 -2
  44. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettings.contribution.js +2 -2
  45. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/openSessionLinkOpener.contribution.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +1 -1
  47. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +1 -1
  48. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +1 -1
  49. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +1 -1
  50. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +1 -1
  52. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.d.ts +1 -1
  53. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +1 -1
  54. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
  56. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +1 -1
  57. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +1 -1
  58. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.js +2 -2
  59. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +1 -1
  60. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +1 -1
  61. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +3 -3
  62. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +1 -1
  63. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationPresentation.d.ts +1 -1
  64. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +1 -1
  65. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +1 -1
  66. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigration.d.ts +1 -1
  67. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationCategories.js +1 -1
  68. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.d.ts +1 -1
  69. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +1 -1
  70. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +1 -1
  71. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +1 -1
  72. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +1 -1
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +12 -12
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.d.ts +1 -1
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.js +1 -1
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.d.ts +1 -1
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.d.ts +1 -1
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.d.ts +1 -1
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.d.ts +1 -1
  81. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.d.ts +1 -1
  82. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +1 -1
  83. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.d.ts +1 -1
  84. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.d.ts +1 -1
  85. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +1 -1
  86. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.d.ts +1 -1
  87. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.d.ts +1 -1
  88. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.d.ts +1 -1
  89. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +1 -1
  90. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.d.ts +1 -1
  91. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +1 -1
  92. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +1 -1
  93. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +1 -1
  94. package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +1 -1
  95. package/vscode/src/vs/workbench/contrib/chat/browser/chatPromoNotification.js +1 -1
  96. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.js +2 -2
  97. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.d.ts +2 -0
  98. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +57 -0
  99. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +2 -2
  100. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +1 -1
  101. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +1 -1
  102. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.d.ts +1 -1
  103. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +1 -1
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +1 -1
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +1 -1
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +1 -1
  107. package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.d.ts +1 -1
  108. package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.js +1 -1
  109. package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationContribution.js +1 -1
  110. package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +1 -1
  111. package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +2 -2
  112. package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +1 -1
  113. package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +1 -1
  114. package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +1 -1
  115. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +3 -3
  116. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +1 -1
  117. package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +1 -1
  118. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +1 -1
  119. package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +1 -1
  120. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +1 -1
  121. package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +1 -1
  122. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +1 -1
  123. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.js +1 -1
  124. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +2 -2
  125. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +1 -1
  126. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +10 -2
  127. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputReferenceDecorations.js +1 -1
  128. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +1 -1
  129. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.d.ts +1 -1
  130. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.d.ts +253 -0
  131. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +20 -0
  132. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +1 -1
  133. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +1 -1
  134. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +2 -2
  135. package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.d.ts +300 -0
  136. package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +272 -0
  137. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +25 -0
  138. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +178 -0
  139. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +78 -0
  140. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +51 -0
  141. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +2 -2
  142. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +2 -2
  143. package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.d.ts +67 -0
  144. package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.js +195 -0
  145. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +67 -0
  146. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +294 -0
  147. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +212 -0
  148. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +955 -0
  149. package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.d.ts +31 -0
  150. package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.js +122 -0
  151. package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.d.ts +1 -1
  152. package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.js +1 -1
  153. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +65 -0
  154. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +698 -0
  155. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +50 -0
  156. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +78 -0
  157. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +77 -0
  158. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +120 -0
  159. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +10 -0
  160. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +23 -0
  161. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.d.ts +92 -0
  162. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.js +335 -0
  163. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +235 -0
  164. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +1673 -0
  165. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +202 -0
  166. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +872 -0
  167. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.d.ts +36 -0
  168. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.js +239 -0
  169. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.d.ts +21 -0
  170. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.js +143 -0
  171. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.d.ts +24 -0
  172. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +298 -0
  173. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.d.ts +25 -0
  174. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +177 -0
  175. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.d.ts +73 -0
  176. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +577 -0
  177. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.d.ts +11 -0
  178. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +90 -0
  179. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.d.ts +16 -0
  180. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +130 -0
  181. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.d.ts +12 -0
  182. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.js +53 -0
  183. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.d.ts +5 -0
  184. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.js +12 -0
  185. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.d.ts +10 -0
  186. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.js +91 -0
  187. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +38 -0
  188. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +518 -0
  189. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +6 -0
  190. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +231 -0
  191. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +1 -1
  192. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +4 -4
  193. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +1 -1
  194. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +1 -1
  195. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +1 -1
  196. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +1 -1
  197. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +1 -1
  198. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +1 -1
  199. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +1 -1
  200. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +1 -1
  201. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +1 -1
  202. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +1 -1
  203. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCache.d.ts +1 -1
  204. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCache.js +1 -1
  205. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCompressor.js +1 -1
@@ -0,0 +1,178 @@
1
+
2
+ import { PluginSourceKind } from './pluginMarketplaceService.js';
3
+ import { CollisionEnablementModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement';
4
+
5
+ const COPILOT_CLI_INSTALL_PATH_FRAGMENT = "/.copilot/installed-plugins/";
6
+ class AgentPluginCollisionEnablementModel extends CollisionEnablementModel {
7
+ constructor(base, collisionGroups) {
8
+ super(base, collisionGroups);
9
+ }
10
+ }
11
+ function getSortedAgentPlugins(discoveries) {
12
+ return ( getUniqueAgentPluginCandidates(discoveries).map(candidate => candidate.plugin)).sort((a, b) => ( a.uri.toString()).localeCompare(( b.uri.toString())));
13
+ }
14
+ function getCanonicalAgentPluginCollisionGroups(discoveries, isBlocked) {
15
+ const candidates = getUniqueAgentPluginCandidates(discoveries);
16
+ const byCanonicalKey = ( new Map());
17
+ for (const candidate of candidates) {
18
+ if (isBlocked?.(candidate.plugin)) {
19
+ continue;
20
+ }
21
+ let group = byCanonicalKey.get(candidate.canonicalKey);
22
+ if (!group) {
23
+ group = [];
24
+ byCanonicalKey.set(candidate.canonicalKey, group);
25
+ }
26
+ group.push(( candidate.plugin.uri.toString()));
27
+ }
28
+ const groups = ( new Map());
29
+ for (const group of ( byCanonicalKey.values())) {
30
+ if (group.length < 2) {
31
+ continue;
32
+ }
33
+ for (const key of group) {
34
+ groups.set(key, group);
35
+ }
36
+ }
37
+ return groups;
38
+ }
39
+ function isAgentPluginBlockedByPolicy(plugin, enabledPluginsPolicy) {
40
+ const pluginId = getAgentPluginPolicyId(plugin);
41
+ return pluginId !== undefined && enabledPluginsPolicy?.[pluginId] === false;
42
+ }
43
+ function isAgentPluginForceEnabledByPolicy(plugin, enabledPluginsPolicy) {
44
+ const pluginId = getAgentPluginPolicyId(plugin);
45
+ return pluginId !== undefined && enabledPluginsPolicy?.[pluginId] === true;
46
+ }
47
+ function getAgentPluginPolicyId(plugin) {
48
+ const identity = getPolicyIdentity(plugin);
49
+ return identity ? `${identity.name}@${identity.marketplace}` : undefined;
50
+ }
51
+ function getAgentPluginCandidates(discoveries) {
52
+ const candidates = [];
53
+ for (const discovery of discoveries) {
54
+ for (let pluginOrder = 0; pluginOrder < discovery.plugins.length; pluginOrder++) {
55
+ const plugin = discovery.plugins[pluginOrder];
56
+ candidates.push({
57
+ plugin,
58
+ priority: discovery.priority,
59
+ order: discovery.order,
60
+ pluginOrder,
61
+ canonicalKey: getCanonicalPluginIdentity(plugin)
62
+ });
63
+ }
64
+ }
65
+ return candidates.sort(
66
+ (a, b) => a.priority - b.priority || a.order - b.order || a.pluginOrder - b.pluginOrder || ( a.plugin.uri.toString()).localeCompare(( b.plugin.uri.toString()))
67
+ );
68
+ }
69
+ function getUniqueAgentPluginCandidates(discoveries) {
70
+ const unique = [];
71
+ const seen = ( new Set());
72
+ for (const candidate of getAgentPluginCandidates(discoveries)) {
73
+ const key = ( candidate.plugin.uri.toString());
74
+ if (( seen.has(key))) {
75
+ continue;
76
+ }
77
+ seen.add(key);
78
+ unique.push(candidate);
79
+ }
80
+ return unique;
81
+ }
82
+ function getCanonicalPluginIdentity(plugin) {
83
+ return getMarketplaceCanonicalIdentity(plugin.fromMarketplace) ?? getCopilotCliInstallCanonicalIdentity(plugin) ?? `uri:${( plugin.uri.toString())}`;
84
+ }
85
+ function getMarketplaceCanonicalIdentity(plugin) {
86
+ if (!plugin) {
87
+ return undefined;
88
+ }
89
+ const normalizedName = normalizePluginIdentitySegment(plugin.name);
90
+ const source = plugin.sourceDescriptor;
91
+ switch (source.kind) {
92
+ case PluginSourceKind.RelativePath:
93
+ {
94
+ if (plugin.marketplaceReference.githubRepo) {
95
+ return `github:${plugin.marketplaceReference.githubRepo.toLowerCase()}|${normalizedName}`;
96
+ }
97
+ return `marketplace:${plugin.marketplaceReference.canonicalId}|${normalizedName}`;
98
+ }
99
+ case PluginSourceKind.GitHub:
100
+ {
101
+ const github = source;
102
+ return `github:${github.repo.toLowerCase()}|${normalizedName}`;
103
+ }
104
+ case PluginSourceKind.GitUrl:
105
+ {
106
+ const git = source;
107
+ return `git:${git.url.toLowerCase()}|${normalizedName}`;
108
+ }
109
+ case PluginSourceKind.Npm:
110
+ {
111
+ const npm = source;
112
+ return `npm:${npm.package.toLowerCase()}|${normalizedName}`;
113
+ }
114
+ case PluginSourceKind.Pip:
115
+ {
116
+ const pip = source;
117
+ return `pip:${pip.package.toLowerCase()}|${normalizedName}`;
118
+ }
119
+ }
120
+ }
121
+ function getCopilotCliInstallCanonicalIdentity(plugin) {
122
+ if (plugin.uri.scheme !== "file") {
123
+ return undefined;
124
+ }
125
+ const idx = plugin.uri.path.indexOf(COPILOT_CLI_INSTALL_PATH_FRAGMENT);
126
+ if (idx === -1) {
127
+ return undefined;
128
+ }
129
+ const segments = plugin.uri.path.slice(idx + COPILOT_CLI_INSTALL_PATH_FRAGMENT.length).split("/").filter(s => s.length > 0);
130
+ if (segments.length !== 2) {
131
+ return undefined;
132
+ }
133
+ const [bucket, installName] = segments;
134
+ const normalizedName = normalizePluginIdentitySegment(plugin.label || installName);
135
+ if (bucket !== "_direct") {
136
+ return `copilot-cli-marketplace:${normalizePluginIdentitySegment(bucket)}|${normalizedName}`;
137
+ }
138
+ const match = /^(?<owner>.+)--(?<repo>.+)--(?<plugin>.+)$/.exec(installName);
139
+ const groups = match?.groups;
140
+ if (!groups) {
141
+ return undefined;
142
+ }
143
+ return `github:${groups.owner.toLowerCase()}/${groups.repo.toLowerCase()}|${normalizePluginIdentitySegment(groups.plugin)}`;
144
+ }
145
+ function normalizePluginIdentitySegment(value) {
146
+ return value.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9_.:-]/g, "-").replace(/-+/g, "-").replace(/^[-:.]+|[-:.]+$/g, "");
147
+ }
148
+ function getPolicyIdentity(plugin) {
149
+ const m = plugin.fromMarketplace;
150
+ if (m) {
151
+ return {
152
+ name: m.name,
153
+ marketplace: m.marketplace,
154
+ marketplaceReference: m.marketplaceReference
155
+ };
156
+ }
157
+ if (plugin.uri.scheme !== "file") {
158
+ return undefined;
159
+ }
160
+ const idx = plugin.uri.path.indexOf(COPILOT_CLI_INSTALL_PATH_FRAGMENT);
161
+ if (idx === -1) {
162
+ return undefined;
163
+ }
164
+ const segments = plugin.uri.path.slice(idx + COPILOT_CLI_INSTALL_PATH_FRAGMENT.length).split("/").filter(s => s.length > 0);
165
+ if (segments.length !== 2) {
166
+ return undefined;
167
+ }
168
+ const [marketplace, name] = segments;
169
+ if (marketplace === "_direct") {
170
+ return undefined;
171
+ }
172
+ return {
173
+ name,
174
+ marketplace
175
+ };
176
+ }
177
+
178
+ export { AgentPluginCollisionEnablementModel, getAgentPluginPolicyId, getCanonicalAgentPluginCollisionGroups, getSortedAgentPlugins, isAgentPluginBlockedByPolicy, isAgentPluginForceEnabledByPolicy };
@@ -0,0 +1,78 @@
1
+ import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
+ import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
3
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
4
+ import { SyncDescriptor0 } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors";
5
+ import { type INamedPluginResource, type IMcpServerDefinition, type IParsedHookCommand, type PluginFormat } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentPlugins/common/pluginParsers";
6
+ import { ContributionEnablementState, IEnablementModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement";
7
+ import { IAutomationBlueprint } from "../automations/automationBlueprint.js";
8
+ import { HookType } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/hookTypes";
9
+ import { IMarketplacePlugin } from "./pluginMarketplaceService.js";
10
+ export interface IAgentPluginHook {
11
+ readonly type: HookType;
12
+ readonly hooks: readonly IParsedHookCommand[];
13
+ /** URI where this hook is defined -- not unique, multiple hooks may be in a manifest */
14
+ readonly uri: URI;
15
+ readonly originalId: string;
16
+ }
17
+ export type IAgentPluginCommand = INamedPluginResource;
18
+ export type IAgentPluginSkill = INamedPluginResource;
19
+ export type IAgentPluginAgent = INamedPluginResource;
20
+ export type IAgentPluginInstruction = INamedPluginResource;
21
+ export type IAgentPluginMcpServerDefinition = IMcpServerDefinition;
22
+ export interface IAgentPluginAutomation {
23
+ readonly uri: URI;
24
+ readonly blueprint: IAutomationBlueprint;
25
+ }
26
+ export interface IAgentPlugin {
27
+ readonly uri: URI;
28
+ readonly format: PluginFormat;
29
+ /** Human-readable display name for the plugin. */
30
+ readonly label: string;
31
+ /** Version declared by the plugin manifest, falling back to marketplace metadata. */
32
+ readonly version?: IObservable<string | undefined>;
33
+ readonly enablement: IObservable<ContributionEnablementState>;
34
+ /**
35
+ * When `true`, the plugin is blocked by enterprise policy. It remains
36
+ * visible (shown as disabled) but its contributions are inactive and the
37
+ * user cannot re-enable it. Folded into {@link enablement} so all gating
38
+ * consumers honor it automatically.
39
+ */
40
+ readonly policyBlocked?: IObservable<boolean>;
41
+ /** Removes this plugin from its discovery source (config or installed storage). Undefined for policy-managed plugins that cannot be removed by the user. */
42
+ remove?(): Promise<boolean>;
43
+ readonly hooks: IObservable<readonly IAgentPluginHook[]>;
44
+ readonly commands: IObservable<readonly IAgentPluginCommand[]>;
45
+ readonly skills: IObservable<readonly IAgentPluginSkill[]>;
46
+ readonly agents: IObservable<readonly IAgentPluginAgent[]>;
47
+ readonly instructions: IObservable<readonly IAgentPluginInstruction[]>;
48
+ readonly mcpServerDefinitions: IObservable<readonly IAgentPluginMcpServerDefinition[]>;
49
+ readonly automations: IObservable<readonly IAgentPluginAutomation[]>;
50
+ /** Set when the plugin was installed from a marketplace repository. */
51
+ readonly fromMarketplace?: IMarketplacePlugin;
52
+ }
53
+ export interface IAgentPluginDiscovery extends IDisposable {
54
+ readonly plugins: IObservable<readonly IAgentPlugin[] | undefined>;
55
+ start(enablementModel: IEnablementModel): void;
56
+ }
57
+ export declare enum AgentPluginDiscoveryPriority {
58
+ Configured = 10,
59
+ Marketplace = 20,
60
+ Extension = 30,
61
+ CopilotCli = 40
62
+ }
63
+ export declare function getCanonicalPluginCommandId(plugin: {
64
+ readonly uri: URI;
65
+ readonly label?: string;
66
+ }, commandName: string): string;
67
+ declare class AgentPluginDiscoveryRegistry {
68
+ private readonly _discovery;
69
+ private _order;
70
+ register(descriptor: SyncDescriptor0<IAgentPluginDiscovery>, priority: AgentPluginDiscoveryPriority): IDisposable;
71
+ getAll(): readonly {
72
+ readonly descriptor: SyncDescriptor0<IAgentPluginDiscovery>;
73
+ readonly priority: AgentPluginDiscoveryPriority;
74
+ readonly order: number;
75
+ }[];
76
+ }
77
+ export declare const agentPluginDiscoveryRegistry: AgentPluginDiscoveryRegistry;
78
+ export {};
@@ -0,0 +1,51 @@
1
+
2
+ import { toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
3
+ import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
4
+
5
+ var AgentPluginDiscoveryPriority;
6
+ (function(AgentPluginDiscoveryPriority) {
7
+ AgentPluginDiscoveryPriority[AgentPluginDiscoveryPriority["Configured"] = 10] = "Configured";
8
+ AgentPluginDiscoveryPriority[AgentPluginDiscoveryPriority["Marketplace"] = 20] = "Marketplace";
9
+ AgentPluginDiscoveryPriority[AgentPluginDiscoveryPriority["Extension"] = 30] = "Extension";
10
+ AgentPluginDiscoveryPriority[AgentPluginDiscoveryPriority["CopilotCli"] = 40] = "CopilotCli";
11
+ })(AgentPluginDiscoveryPriority || (AgentPluginDiscoveryPriority = {}));
12
+ function getCanonicalPluginCommandId(plugin, commandName) {
13
+ const prefix = (plugin.label ? normalizePluginToken(plugin.label) : "") || normalizePluginToken(basename(plugin.uri));
14
+ const normalizedCommand = normalizePluginToken(commandName);
15
+ if (normalizedCommand.startsWith(`${prefix}:`)) {
16
+ return normalizedCommand;
17
+ }
18
+ if (prefix === normalizedCommand) {
19
+ return prefix;
20
+ }
21
+ return `${prefix}:${normalizedCommand}`;
22
+ }
23
+ function normalizePluginToken(value) {
24
+ return value.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9_.:-]/g, "-").replace(/-+/g, "-").replace(/^[-:.]+|[-:.]+$/g, "");
25
+ }
26
+ class AgentPluginDiscoveryRegistry {
27
+ constructor() {
28
+ this._discovery = [];
29
+ this._order = 0;
30
+ }
31
+ register(descriptor, priority) {
32
+ const registration = {
33
+ descriptor,
34
+ priority,
35
+ order: this._order++
36
+ };
37
+ this._discovery.push(registration);
38
+ return toDisposable(() => {
39
+ const index = this._discovery.indexOf(registration);
40
+ if (index >= 0) {
41
+ this._discovery.splice(index, 1);
42
+ }
43
+ });
44
+ }
45
+ getAll() {
46
+ return [...this._discovery].sort((a, b) => a.priority - b.priority || a.order - b.order);
47
+ }
48
+ }
49
+ const agentPluginDiscoveryRegistry = ( new AgentPluginDiscoveryRegistry());
50
+
51
+ export { AgentPluginDiscoveryPriority, agentPluginDiscoveryRegistry, getCanonicalPluginCommandId };
@@ -13,9 +13,9 @@ import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/
13
13
  import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
14
14
  import { IEnablementModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement";
15
15
  import { IAgentPluginRepositoryService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.service";
16
- import { IAgentPlugin, IAgentPluginDiscovery } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService";
16
+ import { IAgentPlugin, IAgentPluginDiscovery } from "./agentPluginService.js";
17
17
  import { IAgentPluginService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService.service";
18
- import { IMarketplacePlugin } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService";
18
+ import { IMarketplacePlugin } from "./pluginMarketplaceService.js";
19
19
  import { IPluginMarketplaceService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.service";
20
20
  export { shellQuotePluginRootInCommand, resolveMcpServersMap, convertBareEnvVarsToVsCodeSyntax } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentPlugins/common/pluginParsers";
21
21
  export declare class AgentPluginService extends Disposable implements IAgentPluginService {
@@ -36,9 +36,9 @@ import { ChatConfiguration } from '@codingame/monaco-vscode-api/vscode/vs/workbe
36
36
  import { EnablementModel, ContributionEnablementState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement';
37
37
  import { AUTOMATION_BLUEPRINT_FILE_SUFFIX, parseAutomationBlueprint } from '../automations/automationBlueprint.js';
38
38
  import { HookType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/hookTypes';
39
- import { getCanonicalAgentPluginCollisionGroups, isAgentPluginBlockedByPolicy, AgentPluginCollisionEnablementModel, getSortedAgentPlugins, getAgentPluginPolicyId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement';
39
+ import { getCanonicalAgentPluginCollisionGroups, isAgentPluginBlockedByPolicy, AgentPluginCollisionEnablementModel, getSortedAgentPlugins, getAgentPluginPolicyId } from './agentPluginEnablement.js';
40
40
  import { IAgentPluginRepositoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.service';
41
- import { agentPluginDiscoveryRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService';
41
+ import { agentPluginDiscoveryRegistry } from './agentPluginService.js';
42
42
  import { IPluginMarketplaceService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.service';
43
43
  import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
44
44
  import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
@@ -0,0 +1,67 @@
1
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
+ import { IObservable, ITransaction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
3
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
4
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
5
+ import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
6
+ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
7
+ /**
8
+ * In-memory representation of an installed plugin entry.
9
+ */
10
+ export interface IStoredInstalledPlugin {
11
+ readonly pluginUri: URI;
12
+ readonly marketplace: string;
13
+ readonly name?: string;
14
+ }
15
+ /**
16
+ * An observable store for installed agent plugins that is backed by a
17
+ * `installed.json` file within the agent-plugins directory. This makes
18
+ * the installed-plugin manifest discoverable by external tools (CLIs,
19
+ * other editors, etc.) without depending on VS Code internals.
20
+ *
21
+ * The on-disk format stores only the plugin URI (as a string), marketplace
22
+ * identifier, and plugin name. Full plugin metadata (description, source
23
+ * descriptor, etc.) is read from marketplace data by the discovery layer -
24
+ * keeping a single source of truth.
25
+ *
26
+ * On construction the store:
27
+ * 1. Attempts to read `installed.json` from the agent-plugins directory.
28
+ * 2. If no file exists, migrates data from the legacy {@link StorageService}
29
+ * key (`chat.plugins.installed.v1`), rebasing plugin URIs from the old
30
+ * cache directory to the new agent-plugins directory.
31
+ * 3. Sets up a correlated file watcher so that external edits to
32
+ * `installed.json` are picked up automatically.
33
+ *
34
+ * Write operations update the in-memory observable synchronously and
35
+ * schedule a debounced file write so that rapid successive mutations
36
+ * (e.g. batch enables) are coalesced into a single I/O operation.
37
+ */
38
+ export declare class FileBackedInstalledPluginsStore extends Disposable {
39
+ private readonly _agentPluginsHome;
40
+ private readonly _oldCacheRoot;
41
+ private readonly _fileService;
42
+ private readonly _logService;
43
+ private readonly _storageService;
44
+ private readonly _installed;
45
+ private readonly _fileUri;
46
+ private readonly _writeDelayer;
47
+ private _suppressFileWatch;
48
+ private _initialized;
49
+ readonly value: IObservable<readonly IStoredInstalledPlugin[]>;
50
+ constructor(_agentPluginsHome: URI, _oldCacheRoot: URI | undefined, _fileService: IFileService, _logService: ILogService, _storageService: IStorageService);
51
+ get(): readonly IStoredInstalledPlugin[];
52
+ set(newValue: readonly IStoredInstalledPlugin[], tx: ITransaction | undefined): void;
53
+ private _initialize;
54
+ private _readFromFile;
55
+ private _scheduleWrite;
56
+ private _writeToFile;
57
+ private _setupFileWatcher;
58
+ private _onFileChanged;
59
+ private _setValue;
60
+ private _migrateFromStorage;
61
+ /**
62
+ * If the plugin URI was under the old cache root, rebase it to the
63
+ * new agent-plugins directory. Otherwise, return `undefined` to keep
64
+ * the original.
65
+ */
66
+ private _rebasePluginUri;
67
+ }
@@ -0,0 +1,195 @@
1
+
2
+ import { ThrottledDelayer, RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
3
+ import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
4
+ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
+ import { revive } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshalling';
6
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
7
+ import { joinPath, isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
8
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
9
+ import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
10
+ import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
11
+
12
+ const INSTALLED_JSON_FILENAME = "installed.json";
13
+ const INSTALLED_JSON_VERSION = 1;
14
+ const LEGACY_INSTALLED_PLUGINS_STORAGE_KEY = "chat.plugins.installed.v1";
15
+ const LEGACY_MARKETPLACE_INDEX_STORAGE_KEY = "chat.plugins.marketplaces.index.v1";
16
+ class FileBackedInstalledPluginsStore extends Disposable {
17
+ constructor(
18
+ _agentPluginsHome,
19
+ _oldCacheRoot,
20
+ _fileService,
21
+ _logService,
22
+ _storageService
23
+ ) {
24
+ super();
25
+ this._agentPluginsHome = _agentPluginsHome;
26
+ this._oldCacheRoot = _oldCacheRoot;
27
+ this._fileService = _fileService;
28
+ this._logService = _logService;
29
+ this._storageService = _storageService;
30
+ this._installed = observableValue("file/installed.json", []);
31
+ this._suppressFileWatch = false;
32
+ this._initialized = false;
33
+ this.value = this._installed;
34
+ this._fileUri = joinPath(_agentPluginsHome, INSTALLED_JSON_FILENAME);
35
+ this._writeDelayer = this._register(( new ThrottledDelayer(100)));
36
+ void this._initialize();
37
+ }
38
+ get() {
39
+ return this._installed.get();
40
+ }
41
+ set(newValue, tx) {
42
+ this._setValue(newValue, tx, true);
43
+ }
44
+ async _initialize() {
45
+ try {
46
+ const read = await this._readFromFile();
47
+ if (read !== undefined) {
48
+ this._setValue(read, undefined, false);
49
+ } else {
50
+ await this._migrateFromStorage();
51
+ }
52
+ } catch (error) {
53
+ this._logService.error("[FileBackedInstalledPluginsStore] Initialization failed", error);
54
+ }
55
+ this._initialized = true;
56
+ this._setupFileWatcher();
57
+ }
58
+ async _readFromFile() {
59
+ try {
60
+ const exists = await this._fileService.exists(this._fileUri);
61
+ if (!exists) {
62
+ return undefined;
63
+ }
64
+ const content = await this._fileService.readFile(this._fileUri);
65
+ const json = JSON.parse(( content.value.toString()));
66
+ if (!json || !Array.isArray(json.installed)) {
67
+ this._logService.warn(
68
+ "[FileBackedInstalledPluginsStore] installed.json has unexpected format, ignoring"
69
+ );
70
+ return undefined;
71
+ }
72
+ return ( json.installed.filter(
73
+ entry => typeof entry.pluginUri === "string" && typeof entry.marketplace === "string"
74
+ ).map(entry => ({
75
+ pluginUri: ( URI.parse(entry.pluginUri)),
76
+ marketplace: entry.marketplace,
77
+ name: typeof entry.name === "string" ? entry.name : undefined
78
+ })));
79
+ } catch {
80
+ return undefined;
81
+ }
82
+ }
83
+ _scheduleWrite() {
84
+ void this._writeDelayer.trigger(async () => {
85
+ await this._writeToFile();
86
+ });
87
+ }
88
+ async _writeToFile() {
89
+ const entries = ( this.get().map(e => ({
90
+ pluginUri: ( e.pluginUri.toString()),
91
+ marketplace: e.marketplace,
92
+ ...(e.name ? {
93
+ name: e.name
94
+ } : {})
95
+ })));
96
+ const data = {
97
+ version: INSTALLED_JSON_VERSION,
98
+ installed: entries
99
+ };
100
+ try {
101
+ this._suppressFileWatch = true;
102
+ const content = JSON.stringify(data, undefined, "\t");
103
+ await this._fileService.createFolder(this._agentPluginsHome);
104
+ await this._fileService.writeFile(this._fileUri, VSBuffer.fromString(content));
105
+ return true;
106
+ } catch (error) {
107
+ this._logService.error("[FileBackedInstalledPluginsStore] Failed to write installed.json", error);
108
+ return false;
109
+ } finally {
110
+ this._suppressFileWatch = false;
111
+ }
112
+ }
113
+ _setupFileWatcher() {
114
+ if (typeof this._fileService.createWatcher !== "function") {
115
+ return;
116
+ }
117
+ const dir = this._agentPluginsHome;
118
+ const watcher = this._fileService.createWatcher(dir, {
119
+ recursive: false,
120
+ excludes: []
121
+ });
122
+ this._register(watcher);
123
+ const scheduler = this._register(( new RunOnceScheduler(() => this._onFileChanged(), 100)));
124
+ this._register(watcher.onDidChange(e => {
125
+ if (!this._suppressFileWatch && e.affects(this._fileUri)) {
126
+ scheduler.schedule();
127
+ }
128
+ }));
129
+ }
130
+ async _onFileChanged() {
131
+ const read = await this._readFromFile();
132
+ if (read !== undefined) {
133
+ this._suppressFileWatch = true;
134
+ try {
135
+ this._setValue(read, undefined, false);
136
+ } finally {
137
+ this._suppressFileWatch = false;
138
+ }
139
+ }
140
+ }
141
+ _setValue(newValue, tx, scheduleWrite) {
142
+ this._installed.set(newValue, tx);
143
+ if (scheduleWrite && this._initialized && !this._suppressFileWatch) {
144
+ this._scheduleWrite();
145
+ }
146
+ }
147
+ async _migrateFromStorage() {
148
+ const raw = this._storageService.get(LEGACY_INSTALLED_PLUGINS_STORAGE_KEY, StorageScope.APPLICATION);
149
+ if (!raw) {
150
+ return;
151
+ }
152
+ try {
153
+ const parsed = JSON.parse(raw);
154
+ if (!Array.isArray(parsed) || parsed.length === 0) {
155
+ return;
156
+ }
157
+ const migrated = ( revive(parsed).map(entry => {
158
+ const uri = URI.revive(entry.pluginUri);
159
+ const rebased = this._rebasePluginUri(uri);
160
+ return {
161
+ pluginUri: rebased ?? uri,
162
+ marketplace: entry.plugin?.marketplaceReference?.rawValue ?? "",
163
+ name: entry.plugin?.name
164
+ };
165
+ })).filter(e => !!e.marketplace);
166
+ this._logService.info(
167
+ `[FileBackedInstalledPluginsStore] Migrating ${migrated.length} plugin(s) from storage to installed.json`
168
+ );
169
+ this._setValue(migrated, undefined, false);
170
+ const didPersist = await this._writeToFile();
171
+ if (!didPersist) {
172
+ return;
173
+ }
174
+ this._storageService.remove(LEGACY_INSTALLED_PLUGINS_STORAGE_KEY, StorageScope.APPLICATION);
175
+ this._storageService.remove(LEGACY_MARKETPLACE_INDEX_STORAGE_KEY, StorageScope.APPLICATION);
176
+ } catch (error) {
177
+ this._logService.error("[FileBackedInstalledPluginsStore] Migration from storage failed", error);
178
+ }
179
+ }
180
+ _rebasePluginUri(uri) {
181
+ if (!this._oldCacheRoot) {
182
+ return undefined;
183
+ }
184
+ const oldRoot = this._oldCacheRoot;
185
+ if (!isEqual(uri, oldRoot) && uri.scheme === oldRoot.scheme && uri.path.startsWith(oldRoot.path + "/")) {
186
+ const relativePart = uri.path.substring(oldRoot.path.length);
187
+ return uri.with({
188
+ path: this._agentPluginsHome.path + relativePart
189
+ });
190
+ }
191
+ return undefined;
192
+ }
193
+ }
194
+
195
+ export { FileBackedInstalledPluginsStore };
@@ -0,0 +1,67 @@
1
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
2
+ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
3
+ export { extraKnownMarketplacesToConfigDict } from "@codingame/monaco-vscode-api/vscode/vs/base/common/managedSettings";
4
+ export declare enum MarketplaceReferenceKind {
5
+ GitHubShorthand = "githubShorthand",
6
+ GitUri = "gitUri",
7
+ LocalFileUri = "localFileUri"
8
+ }
9
+ export interface IMarketplaceReference {
10
+ readonly rawValue: string;
11
+ readonly displayLabel: string;
12
+ readonly cloneUrl: string;
13
+ readonly canonicalId: string;
14
+ readonly cacheSegments: readonly string[];
15
+ readonly kind: MarketplaceReferenceKind;
16
+ readonly ref?: string;
17
+ readonly githubRepo?: string;
18
+ readonly localRepositoryUri?: URI;
19
+ readonly autoUpdate?: boolean;
20
+ }
21
+ /**
22
+ * The two configuration layers behind plugin marketplaces:
23
+ * - `userValues` — what's stored at {@link ChatConfiguration.PluginMarketplaces}
24
+ * (default + user). Writable by the user.
25
+ * - `extraValues` — what's delivered via the `ChatExtraMarketplaces` enterprise
26
+ * policy into {@link ChatConfiguration.ExtraMarketplaces}. Read-only.
27
+ *
28
+ * Entries may be strings (`<owner>/<repo>` or git URIs) or, in the policy case,
29
+ * {@link IExtraMarketplaceObjectEntry} objects — both shapes flow through
30
+ * {@link parseMarketplaceReferences}.
31
+ */
32
+ export interface IConfiguredMarketplaces {
33
+ readonly userValues: readonly unknown[];
34
+ readonly extraValues: readonly unknown[];
35
+ readonly effectiveValues: readonly unknown[];
36
+ }
37
+ export declare function readConfiguredMarketplaces(configurationService: IConfigurationService): IConfiguredMarketplaces;
38
+ export declare function parseMarketplaceReferences(values: readonly unknown[]): IMarketplaceReference[];
39
+ /**
40
+ * Object-form marketplace entry shape, as delivered via the enterprise
41
+ * `managed_settings` policy or `.github/copilot/settings.json` workspace
42
+ * file. `name` (when present) is used as the marketplace's `displayLabel`
43
+ * so that `enabledPlugins["plugin@name"]` keys match consistently.
44
+ *
45
+ * Both the nested form (`source: { source, repo|url }`) and the flat form
46
+ * (`source: 'github', repo: ...`) are accepted.
47
+ */
48
+ export interface IExtraMarketplaceObjectEntry {
49
+ readonly name?: string;
50
+ readonly source?: string | {
51
+ readonly source?: string;
52
+ readonly repo?: string;
53
+ readonly url?: string;
54
+ readonly ref?: string;
55
+ };
56
+ readonly repo?: string;
57
+ readonly url?: string;
58
+ readonly ref?: string;
59
+ readonly autoUpdate?: boolean;
60
+ }
61
+ export declare function parseMarketplaceObjectEntry(entry: IExtraMarketplaceObjectEntry): IMarketplaceReference | undefined;
62
+ /**
63
+ * Merges two sets of marketplace references, deduplicating by canonical ID.
64
+ * The first set takes precedence when IDs collide.
65
+ */
66
+ export declare function deduplicateMarketplaceReferences(primary: readonly IMarketplaceReference[], secondary: readonly IMarketplaceReference[]): IMarketplaceReference[];
67
+ export declare function parseMarketplaceReference(value: string): IMarketplaceReference | undefined;