/**
* External plugin loader (Phase 5 of the 3.12.0 abstraction refactor).
*
* Discovers and loads third-party plugins from the filesystem so the kernel
* can accept new platforms without a fork.
*
* Discovery rule:
* - Scan `
//` directories under each search root.
* - Each directory must contain a `package.json` whose `main` (or `module`)
* points to a JS file exporting `default: () => SourcePlugin` OR a named
* export `createPlugin: () => SourcePlugin`.
* - The plugin manifest's `apiVersion` is verified against the host's
* supported list before registration; mismatches are reported and the
* plugin is skipped (never thrown — one bad plugin must not kill the host).
*
* Search roots default to `~/.claude-in-mobile/plugins/`. Callers can pass
* additional directories via `additionalRoots` for tests or vendoring.
*
* The loader is intentionally side-effect-free at construction; call `discover`
* to walk the filesystem and return loadable plugin factories.
*/
import type { Logger, SourcePlugin } from "@claude-in-mobile/plugin-api";
export interface ExternalLoaderOptions {
/** Extra search roots in addition to `~/.claude-in-mobile/plugins/`. */
additionalRoots?: ReadonlyArray;
/** API versions the host understands. Plugins outside this set are skipped. */
supportedApiVersions?: ReadonlyArray;
/** Logger; defaults to stderr-only console. */
logger?: Logger;
}
export interface DiscoveredPlugin {
factory: () => SourcePlugin;
/** Directory the plugin was loaded from — useful for diagnostics. */
source: string;
}
export declare class ExternalPluginLoader {
private readonly roots;
private readonly apiVersions;
private readonly logger;
constructor(opts?: ExternalLoaderOptions);
/**
* Walk search roots and return loadable plugin factories.
* Bad plugins are logged and skipped.
*/
discover(): Promise>;
}
//# sourceMappingURL=external-loader.d.ts.map