+
    rpÐjÙ'  ã                   ó¦   € ^ RI t ^ RIt^ RIHtHtHtHtHtHt ^ RI	H
t ^ RIHt ^ RIHtHt ^ RIHt ^ RIHt ]'       d   ^ RIHt  ! R R	4      tR# )
é    N)ÚTYPE_CHECKINGÚDictÚListÚOptionalÚSequenceÚUnion)ÚBlock)ÚChunkÚMarkdownTextChunk)ÚMetadata)ÚSlackResponse)Ú	WebClientc                   óÌ   a € ] tR t^t o RtRRRRRRRRRRRR/V 3R	 lR
 llt]V 3R lR l4       tRRRR/V 3R lR lltRRRRRRRRRR/V 3R lR llt	RV 3R lR llt
RtV tR# )Ú
ChatStreama  A helper class for streaming markdown text into a conversation using the chat streaming APIs.

This class provides a convenient interface for the chat.startStream, chat.appendStream, and chat.stopStream API
methods, with automatic buffering and state management.
Úrecipient_team_idNÚrecipient_user_idÚtask_display_modeÚ
icon_emojiÚicon_urlÚusernamec                óÎ   <€ V ^8„  d   QhRRRS[ RS[P                  RS[ RS[RS[S[ ,          RS[S[ ,          R	S[S[ ,          R
S[S[ ,          RS[S[ ,          RS[S[ ,          /# )é   Úclientr   ÚchannelÚloggerÚ	thread_tsÚbuffer_sizer   r   r   r   r   r   )ÚstrÚloggingÚLoggerÚintr   )ÚformatÚ__classdict__s   "€ÚK/opt/hermes/.venv/lib/python3.14/site-packages/slack_sdk/web/chat_stream.pyÚ__annotate__ÚChatStream.__annotate__   s•   ø€ ÷ 7(ñ 7(àð7(ñ ð	7(ñ
 —‘ð7(ñ ð7(ñ ð7(ñ $¡C�=ð7(ñ $¡C�=ð7(ñ $¡C�=ð7(ñ ™S•Mð7(ñ ™3•-ð7(ñ ™3•-ñ7(ó    c       
        ó´   € Wn         W0n        VP                  RR4      V n        RVRVRVRVRVRV	R	V
R
V/VCV n        RV n        RV n        RV n        WPn        R# )aO  Initialize a new ChatStream instance.

The __init__ method creates a unique ChatStream instance that keeps track of one chat stream.

Args:
    client: The WebClient instance to use for API calls.
    channel: An encoded ID that represents a channel, private group, or DM.
    logger: A logging channel for outputs.
    thread_ts: Provide another message's ts value to reply to. Streamed messages should always be replies to a user
      request.
    recipient_team_id: The encoded ID of the team the user receiving the streaming text belongs to. Required when
      streaming to channels.
    recipient_user_id: The encoded ID of the user to receive the streaming text. Required when streaming to channels.
    task_display_mode: Specifies how tasks are displayed in the message. A "timeline" displays individual tasks
      with text and "plan" displays all tasks together.
    icon_emoji: Emoji to use as the icon for this message. Overrides icon_url.
    icon_url: Image URL to use as the icon for this message.
    username: The bot's username to display.
    buffer_size: The length of markdown_text to buffer in-memory before calling a method. Increasing this value
      decreases the number of method calls made for the same amount of text, which is useful to avoid rate limits.
    **kwargs: Additional arguments passed to the underlying API calls.
ÚtokenNr   r   r   r   r   r   r   r   Ú Ústarting)	Ú_clientÚ_loggerÚpopÚ_tokenÚ_stream_argsÚ_bufferÚ_stateÚ
_stream_tsÚ_buffer_size)Úselfr   r   r   r   r   r   r   r   r   r   r   Úkwargss   &&$$$$$$$$$$,r$   Ú__init__ÚChatStream.__init__   s}   € ðL ŒØŒØ%+§Z¡Z°¸Ó%>ˆŒà�wØ˜ØÐ!2ØÐ!2ØÐ!2Ø˜*Ø˜Ø˜ð

ð ð

ˆÔð ˆŒØ ˆŒØ)-ˆŒØ'Ör'   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# )r   Úreturn)r   r   )r"   r#   s   "€r$   r%   r&   P   s   ø€ ÷ ñ ‘H™S•Mñ r'   c                ó   € V P                   # )zºThe message timestamp of the stream.

Returns None until the first flush (when chat.startStream is called).
Can be used with chat.update as a fallback if the stream expires server-side.
)r3   )r5   s   &r$   ÚtsÚChatStream.tsO   s   € ð �‰Ðr'   Úmarkdown_textÚchunksc                ó‚   <€ V ^8„  d   QhRS[ S[,          RS[ S[S[S[S[3,          ,          ,          RS[ S[,          /# )r   r>   r?   r:   )r   r   r   r   r   r
   r   )r"   r#   s   "€r$   r%   r&   X   sG   ø€ ÷ 6ñ 6ñ  ¡•}ð6ñ ™¡%©©e¨Õ"4Õ5Õ6ð	6ñ 
‘-Õ	 ñ6r'   c               óü  € V P                   R8X  d$   \        P                  ! RV P                    24      hVP                  R4      '       d   VP	                  R4      V n        Ve   V ;P                  V,          un        \        V P                  4      V P                  8¼  g   Ve   V P                  ! RRV/VB # R\        V P                  4      RV P                  RV P                  P                  R4      R	V P                  P                  R	4      R
V P                  P                  R
4      RV P                  P                  R4      /pV P                  P                  R\        P                  ! V4       24       R# )aö  Append to the stream.

The "append" method appends to the chat stream being used. This method can be called multiple times. After the stream
is stopped this method cannot be called.

Args:
    chunks: An array of streaming chunks. Chunks can be markdown text, plan, or task update chunks.
    markdown_text: Accepts message text formatted in markdown. Limit this field to 12,000 characters. This text is
      what will be appended to the message received so far.
    **kwargs: Additional arguments passed to the underlying API calls.

Returns:
    SlackResponse if the buffer was flushed, None if buffering.

Raises:
    SlackRequestError: If the stream is already completed.

Example:
    ```python
    streamer = client.chat_stream(
        channel="C0123456789",
        thread_ts="1700000001.123456",
        recipient_team_id="T0123456789",
        recipient_user_id="U0123456789",
    )
    streamer.append(markdown_text="**hello wo")
    streamer.append(markdown_text="rld!**")
    streamer.stop()
    ```
Ú	completedz)Cannot append to stream: stream state is r)   Nr?   Úbuffer_lengthr   r   r   r   r   zChatStream appended to buffer: © )r2   ÚeÚSlackRequestErrorÚgetr.   r/   r1   Úlenr4   Ú_flush_bufferr0   r-   ÚdebugÚjsonÚdumps)r5   r>   r?   r6   Údetailss   &$$, r$   ÚappendÚChatStream.appendX   s=  € ðJ �;‰;˜+Ô%Ü×%Ò%Ð(QÐRV×R]ÑR]ÐQ^Ð&_Ó`Ð`Ø�:‰:�g×ÒØ Ÿ*™* WÓ-ˆDŒKØÒ$Ø�LŠL˜MÕ)�LÜˆt�|‰|Ó × 1Ñ 1Ô1°VÒ5GØ×%Ò%Ñ>¨VÐ>°vÑ>Ð>àœS §¡Ó.Ø˜4×,Ñ,Ø�t×(Ñ(×,Ñ,¨YÓ7Ø ×!2Ñ!2×!6Ñ!6Ð7JÓ!KØ ×!2Ñ!2×!6Ñ!6Ð7JÓ!KØ˜×*Ñ*×.Ñ.¨{Ó;ð
ˆð 	�‰×ÑÐ<¼T¿ZºZÈÓ=PÐ<QÐRÔSÙr'   ÚblocksÚmetadataÚsession_statusc                ó  <€ V ^8„  d   QhRS[ S[,          RS[ S[S[S[S[3,          ,          ,          RS[ S[S[S[S[S[S[3,          ,          3,          ,          RS[ S[S[S[3,          ,          RS[ S[,          RS[/# )r   r>   r?   rP   rQ   rR   r:   )	r   r   r   r   r   r
   r	   r   r   )r"   r#   s   "€r$   r%   r&   �   s—   ø€ ÷ Hñ Hñ  ¡•}ðHñ ™¡%©©e¨Õ"4Õ5Õ6ð	Hñ
 ™™s¡H©U±4¹°;Õ-?Õ$@Ð@ÕAÕBðHñ ™5¡¡x Õ0Õ1ðHñ !¡�ðHñ 
ñHr'   c               ó„  € V P                   R8X  d$   \        P                  ! RV P                    24      hVP                  R4      '       d   VP	                  R4      V n        V'       d   V ;P                  V,          un        V P                  '       g€   V P                  P                  ! R/ V P                  BRV P
                  /B pVP                  R4      '       g   \        P                  ! R4      h\        VR,          4      V n        RV n         . p\        V P                  4      ^ 8w  d&   VP                  \        V P                  R7      4       Ve   VP                  V4       V P                  P                   ! RRV P
                  RV P                  R,          RV P                  R	VR
VRVRV/VB pRV n         V# )aÏ  Stop the stream and finalize the message.

Args:
    blocks: A list of blocks that will be rendered at the bottom of the finalized message.
    chunks: An array of streaming chunks. Chunks can be markdown text, plan, or task update chunks.
    markdown_text: Accepts message text formatted in markdown. Limit this field to 12,000 characters. This text is
      what will be appended to the message received so far.
    metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you
      post to Slack is accessible to any app or user who is a member of that workspace.
    session_status: The session status to set after stopping the stream.
    **kwargs: Additional arguments passed to the underlying API calls.

Returns:
    SlackResponse from the chat.stopStream API call.

Raises:
    SlackRequestError: If the stream is already completed.

Example:
    ```python
    streamer = client.chat_stream(
        channel="C0123456789",
        thread_ts="1700000001.123456",
        recipient_team_id="T0123456789",
        recipient_user_id="U0123456789",
    )
    streamer.append(markdown_text="**hello wo")
    streamer.append(markdown_text="rld!**")
    streamer.stop()
    ```
rB   z$Cannot stop stream: stream state is r)   r<   z)Failed to stop stream: stream not startedÚin_progress©Útextr   rP   r?   rQ   rR   rD   )r2   rE   rF   rG   r.   r/   r1   r3   r,   Úchat_startStreamr0   r   rH   rN   r   ÚextendÚchat_stopStream)	r5   r>   r?   rP   rQ   rR   r6   ÚresponseÚ	flushingss	   &$$$$$,  r$   ÚstopÚChatStream.stop�   s’  € ðR �;‰;˜+Ô%Ü×%Ò%Ð(LÈTÏ[É[ÈMÐ&ZÓ[Ð[Ø�:‰:�g×ÒØ Ÿ*™* WÓ-ˆDŒKßØ�LŠL˜MÕ)�LØ��ˆØ—|‘|×4Ò4ñ Ø×#Ñ#ñà—k‘kòˆHð —<‘< ×%Ò%Ü×)Ò)Ð*UÓVÐVÜ! (¨4¥.Ó1ˆDŒOØ'ˆDŒKØ.0ˆ	Üˆt�|‰|Ó Ô!Ø×ÑÔ.°D·L±LÔAÔBØÒØ×Ñ˜VÔ$Ø—<‘<×/Ò/ñ 	
Ø—+‘+ð	
à×%Ñ% iÕ0ð	
ð �‰ð	
ð ð		
ð
 ð	
ð ð	
ð *ð	
ð ñ	
ˆð "ˆŒØˆr'   c                ó\   <€ V ^8„  d   QhRS[ S[S[S[S[3,          ,          ,          RS[/# )r   r?   r:   )r   r   r   r   r
   r   )r"   r#   s   "€r$   r%   r&   Ú   s/   ø€ ÷ ñ ¡H©X±e¹DÁ%¸KÕ6HÕ-IÕ$Jð Ñ`mñ r'   c           	     ó*  € . p\        V P                  4      ^ 8w  d&   VP                  \        V P                  R7      4       Ve   VP	                  V4       V P
                  '       gY   V P                  P                  ! R/ V P                  BRV P                  /BVBRV/B pVP                  R4      V n        RV n        MKV P                  P                  ! RRV P                  RV P                  R,          RV P
                  /VBRV/B pRV n        V# )	zFFlush the internal buffer with chunks by making appropriate API calls.rV   r)   r?   r<   rU   r   r*   rD   )rH   r1   rN   r   rY   r3   r,   rX   r0   r/   rG   r2   Úchat_appendStream)r5   r?   r6   Úchunks_to_flushr[   s   &&,  r$   rI   ÚChatStream._flush_bufferÚ   s  € à46ˆÜˆt�|‰|Ó Ô!Ø×"Ñ"Ô#4¸$¿,¹,Ô#GÔHØÒØ×"Ñ" 6Ô*Ø��ˆØ—|‘|×4Ò4ñ Ø×#Ñ#ñà—k‘kñð ñð 'ò	ˆHð 'Ÿl™l¨4Ó0ˆDŒOØ'ˆD�Kà—|‘|×5Ò5ñ Ø—k‘kðà×)Ñ)¨)Õ4ðð —?‘?ðð ñ	ð
 'òˆHð ˆŒØˆr'   )r1   r4   r,   r-   r2   r0   r3   r/   )N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r7   Úpropertyr<   rN   r]   rI   Ú__static_attributes__Ú__classdictcell__)r#   s   @r$   r   r      sÙ   ø‡ € ñð7(ð ,0ð7(ð ,0ð7(ð ,0ð7(ð %)ð7(ð #'ð7(ð #'÷7(ò 7(ðr ÷ó ðð6ð (,ð6ð :>÷	6ò 6ðpHð (,ðHð :>ð	Hð
 FJðHð 59ðHð )-÷Hò H÷T÷ ð r'   r   )rK   r   Útypingr   r   r   r   r   r   Úslack_sdk.errorsÚerrorsrE   Úslack_sdk.models.blocks.blocksr	   Úslack_sdk.models.messages.chunkr
   r   Úslack_sdk.models.metadatar   Úslack_sdk.web.slack_responser   Ú	slack_sdkr   r   rD   r'   r$   Ú<module>rt      s2   ðÛ Û ß G× Gå Ý 0ß DÝ .Ý 6çÝ#÷dó dr'   