@codingame/monaco-vscode-chat-service-override 31.0.0 → 32.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +21 -5
  3. package/package.json +5 -5
  4. package/vscode/src/vs/base/common/defaultAccount.d.ts +69 -0
  5. package/vscode/src/vs/base/common/defaultAccount.js +12 -0
  6. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.d.ts +91 -22
  7. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.js +301 -68
  8. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.d.ts +24 -5
  9. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +89 -16
  10. package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.d.ts +17 -5
  11. package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.js +73 -10
  12. package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.d.ts +32 -6
  13. package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.js +32 -20
  14. package/vscode/src/vs/platform/agentHost/common/agentHostPermissionService.d.ts +37 -0
  15. package/vscode/src/vs/platform/agentHost/common/agentHostPermissionService.js +15 -0
  16. package/vscode/src/vs/platform/agentHost/common/agentService.d.ts +242 -201
  17. package/vscode/src/vs/platform/agentHost/common/agentService.js +3 -1
  18. package/vscode/src/vs/platform/agentHost/common/ahpJsonlLogger.d.ts +35 -0
  19. package/vscode/src/vs/platform/agentHost/common/ahpJsonlLogger.js +106 -0
  20. package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.d.ts +38 -30
  21. package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.js +2 -1
  22. package/vscode/src/vs/platform/agentHost/common/state/protocol/errors.d.ts +114 -4
  23. package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.d.ts +10 -10
  24. package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.js +52 -19
  25. package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.d.ts +42 -0
  26. package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.js +7 -0
  27. package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +42 -41
  28. package/vscode/src/vs/platform/agentHost/common/state/sessionTransport.d.ts +6 -6
  29. package/vscode/src/vs/platform/agentHost/common/transportConstants.d.ts +15 -0
  30. package/vscode/src/vs/platform/agentHost/common/transportConstants.js +6 -0
  31. package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.d.ts +4 -3
  32. package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.js +4 -3
  33. package/vscode/src/vs/platform/networkFilter/common/networkFilterService.d.ts +4 -2
  34. package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +15 -7
  35. package/vscode/src/vs/workbench/contrib/browserView/common/browserChatToolReferenceNames.d.ts +19 -0
  36. package/vscode/src/vs/workbench/contrib/browserView/common/browserChatToolReferenceNames.js +17 -0
  37. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +2 -2
  38. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.d.ts +2 -2
  39. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +16 -16
  40. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +14 -10
  41. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +64 -59
  42. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +31 -16
  44. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +18 -9
  45. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.d.ts +16 -0
  46. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +8 -8
  47. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +30 -5
  48. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
  49. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.js +8 -7
  50. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
  51. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
  52. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
  53. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +12 -12
  54. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +12 -12
  55. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +27 -18
  56. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
  57. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +11 -11
  58. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
  59. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +21 -20
  60. package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +22 -22
  61. package/vscode/src/vs/workbench/contrib/chat/browser/actions/reviewEdits.d.ts +12 -0
  62. package/vscode/src/vs/workbench/contrib/chat/browser/actions/reviewEdits.js +171 -0
  63. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.d.ts +1 -1
  64. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.js +8 -8
  65. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +4 -4
  66. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +2 -2
  67. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.d.ts +1 -1
  68. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +3 -2
  69. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +12 -10
  70. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.d.ts +28 -0
  71. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +99 -0
  72. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.d.ts +2 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.js +11 -4
  74. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +9 -3
  75. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +63 -53
  76. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +2 -0
  77. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +10 -7
  78. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +3 -3
  79. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +1 -1
  80. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +4 -4
  81. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
  82. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +5 -4
  83. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +25 -48
  84. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +17 -17
  85. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
  86. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.js +5 -0
  87. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +8 -4
  88. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +99 -39
  89. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +2 -2
  90. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +17 -30
  91. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.d.ts +78 -0
  92. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +38 -0
  93. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +35 -37
  94. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +347 -326
  95. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.d.ts +6 -2
  96. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.js +1 -11
  97. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +113 -109
  98. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +37 -15
  99. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +436 -134
  100. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +1 -1
  101. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.d.ts +2 -0
  102. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.js +52 -26
  103. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.js +7 -1
  104. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +2 -1
  105. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +13 -5
  106. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.d.ts +23 -0
  107. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.js +60 -0
  108. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.d.ts +25 -0
  109. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.js +93 -0
  110. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +9 -2
  111. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +73 -104
  112. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +272 -41
  113. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationWelcomePromptLaunchers.css +12 -2
  114. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +30 -1
  115. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +430 -185
  116. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.d.ts +5 -2
  117. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +44 -3
  118. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +480 -279
  119. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +32 -32
  120. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheDiff.d.ts +138 -0
  121. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheDiff.js +221 -0
  122. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.d.ts +84 -0
  123. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.js +1216 -0
  124. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +6 -6
  125. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.d.ts +2 -1
  126. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +32 -4
  127. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
  128. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +26 -19
  129. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +7 -7
  130. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +4 -4
  131. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +7 -7
  132. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +28 -25
  133. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +13 -13
  134. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
  135. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +25 -24
  136. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +8 -8
  137. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +23 -23
  138. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.d.ts +2 -1
  139. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +68 -33
  140. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
  141. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.d.ts +3 -2
  142. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.js +1 -0
  143. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/media/chatDebug.css +650 -6
  144. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +2 -2
  145. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +46 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +533 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +29 -0
  148. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +390 -0
  149. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +3 -3
  150. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.d.ts +101 -0
  151. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +509 -0
  152. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +2 -2
  153. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +18 -3
  154. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +1 -1
  155. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +11 -11
  156. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +3 -2
  157. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +130 -0
  158. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +276 -0
  159. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
  160. package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +1 -1
  161. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +8 -7
  162. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +2 -2
  163. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +1 -7
  164. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +6 -87
  165. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +1 -1
  166. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +116 -182
  167. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +12 -39
  168. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +3 -3
  169. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +31 -31
  170. package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
  171. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +61 -41
  172. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +10 -10
  173. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +6 -6
  174. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +27 -27
  175. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +2 -0
  176. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +16 -13
  177. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.d.ts +20 -0
  178. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +106 -36
  179. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +25 -7
  180. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +629 -425
  181. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.d.ts +9 -1
  182. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +105 -29
  183. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusItemService.d.ts +1 -0
  184. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +175 -148
  185. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +20 -33
  186. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +9 -2
  187. package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +4 -4
  188. package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
  189. package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +4 -4
  190. package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.js +4 -4
  191. package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
  192. package/vscode/src/vs/workbench/contrib/chat/browser/githubRepoFetcher.d.ts +58 -0
  193. package/vscode/src/vs/workbench/contrib/chat/browser/githubRepoFetcher.js +339 -0
  194. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +1 -1
  195. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/media/planReviewFeedback.css +160 -0
  196. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorActions.d.ts +9 -0
  197. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorActions.js +123 -0
  198. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorContribution.d.ts +37 -0
  199. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorContribution.js +572 -0
  200. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackService.d.ts +36 -0
  201. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackService.js +167 -0
  202. package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.d.ts +49 -7
  203. package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +315 -19
  204. package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +45 -24
  205. package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +15 -15
  206. package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +6 -6
  207. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +6 -6
  208. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +44 -40
  209. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +5 -5
  210. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
  211. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileContributions.js +4 -1
  212. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +2 -2
  213. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
  214. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +7 -7
  215. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
  216. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +3 -3
  217. package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +20 -20
  218. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +39 -39
  219. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.d.ts +9 -1
  220. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +111 -52
  221. package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.d.ts +3 -7
  222. package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +13 -47
  223. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.d.ts +3 -2
  224. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +4 -8
  225. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolResultCompressorService.d.ts +18 -0
  226. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolResultCompressorService.js +56 -0
  227. package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.d.ts +3 -7
  228. package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +14 -52
  229. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
  230. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.d.ts +3 -1
  231. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.js +17 -2
  232. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.d.ts +2 -0
  233. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +23 -12
  234. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.d.ts +39 -0
  235. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +136 -0
  236. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletionsBase.d.ts +72 -0
  237. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletionsBase.js +56 -0
  238. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletionUtils.d.ts +7 -0
  239. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletionUtils.js +14 -1
  240. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +41 -26
  241. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +30 -12
  242. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +1 -1
  243. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +1 -1
  244. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +2 -5
  245. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +25 -6
  246. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +2 -2
  247. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +2 -2
  248. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +5 -4
  249. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +1 -0
  250. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +108 -45
  251. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.js +7 -3
  252. package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +3 -1
  253. package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.d.ts +20 -1
  254. package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +65 -26
  255. package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.d.ts +5 -3
  256. package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.js +38 -11
  257. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +17 -1
  258. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +165 -16
  259. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +1 -0
  260. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +62 -1
  261. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +18 -18
  262. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +2 -1
  263. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +5 -5
  264. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.d.ts +1 -3
  265. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +15 -21
  266. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.d.ts +1 -3
  267. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +18 -24
  268. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +4 -2
  269. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +203 -180
  270. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
  271. package/vscode/src/vs/workbench/contrib/chat/common/workingDirectory.d.ts +30 -0
  272. package/vscode/src/vs/workbench/contrib/chat/common/workingDirectory.js +35 -0
  273. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.d.ts +2 -1
  274. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js +27 -2
  275. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.d.ts +1 -1
  276. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +14 -49
  277. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +0 -16
  278. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +35 -177
  279. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +2 -8
  280. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.d.ts +1 -2
  281. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +2 -3
  282. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +4 -4
  283. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +11 -11
  284. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +14 -14
  285. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +1 -1
  286. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +13 -13
  287. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +5 -5
  288. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
  289. package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
  290. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
  291. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +20 -20
  292. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +29 -3
  293. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +129 -3
  294. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +3 -2
  295. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.d.ts +2 -1
  296. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +14 -6
  297. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
  298. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.d.ts +1 -4
  299. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +12 -38
  300. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
  301. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +4 -4
  302. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +2 -2
  303. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.d.ts +12 -7
  304. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +77 -70
  305. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +14 -14
  306. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +7 -7
  307. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +14 -14
  308. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
  309. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCompressor.d.ts +32 -0
  310. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCompressor.js +232 -0
  311. package/vscode/src/vs/workbench/services/agentHost/common/agentHostPermissionService.d.ts +83 -0
  312. package/vscode/src/vs/workbench/services/agentHost/common/agentHostPermissionService.js +243 -0
  313. package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.d.ts +0 -749
  314. package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.js +0 -14
  315. package/vscode/src/vs/platform/agentHost/common/state/sessionCapabilities.d.ts +0 -17
  316. package/vscode/src/vs/platform/agentHost/common/state/sessionCapabilities.js +0 -5
  317. package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.d.ts +0 -40
  318. package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.js +0 -14
  319. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.d.ts +0 -61
  320. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +0 -638
  321. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +0 -131
  322. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +0 -363
  323. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +0 -24
  324. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.js +0 -306
  325. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.d.ts +0 -23
  326. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.js +0 -97
  327. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/media/chatStatusWidget.css +0 -57
  328. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +0 -50
  329. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +0 -29
  330. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +0 -50
  331. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +0 -78
  332. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +0 -77
  333. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +0 -120
  334. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +0 -10
  335. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +0 -23
  336. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +0 -242
  337. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +0 -1701
  338. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +0 -191
  339. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +0 -728
  340. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.d.ts +0 -14
  341. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.js +0 -69
@@ -0,0 +1,167 @@
1
+
2
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
3
+ import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
+ import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
5
+
6
+ class PlanReviewFeedbackService extends Disposable {
7
+ constructor() {
8
+ super(...arguments);
9
+ this._registrations = ( new Map());
10
+ this._onDidChangeFeedback = this._register(( new Emitter()));
11
+ this.onDidChangeFeedback = this._onDidChangeFeedback.event;
12
+ this._onDidChangeNavigation = this._register(( new Emitter()));
13
+ this.onDidChangeNavigation = this._onDidChangeNavigation.event;
14
+ this._onDidChangeRegistrations = this._register(( new Emitter()));
15
+ this.onDidChangeRegistrations = this._onDidChangeRegistrations.event;
16
+ }
17
+ registerPlanReview(planUri, onSubmit) {
18
+ const key = ( planUri.toString());
19
+ this._registrations.set(key, {
20
+ onSubmit,
21
+ items: [],
22
+ navigationAnchor: undefined
23
+ });
24
+ this._onDidChangeRegistrations.fire();
25
+ return toDisposable(() => {
26
+ this._registrations.delete(key);
27
+ this._onDidChangeRegistrations.fire();
28
+ });
29
+ }
30
+ isActivePlanReview(uri) {
31
+ return ( this._registrations.has(( uri.toString())));
32
+ }
33
+ addFeedback(planUri, line, column, text) {
34
+ const key = ( planUri.toString());
35
+ const registration = this._registrations.get(key);
36
+ if (!registration) {
37
+ return "";
38
+ }
39
+ const id = generateUuid();
40
+ registration.items.push({
41
+ id,
42
+ line,
43
+ column,
44
+ text
45
+ });
46
+ registration.items.sort((a, b) => a.line - b.line || a.column - b.column);
47
+ this._onDidChangeFeedback.fire(planUri);
48
+ return id;
49
+ }
50
+ removeFeedback(planUri, feedbackId) {
51
+ const key = ( planUri.toString());
52
+ const registration = this._registrations.get(key);
53
+ if (!registration) {
54
+ return;
55
+ }
56
+ const idx = registration.items.findIndex(item => item.id === feedbackId);
57
+ if (idx >= 0) {
58
+ registration.items.splice(idx, 1);
59
+ this._onDidChangeFeedback.fire(planUri);
60
+ }
61
+ }
62
+ updateFeedback(planUri, feedbackId, newText) {
63
+ const key = ( planUri.toString());
64
+ const registration = this._registrations.get(key);
65
+ if (!registration) {
66
+ return;
67
+ }
68
+ const idx = registration.items.findIndex(item => item.id === feedbackId);
69
+ if (idx >= 0) {
70
+ const old = registration.items[idx];
71
+ registration.items[idx] = {
72
+ id: old.id,
73
+ line: old.line,
74
+ column: old.column,
75
+ text: newText
76
+ };
77
+ this._onDidChangeFeedback.fire(planUri);
78
+ }
79
+ }
80
+ getFeedback(planUri) {
81
+ const key = ( planUri.toString());
82
+ return this._registrations.get(key)?.items ?? [];
83
+ }
84
+ clearFeedback(planUri) {
85
+ const key = ( planUri.toString());
86
+ const registration = this._registrations.get(key);
87
+ if (!registration || registration.items.length === 0) {
88
+ return;
89
+ }
90
+ registration.items.length = 0;
91
+ registration.navigationAnchor = undefined;
92
+ this._onDidChangeFeedback.fire(planUri);
93
+ }
94
+ getNextFeedback(planUri, next) {
95
+ const key = ( planUri.toString());
96
+ const registration = this._registrations.get(key);
97
+ if (!registration || registration.items.length === 0) {
98
+ return undefined;
99
+ }
100
+ const items = registration.items;
101
+ const anchorIdx = registration.navigationAnchor ? items.findIndex(item => item.id === registration.navigationAnchor) : -1;
102
+ let targetIdx;
103
+ if (anchorIdx === -1) {
104
+ targetIdx = next ? 0 : items.length - 1;
105
+ } else {
106
+ targetIdx = next ? (anchorIdx + 1) % items.length : (anchorIdx - 1 + items.length) % items.length;
107
+ }
108
+ const target = items[targetIdx];
109
+ this.setNavigationAnchor(planUri, target.id);
110
+ return target;
111
+ }
112
+ getNavigationBearing(planUri) {
113
+ const key = ( planUri.toString());
114
+ const registration = this._registrations.get(key);
115
+ if (!registration) {
116
+ return {
117
+ activeIdx: -1,
118
+ totalCount: 0
119
+ };
120
+ }
121
+ const totalCount = registration.items.length;
122
+ if (!registration.navigationAnchor) {
123
+ return {
124
+ activeIdx: -1,
125
+ totalCount
126
+ };
127
+ }
128
+ const activeIdx = registration.items.findIndex(item => item.id === registration.navigationAnchor);
129
+ return {
130
+ activeIdx,
131
+ totalCount
132
+ };
133
+ }
134
+ setNavigationAnchor(planUri, itemId) {
135
+ const key = ( planUri.toString());
136
+ const registration = this._registrations.get(key);
137
+ if (registration) {
138
+ registration.navigationAnchor = itemId;
139
+ this._onDidChangeNavigation.fire(planUri);
140
+ }
141
+ }
142
+ submitAllFeedback(planUri) {
143
+ const key = ( planUri.toString());
144
+ const registration = this._registrations.get(key);
145
+ if (!registration || registration.items.length === 0) {
146
+ return;
147
+ }
148
+ const formatted = this._formatFeedback(registration.items);
149
+ registration.onSubmit({
150
+ rejected: false,
151
+ feedback: formatted
152
+ });
153
+ }
154
+ _formatFeedback(items) {
155
+ const parts = ["Here's the feedback:"];
156
+ for (const item of items) {
157
+ if (item.column > 1) {
158
+ parts.push(`Line ${item.line}: Column ${item.column}: ${item.text}`);
159
+ } else {
160
+ parts.push(`Line ${item.line}: ${item.text}`);
161
+ }
162
+ }
163
+ return parts.join("\n");
164
+ }
165
+ }
166
+
167
+ export { PlanReviewFeedbackService };
@@ -1,18 +1,60 @@
1
1
  import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
2
  import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
4
+ import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
5
+ import { IRequestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service";
6
+ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
7
+ import { IAuthenticationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service";
3
8
  import { IPluginGitService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/pluginGitService.service";
4
9
  /**
5
- * Stub implementation of {@link IPluginGitService} that throws on
6
- * every call. On desktop the native implementation is registered instead;
7
- * this exists only so the browser layer has a default registration.
10
+ * Browser implementation of {@link IPluginGitService}.
11
+ *
12
+ * `git` is not available in the browser, so plugin contents are reconstructed
13
+ * from the GitHub REST API: `/git/trees/{sha}?recursive=1` for the listing and
14
+ * `/git/blobs/{blob_sha}` for each file's bytes. Both live on `api.github.com`,
15
+ * which is the only GitHub host that handles CORS with auth headers — the
16
+ * `/tarball/` endpoint redirects to `codeload.github.com` (no CORS) and
17
+ * `raw.githubusercontent.com` rejects the OPTIONS preflight forced by
18
+ * `Authorization: Bearer`.
19
+ *
20
+ * Only HTTPS GitHub clone URLs are supported; everything else throws an
21
+ * actionable localized error pointing at desktop or a remote agent host.
22
+ *
23
+ * Per-target metadata is persisted via {@link IStorageService} so `revParse`
24
+ * answers locally, `pull()` skips the re-download when the upstream SHA has
25
+ * not moved, and the persisted SHA feeds `CustomizationRef.nonce` for AHP
26
+ * dedupe.
8
27
  */
9
28
  export declare class BrowserPluginGitCommandService implements IPluginGitService {
29
+ private readonly _fileService;
30
+ private readonly _logService;
31
+ private readonly _requestService;
32
+ private readonly _storageService;
33
+ private readonly _authenticationService;
10
34
  readonly _serviceBrand: undefined;
11
- cloneRepository(_cloneUrl: string, _targetDir: URI, _ref?: string, _token?: CancellationToken): Promise<void>;
12
- pull(_repoDir: URI, _token?: CancellationToken): Promise<boolean>;
13
- checkout(_repoDir: URI, _treeish: string, _detached?: boolean, _token?: CancellationToken): Promise<void>;
14
- revParse(_repoDir: URI, _ref: string): Promise<string>;
35
+ private _cache;
36
+ constructor(_fileService: IFileService, _logService: ILogService, _requestService: IRequestService, _storageService: IStorageService, _authenticationService: IAuthenticationService);
37
+ cloneRepository(cloneUrl: string, targetDir: URI, ref?: string, token?: CancellationToken): Promise<void>;
38
+ pull(repoDir: URI, token?: CancellationToken): Promise<boolean>;
39
+ checkout(repoDir: URI, treeish: string, _detached?: boolean, token?: CancellationToken): Promise<void>;
40
+ revParse(repoDir: URI, ref: string): Promise<string>;
15
41
  fetch(_repoDir: URI, _token?: CancellationToken): Promise<void>;
16
42
  fetchRepository(_repoDir: URI, _token?: CancellationToken): Promise<void>;
17
43
  revListCount(_repoDir: URI, _fromRef: string, _toRef: string): Promise<number>;
44
+ private _parseOrThrow;
45
+ private _maybeLogTransientError;
46
+ /**
47
+ * Best-effort silent lookup of an existing GitHub session token. Returns
48
+ * `undefined` when no session is available; callers fall back to anonymous,
49
+ * which still works for public repos. Prefers a `repo`-scoped session when
50
+ * multiple are present (e.g. EMU + personal).
51
+ */
52
+ private _lookupGitHubToken;
53
+ private _requestGitHubToken;
54
+ private _cacheKey;
55
+ private _pruneStaleEntries;
56
+ private _ensureCacheLoaded;
57
+ private _getCacheEntry;
58
+ private _setCacheEntry;
59
+ private _persistCache;
18
60
  }
@@ -1,31 +1,327 @@
1
1
 
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
4
+ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
5
+ import { getComparisonKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
6
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
2
7
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
8
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
9
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
10
+ import { IRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service';
11
+ import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
12
+ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
13
+ import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
14
+ import { resolveGitHubRefToSha, fetchAndExtractGitHubRepo, GitHubAuthRequiredError, parseGitHubCloneUrl, GitHubRateLimitError } from './githubRepoFetcher.js';
3
15
 
4
- function notSupported() {
5
- throw ( new Error(( localize(6488, "Agent plugins are not available in this environment"))));
6
- }
7
- class BrowserPluginGitCommandService {
8
- async cloneRepository(_cloneUrl, _targetDir, _ref, _token) {
9
- notSupported();
16
+ const BROWSER_CACHE_STORAGE_KEY = "chat.plugins.browserCache.v1";
17
+ let BrowserPluginGitCommandService = class BrowserPluginGitCommandService {
18
+ constructor(
19
+ _fileService,
20
+ _logService,
21
+ _requestService,
22
+ _storageService,
23
+ _authenticationService
24
+ ) {
25
+ this._fileService = _fileService;
26
+ this._logService = _logService;
27
+ this._requestService = _requestService;
28
+ this._storageService = _storageService;
29
+ this._authenticationService = _authenticationService;
10
30
  }
11
- async pull(_repoDir, _token) {
12
- notSupported();
31
+ async cloneRepository(cloneUrl, targetDir, ref, token) {
32
+ const repo = this._parseOrThrow(cloneUrl);
33
+ const cancel = token ?? CancellationToken.None;
34
+ const cloneWithToken = async authToken => {
35
+ const sha = await resolveGitHubRefToSha(this._requestService, repo, ref, authToken, cancel);
36
+ await fetchAndExtractGitHubRepo(
37
+ this._requestService,
38
+ this._fileService,
39
+ this._logService,
40
+ repo,
41
+ sha,
42
+ targetDir,
43
+ authToken,
44
+ cancel
45
+ );
46
+ this._setCacheEntry(targetDir, {
47
+ owner: repo.owner,
48
+ repo: repo.repo,
49
+ ref,
50
+ sha,
51
+ fetchedAt: Date.now()
52
+ });
53
+ };
54
+ const initialAuthToken = await this._lookupGitHubToken();
55
+ const attempts = [async () => initialAuthToken];
56
+ if (initialAuthToken) {
57
+ attempts.push(async () => undefined);
58
+ }
59
+ attempts.push(() => this._requestGitHubToken(repo));
60
+ let lastErr;
61
+ for (const getToken of attempts) {
62
+ if (cancel.isCancellationRequested) {
63
+ throw ( new CancellationError());
64
+ }
65
+ try {
66
+ await cloneWithToken(await getToken());
67
+ return;
68
+ } catch (err) {
69
+ lastErr = err;
70
+ this._maybeLogTransientError(err, repo);
71
+ if (!(err instanceof GitHubAuthRequiredError)) {
72
+ throw err;
73
+ }
74
+ }
75
+ }
76
+ if (lastErr instanceof GitHubAuthRequiredError) {
77
+ throw ( new Error(( localize(
78
+ 6730,
79
+ "GitHub authentication is required to install '{0}'. Sign in with an account that has access to this repository, then try again.",
80
+ `${repo.owner}/${repo.repo}`
81
+ ))));
82
+ }
83
+ throw lastErr;
13
84
  }
14
- async checkout(_repoDir, _treeish, _detached, _token) {
15
- notSupported();
85
+ async pull(repoDir, token) {
86
+ const entry = this._getCacheEntry(repoDir);
87
+ if (!entry) {
88
+ throw ( new Error(`Cannot pull plugin: no cached metadata for ${( repoDir.toString())}`));
89
+ }
90
+ const cancel = token ?? CancellationToken.None;
91
+ const authToken = await this._lookupGitHubToken();
92
+ const repo = {
93
+ owner: entry.owner,
94
+ repo: entry.repo
95
+ };
96
+ try {
97
+ const newSha = await resolveGitHubRefToSha(this._requestService, repo, entry.ref, authToken, cancel);
98
+ if (newSha === entry.sha) {
99
+ return false;
100
+ }
101
+ await fetchAndExtractGitHubRepo(
102
+ this._requestService,
103
+ this._fileService,
104
+ this._logService,
105
+ repo,
106
+ newSha,
107
+ repoDir,
108
+ authToken,
109
+ cancel
110
+ );
111
+ this._setCacheEntry(repoDir, {
112
+ ...entry,
113
+ sha: newSha,
114
+ fetchedAt: Date.now()
115
+ });
116
+ return true;
117
+ } catch (err) {
118
+ this._maybeLogTransientError(err, repo);
119
+ throw err;
120
+ }
16
121
  }
17
- async revParse(_repoDir, _ref) {
18
- notSupported();
122
+ async checkout(repoDir, treeish, _detached, token) {
123
+ const entry = this._getCacheEntry(repoDir);
124
+ if (!entry) {
125
+ throw ( new Error(`Cannot checkout plugin: no cached metadata for ${( repoDir.toString())}`));
126
+ }
127
+ const cancel = token ?? CancellationToken.None;
128
+ const authToken = await this._lookupGitHubToken();
129
+ const repo = {
130
+ owner: entry.owner,
131
+ repo: entry.repo
132
+ };
133
+ const requestedRef = treeish.trim();
134
+ const isFullSha = /^[0-9a-f]{40}$/i.test(requestedRef);
135
+ const requestedSha = isFullSha ? requestedRef.toLowerCase() : await resolveGitHubRefToSha(this._requestService, repo, requestedRef, authToken, cancel);
136
+ if (requestedSha === entry.sha.toLowerCase()) {
137
+ return;
138
+ }
139
+ try {
140
+ await fetchAndExtractGitHubRepo(
141
+ this._requestService,
142
+ this._fileService,
143
+ this._logService,
144
+ repo,
145
+ requestedSha,
146
+ repoDir,
147
+ authToken,
148
+ cancel
149
+ );
150
+ this._setCacheEntry(repoDir, {
151
+ ...entry,
152
+ ref: isFullSha ? entry.ref : requestedRef,
153
+ sha: requestedSha,
154
+ fetchedAt: Date.now()
155
+ });
156
+ } catch (err) {
157
+ this._maybeLogTransientError(err, repo);
158
+ throw err;
159
+ }
19
160
  }
20
- async fetch(_repoDir, _token) {
21
- notSupported();
22
- }
23
- async fetchRepository(_repoDir, _token) {
24
- notSupported();
161
+ async revParse(repoDir, ref) {
162
+ const entry = this._getCacheEntry(repoDir);
163
+ if (!entry) {
164
+ throw ( new Error(`Cannot resolve ref: no cached metadata for ${( repoDir.toString())}`));
165
+ }
166
+ const trimmed = ref.trim();
167
+ const isFullSha = /^[0-9a-f]{40}$/i.test(trimmed);
168
+ if (isFullSha && trimmed.toLowerCase() !== entry.sha.toLowerCase()) {
169
+ throw ( new Error(
170
+ `Cannot resolve ref '${ref}' in tree-cached plugin: only HEAD/${entry.sha} is materialised`
171
+ ));
172
+ }
173
+ return entry.sha;
25
174
  }
175
+ async fetch(_repoDir, _token) {}
176
+ async fetchRepository(_repoDir, _token) {}
26
177
  async revListCount(_repoDir, _fromRef, _toRef) {
27
- notSupported();
178
+ return 0;
179
+ }
180
+ _parseOrThrow(cloneUrl) {
181
+ const parsed = parseGitHubCloneUrl(cloneUrl);
182
+ if (!parsed) {
183
+ throw ( new Error(( localize(
184
+ 6731,
185
+ "Agent plugins in the browser can only be installed from GitHub HTTPS URLs. To install '{0}', use the desktop application or connect to a remote agent host.",
186
+ cloneUrl
187
+ ))));
188
+ }
189
+ return parsed;
190
+ }
191
+ _maybeLogTransientError(err, repo) {
192
+ if (err instanceof GitHubAuthRequiredError) {
193
+ this._logService.warn(
194
+ `[BrowserPluginGitCommandService] GitHub auth required for ${repo.owner}/${repo.repo}: ${err.message}`
195
+ );
196
+ } else if (err instanceof GitHubRateLimitError) {
197
+ const wait = err.retryAfterSeconds !== undefined ? ` (retry after ${err.retryAfterSeconds}s)` : "";
198
+ this._logService.warn(
199
+ `[BrowserPluginGitCommandService] GitHub rate limit hit for ${repo.owner}/${repo.repo}${wait}: ${err.message}`
200
+ );
201
+ } else if (err instanceof Error) {
202
+ const cause = err.cause instanceof Error ? ` (cause: ${err.cause.name}: ${err.cause.message})` : "";
203
+ this._logService.error(
204
+ `[BrowserPluginGitCommandService] Clone failed for ${repo.owner}/${repo.repo}: ${err.message}${cause}`
205
+ );
206
+ }
207
+ }
208
+ async _lookupGitHubToken() {
209
+ try {
210
+ const sessions = await this._authenticationService.getSessions("github", [], {
211
+ silent: true
212
+ });
213
+ if (sessions.length === 0) {
214
+ return undefined;
215
+ }
216
+ const repoScopeSession = sessions.find(session => session.scopes.includes("repo"));
217
+ return repoScopeSession?.accessToken ?? sessions[0].accessToken;
218
+ } catch (err) {
219
+ this._logService.trace(
220
+ "[BrowserPluginGitCommandService] Silent GitHub session lookup failed:",
221
+ err
222
+ );
223
+ return undefined;
224
+ }
225
+ }
226
+ async _requestGitHubToken(repo) {
227
+ try {
228
+ const session = await this._authenticationService.createSession("github", ["repo"], {
229
+ activateImmediate: true
230
+ });
231
+ return session.accessToken;
232
+ } catch (err) {
233
+ this._logService.trace("[BrowserPluginGitCommandService] GitHub session request failed:", err);
234
+ throw ( new Error(( localize(
235
+ 6732,
236
+ "Sign in to GitHub with an account that has access to '{0}' to install this plugin.",
237
+ `${repo.owner}/${repo.repo}`
238
+ ))));
239
+ }
240
+ }
241
+ _cacheKey(targetDir) {
242
+ return getComparisonKey(targetDir, true);
243
+ }
244
+ async _pruneStaleEntries(cache, knownDirs) {
245
+ const removed = [];
246
+ await Promise.all(Array.from(knownDirs, async ([key, uri]) => {
247
+ try {
248
+ if (!(await this._fileService.exists(uri))) {
249
+ removed.push(key);
250
+ }
251
+ } catch {}
252
+ }));
253
+ if (removed.length === 0) {
254
+ return;
255
+ }
256
+ for (const key of removed) {
257
+ cache.delete(key);
258
+ }
259
+ this._logService.trace(
260
+ `[BrowserPluginGitCommandService] Pruned ${removed.length} stale cache entries`
261
+ );
262
+ this._persistCache();
263
+ }
264
+ _ensureCacheLoaded() {
265
+ if (this._cache) {
266
+ return this._cache;
267
+ }
268
+ const cache = ( new Map());
269
+ const stored = this._storageService.getObject(BROWSER_CACHE_STORAGE_KEY, StorageScope.APPLICATION);
270
+ const knownDirs = ( new Map());
271
+ if (stored) {
272
+ for (const [key, entry] of Object.entries(stored)) {
273
+ if (entry && typeof entry.sha === "string" && typeof entry.owner === "string" && typeof entry.repo === "string") {
274
+ cache.set(key, {
275
+ owner: entry.owner,
276
+ repo: entry.repo,
277
+ ref: typeof entry.ref === "string" ? entry.ref : undefined,
278
+ sha: entry.sha,
279
+ fetchedAt: typeof entry.fetchedAt === "number" ? entry.fetchedAt : 0
280
+ });
281
+ try {
282
+ knownDirs.set(key, ( URI.parse(key)));
283
+ } catch {
284
+ cache.delete(key);
285
+ }
286
+ }
287
+ }
288
+ }
289
+ this._cache = cache;
290
+ if (knownDirs.size > 0) {
291
+ this._pruneStaleEntries(cache, knownDirs).catch(err => {
292
+ this._logService.trace("[BrowserPluginGitCommandService] Cache prune failed:", err);
293
+ });
294
+ }
295
+ return cache;
296
+ }
297
+ _getCacheEntry(targetDir) {
298
+ return this._ensureCacheLoaded().get(this._cacheKey(targetDir));
299
+ }
300
+ _setCacheEntry(targetDir, entry) {
301
+ const cache = this._ensureCacheLoaded();
302
+ cache.set(this._cacheKey(targetDir), entry);
303
+ this._persistCache();
304
+ }
305
+ _persistCache() {
306
+ if (!this._cache) {
307
+ return;
308
+ }
309
+ const serialized = {};
310
+ for (const [key, entry] of this._cache) {
311
+ serialized[key] = entry;
312
+ }
313
+ if (( Object.keys(serialized)).length === 0) {
314
+ this._storageService.remove(BROWSER_CACHE_STORAGE_KEY, StorageScope.APPLICATION);
315
+ return;
316
+ }
317
+ this._storageService.store(
318
+ BROWSER_CACHE_STORAGE_KEY,
319
+ JSON.stringify(serialized),
320
+ StorageScope.APPLICATION,
321
+ StorageTarget.MACHINE
322
+ );
28
323
  }
29
- }
324
+ };
325
+ BrowserPluginGitCommandService = ( __decorate([( __param(0, IFileService)), ( __param(1, ILogService)), ( __param(2, IRequestService)), ( __param(3, IStorageService)), ( __param(4, IAuthenticationService))], BrowserPluginGitCommandService));
30
326
 
31
327
  export { BrowserPluginGitCommandService };