Ë
    òÏjk  ã                  ól  — d dl mZ d dlZd dlmZmZmZmZmZ d dl	m
Z
mZ d dlmZmZmZ d dlmZ d dlmZ d dlmZ d d	lmZ erd d
lmZmZ d dlmZ d dlmZmZ dd„Z dd„Z!dd„Z" ed¬«       G d„ d«      «       Z# ed¬«       G d„ d«      «       Z$ G d„ d«      Z% G d„ de#e%«      Z& G d„ de$e%«      Z'y)é    )ÚannotationsN)ÚAsyncIteratorÚ	AwaitableÚCallableÚIteratorÚMapping)ÚMappingProxyTypeÚTracebackType)ÚTYPE_CHECKINGÚAnyÚNoReturn)Úbeta)Úconvert_to_protocol_event)Ú	StreamMux)ÚProtocolEvent)ÚAsyncChatModelStreamÚChatModelStream©ÚStreamChannel)ÚLifecyclePayloadÚSubgraphStatusc                ó&   —  | «       r
	  | «       rŒ	yy)z*Call the sync pump until it returns False.N© ©Úpumps    úX/var/www/html/gaurav-v2/venv/lib/python3.12/site-packages/langgraph/stream/run_stream.pyÚ_drive_until_doner      s   € á
Œ&Øñ �&ó    c              ƒ  óV   K  —  | «       ƒ d{  –—† r	  | «       ƒ d{  –—† rŒyy7 Œ7 Œ	­w)z+Call the async pump until it returns False.Nr   r   s    r   Ú_adrive_until_doner       s    è ø€ á“�,ˆ,Øñ “�,Œ,øˆ,ús   ‚)�%Ž)�'ž)£)§)c           	     óÞ   — | j                   j                  d«      }|�t        |j                  «      ng }t	        t        | «      j                  ›d|›ddj                  |«      xs d› d�«      ‚)aC  Raise after normal attribute lookup fails for a projection.

    Registered native projections are installed directly on the run instance
    during `__init__`, so `__getattr__` is never called for them. At this point
    the requested name is necessarily missing; the mux is inspected only to
    include the valid registered projection names in the error message.

    Read `_mux` directly from `__dict__` because it may not exist yet on a
    partially initialized instance. Accessing `run._mux` in that case would
    invoke `__getattr__` again and recurse indefinitely.
    Ú_muxz object has no attribute z (registered projections: z, ÚnoneÚ))Ú__dict__ÚgetÚsortedÚnative_keysÚAttributeErrorÚtypeÚ__name__Újoin)ÚrunÚnameÚmuxÚ
registereds       r   Ú_raise_missing_projectionr1   $   sr   € ð �,‰,×
Ñ
˜6Ó
"€CØ,/¨O”˜Ÿ™Ô(À€JÜ
Ü�‹9×ÑÐ
 Ð 9¸$¸ð B$Ø$(§I¡I¨jÓ$9Ò$C¸VÐ#DÀAð	Góð r   z4The v3 streaming protocol on Pregel is experimental.)Úmessagec                  ó  — e Zd ZU dZded<   ded<   ded<   ded	<   ded
<   ded<   ded<   ded<   ded<   d d„Zddœ	 	 	 	 	 	 	 d!d„Zd"d„Zd#d„Zd$d„Z	d%d„Z
d&d„Z	 	 	 	 	 	 	 	 d'd„Zed(d„«       Zed$d„«       Zed)d„«       Zd*d„Zd+d„Zy),ÚGraphRunStreamuÍ  Sync run stream with caller-driven pumping.

    The caller's iteration on any projection (`values`, `messages`,
    raw events, or `output`) drives the graph forward. No background
    thread is used â€” the caller's `for` loop is the pump.

    Projections are single-consumer â€” iterating `run.values` twice
    raises. Use `projection.tee(n)` if you genuinely need fan-out.

    All transformer projections live in `extensions`. Native transformer
    projections (those with `_native = True`) are also set as direct
    attributes on this instance (e.g. `run.values`, `run.messages`).

    !!! warning

        Returned by `Pregel.stream_events(version="v3")`, which is
        experimental and may change.
    úStreamChannel[dict[str, Any]]ÚvalueszStreamChannel[ChatModelStream]ÚmessagesúStreamChannel[LifecyclePayload]Ú	lifecyclez StreamChannel[SubgraphRunStream]Ú	subgraphsÚupdatesúStreamChannel[Any]ÚcustomÚcheckpointsÚdebugÚtasksc                ó   — t        | |«       y)a  Type the projections of transformers declared outside this package.

        Projection names come from a registry, so no annotation here can name
        them all. The cost is that a misspelling type-checks too, and fails at
        runtime instead.
        N©r1   ©Úselfr.   s     r   Ú__getattr__zGraphRunStream.__getattr___   s   € ô 	" $¨Õ-r   T©Ú	wire_pumpc               ó>  — || _         || _        t        |j                  «      | _        d| _        d| _        d| _        g | _        t        |j                  «      | _
        |j                  D ]  }t        | ||j                  |   «       Œ |r| j                  |«       yy)a;  Initialize the run stream.

        Args:
            graph_iter: Pull-based iterator over the graph's stream,
                or `None` for nested run streams whose pump is driven
                by an outer run (e.g. `SubgraphRunStream`).
            mux: The StreamMux owning projections and the main log.
            wire_pump: When True (default), bind `_pump_next` as the
                mux's pump callable. Subclasses that inherit a parent
                pump via `StreamMux._make_child` should pass False to
                preserve the parent binding.
        FN)Ú_graph_iterr"   r	   Ú
extensionsÚ
_exhaustedÚ_latestÚ_interruptedÚ_interruptsÚlistÚscopeÚ_scope_listr(   ÚsetattrÚ_wire_request_more)rD   Ú
graph_iterr/   rG   Úkeys        r   Ú__init__zGraphRunStream.__init__h   sŠ   € ð& &ˆÔØˆŒ	Ü-=¸c¿n¹nÓ-MˆŒØˆŒØ.2ˆŒØ!ˆÔØ&(ˆÔÜ&*¨3¯9©9£oˆÔØ—?”?ˆCÜ�D˜#˜sŸ~™~¨cÑ2Õ3ð #áØ×#Ñ# CÕ(ð r   c                ó:   — |j                  | j                  «       y)al  Wire the sync pull callback through the mux.

        Routing through `mux.bind_pump` (rather than walking
        projections directly here) lets child mini-muxes built by
        `mux._make_child(...)` inherit the same pump callable, so
        cursors on a subgraph handle's projections drive the root
        pump just like cursors on `run.values` do.
        N)Ú	bind_pumpÚ
_pump_next©rD   r/   s     r   rS   z!GraphRunStream._wire_request_moreˆ   s   € ð 	�‰�d—o‘oÕ&r   c                óÈ   — |d   dk7  ry|d   }|d   | j                   k7  ry|d   | _        |j                  dd«      }|r#d	| _        | j                  j                  |«       yy©
z;Track values-event state for output/interrupted/interrupts.Úmethodr6   NÚparamsÚ	namespaceÚdataÚ
interruptsr   T©rQ   rL   r&   rM   rN   Úextend©rD   Úeventr^   ra   s       r   Ú_observe_eventzGraphRunStream._observe_event“   óo   € à�‰?˜hÒ&ØØ�x‘ˆØ�+Ñ $×"2Ñ"2Ò2ØØ˜f‘~ˆŒØ—Z‘Z ¨bÓ1ˆ
ÙØ $ˆDÔØ×Ñ×#Ñ# JÕ/ð r   c                ó–  — | j                   s| j                  €y	 t        | j                  «      }t        |«      }| j	                  |«       | j
                  j                  |«       y# t        $ r$ | j
                  j                  «        d| _         Y yt        $ r,}| j
                  j                  |«       d| _         Y d}~yd}~ww xY w)a   Pull one event from the graph and push it through the mux.

        Returns:
            True if an event was pulled, False if the graph is exhausted
            or has raised. Always False when constructed with
            `graph_iter=None` (the run is driven by an outer pump).
        NFT)rK   rI   Únextr   rf   r"   ÚpushÚStopIterationÚcloseÚ	ExceptionÚfail©rD   Úpartre   Úes       r   rY   zGraphRunStream._pump_next    s£   € ð �?Š?˜d×.Ñ.Ð6Øð	Ü˜×(Ñ(Ó)ˆDÜ-¨dÓ3ˆEØ×Ñ Ô&Ø�I‰I�N‰N˜5Ô!ØøÜò 	Ø�I‰I�O‰OÔØ"ˆDŒOÙÜò 	Ø�I‰I�N‰N˜1ÔØ"ˆDŒOÜûð	ús   ›AA( Á(*CÂCÂ"CÃCc                óö   — | j                   ryd| _         | j                  }d| _        |�t        |dd«      x}�	  |«        	 | j                  j                  «        y# t        $ r Y Œ'w xY w# t        $ r Y yw xY w)zäStop the run early.

        Closes the underlying graph iterator (propagating `GeneratorExit`
        so in-flight nodes and subgraphs are cancelled), closes the mux,
        and marks the stream exhausted. Idempotent.
        NTrl   )rK   rI   Úgetattrrm   r"   rl   )rD   rT   rl   s      r   ÚabortzGraphRunStream.abort¹   s†   € ð �?Š?ØØˆŒØ×%Ñ%ˆ
ØˆÔàÐ"Ü! *¨g°tÓ<Ð<�ÐIðÙ”ð	Ø�I‰I�O‰OÕøô ò Ùðûô ò 	Ùð	ús#   ºA ÁA, Á	A)Á(A)Á,	A8Á7A8c                ó   — | S ©Nr   ©rD   s    r   Ú	__enter__zGraphRunStream.__enter__Ò   s   € Øˆr   c                ó$   — | j                  «        y rv   ©rt   ©rD   Úexc_typeÚexcÚtbs       r   Ú__exit__zGraphRunStream.__exit__Õ   s   € ð 	�
‰
�r   c                óŒ   — t        | j                  «       | j                  j                  j                  x}�|‚| j
                  S )z7Drive the run to completion and return the final state.)r   rY   r"   Ú_eventsÚ_errorrL   ©rD   Úerrs     r   ÚoutputzGraphRunStream.outputÝ   s:   € ô 	˜$Ÿ/™/Ô*Ø—9‘9×$Ñ$×+Ñ+Ð+ˆCÐ8ØˆIØ�|‰|Ðr   c                óŒ   — t        | j                  «       | j                  j                  j                  x}�|‚| j
                  S )z¡Drive the run to completion, then return whether it was
        interrupted.

        Raises:
            BaseException: If the run ended with an error.
        )r   rY   r"   r�   r‚   rM   rƒ   s     r   ÚinterruptedzGraphRunStream.interruptedå   s<   € ô 	˜$Ÿ/™/Ô*Ø—9‘9×$Ñ$×+Ñ+Ð+ˆCÐ8ØˆIØ× Ñ Ð r   c                óŒ   — t        | j                  «       | j                  j                  j                  x}�|‚| j
                  S )z‘Drive the run to completion, then return interrupt payloads.

        Raises:
            BaseException: If the run ended with an error.
        )r   rY   r"   r�   r‚   rN   rƒ   s     r   ra   zGraphRunStream.interruptsò   s<   € ô 	˜$Ÿ/™/Ô*Ø—9‘9×$Ñ$×+Ñ+Ð+ˆCÐ8ØˆIØ×ÑÐr   c                ó@   — t        | j                  j                  «      S ©z<Subscribe to the main event log and iterate protocol events.)Úiterr"   r�   rw   s    r   Ú__iter__zGraphRunStream.__iter__þ   s   € ä�D—I‘I×%Ñ%Ó&Ð&r   c              '  ó  K  — ddl m} i }	 |D ]ž  }| j                  |   }t        ||«      s$t	        dt        |«      j                  › d|›�«      ‚|j                  €t	        d|›d�«      ‚|j                  rt	        d|›d�«      ‚|j                  rt        d|›d	�«      ‚d
|_        |||<   Œ  t        «       }t        |«      t        |«      k  �rpd}|j                  «       D ]z  \  }}||v rŒ|j                  r6|j                  s*|j                  �|j                  ‚|j!                  |«       ŒM|j                  sŒZ|j                  d   d   }|�	||d   k  sŒw||f}Œ| |�-||d      j                  j#                  «       \  }	}
|d   |
f–— n™| j$                  j&                  }|� |«       szt        |«      }|j                  «       D ]M  \  }}||vsŒ|j                  rŒ|j                  sŒ%|j                  �|j                  ‚|j!                  |«       ŒO t        |«      |k(  rnt        |«      t        |«      k  r�Œp|j)                  «       D ]	  }d|_        Œ y# |j)                  «       D ]	  }d|_        Œ w xY w­w)uW  Iterate multiple projections in arrival order, yielding ``(name, item)``.

        Items are ordered by a monotonic push stamp assigned when each
        transformer pushes into its `StreamChannel`. This gives strict
        arrival ordering across projections, unlike round-robin.

        Args:
            *names: Projection keys to interleave. Must match keys in
                ``extensions``.

        Yields:
            ``(name, item)`` tuples in arrival order across the named
            projections.

        Each named channel is locked for the duration of iteration and
        released when the generator completes, is closed, or raises.
        Channels cannot be subscribed concurrently â€” use `.tee(n)` if
        you need fan-out.

        Raises:
            KeyError: If a name doesn't match a registered projection.

        Example:
            ```python
            for name, item in run.interleave("messages", "values"):
                if name == "messages":
                    print("msg:", item)
                else:
                    print("val:", item)
            ```
        r   r   z5interleave() requires StreamChannel projections, got z for NzStreamChannel zI has not been bound yet. Register the transformer with a StreamMux first.uL    is bound to async mode â€” sync interleave() cannot consume async channels.z3 already has a subscriber; use .tee(n) for fan-out.Té   F)Úlanggraph.stream.stream_channelr   rJ   Ú
isinstanceÚ	TypeErrorr*   r+   Ú	_is_asyncÚ_subscribedÚRuntimeErrorÚsetÚlenÚitemsÚ_closedÚ_itemsr‚   ÚaddÚpopleftr"   Ú_pump_fnr6   )rD   Únamesr   Úchannelsr.   ÚchÚdoneÚbestÚstampÚ_stampÚitemr   Úbefores                r   Ú
interleavezGraphRunStream.interleave  s…  è ø€ õ@ 	Bà24ˆð<	'Û�Ø—_‘_ TÑ*�Ü! " mÔ4Ü#ðÜ# B›x×0Ñ0Ð1°°t°hð@óð ð —<‘<Ð'Ü#Ø(¨¨ð 1Kð Kóð ð —<’<Ü#Ø(¨¨ð 1Kð Kóð ð —>’>Ü&Ø(¨¨ð 13ð 3óð ð "&�”Ø!#�˜’ð/ ô2 !›UˆDä�d“)œc (›mÓ+Ø/3�Ø (§¡Ö 0‘H�D˜"Ø˜t‘|Ø Ø—z’z¨"¯)ª)ØŸ9™9Ð0Ø"$§)¡)˜OØŸ™ œØ Ø—y“yØ "§	¡	¨!¡¨Q¡˜Ø˜<¨5°4¸±7«?Ø$)¨4 =™Dð !1ð Ð#Ø#+¨D°©GÑ#4×#;Ñ#;×#CÑ#CÓ#E‘L�F˜DØ ™7 D˜/Ó)àŸ9™9×-Ñ-�DØ�|©4¬6Ü!$ T£˜Ø(0¯©Ö(8™H˜D "Ø#¨4Ò/¸¿	»	Ø#%§:£:Ø')§y¡yÐ'<Ø.0¯i©i¨Ø$(§H¡H¨T¥Nð )9ô ˜t›9¨Ò.Ø!ô; �d“)œc (›mÔ+ð> —o‘oÖ'�Ø!&�•ñ (ø�h—o‘oÖ'�Ø!&�•ñ (üs=   ‚	I?ŒD0I Ä=I ÅA9I ÇI Ç!I Ç.AI ÉI?ÉI<É<I?N©r.   ÚstrÚreturnr<   )rT   zIterator[Any] | Noner/   r   rG   Úboolr©   ÚNone©r/   r   r©   r«   ©re   r   r©   r«   ©r©   rª   ©r©   r«   )r©   r4   ©r|   ztype[BaseException] | Noner}   zBaseException | Noner~   zTracebackType | Noner©   r«   ©r©   zdict[str, Any] | None©r©   z	list[Any])r©   zIterator[ProtocolEvent])r�   r¨   r©   zIterator[tuple[str, Any]])r+   Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__rE   rV   rS   rf   rY   rt   rx   r   Úpropertyr…   r‡   ra   rŒ   r¦   r   r   r   r4   r4   8   s  … ñð. *Ó)Ø,Ó,Ø.Ó.Ø/Ó/ð
 +Ó*ØÓØ.Ó.Ø(Ó(Ø(Ó(ó.ð ñ)à(ð)ð ð)ð
 ð)ð 
ó)ó@	'ó0óó2ó2ðà,ðð "ðð !ð	ð
 
óð òó ðð ò
!ó ð
!ð ò	 ó ð	 ó'ô_'r   r4   c                  óð   — e Zd ZU dZded<   ded<   ded<   ded	<   ded
<   ded<   ded<   ded<   ded<   dd„Zddœ	 	 	 	 	 	 	 d d„Zd!d„Zd"d„Zd#d„Z	d$d„Z
d%d„Z	 	 	 	 	 	 	 	 d&d„Zd'd„Zd#d„Zd(d„Zd)d„Zy)*ÚAsyncGraphRunStreamuŸ  Async run stream with caller-driven pumping.

    Async iteration on any projection drives the graph forward â€” there
    is no background task. Concurrent consumers share a single-flight
    pump via an `asyncio.Lock`, so each awaiting cursor contributes one
    event per acquisition. Backpressure comes from the logs: when a
    subscribed log's buffer reaches `maxlen`, `apush` awaits the
    subscriber to drain, which holds back the pump and paces the graph.

    Projections are single-consumer â€” a second `aiter(run.values)`
    raises. Use `projection.tee(n)` for fan-out.

    Use as an async context manager to guarantee clean shutdown on
    early exit:

    ```python
    async with await handler.astream(input) as run:
        async for msg in run.messages:
            ...
    ```

    !!! warning

        Awaited from `Pregel.astream_events(version="v3")`, which is
        experimental and may change.
    r5   r6   z#StreamChannel[AsyncChatModelStream]r7   r8   r9   z%StreamChannel[AsyncSubgraphRunStream]r:   r;   r<   r=   r>   r?   r@   c                ó   — t        | |«       y)z:Type projections declared elsewhere. See `GraphRunStream`.NrB   rC   s     r   rE   zAsyncGraphRunStream.__getattr__�  s   € ä! $¨Õ-r   TrF   c               óš  — || _         || _        t        |j                  «      | _        d| _        d| _        d| _        g | _        t        |j                  «      | _
        t        j                  «       | _        d| _        d| _        d| _        |j"                  D ]  }t%        | ||j                  |   «       Œ |r| j'                  |«       yy)aI  Initialize the async run stream.

        Args:
            graph_aiter: Async iterator over the graph's stream, or
                `None` for nested run streams whose pump is driven by
                an outer run (e.g. `AsyncSubgraphRunStream`).
            mux: The StreamMux owning projections and the main log.
            wire_pump: When True (default), bind `_apump_next` as the
                mux's async pump callable. Subclasses that inherit a
                parent pump via `StreamMux._make_child` should pass
                False to preserve the parent binding.
        FN)Ú_graph_aiterr"   r	   rJ   rK   rL   rM   rN   rO   rP   rQ   ÚasyncioÚ	ConditionÚ
_pump_condÚ_pumpingÚ_anext_taskÚ	_abortingr(   rR   Ú_wire_arequest_more)rD   Úgraph_aiterr/   rG   rU   s        r   rV   zAsyncGraphRunStream.__init__”  s°   € ð& (ˆÔØˆŒ	Ü-=¸c¿n¹nÓ-MˆŒØˆŒØ.2ˆŒØ!ˆÔØ&(ˆÔÜ&*¨3¯9©9£oˆÔÜ!×+Ñ+Ó-ˆŒØˆŒØ7;ˆÔØˆŒØ—?”?ˆCÜ�D˜#˜sŸ~™~¨cÑ2Õ3ð #áØ×$Ñ$ SÕ)ð r   c                óÈ   — |d   dk7  ry|d   }|d   | j                   k7  ry|d   | _        |j                  dd«      }|r#d	| _        | j                  j                  |«       yyr\   rb   rd   s       r   rf   z"AsyncGraphRunStream._observe_event¸  rg   r   c                ó:   — |j                  | j                  «       y)zúWire the async pull callback through the mux.

        Mirrors `_wire_request_more`: routing through
        `mux.bind_apump` lets child mini-muxes inherit the pump
        callable so cursors on subgraph handles drive the root
        pump.
        N)Ú
bind_apumpÚ_apump_nextrZ   s     r   rÃ   z'AsyncGraphRunStream._wire_arequest_moreÅ  s   € ð 	�‰�t×'Ñ'Õ(r   c           	   ƒ  ó  K  — | j                   4 ƒd{  –—†  | j                  s| j                  €	 ddd«      ƒd{  –—†  y| j                  r@| j                   j	                  «       ƒ d{  –—†  | j                   cddd«      ƒd{  –—†  S d| _        ddd«      ƒd{  –—†  	 	 t        j                  | j                  j                  «       «      | _        	 | j                  ƒ d{  –—† }	 d| _        t        |«      }| j                  |«       | j                  j!                  |«      ƒ d{  –—†  	 | j                   4 ƒd{  –—†  d| _        | j                   j                  «        ddd«      ƒd{  –—†  y7 �Œj7 �ŒD7 �Œ7 Œý7 Œç# 1 ƒd{  –—†7  sw Y   Œ÷xY w7 Œµ# t
        j                  $ r• | j                  rmd| _        Y d| _        | j                   4 ƒd{  –—†7   d| _        | j                   j                  «        ddd«      ƒd{  –—†7   y# 1 ƒd{  –—†7  sw Y   yxY w| j                  j                  «        ‚ w xY w# d| _        w xY w7 �Œ(7 �Œ7 Œæ# 1 ƒd{  –—†7  sw Y   yxY w# t"        $ rŠ d| _        | j                  j%                  «       ƒ d{  –—†7   Y | j                   4 ƒd{  –—†7   d| _        | j                   j                  «        ddd«      ƒd{  –—†7   y# 1 ƒd{  –—†7  sw Y   yxY wt&        $ r’}d| _        | j                  j)                  |«      ƒ d{  –—†7   Y d}~| j                   4 ƒd{  –—†7   d| _        | j                   j                  «        ddd«      ƒd{  –—†7   y# 1 ƒd{  –—†7  sw Y   yxY wd}~ww xY w# | j                   4 ƒd{  –—†7   d| _        | j                   j                  «        ddd«      ƒd{  –—†7   w # 1 ƒd{  –—†7  sw Y   w xY wxY w­w)u{  Drive one pump step, or wait for the active pumper to drive one.

        "Take-a-number" semantics: at most one task at a time calls
        `graph_aiter.__anext__()` (asyncio iterators can't be advanced
        concurrently). Other callers wait on a Condition that the
        active pumper notifies after each step. This lets a "passive"
        consumer â€” one whose projection's buffer is being filled by the
        active pumper's push â€” wake up as soon as its data lands,
        instead of queueing on the pump and only observing its data one
        graph event late.

        `except Exception` is intentional â€” `CancelledError` and other
        `BaseException` subclasses propagate, matching asyncio's
        cancellation contract.

        Returns:
            True if a pump step completed (by this task or another),
            False if the graph is exhausted.
        NFT)r¿   rK   r¼   rÀ   Úwaitr½   Úensure_futureÚ	__anext__rÁ   ÚCancelledErrorrÂ   Ú
notify_allÚcancelr   rf   r"   ÚapushÚStopAsyncIterationÚacloserm   Úafailro   s       r   rÈ   zAsyncGraphRunStream._apump_nextÏ  s¼  è ø€ ð( —?—?“?Ø�Š $×"3Ñ"3Ð";Ø÷ #—?�?ð �}Š}à—o‘o×*Ñ*Ó,×,Ð,ØŸ?™?Ð*÷ #—?‘?ð !ˆDŒM÷ #—?ð$	-ðô $+×#8Ñ#8¸×9JÑ9J×9TÑ9TÓ9VÓ#W�Ô ð,Ø!%×!1Ñ!1×1‘Dð (,�DÔ$Ü1°$Ó7�Ø×#Ñ# EÔ*Ø—i‘i—o‘o eÓ,×,Ð,Øð ——“Ø %�”Ø—‘×*Ñ*Ô,÷ '—�ðW #ù�?ùð
 -ùð #ø�?ø—?—?‘?úð$ 2ùÜ×-Ñ-ò Ø—~’~à*.˜œØ$ð (,�DÔ$ð ——”Ø %�”Ø—‘×*Ñ*Ô,÷ '———“úð# ×$Ñ$×+Ñ+Ô-Øðûð (,�DÕ$úð -ùð 'ù�ø——‘ûô &ò Ø"&�”Ø—i‘i×&Ñ&Ó(×(Ñ(Øð ——”Ø %�”Ø—‘×*Ñ*Ô,÷ '———“úô ò Ø"&�”Ø—i‘i—o‘o aÓ(×(Ñ(Ûà——”Ø %�”Ø—‘×*Ñ*Ô,÷ '———“þðûð
 ——”Ø %�”Ø—‘×*Ñ*Ô,÷ '———“ÿsˆ  ‚P“E=”P—F
±P¼F ½PÁ)F
Á+FÁ,F
Á<PÂFÂ	PÂF
ÂPÂ FÂ!PÂ'2I5 ÃF! Ã)FÃ*F! Ã/AI5 Ä0IÄ1I5 Ä6PÅIÅPÅ
"I Å,PÅ7IÅ8PÆ PÆF
ÆPÆPÆ
FÆFÆFÆPÆF! Æ!&I	ÇI ÇI5 ÇPÇG"Ç PÇ$"HÈPÈHÈPÈH*ÈH!ÈH*È&PÈ-I	É	I É	IÉI5 ÉPÉPÉ I2É&I)É'I2É.PÉ5-N!Ê"J%Ê#N!Ê(N$ Ê)PÊ9J<Ê:PÊ>"K2Ë PË+K.Ë,PË2LË8K;Ë9LÌ PÌN!Ì%NÌ4L7Ì5NÌ:N$ Ì>PÍMÍPÍ"NÍ5PÎ NÎPÎNÎNÎNÎPÎN!Î!N$ Î$PÎ5N8
Î6PÎ:"O.ÏPÏ'O*Ï(PÏ.P Ï4O7Ï5P Ï<PÐPc              ƒ  ó¾  K  — | j                   4 ƒd{  –—†  | j                  r	 ddd«      ƒd{  –—†  yd| _        d| _        | j                  }d| _        | j                  }| j                   j                  «        ddd«      ƒd{  –—†  �+|j                  «       s|j                  «        	 |ƒ d{  –—†  �t        |dd«      x}�	  |«       ƒ d{  –—†  	 | j                  j                  «       ƒ d{  –—†  y7 Œë7 ŒÐ7 Œz# 1 ƒd{  –—†7  sw Y   ŒŠxY w7 Œd# t        j                  t        f$ r Y Œ}w xY w7 Œd# t        $ r Y Œmw xY w7 ŒR# t        $ r Y yw xY w­w)a˜  Stop the run early.

        Marks the stream exhausted and wakes any pump-waiters. Cancels an
        in-flight pull if one is running, then closes the underlying graph
        iterator, so running nodes and nested subgraphs are cancelled
        whether or not a pump is mid-pull. Closes the mux; any `apush`
        blocked on backpressure wakes and returns without appending.
        Idempotent.
        NTrÒ   )r¿   rK   rÂ   r¼   rÁ   rÎ   r    rÏ   r½   rÍ   rm   rs   r"   rÒ   )rD   rÄ   Ú
anext_taskrÒ   s       r   rt   zAsyncGraphRunStream.abort  s;  è ø€ ð —?—?“?Ø�ŠØ÷ #—?�?ð #ˆDŒOØ!ˆDŒNØ×+Ñ+ˆKØ $ˆDÔØ×)Ñ)ˆJØ�O‰O×&Ñ&Ô(÷ #—?ð Ð!¨*¯/©/Ô*;Ø×ÑÔðØ × Ð ð Ð#Ü" ;°¸$Ó?Ð?�ÐLðÙ“h—�ð	Ø—)‘)×"Ñ"Ó$×$Ñ$ð9 #ø�?ø�?ø—?—?‘?úð  !ùÜ×*Ñ*¬IÐ6ò Ùðúð ùÜò Ùðúð %ùÜò 	Ùð	üsû   ‚E“C?”E—D¥E°D±E¶ADÁ=EÂDÂ	&EÂ0D Â5DÂ6D Â:EÃ
D= ÃD;ÃD= ÃE Ã9EÃ:E Ã>EÄEÄEÄDÄDÄDÄEÄD ÄD8Ä5EÄ7D8Ä8EÄ;D= Ä=	E	ÅEÅE	Å	EÅE Å	EÅEÅEÅEc              ƒ  ó   K  — | S ­wrv   r   rw   s    r   Ú
__aenter__zAsyncGraphRunStream.__aenter__<  s   è ø€ Øˆùs   ‚c              ƒ  ó@   K  — | j                  «       ƒ d {  –—†  y 7 Œ­wrv   rz   r{   s       r   Ú	__aexit__zAsyncGraphRunStream.__aexit__?  s   è ø€ ð �j‰j‹l×Òús   ‚–—c              ƒ  ó¨   K  — t        | j                  «      ƒ d{  –—†  | j                  j                  j                  x}�|‚| j
                  S 7 Œ4­w)a›  Drive the run to completion and return the final state.

        Methods (not properties) on the async lane so `run.output`
        without `await` raises at type-check time instead of silently
        yielding a coroutine object.

        Example:
            ```python
            output = await run.output()
            ```

        Raises:
            BaseException: If the run ended with an error.
        N)r    rÈ   r"   r�   r‚   rL   rƒ   s     r   r…   zAsyncGraphRunStream.outputG  sK   è ø€ ô ! ×!1Ñ!1Ó2×2Ð2Ø—9‘9×$Ñ$×+Ñ+Ð+ˆCÐ8ØˆIØ�|‰|Ðð 	3úó   ‚A›Aœ5Ac              ƒ  ó¨   K  — t        | j                  «      ƒ d{  –—†  | j                  j                  j                  x}�|‚| j
                  S 7 Œ4­w)zŸDrive the run to completion and return whether it was
        interrupted.

        Raises:
            BaseException: If the run ended with an error.
        N)r    rÈ   r"   r�   r‚   rM   rƒ   s     r   r‡   zAsyncGraphRunStream.interrupted[  sM   è ø€ ô ! ×!1Ñ!1Ó2×2Ð2Ø—9‘9×$Ñ$×+Ñ+Ð+ˆCÐ8ØˆIØ× Ñ Ð ð 	3úrÛ   c              ƒ  ó¨   K  — t        | j                  «      ƒ d{  –—†  | j                  j                  j                  x}�|‚| j
                  S 7 Œ4­w)z�Drive the run to completion and return interrupt payloads.

        Raises:
            BaseException: If the run ended with an error.
        N)r    rÈ   r"   r�   r‚   rN   rƒ   s     r   ra   zAsyncGraphRunStream.interruptsg  sM   è ø€ ô ! ×!1Ñ!1Ó2×2Ð2Ø—9‘9×$Ñ$×+Ñ+Ð+ˆCÐ8ØˆIØ×ÑÐð 	3úrÛ   c                óJ   — | j                   j                  j                  «       S rŠ   )r"   r�   Ú	__aiter__rw   s    r   rß   zAsyncGraphRunStream.__aiter__r  s   € à�y‰y× Ñ ×*Ñ*Ó,Ð,r   Nr§   )rÄ   zAsyncIterator[Any] | Noner/   r   rG   rª   r©   r«   r­   r¬   r®   r¯   )r©   r¹   r°   r±   r²   )r©   zAsyncIterator[ProtocolEvent])r+   r³   r´   rµ   r¶   rE   rV   rf   rÃ   rÈ   rt   r×   rÙ   r…   r‡   ra   rß   r   r   r   r¹   r¹   d  sÐ   … ñð> *Ó)Ø1Ó1Ø.Ó.Ø4Ó4à*Ó*ØÓØ.Ó.Ø(Ó(Ø(Ó(ó.ð ñ"*à.ð"*ð ð"*ð
 ð"*ð 
ó"*óH0ó)óA-óF(óTðà,ðð "ðð !ð	ð
 
óóó(
!ó	 ô-r   r¹   c                  óN   — e Zd ZU dZded<   ded<   ded<   ded<   ded	<   d
ed<   y)Ú_SubgraphRunStreamMixinum  Subgraph metadata + parent-pump delegation shared by both lanes.

    Inherits from `GraphRunStream` (or `AsyncGraphRunStream`) with
    `graph_iter=None` + `wire_pump=False` â€” the mini-mux is driven
    by the parent's pump (inherited via `StreamMux._make_child`), and
    the handle never pulls upstream itself. Pump-driving methods
    delegate to the parent pump so `handle.output` and friends drive
    the root run.

    Subclasses set the parent pump function captured at construction
    (`_parent_pump_fn` / `_parent_apump_fn`) and override
    `_pump_next` / `_apump_next` to delegate to it.

    Status is updated in place by `SubgraphTransformer`. Iterate
    `run.subgraphs` to receive handles as subgraphs spawn, then
    drill into projections inside the loop body **before** the next
    pump cycle â€” same lazy-subscribe constraint as root projections.
    útuple[str, ...]Úpathú
str | NoneÚ
graph_nameÚtrigger_call_idr   ÚstatusÚerrorrª   Ú_seen_terminalN)r+   r³   r´   rµ   r¶   r   r   r   rá   rá   w  s-   … ñð& ÓØÓØÓØÓØÓØÔr   rá   c                  óF   ‡ — e Zd ZdZdddœ	 	 	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )ÚSubgraphRunStreamzASync handle for a discovered subgraph (extends `GraphRunStream`).N©rå   ræ   c               ó    •— |j                   | _        t        ‰| �  d |d¬«       || _        || _        || _        d| _        d | _        d| _	        y )NF)rT   r/   rG   Ústarted)
rœ   Ú_parent_pump_fnÚsuperrV   rã   rå   ræ   rç   rè   ré   ©rD   r/   rã   rå   ræ   Ú	__class__s        €r   rV   zSubgraphRunStream.__init__–  sZ   ø€ ð ;>¿,¹,ˆÔÜ‰ÑØØØð 	ô 	
ð
 ˆŒ	Ø$ˆŒØ.ˆÔØˆŒØˆŒ
Ø#ˆÕr   c                ó¬   — | j                   s8| j                  s,| j                  j                  j                  s| j
                  €y| j                  «       S )zâDelegate to the parent's pump.

        Cursors on this handle's projections call here when their
        buffers empty. Driving the parent fans events into our
        mini-mux, transparently advancing the whole run.
        F)rK   ré   r"   r�   r˜   rï   rw   s    r   rY   zSubgraphRunStream._pump_next­  sE   € ð �OŠOØ×"Ò"Ø�y‰y× Ñ ×(Ò(Ø×#Ñ#Ð+àØ×#Ñ#Ó%Ð%r   ©
r/   r   rã   râ   rå   rä   ræ   rä   r©   r«   r®   )r+   r³   r´   rµ   rV   rY   Ú__classcell__©rò   s   @r   rë   rë   “  sH   ø„ ÙKð "&Ø&*ñ$àð$ð ð	$ð
 ð$ð $ð$ð 
õ$÷.&r   rë   c                  óF   ‡ — e Zd ZdZdddœ	 	 	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )ÚAsyncSubgraphRunStreamzGAsync handle for a discovered subgraph (extends `AsyncGraphRunStream`).Nrì   c               ó    •— |j                   | _        t        ‰| �  d |d¬«       || _        || _        || _        d| _        d | _        d| _	        y )NF)rÄ   r/   rG   rî   )
Ú	_apump_fnÚ_parent_apump_fnrð   rV   rã   rå   ræ   rç   rè   ré   rñ   s        €r   rV   zAsyncSubgraphRunStream.__init__Á  s\   ø€ ð GJÇmÁmˆÔÜ‰ÑØØØð 	ô 	
ð
 ˆŒ	Ø$ˆŒØ.ˆÔØˆŒØˆŒ
Ø#ˆÕr   c              ƒ  óÈ   K  — | j                   s8| j                  s,| j                  j                  j                  s| j
                  €y| j                  «       ƒ d{  –—† S 7 Œ­w)z$Delegate to the parent's async pump.NF)rK   ré   r"   r�   r˜   rû   rw   s    r   rÈ   z"AsyncSubgraphRunStream._apump_nextÖ  sO   è ø€ ð �OŠOØ×"Ò"Ø�y‰y× Ñ ×(Ò(Ø×$Ñ$Ð,àØ×*Ñ*Ó,×,Ð,Ð,ús   ‚AA"ÁA ÁA"rô   r®   )r+   r³   r´   rµ   rV   rÈ   rõ   rö   s   @r   rø   rø   ¾  sH   ø„ ÙQð "&Ø&*ñ$àð$ð ð	$ð
 ð$ð $ð$ð 
õ$÷*	-r   rø   )r   zCallable[[], bool]r©   r«   )r   zCallable[[], Awaitable[bool]]r©   r«   )r-   Úobjectr.   r¨   r©   r   )(Ú
__future__r   r½   Úcollections.abcr   r   r   r   r   Útypesr	   r
   Útypingr   r   r   Úlangchain_core._apir   Úlanggraph.stream._convertr   Úlanggraph.stream._muxr   Úlanggraph.stream._typesr   Ú0langchain_core.language_models.chat_model_streamr   r   r�   r   Úlanggraph.stream.transformersr   r   r   r    r1   r4   r¹   rá   rë   rø   r   r   r   Ú<module>r     s·   ðÝ "ã ß QÕ Qß 1ß /Ñ /å $å ?Ý +Ý 1á÷õ
 >ßNóóóñ( ÐDÔE÷h'ð h'ó Fðh'ñV	 ÐDÔE÷O-ð O-ó FðO-÷dñ ô8(&˜Ð(?ô (&ôV!-Ð0Ð2Iõ !-r   