+
    iHàjŠ  ã                  ó‚   € R t ^ RIHt ^ RIt^ RIHtHtHtHtH	t	 ^ RI
Ht ]'       d   ^ RIHt R R lt ! R R	4      tR# )
zHSummary-hook dispatch and cancellation rollback for context compression.)ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚDictÚListÚOptional)ÚAuxiliaryExplicitCancellation)Ú_HandoffScanc               ó$   € V ^8„  d   QhRRRRRR/# )é   Úcallable_objr   ÚnameÚstrÚreturnÚbool© )Úformats   "ÚE/home/ubuntu/.hermes/hermes-agent/agent/context_compressor_summary.pyÚ__annotate__r      s!   € ÷ ñ ¨Cð °sð ¸tñ ó    c                óà  €  \         P                  ! V 4      P                  p\
        ;QJ d*    R TP                  4        4       F  '       g   K   RM	  RM! R TP                  4        4       4      '       d   R# TP                  T4      pTRJ;'       dB    TP                  \         P                  P                  \         P                  P                  39   #   \        \        3 d     R# i ; i)zEReturn whether an inspectable callable accepts ``name`` as a keyword.Fc              3  ól   "  € T F*  qP                   \        P                  P                  J x € K,  	  R # 5i©N)ÚkindÚinspectÚ	ParameterÚVAR_KEYWORD)Ú.0Ú	parameters   & r   Ú	<genexpr>Ú,_accepts_keyword_argument.<locals>.<genexpr>   s%   é € Ð
`ÑL_¸y�>‰>œW×.Ñ.×:Ñ:Õ:ÓL_ùs   ‚24TN)r   Ú	signatureÚ
parametersÚ	TypeErrorÚ
ValueErrorÚanyÚvaluesÚgetr   r   ÚPOSITIONAL_OR_KEYWORDÚKEYWORD_ONLY)r   r   r"   r   s   &&  r   Ú_accepts_keyword_argumentr*      sÁ   € ðÜ×&Ò& |Ó4×?Ñ?ˆ
÷ ƒsÑ
`ÈJ×L]ÑL]ÔL_Ó
`‡s‡s‚sÑ
`ÈJ×L]ÑL]ÔL_Ó
`×`Ò`ÙØ—‘˜tÓ$€IØ˜DÐ ÷ ð  Y§^¡^Ü×Ñ×/Ñ/Ü×Ñ×&Ñ&ð8ñ &ð øô ”zÐ"ô Úðús   ‚ C ÃC-Ã,C-c                  ó2   € ] tR t^tRR R lltR R ltRtR# )ÚSummaryDispatchMixinNc               ó$   € V ^8„  d   QhRRRRRR/# )r   Úcall_kwargsÚdictÚpinnedzOptional[dict[str, Any]]r   ÚNoner   )r   s   "r   r   Ú!SummaryDispatchMixin.__annotate__   s#   € ÷ !)ñ !)°ð !)Ð>Vð !)Ðbfñ !)r   c           
     óì  € V'       d/   R F  pVP                  VR4       K  	  VP                  V4       R# V P                  '       d   V P                  VR&   R# \        V RR4      '       g   R# ^ R	IHp T! VP                  R
4      ;'       g    R4      VR
&   RV P                  3RV P                  3RV P                  3RV P                  3R\        V RR4      33 F  w  r5V'       g   K  WQV&   K  	  R# )uÔ  Pin the summary route onto ``call_kwargs`` for both compression entry points.

After a fallback, an omitted route is NOT "use the main model": ``call_llm`` re-resolves
``auxiliary.compression`` from config â€” the model that just failed â€” and a second fallback
is refused, so every later attempt aborts (#123362). Name the main runtime explicitly.
A stall-fallback ``pinned`` route replaces the whole route: merged over the main runtime, the
main api_key/base_url would ride into the fallback entry's call (to its host, or instead of it).
The main route is complete even with empty fields: an authoritative task keeps compression
policy but never fills an unset endpoint/key/wire mode from the failed aux route (#130895).
ÚproviderÚmodelÚbase_urlÚapi_keyÚapi_modeNÚ_summary_model_fallen_backF)Úauthoritative_auxiliary_taskÚtaskÚcompressionÚ )r4   r5   r6   r7   r8   )ÚpopÚupdateÚsummary_modelÚgetattrÚagent.auxiliary_task_configr:   r'   r4   r5   r6   r7   )Úselfr.   r0   Úkeyr:   Úvalues   &&&   r   Ú_apply_summary_routeÚ)SummaryDispatchMixin._apply_summary_route   så   € ÷ ãO�Ø—‘  TÖ*ñ Pà×Ñ˜vÔ&ÙØ××ÐØ#'×#5Ñ#5ˆK˜Ñ ÙÜ�tÐ9¸5×AÒAÙÝLá:¸;¿?¹?È6Ó;R×;cÐ;cÐVcÓdˆ�FÑà˜Ÿ™Ð'Ø�d—j‘jÐ!Ø˜Ÿ™Ð'Ø˜Ÿ™Ð%Øœ  z°2Ó6Ð7ó
‰JˆC÷ ‰uØ#(˜CÓ ó
r   c               ó4   € V ^8„  d   QhRRRRRRRRRR	R
RRR/# )r   Úmessageszlist[dict[str, Any]]Úturns_to_summarizeÚscanr	   Úfocus_topiczOptional[str]Úmemory_contextr   Úbypass_cooldownr   r   r   )r   s   "r   r   r2   A   sF   € ÷ +ñ +Ø,ð+ØBVð+Ø^jð+à"ð+à47ð+àJNð+ð 
ñ+r   c                óØ  € ^ RI Hp V! 4       '       d@   ^ RIHp V! V 4       RV n        \        V RR4      p	\        V	\        4      '       d   RV	R&   R# RT;'       g    V P                  V4      R	V/p
\        V P                  R
4      '       d   WjR
&    V P                  ! V3/ V
B #   \         d9    ^ RIHp T! T 4      '       d#   TP                  T n        TP                  T n        h i ; i)a"  Run the summary LLM; a cancellation rolls back the handoff scan's self-heal mutation first.
A deterministic pin (repeated stall, #112420) skips the LLM: ``None`` lets Phase 3 insert the static
fallback summary, or abort under ``abort_on_summary_failure`` exactly like a failed summary call.)Útake_deterministic_summary_pin)Ú_raise_if_stale_attemptzMsummary model stalled on every route; deterministic fallback summary insertedÚ_active_compression_telemetryNÚstall_deterministic_fallbackÚfailure_classrL   rM   rN   )Ú_caller_attempt_is_current)Úagent.context_compressorrP   Úagent.conversation_compressionrQ   Ú_last_summary_errorrA   Ú
isinstancer/   Ú_derive_auto_focus_topicr*   Ú_generate_summaryr   rU   Úprevious_summary_beforeÚ_previous_summaryÚhas_user_turn_beforeÚ_summary_has_user_turn)rC   rI   rJ   rK   rL   rM   rN   rP   rQ   Ú	telemetryÚsummary_kwargsrU   s   &&&&&&&     r   Ú_summarize_windowÚ&SummaryDispatchMixin._summarize_windowA   sø   € õ 	LÙ)×+Ò+õ Oá# DÔ)ð `ð Ô$ô   Ð&EÀtÓLˆIÜ˜)¤T×*Ò*Ø-K�	˜/Ñ*Ùð ˜;×QÐQ¨$×*GÑ*GÈÓ*QØ˜nð*
ˆô % T×%;Ñ%;Ð=N×OÒOØ0?Ð,Ñ-ð	Ø×)Ò)Ð*<ÑOÀÑOÐOøÜ,ô 	õ Rá)¨$×/Ò/Ø)-×)EÑ)E�Ô&Ø.2×.GÑ.G�Ô+Øð	ús   ÂB& Â&C)Ã$C))rX   r]   r_   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rF   rb   Ú__static_attributes__r   r   r   r,   r,      s   † ÷!)÷F+ñ +r   r,   )Ú__doc__Ú
__future__r   r   Útypingr   r   r   r   r   Úagent.auxiliary_clientr   rV   r	   r*   r,   r   r   r   Ú<module>rm      s.   ðÙ Nå "ã ß ;Õ ;å @çÝ5õ÷Oó Or   