+
    iHàjâ+  ã                  ó  € R t ^ RIHt ^ RIt^ RIt^ RIHtHtHtH	t	 ]P                  ! ]4      tRtRt. RO]O5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 R ltR R lt ! R R4      tR R ltR R ltR# )a½  Per-turn model route for voice chat: ``auxiliary.voice_chat``.

A voice turn (CLI voice input, a Desktop/TUI voice conversation, a messaging voice note) can run
on a faster model than the session's main one. The route binds at the end of turn setup, after the
system prompt and session row were built for the main model and after preflight compression
judged the history against the main model's window, and is undone before post-turn work (memory
sync, background review) so nothing outside the turn sees it. A turn whose request would not fit
under the voice model's compression threshold at turn start runs on the main model instead, so
switching to voice never compacts the conversation to suit a smaller model.

Surfaces mark the next turn with ``agent._voice_turn_pending = True``; it is consumed here. GPT-Live
delegations are not voice turns in this sense: the live model already owns the voice layer and
delegates real work to the session's model.
)ÚannotationsN)ÚAnyÚDictÚListÚOptionalÚ
voice_chatc               ó$   € V ^8„  d   QhRRRRRR/# )é   Úagentr   Úcfgúdict[str, Any]ÚreturnúOptional[dict[str, Any]]© )Úformats   "Ú;/home/ubuntu/.hermes/hermes-agent/agent/voice_turn_route.pyÚ__annotate__r   %   s'   € ÷ Uñ U˜ð U >ð UÐ6Nñ Uó    c                ó\  € \        VP                  R4      ;'       g    R4      P                  4       P                  4       p\        VP                  R4      ;'       g    R4      P                  4       p\        VP                  R4      ;'       g    R4      P                  4       pVR9   dS   V'       d   RpMGV'       d>   \        \	        V RR4      ;'       g    R4      P                  4       P                  4       pMR# V'       g   ^ RIHp V! VRR	7      ;'       g    RpV'       d	   V'       g   R# V'       gE   T\        V P                  ;'       g    R4      P                  4       8X  d   W0P                  8X  d   R# ^ R
I	H
p T! Y$;'       g    R4      w  r$/ VCRTRTRT;'       g    R/C# )zVThe entry to bind, or None when the slot follows the main model (``auto`` + no model).ÚproviderÚ ÚmodelÚbase_urlÚcustomN)Ú_get_aux_model_for_providerT)Úprefer_fast)Úexpand_direct_api_alias)r   ÚautoÚmain)ÚstrÚgetÚstripÚlowerÚgetattrÚagent.auxiliary_clientr   r   r   Ú"hermes_cli.runtime_provider_customr   )r
   r   r   r   r   r   r   s   &&     r   Ú_route_targetr&   %   sH  € ä�3—7‘7˜:Ó&×,Ð,¨"Ó-×3Ñ3Ó5×;Ñ;Ó=€HÜ�—‘˜Ó ×&Ð& BÓ'×-Ñ-Ó/€EÜ�3—7‘7˜:Ó&×,Ð,¨"Ó-×3Ñ3Ó5€HØÐ'Ô'ßØ‰HßÜœ7 5¨*°bÓ9×?Ð?¸RÓ@×FÑFÓH×NÑNÓP‰HáßåFÙ+¨HÀ$ÔG×MÐMÈ2ˆßŸÙß˜¤C¨¯©×(<Ð(<¸"Ó$=×$CÑ$CÓ$EÔEÈ%×S^ÑS^ÔJ^ÙåJÙ0°×;KÐ;KÀtÓLÑ€HØTˆcÐT�:˜x¨°%¸ÀXÇ^À^ÐQSÑTÐTr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r	   r
   r   Úmessagesúlist[dict[str, Any]]Úsystem_promptr   r   Úboolr   )r   s   "r   r   r   ?   s)   € ÷ ñ �ð Ð 4ð ÀSð ÈTñ r   c           	     óÀ   € ^ RI Hp \        \        V RR4      R^ 4      ;'       g    ^ pV'       g   R# T! Y;'       g    R\        V RR4      ;'       g    RR7      pWT8  # )	é    )Úestimate_request_tokens_roughÚcontext_compressorNÚthreshold_tokensTr   Útools)r*   r1   )Úagent.model_metadatar.   r#   )r
   r(   r*   r.   ÚlimitÚtokenss   &&&   r   Ú_fitsr5   ?   sa   € ÝBÜ”G˜EÐ#7¸Ó>Ð@RÐTUÓV×[Ð[ÐZ[€EßÙÙ*Ø× 3Ð 3°¼7À5È'ÐSWÓ;X×;`Ð;`Ð\`ôb€Fà‰>Ðr   c               ó    € V ^8„  d   QhRRRR/# )r	   r
   r   r   zOptional[str]r   )r   s   "r   r   r   I   s   € ÷ ñ ˜#ð  -ñ r   c                óæ  € ^ RI HpHp RR/pV! W0P                  V P                  V P
                  \        4      VJd   V# V P                  R8X  dk   ^ RIH	p ^ RI
Hp V! V 4      pV! V P
                  RV P                  RV P                  R	VP                  R
VP                  RRRRR//4      w  rxVR9   d   R# T# V P                  R8X  d&   ^ RIHp	Hp
 V
! V P
                  V	4      '       d   V# R# R# )a  The weakest enabled level the active route accepts when it cannot switch reasoning OFF, else
None (OFF goes on the wire as configured). Static knowledge only; a route that 400s on the disable
anyway is learned by turn_recovery and remembered by ``end_voice_turn_route``.)ÚREASONING_FLOOR_EFFORTÚknown_reasoning_floorÚenabledFÚcodex_responses)Úclassify_responses_route)Ú_resolve_reasoningr   r   Úis_codex_backendÚis_xai_responsesÚreasoning_configTÚeffortÚnoneNÚanthropic_messages)Ú%_MANDATORY_THINKING_CLAUDE_SUBSTRINGSÚ_model_matches)NrB   )Úagent.auxiliary_reasoning_floorr8   r9   r   r   r   ÚTASKÚapi_modeÚagent.codex_responses_adapterr<   Úagent.transports.codexr=   r>   r?   Úagent.anthropic_adapterrD   rE   )r
   r8   r9   Úoffr<   r=   ÚrouterA   Ú_rD   rE   s   &          r   Ú_lowest_effortrO   I   sî   € ÷ ^Ø�eÐ
€CÙ˜S§.¡.°%·.±.À%Ç+Á+ÌtÓTÐ\_Ó_Ø%Ð%Ø‡~�~Ð*Ô*ÝJÝ=Ù(¨Ó/ˆñ ' u§{¡{Ø˜Ÿ™¨
°E·N±NÐDVÐX]×XnÑXnØ × 6Ñ 6Ð8JÈYÐX\Ð^fÐhnÐLoð5qó r‰	ˆð  Ô/ˆtÐ;°VÐ;Ø‡~�~Ð-Ô-ßaá)7¸¿¹ÐEj×)kÒ)kÐ%ÐuÐquÐuÙr   c               ó$   € V ^8„  d   QhRRRRRR/# )r	   r
   r   rA   r   r   r   )r   s   "r   r   r   b   s(   € ÷ Eñ E˜Cð EÐ)Að EÐF^ñ Er   c                ó’   € \        V\        4      '       d   VP                  R4      RJ g   V# \        V 4      pV'       d   RRRV/# T# )zi``effort`` for the active route: reasoning OFF becomes the lowest valid level where OFF is
not an option.r:   FTrA   )Ú
isinstanceÚdictr    rO   )r
   rA   Úlowests   && r   Ú_voice_reasoningrU   b   sF   € ô �vœt×$Ò$¨¯©°IÓ)>À%Ó)GØˆÜ˜EÓ"€Fß28ˆI�t˜X vÐ.ÐD¸fÐDr   c               ó    € V ^8„  d   QhRRRR/# )r	   r
   r   r   r   r   )r   s   "r   r   r   k   s   € ÷ ñ �Cð ˜Nñ r   c           
     ó€   € ^ RI Hp RV! W P                  4      /\         Uu/ uF  q"\	        WR4      bK  	  upC# u upi )r-   )Ú_build_primary_runtime_snapshotÚsnapshotN)Úagent.primary_runtime_snapshotrX   rH   Ú_EXTRA_FIELDSr#   )r
   rX   Únames   &  r   Ú_capturer]   k   sB   € ÝNàÑ3°E¿>¹>ÓJðå8EÓ
F¹°”˜ dÓ+Ò+¹Ñ
Fðð ùâ
Fs   ¢;c               ó$   € V ^8„  d   QhRRRRRR/# ©r	   r
   r   Ústater   r   ÚNoner   )r   s   "r   r   r   s   s!   € ÷ *ñ *�cð * .ð *°Tñ *r   c                ón   € ^ RI Hp V! WR,          4       \         F  p\        WW,          4       K  	  R# )r-   )Úreinstall_runtime_snapshotrY   N)Úagent.route_bindingrc   r[   Úsetattr)r
   r`   rc   r\   s   &&  r   Ú
_reinstallrf   s   s(   € Ý>Ù˜u¨JÕ&7Ô8ßˆÜ�˜U�[Ö)ó r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r	   r
   r   Útargetr   Úreasonr   r   ra   r   )r   s   "r   r   r   z   s(   € ÷ 	&ñ 	&�cð 	& >ð 	&¸3ð 	&À4ñ 	&r   c                óX  € \         P                  R \        VR,          VR,          W P                  V P                  4       \        V RR4      '       d   R# RV n        \        V RR4      p\        V4      '       d0   V! RVR,           R	VR,           R
V RV P                   R2	4       R# R# )zCauxiliary.%s route %s/%s not used: %s; the voice turn runs on %s/%sr   r   Ú_warned_voice_routeFNTÚ_emit_warningu   âš  Voice chat model z via z unavailable (z	); using Ú.)ÚloggerÚwarningrG   r   r   r#   rk   Úcallable)r
   rh   ri   Úemits   &&& r   Ú
_warn_oncerr   z   s¦   € Ü
‡N�NÐXÜ˜ 
Õ+¨V°G­_¸fÇnÁnÐV[×VaÑVaôcäˆuÐ+¨U×3Ò3ÙØ $€EÔÜ�5˜/¨4Ó0€DÜ�‡~‚~ÙÐ$ V¨G¥_Ð$5°U¸6À*Õ;MÐ:NÈnÐ]cÐ\dð eØ—k‘k�] !ð%ö 	&ñ r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r	   r
   r   r(   r)   r*   r   r   )r   s   "r   r   r   †   s+   € ÷ &8ñ &8 #ð &8Ð1Eð &8ÐVYð &8Ð^añ &8r   c                óT  € \        V RR4      '       g   V# RV n        ^ RIHp ^ RIHp V! \        4      pV! VP                  R4      4      p\        W4      pVf   Vf   V# R\        P                  ! \        V RR4      4      /pW€n        VEe   TP                  \        V 4      4       Rp	 ^ R	IHp
 V
! WVR
,          VR,          4      f   Rp	T	'       g   \+        YT4      '       g   Rp	T	'       d>   \-        Y4       \/        YT	4       RTR,          /T n        T P0                  ;'       g    T# ^ RIHp T! Y P6                  T P8                  4       \:         F  p\=        YR4       K  	  \        T n        \@        PC                  RT P6                  T P8                  4       Ve   \E        W4      V n#        V P0                  ;'       g    T#   \          dR   p\#        T4      '       d!   \#        T4      P%                  4       ^ ,          M\'        T4      P(                  p	 Rp?ELTRp?ii ; i)zWBind the voice route for a marked turn; returns the system prompt the turn should send.Ú_voice_turn_pendingF)Ú_get_auxiliary_task_config)Úparse_reasoning_effortÚreasoning_effortNr@   r   )Úbind_route_entryr   r   zprovider not configuredz2the conversation is larger than its context window)Úrewrite_prompt_model_identityzVoice turn routed to %s (%s))$r#   ru   Úagent.auxiliary_task_configrv   Úhermes_constantsrw   rG   r    r&   ÚcopyÚdeepcopyÚ_voice_route_stateÚupdater]   rd   ry   Ú	Exceptionr   Ú
splitlinesÚtypeÚ__name__r5   rf   rr   Ú_cached_system_promptÚagent.chat_completion_helpersrz   r   r   Ú_REJECTION_FIELDSre   Ú_turn_route_taskrn   ÚinforU   r@   )r
   r(   r*   rv   rw   r   rA   rh   r`   ri   ry   Úexcrz   r\   s   &&&           r   Úbegin_voice_turn_router‹   †   sÄ  € ä�5Ð/°×7Ò7ØÐØ %€EÔÝFÝ7Ù
$¤TÓ
*€CÙ# C§G¡GÐ,>Ó$?Ó@€FÜ˜5Ó&€FØ‚~˜&š.ØÐØ/´·²¼wÀuÐN`ÐbfÓ?gÓ1hÐi€EØ$ÔØÓØ�‰”X˜e“_Ô%Øˆð	RÝ<Ù ¨v°jÕ/AÀ6È'Å?ÓSÒ[Ø2�÷ œe E°]×CÒCØIˆFßÜ�uÔ$Ü�u fÔ-Ø(:¸EÐBTÕ<UÐ'VˆEÔ$Ø×.Ñ.×?Ð?°-Ð?ÝOÙ% e¯[©[¸%¿.¹.ÔIß%ˆDÜ�E Ö'ñ &ä!%ˆÔÜ�‰Ð2°E·K±KÀÇÁÔPØÒÜ!1°%Ó!@ˆÔØ×&Ñ&×7Ð7¨-Ð7øô# ô 	RÜ14°S·²”S˜“X×(Ñ(Ó*¨1Ö-¼tÀC»y×?QÑ?QŽFûð	Rús   Â,"G ÇH'ÇAH"È"H'c                  ó2   € ] tR t^¯tRtR R ltR R ltRtR# )Ú_SessionRuntimeViewzR``agent`` with the session's own route and effort in place of a live voice turn's.c               ó$   € V ^8„  d   QhRRRRRR/# r_   r   )r   s   "r   r   Ú _SessionRuntimeView.__annotate__²   s!   € ÷ 5ñ 5˜cð 5¨.ð 5¸Tñ 5r   c                	ó  € VP                  R 4      ;'       g    / pR Uu/ uF  qDV9   g   K  WCV,          bK  	  ppRV9   d   VR,          VR&   VP                  R4      VR&   V P                  P                  WR7       R# u upi )rY   Úanthropic_base_urlÚ_anthropic_base_urlr@   )Ú_agentÚ_ownN)r   r   r   rH   )r    Ú__dict__r€   )Úselfr
   r`   rY   r\   Úowns   &&&   r   Ú__init__Ú_SessionRuntimeView.__init__²   s‡   € Ø—9‘9˜ZÓ(×.Ð.¨BˆÙ0]ÓrÑ0]¨ÐiqÑaqÔ#ˆt˜d•^Ò#Ñ0]ˆÐrØ 8Ô+Ø)1Ð2FÕ)GˆCÐ%Ñ&Ø"'§)¡)Ð,>Ó"?ˆÐÑØ�‰×Ñ EÐÖ4ùò	 ss
    B­Bc               ó    € V ^8„  d   QhRRRR/# )r	   r\   r   r   r   r   )r   s   "r   r   r�   º   s   € ÷ Tñ T ð T¨ñ Tr   c                	ó~   € V P                   R ,          pW9   d	   W!,          # \        V P                   R,          V4      # )r”   r“   )r•   r#   )r–   r\   r—   s   && r   Ú__getattr__Ú_SessionRuntimeView.__getattr__º   s1   € Ø�m‰m˜FÕ#ˆØ œKˆs�yÐS¬W°T·]±]À8Õ5LÈdÓ-SÐSr   r   N)r„   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r˜   rœ   Ú__static_attributes__r   r   r   r�   r�   ¯   s   † Ù\õ5÷Tñ Tr   r�   c               ó    € V ^8„  d   QhRRRR/# )r	   r
   r   r   r   )r   s   "r   r   r   ¿   s   € ÷ Añ A ð A¨ñ Ar   c                óF   € \        V RR4      pV'       d   \        W4      # T # )a  What a surface reports or persists as the SESSION's model and effort. Mid voice turn the agent
runs on the voice route (often reasoning off); reported as the chat's own setting, Desktop adopted
it into the composer, and every new chat it opened inherited reasoning off.r   N)r#   r�   )r
   r`   s   & r   Úsession_runtime_viewr¥   ¿   s&   € ô �EÐ/°Ó6€Eß05Ô˜uÓ,Ð@¸5Ð@r   c               ó    € V ^8„  d   QhRRRR/# )r	   r
   r   r   ra   r   )r   s   "r   r   r   Ç   s   € ÷ 7ñ 7 ð 7¨ñ 7r   c                óx  € \        V RR4      pV'       g   R# RV n        RV n         RV9   dP   \        V RR4      '       d2   ^ RIHp V! V P
                  V P                  RV P                  /R4       \        W4       TR,          T n        R#   \         d"    \        P                  R	R
R7       R
T n         L;i ; i)zGUndo ``begin_voice_turn_route`` (idempotent; every turn exit calls it).r   Nr   rY   Ú_reasoning_floor_requiredF)Úremember_reasoning_floorr   zKVoice turn route restore failed; the next turn re-resolves the main runtimeT)Úexc_infor@   )r#   r   rˆ   rF   r©   r   r   r   rf   r�   rn   ro   Ú_fallback_activatedr@   )r
   r`   r©   s   &  r   Úend_voice_turn_router¬   Ç   s²   € ä�EÐ/°Ó6€EßÙØ#€EÔØ€EÔð
)Ø˜ÔÜ�uÐ9¸5×AÒAåTÙ(¨¯©¸¿¹È'ÐSX×S^ÑS^ÐI_ÐaeÔfÜ�uÔ$ð
 #Ð#5Õ6€EÖøô	 ô )Ü�‰ÐdØ $ð 	ô 	&à$(ˆÖ!ð)ús   §AB Â)B9Â8B9)Ú_reasoning_disable_rejectedr¨   Ú_reasoning_effort_rejected)r«   Ú_fallback_indexÚ_provider_fallback_activeÚ_provider_fallback_routeÚ_rate_limit_backoff_countÚ_credential_poolÚ_credential_pool_entry_idÚ_config_context_length)r¡   Ú
__future__r   r}   ÚloggingÚtypingr   r   r   r   Ú	getLoggerr„   rn   rG   r‡   r[   r&   r5   rO   rU   r]   rf   rr   r‹   r�   r¥   r¬   r   r   r   Ú<module>rº      sŒ   ðñõ #ã Û ß ,Ó ,à	×	Ò	˜8Ó	$€à€ð
 oÐ òð ñ€õUõ4õõ2Eõõ*õ	&õ&8÷RTñ Tõ A÷7r   