/** * PluginRegistry — Phase 1.2 dynamic skill loading + Phase 3 generic tool dispatch * * Allows skills to be registered after boot, loaded from config, or discovered * at runtime. Wraps the existing in-process-skill-registry for backward compat. * * Phase 3 extension: SkillToolPlugin interface for multi-tool skills (knowledge-skill * servers). Each server registers as a SkillToolPlugin, exposing arbitrary tools * that can be dispatched via callSkillTool(). * * Goals: * - New skills can be registered post-boot via register() * - Skills are discoverable by name without importing server constructors * - Default set loads automatically from the existing 3 governance skills * - Multi-tool skills can be registered and dispatched via callSkillTool() * - Backward compatible: callInProcessSkill still works as before */ export interface SkillPlugin { /** Unique skill name (e.g. "code-review", "security-audit") */ name: string; /** Handler that processes proposals */ analyzeProposal(args: SkillProposalArgs): Promise; } /** * Metadata describing a tool exposed by a SkillToolPlugin. */ export interface ToolDefinition { name: string; description: string; inputSchema?: Record; } /** * Extended plugin interface for knowledge-skill servers that expose multiple tools. * Each tool is a named function that accepts arbitrary args. */ export interface SkillToolPlugin { /** Unique skill name (e.g. "code-review", "api-design") */ name: string; /** Dispatch a named tool with arbitrary args */ callTool(toolName: string, args: Record): Promise; /** Optional: list tool definitions for dynamic discovery */ listTools?(): ToolDefinition[]; } export interface SkillProposalArgs { proposalTitle?: string; proposalDescription?: string; evidence?: string[]; proposalType?: string; } export interface SkillPluginResult { content: Array<{ type: string; text: string; }>; } type SkillHandler = (args: SkillProposalArgs) => Promise; declare class PluginRegistryImpl { private skills; /** Phase 3: multi-tool skill plugins (knowledge-skill servers) */ private toolPlugins; private initialized; /** * Register a skill plugin. Can be called after boot. */ register(skill: SkillPlugin): void; /** * Register a multi-tool skill plugin (knowledge-skill server). * Tools can be dispatched via callSkillTool(). */ registerToolPlugin(skill: SkillToolPlugin): void; /** * Call a named tool on a registered multi-tool skill plugin. */ callSkillTool(skillName: string, toolName: string, args: Record): Promise; /** * Check if a tool plugin is registered. */ hasToolPlugin(name: string): boolean; /** * List all registered tool plugin names. */ listToolPlugins(): string[]; /** * Get a registered tool plugin by name for introspection. */ getToolPlugin(name: string): SkillToolPlugin | undefined; /** * List tool definitions for a registered tool plugin. * Returns empty array if plugin not found or does not expose listTools(). */ listSkillTools(skillName: string): ToolDefinition[]; /** * Convenience: register a server as a SkillToolPlugin. * Wraps a server with named tools into the SkillToolPlugin interface. */ registerServer(server: { name: string; tools: ToolDefinition[]; callTool: (toolName: string, args: Record) => Promise; }): void; /** * Get a skill handler by name. Falls back to the in-process registry * for the built-in governance skills (code-review, security-audit, researcher). */ get(name: string): SkillHandler | undefined; /** * Check if a skill is registered (either in the plugin registry or the built-in registry). */ has(name: string): boolean; /** * List all registered skill names (plugins + built-in). */ list(): string[]; /** * Call a skill by name. Delegates to the plugin registry first, * then falls back to the built-in in-process registry. */ callSkill(name: string, args: SkillProposalArgs): Promise; /** * Initialize with default governance skills. Called once at boot. * The 3 governance skills are always available via the built-in registry. */ initializeDefaults(): void; /** * Reset the registry for testing. Removes all registered plugins * (built-in governance skills remain available via fallback). */ resetForTest(): void; } /** Singleton plugin registry */ export declare const pluginRegistry: PluginRegistryImpl; export {};