+
    lHàjLH  ã                   óT  a € RR t=0 t R t^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
Ht ]P                  ! R4      tRSR R llt]! R	4      t] ^ k ]! R
4      t] ^k ]! R4      t] ^k ]! R4      t] ^k ]! RR4      t] ^k R R ltR R ltR R ltR R ltR R lt]! 0 RTm4      tR R ltR R ltR R ltR R lt]]P@                  ]!,          ]P@                  ]!,          ]P@                  ]!,          3,          t"R RR!RR"R/R# R$ llt#R% R& lt$RUR' R( llt%R) R* lt&R+ R, lt'R- R. lt(]! 0 RVm4      t)R1 R2 lt*]! R/R004      t+R3 R4 lt,R5 R6 lt-R7 R8 lt.RWR9 lt/R: R; lt0RXt1R< R= lt2R> R? lt3R@ RA lt4RB RC lt5RD RE lt6RF RG lt7RH RI lt8RJ RK lt9RL RM lt:RN RO lt;RP RQ lt<R# )YzûApproval context: who is asking, from where, under which policy.

Session identity and observability contextvars, the interactive/gateway/cron/
unattended predicates, and the ``approvals.*`` config readers used by every
gate in :mod:`tools.approval`.
N)Út)Úcfg_get)Úenv_var_enabledÚis_truthy_valueztools.approvalÚ c                ó^   € V ^8„  d   QhR\         R\         R,          R\        P                  /# )é   ÚnameÚdefaultNÚreturn)ÚstrÚcontextvarsÚ
ContextVar)Úformats   "Ú;/home/ubuntu/.hermes/hermes-agent/tools/approval_context.pyÚ__annotate__r      s+   € ÷ 9ñ 9Œsð 9œS 4�Zð 9´×1GÑ1Gñ 9ó    c                 ó0   € \         P                  ! WR 7      # )©r
   )r   r   )r	   r
   s   &&r   Ú_ctxr      s   € Ü×!Ò! $Ô8Ð8r   Úapproval_session_keyÚapproval_turn_idÚapproval_tool_call_idÚapproval_session_idÚhermes_interactivec                óD   € V ^8„  d   QhR\         R\        P                  /# )r   Úinteractiver   )Úboolr   ÚToken)r   s   "r   r   r   &   s$   € ÷ Cñ C´ð C¼×9JÑ9Jñ Cr   c                óH   € \         P                  V '       d   R4      # R4      # )zMBind interactive mode for the current context instead of mutating os.environ.Ú1r   )Ú_hermes_interactive_ctxÚset)r   s   &r   Úset_hermes_interactive_contextr#   &   s   € ä"×&Ñ&¯k sÓBÐB¸rÓBÐBr   c                ó<   € V ^8„  d   QhR\         P                  RR/# ©r   Útokenr   N)r   r   )r   s   "r   r   r   +   s    € ÷ )ñ )¬K×,=Ñ,=ð )À$ñ )r   c                ó0   € \         P                  V 4       R# )zDRestore the prior value from :func:`set_hermes_interactive_context`.N)r!   Úreset©r&   s   &r   Ú reset_hermes_interactive_contextr*   +   s   € ä×!Ñ! %Ö(r   c                ó$   € V ^8„  d   QhR\         /# ©r   r   ©r   )r   s   "r   r   r   0   s   € ÷ fñ fœTñ fr   c                 ó^   € \         P                  4       p V e   \        V 4      # \        R4      # )zITrue for an interactive CLI/ACP session (contextvar first, env fallback).ÚHERMES_INTERACTIVE)r!   Úgetr   r   )Úctx_vals    r   Ú_is_interactive_clir2   0   s+   € ä%×)Ñ)Ó+€GØ'.Ò':Œ?˜7Ó#ÐeÄÐPdÓ@eÐer   c                ó(   € V ^8„  d   QhR\         RR/# )r   Ú	hook_namer   N©r   )r   s   "r   r   r   6   s   € ÷ Mñ M¤3ð M°Tñ Mr   c                ó¶  €  ^ RI Hp  TP                  R\        P                  4       4       TP                  R\        P                  4       4       \        P                  4       '       d%   TP                  R\        P                  4       4       T! T 3/ TB  R#   \         d     R# i ; i  \         d"   p\        P                  RY4        Rp?R# Rp?ii ; i)züInvoke a plugin lifecycle hook (pre_approval_request / post_approval_response).

Lazy-imports the plugin manager (approval.py is imported long before plugins
are discovered). Never raises: approval flow is safety-critical, plugin
observability is not.
)Úinvoke_hookNÚturn_idÚtool_call_idÚ
session_idz$Approval hook %s dispatch failed: %s)
Úhermes_cli.lifecycler7   Ú	ExceptionÚ
setdefaultÚ_approval_turn_idr0   Ú_approval_tool_call_idÚ_approval_session_idÚloggerÚdebug)r4   Úkwargsr7   Úexcs   &,  r   Ú_fire_approval_hookrE   6   s³   € ðÝ4ðMØ×Ñ˜)Ô%6×%:Ñ%:Ó%<Ô=Ø×Ñ˜.Ô*@×*DÑ*DÓ*FÔGÜ×#Ñ#×%Ò%Ø×Ñ˜lÔ,@×,DÑ,DÓ,FÔGÙ�IÑ( Ô(øô ô Úðûô ô Mä�‰Ð;¸Y×LÒLûðMús/   ‚B ‰A!B, Á+-B, ÂB)Â(B)Â,CÂ7CÃCc                ó$   € V ^8„  d   QhR\         /# r,   r5   )r   s   "r   r   r   L   s   € ÷ >ñ >¤#ñ >r   c                 ó.   € ^ RI Hp  V ! 4       R8X  d   R# R# )z‘Surface a gateway-rendered approval reports: ``cli`` for a classic CLI session's turn (main
prompted those in the CLI process), else ``gateway``.©Úsession_surfaceÚcliÚgateway)Úhermes_cli.plugin_sessionrI   rH   s    r   Úgateway_approval_surfacerM   L   s   € õ :Ù#Ó%¨Ô.ˆ5Ð=°IÐ=r   c                ó$   € V ^8„  d   QhR\         /# r,   r-   )r   s   "r   r   r   W   s   € ÷ 	Nñ 	N¤dñ 	Nr   c                 ó€   €  ^ RI Hp  T ! 4       pTRJ;'       d    TP                  \        9   #   \         d     R# i ; i)zæTrue for a classic CLI, TUI, Desktop or ACP session's turn, read from the launch policy the gateway
froze at ``session.create`` (never a per-turn client flag). Kanban, cron and forwarded routes keep
their own sources and stay out.)Úactive_policyFN)Úgateway.session_policyrP   ÚImportErrorÚsourceÚ_LOCAL_INTERACTIVE_SOURCES)rP   Úpolicys     r   Úis_local_interactive_sessionrV   W   sD   € ðÝ8ñ ‹_€FØ˜Ð×MÐM &§-¡-Ô3MÑ"MÐMøô ô Úðús   ‚. ®=¼=c                ó$   € V ^8„  d   QhR\         /# r,   r-   )r   s   "r   r   r   c   s   € ÷ eñ e¤dñ er   c                 ó¢  €  ^ RI Hp  T P                  4       pTf   R# TP                  P
                  ;_uu_ 4        \        ;QJ d4    R TP                  P                  4        4       F  '       g   K   RM)	  RM%! R TP                  P                  4        4       4      uuRRR4       #   \         d     R# i ; i  + '       g   i     R# ; i)aÜ  True while the executing turn is one its session's viewer submitted through ``session.submit`` (as the
gateway's FIFO drain recorded for this admission) and a viewer that can answer approvals is attached now:
a subscriber holding ``session:approve``, the only answer the gateway's approval resolver accepts. A plugin
``inject_message`` turn, a delegation completion, a background-process or watch notice, a /loop tick, a
heartbeat or a hosted-room task is never a viewer turn.)Úviewer_turnFNc              3   ó@   "  € T F  pR VP                   9   x € K  	  R# 5i)zsession:approveN)Úcapabilities)Ú.0Úmembers   & r   Ú	<genexpr>Ú/is_viewer_turn_with_approver.<locals>.<genexpr>q   s   é € ÐdÑJcÀÐ$¨×(;Ñ(;Ö;ÓJcùs   ‚T)	Úgateway.session_ingressrY   rR   r0   Úevent_streamÚlockÚanyÚsubscribersÚvalues)rY   Úlives     r   Úis_viewer_turn_with_approverrg   c   s–   € ðÝ7ð �?‰?Ó€DØ‚|ÙØ	×	Ñ	×	×	Ó	ß‹sÑdÈ$×JZÑJZ×JaÑJaÔJcÓd�s�sŠsÑdÈ$×JZÑJZ×JaÑJaÔJcÓdÓd÷ 
 Ò	øô ô Úðú÷
 
 ×	Ð	ús"   ‚B+ ¼5B=Á4,B=Â+B:Â9B:Â=C	c                óZ   € V ^8„  d   QhR\         R\        P                  \         ,          /# )r   Úsession_keyr   )r   r   r   )r   s   "r   r   r   t   s%   € ÷ 8ñ 8¬ð 8´×1BÑ1BÄ3Õ1Gñ 8r   c                ó@   € \         P                  T ;'       g    R4      # )z<Bind the active approval session key to the current context.r   )Ú_approval_session_keyr"   )ri   s   &r   Úset_current_session_keyrl   t   s   € ä ×$Ñ$ [×%6Ð%6°BÓ7Ð7r   c                óR   € V ^8„  d   QhR\         P                  \        ,          RR/# r%   )r   r   r   )r   s   "r   r   r   y   s%   € ÷ 'ñ '¤[×%6Ñ%6´sÕ%;ð 'Àñ 'r   c                ó0   € \         P                  V 4       R# )z/Restore the prior approval session key context.N)rk   r(   r)   s   &r   Úreset_current_session_keyro   y   s   € ä×Ñ Ö&r   r8   r9   r:   c                óH   € V ^8„  d   QhR\         R\         R\         R\        /# )r   r8   r9   r:   r   )r   Ú_Tokens)r   s   "r   r   r   �   s*   € ÷ 8ñ 8´#ð 8Ì#ð 8Ô`cð 8Ômtñ 8r   c                óº   € \         P                  T ;'       g    R4      \        P                  T;'       g    R4      \        P                  T;'       g    R4      3# )z3Bind active tool correlation IDs to approval hooks.r   )r>   r"   r?   r@   )r8   r9   r:   s   $$$r   Ú!set_current_observability_contextrs   �   sM   € ä×!Ñ! '§- -¨RÓ0Ô2H×2LÑ2LÈ\×M_ÐM_Ð]_Ó2`Ü ×$Ñ$ Z×%5Ð%5°2Ó6ð8ð 8r   c                ó(   € V ^8„  d   QhR\         RR/# )r   Útokensr   N)rq   )r   s   "r   r   r   ‡   s   € ÷ (ñ (´ð (¸Dñ (r   c                óŽ   € V w  rp\         P                  V4       \        P                  V4       \        P                  V4       R# )z,Restore prior approval hook correlation IDs.N)r@   r(   r?   r>   )ru   Ú
turn_tokenÚ
tool_tokenÚsession_tokens   &   r   Ú#reset_current_observability_contextrz   ‡   s6   € à,2Ñ)€J˜MÜ×Ñ˜}Ô-Ü× Ñ  Ô,Ü×Ñ˜JÖ'r   c                ó0   € V ^8„  d   QhR\         R\         /# )r   r
   r   r5   )r   s   "r   r   r   �   s   € ÷ :ñ :¤Sð :¼ñ :r   c                ó\   € \         P                  4       ;p'       d   V# ^ RIHp V! RV 4      # )uV   Return the active session key: approval contextvar â†’ session_context â†’ os.environ.©Úget_session_envÚHERMES_SESSION_KEY)rk   r0   Úgateway.session_contextr~   )r
   ri   r~   s   &  r   Úget_current_session_keyr�   �   s-   € ä+×/Ñ/Ó1Ð1€{Ö1ØÐÝ7ÙÐ/°Ó9Ð9r   c                ó0   € V ^8„  d   QhR\         R\         /# )r   r	   r   r5   )r   s   "r   r   r   —   s   € ÷ )ñ )”sð )œsñ )r   c                óš   €  ^ RI Hp V! V R4      ;'       g    R#   \         d%    \        P                  ! T R4      ;'       g    Ru # i ; i)zÀSession-scoped env value, contextvar-first so one cron/-q job cannot taint
unrelated gateway/API/TUI turns in the same process; process env is the
fallback for CLI tests and older entrypoints.r}   r   )r€   r~   r<   ÚosÚgetenv)r	   r~   s   & r   Ú_session_envr†   —   sG   € ð)Ý;Ù˜t RÓ(×.Ð.¨BÐ.øÜô )Ü�yŠy˜˜rÓ"×(Ð( bÒ(ð)ús   ‚ ˜ ›(A
ÁA
Á	A
c                ó$   € V ^8„  d   QhR\         /# r,   r5   )r   s   "r   r   r   ¢   s   € ÷ 3ñ 3œsñ 3r   c                 ó   € \        R4      # )zBReturn the current gateway platform from contextvars/env fallback.ÚHERMES_SESSION_PLATFORM)r†   © r   r   Ú_get_session_platformr‹   ¢   s   € äÐ1Ó2Ð2r   c                ó$   € V ^8„  d   QhR\         /# r,   r-   )r   s   "r   r   r   §   s   € ÷ @ñ @¤4ñ @r   c                 ó*   € \        \        R4      4      # )z?True when the current approval decision is running inside cron.ÚHERMES_CRON_SESSION)r   r†   rŠ   r   r   Ú_is_cron_approval_contextr�   §   s   € äœ<Ð(=Ó>Ó?Ð?r   ÚwebhookÚmsgraph_webhookc                ó$   € V ^8„  d   QhR\         /# r,   r-   )r   s   "r   r   r   ²   s   € ÷ Eñ E´$ñ Er   c                 ó$   € \        4       \        9   # )u�  True when the session platform is a programmatic/unattended surface.

Webhook, msgraph_webhook, and api_server sessions bind ``HERMES_SESSION_PLATFORM`` like chat gateways
do, but there is no human who can resolve a pending approval. Treating them as gateway approval contexts
blocks the session for the full approval timeout (60-300s) and then fails closed anyway â€” the deadlock
in #37284/#87509.
)r‹   Ú_UNATTENDED_APPROVAL_PLATFORMSrŠ   r   r   Ú(_is_unattended_platform_approval_contextr•   ²   s   € ô !Ó"Ô&DÑDÐDr   c                ó$   € V ^8„  d   QhR\         /# r,   r-   )r   s   "r   r   r   Æ   s   € ÷ Hñ H¬4ñ Hr   c                 óv   €  ^ RI Hp  V ! 4       RJ d   R#  \        \	        R4      4      #   \         d     L!i ; i)a-  True for a single-query (-q) session: ``hermes chat -q`` exports
``HERMES_INTERACTIVE=1`` (so sudo password prompts work) but nobody is waiting
to answer approvals; without this marker the gate would wait the full timeout,
fail closed and push the agent toward workarounds (e.g. execute_code).
``approvals.single_query_mode`` makes the path deterministic. A gateway-admitted turn
carries the same fact as the submission's ``finite`` flag (``hermes -z`` / ``chat -q``
over the daemon): the viewer detaches on the first prompt, so nobody answers there either.©Úfinite_turn_requiredTÚHERMES_SINGLE_QUERY_SESSION)Úgateway.session_finiter™   rR   r   r†   r˜   s    r   Ú!_is_single_query_approval_contextrœ   Æ   sD   € ðÝ?ñ  Ó! TÓ)Ùð *äœ<Ð(EÓFÓGÐGøô ô Ùðús   ‚* ª8·8c                ó$   € V ^8„  d   QhR\         /# r,   r-   )r   s   "r   r   r   Ø   s   € ÷ ;ñ ;œTñ ;r   c                 ó^   € \        4       ;'       g    \        4       ;'       g    \        4       # )zÎTrue in single-query (-q), cron and unattended-platform sessions. `hermes chat -q` still registers the
CLI panel callback, so a prompt that only checks for a callback would wait the full timeout for nobody.)rœ   r�   r•   rŠ   r   r   Ú_no_user_can_answerrŸ   Ø   s/   € ô .Ó/÷ :ð :Ô3LÓ3N÷ :ð :Ü7Ó9ð;r   c                ó$   € V ^8„  d   QhR\         /# r,   r-   )r   s   "r   r   r   ß   s   € ÷ Vñ V¤dñ Vr   c                 ó’   € \        4       '       g   \        4       '       d   R# \        R4      ;'       g    \        \	        4       4      # )a}  True inside a gateway/API session that can answer an approval.

Legacy integrations set HERMES_GATEWAY_SESSION; concurrent paths bind
HERMES_SESSION_PLATFORM via contextvars. Cron is NEVER a gateway approval
context even when it originated from a platform (cron binds the platform for
delivery routing): falling through would submit a pending approval with no
listener and block the job indefinitely; unattended platforms likewise.

Unattended programmatic platforms (webhook, msgraph_webhook, api_server) are excluded for the same
reason: those adapters have no ``send_exec_approval`` and no way to receive ``/approve`` replies.
Submitting a pending approval there blocks the session for the full approval timeout (60-300 s) with no
human who can resolve it (#37284, 87509). Their dangerous-command handling is governed by
``approvals.unattended_mode`` config (default deny), mirroring cron.
FÚHERMES_GATEWAY_SESSION)r�   r•   r   r   r‹   rŠ   r   r   Ú_is_gateway_approval_contextr£   ß   s6   € ô !×"Ò"Ô&N×&PÒ&PÙÜÐ3Ó4×UÐU¼Ô=RÓ=TÓ8UÐUr   c                óN   € V e   V #  ^ RI Hp V! 4       #   \         d     R# i ; i)zXExplicit callback, else the per-thread one from ``terminal_tool.set_approval_callback``.N)Ú_get_approval_callback)Útools.terminal_toolr¥   r<   )Úapproval_callbackr¥   s   & r   Ú_resolve_cli_approval_callbackr¨   ó   s1   € àÒ$Ø Ð ðÝ>Ù%Ó'Ð'øÜô Úðús   ˆ •$£$c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úis_clir   r-   )r   s   "r   r   r   þ   s   € ÷ Pñ P´Dð PÔ[_ñ Pr   c                óH   € \        T ;'       d    VRJ;'       d    VRJ 4      # )a[  Prefer the CLI Dangerous Command panel over a silent pending approval:
``HERMES_EXEC_ASK`` (or a platform marker) can leak into an interactive CLI
process (historically via ``import gateway.run``), and without a gateway notify
listener the ask branch used to return ``pending_approval`` immediately and
skip the panel the user can actually answer.Nr-   )rª   r§   Ú	notify_cbs   $$$r   Ú$_should_fall_through_to_cli_approvalr­   þ   s*   € ô �×NÐNÐ,°DÐ8×NÐN¸YÈ$Ð=NÓOÐOr   c                ó$   € V ^8„  d   QhR\         /# r,   r5   )r   s   "r   r   r   
  s   € ÷ ñ ¤cñ r   c                ó,  € \        V \        4      '       d   V RJ d   R# R# \        V \        4      '       d^   V P                  4       P	                  4       pV\
        9   d   V# V'       d+   \        P                  RV RP                  \
        4      4       R# )a  Normalize approval mode values loaded from YAML/config. YAML 1.1 parses a
bare ``off`` as False, so ``mode: off`` arrives as a bool; treat it as the
intended string mode. Unknown strings (e.g. 'auto') warn and fall back to
'manual' instead of silently failing every mode check.FÚoffÚmanualuF   Unknown approvals.mode %r â€” defaulting to 'manual'. Valid values: %sz, )	Ú
isinstancer   r   ÚstripÚlowerÚ_VALID_MODESrA   ÚwarningÚjoin)ÚmodeÚ
normalizeds   & r   Ú_normalize_approval_moderº   
  sw   € ô
 �$œ×ÒØ ›ˆuÐ3¨8Ð3Ü�$œ×ÒØ—Z‘Z“\×'Ñ'Ó)ˆ
ØœÔ%ØÐßÜ�N‰Nð .Ø/3°T·Y±Y¼|Ó5LôNár   c                ó$   € V ^8„  d   QhR\         /# r,   ©Údict)r   s   "r   r   r     s   € ÷ ñ œdñ r   c                 ó²   €  ^ RI Hp  V ! 4       P                  R/ 4      ;'       g    / #   \         d#   p\        P                  RT4       / u Rp?# Rp?ii ; i)u—   Read the approvals config block: the LIVE config-cache sub-dict
(load_config_readonly contract) â€” callers must not mutate it or any nested structure.©Úload_config_readonlyÚ	approvalsz"Failed to load approval config: %sN)Úhermes_cli.configrÀ   r0   r<   rA   r¶   )rÀ   Úes     r   Ú_get_approval_configrÄ     sL   € ðÝ:Ù#Ó%×)Ñ)¨+°rÓ:×@Ð@¸bÐ@øÜô Ü�‰Ð;¸QÔ?Ø�	ûðús   ‚#) ¦) ©A´AÁAÁAc                ó$   € V ^8„  d   QhR\         /# r,   r5   )r   s   "r   r   r   &  s   € ÷ Rñ RœCñ Rr   c                 ó¨   €  ^ RI Hp  V ! 4       ;pe   VP                  #  \	        \        4       P                  RR4      4      #   \         d     L0i ; i)zKReturn 'manual', 'smart', or 'off' (a hosted-room policy overrides config).)Úcurrent_room_execution_policyr¸   r±   )Ú$gateway.hosted_room_execution_policyrÇ   Úapproval_moder<   rº   rÄ   r0   )rÇ   Úroom_policys     r   Ú_get_approval_moderË   &  s\   € ðÝVÙ8Ó:Ð:ˆKÒGØ×,Ñ,Ð,ð Hô $Ô$8Ó$:×$>Ñ$>¸vÀxÓ$PÓQÐQøô ô Ùðús   ‚A ÁAÁAc                ó$   € V ^8„  d   QhR\         /# r,   )Úint)r   s   "r   r   r   1  s   € ÷ ñ œsñ r   c                 ó  €  \        \        4       P                  RR4      4      p  ^ RIHp \        T4      pY8”  d   \        P                  RY4       \        Y4      #   \        \        3 d     R# i ; i  \         d    Rp LNi ; i)aŸ  Read ``approvals.timeout`` (default 300s: gateway push notifications may
not be seen for minutes; 60s failed closed before Telegram taps landed).
Clamped to ``agent.deadline.MAX_SAFE_TIMEOUT_S`` (~1 year): a larger value
overflows ``time_t`` inside ``Thread.join`` / ``Lock.acquire`` on macOS and
crashed every parallel tool batch; clamping at the single config-read site
keeps every consumer platform-safe at once.Útimeouti,  )ÚMAX_SAFE_TIMEOUT_SzGapprovals.timeout=%s exceeds the platform-safe maximum; clamping to %ss)rÍ   rÄ   r0   Ú
ValueErrorÚ	TypeErrorÚagent.deadlinerÐ   r<   rA   r¶   Úmin)ÚrawrÐ   Úsafe_caps      r   Ú_get_approval_timeoutr×   1  s…   € ðÜÔ&Ó(×,Ñ,¨Y¸Ó<Ó=ˆðÝ5ÜÐ)Ó*ˆð „~Ü�‰Ð`ÐbeÔpÜˆsÓÐøô œ	Ð"ô Úðûô
 ô ØŠðús"   ‚#A ¦A6 ÁA3Á2A3Á6BÂBc                ó0   € V ^8„  d   QhR\         R\        /# )r   Úsecondsr   )rÍ   r   )r   s   "r   r   r   F  s   € ÷ lñ l¤Cð l¬Cñ lr   c                ó  € \        \        T ;'       g    ^ 4      ^ 4      p V '       d   V R,          ^ 8X  d   V R,          Rr!M$V '       d   V ^<,          ^ 8X  d   V ^<,          Rr!MT Rr!\        V^8X  d   RV R2VR7      # RV R2VR7      # )	uë   The ONE human wording for an approval timeout window, shared by the CLI timeout notice,
the tool result's ``user_summary`` and the gateway card copy so every surface agrees:
300 â†’ "5 minutes", 90 â†’ "90 seconds", 7200 â†’ "2 hours".i  ÚhourÚminuteÚsecondzapproval.window.Ú_oneÚ_other)Úcount)ÚmaxrÍ   r   )rÙ   rà   Úunits   &  r   Úformat_approval_windowrã   F  sŠ   € ô ”#�g—l�l Ó# QÓ'€Gß�7˜T•> QÔ&Ø •o v‰tß	�W˜r•\ QÔ&Ø •m X‰tà˜xˆtÜ¨e°q¬jÐ ˜v TÐ*ÐejÔkÐkÐ@PÐQUÐPVÐV\Ð>]ÐejÔkÐkr   c                ó$   € V ^8„  d   QhR\         /# r,   r¼   )r   s   "r   r   r   T  s   € ÷ Qñ Q¬ñ Qr   c                 óB   € \        4       p R\        V 4      RV ^,          /# )zÇ``{waited, suggested}`` for the ``approval.timeout`` copy: how long we waited (``5 minutes`` /
``90 seconds``) and a tripled ``approvals.timeout`` value the user can paste into ``hermes config set``.ÚwaitedÚ	suggested)r×   rã   )rÙ   s    r   Úapproval_timeout_notice_kwargsrè   T  s%   € ô $Ó%€GØÔ,¨WÓ5°{ÀGÈaÅKÐPÐPr   c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úkeyr   r5   )r   s   "r   r   r   [  s   € ÷ ñ œsð ¤sñ r   c           	     ó¼   €  ^ RI Hp \        \        V! 4       RV RR7      4      P	                  4       P                  4       pVR9   d   R# R#   \         d     R# i ; i)z?Read ``approvals.<key>`` as 'approve' or 'deny' (default deny).r¿   rÁ   Údenyr   Úapprove>   r°   ÚyesÚallowrí   )rÂ   rÀ   r   r   r´   r³   r<   )rê   rÀ   r¸   s   &  r   Ú_binary_approval_moderð   [  sZ   € ðÝ:Ü”7Ñ/Ó1°;ÀÈVÔTÓU×[Ñ[Ó]×cÑcÓeˆØ Ð$FÔFˆyÐRÈFÐRøÜô Úðús   ‚AA Á
A ÁAÁAc                ó$   € V ^8„  d   QhR\         /# r,   r5   )r   s   "r   r   r   e  s   € ÷ .ñ .¤ñ .r   c                 ó   € \        R4      # )zERead the cron approval mode from config. Returns 'deny' or 'approve'.Ú	cron_mode©rð   rŠ   r   r   Ú_get_cron_approval_moderõ   e  s   € ä  Ó-Ð-r   c                ó$   € V ^8„  d   QhR\         /# r,   r5   )r   s   "r   r   r   j  s   € ÷ 6ñ 6¬ñ 6r   c                 ó   € \        R4      # )zRRead the single-query (-q) approval mode from config. Returns 'deny' or 'approve'.Úsingle_query_moderô   rŠ   r   r   Ú_get_single_query_approval_moderù   j  s   € ä Ð!4Ó5Ð5r   c                ó$   € V ^8„  d   QhR\         /# r,   r5   )r   s   "r   r   r   o  s   € ÷ 4ñ 4¤sñ 4r   c                 ó   € \        R4      # )u¸   Approval mode for webhook / msgraph_webhook / api_server sessions; default
deny â€” an unattended session never silently runs a flagged action unless the
operator explicitly trusts it.Úunattended_moderô   rŠ   r   r   Ú_get_unattended_approval_moderý   o  s   € ô !Ð!2Ó3Ð3r   c                óT   € V ^8„  d   QhR\         \        \        R,          3,          /# )r   r   N)Útupler   )r   s   "r   r   r   v  s#   € ÷ Oñ O¬¬c´3¸µ:¨oÕ(>ñ Or   c                 óì  €  ^ RI Hp  V ! 4       ;'       g    / P                  R4      ;'       g    / P                  R4      ;'       g    / p\        VP                  R4      ;'       g    R4      P	                  4       P                  4       p\        VP                  R4      ;'       g    R4      P	                  4       P                  4       pT;'       g    RTR8X  d   R3# R3#   \         d    R	u # i ; i)
zCReturn explicitly selected transport and fail-closed fallback mode.r¿   ÚsecurityÚapprovalÚ	transportÚbuiltinÚtransport_fallbackr   N)zconfig-errorN)rÂ   rÀ   r0   r   r³   r´   r<   )rÀ   ÚcfgÚselectedÚfallbacks       r   Ú_get_approval_transport_configr	  v  sÙ   € ð$Ý:Ù$Ó&×,Ð,¨"×1Ñ1°*Ó=×CÐCÀ×HÑHÈÓT×ZÐZÐXZˆÜ�s—w‘w˜{Ó+×8Ð8¨yÓ9×?Ñ?ÓA×GÑGÓIˆÜ�s—w‘wÐ3Ó4×:Ð:¸Ó;×AÑAÓC×IÑIÓKˆð
 × Ð �y¨x¸9Ô/D )ÐNÐNÈ$ÐNÐNøô	 ô $ð $Ò#ð$ús-   ‚C# –C# ¯C# ÁC# Á(?C# Â(#C# Ã#C3Ã2C3c                óÀ  € V ^8„  d   Qh/ ^ \         9   d   \        P                  \        ,          ;R&   ^\         9   d   \        P                  \        ,          ;R&   ^\         9   d   \        P                  \        ,          ;R&   ^\         9   d   \        P                  \        ,          ;R&   ^\         9   d&   \        P                  \        R,          ,          ;R&   # )r   rk   r>   r?   r@   Nr!   )Ú__conditional_annotations__r   r   r   )r   s   "r   r   r      s¨   € ÷ ñ ÷. RÒ Q”{×-Ñ-¬cÕ2Ñ Qñ/÷0 JÒ I”;×)Ñ)¬#Õ.Ñ Iñ1÷2 TÒ Sœ×.Ñ.¬sÕ3Ñ Sñ3÷: PÒ O”k×,Ñ,¬SÕ1Ñ Oñ;÷D _Ò ^œ×/Ñ/´°dµ
Õ;Ñ ^òEr   )r   >   ÚacprJ   ÚguiÚtuir   >   r�   Ú
api_serverr‘   )N)r±   Úsmartr°   )>r  Ú__doc__r   Úloggingr„   Ú
agent.i18nr   rÂ   r   Úutilsr   r   Ú	getLoggerrA   r   rk   r>   r?   r@   r!   r#   r*   r2   rE   rM   Ú	frozensetrT   rV   rg   rl   ro   rÿ   r   r   rq   rs   rz   r�   r†   r‹   r�   r”   r•   Ú"_NOTIFIER_BLIND_APPROVAL_PLATFORMSrœ   rŸ   r£   r¨   r­   rµ   rº   rÄ   rË   r×   rã   rè   rð   rõ   rù   rý   r	  r   )r  s   @r   Ú<module>r     sº  øðöó Û Û 	Ý Ý %ß 2à	×	Ò	Ð+Ó	,€÷9ñ 6:Ð:PÓ5QÐ Ó QÙ15Ð6HÓ1IÐ Ó IÙ6:Ð;RÓ6SÐ Ó Sñ 59Ð9NÓ4OÐ Ó Oñ
 ?CÐCWÐY]Ó>^Ð Ó ^õCõ
)õ
fõMõ,>ñ 'Ò'CÓDÐ õ	Nõeõ"8õ
'ð
 �×!Ñ! #Õ&¨×(9Ñ(9¸#Õ(>À×@QÑ@QÐRUÕ@VÐVÕ
W€ð8¸ð 8ÐPRð 8Ðfh÷ 8õ(÷:õ)õ3õ
@ñ "+Ò+WÓ!XÐ õEñ" &/°	Ð;LÐ/MÓ%NÐ "õHõ$;õVô(õPð *€õõ"õRõõ*lõQõõ.õ
6õ
4÷Or   