+
    ~j                        ^ RI Ht ^ RIt^ RIt^ RIHtHt ^ RIt^RIH	t	 ]. ]P                  3,          t]P                  ]R,          ,          ! R4      tR R ltR R	 ltR
 R lt]P"                  R R l4       tR# )    )annotationsN)AsyncIteratorCallable)loggeragent_http_sessionc                   V ^8  d   QhRR/# )   return_ClientFactory )formats   "v/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/livekit/agents/utils/http_context.py__annotate__r      s      .     c                 H   a R oR V3R llp \         P                  V 4       V # )Nc                   V ^8  d   QhRR/# r	   r
   zaiohttp.ClientSessionr   )r   s   "r   r   &_new_session_ctx.<locals>.__annotate__   s      / r   c                 (  < Se   SP                   '       dh   \        P                  ! R4       ^RIHp   V ! 4       P
                  P                  p\        P                  ! ^2^xR7      p\        P                  ! WR7      oS#   \         d    R p L@i ; i)Nz-http_session(): creating a new httpclient ctx)get_job_context)limit_per_hostkeepalive_timeout)proxy	connector)closedr   debugjobr   proc
http_proxyRuntimeErroraiohttpTCPConnectorClientSession)r   r   r   	g_sessions      r   _new_session&_new_session_ctx.<locals>._new_session   s    	 0 0 0LLHI-",.33>>
  ,,!"%I  --JTI   "!
"s   B BB)_ContextVarset)r%   r$   s    @r   _new_session_ctxr)      s&    .2I & OOL!r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   )   s      + r   c                 X    \         P                  R4      p V f   \        R4      hV ! 4       # )zOptional utility function to avoid having to manually manage an aiohttp.ClientSession lifetime.
On job processes, this http session will be bound to the main event loop.
Na  Attempted to use an http session outside of a job context. This is probably because you are trying to use a plugin without using the agent worker api. If you're running plugins outside the agent worker (e.g. tests or scripts), wrap your code with `async with livekit.agents.utils.http_context.open(): ...`. Alternatively, create your own aiohttp.ClientSession, pass it into the plugin constructor as a kwarg, and manage its lifecycle.)r'   getr    vals    r   http_sessionr/   )   s3    
 //$
C
{N
 	
 5Lr   c                   V ^8  d   QhRR/# )r	   r
   Noner   )r   s   "r   r   r   9   s      t r   c                    "   \         P                  R 4      p V eK   \        P                  ! R4       V ! 4       P	                  4       G R j  xL
  \         P                  R 4       R # R #  L5i)Nz*http_session(): closing the httpclient ctx)r'   r,   r   r   closer(   r-   s    r   _close_http_ctxr4   9   sJ     
//$
C
ABekkm s   AA*
A(A*c                   V ^8  d   QhRR/# )r	   r
   z$AsyncIterator[aiohttp.ClientSession]r   )r   s   "r   r   r   B   s        8  r   c                   "   \         P                  R4      e   \         P                  4       ! 4       5x  R# \        4       p  V ! 4       5x  \        4       G Rj  xL
  R#  L  \        4       G Rj  xL 
  i ; i5i)uv  Bind a process-local aiohttp.ClientSession to the current asyncio context.

Use this when running plugins outside a job worker (e.g. tests, scripts,
notebooks) so that ``http_session()`` returns a usable session inside the
``async with`` block. The session is closed and the context is reset on exit.

If an http session context is already bound (nested call, or already set up
by the worker), this is a no-op pass-through — the existing session is
yielded and left untouched on exit.

Example::

    async with utils.http_context.open():
        async with AgentSession() as session:
            await session.start(MyAgent())
N)r'   r,   r)   r4   )factorys    r   openr8   A   sU     $ t(oo!! G ios6   A A;
A# A;A!A;#A81A42A88A;)
__future__r   
contextlibcontextvarscollections.abcr   r   r!   logr   r#   r   
ContextVarr'   r)   r/   r4   asynccontextmanagerr8   r   r   r   <module>r@      sp    "   3  "g3334$$^d%:;<PQ4      r   