/**
 * ------------------------------
 * Plugin Type System
 * ------------------------------
 *
 * Plugins receive the sdk as a positional parameter. sdk.context holds shared
 * internal state (api client, event emission, meta, options, etc.). SDK methods
 * live at the root, context nests under .context.
 *
 * A plugin is (sdk) => partialSdk. createSdk() returns an empty SDK. addPlugin
 * merges the plugin's result into the SDK, producing a new SDK.
 */
import type { z } from "zod";
import type { RegistryResult } from "./registry";
export interface PluginProvides extends Record<string, any> {
    context?: {
        meta?: Record<string, PluginMeta>;
        [key: string]: any;
    };
}
export interface PluginMeta {
    /**
     * Human-readable description of the plugin function. Used by the CLI (help text),
     * MCP (tool description), and README generators. When omitted, falls back to
     * the inputSchema's `.describe()` value or a generic placeholder.
     */
    description?: string;
    categories?: string[];
    type?: "list" | "item" | "create" | "update" | "delete" | "function";
    itemType?: string;
    returnType?: string;
    inputSchema?: z.ZodSchema;
    outputSchema?: z.ZodSchema;
    resolvers?: Record<string, any>;
    /** Confirmation prompt type - prompts user before executing */
    confirm?: "create-secret" | "delete";
    /**
     * Marks this plugin as experimental — registered only in the
     * `@zapier/zapier-sdk/experimental` factory and badged in
     * generated docs / CLI help. Access is gated structurally by the
     * subpath import: stable callers can't reach experimental methods
     * because the stable SDK type and runtime registry don't include
     * them. No runtime capability check.
     */
    experimental?: boolean;
    [key: string]: any;
}
/**
 * Plugin interface — 2 type params:
 *
 *   TSdk = what this plugin needs (the SDK shape including context)
 *   TProvides = what this plugin returns (a partial SDK shape)
 *
 * The sdk param always includes context.meta, even if TSdk doesn't declare it.
 */
export interface Plugin<TSdk = {}, TProvides extends PluginProvides = PluginProvides> {
    (sdk: TSdk & {
        context: {
            meta: Record<string, PluginMeta>;
        };
    }): TProvides;
}
/**
 * Takes an SDK shape and adds addPlugin and getRegistry methods to it.
 * addPlugin merges a plugin's result into the shape, producing a new SDK.
 * Use composePlugins(...) to bundle multiple plugins into one before
 * adding — addPlugin itself is single-plugin only, which keeps inference
 * stable through long chains.
 * getRegistry is a lazy view over context.meta, available on every sdk
 * produced by buildSdk regardless of plugin order.
 */
export type WithAddPlugin<T = {
    context: {
        meta: Record<string, PluginMeta>;
    };
}> = T & {
    addPlugin<TProvides extends PluginProvides>(plugin: Plugin<T, TProvides>, options?: {
        override?: boolean;
    }): WithAddPlugin<T & TProvides>;
    getRegistry(options?: {
        package?: string;
    }): RegistryResult;
};
//# sourceMappingURL=plugin.d.ts.map