Ë
    uPêjƒ  ã                   óh   — d Z ddlZ G d„ de«      Z G d„ de«      Z G d„ de«      Z G d	„ d
e«      Zy)zv
A2A Protocol Exceptions.

Custom exception types for A2A protocol operations, following LiteLLM's exception pattern.
é    Nc                   óž   ‡ — e Zd ZdZ	 	 	 	 	 	 	 ddededededz  dej                  dz  dedz  d	edz  d
edz  fˆ fd„Zdefd„Z	defd„Z
ˆ xZS )ÚA2AErrorzm
    Base exception for A2A protocol errors.

    Follows the same pattern as LiteLLM's main exceptions.
    NÚmessageÚstatus_codeÚllm_providerÚmodelÚresponseÚlitellm_debug_infoÚmax_retriesÚnum_retriesc	                 ó  •— || _         d|› �| _        || _        || _        || _        || _        || _        |xs6 t        j                  | j                   t        j                  dd¬«      ¬«      | _
        t        ‰	| �1  | j                  «       y )Nzlitellm.A2AError: ÚPOSTzhttps://litellm.ai)ÚmethodÚurl)r   Úrequest)r   r   r   r   r
   r   r   ÚhttpxÚResponseÚRequestr	   ÚsuperÚ__init__)
Úselfr   r   r   r   r	   r
   r   r   Ú	__class__s
            €úd/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/a2a_protocol/exceptions.pyr   zA2AError.__init__   s„   ø€ ð 'ˆÔØ+¨G¨9Ð5ˆŒØ(ˆÔØˆŒ
Ø"4ˆÔØ&ˆÔØ&ˆÔØ ò 
¤E§N¡NØ×(Ñ(Ü—M‘M¨Ð5IÔJô%
ˆŒô 	‰Ñ˜Ÿ™Õ&ó    Úreturnc                 ó˜   — | j                   }| j                  r|d| j                  › d�z  }| j                  r|d| j                  › �z  }|S )Nz LiteLLM Retried: z timesz, LiteLLM Max Retries: )r   r   r   )r   Ú_messages     r   Ú__str__zA2AError.__str__)   sV   € Ø—<‘<ˆØ×ÒØÐ,¨T×-=Ñ-=Ð,>¸fÐEÑEˆHØ×ÒØÐ1°$×2BÑ2BÐ1CÐDÑDˆHØˆr   c                 ó"   — | j                  «       S )N)r   )r   s    r   Ú__repr__zA2AError.__repr__1   s   € Ø�|‰|‹~Ðr   )iô  Ú	a2a_agentNNNNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstrÚintr   r   r   r   r    Ú__classcell__©r   s   @r   r   r   
   s£   ø„ ñð Ø'Ø Ø*.Ø)-Ø"&Ø"&ñ'àð'ð ð'ð ð	'ð
 �T‰zð'ð —.‘. 4Ñ'ð'ð   $™Jð'ð ˜4‘Zð'ð ˜4‘Zõ'ð0˜ó ð˜#÷ r   r   c                   ó†   ‡ — e Zd ZdZ	 	 	 	 	 	 ddededz  dedz  dej                  dz  dedz  dedz  d	edz  fˆ fd
„Zˆ xZ	S )ÚA2AConnectionErrorzÖ
    Raised when connection to an A2A agent fails.

    This typically occurs when:
    - The agent is unreachable
    - The agent card contains a localhost/internal URL
    - Network issues prevent connection
    Nr   r   r   r	   r
   r   r   c           
      óB   •— || _         t        ‰| �	  |dd|||||¬«       y )Ni÷  r!   )r   r   r   r   r	   r
   r   r   ©r   r   r   )	r   r   r   r   r	   r
   r   r   r   s	           €r   r   zA2AConnectionError.__init__?   s6   ø€ ð ˆŒÜ‰ÑØØØ$ØØØ1Ø#Ø#ð 	õ 		
r   )NNNNNN)
r"   r#   r$   r%   r&   r   r   r'   r   r(   r)   s   @r   r+   r+   5   s‡   ø„ ñð Ø Ø*.Ø)-Ø"&Ø"&ñ
àð
ð �4‰Zð
ð �T‰zð	
ð
 —.‘. 4Ñ'ð
ð   $™Jð
ð ˜4‘Zð
ð ˜4‘Z÷
ñ 
r   r+   c                   ón   ‡ — e Zd ZdZ	 	 	 	 d	dededz  dedz  dej                  dz  dedz  f
ˆ fd„Zˆ xZS )
ÚA2AAgentCardErrorz®
    Raised when there's an issue with the agent card.

    This includes:
    - Failed to fetch agent card
    - Invalid agent card format
    - Missing required fields
    Nr   r   r   r	   r
   c                 ó>   •— || _         t        ‰| �	  |dd|||¬«       y )Ni”  r!   )r   r   r   r   r	   r
   r-   )r   r   r   r   r	   r
   r   s         €r   r   zA2AAgentCardError.__init__`   s0   ø€ ð ˆŒÜ‰ÑØØØ$ØØØ1ð 	õ 	
r   )NNNN)	r"   r#   r$   r%   r&   r   r   r   r(   r)   s   @r   r/   r/   V   se   ø„ ñð Ø Ø*.Ø)-ñ
àð
ð �4‰Zð
ð �T‰zð	
ð
 —.‘. 4Ñ'ð
ð   $™J÷
ñ 
r   r/   c            
       óF   ‡ — e Zd ZdZ	 	 ddedededz  dedz  fˆ fd„Zˆ xZS )	ÚA2ALocalhostURLErrora  
    Raised when an agent card contains a localhost/internal URL.

    Many A2A agents are deployed with agent cards that contain internal URLs
    like "http://0.0.0.0:8001/" or "http://localhost:8000/". This error
    indicates that the URL needs to be corrected and the request should be retried.

    Attributes:
        localhost_url: The localhost/internal URL found in the agent card
        base_url: The public base URL that should be used instead
        original_error: The original connection error that was raised
    NÚlocalhost_urlÚbase_urlÚoriginal_errorr   c                 óf   •— || _         || _        || _        d|› d|› d�}t        ‰| �  |||¬«       y )Nz,Agent card contains localhost/internal URL 'z'. Retrying with base URL 'z'.)r   r   r   )r3   r4   r5   r   r   )r   r3   r4   r5   r   r   r   s         €r   r   zA2ALocalhostURLError.__init__�   sO   ø€ ð +ˆÔØ ˆŒØ,ˆÔà@ÀÀÐOjÐksÐjtÐtvÐwˆÜ‰ÑØØØð 	õ 	
r   )NN)r"   r#   r$   r%   r&   Ú	Exceptionr   r(   r)   s   @r   r2   r2   s   sI   ø„ ñð" ,0Ø ñ
àð
ð ð
ð " DÑ(ð	
ð
 �T‰z÷
ñ 
r   r2   )r%   r   r7   r   r+   r/   r2   © r   r   ú<module>r9      sB   ðñó ô(ˆyô (ôV
˜ô 
ôB
˜ô 
ô:
Ð-õ 
r   