+
    iHàjò  ã                   ó‚   € R t ^ RIt^ RIHt RtR R ltRRRR	R
RRRRRRR/tRR R lltRR/R R llt ! R R4      t	R# )a  Operator-facing wait notice for long provider silences (#92550).

The 30s heartbeat is gateway liveness, not a warning. Once a request has been
silent past the notice threshold this module decides WHAT the status line says
(neutral: which phase of the wait we are in, which watchdog would reconnect and
when) and WHETHER to rewrite it: once when the silence starts, again only when
the wait phase changes or a watchdog deadline is near. Watchdog thresholds and
retry policy live with the watchdogs; this is presentation only.
N)ÚOptionalg      .@c                óh   € V ^8„  d   QhR\         \        \        \        3,          ,          R\        /# )é   ÚwatchdogÚreturn)r   ÚtupleÚstrÚfloatÚbool)Úformats   "ÚF/home/ubuntu/.hermes/hermes-agent/agent/chat_completion_wait_notice.pyÚ__annotate__r      s,   € ÷ Fñ FœX¤e¬C´¨JÕ&7Õ8ð F¼Tñ Fó    c                 ó:   € V R J;'       d    V ^,          \         8*  # ©N)ÚNEAR_DEADLINE_SECS)r   s   &r   Ú_near_deadliner      s   € Ø˜4Ð×EÐE H¨Q¥KÔ3EÑ$EÐEr   Úfirst_eventz){n}s waiting for the first provider eventÚ	reconnectz9{n}s waiting for the first provider event after reconnectÚpre_progressz=provider stream open; {n}s without substantive model progressÚ
post_eventz2provider stream active; {n}s without stream eventsÚfirst_chunkz'{n}s waiting for the first stream chunkÚ
post_chunkz'stream open; {n}s without stream outputc                óŒ   € V ^8„  d   QhR\         R\        R\         R\        \        \         \        3,          ,          R\         /# )r   ÚmodelÚsilence_secsÚphaser   r   )r   r	   r   r   )r   s   "r   r   r   !   s?   € ÷ ñ œCð ¬uð ¼Sð Ü'¬¬c´5¨jÕ(9Õ:ðÜFIñr   c           
     óî   € \        V4      '       d   RMRpRV RV  R2\        V,          P                  \        V4      R7      ,           pVe(   Vw  rgVRV R\	        ^ \        V4      4       R	2,          pV# )
zMOne neutral status line. ``watchdog`` is ``(label, seconds_until_it_fires)``.zstill waiting onz
waiting onu   â�³ Ú u    â€” )Únz (auto-reconnect: z watchdog in zs))r   Ú_PHASE_TEXTr   ÚintÚmax)r   r   r   r   ÚleadÚtextÚlabelÚ	remainings   &&&&    r   Úwait_notice_textr'   !   s�   € ô "0°×!9Ò!9Ñ¸|€DØ�$��q˜˜˜uÐ%¬°EÕ(:×(AÑ(AÄCÈÓDUÐ(AÓ(VÕV€DØÒØ#ÑˆØÐ$ U G¨=¼¸QÄÀIÃÓ9OÐ8PÐPRÐSÕSˆØ€Kr   Úprogress_timeoutç        c                ó.  € V ^8„  d   QhR\         R\        R\         R\        \         ,          R\        \         ,          R\        \         ,          R\         R\        R	\         R
\        R\         R\         R\        \        \        \         3,          ,          /# )r   Ústale_timeoutÚttfb_enabledÚttfb_timeoutÚlast_event_tsÚlast_progress_tsÚretry_started_tsÚ
call_startÚidle_enabledÚidle_timeoutÚidle_requires_progressÚelapsedr(   r   )r	   r
   r   r   r   )r   s   "r   r   r   ,   s˜   € ÷ %ñ %¬eð %Ä4ð %ÔW\ð %ÜœE•?ð%Ü6>¼uµoð%äœu•oð%ä38ð%äHLð%ô ð%ô 26ð%ô AFð%ô ð	%ô '/¬u´S¼%°ZÕ/@Õ&Añ	%r   c                ón  € . p\         P                  ! V 4      '       d   VP                  RV 34       Ve   \        RWV,
          4      MRpVf?   V'       d6   \         P                  ! V4      '       d   VP                  RWÒ,           34       MV^ 8”  d   Vf   VP                  RWÛ,           34       MZV	'       d   VeO   V'       dG   \         P                  ! V4      '       d+   VP                  R\        RW6,
          4      V,           34       V'       g   R# \	        VR R7      w  rïWú8:  d   R# WïV
,
          3# )	z“Earliest enabled Codex watchdog as ``(label, seconds_until_it_fires)``; None when
none applies (disabled/infinite, or its deadline already passed).zwall-clock staleNr)   ÚTTFBzfirst progresszstream idlec                 ó   € V ^,          # )é   © )Úds   &r   Ú<lambda>Ú)codex_watchdog_deadline.<locals>.<lambda>@   s   € °1°Q¶4r   )Úkey)ÚmathÚisfiniteÚappendr"   Úmin)r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r(   Ú	deadlinesÚattempt_offsetr%   Údeadlines   $$$$$$$$$$$$    r   Úcodex_watchdog_deadlinerF   ,   s  € ð *,€IÜ‡}‚}�]×#Ò#Ø×ÑÐ,¨mÐ<Ô=Ø@PÒ@\”S˜Ð.Õ;Ô<Ðbe€NØÒßœDŸMšM¨,×7Ò7Ø×Ñ˜f nÕ&CÐDÔEøØ	˜AÔ	Ð"2Ò":Ø×ÑÐ*¨NÕ,MÐNÕOß$Ð(8Ò(DÏ,Ô[_×[hÒ[hÐiu×[vÒ[vØ×Ñ˜-¬¨S°-Õ2LÓ)MÐP\Õ)\Ð]Ô^ßÙÜ˜)©Ô8�O€EØÔÙØ˜WÕ$Ð$Ð$r   c                   óZ   a € ] tR t^Ft o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
ÚWaitNoticeStateaY  Per-request memory of what the status line currently shows.

``should_emit`` is True for the first notice of a silence, for a phase or
watchdog change, and once when the applicable deadline comes within
``NEAR_DEADLINE_SECS``; every other heartbeat only touches liveness.
``reset`` when activity resumes so the next silence gets a fresh notice.
c                ó   <€ V ^8„  d   QhRR/# ©r   r   Nr:   )r   Ú__classdict__s   "€r   r   ÚWaitNoticeState.__annotate__O   s   ø€ ÷ ñ ˜$ñ r   c                ó&   € V P                  4        R # r   )Úreset©Úselfs   &r   Ú__init__ÚWaitNoticeState.__init__O   s   € Ø�
‰
Žr   c                ó   <€ V ^8„  d   QhRR/# rJ   r:   )r   rK   s   "€r   r   rL   R   s   ø€ ÷  ñ  �tñ  r   c                ó0   € R V n         R V n        RV n        R # )NF)r   Úwatchdog_labelÚ
near_shownrO   s   &r   rN   ÚWaitNoticeState.resetR   s   € Ø$(ˆŒ
Ø-1ˆÔØˆŽr   c                óR   <€ V ^8„  d   QhRS[ RS[S[S[ S[3,          ,          RS[/# )r   r   r   r   )r   r   r   r	   r
   )r   rK   s   "€r   r   rL   W   s1   ø€ ÷ ñ ¡ð ±¹¹sÁE¸zÕ9JÕ0Kð ÑPTñ r   c                ó  € Ve
   V^ ,          MR p\        V4      pV P                  V8g  ;'       g3    V P                  V8g  ;'       g    T;'       d    V P                  '       * pWuV n        V n        V'       d   RV n        V# )NT)r   r   rU   rV   )rP   r   r   r%   ÚnearÚemits   &&&   r   Úshould_emitÚWaitNoticeState.should_emitW   su   € Ø'Ò3�˜–¸ˆÜ˜hÓ'ˆØ�z‰z˜UÑ"×dÐd d×&9Ñ&9¸UÑ&B×dÐdÀt×GcÐGcÐTX×TcÑTcÔPcˆØ*/Ð'ˆŒ
�DÔ'ßØ"ˆDŒOØˆr   )rV   r   rU   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rQ   rN   r\   Ú__static_attributes__Ú__classdictcell__)rK   s   @r   rH   rH   F   s(   ø‡ € ñ÷ð ÷ ð  ÷
ö r   rH   r   )
rb   r?   Útypingr   r   r   r    r'   rF   rH   r:   r   r   Ú<module>rf      si   ðñó Ý àÐ õFð Ð>ØÐLØÐSØÐFàÐ<ØÐ;ð	€÷ð%ð "÷	%÷4ó r   