@langchain/langgraph 0.2.21 → 0.2.22

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.
@@ -472,14 +472,23 @@ class Pregel extends runnables_1.Runnable {
472
472
  let checkpointConfig = (0, utils_js_1.patchConfigurable)(config, {
473
473
  checkpoint_ns: config.configurable?.checkpoint_ns ?? "",
474
474
  });
475
- if (saved) {
475
+ if (saved?.config.configurable) {
476
476
  checkpointConfig = (0, utils_js_1.patchConfigurable)(config, saved.config.configurable);
477
477
  }
478
478
  // Find last node that updated the state, if not provided
479
479
  if (values == null && asNode === undefined) {
480
480
  const nextConfig = await checkpointer.put(checkpointConfig, (0, base_js_1.createCheckpoint)(checkpoint, undefined, step), {
481
481
  source: "update",
482
- step,
482
+ step: step + 1,
483
+ writes: {},
484
+ parents: saved?.metadata?.parents ?? {},
485
+ }, {});
486
+ return (0, index_js_1.patchCheckpointMap)(nextConfig, saved ? saved.metadata : undefined);
487
+ }
488
+ if (values == null && asNode === "__copy__") {
489
+ const nextConfig = await checkpointer.put(saved?.parentConfig ?? checkpointConfig, (0, base_js_1.createCheckpoint)(checkpoint, undefined, step), {
490
+ source: "fork",
491
+ step: step + 1,
483
492
  writes: {},
484
493
  parents: saved?.metadata?.parents ?? {},
485
494
  }, {});
@@ -468,14 +468,23 @@ export class Pregel extends Runnable {
468
468
  let checkpointConfig = patchConfigurable(config, {
469
469
  checkpoint_ns: config.configurable?.checkpoint_ns ?? "",
470
470
  });
471
- if (saved) {
471
+ if (saved?.config.configurable) {
472
472
  checkpointConfig = patchConfigurable(config, saved.config.configurable);
473
473
  }
474
474
  // Find last node that updated the state, if not provided
475
475
  if (values == null && asNode === undefined) {
476
476
  const nextConfig = await checkpointer.put(checkpointConfig, createCheckpoint(checkpoint, undefined, step), {
477
477
  source: "update",
478
- step,
478
+ step: step + 1,
479
+ writes: {},
480
+ parents: saved?.metadata?.parents ?? {},
481
+ }, {});
482
+ return patchCheckpointMap(nextConfig, saved ? saved.metadata : undefined);
483
+ }
484
+ if (values == null && asNode === "__copy__") {
485
+ const nextConfig = await checkpointer.put(saved?.parentConfig ?? checkpointConfig, createCheckpoint(checkpoint, undefined, step), {
486
+ source: "fork",
487
+ step: step + 1,
479
488
  writes: {},
480
489
  parents: saved?.metadata?.parents ?? {},
481
490
  }, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -31,7 +31,7 @@
31
31
  "author": "LangChain",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@langchain/langgraph-checkpoint": "~0.0.10",
34
+ "@langchain/langgraph-checkpoint": "~0.0.12",
35
35
  "@langchain/langgraph-sdk": "~0.0.21",
36
36
  "uuid": "^10.0.0",
37
37
  "zod": "^3.23.8"