@langchain/langgraph 0.2.44 → 0.2.45

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 CHANGED
@@ -21,7 +21,7 @@ LangGraph is inspired by [Pregel](https://research.google/pubs/pub37252/) and [A
21
21
 
22
22
  ### Why use LangGraph?
23
23
 
24
- LangGraph powers production-grade agents, trusted by Linkedin, Uber, Klarna, GitLab, and many more. LangGraph provides fine-grained control over both the flow and state of your agent applications. It implements a central [persistence layer](https://langchain-ai.github.io/langgraphjs/concepts/persistence/), enabling features that are common to most agent architectures:
24
+ LangGraph powers [production-grade agents](https://www.langchain.com/built-with-langgraph), trusted by Linkedin, Uber, Klarna, GitLab, and many more. LangGraph provides fine-grained control over both the flow and state of your agent applications. It implements a central [persistence layer](https://langchain-ai.github.io/langgraphjs/concepts/persistence/), enabling features that are common to most agent architectures:
25
25
 
26
26
  - **Memory**: LangGraph persists arbitrary aspects of your application's state,
27
27
  supporting memory of conversations and other updates within and across user
@@ -358,6 +358,10 @@ Then we define one normal and one conditional edge. Conditional edge means that
358
358
  * [API Reference](https://langchain-ai.github.io/langgraphjs/reference/): Review important classes and methods, simple examples of how to use the graph and checkpointing APIs, higher-level prebuilt components and more.
359
359
  * [LangGraph Platform](https://langchain-ai.github.io/langgraphjs/concepts/#langgraph-platform): LangGraph Platform is a commercial solution for deploying agentic applications in production, built on the open-source LangGraph framework.
360
360
 
361
+ ## Resources
362
+
363
+ * [Built with LangGraph](https://www.langchain.com/built-with-langgraph): Hear how industry leaders use LangGraph to ship powerful, production-ready AI applications.
364
+
361
365
  ## Contributing
362
366
 
363
367
  For more information on how to contribute, see [here](https://github.com/langchain-ai/langgraphjs/blob/main/CONTRIBUTING.md).
@@ -29,16 +29,17 @@ function messagesStateReducer(left, right) {
29
29
  }
30
30
  }
31
31
  // merge
32
- const leftIdxById = new Map(leftMessages.map((m, i) => [m.id, i]));
33
32
  const merged = [...leftMessages];
33
+ const mergedById = new Map(merged.map((m, i) => [m.id, i]));
34
34
  const idsToRemove = new Set();
35
35
  for (const m of rightMessages) {
36
- const existingIdx = leftIdxById.get(m.id);
36
+ const existingIdx = mergedById.get(m.id);
37
37
  if (existingIdx !== undefined) {
38
38
  if (m._getType() === "remove") {
39
39
  idsToRemove.add(m.id);
40
40
  }
41
41
  else {
42
+ idsToRemove.delete(m.id);
42
43
  merged[existingIdx] = m;
43
44
  }
44
45
  }
@@ -46,6 +47,7 @@ function messagesStateReducer(left, right) {
46
47
  if (m._getType() === "remove") {
47
48
  throw new Error(`Attempting to delete a message with an ID that doesn't exist ('${m.id}')`);
48
49
  }
50
+ mergedById.set(m.id, merged.length);
49
51
  merged.push(m);
50
52
  }
51
53
  }
@@ -26,16 +26,17 @@ export function messagesStateReducer(left, right) {
26
26
  }
27
27
  }
28
28
  // merge
29
- const leftIdxById = new Map(leftMessages.map((m, i) => [m.id, i]));
30
29
  const merged = [...leftMessages];
30
+ const mergedById = new Map(merged.map((m, i) => [m.id, i]));
31
31
  const idsToRemove = new Set();
32
32
  for (const m of rightMessages) {
33
- const existingIdx = leftIdxById.get(m.id);
33
+ const existingIdx = mergedById.get(m.id);
34
34
  if (existingIdx !== undefined) {
35
35
  if (m._getType() === "remove") {
36
36
  idsToRemove.add(m.id);
37
37
  }
38
38
  else {
39
+ idsToRemove.delete(m.id);
39
40
  merged[existingIdx] = m;
40
41
  }
41
42
  }
@@ -43,6 +44,7 @@ export function messagesStateReducer(left, right) {
43
44
  if (m._getType() === "remove") {
44
45
  throw new Error(`Attempting to delete a message with an ID that doesn't exist ('${m.id}')`);
45
46
  }
47
+ mergedById.set(m.id, merged.length);
46
48
  merged.push(m);
47
49
  }
48
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {