+
    jHàj¼‡  ã                  óŠ  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
Ht ^ RIHt RsR]R&   R]! 4       R]! 4       R	]! 4       /tR
]R&   RtRt ! R R]4      tR R ltR R ltR R ltR R ltRZR R ll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& R' lt!R( R) lt"R* R+ lt#R, R- lt$R. R/ lt%R0 R1 lt&R2 R3 lt'R4R5/R6 R7 llt(R8 R9 lt)R: R; lt*R[R< R= llt+R> R? lt,R@ RA lt-RB RC lt.RD RE lt/RF RG lt0RH RI lt1RJ RK lt2RL RM lt3RN RO lt4RP RQ lt5RR RS lt6RT RU lt7RV RW lt8RX RY lt9R# )\a	  Pre-swap gateway pause for ``hermes update`` on Linux and macOS.

Windows pauses its gateways before the fetch (``update_cmd_windows``) because they lock venv
files. On POSIX nothing is locked, but a gateway that keeps running while git rewrites the tree
loads new-tree modules into an old process on its next lazy import. So every gateway running
from this install is stopped at the commit point, immediately before the first checkout move
(``update_cmd_commit.arm_commit_point``), and the same set is restarted once the dependencies
are synced and the launchers published, before the product builds
(``source_completion.complete_source_checkout``'s ``before_build``).

The set rides the Windows pause contract: one token in ``update_pause_record`` (identity = pid
+ start time; supervisor unit, or argv + home for bare processes), written before the first stop,
resumed by ``_resume_windows_gateways_after_update`` (which dispatches here on
``platform == "posix"``), adopted by the next ``hermes update`` and resumed by the next launch
when this process dies.

* every gateway is drained first: the control socket's ``pause-for-update`` runs the same
  ``request_restart`` drain as the post-update restart's SIGUSR1 (refuse new turns, let the
  in-flight ones finish within ``agent.restart_after_turn_timeout``, then exit), waited for within
  that restart's budget. The request is recorded before it is sent, and carries no planned-stop
  marker (the gateway's marker watcher would take the immediate stop path instead).
* systemd ``hermes-gateway*`` units and launchd ``ai.hermes.gateway*`` jobs are then stopped and
  later started through their supervisor, so it cannot respawn them on old code mid-update; one
  that does not take the drain gets its supervisor's stop at once.
* bare ``gateway run`` processes that do not answer get marker + SIGTERM, and are replayed from
  their recorded argv + home.
* the updater never kills itself: a unit whose cgroup holds this process (``/update`` from
  chat: the update runs in the gateway unit's cgroup, which ``systemctl stop`` kills) is
  stopped only after this process moved into a transient scope of its own. A launchd job
  whose coalition holds it, or any gateway whose stop would take the updater down, is left
  running for the post-commit restart.
)ÚannotationsN)Úsuppress)ÚPathúdict | NoneÚ_RUNÚunitsÚlabelsÚpidsÚdictÚ
_RESTARTEDg      ^@ç      >@c                  ó   € ] tR t^8tRtRtR# )ÚPauseRefusedzJThe pause could not be completed; everything it stopped was started again.© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    ÚF/home/ubuntu/.hermes/hermes-agent/hermes_cli/update_cmd_posix_pause.pyr   r   8   s   † ÝTr   r   c               ó   € V ^8„  d   QhRR/# ©é   Úreturnr
   r   )Úformats   "r   Ú__annotate__r   <   s   € ÷ /ñ /�dñ /r   c                 ó   € R RRRR/ R. R. R. /# )ÚplatformÚposixÚresume_neededFÚprofilesÚunmapped_pidsÚunmappedÚposix_unitsr   r   r   r   Ú_empty_tokenr&   <   s'   € Ø˜ °%¸ÀRÈÐZ\Ø˜˜M¨2ð/ð /r   c               ó    € V ^8„  d   QhRRRR/# )r   Úno_gateway_restartÚboolr   r   r   )r   s   "r   r   r   A   s   € ÷ ñ  Tð ¨kñ r   c                ó"  € \         P                  R8X  g	   V '       d   R# ^ RIHp \	        4       p VP                  4       w  r4Ve   VP                  / VCRR/CW44      pRVR&   Vs	V#   \         d   p\        RT 24        Rp?Ts	T# Rp?ii ; i)	aH  Arm this run's pause (no stop yet) and adopt any set a killed update left paused.

``None`` on Windows (its own pause) and with ``--no-gateway-restart`` (the user manages
gateways, nothing is stopped). An adopted orphan set is recorded under this process now, so
even an update that never moves the checkout restarts it at exit.Úwin32N©Úupdate_pause_recordr!   Tr    r   u9     âš  Could not adopt gateways an earlier update paused: )
Úsysr   Ú
hermes_clir-   r&   Úadopt_orphansÚrecord_pauseÚ	ExceptionÚprintr   )r(   Úpause_recordÚtokenÚadoptedÚclaimsÚexcs   $     r   Ú	arm_pauser9   A   s£   € ô ‡|�|�wÔ×"4ÙÝ>Ü‹N€EðQØ&×4Ñ4Ó6‰ˆØÒØ ×-Ñ-Ð.N°Ð.N¸ÈÑ.NÐPWÓ`ˆEØ 'ˆE�*Ñð €DØ€Løô ô QÜÐIÈ#ÈÐO×PÐPØ€DØ€LûðQús   ±3A( Á(BÁ3B	Â	Bc               ó   € V ^8„  d   QhRR/# )r   r   r)   r   )r   s   "r   r   r   W   s   € ÷ Rñ R˜ñ Rr   c                 ó”   € \        \        ;'       d3    \        P                  R4      ;'       d    \        P                  R4      4      # )zQTrue while this run holds gateways stopped (no gateway can answer a chat prompt).Úposix_stoppedr!   )r)   r   Úgetr   r   r   Úgateways_pausedr>   W   s/   € ä”×PÐPœŸ™ /Ó2×PÐP´t·x±xÀÓ7PÓQÐQr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Ú	scope_cmdÚlistÚunitÚstrr   ú
str | Noner   )r   s   "r   r   r   ^   s!   € ÷ ñ ˜Dð ¨ð °
ñ r   c           	     ól  € ^ RI Hp \        \        \        P
                  4      ;_uu_ 4        V! V RVRR.,           ^
R7      pVP                  ^ 8X  dE   VP                  P                  4       '       d%   VP                  P                  4       uuRRR4       # RRR4       R#   + '       g   i     R# ; i)é    ©Ú
_systemctlÚshowz--property=ControlGroupú--value©ÚtimeoutN)	Úhermes_cli.update_cmd_fleetrH   r   ÚOSErrorÚ
subprocessÚTimeoutExpiredÚ
returncodeÚstdoutÚstrip)r@   rB   rH   Úresults   &&  r   Ú_unit_cgrouprU   ^   sƒ   € Ý6Ü	”'œ:×4Ñ4×	5Õ	5Ù˜I¨°Ð7PÐR[Ð(\Õ\ÐfhÔiˆØ×Ñ Ô! f§m¡m×&9Ñ&9×&;Ò&;Ø—=‘=×&Ñ&Ó(÷ 
6×	5Ò	5ñ ÷	 
6Ö	5ñ ús   ­AB"Á4B"Â"B3	c               ó    € V ^8„  d   QhRRRR/# )r   Úpidz	int | strr   rD   r   )r   s   "r   r   r   g   s   € ÷ 	ñ 	�Yð 	¨Jñ 	r   c                ó@  € \        \        4      ;_uu_ 4        \        RV  R24      P                  RR7      P	                  4       p\        R V 4       R4      p\        R V 4       R4      pT;'       g    T;'       g    RuuRRR4       #   + '       g   i     R# ; i)	zëThe systemd cgroup path of *pid*: the unified (v2) line, else the v1 ``name=systemd``
hierarchy, which systemd names units in identically. ``None``: not Linux or unreadable, which
callers must treat as unknown, never as outside a unit.ú/proc/z/cgroupúutf-8©Úencodingc              3  ó€   "  € T F4  qP                  R 4      '       g   K  VR,          P                  4       x € K6  	  R# 5i)z0:::é   NNN)Ú
startswithrS   ©Ú.0Úlines   & r   Ú	<genexpr>Ú_pid_cgroup.<locals>.<genexpr>m   s*   é € ÐU±U¨T¿o¹oÈe×>TÔ(˜˜R�Ÿ™×(Ð(³Uùs   ‚>Ÿ>Ú c              3  ó‚   "  € T F5  pR V9   g   K  VP                  R^4      ^,          P                  4       x € K7  	  R# 5i)z:name=systemd:Ú:N)ÚsplitrS   r`   s   & r   rc   rd   n   s8   é € ÐcÁ¸ÐJZÐ^bÑJbÔ4�t—z‘z # qÓ)¨!Õ,×2Ñ2×4Ð4Ãùs   ‚	?�/?N)r   rN   r   Ú	read_textÚ
splitlinesÚnext)rW   ÚlinesÚunifiedÚlegacys   &   r   Ú_pid_cgroupro   g   s†   € ô 
”'×	Õ	Ü�v˜c˜U 'Ð*Ó+×5Ñ5¸wÐ5ÓG×RÑRÓTˆÜÑU±UÓUÐWYÓZˆÜÑcÁÓcÐegÓhˆØ×(Ð(˜&×(Ð( D÷	 
×	×	Ñ	ñ
 ús   ˜A&BÁ?BÂB	c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚcgrouprD   Úunit_cgroupr   r)   r   )r   s   "r   r   r   s   s&   € ÷ Uñ U�Jð U¨Zð U¸Dñ Ur   c                óŒ   € V '       d	   V'       g   R # W8H  ;'       g(    V P                  VP                  R4      R,           4      # )FÚ/)r_   Úrstrip)rq   rr   s   &&r   Ú_insiderv   s   s7   € ßŸÙØÑ ×TÐT F×$5Ñ$5°k×6HÑ6HÈÓ6MÐPSÕ6SÓ$TÐTr   c               ó   € V ^8„  d   QhRR/# ©r   r   ú
list[dict]r   )r   s   "r   r   r   y   s   € ÷ ñ ˜:ñ r   c                 óL  € ^ RI Hp Hp ^ RIHpHpHpHp V! 4       '       g   . # \        \        4      ;_uu_ 4        V ! 4        RRR4       . p\        4       pV! 4        F¯  w  r‰p
. pV! V
P                  VP                  R R7       V F�  pVP                  R4      '       g   K  V! Wœ4      pV^ 8:  g   W×9   g   V! Wœ4      '       g   KA  VP                  V4       VP                  RRR	VR
VRVR\        Wœ4      R\!        V4      /4       Kƒ  	  K±  	  V#   + '       g   i     LØ; i)zGActive ``hermes-gateway*`` units of this install, one per live MainPID.)Ú_ensure_user_systemd_envÚsupports_systemd_services)Ú_for_each_systemd_gateway_unitÚ_systemd_gateway_unit_listingsÚ_systemd_unit_owned_by_updateÚ_unit_main_pidNc                ó   € R # ©Nr   )Únamer8   s   &&r   Ú<lambda>Ú#_discover_systemd.<locals>.<lambda>‰   s   € Ér   )Úprocess_unitÚon_unit_timeoutúhermes-gatewayÚkindÚsystemdÚscoperB   rW   rq   Úhome)Úhermes_cli.gatewayr{   r|   rM   r}   r~   r   r€   r   r2   ÚsetrR   Úappendr_   ÚaddrU   Ú_home_of)r{   r|   r}   r~   r   r€   r   Ú	seen_pidsr‹   r@   ÚlistingÚnamesrƒ   rW   s                 r   Ú_discover_systemdr•   y   s  € çV÷ó ñ %×&Ò&Øˆ	Ü	”)×	Õ	Ù Ô"÷ 
à€EÜ›%€IÙ%CÖ%EÑ!ˆ˜'ØˆÙ& w§~¡~ÀEÇLÁLÙ7Mõ	OãˆDØ—?‘?Ð#3×4Ò4ÙÙ  Ó1ˆCØ�aŒx˜3Ô+Ñ3PÐQZ×3aÒ3aÙØ�M‰M˜#ÔØ�L‰L˜& )¨W°e¸VÀTÈ5ÐRUØ"¤L°Ó$AÀ6Ì8ÐTWË=ðZö [ó ñ	 &Fð €L÷# 
×	ús   »DÄD#	c               ó   € V ^8„  d   QhRR/# rx   r   )r   s   "r   r   r   –   s   € ÷ ñ ˜:ñ r   c                 ó²  € \         P                  R8w  d   . # ^ RIHp HpHpHp ^ RIHp V! 4       p. pWS! \        V4      R7      ,            Fˆ  pV! V4      e   K  V ! V4      w  r‰Ve   V	'       d   V	^ 8:  d   K.  V! 4       P                  V R24      p
VP                  RRRVR	VR
\        V
4      R\        V	4      R\        \        V	4      4      /4       KŠ  	  V# )zOLoaded ``ai.hermes.gateway*`` jobs of this install with a live process (macOS).Údarwin)Ú_locate_launchd_gateway_serviceÚget_launchd_plist_pathÚ"launchd_gateway_labels_for_installÚ!legacy_launchd_labels_for_install)Úlaunchd_label_foreign_home)Úexcludez.plistr‰   ÚlaunchdÚlabelÚdomainÚplistrW   rŒ   )r.   r   r�   r™   rš   r›   rœ   Úhermes_cli.update_fleet_scoper�   rŽ   Ú	with_namer�   rC   Úintr‘   )r™   rš   r›   rœ   r�   ÚderivedÚjobsr    r¡   rW   r¢   s              r   Ú_discover_launchdr¨   –   sÚ   € ä
‡|�|�xÔØˆ	÷ó õ IÙ0Ó2€GØ€DØÐ<ÄSÈÃ\ÔR×RÐRˆÙ% eÓ,Ò8ÙÙ5°eÓ<‰ˆØŠ>§¨¨q¬ÙÙ&Ó(×2Ñ2°e°W¸FÐ3CÓDˆØ�‰�V˜Y¨°¸À&È'ÔSVÐW\ÓS]Ð_dÔfiÐjmÓfnØœX¤c¨#£hÓ/ð1ö 	2ñ Sð €Kr   c               ó    € V ^8„  d   QhRRRR/# ©r   rW   r¥   r   rD   r   )r   s   "r   r   r   ­   s   € ÷ ñ �#ð ˜*ñ r   c                óÆ   € ^ RI Hp \        \        4      ;_uu_ 4        V! V 4      ;p'       d   \	        V4      uuRRR4       #  RRR4       R#   + '       g   i     R# ; i)zKThe Hermes home *pid* serves (its control socket lives there), or ``None``.©Úgateway_pid_homeN)r£   r­   r   r2   rC   )rW   r­   rŒ   s   &  r   r‘   r‘   ­   sJ   € å>Ü	”)×	Õ	Ù# CÓ(Ð(ˆ4Ö(Ü�t“9÷ 
Ò	Ø(÷ 
ñ ÷ 
Ö	ñ ús   žAÁA 	c               ó    € V ^8„  d   QhRRRR/# rª   r   )r   s   "r   r   r   ¶   s   € ÷ ñ ˜Sð  Zñ r   c                ó|  € ^ RI Hp RV! V 4      ;'       g    . 9   d   R#  ^ RIpVP                  V 4      P	                  4       pTP                  R4      '       d   R# \        T 4      ;p'       d   RT 2# TP                  RR4      pTR9  d   TP                  R	4      '       g   R
T 2# R#   \
         d     R# i ; i)znWhy *pid* answers to a supervisor other than a hermes unit/job (it would respawn it on old
code), or ``None``.)Ú_capture_gateway_argvz--external-supervisorNÚHERMES_S6_SUPERVISED_CHILDÚs6zsystemd unit ÚXPC_SERVICE_NAMEÚ0zapplication.zlaunchd job )re   r´   )	r�   r°   ÚpsutilÚProcessÚenvironr2   r=   Ú_respawning_servicer_   )rW   r°   rµ   ÚenvrB   Úxpcs   &     r   Ú_supervisor_markersr»   ¶   s¼   € õ 9ØÑ#8¸Ó#=×#CÐ#CÀÔDÙ&ðÛØ�n‰n˜SÓ!×)Ñ)Ó+ˆð ‡w�wÐ+×,Ò,ÙÜ" 3Ó'Ð'€tÖ'Ø˜t˜fÐ%Ð%à
�'‰'Ð$ cÓ
*€CØ
�)Ô C§N¡N°>×$BÒ$BØ˜c˜UÐ#Ð#Ùøô ô Úðús   ¡#B, Â,B;Â:B;c               ó    € V ^8„  d   QhRRRR/# rª   r   )r   s   "r   r   r   Ì   s   € ÷ ñ ˜Sð  Zñ r   c           	     ó  € ^ RI HpHp \        V 4      ;'       g    RpVP	                  R^4      R,          pVP                  R4      '       g   R# RV9   d   RR.MR.p\        \        \        P                  4      ;_uu_ 4        V! WT4      pV^ 8”  d^   W`\        V 4      39   dM   V! VR	VR
R.,           ^
R7      pVP                  ;'       g    RP                  4       R9  d   TMRuuRRR4       # RRR4       R#   + '       g   i     R# ; i)aŠ  The systemd service that would respawn *pid* when it exits, or ``None``.

systemd restarts a unit only when its main process exits, so the gateway must BE the
MainPID or its direct child (a non-exec wrapper that exits with it). The inherited
INVOCATION_ID is no evidence: a terminal tab's shell carries one (its .scope is never
respawned), and so does anything deep under a CI runner's service.)rH   r€   re   rt   z.serviceNz/user@Ú	systemctlú--userrI   z--property=RestartrJ   rK   éÿÿÿÿ)re   Úno)rM   rH   r€   ro   ÚrsplitÚendswithr   rN   rO   ÚSubprocessErrorÚ_ppidrR   rS   )rW   rH   r€   rq   Úleafr@   ÚmainÚrestarts   &       r   r¸   r¸   Ì   så   € ÷ GÜ˜Ó×#Ð# €FØ�=‰=˜˜aÓ  Õ$€DØ�=‰=˜×$Ò$ÙØ+3°vÔ+=�˜hÑ'ÀKÀ=€IÜ	”'œ:×5Ñ5×	6Õ	6Ù˜iÓ.ˆØ�!Œ8˜¤e¨C£jÐ 1Ô1Ù  ¨f°dÐ<PÐR[Ð-\Õ!\ÐfhÔiˆGØ#ŸN™N×0Ð0¨b×7Ñ7Ó9ÀÔK‘4ÐQU÷	 
7×	6Ò	6ñ
 ÷ 
7Ö	6ñ
 ús   ÂAC;ÃC;Ã;D	c               ó    € V ^8„  d   QhRRRR/# )r   Úservice_pidsúset[int]r   ztuple[list[dict], list[str]]r   )r   s   "r   r   r   á   s   € ÷ ñ  ð Ð.Jñ r   c                óþ  € ^ RI Hp ^ RIHpHpHp ^ RIHp ^ RIH	p \        V 4      \        V! RR7      4      ,          pV! V! VRR7      4      p. . r©V F¤  p\        V4      p\        V4      pV! V4      V! V4      ríV'       g   V'       d	   V'       g4   V'       d   RV 2MV'       g   R	MR
pV
P                  RV RV R24       Ks  V	P                  RVR\        V4      R\        V4      RV! V4      /4       K¦  	  Wš3# )zX``(bare gateways, notices)``: this install's ``gateway run`` processes outside any unit.©Úget_process_start_time)r°   Ú_get_service_pidsÚfind_gateway_pids)Ú_scoped_manual_gateway_pidsr¬   T)Úall_profiles)Úexclude_pidsrÒ   zsupervised by z"its command line could not be readz#its Hermes home could not be provedu     â†· gateway PID z' keeps running until after the update (Ú)rW   ÚargvrŒ   Úct)Úgateway.statusrÎ   r�   r°   rÏ   rÐ   rM   rÑ   r£   r­   rŽ   r¥   r»   r�   rA   rC   )rÊ   rÎ   r°   rÏ   rÐ   rÑ   r­   rž   r	   ÚbareÚnoticesrW   ÚmarkerrÕ   rŒ   Úwhys   &               r   Ú_discover_barerÜ   á   sî   € å5ß^Ñ^ÝGÝ>Ü�,Ó¤#Ñ&7ÀTÔ&JÓ"KÕK€GÙ&Ñ'8ÀgÐ\`Ô'aÓb€DØ˜ˆ'ÛˆÜ�#‹hˆÜ$ SÓ)ˆÙ*¨3Ó/Ñ1AÀ#Ó1FˆdßŸ§Tß/5�N 6 (Ñ+×gkÑ;_Ø:ð à�N‰NÐ/°¨uÐ4[Ð\_Ð[`Ð`aÐbÔcÙØ�‰�U˜C ¬¨d«°V¼SÀ»YÈÑNdÐehÓNiÐjÖkñ ð ˆ=Ðr   c               ó    € V ^8„  d   QhRRRR/# )r   rW   r¥   r   r   )r   s   "r   r   r   ù   s   € ÷ ñ ˆsð �sñ r   c                ó.  € \        \        \        \        4      ;_uu_ 4        \	        R V  R24      P                  RR7      p\        VP                  R^4      ^,          P                  4       ^,          4      uuRRR4       #   + '       g   i     ^ # ; i)rY   z/statrZ   r[   rÔ   N)	r   rN   Ú
ValueErrorÚ
IndexErrorr   ri   r¥   rÂ   rh   )rW   Ústats   & r   rÅ   rÅ   ù   sl   € Ü	”'œ:¤z×	2Õ	2Ü�f˜S˜E Ð'Ó(×2Ñ2¸GÐ2ÓDˆÜ�4—;‘;˜s AÓ& qÕ)×/Ñ/Ó1°!Õ4Ó5÷ 
3×	2×	2Ñ	2ñ ús   ¢ABÂB	c               ó    € V ^8„  d   QhRRRR/# )r   rB   r
   r   r)   r   )r   s   "r   r   r      s   € ÷  ñ  ˜ð   $ñ  r   c                ó8  € \        4       V P                  R4      r!Ve	   V'       g   R# \        W4      '       g   R# ^ RIHp . \
        P                  ! 4       rTV^8”  dÝ   WPR,          8w  dÐ   \        \        V4      V R,          4      '       d®   \        \        4      ;_uu_ 4        \        RV R24      P                  4       P                  R	R
4      P                  RR4      pV\
        P                  ! 4       8w  d   V! V4      '       d    RRR4       M&RRR4       VP                  V4       \        V4      pKã  V R,          R8X  d   RMRpRVRRRRRRR\
        P                  ! 4        R2RRRR\        \!        V4      4      .\#        \        V4      ORNRNR V R!,           R"2NR#Np\        \        \$        P&                  4      ;_uu_ 4        \$        P(                  ! VRRRR\$        P*                  ^RR$7       RRR4       \,        P.                  ! 4       R%,           p	\,        P.                  ! 4       V	8  d:   \        4       ;p
e   \        W¢4      '       g   R# \,        P0                  ! R&4       KS  R#   + '       g   i     ELi; i  + '       g   i     L•; i)'a'  Move this process (and its ancestors in the same unit, e.g. ``/update``'s bash wrapper)
into a transient scope so stopping *unit* cannot kill it. True only when proven out: a
membership that cannot be read (either side) keeps the unit running, since its stop would take
this update down with it.rq   NFT)Úlooks_like_gateway_command_linerW   rY   z/cmdlineó    ó    rZ   Úreplacer‹   Úuserr¿   z--systemÚbusctlÚcallzorg.freedesktop.systemd1z/org/freedesktop/systemd1z org.freedesktop.systemd1.ManagerÚStartTransientUnitzssa(sv)a(sa(sv))zhermes-update-z.scopeÚfailÚ2ÚPIDsÚauÚDescriptionÚszhermes update (outside rB   z while it is paused)r´   ©Úcapture_outputÚtextr\   ÚerrorsÚstdinrL   Úcheckg      @gš™™™™™¹?)ro   r=   rv   r×   rä   ÚosÚgetpidr   rN   r   Ú
read_bytesrç   Údecoder�   rÅ   rC   ÚlenÚmaprO   rÄ   ÚrunÚDEVNULLÚtimeÚ	monotonicÚsleep)rB   Úownrr   rä   r	   rW   ÚcmdlineÚbusÚcmdÚdeadlineÚnows   &          r   Ú_escape_cgroupr	     s'  € ô
 #“} d§h¡h¨xÓ&8ˆØ
‚{Ÿ+ÙÜ�3×$Ò$ÙÝ>Ø”B—I’I“Kˆ#Ø
�Œ'�c %�[Ô(¬W´[ÀÓ5EÀtÈHÅ~×-VÒ-VÜ”g×ÕÜ˜V C 5¨Ð1Ó2×=Ñ=Ó?×GÑGÈÈtÓT×[Ñ[Ð\cÐenÓoˆGØ”b—i’i“kÔ!Ñ&EÀg×&NÒ&NØ÷ ×Ðð 	�‰�CÔÜ�C‹jŠØ˜7•m vÔ-‰(°:€CØ�S˜&Ð"<Ð>YØ-Ð/CÐEWØœBŸIšI›K˜=¨Ð/°¸¸fÀdÌCÔPSÐTXÓPYËNðbä]`ÔadÐfjÓ]kðbð ðbð ðbð "9¸¸f½¸ÐFZÐ[ðbð ^aðb€Cô 
”'œ:×5Ñ5×	6Õ	6Ü�Š�s¨4°dÀWÐU^Ü#×+Ñ+°R¸uõ	F÷ 
7ô �~Š~Ó #Õ%€HÜ
�.Š.Ó
˜XÔ
%Ü“=Ð ˆCÒ-´g¸c×6OÒ6OÙÜ�
Š
�3ŽÙ÷' ×Ðú÷ 
7×	6ús   Â%A%I5ÄI5Ç-J	É5J	Ê	J	c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   ry   r§   r   z(tuple[list[dict], list[dict], list[str]]r   )r   s   "r   r   r   #  s"   € ÷ *ñ *˜ð *¨:ð *Ð:bñ *r   c                ó  € ^ RI Hp . . . rTpV  Fu  p\        VR,          4      f   VP                  RVR,           R24       K5  \	        V4      '       d   VP                  V4       KY  VP                  RVR,           R24       Kw  	  V Fr  pV! VR,          4      '       g,   \
        P                  P                  R4      VR	,          8X  d   VP                  RVR	,           R
24       Ka  VP                  V4       Kt  	  W4V3# )zDDrop the runtimes whose stop would kill this updater; name each one.)Ú#_is_pid_ancestor_of_current_processr‹   u     â†· rB   z^ keeps running until after the update (stopping a system unit needs root or passwordless sudo)zf keeps running until after the update (this update could not prove it runs outside that unit's cgroup)rW   r³   r    zO keeps running until after the update (this update runs inside its launchd job))r�   r  Ú_manage_cmdr�   r	  rø   r·   r=   )r   r§   r  Ú
keep_unitsÚ	keep_jobsrÙ   rB   Újobs   &&      r   Ú_left_runningr  #  sú   € åFØ%'¨¨R˜7€JÛˆÜ�t˜G•}Ó%Ò-Ø�N‰N˜V D¨¥L >ð 2Cð Cö Dä˜D×!Ò!Ø×Ñ˜dÖ#à�N‰N˜V D¨¥L >ð 2Kð Kö Lñ ó ˆÙ/°°Eµ
×;Ò;Ü—:‘:—>‘>Ð"4Ó5¸¸W½ÔEØ�N‰N˜V C¨¥L >ð 25ð 5ö 6ð ×Ñ˜SÖ!ñ ð  'Ð)Ð)r   c               ó    € V ^8„  d   QhRRRR/# )r   r‹   rC   r   zlist | Noner   )r   s   "r   r   r   <  s   € ÷ ñ �sð ˜{ñ r   c                ó²   € ^ RI HpHp V R8X  d   RR.MR.pVR.,           pV R8X  d0   V! V 4      '       d"   RR.VOpV! V. R
O,           4      '       d   V# R	# V# )rF   )Ú_needs_sudoÚ_sudo_noninteractive_okrè   r¾   r¿   z--no-ask-passwordÚsystemÚsudoz-nN)rI   z-pÚIdrˆ   )rM   r  r  )r‹   r  r  r  r  s   &    r   r  r  <  si   € ßPØ%*¨f¤_ˆ;˜Ñ
!¸;¸-€CØ
Ð$Ð%Õ
%€CØ�Ô™[¨×/Ò/Ø˜Ð#˜sÐ#ˆÙ.¨sÒ5[Õ/[×\Ò\ˆtÐfÐbfÐfØ€Jr   c               ó    € V ^8„  d   QhRRRR/# )r   rB   r
   r   ÚNoner   )r   s   "r   r   r   F  s   € ÷ eñ e�Tð e˜dñ er   c                ó:  € ^ RI Hp \        V R,          4      pVf   \        RV R,           24      hV! VRV R,          .,           \        R7      pVP
                  ^ 8w  d;   \        RV R,           R	VP                  ;'       g    R
P                  4        24      hR# )rF   rG   r‹   Nz!no privilege to stop system unit rB   ÚstoprK   zsystemctl stop ú	 failed: re   )rM   rH   r  r   Ú_STOP_TIMEOUT_SrQ   ÚstderrrS   )rB   rH   r  rT   s   &   r   Ú
_stop_unitr   F  s�   € Ý6Ü
�d˜7•mÓ
$€CØ
‚{ÜÐ>¸tÀF½|¸nÐMÓNÐNÙ˜˜v t¨F¥|Ð4Õ4¼oÔN€FØ×Ñ˜AÔÜ˜_¨T°&­\¨N¸)ÀVÇ]Á]×EXÐEXÐVX×D_ÑD_ÓDaÐCbÐcÓdÐdñ r   c               ó    € V ^8„  d   QhRRRR/# )r   rB   r
   r   r¥   r   )r   s   "r   r   r   P  s   € ÷ 3ñ 3�dð 3˜sñ 3r   c                ó,  € ^ RI HpHpHpHp \        V R,          4      pVf   \        RV R,           24      hV! V R,          V R,          4       V! VRV R,          .,           ^
R7       V! VRV R,          .,           \        R7      pV R,          R8X  d   R	R
.MR	.pVP                  ^ 8w  g   V! WpR,          RR7      '       gD   \        V R,           RVP                  ;'       g    RP                  4       ;'       g    R 24      hV! WpR,          4      # )z¿Start *unit* through systemd; the new MainPID (raises when it does not come up). The unit
gets the definition repair the restart it replaces ran first (``_restart_one_systemd_gateway_unit``).)Ú$_repair_unit_without_fatal_exit_parkrH   r€   Ú_wait_for_service_activer‹   z"no privilege to start system unit rB   zreset-failedrK   Ústartrè   r¾   r¿   ç      .@z did not start: re   z
not active)rM   r#  rH   r€   r$  r  ÚRuntimeErrorr  rQ   r  rS   )rB   r#  rH   r€   r$  r  rT   r@   s   &       r   Ú_start_unitr(  P  sþ   € ÷ó ô �d˜7•mÓ
$€CØ
‚{ÜÐ?ÀÀVÅ¸~ÐNÓOÐOÙ(¨¨f­°t¸Gµ}ÔEÙˆs�n d¨6¥lÐ3Õ3¸RÕ@Ù˜˜w¨¨V­Ð5Õ5¼ÔO€FØ+/°­=¸FÔ+B�˜hÑ'ÈÈ€IØ×Ñ˜AÔÑ%=¸iÈfÍÐ_c×%dÓ%dÜ˜d 6�l˜^Ð+;¸V¿]¹]×=PÐ=PÈb×<WÑ<WÓ<Y×<iÐ<iÐ]iÐ;jÐkÓlÐlÙ˜)¨&¥\Ó2Ð2r   ÚdrainedFc               ó$   € V ^8„  d   QhRRRRRR/# )r   r  r
   r)  r)   r   r  r   )r   s   "r   r   r   b  s&   € ÷ hñ h�4ð h Tð h°dñ hr   c               ó,  € ^ RI Hp ^ RIHp V'       g8   V P	                  R4      '       d!   V! \        V R,          4      V R,          4       \        P                  ! RRV R,           RV R	,           2.R
R
RR\        P                  ^ZRR7      p\        V R,          .R4       VP                  ^ 8w  db   V! V R	,          4      ^,          ;'       g    ^ ^ 8”  d;   \        RV R	,           RVP                  ;'       g    RP                  4        24      hR# R# )z�Boot *job* out of launchd. *drained*: its gateway already exited through the drain; the
bootout only keeps KeepAlive from serving the update.)r™   ©Ú!_write_update_planned_stop_markerrŒ   rW   Ú	launchctlÚbootoutr¡   rt   r    TrZ   rç   Frò   r   zlaunchctl bootout r  re   N)r�   r™   Úhermes_cli.update_cmd_windowsr-  r=   r   rO   rþ   rÿ   Ú
_wait_gonerQ   r   r  rS   )r  r)  r™   r-  rT   s   &$   r   Ú	_stop_jobr2  b  sñ   € õ CÝOß�s—w‘w˜v—’Ù)¬$¨s°6­{Ó*;¸SÀ½ZÔHÜ�^Š^˜[¨)¸¸H½°ÀaÈÈGÍÀ~Ð5VÐWØ+/°dÀWÐU^Ü#×+Ñ+°R¸uôF€Fô ��E•
ˆ|˜TÔ"à×Ñ˜AÔÑ#BÀ3ÀwÅ<Ó#PÐQRÕ#S×#XÐ#XÐWXÐ\]Ô"]ÜÐ/°°Gµ¨~¸YÈÏÉ×H[ÐH[ÐY[×GbÑGbÓGdÐFeÐfÓgÐgñ #^Ñr   c               ó    € V ^8„  d   QhRRRR/# )r   r  r
   r   r  r   )r   s   "r   r   r   r  s   € ÷ Nñ N�Dð N˜Tñ Nr   c                ó˜  € ^ RI HpHpHpHp V R,          V! 4       8X  d   V! 4       '       g    V! V R,          V R,          V R,          4       \
        P                  ! RRV R,           RV R,           2.RRR	R
\
        P                  ^RR7       V! V R,          V R,          RV R,          R7      '       g   \        V R,           R24      hR# )z›Load and start *job*. The invoking profile's plist is regenerated first, as the restart it
replaces does (``launchd_restart``); that refresh also loads it.)Ú_launchctl_bootstrapÚ_wait_for_launchd_service_pidÚget_launchd_labelÚrefresh_launchd_plist_if_neededr    r¡   r¢   r.  Ú	kickstartrt   TrZ   rç   Frò   rW   r&  )Úold_pidrL   r¡   z  did not come back under launchdN)	r�   r5  r6  r7  r8  rO   rþ   rÿ   r'  )r  r5  r6  r7  r8  s   &    r   Ú
_start_jobr;  r  s¾   € ÷ó ð ��LÑ-Ó/Ô/Ñ4S×4UÒ4UÙ˜S �]¨C°­L¸#¸g½,ÔGÜ‡N‚N�K °°Xµ°¸qÀÀWÅÀÐ.OÐPØ"&¨T¸GÈIÜ#×+Ñ+°R¸uõFñ )¨¨W­¸sÀ5½zÐSWÐ`cÐdlÕ`m×nÓnÜ˜c '�l˜^Ð+KÐLÓMÐMñ or   c               ó    € V ^8„  d   QhRRRR/# )r   rW   r¥   r   r)   r   )r   s   "r   r   r   �  s   € ÷ Hñ H�ð H˜Dñ Hr   c                ó°   € ^ RI HpHp  V! \        V 4      4      '       g   R#  TRJ ;'       g    T! \        T 4      4      RT39   #   \         d     R# i ; i)rF   )Ú_pid_existsrÎ   FTN)r×   r>  rÎ   r¥   r2   )rW   rÖ   r>  rÎ   s   &&  r   Ú_aliver?  �  s\   € ßBðÙœ3˜s›8×$Ò$Ùð %ð �ˆ:×GÐGÑ/´°C³Ó9¸dÀB¸ZÑGÐGøô ô Úðús   ŠA ÁAÁAc               ó$   € V ^8„  d   QhRRRRRR/# )r   rL   ÚfloatÚbornr   r   rË   r   )r   s   "r   r   r   ‹  s!   € ÷ ñ ˜eð ¨;ð À(ñ r   c           	     ó`  € \         P                  ! 4       V,           p\        V 4      pV'       dz   \         P                  ! 4       V8  d`   V Uu0 uF1  p\        YR;'       g    / P	                  V4      4      '       g   K/  VkK3  	  ppV'       g   Ki  \         P
                  ! R 4       K�  V# u upi )çš™™™™™É?)r   r  rŽ   r?  r=   r  )r	   rL   rB  r  ÚliverW   s   &&&   r   r1  r1  ‹  sv   € Ü�~Š~Ó 'Õ)€HÜˆt‹9€Dß
”4—>’>Ó# hÔ.Ù#ÓJ™t˜¤v¨c·J°J¸B×3CÑ3CÀCÓ3H×'I—�™tˆÐJß‰4Ü�JŠJ�sŽOØ€Kùò Ks   ÁB+Á!B+Á?B+c               ó    € V ^8„  d   QhRRRR/# )r   Úentryr
   r   r)   r   )r   s   "r   r   r   •  s   € ÷ Mñ M˜ð M $ñ Mr   c                ó  € ^ RI Hp V P                  R4      '       g   R#  V! \        V R,          4      4      p\        T;'       d+    TP                  R4      ;'       g    TP                  R4      4      #   \         d     R# i ; i)au  Ask the gateway over its control socket to finish its in-flight turns and exit; True on its
ACK. That is the ``request_restart`` drain the post-update restart uses (SIGUSR1); SIGTERM,
``systemctl stop`` and ``launchctl bootout`` enter ``stop()`` at once and cut a turn off. No
planned-stop marker on this path: the gateway's marker watcher takes that same immediate
signal-stop path, and could fire before the request lands. The caller records the request
(``mark_stop_sent``) BEFORE sending it, so a request that reaches the gateway after this update
died still leaves the evidence that keeps the drained gateway's restart debt.)Úpause_gateway_for_updaterŒ   FÚpausingÚalready_stopping)Úgateway.control_socketrI  r=   r   r2   r)   )rG  rI  Úacks   &  r   Ú_ask_to_drainrN  •  sv   € õ @Ø�9‰9�V×ÒÙðÙ&¤t¨E°&­MÓ':Ó;ˆô �×KÐK˜Ÿ™ Ó+×JÐJ¨s¯w©wÐ7IÓ/JÓLÐLøô ô Úðús   ¡A6 Á6BÂBc               ó    € V ^8„  d   QhRRRR/# ©r   rG  r
   r   r  r   )r   s   "r   r   r   §  s   € ÷ 
2ñ 
2˜ð 
2 $ñ 
2r   c                ó¨  € ^ RI Hp V P                  R4      R8X  d   \        V 4       R# V P                  R4      R8X  d   \	        V 4       R# V! \        V R,          4      V R,          4       \        \        \        4      ;_uu_ 4        \        P                  ! V R,          \        P                  4       RRR4       R#   + '       g   i     R# ; i)z\The stop for a gateway that did not take the drain: its supervisor's, else marker + SIGTERM.r,  r‰   rŠ   rŸ   rŒ   rW   N)r0  r-  r=   r   r2  r   r   ÚProcessLookupErrorÚPermissionErrorrø   ÚkillÚsignalÚSIGTERM)rG  r-  s   & r   Ú_stop_at_oncerW  §  s�   € åOØ‡y�y�Ó˜IÔ%Ü�5ÖØ	�‰�6Ó	˜iÔ	'Ü�%Öá)¬$¨u°V­}Ó*=¸uÀU½|ÔLÜÔ(¬/×:Õ:Ü�GŠG�E˜%•L¤&§.¡.Ô1÷ ;×:×:Ò:ús   Â	-C Ã C	c               ó   € V ^8„  d   QhRR/# )r   r   rA  r   )r   s   "r   r   r   ´  s   € ÷ #ñ #�uñ #r   c                 ó   € ^ RI Hp  V ! 4       # )z_The post-update restart's wait for a drained gateway (after-turn wait + stop drain + headroom).©Ú_gateway_drain_budget)rM   r[  rZ  s    r   Ú_drain_budgetr\  ´  s   € åAÙ Ó"Ð"r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r5   r
   Úentriesry   r   r  r   )r   s   "r   r   r   º  s&   € ÷ %dñ %d˜$ð %d¨ð %d¸ñ %dr   c                ó|  € ^ RI Hp ^ RIHp \	        4       . rTV Ft  pVP                  WR,          4       \        V4      '       d   VP                  V4       K?  \        V4       VP                  R4      '       d   Kc  VP                  V4       Kv  	  V'       g   R# \        RVR R\        V4       R	24       V Uu. uF5  qs! VP                  R
4      '       d   \        VR
,          4      MRVR7      NK7  	  pp\        P                  ! 4       V,           p	V'       d¬   \        P                  ! 4       V	8  d’   V Uu. uF/  p\        VR,          VP                  R4      4      '       d   K-  VNK1  	  up F  pVP!                  V4       \#        V4       K!  	  V'       d   TMR F
  p
V
! 4        K  	  \        P$                  ! R4       K³  V F‡  pVP                  R4      '       d   \        V4       K'  \'        \(        \*        4      ;_uu_ 4        \,        P.                  ! VR,          \1        \2        R\2        P4                  4      4       RRR4       K‰  	  V Uu. uF  qwP                  R4      '       d   K  VNK  	  pp\7        V Uu. uF  qwR,          NK  	  upRV Uu/ uF  qwR,          VP                  R4      bK  	  up4      ;p'       d@   \9        RRP;                  \=        \>        \A        V4      4      4      ,           R,           4      hR# u upi u upi   + '       g   i     EKb  ; iu upi u upi u upi )aÈ  Drain every gateway (bare ones SIGTERMed when they do not answer), then wait for all of them
within one drain budget. A supervised gateway that exited through the drain is stopped through
its supervisor at once: its exit 75 asks for a restart, which systemd honours after
``RestartSec=5`` and launchd immediately, still on the old tree. Past the budget a supervised
survivor gets its supervisor's stop and a bare one SIGKILL, as the restart path escalates.r,   )Údrain_progress_reporterrW   r‰   Nu     â�³ Waiting up to z.0fzs for in-flight turns on z to finish before the update...rŒ   )Úbudget_srÖ   rD  ÚSIGKILLg      $@zgateway PID(s) ú, z did not stopr   )!r/   r-   Ú"hermes_cli.update_cmd_drain_reportr`  r\  Úmark_stop_sentrN  r�   rW  r=   r3   Ú_namesr   r   r  r?  ÚremoveÚ_disarmr  r   rR  rS  rø   rT  ÚgetattrrU  rV  r1  r   Újoinrý   rC   Úsorted)r5   r^  r4   r`  ÚbudgetÚwaitingrG  ÚeÚticksr  ÚtickrØ   Úlefts   &&           r   Ú_stop_gatewaysrr  º  sa  € õ ?ÝJÜ#“o rˆGÛˆØ×#Ñ# E°­<Ô8Ü˜×ÒØ�N‰N˜5Ö!ä˜%Ô Ø—9‘9˜V×$Ô$Ø—‘˜uÖ%ñ ÷ ÙÜ	Ð  ¨ Ð,EÄfÈWÃoÐEVÐVuÐ
vÔwÙkrÓsÑkrÐfgÐ$¸¿¹¸f¿º¤T¨!¨F­)¤_È4ÐZ`×aÑkr€EÐsÜ�~Š~Ó &Õ(€Hß
”d—n’nÓ&¨Ô1Ù!(ÓN¡˜A´°q¸µxÀÇÁÀtÃ×0M—a�a¡ÔNˆEØ�N‰N˜5Ô!Ü�EŽNñ O÷ %‘E¨"Ò,ˆDÙŽFñ -ä�
Š
�3ŽÛˆØ�9‰9�V×ÒÜ˜%Ö äÔ,¬o×>Õ>Ü—’˜˜e�¤g¬f°iÄÇÁÓ&PÔQ÷ ?Ñ>ñ	 ñ Ó4‘w�!§e¡e¨F§m�AˆA‘w€DÐ4Ü©TÓ2©T¨˜UŸ8˜8©TÑ2°DÑZ^Ó:_ÑZ^ÐUV¸U½8ÀQÇUÁUÈ4Ã[Ò;PÑZ^Ñ:_Ó`Ð`€tÖ`ÜÐ,¨t¯y©y¼¼SÄ&ÈÃ,Ó9OÓ/PÕPÐSbÕbÓcÐcñ aùò! tùò O÷ ?×>Ñ>üâ4ùÚ2ùÒ:_s6   Â<;LÄ;*LÅ*LÈ<LÉL/É6L/ÊL4Ê!L9ÌL,c               ó    € V ^8„  d   QhRRRR/# rP  r   )r   s   "r   r   r   â  s   € ÷ 'ñ '�4ð '˜Dñ 'r   c                ó–   € V P                  R4      R8X  d   \        V 4       R# V P                  R4      R8X  d   \        V RR7       R# R# )zVA drained gateway exited: keep its supervisor from bringing it back during the update.r‰   rŠ   rŸ   T)r)  N)r=   r   r2  )rG  s   &r   rh  rh  â  s;   € à‡y�y�Ó˜IÔ%Ü�5ÖØ	�‰�6Ó	˜iÔ	'Ü�% ×&ñ 
(r   c               ó    € V ^8„  d   QhRRRR/# )r   r^  ry   r   rC   r   )r   s   "r   r   r   ê  s   € ÷ dñ d�Jð d 3ñ dr   c                ó2   € R P                  R V  4       4      # )rc  c              3  óœ   "  € T FB  qP                  R 4      ;'       g&    VP                  R4      ;'       g    RVR,           2x € KD  	  R# 5i)rB   r    úgateway PID rW   N)r=   ©ra   rn  s   & r   rc   Ú_names.<locals>.<genexpr>ë  s?   é € ÐcÑ[bÐVW—U‘U˜6“]×QÐQ a§e¡e¨G£n×QÐQ¸,ÀqÈÅxÀjÐ8QÔQÓ[bùs   ‚AžA·A)rj  )r^  s   &r   rf  rf  ê  s   € Ø�9‰9ÑcÑ[bÓcÓcÐcr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   rŒ   rC   rž   rË   r   z
int | Noner   )r   s   "r   r   r   î  s&   € ÷ 	Añ 	A˜3ð 	A¨ð 	A°jñ 	Ar   c                ó    € ^ RI Hp  V! \        V 4      4      pT'       d   \	        T4      T9  d   \	        T4      # R#   \         d     R# i ; i)a  The gateway serving *home*, by the canonical identity reader (PID file + runtime lock,
then the runtime status record), never a process scan: a replayed ``gateway run`` matches the
process matcher for the moment before it finds the home already served and exits.)Úlive_gateway_pid_for_homeN)r×   r}  r   r2   r¥   )rŒ   rž   r}  rW   s   &&  r   Ú_gateway_on_homer~  î  sL   € õ 9ðÙ'¬¨T«
Ó3ˆ÷ œs 3›x¨wÔ6Œ3ˆs‹8Ð@¸DÐ@øô ô Úðús   ˆ> ¾AÁAc               ó    € V ^8„  d   QhRRRR/# )r   rŒ   rC   r   r
   r   )r   s   "r   r   r   ú  s   € ÷ Pñ P�cð P˜dñ Pr   c                óæ   € ^ RI HpHp ^ RIHpHp \        V 4      P                  4       pWQ! 4       P                  4       8w  d'   WR! 4       P                  4       8X  d   V! RRRV /R7      # V! V RR7      # )aÂ  The environment a replayed gateway starts with, as the restart watcher it replaces chose it
(``_spawn_gateway_restart_watcher``): a named profile's gateway, replayed by an update launched
under that same profile, inherits the launcher's environment (an exported bot token may be its
only credential). The multiplexing root, and any home other than the launcher's, get that home's
own secrets and none of the launcher's (``served_profile_child_env``).)Úget_default_hermes_rootÚget_routing_process_hermes_home)Úbuild_subprocess_envÚserved_profile_child_envFÚHERMES_HOME)Úscrub_secretsÚinherit_profile_homeÚextraT)Útarget_homeÚinherit_credentials)Úhermes_constantsr�  r‚  Útools.environments.localrƒ  r„  r   Úresolve)rŒ   r�  r‚  rƒ  r„  Útargets   &     r   Ú_replay_envr�  ú  si   € ÷ ZßWÜ�$‹Z×ÑÓ!€FØÐ(Ó*×2Ñ2Ó4Ô4¸ÐCbÓCd×ClÑClÓCnÔ9nÙ#°%ÈeÐ\iÐkoÐ[pÔqÐqÙ#°È$ÔOÐOr   c               ó    € V ^8„  d   QhRRRR/# )r   rG  r
   r   r¥   r   )r   s   "r   r   r     s   € ÷ pñ p˜$ð p 3ñ pr   c                óÊ  € \        V R,          \        V R,          4      04      ;pe   V# \        V R,          4      R,          pVP                  RRR7       \	        V R,          4      pR F  pVP                  VR4       K  	  \        VR,          R4      ;_uu_ 4       p\        P                  ! \        V R	,          4      V\        P                  V\        P                  RRR
7      pRRR4       \        P                  ! 4       \        ,           p\        P                  ! 4       V8  d‚   \        V R,          \        V R,          4      04      ;pe   V# XP                  4       e.   \!        RV R,           RVP"                   RVR,           R24      h\        P$                  ! R4       K›  \!        RV R,           R\        \        4       R24      h  + '       g   i     Lñ; i)z´Replay a bare gateway from its recorded argv under its recorded home; the new PID once it
is serving. A gateway already serving that home (an earlier attempt's) is adopted instead.rŒ   rW   NÚlogsT)ÚparentsÚexist_okzgateway-update-resume.logÚabrÕ   )r¹   rö   rR   r  Ústart_new_sessionÚ	close_fdszreplayed gateway for z exited z (see rÔ   g      à?z did not come up within rñ   )ÚINVOCATION_IDÚJOURNAL_STREAMÚHERMES_UPDATE_PAUSEDÚ_HERMES_GATEWAY)r~  r¥   r   Úmkdirr�  ÚpopÚopenrO   ÚPopenrA   rÿ   ÚSTDOUTr   r  Ú_READY_TIMEOUT_SÚpollr'  rQ   r  )	rG  Úexistingr’  r¹   ÚleakedÚlogÚprocr  rW   s	   &        r   Ú_relaunch_barer§    s˜  € ô % U¨6¥]´S¸¸u½Ó5FÐ4GÓHÐHˆÒUØˆÜ��f•Ó Õ'€DØ‡J�J�t d€JÔ+Ü
�e˜F•mÓ
$€CÛ`ˆØ�‰�˜Öñ aä	ˆdÐ0Õ0°$×	7Ô	7¸3Ü×Ò¤ U¨6¥]Ó 3¸ÄJ×DVÑDVÐ_bÜ'1×'8Ñ'8ÈDÐ\`ôbˆ÷ 
8ô �~Š~ÓÔ"2Õ2€HÜ
�.Š.Ó
˜XÔ
%Ü# E¨&¥M´C¸¸e½Ó4EÐ3FÓGÐGˆCÒTØˆJØ�9‰9‹;Ò"ÜÐ!6°u¸Vµ}°oÀXÈdÏoÉoÐM^ð _'Ø'+Ð.IÕ'IÐ&JÈ!ð Mó Nð Nä�
Š
�3ŽÜ
Ð.¨u°V­}¨oÐ=UÔVYÔZjÓVkÐUlÐlmÐnÓ
oÐo÷ 
8×	7ús   ÂA
GÇG"	c               ó    € V ^8„  d   QhRRRR/# )r   r5   r
   r   rC   r   )r   s   "r   r   r      s   € ÷ ñ �Tð ˜cñ r   c                ó€  € V P                  R 4      ;'       g    .  Uu. uF,  qP                  R4      ;'       g    VP                  R4      NK.  	  ppY P                  R4      ;'       g    .  Uu. uF'  qP                  R4      '       g   K  RVR,           2NK)  	  up,          pRP                  V4      # u upi u upi )r%   rB   r    r$   rÕ   rx  rW   rc  )r=   rj  )r5   Úur”   s   &  r   Ú	_describer«     s¥   € Ø6;·i±iÀÓ6N×6TÐ6TÐRTÐ6TÓUÑ6T°�U‰U�6‹]×,Ð,˜aŸe™e G›nÒ,Ñ6T€EÐUØ	·±¸:Ó1F×1LÐ1LÈ"Ð1LÓ^Ñ1L¨A×PUÑPUÐV\×P]Ô'�˜Q˜u�X˜JÓ'Ñ1LÑ^Õ^€EØ�9‰9�UÓÐùò VùÚ^s   žB6ºB6Á/B;ÂB;c               ó   € V ^8„  d   QhRR/# )r   r   rD   r   )r   s   "r   r   r   (  s   € ÷ (ñ (˜zñ (r   c                 óV   € \         p V f   R# RV 9  d   \        V 4      V R&   V R,          # )a¸  Stop this install's gateways before the first checkout move; once per run.

Never refuses the update: the pause is protection, not a gate. When it cannot complete
(discovery or the durable record fails, a stop fails), the gateways run through the swap and
the post-commit restart refreshes them, which is how POSIX updated before the pause existed.
Always ``None``; the caller's refusal branch stays for the contract it shares with Windows.NÚposix_pause_verdict)r   Ú_pause)r5   s    r   Úpause_at_commit_pointr°  (  s4   € ô €EØ‚}ÙØ EÔ)Ü'-¨e£}ˆÐ#Ñ$ØÐ&Õ'Ð'r   c               ó    € V ^8„  d   QhRRRR/# )r   r5   r
   r   rD   r   )r   s   "r   r   r   7  s   € ÷ :ñ :�$ð :˜:ñ :r   c                óê  € ^ RI Hp  \        4       \        4       r2\	        W#4      w  r#p\        V Uu0 uF  qUR,          kK  	  upV Uu0 uF  qfR,          kK  	  up,          4      w  rxYH,            F  p
\        T
4       K  	  Y#,           pT'       g   T'       g   R# ^ RIH	p ^ RI
Hp \        P                  ! T 4      pY·,            F  pT! TR,          4      TR&   K  	  . T P                  R	. 4      OTOT R	&   . T P                  R
. 4      OTOT R
&   . T P                  R. 4      OR T 4       OT R&   / T P                  R/ 4      CY·,            Uu/ uF3  p\        TR,          4      TP!                  TR,          4      R,          bK5  	  upCT R&   RT R&    TP#                  T R. 4       TP%                  YT,            Uu. uF  pTR,          NK  	  upY·,            Uu/ uF<  pTP                  R4      '       g   K  TR,          T! \'        TR,          4      4      bK>  	  upR7       RT R&    \1        YT,           4       TP9                  T 4       \        R\;        T 4       R24       R# u upi u upi   \         d   p	\        RT	 R24        Rp	?	R# Rp	?	ii ; iu upi u upi u upi   \         d¦   p	T P                  R4      TP                  R4      8w  dF   \)        \        4      ;_uu_ 4        TP+                  T 4       RRR4       M  + '       g   i     M; iT P-                  4        T P/                  T4       \        RT	 R24        Rp	?	R# Rp	?	ii ; i  \         d‹   p	\        RT	 R24        \3        T 4       M'  \         d   p\        RT R24        Rp?MRp?ii ; i\4        P7                  4        F  pTP-                  4        K  	  TP9                  T 4        Rp	?	R# Rp	?	ii ; i)rF   r,   rW   u+     âš  Could not list the running gateways (z7); they keep running and are restarted after the updateNrÍ   )Ú_planned_stop_marker_pathrÖ   r%   r$   r#   c              3  ó2   "  € T F  qR ,          x € K  	  R# 5i)rW   Nr   ry  s   & r   rc   Ú_pause.<locals>.<genexpr>L  s   é € Ð@XÑSWÈaÀ5ÇÂÓSWùs   ‚Ú
identitiesTr!   rŒ   )ÚmarkersÚpause_idu.     âš  Could not record the gateways to pause (r<   u%     âš  Could not pause every gateway (z:); restarting them, the update continues without the pauseu     âš  z/; they restart once the dependencies are syncedu     â�¸ Paused for the update: z- (restarted once the dependencies are synced))r/   r-   r•   r¨   r  rÜ   r2   r3   r×   rÎ   r0  r³  ÚcopyÚdeepcopyr=   rC   Úidentityr1   Úmark_stop_requestedr   r   Ú	dischargeÚclearÚupdaterr  Úresume_paused_setr   ÚvaluesÚsyncr«  )r5   r4   r   r§   rÙ   rª  ÚjrØ   Úmorer8   rb   Ú
supervisedrÎ   r³  ÚbeforerG  rn  ÚagainÚ	restarteds   &                  r   r¯  r¯  7  s   € Ý>ðÜ'Ó)Ô+<Ó+>ˆtÜ,¨UÓ9Ñˆ�WÜ#±uÓ$=±u°! u§X X±uÑ$=ÑSWÓ@XÑSWÈaÀ5ÇÀÑSWÑ@XÕ$XÓY‰
ˆð —�ˆÜˆdŽñ à•€JßŸdÙÝ5ÝGÜ�]Š]˜5Ó!€FØ×"Ð"ˆÙ,¨U°5­\Ó:ˆˆd‹ñ #àG˜UŸY™Y }°bÓ9ÐG¸JÐG€Eˆ-ÑØ;˜%Ÿ)™) J°Ó3Ð;°dÐ;€Eˆ*ÑØY˜uŸy™y¨¸"Ó=ÐYÑ@XÑSWÓ@XÐY€Eˆ/Ñðp˜UŸY™Y |°RÓ8ð pØ\fÖ\mÓnÑ\mÐWXœc ! E¥(›m¨\×-BÑ-BÀ1ÀUÅ8Ó-LÈTÕ-RÒRÑ\mÑnðp€Eˆ,Ñà!€Eˆ/ÑðØ×!Ñ! %¨¨rÔ2Ø×(Ñ(Ø°4Ö&7Ó8Ñ&7 �A�e—H�HÑ&7Ñ8ØS]ÖSdÓvÑSdÈaÐhi×hmÑhmÐnt×huÔI�Q�u•XÑ8¼¸aÀ½i»ÓIÒIÑSdÑvð 	)ô 	xð "€Eˆ/ÑðÜ�u¨4Õ/Ô0ð ×Ñ�eÔÜ	Ð)¬)°EÓ*:Ð);Ð;hÐ
iÔjÙùòk %>ùÒ@XøÜô ÜÐ;¸C¸5Ð@wÐxÔyÝûðüò$ oùò
 9ùÚvøÜô 	ð �9‰9�ZÓ  F§J¡J¨zÓ$:Ô:Üœ)×$Õ$Ø×&Ñ& uÔ-÷ %×$×$Ð$úà�‰ŒØ�‰�VÔÜÐ>¸s¸eÐCzÐ{Ô|Ýûð	ûô ô 	ÜÐ5°c°UÐ:tÐuÔvð	SÜ˜eÕ$øÜô 	SÜ�F˜5˜'Ð!PÐQ×RÑRûð	Súä#×*Ñ*Ö,ˆIØ�O‰OÖñ -à×Ñ˜%Ô Ýûð	úsÐ   ˆ*I3 ²I)ÁI3 Á	I.
ÁI3 Å9JÆ)J* Æ>J 
ÇJ* ÇJ%Ç:$J%ÈJ* È,M É)
I3 É3JÉ>JÊJÊ 
J* Ê*MÊ5<MË1LÌ	MÌLÌ8MÍMÍO2Í(O-Í8NÎO-ÎN(ÎN#ÎO-Î#N(Î(?O-Ï-O2c               ó    € V ^8„  d   QhRRRR/# )r   r5   r
   r   r  r   )r   s   "r   r   r   v  s   € ÷ (#ñ (#˜Tð (# dñ (#r   c                ó6  € . p. p. pV P                  R4      ;'       g    .  Fá  p VP                  R4      R8X  d9   \        V4       \        R,          P                  VR,          4       VR,          pM]\        R,          P                  \	        V4      4       \        R,          P                  VR,           R	VR
,           24       VR
,          pVP                  V4       V P                  R. 4      P                  V4       Kã  	  W0R&   . pV P                  R4      ;'       g    .  Fb  pVP                  R4      '       g   K   \        V4      p\        R,          P                  V4       VP                  RVR,           RV 24       Kd  	  WpR&   V U	u. uF  q™R,          NK  	  up	V R&   / V R&   V'       d   \        RRP                  V4       24       V'       d"   \        RRP                  V4      ,           4      hRV R&   RV R&   R#   \         d8   pTP                  \        T4      4       TP                  T4        Rp?EK'  Rp?ii ; i  \         d8   pTP                  \        T4      4       TP                  T4        Rp?EKf  Rp?ii ; iu up	i )zUStart every paused runtime again; each leaves *token* only on its own verified start.r%   r‰   rŸ   r   r    r	   r   r‹   rt   rB   Úrestarted_servicesNr$   rÕ   rx  rW   u    â†’ r#   r"   u#     â–¶ Restarted paused gateway(s): rc  z(Could not restart every paused gateway: z; Fr!   r<   )r=   r;  r   r�   r(  r�   Ú
setdefaultr2   rC   r§  r3   rj  r'  )
r5   ÚfailuresrÈ  Ú
kept_unitsrG  rƒ   r8   Ú	kept_bareÚnew_pidrn  s
   &         r   rÀ  rÀ  v  sH  € à€HØ€IØ€JØ—‘˜=Ó)×/Ð/¨RÒ/ˆð	%Ø�y‰y˜Ó  IÔ-Ü˜5Ô!Ü˜8Õ$×(Ñ(¨¨w­Ô8Ø˜W•~‘ä˜6Õ"×&Ñ&¤{°5Ó'9Ô:Ü˜7Õ#×'Ñ'¨5°­>Ð*:¸!¸EÀ&½M¸?Ð(KÔLØ˜V•}�Ø×Ñ˜TÔ"Ø×ÑÐ1°2Ó6×=Ñ=¸dÖCñ 0ð &ˆ-ÑØ€IØ—‘˜:Ó&×,Ð,¨"Ò,ˆØ�y‰y˜× Ò Ùð	$Ü$ UÓ+ˆGÜ�vÕ×"Ñ" 7Ô+Ø×Ñ˜|¨E°%­L¨>¸¸w¸iÐHÖIñ -ð "ˆ*ÑÙ09Ó:±	¨1 Ÿh˜h±	Ñ:€Eˆ/ÑØ€Eˆ*ÑßÜÐ3°D·I±I¸iÓ4HÐ3IÐJÔKßÜÐEÈÏ	É	ÐRZÓH[Õ[Ó\Ð\Ø"€Eˆ/ÑØ"€Eˆ/Óøô/ ô 	%Ø�O‰OœC ›HÔ%Ø×Ñ˜e×$Ó$ûð	%ûô ô 	$Ø�O‰OœC ›HÔ%Ø×Ñ˜U×#Ó#ûð	$üò ;s7   ¦CHÅAIÆJÈIÈ+I	É	IÉJÉ+JÊJc               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   ¡  s   € ÷ ñ ˜4ñ r   c                 ó   € \         # )zXWhat the early resume restarted on the new code in this process (for the fleet restart).)r   r   r   r   Úalready_restartedrÓ  ¡  s   € äÐr   )Úselfr‚   ):Ú__conditional_annotations__r   Ú
__future__r   r¹  rø   rU  rO   r.   r   Ú
contextlibr   Úpathlibr   r   Ú__annotations__rŽ   r   r  r¡  r'  r   r&   r9   r>   rU   ro   rv   r•   r¨   r‘   r»   r¸   rÜ   rÅ   r	  r  r  r   r(  r2  r;  r?  r1  rN  rW  r\  rr  rh  rf  r~  r�  r§  r«  r°  r¯  rÀ  rÓ  )rÕ  s   @r   Ú<module>rÚ     s9  øðôõB #ã Û 	Û Û Û 
Û Ý Ý ð €€kÓ ð ™S›U H©c«e°V¹S»UÐC€
ˆDÓ Cà€ØÐ ôU�<ô Uõ/õ
õ,Rõ÷	õUõõ:õ.õõ,õ*õ0õ õF*õ2õeõ3ð$h¨E÷ hõ NõH÷õMõ$
2õ#õ%dõP'õdõ	AõPõpõ0õ(õ:õ~(#÷Vr   