+
    .pÐj­ª  ã                  ó   a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIHt ^ RIt^ RIHtHtHt ]P$                  ! ]4      tRVt]! 4       tR]R&   ]! 4       tR]R&   ]! 4       tR]R&   / tR	]R
&   ]! 4       tR]R&   ]! 4       tR]R&   ]! 4       tR]R&   / tR]R&   / t R]R&   / t!R]R&   ]! 4       t"R]R&   ]
PF                  ! 4       t$/ t%R]R&   ]PL                  ! 4       t']
PF                  ! 4       t(])! R04      t*R]R&   ])! 0 RWm4      t+R]R&   R R lt,R R lt-R R lt.R  R! lt/R" R# lt0R$ R% lt1R& R' lt2R( R) lt3R* R+ lt4R, R- lt5R. R/ lt6RXR0 R1 llt7R2 R3 lt8RYR4 R5 llt9R6 R7 lt:R8RR9R:/R; R< llt;R= R> lt<R?RR@RRARB/RC RD llt=RE RF lt>R8R/RG RH llt?RI RJ lt@RK RL ltARM RN ltBROR/RP RQ lltCRR RS ltDRT RU ltER# )ZzFHelpers for loading Hermes .env files consistently across entrypoints.)ÚannotationsN)ÚPath)Úatomic_replaceÚload_yaml_file_readonlyÚmkstemp_besideúset[str]Ú_WARNED_KEYSÚ_WARNED_UTF32_PATHSÚ_SCOPED_SKIP_LOGGEDúdict[str, str]Ú_SECRET_SOURCESÚ_SOURCE_SUPPLIED_NAMESÚ_LOADED_DOTENV_KEYSÚ_MANAGED_DOTENV_KEYSzdict[str, dict[str, str]]Ú_SECRET_SOURCE_VALUES_BY_HOMEÚ_SECRET_SOURCE_RESTORE_BY_HOMEz1dict[str, dict[str, tuple[str, str, str | None]]]Ú_SECRET_SOURCE_WRITES_BY_HOMEÚ_APPLIED_HOMESz&dict[str, tuple[str | None, str, int]]Ú_DOTENV_PUBLISHEDÚHERMES_DASHBOARD_SESSION_TOKENúfrozenset[str]Ú_SPAWN_CREDENTIAL_KEYSÚ_PROFILE_MANAGED_ENV_KEYSc               ó    € V ^8„  d   QhRRRR/# )é   Úpathr   Úreturnr   © )Úformats   "Ú$/opt/hermes/hermes_cli/env_loader.pyÚ__annotate__r    `   s   € ÷ $ñ $ dð $¨xñ $ó    c                ó0   € ^ RI Hp \        V! V 4      4      # )uÏ   KEY names assigned in a dotenv file (including empty ``KEY=``), via the same tokenizer that installs
profile scopes â€” a key the installer sees is a key the dashboard scrub sees (BOM'd first line included).©Úload_env_file)Úagent.secret_scoper$   Úset)r   r$   s   & r   Ú_env_keys_defined_in_dotenvr'   `   s   € õ 1ä‰}˜TÓ"Ó#Ð#r!   c               ó    € V ^8„  d   QhRRRR/# ©r   r   r   r   ÚNoner   )r   s   "r   r    r    h   s   € ÷  ñ  °ð  ¸ñ  r!   c                óÆ   € V P                  4       '       g   R# \        V 4      p\         F3  pW!9  g   K  V\        P                  9   g   K"  \        P                  V K5  	  R# )a0  After ``.env`` loaded with override, delete inherited ``_PROFILE_MANAGED_ENV_KEYS`` it does not
define. Deliberately NARROW: only keys that change *which provider path* is used.

Does **not** run when the ``.env`` file does not exist (bare-profile case, which follows ``#66930`` /
``#67027`` semantics).
N)Úexistsr'   r   ÚosÚenviron)r   ÚdefinedÚkeys   &  r   Ú%_clear_known_keys_missing_from_dotenvr1   h   sB   € ð �;‰;�=Š=ÙÜ)¨$Ó/€Gß(ˆØÖ #¬¯©Ö"3Ü—
‘
˜3’ó )r!   c               ó    € V ^8„  d   QhRRRR/# )r   Úenv_varÚstrr   ú
str | Noner   )r   s   "r   r    r    w   s   € ÷ (ñ (˜sð ( zñ (r!   c                ó,   € \         P                  V 4      # )u—   Source label that supplied ``env_var`` (``"bitwarden"`` â€¦), None for .env/shell keys. Metadata only â€”
never authorization to persist the raw value.)r   Úget)r3   s   &r   Úget_secret_sourcer8   w   s   € ô ×Ñ˜wÓ'Ð'r!   c               ó   € V ^8„  d   QhRR/# )r   r   r   r   )r   s   "r   r    r    }   s   € ÷ ñ  hñ r!   c                ó¶   € \        V P                  4      pV P                   F  pVP                  VP                  4       K   	  \
        P                  V4       V# )u¿   Every name *report*'s sources supplied â€” applied, or skipped because a value already existed â€”
recorded into ``_SOURCE_SUPPLIED_NAMES`` so the routed-child scrub knows the source owns it.)r&   Ú
provenanceÚsourcesÚupdateÚskipped_existingr   )ÚreportÚsuppliedÚsrcs   &  r   Ú_record_supplied_namesrB   }   sG   € ô �6×$Ñ$Ó%€HØ�~Œ~ˆØ�‰˜×,Ñ,Ö-ñ ä×!Ñ! (Ô+Ø€Or!   c               ó   € V ^8„  d   QhRR/# ©r   r   ztuple[str, ...]r   )r   s   "r   r    r    ‡   s   € ÷ "ñ "˜_ñ "r!   c                 ó    € \        \        4      # )uU  Every env-var name some profile's external secret source APPLIED (names only â€” the map is
process-wide, so a value must be resolved through the active profile's secret scope). Consumers that
forward source values into a child (MCP stdio env) want exactly these; see ``source_supplied_names``
for the wider set the routed-child scrub needs.)Útupler   r   r!   r   Úsecret_source_namesrG   ‡   s   € ô
 ”Ó!Ð!r!   c               ó   € V ^8„  d   QhRR/# rD   r   )r   s   "r   r    r    �   s   € ÷ Hñ H˜ñ Hr!   c                 óZ   € \        \        \        \        4      \        ,          4      4      # )u  Every env-var name an external source supplied for any home â€” applied, or lost to a pre-existing
process value (``skipped_existing``). The launch value in ``os.environ`` is still not a routed
profile's to inherit, so the strip must see the skipped names too.)rF   Úsortedr&   r   r   r   r!   r   Úsource_supplied_namesrK   �   s   € ô ”œœOÓ,Ô/EÕEÓFÓGÐGr!   c               ó   € V ^8„  d   QhRR/# ©r   r   r   r   )r   s   "r   r    r    –   s   € ÷ *ñ *˜Nñ *r!   c                 ó    € \        \        4      # )z«KEY names any NON-managed dotenv file loaded into this process's ``os.environ`` so far (see
``_LOADED_DOTENV_KEYS``); the launch profile's residue set for routed children.)Ú	frozensetr   r   r!   r   Úlaunch_dotenv_keysrP   –   s   € ô Ô(Ó)Ð)r!   c               ó   € V ^8„  d   QhRR/# rM   r   )r   s   "r   r    r    œ   s   € ÷ +ñ +˜^ñ +r!   c                 ó    € \        \        4      # )z·KEY names the administrator-managed ``.env`` loaded (see ``_MANAGED_DOTENV_KEYS``). Policy for
every profile: never stripped from a routed child, and re-applied over the routed scope.)rO   r   r   r!   r   Úmanaged_dotenv_keysrS   œ   s   € ô Ô)Ó*Ð*r!   c               ó    € V ^8„  d   QhRRRR/# ©r   Úhermes_homezstr | os.PathLiker   r   r   )r   s   "r   r    r    ¢   s   € ÷ Yñ YÐ*;ð YÀñ Yr!   c           	     ó€   € \        \        P                  \        \	        V 4      P                  4       4      / 4      4      # )z>Return the external-secret value snapshot for ``hermes_home``.)Údictr   r7   r4   r   Úresolve©rV   s   &r   Úget_secret_source_valuesr[   ¢   s/   € äÔ-×1Ñ1´#´d¸;Ó6G×6OÑ6OÓ6QÓ2RÐTVÓWÓXÐXr!   c               ó    € V ^8„  d   QhRRRR/# rU   r   )r   s   "r   r    r    §   s   € ÷ Bñ BÐ0Að BÀnñ Br!   c                ó„   € \         ;_uu_ 4        \        \        V 4      4      uuRRR4       #   + '       g   i     R# ; i)a’  Resolve one profile's configured sources without mutating ``os.environ``: multiplex gateways route
turns to profiles that never ran the process-global dotenv path, so resolve against a private mapping
seeded from that ``.env`` and record the per-home snapshot for ``build_profile_secret_scope()``.
Fail-open / once-per-home like ``_apply_external_secret_sources``; never returns plaintext .env entries.N)Ú_SECRET_SOURCE_CACHE_LOCKÚ_hydrate_profile_secret_sourcesr   rZ   s   &r   Úhydrate_profile_secret_sourcesr`   §   s&   € ÷
 
#Ö	"Ü.¬t°KÓ/@ÓA÷ 
#×	"×	"Ó	"ús   �.®?	c               ó    € V ^8„  d   QhRRRR/# )r   Úhomer   r   r   r   )r   s   "r   r    r    °   s   € ÷ 9ñ 9¨$ð 9°>ñ 9r!   c                ó¸  € \        V P                  4       4      pV\        9   d   \        V 4      # \        P                  VR4       \        P                  VR4        \        V 4      pT'       g   / #  ^ RI	H
pHp ^ RIHp \        P                  P!                  4        UUu/ uF  w  rgT! T4      '       g   K  YgbK  	  pppTP#                  T! T R,          4      4       T R,          p	T	P%                  4       '       d1   T! T	4      P!                  4        F  w  r«TP'                  Y«4       K  	  \        T 4      TR&   T! Y TR7      pTP(                  '       g   / # \*        ;QJ d&    R TP(                   4       F  '       d   K   R	M	  R
M! R TP(                   4       4      '       d   \        P-                  T4       \/        T4       / pTP0                  P!                  4        F3  w  rnTP3                  T4      pTf   K  TP4                  \6        T&   Y}T&   K5  	  T\        T&   \9        T4      #   \         d    / u # i ; iu uppi   \         d    / u # i ; i)zALocked implementation for :func:`hydrate_profile_secret_sources`.N)Ú_is_global_envr$   )Ú	apply_allú.envú.op.envÚHERMES_HOME)r.   c              3  óL   "  € T F  qP                   P                  x € K  	  R # 5i©N)ÚresultÚok)Ú.0rA   s   & r   Ú	<genexpr>Ú2_hydrate_profile_secret_sources.<locals>.<genexpr>Û   s   é € Ð
3¡N˜S�:‰:�=Ž=£Nùs   ‚"$FT)r4   rY   r   r[   r   Úpopr   Ú_load_secrets_configÚ	Exceptionr%   rd   r$   Úagent.secret_sources.registryre   r-   r.   Úitemsr=   r,   Ú
setdefaultr<   ÚallÚaddrB   r;   r7   Úsourcer   rX   )rb   Úhome_keyÚcfgrd   r$   re   ÚnameÚvalueÚ	local_envÚop_envÚ_nameÚ_valuer?   ÚvaluesÚapplieds   &              r   r_   r_   °   só  € ä�4—<‘<“>Ó"€HØ”>Ô!Ü'¨Ó-Ð-ô "×%Ñ% h°Ô5Ü"×&Ñ& x°Ô6ðÜ" 4Ó(ˆ÷ Øˆ	ðßDÝ;ä46·J±J×4DÑ4DÔ4FÔ_Ñ4F¡[ TÉ.ÐY]×J^”[�T’[Ñ4Fˆ	Ñ_Ø×Ñ™ t¨f¥}Ó5Ô6ð
 ˜	Õ!ˆØ�=‰=�?Š?Ù!.¨vÓ!6×!<Ñ!<Ö!>‘�Ø×$Ñ$ UÖ3ñ "?ä#& t£9ˆ	�-Ñ Ù˜3¨iÔ8ˆð �>�>ˆ>Øˆ	÷
 ƒsÑ
3 F§N¢NÓ
3‡s‡s‚sÑ
3 F§N¢NÓ
3×3Ò3Ü×Ñ˜8Ô$ô ˜6Ô"Ø€FØ×*Ñ*×0Ñ0Ö2‰ˆØ—‘˜dÓ#ˆØŠ=ÙØ '§¡Œ˜ÑØˆt‹ñ 3ð /5Ô! (Ñ+Ü�‹<ÐøôY ô ØŠ	ðüó `øô ô ØŠ	ðús=   ÁH0 Á3/I	 Â"IÂ9IÂ?BI	 È0I È?I ÉI	 É	IÉIc               ó    € V ^8„  d   QhRRRR/# )r   rV   ústr | os.PathLike | Noner   r*   r   )r   s   "r   r    r    ì   s   € ÷ 7ñ 7Ð+Cð 7Ètñ 7r!   c                óÈ  € V f{   \         P                  4        \        P                  4        \        P                  4        \        P                  4        \
        P                  4        \        P                  4        R# \        \        V 4      P                  4       4      p\         P                  V4       \        P                  VR4       \
        P                  VR4       R# )u›  Forget applied homes so the next load re-pulls (tests, long-running processes after config edits).

``hermes_home`` limits the reset to ONE home: a multiplex gateway keeps every profile's snapshot in
this process, and a per-fire cron re-pull or a plugin-discovery refresh for one home must not wipe
a sibling's hydrated snapshot â€” the sibling's next scope build would run empty until it re-hydrated
(#102041).N)r   Úclearr   r   r   r   r   r4   r   rY   Údiscardrp   )rV   ry   s   & r   Úreset_secret_source_cacherˆ   ì   s›   € ð ÒÜ×ÑÔÜ×ÑÔÜ×$Ñ$Ô&Ü%×+Ñ+Ô-Ü&×,Ñ,Ô.Ü%×+Ñ+Ô-ÙÜ”4˜Ó$×,Ñ,Ó.Ó/€HÜ×Ñ˜8Ô$Ü!×%Ñ% h°Ô5Ü"×&Ñ& x°Ö6r!   c               ó    € V ^8„  d   QhRRRR/# )r   r3   r4   r   r   )r   s   "r   r    r      s   € ÷ ñ ¨ð °ñ r!   c                óÖ   € \        V 4      pV'       g   R# VR8X  d   R#  ^ RIHp V! V4      pVe#   VP                  '       d   RVP                   R2# RT R2#   \         d     Li ; i)zc``" (from Bitwarden)"``-style suffix; ``""`` for .env/shell keys (only external sources are named).Ú Ú	bitwardenz (from Bitwarden)©Ú
get_sourcez (from Ú))r8   rs   rŽ   Úlabelrr   )r3   rx   rŽ   Ú
registereds   &   r   Úformat_secret_source_suffixr’     s{   € ä˜wÓ'€FßÙØ�ÔÙ"ðÝ<á Ó'ˆ
ØÒ! j×&6×&6Ð&6Ø˜Z×-Ñ-Ð.¨aÐ0Ð0ð �V�H˜AÐÐøô ô Ùðús    #A ÁA ÁA(Á'A(c               ó$   € V ^8„  d   QhRRRRRR/# )r   r|   r4   ÚlimitÚintr   r   )r   s   "r   r    r      s!   € ÷ ñ  3ð ¨sð ¸3ñ r!   c                ó  € . pV  Fq  p\        V4      ^8”  g   K  R\        V4      R 2pVP                  4       '       d   VRV: R2,          pWB9  d   VP                  V4       \        V4      V8¼  g   Kq   M	  RP	                  V4      # )z>Compact ``U+XXXX ('c'), ...`` summary of non-ASCII codepoints.zU+Ú04Xú (r�   z, )ÚordÚisprintableÚappendÚlenÚjoin)r|   r”   ÚseenÚchr�   s   &&   r   Ú_format_offending_charsr      s~   € à€DÛˆÜˆr‹7�SŽ=Øœ˜R› ˜Ð&ˆEØ�~‰~×ÒØ˜2˜b™V 1˜Õ%�ØÔ Ø—‘˜EÔ"Ü�4‹y˜EÖ!Ùñ ð �9‰9�T‹?Ðr!   c               ó   € V ^8„  d   QhRR/# )r   r   r*   r   )r   s   "r   r    r    #  s   € ÷ 
ñ 
 dñ 
r!   c                 óØ  a€ \        \        P                  P                  4       4       EF<  w  op \        ;QJ d#    V3R l\
         4       F  '       g   K   RM	  RM! V3R l\
         4       4      '       g   KQ  V P                  4       '       d   Ki  V P                  RRR7      P                  R4      pV\        P                  S&   S\        9   d   K«  \        P                  S4       \        V 4      \        V4      ,
          p\        V 4      ;'       g    Rp\        RS R	T R
V^8w  d   RMR RV R2	\        P                  R7       \        R\        P                  R7       EK?  	  R# )ae  Strip non-ASCII from credential env vars (``_CREDENTIAL_SUFFIXES``) so the codebase never sees them.

Emits a one-line warning to stderr when characters are stripped. Silent stripping would mask copy-paste
corruption (Unicode lookalike glyphs from PDFs / rich-text editors, ZWSP from web pages) as opaque
provider-side "invalid API key" errors (see #6843).
c              3  óF   <"  € T F  pSP                  V4      x € K  	  R # 5irj   )Úendswith)rm   Úsuffixr0   s   & €r   rn   Ú/_sanitize_loaded_credentials.<locals>.<genexpr>+  s   øé € ÐKÑ6J¨F�3—<‘< ×'Ð'Ó6Jùs   ƒ!TFÚasciiÚignore)Úerrorsznon-printablez  Warning: z contained z non-ASCII characterÚsr‹   r˜   u8   ) â€” stripped so the key can be sent as an HTTP header.©Úfilea@    This usually means the key was copy-pasted from a PDF, rich-text editor, or web page that substituted lookalike
  Unicode glyphs for ASCII letters. If authentication fails (e.g. "API key not valid"), re-copy the key from the
  provider's dashboard and run `hermes setup` (or edit the .env file in a plain-text editor).N)Úlistr-   r.   rt   ÚanyÚ_CREDENTIAL_SUFFIXESÚisasciiÚencodeÚdecoder   rw   rœ   r    ÚprintÚsysÚstderr)r|   ÚcleanedÚstrippedÚdetailr0   s       @r   Ú_sanitize_loaded_credentialsr¹   #  s  ø€ ô œ2Ÿ:™:×+Ñ+Ó-×.‰
ˆˆUß‹sÔKÕ6JÓK�s�sŠsÔKÕ6JÓK×KÒKÙØ�=‰=�?Š?ÙØ—,‘,˜w¨x�,Ó8×?Ñ?ÀÓHˆØ!Œ�
‰
�3‰Ø”,ÔÙÜ×Ñ˜ÔÜ�u“:¤ G£Õ,ˆÜ(¨Ó/×BÐB°?ˆÜ�˜C˜5 ¨H¨:Ð5IØ  Aœ‘¨2Ð.¨b°°ð 93ð4ä:=¿*¹*õ	Fô 	ð1ô —‘÷	
ð 	
ó /r!   Ú	load_passÚmanagedFc          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   r   r   ÚoverrideÚboolrº   ú
int | Noner»   r   r*   r   )r   s   "r   r    r    D  s4   € ÷ 9#ñ 9#Ø
ð9#Ø!ð9#Ø.8ð9#ØJNð9#à	ñ9#r!   c          	     óB  a€ V P                  4       p VP                  R4      p^ RIHp ^ RIH	p \        V! R\        P                  ! V4      RR7      P                  4       4      p\        ;_uu_ 4        Vf   \        \         4      p\#        \$        P&                  4      p	\(        P+                  4        F5  w  p
w  r¼pWÒ8w  g   K  V	P-                  V
4      V8X  g   K)  Vf   Wš K1  W¹V
&   K7  	  / pV FB  w  r¯Ve6   V'       d   / V	CVCM/ VCV	CoRP/                  V3R	 lV! V4       4       4      pWþV
&   KD  	  VP+                  4        FÂ  w  r¯Ve   V'       g   V
\$        P&                  9   d   K(  \$        P&                  P-                  V
4      p\(        P-                  V
4      pVRJ;'       d    VV^,          8H  pV
\0        9   d   V'       d   V'       g   K‘  V'       d
   V^ ,          MTpV\$        P&                  V
&   W¿V3\(        V
&   KÄ  	  RRR4       V'       d   \2        M\4        P7                  R
 V 4       4       \9        4        R#   \         d5    TP                  \        P
                  4      pTP                  R4      p ELfi ; i  + '       g   i     Lˆ; i)u3  Load one dotenv file into ``os.environ`` like ``dotenv.load_dotenv`` â€” same parser, same
``${VAR}`` / ``${VAR:-default}`` / precedence rules â€” except that ``${VAR}`` resolves against the value
VAR had before this process's earlier passes published it (see ``_DOTENV_PUBLISHED``).

``load_pass`` groups the layered files of one ``load_hermes_dotenv`` call: within a pass a later layer
(project, managed) still sees the earlier layer's output, as it always did; only OTHER passes' output
is peeled. A bare call (``hermes send``'s direct reload) is its own pass.ú	utf-8-sigzlatin-1)ÚDotEnv)Úparse_variablesNF)Údotenv_pathÚstreamÚinterpolater‹   c              3  óD   <"  € T F  qP                  S4      x € K  	  R # 5irj   )rY   )rm   ÚatomÚlookups   & €r   rn   Ú-_load_dotenv_with_fallback.<locals>.<genexpr>k  s   øé € ÐXÑAW¸§¡¨V× 4Ð 4ÓAWùs   ƒ c              3  ó*   "  € T F	  w  rVx € K  	  R # 5irj   r   )rm   r{   r€   s   &  r   rn   rÊ   |  s   é € ÐEkÑ_jÉ|ÈtÅdÓ_jùs   ‚)Ú
read_bytesr²   ÚUnicodeDecodeErrorÚremoveprefixÚcodecsÚBOM_UTF8Údotenv.mainrÂ   Údotenv.variablesrÃ   r­   ÚioÚStringIOÚparseÚ_DOTENV_LOCKÚnextÚ_DOTENV_PASSESrX   r-   r.   r   rt   r7   r�   r   r   r   r=   r¹   )r   r½   rº   r»   ÚrawÚtextrÂ   rÃ   ÚassignmentsÚ
lookup_envr{   ÚbaselineÚ	publishedÚpublished_passÚresolvedr|   ÚcurrentÚrecordÚoursrÉ   s   &$$$               @r   Ú_load_dotenv_with_fallbackrä   D  s  ø€ ð �/‰/Ó
€Cð%ð �z‰z˜+Ó&ˆõ #Ý0ä‘v¨$´r·{²{À4Ó7HÐV[Ô\×bÑbÓdÓe€Kç	ŽØÒÜœ^Ó,ˆIÜ,0´·±Ó,<ˆ
Ü;L×;RÑ;RÖ;TÑ7ˆDÑ7�8¨ØÖ*¨z¯~©~¸dÓ/CÀyÖ/PØÒ#Ø"Ò(à'/˜tÓ$ñ <Uð +-ˆÛ&‰KˆDØÒ ß7?Ð3˜JÐ3¨(Ñ3ÐE_ÈÐE_ÐT^ÐE_�ØŸ™ÔXÁÐQVÔAWÓXÓX�Ø"�T‹Nñ	 'ð
 $Ÿ>™>Ö+‰KˆDØŠ}§X°$¼"¿*¹*Ô2DÙÜ—j‘j—n‘n TÓ*ˆGÜ&×*Ñ*¨4Ó0ˆFØ Ð%×>Ð>¨'°V¸AµYÑ*>ˆDØÔ-Ô-·'Ç$Ùç$(�v˜a–y¨gˆHØ$ŒB�J‰J�tÑØ'/¸	Ð&BÔ˜dÓ#ñ ,÷! 
÷> %ÕÔ*=×EÑEÑEkÑ_jÓEkÔkÜ Ö"øôU ô %Ø×ÑœvŸ™Ó/ˆØ�z‰z˜)Ó$‹ð%ú÷ 
�úsP   “I Á4AJÃJÃ$JÄAJÅAJÆ/JÇJÇ	JÇ!-JÉ;JÊ
JÊJ	c               ó    € V ^8„  d   QhRRRR/# r)   r   )r   s   "r   r    r    €  s   € ÷ Cñ C tð C°ñ Cr!   c                ó´  € V P                  4       '       g   R#  ^ RIHp  T P	                  4       pRpTP                  \        P                  4      '       g&   TP                  \        P                  4      '       dR   \        T P                  4       4      pT\        9  d,   \        P                  T4       \        P                  RT 4       R# TP                  \        P                   4      '       g&   TP                  \        P"                  4      '       dS    \$        P&                  ! \$        P(                  ! T4      RRR7      ;_uu_ 4       pTP+                  4       pRRR4       RpMX \/        T RR	R
7      ;_uu_ 4       pTP+                  4       pRRR4       X'       d!   T^ ,          P                  R4      '       d   R#  X Uu. uF  qwP1                  RR4      NK  	  ppT! T4      p	Y–8w  g	   T'       dŽ   \3        T RRR7      w  r« \4        P6                  ! T
RRR7      ;_uu_ 4       pTP9                  T	4       TP;                  4        \4        P<                  ! TP?                  4       4       RRR4       \A        Y°4       R# R#   \         d     R# i ; i  \
         d     R# i ; i  + '       g   i     ELV; i  \,         d     R# i ; i  + '       g   i     ELI; i  \
         d     R# i ; iu upi   + '       g   i     L”; i  \B         d+     \4        PD                  ! T4       h   \F         d     h i ; ii ; i  \
         d     R# i ; i)a  Pre-sanitize a .env file before python-dotenv reads it. Sniffs a leading BOM *before* any text
decode: UTF-16 (Notepad "Unicode") is rewritten as clean UTF-8; UTF-32 is refused (left untouched) so
we never fall through to the errors=replace corruption path.N)Ú_sanitize_env_linesFz^Skipping .env sanitize for %s: UTF-32 BOM detected; leaving file untouched to avoid corruptionzutf-16)ÚencodingÚnewlineTrÁ   Úreplace)rè   r©   u   ï¿½Ú r‹   z.tmpz.env_)r¥   ÚprefixÚwzutf-8)rè   )$r,   Úhermes_cli.configrç   ÚImportErrorrÌ   rr   Ú
startswithrÏ   ÚBOM_UTF32_LEÚBOM_UTF32_BEr4   rY   r	   rw   ÚloggerÚwarningÚBOM_UTF16_LEÚBOM_UTF16_BErÓ   ÚTextIOWrapperÚBytesIOÚ	readlinesrÍ   Úopenrê   r   r-   ÚfdopenÚ
writelinesÚflushÚfsyncÚfilenor   ÚBaseExceptionÚunlinkÚOSError)r   rç   rÙ   Úforce_utf8_rewriteÚpath_keyÚfÚoriginalÚliner·   Ú	sanitizedÚfdÚtmps   &           r   Ú_sanitize_env_file_if_neededr  €  s£  € ð �;‰;�=Š=ÙðÝ9ðØ�o‰oÓˆð
 ÐØ
‡~�~”f×)Ñ)×*Ò*¨c¯n©n¼V×=PÑ=P×.QÒ.Qô �t—|‘|“~Ó&ˆØÔ.Ô.Ü×#Ñ# HÔ-Ü�N‰Nð HØIMôOáØ
‡~�~”f×)Ñ)×*Ò*¨c¯n©n¼V×=PÑ=P×.QÒ.Qð	Ü×!Ò!¤"§*¢*¨S£/¸HÈd×SÕSÐWXØŸ;™;›=�÷ Tð "Ñð	Ü�d [¸×CÕCÀqØŸ;™;›=�÷ D÷ ˜ �×.Ñ.¨x×8Ò8Ùðá9AÓB¹°—L‘L ¨Ö,¹ˆÐBÙ'¨Ó1ˆ	ØÔ ×$6Ü$ T°&ÀÔI‰GˆBðÜ—Y’Y˜r 3°×9Õ9¸QØ—L‘L Ô+Ø—G‘G”IÜ—H’H˜QŸX™X›ZÔ(÷ :ô ˜sÖ)ñ %7øôY ô Úðûô
 ô Úðú÷$ T×SÐSûä!ô 	Úð	ú÷ D×CÐCûäô 	Úð	üò C÷
 :×9ûô
 !ô ðÜ—I’I˜c”Nð øô ô ØØðúðûô ô Úðúsû   šJ ¡J Ä5K  ÅJ,ÅK  Å+K& ÆKÆK& ÇM ÇK8Ç!M Ç9M È
!L È+AK=É1L ÊJÊJÊJ)Ê(J)Ê,J=	Ê7K  Ê=K  Ë KËKËK#	ËK& Ë#K& Ë&K5Ë4K5Ë8M Ë=L	ÌL ÌMÌL3Ì2MÌ3MÌ>MÍ MÍMÍM ÍMÍMrV   Úproject_envÚload_external_secretsTc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rV   r„   r  r  r¾   r   z
list[Path]r   )r   s   "r   r    r    Æ  s8   € ÷ hñ hà)ðhð *ðhð  ð	hð
 ñhr!   c                óT  € ^ RI Hp V '       d   \        V 4      MV! 4       p^ RIHp ^ RI HpHp \        4       P                  4       pV! 4       '       d¹   V! 4       e°   VP                  4       V8w  g   V! 4       P                  4       V8w  d�   \        VP                  4       4      p	V	\        9  d,   \        P                  V	4       \        P                  RV4       V'       d(   ^ RIHp
 V
P!                  4       '       g   \#        V4       . # . pVR,          pV'       d   \        V4      MRp\%        \&        4      pVP)                  4       '       d   \+        V4       V'       d"   VP)                  4       '       d   \+        V4       VP)                  4       '       d+   \-        VRVR	7       VP/                  V4       \1        V4       VR
,          pVP)                  4       '       d4   \2        P4                  P7                  R4      '       g   \-        VRVR	7       V'       d:   VP)                  4       '       d$   \-        WÛ'       * VR	7       VP/                  V4       \8        '       d   \8        P7                  \        VP                  4       4      / 4      P;                  4        F?  w  pp\2        P4                  P7                  V4      V8w  g   K,  V\2        P4                  V&   KA  	  ^ RIHp
 V'       d"   V
P!                  4       '       g   \=        V4       \?        VR7       \A        V4       V# )zÆLoad Hermes env files: ``~/.hermes/.env`` overrides stale shell exports; project ``.env`` is a dev
fallback that only fills gaps when the user env exists (and overrides shell vars when it does not).)Úget_process_hermes_home)Úis_multiplex_active)Úget_hermes_homeÚget_hermes_home_overrideNzumultiplex: skipping process-global dotenv load for routed profile home %s (credentials resolve via the profile scope))Ú_early_recoveryrf   T)r½   rº   rg   ÚOP_SERVICE_ACCOUNT_TOKENF)rº   )!Úhermes_constantsr  r   r%   r  r  r  Ú_process_hermes_homerY   r4   r
   rw   ró   ÚdebugÚ
hermes_clir  Ú$_should_skip_external_secret_sourcesr`   r×   rØ   r,   r  rä   r›   r1   r-   r.   r7   r   rt   Ú_apply_external_secret_sourcesÚ_apply_managed_envÚ_reapply_terminal_config_bridge)rV   r  r  r  Ú	home_pathr  r  r  Úlaunch_homery   r  ÚloadedÚuser_envÚproject_env_pathrº   r~   r{   r|   s   $$$               r   Úload_hermes_dotenvr#  Æ  sI  € õ 9ß%0”�[Ô!Ñ6MÓ6O€Iõ 7ßJä&Ó(×0Ñ0Ó2€KÙ×ÒÑ":Ó"<Ò"HØ×"Ñ"Ó$¨Ô3±Ó7H×7PÑ7PÓ7RÐVaÔ7aÜ�y×(Ñ(Ó*Ó+ˆØÔ.Ô.Ü×#Ñ# HÔ-Ü�L‰Lð WØXaôcç Ý2à"×GÑG×IÒIÜ.¨yÔ9Øˆ	à€FØ˜6Õ!€Hß,7”t˜KÔ(¸TÐÜ”^Ó$€Ià‡�×ÒÜ$ XÔ.ßÐ,×3Ñ3×5Ò5Ü$Ð%5Ô6à‡�×ÒÜ" 8°dÀiÕPØ�‰�hÔÜ-¨hÔ7ð
 ˜Õ"€FØ‡}�}‡‚œrŸz™zŸ~™~Ð.H×IÒIÜ" 6°EÀYÕOçÐ,×3Ñ3×5Ò5Ü"Ð#3¼jÐT]Õ^Ø�‰Ð&Ô'÷ &Ó%Ü9×=Ñ=¼cÀ)×BSÑBSÓBUÓ>VÐXZÓ[×aÑaÖc‰KˆD�%Ü�z‰z�~‰~˜dÓ# uÖ,Ø#(”—
‘
˜4Ó ñ dõ +÷  _×%YÑ%Y×%[Ò%[Ü& yÔ1Ü Õ+ô $ IÔ.à€Mr!   c               ó    € V ^8„  d   QhRRRR/# ©r   r  r   r   r*   r   )r   s   "r   r    r    1  s   € ÷ ñ ¨tð ¸ñ r!   c                ó¶   €  \        V 4      P                  4       \        4       P                  4       8w  d   R# ^ RIHp V! RR7       R#   \
         d     R# i ; i)zîRe-assert config.yaml's explicit ``terminal.*`` keys over reloaded .env via the single shared bridge
``apply_terminal_config_to_env`` (also used by terminal_tool and the TUI/dashboard launchers) so the
semantics can't drift between sites.N)Úapply_terminal_config_to_env)Úenv)r   rY   r  rî   r'  rr   )r  r'  s   & r   r  r  1  sI   € ðÜ�	‹?×"Ñ"Ó$Ô(<Ó(>×(FÑ(FÓ(HÔHÙÝBá$¨×.øÜô Úðús   ‚4A	 ¸A	 Á	AÁAc               ó    € V ^8„  d   QhRRRR/# )r   rº   r¿   r   r*   r   )r   s   "r   r    r    ?  s   € ÷ ^ñ ^ Zð ^¸4ñ ^r!   c                óÚ   €  ^ RI Hp VP                  4       pTf   R# TR,          pTP	                  4       '       g   R# \        T4       \        TRT RR7       R#   \         d     R# i ; i)zÈApply the managed-scope .env last, with override, so it beats user/shell. Does NOT stop the agent
from later mutating os.environ (v1 relies on filesystem permissions). Fail-open: never blocks startup.)Úmanaged_scopeNrf   T)r½   rº   r»   )r  r+  Úget_managed_dirrr   r,   r  rä   )rº   r+  Úmanaged_dirÚmanaged_envs   $   r   r  r  ?  sj   € ðÝ,à#×3Ñ3Ó5ˆð ÒÙØ Õ&€KØ×Ñ×ÒÙÜ  Ô-Ü˜{°TÀYÐX\×]øô ô Úðús   ‚A ÁA*Á)A*c               ó    € V ^8„  d   QhRRRR/# r%  r   )r   s   "r   r    r    Q  s   € ÷ $:ñ $:¨Dð $:¸dñ $:r!   c               ó   a	a
a€ \        \        V 4      P                  4       4      o	\        P	                  S	4      pV'       g   R#  ^ RIHp \        V! \        V 4      R,          4      4      \        ,          p/ pVP                  4        EF%  w  o
w  orgV! S
S4      '       d
   SWg3VS
&   K"  S
V9  d]   \        P                  P	                  S
4      V8X  d9   Vf"   \        P                  P                  S
R4       MV\        P                  S
&   \        ;QJ d3    V	V
V3R l\        P                  4        4       F  '       g   K   RM(	  RM$! V	V
V3R l\        P                  4        4       4      p\        P	                  S
4      S8X  g   EK  V'       d   EK  \        P                  S
R4       EK(  	  V'       d   V\        S	&   R# \        P                  S	R4       R#   \         d    \        \        4      p EL„i ; i)a  Take back what a source wrote into ``os.environ`` for *home_path* once nothing backs it.

``keep(name, source)`` says which recorded writes are still owned. Every other write is revoked,
but only while ``os.environ`` still holds exactly the value the source wrote: a value another owner
replaced since (the profile's ``.env``, the administrator-managed ``.env``, a shell export, a later
source) is theirs and stays. A revoked name gets back the value it held before the source's first
write, or is removed when it had none.Nr#   rf   c              3  ór   <"  € T F,  w  rVS8w  g   K  VP                  SR4      ^ ,          S8H  x € K.  	  R# 5i)r‹   N)r‹   )r7   )rm   r0   Úotherry   r{   rx   s   &  €€€r   rn   Ú/_revoke_secret_source_writes.<locals>.<genexpr>m  s8   øé € ð XáC‘
�ÀsÈhÁô 0ˆE�I‰I�d˜EÓ" 1Õ%¨Ö/ÛCùs   ƒ7“$7TF)r4   r   rY   r   r7   r%   r$   r&   r   rr   rt   r-   r.   rp   r®   r   )r  ÚkeepÚwritesr$   Úowned_by_dotenvÚkeptr|   ÚpriorÚstill_attributedry   r{   rx   s   &$       @@@r   Ú_revoke_secret_source_writesr:  Q  sƒ  ú€ ô ”4˜	“?×*Ñ*Ó,Ó-€HÜ*×.Ñ.¨xÓ8€FßÙð4Ý4ä™m¬D°«O¸fÕ,DÓEÓFÔI]Õ]ˆð 46€DØ(.¯©¯Ñ$ˆÑ$ˆv�uÙ��f×ÒØ  %Ð/ˆD�‰JÙØ�Ô&¬2¯:©:¯>©>¸$Ó+?À5Ô+HØŠ}Ü—
‘
—‘˜t TÕ*à#(”—
‘
˜4Ñ ß›3ö Xä;×AÑAÔCóXŸ3Ÿ3š3ö Xä;×AÑAÔCóXó XÐô ×Ñ˜tÓ$¨×.×7GÒ7GÜ×Ñ  d×+ñ )7÷ Ø26Ô% hÓ/ä%×)Ñ)¨(°DÖ9øô) ô 4ÜÔ2Ó3‹ð4ús   Á2G ÇG=Ç<G=c               ó    € V ^8„  d   QhRRRR/# r%  r   )r   s   "r   r    r    x  s"   € ÷ ^@ñ ^@¨dð ^@°tñ ^@r!   c                óŠ  a€ \        \        V 4      P                  4       4      pV\        9   d   R#  \	        V 4      pT'       g   \        T R R7       R# \        ;QJ d*    R TP                  4        4       F  '       g   K   RM	  RM! R TP                  4        4       4      pT'       g   \        T R R7       R#  ^ RI	H
pHp  T! Y 4      oSe   \        T T3R	 lR7       \        \        P                  4      p T! Y 4      pTP                   '       g   R# \        P#                  T4       TP$                  '       dA   \'        4        TP(                  P+                  4        F  w  r‰T	P,                  \.        T&   K  	  / p
\1        T4      pT F3  pT\        P                  9   g   K  \        P                  T,          Y¨&   K5  	  \3        YY¶4       T
'       d
   T
\4        T&   TP(                  P+                  4        UUu/ uF*  w  rÍTP6                  '       g   K  YÊ9   g   K!  YÊT,          bK,  	  upp\8        T&   TP                    EFu  pTP:                  '       d^   \=        R
TP>                   R\A        TP:                  4       R\A        TP:                  4      ^8w  d   RMR 2\B        PD                  R7       TPF                  PH                  '       dŸ   \=        R
TP>                   RTPF                  PH                   2\B        PD                  R7       \K        TPL                  TPF                  PN                  Y!R7      pT'       d,   \=        R
TP>                   RT 2\B        PD                  R7       TPF                  PP                   F.  p\=        R
TP>                   RT 2\B        PD                  R7       K0  	  EKx  	  TPR                   F!  p\=        RT 2\B        PD                  R7       K#  	  R#   \
         d     R# i ; i  \         d     R# i ; i  \
         d    Ro ELZi ; i  \
         d     R# i ; iu uppi )uc  Pull secrets from every enabled external source into env â€” AFTER dotenv (sources need .env bootstrap
tokens), BEFORE Hermes reads credentials; failures never block startup. Precedence/conflicts/provenance
live in ``registry.apply_all``; this wrapper owns the once-per-home guard, the post-apply ASCII sweep,
the ``_SECRET_SOURCES`` map and status lines.Nc                ó   € R # ©Fr   ©r   Ú_sources   &&r   Ú<lambda>Ú0_apply_external_secret_sources.<locals>.<lambda>Œ  ó   € ÉEr!   ©r4  c              3  óx   "  € T F0  p\        V\        4      ;'       d    VP                  R 4      RJ x € K2  	  R# 5i)ÚenabledTN)Ú
isinstancerX   r7   )rm   Úvs   & r   rn   Ú1_apply_external_secret_sources.<locals>.<genexpr>’  s2   é € Ð]ÑP\È1”j ¤DÓ)×FÐF¨a¯e©e°IÓ.>À$Ð.FÔFÓP\ùs   ‚:ž:TFc                ó   € R # r>  r   r?  s   &&r   rA  rB  ”  rC  r!   )re   Úenabled_source_namesc                ó   <€ VS9   # rj   r   )r   rx   Úactives   &&€r   rA  rB  £  s   ø€ È6ÐU[ÒK[r!   z  z
: applied z secretrª   r‹   r«   z: ©Úscopeu   : â†’ z  Secret sources: )*r4   r   rY   r   rq   rr   r:  r®   r�   rs   re   rK  rï   rX   r-   r.   r<   rw   Úapplied_anyr¹   r;   rt   rx   r   rB   Ú_record_secret_source_writesr   Úauthoritativer   r‚   r³   r�   rœ   r´   rµ   rk   ÚerrorÚ_remediation_hintr{   Ú
error_kindÚwarningsÚ	conflicts)r  ry   rz   Úany_enabledre   rK  Úenviron_beforer?   r{   r‚   r�   r@   ÚnÚarA   ÚhintÚwarnÚconflictrM  s   &                 @r   r  r  x  sX  ø€ ô
 ”4˜	“?×*Ñ*Ó,Ó-€HØ”>Ô!Ùð
Ü" 9Ó-ˆ÷ Ü$ YÑ5QÕRÙ÷
 “#Ñ]ÐPS×PZÑPZÔP\Ó]—#—#’#Ñ]ÐPS×PZÑPZÔP\Ó]Ó]€KßÜ$ YÑ5QÕRÙðßQðÙ% cÓ5ˆð ÒÜ$ YÔ5[Õ\Üœ"Ÿ*™*Ó%€NðÙ˜3Ó*ˆð �>�>ˆ>Ùô
 ×Ñ�xÔ à××ÐÜ$Ô&Ø#×.Ñ.×4Ñ4Ö6‰MˆDØ$+§N¡NŒO˜DÓ!ñ 7ð  €FÜ% fÓ-€HÛˆØ”2—:‘:ÖÜŸ:™: dÕ+ˆF‹Lñ ô ! °8ÔLßØ28Ô% hÑ/à!'×!2Ñ!2×!8Ñ!8Ô!:ô0_Ù!:™˜¸a¿o½oŒÐRSÑR]Œˆ�!�9ŠÑ!:ò0_Ô" 8Ñ,ð �~�~ˆØ�;�;ˆ;Ü�B�s—y‘y�k ¬C°·±Ó,<Ð+=ð >Ü"% c§k¡kÓ"2°aÔ"7™3¸RÐ@ðBÜHKÏ
É
õTà�:‰:××ÐÜ�B�s—y‘y�k  C§J¡J×$4Ñ$4Ð#5Ð6¼S¿Z¹ZÕHÜ$ S§X¡X¨s¯z©z×/DÑ/DÀcÔZˆDßÜ˜˜3Ÿ9™9˜+ V¨D¨6Ð2¼¿¹ÕDØ—J‘J×'Ô'ˆDÜ�B�s—y‘y�k  D 6Ð*´·±×<ô (ñ ð ×$Ô$ˆÜÐ" 8 *Ð-´C·J±J×?ó %øô_ ô âðûô& ô Úðûô ô Ø‹ðûô ô Úðüó>0_sY   ²O5 Â>P ÃP Ã>P- ÈP?ÈP?È$P?Ï5PÐPÐPÐPÐP*Ð)P*Ð-P<Ð;P<c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   ry   r4   r@   r   rY  rX   r   r*   r   )r   s   "r   r    r    Ù  s*   € ÷ :ñ :¨3ð :À(ð :Ð\`ð :Ðeiñ :r!   c                óŠ  aaa€ SP                    Uu0 uF,  qDP                  P                  '       d   K   VP                  kK.  	  upo\        P                  V / 4      p\        \        V 4      VVV3R lR7       \        P                  V / 4      P                  4        UUu/ uFG  w  rgVSP                  9  g   K  \        P                  P                  V4      V^,          8X  g   KE  WgbKI  	  pppSP                  P                  4        F�  w  riV\        P                  9  d   K  VP                  V4      p
VP                  V4      pVe   V^,          V
8X  d
   V^,          MT
pV	P                  \        P                  V,          V3W†&   Kƒ  	  V'       d   V\        V &   R# \        P                  V R4       R# u upi u uppi )a  Refresh ``_SECRET_SOURCE_WRITES_BY_HOME`` after one process-global pass, revoking a write its
still-enabled source has stopped supplying (rotated out, mapping removed). A source whose fetch
FAILED this pass keeps its earlier writes: a transient vault outage is not a revocation.c                óV   <€ V SP                   9   ;'       g    V S9   ;'       g    VS9   # rj   )r;   )r{   rx   Úfailedr?   r@   s   &&€€€r   rA  Ú._record_secret_source_writes.<locals>.<lambda>á  s/   ø€  $¨&×*;Ñ*;Ñ";×"cÐ"c¸tÀxÑ?O×"cÐ"cÐSYÐ]cÑScÐ"cr!   rD  N)r<   rk   rl   r{   r   r7   r:  r   rt   r;   r-   r.   rx   rp   )ry   r?   r@   rY  rA   Úpreviousr{   Úrecr5  r‚   ÚbeforeÚearlierr8  rb  s   &ff&         @r   rQ  rQ  Ù  sf  ú€ ð #)§.¢.ÓF¡.˜3¿
¹
¿½Œhˆc�hŒh¡.ÑF€FÜ,×0Ñ0°¸2Ó>€HÜ ÜˆX‹Þcõeô *G×)JÑ)JÈ8ÐUWÓ)X×)^Ñ)^Ô)`ô SÑ)`™I˜DØ˜V×.Ñ.Ñ.ô Ü35·:±:·>±>À$Ó3GÈ3ÈqÍ6Ñ3Qô ˆdŠiÑ)`€Fñ Sà×*Ñ*×0Ñ0Ö2‰ˆØ”r—z‘zÔ!ÙØ×#Ñ# DÓ)ˆØ—,‘,˜tÓ$ˆà%Ò1°g¸aµjÀFÔ6J�˜–
ÐPVˆØŸ™¬¯
©
°4Õ(8¸%Ð@ˆ‹ñ 3÷ Ø28Ô% hÓ/ä%×)Ñ)¨(°DÖ9ùò% Gùó
Ss   ’F:´F:Â F?Â:(F?Ã'F?rO  c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úsource_namer4   Úsecrets_cfgrX   rO  r5   r   r   )r   s   "r   r    r    ò  s*   € ÷ ñ  3ð Àð ÐQ[ð Ðgjñ r!   c               ó  €  ^ RI Hp V! WR7      pVf   R# VP                  V 4      p\        V\        4      '       d   TM/ p\        VP                  W4      ;'       g    R4      P                  4       #   \         d     R# i ; i)zbThe failed source's one-line fix-it hint; a plugin remediation() could raise and startup must not.r�   rN  r‹   )	rs   rŽ   r7   rG  rX   r4   ÚremediationÚstriprr   )ri  rU  rj  rO  rŽ   rx   Úsrc_cfgs   &&&$   r   rT  rT  ò  sv   € ð
Ý<á˜KÔ5ˆØŠ>ÙØ—/‘/ +Ó.ˆÜ'¨´×6Ò6‘'¸BˆÜ�6×%Ñ% jÓ:×@Ð@¸bÓA×GÑGÓIÐIøÜô Úðús   ‚A4 —AA4 ÁA4 Á4BÂBc               ó    € V ^8„  d   QhRRRR/# )r   r  r   r   rX   r   )r   s   "r   r    r      s   € ÷ %ñ % Dð %¨Tñ %r!   c                ór  € V R,          pVP                  4       '       g   / # V \        4       8X  d4    ^ RIHp V! 4       ;'       g    / pVP	                  R4      ;'       g    / #  \        V4      ;'       g    / pTP	                  R4      ;'       g    / #   \
         d     L>i ; i  \
         d    / u # i ; i)zeRead just the ``secrets:`` section of config.yaml, isolated so a malformed config can't break dotenv.zconfig.yaml)Úread_raw_configÚsecrets)r,   r  rî   rq  r7   rr   r   )r  Úconfig_pathrq  Údatas   &   r   rq   rq     s¶   € à˜mÕ+€KØ×Ñ×ÒØˆ	ð Ô(Ó*Ô*ð	Ý9á"Ó$×*Ð*¨ˆDØ—8‘8˜IÓ&×,Ð,¨"Ð,ðÜ& {Ó3×9Ð9°rˆð �8‰8�IÓ×$Ð$ "Ð$øô ô 	Ùð	ûô
 ô ØŠ	ðús5   ²B ÁB Á!B Á%B& Á7B& ÂB#Â"B#Â&B6Â5B6c               ó   € V ^8„  d   QhRR/# )r   r   r   r   )r   s   "r   r    r      s   € ÷ 'ñ '˜dñ 'r!   c                 óx   €  ^ RI Hp  V ! 4       #   \         d     \        P                  ! 4       R,          u # i ; i)u„  The HERMES_HOME the running process was launched under.

Must be the *true* process home, ignoring any context-local
``set_hermes_home_override`` a per-request task has installed. Both
callers depend on that:

* ``_reapply_terminal_config_bridge`` guards "only re-bridge config into
  the shared ``os.environ`` when THIS load is for the process's own
  profile". If this followed the task override, a per-turn handler scoped
  to a *secondary* profile (the multiplex dashboard serving every profile
  from one process) would satisfy the guard and bridge that profile's
  ``terminal.backend`` into the shared env â€” e.g. a ``local`` sibling
  profile clobbering the launch profile's ``TERMINAL_ENV=ssh`` while
  leaving its ``TERMINAL_SSH_*`` untouched, so the session silently runs
  commands locally (cross-profile terminal-backend leak).
* ``_load_secrets_config`` uses it to decide whether the shared
  (mtime,size)-keyed config cache is safe to reuse; under an override it
  must fall through to an isolated parse of the scoped profile.

``hermes_constants.get_routing_process_hermes_home()`` is the override-immune
resolver built for exactly this; delegate to it. It is also immune to a host
that mirrors the served profile into the live ``HERMES_HOME`` env var
(``pin_process_hermes_home``): without that, the mirrored profile satisfied
the guard above and bridged ITS ``terminal.*`` into the shared env.
©Úget_routing_process_hermes_homez.hermes)r  rx  rr   r   rb   rw  s    r   r  r    s3   € ð4'ÝDá.Ó0Ð0øÜô 'Ü�yŠy‹{˜YÕ&Ò&ð'ús   ‚ �'9¸9)Ú_API_KEYÚ_TOKENÚ_SECRETÚ_KEY>   ÚCOPILOT_CLI_PATHÚCOPILOT_ACP_BASE_URLÚHERMES_ACP_AUTH_METHODÚHERMES_ACP_AUTO_APPROVEÚHERMES_COPILOT_ACP_ARGSÚHERMES_COPILOT_ACP_COMMANDrj   )é   )FÚ__conditional_annotations__Ú__doc__Ú
__future__r   rÏ   rÓ   Ú	itertoolsÚloggingr-   r´   Ú	threadingÚpathlibr   ÚdotenvÚutilsr   r   r   Ú	getLoggerÚ__name__ró   r¯   r&   r   Ú__annotations__r	   r
   r   r   r   r   r   r   r   r   ÚRLockr^   r   ÚcountrØ   rÖ   rO   r   r   r'   r1   r8   rB   rG   rK   rP   rS   r[   r`   r_   rˆ   r’   r    r¹   rä   r  r#  r  r  r:  r  rQ  rT  rq   r  )r„  s   @r   Ú<module>r’     s  øðÜ Lå "ã Û 	Û Û Û 	Û 
Û Ý ó
 ß IÑ Ià	×	Ò	˜8Ó	$€ð AÐ ñ ›€ˆhÓ Ù #£Ð �XÓ %Ù #£Ð �XÓ %ð #%€�Ó $ñ
 $'£5Ð ˜Ó (ñ
 !$£Ð �XÓ %ñ "%£Ð �hÓ &à;=Ð Ð8Ó =à<>Ð Ð 9Ó >ð TVÐ ÐPÓ Uñ ›5€�Ó  Ø%ŸOšOÓ-Ð ð =?Ð Ð9Ó >Ø—’Ó"€Ø�ŠÓ €ñ *3Ð4TÐ3UÓ)VÐ ˜Ó Vñ -6ò 7ó -Ð ˜>ó õ$õ õ(õõ"õHõ*õ+õYõ
Bõ9÷x7õ*÷&õ
ðB9#Ø;?ð9#ØQV÷9#õxCðLhà,0ðhð -1ðhð #'÷	hõVð^°$÷ ^õ$$:õN^@õB:ð2Ð^b÷ õ%÷.'r!   