§
    ‰eîiN
  ã                   ó˜   — d Z ddlZddlZ ej        d¦  «        ZddlmZ  e¦   «         Zedz  Zde	de	fd„Z
de	ddfd	„Zd
e	deddfd„ZdS )ua  Built-in boot-md hook â€” run ~/.hermes/BOOT.md on gateway startup.

This hook is always registered. It silently skips if no BOOT.md exists.
To activate, create ``~/.hermes/BOOT.md`` with instructions for the
agent to execute on every gateway restart.

Example BOOT.md::

    # Startup Checklist

    1. Check if any cron jobs failed overnight
    2. Send a status update to Discord #general
    3. If there are errors in /opt/app/deploy.log, summarize them

The agent runs in a background thread so it doesn't block gateway
startup. If nothing needs attention, it replies with [SILENT] to
suppress delivery.
é    Nzhooks.boot-md)Úget_hermes_homezBOOT.mdÚcontentÚreturnc                 ó   — d| › d�S )z3Wrap BOOT.md content in a system-level instruction.z^You are running a startup boot checklist. Follow the BOOT.md instructions below exactly.

---
z¼
---

Execute each instruction. If you need to send a message to a platform, use the send_message tool.
If nothing needs attention and there is nothing to report, reply with ONLY: [SILENT]© )r   s    ú?/home/div/.hermes/hermes-agent/gateway/builtin_hooks/boot_md.pyÚ_build_boot_promptr	      s    € ð	$ð ð	$ð 	$ð 	$ð
ó    c                 ó–  — 	 ddl m} t          | ¦  «        } |dddd¬¦  «        }|                     |¦  «        }|                     dd¦  «        }|r)d|vr%t
                               d	|d
d…         ¦  «         d
S t
                               d¦  «         d
S # t          $ r&}t
                               d|¦  «         Y d
}~d
S d
}~ww xY w)z@Spawn a one-shot agent session to execute the boot instructions.r   )ÚAIAgentTé   )Ú
quiet_modeÚskip_context_filesÚskip_memoryÚmax_iterationsÚfinal_responseÚ z[SILENT]zboot-md completed: %sNéÈ   z%boot-md completed (nothing to report)zboot-md agent failed: %s)	Ú	run_agentr   r	   Úrun_conversationÚgetÚloggerÚinfoÚ	ExceptionÚerror)r   r   ÚpromptÚagentÚresultÚresponseÚes          r   Ú_run_boot_agentr!   -   s  € ð4Ø%Ð%Ð%Ð%Ð%Ð%å# GÑ,Ô,ˆØ�ØØ#ØØð	
ñ 
ô 
ˆð ×'Ò'¨Ñ/Ô/ˆØ—:’:Ð.°Ñ3Ô3ˆØð 	A˜
¨(Ð2Ð2Ý�KŠKÐ/°¸$¸3¸$´Ñ@Ô@Ð@Ð@Ð@å�KŠKÐ?Ñ@Ô@Ð@Ð@Ð@øÝð 4ð 4ð 4Ý�ŠÐ/°Ñ3Ô3Ð3Ð3Ð3Ð3Ð3Ð3Ð3øøøøð4øøøs   ‚A8B Á<B Â
CÂ"CÃCÚ
event_typeÚcontextc              ƒ   óV  K  — t                                ¦   «         sdS t                                d¬¦  «                             ¦   «         }|sdS t                               dt          |¦  «        ¦  «         t          j        t          |fdd¬¦  «        }| 
                    ¦   «          dS )u5   Gateway startup handler â€” run BOOT.md if it exists.Nzutf-8)ÚencodingzRunning BOOT.md (%d chars)zboot-mdT)ÚtargetÚargsÚnameÚdaemon)Ú	BOOT_FILEÚexistsÚ	read_textÚstripr   r   ÚlenÚ	threadingÚThreadr!   Ústart)r"   r#   r   Úthreads       r   Úhandler3   C   s£   è è € å×ÒÑÔð Øˆå×!Ò!¨7Ð!Ñ3Ô3×9Ò9Ñ;Ô;€GØð Øˆå
‡K‚KÐ,­c°'©l¬lÑ;Ô;Ð;õ ÔÝØˆZØØð	ñ ô €Fð ‡L‚L�N„N€N€N€Nr
   )Ú__doc__Úloggingr/   Ú	getLoggerr   Úhermes_constantsr   ÚHERMES_HOMEr*   Ústrr	   r!   Údictr3   r   r
   r   ú<module>r;      sØ   ððð ð& €€€Ø Ð Ð Ð à	ˆÔ	˜?Ñ	+Ô	+€à ,Ð ,Ð ,Ð ,Ð ,Ð ,ØˆoÑÔ€Ø˜)Ñ#€	ð ð ¨ð ð ð ð ð4˜Sð 4 Tð 4ð 4ð 4ð 4ð,˜Sð ¨4ð °Dð ð ð ð ð ð r
   