+
    jHàjÀ  ã                  ó¦   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt R R lt	]! RR7       ! R	 R
4      4       t
R R ltR R ltR R ltRR R lltR# )u—  Who owns the gateway role on THIS host, and which profiles does that one process serve?

Multiplex-only (Teknium ruling): exactly ONE ``hermes gateway run`` per host, multiplexing every
profile. Every reporting surface (doctor, ``cron status``, ``claw``, the dashboard liveness ladder)
used to ask a per-PROFILE question instead â€” "does *my* profile own a gateway process?" â€” and a
profile that is SERVED by the host gateway answered "no". That produced three user-visible lies:
"not running", "Per-profile gateways: 0/3 up", and a silently skipped destructive-action warning.

:func:`host_gateway_topology` answers the real question once, from
:mod:`gateway.host_rendezvous` (the authoritative host record the winning process publishes),
falling back to the default home's recorded ``served_profiles`` for a gateway that predates the
record. ``default`` is just another served profile here, never a special owner.
)Úannotations)Ú	dataclass)ÚPath)ÚOptionalc               ó    € V ^8„  d   QhRRRR/# )é   ÚnameúOptional[str]ÚreturnÚstr© )Úformats   "Ú:/home/ubuntu/.hermes/hermes-agent/gateway/host_topology.pyÚ__annotate__r      s   € ÷ (ñ (�mð (¨ñ (ó    c                ó2   € V '       g   R # ^ RI Hp V! V 4      # )Ú )Únormalize_profile_name)Úhermes_cli.profilesr   )r   r   s   & r   Ú_normalizedr      s   € ßÙå:á! $Ó'Ð'r   T)Úfrozenc                  ó`   € ] tR t^t$ RtR]R&   R]R&   R]R&   RtR	]R
&   R R ltR R ltRt	R# )ÚHostGatewayTopologyuâ   The single gateway process on this host plus the profile roster it multiplexes.

``source`` names the rung that answered (``host_record`` / ``served_record``) â€” for logs and
tests only; never branch product behaviour on it.
ÚintÚpidztuple[str, ...]Úprofilesr   ÚsourceNzOptional[Path]Úhomec               ó    € V ^8„  d   QhRRRR/# )r   Úprofile_namer	   r
   Úboolr   )r   s   "r   r   Ú HostGatewayTopology.__annotate__.   s   € ÷ Rñ R =ð R°Tñ Rr   c                ó–   € \        V4      p\        V4      ;'       d(    Y P                   Uu0 uF  p\        V4      kK  	  up9   # u upi )zQTrue when this host process ticks/serves ``profile_name`` (``default`` included).)r   r    r   )Úselfr   ÚwantedÚps   &&  r   ÚservesÚHostGatewayTopology.serves.   s;   € ä˜\Ó*ˆÜ�F‹|×QÐQ Ç=Â=Ó*QÁ=¸a¬;°q®>Á=Ñ*QÑ QÐQùÒ*Qs   ­Ac               ó   € V ^8„  d   QhRR/# )r   r
   r   r   )r   s   "r   r   r!   3   s   € ÷ Nñ N˜#ñ Nr   c                ó„   € V P                   '       d   RP                  V P                   4      MRpRV P                   RV 2# )už   ``the host gateway (PID 42) serving profiles default, coder`` â€” one shared phrasing so
doctor, cron status and the state.db holder lines cannot drift apart.z, zan unknown profile setzthe host gateway (PID z) serving profiles )r   Újoinr   )r#   Úrosters   & r   ÚdescribeÚHostGatewayTopology.describe3   s9   € ð .2¯]¯]¨]�—‘˜4Ÿ=™=Ô)Ð@XˆØ'¨¯© zÐ1DÀVÀHÐMÐMr   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r   r&   r,   Ú__static_attributes__r   r   r   r   r      s7   ‡ ñð 
ƒHØÓØƒKð  €Dˆ.ÓõR÷
Nñ Nr   r   c               ó   € V ^8„  d   QhRR/# ©r   r
   úOptional[HostGatewayTopology]r   )r   s   "r   r   r   :   s   € ÷ 9ñ 9Ð8ñ 9r   c                 ó”  € ^ RI Hp  V P                  V P                  4      pVe   VP                  '       g   R# VP
                  e   V P                  V4      '       g   R# ^ RIHpH	p ^ RI
Hp V! VP                  V! 4       4      '       d   R# \        \        VP                  4      \        VP                   4      RV! V4      R7      # )é    )Úhost_rendezvousN)Úlaunched_by_other_tenantÚrecord_home)Úget_hermes_homeÚhost_record)r   r   r   r   )Úgatewayr:   Úread_recordÚROLE_GATEWAYr   Úcreate_timeÚrecord_names_live_ownerÚgateway.host_attachr;   r<   Úhermes_constantsr=   r   r   r   Útupler   )ÚhrÚrecordr;   r<   r=   s        r   Ú_from_host_recordrI   :   s”   € Ý-à�^‰^˜BŸO™OÓ,€FØ‚~˜VŸZŸZ˜ZÙð ×ÑÒ!¨×)CÑ)CÀF×)KÒ)KÙßIÝ0ñ   §¡©_Ó->×?Ò?ÙÜ¤3 v§z¡z£?¼UÀ6Ç?Á?Ó=SÐ\iÙ$/°Ó$7ô9ð 9r   c               ó   € V ^8„  d   QhRR/# r6   r   )r   s   "r   r   r   Q   s   € ÷ 
]ñ 
]Ð:ñ 
]r   c                 ó  € ^ RI Hp Hp V ! 4       pVf   R# V! 4       ;'       g    . pR.V Uu. uF   p\        V4      R8w  g   K  \	        V4      NK"  	  up,           p\        \        V4      \        V4      RR7      # u upi )z²A gateway started before the host record existed still publishes ``served_profiles`` into
the default home's ``gateway_state.json``; that plus a proven-live PID is the same fact.)Úlive_default_gateway_pidÚrecorded_served_profilesNÚdefaultÚserved_record)r   r   r   )Ú#hermes_cli.gateway_multiplex_servedrL   rM   r   r   r   r   rF   )rL   rM   r   Úservedr%   r+   s         r   Ú_from_served_recordrR   Q   sq   € ÷ gá
"Ó
$€CØ
‚{ÙÙ%Ó'×-Ð-¨2€FØˆ[©FÓR©F q´kÀ!³nÈ	Ñ6QœFœC žF©FÑRÕR€FÜ¤3 s£8´e¸F³mÈOÔ\Ð\ùò Ss   ­A<ÁA<c               ó   € V ^8„  d   QhRR/# r6   r   )r   s   "r   r   r   ^   s   € ÷ ñ Ð<ñ r   c                 óJ   € \         \        3 F  p V ! 4       pVf   K  Vu # 	  R# )zYThe one live host gateway and its served profiles, or None when no gateway owns the role.N)rI   rR   )ÚrungÚtopologys     r   Úhost_gateway_topologyrW   ^   s)   € ä"Ô$7Ó8ˆÙ“6ˆØÔØŠOñ 9ñ r   Nc               ó    € V ^8„  d   QhRRRR/# )r   r   r	   r
   r7   r   )r   s   "r   r   r   g   s   € ÷ 	?ñ 	? }ð 	?Ð@]ñ 	?r   c                óz   € \        4       pVf   R# V f   ^ RIHp V! 4       p VP                  V 4      '       d   V# R# )zZThe host gateway when it serves ``profile_name`` (default: the active profile), else None.N)Úget_active_profile_name)rW   r   rZ   r&   )r   rV   rZ   s   &  r   Úhost_gateway_servingr[   g   s=   € ä$Ó&€HØÒÙØÒÝ?á.Ó0ˆØ—‘ |×4Ò4ˆ8Ð>¸$Ð>r   )N)r2   Ú
__future__r   Údataclassesr   Úpathlibr   Útypingr   r   r   rI   rR   rW   r[   r   r   r   Ú<module>r`      sX   ðñõ #å !Ý Ý õ(ñ �$Ô÷Nð Nó ðNõ49õ.
]õ÷	?ñ 	?r   