import { AgentServerOptions as AgentServerOptions$1, CustomAdapterOptions as CustomAdapterOptions$1, UseStreamReturn } from "./use-stream.js"; import { ReactNode } from "react"; import { InferStateType } from "@langchain/langgraph-sdk/stream"; //#region src/context.d.ts /** * Props for {@link StreamProvider} when talking to the default * LangGraph Platform agent server. Mirrors {@link AgentServerOptions} * plus `children`. */ type StreamProviderProps> = AgentServerOptions$1> & { children: ReactNode; }; /** * Props for {@link StreamProvider} when wiring a custom * {@link AgentServerAdapter}. Mirrors {@link CustomAdapterOptions} * plus `children`. */ type StreamProviderCustomProps> = CustomAdapterOptions$1> & { children: ReactNode; }; /** * Provides a shared {@link useStream} instance to all descendants via * React Context. * * Use `StreamProvider` when multiple components in a subtree need * access to the same stream state (messages, loading status, errors, * interrupts, …) without prop drilling. * * @example * ```tsx * import { StreamProvider, useStreamContext } from "@langchain/react"; * * function App() { * return ( * * * * * * ); * } * * function ChatHeader() { * const { isLoading, error } = useStreamContext(); * return ( *
* {isLoading && Thinking...} * {error && Error} *
* ); * } * ``` * * Multiple providers can be nested for multi-agent scenarios: * * @example * ```tsx * * * * * * * ``` */ declare function StreamProvider>(props: StreamProviderProps | StreamProviderCustomProps): ReactNode; /** * Accesses the shared stream instance from the nearest * {@link StreamProvider}. Throws if called outside of one. * * @example * ```tsx * function MessageList() { * const { messages } = useStreamContext(); * return messages.map((m, i) =>
{String(m.content)}
); * } * ``` * * @example With a type parameter for full type safety: * ```tsx * import type { agent } from "./agent"; * * function Chat() { * const { toolCalls } = useStreamContext(); * } * ``` */ declare function useStreamContext>(): UseStreamReturn; //#endregion export { StreamProvider, StreamProviderCustomProps, StreamProviderProps, useStreamContext }; //# sourceMappingURL=context.d.ts.map