ó
    ýÞ jî  ã                  óP   • S 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5      r
g)	u]  In-process handle for a single tool call's streaming execution.

Mirrors the shape of `ChatModelStream` from langchain-core but simpler â€”
a tool has one output channel, no content-block multiplexing. Populated
by `ToolCallTransformer` as `tool-started` / `tool-output-delta` /
`tool-finished` / `tool-error` events flow in on the `tools` channel.
é    )Úannotations)ÚAsyncIteratorÚIterator)ÚAny)ÚStreamChannelc                  ó�   • \ rS rSrSr S       SS jjr\SS j5       rSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSrg)ÚToolCallStreamé   u  Scoped view of a single tool call's lifecycle.

Yielded on `run.tool_calls` once per `tool-started` event. Fields
are populated as events arrive:

- `tool_call_id`, `tool_name`, `input`: stable from the start event.
- `output_deltas`: a `StreamChannel` of delta chunks. Iterate (sync or
  async) to consume partial output in arrival order.
- `output`: terminal payload from `tool-finished`, or `None` if the
  call failed or is still in flight.
- `error`: terminal error string from `tool-error`, or `None` if the
  call succeeded or is still in flight.
- `completed`: True once a terminal event (`tool-finished` or
  `tool-error`) has been observed.

`ToolCallStream` is not meant to be constructed by end users â€” it's
produced by `ToolCallTransformer` as events flow through the mux.
Nc                óp   • Xl         X l        X0l        [        5       U l        SU l        SU l        SU l        g)züInitialize a fresh handle for a tool call.

Args:
    tool_call_id: The `tool_call_id` from the AIMessage.
    tool_name: The tool's name.
    input: The tool's input arguments (as reported by
        `on_tool_start`), or `None` if none were captured.
NF)Útool_call_idÚ	tool_nameÚinputr   Ú_output_deltasÚoutputÚerrorÚ	completed)Úselfr   r   r   s       Ú^/var/www/html/gaurav/venv/lib/python3.13/site-packages/langgraph/prebuilt/_tool_call_stream.pyÚ__init__ÚToolCallStream.__init__%   s3   € ð )ÔØ"ŒØŒ
Ü2?³/ˆÔØˆŒØ!%ˆŒ
Øˆ�ó    c                ó   • U R                   $ )zÑThe channel of streamed `tool-output-delta` payloads.

Iterate (sync or async depending on how the run was started)
to consume partial output in arrival order. The log closes when
the tool finishes or errors.
)r   ©r   s    r   Úoutput_deltasÚToolCallStream.output_deltas;   s   € ð ×"Ñ"Ð"r   c               ó6   • U R                   R                  US9  g)zœBind the deltas log to sync or async iteration.

Called by `ToolCallTransformer` when constructing this handle so
the log matches the enclosing mux's mode.
)Úis_asyncN)r   Ú_bind)r   r   s     r   r   ÚToolCallStream._bindE   s   € ð 	×Ñ×!Ñ!¨8Ð!Ò4r   c                ó:   • U R                   R                  U5        g ©N)r   Úpush)r   Údeltas     r   Ú_push_deltaÚToolCallStream._push_deltaM   s   € Ø×Ñ× Ñ  Õ'r   c                óR   • Xl         SU l        U R                  R                  5         g ©NT)r   r   r   Úclose)r   r   s     r   Ú_finishÚToolCallStream._finishP   s    € ØŒØˆŒØ×Ñ×!Ñ!Õ#r   c                óR   • Xl         SU l        U R                  R                  5         g r'   )r   r   r   r(   )r   Úmessages     r   Ú_failÚToolCallStream._failU   s    € ØŒ
ØˆŒØ×Ñ×!Ñ!Õ#r   c                ó,   • [        U R                  5      $ )z�Iterate delta chunks synchronously.

Equivalent to `iter(self.output_deltas)`. Raises `TypeError` if
the underlying log is bound to async mode.
)Úiterr   r   s    r   Ú__iter__ÚToolCallStream.__iter__Z   s   € ô �D×'Ñ'Ó(Ð(r   c                ó6   • U R                   R                  5       $ )z‘Iterate delta chunks asynchronously.

Equivalent to `aiter(self.output_deltas)`. Raises `TypeError`
if the underlying log is bound to sync mode.
)r   Ú	__aiter__r   s    r   r4   ÚToolCallStream.__aiter__b   s   € ð ×"Ñ"×,Ñ,Ó.Ð.r   c                ó°   • U R                   (       a  U R                  c  SOU R                   (       a  SOSnSU R                  < SU R                  < SU S3$ )Nr   ÚfailedÚrunningzToolCallStream(tool_call_id=z, tool_name=z	, status=Ú))r   r   r   r   )r   Ústatuss     r   Ú__repr__ÚToolCallStream.__repr__j   sa   € ð �~�~ $§*¡*Ñ"4ñ ð �~�~ñ àð 	ð +¨4×+<Ñ+<Ñ*?ð @ØŸ™Ñ*¨)°F°8¸1ð>ð	
r   )r   r   r   r   r   r   r   r!   )r   Ústrr   r=   r   zdict[str, Any] | NoneÚreturnÚNone)r>   zStreamChannel[Any])r   Úboolr>   r?   )r#   r   r>   r?   )r   r   r>   r?   )r,   r=   r>   r?   )r>   zIterator[Any])r>   zAsyncIterator[Any])r>   r=   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úpropertyr   r   r$   r)   r-   r1   r4   r;   Ú__static_attributes__© r   r   r	   r	      sn   † ñð. (,ð	àðð ðð %ð	ð
 
õð, ó#ó ð#ô5ô(ô$ô
$ô
)ô/÷
r   r	   N)rE   Ú
__future__r   Úcollections.abcr   r   Útypingr   Úlanggraph.stream.stream_channelr   r	   rH   r   r   Ú<module>rM      s$   ðñõ #ç 3Ý å 9÷d
ò d
r   