+
    jHàjY  ã                   óJ   € R t ^ RIt^ RIt^ RIHt RtRtR	R ltR tR t	R t
R# )
zSDurable media retirement candidates survive transcript deletion and failed cleanup.N)Úprefix_rangezgateway.media.retired.v1.zgateway.spillover.retired.v1.c                 óh  € ^ RI HpHp . V! V4      OV! W!4      OVP                  R/ 4      P                  R. 4      OpV Fo  p\        \
        P                  ! VR,          P                  4       4      P                  4       ,           pV P                  RV\        P                  ! V4      34       Kq  	  R# )é    )Úadmission_media_referencesÚhosted_document_referencesÚapi_turn_v1ÚmediaÚpathú7INSERT OR IGNORE INTO state_meta(key,value) VALUES(?,?)N)Úgateway.session_ingress_mediar   r   ÚgetÚPREFIXÚhashlibÚsha256ÚencodeÚ	hexdigestÚexecuteÚjsonÚdumps)ÚconnÚpayloadÚ
request_idr   r   Ú
referencesÚ	referenceÚkeys   &&&     Ú7/home/ubuntu/.hermes/hermes-agent/hermes_state_media.pyÚretire_mediar      sŸ   € ßdðDÑ-¨gÓ6ð DÑ9SÐT^Ó9hð DØ—;‘;˜}¨bÓ1×5Ñ5°g¸rÓBðD€Jãˆ	Ü”w—~’~ i°Õ&7×&>Ñ&>Ó&@ÓA×KÑKÓMÕMˆØ�‰ÐNØœ4Ÿ:š: iÓ0Ð1ö	3ó  ó    c                ó\  € ^ RI HpHp ^ RIHpHp V! \        V4      4       F�  pV P                  RV! V4       RV 2V4      P                  4        FN  w  rxT P                  RV! Wx4       U	u. uF&  p	\        V	,           \        P                  ! V	4      3NK(  	  up	4       KP  	  Kƒ  	  R# u up	i )z©Record the spillover archives the doomed sessions' messages point at, inside the delete
transaction (the pointers vanish with the rows), as durable candidates (#126351).)Ú
_id_chunksÚ_placeholders)ÚSPILLOVER_SQL_FILTERÚspillover_names_in_textz?SELECT content, api_content FROM messages WHERE session_id IN (z) AND r
   N)Úhermes_state_commonr   r    Útools.tool_result_storager!   r"   Úlistr   ÚfetchallÚexecutemanyÚSPILLOVER_PREFIXr   r   )
r   Úsession_idsr   r    r!   r"   ÚchunkÚcontentÚapi_contentÚns
   &&        r   Úretire_spilloverr.      s¬   € ÷ >ßWÙœD Ó-Ö.ˆØ$(§L¡LØQÑR_Ð`eÓRfÐQgð hØ,Ð-ð/Ø05ó%7ç7?±x³zò%BÑ ˆGð ×ÑÐVÙMdÐelÔMzÓ{ÑMzÈÔ/°!Õ3´T·Z²ZÀ³]ÓCÑMzÑ{ö}ó%Bó /ùò
 |s   Á,,B)c                ó@  a	€ ^ RI Hp V P                  4       ;_uu_ 4       pVP                  R\	        \
        4      4      P                  4       pRRR4       V P                  P                  R,          R,          pX'       d   V! V4      ;pf   R# . o	V FL  w  rg \        P                  ! V4      ;q…9  d   WH,          P                  RR7       S	P                  T34       KN  	  V P                  V	3R l4       R#   + '       g   i     Lµ; i  \         d     Kˆ  i ; i)	z¸Unlink retired archives no surviving message references (a branch/compression sibling sharing
the pointer keeps it until it dies too). Unknown reference set: keep files and candidates.)Úreferenced_spillover_namesú7SELECT key,value FROM state_meta WHERE key>=? AND key<?NÚcacheÚ	spilloverT)Ú
missing_okc                 ó(   <€ V P                  R S4      # ©z"DELETE FROM state_meta WHERE key=?©r'   )r   Údones   &€r   Ú<lambda>Ú+collect_retired_spillover.<locals>.<lambda>4   s   ø€  4×#3Ñ#3Ð4XÐZ^Ô#_r   )r$   r0   Ú	_read_ctxr   r   r(   r&   Údb_pathÚparentr   ÚloadsÚunlinkÚOSErrorÚappendÚ_execute_write)
Údbr0   r   ÚrowsÚ	spill_dirÚ
referencedr   ÚrawÚnamer8   s
   &        @r   Úcollect_retired_spilloverrI   "   sé   ø€ õ EØ	�‰�Œ˜4Ø�|‰|ÐUÜ(Ô)9Ó:ó<ß<D¹H»Jð 	÷ 
ð —
‘
×!Ñ! GÕ+¨kÕ9€IßÑ"<¸YÓ"GÐG�JÒPÙØ€DÛ‰ˆð	ÜŸ
š
 3›Ð'�Ô:ØÕ!×)Ñ)°TÐ)Ô:ð 	�‰�S�FÖñ ð ×ÑÔ_Ö`÷ 
�ûô ô 	Úð	ús    .C;Â4DÃ;D	ÄDÄDc           
     óv  a€ ^ RI Hp \        V 4       V P                  4       ;_uu_ 4       pVP	                  R\        \        4      4      P                  4       pRRR4       X'       d´   T! Y Uu. uF   p\        P                  ! VR,          4      NK"  	  up4       ^ RI
Hp V Uu. uFL  qE! \        P                  ! VR,          4      R,          4      P                  4       '       d   KB  VR,          3NKN  	  upoS'       d   V P                  V3R l4       R# R# R#   + '       g   i     LÍ; iu upi u upi )	z¶Release retired candidates no admission or retained transcript row owns; drop collected keys.
Synchronous SQLite plus one messages pass: async callers must run it off the event loop.)Úrelease_unheld_mediar1   NÚvalue)ÚPathr	   r   c                 ó(   <€ V P                  R S4      # r6   r7   )r   Úgones   &€r   r9   Ú'collect_retired_media.<locals>.<lambda>E   s   ø€ ¨4×+;Ñ+;Ð<`ÐbfÔ+gr   )r   rK   rI   r;   r   r   r   r&   r   r>   ÚpathlibrM   ÚexistsrB   )rC   rK   r   rD   ÚrowrM   rO   s   &     @r   Úcollect_retired_mediarT   7   sß   ø€ õ CÜ˜bÔ!Ø	�‰�Œ˜4à�|‰|ÐUÜ(¬Ó0ó2ß2:±(³*ð 	÷ 
÷ Ù˜RÀdÓ!KÁd¸s¤$§*¢*¨S°­\Ö":ÁdÑ!KÔLÝ Ù)-Óe© #°T¼$¿*º*ÀSÈÅ\Ó:RÐSYÕ:ZÓ5[×5bÑ5b×5d”��U•“©ÑeˆßØ×ÑÔgÖhñ ñ	 ÷	 
�üò
 "Lùâes   «.DÁ/&D1
Â&?D6Ã*D6ÄD.	)Ú )Ú__doc__r   r   Úhermes_state_keysr   r   r(   r   r.   rI   rT   © r   r   Ú<module>rY      s3   ðÙ YÛ Û å *à	$€Ø2Ð ô3ò
}òaô*ir   