Ë
    ñÏjy  ã                  óh   — d Z ddlmZ ddlmZ ddlmZmZmZ ed   Z	 G d„ ded¬	«      Z
dd
„Zdd„Zy)z)Delegated LangSmith access for sandboxes.é    )Úannotations)ÚSequence)ÚAnyÚLiteralÚ	TypedDict©ÚINHERITÚEXPLICITc                  ó&   — e Zd ZU dZded<   ded<   y)ÚAccessDelegationaT  Grant letting code inside a sandbox call the LangSmith API as the creator.

    ``mode`` is ``"INHERIT"`` for everything the creator can do, or
    ``"EXPLICIT"`` for the subset named in ``permissions``. Permissions are a
    ceiling re-checked on every request rather than a snapshot, so access the
    creator loses is lost here too.
    ÚAccessDelegationModeÚmodez	list[str]ÚpermissionsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© ó    úa/var/www/html/gaurav-v2/venv/lib/python3.12/site-packages/langsmith/sandbox/_access_delegation.pyr   r      s   … ñð ÓØÔr   r   F)Útotalc                óV  — t        | t        «      st        d«      ‚| j                  d«      }|dvrt        d«      ‚| j                  d«      }|�+t        |t        «      st        |t
        «      st        d«      ‚|dk(  r|rt        d«      ‚ddiS |st        d	«      ‚d
t        |«      dœS )z>Reject grants the server would refuse, without the round trip.z#access_delegation must be a mappingr   r   z9access_delegation["mode"] must be "INHERIT" or "EXPLICIT"r   z:access_delegation["permissions"] must be a list of stringsr	   zCaccess_delegation["permissions"] is not allowed with mode "INHERIT"zAaccess_delegation["permissions"] is required with mode "EXPLICIT"r
   )r   r   )Ú
isinstanceÚdictÚ
ValueErrorÚgetÚstrr   Úlist)Úvaluer   r   s      r   Ú_validate_access_delegationr!      s»   € ä�eœTÔ"ÜÐ>Ó?Ð?à�9‰9�VÓ€DØÐ*Ñ*ÜÐTÓUÐUà—)‘)˜MÓ*€KØÐÜ�;¤Ô$¬J°{ÄHÔ,MäÐUÓVÐVàˆyÒÙÜØUóð ð ˜	Ð"Ð"áÜØOó
ð 	
ð ¬t°KÓ/@ÑAÐAr   c                óž   — t        | t        «      sy | j                  d«      }|dvry d|i}| j                  d«      }|rt        |«      |d<   |S )Nr   r   r   )r   r   r   r   )r    r   Ú
delegationr   s       r   Ú_access_delegation_from_dictr$   5   sX   € Ü�eœTÔ"ØØ�9‰9�VÓ€DØÐ*Ñ*ØØ$*¨D >€JØ—)‘)˜MÓ*€KÙÜ$(¨Ó$5ˆ
�=Ñ!ØÐr   N)r    r   Úreturnr   )r    r   r%   zAccessDelegation | None)r   Ú
__future__r   Úcollections.abcr   Útypingr   r   r   r   r   r!   r$   r   r   r   Ú<module>r)      s9   ðÙ /å "å $ß *Ñ *àÐ4Ñ5Ð ô
�y¨õ 
óBô:
r   