+
    .pÐjÕ  ã                   óp   € R t ^ RIt^ RIHt  ! R R]4      tR R ltR R ltR	 R
 ltR R lt	R R lt
R# )zLDirectory initialization and storage diagnostics for the active Hermes home.N)ÚPathc                   ó   € ] tR t^tRtRtR# )ÚHomeInitializationErrorz?The home skeleton is unavailable, not an invalid YAML document.© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    Ú%/opt/hermes/hermes_cli/config_home.pyr   r      s   † ÝIr   r   c                óF   € V ^8„  d   QhR\         R\        \         ,          /# )é   ÚpathÚreturn)r   Úlist)Úformats   "r   Ú__annotate__r      s"   € ÷ Sñ Sœ4ð S¤D¬¥Jñ Sr   c                 óŒ   € . \        V P                  4      OV N Uu. uF  qP                  4       '       g   K  VNK  	  up# u upi )N)ÚreversedÚparentsÚ
is_symlink)r   Úparts   & r   Ú_directory_linksr      s8   € Ø<œx¨¯©Ó5Ð<°tÑ<ÓRÑ<�TÇÁ×@Q�DˆDÑ<ÑRÐRùÒRs
   œA¸Ac                óh   € V ^8„  d   QhR\         \        ,          R\        R\         \        ,          /# )r   ÚlinksÚhomer   )r   r   )r   s   "r   r   r      s.   € ÷ 	Lñ 	L¤¤d¥ð 	L´4ð 	L¼DÄ½Jñ 	Lr   c                ó`   € V  Uu. uF  q"V8X  g   WP                   9   g   K  VNK  	  up# u upi )aï  Keep only the links that make the operator the owner of the home's permissions.

That boundary is the home itself and anything under it. A link *above* the home
(macOS ``/tmp`` -> ``/private/tmp``, ``/var`` -> ``/private/var``, or any aliased parent
the user happens to live in) says nothing about who owns :data:`home`, and treating it as
an operator-owned link left a fresh home and its ``cron``/``sessions``/``logs``/``memories``
subdirectories at the default ``0o755`` instead of ``0o700``.
)r   )r   r   Úlinks   && r   Ú_operator_owned_linksr       s+   € ñ #ÓK™U�T¨d¤l°d¿l¹lÑ6J�DˆD™UÑKÐKùÒKs   …+¢+c          
      óL   € V ^8„  d   QhR\         R\        R\        R\         RR/# )r   r   ÚcreateÚsecurer   r   N)r   Úbool)r   s   "r   r   r      s0   € ÷ ñ œDð ¬Tð ¼4ð Ätð ÐPTñ r   c                ó  € ^ RI Hp Rp \        V 4      pRP                  R V 4       4      pV F'  pVP	                  4       '       d   K  \        RV 24      h	  V'       d   V P                  RRR7       M$V P	                  4       '       g   \        RV  24      hV'       d   \        Wc4      '       g   V! V 4       R# R# R#   \         d5   p\        R	T  R
T R2T'       d   RT R2MR,           R,           4      ThRp?ii ; i)é    )Ú_secure_dirÚ z; c              3   óJ   "  € T F  q R VP                  4        2x € K  	  R# 5i)z -> N)Úreadlink)Ú.0r   s   & r   Ú	<genexpr>Ú$_ensure_directory.<locals>.<genexpr>!   s    é € ÐLÁe¸d˜V 4¨¯©«Ð'8Õ9Ãeùs   ‚!#zDirectory link is unavailable: T)r   Úexist_okz#Required directory does not exist: z#Cannot initialize Hermes directory ú: z. zDirectory links: zÁCheck the directory/link target, mount availability and access permissions; restore the mount or repair the link before retrying. Hermes has not replaced the link or created its missing target.N)
Úhermes_cli.configr'   r   ÚjoinÚis_dirÚFileNotFoundErrorÚmkdirr    ÚOSErrorr   )	r   r"   r#   r   r'   Údetailr   r   Úexcs	   &$$$     r   Ú_ensure_directoryr8      sü   € Ý-à€FðÜ  Ó&ˆØ—‘ÑLÁeÓLÓLˆãˆDØ—;‘;—=”=Ü'Ð*IÈ$ÈÐ(PÓQÐQñ ÷ Ø�J‰J˜t¨dˆJÕ3Ø—‘—’Ü#Ð&IÈ$ÈÐ$PÓQÐQçÔ/°×<Ò<Ù˜Öñ =‰6øäô Ü%Ø1°$°°r¸#¸¸bÐAß17Ð" 6 (¨"Ñ-¸RõAðNõNó
ð ð	ûðús/   Š;C Á
C Á")C ÂC Â"C ÃD Ã/C;Ã;D c                óp   € V ^8„  d   QhR\         R\        \        R3,          R\        \        ,          RR/# )r   r   Úsubdirs.Úensuredr   N)r   ÚtupleÚstrÚset)r   s   "r   r   r   7   s5   € ÷ 5ñ 5œ$ð 5¬¬s°C¨x­ð 5Ä3ÄsÅ8ð 5ÐPTñ 5r   c                 ó‚  € ^ RI HpHp V! 4       pV'       d   \        P                  ! ^4      MRp \        W'       * V'       * V R7       V'       d   RMTpV F"  p\        W,          V'       * V'       * V R7       K$  	  V'       d   \        V R,          R,          RRV R7        V! V 4        Te   \        P                  ! T4       TP                  \        T 4      \        T P                  4       4      34       R#   \         d   p	\        RT  R	T	 R
24      T	hRp	?	ii ; i  Te   \        P                  ! T4       i i ; i)r&   )Ú_ensure_default_soul_mdÚ
is_managedN)r"   r#   r   ÚlogsÚcuratorTFzCannot initialize Hermes home r/   z4. Check storage availability and access permissions.)ÚcronÚsessionsrB   Úmemories)r0   r@   rA   ÚosÚumaskr8   r5   r   Úupdater=   Úresolve)
r   r:   r;   r@   rA   ÚmanagedÚ	old_umaskÚrequiredÚsubdirr7   s
   &&&       r   Úinitialize_homerO   7   s  € ßEá‹l€Gß#*”—’˜”°€Ið Ü˜$¤{¸w¼;ÈTÕRß?FÑ;ÈGˆÛˆFÜ˜d�m¸´KÈGÌÐZ^×_ñ çÜ˜d V�m¨iÕ7ÀÈUÐY]Õ^ð	Ù# DÕ)ð Ò Ü�HŠH�YÔð ‡N�N”C˜“Iœs 4§<¡<£>Ó2Ð3Ö4øô ô 	Ü)Ø0°°°b¸¸ð >Eð Eóð ðûð	ûð Ò Ü�HŠH�YÕð !ús0   ±AD! ÂD! Â#C; Ã;DÄDÄDÄD! Ä!D>c                ó$   € V ^8„  d   QhR\         /# )r   r7   )Ú	Exception)r   s   "r   r   r   R   s   € ÷ mñ mœ9ñ mr   c                 ót   € ^ RI Hp \        V \        \        34      '       d   V! RRV  2R4      # V! RRR4      # )r&   )ÚConfigIssueÚerrorzHermes storage is unavailable: zXCheck the reported path, link target, mount and permissions; keep config.yaml unchanged.zCould not load config.yamlz+Run 'hermes setup' to create a valid config)r0   rS   Ú
isinstancer   r5   )r7   rS   s   & r   Úconfig_load_issuerV   R   sH   € Ý-ä�#Ô/´Ð9×:Ò:ÙØÐ6°s°eÐ<Øfó
ð 	
ñ �wÐ <Ð>kÓlÐlr   )r
   rG   Úpathlibr   ÚRuntimeErrorr   r   r    r8   rO   rV   r   r   r   Ú<module>rY      s8   ðÙ Rã 	Ý ôJ˜lô JõSõ	Lõõ85÷6mr   