@ironflow/langgraph 0.20.0 → 0.20.2

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/LICENSE ADDED
@@ -0,0 +1,181 @@
1
+ # Ironflow License
2
+
3
+ **Version 1.0 — 2026-05-08**
4
+
5
+ This file contains the binding legal terms under which Ironflow is offered.
6
+ A plain-English summary lives at `docs/explanation/licensing.md`. If the two
7
+ disagree, this file controls.
8
+
9
+ > **Lawyer review status:** v1 DIY-substitute. Pending counsel review before
10
+ > the first paid customer ships (issue #777). All of the following MUST be
11
+ > resolved before this license is published on the public release mirror:
12
+ >
13
+ > - `[LICENSOR_ENTITY]` placeholder filled with the legal entity name
14
+ > - `[LICENSE_EMAIL]` placeholder filled with the commercial-licensing
15
+ > contact address
16
+ > - "Personal-Use and Evaluation Carve-Out" section reviewed by counsel —
17
+ > this is supplemental to the FSL Permitted Purpose and was added to
18
+ > match the worked examples in `docs/explanation/licensing.md` per the
19
+ > plan body. JetBrains Toolbox + Postman free-tier EULAs were the
20
+ > reference for the carve-out shape, but the wording is original prose
21
+ > and has not been counsel-reviewed.
22
+ > - "Governing Law and Venue" + "Commercial Licensing" sections reviewed
23
+ > by counsel — these are original prose, not part of the FSL template.
24
+ >
25
+ > **Versioning:** revised terms apply on next install. Each release ships
26
+ > the LICENSE that was effective at the time the artifact was built.
27
+ > Continuing to use a previously installed version under its prior terms
28
+ > is permitted; upgrading to a newer release accepts the LICENSE shipped
29
+ > with that release.
30
+
31
+ ---
32
+
33
+ ## Functional Source License, Version 1.1, ALv2 Future License
34
+
35
+ ## Abbreviation
36
+
37
+ FSL-1.1-ALv2
38
+
39
+ ## Notice
40
+
41
+ Copyright 2026 [LICENSOR_ENTITY]
42
+
43
+ ## Terms and Conditions
44
+
45
+ ### Licensor ("We")
46
+
47
+ The party offering the Software under these Terms and Conditions.
48
+
49
+ ### The Software
50
+
51
+ The "Software" is each version of the software that we make available under
52
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
53
+ Conditions with the Software.
54
+
55
+ ### License Grant
56
+
57
+ Subject to your compliance with this License Grant and the Patents,
58
+ Redistribution and Trademark clauses below, we hereby grant you the right to
59
+ use, copy, modify, create derivative works, publicly perform, publicly display
60
+ and redistribute the Software for any Permitted Purpose identified below.
61
+
62
+ ### Permitted Purpose
63
+
64
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
65
+ means making the Software available to others in a commercial product or
66
+ service that:
67
+
68
+ 1. substitutes for the Software;
69
+
70
+ 2. substitutes for any other product or service we offer using the Software
71
+ that exists as of the date we make the Software available; or
72
+
73
+ 3. offers the same or substantially similar functionality as the Software.
74
+
75
+ Permitted Purposes specifically include using the Software:
76
+
77
+ 1. for your internal use and access;
78
+
79
+ 2. for non-commercial education;
80
+
81
+ 3. for non-commercial research; and
82
+
83
+ 4. in connection with professional services that you provide to a licensee
84
+ using the Software in accordance with these Terms and Conditions.
85
+
86
+ ### Patents
87
+
88
+ To the extent your use for a Permitted Purpose would necessarily infringe our
89
+ patents, the license grant above includes a license under our patents. If you
90
+ make a claim against any party that the Software infringes or contributes to
91
+ the infringement of any patent, then your patent license to the Software ends
92
+ immediately.
93
+
94
+ ### Redistribution
95
+
96
+ The Terms and Conditions apply to all copies, modifications and derivatives of
97
+ the Software.
98
+
99
+ If you redistribute any copies, modifications or derivatives of the Software,
100
+ you must include a copy of or a link to these Terms and Conditions and not
101
+ remove any copyright notices provided in or with the Software.
102
+
103
+ ### Disclaimer
104
+
105
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
106
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
107
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
108
+
109
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
110
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
111
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
112
+
113
+ ### Trademarks
114
+
115
+ Except for displaying the License Details and identifying us as the origin of
116
+ the Software, you have no right under these Terms and Conditions to use our
117
+ trademarks, trade names, service marks or product names.
118
+
119
+ ## Grant of Future License
120
+
121
+ We hereby irrevocably grant you an additional license to use the Software under
122
+ the Apache License, Version 2.0 that is effective on the second anniversary of
123
+ the date we make the Software available. On or after that date, you may use the
124
+ Software under the Apache License, Version 2.0, in which case the following
125
+ will apply:
126
+
127
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
128
+ this file except in compliance with the License.
129
+
130
+ You may obtain a copy of the License at
131
+
132
+ http://www.apache.org/licenses/LICENSE-2.0
133
+
134
+ Unless required by applicable law or agreed to in writing, software distributed
135
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
136
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
137
+ specific language governing permissions and limitations under the License.
138
+
139
+ ---
140
+
141
+ ## Personal-Use and Evaluation Carve-Out
142
+
143
+ > _Supplemental to the FSL Permitted Purpose above. Pending counsel review._
144
+
145
+ The following uses are explicitly permitted in addition to the FSL Permitted
146
+ Purposes listed above:
147
+
148
+ 1. **Personal use.** Use of the Software by a natural person for that
149
+ person's personal, non-commercial purposes — including hobby projects,
150
+ self-education, and side projects that do not generate revenue or
151
+ commercial advantage.
152
+
153
+ 2. **Evaluation.** Use of the Software by any individual or organization for
154
+ the purpose of evaluating the Software prior to a commercial purchase
155
+ decision, for a period of up to ninety (90) days from first install.
156
+ Evaluation use does not require notification.
157
+
158
+ These carve-outs are non-transferable and do not extend to redistribution,
159
+ sublicensing, or any Competing Use as defined in the FSL Permitted Purpose
160
+ section.
161
+
162
+ ---
163
+
164
+ ## Governing Law and Venue
165
+
166
+ These Terms and Conditions are governed by the laws of the State of Delaware,
167
+ United States of America, without regard to its conflict-of-laws provisions.
168
+ Any dispute arising out of or relating to these Terms and Conditions shall be
169
+ brought exclusively in the state or federal courts located in Delaware, and
170
+ you consent to the personal jurisdiction of those courts.
171
+
172
+ ## Commercial Licensing
173
+
174
+ For uses that fall outside the Permitted Purpose — including any Competing
175
+ Use, or any commercial use case for which a separate paid license is required
176
+ under our Cloud or Enterprise terms — contact `[LICENSE_EMAIL]` to discuss
177
+ a commercial license.
178
+
179
+ ## SPDX Identifier
180
+
181
+ `LicenseRef-Ironflow-EULA`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ironflow/langgraph",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
4
4
  "description": "LangGraph checkpoint saver backed by Ironflow entity streams — durable agent state with crash-resume",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -18,18 +18,18 @@
18
18
  "README.md"
19
19
  ],
20
20
  "dependencies": {
21
- "@ironflow/node": "^0.20.0",
22
- "@ironflow/core": "^0.20.0"
21
+ "@ironflow/core": "^0.20.2",
22
+ "@ironflow/node": "^0.20.2"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@langchain/core": "^1.0.0",
26
26
  "@langchain/langgraph-checkpoint": "^1.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@langchain/core": "^1.1.41",
30
- "@langchain/langgraph": "^1.2.9",
31
- "@langchain/langgraph-checkpoint": "^1.0.1",
32
- "@types/node": "^22.14.0",
29
+ "@langchain/core": "^1.1.45",
30
+ "@langchain/langgraph": "^1.3.0",
31
+ "@langchain/langgraph-checkpoint": "^1.0.2",
32
+ "@types/node": "^22.19.18",
33
33
  "typescript": "^5.9.3",
34
34
  "vitest": "^2.1.9"
35
35
  },
@@ -45,14 +45,14 @@
45
45
  "agent"
46
46
  ],
47
47
  "author": "Ironflow",
48
- "license": "MIT",
48
+ "license": "LicenseRef-Ironflow-EULA",
49
49
  "repository": {
50
50
  "type": "git",
51
51
  "url": "https://github.com/ironflowapp/ironflow.git",
52
52
  "directory": "sdk/js/langgraph"
53
53
  },
54
54
  "publishConfig": {
55
- "access": "restricted"
55
+ "access": "public"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsc --build tsconfig.build.json",
@@ -1,8 +0,0 @@
1
- /**
2
- * Base64 helpers — LangGraph's serde returns Uint8Array for serialized
3
- * checkpoints/metadata/writes, but Ironflow's AppendEvent payload is JSON.
4
- * Encode bytes as base64 strings on write; decode back to bytes on read.
5
- */
6
- export declare function bytesToB64(bytes: Uint8Array): string;
7
- export declare function b64ToBytes(b64: string): Uint8Array;
8
- //# sourceMappingURL=encoding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEpD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAElD"}
package/dist/encoding.js DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * Base64 helpers — LangGraph's serde returns Uint8Array for serialized
3
- * checkpoints/metadata/writes, but Ironflow's AppendEvent payload is JSON.
4
- * Encode bytes as base64 strings on write; decode back to bytes on read.
5
- */
6
- export function bytesToB64(bytes) {
7
- return Buffer.from(bytes).toString("base64");
8
- }
9
- export function b64ToBytes(b64) {
10
- return new Uint8Array(Buffer.from(b64, "base64"));
11
- }
12
- //# sourceMappingURL=encoding.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,UAAU,UAAU,CAAC,KAAiB;IAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpD,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * @ironflow/langgraph — durable LangGraph checkpoint saver.
3
- *
4
- * Drop-in replacement for MemorySaver / SqliteSaver / PostgresSaver. Stores
5
- * each thread's checkpoint stream in Ironflow as a per-thread entity stream
6
- * (`irn:agent-ckpt:{thread_id}`), inheriting Ironflow's crash-resume,
7
- * audit, and replay semantics.
8
- *
9
- * @example
10
- * ```ts
11
- * import { IronflowClient } from "@ironflow/node";
12
- * import { IronflowSaver } from "@ironflow/langgraph";
13
- * import { StateGraph } from "@langchain/langgraph";
14
- *
15
- * const client = new IronflowClient({ serverUrl: process.env.IRONFLOW_URL! });
16
- * const saver = new IronflowSaver({ client });
17
- * const graph = new StateGraph(...).compile({ checkpointer: saver });
18
- * await graph.invoke(input, { configurable: { thread_id: "thread-1" } });
19
- * ```
20
- */
21
- export { IronflowSaver } from "./saver.js";
22
- export type { IronflowSaverConfig } from "./saver.js";
23
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * @ironflow/langgraph — durable LangGraph checkpoint saver.
3
- *
4
- * Drop-in replacement for MemorySaver / SqliteSaver / PostgresSaver. Stores
5
- * each thread's checkpoint stream in Ironflow as a per-thread entity stream
6
- * (`irn:agent-ckpt:{thread_id}`), inheriting Ironflow's crash-resume,
7
- * audit, and replay semantics.
8
- *
9
- * @example
10
- * ```ts
11
- * import { IronflowClient } from "@ironflow/node";
12
- * import { IronflowSaver } from "@ironflow/langgraph";
13
- * import { StateGraph } from "@langchain/langgraph";
14
- *
15
- * const client = new IronflowClient({ serverUrl: process.env.IRONFLOW_URL! });
16
- * const saver = new IronflowSaver({ client });
17
- * const graph = new StateGraph(...).compile({ checkpointer: saver });
18
- * await graph.invoke(input, { configurable: { thread_id: "thread-1" } });
19
- * ```
20
- */
21
- export { IronflowSaver } from "./saver.js";
22
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
package/dist/saver.d.ts DELETED
@@ -1,47 +0,0 @@
1
- /**
2
- * IronflowSaver — LangGraph BaseCheckpointSaver backed by Ironflow entity streams.
3
- *
4
- * Storage model:
5
- * - One entity stream per LangGraph thread, id = `irn:agent-ckpt:{thread_id}`
6
- * - entity_type = `agent-ckpt`
7
- * - Three event names:
8
- * checkpoint.put — full checkpoint snapshot
9
- * checkpoint.putWrites — pending writes for a task before next checkpoint
10
- * checkpoint.deleteThread — tombstone; drops all events at-or-before its position
11
- *
12
- * Replay semantics:
13
- * - put events use idempotency key `lg:put:{thread}:{ns}:{checkpoint_id}` so
14
- * server-side dedup makes re-puts a no-op (LangGraph re-emits the same
15
- * checkpoint_id on retry).
16
- * - putWrites events use no idempotency key — replays append fresh events and
17
- * materialize() dedupes by (taskId, idx) at read time. This matches
18
- * MemorySaver's cross-call accumulation: a second putWrites for the same
19
- * (checkpoint_id, task_id) with different writes adds them to the visible
20
- * pendingWrites list rather than dropping the whole event.
21
- *
22
- * Read path materializes the stream in memory. v1 is happy with full scans
23
- * (typical thread has <100 events). Optimization via a managed projection
24
- * is a separate issue once profiling shows it's worth it.
25
- */
26
- import { BaseCheckpointSaver, type Checkpoint, type CheckpointListOptions, type CheckpointTuple, type ChannelVersions } from "@langchain/langgraph-checkpoint";
27
- import type { CheckpointMetadata, PendingWrite, SerializerProtocol } from "@langchain/langgraph-checkpoint";
28
- import type { RunnableConfig } from "@langchain/core/runnables";
29
- import type { IronflowClient } from "@ironflow/node";
30
- export interface IronflowSaverConfig {
31
- /** Ironflow client used for stream reads/writes. */
32
- client: IronflowClient;
33
- /** Optional serializer override. Default: BaseCheckpointSaver's JSON serde. */
34
- serde?: SerializerProtocol;
35
- }
36
- export declare class IronflowSaver extends BaseCheckpointSaver {
37
- private readonly client;
38
- constructor(config: IronflowSaverConfig);
39
- getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined>;
40
- list(config: RunnableConfig, options?: CheckpointListOptions): AsyncGenerator<CheckpointTuple>;
41
- put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, _newVersions: ChannelVersions): Promise<RunnableConfig>;
42
- putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
43
- deleteThread(threadId: string): Promise<void>;
44
- private readStream;
45
- private toTuple;
46
- }
47
- //# sourceMappingURL=saver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"saver.d.ts","sourceRoot":"","sources":["../src/saver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EAEpB,KAAK,eAAe,EAGrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,kBAAkB,EAElB,YAAY,EACZ,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkCrD,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,MAAM,EAAE,cAAc,CAAC;IACvB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,qBAAa,aAAc,SAAQ,mBAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;gBAE5B,MAAM,EAAE,mBAAmB;IAKjC,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAiBrE,IAAI,CACT,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,cAAc,CAAC,eAAe,CAAC;IA0C5B,GAAG,CACP,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,kBAAkB,EAC5B,YAAY,EAAE,eAAe,GAC5B,OAAO,CAAC,cAAc,CAAC;IAwCpB,SAAS,CACb,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,YAAY,EAAE,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IA0CV,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAcrC,UAAU;YAkBV,OAAO;CAkDtB"}
package/dist/saver.js DELETED
@@ -1,299 +0,0 @@
1
- /**
2
- * IronflowSaver — LangGraph BaseCheckpointSaver backed by Ironflow entity streams.
3
- *
4
- * Storage model:
5
- * - One entity stream per LangGraph thread, id = `irn:agent-ckpt:{thread_id}`
6
- * - entity_type = `agent-ckpt`
7
- * - Three event names:
8
- * checkpoint.put — full checkpoint snapshot
9
- * checkpoint.putWrites — pending writes for a task before next checkpoint
10
- * checkpoint.deleteThread — tombstone; drops all events at-or-before its position
11
- *
12
- * Replay semantics:
13
- * - put events use idempotency key `lg:put:{thread}:{ns}:{checkpoint_id}` so
14
- * server-side dedup makes re-puts a no-op (LangGraph re-emits the same
15
- * checkpoint_id on retry).
16
- * - putWrites events use no idempotency key — replays append fresh events and
17
- * materialize() dedupes by (taskId, idx) at read time. This matches
18
- * MemorySaver's cross-call accumulation: a second putWrites for the same
19
- * (checkpoint_id, task_id) with different writes adds them to the visible
20
- * pendingWrites list rather than dropping the whole event.
21
- *
22
- * Read path materializes the stream in memory. v1 is happy with full scans
23
- * (typical thread has <100 events). Optimization via a managed projection
24
- * is a separate issue once profiling shows it's worth it.
25
- */
26
- import { BaseCheckpointSaver, WRITES_IDX_MAP, copyCheckpoint, getCheckpointId, } from "@langchain/langgraph-checkpoint";
27
- import { IronflowError } from "@ironflow/core";
28
- import { b64ToBytes, bytesToB64 } from "./encoding.js";
29
- const ENTITY_TYPE = "agent-ckpt";
30
- const EVT_PUT = "checkpoint.put";
31
- const EVT_PUT_WRITES = "checkpoint.putWrites";
32
- const EVT_DELETE = "checkpoint.deleteThread";
33
- const READ_BATCH = 500;
34
- export class IronflowSaver extends BaseCheckpointSaver {
35
- client;
36
- constructor(config) {
37
- super(config.serde);
38
- this.client = config.client;
39
- }
40
- async getTuple(config) {
41
- const threadId = requireThreadId(config);
42
- const ns = config.configurable?.checkpoint_ns ?? "";
43
- const requestedId = getCheckpointId(config);
44
- const events = await this.readStream(threadId);
45
- const view = materialize(events, ns);
46
- if (!view)
47
- return undefined;
48
- const target = requestedId
49
- ? view.checkpoints.get(requestedId)
50
- : view.latest;
51
- if (!target)
52
- return undefined;
53
- return await this.toTuple(target, ns, threadId, view, requestedId ? config : undefined);
54
- }
55
- async *list(config, options) {
56
- const { before, limit, filter } = options ?? {};
57
- const threadId = config.configurable?.thread_id;
58
- const ns = config.configurable?.checkpoint_ns;
59
- const filterCheckpointId = config.configurable?.checkpoint_id;
60
- const beforeId = before?.configurable?.checkpoint_id;
61
- if (!threadId) {
62
- throw new IronflowError("list() without thread_id requires server-side index — pass thread_id in config.configurable", { code: "LG_THREAD_ID_REQUIRED", retryable: false });
63
- }
64
- let yielded = 0;
65
- const events = await this.readStream(threadId);
66
- const namespaces = ns !== undefined ? [ns] : namespacesIn(events);
67
- for (const useNs of namespaces) {
68
- const view = materialize(events, useNs);
69
- if (!view)
70
- continue;
71
- // Sort by checkpoint_id descending. LangGraph's checkpoint IDs are
72
- // UUID v6 (timestamp-prefixed lex-ordered) per
73
- // @langchain/langgraph-checkpoint base.d.ts; this matches MemorySaver
74
- // / SqliteSaver / PostgresSaver "ORDER BY checkpoint_id DESC" semantics.
75
- const ordered = [...view.checkpoints.values()].sort((a, b) => b.data.checkpoint_id.localeCompare(a.data.checkpoint_id));
76
- for (const entry of ordered) {
77
- const id = entry.data.checkpoint_id;
78
- if (filterCheckpointId && id !== filterCheckpointId)
79
- continue;
80
- if (beforeId && id >= beforeId)
81
- continue;
82
- const tuple = await this.toTuple(entry, useNs, threadId, view, undefined);
83
- if (filter && !matchesFilter(tuple.metadata, filter))
84
- continue;
85
- if (limit !== undefined && yielded >= limit)
86
- return;
87
- yielded += 1;
88
- yield tuple;
89
- }
90
- }
91
- }
92
- async put(config, checkpoint, metadata, _newVersions) {
93
- const threadId = requireThreadId(config);
94
- const ns = config.configurable?.checkpoint_ns ?? "";
95
- const parentId = config.configurable?.checkpoint_id;
96
- const prepared = copyCheckpoint(checkpoint);
97
- const [[cpType, cpBytes], [metaType, metaBytes],] = await Promise.all([
98
- this.serde.dumpsTyped(prepared),
99
- this.serde.dumpsTyped(metadata),
100
- ]);
101
- const data = {
102
- checkpoint_ns: ns,
103
- checkpoint_id: checkpoint.id,
104
- type: cpType,
105
- checkpoint_b64: bytesToB64(cpBytes),
106
- metadata_b64: bytesToB64(metaBytes),
107
- metadata_type: metaType,
108
- ts: checkpoint.ts,
109
- ...(parentId ? { parent_checkpoint_id: parentId } : {}),
110
- };
111
- await this.client.streams.append(streamId(threadId), { name: EVT_PUT, data: data, entityType: ENTITY_TYPE }, { idempotencyKey: `lg:put:${threadId}:${ns}:${checkpoint.id}` });
112
- return {
113
- configurable: {
114
- thread_id: threadId,
115
- checkpoint_ns: ns,
116
- checkpoint_id: checkpoint.id,
117
- },
118
- };
119
- }
120
- async putWrites(config, writes, taskId) {
121
- const threadId = requireThreadId(config);
122
- const ns = config.configurable?.checkpoint_ns ?? "";
123
- const checkpointId = config.configurable?.checkpoint_id;
124
- if (typeof checkpointId !== "string" || !checkpointId) {
125
- throw new IronflowError("putWrites requires checkpoint_id in RunnableConfig.configurable", { code: "LG_CHECKPOINT_ID_REQUIRED", retryable: false });
126
- }
127
- const seen = new Set();
128
- const entries = [];
129
- for (let i = 0; i < writes.length; i += 1) {
130
- const [channel, value] = writes[i];
131
- const idx = WRITES_IDX_MAP[channel] ?? i;
132
- const dedupKey = `${taskId}:${idx}`;
133
- if (idx >= 0 && seen.has(dedupKey))
134
- continue;
135
- seen.add(dedupKey);
136
- const [type, bytes] = await this.serde.dumpsTyped(value);
137
- entries.push({ channel, idx, type, value_b64: bytesToB64(bytes) });
138
- }
139
- if (entries.length === 0)
140
- return;
141
- const data = {
142
- checkpoint_ns: ns,
143
- checkpoint_id: checkpointId,
144
- task_id: taskId,
145
- writes: entries,
146
- };
147
- await this.client.streams.append(streamId(threadId), {
148
- name: EVT_PUT_WRITES,
149
- data: data,
150
- entityType: ENTITY_TYPE,
151
- });
152
- }
153
- async deleteThread(threadId) {
154
- // No idempotency key — semantics are "append a tombstone", not dedup.
155
- // Multiple deletes append multiple tombstones; reads use the highest one
156
- // as cutoff, so duplicate tombstones are harmless.
157
- await this.client.streams.append(streamId(threadId), {
158
- name: EVT_DELETE,
159
- data: { deleted_at: new Date().toISOString() },
160
- entityType: ENTITY_TYPE,
161
- });
162
- }
163
- async readStream(threadId) {
164
- const all = [];
165
- let fromVersion = 0;
166
- while (true) {
167
- const { events } = await this.client.streams.read(streamId(threadId), {
168
- fromVersion,
169
- limit: READ_BATCH,
170
- direction: "forward",
171
- });
172
- if (events.length === 0)
173
- break;
174
- all.push(...events);
175
- const last = events[events.length - 1];
176
- if (events.length < READ_BATCH)
177
- break;
178
- fromVersion = last.entityVersion + 1;
179
- }
180
- return all;
181
- }
182
- async toTuple(entry, ns, threadId, view, originalConfig) {
183
- const checkpoint = (await this.serde.loadsTyped(entry.data.type, b64ToBytes(entry.data.checkpoint_b64)));
184
- const metadata = (await this.serde.loadsTyped(entry.data.metadata_type, b64ToBytes(entry.data.metadata_b64)));
185
- const writes = view.writes.get(entry.data.checkpoint_id) ?? [];
186
- const pendingWrites = [];
187
- const seenWrite = new Set();
188
- for (const w of writes) {
189
- const key = `${w.taskId}:${w.idx}`;
190
- if (w.idx >= 0 && seenWrite.has(key))
191
- continue;
192
- seenWrite.add(key);
193
- const value = await this.serde.loadsTyped(w.type, b64ToBytes(w.value_b64));
194
- pendingWrites.push([w.taskId, w.channel, value]);
195
- }
196
- const tuple = {
197
- config: originalConfig ?? {
198
- configurable: {
199
- thread_id: threadId,
200
- checkpoint_ns: ns,
201
- checkpoint_id: entry.data.checkpoint_id,
202
- },
203
- },
204
- checkpoint,
205
- metadata,
206
- pendingWrites,
207
- };
208
- if (entry.data.parent_checkpoint_id) {
209
- tuple.parentConfig = {
210
- configurable: {
211
- thread_id: threadId,
212
- checkpoint_ns: ns,
213
- checkpoint_id: entry.data.parent_checkpoint_id,
214
- },
215
- };
216
- }
217
- return tuple;
218
- }
219
- }
220
- function streamId(threadId) {
221
- return `irn:agent-ckpt:${threadId}`;
222
- }
223
- function requireThreadId(config) {
224
- const threadId = config.configurable?.thread_id;
225
- if (typeof threadId !== "string" || !threadId) {
226
- throw new IronflowError("RunnableConfig.configurable.thread_id is required", { code: "LG_THREAD_ID_REQUIRED", retryable: false });
227
- }
228
- return threadId;
229
- }
230
- function materialize(events, ns) {
231
- let cutoff = -1;
232
- for (const e of events) {
233
- if (e.name === EVT_DELETE && e.entityVersion > cutoff) {
234
- cutoff = e.entityVersion;
235
- }
236
- }
237
- const checkpoints = new Map();
238
- const writes = new Map();
239
- let latest;
240
- for (const e of events) {
241
- if (e.entityVersion <= cutoff)
242
- continue;
243
- if (e.name === EVT_PUT) {
244
- const data = e.data;
245
- if (data.checkpoint_ns !== ns)
246
- continue;
247
- const entry = { data, version: e.entityVersion };
248
- checkpoints.set(data.checkpoint_id, entry);
249
- // Lex-MAX of checkpoint_id matches MemorySaver / SqliteSaver /
250
- // PostgresSaver "latest" semantics (ORDER BY checkpoint_id DESC LIMIT 1).
251
- // LangGraph IDs are UUID v6, so lex order == time order.
252
- if (!latest || data.checkpoint_id > latest.data.checkpoint_id) {
253
- latest = entry;
254
- }
255
- }
256
- else if (e.name === EVT_PUT_WRITES) {
257
- const data = e.data;
258
- if (data.checkpoint_ns !== ns)
259
- continue;
260
- const list = writes.get(data.checkpoint_id) ?? [];
261
- for (const w of data.writes) {
262
- list.push({
263
- checkpointId: data.checkpoint_id,
264
- taskId: data.task_id,
265
- channel: w.channel,
266
- idx: w.idx,
267
- type: w.type,
268
- value_b64: w.value_b64,
269
- version: e.entityVersion,
270
- });
271
- }
272
- writes.set(data.checkpoint_id, list);
273
- }
274
- }
275
- if (checkpoints.size === 0)
276
- return undefined;
277
- return { checkpoints, writes, latest };
278
- }
279
- function namespacesIn(events) {
280
- const set = new Set();
281
- for (const e of events) {
282
- if (e.name === EVT_PUT || e.name === EVT_PUT_WRITES) {
283
- const ns = e.data.checkpoint_ns ?? "";
284
- set.add(ns);
285
- }
286
- }
287
- return [...set];
288
- }
289
- function matchesFilter(metadata, filter) {
290
- if (!metadata)
291
- return false;
292
- const m = metadata;
293
- for (const [k, v] of Object.entries(filter)) {
294
- if (m[k] !== v)
295
- return false;
296
- }
297
- return true;
298
- }
299
- //# sourceMappingURL=saver.js.map
package/dist/saver.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"saver.js","sourceRoot":"","sources":["../src/saver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,mBAAmB,EAInB,cAAc,EAEd,cAAc,EACd,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAAE,aAAa,EAAoB,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,OAAO,GAAG,gBAAgB,CAAC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