
    (GgJ              $          d dl Z d dlZd dlZd dlZd dlmZmZ d dlmZ d dl	m
Z
 d dlmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZmZ d dlmZ d d	l m!Z! d d
l"m#Z# d dl$m%Z%m&Z&m'Z'm(Z(m)Z) d dl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZE d dlFmGZGmHZH d dlImJZJ d dlKmLZL d dlMmNZNmOZO d dlPmQZQ d dlRmSZS d dlTmUZU d dlVmWZWmXZXmYZYmZZZm[Z[ d dl\m]Z]m^Z^ eee)   e#ge)f   Z_ej                  dk\  Za G d de      Zb G d de      Zc G d d      Zdde'deeWeee   f   deeX   d efeX   fd!Zg	 d\d#eeee#f   d$eJd%ebd&eefee   eef   d'ehd eeieeef   ef   fd(Zjd)eeekeeef      gdf   d*eee   d+eekeeef      d dfd,Zld-eem   d.e#d emfd/Znde'd#eeee#f   deeb   d0ee_   d ekeieeefe   f   eoee   f   f
d1Zpd2eeeeee   f   d3eoee   de'd ehfd4Zqedddddd5de'd6efe(   d7eeeeSf   d#eeee#f   d$eJd8ed9emd:ed"   d;ed   d<ed   d=ed   d2eeeeeee   f      d3eeoee      d eieeeZf   fd>       Zreddd?de'd6efe(   d7eeeeSf   d#eeee#f   d$eJd8ed9emd:ed@   d;eeU   d<ee%   d=edeef   d2eeeeeee   f      d3eeoee      d eieeeXf   fdA       Zrdddddd5de'd6efe(   d7eeeeSf   d#eeee#f   d$eJd8ed9emd:ehd;eeU   d<ee%   d=edeef   d2eeeeeee   f      d3eeoee      d eeieeeZf   eieeeXf   f   fdBZre?fZsddddCdDekedEf   dFeee   de'dGetdHee)   d6efe(   d7eeeeSf   d#eeee#f   d$eJd8ed9emd:ehd;eeU   d<ee%   d=edeef   d edeZeXf   f dIZude'd ee)   fdJZvd#eeee#f   dKe&dLee&   dMe)dNeSd eee   fdOZwdPeeY   d6efe(   dQeed eYfdRZxdNeSd$eJd#eeee#f   d:ehd ee   f
dSZydTetdUeed eefdVZzdTetdUeed eefdWZ{dXeeeemekf   d eefdYZ| ej                         Z~ G dZ d[      Zy)]    N)defaultdictdeque)partial)sha1)AnyCallableIterableIteratorLiteralMapping
NamedTupleOptionalProtocolSequenceUnioncastoverload)	Callbacks)AsyncParentRunManagerParentRunManager)RunnableConfig)xxh3_128_hexdigest)BaseChannel)BaseCheckpointSaverChannelVersions
CheckpointPendingWriteV)CONFCONFIG_KEY_CHECKPOINT_IDCONFIG_KEY_CHECKPOINT_MAPCONFIG_KEY_CHECKPOINT_NSCONFIG_KEY_CHECKPOINTERCONFIG_KEY_PREVIOUSCONFIG_KEY_READCONFIG_KEY_SCRATCHPADCONFIG_KEY_SENDCONFIG_KEY_STORECONFIG_KEY_TASK_ID	EMPTY_SEQERROR	INTERRUPT	NO_WRITESNS_ENDNS_SEPNULL_TASK_IDPREVIOUSPULLPUSHRESERVEDRESUMERETURN
TAG_HIDDENTASKSSend)EmptyChannelErrorInvalidUpdateError)ManagedValueMapping)get_runnable_for_task)read_channelread_channels)logger)
PregelNode)	BaseStore)AllPregelExecutableTaskPregelScratchpad
PregelTaskRetryPolicy)merge_configspatch_config)      c                       e Zd ZdZedeeeeef   df   fd       Z	edefd       Z
edeeeef      fd       Zedee   fd       Zy)	WritesProtocolzProtocol for objects containing writes to be applied to checkpoint.
    Implemented by PregelTaskWrites and PregelExecutableTask.return.c                      y N selfs    r/home/kushmeetdev/apache_webroot/langgraph_flaskproject/venv/lib/python3.12/site-packages/langgraph/pregel/algo.pypathzWritesProtocol.pathZ   s    :=    c                      y rP   rQ   rR   s    rT   namezWritesProtocol.name]   s    rV   c                      y rP   rQ   rR   s    rT   writeszWritesProtocol.writes`   s    36rV   c                      y rP   rQ   rR   s    rT   triggerszWritesProtocol.triggersc   s    ),rV   N)__name__
__module____qualname____doc__propertytupler   strintrU   rX   r   r   rZ   r\   rQ   rV   rT   rM   rM   V   s|    A =eE#sE/2C78= =c 6sCx16 6,(3-, ,rV   rM   c                   f    e Zd ZU dZeeeeef   df   ed<   eed<   e	eee
f      ed<   e	e   ed<   y)PregelTaskWriteszSimplest implementation of WritesProtocol, for usage with writes that
    don't originate from a runnable task, eg. graph input, update_state, etc..rU   rX   rZ   r\   N)r]   r^   r_   r`   rb   r   rc   rd   __annotations__r   r   rQ   rV   rT   rf   rf   g   sG    Q c3o&+
,,
IU38_%%smrV   rf   c            
       b    e Zd ZU dZeed<   eed<   ee   ed<   e	ed<   dededee   de	ddf
dZ
y)	Callfuncinputretry	callbacksrk   rl   rm   rn   rN   Nc                <    || _         || _        || _        || _        y rP   rj   )rS   rk   rl   rm   rn   s        rT   __init__zCall.__init__y   s      	

"rV   )r]   r^   r_   	__slots__r   rg   r   r   rG   r   rp   rQ   rV   rT   ri   ri   q   s\    7I
NJK  ## #
 $# # 
#rV   ri   
checkpointinterrupt_nodestasksrN   c                    t        t        t        | d   j                               d            } |       | d   j	                  t
        i       t        fd| d   j                         D              }|rV|D cg c]J  }|dk(  r3|j                  r5t        |j                  j	                  dt              vrn|j                  |v r|L c}S g S c c}w )z@Check if the graph should be interrupted based on current state.channel_versionsNversions_seenc              3   N   K   | ]  \  }}|j                  |      kD    y wrP   )get).0chanversionnull_versionseens      rT   	<genexpr>z#should_interrupt.<locals>.<genexpr>   s-      +D' 	$((4..+s   "%*tags)typenextitervaluesry   r,   anyitemsconfigr7   r*   rX   )rr   rs   rt   version_type any_updates_since_prev_interrupttaskr}   r~   s         @@rT   should_interruptr      s     T*-?"@"G"G"IJDQRL>Lo&**9b9D'* +'(:;AAC+ ($$ , 	
 #c) !)KK YY/1 	
 	
s   >ACFchannelsmanagedr   selectfreshc           	      z   t        t              }t        |t              r1g }|j                  D ]  \  }}||k(  s||   j                  |       ! nU|D 	cg c]	  }	|	|v s|	 }}	|D 	cg c]	  }	|	|vs|	 }}	|j                  D ]  \  }}||v s||   j                  |         |rN|rLi }
| D ]8  }	|	|v r(| |	   j                         }|j                  ||	          n| |	   }||
|	<   : t        |
|      }nt        | |      }|r(|j                  |D 	ci c]  }	|	 ||	           c}	       |S c c}	w c c}	w c c}	w )zFunction injected under CONFIG_KEY_READ in task config, to read current state.
    Used by conditional edges to read a copy of the state with reflecting the writes
    from that node only.)	r   list
isinstancerc   rZ   appendcopyupdater?   )r   r   r   r   r   updatedmanaged_keyscvklocal_channelsccr   s                rT   
local_readr      s[    %0$5G&#KK 	%DAqF{
!!!$	% $*:aQ'\::#8q'7!88KK 	%DAqF{
!!!$	% 13 	#AG|a[%%'		'!*%a[ "N1	# ~v6x0=1q*'!*,=>M+ ;8& >s   	D.D.)	D33D3D8commitprocess_keysrZ   c                     |D ]\  \  }}|t         t        fv s|t        |t              st	        d|       |j
                  |vsEt	        d|j
                   d        | |       y)zFunction injected under CONFIG_KEY_SEND in task config, to write to channels.
    Validates writes and forwards them to `commit` function.NzExpected Send, got zInvalid node name z
 in packet)r3   r8   r   r9   r;   node)r   r   rZ   r{   values        rT   local_writer      su      VeD%= U%6eT*(+>ug)FGGzz-(+=ejj\)TUUV 6NrV   currentchannelc                     | | dz   S dS )zHDefault channel versioning function, increments the current int version.   rQ   )r   r   s     rT   	incrementr      s    !-7Q;414rV   get_next_versionc           	      B   t        |d       }t        d |D              }|D ]V  }| d   j                  |j                  i       j	                  |j
                  D ci c]  }|| d   v r	|| d   |    c}       X | d   rt        | d   j                               }nd}|D ch c]!  }|j
                  D ]  }|t        vr||v r| # c}}D ]+  }||   j                         s| ||||         | d   |<   - | d   r|r| d   j                          t        t              }t        t              }	|D ]  }|j                  D ]s  \  }}
|t        t        t         t"        t$        t&        fv r)|t(        k(  r| d   j+                  |
       G||v r||   j+                  |
       `|	|   j+                  |
       u  | d   rt        | d   j                               }nd}t-               }|j/                         D ]C  \  }}||v s||   j	                  |      r| ||||         | d   |<   |j1                  |       E |rN|D ]I  }||   j3                         s||vs||   j	                  t4              s5|8 ||||         | d   |<   K |	|fS c c}w c c}}w )a6  Apply writes from a set of tasks (usually the tasks from a Pregel step)
    to the checkpoint and channels, and return managed values writes to be applied
    externally.

    Args:
        checkpoint: The checkpoint to update.
        channels: The channels to update.
        tasks: The tasks to apply writes from.
        get_next_version: Optional function to determine the next version of a channel.

    Returns:
        A tuple containing the managed values writes to be applied externally, and
        the set of channels that were updated in this step.
    c                 2    t        | j                  d d       S )NrJ   )task_path_strrU   )ts    rT   <lambda>zapply_writes.<locals>.<lambda>   s    affRaj(A rV   )keyc              3   4   K   | ]  }|j                     y wrP   )r\   )rz   r   s     rT   r   zapply_writes.<locals>.<genexpr>   s     .1AJJ.s   rw   rv   Npending_sends)sortedr   
setdefaultrX   r   r\   maxr   r4   consumeclearr   r   rZ   r-   r3   r5   r,   r6   r+   r8   r   setr   addis_availabler*   )rr   r   rt   r   	bump_stepr   r{   max_versionpending_writes_by_channelpending_writes_by_managedvalupdated_channelsvalss                rT   apply_writesr      s   . 5ABE ...I  
?#..tyy"=DD !MM:&899 j!34T::	

 $%*%78??AB
 MM xDH$4 	 
 D>!!#(8(D3C4J)*40
 /"y?#))+ 7B$6G6A$6G 	< 	<ID#	4FEJJ?+2237!)$/66s;)$/66s;	<	< $%*%78??AB "%/557 '
d8~$$T*/?/K7GTN8
-.t4   &'  	D~**,=M1MD>((38H8T;K# <J1248	 %&666Os   J
%&Jtrigger_to_nodesr   c                 F    t        |d         xs |j                  |        S )zACheck if there are any tasks that should be run in the next step.r   )bool
isdisjoint)r   r   rr   s      rT   has_next_tasksr   O  s1     
?+, 4D4O4O5 1 rV   )storecheckpointermanagerr   r   pending_writes	processesr   stepfor_executionr   r   r   c                     y rP   rQ   rr   r   r   r   r   r   r   r   r   r   r   r   r   s                rT   prepare_next_tasksr   Z  s       rV   )r   r   Tc                     y rP   rQ   r   s                rT   r   r   m  s      '*rV   c                r   t        j                  | d   j                  dd            }t        |       }g }t	        | d         D ]9  \  }}t        t        |fd| |||||||||||	|
      x}s)|j                  |       ; |rD|rBt               }|D ]'  }|j                  |      x}s|j                  |       ) t        |      }n| d   sd}n|j                         }|D ]6  }t        t        |fd| |||||||||||	|
      x}s&|j                  |       8 |D ci c]  }|j                  | c}S c c}w )	aw  Prepare the set of tasks that will make up the next Pregel step.

    Args:
        checkpoint: The current checkpoint.
        pending_writes: The list of pending writes.
        processes: The mapping of process names to PregelNode instances.
        channels: The mapping of channel names to BaseChannel instances.
        managed: The mapping of managed value names to functions.
        config: The runnable configuration.
        step: The current step.
        for_execution: Whether the tasks are being prepared for execution.
        store: An instance of BaseStore to make it available for usage within tasks.
        checkpointer: Checkpointer instance used for saving checkpoints.
        manager: The parent run manager to use for the tasks.
        trigger_to_nodes: Optional: Mapping of channel names to the set of nodes
            that are can be triggered by that channel.
        updated_channels: Optional. Set of channel names that have been updated during
            the previous step. Using in conjunction with trigger_to_nodes to speed
            up the process of determining which nodes should be triggered in the next
            step.

    Returns:
        A dictionary of tasks to be executed. The keys are the task ids and the values
        are the tasks themselves. This is the union of all PUSH tasks (Sends)
        and PULL tasks (nodes triggered by edges).
    id- r   N)rr   checkpoint_id_bytescheckpoint_null_versionr   r   r   r   r   r   r   r   r   r   rv   rQ   )binascii	unhexlifyreplacer   	enumerateprepare_single_taskr3   r   r   ry   r   r   keysr2   r   )rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r}   rt   idx_r   triggered_nodesr   node_idscandidate_nodesrX   r   s                            rT   r   r     s   T #,,Z-=-E-Ec2-NO*:6L;=EJ78 Q&3K! 3$0)'%
 
4 
" LL%6 ,$'E' 	1G+//88x8&&x0	1 *0)@*+#..*   &4L! 3$0)'%
 
4 
" LL%& ##ADD!G###s   D4)r   r   r   	task_path.task_id_checksumr   r   c          "         |	j                  t        i       }|j                  t        d      }|d   dkD  rt        nt        }| d   t
        k(  rRt        | d   t              r>t        t        t        t        t        t        t        f   |       }|d   }t        |j                        }|j                  }|t        d      t         }|r| t"         | n|} |||t        |
      |t
        t%        | d         t        | d               }| d	| }|
||| dd
 |d}|||k(  sJ | d|        |r^t'               }t)        ||j*                  ||t-        t/        |	d|i      ||j0                  xs |r|j3                  d|
       ndt4        |t6        t9        t:        |j<                  |j?                               t@        t9        tB        ||tE        | dd
 |||            tF        |xs |j                  tF              tH        |xs |j                  tH              tJ        i |j                  tJ        i       ||d   itL        dt        |tN        tQ        |	t           j                  tN              ||      i	      ||jR                  d|| dd
 
      S tU        ||| dd
       S | d   t
        k(  rPtW        |       dk(  rt        t        | d         }|tW        |d         k\  ry|d   |   }t        |tX              s#t[        j\                  dt_        |       d       y|j`                  |vr$t[        j\                  d|j`                   d       yt         }|r| t"         |j`                   n|j`                  } |||t        |
      |j`                  t
        t        |            }nt[        j\                  d|         y| d	| }|
|j`                  || dd
 |d}|||k(  sJ | d|        |r||j`                     }|j`                  x}r|jb                  r|je                  |jb                         t'               }t)        |j`                  |jf                  ||t-        t/        |	||jh                  d      |j`                  |r|j3                  d|
       ndt4        |t6        t9        t:        |j<                  |j?                               t@        t9        tB        ||tE        | dd
 |j`                  ||            tF        |xs |j                  tF              tH        |xs |j                  tH              tJ        i |j                  tJ        i       ||d   itL        dt        |tN        tQ        |	t           j                  tN              ||      tj        |d   j                  tl        d      i
      ||jn                  d|| dd
 |jp                  |jr                        S tU        ||j`                  | dd
       S y| d   tt        k(  rt        t        | d         }||vry||   }|ytw        ||d   |d   j                  |      ||      rct        ty        |jz                              }	 t}        t        ||||            } |r| t"         | n|} |||t        |
      |tt        g| }| t         | }|
||| dd
 |d}|||k(  sJ | d|        |r|j`                  x}r|jb                  r|je                  |jb                         t'               }t)        || ||t-        t/        |	||jh                  d      ||r|j3                  d|
       ndt4        |t6        t9        t:        |j<                  t        |j?                                     t@        t9        tB        ||tE        | dd
 |||            tF        |xs |j                  tF              tH        |xs |j                  tH              tJ        i |j                  tJ        i       ||d   itL        dt        |tN        tQ        |	t           j                  tN              ||      tj        |d   j                  tl        d      i
      ||jn                  d|| dd
 |jp                  |jr                        S ytU        ||| dd
       S yy# t        $ r Y yt        $ r'}!t        r|!j                  d| d| dd
  d        d}!~!ww xY w)zPrepares a single task for the next Pregel step, given a task path, which
    uniquely identifies a PUSH or PULL task within the graph.r   r   r   r   Nz1`call` functions must have a `__name__` attribute   :rJ   )langgraph_steplanggraph_nodelanggraph_triggerslanggraph_pathlanggraph_checkpoint_nsz != metadatazgraph:step:r   )run_namern   configurabler   zIgnoring invalid packet type z in pending sendszIgnoring unknown node name z Ignoring invalid PUSH task path )r   r   channel_values)writers	subgraphsrv   rw   )r   zBefore task with name 'z' and path '')Ery   r   r"   _xxhash_str
_uuid5_strr3   r   ri   r   rb   rc   rd   r=   rk   rX   
ValueErrorPUSH_TRIGGERr/   r   r   rD   rl   rI   rH   rn   	get_childr)   r'   r   r   extendr   r%   r   rf   r(   r#   r!   r    r&   _scratchpadrm   rF   lenr9   r@   warningr   r   r   r   argr   r$   r1   retry_policyflat_writersr   r2   	_triggersr   r\   r   _proc_inputStopIteration	ExceptionSUPPORTS_EXC_NOTESadd_noter.   )"r   r   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   	parent_nstask_id_functask_path_tcallproc_rX   r\   checkpoint_nstask_idtask_checkpoint_nsr   rZ   r   packetprocr   r   excs"                                     rT   r   r     s	   ( ::dB'L  !92>I",S/A"5;:L|t
9R=$ ?5eS#t!;<iH2%dii0zz<PQQ".8A9+fXdV4tI)A,'	!
 !.ay9"""*'m'9
 '..R7)4@P?Q0RR.-2WF'

!&:x*@A!"nn VCJ))Kv*>?PT*G''"MM%NN,*
 (&$#,Yr]D&(S	* )5+VL4D4DEU4V/(UL,<,<=T,U1 4*../H"M4%z$'74 1$02D-{"4L,,-BC*#01"#H 

"1[. .` gtYr];;	1	y>Q sIaL)Cc*_56605Ffd+3DL>ARS {{)+1&++>OP #H7@9+fXfkk]3fkk  ##D	CG NN=i[IJ -ay9"$kk"*'m'9
 '..R7)4@P?Q0RR.V[[)Dyy t ==OODMM2+KKJJ %"499$M "(GNG--D6.BCTX /+W + & ) 0.
 ,W * ( ' 0$-bqM6;;!"	. - % K)9)9:J)K3 , !M#/#3#34K#L5 8"."2"23Lb"Q8 ):d+;8 5d46H1; &t 0 01F G . '4
 0<L1M1Q1Q ($2E%&.^ %%bqM --"nnu; ;z gv{{IbqMBBC !D 
1	C1&y "*)*'++D1#
 VDMM23Hgx}U =Fyk&$84M"#D	 G %2?6(7)!D"&"&&."+BQ-+=H  +"22VwitDTCU4VV299$4$}} 6"WF/$) &Xtyy(Q &* $+ !( 1 1Kv2F G%) !3G /$/$*MM$))..*:$;2"
 !0$.$,$+$4(1"1(,(.(0	%&	
2" !1$)$O\-=-=>N-O 7$0 %Q'3'7'78O'P 9 <"&2&6&67PRT&U<"$-z$/?<" !9$ 8:L 5{$*4L$4$45J$K$2$+8"
 !4Z@P5Q5U5U$,d6"K(*3h !))!"1 $ 1 1"&..@ @	 %L "'42A??a
 
* !  %LL1$|IbqM?RST s   .b4 4	c.?c."c))c.c                 V    | d   j                         D ]  } t        |             c S  y)z6Get the null version for the checkpoint, if available.rv   N)r   r   )rr   r|   s     rT   r   r   F  s3     0188: tG}rV   versionsr~   r}   r  c                    |/|j                   D ]  }| |   j                         s|fc S  t        S |j                   D ]@  }| |   j                         s|j                  ||      |j                  ||      kD  s=|fc S  t        S rP   )r\   r   ry   r*   )r   r  r~   r}   r  r{   s         rT   r  r  O  s     |MM 	D~**,w	  MM 	D~**,l2|,2- w		
 rV   parent_scratchpadr  c                 f    t              dkD  r`D ]  }|d   t        k(  s|d   t        k(  s| n d D ]1  }|d   |k(  s|d   t        k(  s|d   }t        |t              s|g} n g }~nd g }ddt
        dt        f fd}t        t               t               ||t                     S )	Nr   r   r   r   rN   c                     j                  |       S y | r	 j                         d   S d   S # t        $ r Y y w xY w)Nr   )get_null_resumeremover   )r   null_resume_writer  r   s    rT   r  z$_scratchpad.<locals>.get_null_resume  sf    $ ,(88AA%%&78(++ !##  s   6 	AA)call_counterinterrupt_counterresumer  subgraph_counterF)	r   r0   r5   r   r   r   r   rE   LazyAtomicCounter)r  r   r  wtask_resume_writer  r  s   ``    @rT   r   r   c  s    
 >Q 	%At|#!$%!	% !% 	#Atw1Q46>$%aD!!"3T:):(;%	# !# $ $# $ &(+- '*,	 	rV   c             #   B  K   t        | j                  t              rj	 i }| j                  j                         D ]I  \  }}|| j                  v rt        ||d      ||<   &||v r	 t        ||d      ||<   = ||          ||<   K nGt        | j                  t              r"| j                  D ]  }	 t        ||d      } n yt        d      |r| j                  | j                  |      }| y# t        $ r Y w xY w# t        $ r Y yw xY w# t        $ r Y nw xY ww)zLPrepare input for a PULL task, based on the process's channels and triggers.F)catchNzAInvalid channels type, expected list or dict, got {proc.channels})
r   r   dictr   r\   r>   r:   r   RuntimeErrormapper)r  r   r   r   r   r   r{   s          rT   r  r    s8     $--&	"$C==..0 	*44==()(DFCFX%!!-hE!JA (WQZ\CF	* 
DMM4	(MM 	D"8T?	 O
 	

 0kk#
I1 - ! ! ! 		 % sq   DAD %C26D *D1D?3D2	C>;D =C>>D 	D
DDD	DDDD	namespacepartsc                     t        | d      }|j                  dj                  d |D                     |j                         }|dd  d|dd  d|dd	  d|d	d
  d|d
d  	S )zAGenerate a UUID from the SHA-1 hash of a namespace and str parts.F)usedforsecurityrV   c              3   <   K   | ]  }|j                           y wrP   encoderz   ps     rT   r   z_uuid5_str.<locals>.<genexpr>  s     2q
2   N   r                )r   r   join	hexdigest)r)  r*  shahexs       rT   r   r     sw     y%
0CJJsxx2E223
--/C"1gYaAb	{!C2J<qRAc"Rj\JJrV   c                     t        | dj                  d |D              z         }|dd  d|dd  d|dd  d|dd  d|dd	  	S )
z@Generate a UUID from the XXH3 hash of a namespace and str parts.rV   c              3   <   K   | ]  }|j                           y wrP   r.  r0  s     rT   r   z_xxhash_str.<locals>.<genexpr>  s     1L!((*1Lr2  Nr3  r   r4  r5  r6  r7  )r   r8  )r)  r*  r;  s      rT   r   r     sa    
Y1Le1L)LL
MC"1gYaAb	{!C2J<qRAc"Rj\JJrV   tupc                     t        | t        t        f      rddj                  d | D               S t        | t              r| dS t        |       S )z2Generate a string representation of the task path.~z, c              3   2   K   | ]  }t        |        y wrP   )r   )rz   xs     rT   r   z task_path_str.<locals>.<genexpr>  s     41mA&4s   010d)r   rb   r   r8  rd   rc   )r>  s    rT   r   r     s[     cE4=) DII44456 c3 Dz
 XrV   c                   @    e Zd ZU dZeeg ef      ed<   ddZdefdZ	y)r!  _counterrF  rN   Nc                     d | _         y rP   rE  rR   s    rT   rp   zLazyAtomicCounter.__init__  s	    rV   c                    | j                   Ot        5  | j                   $t        j                  d      j                  | _         d d d        | j                         S | j                         S # 1 sw Y   | j                         S xY w)Nr   )rF  LAZY_ATOMIC_COUNTER_LOCK	itertoolscount__next__rR   s    rT   __call__zLazyAtomicCounter.__call__  si    == ) @==($-OOA$6$?$?DM@ }}t}}@ }}s   1A,,B)rN   N)
r]   r^   r_   rq   r   r   rd   rg   rp   rM  rQ   rV   rT   r!  r!    s,    IxC())# rV   r!  r   )r   rJ  sys	threadingcollectionsr   r   	functoolsr   hashlibr   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   langchain_core.callbacksr    langchain_core.callbacks.managerr   r   langchain_core.runnables.configr   xxhashr   langgraph.channels.baser   langgraph.checkpoint.baser   r   r   r   r   langgraph.constantsr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   langgraph.errorsr:   r;   langgraph.managed.baser<   langgraph.pregel.callr=   langgraph.pregel.ior>   r?   langgraph.pregel.logr@   langgraph.pregel.readrA   langgraph.store.baserB   langgraph.typesrC   rD   rE   rF   rG   langgraph.utils.configrH   rI   GetNextVersionversion_infor  rM   rf   ri   rc   r   r   r   r&  r   rb   r   rd   r   r   r   r   r   r   bytesr   r   r  r   r  r   r   r   LockrI  r!  rQ   rV   rT   <module>rh     s8     
  *       / T : % /        : C 6 7 ; ' , *  ?8A;4a78%%0 -X -"z # #,3-. () 

	L &c;&'& & & $s)S.!	&
 & 4S>3&RhuS#X/0$673- U38_% 
	 5x} 5{ 5s 5
f7f7c;&'f7 N#f7 ~.	f7
 4T#YS)*f7Rc8C=01#h  
	 
  "&!>B+/  &  sJ'  c;&'	 
 !      5>  4=  $-  T]  wsHSM'9:;  s3x(  
#z/  
 $ 
 ?C+/**&* sJ'* c;&'	*
 !* * * 4=* I* ./* 4)+@@A* wsHSM'9:;* s3x(* 
##
#$* 
*8 "&26DH>B+/k$k$&k$ sJ'k$ c;&'	k$
 !k$ k$ k$ k$ Ik$ ./k$ 4)+@@Ak$ wsHSM'9:;k$ s3x(k$ 4Z $s,@'@"AABk$\ w" "&26DH!R@S#XR@smR@ 	R@
 R@ &a[R@ &R@ sJ'R@ c;&'R@ !R@ R@ R@ R@ IR@ ./R@  4)+@@A!R@" 4112#R@j
a[c;&' ?
# 	
  c](5 015&5 5 	5p+
+ + c;&'+
 + c]+\K% K K KK5 K# K# KuS#u_- #  *9>>+  rV   