+
    kHàjï  ã                  ó  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
Ht ]P                  ! ]4      t]	! ]4      P                   R,          tRtRsR]R&   RtR]R&   R	tR
 R lt]tR R ltRR R lltR R ltR R ltR# )uˆ  Resolve where the Photon sidecar runs from and where its Node deps live.

Hosted images keep the plugin tree read-only (EROFS), so, mirroring
``resolve_whatsapp_bridge_dir``: (1) ``PHOTON_SIDECAR_DIR`` override as-is; (2) writable
source dir â†’ run in place; (3) read-only with baked, current ``node_modules`` â†’ in place;
(4) read-only and deps missing/stale â†’ mirror the source files to
``$HERMES_HOME/photon/sidecar``. The mirror is refreshed by content compare; ``node_modules``
is left alone so the lockfile-vs-install-marker check triggers ``npm ci`` inside the mirror.
Resolution never happens at import time (it probes/copies on disk).
)ÚannotationsN)ÚPath)ÚOptionalÚsidecarúOptional[Path]Ú_SIDECAR_DIRÚ_NPM_ERROR_LOGi,  c               ó    € V ^8„  d   QhRRRR/# )é   Úpathr   ÚreturnÚbool© )Úformats   "ÚK/home/ubuntu/.hermes/hermes-agent/plugins/platforms/photon/sidecar_paths.pyÚ__annotate__r   "   s   € ÷ 	ñ 	�tð 	 ñ 	ó    c                ó~   € V R,          p VP                  4        VP                  4        R#   \         d     R# i ; i)uq   True when we can create files in ``path`` (probe, not stat â€” stat lies on root-squash
/ read-only bind mounts).z.hermes-write-probeFT)ÚtouchÚunlinkÚOSError)r   Úprobes   & r   Údir_writabler   "   s?   € ð Ð(Õ(€EðØ�‰ŒØ�‰Œñ øô ô Úðús   ‹ - ­<»<c               ó    € V ^8„  d   QhRRRR/# )r
   Úsidecar_dirr   r   r   r   )r   s   "r   r   r   1   s   € ÷ 	ñ 	¨$ð 	°4ñ 	r   c                óÄ   € V R,          pV R,          R,          p VP                  4       P                  VP                  4       P                  8„  #   \         d     R# i ; i)uÍ   True when the committed lockfile postdates npm's install marker
(``node_modules/.package-lock.json``) â€” the same signal ``npm ci`` uses. False on any
stat failure so an odd filesystem never blocks start.úpackage-lock.jsonÚnode_modulesz.package-lock.jsonF)ÚstatÚst_mtimer   )r   ÚlockfileÚmarkers   &  r   Ú_lock_newer_than_installr"   1   sY   € ð Ð0Õ0€HØ˜>Õ)Ð,@Õ@€FðØ�}‰}‹×'Ñ'¨&¯+©+«-×*@Ñ*@Ñ@Ð@øÜô Úðús   ›4A ÁAÁAc               ó    € V ^8„  d   QhRRRR/# )r
   Ú
source_dirr   r   r   r   )r   s   "r   r   r   =   s   € ÷ ñ  Nð ¸dñ r   c                ó  € V e   \        V 4      M\        p\        P                  ! R4      pV'       d   \        V4      # \	        V4      '       d   V# VR,          P                  4       '       d   \        V4      '       g   V# ^ RIHp V! 4       R,          R,          p VP                  RRR7       \         Fœ  pW,          WE,          rvVP                  4       '       g   K*  VP                  4       '       d4   \        P                  ! \        V4      \        V4      R	R
7      '       d   Ks  \        P                  ! \        V4      \        V4      4       Kž  	  V#   \          d#   p\"        P%                  RYH4       Tu Rp?# Rp?ii ; i)zBReturn the directory the sidecar should run from (see module doc).NÚPHOTON_SIDECAR_DIRr   )Úget_hermes_homeÚphotonr   T)ÚparentsÚexist_okF)Úshallowu¥   [photon] install tree is read-only and mirroring the sidecar to %s failed (%s) â€” falling back to the read-only source dir; dependency installs will not be possible)r   ÚSOURCE_SIDECAR_DIRÚosÚgetenvÚ_dir_writableÚexistsr"   Úhermes_constantsr'   ÚmkdirÚ_MIRROR_FILESÚfilecmpÚcmpÚstrÚshutilÚcopy2r   ÚloggerÚwarning)	r$   ÚsourceÚoverrider'   ÚmirrorÚnameÚsrcÚdstÚexcs	   &        r   Úresolve_sidecar_dirrB   =   s  € à!+Ò!7ŒT�*ÔÔ=O€FÜ�yŠyÐ-Ó.€HßÜ�H‹~ÐÜ�V×ÒØˆà�Õ×'Ñ'×)Ò)Ô2JÈ6×2RÒ2RØˆÝ0ÙÓ Õ)¨IÕ5€FðØ�‰˜T¨DˆÔ1ß!ˆDØ•} f¥m�Ø�z‰z�|Œ| S§Z¡Z§\¢\¼¿ºÄSÈÃXÌsÐSVËxÐaf×9gÕ9gÜ—’œS ›X¤s¨3£xÖ0ñ "ð ˆøÜô Ü�‰ð7ð ô		ð
 �ûðús0   Â>E Ã!E Ã7.E Ä*.E ÅFÅ$FÅ;FÆFc               ó   € V ^8„  d   QhRR/# ©r
   r   r   r   )r   s   "r   r   r   Z   s   € ÷ ñ �dñ r   c                 ó2   € \         f   \        4       s \         # )zBSidecar runtime dir, resolved once on first use (never at import).)r   rB   r   r   r   Ú_sidecar_dirrF   Z   s   € ô ÒÜ*Ó,ˆÜÐr   c               ó   € V ^8„  d   QhRR/# rD   r   )r   s   "r   r   r   b   s   € ÷ fñ f˜ñ fr   c                 ó@   € \         e   \         # \        4       R,          # )zEPath of the persisted npm-failure log (derived from the sidecar dir).z.photon-npm-error.log)r   rF   r   r   r   Ú_npm_error_logrI   b   s   € ä+Ò7Œ>Ðe¼\»^ÐNeÕ=eÐer   )z	index.mjszpackage.jsonr   z$patch-spectrum-mixed-attachments.mjs)N)Ú__conditional_annotations__Ú__doc__Ú
__future__r   r4   Úloggingr-   r7   Úpathlibr   Útypingr   Ú	getLoggerÚ__name__r9   Ú__file__Úparentr,   r3   r   Ú__annotations__r   Ú_NPM_ERROR_LOG_MAX_CHARSr   r/   r"   rB   rF   rI   )rJ   s   @r   Ú<module>rV      sŒ   øðô	õ #ã Û Û 	Û Ý Ý à	×	Ò	˜8Ó	$€á˜(“^×*Ñ*¨YÕ6Ð ð k€à#€ˆnÓ #ð "&€�Ó %ØÐ õ	ð €õ	÷õ:÷fr   