§
    øžyj4  ã                  ó`   — d Z ddlmZ ddlZddlmZ ddlmZmZ ddl	m
Z
 dZdZdd„Zddd„ZdS )aR  Hermes-managed Camofox state helpers.

Provides profile-scoped identity and state directory paths for Camofox
persistent browser profiles.  When managed persistence is enabled, Hermes
sends a deterministic userId derived from the active profile so that
Camofox can map it to the same persistent browser profile directory
across restarts.
é    )ÚannotationsN)ÚPath)ÚDictÚOptional)Úget_hermes_homeÚbrowser_authÚcamofoxÚreturnr   c                 ó>   — t          ¦   «         t          z  t          z  S )zAReturn the profile-scoped root directory for Camofox persistence.)r   ÚCAMOFOX_STATE_DIR_NAMEÚCAMOFOX_STATE_SUBDIR© ó    úA/home/ragecks/.hermes/hermes-agent/tools/browser_camofox_state.pyÚget_camofox_state_dirr      s   € åÑÔÕ5Ñ5Õ8LÑLÐLr   Útask_idúOptional[str]úDict[str, str]c                ó  — t          t          ¦   «         ¦  «        }| pd}t          j        t          j        d|› �¦  «        j        dd…         }t          j        t          j        d|› d|› �¦  «        j        dd…         }d|› �d	|› �d
œS )a$  Return the stable Hermes-managed Camofox identity for this profile.

    The user identity is profile-scoped (same Hermes profile = same userId).
    The session key is scoped to the logical browser task so newly created
    tabs within the same profile reuse the same identity contract.
    Údefaultzcamofox-user:Né
   zcamofox-session:ú:é   Úhermes_Útask_)Úuser_idÚsession_key)Ústrr   ÚuuidÚuuid5ÚNAMESPACE_URLÚhex)r   Ú
scope_rootÚlogical_scopeÚuser_digestÚsession_digests        r   Úget_camofox_identityr'      s·   € õ Õ*Ñ,Ô,Ñ-Ô-€JØÐ(˜y€MÝ”*ÝÔØ$˜
Ð$Ð$ñô ô 
ˆ#ˆ2ˆ#ô€Kõ ”ZÝÔØ7˜:Ð7Ð7¨Ð7Ð7ñô ô 
ˆ#ˆ2ˆ#ô€Nð
 +˜[Ð*Ð*Ø/˜~Ð/Ð/ðð ð r   )r
   r   )N)r   r   r
   r   )Ú__doc__Ú
__future__r   r   Úpathlibr   Útypingr   r   Úhermes_constantsr   r   r   r   r'   r   r   r   ú<module>r-      s¯   ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !Ð !Ð !à ,Ð ,Ð ,Ð ,Ð ,Ð ,à'Ð Ø Ð ðMð Mð Mð Mð
ð ð ð ð ð ð r   