+
    jHàjU  ã                  ó~   € R t ^ RIHt ^ RIt^ RIt^ RIHtHtHt R R lt	R R lt
R R	 ltR
 R ltRR/R R lltR# )ax  Gateway session stall notification policy.

Consumes ``AIAgent.get_activity_summary()`` as the **single progress source** and owns
only the notify-once policy for "pending inbound + stale progress"; it never derives a
parallel progress clock from turn-start or inbound timestamps.  Pending inbound is a
stall *policy gate*, not a delivery obligation and not process liveness.
)ÚannotationsN)ÚAnyÚMappingÚOptionalc          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	é   Útimeout_secondsÚfloatÚidle_secondsúOptional[float]Úhas_pending_inboundÚboolÚalready_notifiedÚreturn© )Úformats   "Ú:/home/ubuntu/.hermes/hermes-agent/gateway/session_stall.pyÚ__annotate__r      s6   € ÷ ñ ØðØ-<ðØSWðàðð 
ñó    c                ón   € V ^ 8„  ;'       d*    T;'       d     V'       * ;'       d    VRJ;'       d    W8¬  # )zAReturn True when a stall warning should be sent for this session.Nr   )r   r
   r   r   s   $$$$r   Ú&should_emit_session_stall_notificationr      sX   € ð 	˜!Ñ÷ 	Ið 	IÐ 3÷ 	Ið 	IÐ<LÔ8L÷ 	Ið 	IØ Ð$÷	Ið 	IØ)5Ñ)Hðr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r   r	   r
   r   r   r   r   r   )r   s   "r   r   r      s2   € ÷ Gñ GØðGØ-<ðGØSWðGà	ñGr   c                óD   € V'       d   V ^ 8:  d   R# VRJ;'       d    W8  # )zEReturn True when a prior stall notice may be cleared (episode ended).TNr   )r   r
   r   s   $$$r   Ú'should_clear_session_stall_notificationr      s'   € ÷  /°QÔ"6Ùà˜tÐ#×FÐF¨Ñ(FÐFr   c               ó    € V ^8„  d   QhRRRR/# )r   r
   r	   r   Ústrr   )r   s   "r   r   r   %   s   € ÷ <ñ <°Eð <¸cñ <r   c                óF   € \        ^\        V ^<,          4      4      pRV R2# )z8User-facing stall warning (ASCII minutes).

See #72016.
u+   âš ï¸� I seem to be stuck (no activity for zT min). Send /stop to cancel the current task, or /new to start a fresh conversation.)ÚmaxÚint)r
   Úminss   & r   Ú!format_session_stall_notificationr    %   s1   € ô
 ˆq”#�l bÕ(Ó)Ó*€DØ9¸$¸ð @;ð ;ð <r   c               ó    € V ^8„  d   QhRRRR/# )r   Úvaluer   r   r   r   )r   s   "r   r   r   /   s   € ÷ 5ñ 5˜ð 5 ñ 5r   c                óÂ   € V e   \        V \        4      '       d   R#  \        V 4      p\
        P                  ! T4      '       d   T# R#   \        \        3 d     R# i ; i)zI``value`` as a finite float, or None (bools are rejected as non-numeric).N)Ú
isinstancer   r	   Ú	TypeErrorÚ
ValueErrorÚmathÚisfinite)r"   Úresults   & r   Ú_finite_floatr*   /   sX   € à‚}œ
 5¬$×/Ò/ÙðÜ�u“ˆô —]’] 6×*Ò*ˆ6Ð4°Ð4øô ”zÐ"ô Úðús   žA	 Á	AÁAÚnowc               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚactivityzOptional[Mapping[str, Any]]r+   r   r   r   )r   s   "r   r   r   :   s)   € ÷ Gñ GØ)ðGØ3BðGàñGr   c               óB  € V '       g   R# \        V P                  R4      4      pVe   \        RV4      # V P                  R4      p\        Vf   V P                  R4      MT4      pVf   R# \        R\        Vf   \        P                  ! 4       MT4      V,
          4      # )u  Idle seconds from a shared activity snapshot: a finite ``seconds_since_activity``, else
derived from ``last_activity_at`` / ``last_activity_ts``.  None when there is no usable
progress timestamp â€” callers must not fall back to turn-start or inbound clocks.

See #72039.
NÚseconds_since_activityg        Úlast_activity_atÚlast_activity_ts)r*   Úgetr   r	   Útime)r-   r+   ÚidleÚtsÚwhens   &$   r   Ú*resolve_session_idle_seconds_from_activityr7   :   s„   € ÷ ÙÜ˜Ÿ™Ð&>Ó?Ó@€DØÒÜ�3˜‹~ÐØ	�‰Ð(Ó	)€BÜ¸RºZ˜Ÿ™Ð&8Ô9ÈRÓP€DØ‚|ÙÜˆs”E¨ªœ$Ÿ)š)œ+¸#Ó>ÀÕEÓFÐFr   )Ú__doc__Ú
__future__r   r'   r3   Útypingr   r   r   r   r   r    r*   r7   r   r   r   Ú<module>r;      sE   ðñõ #ã Û ß )Ñ )õõGõ<õ5ðGØEI÷Gñ Gr   