@langchain/langgraph 0.2.0-rc.2 → 0.2.0-rc.3

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.
@@ -98,12 +98,6 @@ class Graph {
98
98
  writable: true,
99
99
  value: false
100
100
  });
101
- Object.defineProperty(this, "supportMultipleEdges", {
102
- enumerable: true,
103
- configurable: true,
104
- writable: true,
105
- value: false
106
- });
107
101
  this.nodes = {};
108
102
  this.edges = new Set();
109
103
  this.branches = {};
@@ -143,9 +137,9 @@ class Graph {
143
137
  if (endKey === exports.START) {
144
138
  throw new Error("START cannot be an end node");
145
139
  }
146
- if (!this.supportMultipleEdges &&
147
- Array.from(this.edges).some(([start]) => start === startKey)) {
148
- throw new Error(`Already found path for ${startKey}. For multiple edges, use StateGraph with an annotated state key.`);
140
+ if (Array.from(this.edges).some(([start]) => start === startKey) &&
141
+ !("channels" in this)) {
142
+ throw new Error(`Already found path for ${startKey}. For multiple edges, use StateGraph.`);
149
143
  }
150
144
  this.edges.add([startKey, endKey]);
151
145
  return this;
@@ -36,7 +36,6 @@ export declare class Graph<N extends string = typeof END, RunInput = any, RunOut
36
36
  branches: Record<string, Record<string, Branch<RunInput, N>>>;
37
37
  entryPoint?: string;
38
38
  compiled: boolean;
39
- supportMultipleEdges: boolean;
40
39
  constructor();
41
40
  protected warnIfCompiled(message: string): void;
42
41
  get allEdges(): Set<[string, string]>;
@@ -94,12 +94,6 @@ export class Graph {
94
94
  writable: true,
95
95
  value: false
96
96
  });
97
- Object.defineProperty(this, "supportMultipleEdges", {
98
- enumerable: true,
99
- configurable: true,
100
- writable: true,
101
- value: false
102
- });
103
97
  this.nodes = {};
104
98
  this.edges = new Set();
105
99
  this.branches = {};
@@ -139,9 +133,9 @@ export class Graph {
139
133
  if (endKey === START) {
140
134
  throw new Error("START cannot be an end node");
141
135
  }
142
- if (!this.supportMultipleEdges &&
143
- Array.from(this.edges).some(([start]) => start === startKey)) {
144
- throw new Error(`Already found path for ${startKey}. For multiple edges, use StateGraph with an annotated state key.`);
136
+ if (Array.from(this.edges).some(([start]) => start === startKey) &&
137
+ !("channels" in this)) {
138
+ throw new Error(`Already found path for ${startKey}. For multiple edges, use StateGraph.`);
145
139
  }
146
140
  this.edges.add([startKey, endKey]);
147
141
  return this;
@@ -150,12 +150,6 @@ class StateGraph extends graph_js_1.Graph {
150
150
  this._addSchema(this._schemaDefinition);
151
151
  this._addSchema(this._inputDefinition);
152
152
  this._addSchema(this._outputDefinition);
153
- for (const c of Object.values(this.channels)) {
154
- if (c.lc_graph_name === "BinaryOperatorAggregate") {
155
- this.supportMultipleEdges = true;
156
- break;
157
- }
158
- }
159
153
  }
160
154
  get allEdges() {
161
155
  return new Set([
@@ -147,12 +147,6 @@ export class StateGraph extends Graph {
147
147
  this._addSchema(this._schemaDefinition);
148
148
  this._addSchema(this._inputDefinition);
149
149
  this._addSchema(this._outputDefinition);
150
- for (const c of Object.values(this.channels)) {
151
- if (c.lc_graph_name === "BinaryOperatorAggregate") {
152
- this.supportMultipleEdges = true;
153
- break;
154
- }
155
- }
156
150
  }
157
151
  get allEdges() {
158
152
  return new Set([
package/dist/web.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { END, Graph, type StateGraphArgs, START, StateGraph, type CompiledStateGraph, MessageGraph, messagesStateReducer, type Messages, Annotation, type StateDefinition, type SingleReducer, type CompiledGraph, } from "./graph/index.js";
2
2
  export * from "./errors.js";
3
- export { BaseChannel, type BinaryOperator, BinaryOperatorAggregate } from "./channels/index.js";
3
+ export { BaseChannel, type BinaryOperator, BinaryOperatorAggregate, } from "./channels/index.js";
4
4
  export { type RetryPolicy } from "./pregel/utils.js";
5
5
  export { Send } from "./constants.js";
6
6
  export { MemorySaver, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, copyCheckpoint, emptyCheckpoint, BaseCheckpointSaver, } from "@langchain/langgraph-checkpoint";
package/dist/web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { END, Graph, START, StateGraph, MessageGraph, messagesStateReducer, Annotation, } from "./graph/index.js";
2
2
  export * from "./errors.js";
3
- export { BaseChannel, BinaryOperatorAggregate } from "./channels/index.js";
3
+ export { BaseChannel, BinaryOperatorAggregate, } from "./channels/index.js";
4
4
  export { Send } from "./constants.js";
5
5
  export { MemorySaver, copyCheckpoint, emptyCheckpoint, BaseCheckpointSaver, } from "@langchain/langgraph-checkpoint";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.2.0-rc.2",
3
+ "version": "0.2.0-rc.3",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {