+
    iHàjÝ	  ã                  óT   a € 0 t $ R t^ RIHt ^ RIHt R
tR]R&   R R ltRR R	 llt	R# )uS  Thinking-timeout detection and user-facing guidance for reasoning models.

A known reasoning model hitting a transport-layer error before the first content token was
almost certainly idle-killed mid-think by the upstream proxy â€” not a context overflow â€” so
the generic stream-drop guidance in conversation_loop is wrong for that case.
)Úannotations)ÚOptionalztuple[str, ...]Ú_THINKING_TIMEOUT_SUBSTRINGSc               ó(   € V ^8„  d   QhRRRRRRRR/# )é   Ú
classifiedÚobjectÚmodelÚstrÚ	error_msgÚreturnÚbool© )Úformats   "ÚD/home/ubuntu/.hermes/hermes-agent/agent/thinking_timeout_guidance.pyÚ__annotate__r      s.   € ÷ Uñ U Fð U°3ð UÀ3ð UÈ4ñ Uó    c                óê   a€ ^ RI Hp \        \        V RR4      RR4      R8w  d   R# V! V4      f   R# \        ;QJ d#    V3R l\         4       F  '       g   K   R# 	  R# ! V3R l\         4       4      # )	ai  True when a reasoning model's thinking phase hit a transport kill.

All must hold: ``classified.reason`` is the ``timeout`` FailoverReason (duck-typed via
``.value`` to avoid importing error_classifier), ``model`` is in the reasoning allowlist,
and ``error_msg`` carries a transport-kill substring. The caller gates on the error having
no HTTP ``status_code``.
)Ú!get_reasoning_stale_timeout_floorÚreasonNÚvalueÚtimeoutFc              3  ó\   <"  € T F!  qS;'       g    R P                  4       9   x € K#  	  R# 5i)Ú N)Úlower)Ú.0Úpr   s   & €r   Ú	<genexpr>Ú&is_thinking_timeout.<locals>.<genexpr>#   s%   øé € ÐTÑ7S°!�Y—_�_ "×+Ñ+Ó-Ö-Ó7Sùs   ƒ,‘,T)Úagent.reasoning_timeoutsr   ÚgetattrÚanyr   )r   r	   r   r   s   &&f r   Úis_thinking_timeoutr"      s_   ø€ õ KäŒw�z 8¨TÓ2°G¸TÓBÀiÔOÙÙ(¨Ó/Ò7Ùß‹3ÔTÕ7SÓT�3Œ3ÐTŠ3ÐTˆ3ÔTÕ7SÓTÓTÐTr   Nc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úproviderr
   r	   Úmodel_labelzOptional[str]r   r   )r   s   "r   r   r   &   s)   € ÷ ñ ¨cð ¸#ð ÈMð Ðehñ r   c                óL   € ^ RI Hp T;'       g    TpV RV  RV RV! 4        R2# )zåUser-facing guidance appended to the final response: easiest fix first (``/reasoning
low``), the config knob last. ``model`` is used verbatim in the config path so it is
copy-pasteable; ``model_label`` is the optional prose name.)Údisplay_hermes_homea   was thinking for so long that the connection timed out before it wrote anything (common for reasoning models behind cloud gateways such as NVIDIA NIM, OpenAI, Anthropic, DeepSeek). Easiest fixes: `/reasoning low`, or switch to a faster model with /model. Advanced: set `providers.z.models.z!.stale_timeout_seconds: 900` in `z%/config.yaml` to allow a longer wait.)Úhermes_constantsr'   )r$   r	   r%   r'   Úlabels   &&&  r   Úbuild_thinking_timeout_guidancer*   &   sG   € õ 5à× Ð ˜5€Eàˆ'ð $ð %- :¨X°e°Wð =ÙÓ!Ð"Ð"Gð		Iðr   )zbroken pipezerrno 32zremote protocolzconnection resetzconnection lostzpeer closedzserver disconnected)N)
Ú__conditional_annotations__Ú__doc__Ú
__future__r   Útypingr   r   Ú__annotations__r"   r*   )r+   s   @r   Ú<module>r0      s2   øðôõ #å ð
1Ð ˜oó õU÷"ñ r   