import type { NativeLang, PluginMetadata } from "../types.js"; /** * A loaded, instantiated, version-validated plugin. A method is present iff the * module exported the corresponding parse* function. Each returns the plugin's * parsed JSON (any shape) for a source string, or null when it produced nothing. * Throws if the underlying wasm traps. */ export interface LoadedPlugin { routes?(source: string): unknown; schemas?(source: string): unknown; imports?(source: string): unknown; /** Self-reported metadata from the optional `describe()` export (if any). */ metadata?: PluginMetadata; } /** Resolves a language to a LoadedPlugin (or null if none found). Swappable for tests. */ export type PluginProvider = (lang: NativeLang, pluginDirs: string[]) => LoadedPlugin | null; /** A plugin binary found on the search path: its filename language id + path. */ export interface PluginFile { /** The `` captured from the filename — a discovery hint / fallback id. */ lang: string; path: string; } /** * Enumerate plugin binaries across the search path (for `all` mode). Returns one * entry per filename language id, first-match-wins by waterfall dir order (lower * dirs shadowed), deterministic within a dir. Only template-matching files are * returned — arbitrary `.wasm` is ignored. Filesystem-only (a test provider is * for load-by-id, not enumeration). */ export declare function listPluginFiles(pluginDirs: string[]): PluginFile[]; /** Install a fake provider (tests). */ export declare function setNativePluginProvider(fn: PluginProvider | null): void; /** Remove a fake provider and drop the instance cache. */ export declare function resetNativePluginProvider(): void; /** * Resolve + load the plugin for `lang`, searching `pluginDirs` in order. Returns * null when no plugin is available; a malformed/incompatible plugin is treated * as absent (never throws for that). */ export declare function loadPlugin(lang: NativeLang, pluginDirs: string[]): LoadedPlugin | null; /** * Validate a module's exports against the ABI and bind a LoadedPlugin, or return * null if it is not a compatible codesight plugin (missing core exports, or a * contractVersion that doesn't match the host). Exported for testing the gate * without compiling a variant module. */ export declare function bindExports(rawExports: unknown): LoadedPlugin | null;