langgraph-checkpoint 2.0.2__tar.gz → 2.0.3__tar.gz

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.
Files changed (19) hide show
  1. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/PKG-INFO +1 -1
  2. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/memory/__init__.py +4 -0
  3. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/serde/jsonplus.py +17 -1
  4. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/serde/types.py +9 -0
  5. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/pyproject.toml +1 -1
  6. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/LICENSE +0 -0
  7. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/README.md +0 -0
  8. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/base/__init__.py +0 -0
  9. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/base/id.py +0 -0
  10. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/base/py.typed +0 -0
  11. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/memory/py.typed +0 -0
  12. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/serde/__init__.py +0 -0
  13. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/serde/base.py +0 -0
  14. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/checkpoint/serde/py.typed +0 -0
  15. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/store/base/__init__.py +0 -0
  16. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/store/base/batch.py +0 -0
  17. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/store/base/py.typed +0 -0
  18. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/store/memory/__init__.py +0 -0
  19. {langgraph_checkpoint-2.0.2 → langgraph_checkpoint-2.0.3}/langgraph/store/memory/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langgraph-checkpoint
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: Library with base interfaces for LangGraph checkpoint savers.
5
5
  Home-page: https://www.github.com/langchain-ai/langgraph
6
6
  License: MIT
@@ -364,8 +364,12 @@ class MemorySaver(
364
364
  checkpoint_ns = config["configurable"]["checkpoint_ns"]
365
365
  checkpoint_id = config["configurable"]["checkpoint_id"]
366
366
  outer_key = (thread_id, checkpoint_ns, checkpoint_id)
367
+ outer_writes_ = self.writes.get(outer_key)
367
368
  for idx, (c, v) in enumerate(writes):
368
369
  inner_key = (task_id, WRITES_IDX_MAP.get(c, idx))
370
+ if inner_key[1] >= 0 and outer_writes_ and inner_key in outer_writes_:
371
+ continue
372
+
369
373
  self.writes[outer_key][inner_key] = (task_id, c, self.serde.dumps_typed(v))
370
374
 
371
375
  async def aget_tuple(self, config: RunnableConfig) -> Optional[CheckpointTuple]:
@@ -25,7 +25,7 @@ from langchain_core.load.serializable import Serializable
25
25
  from zoneinfo import ZoneInfo
26
26
 
27
27
  from langgraph.checkpoint.serde.base import SerializerProtocol
28
- from langgraph.checkpoint.serde.types import SendProtocol
28
+ from langgraph.checkpoint.serde.types import CommandProtocol, SendProtocol
29
29
  from langgraph.store.base import Item
30
30
 
31
31
  LC_REVIVER = Reviver()
@@ -122,6 +122,11 @@ class JsonPlusSerializer(SerializerProtocol):
122
122
  return self._encode_constructor_args(
123
123
  obj.__class__, kwargs={"node": obj.node, "arg": obj.arg}
124
124
  )
125
+ elif isinstance(obj, CommandProtocol):
126
+ return self._encode_constructor_args(
127
+ obj.__class__,
128
+ kwargs={k: getattr(obj, k) for k in obj.__all_slots__},
129
+ )
125
130
  elif isinstance(obj, (bytes, bytearray)):
126
131
  return self._encode_constructor_args(
127
132
  obj.__class__, method="fromhex", args=(obj.hex(),)
@@ -402,6 +407,17 @@ def _msgpack_default(obj: Any) -> Union[str, msgpack.ExtType]:
402
407
  (obj.__class__.__module__, obj.__class__.__name__, (obj.node, obj.arg)),
403
408
  ),
404
409
  )
410
+ elif isinstance(obj, CommandProtocol):
411
+ return msgpack.ExtType(
412
+ EXT_CONSTRUCTOR_KW_ARGS,
413
+ _msgpack_enc(
414
+ (
415
+ obj.__class__.__module__,
416
+ obj.__class__.__name__,
417
+ {k: getattr(obj, k) for k in obj.__all_slots__},
418
+ ),
419
+ ),
420
+ )
405
421
  elif dataclasses.is_dataclass(obj):
406
422
  # doesn't use dataclasses.asdict to avoid deepcopy and recursion
407
423
  return msgpack.ExtType(
@@ -4,6 +4,7 @@ from typing import (
4
4
  Protocol,
5
5
  Sequence,
6
6
  TypeVar,
7
+ Union,
7
8
  runtime_checkable,
8
9
  )
9
10
 
@@ -48,3 +49,11 @@ class SendProtocol(Protocol):
48
49
  def __repr__(self) -> str: ...
49
50
 
50
51
  def __eq__(self, value: object) -> bool: ...
52
+
53
+
54
+ @runtime_checkable
55
+ class CommandProtocol(Protocol):
56
+ # Mirrors langgraph.types.Command
57
+ update: Optional[dict[str, Any]]
58
+ send: Union[Any, Sequence[Any]]
59
+ __all_slots__: set[str]
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langgraph-checkpoint"
3
- version = "2.0.2"
3
+ version = "2.0.3"
4
4
  description = "Library with base interfaces for LangGraph checkpoint savers."
5
5
  authors = []
6
6
  license = "MIT"