ó
    ýÞ jÃw  ã                  óV  • S SK Jr  S SKrS SKrS SKJrJrJrJrJ	r	  S SK
JrJrJrJrJrJr  S SKJr  S SKJr  S SKJr  S SKJrJr  S S	KJr  S S
KJr  S SKJrJ r J!r!J"r"J#r#  \" S\$\%\&5      r'\(\&\&\4   r)\RT                  " \+5      r, " S S\SS9r-\.\&\&\$-  \%-  4   r/ " S S\5      r0S)S jr1 " S S\5      r2 " S S\5      r3 " S S\\'   5      r4      S*S jr5 " S S\65      r7S+S jr8      S,S jr9      S,S jr: \S \"S!\ S"\!S#0r;1 S$kr<S%r=S-S& jr>SS'.         S.S( jjr?g)/é    )ÚannotationsN)ÚAsyncIteratorÚ
CollectionÚIteratorÚMappingÚSequence)ÚAnyÚGenericÚLiteralÚ
NamedTupleÚ	TypedDictÚTypeVar)ÚRunnableConfig)ÚNotRequired)Úuuid6)ÚSerializerProtocolÚmaybe_add_typed_methods)ÚEncryptedSerializer)ÚJsonPlusSerializer)ÚERRORÚ	INTERRUPTÚRESUMEÚ	SCHEDULEDÚChannelProtocolÚVc                  óT   • \ rS rSr% SrS\S'    S\S'    S\S'    S	\S
'    S\S'   Srg)ÚCheckpointMetadataé&   z&Metadata associated with a checkpoint.z*Literal['input', 'loop', 'update', 'fork']ÚsourceÚintÚstepzdict[str, str]ÚparentsÚstrÚrun_idzdict[str, tuple[int, int]]Úcounters_since_delta_snapshot© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__Ú__static_attributes__r&   ó    Ú\/var/www/html/gaurav/venv/lib/python3.13/site-packages/langgraph/checkpoint/base/__init__.pyr   r   &   s>   ‡ Ù0à6Ó6ðð ƒIðð Óðð ƒKØ9Ø#=Ó=òr/   r   F)Útotalc                  ól   • \ rS rSr% SrS\S'    S\S'    S\S'    S\S	'    S
\S'    S\S'    S\S'   Srg)Ú
Checkpointé\   z(State snapshot at a given point in time.r    Úvr#   ÚidÚtszdict[str, Any]Úchannel_valuesÚChannelVersionsÚchannel_versionszdict[str, ChannelVersions]Úversions_seenzlist[str] | NoneÚupdated_channelsr&   Nr'   r&   r/   r0   r3   r3   \   sS   ‡ Ù2à
ƒFØ>ØƒGð'ð 	ƒGØ=Ø"Ó"ðð &Ó%ðð
 .Ó-ðð
 'Ó&òr/   r3   c                óF  • [        U S   U S   U S   U S   R                  5       U S   R                  5       U S   R                  5        VVs0 sH  u  pXR                  5       _M     snnU R                  S/ 5      R                  5       U R                  SS 5      S	9$ s  snnf )
Nr5   r7   r6   r8   r:   r;   Úpending_sendsr<   ©r5   r7   r6   r8   r:   r;   r>   r<   )r3   ÚcopyÚitemsÚget)Ú
checkpointÚkr5   s      r0   Úcopy_checkpointrE   ~   s¢   € ÜØ
�S‰/Ø�dÑØ�dÑØ!Ð"2Ñ3×8Ñ8Ó:Ø#Ð$6Ñ7×<Ñ<Ó>Ø/9¸/Ñ/J×/PÑ/PÔ/RÔSÑ/R¡t q�qŸ&™&›(’{Ñ/RÒSØ —n‘n _°bÓ9×>Ñ>Ó@Ø#Ÿ™Ð(:¸DÓAñ	ð 	ùó Ts   ÁBc                  óT   • \ rS rSr% SrS\S'   S\S'   S\S'   S	rS
\S'   S	rS\S'   Srg	)ÚCheckpointTupleé‹   z8A tuple containing a checkpoint and its associated data.r   Úconfigr3   rC   r   ÚmetadataNúRunnableConfig | NoneÚparent_configzlist[PendingWrite] | NoneÚpending_writesr&   )	r(   r)   r*   r+   r,   r-   rL   rM   r.   r&   r/   r0   rG   rG   ‹   s-   ‡ ÙBàÓØÓØ Ó Ø+/€MÐ(Ó/Ø04€NÐ-Ö4r/   rG   c                  ó.   • \ rS rSr% SrS\S'   S\S'   Srg)	ÚDeltaChannelHistoryé•   u‘  Per-channel result entry from `BaseCheckpointSaver.get_delta_channel_history`.

!!! warning "Beta"

    Part of the `DeltaChannel` support surface; in beta. Field names and
    semantics may change.

Storage-level view of what one channel contributed across the ancestor
chain of a target checkpoint:

* `writes` â€” on-path deltas oldestâ†’newest as `PendingWrite` tuples.
  Always present; possibly empty. Already filtered to one channel.
  Writes stored at the target checkpoint itself are pending for the
  next super-step and are excluded.
* `seed` â€” the stored value at the nearest ancestor whose
  `channel_values[ch]` is populated. Omitted if the walk reached the
  root without finding any stored value (consumer treats absence as
  "start empty"). Typically a `_DeltaSnapshot` for delta channels with
  finite snapshot frequency, or a plain value for threads migrated
  from a pre-delta channel type.
zlist[PendingWrite]ÚwriteszNotRequired[Any]Úseedr&   Nr'   r&   r/   r0   rO   rO   •   s   ‡ ñð, ÓØ
Ör/   rO   c                  óJ  • \ rS rSr% Sr\" 5       rS\S'   SS.   S"S jjr\	S#S j5       r
S$S	 jrS%S
 jrSSSS.         S&S jjr          S'S jr S(         S)S jjr    S*S jr    S+S jr      S,S jrSS.     S-S jjrS$S jrS%S jrSSSS.         S.S jjr          S'S jr S(         S)S jjr    S*S jr    S+S jr      S,S jrSS.     S-S jjr      S/S jr      S/S jrS0S  jr    S1S! jr Sr!g)2ÚBaseCheckpointSaveré°   a$  Base class for creating a graph checkpointer.

Checkpointers allow LangGraph agents to persist their state
within and across multiple interactions.

When a checkpointer is configured, you should pass a `thread_id` in the config when
invoking the graph:

```python
config = {"configurable": {"thread_id": "my-thread"}}
graph.invoke(inputs, config)
```

The `thread_id` is the primary key used to store and retrieve checkpoints. Without
it, the checkpointer cannot save state, resume from interrupts, or enable
time-travel debugging.

How you choose ``thread_id`` depends on your use case:

- **Single-shot workflows**: Use a unique ID (e.g., uuid4) for each run when
    executions are independent.
- **Conversational memory**: Reuse the same `thread_id` across invocations
    to accumulate state (e.g., chat history) within a conversation.

Attributes:
    serde (SerializerProtocol): Serializer for encoding/decoding checkpoints.

Note:
    When creating a custom checkpoint saver, consider implementing async
    versions to avoid blocking the main thread.
r   ÚserdeN)rV   c               óJ   • [        U=(       d    U R                  5      U l        g )N)r   rV   )ÚselfrV   s     r0   Ú__init__ÚBaseCheckpointSaver.__init__Ó   s   € ô
 -¨U×-@°d·j±jÓAˆ�
r/   c                ó   • / $ )zrDefine the configuration options for the checkpoint saver.

Returns:
    list: List of configuration field specs.
r&   )rX   s    r0   Úconfig_specsÚ BaseCheckpointSaver.config_specsÚ   s	   € ð ˆ	r/   c                óL   • U R                  U5      =n(       a  UR                  $ g)z¼Fetch a checkpoint using the given configuration.

Args:
    config: Configuration specifying which checkpoint to retrieve.

Returns:
    The requested checkpoint, or `None` if not found.
N)Ú	get_tuplerC   ©rX   rI   Úvalues      r0   rB   ÚBaseCheckpointSaver.getã   s)   € ð —N‘N 6Ó*Ð*ˆ5Õ*Ø×#Ñ#Ð#ð +r/   c                ó   • [         e)a!  Fetch a checkpoint tuple using the given configuration.

Args:
    config: Configuration specifying which checkpoint to retrieve.

Returns:
    The requested checkpoint tuple, or `None` if not found.

Raises:
    NotImplementedError: Implement this method in your custom checkpoint saver.
©ÚNotImplementedError©rX   rI   s     r0   r_   ÚBaseCheckpointSaver.get_tupleï   s
   € ô "Ð!r/   )ÚfilterÚbeforeÚlimitc               ó   • [         e)aŸ  List checkpoints that match the given criteria.

Args:
    config: Base configuration for filtering checkpoints.
    filter: Additional filtering criteria.
    before: List checkpoints created before this configuration.
    limit: Maximum number of checkpoints to return.

Returns:
    Iterator of matching checkpoint tuples.

Raises:
    NotImplementedError: Implement this method in your custom checkpoint saver.
rd   ©rX   rI   rh   ri   rj   s        r0   ÚlistÚBaseCheckpointSaver.listý   ó
   € ô, "Ð!r/   c                ó   • [         e)a°  Store a checkpoint with its configuration and metadata.

Args:
    config: Configuration for the checkpoint.
    checkpoint: The checkpoint to store.
    metadata: Additional metadata for the checkpoint.
    new_versions: New channel versions as of this write.

Returns:
    RunnableConfig: Updated configuration after storing the checkpoint.

Raises:
    NotImplementedError: Implement this method in your custom checkpoint saver.
rd   ©rX   rI   rC   rJ   Únew_versionss        r0   ÚputÚBaseCheckpointSaver.put  s
   € ô* "Ð!r/   c                ó   • [         e)a[  Store intermediate writes linked to a checkpoint.

Args:
    config: Configuration of the related checkpoint.
    writes: List of writes to store.
    task_id: Identifier for the task creating the writes.
    task_path: Path of the task creating the writes.

Raises:
    NotImplementedError: Implement this method in your custom checkpoint saver.
rd   ©rX   rI   rQ   Útask_idÚ	task_paths        r0   Ú
put_writesÚBaseCheckpointSaver.put_writes,  s
   € ô$ "Ð!r/   c                ó   • [         e©z‘Delete all checkpoints and writes associated with a specific thread ID.

Args:
    thread_id: The thread ID whose checkpoints should be deleted.
rd   ©rX   Ú	thread_ids     r0   Údelete_threadÚ!BaseCheckpointSaver.delete_thread@  s
   € ô "Ð!r/   c                ó   • [         e)uÒ  Delete all checkpoints and writes associated with the given run IDs.

Args:
    run_ids: The run IDs whose checkpoints should be deleted.

!!! warning "DeltaChannel"

    Deleting a run that produced ancestor `checkpoint_writes` â€” or
    the only `_DeltaSnapshot` blob â€” for a still-live thread will
    break reconstruction of any `DeltaChannel` whose history
    depended on those rows. See the `DeltaChannel` note on `prune`
    for safe-recovery strategies.
rd   ©rX   Úrun_idss     r0   Údelete_for_runsÚ#BaseCheckpointSaver.delete_for_runsK  s
   € ô" "Ð!r/   c                ó   • [         e)uÓ  Copy all checkpoints and writes from one thread to another.

Args:
    source_thread_id: The thread ID to copy from.
    target_thread_id: The thread ID to copy to.

!!! warning "DeltaChannel"

    Implementations must copy the **complete** parent chain (all
    ancestor checkpoints and their `checkpoint_writes`) â€” copying
    only the head checkpoint will leave the target thread with
    `DeltaChannel` state that cannot be reconstructed (no path back
    to a `_DeltaSnapshot` ancestor). Equivalently, the copy must
    include enough ancestors that every `DeltaChannel`-backed key
    has either a `_DeltaSnapshot` in `channel_values` somewhere in
    the chain, or a complete write history back to the chain root.
rd   ©rX   Úsource_thread_idÚtarget_thread_ids      r0   Úcopy_threadÚBaseCheckpointSaver.copy_thread^  ro   r/   Úkeep_latest)Ústrategyc               ó   • [         e)ul  Prune checkpoints for the given threads.

Args:
    thread_ids: The thread IDs to prune.
    strategy: The pruning strategy. `"keep_latest"` retains only the most
        recent checkpoint per namespace. `"delete"` removes all checkpoints.

!!! warning "DeltaChannel"

    Custom implementations must be `DeltaChannel`-aware. `DeltaChannel`
    stores only a sentinel in `channel_values` for non-snapshot steps;
    reconstruction walks the parent chain via
    `get_delta_channel_history`, accumulating rows from
    `checkpoint_writes` until it reaches an ancestor whose
    `channel_values` contains a `_DeltaSnapshot` blob (written every
    `snapshot_frequency` updates).

    A naive `"keep_latest"` that drops intermediate checkpoints and
    their writes can sever that chain: the surviving "latest"
    checkpoint is rarely a snapshot point itself, so its delta
    channels would silently reconstruct as empty (no error raised â€”
    `get_delta_channel_history` simply returns no `seed`). Safe
    options when the graph uses `DeltaChannel`:

    * Walk back from each kept checkpoint and preserve every
      ancestor (plus its `checkpoint_writes`) up to the nearest one
      whose `channel_values` already contains a `_DeltaSnapshot` for
      every `DeltaChannel`-backed key.
    * Force a fresh snapshot on the kept checkpoint before deleting
      ancestors â€” rewrite `channel_values[k] = _DeltaSnapshot(value)`
      for each delta channel `k` (resolving `value` via the existing
      ancestor walk first), then prune.
    * Skip pruning threads whose graph uses `DeltaChannel` until one
      of the above is implemented.
rd   ©rX   Ú
thread_idsr�   s      r0   ÚpruneÚBaseCheckpointSaver.prunev  s   € ôR "Ð!r/   c              ƒ  óh   #   • U R                  U5      I Sh  v•N =n(       a  UR                  $ g N7f)zËAsynchronously fetch a checkpoint using the given configuration.

Args:
    config: Configuration specifying which checkpoint to retrieve.

Returns:
    The requested checkpoint, or `None` if not found.
N)Ú
aget_tuplerC   r`   s      r0   ÚagetÚBaseCheckpointSaver.aget¡  s2   é € ð Ÿ/™/¨&Ó1×1Ð1ˆ5Õ1Ø×#Ñ#Ð#ð 2Ñ1ùs   ‚2—0˜2c              ƒ  ó   #   • [         e7f)a0  Asynchronously fetch a checkpoint tuple using the given configuration.

Args:
    config: Configuration specifying which checkpoint to retrieve.

Returns:
    The requested checkpoint tuple, or `None` if not found.

Raises:
    NotImplementedError: Implement this method in your custom checkpoint saver.
rd   rf   s     r0   r”   ÚBaseCheckpointSaver.aget_tuple­  s   é € ô "Ð!ùó   ‚	c              ó   #   • [         e7f)aÁ  Asynchronously list checkpoints that match the given criteria.

Args:
    config: Base configuration for filtering checkpoints.
    filter: Additional filtering criteria for metadata.
    before: List checkpoints created before this configuration.
    limit: Maximum number of checkpoints to return.

Returns:
    Async iterator of matching checkpoint tuples.

Raises:
    NotImplementedError: Implement this method in your custom checkpoint saver.
rd   rl   s        r0   ÚalistÚBaseCheckpointSaver.alist»  s   é € ô, "Ð!ùr™   c              ƒ  ó   #   • [         e7f)a¿  Asynchronously store a checkpoint with its configuration and metadata.

Args:
    config: Configuration for the checkpoint.
    checkpoint: The checkpoint to store.
    metadata: Additional metadata for the checkpoint.
    new_versions: New channel versions as of this write.

Returns:
    RunnableConfig: Updated configuration after storing the checkpoint.

Raises:
    NotImplementedError: Implement this method in your custom checkpoint saver.
rd   rq   s        r0   ÚaputÚBaseCheckpointSaver.aputÔ  s   é € ô* "Ð!ùr™   c              ƒ  ó   #   • [         e7f)aj  Asynchronously store intermediate writes linked to a checkpoint.

Args:
    config: Configuration of the related checkpoint.
    writes: List of writes to store.
    task_id: Identifier for the task creating the writes.
    task_path: Path of the task creating the writes.

Raises:
    NotImplementedError: Implement this method in your custom checkpoint saver.
rd   rv   s        r0   Úaput_writesÚBaseCheckpointSaver.aput_writesë  ó   é € ô$ "Ð!ùr™   c              ƒ  ó   #   • [         e7fr|   rd   r}   s     r0   Úadelete_threadÚ"BaseCheckpointSaver.adelete_threadÿ  s   é € ô "Ð!ùr™   c              ƒ  ó   #   • [         e7f)u‘  Asynchronously delete all checkpoints and writes for the given run IDs.

Args:
    run_ids: The run IDs whose checkpoints should be deleted.

!!! warning "DeltaChannel"

    See `delete_for_runs` â€” deleting rows a still-live thread's
    `DeltaChannel` reconstruction depends on (writes between the
    head and its nearest `_DeltaSnapshot` ancestor) will silently
    corrupt that channel's state.
rd   r‚   s     r0   Úadelete_for_runsÚ$BaseCheckpointSaver.adelete_for_runs
  s   é € ô  "Ð!ùr™   c              ƒ  ó   #   • [         e7f)u¢  Asynchronously copy all checkpoints and writes from one thread to another.

Args:
    source_thread_id: The thread ID to copy from.
    target_thread_id: The thread ID to copy to.

!!! warning "DeltaChannel"

    See `copy_thread` â€” the copy must carry the complete parent
    chain (or at least back to a `_DeltaSnapshot` ancestor for every
    `DeltaChannel`) so the target thread can reconstruct delta
    state.
rd   r‡   s      r0   Úacopy_threadÚ BaseCheckpointSaver.acopy_thread  r£   r™   c             ƒ  ó   #   • [         e7f)a(  Asynchronously prune checkpoints for the given threads.

Args:
    thread_ids: The thread IDs to prune.
    strategy: The pruning strategy. `"keep_latest"` retains only the most
        recent checkpoint per namespace. `"delete"` removes all checkpoints.

!!! warning "DeltaChannel"

    See `prune` for the full `DeltaChannel` caveat. In short:
    `"keep_latest"` must not drop ancestor checkpoints / writes that
    sit between the kept checkpoint and the nearest `_DeltaSnapshot`
    ancestor, or delta channels will silently reconstruct as empty.
rd   r�   s      r0   ÚapruneÚBaseCheckpointSaver.aprune0  s   é € ô( "Ð!ùr™   c               ó¬  • U(       d  0 $ U Vs0 sH  o3/ _M     nn0 n[        U5      nU R                  U5      nU(       a  UR                  OSnUbË  U(       aÄ  U R                  U5      n	U	c  O¯U	R                  (       a;  [	        U	R                  5       H"  n
U
S   nX¶;   d  M  XK   R                  U
5        M$     [        U5       H<  nX¹R                  S   ;   d  M  U	R                  S   U   X['   UR                  U5        M>     U	R                  nUb	  U(       a  MÄ  0 nU H+  nS[        [	        XK   5      5      0nXµ;   a  X[   US'   XÜU'   M-     U$ s  snf )u°  Walk the parent chain returning per-channel writes + seed.

!!! warning "Beta"

    This method is part of the `DeltaChannel` support surface and is
    in beta. The signature, return shape (`DeltaChannelHistory`), and
    interaction with `_DeltaSnapshot` blobs may change. Override at
    your own risk; the default implementation will continue to work
    against the public `BaseCheckpointSaver` contract.

For each requested channel, walks ancestors of the checkpoint
identified by `config` (following `parent_config`) and accumulates
`pending_writes` for that channel. The walk terminates per-channel
at the nearest ancestor whose `channel_values[ch]` is populated;
that value is returned as `seed`. If the walk reaches the root
without finding a stored value, `seed` is omitted from that
channel's entry â€” the consumer treats the absence as "start
empty."

Walks the **parent chain** (not `list(before=...)`): for forked
threads, only on-path ancestors contribute.

The default implementation walks `get_tuple` + `parent_config`
once for all channels â€” each ancestor visited once, not once per
channel. Savers with direct storage access (`InMemorySaver`,
`PostgresSaver`) override for performance; the return contract is
fixed here.

Args:
    config: Configuration identifying the target checkpoint.
    channels: Channel names to walk for. Empty â†’ empty mapping.

Returns:
    Per-channel `DeltaChannelHistory` for every name in `channels`.
Né   r8   rQ   rR   )	Úsetr_   rL   rM   ÚreversedÚappendrm   rC   Údiscard©rX   rI   ÚchannelsÚcÚcollected_by_chÚ
seed_by_chÚ	remainingÚtarget_tupleÚcursor_configÚtupÚwriteÚchÚresultÚentrys                 r0   Úget_delta_channel_historyÚ-BaseCheckpointSaver.get_delta_channel_historyF  sX  € öL ØˆIÙIQÓ9RÉÀA¸Rº%ÉˆÐ9RØ%'ˆ
Ü! (›mˆ	Ø—~‘~ fÓ-ˆæ*6ˆL×&Ò&¸Dð 	ð Ñ'®IØ—.‘. Ó/ˆCØ‰{ØØ×!×!Ü% c×&8Ñ&8Ö9�EØ˜q™�BØ•Ø'Ñ+×2Ñ2°5Ö9ñ :ô ˜9–o�ØŸ™Ð(8Ñ9Õ9Ø%(§^¡^Ð4DÑ%EÀbÑ%I�J‘NØ×%Ñ% bÖ)ñ &ð  ×-Ñ-ˆMð Ñ'¯I¨Ið 24ˆÛˆBØ*2´D¼À/ÑBUÓ9VÓ4WÐ)XˆEØÓØ *¡��f‘Ø�2‹Jñ	 ð
 ˆùò7 :Ss   ŽEc             ƒ  óÞ  #   • U(       d  0 $ U Vs0 sH  o3/ _M     nn0 n[        U5      nU R                  U5      I Sh  v•N nU(       a  UR                  OSnUbÓ  U(       aÌ  U R                  U5      I Sh  v•N n	U	c  O¯U	R                  (       a;  [	        U	R                  5       H"  n
U
S   nX¶;   d  M  XK   R                  U
5        M$     [        U5       H<  nX¹R                  S   ;   d  M  U	R                  S   U   X['   UR                  U5        M>     U	R                  nUb	  U(       a  MÌ  0 nU H+  nS[        [	        XK   5      5      0nXµ;   a  X[   US'   XÜU'   M-     U$ s  snf  GN* Nô7f)zÂAsync version of `get_delta_channel_history`.

!!! warning "Beta"

    This method is part of the `DeltaChannel` support surface and is
    in beta. See `get_delta_channel_history` for caveats.
Nr±   r8   rQ   rR   )	r²   r”   rL   rM   r³   r´   rm   rC   rµ   r¶   s                 r0   Úaget_delta_channel_historyÚ.BaseCheckpointSaver.aget_delta_channel_history‹  sj  é € ö ØˆIÙIQÓ9RÉÀA¸Rº%ÉˆÐ9RØ%'ˆ
Ü! (›mˆ	Ø!Ÿ_™_¨VÓ4×4ˆæ*6ˆL×&Ò&¸Dð 	ð Ñ'®IØŸ™¨Ó6×6ˆCØ‰{ØØ×!×!Ü% c×&8Ñ&8Ö9�EØ˜q™�BØ•Ø'Ñ+×2Ñ2°5Ö9ñ :ô ˜9–o�ØŸ™Ð(8Ñ9Õ9Ø%(§^¡^Ð4DÑ%EÀbÑ%I�J‘NØ×%Ñ% bÖ)ñ &ð  ×-Ñ-ˆMð Ñ'¯I¨Ið 24ˆÛˆBØ*2´D¼À/ÑBUÓ9VÓ4WÐ)XˆEØÓØ *¡��f‘Ø�2‹Jñ	 ð
 ˆùò7 :Sò 5ñ
 7ùs=   ‚E-�E#›#E-¾E(¿7E-Á6E+Á79E-Â45E-Ã-?E-Ä.;E-Å+E-c                óJ   • [        U[        5      (       a  [        eUc  gUS-   $ )a«  Generate the next version ID for a channel.

Default is to use integer versions, incrementing by `1`.

If you override, you can use `str`/`int`/`float` versions, as long as they are monotonically increasing.

Args:
    current: The current version identifier (`int`, `float`, or `str`).
    channel: Deprecated argument, kept for backwards compatibility.

Returns:
    V: The next version identifier, which must be increasing.
r±   )Ú
isinstancer#   re   )rX   ÚcurrentÚchannels      r0   Úget_next_versionÚ$BaseCheckpointSaver.get_next_version´  s)   € ô �gœs×#Ñ#Ü%Ð%Ø‰_Øà˜Q‘;Ðr/   c                óž   • [        U R                  U5      nX R                  L a  U $ [        R                  " U 5      n[        U5      Ul        U$ )z8Return a shallow clone with a derived msgpack allowlist.)Ú_with_msgpack_allowlistrV   r@   r   )rX   Úextra_allowlistrV   Úclones       r0   Úwith_allowlistÚ"BaseCheckpointSaver.with_allowlistÉ  sA   € ô (¨¯
©
°OÓDˆØ—J‘JÒØˆKÜ—	’	˜$“ˆÜ-¨eÓ4ˆŒØˆr/   )rV   zSerializerProtocol | NoneÚreturnÚNone)rÔ   rm   )rI   r   rÔ   zCheckpoint | None)rI   r   rÔ   zCheckpointTuple | None)
rI   rK   rh   údict[str, Any] | Noneri   rK   rj   ú
int | NonerÔ   zIterator[CheckpointTuple])
rI   r   rC   r3   rJ   r   rr   r9   rÔ   r   )Ú )
rI   r   rQ   zSequence[tuple[str, Any]]rw   r#   rx   r#   rÔ   rÕ   )r~   r#   rÔ   rÕ   )rƒ   úSequence[str]rÔ   rÕ   )rˆ   r#   r‰   r#   rÔ   rÕ   )r�   rÙ   r�   r#   rÔ   rÕ   )
rI   rK   rh   rÖ   ri   rK   rj   r×   rÔ   zAsyncIterator[CheckpointTuple])rI   r   r·   rÙ   rÔ   z!Mapping[str, DeltaChannelHistory])rÊ   zV | NonerË   rÕ   rÔ   r   )rÐ   úCollection[tuple[str, ...]]rÔ   zBaseCheckpointSaver[V])"r(   r)   r*   r+   r,   r   rV   r-   rY   Úpropertyr\   rB   r_   rm   rs   ry   r   r„   rŠ   r‘   r•   r”   r›   rž   r¡   r¥   r¨   r«   r®   rÃ   rÆ   rÌ   rÒ   r.   r&   r/   r0   rT   rT   °   s  ‡ ññ@ !3Ó 4€EÐÓ4ð
 ,0ñBð )ðBð 
õ	Bð óó ðô
$ô"ð$ )-Ø(,Ø ñ"à%ð"ð &ð	"ð
 &ð"ð ð"ð 
#õ"ð0"àð"ð ð"ð %ð	"ð
 &ð"ð 
ô"ð8 ð"àð"ð *ð"ð ð	"ð
 ð"ð 
õ"ð(	"àð	"ð 
ô	"ð"àð"ð 
ô"ð&"àð"ð ð"ð 
ô	"ð8 &ñ	)"à!ð)"ð ð	)"ð
 
õ)"ôV
$ô"ð$ )-Ø(,Ø ñà%ðð &ð	ð
 &ðð ðð 
(õð2"àð"ð ð"ð %ð	"ð
 &ð"ð 
ô"ð8 ð"àð"ð *ð"ð ð	"ð
 ð"ð 
õ"ð(	"àð	"ð 
ô	"ð"àð"ð 
ô"ð$"àð"ð ð"ð 
ô	"ð0 &ñ	"à!ð"ð ð	"ð
 
õ"ð,CØ'ðCØ3@ðCà	*ôCðJ'Ø'ð'Ø3@ð'à	*ô'ôRð*	Ø:ð	à	÷	r/   rT   c                ój  • [        U [        5      (       a  U R                  U5      $ [        U [        5      (       aN  U R                  n[        U[        5      (       a-  UR                  U5      nX2L a  U $ [        U R
                  U5      $ [        R                  S[        U 5      R                  5        U $ )NzfSerializer %s does not support msgpack allowlist. Strict msgpack deserialization will not be enforced.)
rÉ   r   Úwith_msgpack_allowlistr   rV   ÚcipherÚloggerÚwarningÚtyper(   )rV   rÐ   ÚinnerÚupdated_inners       r0   rÏ   rÏ   Õ  s™   € ô �%Ô+×,Ñ,Ø×+Ñ+¨OÓ<Ð<Ü�%Ô,×-Ñ-Ø—‘ˆÜ�eÔ/×0Ñ0Ø!×8Ñ8¸ÓIˆMØÒ%Ø�Ü& u§|¡|°]ÓCÐCÜ
‡N�Nð	?äˆU‹×Ñôð
 €Lr/   c                  ó   • \ rS rSrSrSrg)ÚEmptyChannelErrorié  zeRaised when attempting to get the value of a channel that hasn't been updated
for the first time yet.r&   N)r(   r)   r*   r+   r,   r.   r&   r/   r0   rå   rå   é  s   † ñò 	r/   rå   c                ó*   • U S   R                  S5      $ )zGet checkpoint ID.ÚconfigurableÚcheckpoint_id)rB   )rI   s    r0   Úget_checkpoint_idré   ð  s   € à�.Ñ!×%Ñ% oÓ6Ð6r/   c           	     ó.  • UR                  5        VVs0 sH/  u  p#U[        U[        5      (       a  UR                  SS5      OU_M1     nnnU R	                  S5      U R	                  S5      4 H�  nU(       d  M  UR                  5        H}  u  pSXQ;   d   U[
        ;   d  UR                  S5      (       a  M,  [        U[        5      (       a  UR                  SS5      X'   MW  [        U[        [        [        45      (       d  My  X1U'   M     MŸ     U$ s  snnf )ú9Get checkpoint metadata in a backwards-compatible manner.Ú rØ   rJ   rç   Ú__)
rA   rÉ   r#   ÚreplacerB   ÚEXCLUDED_METADATA_KEYSÚ
startswithr    ÚboolÚfloat)rI   rJ   rD   r5   ÚobjÚkeys         r0   Úget_checkpoint_metadatarõ   õ  sì   € ð —N‘NÔ$ôá$‰DˆAð 	
¤j°´C×&8Ñ&8ˆ1�9‰9�X˜rÔ"¸aÒ?Ù$ð ñ ð —
‘
˜:Ó&¨¯
©
°>Ó(BÓCˆÞÙØ—i‘i–k‰FˆCØ‹ #Ô)?Ó"?À3Ç>Á>ÐRV×CWÑCWÙÜ˜Aœs×#Ñ#Ø !§	¡	¨(°BÓ 7�“Ü˜A¤¤T¬5Ð1×2Ó2Ø !˜“ó "ñ Dð €Oùós   ”5Dc                óJ   • [        X5      nSU;   a  UR                  S5        U$ )rë   rQ   )rõ   Úpop)rI   rJ   Úcheckpoint_metadatas      r0   Ú$get_serializable_checkpoint_metadatarù   
  s,   € ô 2°&ÓCÐØÐ&Ó&Ø×Ñ Ô)ØÐr/   éÿÿÿÿéþÿÿÿéýÿÿÿéüÿÿÿ>	   r~   rè   Úcheckpoint_nsÚcheckpoint_mapÚlanggraph_nodeÚlanggraph_pathÚlanggraph_stepÚlanggraph_triggersÚlanggraph_checkpoint_nsé   c                 ó¨   • SSK J n Jn  [        [        [	        [        SS95      U R                  UR                  5      R                  5       0 0 0 / S S9$ )Nr   ©ÚdatetimeÚtimezonerû   ©Ú	clock_seq)r5   r6   r7   r8   r:   r;   r>   r<   )	r  r	  r3   ÚLATEST_VERSIONr#   r   ÚnowÚutcÚ	isoformatr  s     r0   Úempty_checkpointr  .  sJ   € ß+äÜ
ÜŒu˜rÑ"Ó#Ø�<‰<˜Ÿ™Ó%×/Ñ/Ó1ØØØØØñ	ð 	r/   )r6   c               óŽ  • SSK J nJn  UR                  UR                  5      R	                  5       nUc  U S   nO80 nUR                  5        H"  u  p‰X€S   ;  a  M   U	R                  5       Xx'   M$     [        [        UU=(       d    [        [        US95      UU S   U S   U R                  S/ 5      SS	9$ ! [         a     Mv  f = f)
z+Create a checkpoint for the given channels.r   r  Nr8   r:   r
  r;   r>   r?   )r  r	  r  r  r  rA   rC   rå   r3   r  r#   r   rB   )
rC   r·   r!   r6   r  r	  r7   ÚvaluesrD   r5   s
             r0   Úcreate_checkpointr  =  sÌ   € ÷ ,à	�‰�h—l‘lÓ	#×	-Ñ	-Ó	/€BØÑØÐ,Ñ-‰àˆØ—N‘NÖ$‰DˆAØÐ#5Ñ6Ó6ÙðØŸL™L›N�“	ñ	 %ô Ü
ØØ×+””U TÑ*Ó+ØØ#Ð$6Ñ7Ø  Ñ1Ø —n‘n _°bÓ9Øñ	ð 	øô %ó Úðús   ÁB6Â6
CÃC)rC   r3   rÔ   r3   )rV   r   rÐ   rÚ   rÔ   r   )rI   r   rÔ   ú
str | None)rI   r   rJ   r   rÔ   r   )rÔ   r3   )
rC   r3   r·   z$Mapping[str, ChannelProtocol] | Noner!   r    r6   r  rÔ   r3   )@Ú
__future__r   r@   ÚloggingÚcollections.abcr   r   r   r   r   Útypingr	   r
   r   r   r   r   Úlangchain_core.runnablesr   Útyping_extensionsr   Úlanggraph.checkpoint.base.idr   Úlanggraph.checkpoint.serde.baser   r   Ú$langgraph.checkpoint.serde.encryptedr   Ú#langgraph.checkpoint.serde.jsonplusr   Ú langgraph.checkpoint.serde.typesr   r   r   r   r   r    rò   r#   r   ÚtupleÚPendingWriteÚ	getLoggerr(   rß   r   Údictr9   r3   rE   rG   rO   rT   rÏ   Ú	Exceptionrå   ré   rõ   rù   ÚWRITES_IDX_MAPrï   r  r  r  r&   r/   r0   Ú<module>r&     s§  ðÝ "ã Û ß RÕ R÷÷ õ 4Ý )å .ß WÝ DÝ B÷õ ñ ˆC��e˜SÓ!€Ø�S˜#˜s�]Ñ#€ð 
×	Ò	˜8Ó	$€ô0˜¨%ò 0ðf �s˜C #™I¨Ñ-Ð-Ñ.€ô�ô ôD
ô5�jô 5ô˜)ô ô6b˜' !™*ô bðJØðØ0Kðàôô(	˜	ô 	ô7ð
ØðØ&8ðàôð*ØðØ&8ðàôðð ˜˜Y¨¨I°r¸6À2ÐF€ò
Ð ð €ôð( ñØðà2ðð ðð
 	ðð ör/   