@langchain/langgraph 0.1.4-rc.2 → 0.1.5
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/channels/any_value.cjs +2 -4
- package/dist/channels/any_value.d.ts +1 -3
- package/dist/channels/any_value.js +1 -3
- package/dist/channels/base.cjs +0 -3
- package/dist/channels/base.d.ts +0 -3
- package/dist/channels/base.js +0 -3
- package/dist/channels/binop.cjs +0 -1
- package/dist/channels/binop.d.ts +0 -1
- package/dist/channels/binop.js +0 -1
- package/dist/channels/dynamic_barrier_value.cjs +9 -10
- package/dist/channels/dynamic_barrier_value.d.ts +8 -9
- package/dist/channels/dynamic_barrier_value.js +8 -9
- package/dist/channels/ephemeral_value.cjs +2 -3
- package/dist/channels/ephemeral_value.d.ts +1 -2
- package/dist/channels/ephemeral_value.js +1 -2
- package/dist/channels/index.d.ts +0 -6
- package/dist/channels/last_value.cjs +2 -4
- package/dist/channels/last_value.d.ts +1 -3
- package/dist/channels/last_value.js +1 -3
- package/dist/channels/named_barrier_value.cjs +2 -3
- package/dist/channels/named_barrier_value.d.ts +1 -2
- package/dist/channels/named_barrier_value.js +1 -2
- package/dist/channels/topic.cjs +0 -3
- package/dist/channels/topic.d.ts +0 -3
- package/dist/channels/topic.js +0 -3
- package/dist/graph/graph.d.ts +1 -1
- package/dist/graph/index.cjs +2 -1
- package/dist/graph/index.d.ts +1 -1
- package/dist/graph/index.js +1 -1
- package/dist/pregel/algo.cjs +2 -2
- package/dist/pregel/algo.js +3 -3
- package/dist/pregel/index.cjs +1 -3
- package/dist/pregel/index.js +2 -4
- package/dist/web.cjs +5 -1
- package/dist/web.d.ts +2 -2
- package/dist/web.js +2 -1
- package/package.json +2 -2
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AnyValue = void 0;
|
|
4
4
|
const errors_js_1 = require("../errors.cjs");
|
|
5
|
-
const
|
|
5
|
+
const index_js_1 = require("./index.cjs");
|
|
6
6
|
/**
|
|
7
7
|
* Stores the last value received, assumes that if multiple values are received, they are all equal.
|
|
8
8
|
*
|
|
9
9
|
* Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values
|
|
10
10
|
* will be continuously overwritten.
|
|
11
|
-
*
|
|
12
|
-
* @internal
|
|
13
11
|
*/
|
|
14
|
-
class AnyValue extends
|
|
12
|
+
class AnyValue extends index_js_1.BaseChannel {
|
|
15
13
|
constructor() {
|
|
16
14
|
super();
|
|
17
15
|
Object.defineProperty(this, "lc_graph_name", {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { BaseChannel } from "./
|
|
1
|
+
import { BaseChannel } from "./index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Stores the last value received, assumes that if multiple values are received, they are all equal.
|
|
4
4
|
*
|
|
5
5
|
* Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values
|
|
6
6
|
* will be continuously overwritten.
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
9
7
|
*/
|
|
10
8
|
export declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {
|
|
11
9
|
lc_graph_name: string;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { EmptyChannelError } from "../errors.js";
|
|
2
|
-
import { BaseChannel } from "./
|
|
2
|
+
import { BaseChannel } from "./index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Stores the last value received, assumes that if multiple values are received, they are all equal.
|
|
5
5
|
*
|
|
6
6
|
* Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values
|
|
7
7
|
* will be continuously overwritten.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
8
|
*/
|
|
11
9
|
export class AnyValue extends BaseChannel {
|
|
12
10
|
constructor() {
|
package/dist/channels/base.cjs
CHANGED
|
@@ -3,9 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createCheckpoint = exports.emptyChannels = exports.BaseChannel = void 0;
|
|
4
4
|
const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
|
|
5
5
|
const errors_js_1 = require("../errors.cjs");
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
6
|
class BaseChannel {
|
|
10
7
|
constructor() {
|
|
11
8
|
Object.defineProperty(this, "ValueType", {
|
package/dist/channels/base.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { ReadonlyCheckpoint, Checkpoint } from "@langchain/langgraph-checkpoint";
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
2
|
export declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {
|
|
6
3
|
ValueType: ValueType;
|
|
7
4
|
UpdateType: UpdateType;
|
package/dist/channels/base.js
CHANGED
package/dist/channels/binop.cjs
CHANGED
|
@@ -5,7 +5,6 @@ const errors_js_1 = require("../errors.cjs");
|
|
|
5
5
|
const base_js_1 = require("./base.cjs");
|
|
6
6
|
/**
|
|
7
7
|
* Stores the result of applying a binary operator to the current value and each new value.
|
|
8
|
-
* @internal
|
|
9
8
|
*/
|
|
10
9
|
class BinaryOperatorAggregate extends base_js_1.BaseChannel {
|
|
11
10
|
constructor(operator, initialValueFactory) {
|
package/dist/channels/binop.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { BaseChannel } from "./base.js";
|
|
|
2
2
|
export type BinaryOperator<ValueType, UpdateType> = (a: ValueType, b: UpdateType) => ValueType;
|
|
3
3
|
/**
|
|
4
4
|
* Stores the result of applying a binary operator to the current value and each new value.
|
|
5
|
-
* @internal
|
|
6
5
|
*/
|
|
7
6
|
export declare class BinaryOperatorAggregate<ValueType, UpdateType = ValueType> extends BaseChannel<ValueType, UpdateType, ValueType> {
|
|
8
7
|
lc_graph_name: string;
|
package/dist/channels/binop.js
CHANGED
|
@@ -2,7 +2,6 @@ import { EmptyChannelError } from "../errors.js";
|
|
|
2
2
|
import { BaseChannel } from "./base.js";
|
|
3
3
|
/**
|
|
4
4
|
* Stores the result of applying a binary operator to the current value and each new value.
|
|
5
|
-
* @internal
|
|
6
5
|
*/
|
|
7
6
|
export class BinaryOperatorAggregate extends BaseChannel {
|
|
8
7
|
constructor(operator, initialValueFactory) {
|
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DynamicBarrierValue = void 0;
|
|
4
4
|
const errors_js_1 = require("../errors.cjs");
|
|
5
|
-
const
|
|
5
|
+
const index_js_1 = require("./index.cjs");
|
|
6
6
|
const named_barrier_value_js_1 = require("./named_barrier_value.cjs");
|
|
7
7
|
function isWaitForNames(v) {
|
|
8
8
|
return v.__names !== undefined;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @internal
|
|
11
|
+
A channel that switches between two states
|
|
12
|
+
|
|
13
|
+
- in the "priming" state it can't be read from.
|
|
14
|
+
- if it receives a WaitForNames update, it switches to the "waiting" state.
|
|
15
|
+
- in the "waiting" state it collects named values until all are received.
|
|
16
|
+
- once all named values are received, it can be read once, and it switches
|
|
17
|
+
back to the "priming" state.
|
|
19
18
|
*/
|
|
20
|
-
class DynamicBarrierValue extends
|
|
19
|
+
class DynamicBarrierValue extends index_js_1.BaseChannel {
|
|
21
20
|
constructor() {
|
|
22
21
|
super();
|
|
23
22
|
Object.defineProperty(this, "lc_graph_name", {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { BaseChannel } from "./
|
|
1
|
+
import { BaseChannel } from "./index.js";
|
|
2
2
|
export interface WaitForNames<Value> {
|
|
3
3
|
__names: Value[];
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @internal
|
|
6
|
+
A channel that switches between two states
|
|
7
|
+
|
|
8
|
+
- in the "priming" state it can't be read from.
|
|
9
|
+
- if it receives a WaitForNames update, it switches to the "waiting" state.
|
|
10
|
+
- in the "waiting" state it collects named values until all are received.
|
|
11
|
+
- once all named values are received, it can be read once, and it switches
|
|
12
|
+
back to the "priming" state.
|
|
14
13
|
*/
|
|
15
14
|
export declare class DynamicBarrierValue<Value> extends BaseChannel<void, Value | WaitForNames<Value>, [
|
|
16
15
|
Value[] | undefined,
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { EmptyChannelError, InvalidUpdateError } from "../errors.js";
|
|
2
|
-
import { BaseChannel } from "./
|
|
2
|
+
import { BaseChannel } from "./index.js";
|
|
3
3
|
import { areSetsEqual } from "./named_barrier_value.js";
|
|
4
4
|
function isWaitForNames(v) {
|
|
5
5
|
return v.__names !== undefined;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @internal
|
|
8
|
+
A channel that switches between two states
|
|
9
|
+
|
|
10
|
+
- in the "priming" state it can't be read from.
|
|
11
|
+
- if it receives a WaitForNames update, it switches to the "waiting" state.
|
|
12
|
+
- in the "waiting" state it collects named values until all are received.
|
|
13
|
+
- once all named values are received, it can be read once, and it switches
|
|
14
|
+
back to the "priming" state.
|
|
16
15
|
*/
|
|
17
16
|
export class DynamicBarrierValue extends BaseChannel {
|
|
18
17
|
constructor() {
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EphemeralValue = void 0;
|
|
4
4
|
const errors_js_1 = require("../errors.cjs");
|
|
5
|
-
const
|
|
5
|
+
const index_js_1 = require("./index.cjs");
|
|
6
6
|
/**
|
|
7
7
|
* Stores the value received in the step immediately preceding, clears after.
|
|
8
|
-
* @internal
|
|
9
8
|
*/
|
|
10
|
-
class EphemeralValue extends
|
|
9
|
+
class EphemeralValue extends index_js_1.BaseChannel {
|
|
11
10
|
constructor(guard = true) {
|
|
12
11
|
super();
|
|
13
12
|
Object.defineProperty(this, "lc_graph_name", {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { BaseChannel } from "./
|
|
1
|
+
import { BaseChannel } from "./index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Stores the value received in the step immediately preceding, clears after.
|
|
4
|
-
* @internal
|
|
5
4
|
*/
|
|
6
5
|
export declare class EphemeralValue<Value> extends BaseChannel<Value, Value, Value> {
|
|
7
6
|
lc_graph_name: string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { EmptyChannelError, InvalidUpdateError } from "../errors.js";
|
|
2
|
-
import { BaseChannel } from "./
|
|
2
|
+
import { BaseChannel } from "./index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Stores the value received in the step immediately preceding, clears after.
|
|
5
|
-
* @internal
|
|
6
5
|
*/
|
|
7
6
|
export class EphemeralValue extends BaseChannel {
|
|
8
7
|
constructor(guard = true) {
|
package/dist/channels/index.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
export { type AnyValue } from "./any_value.js";
|
|
2
1
|
export { BaseChannel, createCheckpoint, emptyChannels as empty, } from "./base.js";
|
|
3
2
|
export { type BinaryOperator, BinaryOperatorAggregate } from "./binop.js";
|
|
4
|
-
export { type DynamicBarrierValue } from "./dynamic_barrier_value.js";
|
|
5
|
-
export { type EphemeralValue } from "./ephemeral_value.js";
|
|
6
|
-
export { type LastValue } from "./last_value.js";
|
|
7
|
-
export { type NamedBarrierValue } from "./named_barrier_value.js";
|
|
8
|
-
export { type Topic } from "./topic.js";
|
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LastValue = void 0;
|
|
4
4
|
const errors_js_1 = require("../errors.cjs");
|
|
5
|
-
const
|
|
5
|
+
const index_js_1 = require("./index.cjs");
|
|
6
6
|
/**
|
|
7
7
|
* Stores the last value received, can receive at most one value per step.
|
|
8
8
|
*
|
|
9
9
|
* Since `update` is only called once per step and value can only be of length 1,
|
|
10
10
|
* LastValue always stores the last value of a single node. If multiple nodes attempt to
|
|
11
11
|
* write to this channel in a single step, an error will be thrown.
|
|
12
|
-
*
|
|
13
|
-
* @internal
|
|
14
12
|
*/
|
|
15
|
-
class LastValue extends
|
|
13
|
+
class LastValue extends index_js_1.BaseChannel {
|
|
16
14
|
constructor() {
|
|
17
15
|
super(...arguments);
|
|
18
16
|
Object.defineProperty(this, "lc_graph_name", {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { BaseChannel } from "./
|
|
1
|
+
import { BaseChannel } from "./index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Stores the last value received, can receive at most one value per step.
|
|
4
4
|
*
|
|
5
5
|
* Since `update` is only called once per step and value can only be of length 1,
|
|
6
6
|
* LastValue always stores the last value of a single node. If multiple nodes attempt to
|
|
7
7
|
* write to this channel in a single step, an error will be thrown.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
8
|
*/
|
|
11
9
|
export declare class LastValue<Value> extends BaseChannel<Value, Value, Value> {
|
|
12
10
|
lc_graph_name: string;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { EmptyChannelError, InvalidUpdateError } from "../errors.js";
|
|
2
|
-
import { BaseChannel } from "./
|
|
2
|
+
import { BaseChannel } from "./index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Stores the last value received, can receive at most one value per step.
|
|
5
5
|
*
|
|
6
6
|
* Since `update` is only called once per step and value can only be of length 1,
|
|
7
7
|
* LastValue always stores the last value of a single node. If multiple nodes attempt to
|
|
8
8
|
* write to this channel in a single step, an error will be thrown.
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
9
|
*/
|
|
12
10
|
export class LastValue extends BaseChannel {
|
|
13
11
|
constructor() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NamedBarrierValue = exports.areSetsEqual = void 0;
|
|
4
4
|
const errors_js_1 = require("../errors.cjs");
|
|
5
|
-
const
|
|
5
|
+
const index_js_1 = require("./index.cjs");
|
|
6
6
|
const areSetsEqual = (a, b) => a.size === b.size && [...a].every((value) => b.has(value));
|
|
7
7
|
exports.areSetsEqual = areSetsEqual;
|
|
8
8
|
/**
|
|
@@ -10,9 +10,8 @@ exports.areSetsEqual = areSetsEqual;
|
|
|
10
10
|
*
|
|
11
11
|
* This ensures that if node N and node M both write to channel C, the value of C will not be updated
|
|
12
12
|
* until N and M have completed updating.
|
|
13
|
-
* @internal
|
|
14
13
|
*/
|
|
15
|
-
class NamedBarrierValue extends
|
|
14
|
+
class NamedBarrierValue extends index_js_1.BaseChannel {
|
|
16
15
|
constructor(names) {
|
|
17
16
|
super();
|
|
18
17
|
Object.defineProperty(this, "lc_graph_name", {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { BaseChannel } from "./
|
|
1
|
+
import { BaseChannel } from "./index.js";
|
|
2
2
|
export declare const areSetsEqual: <T>(a: Set<T>, b: Set<T>) => boolean;
|
|
3
3
|
/**
|
|
4
4
|
* A channel that waits until all named values are received before making the value available.
|
|
5
5
|
*
|
|
6
6
|
* This ensures that if node N and node M both write to channel C, the value of C will not be updated
|
|
7
7
|
* until N and M have completed updating.
|
|
8
|
-
* @internal
|
|
9
8
|
*/
|
|
10
9
|
export declare class NamedBarrierValue<Value> extends BaseChannel<void, Value, Value[]> {
|
|
11
10
|
lc_graph_name: string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { EmptyChannelError, InvalidUpdateError } from "../errors.js";
|
|
2
|
-
import { BaseChannel } from "./
|
|
2
|
+
import { BaseChannel } from "./index.js";
|
|
3
3
|
export const areSetsEqual = (a, b) => a.size === b.size && [...a].every((value) => b.has(value));
|
|
4
4
|
/**
|
|
5
5
|
* A channel that waits until all named values are received before making the value available.
|
|
6
6
|
*
|
|
7
7
|
* This ensures that if node N and node M both write to channel C, the value of C will not be updated
|
|
8
8
|
* until N and M have completed updating.
|
|
9
|
-
* @internal
|
|
10
9
|
*/
|
|
11
10
|
export class NamedBarrierValue extends BaseChannel {
|
|
12
11
|
constructor(names) {
|
package/dist/channels/topic.cjs
CHANGED
package/dist/channels/topic.d.ts
CHANGED
package/dist/channels/topic.js
CHANGED
package/dist/graph/graph.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const END = "__end__";
|
|
|
15
15
|
export interface BranchOptions<IO, N extends string> {
|
|
16
16
|
source: N;
|
|
17
17
|
path: Branch<IO, N>["condition"];
|
|
18
|
-
pathMap?: Record<string, N | typeof END> | N[];
|
|
18
|
+
pathMap?: Record<string, N | typeof END> | (N | typeof END)[];
|
|
19
19
|
}
|
|
20
20
|
export declare class Branch<IO, N extends string> {
|
|
21
21
|
condition: (input: IO, config?: RunnableConfig) => string | Send | (string | Send)[] | Promise<string | Send | (string | Send)[]>;
|
package/dist/graph/index.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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.Annotation = void 0;
|
|
3
|
+
exports.messagesStateReducer = exports.MessageGraph = 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
|
+
Object.defineProperty(exports, "AnnotationRoot", { enumerable: true, get: function () { return annotation_js_1.AnnotationRoot; } });
|
|
6
7
|
var graph_js_1 = require("./graph.cjs");
|
|
7
8
|
Object.defineProperty(exports, "END", { enumerable: true, get: function () { return graph_js_1.END; } });
|
|
8
9
|
Object.defineProperty(exports, "START", { enumerable: true, get: function () { return graph_js_1.START; } });
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Annotation, type StateType, type UpdateType,
|
|
1
|
+
export { Annotation, type StateType, type UpdateType, AnnotationRoot, } from "./annotation.js";
|
|
2
2
|
export { END, START, Graph, type CompiledGraph } from "./graph.js";
|
|
3
3
|
export { type StateGraphArgs, StateGraph, type CompiledStateGraph, } from "./state.js";
|
|
4
4
|
export { MessageGraph, messagesStateReducer } from "./message.js";
|
package/dist/graph/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Annotation, } from "./annotation.js";
|
|
1
|
+
export { Annotation, AnnotationRoot, } from "./annotation.js";
|
|
2
2
|
export { END, START, Graph } from "./graph.js";
|
|
3
3
|
export { StateGraph, } from "./state.js";
|
|
4
4
|
export { MessageGraph, messagesStateReducer } from "./message.js";
|
package/dist/pregel/algo.cjs
CHANGED
|
@@ -86,7 +86,7 @@ getNextVersion) {
|
|
|
86
86
|
// Find the highest version of all channels
|
|
87
87
|
let maxVersion;
|
|
88
88
|
if (Object.keys(checkpoint.channel_versions).length > 0) {
|
|
89
|
-
maxVersion =
|
|
89
|
+
maxVersion = (0, langgraph_checkpoint_1.maxChannelVersion)(...Object.values(checkpoint.channel_versions));
|
|
90
90
|
}
|
|
91
91
|
// Consume all channels that were read
|
|
92
92
|
const channelsToConsume = new Set(tasks
|
|
@@ -126,7 +126,7 @@ getNextVersion) {
|
|
|
126
126
|
// find the highest version of all channels
|
|
127
127
|
maxVersion = undefined;
|
|
128
128
|
if (Object.keys(checkpoint.channel_versions).length > 0) {
|
|
129
|
-
maxVersion =
|
|
129
|
+
maxVersion = (0, langgraph_checkpoint_1.maxChannelVersion)(...Object.values(checkpoint.channel_versions));
|
|
130
130
|
}
|
|
131
131
|
const updatedChannels = new Set();
|
|
132
132
|
// Apply writes to channels
|
package/dist/pregel/algo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
import { mergeConfigs, patchConfig, } from "@langchain/core/runnables";
|
|
3
|
-
import { copyCheckpoint, uuid5, } from "@langchain/langgraph-checkpoint";
|
|
3
|
+
import { copyCheckpoint, uuid5, maxChannelVersion, } from "@langchain/langgraph-checkpoint";
|
|
4
4
|
import { createCheckpoint, emptyChannels, } from "../channels/base.js";
|
|
5
5
|
import { readChannel, readChannels } from "./io.js";
|
|
6
6
|
import { _isSend, _isSendInterface, CHECKPOINT_NAMESPACE_SEPARATOR, CONFIG_KEY_CHECKPOINTER, CONFIG_KEY_READ, CONFIG_KEY_RESUMING, CONFIG_KEY_SEND, INTERRUPT, RESERVED, TAG_HIDDEN, TASKS, } from "../constants.js";
|
|
@@ -79,7 +79,7 @@ getNextVersion) {
|
|
|
79
79
|
// Find the highest version of all channels
|
|
80
80
|
let maxVersion;
|
|
81
81
|
if (Object.keys(checkpoint.channel_versions).length > 0) {
|
|
82
|
-
maxVersion =
|
|
82
|
+
maxVersion = maxChannelVersion(...Object.values(checkpoint.channel_versions));
|
|
83
83
|
}
|
|
84
84
|
// Consume all channels that were read
|
|
85
85
|
const channelsToConsume = new Set(tasks
|
|
@@ -119,7 +119,7 @@ getNextVersion) {
|
|
|
119
119
|
// find the highest version of all channels
|
|
120
120
|
maxVersion = undefined;
|
|
121
121
|
if (Object.keys(checkpoint.channel_versions).length > 0) {
|
|
122
|
-
maxVersion =
|
|
122
|
+
maxVersion = maxChannelVersion(...Object.values(checkpoint.channel_versions));
|
|
123
123
|
}
|
|
124
124
|
const updatedChannels = new Set();
|
|
125
125
|
// Apply writes to channels
|
package/dist/pregel/index.cjs
CHANGED
|
@@ -315,9 +315,7 @@ class Pregel extends runnables_1.Runnable {
|
|
|
315
315
|
});
|
|
316
316
|
})
|
|
317
317
|
.flat()
|
|
318
|
-
.sort(([aNumber], [bNumber]) =>
|
|
319
|
-
return aNumber - bNumber;
|
|
320
|
-
});
|
|
318
|
+
.sort(([aNumber], [bNumber]) => (0, langgraph_checkpoint_1.compareChannelVersions)(aNumber, bNumber));
|
|
321
319
|
// if two nodes updated the state at the same time, it's ambiguous
|
|
322
320
|
if (lastSeenByNode) {
|
|
323
321
|
if (lastSeenByNode.length === 1) {
|
package/dist/pregel/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
import { Runnable, RunnableSequence, _coerceToRunnable, ensureConfig, getCallbackManagerForConfig, patchConfig, } from "@langchain/core/runnables";
|
|
3
|
-
import { copyCheckpoint, emptyCheckpoint, uuid5, } from "@langchain/langgraph-checkpoint";
|
|
3
|
+
import { compareChannelVersions, copyCheckpoint, emptyCheckpoint, uuid5, } from "@langchain/langgraph-checkpoint";
|
|
4
4
|
import { createCheckpoint, emptyChannels, } from "../channels/base.js";
|
|
5
5
|
import { PregelNode } from "./read.js";
|
|
6
6
|
import { validateGraph, validateKeys } from "./validate.js";
|
|
@@ -311,9 +311,7 @@ export class Pregel extends Runnable {
|
|
|
311
311
|
});
|
|
312
312
|
})
|
|
313
313
|
.flat()
|
|
314
|
-
.sort(([aNumber], [bNumber]) =>
|
|
315
|
-
return aNumber - bNumber;
|
|
316
|
-
});
|
|
314
|
+
.sort(([aNumber], [bNumber]) => compareChannelVersions(aNumber, bNumber));
|
|
317
315
|
// if two nodes updated the state at the same time, it's ambiguous
|
|
318
316
|
if (lastSeenByNode) {
|
|
319
317
|
if (lastSeenByNode.length === 1) {
|
package/dist/web.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseCheckpointSaver = exports.emptyCheckpoint = exports.copyCheckpoint = exports.MemorySaver = exports.Send = exports.EmptyChannelError = exports.InvalidUpdateError = exports.GraphValueError = exports.GraphRecursionError = exports.Annotation = exports.messagesStateReducer = exports.MessageGraph = exports.StateGraph = exports.START = exports.Graph = exports.END = void 0;
|
|
3
|
+
exports.BaseCheckpointSaver = exports.emptyCheckpoint = exports.copyCheckpoint = exports.MemorySaver = exports.Send = exports.BinaryOperatorAggregate = exports.BaseChannel = exports.EmptyChannelError = exports.InvalidUpdateError = exports.GraphValueError = exports.GraphRecursionError = exports.AnnotationRoot = exports.Annotation = exports.messagesStateReducer = exports.MessageGraph = exports.StateGraph = exports.START = exports.Graph = exports.END = void 0;
|
|
4
4
|
var index_js_1 = require("./graph/index.cjs");
|
|
5
5
|
Object.defineProperty(exports, "END", { enumerable: true, get: function () { return index_js_1.END; } });
|
|
6
6
|
Object.defineProperty(exports, "Graph", { enumerable: true, get: function () { return index_js_1.Graph; } });
|
|
@@ -9,11 +9,15 @@ Object.defineProperty(exports, "StateGraph", { enumerable: true, get: function (
|
|
|
9
9
|
Object.defineProperty(exports, "MessageGraph", { enumerable: true, get: function () { return index_js_1.MessageGraph; } });
|
|
10
10
|
Object.defineProperty(exports, "messagesStateReducer", { enumerable: true, get: function () { return index_js_1.messagesStateReducer; } });
|
|
11
11
|
Object.defineProperty(exports, "Annotation", { enumerable: true, get: function () { return index_js_1.Annotation; } });
|
|
12
|
+
Object.defineProperty(exports, "AnnotationRoot", { enumerable: true, get: function () { return index_js_1.AnnotationRoot; } });
|
|
12
13
|
var errors_js_1 = require("./errors.cjs");
|
|
13
14
|
Object.defineProperty(exports, "GraphRecursionError", { enumerable: true, get: function () { return errors_js_1.GraphRecursionError; } });
|
|
14
15
|
Object.defineProperty(exports, "GraphValueError", { enumerable: true, get: function () { return errors_js_1.GraphValueError; } });
|
|
15
16
|
Object.defineProperty(exports, "InvalidUpdateError", { enumerable: true, get: function () { return errors_js_1.InvalidUpdateError; } });
|
|
16
17
|
Object.defineProperty(exports, "EmptyChannelError", { enumerable: true, get: function () { return errors_js_1.EmptyChannelError; } });
|
|
18
|
+
var index_js_2 = require("./channels/index.cjs");
|
|
19
|
+
Object.defineProperty(exports, "BaseChannel", { enumerable: true, get: function () { return index_js_2.BaseChannel; } });
|
|
20
|
+
Object.defineProperty(exports, "BinaryOperatorAggregate", { enumerable: true, get: function () { return index_js_2.BinaryOperatorAggregate; } });
|
|
17
21
|
var constants_js_1 = require("./constants.cjs");
|
|
18
22
|
Object.defineProperty(exports, "Send", { enumerable: true, get: function () { return constants_js_1.Send; } });
|
|
19
23
|
var langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
|
package/dist/web.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { END, Graph, type StateGraphArgs, START, StateGraph, type CompiledStateGraph, MessageGraph, messagesStateReducer, Annotation,
|
|
1
|
+
export { END, Graph, type StateGraphArgs, START, StateGraph, type CompiledStateGraph, MessageGraph, messagesStateReducer, Annotation, AnnotationRoot, type StateType, type UpdateType, type CompiledGraph, } from "./graph/index.js";
|
|
2
2
|
export { GraphRecursionError, GraphValueError, InvalidUpdateError, EmptyChannelError, } from "./errors.js";
|
|
3
|
-
export {
|
|
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,4 +1,5 @@
|
|
|
1
|
-
export { END, Graph, START, StateGraph, MessageGraph, messagesStateReducer, Annotation, } from "./graph/index.js";
|
|
1
|
+
export { END, Graph, START, StateGraph, MessageGraph, messagesStateReducer, Annotation, AnnotationRoot, } from "./graph/index.js";
|
|
2
2
|
export { GraphRecursionError, GraphValueError, InvalidUpdateError, EmptyChannelError, } from "./errors.js";
|
|
3
|
+
export { BaseChannel, BinaryOperatorAggregate, } from "./channels/index.js";
|
|
3
4
|
export { Send } from "./constants.js";
|
|
4
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.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "LangGraph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@langchain/core": ">=0.2.20 <0.3.0",
|
|
35
|
-
"@langchain/langgraph-checkpoint": "~0.0.
|
|
35
|
+
"@langchain/langgraph-checkpoint": "~0.0.4",
|
|
36
36
|
"@langchain/langgraph-checkpoint-sqlite": "~0.0.1",
|
|
37
37
|
"double-ended-queue": "^2.1.0-0",
|
|
38
38
|
"uuid": "^10.0.0",
|