@langchain/langgraph-checkpoint 1.0.3 → 1.1.0
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/base.cjs +60 -1
- package/dist/base.cjs.map +1 -1
- package/dist/base.d.cts +34 -1
- package/dist/base.d.cts.map +1 -1
- package/dist/base.d.ts +34 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +60 -1
- package/dist/base.js.map +1 -1
- package/dist/id.cjs +16 -1
- package/dist/id.cjs.map +1 -1
- package/dist/id.d.cts.map +1 -1
- package/dist/id.d.ts.map +1 -1
- package/dist/id.js +16 -1
- package/dist/id.js.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/memory.cjs +79 -0
- package/dist/memory.cjs.map +1 -1
- package/dist/memory.d.cts +22 -1
- package/dist/memory.d.cts.map +1 -1
- package/dist/memory.d.ts +22 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +79 -0
- package/dist/memory.js.map +1 -1
- package/dist/serde/jsonplus.cjs +9 -1
- package/dist/serde/jsonplus.cjs.map +1 -1
- package/dist/serde/jsonplus.js +9 -1
- package/dist/serde/jsonplus.js.map +1 -1
- package/dist/serde/types.cjs +30 -0
- package/dist/serde/types.cjs.map +1 -1
- package/dist/serde/types.d.cts +30 -1
- package/dist/serde/types.d.cts.map +1 -1
- package/dist/serde/types.d.ts +30 -1
- package/dist/serde/types.d.ts.map +1 -1
- package/dist/serde/types.js +29 -1
- package/dist/serde/types.js.map +1 -1
- package/dist/types.d.cts +47 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +47 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/serde/types.cjs
CHANGED
|
@@ -4,11 +4,41 @@ const ERROR = "__error__";
|
|
|
4
4
|
const SCHEDULED = "__scheduled__";
|
|
5
5
|
const INTERRUPT = "__interrupt__";
|
|
6
6
|
const RESUME = "__resume__";
|
|
7
|
+
/**
|
|
8
|
+
* Snapshot blob for a `DeltaChannel` with finite snapshot frequency.
|
|
9
|
+
*
|
|
10
|
+
* Stored directly in a checkpoint's `channel_values` in place of the full
|
|
11
|
+
* accumulated value. The ancestor walk in
|
|
12
|
+
* {@link BaseCheckpointSaver.getDeltaChannelHistory} terminates when it
|
|
13
|
+
* encounters a populated `channel_values` entry for a channel; a
|
|
14
|
+
* `DeltaSnapshot` value is the materialized state at that ancestor, so the
|
|
15
|
+
* channel reconstructs directly from `.value` without replaying earlier
|
|
16
|
+
* writes.
|
|
17
|
+
*
|
|
18
|
+
* @remarks Beta. The on-disk representation may change in future releases.
|
|
19
|
+
*/
|
|
20
|
+
var DeltaSnapshot = class {
|
|
21
|
+
/** Marker used for structural detection across module/realm boundaries. */
|
|
22
|
+
lg_name = "DeltaSnapshot";
|
|
23
|
+
value;
|
|
24
|
+
constructor(value) {
|
|
25
|
+
this.value = value;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Structural type guard for {@link DeltaSnapshot}. Uses the `lg_name` marker
|
|
30
|
+
* so it survives serialization round-trips and cross-package duplication.
|
|
31
|
+
*/
|
|
32
|
+
function isDeltaSnapshot(value) {
|
|
33
|
+
return value != null && typeof value === "object" && value.lg_name === "DeltaSnapshot";
|
|
34
|
+
}
|
|
7
35
|
//#endregion
|
|
36
|
+
exports.DeltaSnapshot = DeltaSnapshot;
|
|
8
37
|
exports.ERROR = ERROR;
|
|
9
38
|
exports.INTERRUPT = INTERRUPT;
|
|
10
39
|
exports.RESUME = RESUME;
|
|
11
40
|
exports.SCHEDULED = SCHEDULED;
|
|
12
41
|
exports.TASKS = TASKS;
|
|
42
|
+
exports.isDeltaSnapshot = isDeltaSnapshot;
|
|
13
43
|
|
|
14
44
|
//# sourceMappingURL=types.cjs.map
|
package/dist/serde/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":[],"sources":["../../src/serde/types.ts"],"sourcesContent":["export const TASKS = \"__pregel_tasks\";\nexport const ERROR = \"__error__\";\nexport const SCHEDULED = \"__scheduled__\";\nexport const INTERRUPT = \"__interrupt__\";\nexport const RESUME = \"__resume__\";\n\n// Mirrors BaseChannel in \"@langchain/langgraph\"\nexport interface ChannelProtocol<\n ValueType = unknown,\n UpdateType = unknown,\n CheckpointType = unknown,\n> {\n ValueType: ValueType;\n\n UpdateType: UpdateType;\n\n /**\n * The name of the channel.\n */\n lc_graph_name: string;\n\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @returns {this}\n */\n fromCheckpoint(checkpoint?: CheckpointType): this;\n\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n update(values: UpdateType[]): void;\n\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n get(): ValueType;\n\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n checkpoint(): CheckpointType | undefined;\n}\n\n// Mirrors SendInterface in \"@langchain/langgraph\"\nexport interface SendProtocol {\n node: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any;\n}\n"],"mappings":";AAAA,MAAa,QAAQ;AACrB,MAAa,QAAQ;AACrB,MAAa,YAAY;AACzB,MAAa,YAAY;AACzB,MAAa,SAAS"}
|
|
1
|
+
{"version":3,"file":"types.cjs","names":[],"sources":["../../src/serde/types.ts"],"sourcesContent":["export const TASKS = \"__pregel_tasks\";\nexport const ERROR = \"__error__\";\nexport const SCHEDULED = \"__scheduled__\";\nexport const INTERRUPT = \"__interrupt__\";\nexport const RESUME = \"__resume__\";\n\n/**\n * Snapshot blob for a `DeltaChannel` with finite snapshot frequency.\n *\n * Stored directly in a checkpoint's `channel_values` in place of the full\n * accumulated value. The ancestor walk in\n * {@link BaseCheckpointSaver.getDeltaChannelHistory} terminates when it\n * encounters a populated `channel_values` entry for a channel; a\n * `DeltaSnapshot` value is the materialized state at that ancestor, so the\n * channel reconstructs directly from `.value` without replaying earlier\n * writes.\n *\n * @remarks Beta. The on-disk representation may change in future releases.\n */\nexport class DeltaSnapshot<Value = unknown> {\n /** Marker used for structural detection across module/realm boundaries. */\n lg_name = \"DeltaSnapshot\" as const;\n\n value: Value;\n\n constructor(value: Value) {\n this.value = value;\n }\n}\n\n/**\n * Structural type guard for {@link DeltaSnapshot}. Uses the `lg_name` marker\n * so it survives serialization round-trips and cross-package duplication.\n */\nexport function isDeltaSnapshot<Value = unknown>(\n value: unknown\n): value is DeltaSnapshot<Value> {\n return (\n value != null &&\n typeof value === \"object\" &&\n (value as { lg_name?: string }).lg_name === \"DeltaSnapshot\"\n );\n}\n\n// Mirrors BaseChannel in \"@langchain/langgraph\"\nexport interface ChannelProtocol<\n ValueType = unknown,\n UpdateType = unknown,\n CheckpointType = unknown,\n> {\n ValueType: ValueType;\n\n UpdateType: UpdateType;\n\n /**\n * The name of the channel.\n */\n lc_graph_name: string;\n\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @returns {this}\n */\n fromCheckpoint(checkpoint?: CheckpointType): this;\n\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n update(values: UpdateType[]): void;\n\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n get(): ValueType;\n\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n checkpoint(): CheckpointType | undefined;\n}\n\n// Mirrors SendInterface in \"@langchain/langgraph\"\nexport interface SendProtocol {\n node: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any;\n // Optional per-task timeout policy. Structural to avoid a dependency on the\n // langgraph package; mirrors `TimeoutPolicy` in \"@langchain/langgraph\".\n timeout?: {\n runTimeout?: number;\n idleTimeout?: number;\n refreshOn?: \"auto\" | \"heartbeat\";\n };\n}\n"],"mappings":";AAAA,MAAa,QAAQ;AACrB,MAAa,QAAQ;AACrB,MAAa,YAAY;AACzB,MAAa,YAAY;AACzB,MAAa,SAAS;;;;;;;;;;;;;;AAetB,IAAa,gBAAb,MAA4C;;CAE1C,UAAU;CAEV;CAEA,YAAY,OAAc;AACxB,OAAK,QAAQ;;;;;;;AAQjB,SAAgB,gBACd,OAC+B;AAC/B,QACE,SAAS,QACT,OAAO,UAAU,YAChB,MAA+B,YAAY"}
|
package/dist/serde/types.d.cts
CHANGED
|
@@ -4,6 +4,30 @@ declare const ERROR = "__error__";
|
|
|
4
4
|
declare const SCHEDULED = "__scheduled__";
|
|
5
5
|
declare const INTERRUPT = "__interrupt__";
|
|
6
6
|
declare const RESUME = "__resume__";
|
|
7
|
+
/**
|
|
8
|
+
* Snapshot blob for a `DeltaChannel` with finite snapshot frequency.
|
|
9
|
+
*
|
|
10
|
+
* Stored directly in a checkpoint's `channel_values` in place of the full
|
|
11
|
+
* accumulated value. The ancestor walk in
|
|
12
|
+
* {@link BaseCheckpointSaver.getDeltaChannelHistory} terminates when it
|
|
13
|
+
* encounters a populated `channel_values` entry for a channel; a
|
|
14
|
+
* `DeltaSnapshot` value is the materialized state at that ancestor, so the
|
|
15
|
+
* channel reconstructs directly from `.value` without replaying earlier
|
|
16
|
+
* writes.
|
|
17
|
+
*
|
|
18
|
+
* @remarks Beta. The on-disk representation may change in future releases.
|
|
19
|
+
*/
|
|
20
|
+
declare class DeltaSnapshot<Value = unknown> {
|
|
21
|
+
/** Marker used for structural detection across module/realm boundaries. */
|
|
22
|
+
lg_name: "DeltaSnapshot";
|
|
23
|
+
value: Value;
|
|
24
|
+
constructor(value: Value);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Structural type guard for {@link DeltaSnapshot}. Uses the `lg_name` marker
|
|
28
|
+
* so it survives serialization round-trips and cross-package duplication.
|
|
29
|
+
*/
|
|
30
|
+
declare function isDeltaSnapshot<Value = unknown>(value: unknown): value is DeltaSnapshot<Value>;
|
|
7
31
|
interface ChannelProtocol<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {
|
|
8
32
|
ValueType: ValueType;
|
|
9
33
|
UpdateType: UpdateType;
|
|
@@ -46,7 +70,12 @@ interface ChannelProtocol<ValueType = unknown, UpdateType = unknown, CheckpointT
|
|
|
46
70
|
interface SendProtocol {
|
|
47
71
|
node: string;
|
|
48
72
|
args: any;
|
|
73
|
+
timeout?: {
|
|
74
|
+
runTimeout?: number;
|
|
75
|
+
idleTimeout?: number;
|
|
76
|
+
refreshOn?: "auto" | "heartbeat";
|
|
77
|
+
};
|
|
49
78
|
}
|
|
50
79
|
//#endregion
|
|
51
|
-
export { ChannelProtocol, ERROR, INTERRUPT, RESUME, SCHEDULED, SendProtocol, TASKS };
|
|
80
|
+
export { ChannelProtocol, DeltaSnapshot, ERROR, INTERRUPT, RESUME, SCHEDULED, SendProtocol, TASKS, isDeltaSnapshot };
|
|
52
81
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/serde/types.ts"],"mappings":";cAAa,KAAA;AAAA,cACA,KAAA;AAAA,cACA,SAAA;AAAA,cACA,SAAA;AAAA,cACA,MAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/serde/types.ts"],"mappings":";cAAa,KAAA;AAAA,cACA,KAAA;AAAA,cACA,SAAA;AAAA,cACA,SAAA;AAAA,cACA,MAAA;;AAHb;;;;;AACA;;;;;AACA;;cAgBa,aAAA;EAhBS;EAkBpB,OAAA;EAEA,KAAA,EAAO,KAAA;EAEP,WAAA,CAAY,KAAA,EAAO,KAAA;AAAA;;;AANrB;;iBAegB,eAAA,iBAAA,CACd,KAAA,YACC,KAAA,IAAS,aAAA,CAAc,KAAA;AAAA,UAST,eAAA;EAKf,SAAA,EAAW,SAAA;EAEX,UAAA,EAAY,UAAA;EA7BZ;;;EAkCA,aAAA;EAhCY;;;AASd;;;;EAgCE,cAAA,CAAe,UAAA,GAAa,cAAA;EA/B5B;;;;;;AAUF;;EA+BE,MAAA,CAAO,MAAA,EAAQ,UAAA;EA1BJ;;;;;;EAkCX,GAAA,IAAO,SAAA;EAQqB;;;;;;EAA5B,UAAA,IAAc,cAAA;AAAA;AAAA,UAIC,YAAA;EACf,IAAA;EAEA,IAAA;EAGA,OAAA;IACE,UAAA;IACA,WAAA;IACA,SAAA;EAAA;AAAA"}
|
package/dist/serde/types.d.ts
CHANGED
|
@@ -4,6 +4,30 @@ declare const ERROR = "__error__";
|
|
|
4
4
|
declare const SCHEDULED = "__scheduled__";
|
|
5
5
|
declare const INTERRUPT = "__interrupt__";
|
|
6
6
|
declare const RESUME = "__resume__";
|
|
7
|
+
/**
|
|
8
|
+
* Snapshot blob for a `DeltaChannel` with finite snapshot frequency.
|
|
9
|
+
*
|
|
10
|
+
* Stored directly in a checkpoint's `channel_values` in place of the full
|
|
11
|
+
* accumulated value. The ancestor walk in
|
|
12
|
+
* {@link BaseCheckpointSaver.getDeltaChannelHistory} terminates when it
|
|
13
|
+
* encounters a populated `channel_values` entry for a channel; a
|
|
14
|
+
* `DeltaSnapshot` value is the materialized state at that ancestor, so the
|
|
15
|
+
* channel reconstructs directly from `.value` without replaying earlier
|
|
16
|
+
* writes.
|
|
17
|
+
*
|
|
18
|
+
* @remarks Beta. The on-disk representation may change in future releases.
|
|
19
|
+
*/
|
|
20
|
+
declare class DeltaSnapshot<Value = unknown> {
|
|
21
|
+
/** Marker used for structural detection across module/realm boundaries. */
|
|
22
|
+
lg_name: "DeltaSnapshot";
|
|
23
|
+
value: Value;
|
|
24
|
+
constructor(value: Value);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Structural type guard for {@link DeltaSnapshot}. Uses the `lg_name` marker
|
|
28
|
+
* so it survives serialization round-trips and cross-package duplication.
|
|
29
|
+
*/
|
|
30
|
+
declare function isDeltaSnapshot<Value = unknown>(value: unknown): value is DeltaSnapshot<Value>;
|
|
7
31
|
interface ChannelProtocol<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {
|
|
8
32
|
ValueType: ValueType;
|
|
9
33
|
UpdateType: UpdateType;
|
|
@@ -46,7 +70,12 @@ interface ChannelProtocol<ValueType = unknown, UpdateType = unknown, CheckpointT
|
|
|
46
70
|
interface SendProtocol {
|
|
47
71
|
node: string;
|
|
48
72
|
args: any;
|
|
73
|
+
timeout?: {
|
|
74
|
+
runTimeout?: number;
|
|
75
|
+
idleTimeout?: number;
|
|
76
|
+
refreshOn?: "auto" | "heartbeat";
|
|
77
|
+
};
|
|
49
78
|
}
|
|
50
79
|
//#endregion
|
|
51
|
-
export { ChannelProtocol, ERROR, INTERRUPT, RESUME, SCHEDULED, SendProtocol, TASKS };
|
|
80
|
+
export { ChannelProtocol, DeltaSnapshot, ERROR, INTERRUPT, RESUME, SCHEDULED, SendProtocol, TASKS, isDeltaSnapshot };
|
|
52
81
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/serde/types.ts"],"mappings":";cAAa,KAAA;AAAA,cACA,KAAA;AAAA,cACA,SAAA;AAAA,cACA,SAAA;AAAA,cACA,MAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/serde/types.ts"],"mappings":";cAAa,KAAA;AAAA,cACA,KAAA;AAAA,cACA,SAAA;AAAA,cACA,SAAA;AAAA,cACA,MAAA;;AAHb;;;;;AACA;;;;;AACA;;cAgBa,aAAA;EAhBS;EAkBpB,OAAA;EAEA,KAAA,EAAO,KAAA;EAEP,WAAA,CAAY,KAAA,EAAO,KAAA;AAAA;;;AANrB;;iBAegB,eAAA,iBAAA,CACd,KAAA,YACC,KAAA,IAAS,aAAA,CAAc,KAAA;AAAA,UAST,eAAA;EAKf,SAAA,EAAW,SAAA;EAEX,UAAA,EAAY,UAAA;EA7BZ;;;EAkCA,aAAA;EAhCY;;;AASd;;;;EAgCE,cAAA,CAAe,UAAA,GAAa,cAAA;EA/B5B;;;;;;AAUF;;EA+BE,MAAA,CAAO,MAAA,EAAQ,UAAA;EA1BJ;;;;;;EAkCX,GAAA,IAAO,SAAA;EAQqB;;;;;;EAA5B,UAAA,IAAc,cAAA;AAAA;AAAA,UAIC,YAAA;EACf,IAAA;EAEA,IAAA;EAGA,OAAA;IACE,UAAA;IACA,WAAA;IACA,SAAA;EAAA;AAAA"}
|
package/dist/serde/types.js
CHANGED
|
@@ -4,7 +4,35 @@ const ERROR = "__error__";
|
|
|
4
4
|
const SCHEDULED = "__scheduled__";
|
|
5
5
|
const INTERRUPT = "__interrupt__";
|
|
6
6
|
const RESUME = "__resume__";
|
|
7
|
+
/**
|
|
8
|
+
* Snapshot blob for a `DeltaChannel` with finite snapshot frequency.
|
|
9
|
+
*
|
|
10
|
+
* Stored directly in a checkpoint's `channel_values` in place of the full
|
|
11
|
+
* accumulated value. The ancestor walk in
|
|
12
|
+
* {@link BaseCheckpointSaver.getDeltaChannelHistory} terminates when it
|
|
13
|
+
* encounters a populated `channel_values` entry for a channel; a
|
|
14
|
+
* `DeltaSnapshot` value is the materialized state at that ancestor, so the
|
|
15
|
+
* channel reconstructs directly from `.value` without replaying earlier
|
|
16
|
+
* writes.
|
|
17
|
+
*
|
|
18
|
+
* @remarks Beta. The on-disk representation may change in future releases.
|
|
19
|
+
*/
|
|
20
|
+
var DeltaSnapshot = class {
|
|
21
|
+
/** Marker used for structural detection across module/realm boundaries. */
|
|
22
|
+
lg_name = "DeltaSnapshot";
|
|
23
|
+
value;
|
|
24
|
+
constructor(value) {
|
|
25
|
+
this.value = value;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Structural type guard for {@link DeltaSnapshot}. Uses the `lg_name` marker
|
|
30
|
+
* so it survives serialization round-trips and cross-package duplication.
|
|
31
|
+
*/
|
|
32
|
+
function isDeltaSnapshot(value) {
|
|
33
|
+
return value != null && typeof value === "object" && value.lg_name === "DeltaSnapshot";
|
|
34
|
+
}
|
|
7
35
|
//#endregion
|
|
8
|
-
export { ERROR, INTERRUPT, RESUME, SCHEDULED, TASKS };
|
|
36
|
+
export { DeltaSnapshot, ERROR, INTERRUPT, RESUME, SCHEDULED, TASKS, isDeltaSnapshot };
|
|
9
37
|
|
|
10
38
|
//# sourceMappingURL=types.js.map
|
package/dist/serde/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/serde/types.ts"],"sourcesContent":["export const TASKS = \"__pregel_tasks\";\nexport const ERROR = \"__error__\";\nexport const SCHEDULED = \"__scheduled__\";\nexport const INTERRUPT = \"__interrupt__\";\nexport const RESUME = \"__resume__\";\n\n// Mirrors BaseChannel in \"@langchain/langgraph\"\nexport interface ChannelProtocol<\n ValueType = unknown,\n UpdateType = unknown,\n CheckpointType = unknown,\n> {\n ValueType: ValueType;\n\n UpdateType: UpdateType;\n\n /**\n * The name of the channel.\n */\n lc_graph_name: string;\n\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @returns {this}\n */\n fromCheckpoint(checkpoint?: CheckpointType): this;\n\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n update(values: UpdateType[]): void;\n\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n get(): ValueType;\n\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n checkpoint(): CheckpointType | undefined;\n}\n\n// Mirrors SendInterface in \"@langchain/langgraph\"\nexport interface SendProtocol {\n node: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any;\n}\n"],"mappings":";AAAA,MAAa,QAAQ;AACrB,MAAa,QAAQ;AACrB,MAAa,YAAY;AACzB,MAAa,YAAY;AACzB,MAAa,SAAS"}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/serde/types.ts"],"sourcesContent":["export const TASKS = \"__pregel_tasks\";\nexport const ERROR = \"__error__\";\nexport const SCHEDULED = \"__scheduled__\";\nexport const INTERRUPT = \"__interrupt__\";\nexport const RESUME = \"__resume__\";\n\n/**\n * Snapshot blob for a `DeltaChannel` with finite snapshot frequency.\n *\n * Stored directly in a checkpoint's `channel_values` in place of the full\n * accumulated value. The ancestor walk in\n * {@link BaseCheckpointSaver.getDeltaChannelHistory} terminates when it\n * encounters a populated `channel_values` entry for a channel; a\n * `DeltaSnapshot` value is the materialized state at that ancestor, so the\n * channel reconstructs directly from `.value` without replaying earlier\n * writes.\n *\n * @remarks Beta. The on-disk representation may change in future releases.\n */\nexport class DeltaSnapshot<Value = unknown> {\n /** Marker used for structural detection across module/realm boundaries. */\n lg_name = \"DeltaSnapshot\" as const;\n\n value: Value;\n\n constructor(value: Value) {\n this.value = value;\n }\n}\n\n/**\n * Structural type guard for {@link DeltaSnapshot}. Uses the `lg_name` marker\n * so it survives serialization round-trips and cross-package duplication.\n */\nexport function isDeltaSnapshot<Value = unknown>(\n value: unknown\n): value is DeltaSnapshot<Value> {\n return (\n value != null &&\n typeof value === \"object\" &&\n (value as { lg_name?: string }).lg_name === \"DeltaSnapshot\"\n );\n}\n\n// Mirrors BaseChannel in \"@langchain/langgraph\"\nexport interface ChannelProtocol<\n ValueType = unknown,\n UpdateType = unknown,\n CheckpointType = unknown,\n> {\n ValueType: ValueType;\n\n UpdateType: UpdateType;\n\n /**\n * The name of the channel.\n */\n lc_graph_name: string;\n\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @returns {this}\n */\n fromCheckpoint(checkpoint?: CheckpointType): this;\n\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n update(values: UpdateType[]): void;\n\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n get(): ValueType;\n\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n checkpoint(): CheckpointType | undefined;\n}\n\n// Mirrors SendInterface in \"@langchain/langgraph\"\nexport interface SendProtocol {\n node: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any;\n // Optional per-task timeout policy. Structural to avoid a dependency on the\n // langgraph package; mirrors `TimeoutPolicy` in \"@langchain/langgraph\".\n timeout?: {\n runTimeout?: number;\n idleTimeout?: number;\n refreshOn?: \"auto\" | \"heartbeat\";\n };\n}\n"],"mappings":";AAAA,MAAa,QAAQ;AACrB,MAAa,QAAQ;AACrB,MAAa,YAAY;AACzB,MAAa,YAAY;AACzB,MAAa,SAAS;;;;;;;;;;;;;;AAetB,IAAa,gBAAb,MAA4C;;CAE1C,UAAU;CAEV;CAEA,YAAY,OAAc;AACxB,OAAK,QAAQ;;;;;;;AAQjB,SAAgB,gBACd,OAC+B;AAC/B,QACE,SAAS,QACT,OAAO,UAAU,YAChB,MAA+B,YAAY"}
|
package/dist/types.d.cts
CHANGED
|
@@ -29,7 +29,53 @@ type CheckpointMetadata<ExtraProperties extends object = object> = {
|
|
|
29
29
|
* Mapping from checkpoint namespace to checkpoint ID.
|
|
30
30
|
*/
|
|
31
31
|
parents: Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Per-channel counters since the last `DeltaSnapshot` was written, backing
|
|
34
|
+
* `DeltaChannel`.
|
|
35
|
+
*
|
|
36
|
+
* Maps channel name to a `[updates, supersteps]` pair:
|
|
37
|
+
* - `updates` (index 0): number of supersteps that wrote to this channel
|
|
38
|
+
* since its last snapshot blob.
|
|
39
|
+
* - `supersteps` (index 1): total supersteps elapsed since this channel's
|
|
40
|
+
* last snapshot, regardless of whether the channel was written.
|
|
41
|
+
*
|
|
42
|
+
* A snapshot fires when EITHER `updates >= ch.snapshotFrequency` OR
|
|
43
|
+
* `supersteps >= DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT` (system-wide bound,
|
|
44
|
+
* default 5000, env `LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT`). The
|
|
45
|
+
* supersteps bound prevents unbounded ancestor walks on threads where a
|
|
46
|
+
* delta channel exists but is no longer being updated.
|
|
47
|
+
*
|
|
48
|
+
* Absent on threads that don't use delta channels.
|
|
49
|
+
*
|
|
50
|
+
* @remarks Beta. The key name and contents may change while the
|
|
51
|
+
* delta-channel design stabilizes.
|
|
52
|
+
*/
|
|
53
|
+
counters_since_delta_snapshot?: Record<string, [number, number]>;
|
|
32
54
|
} & ExtraProperties;
|
|
55
|
+
/**
|
|
56
|
+
* Per-channel result entry from
|
|
57
|
+
* {@link BaseCheckpointSaver.getDeltaChannelHistory}.
|
|
58
|
+
*
|
|
59
|
+
* Storage-level view of what one channel contributed across the ancestor
|
|
60
|
+
* chain of a target checkpoint:
|
|
61
|
+
*
|
|
62
|
+
* - `writes` — on-path deltas oldest→newest as {@link CheckpointPendingWrite}
|
|
63
|
+
* tuples. Always present; possibly empty. Already filtered to one channel.
|
|
64
|
+
* Writes stored at the target checkpoint itself are pending for the next
|
|
65
|
+
* super-step and are excluded.
|
|
66
|
+
* - `seed` — the stored value at the nearest ancestor whose
|
|
67
|
+
* `channel_values[ch]` is populated. Omitted if the walk reached the root
|
|
68
|
+
* without finding any stored value (the consumer treats absence as "start
|
|
69
|
+
* empty"). Typically a `DeltaSnapshot` for delta channels with finite
|
|
70
|
+
* snapshot frequency, or a plain value for threads migrated from a
|
|
71
|
+
* pre-delta channel type.
|
|
72
|
+
*
|
|
73
|
+
* @remarks Beta. Field names and semantics may change.
|
|
74
|
+
*/
|
|
75
|
+
type DeltaChannelHistory = {
|
|
76
|
+
writes: CheckpointPendingWrite[];
|
|
77
|
+
seed?: unknown;
|
|
78
|
+
};
|
|
33
79
|
//#endregion
|
|
34
|
-
export { All, CheckpointMetadata, CheckpointPendingWrite, PendingWrite, PendingWriteValue };
|
|
80
|
+
export { All, CheckpointMetadata, CheckpointPendingWrite, DeltaChannelHistory, PendingWrite, PendingWriteValue };
|
|
35
81
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,GAAA;AAAA,KAEA,iBAAA;AAAA,KAEA,YAAA,sBAAkC,OAAA,EAAS,iBAAA;AAAA,KAE3C,sBAAA,qBACV,MAAA,KACG,YAAA;;;;;AAJL;KAYY,kBAAA;EAZY;;;;;;;EAoBtB,MAAA;EAlBgC;;;;;;EA0BhC,IAAA;EAxBe;AAQjB;;;EAsBE,OAAA,EAAS,MAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,GAAA;AAAA,KAEA,iBAAA;AAAA,KAEA,YAAA,sBAAkC,OAAA,EAAS,iBAAA;AAAA,KAE3C,sBAAA,qBACV,MAAA,KACG,YAAA;;;;;AAJL;KAYY,kBAAA;EAZY;;;;;;;EAoBtB,MAAA;EAlBgC;;;;;;EA0BhC,IAAA;EAxBe;AAQjB;;;EAsBE,OAAA,EAAS,MAAA;EAuBuB;;;;;;;;;;;;;;AAuBlC;;;;;;;EAvBE,6BAAA,GAAgC,MAAA;AAAA,IAC9B,eAAA;;;;;;;;;;;;;;;;;;;;;KAsBQ,mBAAA;EACV,MAAA,EAAQ,sBAAA;EACR,IAAA;AAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -29,7 +29,53 @@ type CheckpointMetadata<ExtraProperties extends object = object> = {
|
|
|
29
29
|
* Mapping from checkpoint namespace to checkpoint ID.
|
|
30
30
|
*/
|
|
31
31
|
parents: Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Per-channel counters since the last `DeltaSnapshot` was written, backing
|
|
34
|
+
* `DeltaChannel`.
|
|
35
|
+
*
|
|
36
|
+
* Maps channel name to a `[updates, supersteps]` pair:
|
|
37
|
+
* - `updates` (index 0): number of supersteps that wrote to this channel
|
|
38
|
+
* since its last snapshot blob.
|
|
39
|
+
* - `supersteps` (index 1): total supersteps elapsed since this channel's
|
|
40
|
+
* last snapshot, regardless of whether the channel was written.
|
|
41
|
+
*
|
|
42
|
+
* A snapshot fires when EITHER `updates >= ch.snapshotFrequency` OR
|
|
43
|
+
* `supersteps >= DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT` (system-wide bound,
|
|
44
|
+
* default 5000, env `LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT`). The
|
|
45
|
+
* supersteps bound prevents unbounded ancestor walks on threads where a
|
|
46
|
+
* delta channel exists but is no longer being updated.
|
|
47
|
+
*
|
|
48
|
+
* Absent on threads that don't use delta channels.
|
|
49
|
+
*
|
|
50
|
+
* @remarks Beta. The key name and contents may change while the
|
|
51
|
+
* delta-channel design stabilizes.
|
|
52
|
+
*/
|
|
53
|
+
counters_since_delta_snapshot?: Record<string, [number, number]>;
|
|
32
54
|
} & ExtraProperties;
|
|
55
|
+
/**
|
|
56
|
+
* Per-channel result entry from
|
|
57
|
+
* {@link BaseCheckpointSaver.getDeltaChannelHistory}.
|
|
58
|
+
*
|
|
59
|
+
* Storage-level view of what one channel contributed across the ancestor
|
|
60
|
+
* chain of a target checkpoint:
|
|
61
|
+
*
|
|
62
|
+
* - `writes` — on-path deltas oldest→newest as {@link CheckpointPendingWrite}
|
|
63
|
+
* tuples. Always present; possibly empty. Already filtered to one channel.
|
|
64
|
+
* Writes stored at the target checkpoint itself are pending for the next
|
|
65
|
+
* super-step and are excluded.
|
|
66
|
+
* - `seed` — the stored value at the nearest ancestor whose
|
|
67
|
+
* `channel_values[ch]` is populated. Omitted if the walk reached the root
|
|
68
|
+
* without finding any stored value (the consumer treats absence as "start
|
|
69
|
+
* empty"). Typically a `DeltaSnapshot` for delta channels with finite
|
|
70
|
+
* snapshot frequency, or a plain value for threads migrated from a
|
|
71
|
+
* pre-delta channel type.
|
|
72
|
+
*
|
|
73
|
+
* @remarks Beta. Field names and semantics may change.
|
|
74
|
+
*/
|
|
75
|
+
type DeltaChannelHistory = {
|
|
76
|
+
writes: CheckpointPendingWrite[];
|
|
77
|
+
seed?: unknown;
|
|
78
|
+
};
|
|
33
79
|
//#endregion
|
|
34
|
-
export { All, CheckpointMetadata, CheckpointPendingWrite, PendingWrite, PendingWriteValue };
|
|
80
|
+
export { All, CheckpointMetadata, CheckpointPendingWrite, DeltaChannelHistory, PendingWrite, PendingWriteValue };
|
|
35
81
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,GAAA;AAAA,KAEA,iBAAA;AAAA,KAEA,YAAA,sBAAkC,OAAA,EAAS,iBAAA;AAAA,KAE3C,sBAAA,qBACV,MAAA,KACG,YAAA;;;;;AAJL;KAYY,kBAAA;EAZY;;;;;;;EAoBtB,MAAA;EAlBgC;;;;;;EA0BhC,IAAA;EAxBe;AAQjB;;;EAsBE,OAAA,EAAS,MAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,GAAA;AAAA,KAEA,iBAAA;AAAA,KAEA,YAAA,sBAAkC,OAAA,EAAS,iBAAA;AAAA,KAE3C,sBAAA,qBACV,MAAA,KACG,YAAA;;;;;AAJL;KAYY,kBAAA;EAZY;;;;;;;EAoBtB,MAAA;EAlBgC;;;;;;EA0BhC,IAAA;EAxBe;AAQjB;;;EAsBE,OAAA,EAAS,MAAA;EAuBuB;;;;;;;;;;;;;;AAuBlC;;;;;;;EAvBE,6BAAA,GAAgC,MAAA;AAAA,IAC9B,eAAA;;;;;;;;;;;;;;;;;;;;;KAsBQ,mBAAA;EACV,MAAA,EAAQ,sBAAA;EACR,IAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph-checkpoint",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Library with base interfaces for LangGraph checkpoint savers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"author": "LangChain",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"uuid": "^
|
|
19
|
+
"uuid": "^14.0.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@langchain/core": "^1.1.44"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"rollup": "^4.37.0",
|
|
31
31
|
"tsx": "^4.19.3",
|
|
32
32
|
"typescript": "^4.9.5 || ^5.4.5",
|
|
33
|
-
"vitest": "^
|
|
33
|
+
"vitest": "^4.1.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public",
|