Ë
    Z²jÕ  ã                   ó¾   — 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eD � �ch c]  \  } }|’Œ	 c}} z  Z	d
ee   fd„Z
d
efd„Zyc c}} w )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)ÚAI_AGENTÚAGENT.Ú_STANDARD_AGENT_VARS)))ÚANTIGRAVITY_AGENTÚantigravity))ÚAUGMENT_AGENTzaugment-cli))ÚCLINE_ACTIVEÚcline))ÚCLAUDE_CODE_IS_COWORKÚcowork))Ú
CLAUDECODEÚCLAUDE_CODEzclaude-code))ÚCODEX_SANDBOXÚCODEX_CIÚCODEX_THREAD_IDÚcodex))ÚCURSOR_TRACE_IDÚcursor))ÚCURSOR_AGENTz
cursor-cli))Ú
GEMINI_CLIÚgemini))ÚCOPILOT_MODELÚCOPILOT_ALLOW_ALLÚCOPILOT_GITHUB_TOKENzgithub-copilot))ÚGOOSE_TERMINALÚgoose))ÚOPENCLAW_SHELLÚopenclaw))ÚOPENCODE_CLIENTÚopencode))ÚPI_CODING_AGENTÚpi))ÚREPL_IDÚreplit))Ú
ROO_ACTIVEzroo-code))ÚTRAE_AI_SHELL_IDÚtraeÚ_TOOL_AGENTSÚdevinÚreturnc                  óþ   — t         D ]P  } t        j                  j                  | d«      j	                  «       j                  «       }|sŒB|t        v r|c S dc S  t        D ]  \  }}t        d„ |D «       «      sŒ|c S  y)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              3   óZ   K  — | ]#  }t         j                  j                  |«      –— Œ% y ­w)N)ÚosÚenvironÚget)Ú.0Úvars     úb/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/huggingface_hub/utils/_detect_agent.pyú	<genexpr>zdetect_agent.<locals>.<genexpr>G   s   è ø€ Ò7 sŒr�z‰z�~‰~˜c×"Ñ7ùs   ‚)+N)	r   r0   r1   r2   ÚstripÚlowerÚ_KNOWN_AGENTSr)   Úany)r4   ÚnameÚenv_varsÚ
agent_names       r5   Údetect_agentr>   :   s   € ô $ò @ˆÜ�z‰z�~‰~˜c 2Ó&×,Ñ,Ó.×4Ñ4Ó6ˆÚØ¤=Ñ0�4Ò?°iÒ?ð@ô
 !-ò Ñˆ�*ÜÑ7¨hÔ7Õ7ØÒðð ó    c                  ó   — t        «       duS )zFReturn ``True`` if the process is being invoked by an AI coding agent.N)r>   © r?   r5   Úis_agentrB   M   s   € ä‹> Ð%Ð%r?   )Ú__doc__r0   Útypingr   r   ÚtupleÚstrÚ__annotations__r)   r9   r>   ÚboolrB   )Ú_Úagents   00r5   ú<module>rK      s�   ðòó 
Ý ð )>Ð �e˜C ˜H‘oÓ =ð9€ˆe�E˜%  S ™/¨3Ð.Ñ/°Ð4Ñ5ó ð( �	°<×@¡x q¨%šUÓ@Ñ@€ð�h˜s‘mó ð&&�$ô &ùó- As   ·A