+
    jHàjü	  ã                  óŒ   € R t ^ RIHt ^ RIt^ RIt]P
                  ! ]4      t^xtRR R]/R R llt	]P                  R 4       tR# )	uR  The masked sudo password prompt for a local viewer's turn.

Main's TUI sidecar registered ``set_sudo_password_callback`` per session (``tui_gateway/agent_callbacks.py``):
the terminal tool's sudo rewrite asked the renderer through a ``sudo`` serverâ†’client request and the
Ink card answered with ``{value}``. On the session authority no callback was registered, so the tool
took the headless path (``sudo: a terminal is required``). Here the owner sends the same ``sudo``
request frame (``tui_gateway/contracts/server_requests.py``) to the viewers attached to the session's
event stream and blocks the agent thread until one answers, the turn is interrupted, or it times out.
The password is never published, journaled or logged: it travels only in the viewer's response frame.
The request registry itself is ``gateway/session_server_requests.py``.
)ÚannotationsNÚ	cancelledc                 ó   € R # )F© r   ó    Ú@/home/ubuntu/.hermes/hermes-agent/gateway/session_sudo_prompt.pyÚ<lambda>r      s   € ¹ur   Útimeoutc               ó   € V ^8„  d   QhRR/# )é   ÚreturnÚstrr   )Úformats   "r   Ú__annotate__r      s   € ÷ nñ nÐadñ nr   c          	     ó*   € ^ RI Hp V! WRRV/W4R7      # )z²Send one ``sudo`` request to the session's attached viewers and wait for its ``value``.
"" when nobody is attached, the viewer skipped, the turn was interrupted, or it timed out.)Ú
ask_viewerÚsudoÚcommand)r   r	   )Úgateway.session_server_requestsr   )ÚeventsÚ
session_idr   r   r	   r   s   &&&$$ r   Úask_sudor      s   € õ ;Ù�f¨&°9¸gÐ2FÐR[ÔmÐmr   c              #  óÚ   aaa	"  € ^ RI Hp V! V 4      '       g   Rx € R# ^ RIHpHp V P
                  w  oo	pVVV	3R lpV! 4       pV! V4        Rx € V! V4       R#   T! T4       i ; i5i)zZInstall the sudo callback on this (agent) thread for a local viewer's turn; restore after.)Úlocal_viewer_turnN)Ú_get_sudo_password_callbackÚset_sudo_password_callbackc                 ó®   <€ ^ RI Hp  ^ RIHp SP                  P                  S4      pVf   R# \        VP                  SV ! V! 4       4      V3R lR7      # )é    )Ú_redact_approval_command)Úget_sudo_prompt_commandÚ c                 ó0   <€ \        \        S R R4      4      # )Ú_interrupt_requestedF)ÚboolÚgetattr)Úagents   €r   r   Ú5sudo_prompt_scope.<locals>.callback.<locals>.<lambda>.   s   ø€ ¬$¬w°uÐ>TÐV[Ó/\Ô*]r   )r   )Úgateway.runr   Útools.terminal_tool_sudor   ÚsessionsÚgetr   Úevent_stream)r   r   Úliver%   Ú	authorityr   s      €€€r   ÚcallbackÚ#sudo_prompt_scope.<locals>.callback'   sO   ø€ Ý8ÝDØ×!Ñ!×%Ñ% jÓ1ˆØŠ<ÙÜ˜×)Ñ)¨:Ñ7OÑPgÓPiÓ7jÜ"]ô_ð 	_r   )Úgateway.run_turn_progressr   Útools.terminal_toolr   r   Ú_approval_owner)
Úturnr%   r   r   r   Ú_generationr.   Úpreviousr-   r   s
   &f      @@r   Úsudo_prompt_scoper6      sb   úé € õ <Ù˜T×"Ò"ÛÙß[Ø)-×)=Ñ)=Ñ&€Iˆz˜;÷_ñ +Ó,€HÙ˜xÔ(ð-Ûá" 8Ö,øÑ" 8Õ,üs   …A
A+ÁA Á
A+Á
A(Á(A+)Ú__doc__Ú
__future__r   Ú
contextlibÚloggingÚ	getLoggerÚ__name__ÚloggerÚSUDO_TIMEOUT_Sr   Úcontextmanagerr6   r   r   r   Ú<module>r@      sZ   ðñ
õ #ã Û à	×	Ò	˜8Ó	$€à€ðn±}ð nÈn÷ nð ×Ññ-ó ò-r   