import type { ReactNode } from 'react';
import type { BusEventSource, EventPayload } from '@almadar/core';
interface OrbitalEventResponse {
    success: boolean;
    transitioned: boolean;
    states: Record<string, string>;
    /**
     * Server-cascade events carried back in the response. Each entry has a
     * `source: BusEventSource` stamped by the compiled handler (`emit ...
     * { source: __ORBITAL_SOURCE }`) so the client can re-broadcast on the
     * qualified `UI:Orbital.Trait.EVENT` bus key (gap #13).
     */
    emittedEvents?: Array<{
        event: string;
        payload?: EventPayload;
        source?: BusEventSource;
    }>;
    data?: Record<string, unknown[]>;
    clientEffects?: unknown[];
    /**
     * Same effects as `clientEffects`, paired with the trait that produced
     * each one. When present, prefer this for trait attribution. Falls back
     * to legacy `clientEffects` parsing on older servers.
     */
    clientEffectsByTrait?: Array<{
        traitName: string;
        effect: unknown[];
    }>;
    error?: string;
}
export interface ServerClientEffect {
    type: 'render-ui' | 'navigate' | 'notify';
    slot?: string;
    pattern?: Record<string, unknown>;
    route?: string;
    params?: Record<string, unknown>;
    message?: string;
    /**
     * Trait that emitted this effect. Used by `<TraitFrame>` to resolve
     * `@trait.X` bindings. Undefined when the server didn't tag the effect
     * (older servers that pre-date the per-trait sidecar).
     */
    traitName?: string;
}
/** Metadata about what the server returned, for debugger logging */
export interface ServerResponseMeta {
    success: boolean;
    clientEffects: number;
    dataEntities: Record<string, number>;
    /** Raw entity data from server response (for EntityStore advancement) */
    data?: Record<string, unknown[]>;
    emittedEvents: string[];
    error?: string;
}
export interface SendEventResult {
    effects: ServerClientEffect[];
    meta: ServerResponseMeta;
}
export interface ServerBridgeContextValue {
    connected: boolean;
    sendEvent: (orbitalName: string, event: string, payload?: Record<string, unknown>) => Promise<SendEventResult>;
}
/**
 * Transport adapter for ServerBridgeProvider. Decouples the bridge's
 * cascade-rebroadcast / effect-parsing logic from its wire format.
 *
 * - The `serverUrl` mode (default) uses an HTTP transport that POSTs to
 *   `/register`, `/unregister`, `/:orbital/events`. This is what canonical
 *   playground-runtime (`tools/runtime-verify`) and apps/builder-server
 *   speak.
 * - The `transport` mode lets a consumer plug in a direct function-call
 *   adapter — used by `<BrowserPlayground>` to invoke
 *   `OrbitalServerRuntime.processOrbitalEvent` in-process, no HTTP, no
 *   server. Both modes return the same `OrbitalEventResponse` shape so the
 *   cascade-rebroadcast logic is identical downstream.
 */
export interface ServerBridgeTransport {
    register: (schema: unknown) => Promise<boolean>;
    unregister: () => Promise<void>;
    sendEvent: (orbitalName: string, event: string, payload?: Record<string, unknown>) => Promise<OrbitalEventResponse>;
}
/**
 * Access the server bridge. Returns a no-op stub when outside the provider.
 */
export declare function useServerBridge(): ServerBridgeContextValue;
export interface ServerBridgeProviderProps {
    schema: unknown;
    /** HTTP server URL (canonical playground-runtime / apps/builder-server). */
    serverUrl?: string;
    /**
     * Custom transport adapter. Use this for in-process execution (e.g.
     * `<BrowserPlayground>` invokes `OrbitalServerRuntime.processOrbitalEvent`
     * directly). Mutually exclusive with `serverUrl`.
     */
    transport?: ServerBridgeTransport;
    children: ReactNode;
}
export declare function ServerBridgeProvider({ schema, serverUrl, transport: customTransport, children, }: ServerBridgeProviderProps): import("react/jsx-runtime").JSX.Element;
export {};
