@codingame/monaco-vscode-mcp-service-override 26.2.2 → 28.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 (66) hide show
  1. package/index.js +8 -2
  2. package/package.json +2 -2
  3. package/vscode/src/vs/base/common/jsonRpcProtocol.d.ts +66 -0
  4. package/vscode/src/vs/base/common/jsonRpcProtocol.js +216 -0
  5. package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +1 -1
  6. package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +2 -2
  7. package/vscode/src/vs/platform/mcp/common/mcpGateway.d.ts +39 -0
  8. package/vscode/src/vs/platform/mcp/common/mcpGateway.js +6 -0
  9. package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.d.ts +3 -1
  10. package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js +12 -5
  11. package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +15 -5
  12. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
  13. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +58 -58
  14. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +27 -28
  15. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.d.ts +20 -0
  16. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js +51 -0
  17. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayToolBrokerContribution.d.ts +7 -0
  18. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayToolBrokerContribution.js +16 -0
  19. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +18 -18
  20. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +4 -4
  21. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +8 -8
  22. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +4 -1
  23. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +42 -24
  24. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +1 -1
  25. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +13 -12
  26. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
  27. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +3 -1
  28. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +2 -1
  30. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.d.ts +15 -0
  31. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.js +106 -0
  32. package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
  33. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.d.ts +39 -0
  34. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.js +302 -0
  35. package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +25 -17
  36. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +3 -1
  37. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +27 -18
  38. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
  39. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.d.ts +1 -0
  40. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +28 -18
  41. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.d.ts +47 -0
  42. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +385 -0
  43. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +6 -1
  44. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +61 -3
  45. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +4 -20
  46. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +95 -145
  47. package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
  48. package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.d.ts +1 -1
  49. package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js +2 -2
  50. package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.d.ts +0 -42
  51. package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.js +0 -105
  52. package/vscode/src/vs/platform/mcp/common/mcpManagementService.d.ts +0 -130
  53. package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +0 -665
  54. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.d.ts +0 -259
  55. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +0 -1225
  56. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +0 -72
  57. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +0 -996
  58. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.d.ts +0 -17
  59. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +0 -49
  60. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.d.ts +0 -5
  61. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +0 -12
  62. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +0 -88
  63. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +0 -464
  64. package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServerEditor.css +0 -94
  65. package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.d.ts +0 -87
  66. package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.js +0 -702
@@ -1,996 +0,0 @@
1
-
2
- import { registerCss } from '@codingame/monaco-vscode-api/css';
3
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
- import * as mcpServerEditor from './media/mcpServerEditor.css';
5
- import { append, $, setParentFlowTo, clearNode } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
6
- import { ActionBar } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionbar';
7
- import { getDefaultHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
8
- import { DomScrollableElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
9
- import { Action } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
10
- import { insert } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
11
- import { Cache } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cache';
12
- import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
13
- import { isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
14
- import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
15
- import { Disposable, dispose, MutableDisposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
16
- import { matchesScheme, Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
17
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
18
- import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
19
- import { TokenizationRegistry } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
20
- import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
21
- import { generateTokensCSSForColorMap } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/supports/tokenization';
22
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
23
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
24
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
25
- import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
26
- import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
27
- import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
28
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
29
- import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
30
- import { EditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/editor/editorPane';
31
- import { renderMarkdownDocument, DEFAULT_MARKDOWN_STYLES } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer';
32
- import { IWebviewService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/webview/browser/webview.service';
33
- import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
34
- import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
35
- import { McpServerInstallState, McpServerContainers } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
36
- import { IMcpWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
37
- import { McpServerIconWidget, McpServerScopeBadgeWidget, PublisherWidget, StarredWidget, LicenseWidget, McpServerStatusWidget, McpServerWidget, onClick } from './mcpServerWidgets.js';
38
- import { InstallAction, InstallingLabelAction, ButtonWithDropDownExtensionAction, UninstallAction, InstallInWorkspaceAction, InstallInRemoteAction, ManageMcpServerAction, DropDownAction, ButtonWithDropdownExtensionActionViewItem, McpServerStatusAction } from './mcpServerActions.js';
39
- import { McpServerType } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpPlatformTypes';
40
- import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
41
- import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
42
- import { getMcpGalleryManifestResourceUri, McpGalleryResourceType } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest';
43
- import { IMcpGalleryManifestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest.service';
44
- import { fromNow } from '@codingame/monaco-vscode-api/vscode/vs/base/common/date';
45
- import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
46
-
47
- var McpServerEditor_1;
48
- registerCss(mcpServerEditor);
49
- var McpServerEditorTab;
50
- (function(McpServerEditorTab) {
51
- McpServerEditorTab["Readme"] = "readme";
52
- McpServerEditorTab["Configuration"] = "configuration";
53
- McpServerEditorTab["Manifest"] = "manifest";
54
- })(McpServerEditorTab || (McpServerEditorTab = {}));
55
- class NavBar extends Disposable {
56
- get onChange() {
57
- return this._onChange.event;
58
- }
59
- get currentId() {
60
- return this._currentId;
61
- }
62
- constructor(container) {
63
- super();
64
- this._onChange = this._register(( new Emitter()));
65
- this._currentId = null;
66
- const element = append(container, $(".navbar"));
67
- this.actions = [];
68
- this.actionbar = this._register(( new ActionBar(element)));
69
- }
70
- push(id, label, tooltip, index) {
71
- const action = ( new Action(id, label, undefined, true, () => this.update(id, true)));
72
- action.tooltip = tooltip;
73
- if (typeof index === "number") {
74
- this.actions.splice(index, 0, action);
75
- } else {
76
- this.actions.push(action);
77
- }
78
- this.actionbar.push(action, {
79
- index
80
- });
81
- if (this.actions.length === 1) {
82
- this.update(id);
83
- }
84
- }
85
- remove(id) {
86
- const index = this.actions.findIndex(action => action.id === id);
87
- if (index !== -1) {
88
- this.actions.splice(index, 1);
89
- this.actionbar.pull(index);
90
- if (this._currentId === id) {
91
- this.switch(this.actions[0]?.id);
92
- }
93
- }
94
- }
95
- clear() {
96
- this.actions = dispose(this.actions);
97
- this.actionbar.clear();
98
- }
99
- switch(id) {
100
- const action = this.actions.find(action => action.id === id);
101
- if (action) {
102
- action.run();
103
- return true;
104
- }
105
- return false;
106
- }
107
- has(id) {
108
- return ( this.actions.some(action => action.id === id));
109
- }
110
- update(id, focus) {
111
- this._currentId = id;
112
- this._onChange.fire({
113
- id,
114
- focus: !!focus
115
- });
116
- this.actions.forEach(a => a.checked = a.id === id);
117
- }
118
- }
119
- var WebviewIndex;
120
- (function(WebviewIndex) {
121
- WebviewIndex[WebviewIndex["Readme"] = 0] = "Readme";
122
- WebviewIndex[WebviewIndex["Changelog"] = 1] = "Changelog";
123
- })(WebviewIndex || (WebviewIndex = {}));
124
- let McpServerEditor = class McpServerEditor extends EditorPane {
125
- static {
126
- McpServerEditor_1 = this;
127
- }
128
- static {
129
- this.ID = "workbench.editor.mcpServer";
130
- }
131
- constructor(
132
- group,
133
- telemetryService,
134
- instantiationService,
135
- themeService,
136
- notificationService,
137
- openerService,
138
- storageService,
139
- extensionService,
140
- webviewService,
141
- languageService,
142
- contextKeyService,
143
- mcpWorkbenchService,
144
- hoverService,
145
- contextMenuService
146
- ) {
147
- super(
148
- McpServerEditor_1.ID,
149
- group,
150
- telemetryService,
151
- themeService,
152
- storageService
153
- );
154
- this.instantiationService = instantiationService;
155
- this.notificationService = notificationService;
156
- this.openerService = openerService;
157
- this.extensionService = extensionService;
158
- this.webviewService = webviewService;
159
- this.languageService = languageService;
160
- this.contextKeyService = contextKeyService;
161
- this.mcpWorkbenchService = mcpWorkbenchService;
162
- this.hoverService = hoverService;
163
- this.contextMenuService = contextMenuService;
164
- this._scopedContextKeyService = this._register(( new MutableDisposable()));
165
- this.initialScrollProgress = ( new Map());
166
- this.currentIdentifier = "";
167
- this.layoutParticipants = [];
168
- this.contentDisposables = this._register(( new DisposableStore()));
169
- this.transientDisposables = this._register(( new DisposableStore()));
170
- this.activeElement = null;
171
- this.mcpServerReadme = null;
172
- this.mcpServerManifest = null;
173
- }
174
- get scopedContextKeyService() {
175
- return this._scopedContextKeyService.value;
176
- }
177
- createEditor(parent) {
178
- const root = append(parent, $(".extension-editor.mcp-server-editor"));
179
- this._scopedContextKeyService.value = this.contextKeyService.createScoped(root);
180
- this._scopedContextKeyService.value.createKey("inExtensionEditor", true);
181
- root.tabIndex = 0;
182
- root.style.outline = "none";
183
- root.setAttribute("role", "document");
184
- const header = append(root, $(".header"));
185
- const iconContainer = append(header, $(".icon-container"));
186
- const iconWidget = this.instantiationService.createInstance(McpServerIconWidget, iconContainer);
187
- const scopeWidget = this.instantiationService.createInstance(McpServerScopeBadgeWidget, iconContainer);
188
- const details = append(header, $(".details"));
189
- const title = append(details, $(".title"));
190
- const name = append(title, $("span.name.clickable", {
191
- role: "heading",
192
- tabIndex: 0
193
- }));
194
- this._register(
195
- this.hoverService.setupManagedHover(getDefaultHoverDelegate("mouse"), name, ( localize(9429, "Extension name")))
196
- );
197
- const subtitle = append(details, $(".subtitle"));
198
- const subTitleEntryContainers = [];
199
- const publisherContainer = append(subtitle, $(".subtitle-entry"));
200
- subTitleEntryContainers.push(publisherContainer);
201
- const publisherWidget = this.instantiationService.createInstance(PublisherWidget, publisherContainer, false);
202
- const starredContainer = append(subtitle, $(".subtitle-entry"));
203
- subTitleEntryContainers.push(starredContainer);
204
- const installCountWidget = this.instantiationService.createInstance(StarredWidget, starredContainer, false);
205
- const licenseContainer = append(subtitle, $(".subtitle-entry"));
206
- subTitleEntryContainers.push(licenseContainer);
207
- const licenseWidget = this.instantiationService.createInstance(LicenseWidget, licenseContainer);
208
- const widgets = [
209
- iconWidget,
210
- publisherWidget,
211
- installCountWidget,
212
- scopeWidget,
213
- licenseWidget
214
- ];
215
- const description = append(details, $(".description"));
216
- const actions = [
217
- this.instantiationService.createInstance(InstallAction, false),
218
- this.instantiationService.createInstance(InstallingLabelAction),
219
- this.instantiationService.createInstance(
220
- ButtonWithDropDownExtensionAction,
221
- "extensions.uninstall",
222
- UninstallAction.CLASS,
223
- [[
224
- this.instantiationService.createInstance(UninstallAction),
225
- this.instantiationService.createInstance(InstallInWorkspaceAction, false),
226
- this.instantiationService.createInstance(InstallInRemoteAction, false)
227
- ]]
228
- ),
229
- this.instantiationService.createInstance(ManageMcpServerAction, true)
230
- ];
231
- const actionsAndStatusContainer = append(details, $(".actions-status-container.mcp-server-actions"));
232
- const actionBar = this._register(( new ActionBar(actionsAndStatusContainer, {
233
- actionViewItemProvider: (action, options) => {
234
- if (action instanceof DropDownAction) {
235
- return action.createActionViewItem(options);
236
- }
237
- if (action instanceof ButtonWithDropDownExtensionAction) {
238
- return ( new ButtonWithDropdownExtensionActionViewItem(action, {
239
- ...options,
240
- icon: true,
241
- label: true,
242
- menuActionsOrProvider: {
243
- getActions: () => action.menuActions
244
- },
245
- menuActionClassNames: action.menuActionClassNames
246
- }, this.contextMenuService));
247
- }
248
- return undefined;
249
- },
250
- focusOnlyEnabledItems: true
251
- })));
252
- actionBar.push(actions, {
253
- icon: true,
254
- label: true
255
- });
256
- actionBar.setFocusable(true);
257
- this._register(Event.any(...( actions.map(a => Event.filter(a.onDidChange, e => e.enabled !== undefined))))(() => {
258
- actionBar.setFocusable(false);
259
- actionBar.setFocusable(true);
260
- }));
261
- const otherContainers = [];
262
- const mcpServerStatusAction = this.instantiationService.createInstance(McpServerStatusAction);
263
- const mcpServerStatusWidget = this._register(this.instantiationService.createInstance(
264
- McpServerStatusWidget,
265
- append(actionsAndStatusContainer, $(".status")),
266
- mcpServerStatusAction
267
- ));
268
- this._register(Event.any(mcpServerStatusWidget.onDidRender)(() => {
269
- if (this.dimension) {
270
- this.layout(this.dimension);
271
- }
272
- }));
273
- otherContainers.push(mcpServerStatusAction, new (class extends McpServerWidget {
274
- render() {
275
- actionsAndStatusContainer.classList.toggle(
276
- "list-layout",
277
- this.mcpServer?.installState === McpServerInstallState.Installed
278
- );
279
- }
280
- })());
281
- const mcpServerContainers = this.instantiationService.createInstance(McpServerContainers, [...actions, ...widgets, ...otherContainers]);
282
- for (const disposable of [...actions, ...widgets, ...otherContainers, mcpServerContainers]) {
283
- this._register(disposable);
284
- }
285
- const onError = Event.chain(actionBar.onDidRun, $ => ( $.map((
286
- {
287
- error
288
- }
289
- ) => error)).filter(error => !!error));
290
- this._register(onError(this.onError, this));
291
- const body = append(root, $(".body"));
292
- const navbar = ( new NavBar(body));
293
- const content = append(body, $(".content"));
294
- content.id = generateUuid();
295
- this.template = {
296
- content,
297
- description,
298
- header,
299
- name,
300
- navbar,
301
- actionsAndStatusContainer,
302
- actionBar: actionBar,
303
- set mcpServer(mcpServer) {
304
- mcpServerContainers.mcpServer = mcpServer;
305
- let lastNonEmptySubtitleEntryContainer;
306
- for (const subTitleEntryElement of subTitleEntryContainers) {
307
- subTitleEntryElement.classList.remove("last-non-empty");
308
- if (subTitleEntryElement.children.length > 0) {
309
- lastNonEmptySubtitleEntryContainer = subTitleEntryElement;
310
- }
311
- }
312
- if (lastNonEmptySubtitleEntryContainer) {
313
- lastNonEmptySubtitleEntryContainer.classList.add("last-non-empty");
314
- }
315
- }
316
- };
317
- }
318
- async setInput(input, options, context, token) {
319
- await super.setInput(input, options, context, token);
320
- if (this.template) {
321
- await this.render(input.mcpServer, this.template, !!options?.preserveFocus);
322
- }
323
- }
324
- async render(mcpServer, template, preserveFocus) {
325
- this.activeElement = null;
326
- this.transientDisposables.clear();
327
- const token = this.transientDisposables.add(( new CancellationTokenSource())).token;
328
- this.mcpServerReadme = ( new Cache(() => mcpServer.getReadme(token)));
329
- this.mcpServerManifest = ( new Cache(() => mcpServer.getManifest(token)));
330
- template.mcpServer = mcpServer;
331
- template.name.textContent = mcpServer.label;
332
- template.name.classList.toggle("clickable", !!mcpServer.gallery?.webUrl);
333
- template.description.textContent = mcpServer.description;
334
- if (mcpServer.gallery?.webUrl) {
335
- this.transientDisposables.add(onClick(template.name, () => this.openerService.open(( URI.parse(mcpServer.gallery?.webUrl)))));
336
- }
337
- this.renderNavbar(mcpServer, template, preserveFocus);
338
- }
339
- setOptions(options) {
340
- super.setOptions(options);
341
- if (options?.tab) {
342
- this.template?.navbar.switch(options.tab);
343
- }
344
- }
345
- renderNavbar(extension, template, preserveFocus) {
346
- template.content.innerText = "";
347
- template.navbar.clear();
348
- if (this.currentIdentifier !== extension.id) {
349
- this.initialScrollProgress.clear();
350
- this.currentIdentifier = extension.id;
351
- }
352
- if (extension.readmeUrl || extension.gallery?.readme) {
353
- template.navbar.push(McpServerEditorTab.Readme, ( localize(9430, "Details")), ( localize(9431, "Extension details, rendered from the extension's 'README.md' file")));
354
- }
355
- if (extension.gallery || extension.local?.manifest) {
356
- template.navbar.push(McpServerEditorTab.Manifest, ( localize(9432, "Manifest")), ( localize(9433, "Server manifest details")));
357
- }
358
- if (extension.config) {
359
- template.navbar.push(McpServerEditorTab.Configuration, ( localize(9434, "Configuration")), ( localize(9435, "Server configuration details")));
360
- }
361
- this.transientDisposables.add(this.mcpWorkbenchService.onChange(e => {
362
- if (e === extension) {
363
- if (e.config && !( template.navbar.has(McpServerEditorTab.Configuration))) {
364
- template.navbar.push(McpServerEditorTab.Configuration, ( localize(9434, "Configuration")), ( localize(9435, "Server configuration details")), extension.readmeUrl ? 1 : 0);
365
- }
366
- if (!e.config && ( template.navbar.has(McpServerEditorTab.Configuration))) {
367
- template.navbar.remove(McpServerEditorTab.Configuration);
368
- }
369
- }
370
- }));
371
- if (this.options?.tab) {
372
- template.navbar.switch(this.options.tab);
373
- }
374
- if (template.navbar.currentId) {
375
- this.onNavbarChange(extension, {
376
- id: template.navbar.currentId,
377
- focus: !preserveFocus
378
- }, template);
379
- }
380
- template.navbar.onChange(
381
- e => this.onNavbarChange(extension, e, template),
382
- this,
383
- this.transientDisposables
384
- );
385
- }
386
- clearInput() {
387
- this.contentDisposables.clear();
388
- this.transientDisposables.clear();
389
- super.clearInput();
390
- }
391
- focus() {
392
- super.focus();
393
- this.activeElement?.focus();
394
- }
395
- showFind() {
396
- this.activeWebview?.showFind();
397
- }
398
- runFindAction(previous) {
399
- this.activeWebview?.runFindAction(previous);
400
- }
401
- get activeWebview() {
402
- if (!this.activeElement || !this.activeElement.runFindAction) {
403
- return undefined;
404
- }
405
- return this.activeElement;
406
- }
407
- onNavbarChange(
408
- extension,
409
- {
410
- id,
411
- focus
412
- },
413
- template
414
- ) {
415
- this.contentDisposables.clear();
416
- template.content.innerText = "";
417
- this.activeElement = null;
418
- if (id) {
419
- const cts = ( new CancellationTokenSource());
420
- this.contentDisposables.add(toDisposable(() => cts.dispose(true)));
421
- this.open(id, extension, template, cts.token).then(activeElement => {
422
- if (cts.token.isCancellationRequested) {
423
- return;
424
- }
425
- this.activeElement = activeElement;
426
- if (focus) {
427
- this.focus();
428
- }
429
- });
430
- }
431
- }
432
- open(id, extension, template, token) {
433
- switch (id) {
434
- case McpServerEditorTab.Configuration:
435
- return this.openConfiguration(extension, template, token);
436
- case McpServerEditorTab.Readme:
437
- return this.openDetails(extension, template, token);
438
- case McpServerEditorTab.Manifest:
439
- return extension.readmeUrl ? this.openManifest(extension, template.content, token) : this.openManifestWithAdditionalDetails(extension, template, token);
440
- }
441
- return Promise.resolve(null);
442
- }
443
- async openMarkdown(
444
- extension,
445
- cacheResult,
446
- noContentCopy,
447
- container,
448
- webviewIndex,
449
- title,
450
- token
451
- ) {
452
- try {
453
- const body = await this.renderMarkdown(extension, cacheResult, container, token);
454
- if (token.isCancellationRequested) {
455
- return Promise.resolve(null);
456
- }
457
- const webview = this.contentDisposables.add(this.webviewService.createWebviewOverlay({
458
- title,
459
- options: {
460
- enableFindWidget: true,
461
- tryRestoreScrollPosition: true,
462
- disableServiceWorker: true
463
- },
464
- contentOptions: {},
465
- extension: undefined
466
- }));
467
- webview.initialScrollProgress = this.initialScrollProgress.get(webviewIndex) || 0;
468
- webview.claim(this, this.window, this.scopedContextKeyService);
469
- setParentFlowTo(webview.container, container);
470
- webview.layoutWebviewOverElement(container);
471
- webview.setHtml(body);
472
- webview.claim(this, this.window, undefined);
473
- this.contentDisposables.add(webview.onDidFocus(() => this._onDidFocus?.fire()));
474
- this.contentDisposables.add(webview.onDidScroll(
475
- () => this.initialScrollProgress.set(webviewIndex, webview.initialScrollProgress)
476
- ));
477
- const removeLayoutParticipant = insert(this.layoutParticipants, {
478
- layout: () => {
479
- webview.layoutWebviewOverElement(container);
480
- }
481
- });
482
- this.contentDisposables.add(toDisposable(removeLayoutParticipant));
483
- let isDisposed = false;
484
- this.contentDisposables.add(toDisposable(() => {
485
- isDisposed = true;
486
- }));
487
- this.contentDisposables.add(this.themeService.onDidColorThemeChange(async () => {
488
- const body = await this.renderMarkdown(extension, cacheResult, container);
489
- if (!isDisposed) {
490
- webview.setHtml(body);
491
- }
492
- }));
493
- this.contentDisposables.add(webview.onDidClickLink(link => {
494
- if (!link) {
495
- return;
496
- }
497
- if (matchesScheme(link, Schemas.http) || matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.mailto)) {
498
- this.openerService.open(link);
499
- }
500
- }));
501
- return webview;
502
- } catch (e) {
503
- const p = append(container, $("p.nocontent"));
504
- p.textContent = noContentCopy;
505
- return p;
506
- }
507
- }
508
- async renderMarkdown(extension, cacheResult, container, token) {
509
- const contents = await this.loadContents(() => cacheResult, container);
510
- if (token?.isCancellationRequested) {
511
- return "";
512
- }
513
- const content = await renderMarkdownDocument(contents, this.extensionService, this.languageService, {}, token);
514
- if (token?.isCancellationRequested) {
515
- return "";
516
- }
517
- return this.renderBody(content);
518
- }
519
- renderBody(body) {
520
- const nonce = generateUuid();
521
- const colorMap = TokenizationRegistry.getColorMap();
522
- const css = colorMap ? generateTokensCSSForColorMap(colorMap) : "";
523
- return `<!DOCTYPE html>
524
- <html>
525
- <head>
526
- <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
527
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${nonce}';">
528
- <style nonce="${nonce}">
529
- ${DEFAULT_MARKDOWN_STYLES}
530
-
531
- /* prevent scroll-to-top button from blocking the body text */
532
- body {
533
- padding-bottom: 75px;
534
- }
535
-
536
- #scroll-to-top {
537
- position: fixed;
538
- width: 32px;
539
- height: 32px;
540
- right: 25px;
541
- bottom: 25px;
542
- background-color: var(--vscode-button-secondaryBackground);
543
- border-color: var(--vscode-button-border);
544
- border-radius: 50%;
545
- cursor: pointer;
546
- box-shadow: 1px 1px 1px rgba(0,0,0,.25);
547
- outline: none;
548
- display: flex;
549
- justify-content: center;
550
- align-items: center;
551
- }
552
-
553
- #scroll-to-top:hover {
554
- background-color: var(--vscode-button-secondaryHoverBackground);
555
- box-shadow: 2px 2px 2px rgba(0,0,0,.25);
556
- }
557
-
558
- body.vscode-high-contrast #scroll-to-top {
559
- border-width: 2px;
560
- border-style: solid;
561
- box-shadow: none;
562
- }
563
-
564
- #scroll-to-top span.icon::before {
565
- content: "";
566
- display: block;
567
- background: var(--vscode-button-secondaryForeground);
568
- /* Chevron up icon */
569
- webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
570
- -webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
571
- width: 16px;
572
- height: 16px;
573
- }
574
- ${css}
575
- </style>
576
- </head>
577
- <body>
578
- <a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
579
- ${body}
580
- </body>
581
- </html>`;
582
- }
583
- async openDetails(extension, template, token) {
584
- const details = append(template.content, $(".details"));
585
- const readmeContainer = append(details, $(".content-container"));
586
- const additionalDetailsContainer = append(details, $(".additional-details-container"));
587
- const layout = () => details.classList.toggle("narrow", this.dimension && this.dimension.width < 500);
588
- layout();
589
- this.contentDisposables.add(toDisposable(insert(this.layoutParticipants, {
590
- layout
591
- })));
592
- const activeElement = await this.openMarkdown(extension, this.mcpServerReadme.get(), ( localize(9436, "No README available.")), readmeContainer, WebviewIndex.Readme, ( localize(9437, "Readme")), token);
593
- this.renderAdditionalDetails(additionalDetailsContainer, extension);
594
- return activeElement;
595
- }
596
- async openConfiguration(mcpServer, template, token) {
597
- const configContainer = append(template.content, $(".configuration"));
598
- const content = $("div", {
599
- class: "configuration-content"
600
- });
601
- this.renderConfigurationDetails(content, mcpServer);
602
- const scrollableContent = ( new DomScrollableElement(content, {}));
603
- const layout = () => scrollableContent.scanDomNode();
604
- this.contentDisposables.add(toDisposable(insert(this.layoutParticipants, {
605
- layout
606
- })));
607
- append(configContainer, scrollableContent.getDomNode());
608
- return {
609
- focus: () => content.focus()
610
- };
611
- }
612
- async openManifestWithAdditionalDetails(mcpServer, template, token) {
613
- const details = append(template.content, $(".details"));
614
- const readmeContainer = append(details, $(".content-container"));
615
- const additionalDetailsContainer = append(details, $(".additional-details-container"));
616
- const layout = () => details.classList.toggle("narrow", this.dimension && this.dimension.width < 500);
617
- layout();
618
- this.contentDisposables.add(toDisposable(insert(this.layoutParticipants, {
619
- layout
620
- })));
621
- const activeElement = await this.openManifest(mcpServer, readmeContainer, token);
622
- this.renderAdditionalDetails(additionalDetailsContainer, mcpServer);
623
- return activeElement;
624
- }
625
- async openManifest(mcpServer, parent, token) {
626
- const manifestContainer = append(parent, $(".manifest"));
627
- const content = $("div", {
628
- class: "manifest-content"
629
- });
630
- try {
631
- const manifest = await this.loadContents(() => this.mcpServerManifest.get(), content);
632
- if (token.isCancellationRequested) {
633
- return null;
634
- }
635
- this.renderManifestDetails(content, manifest);
636
- } catch (error) {
637
- while (content.firstChild) {
638
- content.removeChild(content.firstChild);
639
- }
640
- const noManifestMessage = append(content, $(".no-manifest"));
641
- noManifestMessage.textContent = ( localize(9438, "No manifest available for this MCP server."));
642
- }
643
- const scrollableContent = ( new DomScrollableElement(content, {}));
644
- const layout = () => scrollableContent.scanDomNode();
645
- this.contentDisposables.add(toDisposable(insert(this.layoutParticipants, {
646
- layout
647
- })));
648
- append(manifestContainer, scrollableContent.getDomNode());
649
- return {
650
- focus: () => content.focus()
651
- };
652
- }
653
- renderConfigurationDetails(container, mcpServer) {
654
- clearNode(container);
655
- const config = mcpServer.config;
656
- if (!config) {
657
- const noConfigMessage = append(container, $(".no-config"));
658
- noConfigMessage.textContent = ( localize(9439, "No configuration available for this MCP server."));
659
- return;
660
- }
661
- const nameSection = append(container, $(".config-section"));
662
- const nameLabel = append(nameSection, $(".config-label"));
663
- nameLabel.textContent = ( localize(9440, "Name:"));
664
- const nameValue = append(nameSection, $(".config-value"));
665
- nameValue.textContent = mcpServer.name;
666
- const typeSection = append(container, $(".config-section"));
667
- const typeLabel = append(typeSection, $(".config-label"));
668
- typeLabel.textContent = ( localize(9441, "Type:"));
669
- const typeValue = append(typeSection, $(".config-value"));
670
- typeValue.textContent = config.type;
671
- if (config.type === McpServerType.LOCAL) {
672
- const commandSection = append(container, $(".config-section"));
673
- const commandLabel = append(commandSection, $(".config-label"));
674
- commandLabel.textContent = ( localize(9442, "Command:"));
675
- const commandValue = append(commandSection, $("code.config-value"));
676
- commandValue.textContent = config.command;
677
- if (config.args && config.args.length > 0) {
678
- const argsSection = append(container, $(".config-section"));
679
- const argsLabel = append(argsSection, $(".config-label"));
680
- argsLabel.textContent = ( localize(9443, "Arguments:"));
681
- const argsValue = append(argsSection, $("code.config-value"));
682
- argsValue.textContent = config.args.join(" ");
683
- }
684
- } else if (config.type === McpServerType.REMOTE) {
685
- const urlSection = append(container, $(".config-section"));
686
- const urlLabel = append(urlSection, $(".config-label"));
687
- urlLabel.textContent = ( localize(9444, "URL:"));
688
- const urlValue = append(urlSection, $("code.config-value"));
689
- urlValue.textContent = config.url;
690
- }
691
- }
692
- renderManifestDetails(container, manifest) {
693
- clearNode(container);
694
- if (manifest.packages && manifest.packages.length > 0) {
695
- const packagesByType = ( new Map());
696
- for (const pkg of manifest.packages) {
697
- const type = pkg.registryType;
698
- let packages = packagesByType.get(type);
699
- if (!packages) {
700
- packagesByType.set(type, packages = []);
701
- }
702
- packages.push(pkg);
703
- }
704
- append(container, $(
705
- ".manifest-section",
706
- undefined,
707
- $(".manifest-section-title", undefined, ( localize(9445, "Packages")))
708
- ));
709
- for (const [packageType, packages] of packagesByType) {
710
- const packageSection = append(container, $(
711
- ".package-section",
712
- undefined,
713
- $(".package-section-title", undefined, packageType.toUpperCase())
714
- ));
715
- const packagesGrid = append(packageSection, $(".package-details"));
716
- for (let i = 0; i < packages.length; i++) {
717
- const pkg = packages[i];
718
- append(
719
- packagesGrid,
720
- $(".package-detail", undefined, $(".detail-label", undefined, ( localize(9446, "Package:"))), $(".detail-value", undefined, pkg.identifier))
721
- );
722
- if (pkg.packageArguments && pkg.packageArguments.length > 0) {
723
- const argStrings = [];
724
- for (const arg of pkg.packageArguments) {
725
- if (arg.type === "named") {
726
- argStrings.push(arg.name);
727
- if (arg.value) {
728
- argStrings.push(arg.value);
729
- }
730
- }
731
- if (arg.type === "positional") {
732
- const val = arg.value ?? arg.valueHint;
733
- if (val) {
734
- argStrings.push(val);
735
- }
736
- }
737
- }
738
- append(
739
- packagesGrid,
740
- $(".package-detail", undefined, $(".detail-label", undefined, ( localize(9447, "Package Arguments:"))), $("code.detail-value", undefined, argStrings.join(" ")))
741
- );
742
- }
743
- if (pkg.runtimeArguments && pkg.runtimeArguments.length > 0) {
744
- const argStrings = [];
745
- for (const arg of pkg.runtimeArguments) {
746
- if (arg.type === "named") {
747
- argStrings.push(arg.name);
748
- if (arg.value) {
749
- argStrings.push(arg.value);
750
- }
751
- }
752
- if (arg.type === "positional") {
753
- const val = arg.value ?? arg.valueHint;
754
- if (val) {
755
- argStrings.push(val);
756
- }
757
- }
758
- }
759
- append(
760
- packagesGrid,
761
- $(".package-detail", undefined, $(".detail-label", undefined, ( localize(9448, "Runtime Arguments:"))), $("code.detail-value", undefined, argStrings.join(" ")))
762
- );
763
- }
764
- if (pkg.environmentVariables && pkg.environmentVariables.length > 0) {
765
- const envStrings = ( pkg.environmentVariables.map(envVar => `${envVar.name}=${envVar.value ?? ""}`));
766
- append(
767
- packagesGrid,
768
- $(".package-detail", undefined, $(".detail-label", undefined, ( localize(9449, "Environment Variables:"))), $("code.detail-value", undefined, envStrings.join(" ")))
769
- );
770
- }
771
- if (i < packages.length - 1) {
772
- append(packagesGrid, $(".package-separator"));
773
- }
774
- }
775
- }
776
- }
777
- if (manifest.remotes && manifest.remotes.length > 0) {
778
- const packageSection = append(container, $(
779
- ".package-section",
780
- undefined,
781
- $(".package-section-title", undefined, ( localize(9450, "Remote")).toLocaleUpperCase())
782
- ));
783
- for (const remote of manifest.remotes) {
784
- const packagesGrid = append(packageSection, $(".package-details"));
785
- append(
786
- packagesGrid,
787
- $(".package-detail", undefined, $(".detail-label", undefined, ( localize(9444, "URL:"))), $(".detail-value", undefined, remote.url))
788
- );
789
- if (remote.type) {
790
- append(
791
- packagesGrid,
792
- $(".package-detail", undefined, $(".detail-label", undefined, ( localize(9451, "Transport:"))), $(".detail-value", undefined, remote.type))
793
- );
794
- }
795
- if (remote.headers && remote.headers.length > 0) {
796
- const headerStrings = ( remote.headers.map(header => `${header.name}: ${header.value ?? ""}`));
797
- append(
798
- packagesGrid,
799
- $(".package-detail", undefined, $(".detail-label", undefined, ( localize(9452, "Headers:"))), $(".detail-value", undefined, headerStrings.join(", ")))
800
- );
801
- }
802
- }
803
- }
804
- }
805
- renderAdditionalDetails(container, extension) {
806
- const content = $("div", {
807
- class: "additional-details-content",
808
- tabindex: "0"
809
- });
810
- const scrollableContent = ( new DomScrollableElement(content, {}));
811
- const layout = () => scrollableContent.scanDomNode();
812
- const removeLayoutParticipant = insert(this.layoutParticipants, {
813
- layout
814
- });
815
- this.contentDisposables.add(toDisposable(removeLayoutParticipant));
816
- this.contentDisposables.add(scrollableContent);
817
- this.contentDisposables.add(
818
- this.instantiationService.createInstance(AdditionalDetailsWidget, content, extension)
819
- );
820
- append(container, scrollableContent.getDomNode());
821
- scrollableContent.scanDomNode();
822
- }
823
- loadContents(loadingTask, container) {
824
- container.classList.add("loading");
825
- const result = this.contentDisposables.add(loadingTask());
826
- const onDone = () => container.classList.remove("loading");
827
- result.promise.then(onDone, onDone);
828
- return result.promise;
829
- }
830
- layout(dimension) {
831
- this.dimension = dimension;
832
- this.layoutParticipants.forEach(p => p.layout());
833
- }
834
- onError(err) {
835
- if (isCancellationError(err)) {
836
- return;
837
- }
838
- this.notificationService.error(err);
839
- }
840
- };
841
- McpServerEditor = McpServerEditor_1 = ( __decorate([( __param(1, ITelemetryService)), ( __param(2, IInstantiationService)), ( __param(3, IThemeService)), ( __param(4, INotificationService)), ( __param(5, IOpenerService)), ( __param(6, IStorageService)), ( __param(7, IExtensionService)), ( __param(8, IWebviewService)), ( __param(9, ILanguageService)), ( __param(10, IContextKeyService)), ( __param(11, IMcpWorkbenchService)), ( __param(12, IHoverService)), ( __param(13, IContextMenuService))], McpServerEditor));
842
- let AdditionalDetailsWidget = class AdditionalDetailsWidget extends Disposable {
843
- constructor(
844
- container,
845
- extension,
846
- mcpGalleryManifestService,
847
- hoverService,
848
- openerService
849
- ) {
850
- super();
851
- this.container = container;
852
- this.mcpGalleryManifestService = mcpGalleryManifestService;
853
- this.hoverService = hoverService;
854
- this.openerService = openerService;
855
- this.disposables = this._register(( new DisposableStore()));
856
- this.render(extension);
857
- this._register(
858
- this.mcpGalleryManifestService.onDidChangeMcpGalleryManifest(() => this.render(extension))
859
- );
860
- }
861
- render(extension) {
862
- this.container.innerText = "";
863
- this.disposables.clear();
864
- if (extension.local) {
865
- this.renderInstallInfo(this.container, extension.local);
866
- }
867
- if (extension.gallery) {
868
- this.renderMarketplaceInfo(this.container, extension);
869
- }
870
- this.renderTags(this.container, extension);
871
- this.renderExtensionResources(this.container, extension);
872
- }
873
- renderTags(container, extension) {
874
- if (extension.gallery?.topics?.length) {
875
- const categoriesContainer = append(container, $(".categories-container.additional-details-element"));
876
- append(
877
- categoriesContainer,
878
- $(".additional-details-title", undefined, ( localize(9453, "Tags")))
879
- );
880
- const categoriesElement = append(categoriesContainer, $(".categories"));
881
- for (const category of extension.gallery.topics) {
882
- append(categoriesElement, $("span.category", {
883
- tabindex: "0"
884
- }, category));
885
- }
886
- }
887
- }
888
- async renderExtensionResources(container, extension) {
889
- const resources = [];
890
- const manifest = await this.mcpGalleryManifestService.getMcpGalleryManifest();
891
- if (extension.repository) {
892
- try {
893
- resources.push([( localize(9454, "Repository")), ThemeIcon.fromId(Codicon.repo.id), ( URI.parse(extension.repository))]);
894
- } catch (error) {}
895
- }
896
- if (manifest) {
897
- const supportUri = getMcpGalleryManifestResourceUri(manifest, McpGalleryResourceType.ContactSupportUri);
898
- if (supportUri) {
899
- try {
900
- resources.push([( localize(9455, "Contact Support")), ThemeIcon.fromId(Codicon.commentDiscussion.id), ( URI.parse(supportUri))]);
901
- } catch (error) {}
902
- }
903
- }
904
- if (resources.length) {
905
- const extensionResourcesContainer = append(container, $(".resources-container.additional-details-element"));
906
- append(
907
- extensionResourcesContainer,
908
- $(".additional-details-title", undefined, ( localize(9456, "Resources")))
909
- );
910
- const resourcesElement = append(extensionResourcesContainer, $(".resources"));
911
- for (const [label, icon, uri] of resources) {
912
- const resourceElement = append(resourcesElement, $(".resource"));
913
- append(resourceElement, $(ThemeIcon.asCSSSelector(icon)));
914
- append(resourceElement, $("a", {
915
- tabindex: "0"
916
- }, label));
917
- this.disposables.add(onClick(resourceElement, () => this.openerService.open(uri)));
918
- this.disposables.add(
919
- this.hoverService.setupManagedHover(getDefaultHoverDelegate("mouse"), resourceElement, ( uri.toString()))
920
- );
921
- }
922
- }
923
- }
924
- renderInstallInfo(container, extension) {
925
- const installInfoContainer = append(container, $(".more-info-container.additional-details-element"));
926
- append(
927
- installInfoContainer,
928
- $(".additional-details-title", undefined, ( localize(9457, "Installation")))
929
- );
930
- const installInfo = append(installInfoContainer, $(".more-info"));
931
- append(installInfo, $(
932
- ".more-info-entry",
933
- undefined,
934
- $("div.more-info-entry-name", undefined, ( localize(9458, "Identifier"))),
935
- $("code", undefined, extension.name)
936
- ));
937
- if (extension.version) {
938
- append(installInfo, $(
939
- ".more-info-entry",
940
- undefined,
941
- $("div.more-info-entry-name", undefined, ( localize(9459, "Version"))),
942
- $("code", undefined, extension.version)
943
- ));
944
- }
945
- }
946
- renderMarketplaceInfo(container, extension) {
947
- const gallery = extension.gallery;
948
- const moreInfoContainer = append(container, $(".more-info-container.additional-details-element"));
949
- append(
950
- moreInfoContainer,
951
- $(".additional-details-title", undefined, ( localize(9460, "Marketplace")))
952
- );
953
- const moreInfo = append(moreInfoContainer, $(".more-info"));
954
- if (gallery) {
955
- if (!extension.local) {
956
- append(moreInfo, $(
957
- ".more-info-entry",
958
- undefined,
959
- $("div.more-info-entry-name", undefined, ( localize(9458, "Identifier"))),
960
- $("code", undefined, extension.name)
961
- ));
962
- if (gallery.version) {
963
- append(moreInfo, $(
964
- ".more-info-entry",
965
- undefined,
966
- $("div.more-info-entry-name", undefined, ( localize(9459, "Version"))),
967
- $("code", undefined, gallery.version)
968
- ));
969
- }
970
- }
971
- if (gallery.lastUpdated) {
972
- append(moreInfo, $(
973
- ".more-info-entry",
974
- undefined,
975
- $("div.more-info-entry-name", undefined, ( localize(9461, "Last Released"))),
976
- $("div", {
977
- "title": ( ( new Date(gallery.lastUpdated)).toString())
978
- }, fromNow(gallery.lastUpdated, true, true, true))
979
- ));
980
- }
981
- if (gallery.publishDate) {
982
- append(moreInfo, $(
983
- ".more-info-entry",
984
- undefined,
985
- $("div.more-info-entry-name", undefined, ( localize(9462, "Published"))),
986
- $("div", {
987
- "title": ( ( new Date(gallery.publishDate)).toString())
988
- }, fromNow(gallery.publishDate, true, true, true))
989
- ));
990
- }
991
- }
992
- }
993
- };
994
- AdditionalDetailsWidget = ( __decorate([( __param(2, IMcpGalleryManifestService)), ( __param(3, IHoverService)), ( __param(4, IOpenerService))], AdditionalDetailsWidget));
995
-
996
- export { McpServerEditor };