import type { RegistrablePlugin } from "./tool.js"; /** * A plugin registry, created as a **factory rather than a module singleton**. * * Monad's original registry was a module-level `Map` populated by * self-registration at import time. That is workable in a long-lived Node * process but wrong for a package targeting workerd isolates (module state is * per-isolate and its lifetime is not the host's) and it makes tests share * state implicitly. A host that wants the singleton ergonomics can still wrap * one instance in a module — the choice moves to the host, which is where it * belongs. */ export interface PluginSummary { name: string; description: string; isCorePlugin: boolean; } export interface ToolRegistryOptions { /** * Always-active plugins, loaded on every run without explicit activation. */ corePlugins: readonly string[]; /** * Compatibility aliases for historical plugin names, mapping an old name to * the current canonical one. Persisted activation state stores names, so an * alias is how a rename avoids silently stripping capabilities from live * sessions without a data migration. Entries are permanent. */ aliases?: Readonly>; /** * Called after a plugin is registered. The seam for host-side side effects * of registration (e.g. contributing a plugin's skills into a separate * registry) without the harness knowing what those are. */ onRegister?: (plugin: TPlugin) => void; } export interface ToolRegistry { register(plugin: TPlugin): void; /** Resolve by name (following aliases); `undefined` when absent or unavailable. */ get(name: string): TPlugin | undefined; /** The canonical registered name for `name`, following any alias. */ canonicalizeName(name: string): string; corePlugins(): string[]; isCoreName(name: string): boolean; /** Every registered plugin, including currently-unavailable ones. */ all(): TPlugin[]; /** Summaries of available plugins only. */ summaries(): PluginSummary[]; /** Names of available plugins — the single source of truth for "what exists". */ availableNames(): string[]; } export declare function createToolRegistry(options: ToolRegistryOptions): ToolRegistry;