@ironflow/langgraph 0.20.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/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @ironflow/langgraph
2
+
3
+ Durable [LangGraph](https://github.com/langchain-ai/langgraphjs) checkpoint saver
4
+ backed by Ironflow entity streams. Drop-in replacement for `MemorySaver` /
5
+ `SqliteSaver` / `PostgresSaver` — your agent state survives crashes and resumes
6
+ from the last checkpoint with no extra wiring.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @ironflow/langgraph @ironflow/node @langchain/langgraph @langchain/langgraph-checkpoint
12
+ ```
13
+
14
+ ## Quick start
15
+
16
+ ```ts
17
+ import { IronflowClient } from "@ironflow/node";
18
+ import { IronflowSaver } from "@ironflow/langgraph";
19
+ import { StateGraph, START, END, Annotation } from "@langchain/langgraph";
20
+
21
+ const client = new IronflowClient({ serverUrl: process.env.IRONFLOW_URL! });
22
+ const saver = new IronflowSaver({ client });
23
+
24
+ const State = Annotation.Root({
25
+ counter: Annotation<number>({ reducer: (_a, b) => b, default: () => 0 }),
26
+ });
27
+
28
+ const graph = new StateGraph(State)
29
+ .addNode("step", (s) => ({ counter: s.counter + 1 }))
30
+ .addEdge(START, "step")
31
+ .addConditionalEdges("step", (s) => (s.counter >= 5 ? END : "step"))
32
+ .compile({ checkpointer: saver });
33
+
34
+ await graph.invoke(
35
+ { counter: 0 },
36
+ { configurable: { thread_id: "thread-1" } }
37
+ );
38
+ ```
39
+
40
+ If the process crashes mid-cycle, restarting with the same `thread_id` resumes
41
+ from the last persisted checkpoint.
42
+
43
+ ## Storage model
44
+
45
+ - One entity stream per thread: `irn:agent-ckpt:{thread_id}`, entity type `agent-ckpt`.
46
+ - Three event names:
47
+ - `checkpoint.put` — full checkpoint snapshot
48
+ - `checkpoint.putWrites` — pending writes for a task before the next checkpoint
49
+ - `checkpoint.deleteThread` — tombstone; reads ignore events at-or-before its position
50
+ - `put` events use idempotency key `lg:put:{thread}:{ns}:{checkpoint_id}` — re-puts
51
+ on retry are no-ops at the server.
52
+ - `putWrites` events have no idempotency key. Replays append fresh events; reads
53
+ dedupe by `(taskId, idx)`. This matches MemorySaver's cross-call accumulation.
54
+
55
+ ## Limitations
56
+
57
+ - **Node-only.** The serializer uses `Buffer` for base64 encoding. Browser / edge
58
+ runtimes need a different saver.
59
+ - **`list()` requires `thread_id`.** Calling `saver.list({})` without a
60
+ `thread_id` in `configurable` throws `LG_THREAD_ID_REQUIRED`. Ironflow has no
61
+ global thread index in v1, so cross-thread iteration is not supported. Pass
62
+ `configurable: { thread_id }` explicitly. (Tracked for a future projection-backed
63
+ index.)
64
+ - **Full-stream materialization.** Reads currently load the entire thread's
65
+ event stream and reduce in memory. Fine for typical thread sizes (<100
66
+ checkpoints); a managed projection can replace this if profiling shows it's
67
+ worth it.
68
+
69
+ ## Tests
70
+
71
+ ```bash
72
+ # Unit tests
73
+ pnpm -C sdk/js/langgraph test
74
+
75
+ # Integration tests (against a running server)
76
+ ./build/ironflow serve --dev
77
+ IRONFLOW_INTEGRATION=1 pnpm -C sdk/js/langgraph test
78
+ ```
79
+
80
+ ## License
81
+
82
+ MIT.
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,12 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,23 @@
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
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,22 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,47 @@
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
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,299 @@
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
@@ -0,0 +1 @@
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;AACjC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAC7C,MAAM,UAAU,GAAG,GAAG,CAAC;AAkCvB,MAAM,OAAO,aAAc,SAAQ,mBAAmB;IACnC,MAAM,CAAiB;IAExC,YAAY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CAAC;IACD,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,aAAa,CACpB,QAAwC,EACxC,MAA+B;IAE/B,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,MAAM,CAAC,GAAG,QAA8C,CAAC;IACzD,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IAC/B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@ironflow/langgraph",
3
+ "version": "0.20.0",
4
+ "description": "LangGraph checkpoint saver backed by Ironflow entity streams — durable agent state with crash-resume",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "sideEffects": false,
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "dependencies": {
21
+ "@ironflow/node": "^0.20.0",
22
+ "@ironflow/core": "^0.20.0"
23
+ },
24
+ "peerDependencies": {
25
+ "@langchain/core": "^1.0.0",
26
+ "@langchain/langgraph-checkpoint": "^1.0.0"
27
+ },
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",
33
+ "typescript": "^5.9.3",
34
+ "vitest": "^2.1.9"
35
+ },
36
+ "engines": {
37
+ "node": ">=20.0.0"
38
+ },
39
+ "keywords": [
40
+ "ironflow",
41
+ "langgraph",
42
+ "checkpoint",
43
+ "saver",
44
+ "durable",
45
+ "agent"
46
+ ],
47
+ "author": "Ironflow",
48
+ "license": "MIT",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/ironflowapp/ironflow.git",
52
+ "directory": "sdk/js/langgraph"
53
+ },
54
+ "publishConfig": {
55
+ "access": "restricted"
56
+ },
57
+ "scripts": {
58
+ "build": "tsc --build tsconfig.build.json",
59
+ "dev": "tsc --build tsconfig.build.json --watch",
60
+ "test": "pnpm typecheck && vitest run",
61
+ "test:watch": "vitest",
62
+ "lint": "eslint src/",
63
+ "clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
64
+ "typecheck": "tsc -p tsconfig.json --noEmit"
65
+ }
66
+ }