
    i!
                         d dl Z d dlZd dlZd dlmZ d dlmZmZ d dlZd dl	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  edd	      Z G d
 ded      Z G d de j.                        Zy)    N)AsyncIterator)LiteralTypeVar)ClientSession)ElicitationFnTListRootsFnT
LoggingFnTMessageHandlerFnTSamplingFnT)	TypedDictUnpackClientTransportTClientTransport)boundc                       e Zd ZU dZej
                  dz  ed<   edz  ed<   ej                  j                  dz  ed<   edz  ed<   edz  ed<   edz  ed<   edz  ed	<   ej                  j                  dz  ed
<   y)SessionKwargsz8Keyword arguments for the MCP ClientSession constructor.Nread_timeout_secondssampling_callbacksampling_capabilitieslist_roots_callbacklogging_callbackelicitation_callbackmessage_handlerclient_info)__name__
__module____qualname____doc__datetime	timedelta__annotations__r   mcptypesSamplingCapabilityr   r	   r   r
   Implementation     n/Users/bowang/.openclaw/workspace/ChatDev/.venv/lib/python3.12/site-packages/fastmcp/client/transports/base.pyr   r      sw    B",,t33"T))9977$>>%,, 4''(4//&--))D00r'   r   F)totalc                       e Zd ZdZej
                  ej                  dee	   de
e   fd              ZdefdZd Zdedz  fdZd	ej$                  ed
   z  ez  dz  fdZy)r   z
    Abstract base class for different MCP client transport mechanisms.

    A Transport is responsible for establishing and managing connections
    to an MCP server, and providing a ClientSession within an async context.

    session_kwargsreturnc                   K   t         w)a6  
        Establishes a connection and yields an active ClientSession.

        The ClientSession is *not* expected to be initialized in this context manager.

        The session is guaranteed to be valid only within the scope of the
        async context manager. Connection setup and teardown are handled
        within this context.

        Args:
            **session_kwargs: Keyword arguments to pass to the ClientSession
                              constructor (e.g., callbacks, timeouts).

        Yields:
            A mcp.ClientSession instance.
        )NotImplementedError)selfr+   s     r(   connect_sessionzClientTransport.connect_session-   s     * "!s   	c                 6    d| j                   j                   dS )N<>)	__class__r   r/   s    r(   __repr__zClientTransport.__repr__E   s    4>>**+1--r'   c                    K   yw)zClose the transport.Nr&   r5   s    r(   closezClientTransport.closeI   s     s   Nc                      y)z4Get the session ID for this transport, if available.Nr&   r5   s    r(   get_session_idzClientTransport.get_session_idL   s    r'   authoauthc                     |t        d      y )Nz$This transport does not support auth)
ValueError)r/   r;   s     r(   	_set_authzClientTransport._set_authP   s    CDD r'   )r   r   r   r   abcabstractmethod
contextlibasynccontextmanagerr   r   r   r   r0   strr6   r8   r:   httpxAuthr   r?   r&   r'   r(   r   r   $   s     	## &} 5	}	% $ ,.# .#d
 Eejj77+;;cADH Er'   )r@   rB   r   collections.abcr   typingr   r   rE   	mcp.typesr"   r   mcp.client.sessionr   r   r	   r
   r   typing_extensionsr   r   r   r   ABCr   r&   r'   r(   <module>rM      s]    
   ) #     0 -5FG 
1IU 
1.Ecgg .Er'   