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

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/README.md CHANGED
@@ -24,7 +24,7 @@ LangGraph is inspired by [Pregel](https://research.google/pubs/pub37252/) and [A
24
24
  ## Installation
25
25
 
26
26
  ```bash
27
- npm install @langchain/langgraph
27
+ npm install @langchain/langgraph @langchain/core
28
28
  ```
29
29
 
30
30
  ## Example
package/dist/_types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { type AnyValue, type WaitForNames, type DynamicBarrierValue, type LastValue, type NamedBarrierValue, type Topic, } from "./channels/index.js";
2
- export { type AnnotationRoot, type StateType, type UpdateType, type NodeType, } from "./graph/index.js";
2
+ export { type AnnotationRoot, } from "./graph/index.js";
@@ -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([
@@ -139,7 +139,7 @@ getNextVersion) {
139
139
  }
140
140
  catch (e) {
141
141
  if (e.name === errors_js_1.InvalidUpdateError.unminifiable_name) {
142
- throw new errors_js_1.InvalidUpdateError(`Invalid update for channel ${chan} with values ${JSON.stringify(vals)}`);
142
+ throw new errors_js_1.InvalidUpdateError(`Invalid update for channel ${chan} with values ${JSON.stringify(vals)}: ${e.message}`);
143
143
  }
144
144
  else {
145
145
  throw e;
@@ -132,7 +132,7 @@ getNextVersion) {
132
132
  }
133
133
  catch (e) {
134
134
  if (e.name === InvalidUpdateError.unminifiable_name) {
135
- throw new InvalidUpdateError(`Invalid update for channel ${chan} with values ${JSON.stringify(vals)}`);
135
+ throw new InvalidUpdateError(`Invalid update for channel ${chan} with values ${JSON.stringify(vals)}: ${e.message}`);
136
136
  }
137
137
  else {
138
138
  throw e;
package/dist/web.d.ts CHANGED
@@ -1,6 +1,6 @@
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";
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";
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.4",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {