import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation"; import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service"; import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service"; import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service"; import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service"; import { IEnablementModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement"; import { IAgentPluginRepositoryService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.service"; import { IAgentPlugin, IAgentPluginDiscovery } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService"; import { IAgentPluginService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService.service"; import { IMarketplacePlugin } from "./pluginMarketplaceService.js"; import { IPluginMarketplaceService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.service"; export { shellQuotePluginRootInCommand, resolveMcpServersMap, convertBareEnvVarsToVsCodeSyntax } from "../../../../../platform/agentPlugins/common/pluginParsers.js"; export declare class AgentPluginService extends Disposable implements IAgentPluginService { readonly _serviceBrand: undefined; readonly plugins: IObservable; readonly enablementModel: IEnablementModel; constructor(instantiationService: IInstantiationService, configurationService: IConfigurationService, storageService: IStorageService); private _dedupeAndSort; } /** * Describes a single discovered plugin source, before the shared * infrastructure builds the full {@link IAgentPlugin} from it. */ interface IPluginSource { readonly uri: URI; readonly fromMarketplace: IMarketplacePlugin | undefined; /** Repository root that serves as the boundary for component path resolution. */ readonly repositoryUri?: URI; /** Called when remove is invoked on the plugin */ remove(): void; } /** * Shared base class for plugin discovery implementations. Contains the common * logic for reading plugin contents (commands, skills, agents, hooks, MCP server * definitions) from the filesystem and watching for live updates. * * Subclasses implement {@link _discoverPluginSources} to determine *which* * plugins exist, while this class handles the rest. */ export declare abstract class AbstractAgentPluginDiscovery extends Disposable implements IAgentPluginDiscovery { protected readonly _fileService: IFileService; protected readonly _pathService: IPathService; protected readonly _logService: ILogService; protected readonly _workspaceContextService: IWorkspaceContextService; private readonly _pluginEntries; private readonly _plugins; readonly plugins: IObservable; private _discoverVersion; protected _enablementModel: IEnablementModel; constructor(_fileService: IFileService, _pathService: IPathService, _logService: ILogService, _workspaceContextService: IWorkspaceContextService); abstract start(enablementModel: IEnablementModel): void; protected _refreshPlugins(): Promise; /** Subclasses return plugin sources to discover. */ protected abstract _discoverPluginSources(): Promise; private _discoverAndBuildPlugins; protected _pathExists(resource: URI): Promise; private _toPlugin; private _readManifest; /** * Reads hook definitions from a list of resolved paths (JSON files). * Each path is tried in order; the first one that contains valid hook * JSON is used. */ private _readHooksFromPaths; /** * Reads MCP server definitions from a list of resolved paths (JSON files). * Definitions from all files are merged; the first definition for a given * server name wins. */ private _readMcpDefinitionsFromPaths; private _readJsonFile; /** * Scans directories for rule/instruction files (`.mdc`, `.md`, * `.instructions.md`), returning `{ uri, name }` entries where name is * derived from the filename minus the matched suffix. */ private _readRules; private _disposePluginEntriesExcept; dispose(): void; } export declare class ConfiguredAgentPluginDiscovery extends AbstractAgentPluginDiscovery { private readonly _configurationService; private readonly _pluginMarketplaceService; private readonly _pluginLocationsConfig; constructor(_configurationService: IConfigurationService, fileService: IFileService, _pluginMarketplaceService: IPluginMarketplaceService, workspaceContextService: IWorkspaceContextService, pathService: IPathService, logService: ILogService); start(enablementModel: IEnablementModel): void; protected _discoverPluginSources(): Promise; private _getUserHome; /** * Resolves a plugin path to one or more resource URIs. Supports: * - Absolute paths (used directly) * - Tilde paths (expanded to user home directory) * - Relative paths (resolved against each workspace folder) */ private _resolvePluginPath; /** * Removes a plugin path from `chat.pluginLocations` in the most specific * config target where the key is defined. */ private _removePluginPath; } export declare class MarketplaceAgentPluginDiscovery extends AbstractAgentPluginDiscovery { private readonly _pluginMarketplaceService; private readonly _pluginRepositoryService; constructor(_pluginMarketplaceService: IPluginMarketplaceService, _pluginRepositoryService: IAgentPluginRepositoryService, fileService: IFileService, pathService: IPathService, logService: ILogService, workspaceContextService: IWorkspaceContextService); start(enablementModel: IEnablementModel): void; protected _discoverPluginSources(): Promise; } /** * Discovers plugins installed by the Copilot CLI under * `~/.copilot/installed-plugins///`. Each leaf directory * is treated as a plugin root, allowing CLI-installed plugins (both * marketplace and direct) to surface in VS Code without a separate install. */ export declare class CopilotCliAgentPluginDiscovery extends AbstractAgentPluginDiscovery { private readonly _dialogService; constructor(fileService: IFileService, pathService: IPathService, logService: ILogService, workspaceContextService: IWorkspaceContextService, _dialogService: IDialogService); start(enablementModel: IEnablementModel): void; private _getInstalledPluginsDir; protected _discoverPluginSources(): Promise; private _promptRemove; } export declare class ExtensionAgentPluginDiscovery extends AbstractAgentPluginDiscovery { private readonly _commandService; private readonly _contextKeyService; private readonly _dialogService; private readonly _extensionPlugins; private readonly _whenKeys; constructor(_commandService: ICommandService, _contextKeyService: IContextKeyService, _dialogService: IDialogService, fileService: IFileService, pathService: IPathService, logService: ILogService, workspaceContextService: IWorkspaceContextService); start(enablementModel: IEnablementModel): void; private _rebuildWhenKeys; protected _discoverPluginSources(): Promise; private _promptUninstallExtension; }