/** * Plugin factory — wraps the canonical `PluginDefinition` shape with * source-location capture so tooling (Studio, scan) can render where a * plugin was declared. * * Two call forms produce the same returned shape: * * // Single-phase: pass a setup closure directly. * definePlugin("name", (ctx) => { ... setup body ... }); * * // Two-phase: pass a body object with options + register + setup. * definePlugin("name", { * options: opts, * register: (ctx) => { ... bindings + hook slots ... }, * setup: (ctx) => { ... capabilities + listeners + boots ... }, * }); * * Both produce a `PluginDefinition` that the Runtime's * `registerPlugin` runs as register-then-setup. */ import type { PluginContext, PluginDefinition } from "./runtime/index.js"; /** Body for the object call form. */ export interface DefinePluginBody { readonly options?: TOptions; register?(ctx: PluginContext): void; setup(ctx: PluginContext): void; readonly __mark?: TMark; } /** Single-phase form — receives a setup closure directly. */ export declare function definePlugin(name: string, setup: (ctx: PluginContext) => void): PluginDefinition; /** Two-phase form — accepts options + register + setup as a body object. */ export declare function definePlugin(name: string, body: DefinePluginBody): PluginDefinition; /** Discriminator for runtime-side checks. */ export declare function isPlugin(x: unknown): x is PluginDefinition;