@langchain/langgraph 0.1.4-rc.1 → 0.1.4

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.
@@ -86,7 +86,7 @@ getNextVersion) {
86
86
  // Find the highest version of all channels
87
87
  let maxVersion;
88
88
  if (Object.keys(checkpoint.channel_versions).length > 0) {
89
- maxVersion = Math.max(...Object.values(checkpoint.channel_versions));
89
+ maxVersion = (0, langgraph_checkpoint_1.maxChannelVersion)(...Object.values(checkpoint.channel_versions));
90
90
  }
91
91
  // Consume all channels that were read
92
92
  const channelsToConsume = new Set(tasks
@@ -126,7 +126,7 @@ getNextVersion) {
126
126
  // find the highest version of all channels
127
127
  maxVersion = undefined;
128
128
  if (Object.keys(checkpoint.channel_versions).length > 0) {
129
- maxVersion = Math.max(...Object.values(checkpoint.channel_versions));
129
+ maxVersion = (0, langgraph_checkpoint_1.maxChannelVersion)(...Object.values(checkpoint.channel_versions));
130
130
  }
131
131
  const updatedChannels = new Set();
132
132
  // Apply writes to channels
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-param-reassign */
2
2
  import { mergeConfigs, patchConfig, } from "@langchain/core/runnables";
3
- import { copyCheckpoint, uuid5, } from "@langchain/langgraph-checkpoint";
3
+ import { copyCheckpoint, uuid5, maxChannelVersion, } from "@langchain/langgraph-checkpoint";
4
4
  import { createCheckpoint, emptyChannels, } from "../channels/base.js";
5
5
  import { readChannel, readChannels } from "./io.js";
6
6
  import { _isSend, _isSendInterface, CHECKPOINT_NAMESPACE_SEPARATOR, CONFIG_KEY_CHECKPOINTER, CONFIG_KEY_READ, CONFIG_KEY_RESUMING, CONFIG_KEY_SEND, INTERRUPT, RESERVED, TAG_HIDDEN, TASKS, } from "../constants.js";
@@ -79,7 +79,7 @@ getNextVersion) {
79
79
  // Find the highest version of all channels
80
80
  let maxVersion;
81
81
  if (Object.keys(checkpoint.channel_versions).length > 0) {
82
- maxVersion = Math.max(...Object.values(checkpoint.channel_versions));
82
+ maxVersion = maxChannelVersion(...Object.values(checkpoint.channel_versions));
83
83
  }
84
84
  // Consume all channels that were read
85
85
  const channelsToConsume = new Set(tasks
@@ -119,7 +119,7 @@ getNextVersion) {
119
119
  // find the highest version of all channels
120
120
  maxVersion = undefined;
121
121
  if (Object.keys(checkpoint.channel_versions).length > 0) {
122
- maxVersion = Math.max(...Object.values(checkpoint.channel_versions));
122
+ maxVersion = maxChannelVersion(...Object.values(checkpoint.channel_versions));
123
123
  }
124
124
  const updatedChannels = new Set();
125
125
  // Apply writes to channels
@@ -315,9 +315,7 @@ class Pregel extends runnables_1.Runnable {
315
315
  });
316
316
  })
317
317
  .flat()
318
- .sort(([aNumber], [bNumber]) => {
319
- return aNumber - bNumber;
320
- });
318
+ .sort(([aNumber], [bNumber]) => (0, langgraph_checkpoint_1.compareChannelVersions)(aNumber, bNumber));
321
319
  // if two nodes updated the state at the same time, it's ambiguous
322
320
  if (lastSeenByNode) {
323
321
  if (lastSeenByNode.length === 1) {
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-param-reassign */
2
2
  import { Runnable, RunnableSequence, _coerceToRunnable, ensureConfig, getCallbackManagerForConfig, patchConfig, } from "@langchain/core/runnables";
3
- import { copyCheckpoint, emptyCheckpoint, uuid5, } from "@langchain/langgraph-checkpoint";
3
+ import { compareChannelVersions, copyCheckpoint, emptyCheckpoint, uuid5, } from "@langchain/langgraph-checkpoint";
4
4
  import { createCheckpoint, emptyChannels, } from "../channels/base.js";
5
5
  import { PregelNode } from "./read.js";
6
6
  import { validateGraph, validateKeys } from "./validate.js";
@@ -311,9 +311,7 @@ export class Pregel extends Runnable {
311
311
  });
312
312
  })
313
313
  .flat()
314
- .sort(([aNumber], [bNumber]) => {
315
- return aNumber - bNumber;
316
- });
314
+ .sort(([aNumber], [bNumber]) => compareChannelVersions(aNumber, bNumber));
317
315
  // if two nodes updated the state at the same time, it's ambiguous
318
316
  if (lastSeenByNode) {
319
317
  if (lastSeenByNode.length === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.1.4-rc.1",
3
+ "version": "0.1.4",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -32,7 +32,7 @@
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
34
  "@langchain/core": ">=0.2.20 <0.3.0",
35
- "@langchain/langgraph-checkpoint": "~0.0.3",
35
+ "@langchain/langgraph-checkpoint": "~0.0.4",
36
36
  "@langchain/langgraph-checkpoint-sqlite": "~0.0.1",
37
37
  "double-ended-queue": "^2.1.0-0",
38
38
  "uuid": "^10.0.0",