import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { IMcpServerConfiguration } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpPlatformTypes"; /** A single hook command to execute. Platform resolution happens at conversion time. */ export interface IParsedHookCommand { /** Cross-platform default command. */ readonly command?: string; /** Windows-specific command. */ readonly windows?: string; /** Linux-specific command. */ readonly linux?: string; /** macOS-specific command. */ readonly osx?: string; /** Working directory. */ readonly cwd?: URI; /** Environment variables. */ readonly env?: Record; /** Timeout in seconds. */ readonly timeout?: number; /** URI of the file this hook was defined in. */ readonly sourceUri?: URI; } /** A group of hooks for a single lifecycle event. */ export interface IParsedHookGroup { /** Canonical hook type identifier (e.g. `'SessionStart'`, `'PreToolUse'`). */ readonly type: string; /** The commands to execute for this hook type. */ readonly commands: readonly IParsedHookCommand[]; /** URI where this hook is defined. */ readonly uri: URI; /** Original key as it appears in the hook file. */ readonly originalId: string; } export interface IMcpServerDefinition { readonly name: string; readonly configuration: IMcpServerConfiguration; readonly uri: URI; } /** A named resource (skill, agent, command, or instruction) within a plugin. */ export interface INamedPluginResource { readonly uri: URI; readonly name: string; } /** The result of parsing a single plugin directory. */ export interface IParsedPlugin { readonly hooks: readonly IParsedHookGroup[]; readonly mcpServers: readonly IMcpServerDefinition[]; readonly skills: readonly INamedPluginResource[]; readonly agents: readonly INamedPluginResource[]; } export declare enum PluginFormat { Copilot = 0, Claude = 1, OpenPlugin = 2 } export interface IPluginFormatConfig { readonly format: PluginFormat; readonly manifestPath: string; readonly hookConfigPath: string; readonly pluginRootToken: string | undefined; readonly pluginRootEnvVar: string | undefined; /** Parses hooks from a JSON object using the format's conventions. */ parseHooks(hookUri: URI, json: unknown, pluginUri: URI, workspaceRoot: URI | undefined, userHome: string): IParsedHookGroup[]; } export declare function detectPluginFormat(pluginUri: URI, fileService: IFileService): Promise; export interface IComponentPathConfig { readonly paths: readonly string[]; readonly exclusive: boolean; } /** * Parses a manifest component path field into a normalized config. * Supports `undefined`, `string`, `string[]`, and `{ paths: string[], exclusive?: boolean }`. */ export declare function parseComponentPathConfig(raw: unknown): IComponentPathConfig; /** * Resolves the directories to scan for a given component type, combining * the default directory with any custom paths from the manifest config. * Paths that resolve outside the boundary are silently ignored. * @param boundaryUri The outermost directory that resolved paths must stay within. Defaults to {@link pluginUri}. */ export declare function resolveComponentDirs(pluginUri: URI, defaultDir: string, config: IComponentPathConfig, boundaryUri?: URI): readonly URI[]; /** * Extracts the MCP server map from a raw JSON value. Accepts both the * wrapped format `{ mcpServers: { … } }` and the flat format. */ export declare function resolveMcpServersMap(raw: unknown): Record | undefined; /** * Normalizes a raw JSON value into a typed MCP server configuration. */ export declare function normalizeMcpServerConfiguration(rawConfig: unknown): IMcpServerConfiguration | undefined; /** * Replaces a plugin-root token in a shell command string with the * given fsPath, shell-quoting if the path contains special characters. */ export declare function shellQuotePluginRootInCommand(command: string, fsPath: string, token: string): string; /** * Replaces plugin-root token references in MCP server definition string fields * with the plugin root filesystem path. */ export declare function interpolateMcpPluginRoot(def: IMcpServerDefinition, fsPath: string, token: string, envVar: string): IMcpServerDefinition; /** * Converts bare `${VAR}` environment-variable references to VS Code `${env:VAR}` syntax. */ export declare function convertBareEnvVarsToVsCodeSyntax(def: IMcpServerDefinition): IMcpServerDefinition; /** * Applies plugin-root token interpolation to hook commands for * Claude and OpenPlugin formats. */ export declare function interpolateHookPluginRoot(hookUri: URI, json: unknown, pluginUri: URI, workspaceRoot: URI | undefined, userHome: string, token: string, envVar: string): IParsedHookGroup[]; export declare function readJsonFile(uri: URI, fileService: IFileService): Promise; export declare function pathExists(resource: URI, fileService: IFileService): Promise; export declare function readSkills(pluginRoot: URI, dirs: readonly URI[], fileService: IFileService): Promise; export declare function readMarkdownComponents(dirs: readonly URI[], fileService: IFileService): Promise; export declare function parseMcpServerDefinitionMap(definitionURI: URI, raw: unknown, pluginFsPath: string, formatConfig: IPluginFormatConfig): IMcpServerDefinition[]; /** * Parses a plugin directory to extract hooks, MCP servers, skills, and agents. * This is the main entry point for the agent host to discover plugin contents. */ export declare function parsePlugin(pluginUri: URI, fileService: IFileService, workspaceRoot: URI | undefined, userHome: string, boundaryUri?: URI): Promise;