+
    Q(i                         R t ^ RIt^ RIHtHt ^ RIHtHtHtH	t	 ^ RI
t
^ RIHt ]! R4      tR R lt]	R R	 l4       t]	R
R/R R ll4       tR
R/R R lltR# )zAsync utilities for FastMCP.N)	AwaitableCallable)AnyLiteralTypeVaroverload)run_syncTc                b    V ^8  d   QhR\         R\        3,          R\        R\        R\        /# )   fn.argskwargsreturn)r   r   )formats   "c/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/fastmcp/utilities/async_utils.py__annotate__r      s;     P PcP#&P25PP    c                d   "   \        \        P                  ! V .VO5/ VB 4      G Rj  xL
 #  L5i)zCall a sync function in a threadpool to avoid blocking the event loop.

Uses anyio.to_thread.run_sync which properly propagates contextvars,
making this safe for functions that depend on context (like dependency injection).
N)run_sync_in_threadpool	functoolspartial)r   r   r   s   &*,r   call_sync_fn_in_threadpoolr      s-      (	(9(9"(Nt(Nv(NOOOOs   '0.0c                    V ^8  d   QhR\         \        ,          R\        R,          R\        \        \        ,          ,          /# )r   
awaitablesreturn_exceptionsTr   )r   r	   r   listBaseException)r   s   "r   r   r      s8     " "1"t}" 
!m
"r   c                    "   R # 5iN r   r   s   $*r   gatherr"      s
      "   r   .c                v    V ^8  d   QhR\         \        ,          R\        R,          R\        \        ,          /# )r   r   r   Fr   )r   r	   r   r   )r   s   "r   r   r       s2      1u~ 
!Wr   c                    "   R # 5ir   r    r!   s   $*r   r"   r"      s
      r#   Fc          	          V ^8  d   QhR\         \        ,          R\        R\        \        ,          \        \        \        ,          ,          ,          /# )r   r   r   r   )r   r	   boolr   r   )r   s   "r   r   r   &   s=      1 
!WtA%&&r   c                F  a a"   R.\        V4      ,          oR VV 3R llp\        P                  ! 4       ;_uu_4       GRj  xL
 p\        V4       F  w  rEVP	                  W$V4       K  	  RRR4      GRj  xL
  S#  L< L  + GRj  xL 
 '       g   i     S# ; i5i)as  Run awaitables concurrently and return results in order.

Uses anyio TaskGroup for structured concurrency.

Args:
    *awaitables: Awaitables to run concurrently
    return_exceptions: If True, exceptions are returned in results.
                      If False, first exception cancels all and raises.

Returns:
    List of results in the same order as input awaitables.
Nc                J    V ^8  d   QhR\         R\        \        ,          RR/# )r   iawr   N)intr   r	   )r   s   "r   r   gather.<locals>.__annotate__8   s%       1 $ r   c                 ~   <"    VG R j  xL
 SV &   R #  L	  \          d   pS'       d   TST &    R p?R # h R p?ii ; i5ir   )r   )r*   r+   eresultsr   s   && r   run_atgather.<locals>.run_at8   s6     	!GAJ 	 
		s0   =  = :5=5:=)lenanyiocreate_task_group	enumerate
start_soon)r   r   r1   tgr*   r+   r0   s   d*    @r   r"   r"   &   s{       )-vJ'?G  &&(((Bz*EAMM&R( + )( N	 )((( NsM   ?B!B B!'B.B!9B:B!B!B	
B
B	B		B!)__doc__r   collections.abcr   r   typingr   r   r   r   r4   anyio.to_threadr   r   r	   r   r"   r    r   r   <module>r=      sk    "  / 2 2  >CLP 
" 
" 
(+ 
# r   