+
    iHàjî  ã                  ó†   € R t ^ RIHt ^ RIt^ RIt^ RIHtHtHt ^ RI	H
t
 ]P                  ! ]4      tRtRt ! R R4      tR# )	zgPre-LLM summary skips for ContextCompressor: compact deterministically without calling a summary model.)ÚannotationsN)ÚAnyÚDictÚList)Úestimate_messages_tokens_roughgš™™™™™¹?Ú_fallback_probe_atc                  óJ   € ] tR t^tRtR R ltR R ltR R ltR R	 ltR
t	R# )ÚPreLlmSkipMixinzSDecides, before the summary call, whether compress() should skip the summary model.c               ó    € V ^8„  d   QhRRRR/# )é   ÚatÚfloatÚreturnÚNone© )Úformats   "ÚD/home/ubuntu/.hermes/hermes-agent/agent/context_compressor_prellm.pyÚ__annotate__ÚPreLlmSkipMixin.__annotate__   s   € ÷ 
ñ 
¨ð 
°4ñ 
ó    c                ó|   € WP                   8X  d   R# Wn         T P                  RR\        T;'       g    R/4       R# )z³Set the summary-model probe deadline, persisting on change only (0 = unarmed) so a rebuilt
compressor resumes the bench window instead of restarting it (same contract as #100185).NÚpatch_session_model_configúsummary-model probe deadline)r   Ú_durable_writeÚ#_FALLBACK_PROBE_AT_MODEL_CONFIG_KEY)Úselfr   s   &&r   Ú_set_fallback_probe_atÚ&PreLlmSkipMixin._set_fallback_probe_at   s?   € ð ×(Ñ(Ô(ÙØ"$ÔØ×ÑØ(Ð*HÔKnÐpr×pzÐpzÐvzÐJ{ö	
r   c               ó   € V ^8„  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   !   s   € ÷ 
ñ 
¨ñ 
r   c           	     	óD   € V P                  R RR\        R\        R4       R# )r   Úget_session_model_config_valuer   ç        N)Ú_load_durabler   r   )r   s   &r   Ú_load_fallback_probe_atÚ'PreLlmSkipMixin._load_fallback_probe_at!   s#   € Ø×ÑØ Ð"BÐDbÜ�3Ô;¸Sö	
r   c               ó    € V ^8„  d   QhRRRR/# )r   Ú	telemetryúdict[str, Any]r   Úboolr   )r   s   "r   r   r   '   s   € ÷ ñ ¨~ð À$ñ r   c           	     ó¤  € V P                   ^8  d   V P                  R4       R# \        P                  ! 4       pV P                  '       dV   W P                  8¼  dF   V P                  R4       V P                  '       g!   \
        P                  RV P                   4       R# V P                  '       d#   V P                  V,
          V P                  8”  d"   V P                  W P                  ,           4       RV n        RVR&   V P                  '       g=   \
        P                  RV P                   \        RV P                  V,
          4      4       R# )zøPre-LLM skip while two summaries in a row fell back: compact deterministically instead of
paying for a summary model that keeps failing (#63008). One probe per recovery window; a
healthy summary resets the streak, another fallback benches it again.r!   FzQCompression: probing the summary model again after %d fallback summaries in a rowTÚsummary_model_benchedÚfailure_classuž   Compression: %d fallback summaries in a row â€” skipping LLM summarization, proceeding with deterministic message dropping. Next summary-model probe in %.0fs.)Ú_fallback_compression_streakr   Útimer   Ú
quiet_modeÚloggerÚinfoÚ_ANTI_THRASH_RECOVERY_SECONDSÚ_last_feasibility_skipÚwarningÚmax)r   r&   Únows   && r   Ú_fallback_streak_skipÚ%PreLlmSkipMixin._fallback_streak_skip'   s  € ð ×,Ñ,¨qÔ0Ø×'Ñ'¨Ô,Ùä�iŠi‹kˆØ×"×"Ð" s×.EÑ.EÔ'EØ×'Ñ'¨Ô,Ø—?—?�?Ü—‘ØgØ×5Ñ5ôñ Ø×&×&Ð&¨$×*AÑ*AÀCÕ*GÈ$×JlÑJlÔ*lØ×'Ñ'¨×.PÑ.PÕ(PÔQØ&*ˆÔ#Ø%<ˆ	�/Ñ"Ø��ˆÜ�N‰NðUà×1Ñ1´3°s¸D×<SÑ<SÐVYÕ<YÓ3Zôñ
 r   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   r&   r'   Úturns_to_summarizezlist[dict[str, Any]]Úcompress_startÚintÚcompress_endr   r(   r   )r   s   "r   r   r   D   s6   € ÷ ñ Ø'ðØ=Qðàðà+.ðð 
ñr   c           	     ó²  € V P                   ^8  d   R# VP                  R4      pVf   \        V4      MTpV\        V P                  \
        ,          4      8¼  d   R# RV n        V ;P                  ^,          un        V P                  VR&   V P                  '       g:   \        P                  RWSV\
        ^d,          V P                  V P                  4       R# )zYPre-LLM skip after a real-usage ineffectiveness strike (reads the counter, never writes).FÚmiddle_window_tokensTÚprellm_skip_countuÆ   Compression: middle section (%d tokens at indices %d-%d) is below %.0f%% of threshold (%d tokens) â€” skipping LLM summarization, proceeding with deterministic message dropping. prellm_skip_count=%d)Ú_ineffective_compression_countÚgetr   r;   Úthreshold_tokensÚ!_FEASIBILITY_SKIP_MIDDLE_FRACTIONr2   Ú_prellm_skip_countr.   r/   r3   )r   r&   r9   r:   r<   Úmiddle_tokenss   &&&&& r   Ú_feasibility_skipÚ!PreLlmSkipMixin._feasibility_skipD   s¾   € ð
 ×.Ñ.°Ô2Ùð "Ÿ™Ð&<Ó=ˆØN[ÒNcÔ6Ð7IÔJÐivˆØœC × 5Ñ 5Ô8YÕ YÓZÔZÙØ&*ˆÔ#Ø×Ò 1Õ$ÕØ)-×)@Ñ)@ˆ	Ð%Ñ&Ø��ˆÜ�N‰Nðsà¨|Ü1°CÕ7Ø×%Ñ% t×'>Ñ'>ôñ r   )r   r2   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r#   r6   rF   Ú__static_attributes__r   r   r   r	   r	      s   † Ù]õ
õ
õ÷:ñ r   r	   )rL   Ú
__future__r   Úloggingr-   Útypingr   r   r   Úagent.model_metadatar   Ú	getLoggerrH   r/   rC   r   r	   r   r   r   Ú<module>rS      sD   ðÙ må "ã Û ß "Ñ "å ?à	×	Ò	˜8Ó	$€ð
 %)Ð !Ø&:Ð #÷Hó Hr   