import type { CapabilityHandler, PluginCategory, PluginManifest, PluginSchema, TagmaPlugin } from './types'; type PluginType = CapabilityHandler; export interface RegisteredCapability { readonly category: PluginCategory; readonly type: string; readonly result: RegisterResult; } export type RegisterResult = 'registered' | 'replaced' | 'unchanged'; export interface RegisterPluginOptions { readonly replace?: boolean; } export declare const PLUGIN_NAME_RE: RegExp; export declare function isValidPluginName(name: unknown): name is string; /** * Parse and validate the `tagmaPlugin` field of a `package.json` blob. * * Returns the strongly-typed manifest if the field is present and * well-formed (`category` is one of the four known categories and `type` * is a non-empty string). Returns `null` if the field is absent; that * is the host's signal that the package is a library, not a plugin. * * Throws if the field is present but malformed: that's a packaging bug * the plugin author should hear about loudly, not a silent skip. * * Hosts use this during auto-discovery to decide whether to load a * package as a plugin without having to dynamically `import()` it. */ export declare function readPluginManifest(pkgJson: unknown): PluginManifest | null; export declare function validatePluginConfig(schema: PluginSchema | undefined, config: Record, path: string): readonly string[]; /** * Instance-scoped plugin registry. Each workspace in a multi-tenant sidecar * owns its own PluginRegistry, so installing/uninstalling a driver in one * workspace cannot clobber another. */ export declare class PluginRegistry { private readonly registries; private validatePluginRegistration; private assertCanRegister; /** * Register a plugin under (category, type). Returns: * - 'registered' on first registration * - 'replaced' when an existing entry was intentionally overwritten * - 'unchanged' when the same handler instance was already present * * Throws if `category` is unknown, `type` is empty, `handler` violates * the minimum interface contract for the category, or another handler is * already registered for the same category/type without `{ replace: true }`. */ registerPlugin(category: PluginCategory, type: string, handler: T, options?: RegisterPluginOptions): RegisterResult; registerTagmaPlugin(plugin: TagmaPlugin, options?: RegisterPluginOptions): RegisteredCapability[]; /** * Remove a plugin from the in-process registry. Returns true if a plugin * was actually removed. Note: ESM module caching is not affected, so * re-importing the same file after unregister will yield the cached module; * callers wanting a fresh load must restart the host process. */ unregisterPlugin(category: PluginCategory, type: string): boolean; getHandler(category: PluginCategory, type: string): T; hasHandler(category: PluginCategory, type: string): boolean; listRegistered(category: PluginCategory): string[]; /** * Load and register a list of plugin packages into this registry. * * @param pluginNames - Validated npm package names to load. * @param resolveFrom - Optional absolute path to resolve plugins from (e.g. * the workspace's working directory). When omitted, the default ESM * resolution uses the SDK's own `node_modules`, which will fail for * plugins installed only in the user's workspace. CLI callers should * pass `process.cwd()` or the workspace root so that workspace-local * plugins resolve correctly. */ loadPlugins(pluginNames: readonly string[], resolveFrom?: string): Promise; } export {}; //# sourceMappingURL=registry.d.ts.map