+
    iHàj:  ã                  ót   € R t ^ RIHt ^ RIt^ RIHtHtHt ]P                  ! R4      t	R R lt
R tR R	 ltR# )
zXInit-time fallback chain: entry normalization, chain setup, and the fallback's api_mode.)ÚannotationsN)ÚAnyÚDictÚListÚ	run_agentc               ó   € V ^8„  d   QhRR/# )é   Úreturnzlist[dict[str, Any]]© )Úformats   "Ú>/home/ubuntu/.hermes/hermes-agent/agent/agent_init_fallback.pyÚ__annotate__r      s   € ÷ ñ Ð)=ñ ó    c                ó&  € \        V \        4      '       d   V .p \        V \        4      '       g   . # V  Uu. uFO  p\        V\        4      '       g   K  VP                  R4      '       g   K4  VP                  R4      '       g   KM  VNKQ  	  up# u upi )zNNormalize legacy single-dict ``fallback_model`` / list ``fallback_providers``.ÚproviderÚmodel)Ú
isinstanceÚdictÚlistÚget)Úfallback_modelÚfs   & r   Ú_fallback_entriesr      ss   € ä�.¤$×'Ò'Ø(Ð)ˆÜ�n¤d×+Ò+Øˆ	á!óÙ!ˆa¤Z°´4×%8Œ¸Q¿U¹UÀ:×=NŒÐST×SXÑSXÐY`×Sa�ˆ‘>ñð ùò s   ¶BÁBÁ,BÂBc                ó  € ^ RI Hp V! V 4       \        V4      V n        ^ V n        \        V RR4      V n        V P                  '       d   V P                  ^ ,          MRV n        V P                  pV'       d�   V P                  '       g|   V Uu. uF  qDR,           RVR,           R2NK  	  pp\        V4      ^8X  d   \        R	V^ ,           24       R# \        R
\        V4       R2RP                  V4      ,           4       R# R# R# u upi )é    )Úsync_credential_pool_entry_idÚ_fallback_activatedFNr   z (r   Ú)u   ðŸ”„ Fallback model: u   ðŸ”„ Fallback chain (z providers): u    â†’ )Úagent.agent_runtime_helpersr   r   Ú_fallback_chainÚ_fallback_indexÚgetattrr   Ú_fallback_modelÚ
quiet_modeÚlenÚprintÚjoin)Úagentr   r   Úchainr   Úlabelss   &&    r   Ú_init_fallback_chainr*      sè   € õ JÙ! %Ô(ô .¨nÓ=€EÔØ€EÔÜ '¨Ð/DÀeÓ L€EÔà8=×8M×8MÐ8M˜E×1Ñ1°!Ö4ÐSW€EÔØ×!Ñ!€Eß�U×%×%Ð%Ù=BÓC¹U¸�w•Z�L  1 Z¥= /°Ó3¹UˆÐCÜˆu‹:˜Œ?ÜÐ)¨&°­)¨Ð5Ö6äÐ)¬#¨e«*¨°]ÐCÀgÇlÁlÐSYÓFZÕZÖ[ñ &�uùÚCs   ÂD	c               ó   € V ^8„  d   QhRR/# )r   r	   ÚNoner
   )r   s   "r   r   r   +   s   € ÷ 'ñ '¸$ñ 'r   c                óZ  € ^ RI Hp  T! Y P                  V P                  \	        \        VRR4      ;'       g    R4      4      V n        \        T R4      '       d   T P                  P                  4        R# R#   \         d'    \        P                  RT P                  RR7        R# i ; i)	aK  Give an init-time fallback its own api_mode instead of the unreachable primary's.

A Nous primary configured with ``api_mode: codex_responses`` otherwise leaves a Copilot
gpt-5-mini fallback on the Responses API, which silently drops reasoning content (#46527).
The per-turn path (``try_activate_fallback``) already recomputes via
``_fallback_api_mode_resolved``; this keeps init in agreement, and runs before the
``_primary_runtime`` snapshot so ``restore_primary_runtime`` replays the recomputed mode.
A detection failure keeps the primary's mode and never blocks the fallback itself.
)Ú_fallback_api_mode_resolvedÚbase_urlÚ z3Init-time fallback api_mode detection failed for %sT)Úexc_infoNÚ_transport_cache)Úagent.chat_completion_helpersr.   r   r   Ústrr!   Úapi_modeÚ	ExceptionÚloggerÚdebugÚhasattrr2   Úclear)r'   Ú	fb_clientr.   s   && r   Ú recompute_init_fallback_api_moder<   +   s”   € õ JðÙ4Ø—>‘> 5§;¡;´´G¸IÀzÐSUÓ4V×4\Ð4\ÐZ\Ó0]ó_ˆŒô
 ˆuÐ(×)Ò)Ø×Ñ×$Ñ$Ö&ñ *øô ô Ü�‰ÐJÈEÏNÉNÐeiˆÔjÚðús   ˆAA9 Á9-B*Â)B*)Ú__doc__Ú
__future__r   ÚloggingÚtypingr   r   r   Ú	getLoggerr7   r   r*   r<   r
   r   r   Ú<module>rB      s4   ðÙ ^å "ã ß "Ñ "à	×	Ò	˜;Ó	'€õò\÷*'r   