@vooodooo/magic
Version:
Vooodooo - AI orchestration platform
47 lines (46 loc) • 1.75 kB
TypeScript
import { Extension as ExtensionInterface } from '../index.js';
/**
* Registry for plugin extensions
*/
export declare class ExtensionRegistry {
private extensions;
private extensionOwners;
/**
* Register an extension for a specific extension point
* @param pluginId ID of the plugin registering the extension
* @param extension Extension to register
*/
registerExtension<T>(pluginId: string, extension: ExtensionInterface<T>): void;
/**
* Get extensions for a specific extension point
* @param extensionPointId ID of the extension point
* @returns Array of extensions sorted by priority (highest first)
*/
getExtensions<T>(extensionPointId: string): ExtensionInterface<T>[];
/**
* Check if an extension point has any registered extensions
* @param extensionPointId ID of the extension point
* @returns True if there are extensions registered for this point
*/
hasExtensions(extensionPointId: string): boolean;
/**
* Remove all extensions from a specific plugin
* @param pluginId ID of the plugin
*/
removeExtensionsFromPlugin(pluginId: string): void;
/**
* Get all registered extension points
* @returns Array of extension point IDs
*/
getExtensionPoints(): string[];
/**
* Execute a function on all extensions for a specific extension point
* @param extensionPointId ID of the extension point
* @param fn Function to execute on each extension
*/
executeExtensions<T, R>(extensionPointId: string, fn: (extension: ExtensionInterface<T>) => Promise<R>): Promise<R[]>;
}
/**
* Create an extension registry
*/
export declare function createExtensionRegistry(): ExtensionRegistry;