
    0j	                         d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
mZmZ ed         Z G d dej                  Z G d d	e          ZdS )
z[
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
    N)	AwaitableCallableLiteralOptionalProtocolUnion)MessageActivityInputSentActivityTypingActivityInput)chunkclosec                       e Zd ZdZdS )StreamCancelledErrorzPRaised when a stream operation is attempted after the stream has been cancelled.N)__name__
__module____qualname____doc__     m/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/microsoft_teams/apps/plugins/streamer.pyr   r      s        ZZDr   r   c                   0   e Zd ZdZedefd            Zedefd            Zedefd            Z	edefd            Z
deeged         f         ddfd	Zdeeged         f         ddfd
Zdeeeef         ddfdZdeddfdZddZdee         fdZdS )StreamerProtocolz7Component that can send streamed chunks of an activity.returnc                     dS )z
        Whether the stream has been canceled.
        For example when the user pressed the Stop button or the 2-minute timeout has exceeded.
        Nr   selfs    r   canceledzStreamerProtocol.canceled   s	     	r   c                     dS )z/Whether the final stream message has been sent.Nr   r   s    r   closedzStreamerProtocol.closed   	     	r   c                     dS )z-The total number of chunks queued to be sent.Nr   r   s    r   countzStreamerProtocol.count$   r    r   c                     dS )z
        The sequence number, representing the number of stream activities sent.

        Several chunks can be aggregated into one stream activity
        due to differences in Api rate limits.
        Nr   r   s    r   sequencezStreamerProtocol.sequence)   s	     	r   handlerNc                     dS )z
        Register a handler for chunk events.

        Args:
            handler: Async function that will be called for each chunk activity
        Nr   r   r%   s     r   on_chunkzStreamerProtocol.on_chunk3   	     	r   c                     dS )z
        Register a handler for close events.

        Args:
            handler: Async function that will be called when the stream closes
        Nr   r'   s     r   on_closezStreamerProtocol.on_close<   r)   r   activityc                     dS )z)
        Emit an activity chunk.
        Nr   )r   r,   s     r   emitzStreamerProtocol.emitE   	     	r   textc                     dS )z
        Send status updates before emitting (ex. "Thinking...").

        Args:
            text: The status text to send.
        Nr   )r   r0   s     r   updatezStreamerProtocol.updateK   r)   r   c                     dS )zY
        Discard any text accumulated so far so the final activity is card-only.
        Nr   r   s    r   
clear_textzStreamerProtocol.clear_textT   r/   r   c                 
   K   dS )z#
        Close the stream.
        Nr   r   s    r   r   zStreamerProtocol.closeZ   s       	r   )r   N)r   r   r   r   propertyboolr   r   intr"   r$   r   r
   r   r(   r+   r   r	   r   strr.   r2   r4   r   r   r   r   r   r   r      s       AA$    X     X s    X #    X,4)H I d    ,4)H I d    U#79Lc#QR W[    3 4       Xl3      r   r   )r   asynciotypingr   r   r   r   r   r   microsoft_teams.apir	   r
   r   StreamerEventCancelledErrorr   r   r   r   r   <module>r?      s    
  J J J J J J J J J J J J J J J J W W W W W W W W W W()	 	 	 	 	71 	 	 	J J J J Jx J J J J Jr   