import { Disposable } from "../../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../../base/common/observable.js"; import { URI } from "../../../../../base/common/uri.js"; import { IRange } from "../../../../../editor/common/core/range.js"; import { ILanguageService } from "../../../../../editor/common/languages/language.service.js"; import { IModelService } from "../../../../../editor/common/services/model.service.js"; import { ICommandService } from "../../../../../platform/commands/common/commands.service.js"; import { IConfigurationService } from "../../../../../platform/configuration/common/configuration.service.js"; import { IFileService } from "../../../../../platform/files/common/files.service.js"; import { IInstantiationService } from "../../../../../platform/instantiation/common/instantiation.js"; import { IMcpServerConfiguration } from "../../../../../platform/mcp/common/mcpPlatformTypes.js"; import { INotificationService } from "../../../../../platform/notification/common/notification.service.js"; import { CustomizationMarketplaceIcon } from "../../../../../platform/customizationMarketplace/common/customizationMarketplaceService.js"; import { IThemeService } from "../../../../../platform/theme/common/themeService.service.js"; import { IEditorService } from "../../../../services/editor/common/editorService.service.js"; import { ICustomizationHarnessService } from "../../common/customizationHarnessService.service.js"; import { IMcpServerCustomizationMigrationCandidate } from "../../common/promptSyntax/service/customizationMigrationService.js"; import { IWorkbenchMcpServer, McpServerInstallState } from "../../../mcp/common/mcpTypes.js"; import { IMcpWorkbenchService } from "../../../mcp/common/mcpTypes.service.js"; export interface IMcpServerDetailInput { readonly id: string; readonly name: string; readonly label: string; readonly installState: McpServerInstallState; readonly icon?: CustomizationMarketplaceIcon; readonly config?: IMcpServerConfiguration; /** Identifier used by the active harness's compatibility provider. */ readonly compatibilityId?: string; /** Current full runtime error, independent of compatibility. */ readonly error?: IObservable; /** Whether the migration planner currently considers this server eligible. */ readonly migratable?: boolean; /** Localized explanation of why the migration planner cannot migrate this server automatically. */ readonly manualReviewReason?: string; readonly source?: { readonly uri: URI; readonly range?: IRange; }; /** Where the server comes from when it has no {@link source} file, such as an extension or the agent itself. */ readonly provenance?: IMcpServerProvenance; /** Explains why there is no definition to show, for a server whose definition the client cannot read. */ readonly definitionUnavailable?: IMcpServerDefinitionUnavailable; } export declare function isMcpServerDetailMigratable(server: Pick, candidates: readonly IMcpServerCustomizationMigrationCandidate[]): boolean; /** * Finds the migration planner entry (candidate or exclusion) that describes the server shown in a detail. */ export declare function findMcpServerDetailMigrationEntry(server: Pick, entries: readonly T[]): T | undefined; /** Why an MCP server has no definition to show, and where it can be controlled instead. */ export interface IMcpServerDefinitionUnavailable { /** Localized explanation shown in place of the definition. */ readonly message: string; /** Setting that controls the server, offered as a link to the Settings editor. */ readonly settingId?: string; } /** Describes where an MCP server comes from when there is no configuration file to open. */ export interface IMcpServerProvenance { /** Short localized label, for example "Built-in: Copilot" or "Extension: GitHub Copilot Chat". */ readonly label: string; /** Localized accessible name of the link that reveals the provider; present with {@link open}. */ readonly ariaLabel?: string; /** Reveals the provider, for example its extension details. */ open?(): void; } export interface IMcpServerDetailOptions { readonly openMigrationPage: () => void; } export declare function createWorkbenchMcpServerDetailInput(server: IWorkbenchMcpServer): IMcpServerDetailInput; /** * Detail view for an MCP server inside the AI Customizations management editor. */ export declare class EmbeddedMcpServerDetail extends Disposable { private readonly options; private readonly mcpWorkbenchService; private readonly instantiationService; private readonly configurationService; private readonly modelService; private readonly languageService; private readonly fileService; private readonly editorService; private readonly customizationHarnessService; private readonly notificationService; private readonly themeService; private readonly commandService; private readonly _onDidChangeContent; readonly onDidChangeContent: import("../../../../../base/common/event.js").Event; private readonly root; private readonly headerEl; private readonly leadingSlotEl; private readonly iconEl; private readonly nameEl; private readonly pathEl; private readonly titleActionsEl; private readonly editConfigurationButton; private readonly bodyEl; private readonly diagnosticsEl; private readonly definitionHeading; private readonly definitionEditorContainer; private readonly definitionEmptyEl; private readonly configurationFormContainer; private configurationForm; private configurationFormInput; private readonly errorsSection; private readonly compatibilitySection; private readonly migrationSection; private definitionEditor; private readonly definitionModel; private readonly diagnosticDisposables; private readonly iconDisposables; private readonly migrationLinkListener; private readonly definitionSettingsLinkListener; private readonly emptyEl; private current; private currentDefinition; private currentError; private compatibilityState; private harnessLabel; private renderGeneration; constructor(parent: HTMLElement, options: IMcpServerDetailOptions, mcpWorkbenchService: IMcpWorkbenchService, instantiationService: IInstantiationService, configurationService: IConfigurationService, modelService: IModelService, languageService: ILanguageService, fileService: IFileService, editorService: IEditorService, customizationHarnessService: ICustomizationHarnessService, notificationService: INotificationService, themeService: IThemeService, commandService: ICommandService); get element(): HTMLElement; get headerElement(): HTMLElement; /** * Header slot reserved for leading chrome (e.g. a back button). * Prefer this over reaching into the header element directly. */ get leadingSlot(): HTMLElement; get titleActions(): HTMLElement; /** * Focuses the read-only definition editor when it is shown. * @returns Whether the editor received focus. */ focusDefinitionEditor(): boolean; setInput(server: IMcpServerDetailInput): void; /** * Replaces the current server's presentation (label, source, provenance, definition) after the host * reports new metadata, keeping migration state and leaving the view untouched when nothing changed. */ updateInput(server: IMcpServerDetailInput): void; setMigratable(migratable: boolean): void; /** Shows why the migration planner cannot migrate this server automatically, or clears it when `undefined`. */ setManualReviewReason(manualReviewReason: string | undefined): void; clearInput(): void; focus(): void; private renderItem; /** * Shows the form for a server from a file shared with other MCP clients: a workspace root * `.mcp.json` or the Copilot CLI's `mcp-config.json`. VS Code's own `mcp.json` files and other * sources, such as extensions or agent host plugins, keep the read-only definition. */ private resolveSourceFormInput; private setConfigurationForm; /** The form replaces the read-only definition while it is shown. */ private updateDefinitionVisibility; private renderIcon; /** Shows the configuration file, or where the server comes from when it has none. */ private renderSource; private editConfiguration; private bindDiagnostics; private createDiagnosticSection; private renderDiagnostics; private renderErrors; private renderCompatibility; private renderMigration; /** * Explains that a server the migration planner cannot migrate automatically needs to be migrated manually, * with the planner's reason unless the compatibility details already give it, as they do for servers * excluded because the active agent cannot use them. */ private getManualMigrationDetail; private updateDiagnosticsVisibility; private updateDiagnosticSection; private loadSourceDefinition; private setDefinition; /** Shows why there is no definition, with a link to the setting that controls the server when one exists. */ private renderDefinitionEmpty; private ensureDefinitionEditor; }