@langchain/langgraph 0.0.24 → 0.0.26
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/base.cjs +1 -1
- package/dist/channels/base.js +1 -1
- package/dist/checkpoint/id.cjs +2 -34
- package/dist/checkpoint/id.d.ts +0 -1
- package/dist/checkpoint/id.js +2 -33
- package/dist/errors.cjs +12 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +12 -0
- package/dist/pregel/debug.cjs +1 -1
- package/dist/pregel/debug.js +1 -1
- package/dist/pregel/index.cjs +3 -3
- package/dist/pregel/index.js +3 -3
- package/dist/pregel/io.cjs +2 -2
- package/dist/pregel/io.js +2 -2
- package/dist/tests/checkpoints.test.js +6 -19
- package/dist/web.d.ts +2 -1
- package/package.json +7 -5
package/dist/channels/base.cjs
CHANGED
|
@@ -27,7 +27,7 @@ function createCheckpoint(checkpoint, channels, step) {
|
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
30
|
-
if (error.name === errors_js_1.EmptyChannelError.
|
|
30
|
+
if (error.name === errors_js_1.EmptyChannelError.unminifiable_name) {
|
|
31
31
|
// no-op
|
|
32
32
|
}
|
|
33
33
|
else {
|
package/dist/channels/base.js
CHANGED
|
@@ -22,7 +22,7 @@ export function createCheckpoint(checkpoint, channels, step) {
|
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
23
|
}
|
|
24
24
|
catch (error) {
|
|
25
|
-
if (error.name === EmptyChannelError.
|
|
25
|
+
if (error.name === EmptyChannelError.unminifiable_name) {
|
|
26
26
|
// no-op
|
|
27
27
|
}
|
|
28
28
|
else {
|
package/dist/checkpoint/id.cjs
CHANGED
|
@@ -1,40 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.uuid6 = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
|
-
/**
|
|
6
|
-
* Returns an unsigned `x`-bit random integer.
|
|
7
|
-
* @param x - An unsigned integer ranging from 0 to 53, inclusive.
|
|
8
|
-
* @returns An unsigned `x`-bit random integer (`0 <= f(x) < 2^x`).
|
|
9
|
-
*/
|
|
10
|
-
function getRandomInt(x) {
|
|
11
|
-
if (x < 0 || x > 53) {
|
|
12
|
-
return NaN;
|
|
13
|
-
}
|
|
14
|
-
const n = 0 | (Math.random() * 0x40000000); // 1 << 30
|
|
15
|
-
return x > 30
|
|
16
|
-
? n + (0 | (Math.random() * (1 << (x - 30)))) * 0x40000000
|
|
17
|
-
: n >>> (30 - x);
|
|
18
|
-
}
|
|
19
5
|
function uuid6(clockseq) {
|
|
20
|
-
|
|
21
|
-
? crypto.getRandomValues(new Uint8Array(6))
|
|
22
|
-
: [
|
|
23
|
-
getRandomInt(8),
|
|
24
|
-
getRandomInt(8),
|
|
25
|
-
getRandomInt(8),
|
|
26
|
-
getRandomInt(8),
|
|
27
|
-
getRandomInt(8),
|
|
28
|
-
getRandomInt(8),
|
|
29
|
-
];
|
|
30
|
-
const uuid1 = (0, uuid_1.v1)({ node, clockseq });
|
|
31
|
-
return convert1to6(uuid1);
|
|
6
|
+
return (0, uuid_1.v6)({ clockseq });
|
|
32
7
|
}
|
|
33
8
|
exports.uuid6 = uuid6;
|
|
34
|
-
function convert1to6(uuid1) {
|
|
35
|
-
// https://github.com/oittaa/uuid6-python/blob/main/src/uuid6/__init__.py#L81
|
|
36
|
-
const hex = uuid1.replace(/-/g, "");
|
|
37
|
-
const v6 = `${hex.slice(13, 16)}${hex.slice(8, 12)}${hex.slice(0, 1)}-${hex.slice(1, 5)}-6${hex.slice(5, 8)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
38
|
-
return v6;
|
|
39
|
-
}
|
|
40
|
-
exports.convert1to6 = convert1to6;
|
package/dist/checkpoint/id.d.ts
CHANGED
package/dist/checkpoint/id.js
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* Returns an unsigned `x`-bit random integer.
|
|
4
|
-
* @param x - An unsigned integer ranging from 0 to 53, inclusive.
|
|
5
|
-
* @returns An unsigned `x`-bit random integer (`0 <= f(x) < 2^x`).
|
|
6
|
-
*/
|
|
7
|
-
function getRandomInt(x) {
|
|
8
|
-
if (x < 0 || x > 53) {
|
|
9
|
-
return NaN;
|
|
10
|
-
}
|
|
11
|
-
const n = 0 | (Math.random() * 0x40000000); // 1 << 30
|
|
12
|
-
return x > 30
|
|
13
|
-
? n + (0 | (Math.random() * (1 << (x - 30)))) * 0x40000000
|
|
14
|
-
: n >>> (30 - x);
|
|
15
|
-
}
|
|
1
|
+
import { v6 } from "uuid";
|
|
16
2
|
export function uuid6(clockseq) {
|
|
17
|
-
|
|
18
|
-
? crypto.getRandomValues(new Uint8Array(6))
|
|
19
|
-
: [
|
|
20
|
-
getRandomInt(8),
|
|
21
|
-
getRandomInt(8),
|
|
22
|
-
getRandomInt(8),
|
|
23
|
-
getRandomInt(8),
|
|
24
|
-
getRandomInt(8),
|
|
25
|
-
getRandomInt(8),
|
|
26
|
-
];
|
|
27
|
-
const uuid1 = v1({ node, clockseq });
|
|
28
|
-
return convert1to6(uuid1);
|
|
29
|
-
}
|
|
30
|
-
export function convert1to6(uuid1) {
|
|
31
|
-
// https://github.com/oittaa/uuid6-python/blob/main/src/uuid6/__init__.py#L81
|
|
32
|
-
const hex = uuid1.replace(/-/g, "");
|
|
33
|
-
const v6 = `${hex.slice(13, 16)}${hex.slice(8, 12)}${hex.slice(0, 1)}-${hex.slice(1, 5)}-6${hex.slice(5, 8)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
34
|
-
return v6;
|
|
3
|
+
return v6({ clockseq });
|
|
35
4
|
}
|
package/dist/errors.cjs
CHANGED
|
@@ -6,6 +6,9 @@ class GraphRecursionError extends Error {
|
|
|
6
6
|
super(message);
|
|
7
7
|
this.name = "GraphRecursionError";
|
|
8
8
|
}
|
|
9
|
+
static get unminifiable_name() {
|
|
10
|
+
return "GraphRecursionError";
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
exports.GraphRecursionError = GraphRecursionError;
|
|
11
14
|
class GraphValueError extends Error {
|
|
@@ -13,6 +16,9 @@ class GraphValueError extends Error {
|
|
|
13
16
|
super(message);
|
|
14
17
|
this.name = "GraphValueError";
|
|
15
18
|
}
|
|
19
|
+
static get unminifiable_name() {
|
|
20
|
+
return "GraphValueError";
|
|
21
|
+
}
|
|
16
22
|
}
|
|
17
23
|
exports.GraphValueError = GraphValueError;
|
|
18
24
|
class EmptyChannelError extends Error {
|
|
@@ -20,6 +26,9 @@ class EmptyChannelError extends Error {
|
|
|
20
26
|
super(message);
|
|
21
27
|
this.name = "EmptyChannelError";
|
|
22
28
|
}
|
|
29
|
+
static get unminifiable_name() {
|
|
30
|
+
return "EmptyChannelError";
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
exports.EmptyChannelError = EmptyChannelError;
|
|
25
34
|
class InvalidUpdateError extends Error {
|
|
@@ -27,5 +36,8 @@ class InvalidUpdateError extends Error {
|
|
|
27
36
|
super(message);
|
|
28
37
|
this.name = "InvalidUpdateError";
|
|
29
38
|
}
|
|
39
|
+
static get unminifiable_name() {
|
|
40
|
+
return "InvalidUpdateError";
|
|
41
|
+
}
|
|
30
42
|
}
|
|
31
43
|
exports.InvalidUpdateError = InvalidUpdateError;
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export declare class GraphRecursionError extends Error {
|
|
2
2
|
constructor(message?: string);
|
|
3
|
+
static get unminifiable_name(): string;
|
|
3
4
|
}
|
|
4
5
|
export declare class GraphValueError extends Error {
|
|
5
6
|
constructor(message?: string);
|
|
7
|
+
static get unminifiable_name(): string;
|
|
6
8
|
}
|
|
7
9
|
export declare class EmptyChannelError extends Error {
|
|
8
10
|
constructor(message?: string);
|
|
11
|
+
static get unminifiable_name(): string;
|
|
9
12
|
}
|
|
10
13
|
export declare class InvalidUpdateError extends Error {
|
|
11
14
|
constructor(message?: string);
|
|
15
|
+
static get unminifiable_name(): string;
|
|
12
16
|
}
|
package/dist/errors.js
CHANGED
|
@@ -3,22 +3,34 @@ export class GraphRecursionError extends Error {
|
|
|
3
3
|
super(message);
|
|
4
4
|
this.name = "GraphRecursionError";
|
|
5
5
|
}
|
|
6
|
+
static get unminifiable_name() {
|
|
7
|
+
return "GraphRecursionError";
|
|
8
|
+
}
|
|
6
9
|
}
|
|
7
10
|
export class GraphValueError extends Error {
|
|
8
11
|
constructor(message) {
|
|
9
12
|
super(message);
|
|
10
13
|
this.name = "GraphValueError";
|
|
11
14
|
}
|
|
15
|
+
static get unminifiable_name() {
|
|
16
|
+
return "GraphValueError";
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
export class EmptyChannelError extends Error {
|
|
14
20
|
constructor(message) {
|
|
15
21
|
super(message);
|
|
16
22
|
this.name = "EmptyChannelError";
|
|
17
23
|
}
|
|
24
|
+
static get unminifiable_name() {
|
|
25
|
+
return "EmptyChannelError";
|
|
26
|
+
}
|
|
18
27
|
}
|
|
19
28
|
export class InvalidUpdateError extends Error {
|
|
20
29
|
constructor(message) {
|
|
21
30
|
super(message);
|
|
22
31
|
this.name = "InvalidUpdateError";
|
|
23
32
|
}
|
|
33
|
+
static get unminifiable_name() {
|
|
34
|
+
return "InvalidUpdateError";
|
|
35
|
+
}
|
|
24
36
|
}
|
package/dist/pregel/debug.cjs
CHANGED
|
@@ -32,7 +32,7 @@ function* _readChannels(channels
|
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
33
|
}
|
|
34
34
|
catch (error) {
|
|
35
|
-
if (error.name === errors_js_1.EmptyChannelError.
|
|
35
|
+
if (error.name === errors_js_1.EmptyChannelError.unminifiable_name) {
|
|
36
36
|
// Skip the channel if it's empty
|
|
37
37
|
continue;
|
|
38
38
|
}
|
package/dist/pregel/debug.js
CHANGED
|
@@ -27,7 +27,7 @@ function* _readChannels(channels
|
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
30
|
-
if (error.name === EmptyChannelError.
|
|
30
|
+
if (error.name === EmptyChannelError.unminifiable_name) {
|
|
31
31
|
// Skip the channel if it's empty
|
|
32
32
|
continue;
|
|
33
33
|
}
|
package/dist/pregel/index.cjs
CHANGED
|
@@ -601,7 +601,7 @@ function _applyWrites(checkpoint, channels, pendingWrites) {
|
|
|
601
601
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
602
602
|
}
|
|
603
603
|
catch (e) {
|
|
604
|
-
if (e.name === errors_js_1.InvalidUpdateError.
|
|
604
|
+
if (e.name === errors_js_1.InvalidUpdateError.unminifiable_name) {
|
|
605
605
|
throw new errors_js_1.InvalidUpdateError(`Invalid update for channel ${chan}. Values: ${vals}`);
|
|
606
606
|
}
|
|
607
607
|
}
|
|
@@ -655,7 +655,7 @@ function _prepareNextTasks(checkpoint, processes, channels, forExecution) {
|
|
|
655
655
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
656
656
|
}
|
|
657
657
|
catch (e) {
|
|
658
|
-
if (e.name === errors_js_1.EmptyChannelError.
|
|
658
|
+
if (e.name === errors_js_1.EmptyChannelError.unminifiable_name) {
|
|
659
659
|
emptyChannels += 1;
|
|
660
660
|
continue;
|
|
661
661
|
}
|
|
@@ -677,7 +677,7 @@ function _prepareNextTasks(checkpoint, processes, channels, forExecution) {
|
|
|
677
677
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
678
678
|
}
|
|
679
679
|
catch (e) {
|
|
680
|
-
if (e.name === errors_js_1.EmptyChannelError.
|
|
680
|
+
if (e.name === errors_js_1.EmptyChannelError.unminifiable_name) {
|
|
681
681
|
continue;
|
|
682
682
|
}
|
|
683
683
|
else {
|
package/dist/pregel/index.js
CHANGED
|
@@ -594,7 +594,7 @@ export function _applyWrites(checkpoint, channels, pendingWrites) {
|
|
|
594
594
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
595
595
|
}
|
|
596
596
|
catch (e) {
|
|
597
|
-
if (e.name === InvalidUpdateError.
|
|
597
|
+
if (e.name === InvalidUpdateError.unminifiable_name) {
|
|
598
598
|
throw new InvalidUpdateError(`Invalid update for channel ${chan}. Values: ${vals}`);
|
|
599
599
|
}
|
|
600
600
|
}
|
|
@@ -647,7 +647,7 @@ export function _prepareNextTasks(checkpoint, processes, channels, forExecution)
|
|
|
647
647
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
648
648
|
}
|
|
649
649
|
catch (e) {
|
|
650
|
-
if (e.name === EmptyChannelError.
|
|
650
|
+
if (e.name === EmptyChannelError.unminifiable_name) {
|
|
651
651
|
emptyChannels += 1;
|
|
652
652
|
continue;
|
|
653
653
|
}
|
|
@@ -669,7 +669,7 @@ export function _prepareNextTasks(checkpoint, processes, channels, forExecution)
|
|
|
669
669
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
670
670
|
}
|
|
671
671
|
catch (e) {
|
|
672
|
-
if (e.name === EmptyChannelError.
|
|
672
|
+
if (e.name === EmptyChannelError.unminifiable_name) {
|
|
673
673
|
continue;
|
|
674
674
|
}
|
|
675
675
|
else {
|
package/dist/pregel/io.cjs
CHANGED
|
@@ -9,7 +9,7 @@ function readChannel(channels, chan, catch_ = true, returnException = false) {
|
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
}
|
|
11
11
|
catch (e) {
|
|
12
|
-
if (e.name === errors_js_1.EmptyChannelError.
|
|
12
|
+
if (e.name === errors_js_1.EmptyChannelError.unminifiable_name) {
|
|
13
13
|
if (returnException) {
|
|
14
14
|
return e;
|
|
15
15
|
}
|
|
@@ -33,7 +33,7 @@ function readChannels(channels, select, skipEmpty = true
|
|
|
33
33
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
34
|
}
|
|
35
35
|
catch (e) {
|
|
36
|
-
if (e.name === errors_js_1.EmptyChannelError.
|
|
36
|
+
if (e.name === errors_js_1.EmptyChannelError.unminifiable_name) {
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
39
|
}
|
package/dist/pregel/io.js
CHANGED
|
@@ -6,7 +6,7 @@ export function readChannel(channels, chan, catch_ = true, returnException = fal
|
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
7
|
}
|
|
8
8
|
catch (e) {
|
|
9
|
-
if (e.name === EmptyChannelError.
|
|
9
|
+
if (e.name === EmptyChannelError.unminifiable_name) {
|
|
10
10
|
if (returnException) {
|
|
11
11
|
return e;
|
|
12
12
|
}
|
|
@@ -29,7 +29,7 @@ export function readChannels(channels, select, skipEmpty = true
|
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
30
|
}
|
|
31
31
|
catch (e) {
|
|
32
|
-
if (e.name === EmptyChannelError.
|
|
32
|
+
if (e.name === EmptyChannelError.unminifiable_name) {
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -2,7 +2,7 @@ import { describe, it, expect } from "@jest/globals";
|
|
|
2
2
|
import { deepCopy } from "../checkpoint/base.js";
|
|
3
3
|
import { MemorySaver } from "../checkpoint/memory.js";
|
|
4
4
|
import { SqliteSaver } from "../checkpoint/sqlite.js";
|
|
5
|
-
import {
|
|
5
|
+
import { uuid6 } from "../checkpoint/id.js";
|
|
6
6
|
const checkpoint1 = {
|
|
7
7
|
v: 1,
|
|
8
8
|
id: uuid6(-1),
|
|
@@ -169,23 +169,10 @@ describe("SqliteSaver", () => {
|
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
171
|
describe("id", () => {
|
|
172
|
-
it("should
|
|
173
|
-
const regex = /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
"5714f720-1268-11e7-a24b-96d95aa38c32",
|
|
178
|
-
"1e712685-714f-6720-a24b-96d95aa38c32",
|
|
179
|
-
],
|
|
180
|
-
[
|
|
181
|
-
"68f820c0-1268-11e7-a24b-671acd892c6a",
|
|
182
|
-
"1e712686-8f82-60c0-a24b-671acd892c6a",
|
|
183
|
-
],
|
|
184
|
-
];
|
|
185
|
-
cases.forEach(([v1, v6]) => {
|
|
186
|
-
const converted = convert1to6(v1);
|
|
187
|
-
expect(converted).toBe(v6);
|
|
188
|
-
expect(converted).toMatch(regex);
|
|
189
|
-
});
|
|
172
|
+
it("should accept clockseq -1", () => {
|
|
173
|
+
const regex = /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
174
|
+
const uuid = uuid6(-1);
|
|
175
|
+
expect(uuid).toMatch(regex);
|
|
176
|
+
expect(uuid.includes("u")).toBe(false);
|
|
190
177
|
});
|
|
191
178
|
});
|
package/dist/web.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { END, Graph, type StateGraphArgs, START, StateGraph, type CompiledStateGraph, MessageGraph, } from "./graph/index.js";
|
|
2
2
|
export { MemorySaver } from "./checkpoint/memory.js";
|
|
3
|
-
export { type Checkpoint, type CheckpointMetadata, copyCheckpoint, emptyCheckpoint, BaseCheckpointSaver, } from "./checkpoint/base.js";
|
|
3
|
+
export { type Checkpoint, type CheckpointMetadata, type CheckpointTuple, copyCheckpoint, emptyCheckpoint, BaseCheckpointSaver, } from "./checkpoint/base.js";
|
|
4
4
|
export { GraphRecursionError, GraphValueError, InvalidUpdateError, EmptyChannelError, } from "./errors.js";
|
|
5
|
+
export { type SerializerProtocol } from "./serde/base.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "LangGraph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -38,22 +38,24 @@
|
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@langchain/core": ">0.1.61 <0.3.0",
|
|
41
|
-
"uuid": "^
|
|
41
|
+
"uuid": "^10.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@jest/globals": "^29.5.0",
|
|
45
45
|
"@langchain/anthropic": "^0.1.21",
|
|
46
|
-
"@langchain/community": "^0.2.
|
|
47
|
-
"@langchain/openai": "^0.
|
|
46
|
+
"@langchain/community": "^0.2.12",
|
|
47
|
+
"@langchain/openai": "^0.1.3",
|
|
48
48
|
"@langchain/scripts": "^0.0.13",
|
|
49
49
|
"@swc/core": "^1.3.90",
|
|
50
50
|
"@swc/jest": "^0.2.29",
|
|
51
51
|
"@tsconfig/recommended": "^1.0.3",
|
|
52
52
|
"@types/better-sqlite3": "^7.6.9",
|
|
53
|
-
"@types/uuid": "^
|
|
53
|
+
"@types/uuid": "^10",
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
55
55
|
"@typescript-eslint/parser": "^6.12.0",
|
|
56
|
+
"@xenova/transformers": "^2.17.2",
|
|
56
57
|
"better-sqlite3": "^9.5.0",
|
|
58
|
+
"cheerio": "1.0.0-rc.12",
|
|
57
59
|
"dotenv": "^16.3.1",
|
|
58
60
|
"dpdm": "^3.12.0",
|
|
59
61
|
"eslint": "^8.33.0",
|