+
    jHàj”  ã                  óV   € R t ^ RIHt ^ RIHt ^ RIHt ]! 0 Rm4      t ! R R4      t	R# )u  Config-driven DM / group intake policy shared by the adapters that gate access themselves
(Weixin, WeCom, QQBot, WhatsApp, Yuanbao's ``AccessPolicy``).

Host contract â€” the adapter sets these on ``self`` before any predicate runs: ``_dm_policy`` /
``_group_policy`` (``open`` | ``allowlist`` | ``disabled`` | ``pairing``), ``_allow_from`` /
``_group_allow_from`` (iterable of allowlist entries), and ``ALLOW_ALL_ENV_PREFIX`` (class
attribute, e.g. ``"WEIXIN"``). Platform-specific allowlist matching goes through
``_entry_matches``; env-seeded allowlists that must be re-read live go through
``_live_dm_allow_from``.

Every env read is profile-scoped and fails closed: under multiplexing ``os.environ`` holds the
DEFAULT profile's opt-in, which must never open a secondary bot's DMs (#93522).
)Úannotations)ÚIterable)Úget_scoped_secretc                  ó¦   a € ] tR t^t$ RtR]R&   V 3R lt]R R l4       tR R lt	R	 R
 lt
R R ltR R ltR R ltR R ltRR R lltRtV ;t# )ÚOwnAccessPolicyMixinÚ ÚstrÚALLOW_ALL_ENV_PREFIXc                	ó¾   <€ \         SV `  ! R/ VB  \        V P                  ;'       g    R 4      P	                  4       '       g   \        V P                   R24      hR# )r   z? mixes in OwnAccessPolicyMixin but sets no ALLOW_ALL_ENV_PREFIXN© )ÚsuperÚ__init_subclass__r   r	   ÚstripÚ	TypeErrorÚ__qualname__)ÚclsÚkwargsÚ	__class__s   &,€ÚJ/home/ubuntu/.hermes/hermes-agent/gateway/platforms/access_policy_mixin.pyr   Ú&OwnAccessPolicyMixin.__init_subclass__   sV   ø€ Ü‰Ò!Ñ+ FÒ+ô �3×+Ñ+×1Ð1¨rÓ2×8Ñ8×:Ò:Ü˜s×/Ñ/Ð0Ð0oÐpÓqÐqñ ;ó    c               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚboolr   )Úformats   "r   Ú__annotate__Ú!OwnAccessPolicyMixin.__annotate__#   s   € ÷ ñ ¨Dñ r   c                	ó   € R # )Tr   ©Úselfs   &r   Úenforces_own_access_policyÚ/OwnAccessPolicyMixin.enforces_own_access_policy"   s   € ár   c               ó   € V ^8„  d   QhRR/# )r   r   ztuple[str, ...]r   )r   s   "r   r   r   &   s   € ÷ [ñ [ oñ [r   c                	ó$   € R V P                    R23# )ÚGATEWAY_ALLOW_ALL_USERSÚ_ALLOW_ALL_USERS)r	   r    s   &r   Ú_allow_all_env_namesÚ)OwnAccessPolicyMixin._allow_all_env_names&   s   € Ø)¨d×.GÑ.GÐ-HÐHXÐ+YÐZÐZr   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   )   s   € ÷ <ñ < 4ñ <r   c                	ó¢   € \         ;QJ d*    R  V P                  4        4       F  '       g   K   R# 	  R# ! R  V P                  4        4       4      # )c              3  ó¦   "  € T FG  p\        \        VR 4      ;'       g    R 4      P                  4       P                  4       \        9   x € KI  	  R# 5i)r   N)r   r   r   ÚlowerÚOPTIN_TRUTHY)Ú.0Únames   & r   Ú	<genexpr>Ú9OwnAccessPolicyMixin._open_dm_opted_in.<locals>.<genexpr>*   sC   é € ð <Ù:�tô Ô(¨¨rÓ2×8Ð8°bÓ9×?Ñ?ÓA×GÑGÓIÌ\ÖYÛ:ùs
   ‚AŸ2ATF)Úanyr(   r    s   &r   Ú_open_dm_opted_inÚ&OwnAccessPolicyMixin._open_dm_opted_in)   sO   € ß‹sñ <Ø#×8Ñ8Ô:ó<�sŒsð 	<Šsð 	<ˆsñ <Ø#×8Ñ8Ô:ó<ó <ð 	<r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚentriesúIterable[str]Útargetr   r   r   r   )r   s   "r   r   r   -   s!   € ÷ !ñ ! mð !¸Sð !ÀTñ !r   c                	ó
   € W!9   # ©Nr   )r!   r7   r9   s   &&&r   Ú_entry_matchesÚ#OwnAccessPolicyMixin._entry_matches-   s   € ØÑ Ð r   c               ó   € V ^8„  d   QhRR/# )r   r   r8   r   )r   s   "r   r   r   0   s   € ÷  ñ   ]ñ  r   c                	ó   € V P                   # r;   )Ú_allow_fromr    s   &r   Ú_live_dm_allow_fromÚ(OwnAccessPolicyMixin._live_dm_allow_from0   s   € Ø×ÑÐr   c               ó    € V ^8„  d   QhRRRR/# ©r   Ú	sender_idr   r   r   r   )r   s   "r   r   r   3   s   € ÷ Fñ F¨ð F°ñ Fr   c                ó²   € V P                   R8X  d!   V P                  V P                  4       V4      # V P                   R8H  ;'       d    V P                  4       # )u:   Strict DM authorization â€” pairing does not imply access.Ú	allowlistÚopen)Ú
_dm_policyr<   rA   r4   )r!   rE   s   &&r   Ú_is_dm_allowedÚ#OwnAccessPolicyMixin._is_dm_allowed3   sJ   € à�?‰?˜kÔ)Ø×&Ñ& t×'?Ñ'?Ó'AÀ9ÓMÐMØ�‰ &Ñ(×EÐE¨T×-CÑ-CÓ-EÐEr   c               ó    € V ^8„  d   QhRRRR/# rD   r   )r   s   "r   r   r   9   s   € ÷ Nñ N¨sð N°tñ Nr   c                ó¬   € \        T;'       g    R4      P                  4       pV'       g   R# V P                  R8H  ;'       g    V P                  V4      # )z·Whether a DM may reach gateway intake; ``pairing`` admits everyone with a principal so the
handshake can run (the pairing gate itself runs later). A blank principal is never admitted.r   FÚpairing)r   r   rI   rJ   )r!   rE   Ú	principals   && r   Ú_is_dm_intake_allowedÚ*OwnAccessPolicyMixin._is_dm_intake_allowed9   sE   € ô ˜	Ÿ˜ RÓ(×.Ñ.Ó0ˆ	ßÙØ�‰ )Ñ+×MÐM¨t×/BÑ/BÀ9Ó/MÐMr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úchat_idr   rE   r   r   r   )r   s   "r   r   r   A   s!   € ÷ ,ñ ,¨ð ,¸ð ,Àdñ ,r   c                óz   € V P                   R8X  d   V P                  V P                  V4      # V P                   R8H  # )zP``disabled``/``pairing``/unknown policies never forward group traffic at intake.rG   rH   )Ú_group_policyr<   Ú_group_allow_from)r!   rS   rE   s   &&&r   Ú_is_group_allowedÚ&OwnAccessPolicyMixin._is_group_allowedA   s:   € à×Ñ Ô,Ø×&Ñ& t×'=Ñ'=¸wÓGÐGØ×!Ñ! VÑ+Ð+r   r   )r   )Ú__name__Ú
__module__r   Ú__firstlineno__r	   Ú__annotations__r   Úpropertyr"   r(   r4   r<   rA   rJ   rP   rW   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      sS   ø‡ Ø "Ð˜#Ó"õrð ôó ðõ[õ<õ!õ õFõN÷,õ ,r   r   N>   Ú1ÚyesÚtrue)
Ú__doc__Ú
__future__r   Útypingr   Úgateway.platforms._sharedr   Ú	frozensetr.   r   r   r   r   Ú<module>rh      s*   ðñõ #å å 7áÒ-Ó.€÷-,ó -,r   