import type { AgentClient, ClientOptions } from "@cubos/agent-sdk"; import { type ReactNode } from "react"; /** An intersection, not `extends`: `ClientOptions` is a union (`getToken` or * `token`), and an interface cannot extend one. */ export type AgentProviderProps = ClientOptions & { children: ReactNode; }; /** * Holds one `AgentClient` for the tree below it. * * `baseUrl`, `tenant`, `fetch` and `timeoutMs` are identity keys: change one and * a new client is built, so every subscription below reconnects. That is right * when you switch backend or user, and a waste when it happens because the props * object was rebuilt for nothing — keep `fetch` stable if you pass it. * * The credential is exempt: both `getToken` and `token` reach the client through * a ref, so a fresh closure every render (the normal case for an inline arrow) * neither rebuilds the client nor pins a stale token. */ export declare function AgentProvider({ children, ...options }: AgentProviderProps): import("react").FunctionComponentElement>; /** The client from the nearest `AgentProvider`. Throws outside one, because the * alternative is a component that silently never loads. */ export declare function useAgentClient(): AgentClient;