Ë
    âß²j@  ã                  óR   — U d Z ddlmZ ddlZddlmZmZ ddiZded<   	 d
	 	 	 dd	„Z	y)u  Heal mixed ``sys.modules`` after an in-place checkout update.

Pre-reexec updaters (Hermes â‰¤ v2026.9.14) purged only package prefixes
(``hermes_cli``, ``gateway``, ``tools``, ``tui_gateway``, ``agent``) and left
root modules like ``utils`` cached in the updater process. The post-pull
gateway-restart phase then imports new ``hermes_cli.gateway`` /
``hermes_cli.config`` into that process; those need symbols the stale
``utils`` lacks (``file_signature``), and ``hermes update`` exits 1 with
``gateway auto-restart failed: cannot import name 'file_signature' from
'utils'``.

Post-swap hand-off (``hermes_cli.update_handoff``) makes this class dead for
updaters that already include it. This module is the bridge for the one
upgrade from a pre-handoff release onto a tree that needs new root symbols:
freshly imported ``hermes_cli`` code drops the incomplete cache before
importing ``utils``.
é    )ÚannotationsN)ÚMappingÚSequenceÚutils)Úfile_signaturezdict[str, tuple[str, ...]]Ú_ROOT_MODULE_REQUIRED_ATTRSc                ó   ‡— | €t         n| }g }|j                  «       D ]m  \  }}t        j                  j	                  |«      Š‰€Œ(t        ˆfd„|D «       «      sŒ=t        j                  j                  |d«       |j                  |«       Œo |S )zGDrop cached root modules missing required attrs. Returns dropped names.Nc              3  ó8   •K  — | ]  }t        ‰|«       –— Œ y ­w©N)Úhasattr)Ú.0ÚattrÚmods     €ú=/home/ubuntu/.hermes/hermes-agent/hermes_cli/stale_modules.pyú	<genexpr>z*drop_stale_root_modules.<locals>.<genexpr>*   s   øè ø€ Ò8¨$”7˜3 Ó%Ô%Ñ8ùs   ƒ)r   ÚitemsÚsysÚmodulesÚgetÚanyÚpopÚappend)ÚrequiredÚchecksÚdroppedÚnameÚattrsr   s        @r   Údrop_stale_root_modulesr       s}   ø€ ð -5Ð,<Õ(À(€FØ€GØ—|‘|“~ò !‰ˆˆeÜ�k‰k�o‰o˜dÓ#ˆØˆ;ØÜÓ8°%Ô8Õ8Ü�K‰K�O‰O˜D $Ô'Ø�N‰N˜4Õ ð!ð €Nó    r   )r   z"Mapping[str, Sequence[str]] | NoneÚreturnz	list[str])
Ú__doc__Ú
__future__r   r   Útypingr   r   r   Ú__annotations__r   © r   r   ú<module>r&      sG   ðòõ$ #ã 
ß $ð Ð ð;Ð Ð7ó ð 48ðØ0ðàôr   