@langchain/langgraph 0.2.13 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/errors.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvalidUpdateError = exports.EmptyChannelError = exports.EmptyInputError = exports.isGraphInterrupt = exports.NodeInterrupt = exports.GraphInterrupt = exports.GraphValueError = exports.GraphRecursionError = void 0;
3
+ exports.getSubgraphsSeenSet = exports.MultipleSubgraphsError = exports.InvalidUpdateError = exports.EmptyChannelError = exports.EmptyInputError = exports.isGraphInterrupt = exports.NodeInterrupt = exports.GraphInterrupt = exports.GraphValueError = exports.GraphRecursionError = void 0;
4
4
  class GraphRecursionError extends Error {
5
5
  constructor(message) {
6
6
  super(message);
@@ -92,3 +92,27 @@ class InvalidUpdateError extends Error {
92
92
  }
93
93
  }
94
94
  exports.InvalidUpdateError = InvalidUpdateError;
95
+ class MultipleSubgraphsError extends Error {
96
+ constructor(message) {
97
+ super(message);
98
+ this.name = "MultipleSubgraphError";
99
+ }
100
+ static get unminifiable_name() {
101
+ return "MultipleSubgraphError";
102
+ }
103
+ }
104
+ exports.MultipleSubgraphsError = MultipleSubgraphsError;
105
+ /**
106
+ * Used for subgraph detection.
107
+ */
108
+ const getSubgraphsSeenSet = () => {
109
+ if (
110
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
111
+ globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")] === undefined) {
112
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
+ globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")] = new Set();
114
+ }
115
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
+ return globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")];
117
+ };
118
+ exports.getSubgraphsSeenSet = getSubgraphsSeenSet;
package/dist/errors.d.ts CHANGED
@@ -30,3 +30,11 @@ export declare class InvalidUpdateError extends Error {
30
30
  constructor(message?: string);
31
31
  static get unminifiable_name(): string;
32
32
  }
33
+ export declare class MultipleSubgraphsError extends Error {
34
+ constructor(message?: string);
35
+ static get unminifiable_name(): string;
36
+ }
37
+ /**
38
+ * Used for subgraph detection.
39
+ */
40
+ export declare const getSubgraphsSeenSet: () => any;
package/dist/errors.js CHANGED
@@ -81,3 +81,25 @@ export class InvalidUpdateError extends Error {
81
81
  return "InvalidUpdateError";
82
82
  }
83
83
  }
84
+ export class MultipleSubgraphsError extends Error {
85
+ constructor(message) {
86
+ super(message);
87
+ this.name = "MultipleSubgraphError";
88
+ }
89
+ static get unminifiable_name() {
90
+ return "MultipleSubgraphError";
91
+ }
92
+ }
93
+ /**
94
+ * Used for subgraph detection.
95
+ */
96
+ export const getSubgraphsSeenSet = () => {
97
+ if (
98
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
99
+ globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")] === undefined) {
100
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
+ globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")] = new Set();
102
+ }
103
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
104
+ return globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")];
105
+ };
@@ -93,6 +93,7 @@ class Graph {
93
93
  writable: true,
94
94
  value: void 0
95
95
  });
96
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
97
  Object.defineProperty(this, "branches", {
97
98
  enumerable: true,
98
99
  configurable: true,
@@ -7,21 +7,23 @@ import type { PregelParams } from "../pregel/types.js";
7
7
  import { BaseChannel } from "../channels/base.js";
8
8
  import { Send } from "../constants.js";
9
9
  import { RunnableCallable } from "../utils.js";
10
+ import { StateDefinition, StateType } from "./annotation.js";
11
+ import type { LangGraphRunnableConfig } from "../pregel/runnable_types.js";
10
12
  /** Special reserved node name denoting the start of a graph. */
11
13
  export declare const START = "__start__";
12
14
  /** Special reserved node name denoting the end of a graph. */
13
15
  export declare const END = "__end__";
14
- export interface BranchOptions<IO, N extends string> {
16
+ export interface BranchOptions<IO, N extends string, CallOptions extends LangGraphRunnableConfig = LangGraphRunnableConfig> {
15
17
  source: N;
16
- path: Branch<IO, N>["condition"];
18
+ path: Branch<IO, N, CallOptions>["condition"];
17
19
  pathMap?: Record<string, N | typeof END> | (N | typeof END)[];
18
20
  }
19
- export declare class Branch<IO, N extends string> {
20
- condition: (input: IO, config?: RunnableConfig) => string | Send | (string | Send)[] | Promise<string | Send | (string | Send)[]>;
21
+ export declare class Branch<IO, N extends string, CallOptions extends LangGraphRunnableConfig = LangGraphRunnableConfig> {
22
+ condition: (input: IO, config: CallOptions) => string | Send | (string | Send)[] | Promise<string | Send | (string | Send)[]>;
21
23
  ends?: Record<string, N | typeof END>;
22
- constructor(options: Omit<BranchOptions<IO, N>, "source">);
23
- compile(writer: (dests: (string | Send)[]) => Runnable | undefined, reader?: (config: RunnableConfig) => IO): RunnableCallable<unknown, unknown>;
24
- _route(input: IO, config: RunnableConfig, writer: (dests: (string | Send)[]) => Runnable | undefined, reader?: (config: RunnableConfig) => IO): Promise<Runnable | undefined>;
24
+ constructor(options: Omit<BranchOptions<IO, N, CallOptions>, "source">);
25
+ compile(writer: (dests: (string | Send)[]) => Runnable | undefined, reader?: (config: CallOptions) => IO): RunnableCallable<unknown, unknown>;
26
+ _route(input: IO, config: CallOptions, writer: (dests: (string | Send)[]) => Runnable | undefined, reader?: (config: CallOptions) => IO): Promise<Runnable | undefined>;
25
27
  }
26
28
  export type NodeSpec<RunInput, RunOutput> = {
27
29
  runnable: Runnable<RunInput, RunOutput>;
@@ -30,19 +32,19 @@ export type NodeSpec<RunInput, RunOutput> = {
30
32
  export type AddNodeOptions = {
31
33
  metadata?: Record<string, unknown>;
32
34
  };
33
- export declare class Graph<N extends string = typeof END, RunInput = any, RunOutput = any, NodeSpecType extends NodeSpec<RunInput, RunOutput> = NodeSpec<RunInput, RunOutput>> {
35
+ export declare class Graph<N extends string = typeof END, RunInput = any, RunOutput = any, NodeSpecType extends NodeSpec<RunInput, RunOutput> = NodeSpec<RunInput, RunOutput>, C extends StateDefinition = StateDefinition> {
34
36
  nodes: Record<N, NodeSpecType>;
35
37
  edges: Set<[N | typeof START, N | typeof END]>;
36
- branches: Record<string, Record<string, Branch<RunInput, N>>>;
38
+ branches: Record<string, Record<string, Branch<RunInput, N, any>>>;
37
39
  entryPoint?: string;
38
40
  compiled: boolean;
39
41
  constructor();
40
42
  protected warnIfCompiled(message: string): void;
41
43
  get allEdges(): Set<[string, string]>;
42
- addNode<K extends string, NodeInput = RunInput>(key: K, action: RunnableLike<NodeInput, RunOutput>, options?: AddNodeOptions): Graph<N | K, RunInput, RunOutput>;
44
+ addNode<K extends string, NodeInput = RunInput>(key: K, action: RunnableLike<NodeInput, RunOutput extends object ? RunOutput & Record<string, any> : RunOutput, LangGraphRunnableConfig<StateType<C>>>, options?: AddNodeOptions): Graph<N | K, RunInput, RunOutput>;
43
45
  addEdge(startKey: N | typeof START, endKey: N | typeof END): this;
44
- addConditionalEdges(source: BranchOptions<RunInput, N>): this;
45
- addConditionalEdges(source: N, path: Branch<RunInput, N>["condition"], pathMap?: BranchOptions<RunInput, N>["pathMap"]): this;
46
+ addConditionalEdges(source: BranchOptions<RunInput, N, LangGraphRunnableConfig<StateType<C>>>): this;
47
+ addConditionalEdges(source: N, path: Branch<RunInput, N, LangGraphRunnableConfig<StateType<C>>>["condition"], pathMap?: BranchOptions<RunInput, N, LangGraphRunnableConfig<StateType<C>>>["pathMap"]): this;
46
48
  /**
47
49
  * @deprecated use `addEdge(START, key)` instead
48
50
  */
@@ -52,7 +54,7 @@ export declare class Graph<N extends string = typeof END, RunInput = any, RunOut
52
54
  */
53
55
  setFinishPoint(key: N): this;
54
56
  compile({ checkpointer, interruptBefore, interruptAfter, }?: {
55
- checkpointer?: BaseCheckpointSaver;
57
+ checkpointer?: BaseCheckpointSaver | false;
56
58
  interruptBefore?: N[] | All;
57
59
  interruptAfter?: N[] | All;
58
60
  }): CompiledGraph<N>;
@@ -89,6 +89,7 @@ export class Graph {
89
89
  writable: true,
90
90
  value: void 0
91
91
  });
92
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
93
  Object.defineProperty(this, "branches", {
93
94
  enumerable: true,
94
95
  configurable: true,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.messagesStateReducer = exports.MessageGraph = exports.StateGraph = exports.Graph = exports.START = exports.END = exports.AnnotationRoot = exports.Annotation = void 0;
3
+ exports.messagesStateReducer = exports.MessageGraph = exports.CompiledStateGraph = exports.StateGraph = exports.Graph = exports.START = exports.END = exports.AnnotationRoot = exports.Annotation = void 0;
4
4
  var annotation_js_1 = require("./annotation.cjs");
5
5
  Object.defineProperty(exports, "Annotation", { enumerable: true, get: function () { return annotation_js_1.Annotation; } });
6
6
  Object.defineProperty(exports, "AnnotationRoot", { enumerable: true, get: function () { return annotation_js_1.AnnotationRoot; } });
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "START", { enumerable: true, get: function () { r
10
10
  Object.defineProperty(exports, "Graph", { enumerable: true, get: function () { return graph_js_1.Graph; } });
11
11
  var state_js_1 = require("./state.cjs");
12
12
  Object.defineProperty(exports, "StateGraph", { enumerable: true, get: function () { return state_js_1.StateGraph; } });
13
+ Object.defineProperty(exports, "CompiledStateGraph", { enumerable: true, get: function () { return state_js_1.CompiledStateGraph; } });
13
14
  var message_js_1 = require("./message.cjs");
14
15
  Object.defineProperty(exports, "MessageGraph", { enumerable: true, get: function () { return message_js_1.MessageGraph; } });
15
16
  Object.defineProperty(exports, "messagesStateReducer", { enumerable: true, get: function () { return message_js_1.messagesStateReducer; } });
@@ -1,4 +1,4 @@
1
1
  export { Annotation, type StateType, type UpdateType, type NodeType, AnnotationRoot, type StateDefinition, type SingleReducer, } from "./annotation.js";
2
2
  export { END, START, Graph, type CompiledGraph } from "./graph.js";
3
- export { type StateGraphArgs, StateGraph, type CompiledStateGraph, } from "./state.js";
3
+ export { type StateGraphArgs, StateGraph, CompiledStateGraph, } from "./state.js";
4
4
  export { MessageGraph, messagesStateReducer, type Messages, } from "./message.js";
@@ -1,4 +1,4 @@
1
1
  export { Annotation, AnnotationRoot, } from "./annotation.js";
2
2
  export { END, START, Graph } from "./graph.js";
3
- export { StateGraph, } from "./state.js";
3
+ export { StateGraph, CompiledStateGraph, } from "./state.js";
4
4
  export { MessageGraph, messagesStateReducer, } from "./message.js";
@@ -312,6 +312,11 @@ function _getChannels(schema) {
312
312
  }
313
313
  return channels;
314
314
  }
315
+ /**
316
+ * Final result from building and compiling a {@link StateGraph}.
317
+ * Should not be instantiated directly, only using the StateGraph `.compile()`
318
+ * instance method.
319
+ */
315
320
  class CompiledStateGraph extends graph_js_1.CompiledGraph {
316
321
  attachNode(key, node) {
317
322
  const stateKeys = Object.keys(this.builder.channels);
@@ -5,6 +5,7 @@ import { END, CompiledGraph, Graph, START, Branch, AddNodeOptions, NodeSpec } fr
5
5
  import { AnnotationRoot, SingleReducer, StateDefinition, StateType, UpdateType } from "./annotation.js";
6
6
  import type { RetryPolicy } from "../pregel/utils/index.js";
7
7
  import { ManagedValueSpec } from "../managed/base.js";
8
+ import type { LangGraphRunnableConfig } from "../pregel/runnable_types.js";
8
9
  export type ChannelReducers<Channels extends object> = {
9
10
  [K in keyof Channels]: SingleReducer<Channels[K], any>;
10
11
  };
@@ -94,7 +95,7 @@ export type StateGraphArgsWithInputOutputSchemas<SD extends StateDefinition, O e
94
95
  * // }
95
96
  * ```
96
97
  */
97
- export declare class StateGraph<SD extends StateDefinition | unknown, S = SD extends StateDefinition ? StateType<SD> : SD, U = SD extends StateDefinition ? UpdateType<SD> : Partial<S>, N extends string = typeof START, I extends StateDefinition = SD extends StateDefinition ? SD : StateDefinition, O extends StateDefinition = SD extends StateDefinition ? SD : StateDefinition, C extends StateDefinition = StateDefinition> extends Graph<N, S, U, StateGraphNodeSpec<S, U>> {
98
+ export declare class StateGraph<SD extends StateDefinition | unknown, S = SD extends StateDefinition ? StateType<SD> : SD, U = SD extends StateDefinition ? UpdateType<SD> : Partial<S>, N extends string = typeof START, I extends StateDefinition = SD extends StateDefinition ? SD : StateDefinition, O extends StateDefinition = SD extends StateDefinition ? SD : StateDefinition, C extends StateDefinition = StateDefinition> extends Graph<N, S, U, StateGraphNodeSpec<S, U>, C> {
98
99
  channels: Record<string, BaseChannel | ManagedValueSpec>;
99
100
  waitingEdges: Set<[N[], N]>;
100
101
  /** @internal */
@@ -113,15 +114,20 @@ export declare class StateGraph<SD extends StateDefinition | unknown, S = SD ext
113
114
  constructor(fields: SD extends StateDefinition ? SD | AnnotationRoot<SD> | StateGraphArgs<S> | StateGraphArgsWithStateSchema<SD, I, O> | StateGraphArgsWithInputOutputSchemas<SD, O> : StateGraphArgs<S>, configSchema?: AnnotationRoot<C>);
114
115
  get allEdges(): Set<[string, string]>;
115
116
  _addSchema(stateDefinition: StateDefinition): void;
116
- addNode<K extends string, NodeInput = S>(key: K, action: RunnableLike<NodeInput, U extends object ? U & Record<string, any> : U>, options?: StateGraphAddNodeOptions): StateGraph<SD, S, U, N | K, I, O, C>;
117
+ addNode<K extends string, NodeInput = S>(key: K, action: RunnableLike<NodeInput, U extends object ? U & Record<string, any> : U, LangGraphRunnableConfig<StateType<C>>>, options?: StateGraphAddNodeOptions): StateGraph<SD, S, U, N | K, I, O, C>;
117
118
  addEdge(startKey: typeof START | N | N[], endKey: N | typeof END): this;
118
119
  compile({ checkpointer, store, interruptBefore, interruptAfter, }?: {
119
- checkpointer?: BaseCheckpointSaver;
120
+ checkpointer?: BaseCheckpointSaver | false;
120
121
  store?: BaseStore;
121
122
  interruptBefore?: N[] | All;
122
123
  interruptAfter?: N[] | All;
123
124
  }): CompiledStateGraph<S, U, N, I, O, C>;
124
125
  }
126
+ /**
127
+ * Final result from building and compiling a {@link StateGraph}.
128
+ * Should not be instantiated directly, only using the StateGraph `.compile()`
129
+ * instance method.
130
+ */
125
131
  export declare class CompiledStateGraph<S, U, N extends string = typeof START, I extends StateDefinition = StateDefinition, O extends StateDefinition = StateDefinition, C extends StateDefinition = StateDefinition> extends CompiledGraph<N, S, U, StateType<C>> {
126
132
  builder: StateGraph<unknown, S, U, N, I, O, C>;
127
133
  attachNode(key: typeof START, node?: never): void;
@@ -308,6 +308,11 @@ function _getChannels(schema) {
308
308
  }
309
309
  return channels;
310
310
  }
311
+ /**
312
+ * Final result from building and compiling a {@link StateGraph}.
313
+ * Should not be instantiated directly, only using the StateGraph `.compile()`
314
+ * instance method.
315
+ */
311
316
  export class CompiledStateGraph extends CompiledGraph {
312
317
  attachNode(key, node) {
313
318
  const stateKeys = Object.keys(this.builder.channels);
@@ -4,6 +4,7 @@ exports.printStepWrites = exports.printStepTasks = exports.printStepCheckpoint =
4
4
  const constants_js_1 = require("../constants.cjs");
5
5
  const errors_js_1 = require("../errors.cjs");
6
6
  const io_js_1 = require("./io.cjs");
7
+ const subgraph_js_1 = require("./utils/subgraph.cjs");
7
8
  const COLORS_MAP = {
8
9
  blue: {
9
10
  start: "\x1b[34m",
@@ -101,7 +102,7 @@ function* mapDebugTaskResults(step, tasks, streamChannels) {
101
102
  }
102
103
  }
103
104
  exports.mapDebugTaskResults = mapDebugTaskResults;
104
- function* mapDebugCheckpoint(step, config, channels, streamChannels, metadata, tasks, pendingWrites) {
105
+ function* mapDebugCheckpoint(step, config, channels, streamChannels, metadata, tasks, pendingWrites, parentConfig) {
105
106
  function formatConfig(config) {
106
107
  // make sure the config is consistent with Python
107
108
  const pyConfig = {};
@@ -123,11 +124,22 @@ function* mapDebugCheckpoint(step, config, channels, streamChannels, metadata, t
123
124
  pyConfig.tags = config.tags;
124
125
  return pyConfig;
125
126
  }
126
- function getCurrentUTC() {
127
- const now = new Date();
128
- return new Date(now.getTime() - now.getTimezoneOffset() * 60 * 1000);
127
+ const parentNs = config.configurable?.checkpoint_ns;
128
+ const taskStates = {};
129
+ for (const task of tasks) {
130
+ if (!(0, subgraph_js_1.findSubgraphPregel)(task.proc))
131
+ continue;
132
+ let taskNs = `${task.name}:${task.id}`;
133
+ if (parentNs)
134
+ taskNs = `${parentNs}|${taskNs}`;
135
+ taskStates[task.id] = {
136
+ configurable: {
137
+ thread_id: config.configurable?.thread_id,
138
+ checkpoint_ns: taskNs,
139
+ },
140
+ };
129
141
  }
130
- const ts = getCurrentUTC().toISOString();
142
+ const ts = new Date().toISOString();
131
143
  yield {
132
144
  type: "checkpoint",
133
145
  timestamp: ts,
@@ -137,7 +149,8 @@ function* mapDebugCheckpoint(step, config, channels, streamChannels, metadata, t
137
149
  values: (0, io_js_1.readChannels)(channels, streamChannels),
138
150
  metadata,
139
151
  next: tasks.map((task) => task.name),
140
- tasks: tasksWithWrites(tasks, pendingWrites),
152
+ tasks: tasksWithWrites(tasks, pendingWrites, taskStates),
153
+ parentConfig: parentConfig ? formatConfig(parentConfig) : undefined,
141
154
  },
142
155
  };
143
156
  }
@@ -26,7 +26,7 @@ export declare function mapDebugTaskResults<N extends PropertyKey, C extends Pro
26
26
  interrupts: PendingWrite<C>[];
27
27
  };
28
28
  }, void, unknown>;
29
- export declare function mapDebugCheckpoint<N extends PropertyKey, C extends PropertyKey>(step: number, config: RunnableConfig, channels: Record<string, BaseChannel>, streamChannels: string | string[], metadata: CheckpointMetadata, tasks: readonly PregelExecutableTask<N, C>[], pendingWrites: CheckpointPendingWrite[]): Generator<{
29
+ export declare function mapDebugCheckpoint<N extends PropertyKey, C extends PropertyKey>(step: number, config: RunnableConfig, channels: Record<string, BaseChannel>, streamChannels: string | string[], metadata: CheckpointMetadata, tasks: readonly PregelExecutableTask<N, C>[], pendingWrites: CheckpointPendingWrite[], parentConfig: RunnableConfig | undefined): Generator<{
30
30
  type: string;
31
31
  timestamp: string;
32
32
  step: number;
@@ -36,6 +36,7 @@ export declare function mapDebugCheckpoint<N extends PropertyKey, C extends Prop
36
36
  metadata: CheckpointMetadata;
37
37
  next: N[];
38
38
  tasks: PregelTaskDescription[];
39
+ parentConfig: Partial<Record<"configurable" | "timeout" | "signal" | "tags" | "metadata" | "callbacks" | "recursion_limit" | "max_concurrency" | "run_name" | "run_id", unknown>> | undefined;
39
40
  };
40
41
  }, void, unknown>;
41
42
  export declare function tasksWithWrites<N extends PropertyKey, C extends PropertyKey>(tasks: PregelTaskDescription[] | readonly PregelExecutableTask<N, C>[], pendingWrites: CheckpointPendingWrite[], states?: Record<string, RunnableConfig | StateSnapshot>): PregelTaskDescription[];
@@ -1,6 +1,7 @@
1
1
  import { ERROR, INTERRUPT, TAG_HIDDEN } from "../constants.js";
2
2
  import { EmptyChannelError } from "../errors.js";
3
3
  import { readChannels } from "./io.js";
4
+ import { findSubgraphPregel } from "./utils/subgraph.js";
4
5
  const COLORS_MAP = {
5
6
  blue: {
6
7
  start: "\x1b[34m",
@@ -95,7 +96,7 @@ export function* mapDebugTaskResults(step, tasks, streamChannels) {
95
96
  };
96
97
  }
97
98
  }
98
- export function* mapDebugCheckpoint(step, config, channels, streamChannels, metadata, tasks, pendingWrites) {
99
+ export function* mapDebugCheckpoint(step, config, channels, streamChannels, metadata, tasks, pendingWrites, parentConfig) {
99
100
  function formatConfig(config) {
100
101
  // make sure the config is consistent with Python
101
102
  const pyConfig = {};
@@ -117,11 +118,22 @@ export function* mapDebugCheckpoint(step, config, channels, streamChannels, meta
117
118
  pyConfig.tags = config.tags;
118
119
  return pyConfig;
119
120
  }
120
- function getCurrentUTC() {
121
- const now = new Date();
122
- return new Date(now.getTime() - now.getTimezoneOffset() * 60 * 1000);
121
+ const parentNs = config.configurable?.checkpoint_ns;
122
+ const taskStates = {};
123
+ for (const task of tasks) {
124
+ if (!findSubgraphPregel(task.proc))
125
+ continue;
126
+ let taskNs = `${task.name}:${task.id}`;
127
+ if (parentNs)
128
+ taskNs = `${parentNs}|${taskNs}`;
129
+ taskStates[task.id] = {
130
+ configurable: {
131
+ thread_id: config.configurable?.thread_id,
132
+ checkpoint_ns: taskNs,
133
+ },
134
+ };
123
135
  }
124
- const ts = getCurrentUTC().toISOString();
136
+ const ts = new Date().toISOString();
125
137
  yield {
126
138
  type: "checkpoint",
127
139
  timestamp: ts,
@@ -131,7 +143,8 @@ export function* mapDebugCheckpoint(step, config, channels, streamChannels, meta
131
143
  values: readChannels(channels, streamChannels),
132
144
  metadata,
133
145
  next: tasks.map((task) => task.name),
134
- tasks: tasksWithWrites(tasks, pendingWrites),
146
+ tasks: tasksWithWrites(tasks, pendingWrites, taskStates),
147
+ parentConfig: parentConfig ? formatConfig(parentConfig) : undefined,
135
148
  },
136
149
  };
137
150
  }
@@ -18,6 +18,7 @@ const constants_js_1 = require("../constants.cjs");
18
18
  const errors_js_1 = require("../errors.cjs");
19
19
  const algo_js_1 = require("./algo.cjs");
20
20
  const index_js_1 = require("./utils/index.cjs");
21
+ const subgraph_js_1 = require("./utils/subgraph.cjs");
21
22
  const loop_js_1 = require("./loop.cjs");
22
23
  const retry_js_1 = require("./retry.cjs");
23
24
  const base_js_2 = require("../managed/base.cjs");
@@ -81,16 +82,6 @@ class Channel {
81
82
  }
82
83
  }
83
84
  exports.Channel = Channel;
84
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
- function isPregel(x) {
86
- return ("inputChannels" in x &&
87
- x.inputChannels !== undefined &&
88
- "outputChannels" &&
89
- x.outputChannels !== undefined);
90
- }
91
- function isRunnableSequence(x) {
92
- return "steps" in x && Array.isArray(x.steps);
93
- }
94
85
  class Pregel extends runnables_1.Runnable {
95
86
  static lc_name() {
96
87
  return "LangGraph";
@@ -264,18 +255,7 @@ class Pregel extends runnables_1.Runnable {
264
255
  continue;
265
256
  }
266
257
  }
267
- // find the subgraph if any
268
- let graph;
269
- const candidates = [node.bound];
270
- for (const candidate of candidates) {
271
- if (isPregel(candidate)) {
272
- graph = candidate;
273
- break;
274
- }
275
- else if (isRunnableSequence(candidate)) {
276
- candidates.push(...candidate.steps);
277
- }
278
- }
258
+ const graph = (0, subgraph_js_1.findSubgraphPregel)(node.bound);
279
259
  // if found, yield recursively
280
260
  if (graph !== undefined) {
281
261
  if (name === namespace) {
@@ -609,7 +589,10 @@ class Pregel extends runnables_1.Runnable {
609
589
  defaultStreamMode = ["values"];
610
590
  }
611
591
  let defaultCheckpointer;
612
- if (config !== undefined &&
592
+ if (this.checkpointer === false) {
593
+ defaultCheckpointer = undefined;
594
+ }
595
+ else if (config !== undefined &&
613
596
  config.configurable?.[constants_js_1.CONFIG_KEY_CHECKPOINTER] !== undefined) {
614
597
  defaultCheckpointer = config.configurable[constants_js_1.CONFIG_KEY_CHECKPOINTER];
615
598
  }
@@ -699,6 +682,7 @@ class Pregel extends runnables_1.Runnable {
699
682
  throw new Error(`Passed "recursionLimit" must be at least 1.`);
700
683
  }
701
684
  if (this.checkpointer !== undefined &&
685
+ this.checkpointer !== false &&
702
686
  inputConfig.configurable === undefined) {
703
687
  throw new Error(`Checkpointer requires one or more of the following "configurable" keys: "thread_id", "checkpoint_ns", "checkpoint_id"`);
704
688
  }
@@ -56,7 +56,7 @@ export declare class Pregel<Nn extends StrRecord<string, PregelNode>, Cc extends
56
56
  interruptBefore?: Array<keyof Nn> | All;
57
57
  stepTimeout?: number;
58
58
  debug: boolean;
59
- checkpointer?: BaseCheckpointSaver;
59
+ checkpointer?: BaseCheckpointSaver | false;
60
60
  retryPolicy?: RetryPolicy;
61
61
  config?: LangGraphRunnableConfig;
62
62
  store?: BaseStore;
@@ -12,6 +12,7 @@ import { CONFIG_KEY_CHECKPOINTER, CONFIG_KEY_READ, CONFIG_KEY_SEND, ERROR, INTER
12
12
  import { GraphRecursionError, GraphValueError, InvalidUpdateError, isGraphInterrupt, } from "../errors.js";
13
13
  import { _prepareNextTasks, _localRead, _applyWrites, } from "./algo.js";
14
14
  import { _coerceToDict, getNewChannelVersions, patchCheckpointMap, } from "./utils/index.js";
15
+ import { findSubgraphPregel } from "./utils/subgraph.js";
15
16
  import { PregelLoop, StreamProtocol } from "./loop.js";
16
17
  import { executeTasksWithRetry } from "./retry.js";
17
18
  import { ChannelKeyPlaceholder, isConfiguredManagedValue, ManagedValueMapping, NoopManagedValue, } from "../managed/base.js";
@@ -74,16 +75,6 @@ export class Channel {
74
75
  return new ChannelWrite(channelWriteEntries);
75
76
  }
76
77
  }
77
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
- function isPregel(x) {
79
- return ("inputChannels" in x &&
80
- x.inputChannels !== undefined &&
81
- "outputChannels" &&
82
- x.outputChannels !== undefined);
83
- }
84
- function isRunnableSequence(x) {
85
- return "steps" in x && Array.isArray(x.steps);
86
- }
87
78
  export class Pregel extends Runnable {
88
79
  static lc_name() {
89
80
  return "LangGraph";
@@ -257,18 +248,7 @@ export class Pregel extends Runnable {
257
248
  continue;
258
249
  }
259
250
  }
260
- // find the subgraph if any
261
- let graph;
262
- const candidates = [node.bound];
263
- for (const candidate of candidates) {
264
- if (isPregel(candidate)) {
265
- graph = candidate;
266
- break;
267
- }
268
- else if (isRunnableSequence(candidate)) {
269
- candidates.push(...candidate.steps);
270
- }
271
- }
251
+ const graph = findSubgraphPregel(node.bound);
272
252
  // if found, yield recursively
273
253
  if (graph !== undefined) {
274
254
  if (name === namespace) {
@@ -602,7 +582,10 @@ export class Pregel extends Runnable {
602
582
  defaultStreamMode = ["values"];
603
583
  }
604
584
  let defaultCheckpointer;
605
- if (config !== undefined &&
585
+ if (this.checkpointer === false) {
586
+ defaultCheckpointer = undefined;
587
+ }
588
+ else if (config !== undefined &&
606
589
  config.configurable?.[CONFIG_KEY_CHECKPOINTER] !== undefined) {
607
590
  defaultCheckpointer = config.configurable[CONFIG_KEY_CHECKPOINTER];
608
591
  }
@@ -692,6 +675,7 @@ export class Pregel extends Runnable {
692
675
  throw new Error(`Passed "recursionLimit" must be at least 1.`);
693
676
  }
694
677
  if (this.checkpointer !== undefined &&
678
+ this.checkpointer !== false &&
695
679
  inputConfig.configurable === undefined) {
696
680
  throw new Error(`Checkpointer requires one or more of the following "configurable" keys: "thread_id", "checkpoint_ns", "checkpoint_id"`);
697
681
  }
@@ -64,7 +64,7 @@ chunk
64
64
  }
65
65
  }
66
66
  else if (Array.isArray(inputChannels)) {
67
- throw new Error("Input chunk must be an object when inputChannels is an array");
67
+ throw new Error(`Input chunk must be an object when "inputChannels" is an array`);
68
68
  }
69
69
  else {
70
70
  yield [inputChannels, chunk];
package/dist/pregel/io.js CHANGED
@@ -59,7 +59,7 @@ chunk
59
59
  }
60
60
  }
61
61
  else if (Array.isArray(inputChannels)) {
62
- throw new Error("Input chunk must be an object when inputChannels is an array");
62
+ throw new Error(`Input chunk must be an object when "inputChannels" is an array`);
63
63
  }
64
64
  else {
65
65
  yield [inputChannels, chunk];
@@ -166,6 +166,12 @@ class PregelLoop {
166
166
  writable: true,
167
167
  value: 0
168
168
  });
169
+ Object.defineProperty(this, "prevCheckpointConfig", {
170
+ enumerable: true,
171
+ configurable: true,
172
+ writable: true,
173
+ value: void 0
174
+ });
169
175
  Object.defineProperty(this, "status", {
170
176
  enumerable: true,
171
177
  configurable: true,
@@ -238,9 +244,11 @@ class PregelLoop {
238
244
  this.store = params.store;
239
245
  this.stream = params.stream;
240
246
  this.checkpointNamespace = params.checkpointNamespace;
247
+ this.prevCheckpointConfig = params.prevCheckpointConfig;
241
248
  }
242
249
  static async initialize(params) {
243
250
  let { config, stream } = params;
251
+ const { checkSubgraphs = true } = params;
244
252
  if (stream !== undefined &&
245
253
  config.configurable?.[constants_js_1.CONFIG_KEY_STREAM] !== undefined) {
246
254
  stream = createDuplexStream(stream, config.configurable[constants_js_1.CONFIG_KEY_STREAM]);
@@ -283,6 +291,7 @@ class PregelLoop {
283
291
  ...saved.config.configurable,
284
292
  },
285
293
  };
294
+ const prevCheckpointConfig = saved.parentConfig;
286
295
  const checkpoint = (0, langgraph_checkpoint_1.copyCheckpoint)(saved.checkpoint);
287
296
  const checkpointMetadata = { ...saved.metadata };
288
297
  const checkpointPendingWrites = saved.pendingWrites ?? [];
@@ -297,6 +306,19 @@ class PregelLoop {
297
306
  // Start the store. This is a batch store, so it will run continuously
298
307
  store.start();
299
308
  }
309
+ if (checkSubgraphs && isNested && params.checkpointer !== undefined) {
310
+ if ((0, errors_js_1.getSubgraphsSeenSet)().has(config.configurable?.checkpoint_ns)) {
311
+ throw new errors_js_1.MultipleSubgraphsError([
312
+ "Detected the same subgraph called multiple times by the same node.",
313
+ "This is not allowed if checkpointing is enabled.",
314
+ "",
315
+ `You can disable checkpointing for a subgraph by compiling it with ".compile({ checkpointer: false });"`,
316
+ ].join("\n"));
317
+ }
318
+ else {
319
+ (0, errors_js_1.getSubgraphsSeenSet)().add(config.configurable?.checkpoint_ns);
320
+ }
321
+ }
300
322
  return new PregelLoop({
301
323
  input: params.input,
302
324
  config,
@@ -304,6 +326,7 @@ class PregelLoop {
304
326
  checkpoint,
305
327
  checkpointMetadata,
306
328
  checkpointConfig,
329
+ prevCheckpointConfig,
307
330
  checkpointNamespace,
308
331
  channels,
309
332
  managed: params.managed,
@@ -453,7 +476,7 @@ class PregelLoop {
453
476
  // Produce debug output
454
477
  if (this.checkpointer) {
455
478
  this._emit(await (0, utils_js_1.gatherIterator)((0, utils_js_1.prefixGenerator)((0, debug_js_1.mapDebugCheckpoint)(this.step - 1, // printing checkpoint for previous step
456
- this.checkpointConfig, this.channels, this.streamKeys, this.checkpointMetadata, Object.values(this.tasks), this.checkpointPendingWrites), "debug")));
479
+ this.checkpointConfig, this.channels, this.streamKeys, this.checkpointMetadata, Object.values(this.tasks), this.checkpointPendingWrites, this.prevCheckpointConfig), "debug")));
457
480
  }
458
481
  if (Object.values(this.tasks).length === 0) {
459
482
  this.status = "done";
@@ -586,6 +609,11 @@ class PregelLoop {
586
609
  };
587
610
  // Bail if no checkpointer
588
611
  if (this.checkpointer !== undefined) {
612
+ // store the previous checkpoint config for debug events
613
+ this.prevCheckpointConfig = this.checkpointConfig?.configurable
614
+ ?.checkpoint_id
615
+ ? this.checkpointConfig
616
+ : undefined;
589
617
  // create new checkpoint
590
618
  this.checkpointMetadata = metadata;
591
619
  // child graphs keep at most one checkpoint per parent checkpoint
@@ -18,6 +18,7 @@ export type PregelLoopInitializeParams = {
18
18
  managed: ManagedValueMapping;
19
19
  stream: StreamProtocol;
20
20
  store?: BaseStore;
21
+ checkSubgraphs?: boolean;
21
22
  };
22
23
  type PregelLoopParams = {
23
24
  input?: any;
@@ -40,6 +41,7 @@ type PregelLoopParams = {
40
41
  isNested: boolean;
41
42
  stream: StreamProtocol;
42
43
  store?: AsyncBatchedStore;
44
+ prevCheckpointConfig: RunnableConfig | undefined;
43
45
  };
44
46
  export declare class StreamProtocol {
45
47
  push: (chunk: StreamChunk) => void;
@@ -67,6 +69,7 @@ export declare class PregelLoop {
67
69
  protected nodes: Record<string, PregelNode>;
68
70
  protected skipDoneTasks: boolean;
69
71
  protected taskWritesLeft: number;
72
+ protected prevCheckpointConfig: RunnableConfig | undefined;
70
73
  status: "pending" | "done" | "interrupt_before" | "interrupt_after" | "out_of_steps";
71
74
  tasks: Record<string, PregelExecutableTask<any, any>>;
72
75
  stream: StreamProtocol;
@@ -4,7 +4,7 @@ import { CHECKPOINT_NAMESPACE_SEPARATOR, CONFIG_KEY_CHECKPOINT_MAP, CONFIG_KEY_R
4
4
  import { _applyWrites, _prepareNextTasks, increment, shouldInterrupt, } from "./algo.js";
5
5
  import { gatherIterator, gatherIteratorSync, prefixGenerator, } from "../utils.js";
6
6
  import { mapInput, mapOutputUpdates, mapOutputValues, readChannels, } from "./io.js";
7
- import { EmptyInputError, GraphInterrupt, isGraphInterrupt, } from "../errors.js";
7
+ import { getSubgraphsSeenSet, EmptyInputError, GraphInterrupt, isGraphInterrupt, MultipleSubgraphsError, } from "../errors.js";
8
8
  import { getNewChannelVersions, patchConfigurable } from "./utils/index.js";
9
9
  import { mapDebugTasks, mapDebugCheckpoint, mapDebugTaskResults, } from "./debug.js";
10
10
  const INPUT_DONE = Symbol.for("INPUT_DONE");
@@ -162,6 +162,12 @@ export class PregelLoop {
162
162
  writable: true,
163
163
  value: 0
164
164
  });
165
+ Object.defineProperty(this, "prevCheckpointConfig", {
166
+ enumerable: true,
167
+ configurable: true,
168
+ writable: true,
169
+ value: void 0
170
+ });
165
171
  Object.defineProperty(this, "status", {
166
172
  enumerable: true,
167
173
  configurable: true,
@@ -234,9 +240,11 @@ export class PregelLoop {
234
240
  this.store = params.store;
235
241
  this.stream = params.stream;
236
242
  this.checkpointNamespace = params.checkpointNamespace;
243
+ this.prevCheckpointConfig = params.prevCheckpointConfig;
237
244
  }
238
245
  static async initialize(params) {
239
246
  let { config, stream } = params;
247
+ const { checkSubgraphs = true } = params;
240
248
  if (stream !== undefined &&
241
249
  config.configurable?.[CONFIG_KEY_STREAM] !== undefined) {
242
250
  stream = createDuplexStream(stream, config.configurable[CONFIG_KEY_STREAM]);
@@ -279,6 +287,7 @@ export class PregelLoop {
279
287
  ...saved.config.configurable,
280
288
  },
281
289
  };
290
+ const prevCheckpointConfig = saved.parentConfig;
282
291
  const checkpoint = copyCheckpoint(saved.checkpoint);
283
292
  const checkpointMetadata = { ...saved.metadata };
284
293
  const checkpointPendingWrites = saved.pendingWrites ?? [];
@@ -293,6 +302,19 @@ export class PregelLoop {
293
302
  // Start the store. This is a batch store, so it will run continuously
294
303
  store.start();
295
304
  }
305
+ if (checkSubgraphs && isNested && params.checkpointer !== undefined) {
306
+ if (getSubgraphsSeenSet().has(config.configurable?.checkpoint_ns)) {
307
+ throw new MultipleSubgraphsError([
308
+ "Detected the same subgraph called multiple times by the same node.",
309
+ "This is not allowed if checkpointing is enabled.",
310
+ "",
311
+ `You can disable checkpointing for a subgraph by compiling it with ".compile({ checkpointer: false });"`,
312
+ ].join("\n"));
313
+ }
314
+ else {
315
+ getSubgraphsSeenSet().add(config.configurable?.checkpoint_ns);
316
+ }
317
+ }
296
318
  return new PregelLoop({
297
319
  input: params.input,
298
320
  config,
@@ -300,6 +322,7 @@ export class PregelLoop {
300
322
  checkpoint,
301
323
  checkpointMetadata,
302
324
  checkpointConfig,
325
+ prevCheckpointConfig,
303
326
  checkpointNamespace,
304
327
  channels,
305
328
  managed: params.managed,
@@ -449,7 +472,7 @@ export class PregelLoop {
449
472
  // Produce debug output
450
473
  if (this.checkpointer) {
451
474
  this._emit(await gatherIterator(prefixGenerator(mapDebugCheckpoint(this.step - 1, // printing checkpoint for previous step
452
- this.checkpointConfig, this.channels, this.streamKeys, this.checkpointMetadata, Object.values(this.tasks), this.checkpointPendingWrites), "debug")));
475
+ this.checkpointConfig, this.channels, this.streamKeys, this.checkpointMetadata, Object.values(this.tasks), this.checkpointPendingWrites, this.prevCheckpointConfig), "debug")));
453
476
  }
454
477
  if (Object.values(this.tasks).length === 0) {
455
478
  this.status = "done";
@@ -582,6 +605,11 @@ export class PregelLoop {
582
605
  };
583
606
  // Bail if no checkpointer
584
607
  if (this.checkpointer !== undefined) {
608
+ // store the previous checkpoint config for debug events
609
+ this.prevCheckpointConfig = this.checkpointConfig?.configurable
610
+ ?.checkpoint_id
611
+ ? this.checkpointConfig
612
+ : undefined;
585
613
  // create new checkpoint
586
614
  this.checkpointMetadata = metadata;
587
615
  // child graphs keep at most one checkpoint per parent checkpoint
@@ -132,6 +132,13 @@ pregelTask, retryPolicy) {
132
132
  error.constructor.name;
133
133
  console.log(`Retrying task "${pregelTask.name}" after ${interval.toFixed(2)} seconds (attempt ${attempts}) after ${errorName}: ${error}`);
134
134
  }
135
+ finally {
136
+ // Clear checkpoint_ns seen (for subgraph detection)
137
+ const checkpointNs = pregelTask.config?.configurable?.checkpoint_ns;
138
+ if (checkpointNs) {
139
+ (0, errors_js_1.getSubgraphsSeenSet)().delete(checkpointNs);
140
+ }
141
+ }
135
142
  }
136
143
  return {
137
144
  task: pregelTask,
@@ -1,4 +1,4 @@
1
- import { isGraphInterrupt } from "../errors.js";
1
+ import { getSubgraphsSeenSet, isGraphInterrupt } from "../errors.js";
2
2
  export const DEFAULT_INITIAL_INTERVAL = 500;
3
3
  export const DEFAULT_BACKOFF_FACTOR = 2;
4
4
  export const DEFAULT_MAX_INTERVAL = 128000;
@@ -128,6 +128,13 @@ pregelTask, retryPolicy) {
128
128
  error.constructor.name;
129
129
  console.log(`Retrying task "${pregelTask.name}" after ${interval.toFixed(2)} seconds (attempt ${attempts}) after ${errorName}: ${error}`);
130
130
  }
131
+ finally {
132
+ // Clear checkpoint_ns seen (for subgraph detection)
133
+ const checkpointNs = pregelTask.config?.configurable?.checkpoint_ns;
134
+ if (checkpointNs) {
135
+ getSubgraphsSeenSet().delete(checkpointNs);
136
+ }
137
+ }
131
138
  }
132
139
  return {
133
140
  task: pregelTask,
@@ -1,5 +1,5 @@
1
1
  import { RunnableConfig } from "@langchain/core/runnables";
2
2
  import { BaseStore } from "@langchain/langgraph-checkpoint";
3
- export interface LangGraphRunnableConfig extends RunnableConfig {
3
+ export interface LangGraphRunnableConfig<ConfigurableType extends Record<string, any> = Record<string, any>> extends RunnableConfig<ConfigurableType> {
4
4
  store?: BaseStore;
5
5
  }
@@ -44,7 +44,7 @@ export interface PregelInterface<Nn extends StrRecord<string, PregelNode>, Cc ex
44
44
  * @default false
45
45
  */
46
46
  debug?: boolean;
47
- checkpointer?: BaseCheckpointSaver;
47
+ checkpointer?: BaseCheckpointSaver | false;
48
48
  retryPolicy?: RetryPolicy;
49
49
  config?: LangGraphRunnableConfig;
50
50
  /**
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findSubgraphPregel = void 0;
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ function isRunnableSequence(x) {
6
+ return "steps" in x && Array.isArray(x.steps);
7
+ }
8
+ function isPregelLike(
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ x
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ ) {
13
+ return ("inputChannels" in x &&
14
+ x.inputChannels !== undefined &&
15
+ "outputChannels" &&
16
+ x.outputChannels !== undefined);
17
+ }
18
+ function findSubgraphPregel(candidate
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ ) {
21
+ const candidates = [candidate];
22
+ for (const candidate of candidates) {
23
+ if (isPregelLike(candidate)) {
24
+ return candidate;
25
+ }
26
+ else if (isRunnableSequence(candidate)) {
27
+ candidates.push(...candidate.steps);
28
+ }
29
+ }
30
+ return undefined;
31
+ }
32
+ exports.findSubgraphPregel = findSubgraphPregel;
@@ -0,0 +1,3 @@
1
+ import { Runnable } from "@langchain/core/runnables";
2
+ import type { PregelInterface } from "../types.js";
3
+ export declare function findSubgraphPregel(candidate: Runnable): PregelInterface<any, any> | undefined;
@@ -0,0 +1,28 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ function isRunnableSequence(x) {
3
+ return "steps" in x && Array.isArray(x.steps);
4
+ }
5
+ function isPregelLike(
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ x
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ ) {
10
+ return ("inputChannels" in x &&
11
+ x.inputChannels !== undefined &&
12
+ "outputChannels" &&
13
+ x.outputChannels !== undefined);
14
+ }
15
+ export function findSubgraphPregel(candidate
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ ) {
18
+ const candidates = [candidate];
19
+ for (const candidate of candidates) {
20
+ if (isPregelLike(candidate)) {
21
+ return candidate;
22
+ }
23
+ else if (isRunnableSequence(candidate)) {
24
+ candidates.push(...candidate.steps);
25
+ }
26
+ }
27
+ return undefined;
28
+ }
package/dist/web.cjs CHANGED
@@ -14,12 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.MessagesAnnotation = exports.InMemoryStore = exports.AsyncBatchedStore = exports.BaseStore = exports.BaseCheckpointSaver = exports.emptyCheckpoint = exports.copyCheckpoint = exports.MemorySaver = exports.Send = exports.BinaryOperatorAggregate = exports.BaseChannel = exports.Annotation = exports.messagesStateReducer = exports.MessageGraph = exports.StateGraph = exports.START = exports.Graph = exports.END = void 0;
17
+ exports.MessagesAnnotation = exports.InMemoryStore = exports.AsyncBatchedStore = exports.BaseStore = exports.BaseCheckpointSaver = exports.emptyCheckpoint = exports.copyCheckpoint = exports.MemorySaver = exports.Send = exports.BinaryOperatorAggregate = exports.BaseChannel = exports.Annotation = exports.messagesStateReducer = exports.MessageGraph = exports.CompiledStateGraph = exports.StateGraph = exports.START = exports.Graph = exports.END = void 0;
18
18
  var index_js_1 = require("./graph/index.cjs");
19
19
  Object.defineProperty(exports, "END", { enumerable: true, get: function () { return index_js_1.END; } });
20
20
  Object.defineProperty(exports, "Graph", { enumerable: true, get: function () { return index_js_1.Graph; } });
21
21
  Object.defineProperty(exports, "START", { enumerable: true, get: function () { return index_js_1.START; } });
22
22
  Object.defineProperty(exports, "StateGraph", { enumerable: true, get: function () { return index_js_1.StateGraph; } });
23
+ Object.defineProperty(exports, "CompiledStateGraph", { enumerable: true, get: function () { return index_js_1.CompiledStateGraph; } });
23
24
  Object.defineProperty(exports, "MessageGraph", { enumerable: true, get: function () { return index_js_1.MessageGraph; } });
24
25
  Object.defineProperty(exports, "messagesStateReducer", { enumerable: true, get: function () { return index_js_1.messagesStateReducer; } });
25
26
  Object.defineProperty(exports, "Annotation", { enumerable: true, get: function () { return index_js_1.Annotation; } });
package/dist/web.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { END, Graph, type StateGraphArgs, START, StateGraph, type CompiledStateGraph, MessageGraph, messagesStateReducer, type Messages, Annotation, type StateType, type UpdateType, type NodeType, type StateDefinition, type SingleReducer, type CompiledGraph, } from "./graph/index.js";
1
+ export { END, Graph, type StateGraphArgs, START, StateGraph, CompiledStateGraph, MessageGraph, messagesStateReducer, type Messages, Annotation, type StateType, type UpdateType, type NodeType, type StateDefinition, type SingleReducer, type CompiledGraph, } from "./graph/index.js";
2
2
  export type { StateSnapshot } from "./pregel/types.js";
3
3
  export * from "./errors.js";
4
4
  export { BaseChannel, type BinaryOperator, BinaryOperatorAggregate, type AnyValue, type WaitForNames, type DynamicBarrierValue, type LastValue, type NamedBarrierValue, type Topic, } from "./channels/index.js";
package/dist/web.js CHANGED
@@ -1,4 +1,4 @@
1
- export { END, Graph, START, StateGraph, MessageGraph, messagesStateReducer, Annotation, } from "./graph/index.js";
1
+ export { END, Graph, START, StateGraph, CompiledStateGraph, MessageGraph, messagesStateReducer, Annotation, } from "./graph/index.js";
2
2
  export * from "./errors.js";
3
3
  export { BaseChannel, BinaryOperatorAggregate, } from "./channels/index.js";
4
4
  export { Send } from "./constants.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -31,19 +31,19 @@
31
31
  "author": "LangChain",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@langchain/langgraph-checkpoint": "~0.0.9",
34
+ "@langchain/langgraph-checkpoint": "~0.0.10",
35
35
  "double-ended-queue": "^2.1.0-0",
36
36
  "uuid": "^10.0.0",
37
37
  "zod": "^3.23.8"
38
38
  },
39
39
  "peerDependencies": {
40
- "@langchain/core": ">=0.2.35 <0.3.0 || >=0.3.8 < 0.4.0"
40
+ "@langchain/core": ">=0.2.36 <0.3.0 || >=0.3.9 < 0.4.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "^29.5.0",
44
44
  "@langchain/anthropic": "^0.3.0",
45
45
  "@langchain/community": "^0.3.0",
46
- "@langchain/core": "^0.3.6",
46
+ "@langchain/core": "^0.3.10",
47
47
  "@langchain/langgraph-checkpoint-postgres": "workspace:*",
48
48
  "@langchain/langgraph-checkpoint-sqlite": "workspace:*",
49
49
  "@langchain/openai": "^0.3.0",