o
    0j                     @   s   U d Z ddlZddlmZ dZeedf ed< dZeeeedf ef df ed< d	hd
d eD B Z	dee fddZ
defddZdS )a  Detect whether the process is being invoked by an AI coding agent.

Detection is based on environment variables that AI agents set in their shell
sessions.  ``AI_AGENT`` and ``AGENT`` are treated as a universal standard (any
tool can set it); the remaining checks are tool-specific and ordered by
prevalence.

Inspired by ``@vercel/detect-agent`` (https://github.com/vercel/vercel/tree/main/packages/detect-agent).
    N)Optional)ZAI_AGENTZAGENT._STANDARD_AGENT_VARS)))ZANTIGRAVITY_AGENTZantigravity))ZAUGMENT_AGENTzaugment-cli))ZCLINE_ACTIVEZcline))ZCLAUDE_CODE_IS_COWORKZcowork))Z
CLAUDECODEZCLAUDE_CODEzclaude-code))ZCODEX_SANDBOXZCODEX_CIZCODEX_THREAD_IDZcodex))ZCURSOR_TRACE_IDcursor))ZCURSOR_AGENTz
cursor-cli))Z
GEMINI_CLIgemini))ZCOPILOT_MODELZCOPILOT_ALLOW_ALLZCOPILOT_GITHUB_TOKENzgithub-copilot))ZGOOSE_TERMINALZgoose))ZOPENCLAW_SHELLZopenclaw))ZOPENCODE_CLIENTZopencode))ZPI_CODING_AGENTpi))ZREPL_IDZreplit))Z
ROO_ACTIVEzroo-code))ZTRAE_AI_SHELL_IDZtrae_TOOL_AGENTSZdevinc                 C   s   h | ]\}}|qS  r   ).0_Zagentr   r   d/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/huggingface_hub/utils/_detect_agent.py	<setcomp>7   s    r   returnc                  C   sh   t D ]} tj| d  }|r|tv r|  S d  S qtD ]\}}tdd |D r1|  S q dS )a!  Return the name of the detected AI agent or ``None``.

    Checks environment variables in priority order and returns on the first
    match.  When ``AI_AGENT`` or ``AGENT`` is set, the value is checked against
    known agent names, unrecognized values are returned as ``"unknown"``.
     unknownc                 s   s    | ]	}t j|V  qd S )N)osenvironget)r	   varr   r   r   	<genexpr>G   s    zdetect_agent.<locals>.<genexpr>N)	r   r   r   r   striplower_KNOWN_AGENTSr   any)r   nameZenv_varsZ
agent_namer   r   r   detect_agent:   s   r   c                   C   s
   t  duS )zFReturn ``True`` if the process is being invoked by an AI coding agent.N)r   r   r   r   r   is_agentM   s   
r   )__doc__r   typingr   r   tuplestr__annotations__r   r   r   boolr   r   r   r   r   <module>   s   
$