+
    jHàj;  ã                   óV   € R t RtR R ltR R ltR R ltR R ltR	 R
 ltR R ltR# )a¾  One resolved-route identity for launch-route gates.

Two launch routes are the same route when the runtime resolver would send them to the same
endpoint: compare what it resolves (canonical provider, configured named entry, effective
URL), never raw spellings. ``ollama``/``vllm`` resolve to ``custom``, ``deep-infra`` to
``deepinfra``, and a configured ``providers:``/``custom_providers`` name (or its
``custom:<name>`` spelling) to that entry.
c                óJ   € V ^8„  d   QhR\         R\        R\        R,          /# )é   ÚnameÚconfigÚreturnN©ÚstrÚdict)Úformats   "ÚC/home/ubuntu/.hermes/hermes-agent/gateway/session_route_identity.pyÚ__annotate__r      s*   € ÷ Vñ V”sð V¤Dð V¬T°D­[ñ Vó    c                 ó"   € ^ RI Hp V! WRR7      # )é    )Ú_get_named_custom_providerF)r   Úresolve_credentials)Ú"hermes_cli.runtime_provider_customr   )r   r   r   s   && r   Ú_named_entryr      s   € ÝMÙ% dÈuÔUÐUr   c                ó0   € V ^8„  d   QhR\         R\         /# )r   r   r   )r   )r
   s   "r   r   r      s   € ÷ ñ ”Sð œSñ r   c                 ó^   € ^ RI Hp V! V 4      p^ RIHpHp  V! V4      #   T d    Tu # i ; i)r   )Únormalize_provider)Ú	AuthErrorÚresolve_provider)Úhermes_cli.modelsr   Úhermes_cli.authr   r   )r   r   Ú	canonicalr   r   s   &    r   Ú
_canonicalr      s7   € Ý4Ù" 4Ó(€Iß;ðÙ 	Ó*Ð*øØô ØÒðús   ˜   	,«,c                ó<   € V ^8„  d   QhR\         R\        R\         /# )r   Úidentityr   r   r   )r
   s   "r   r   r   %   s!   € ÷ -ñ -¤3ð -´ð -¼ñ -r   c                ó  € \        T ;'       g    R4      P                  4       P                  4       p V P                  R4      '       d   \	        W4      '       g   R# V P                  R^4      ^,          P                  4       # )aÇ  The bare config key of the configured entry behind a ``custom:<key>`` identity, else ``''``.

Raw provider resolution defers a bare name that is a canonical built-in to the built-in, so a
``providers:`` entry keyed ``deepseek`` is reachable only through its ``custom:`` spelling. Only
that key names a keyed entry: its display name may be a real built-in's slug (``name: OpenRouter``
on ``providers.work``), and a pick of that built-in is not this endpoint (#140107). A legacy
``custom_providers:`` entry has no key, so its normalized display name is its identity and its
key here (``custom_provider_slug``): ``name: OpenRouter`` there answers ``openrouter``, as
Desktop's ``customDefaultSupersedesPick`` does.
Ú zcustom:Ú:)r   ÚstripÚlowerÚ
startswithr   Úsplit)r   r   s   &&r   Úconfigured_entry_keyr&   %   sc   € ô �8—>�>˜rÓ"×(Ñ(Ó*×0Ñ0Ó2€HØ×Ñ˜y×)Ò)´¸h×1OÒ1OÙØ�>‰>˜#˜qÓ! !Õ$×*Ñ*Ó,Ð,r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   r   r   )r	   r   )r
   s   "r   r   r   6   s   € ÷ +ñ +¤4ð +¬Cñ +r   c                óÀ  € \        V P                  R4      \        4      '       d%   \        V P                  R4      ;'       g    / 4      M/ p\        VP                  R4      ;'       g    R4      P	                  4       P                  4       R9   d>   \        VP                  R4      ;'       g    R4      P	                  4       '       d   RVR&   \        W4      ^ ,          # )u¯   The identity the profile's own ``model`` block resolves to â€” ``custom`` for an endpoint with
no provider named (or ``auto``), which already routes to ``custom`` at that URL.ÚmodelÚproviderr    Úbase_urlÚcustom©r    Úauto)Ú
isinstanceÚgetr	   r   r"   r#   Úresolved_route)r   Úhelds   & r   Úprofile_route_identityr3   6   s§   € ô /9¸¿¹ÀGÓ9LÌd×.SÒ.SŒ4�—
‘
˜7Ó#×)Ð) rÔ*ÐY[€DÜ
ˆ4�8‰8�JÓ×%Ð% 2Ó&×,Ñ,Ó.×4Ñ4Ó6¸,ÔFÌ3ÈtÏxÉxÐXbÓOc×OiÐOiÐgiÓKj×KpÑKp×KrÒKrØ#ˆˆZÑÜ˜$Ó'¨Õ*Ð*r   c                ó^   € V ^8„  d   QhR\         R\         R\        \        \        3,          /# )r   Ú	model_cfgr   r   )r	   Útupler   )r
   s   "r   r   r   ?   s)   € ÷ *ñ *œdð *¬Dð *´U¼3Ä¸8µ_ñ *r   c                óà  € \        V \        4      '       d   T M/ p \        V\        4      '       d   TM/ p\        V P                  R4      ;'       g    R4      P	                  4       P                  4       pVR9   d   R	# \        V P                  R4      ;'       g    R4      P	                  4       p\        W!4      pV'       d‘   ^ RIHp T! \        VP                  R4      ;'       g    R4      \        VP                  R4      ;'       g    R4      4      pT;'       g3    \        VP                  R4      ;'       g    R4      P	                  4       pM\        V4      pWcP                  R4      3# )
zR``(provider_identity, effective_base_url)`` the runtime resolves ``model_cfg`` to.r*   r    r+   )Úcustom_provider_slugr   Úprovider_keyÚ/r-   )r.   r    )r/   r	   r   r0   r"   r#   r   Úhermes_cli.providersr8   r   Úrstrip)r5   r   r   r+   Úentryr8   r   s   &&     r   r1   r1   ?   s  € ä'¨	´4×8Ò8‘	¸b€IÜ! &¬$×/Ò/‰V°R€FÜˆy�}‰}˜ZÓ(×.Ð.¨BÓ/×5Ñ5Ó7×=Ñ=Ó?€DØˆ|ÔØÐÜ�9—=‘= Ó,×2Ð2°Ó3×9Ñ9Ó;€HÜ˜Ó&€EßÝ=Ù'¬¨E¯I©I°fÓ,=×,CÐ,CÀÓ(DÄcÈ%Ï)É)ÐTbÓJc×JiÐJiÐgiÓFjÓkˆØ×GÐGœs 5§9¡9¨ZÓ#8×#>Ð#>¸BÓ?×EÑEÓG‰ä˜dÓ#ˆØ—_‘_ SÓ)Ð)Ð)r   c                óH   € V ^8„  d   QhR\         R\         R\         R\        /# )r   Úa_cfgÚb_cfgr   r   )r	   Úbool)r
   s   "r   r   r   Q   s(   € ÷ 	ñ 	”dð 	¤4ð 	´ð 	¼$ñ 	r   c                ó    € \        W4      w  r4\        W4      w  rVRW539   d   R# V'       g	   V'       d   ^ RIHp V! V4      V! V4      8H  # W58H  # )zXTrue when both configs resolve to one endpoint; ``auto`` on either side keeps the route.r.   T)Únormalize_route_base_url)r1   Úhermes_cli.route_identityrC   )r?   r@   r   Úa_idÚa_urlÚb_idÚb_urlrC   s   &&&     r   Ú
same_routerI   Q   sM   € ä  Ó/�K€DÜ  Ó/�K€DØ�$�ÔÙß—ÝFÙ'¨Ó.Ñ2JÈ5Ó2QÑQÐQØ‰<Ðr   N)	r*   r+   Úapi_modeÚcontext_lengthÚapi_keyÚapiÚapi_key_fromÚkey_envÚapi_key_env)Ú__doc__ÚROUTE_BOUND_KEYSr   r   r&   r3   r1   rI   © r   r   Ú<module>rT      s2   ðñð"PÐ õVõ
õ-õ"+õ*÷$	r   