+
    jHàjT"  ã                  ó  € R t ^ RIHt ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
Ht ]P                  ! ]4      t^t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 lt ! R R4      tR R ltR R ltR# )a°  Bounded home maintenance after an installed revision changes.

A per-install, per-profile record and lock remain because config migrations
must not retry a broken migration on every launch, and the full SQLite
integrity guard is too expensive to run every time. Steps still own their
idempotence and rollback; failure is recorded until the next revision (or
an explicit post-update run). PM owns runtime diagnosis, not this record.
)Úannotations)Úinstall_state_dirN)ÚPathiX  c               ó    € V ^8„  d   QhRRRR/# )é   Úrootr   Úreturnú
str | None© )Úformats   "Ú>/home/ubuntu/.hermes/hermes-agent/hermes_cli/boot_bootstrap.pyÚ__annotate__r      s   € ÷ *ñ *˜ð * ñ *ó    c           
     ó@  € \        4       pVf   R#  \        P                  ! VR\        V 4      RR.RRRR^
RR	7      pTP                  ^ 8w  d   R# TP                  P                  4       p\        T4      ^8¼  d   T# R#   \        \        P
                  3 d     R# i ; i)
uù  The commit SHA of the checkout at ``root``.

Asks git, rather than reimplementing it: parsing ``.git`` by hand
(worktree gitfiles, symbolic HEAD, packed-refs, commondir) is a
reimplementation of ``git rev-parse HEAD`` that reftable breaks
wholesale. The managed git comes first, a PATH git second; with
neither, the answer is None and boot carries on â€” fail-open.

Cost: one ~10ms subprocess. Only checkouts pay it â€” a sealed tree
reads its stamp and never gets here â€” and it happens once per boot.
Nz-Cz	rev-parseÚHEADTúutf-8ÚreplaceF)Úcapture_outputÚtextÚencodingÚerrorsÚtimeoutÚcheck)
Ú_git_binaryÚ
subprocessÚrunÚstrÚOSErrorÚSubprocessErrorÚ
returncodeÚstdoutÚstripÚlen)r   ÚgitÚoutÚshas   &   r   Úread_git_headr&      sŸ   € ô ‹-€CØ
‚{Ùð	Ü�nŠnØ�$œ˜D›	 ;°Ð7ØØ °	ØØô
ˆð ‡~�~˜ÔÙØ
�*‰*×
Ñ
Ó
€CÜ�c“(˜a”-ˆ3Ð) TÐ)øô ”Z×/Ñ/Ð0ô Úðús   ’+A> Á>BÂBc               ó   € V ^8„  d   QhRR/# )r   r   r	   r
   )r   s   "r   r   r   =   s   € ÷ ñ �Zñ r   c                 óô   €  ^ RI Hp  V ! R4      pVe$   VP                  e   \        VP                  4      # ^ RIpTP                  R4      #   \         d!   p\
        P                  RT4        Rp?L;Rp?ii ; i)u�  The git to run, or None when this machine has no usable one.

pm's pinned git first (the win32 Git-for-Windows package â€” where it
is installed, it is the one whose bash contract the rest of the tree
already trusts), then a PATH git. The imports are local: this module
is loaded early enough that a module-level import would widen the
boot import graph for a lookup most platforms answer from PATH.
)Úinstalled_packager#   Nzpm git lookup failed: %s)	Úpmr)   Úbinaryr   Ú	ExceptionÚloggerÚdebugÚshutilÚwhich)r)   Ú	installedÚexcr/   s       r   r   r   =   sn   € ð6Ý(á% eÓ,ˆ	ØÒ  Y×%5Ñ%5Ò%AÜ�y×'Ñ'Ó(Ð(ó à�<‰<˜ÓÐøô	 ô 6Ü�‰Ð/°×5Ñ5ûð6ús   ‚4A ÁA7ÁA2Á2A7c               ó    € V ^8„  d   QhRRRR/# ©r   Úproject_rootr   r   r	   r
   )r   s   "r   r   r   S   s   € ÷ 9ñ 9¨4ð 9°Jñ 9r   c                ó\  € ^ RI Hp \        V 4      pVR,          P                  4       '       d   \	        V4      # V! V4      pVP                  R4      p\        V\        4      '       d   \        V4      ^8¼  d   V# VP                  R4      p\        V\        4      '       d   V'       d   V# R# )z‡What code this install is: stamp commit for sealed trees, git HEAD
for checkouts, None for broken trees (never bootstrap, never write).)Úread_install_stampz.gitÚcommitÚtagN)	Úhermes_cli.stewardr7   r   Úexistsr&   ÚgetÚ
isinstancer   r"   )r5   r7   r   Ústampr8   r9   s   &     r   Úcurrent_install_identityr?   S   s�   € õ 6ä�Ó€DØˆv�×Ñ×ÒÜ˜TÓ"Ð"Ù˜tÓ$€EØ�Y‰Y�xÓ €FÜ�&œ#×Ò¤3 v£;°!Ô#3Øˆð �)‰)�EÓ
€CÜ˜S¤#×&Ò&¯3ˆ3Ð8°DÐ8r   c               ó    € V ^8„  d   QhRRRR/# )r   r5   r   r   r
   )r   s   "r   r   r   i   s   € ÷ Jñ J˜dð J tñ Jr   c                óh   € ^ RI Hp V! 4       ;'       g    Rp\        V 4      R,          V R2,          # )zFEach profile completes its own home maintenance for this installation.)Úget_active_profile_nameÚdefaultÚ	bootstrapz.json)Úhermes_cli.profilesrB   r   )r5   rB   Únames   &  r   Úrecord_pathrG   i   s0   € å;á"Ó$×1Ð1¨	€DÜ˜\Ó*¨[Õ8¸d¸VÀ5¸>ÕIÐIr   c               ó    € V ^8„  d   QhRRRR/# )r   Úpathr   r   Údictr
   )r   s   "r   r   r   q   s   € ÷ 2ñ 2˜$ð 2 4ñ 2r   c                óÈ   €  \         P                  ! \        V 4      P                  R R7      4      p\        T\        4      '       d   T# / #   \        \
        3 d    / u # i ; i)ú	utf-8-sig©r   )ÚjsonÚloadsr   Ú	read_textr   Ú
ValueErrorr=   rJ   )rI   Údatas   & r   Úread_last_knownrS   q   s[   € ðÜ�zŠzœ$˜t›*×.Ñ.¸Ð.ÓDÓEˆô ˜d¤D×)Ò)ˆ4Ð1¨rÐ1øô ”ZÐ ô ØŠ	ðús   ‚/A ÁA!Á A!c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   rI   r   Úidentityr   ÚresultsrJ   r   ÚNoner
   )r   s   "r   r   r   y   s(   € ÷ 
ñ 
˜ð 
¨ð 
°dð 
¸tñ 
r   c                óT  € R \         RVR\        P                  ! R4      RV/pV P                  P	                  RRR7       V P                  V P                  R,           4      pVP                  \        P                  ! V^R7      R	,           R
R7       \        P                  ! W@4       R# )ÚschemaVersionrU   ÚbootstrappedAtz%Y-%m-%dT%H:%M:%S%zrV   T©ÚparentsÚexist_okz.tmp)ÚindentÚ
r   rM   N)ÚRECORD_SCHEMA_VERSIONÚtimeÚstrftimeÚparentÚmkdirÚ	with_namerF   Ú
write_textrN   ÚdumpsÚosr   )rI   rU   rV   ÚpayloadÚtmps   &&&  r   Ú_write_recordrk   y   s„   € àÔ.Ø�HØœ$Ÿ-š-Ð(=Ó>Ø�7ð	€Gð 	‡K�K×Ñ˜d¨TÐÔ2Ø
�.‰.˜Ÿ™ VÕ+Ó
,€CØ‡N�N”4—:’:˜g¨aÔ0°4Õ7À'€NÔJÜ‡J‚JˆsÖr   c               ó    € V ^8„  d   QhRRRR/# r4   r
   )r   s   "r   r   r   †   s   € ÷ 	ñ 	 $ð 	¨:ñ 	r   c                óˆ   € \        V 4      pV'       g   R# \        \        V 4      4      pVP                  R4      V8X  d   R# V# )z}The new identity when this install changed since its last bootstrap,
else None. None identity (broken tree) never bootstraps.NrU   )r?   rS   rG   r<   )r5   rU   Úknowns   &  r   Úneeds_bootstrapro   †   s<   € ô (¨Ó5€HßÙÜœK¨Ó5Ó6€EØ‡y�y�Ó Ô(ÙØ€Or   c                  óV   € ] tR t^–tRtR R ltR R ltR R ltR R	 ltR
 R lt	Rt
R# )Ú_RecordLockua  O_CREAT|O_EXCL existence-as-mutex next to a record file.

Losers skip (boot never waits on another process's bootstrap; the steps
are idempotent, so a botched winner only costs redundant work later).
A stale lock â€” older than LOCK_STALE_SECONDS â€” is broken and re-tried
once: a crashed winner died before its record write, so re-running is
correct.
c               ó   € V ^8„  d   QhRR/# )r   Úrecordr   r
   )r   s   "r   r   Ú_RecordLock.__annotate__    s   € ÷ ñ ˜tñ r   c                	ób   € VP                  VP                  R ,           4      V n        RV n        R# )z.lockFN)re   rF   rI   Úacquired)Úselfrs   s   &&r   Ú__init__Ú_RecordLock.__init__    s$   € Ø×$Ñ$ V§[¡[°7Õ%:Ó;ˆŒ	ØˆŽr   c               ó   € V ^8„  d   QhRR/# ©r   r   Úboolr
   )r   s   "r   r   rt   ¤   s   € ÷ ñ ˜Tñ r   c           
     	ór  €  V P                   P                  P                  R R R7       \        P                  ! V P                   \        P
                  \        P                  ,          \        P                  ,          4      p \        P                  ! T\        P                  ! R\        P                  ! 4       R\        P                  ! 4       /4      P                  R4      4       \        P                   ! T4       R #   \         d     R# \         d     R# i ; i  \        P                   ! T4       i ; i)Tr[   FÚpidÚ	startedAtr   )rI   rc   rd   rh   ÚopenÚO_CREATÚO_EXCLÚO_WRONLYÚFileExistsErrorr   ÚwriterN   rg   Úgetpidra   ÚencodeÚclose)rw   Úfds   & r   Ú_try_createÚ_RecordLock._try_create¤   sÆ   € ð	Ø�I‰I×Ñ×"Ñ"¨4¸$Ð"Ô?Ü—’˜Ÿ™¤B§J¡J´·±Õ$:¼R¿[¹[Õ$HÓIˆBð
	Ü�HŠH�RœŸš U¬B¯IªI«K¸ÄdÇiÂiÃkÐ$RÓS×ZÑZÐ[bÓcÔdä�HŠH�RŒLÙøô ô 	ÚÜô 	Úð	ûô
 �HŠH�R�Lús+   ‚B C? ÂA$D Ã?DÄDÄDÄDÄD6c               ó   € V ^8„  d   QhRR/# r{   r
   )r   s   "r   r   rt   ²   s   € ÷ 
<ñ 
<˜4ñ 
<r   c                	ó~  €  \         P                  ! V P                  P                  R R7      4      p\	        VP                  R^ 4      4      p\        P                  ! 4       T,
          \        8„  #   \        \        3 d<     T P                  P                  4       P                  p L[  \         d      R# i ; ii ; i)rL   rM   r   F)rN   rO   rI   rP   Úfloatr<   r   rQ   ÚstatÚst_mtimera   ÚLOCK_STALE_SECONDS)rw   ÚbodyÚstarteds   &  r   Ú	_is_staleÚ_RecordLock._is_stale²   s˜   € ð	Ü—:’:˜dŸi™i×1Ñ1¸;Ð1ÓGÓHˆDÜ˜DŸH™H [°!Ó4Ó5ˆGô —	’	“˜gÕ%Ô);Ñ;Ð;øô œÐ$ô 	ðØŸ)™)Ÿ.™.Ó*×3Ñ3’øÜô Ûðúð		ús*   ‚AA0 Á0B<Â$B(Â(B8Â3B<Â7B8Â8B<c               ó   € V ^8„  d   QhRR/# r{   r
   )r   s   "r   r   rt   ¾   s   € ÷ ñ ˜ñ r   c                	ó  € V P                  4       '       d
   R V n        R # V P                  4       '       d;    V P                  P	                  4        T P                  4       '       d
   R T n        R # R#   \
         d     R# i ; i)TF)rŠ   rv   r”   rI   Úunlinkr   ©rw   s   &r   ÚacquireÚ_RecordLock.acquire¾   so   € Ø×Ñ×ÒØ ˆDŒMÙØ�>‰>×ÒðØ—	‘	× Ñ Ô"ð ×Ñ×!Ò!Ø $�”ÙÙøô ô Úðús   ·A2 Á2BÂ Bc               ó   € V ^8„  d   QhRR/# )r   r   rW   r
   )r   s   "r   r   rt   Ì   s   € ÷ ñ ˜ñ r   c                	ó”   € V P                   '       g   R #  V P                  P                  4        RV n         R #   \         d     Li ; i)NF)rv   rI   r˜   r   r™   s   &r   ÚreleaseÚ_RecordLock.releaseÌ   s@   € Ø�}�}ˆ}Ùð	Ø�I‰I×ÑÔð ˆŽøô ô 	Ùð	ús   –9 ¹AÁA)rv   rI   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rx   rŠ   r”   rš   rž   Ú__static_attributes__r
   r   r   rq   rq   –   s%   † ñõõõ
<õ÷ñ r   rq   c               ó    € V ^8„  d   QhRRRR/# )r   r5   r   r   rJ   r
   )r   s   "r   r   r   Ú   s   € ÷ ñ  Tð ¨dñ r   c                óÞ  € ^ RI Hp \        V 4      pV'       g   RR/# \        V 4      p\	        V4      pVP                  4       '       g   RR/#  \        V4      P                  R4      V8X  d   RR/VP                  4        # \        P                  RVR,          4       VP                  VP                  4      p\        W2V4       RV/VP                  4        #   TP                  4        i ; i)	z=Bound home maintenance to one attempt per installed revision.)Úpost_updateÚhomeÚskippedz	lost-racerU   zdone-by-otherz3home maintenance: code changed to %s, running steps:Né   N)Ú
hermes_clir¨   ro   rG   rq   rš   rS   r<   rž   r-   ÚinfoÚ	run_stepsÚBOOT_HOME_STEPSrk   )r5   r¨   rU   rs   ÚlockrV   s   &     r   Úrun_boot_bootstrapr±   Ú   sÈ   € å&ä˜|Ó,€HßØ˜	Ð"Ð"Ü˜Ó&€FÜ�vÓ€DØ�<‰<�>Š>Ø˜Ð$Ð$ð	ä˜6Ó"×&Ñ& zÓ2°hÔ>Ø˜OÐ,ð 	�‰�ô 	�‰ÐIÈ8ÐTWÍ=ÔYØ×'Ñ'¨×(CÑ(CÓDˆÜ�f¨Ô0Ø˜Ð à�‰�øˆ�‰�ús   Á"C ÂAC ÃC,c               ó    € V ^8„  d   QhRRRR/# )r   r5   r   r   rW   r
   )r   s   "r   r   r   ñ   s   € ÷ Kñ K¨4ð K°Dñ Kr   c                óŽ   €  \        \        V 4      4       R#   \         d"   p\        P	                  RT4        Rp?R# Rp?ii ; i)zqThe one call boot paths use. Never raises: a bootstrap problem must
not stop the gateway/serve/CLI from starting.z+boot bootstrap failed (continuing boot): %sN)r±   r   r,   r-   Úwarning)r5   r2   s   & r   Úmaybe_run_boot_bootstraprµ   ñ   s9   € ðKÜœ4 Ó-Ö.øÜô KÜ�‰ÐDÀc×JÒJûðKús   ‚ ˜A£?¿A)r¤   Ú
__future__r   Úpm.environmentsr   rN   Úloggingrh   r   ra   Úpathlibr   Ú	getLoggerr    r-   r`   r‘   r&   r   r?   rG   rS   rk   ro   rq   r±   rµ   r
   r   r   Ú<module>r»      sz   ðñõ #å -Û Û Û 	Û Û Ý à	×	Ò	˜8Ó	$€àÐ ØÐ õ*õ>õ,9õ,Jõ2õ
õ	÷ =ñ =õH÷.Kr   