+
    lHàj¨  ã                  óR   € R t ^ RIHt RtRRRR/R R lltR	 R
 ltRR/R R lltR# )a  Head/tail truncation for oversized tool output (terminal, execute_code, MCP results).

One algorithm and one notice wording: 40% head (errors surface early) / 60% tail (the most
recent lines matter most) around a single ``... [<LABEL> TRUNCATED - N <unit> omitted out of
T total] ...`` marker, so downstream code that recognises the marker sees one shape. Limits
live in ``tools/tool_output_limits.py``; line-snapped, path-bearing footers (web/browser,
read_file pagination) are different products and stay separate.
)Úannotationsgš™™™™™Ù?ÚlabelÚOUTPUTÚunitÚcharsc          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )é   ÚomittedÚintÚtotalr   Ústrr   Úreturn© )Úformats   "Ú?/home/ubuntu/.hermes/hermes-agent/tools/tool_output_truncate.pyÚ__annotate__r      s8   € ÷ fñ f˜sð f¨3ð f¸#ð fÐPSð fÐbeñ fó    c          	     ó$   € R V RV R RV RVR R2	# )z

... [z TRUNCATED - Ú,Ú z omitted out of z total] ...

r   )r	   r   r   r   s   &&$$r   Útruncation_noticer      s*   € Ø�u�g˜]¨7°1¨+°Q°t°fÐ<LÈUÐSTÈIÐUdÐeÐer   c               ó    € V ^8„  d   QhRRRR/# )r   Úbudgetr
   r   ztuple[int, int]r   )r   s   "r   r   r      s   € ÷ ñ ˜Cð  Oñ r   c                óB   € \        V \        ,          4      pWV,
          3# )z8``(head, tail)`` character budgets for ``budget`` total.)r
   Ú
HEAD_RATIO)r   Úheads   & r   Úhead_tail_splitr      s   € äˆvœ
Õ"Ó#€DØ˜$•ÐÐr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Útextr   Ú	max_charsr
   r   r   r   )r   s   "r   r   r      s.   € ÷ [ñ [˜Sð [¨Sð [¸Cð [Èsñ [r   c               óÈ   € \        V 4      V8:  d   V # \        V4      w  r4\        V 4      V,
          V,
          pV RV \        V\        V 4      VR7      ,           W) R ,           # )z•``text`` unchanged when it fits ``max_chars``; otherwise head + notice + tail (the kept
text is exactly ``max_chars`` long, the notice rides on top).N)r   )Úlenr   r   )r   r   r   r   Útailr	   s   &&$   r   Útruncate_head_tailr#      s`   € ô ˆ4ƒy�IÔØˆÜ  Ó+�J€DÜ�$‹i˜$Õ Õ%€GØ��ˆ;Ô*¨7´C¸³IÀUÔKÕKÈdÐSXÐSYÈlÕZÐZr   N)Ú__doc__Ú
__future__r   r   r   r   r#   r   r   r   Ú<module>r&      sD   ðñõ #à€
ðfÀð fÐV]÷ fõð[À(÷ [ñ [r   