+
    jHàj¯  ã                  ó‚   € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ]P                  ! ]	4      t
R R ltR R ltR R	 ltR# )
a»  Cron: import path of the restart-safe external worker.

The worker is spawned as ``sys.executable -m cron.scheduler``. Its entry module is
``cron.scheduler``, not ``hermes_cli.main``, so nothing bootstraps the gateway's checkout
onto its ``sys.path``; historically it imported ``cron`` only through the implicit ``-m``
cwd entry. That entry is gone under ``PYTHONSAFEPATH`` and useless when the venv's
editable install maps a moved/deleted checkout -- the worker then dies with
"No module named 'cron'" before its ownership ack (#112729, hypothesised cause).

The shared subprocess sanitizer strips Hermes-owned PYTHONPATH entries because user
children must not see our tree. This child IS Hermes, so the pin is applied *after* the
env is built, on the sanitized env. On a self-managed (shell-installer / PM) install the
sanitizer's drop of the runtime site-packages cannot stand this time: the worker inherits
this process's interpreter, which is PM's store Python and owns no third-party
dependencies, so the committed generation's site-packages is restored here too or the
child dies at its first dependency import (``No module named 'ruamel'``, #122222) before
it can publish its ownership acknowledgement.
)ÚannotationsN)ÚPathc               ó   € V ^8„  d   QhRR/# )é   ÚreturnúPath | None© )Úformats   "Ú>/home/ubuntu/.hermes/hermes-agent/cron/scheduler_worker_env.pyÚ__annotate__r      s   € ÷ ñ ˜Kñ ó    c                 óš   €  \        \        P                  ! 4       R ,          4      P                  4       #   \        \
        3 d     R# i ; i)ÚpurelibN)r   Ú	sysconfigÚ	get_pathsÚresolveÚKeyErrorÚOSErrorr   r   r
   Ú_installed_purelibr      s@   € ðÜ”I×'Ò'Ó)¨)Õ4Ó5×=Ñ=Ó?Ð?øÜ”gÐô Úðús   ‚25 µA
Á	A
c               ó    € V ^8„  d   QhRRRR/# )r   Úproject_rootr   r   r   r   )r	   s   "r
   r   r   %   s   € ÷ 3ñ 3°dð 3¸{ñ 3r   c                óÒ   €  ^ RI HpHp V! V 4      pTf   R# T! T4      pTP                  4       '       d   T# R#   \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i)a
  The dependency ``site-packages`` PM committed for this install, or ``None``.

Asked of PM's own committed selection -- the record ``activate_dependencies`` resolves
at process boot -- rather than re-derived from this process's ``sys.path``: the record
belongs to this install (``install_state_dir``, shared by every profile it serves). A
runner that owns its dependencies (wheel / pipx / developer venv / Nix: no committed
generation) has nothing to restore, so ``None`` means "pin the tree only" and nothing
is invented.
)Úcommitted_venvÚsite_packageszDcron worker: could not read the committed dependency environment: %sN)Úpm.environmentsr   r   Ú	ExceptionÚloggerÚwarningÚis_dir)r   r   r   ÚenvironmentÚexcÚselecteds   &     r
   Ú#_committed_dependency_site_packagesr"   %   sk   € ð
ßAá$ \Ó2ˆð ÒÙÙ˜[Ó)€HØ—‘×(Ò(ˆ8Ð2¨dÐ2øô ô ô 	�‰ØRÐTWô	
õ ûðús   ‚: ºA&ÁA!Á!A&c               ó$   € V ^8„  d   QhRRRRRR/# )r   Ú
worker_envÚdictÚ	repo_rootr   r   r   )r	   s   "r
   r   r   @   s!   € ÷ ñ ¨dð ¸tð Èñ r   c                óÈ  € \        V4      p\        4       \        V4      P                  4       8X  d   V # V P	                  RR4      P                  \        P                  4       Uu. uF  q3'       g   K  VNK  	  pp\        \        V4      4      pV.Ve   \        V4      .M. Op\        P                  P                  \        P                  . VOVO4      4      V R&   V # u upi )a¾  Prepend ``repo_root`` -- and, when this runner has one, the committed dependency
generation's ``site-packages`` -- to the worker env's own PYTHONPATH (never
``os.environ``'s).

Skipped when ``repo_root`` is the interpreter's ``purelib``: under a wheel / pipx /
uv-tool install ``cron/`` lives in site-packages itself, which is already importable,
and pinning it would move site-packages ahead of the stdlib on ``sys.path``.

Order (checkout, generation, sanitizer-kept) mirrors ``activate_dependencies``' own
``sys.path``. For the cron worker, its boot (``cron/worker_bootstrap.py``) then re-selects
and leases the committed generation before any third-party import, and exits the worker
if it cannot.
Ú
PYTHONPATHÚ )Ústrr   r   r   ÚgetÚsplitÚosÚpathsepr"   Újoinr%   Úfromkeys)r$   r&   ÚrootÚeÚexistingÚ
dependencyÚpinneds   &&     r
   Úpin_hermes_tree_on_pythonpathr6   @   sÀ   € ô ˆy‹>€DÜÓœt D›z×1Ñ1Ó3Ô3ØÐØ%Ÿ>™>¨,¸Ó;×AÑAÄ"Ç*Á*ÔMÓSÑM�aÓQR—�ÑM€HÐSÜ4´T¸$³ZÓ@€JØÐK¨:Ò+A”s˜:“Ñ'ÀrÐK€FÜ!Ÿz™zŸ™¬t¯}©}Ð=Q¸vÐ=QÈÐ=QÓ/RÓS€Jˆ|ÑØÐùò	 Ts   Á%	CÁ3C)Ú__doc__Ú
__future__r   Úloggingr-   r   Úpathlibr   Ú	getLoggerÚ__name__r   r   r"   r6   r   r   r
   Ú<module>r=      s:   ðñõ& #ã Û 	Û Ý à	×	Ò	˜8Ó	$€õõ3÷6r   