1229
* This is the main entry point for the agent host to discover plugin contents.
1230
*/
1232
>
pluginUri: URI,
1233
>
fileService: IFileService,
1234
>
workspaceRoot: URI | undefined,
1235
>
userHome: URI,
1236
>
boundaryUri?: URI,
1237
>
): Promise<IParsedPlugin> {
1238
>
const formatConfig = await detectPluginFormat(pluginUri, fileService);
1239
>
1240
>
// Read manifest
1241
>
const manifest = await readPluginManifest(pluginUri, formatConfig, fileService);
1242
>
if (formatConfig.requiresManifest && !manifest) {
1243
throw new Error(`Plugin manifest '${joinPath(pluginUri, formatConfig.manifestPath).toString()}' is missing`);
1244
}
1246
>
// Resolve component directories from manifest
1247
>
const hookDirs = resolvePluginComponentDirs(pluginUri, formatConfig, 'hooks', formatConfig.hookConfigPath, manifest?.['hooks'], boundaryUri);
1248
>
const mcpDirs = resolvePluginComponentDirs(pluginUri, formatConfig, 'mcpServers', '.mcp.json', manifest?.['mcpServers'], boundaryUri);
1249
>
const skillDirs = resolvePluginComponentDirs(pluginUri, formatConfig, 'skills', 'skills', manifest?.['skills'], boundaryUri);
1250
>
const agentDirs = resolvePluginComponentDirs(pluginUri, formatConfig, 'agents', 'agents', manifest?.['agents'], boundaryUri);
1251
>
const instructionDirs = resolvePluginComponentDirs(pluginUri, formatConfig, 'rules', 'rules', manifest?.['rules'], boundaryUri);
1252
>
1253
>
// Handle embedded MCP servers in manifest
1254
>
let embeddedMcp: IMcpServerDefinition[] = [];
1255
>
const mcpSection = getPluginManifestComponent(formatConfig, 'mcpServers', manifest);
1256
>
if (mcpSection && typeof mcpSection === 'object' && !Array.isArray(mcpSection) && !(hasKey(mcpSection, { paths: true }))) {
1257
embeddedMcp = parseMcpServerDefinitionMap(
1258
joinPath(pluginUri, formatConfig.manifestPath),