import { Runnable, RunnableConfig, RunnableLike } from "@langchain/core/runnables";
import { BaseChannel } from "../channels/base.js";
import { BinaryOperator } from "../channels/binop.js";
import { END, CompiledGraph, Graph, START, Branch } from "./graph.js";
import { BaseCheckpointSaver } from "../checkpoint/base.js";
import { All } from "../pregel/types.js";
type SingleReducer<T> = {
    reducer: BinaryOperator<T>;
    default?: () => T;
} | {
    /**
     * @deprecated Use `reducer` instead
     */
    value: BinaryOperator<T>;
    default?: () => T;
} | null;
export type ChannelReducers<Channels extends object> = {
    [K in keyof Channels]: SingleReducer<Channels[K]>;
};
export interface StateGraphArgs<Channels extends object | unknown> {
    channels: Channels extends object ? Channels extends unknown[] ? ChannelReducers<{
        __root__: Channels;
    }> : ChannelReducers<Channels> : ChannelReducers<{
        __root__: Channels;
    }>;
}
export declare class StateGraph<const State extends object | unknown, const Update extends object | unknown = Partial<State>, const N extends string = typeof START> extends Graph<N, State, Update> {
    channels: Record<string, BaseChannel>;
    waitingEdges: Set<[N[], N]>;
    constructor(fields: StateGraphArgs<State>);
    get allEdges(): Set<[string, string]>;
    addNode<K extends string>(key: K, action: RunnableLike<State, Update>): StateGraph<State, Update, N | K>;
    addEdge(startKey: typeof START | N | N[], endKey: N | typeof END): this;
    compile({ checkpointer, interruptBefore, interruptAfter, }?: {
        checkpointer?: BaseCheckpointSaver;
        interruptBefore?: N[] | All;
        interruptAfter?: N[] | All;
    }): CompiledStateGraph<State, Update, N>;
}
export declare class CompiledStateGraph<const State extends object | unknown, const Update extends object | unknown = Partial<State>, const N extends string = typeof START> extends CompiledGraph<N, State, Update> {
    builder: StateGraph<State, Update, N>;
    attachNode(key: typeof START, node?: never): void;
    attachNode(key: N, node: Runnable<State, Update, RunnableConfig>): void;
    attachEdge(start: N | N[] | "__start__", end: N | "__end__"): void;
    attachBranch(start: N | typeof START, name: string, branch: Branch<State, N>): void;
}
export {};
