+
    jHàjJ.  ã                  óä   a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RI	t	^ RI
t
^ RIt^ RIHtHt RsR]R&   R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/R R lltR R ltR# )zëThe newly imported escape hatch from an already-running historical updater.

This module must remain stdlib-only: the parent still has the old interpreter,
modules and native extensions. Only the child imports the updated application.
)ÚannotationsN)ÚPath)ÚAnyÚNoReturnz
int | NoneÚ_resultc               ó    € V ^8„  d   QhRRRR/# )é   Úframer   ÚreturnÚbool© )Úformats   "Ú</home/ubuntu/.hermes/hermes-agent/hermes_cli/_old_updater.pyÚ__annotate__r      s   € ÷ /ñ / sð /¨tñ /ó    c                ó�   € \         w  rV P                  P                  R 4      V9   ;'       d    V P                  P                  V9   # )Ú__name__)Ú_HISTORICAL_UPDATE_FRAMESÚ	f_globalsÚgetÚf_codeÚco_name)r	   ÚmodulesÚnamess   &  r   Ú_is_historical_update_framer      sA   € Ü.�N€GØ�O‰O×Ñ 
Ó+¨wÑ6÷ .ð .Ø—‘×$Ñ$¨Ñ-ð/r   c               ó   € V ^8„  d   QhRR/# )r   r
   r   r   )r   s   "r   r   r   %   s   € ÷ ñ ˜dñ r   c                 óÈ   € \         P                  ! ^4      p  V e?   \        V 4      '       d    RV P                  P                  9  d    ? R# V P
                  p KB   ? R#   ? i ; i)aA  True when an ancestor frame is a historical updater entrypoint.

The current tree's updater sets ``_hermes_current_updater_frame`` in its
entrypoints; no historical on-disk version contains that local, so its
presence proves the caller is current code that must keep running rather
than hand control to a takeover child.
Ú_hermes_current_updater_frameTF)ÚsysÚ	_getframer   r   Úco_varnamesÚf_back)r	   s    r   Úin_historical_updater"   %   sa   € ô �MŠM˜!Ó€EðØÒÜ+¨E×2Ò2Ø7¸u¿|¹|×?WÑ?WÔWØò ð —L‘LŠEð	  ð Ùøñ ús   ˜0A ÁA ÁA!c               ó   € V ^8„  d   QhRR/# )r   r
   ztuple[dict, list[dict], Any]r   )r   s   "r   r   r   9   s   € ÷ 2ñ 2Ð9ñ 2r   c                 óö  a€ Rp / p. pRp\         P                  ! ^4      p VEe	   Vf<   \        V4      '       d+   RVP                  P                  9   d   RVP
                  9  pV  F2  pWQ9  g   K  WTP
                  9   g   K  VP
                  V,          W&   K4  	  VP
                  P                  R4      o\        S\        4      '       dR   \        ;QJ d    V3R	 lV 4       F  '       g   K   R
M	  RM! V3R	 lV 4       4      '       g   VP                  S4       VP                  pEK   ?\         P                  P                  R4      pV'       d   \        V4      P                  R4      MRp\        VRR4      pVe   V! 4       MTp	\        V	RR4      p
VP                  R4      p\        P                   ! V4      '       d.   \        V\"        4      '       g   \        P$                  ! V4      pM?\        V\        4      '       g*   \        V
\        4      '       d   V
P                  R4      MRpRVR
J RVP                  R4      RVP                  R4      RVP                  R4      R\'        VP                  RR\         P(                  9   4      4      R\'        VP                  RR\         P(                  9   4      4      RV'       d
   V^ ,          MRRTR\        V
\        4      '       d   T
MR/	W'3#   ?i ; i)zßCarry data already held by old frames, without importing their modules.

Older callers did not pass a continuation object. Read only the historical
updater's known local names; do not serialize frames or arbitrary globals.
Úhad_desktop_app_before_updateÚpre_update_snapshot_idÚpre_update_versionÚgateway_modeÚ
assume_yesÚ_pre_update_planNÚ_windows_gateway_resumec              3  ó,   <"  € T F	  pSVJ x € K  	  R # 5i©Nr   )Ú.0ÚitemÚtokens   & €r   Ú	<genexpr>Ú&_historical_context.<locals>.<genexpr>Q   s   øé € Ð2UÉWÀT°5¸Dµ=ËWùs   ƒTFúhermes_cli.update_receiptÚ_currentr   ÚdataÚplanÚrestart_updateÚdesktopz	--gatewayz--yesÚwindows_resumeÚreceipt)r%   r&   r'   r(   r)   r*   )r   r   r   r   r    Úf_localsr   Ú
isinstanceÚdictÚanyÚappendr!   r   ÚvarsÚgetattrÚdataclassesÚis_dataclassÚtypeÚasdictr   Úargv)r   ÚfoundÚresumesr7   r	   ÚnameÚreceipt_moduleÚreceipt_slotÚget_currentÚcurrentr:   r6   r0   s               @r   Ú_historical_contextrN   9   s`  ø€ ðU€Eà€EØ€GØ€NÜ�MŠM˜!Ó€EðØÓð Ò&Ô+FÀu×+MÒ+MØ,°·±×0HÑ0HÔHØ!5¸U¿^¹^Ñ!K�Û�ØÖ$¨·±Ö)?Ø"'§.¡.°Õ"6�E“Kñ ð —N‘N×&Ñ&Ð'@ÓAˆEÜ˜%¤×&Ò&¯s«sÔ2UÉWÓ2U¯s¯sªsÔ2UÉWÓ2U×/UÒ/UØ—‘˜uÔ%Ø—L‘L‹Eð  ð Ü—[‘[—_‘_Ð%@ÓA€Nß;I”4˜Ó'×+Ñ+¨JÔ7Èt€LÜ˜,¨¨tÓ4€KØ*Ò6‰kŒm¸L€GÜ�g˜v tÓ,€GØ�9‰9Ð'Ó(€DÜ×Ò ×%Ò%¬j¸¼t×.DÒ.DÜ×!Ò! $Ó'‰Ü˜œd×#Ò#Ü&0°¼$×&?Ò&?ˆw�{‰{˜6Ô"ÀTˆà˜.¨DÐ0à�5—9‘9Ð<Ó=Ø  %§)¡)Ð,DÓ"EØ˜eŸi™iÐ(<Ó=Øœ˜UŸY™Y ~°{ÄcÇhÁhÑ7NÓOÓPØ”d˜5Ÿ9™9 \°7¼c¿h¹hÑ3FÓGÓHØ¯˜' !ž*°TØ�Øœj¨´$×7Ò7‘7¸Tðð ðð øñ ús+   ¡AK5 Á2K5 ÂAK5 ÃK5 Ã0K5 Ä K5 Ë5K8c               ó    € V ^8„  d   QhRRRR/# )r   Úrequestr=   r
   ztuple[int, dict]r   )r   s   "r   r   r   n   s   € ÷ !3ñ !3˜ð !3Ð!1ñ !3r   c                óÈ  € \        \        4      P                  4       P                  ^,          p\        P
                  P                  R4      p\        P                  P                  R4      pV'       d   \        V4      P                  R4      MRpVe@   VP                  4       p\        V\        \         34      '       d   V'       d   \        V4      pV P                  \        V4      V\        \        P                  4      R7       \        P
                  P                  4        UUu/ uF)  w  reVP!                  R4      '       d   K  VR8w  g   K'  WebK+  	  pppV'       d   W'R&   VP#                  R\        \        P$                  ! 4       4      4       \'        RR	R
7       \(        P*                  ! RR7      ;_uu_ 4       p\        V4      R,          p	\        V4      R,          p
V	P-                  \.        P0                  ! V 4      RR7       \3        \        P4                  RRRRR\        VR,          4      \        V	4      \        V
4      .	WVR7      pV
P7                  4       '       d'   \.        P8                  ! V
P;                  RR7      4      M/ p\        V\<        4      '       g   \?        R4      hV^ 8¼  d   TM^V3uuRRR4       # u uppi   + '       g   i     R# ; i)zCOne JSON exchange; the old process never imports the updated graph.ÚHERMES_HOMEÚhermes_constantsÚ_HERMES_HOME_OVERRIDEN)ÚrootÚhomerF   ÚVIRTUAL_ENVÚHERMES_UPDATE_HANDOFF_PIDzR-> Handing off to the new updater (package manager) for the rest of this update...T©Úflushzhermes-update-takeover-)Úprefixzrequest.jsonzresult.jsonzutf-8)Úencodingz-Iz-Sz-Bz-XÚutf8zhermes_cli/_update_takeover.py)ÚcwdÚenvz	utf-8-sigz'invalid update takeover acknowledgement)ÚPYTHONÚUV_) r   Ú__file__ÚresolveÚparentsÚosÚenvironr   r   r   r@   r<   ÚstrÚupdateÚlistrF   ÚitemsÚ
startswithÚ
setdefaultÚgetpidÚprintÚtempfileÚTemporaryDirectoryÚ
write_textÚjsonÚdumpsÚ_run_in_custodyÚ
executableÚis_fileÚloadsÚ	read_textr=   Ú
ValueError)rP   rU   rV   Ú	constantsÚoverrideÚvalueÚkeyr_   Ú	directoryÚcontextÚresultÚcodeÚ	completeds   &            r   Ú
_run_childrƒ   n   s&  € ä”‹>×!Ñ!Ó#×+Ñ+¨AÕ.€DÜ�:‰:�>‰>˜-Ó(€DÜ—‘—‘Ð 2Ó3€Iß?HŒt�I‹×"Ñ"Ð#:Ô;Èd€HØÒØ—‘“ˆÜ�eœc¤4˜[×)Ò)¯eÜ�u“:ˆDØ‡N�Nœ˜D›	¨´4¼¿¹³>€NÔBÜ(*¯
©
×(8Ñ(8Ô(:ô NÑ(:™*˜#Ø—.‘.Ð!2×3ô Ø8;¸}Ñ8Lô ˆ3Š:Ñ(:€Cñ NçØ!ˆMÑØ‡N�NÐ.´´B·I²I³KÓ0@ÔAô 
Ð
^ÐfjÕkÜ	×	$Ò	$Ð,E×	FÕ	FÈ)Ü�y“/ NÕ2ˆÜ�i“ =Õ0ˆØ×Ñœ4Ÿ:š: gÓ.¸ÐÔAÜÜ�^‰^˜T 4¨¨t°V¼SÀÐHhÕAhÓ=iÜ�‹\œ3˜v›;ð(Ø)-¸Sô
ˆð KQÏ.É.×JZÒJZ”D—J’J˜v×/Ñ/¸Ð/ÓEÔFÐ`bˆ	Ü˜)¤T×*Ò*ÜÐFÓGÐGØ˜q”y‰t a¨Ð2÷ 
GÒ	FùóN÷ 
G×	FÐ	Fús   Ä)K
Å	K
ÅK
ÇC>KËK!	c               ó$   € V ^8„  d   QhRRRRRR/# )r   rF   ri   rU   r   r
   Úintr   )r   s   "r   r   r   ’   s!   € ÷ ñ ˜$ð  dð ¸ñ r   c                ó   a€ \         P                  P                  R4      oV3R lR 4       w  r4\        P                  R8w  g   Ve   Ve   \        SRR4      f-   \        P                  ! V 3/ VB\        V4      B P                  # \        P                  ! V 3RSP                  /VB p V! V4      pVe   \        RV R2R	R
7       V! V4       VP                  4       #   \         d    TP                  4        h i ; i)aº  Run the takeover (it syncs and builds the checkout) in this updater's checkout custody,
from the update_lock module ALREADY loaded here (nothing new is imported). Windows: created
suspended, bound to this updater's kill-on-close job, then resumed; a refused bind still runs
(the update committed) and the takeover joins the lock holding its own lease. Releases
without these helpers hold no checkout lock, and the takeover acquires it itself.úhermes_cli.update_lockc              3  ó>   <"  € T F  p\        SVR 4      x € K  	  R # 5ir-   )rA   )r.   rI   Úlocks   & €r   r1   Ú"_run_in_custody.<locals>.<genexpr>™   s   øé € ÐrÑ:q°$”G˜D $¨×-Ð-Ó:qùs   ƒÚntNÚ_HELDÚcreationflagsz2  ! The update's job would not take the takeover (z;); it runs outside the job, holding its own checkout lease.TrY   )Úbind_child_to_update_treeÚresume_suspended_child)r   r   r   re   rI   rA   Ú
subprocessÚrunÚ_checkout_custodyÚ
returncodeÚPopenÚCREATE_SUSPENDEDrn   ÚwaitÚBaseExceptionÚkill)rF   rU   ÚkwargsÚbindÚresumeÚprocÚrefusalr‰   s   &&,    @r   rt   rt   ’   sð   ø€ ô �;‰;�?‰?Ð3Ó4€DÜrÑ:qÓr�L€DÜ	‡w�w�$„˜$š,¨&ª.¼GÀDÈ'ÐSWÓ<XÒ<`ô
 �~Š~˜dÑH fÐHÔ0AÀ$Ó0GÑH×SÑSÐSÜ×Ò˜DÑP°×0EÑ0EÐPÈÑP€DðÙ�t“*ˆØÒÜÐFÀwÀið P4ð 4Ø;?õAáˆtŒð �y‰y‹{ÐøÜô Ø�	‰	ŒØðús   Â+4C  Ã C=c               ó    € V ^8„  d   QhRRRR/# )r   rU   r   r
   r=   r   )r   s   "r   r   r   °   s   € ÷ 	,ñ 	,˜Dð 	, Tñ 	,r   c                óò   € \        \        P                  P                  R4      RR4      p Ve'   \        P
                  R8X  d   \        V! V 4      4      MRpV'       d   RV/# / #   \         d    Rp Li ; i)zýThe takeover child keeps the checkout lock this (old) updater holds: its fd, read from the
update_lock module ALREADY loaded in this process (nothing new is imported here). Releases
without a checkout lock hold none, and the takeover acquires it itself.r‡   Úcheckout_lock_fdsNÚposixÚpass_fdsr   )rA   r   r   r   re   rI   ÚtupleÚ	Exception)rU   ÚheldÚfdss   &  r   r’   r’   °   sr   € ô ”3—;‘;—?‘?Ð#;Ó<Ð>QÐSWÓX€DðØ#'Ò#3¼¿¹À7Ô8JŒe‘D˜“JÔÐPRˆ÷ !$ˆJ˜ÐÐ+¨Ð+øô ô ØŠðús   ¬,A& Á&A6Á5A6Ú
incompleteFc               ó    € V ^8„  d   QhRRRR/# )r   r§   r   r
   r   r   )r   s   "r   r   r   ¼   s   € ÷ %ñ % Tð %°hñ %r   c                óè  € V '       d]   \        \        P                  P                  R4      RR4      pVe	   V! R4       \	        R\        P
                  R7       \        ^4      h\        e   \        \        4      h^s \        4       w  r#p\        V4      w  spVP                  R4      '       d   V F  pRVR	&   K
  	  VP                  R
4      '       dL   \        VR4      '       d   VP                  R4       M'Ve$   R\        \        P                  R,          4      R&   \        \        4      h  \        \        \        3 d,   p^s\	        RT 2\        P
                  RR7        Rp?LKRp?ii ; i)zØFinish in a fresh child, then exit rather than resume an old fallback.

The historical name is retained. A finally/atexit path can call another
shim while unwinding; it must receive the same result, not start again.
r3   Úrecord_stop_reasonNÚold_version_handoffzjYou're updating from an older version of Hermes Agent. To complete this update, run `hermes update` again.)ÚfileÚresume_handledFÚresume_neededÚreceipt_handledÚsetr4   zUpdate takeover failed: T©r¬   rZ   )rA   r   r   r   rn   ÚstderrÚ
SystemExitr   rN   rƒ   Úhasattrr°   r@   ÚOSErrorry   Ú	TypeError)r§   ÚrecordrP   rH   rK   r‚   r0   Úexcs   $       r   Ústop_for_relaunchr¹   ¼   sE  € ÷ ô œŸ™Ÿ™Ð)DÓEÐG[Ð]aÓbˆØÒÙÐ(Ô)ÜðBä—‘õ	
ô
 ˜‹mÐäÒÜœÓ!Ð!Ø€GðMÜ)<Ó)>Ñ&ˆ˜,Ü'¨Ó0Ñˆ�Ø�=‰=Ð)×*Ò*Û �Ø).��oÓ&ñ !à�=‰=Ð*×+Ò+Ü�| U×+Ò+Ø× Ñ  Õ&ØÒ)ØMQ””S—[‘[Ð!<Õ=Ó>¸zÑJô ”WÓ
Ðøô ”Z¤Ð+ô MØˆÜÐ(¨¨Ð.´S·Z±ZÀt×LÒLûðMús%   Á?AD0 Ã#D0 Ã:'D0 Ä0E1Å!E,Å,E1c               ó    € V ^8„  d   QhRRRR/# )r   r0   r=   r
   ÚNoner   )r   s   "r   r   r   ä   s   € ÷ Qñ Q 4ð Q¨Dñ Qr   c                óŽ  € V P                  R4      '       g   R# ^p \        RV /4      w  rVP                  R4      RJ d   RV R&   T'       g   T P                  R4      '       d   \        R	\        P                  RR7       R# R#   \        \        \        3 d*   p\        RT 2\        P                  RR7        Rp?LyRp?ii ; i)
zEA historical atexit token is separate work, not another whole update.ÚpendingNÚstopped_servesÚserves_handledTFzStopped serve recovery failed: r±   z`Stopped serve recovery did not complete; restart the affected serve/dashboard backends manually.)r   rƒ   rµ   ry   r¶   rn   r   r²   )r0   r�   r‚   r¸   s   &   r   Úrelaunch_stopped_servesrÀ   ä   s²   € à�9‰9�Y×ÒÙØ€DðTÜ$Ð&6¸Ð%>Ó?‰ˆØ�=‰=Ð)Ó*¨dÓ2Ø$ˆE�)Ñ÷ ˆu�y‰y˜×#Ò#Üð 3Ü9<¿¹È4÷	Qñ $øô ”Z¤Ð+ô TÜÐ/°¨uÐ5¼C¿J¹JÈd×SÒSûðTús   �)B ÂCÂB?Â?C))zhermes_cli.update_cmdzhermes_cli.main)Ú_cmd_update_implÚ
cmd_update)Ú__conditional_annotations__Ú__doc__Ú
__future__r   rB   rr   re   Úpathlibr   r�   r   ro   Útypingr   r   r   Ú__annotations__r   r   r"   rN   rƒ   rt   r’   r¹   rÀ   )rÃ   s   @r   Ú<module>rÉ      so   øðôõ
 #ã Û Û 	Ý Û Û 
Û ß  ð €ˆÓ ðÐ õ/õõ(2õj!3õHõ<	,ð%¨E÷ %÷PQr   