§
    @xÅj  ã                   óâ   — d Z ddlZddgfddgfddgfd	d
gfdddgfdg d¢fddgfddgfdg d¢fddgfddgfddgfddgfddgfd d!gfd"d#gfd$d%gfd&d'gfd(d)gfd*d+gfd,d-gfgZd.gZd/„ Zd0„ Zd1„ Zd2„ ZdS )3a�  Detects which AI coding agent (if any) is driving the SDK.

Detection is based on the environment variables that agent harnesses set in
the processes they spawn. The registry mirrors Hugging Face's public
agent-harnesses list so that traffic is attributed under the same agent
identifiers across tools:
https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/agent-harnesses.ts
é    NÚantigravityÚANTIGRAVITY_AGENTzaugment-cliÚAUGMENT_AGENTÚclineÚCLINE_ACTIVEÚcoworkÚCLAUDE_CODE_IS_COWORKzclaude-codeÚ
CLAUDECODEÚCLAUDE_CODEÚcodex)ÚCODEX_SANDBOXÚCODEX_CIÚCODEX_THREAD_IDÚcrushÚCRUSHz
gemini-cliÚ
GEMINI_CLIzgithub-copilot)ÚCOPILOT_MODELÚCOPILOT_ALLOW_ALLÚCOPILOT_GITHUB_TOKENÚgooseÚGOOSE_TERMINALzhermes-agentÚHERMES_SESSION_IDz	kilo-codeÚKILOCODE_FEATUREÚkiroÚAGENT_CONTEXT_OUTÚopenclawÚOPENCLAW_SHELLÚopencodeÚOPENCODE_CLIENTÚpiÚPI_CODING_AGENTÚreplitÚREPL_IDÚtraeÚTRAE_AI_SHELL_IDÚzedÚZED_TERMz
cursor-cliÚCURSOR_AGENTÚcursorÚCURSOR_TRACE_IDÚAI_AGENTc                  óx   — g } t           D ]\  }}|                      |¦  «         Œ| t          t          ¦  «        z   S )z¼Returns every environment variable the registry inspects, including the
    standard AI_AGENT signal. Useful for tests that need to isolate detection
    from the ambient environment.
    )Ú	HARNESSESÚextendÚlistÚSTANDARD_ENV_VARS)Ú	variablesÚ_Úenv_varss      ú=C:\Projects\Historical\venv\Lib\site-packages\runpod/agent.pyÚknown_env_varsr5   0   sG   € ð
 €IÝ ð #ð #‰ˆˆ8Ø×Ò˜Ñ"Ô"Ð"Ð"Ø•tÕ-Ñ.Ô.Ñ.Ð.ó    c                 ó  — |                       ¦   «         } g }| D ]X}t          |¦  «        dk    r nB|                     ¦   «         r-|                     ¦   «         s|dv r|                     |¦  «         ŒYd                     |¦  «        S )z–Keeps only User-Agent-safe characters ([A-Za-z0-9._-]), capped at 64
    characters, so an arbitrary env value cannot produce a malformed header.
    é@   z._-Ú )ÚstripÚlenÚisasciiÚisalnumÚappendÚjoin)ÚvalueÚsafeÚchars      r4   Ú	_sanitizerC   ;   sƒ   € ð �KŠK‰MŒM€EØ€DØð ð ˆÝˆt‰9Œ9˜Š?ˆ?ØˆEØ�<Š<‰>Œ>ð 	˜tŸ|š|™~œ~ð 	°¸°°Ø�KŠK˜ÑÔÐøØ�7Š7�4‰=Œ=Ðr6   c                  óè   — t           D ]7\  } }|D ]/}t          j        |d¦  «                             ¦   «         r| c c S Œ0Œ8t          D ]*}t          t          j        |d¦  «        ¦  «        }|r|c S Œ+dS )z¼Returns the identifier of the AI coding agent driving the SDK, or an
    empty string if none is detected. Specific harness markers take priority
    over the generic AI_AGENT signal.
    r9   )r-   ÚosÚgetenvr:   r0   rC   )Úagent_idr3   Úenvr@   s       r4   ÚdetectrI   I   s¥   € õ
 (ð  ð  Ñˆ�(Øð 	 ð 	 ˆCÝŒy˜˜bÑ!Ô!×'Ò'Ñ)Ô)ð  Ø�����ð ð	 õ !ð ð ˆÝ�"œ) C¨Ñ,Ô,Ñ-Ô-ˆØð 	ØˆLˆLˆLð	ð ˆ2r6   c                  ó2   — t          ¦   «         } | rd| › d�S dS )zÜReturns the " (via <id>)" User-Agent fragment for the detected agent, or
    an empty string when none is detected. Centralizing the fragment here keeps
    the tag format identical across every client's User-Agent.
    z (via ú)r9   )rI   )rG   s    r4   ÚsuffixrL   [   s+   € õ
 ‰xŒx€HØð $Ø#˜Ð#Ð#Ð#Ð#Øˆ2r6   )Ú__doc__rE   r-   r0   r5   rC   rI   rL   © r6   r4   ú<module>rO      sk  ððð ð 
€	€	€	ð Ð(Ð)Ð*Ø�_Ð%Ð&Øˆ~ÐÐØÐ'Ð(Ð)Ø�\ =Ð1Ð2ØÐ>Ð>Ð>Ð?ØˆwˆiÐØ�L�>Ð"ØÐUÐUÐUÐVØÐÐ Ð!ØÐ)Ð*Ð+ØÐ%Ð&Ð'ØÐ!Ð"Ð#ØÐ"Ð#Ð$ØÐ#Ð$Ð%Ø	ÐÐÐØ�	ˆ{ÐØÐ Ð!Ð"Ø
ˆZˆLÐØ�NÐ#Ð$ØÐ!Ð"Ð#ð+€	ð8  �LÐ ð/ð /ð /ðð ð ðð ð ð$ð ð ð ð r6   