+
    „WÝjì  ã                  ó:   € R t ^ RIHt ^ RIHt R R ltR R ltR# )zÓSession-switch plumbing shared by /resume, /sessions and /branch.

The switch itself lives in ``cli_commands_mixin``; the handoff it needs sits here: end the row
being left, then repoint an already-built agent.
)Úannotations)Úsuppressc               ó    € V ^8„  d   QhRRRR/# )é   ÚreasonÚstrÚreturnÚNone© )Úformats   "ÚQC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\cli_session_switch.pyÚ__annotate__r      s   € ÷ <ñ < cð <¨dñ <ó    c                ó¦  € V P                   '       dR   \        \        4      ;_uu_ 4        V P                   P                  V P                  V P                  R7       RRR4       \        \        4      ;_uu_ 4        V P
                  P                  V P                  V4       RRR4       R#   + '       g   i     LX; i  + '       g   i     R# ; i)zšFlush un-persisted messages, then end the current session row with ``reason``.
Best-effort on both steps (the switch proceeds even if the DB write fails).)Úconversation_historyN)Úagentr   Ú	ExceptionÚ_flush_messages_to_session_dbr   Ú_session_dbÚend_sessionÚ
session_id)Úclir   s   &&r   Ú_end_current_sessionr      sˆ   € ð ‡y‡y€yÜ”i× Õ Ø�I‰I×3Ñ3Ø×(Ñ(¸s×?WÑ?Wð 4ô Y÷ !ô 
”)×	Õ	Ø�‰×#Ñ# C§N¡N°FÔ;÷ 
Ñ	÷ !× ú÷ 
×	Ð	ús   ª2B,Á;'B?Â,B<	Â?C	c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r   r   Úparent_session_idr   r   r	   r
   )r   s   "r   r   r      s0   € ÷ cñ c¨Cð cÀsð cÐTWð cÐ\`ñ cr   c          	     ó  € V P                   '       g   R# WP                   n        V P                   P                  4        \        V P                   R4      '       d%   \	        V P
                  4      V P                   n        \        V P                   R4      '       d=   \        \        4      ;_uu_ 4        ^ RI	H
p V! 4       V P                   n        RRR4       \        V P                   R4      '       d   V P                   P                  4        \        \        4      ;_uu_ 4        \        V P                   RR4      pVe   TP                  Y;'       g    RRVR	7       RRR4       R#   + '       g   i     L¡; i  + '       g   i     R# ; i)
a  Point an already-built agent at ``session_id`` after a /resume or /branch switch: reset
per-session state, re-anchor the DB flush index, and notify memory providers with
reset=False (their state stays valid and just targets the new id; parent keeps lineage).NÚ_last_flushed_db_idxÚ_todo_store)Ú	TodoStoreÚ_invalidate_system_promptÚ_memory_managerÚ F)r   Úresetr   )r   r   Úreset_session_stateÚhasattrÚlenr   r   r   r   Útools.todo_toolr   r   r   ÚgetattrÚon_session_switch)r   r   r   r   r   Ú_mms   &&$$  r   Ú_sync_agent_to_sessionr*      s  € ð �9�9ˆ9ÙØ%‡I�IÔØ‡I�I×!Ñ!Ô#Üˆs�y‰yÐ0×1Ò1Ü),¨S×-EÑ-EÓ)Fˆ�	‰	Ô&Üˆs�y‰y˜-×(Ò(Ü”i× Õ Ý1Ù$-£KˆC�I‰IÔ!÷ !ô ˆs�y‰yÐ5×6Ò6Ø�	‰	×+Ñ+Ô-Ü	”)×	Õ	Ü�c—i‘iÐ!2°DÓ9ˆàŠ?Ø×!Ñ!Ø×.EÐ.EÀ2ÈUÐ[að "ô c÷	 
Ñ	÷ !× ú÷
 
×	Ð	ús   Â2E(Ä$/E;Å
E;Å(E8	Å;F	N)Ú__doc__Ú
__future__r   Ú
contextlibr   r   r*   r
   r   r   Ú<module>r.      s   ðñõ
 #å õ<÷cr   