import { createPluginAPI } from './api.js'; import type { CommandRegistryLike } from '../runtime/host-ui.js'; import type { ProviderRegistry } from '../providers/registry.js'; import type { ToolRegistry } from '../tools/registry.js'; import type { RuntimeEventBus } from '../runtime/events/index.js'; import type { GatewayMethodCatalog } from '../control-plane/index.js'; import type { ChannelDeliveryRouter, ChannelPluginRegistry } from '../channels/index.js'; import type { MemoryEmbeddingProviderRegistry } from '../state/index.js'; import type { VoiceProviderRegistry } from '../voice/index.js'; import type { MediaProviderRegistry } from '../media/index.js'; import type { WebSearchProviderRegistry } from '../web-search/index.js'; export interface PluginPathOptions { readonly cwd: string; readonly homeDir: string; /** Additional plugin directories to search, appended after the standard directories. */ readonly additionalDirectories?: readonly string[] | undefined; } /** * Plugin search directories in precedence order. * Project-local plugins override global plugins with the same manifest name. */ export declare function getUserPluginDirectory(options: PluginPathOptions): string; export declare function getPluginDirectories(options: PluginPathOptions): string[]; /** * PluginManifest, The structure of a plugin's manifest.json. */ export interface PluginManifest { /** Unique plugin identifier (no spaces, lowercase-kebab). */ name: string; version: string; description: string; author?: string | undefined; /** Entry point relative to plugin directory. Defaults to "index.js". */ main?: string | undefined; /** Optional list of runtime event names the plugin subscribes to. */ hooks?: string[] | undefined; } /** * PluginEntryPoint, The exports expected from a plugin's entry file. */ export interface PluginEntryPoint { /** Called once after the plugin is loaded. Receives the sandboxed PluginAPI. */ init(api: ReturnType): void | Promise; /** Optional: called when the plugin is activated (after init). */ activate?(): void | Promise; /** Optional: called when the plugin is deactivated (before cleanup). */ deactivate?(): void | Promise; } /** * LoadedPlugin, Runtime state of a single loaded plugin. */ export interface LoadedPlugin { manifest: PluginManifest; /** Absolute path to the plugin directory. */ pluginDir: string; /** Whether the plugin is currently active (init + activate completed). */ active: boolean; /** Cleanup callbacks accumulated during plugin API use. */ cleanup: Array<() => void>; /** The resolved entry point module (available after load). */ entry?: PluginEntryPoint | undefined; } /** * DiscoveredPlugin, Result of scanning the plugins directory. */ export interface DiscoveredPlugin { pluginDir: string; manifest: PluginManifest; } export declare function discoverPlugins(options: PluginPathOptions): DiscoveredPlugin[]; /** * PluginLoaderDeps, External dependencies injected into the loader. */ export interface PluginLoaderDeps { runtimeBus: RuntimeEventBus; commandRegistry: CommandRegistryLike; providerRegistry: ProviderRegistry; toolRegistry: ToolRegistry; gatewayMethods: GatewayMethodCatalog; channelRegistry: ChannelPluginRegistry; channelDeliveryRouter: ChannelDeliveryRouter; memoryEmbeddingRegistry: MemoryEmbeddingProviderRegistry; voiceProviderRegistry: VoiceProviderRegistry; mediaProviderRegistry: MediaProviderRegistry; webSearchProviderRegistry: WebSearchProviderRegistry; /** Returns plugin-specific config given a plugin name. */ getPluginConfig(name: string): Record; /** Returns whether a plugin is enabled in persistent state. */ isEnabled(name: string): boolean; } /** * loadPlugin, Load, init, and activate a single plugin. * Returns a LoadedPlugin on success, or null on failure. * * @param cacheBust - Optional timestamp suffix appended to the import URL to bypass * Bun's module cache. Pass `Date.now()` on reload to force fresh execution. */ export declare function loadPlugin(discovered: DiscoveredPlugin, deps: PluginLoaderDeps, cacheBust?: number): Promise; /** * unloadPlugin, Deactivate a plugin and run all cleanup callbacks. */ export declare function unloadPlugin(plugin: LoadedPlugin): Promise; //# sourceMappingURL=loader.d.ts.map