UNPKG

@vooodooo/magic

Version:

Vooodooo - AI orchestration platform

213 lines (212 loc) 6.61 kB
export declare const name = "vooodooo"; /** * Plugin manifest information. */ export interface PluginManifest { /** Unique identifier for the plugin */ id: string; /** Human-readable name of the plugin */ name: string; /** Plugin version */ version: string; /** Brief description of what the plugin does */ description: string; /** Plugin author information */ author: { name: string; email?: string; url?: string; }; /** Minimum platform version required for the plugin */ minPlatformVersion: string; /** Main entry point file */ main: string; /** Dependencies on other plugins */ dependencies?: { [pluginId: string]: string; }; /** Plugin homepage URL */ homepage?: string; /** Plugin repository URL */ repository?: string; /** Plugin license */ license?: string; /** Plugin keywords */ keywords?: string[]; /** Additional configuration options */ [key: string]: unknown; } /** * Plugin lifecycle state. */ export declare enum PluginState { /** Plugin is registered but not initialized */ REGISTERED = "registered", /** Plugin is initializing */ INITIALIZING = "initializing", /** Plugin is active and ready for use */ ACTIVE = "active", /** Plugin is disabled */ DISABLED = "disabled", /** Plugin experienced an error */ ERROR = "error", /** Plugin is being unloaded */ UNLOADING = "unloading" } /** * Severity levels for logging. */ export type LogLevel = 'debug' | 'info' | 'warn' | 'error'; /** * API provided to plugins by the Vooodooo platform. */ export interface PluginAPI { /** * Log a message to the platform's logging system. * @param level Severity level of the log * @param message Message to log * @param data Optional additional data */ log(level: LogLevel, message: string, data?: unknown): void; /** * Register an extension for an extension point. * @param extension Extension to register */ registerExtension<T>(extension: Extension<T>): void; /** * Get the platform version. * @returns Current platform version */ getPlatformVersion(): string; /** * Get plugin configuration. * @returns Plugin configuration object */ getConfig(): Record<string, unknown>; /** * Set plugin configuration. * @param config Configuration object to set */ setConfig(config: Record<string, unknown>): Promise<void>; /** * Access the knowledge system for storing and retrieving domain knowledge. * @returns Knowledge system API */ getKnowledgeSystem(): KnowledgeSystemAPI; /** * Register a CLI command provided by this plugin. * @param command Command definition */ registerCommand(command: PluginCommand): void; /** * Get the current state of the plugin. * @returns Current plugin state */ getState(): PluginState; } /** * Definition for a CLI command provided by a plugin. */ export interface PluginCommand { /** Command name (e.g., 'analyze-domain') */ name: string; /** Command description */ description: string; /** Command options */ options?: { /** Option name (e.g., '--format') */ name: string; /** Option description */ description: string; /** Default value for the option */ default?: string | boolean | number; /** Whether the option is required */ required?: boolean; }[]; /** Function to execute when the command is invoked */ action: (args: any, options: any) => Promise<void>; /** ID of the plugin that registered this command */ pluginId?: string; } /** * API for the knowledge system. */ export interface KnowledgeSystemAPI { /** * Store domain knowledge. * @param key Unique key for the knowledge * @param data Knowledge data to store * @param metadata Additional metadata about the knowledge */ storeKnowledge(key: string, data: any, metadata?: Record<string, unknown>): Promise<void>; /** * Retrieve domain knowledge. * @param key Knowledge key to retrieve * @returns The stored knowledge data, or null if not found */ retrieveKnowledge(key: string): Promise<any | null>; /** * Contribute knowledge to the core system. * @param knowledge Knowledge data to contribute * @param metadata Additional metadata about the knowledge */ contributeToCore(knowledge: any, metadata: Record<string, unknown>): Promise<void>; /** * Get a list of available knowledge keys. * @param pattern Optional pattern to filter keys * @returns List of matching knowledge keys */ listKnowledgeKeys(pattern?: string): Promise<string[]>; } /** * Interface for extensions registered by plugins. */ export interface Extension<T> { /** ID of the extension point this extension targets */ extensionPointId: string; /** Priority of this extension (higher numbers = higher priority) */ priority?: number; /** Implementation of the extension */ implementation: T; } /** * Interface that all Vooodooo plugins must implement. */ export interface Plugin { /** Plugin manifest with metadata */ manifest: PluginManifest; /** * Initialize the plugin. * @param api Platform API provided to the plugin */ initialize(api: PluginAPI): Promise<void>; /** * Clean up resources when the plugin is unloaded. */ cleanup(): Promise<void>; /** * Called when the plugin is enabled. * This occurs after initialization or when a disabled plugin is re-enabled. */ onEnable?(): Promise<void>; /** * Called when the plugin is disabled. * This occurs when a plugin is temporarily disabled but not unloaded. */ onDisable?(): Promise<void>; /** * Called when the plugin's configuration changes. * @param newConfig The new configuration object * @param oldConfig The previous configuration object */ onConfigChange?(newConfig: Record<string, unknown>, oldConfig: Record<string, unknown>): Promise<void>; /** * Called to check if the plugin is compatible with the current platform. * @param platformVersion The current platform version * @returns True if compatible, false otherwise */ checkCompatibility?(platformVersion: string): boolean; } export * from './agents/index.js'; export * from './plugin-system/index.js'; export * from './core/index.js';