
    i4                    `    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     @/home/ubuntu/.hermes/hermes-agent/tools/browser_camofox_state.pyget_camofox_state_dirr      s    558L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(yM*$
$$  
#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   