{"version":3,"file":"ReactAgent.d.cts","names":["InteropZodObject","Command","CompiledStateGraph","GetStateOptions","LangGraphRunnableConfig","CheckpointListOptions","IterableReadableStream","Runnable","RunnableConfig","StreamEvent","CreateAgentParams","BuiltInState","UserInput","InvokeConfiguration","StreamConfiguration","AgentMiddleware","InferMiddlewareContextInputs","InferMiddlewareStates","InferMiddlewareInputStates","InferContextInput","AnyAnnotationRoot","InferSchemaInput","ToAnnotationRoot","ResponseFormatUndefined","MergedAgentState","Record","StateSchema","StructuredResponseFormat","Omit","TMiddleware","InvokeStateParameter","AgentGraph","ContextSchema","ReactAgent","Promise","ArrayBuffer","Uint8Array","Parameters"],"sources":["../../src/agents/ReactAgent.d.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { InteropZodObject } from \"@langchain/core/utils/types\";\nimport { Command, CompiledStateGraph, type GetStateOptions, type LangGraphRunnableConfig } from \"@langchain/langgraph\";\nimport type { CheckpointListOptions } from \"@langchain/langgraph-checkpoint\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport type { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport type { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport type { CreateAgentParams, BuiltInState, UserInput } from \"./types.js\";\nimport type { InvokeConfiguration, StreamConfiguration } from \"./runtime.js\";\nimport type { AgentMiddleware, InferMiddlewareContextInputs, InferMiddlewareStates, InferMiddlewareInputStates, InferContextInput, AnyAnnotationRoot, InferSchemaInput, ToAnnotationRoot } from \"./middleware/types.js\";\nimport { type ResponseFormatUndefined } from \"./responses.js\";\n// Helper type to get the state definition with middleware states\ntype MergedAgentState<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware[]> = InferSchemaInput<StateSchema> & (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, \"jumpTo\"> : Omit<BuiltInState, \"jumpTo\"> & {\n    structuredResponse: StructuredResponseFormat;\n}) & InferMiddlewareStates<TMiddleware>;\ntype InvokeStateParameter<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, TMiddleware extends readonly AgentMiddleware[]> = (UserInput<StateSchema> & InferMiddlewareInputStates<TMiddleware>) | Command<any, any, any> | null;\ntype AgentGraph<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = []> = CompiledStateGraph<any, any, any, any, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown>;\nexport declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]> {\n    #private;\n    options: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema>;\n    constructor(options: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema>);\n    /**\n     * Get the compiled {@link https://docs.langchain.com/oss/javascript/langgraph/use-graph-api | StateGraph}.\n     */\n    get graph(): AgentGraph<StateSchema, StructuredResponseFormat, ContextSchema, TMiddleware>;\n    /**\n     * Executes the agent with the given state and returns the final state after all processing.\n     *\n     * This method runs the agent's entire workflow synchronously, including:\n     * - Processing the input messages through any configured middleware\n     * - Calling the language model to generate responses\n     * - Executing any tool calls made by the model\n     * - Running all middleware hooks (beforeModel, afterModel, etc.)\n     *\n     * @param state - The initial state for the agent execution. Can be:\n     *   - An object containing `messages` array and any middleware-specific state properties\n     *   - A Command object for more advanced control flow\n     *\n     * @param config - Optional runtime configuration including:\n     * @param config.context - The context for the agent execution.\n     * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n     * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n     * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n     * @param config.recursionLimit - The recursion limit for the agent execution.\n     *\n     * @returns A Promise that resolves to the final agent state after execution completes.\n     *          The returned state includes:\n     *          - a `messages` property containing an array with all messages (input, AI responses, tool calls/results)\n     *          - a `structuredResponse` property containing the structured response (if configured)\n     *          - all state values defined in the middleware\n     *\n     * @example\n     * ```typescript\n     * const agent = new ReactAgent({\n     *   llm: myModel,\n     *   tools: [calculator, webSearch],\n     *   responseFormat: z.object({\n     *     weather: z.string(),\n     *   }),\n     * });\n     *\n     * const result = await agent.invoke({\n     *   messages: [{ role: \"human\", content: \"What's the weather in Paris?\" }]\n     * });\n     *\n     * console.log(result.structuredResponse.weather); // outputs: \"It's sunny and 75°F.\"\n     * ```\n     */\n    invoke(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: InvokeConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>>;\n    /**\n     * Executes the agent with streaming, returning an async iterable of state updates as they occur.\n     *\n     * This method runs the agent's workflow similar to `invoke`, but instead of waiting for\n     * completion, it streams high-level state updates in real-time. This allows you to:\n     * - Display intermediate results to users as they're generated\n     * - Monitor the agent's progress through each step\n     * - React to state changes as nodes complete\n     *\n     * For more granular event-level streaming (like individual LLM tokens), use `streamEvents` instead.\n     *\n     * @param state - The initial state for the agent execution. Can be:\n     *   - An object containing `messages` array and any middleware-specific state properties\n     *   - A Command object for more advanced control flow\n     *\n     * @param config - Optional runtime configuration including:\n     * @param config.context - The context for the agent execution.\n     * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n     * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n     * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n     * @param config.streamMode - The streaming mode for the agent execution, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/streaming#supported-stream-modes | Supported stream modes}.\n     * @param config.recursionLimit - The recursion limit for the agent execution.\n     *\n     * @returns A Promise that resolves to an IterableReadableStream of state updates.\n     *          Each update contains the current state after a node completes.\n     *\n     * @example\n     * ```typescript\n     * const agent = new ReactAgent({\n     *   llm: myModel,\n     *   tools: [calculator, webSearch]\n     * });\n     *\n     * const stream = await agent.stream({\n     *   messages: [{ role: \"human\", content: \"What's 2+2 and the weather in NYC?\" }]\n     * });\n     *\n     * for await (const chunk of stream) {\n     *   console.log(chunk); // State update from each node\n     * }\n     * ```\n     */\n    stream(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<IterableReadableStream<any>>;\n    /**\n     * Visualize the graph as a PNG image.\n     * @param params - Parameters for the drawMermaidPng method.\n     * @param params.withStyles - Whether to include styles in the graph.\n     * @param params.curveStyle - The style of the graph's curves.\n     * @param params.nodeColors - The colors of the graph's nodes.\n     * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n     * @param params.backgroundColor - The background color of the graph.\n     * @returns PNG image as a buffer\n     */\n    drawMermaidPng(params?: {\n        withStyles?: boolean;\n        curveStyle?: string;\n        nodeColors?: Record<string, string>;\n        wrapLabelNWords?: number;\n        backgroundColor?: string;\n    }): Promise<Uint8Array<ArrayBuffer>>;\n    /**\n     * Draw the graph as a Mermaid string.\n     * @param params - Parameters for the drawMermaid method.\n     * @param params.withStyles - Whether to include styles in the graph.\n     * @param params.curveStyle - The style of the graph's curves.\n     * @param params.nodeColors - The colors of the graph's nodes.\n     * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n     * @param params.backgroundColor - The background color of the graph.\n     * @returns Mermaid string\n     */\n    drawMermaid(params?: {\n        withStyles?: boolean;\n        curveStyle?: string;\n        nodeColors?: Record<string, string>;\n        wrapLabelNWords?: number;\n        backgroundColor?: string;\n    }): Promise<string>;\n    /**\n     * The following are internal methods to enable support for LangGraph Platform.\n     * They are not part of the createAgent public API.\n     *\n     * Note: we intentionally return as `never` to avoid type errors due to type inference.\n     */\n    /**\n     * @internal\n     */\n    streamEvents(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>> & {\n        version?: \"v1\" | \"v2\";\n    }, streamOptions?: Parameters<Runnable[\"streamEvents\"]>[2]): IterableReadableStream<StreamEvent>;\n    /**\n     * @internal\n     */\n    getGraphAsync(config?: RunnableConfig): never;\n    /**\n     * @internal\n     */\n    getState(config: RunnableConfig, options?: GetStateOptions): never;\n    /**\n     * @internal\n     */\n    getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): never;\n    /**\n     * @internal\n     */\n    getSubgraphs(namespace?: string, recurse?: boolean): never;\n    /**\n     * @internal\n     */\n    getSubgraphAsync(namespace?: string, recurse?: boolean): never;\n    /**\n     * @internal\n     */\n    updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: string): never;\n}\nexport {};\n"],"mappings":";;;;;;;;;;;;;AAW8D;KAEzDwB,gBAAgB,CAAA,oBAAqBJ,iBAArB,GAAyCpB,gBAAzC,GAAA,SAAA,EAAA,iCAAwGyB,MAAxG,CAAA,MAAA,EAAA,GAAA,CAAA,GAA8HF,uBAA9H,EAAA,oBAAA,SAAoLR,eAApL,EAAA,CAAA,GAAyMM,gBAAzM,CAA0NK,WAA1N,CAAA,GAAA,CAA0OC,wBAA1O,SAA2QJ,uBAA3Q,GAAqSK,IAArS,CAA0SjB,YAA1S,EAAA,QAAA,CAAA,GAAoUiB,IAApU,CAAyUjB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