import { createElement, type ComponentType, type ReactNode } from "react";
import type { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
import * as AtomHttpApi from "effect/unstable/reactivity/AtomHttpApi";
export { Schema } from "effect";
export { HttpApi, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
export * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
export * as Atom from "effect/unstable/reactivity/Atom";
export * as AtomHttpApi from "effect/unstable/reactivity/AtomHttpApi";
export { useAtomValue, useAtomSet, useAtomMount, useAtomRefresh } from "@effect/atom-react";
export interface PageDecl {
    /** Path relative to the plugin's mount point, e.g. `/`, `/edit/$id`. */
    readonly path: string;
    readonly component: ComponentType;
    /** Optional sidebar nav metadata — the host renders these alongside its
     *  own nav links. Omit to register a page without a nav entry. */
    readonly nav?: {
        readonly label: string;
        readonly section?: string;
    };
}
export interface WidgetProps {
    readonly scopeId?: string;
}
export interface WidgetDecl {
    readonly id: string;
    readonly component: ComponentType<WidgetProps>;
    readonly size?: "half" | "full";
}
/**
 * Open record of host-defined slot components a plugin can fill. Slot
 * names are part of the host UI contract — plugins opt in by registering
 * a component for the slot they care about. Adding a slot is a host-side
 * change; plugin authors don't define new slots.
 */
export type SlotComponent = ComponentType<Record<string, unknown>>;
export interface SourcePreset {
    /** Unique id (e.g. "stripe", "github-graphql"). */
    readonly id: string;
    readonly name: string;
    readonly summary: string;
    /** URL passed as `initialUrl` to the add form. Omit for presets that
     *  don't use a URL (e.g. stdio MCP presets). */
    readonly url?: string;
    /** Endpoint passed to agent-facing probe/add tools when their schema
     *  uses `endpoint` instead of `url`. */
    readonly endpoint?: string;
    /** Optional icon URL (favicon, logo). */
    readonly icon?: string;
    /** Shown in the top-level grid on the sources page when true. */
    readonly featured?: boolean;
}
export interface SourcePlugin {
    /** Unique key matching the SDK plugin id (e.g. "openapi"). */
    readonly key: string;
    readonly label: string;
    readonly add: ComponentType<{
        readonly onComplete: () => void;
        readonly onCancel: () => void;
        readonly initialUrl?: string;
        readonly initialPreset?: string;
        readonly initialNamespace?: string;
    }>;
    readonly edit: ComponentType<{
        readonly sourceId: string;
        readonly onSave: () => void;
    }>;
    readonly summary?: ComponentType<{
        readonly sourceId: string;
        readonly variant?: "badge" | "panel";
        readonly onAction?: () => void;
    }>;
    readonly presets?: readonly SourcePreset[];
    /** Trigger early download of the plugin's lazy component chunks (add/edit/etc.).
     *  Call from the host on intent (hover/focus) so the chunks land before the
     *  user navigates into the add page. Idempotent. */
    readonly preload?: () => void;
}
export interface SecretProviderPlugin {
    /** Unique key matching the SDK plugin id (e.g. "onepassword"). */
    readonly key: string;
    readonly label: string;
    readonly settings: ComponentType<Record<string, never>>;
}
export interface ClientPluginSpec<TId extends string = string> {
    readonly id: TId;
    readonly pages?: readonly PageDecl[];
    readonly widgets?: readonly WidgetDecl[];
    readonly slots?: Record<string, SlotComponent>;
    /** Source plugin contribution — populated by plugins that expose
     *  `kind` rows in the core `source` table (openapi, mcp, graphql,
     *  google-discovery). The host's sources page derives its provider
     *  list from the union of every loaded plugin's `sourcePlugin`. */
    readonly sourcePlugin?: SourcePlugin;
    /** Secret provider plugin contribution — populated by plugins that
     *  also ship a `secretProviders` (or related) server-side capability
     *  AND want to expose a settings card on the host's secrets page. */
    readonly secretProviderPlugin?: SecretProviderPlugin;
}
/**
 * Identity factory — returns the spec unchanged but pins the inferred
 * literal type of `id` so the host can index plugin records by id with
 * full autocomplete. Plugins export this as their package's default
 * (or named) export from `./client`.
 */
export declare const defineClientPlugin: <const TId extends string>(spec: ClientPluginSpec<TId>) => ClientPluginSpec<TId>;
export interface CreatePluginAtomClientOptions {
    /** Override the base URL. Defaults to `/api` (host strips this prefix
     *  when forwarding to the Effect handler) — same convention as the
     *  core `ExecutorApiClient`. */
    readonly baseUrl?: string | (() => string);
}
/**
 * Build a typed reactive client for a plugin's HttpApiGroup.
 *
 *   const FooClient = createPluginAtomClient(FooApi)
 *   export const fooThings = FooClient.query("foo", "listThings", { ... })
 *   export const fooSync   = FooClient.mutation("foo", "syncThing")
 *
 * Each plugin gets a private service Tag (`Plugin_<id>Client`) keyed by
 * the group's `identifier`, so multiple plugins coexist in the same
 * React tree without colliding.
 */
export declare const createPluginAtomClient: <G extends HttpApiGroup.HttpApiGroup<string, HttpApiEndpoint.Any, boolean>>(group: G, options?: CreatePluginAtomClientOptions) => AtomHttpApi.AtomHttpApiClient<`Plugin_${G["identifier"]}Client`, `Plugin_${string}Client`, G>;
export interface ExecutorPluginsProviderProps {
    readonly plugins: readonly ClientPluginSpec[];
    readonly children: ReactNode;
}
export declare function ExecutorPluginsProvider(props: ExecutorPluginsProviderProps): ReturnType<typeof createElement>;
/** Full list of loaded `ClientPluginSpec` values. */
export declare const useClientPlugins: () => readonly ClientPluginSpec[];
/** Source plugins extracted from `clientPlugins[].sourcePlugin`. */
export declare const useSourcePlugins: () => readonly SourcePlugin[];
/** Secret-provider plugins extracted from `clientPlugins[].secretProviderPlugin`. */
export declare const useSecretProviderPlugins: () => readonly SecretProviderPlugin[];
//# sourceMappingURL=client.d.ts.map