+
    iHàjS  ã                  óŽ   € R t ^ RIHt ^ RIt^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHtHt ]P                  ! R4      tR	 R
 ltR# )ad  Pre-API pressure gate for the conversation turn loop: the Ollama runtime-context floor,
the provider-overflow re-check arming, the insufficient-progress blocker (compares fully
assembled requests, not raw ``messages``) and the call into
``turn_preflight.run_preflight_compression``. Nothing here imports
``agent.conversation_loop`` at module level (cycle).)ÚannotationsN)Úsuppress)ÚAny)Úappend_message)Ú,_compression_warrants_another_preflight_pass)ÚPreflightGateVerdictÚrun_preflight_compressionzagent.conversation_loopc          *     ól   € V ^8„  d   QhRRRRRRRRRRRRRRR	RR
RRRRRRRRRRRRRRRRRRRRRRRRR/# )é   Úagentr   Úrequest_pressure_tokensÚ_moa_prepared_requestÚpending_moa_prepared_requestÚmessagesÚsystem_messageÚuser_messageÚactive_system_promptÚconversation_historyÚapi_call_countÚcompression_attemptsÚmax_compression_attemptsÚeffective_task_idÚfinal_responseÚfailedÚ_turn_exit_reasonÚ_compression_timeout_exhaustedÚ_preflight_compression_blockedÚ#_provider_overflow_recovery_pendingÚ_last_preflight_pressureÚreturnr   © )Úformats   "Ú>/home/ubuntu/.hermes/hermes-agent/agent/turn_preflight_gate.pyÚ__annotate__r#      sï   € ÷ Rñ RØðRØ,/ðRØHKðRà"%ðRà14ðRàFIðRàY\ðRð ðRð 69ðRð KNðRð ð	Rð :=ð	Rð RUð	Rð
 ðRð
 "%ðRð
 :=ðRð
 _bðRð %(ðRð ORðRð "ðRð ñRó    c               ó„  € ^ RI Hp \        RVWGW‰W­VVVVVRR7      pV! W4      pV'       d®   VVn        RVn        RVn        \        VRRR	VP                  /4       V P                  R
4       V;P                  ^,          un        VP                  V n	        \        \        4      ;_uu_ 4        V P                  P                  4        RRR4       RVn        V# V P                  p\!        \#        VR^ 4      ;'       g    ^ 4      pT;'       d    V^ 8*  ;'       g    VV8¬  pV'       d   V'       g   RVn        Ve=   VV8¼  d6   \'        VVV4      '       g#   RVn        \*        P-                  RVR VR 4       \/        T TTTT\#        V RR4      '       d   R M\#        VRR 4      W%WkVR7      #   + '       g   i     Lî; i)zÕRun the pre-API guard chain in the original order. ``_last_preflight_pressure`` is
consumed here (set to None) and re-armed only by a compression pass, so a blocked
preflight never compares against a stale figure.)Ú_ollama_context_limit_errorÚfallthroughN)Úactionr   r   r   r   r   r   r   r   r   r   r   r   r   TÚ ollama_runtime_context_too_smallÚroleÚ	assistantÚcontentu;   â�Œ Ollama runtime context is too small for Hermes tool useÚbreakÚthreshold_tokensFzoPre-API compression made insufficient progress: ~%s -> ~%s request tokens; skipping additional preflight passesÚ,Ú_request_pressure_anchoredc                ó   € R # ©Fr    ©Ú_ts   &r"   Ú<lambda>Ú$run_preflight_gate.<locals>.<lambda>`   s   € ™r$   Ú$should_defer_preflight_to_real_usagec                ó   € R # r2   r    r3   s   &r"   r5   r6   a   s   € ÑY^r$   )	Ú
compressorr   Úprovider_overflow_preflightÚdefer_preflightÚmoa_prepared_requestr   r   r   r   )Úagent.conversation_loopr&   r   r   r   r   r   Ú_emit_diagnostic_statusr   Ú_api_call_countr   Ú	ExceptionÚiteration_budgetÚrefundr(   Úcontext_compressorÚintÚgetattrr   r   r   ÚloggerÚwarningr   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r&   ÚvÚ_runtime_context_errorÚ_compressorÚ_preflight_thresholdÚ_provider_overflow_preflights   &$$$$$$$$$$$$$$$$$$$      r"   Úrun_preflight_gaterM      sÙ  € õ DäØÐ;WØØ1Ø1ÐY_Ø+Ø'EØ'EØ,OØ!%ô
	€Añ 9¸ÓXÐßØ1ˆÔØˆŒØ@ˆÔÜ�x &¨+°yÀ!×BRÑBRÐ!SÔTØ×%Ñ%Ð&cÔdØ	×Ò˜AÕÕØ !× 0Ñ 0ˆÔÜ”i× Õ Ø×"Ñ"×)Ñ)Ô+÷ !àˆŒØˆð
 ×*Ñ*€KÜœw {Ð4FÈÓJ×OÐOÈaÓPÐØ#F÷ $ð $Ø Ñ!×TÐTÐ%<Ð@TÑ%Tð !÷ +×3Oð 16ˆÔ-ð 	!Ò,Ø#Ð';Ô;Ü<Ø$Ð&=Ð?S÷
ò 
ð ,0ˆÔ(Ü�‰ðGà'¨Ð*Ø& qÐ)ô		
ô %Øˆq˜[ÐBYØ$@ô #*¨%Ð1MÈu×"UÒ"UÒÜ˜Ð&LÑN^Ó_à2Ø!Ø+ôð ÷G !× ús   Â.F/Æ/F?	)Ú__doc__Ú
__future__r   ÚloggingÚ
contextlibr   Útypingr   Úagent.message_metadatar   Úagent.turn_contextr   Úagent.turn_preflightr   r   Ú	getLoggerrF   rM   r    r$   r"   Ú<module>rW      s8   ðñ8õ #ã Ý Ý å 1Ý Kß Pà	×	Ò	Ð4Ó	5€÷Rr$   