+
    iHàjö  ã                  ó¨   € R t ^ RIHt ^ RIt^ RIHt ^ RIHt RtRt	]P                  ! 4       tR R ltR	 R
 ltR R ltR R ltR R ltR R ltR# )a#  Tell an open chat about a plugin that went live while it runs, once, without breaking its cache.

An install from any surface (the onboarding plugins card, Settings, ``hermes plugins install`` with a
serve backend) makes the plugin's MCP tools and skills usable in this profile's open chats at once
(``hermes_cli.plugins_activation.load_and_go_live``) and queues the notice here, one per plugin key: a
second install or update of the same plugin replaces its notice. The notice rides the next tool result
of the running turn (``agent/tool_executor.py``), after its content: a new row not yet flushed, so no
cached byte moves. When no tool runs again this turn, the next user message carries it instead
(``agent/turn_context.py::_merge_gateway_notes``). Either way it is popped, so it is delivered once.
)ÚannotationsN)ÚAny)Úflatten_message_textÚ_plugin_live_notesÚ_plugin_notes_in_tool_batchc               ó    € V ^8„  d   QhRRRR/# )é   Úagentr   Úreturnzdict[str, str]© )Úformats   "Ú</home/ubuntu/.hermes/hermes-agent/agent/plugin_live_notes.pyÚ__annotate__r      s   € ÷ 4ñ 4�3ð 4˜>ñ 4ó    c                óX   € \        V \        R 4      p\        V\        4      '       d   V# / # )N)ÚgetattrÚ_QUEUEDÚ
isinstanceÚdict©r	   Únotess   & r   Ú_queuedr      s'   € Ü�Eœ7 DÓ)€EÜ˜u¤d×+Ò+ˆ5Ð3°Ð3r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r	   r   Ú
plugin_keyÚstrÚnoter
   ÚNoner   )r   s   "r   r   r      s(   € ÷ 'ñ '˜sð '°ð '¸3ð 'À4ñ 'r   c                óú   € \         ;_uu_ 4        \        V 4      P                  4        UUu/ uF  w  r4W18w  g   K  W4bK  	  pppW%V&   \        V \        V4       RRR4       R# u uppi   + '       g   i     R# ; i)zbQueue ``note`` for ``agent``'s next tool result or user turn; it replaces this plugin's older one.N)Ú_LOCKr   ÚitemsÚsetattrr   )r	   r   r   ÚkeyÚtextr   s   &&&   r   Úqueue_plugin_noticer#      s]   € ç	ŽÜ,3°E«N×,@Ñ,@Ô,BÔXÑ,B™y˜sÀcÑFW”�’Ñ,BˆÑXØ ˆjÑÜ�”w Ô&÷ 
‰ùÛX÷ 
�ˆús!   �A)¬
A#
»A#
ÁA)Á#A)Á)A:	c               ó    € V ^8„  d   QhRRRR/# )r   r	   r   r
   r   r   )r   s   "r   r   r   &   s   € ÷ 'ñ '˜cð ' cñ 'r   c                óÜ   € \         ;_uu_ 4        \        V 4      pV'       d   \        V \        / 4       RRR4       RP	                  XP                  4       4      #   + '       g   i     L/; i)z>Every queued notice, oldest plugin first, and clear the queue.Nú

)r   r   r    r   ÚjoinÚvaluesr   s   & r   Úpop_plugin_noticesr)   &   sC   € ç	ŽÜ˜“ˆßÜ�Eœ7 BÔ'÷ 
ð �;‰;�u—|‘|“~Ó&Ð&÷	 
�ús   �%AÁA+	c               ó$   € V ^8„  d   QhRRRRRR/# )r   r	   r   Úmessager   r
   r   r   )r   s   "r   r   r   /   s&   € ÷ 	Pñ 	P #ð 	P°ð 	P¸ñ 	Pr   c                óè   € \        V 4      pV'       g   R# \        W4       \        V \        R4      p\	        V\
        4      '       d   TM/ p\        V \        / VCVP                  R4      V/C4       R# )zÃAppend every queued notice to ``message``, the tool result about to be appended and flushed. It
goes after the content, so a result wrapped as untrusted data keeps the notice outside the wrapper.NÚtool_call_id)r)   Ú_appendr   Ú	_IN_BATCHr   r   r    Úget)r	   r+   r   Úin_batchs   &&  r   Úattach_to_tool_messager2   /   s_   € ô ˜uÓ%€EßÙÜˆGÔÜ�uœi¨Ó.€HÜ% h´×5Ò5‰x¸2€HÜˆE”9ÐN ÐN¨7¯;©;°~Ó+FÈÑNÖOr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r	   r   Úbatchz
list[dict]r
   r   r   )r   s   "r   r   r   ;   s!   € ÷ 
$ñ 
$ #ð 
$¨jð 
$¸Tñ 
$r   c                óH  € \        V \        R4      p\        V\        4      '       d	   V'       g   R# \	        V \        / 4       V FY  pVP                  VP                  R4      4      pV'       g   K-  V\        VP                  R4      4      9  g   KN  \        W44       K[  	  R# )z¼Put a notice back on a batch row whose content the turn budget spilled to a file: the inline
preview keeps only the head, and the notice sits at the tail. The flushed row already holds it.Nr-   Úcontent)r   r/   r   r   r    r0   r   r.   )r	   r4   r1   r+   r   s   &&   r   Úkeep_after_turn_budgetr7   ;   st   € ô �uœi¨Ó.€HÜ�h¤×%Ò%¯XÙÜˆE”9˜bÔ!ÛˆØ—‘˜WŸ[™[¨Ó8Ó9ˆß‰5�UÔ"6°w·{±{À9Ó7MÓ"NÖNÜ�GÖ#ó r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r+   r   r   r   r
   r   r   )r   s   "r   r   r   H   s!   € ÷ ;ñ ;�Tð ; #ð ;¨$ñ ;r   c                óš   € V P                  R 4      p\        V\        4      '       d   . VORRRV/NV R &   R# T;'       g    R RV 2V R &   R# )r6   Útyper"   Ú r&   N)r0   r   Úlist)r+   r   r6   s   && r   r.   r.   H   sU   € Ø�k‰k˜)Ó$€GÜ�'œ4× Ò ØH˜wÐH¨°¸ÀÐ(GÐHˆ�	Óà '§ ¨2˜¨d°5°'Ð:ˆ�	Ór   )Ú__doc__Ú
__future__r   Ú	threadingÚtypingr   Úagent.message_contentr   r   r/   ÚLockr   r   r#   r)   r2   r7   r.   r   r   r   Ú<module>rC      sM   ðñ	õ #ã Ý å 6à
€Ø)€	à�ŠÓ€õ4õ
'õ'õ	Põ
$÷;r   