+
    jHàj2  ã                   ó”   € R t ^ RIt^ RIHt ^ RIHt ^ RIHt R tR t	RR/R	 lt
RtR tR tR tRRRRRRRRR
RRR/tR tR tR tR# )zLSession-scoped busy preferences and controls of the existing execution only.N)Úpartial)ÚPath)ÚRuntimeStoreErrorc                 ó’   € R \        \        V 4      R\        \        V RR7      R\        \        V RR7      R\        \        V RR7      /# )	z
config.getz
config.setT)Úwritezsession.steerÚsteer)Úverbzsession.redirectÚredirect)r   Úbusy_configÚcorrect)Ú
connections   &ÚB/home/ubuntu/.hermes/hermes-agent/gateway/session_busy_controls.pyÚhandlersr   	   sB   € à”gœk¨:Ó6Ø”gœk¨:¸TÔBØœ¤¨*¸7ÔCØœG¤G¨Z¸jÔIð	ð ó    c                 ó^  € V P                   P                  V P                  W4       VP                  R 4      et   ^ RIHp VR ,          p\        V\        4      '       g   \        R4      hV'       d:   V! V\        V P                   P                  4      4      '       g   \        R4      hR# R# R# )ÚprofileN)Úprofile_matches_homeÚinvalid_paramsÚprofile_mismatch)Ú	authorityÚ	authorizeÚactorÚgetÚhermes_cli.profilesr   Ú
isinstanceÚstrr   r   Ú
profile_id)r   ÚrefÚparamsÚ
capabilityr   r   s   &&&&  r   r   r      s�   € Ø×Ñ×"Ñ" :×#3Ñ#3°SÔEà‡z�z�)ÓÒ(Ý<Ø˜Õ#ˆÜ˜'¤3×'Ò'Ü#Ð$4Ó5Ð5ßÑ/°¼¸j×>RÑ>R×>]Ñ>]Ó9^×_Ò_Ü#Ð$6Ó7Ð7ñ `‰7ñ )r   r   Fc             ƒ   óN  "  € V'       d"   VP                  R 4      R8X  d   \        R4      h0 RmV'       d   R0M	\        4       ,          pVP                  R 4      R8X  d7   \        V4      V,
          '       g   VP                  '       d   \	        WW#4      # VP                  R 4      R8X  d7   \        V4      V,
          '       g   VP                  '       d   \        WW#4      # VP                  R 4      R8X  d?   V'       d7   \        V4      V,
          '       g   VP                  '       d   \        WV4      # VP                  R 4      R8X  d?   \        V4      V,
          '       g'   VP                  '       d   \        WW#4      G Rj  x€L
 # \        V4      V,
          '       gG   VP                  '       d5   VP                  R 4      R	8w  g   V'       d"   VP                  R4      R9  d   \        R4      h\        YY#'       d   RMR4       V P                  pVP                  VP                  ,          pV'       d   VR,          Vn        \        VRR4      pVfÂ   ^ RIHp V! VP                  VP                   4      p	V	e   \        V	RR4      R8X  d   RMR
p
V	'       d*   V	P#                  4       P                  R4      ;'       g    / M/ pV	'       d   VP                  R4      ;'       g    T
M$VP                  P%                  VP                   4      pVR9  d   T
pR R	RVRR/#  EL�5i)ÚkeyÚmodelÚuse_session_mutation_modelÚvalueÚverboseÚshow_reasoningÚservice_tierÚyoloNÚbusyÚ	interruptÚqueuer   úsession:controlúsession:readÚbusy_input_mode©Úpolicy_for_sourceÚsourceÚtuiÚdisplayÚscopeÚsession>   r!   r   Ú
session_id)r*   r   r+   )r   r   Úsetr6   Úverbose_configÚshow_reasoning_configÚservice_tier_configÚyolo_configr   r   Úsessionsr.   ÚgetattrÚgateway.session_policyr0   Úrunnerr1   ÚconfigÚ_effective_busy_input_mode)r   r   r   r   Úallowedr   Úliver$   r0   ÚpolicyÚfallbackr3   s   &&&$        r   r
   r
      sf  é € ß�—‘˜EÓ" gÔ-ô  Ð <Ó=Ð=Ú.¿u°7±)Ì#Ë%ÕP€GØ‡z�z�%Ó˜IÔ%¬c°&«k¸G×.CÔ.CÈÏÏÈÜ˜j¨vÓ=Ð=Ø‡z�z�%ÓÐ,Ô,´S¸³[À7×5JÔ5JÈsÏ~Ï~È~Ü$ Z°fÓDÐDØ‡z�z�%Ó˜NÔ*¯u¼SÀ»[È7×=RÔ=RÐWZ×We×WeÐWeÜ" :°FÓ;Ð;Ø‡z�z�%Ó˜FÔ"¬3¨v«;¸×+@Ô+@ÀSÇ^Ç^À^Ü  °&Ó@×@Ð@ÜˆF‹�g×Ô S§^§^ ^°v·z±zÀ%Ó7HÈFÔ7Rß˜&Ÿ*™* WÓ-Ð5TÔTÜÐ 0Ó1Ð1Üˆj˜v¾EÑ'8À~ÔVØ×$Ñ$€IØ×Ñ˜cŸn™nÕ-€Dßð  & g�ˆÔÜ�DÐ+¨TÓ2€EØ‚}Ý<Ù" 9×#3Ñ#3°T·[±[ÓAˆð
 %Ò0´W¸VÀXÈtÓ5TÐX]Ô5]‘7Ðcnˆß<B�6—=‘=“?×&Ñ& yÓ1×7Ð7°RøÈˆß?E�—‘Ð.Ó/×;Ð;°8øØ×!Ñ!×<Ñ<¸T¿[¹[ÓIð 	àÐ7Ô7ØˆEØ�6˜7 E¨7°IÐ>Ð>ò3 Aùs^   ‚BL%Â
AL%Ã)L%Ä )L%Ä*AL%Å6L%ÆL"Æ-L%Æ4L%ÇA'L%È:A#L%Ê%L%ËL%ËL%Ë):L%Úoffc                ó®  € VP                  R4      pV'       d   V. \        ORN59  d   \        R4      h\        YY#'       d   RMR4       V P                  P
                  VP                  ,          p\        VRR4      ;'       g    RpV'       d?   VR8X  d/   \        \        P                  V4      ^,           ^,          ,          MT;Vn	        pR	R
RVRR/# )z˜Session-scoped /verbose: the tool-progress mode the next tool events of
this session render with (read by TurnRunner), like busy never a settings write.r$   Úcycler   r,   r-   Útool_progress_modeNÚallr!   r%   r4   r5   )
r   Ú_VERBOSE_CYCLEr   r   r   r<   r6   r=   ÚindexrI   )r   r   r   r   r$   rC   Úcurrents   &&&&   r   r8   r8   K   sÀ   € ð �J‰J�wÓ€Eß�Ð8¤Ð8°Ñ8Ô8ÜÐ 0Ó1Ð1Üˆj˜v¾EÑ'8À~ÔVØ×Ñ×(Ñ(¨¯©Õ8€DÜ�dÐ0°$Ó7×@Ð@¸5€GßàGLÐPWÔGWŒNœN×0Ñ0°Ó9¸AÕ=ÀÕBÖCÐ]bð	dˆÔ 'à�9˜g w°¸ÐCÐCr   c                ó,  € VP                  R4      p\        V4      P                  4       P                  4       pV'       d   V\        9  d   \        R4      h\        YY#'       d   RMR4       V P                  P                  VP                  ,          pV'       d   \        V,          Vn
        \        VRR4      pVfE   ^ RIHp ^ RIHp	 V! V	! V P                  P                   VP"                  4      V P                  4      pR	RRVR
J d   RRR/# RRR/# )zùSession-scoped reasoning display (the classic CLI's ``/reasoning show|hide`` and verbose
reasoning): whether a local-viewer turn of this session streams ``reasoning.delta``. Unset, it
reports the launch default the turn uses. Never a settings write.r$   r   r,   r-   r&   N)Úlaunch_shows_reasoningr/   r!   TÚ1Ú0r4   r5   )r   r   ÚstripÚlowerÚ_YOLO_WORDSr   r   r   r<   r6   r&   r=   Úgateway.local_viewer_eventsrO   r>   r0   r?   r1   )
r   r   r   r   r$   ÚwordrC   ÚshownrO   r0   s
   &&&&      r   r9   r9   Z   sð   € ð �J‰J�wÓ€EÜˆu‹:×ÑÓ×#Ñ#Ó%€Dß�œ[Ô(ÜÐ 0Ó1Ð1Üˆj˜v¾EÑ'8À~ÔVØ×Ñ×(Ñ(¨¯©Õ8€DßÜ)¨$Õ/ˆÔÜ�DÐ*¨DÓ1€EØ‚}ÝFÝ<Ù&Ñ'8¸×9MÑ9M×9TÑ9TÐVZ×VaÑVaÓ'bØ'1×';Ñ';ó=ˆàÐ# W°U¸d³]¨cÈWÐV_Ð`Ð`ÈÈWÐV_Ð`Ð`r   c                óÐ  € ^ RI Hp  \        VP                  R4      \        4      '       d   V! VP                  R4      4      MRpVf   \        R4      h\        WVR4       V P                  P                  VP                  ,          pV P                  P                  P                  VP                  T;'       g    R4       RRRT;'       g    RR	R
/#   \
         d    Rp Lži ; i)a  Session-scoped ``/fast`` (the classic CLI's tier pick, ``normal`` clears to normal): the
session's service-tier override the next turn's agent reads (``current_service_tier``), never a
settings write. ``--global`` persistence stays the client's own config.yaml write.)Úparse_exact_service_tierr$   Nr   r,   r!   r'   Únormalr4   r5   )Úagent.fast_moderY   r   r   r   Ú
ValueErrorr   r   r   r<   r6   r?   Ú"_set_session_service_tier_overrideÚroute)r   r   r   rY   ÚtierrC   s   &&&   r   r:   r:   o   sÌ   € õ 9ðÜ@JÈ6Ï:É:ÐV]ÓK^Ô`c×@dÒ@dÑ'¨¯
©
°7Ó(;Ô<Ðjnˆð ‚|ÜÐ 0Ó1Ð1Üˆj˜vÐ'8Ô9Ø×Ñ×(Ñ(¨¯©Õ8€DØ×Ñ×Ñ×BÑBÀ4Ç:Á:ÈtÏ|È|ÐW[Ô\Ø�> 7¨D×,<Ð,<°H¸gÀyÐQÐQøô ô ØŠðús   ˆ>C ÃC%Ã$C%rP   TÚonÚtruerQ   Úfalsec              ƒ  ó&  aa"  € VP                  R4      pV'       d@   Ve<   \        V4      P                  4       P                  4       \        9  d   \        R4      h\        YY#'       d   RMR4       ^ RIHp ^ RI	H
p ^ RIHpHp V P                  P                  VP                   ,          oV P                  P"                  p	V! V	SP$                  4      p
\'        V	R	R4      oSe.   V	P(                  P+                  SP,                  4      G Rj  x€L
 MRpT! SP,                  \'        VR
R4      \/        V
RJ;'       d    V
P0                  4      R7       \'        VR
R4      RJ pV! SP,                  4      ;'       g    TpV'       dp   Se   VV3R lMRp\2        P4                  ! TSP,                  Vf   RM1\        \        V4      P                  4       P                  4       ,          WÎR7      G Rj  x€L
 pRR
RV'       d   RRR/# RRR/#  Lü L5i)a  Session-scoped /yolo (TUI slash + Shift+Tab, Desktop toggle): this session's approval bypass,
never HERMES_YOLO_MODE or approvals.mode. A ``--yolo`` launch is seeded first, so revoking it
here is not re-enabled by the next turn's launch seeding. The write goes through the shared
``tools.approval_yolo.toggle_session_yolo`` contract on the route's persisted copy
(``SessionEntry.yolo``, restored by ``restore_gateway_yolo``), like the messaging
``/yolo``: persisted before the live flip, so an OFF here is not revived by the next turn.r$   Nr   r,   r-   r/   )Úis_session_yolo_enabled)Úrestore_gateway_yoloÚtoggle_session_yoloÚsession_storer(   )ÚlaunchFTc                 ó<   <€ SP                  SP                  V 4      # )N)Úset_session_yolor^   )r`   rC   Ústores   &€€r   Ú<lambda>Úyolo_config.<locals>.<lambda>›   s   ø€ ˜e×4Ñ4°T·Z±ZÀÔDr   )Ú	persistedÚpersistr!   rP   rQ   r4   r5   )r   r   rR   rS   rT   r   r   r>   r0   Útools.approvalrd   Útools.approval_yolore   rf   r   r<   r6   r?   r1   r=   Úasync_session_storeÚlookup_by_session_keyr^   Úboolr(   ÚasyncioÚ	to_thread)r   r   r   r   r$   r0   rd   re   rf   r?   rD   Úentryrn   Úenabledro   rC   rk   s   &&&&           @@r   r;   r;   ƒ   s´  ùé € ð �J‰J�wÓ€Eß�Ò"¤s¨5£z×'7Ñ'7Ó'9×'?Ñ'?Ó'AÌÔ'TÜÐ 0Ó1Ð1Üˆj˜v¾EÑ'8À~ÔVÝ8Ý6ßMØ×Ñ×(Ñ(¨¯©Õ8€DØ×!Ñ!×(Ñ(€FÙ˜v t§{¡{Ó3€FÜ�F˜O¨TÓ2€EØRWÒRc�&×,Ñ,×BÑBÀ4Ç:Á:ÓN×NÐNÐim€EÙ˜Ÿ™¤W¨U°F¸DÓ%AÌ$ÈvÐ]aÐOa×OqÐOqÐfl×fqÑfqÓJrÕsä˜˜v uÓ-°Ð5€IÙ% d§j¡jÓ1×>Ð>°Y€GßØINÒIZÖDÐ`dˆä×)Ò)Ø §¡°U²]©TÌÔTWÐX]ÓT^×TdÑTdÓTf×TlÑTlÓTnÕHoØô2÷ 2ˆð �6˜7¯7 C¸WÀiÐPÐP¸¸WÀiÐPÐPñ Oñ2ùs=   „DHÄHÄ.HÅ =HÅ>
HÆ	A*HÇ3HÇ4HÈHÈHc                ó  € ^ RI Hp ^ RIHp  V! V P                  V P
                  VP                  ,          P                  4      pVRJ;'       d    VP                  R8H  '       * ;'       d    V! W4      RJ #   \         d     R# i ; i)z¾The claimed turn runs an in-process owner agent, which adopt_agent hands latched steers to;
a cron job or a managed worker has no steer seam, so a latch there would be acknowledged and lost.)Úmanaged_policyr/   NÚcronF)	Úgateway.session_managed_workerrz   r>   r0   r?   r<   r6   r1   r   )r   r   rz   r0   rD   s   &&   r   Úadopts_owner_agentr}   £   s{   € õ >Ý8ðÙ" 9×#3Ñ#3°Y×5GÑ5GÈÏÉÕ5W×5^Ñ5^Ó_ˆØ $Ð&×BÐB¨6¯=©=¸FÑ+BÔC×nÐnÉÐW`ÓHfÐjnÐHnÐnøÜô Úðús   ŽAA8 ÁA8 Á-
A8 Á8BÂBc             ƒ   ó¼  "  € \        V4      0 Rm,
          '       ge   \        VP                  R4      \        4      '       d@   VR,          P	                  4       '       d#   \        VP                  R4      4      \        Jd   \        R4      h\        WVR4       \        V RR4      pVe   V! W4      G Rj  x€L
 '       d   RR/# V P                  pVR,          pVP                  VP                  ,          pVP                  P                  ;_uu_ 4        VP                  VP                  V4       VP                  \        VR	/ 4      9   d   \        R
4      hTP!                  YVR8X  d
   VR,          MR4      w  r‰V	'       d&   RRRVR,          RVRVP"                  /uuRRR4       # Vf(   RRRVR,          RVRVP"                  RR/uuRRR4       # \        WƒR4      p
\%        V
4      '       g   \        R4      hV
! VR,          4      pRV'       d   RRRR/V,          MRRVR,          RVRVP"                  /uuRRR4       #  EL�  + '       g   i     R# ; i5i)r6   ÚtextÚexecution_generationr   r,   Ú_typed_voice_stopNÚvoice_stoppedTÚ_managed_workersÚunsupported_controlr   ÚstatusÚqueuedÚauthority_epochÚrejectedÚ	deliveredFÚexecution_not_readyr	   Ú
redirected>   r   r   r6   r€   )r7   r   r   r   rR   ÚtypeÚintr   r   r=   r   r<   r6   Úevent_streamÚlockÚcheck_approval_generationÚsteer_agentÚepochÚcallable)r   r   r   r   Ú
voice_stopr   Ú
generationrC   ÚagentÚlatchedÚmethodÚaccepteds   &&&$        r   r   r   ¯   s  é € ÜˆF‹ÒO×OÔOÜ˜fŸj™j¨Ó0´#×6Ò6¸fÀV½n×>RÑ>R×>TÒ>TÜ�F—J‘JÐ5Ó6Ó7¼sÓBÜÐ 0Ó1Ð1Üˆj˜vÐ'8Ô9ô ˜Ð%8¸$Ó?€JØÒ©
°3Ó(?×"?Ö"?Ø Ð&Ð&Ø×$Ñ$€IØÐ.Õ/€JØ×Ñ˜cŸn™nÕ-€DØ	×	Ñ	×	×	Ó	Ø×+Ñ+¨C¯N©N¸JÔGð �>‰>œW YÐ0BÀBÓGÔGÜ#Ð$9Ó:Ð:ð #×.Ñ.¨sÐRVÐZaÔRaÀÀvÆÐgkÓl‰ˆßØ˜h¨°°vµÐ@VÐXbØ% y§¡ð8÷ 
 Ò	ð$ Š=Ø˜j¨&°&¸µ.ÐBXÐZdØ% y§¡¸ÀUðL÷' 
 Ò	ô* ˜ dÓ+ˆÜ˜×ÒÜ#Ð$9Ó:Ð:Ù˜& �.Ó)ˆØ×RZ˜G X¨z¸<ÐHÈÖNÐ`jØ˜˜v�Ð(>À
Ø! 9§?¡?ð4÷3 
 Ò	ò #@÷
 
 ×	Ð	üsW   ‚AIÁAIÂ5IÂ6	IÃ AIÄB
IÆIÆ) IÇ	IÇ?IÈ&IÈ:IÉI	É	I)rF   ÚnewrJ   r%   )Ú__doc__ru   Ú	functoolsr   Úpathlibr   Úhermes_state_runtimer   r   r   r
   rK   r8   r9   r:   rT   r;   r}   r   © r   r   Ú<module>r       sv   ðÙ RÛ Ý Ý å 2òò	8ð'?¸ô '?ðT 2€òDòaò*Rð" �D˜$  f¨d°C¸ÀÀuÈgÐW\Ð]€òQò@	ô*4r   