+
    jHàjÌ  ã                  óˆ  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIHtHt ^ RI	H
t
Ht ^ RIHtHt ]P                  ! ]4      t]P$                  ! 4       t/ tR]R&   / tR]R	&   R%R
 R lltR R ltR R ltRR/R R lltRR/R R lltRR/R R lltRR/R R lltRR/R R lltR R ltR R lt R R  lt!R! R" lt"R# R$ lt#R# )&züModule-level registry for DashboardAuthProvider instances. Plugins call ``register_provider``
via the plugin context hook at startup; the auth gate iterates ``list_providers()`` and uses
``get_provider`` to dispatch on the session's ``provider`` field.)ÚannotationsN)ÚListÚOptional)Úhermes_home_keyÚnormalize_scope)ÚDashboardAuthProviderÚassert_protocol_complianceú dict[str, DashboardAuthProvider]Ú
_providersz+dict[str, dict[str, DashboardAuthProvider]]Ú_scoped_providersc               ó    € V ^8„  d   QhRRRR/# )é   ÚscopeúOptional[str]Úreturnr	   © )Úformats   "ÚG/home/ubuntu/.hermes/hermes-agent/hermes_cli/dashboard_auth/registry.pyÚ__annotate__r      s   € ÷ ñ �=ð Ð,Lñ ó    c                ó€   € \        \        4      pVP                  \        P	                  \        V 4      / 4      4       V# ©N)Údictr
   Úupdater   Úgetr   )r   Ú	providerss   & r   Ú_mergedr      s3   € Ü”ZÓ €IØ×ÑÔ&×*Ñ*¬?¸5Ó+AÀ2ÓFÔGØÐr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   ÚcreateÚboolr   r	   r   )r   s   "r   r   r      s'   € ÷ cñ c�=ð c¨Tð cÐ6Vñ cr   c               ó~   € V f   \         # V'       d   \        P                  V / 4      # \        P                  V / 4      # )z<Global map for ``scope is None``, else that scope's overlay.)r
   r   Ú
setdefaultr   )r   r   s   &$r   Ú_targetr"      s8   € à‚}ÜÐß6<Ô×'Ñ'¨¨rÓ2ÐbÔBS×BWÑBWÐX]Ð_aÓBbÐbr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚkindÚstrÚproviderr   r   ÚNoner   )r   s   "r   r   r       s'   € ÷ bñ b˜#ð bÐ)>ð bÀ4ñ br   c                ó\   € \         P                  R WP                  VP                  4       R# )z$dashboard-auth: registered %s%r (%s)N)Ú_logÚinfoÚnameÚdisplay_name)r$   r&   s   &&r   Ú_log_registeredr-       s   € Ü‡I�IÐ4°d¿M¹MÈ8×K`ÑK`Öar   r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r&   r   r   r   r   r'   r   )r   s   "r   r   r   $   s#   € ÷ 
+ñ 
+Ð 5ð 
+Àð 
+ÐZ^ñ 
+r   c               ó\  € \        \        V 4      4       \        ;_uu_ 4        \        V4      p\	        VRR7      pVf   TM
\        V4      pV P                  V9   d   \        RV P                  : 24      hWV P                  &   RRR4       \        RV 4       R#   + '       g   i     L; i)zORaises ``TypeError`` on protocol violation, ``ValueError`` on a duplicate name.T©r   Nz,dashboard-auth provider already registered: z	provider )	r   ÚtypeÚ_lockr   r"   r   r+   Ú
ValueErrorr-   )r&   r   ÚtargetÚ	effectives   &$  r   Úregister_providerr6   $   s�   € äœt H›~Ô.ß	ŽÜ Ó&ˆÜ˜ tÔ,ˆØ#šm‘F´¸³ˆ	Ø�=‰=˜IÔ%ÜÐKÈHÏMÉMÑK\Ð]Ó^Ð^Ø (ˆx�}‰}Ñ÷ 
ô �K Ö*÷ 
�ús   £A"BÂB+	c               ó$   € V ^8„  d   QhRRRRRR/# ©r   r+   r%   r   r   r   úOptional[DashboardAuthProvider]r   )r   s   "r   r   r   1   s"   € ÷ (ñ (�sð ( mð (Ð?^ñ (r   c               ó�   € \         ;_uu_ 4        \        V4      P                  V 4      uuRRR4       #   + '       g   i     R# ; i)z@Return the registered provider for ``name``, or None if unknown.N)r2   r   r   ©r+   r   s   &$r   Úget_providerr<   1   s%   € ç	ŽÜ�u‹~×!Ñ! $Ó'÷ 
��‹ús	   �4´A	c               ó$   € V ^8„  d   QhRRRRRR/# r8   r   )r   s   "r   r   r   7   s$   € ÷ 6ñ 6Ø
ð6Ø&ð6Ø2Qñ6r   c               óª   € \         ;_uu_ 4        \        V4      p\        VR R7      P                  V 4      uuRRR4       #   + '       g   i     R# ; i)Fr0   N)r2   r   r"   r   r;   s   &$r   Úsnapshot_registrationr?   7   s2   € ç	ŽÜ Ó&ˆÜ�u UÔ+×/Ñ/°Ó5÷ 
��‹ús   �'AÁA	c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   r+   r%   Úcurrentr   Úpreviousr9   r   r   r   r   r   )r   s   "r   r   r   >   s4   € ÷ ñ Ø
ðØ-ðØ9Xðàðà'+ñr   c               óF  € \         ;_uu_ 4        \        V4      p\        VRR7      pVP                  V 4      VJd    RRR4       R# Vf   VP	                  V R4       MW$V &   Ve   V'       g   \
        P	                  VR4       RRR4       R#   + '       g   i     R# ; i)zBRestore a host-owned provider registration if it is still current.Tr0   NF)r2   r   r"   r   Úpopr   )r+   rA   rB   r   r4   s   &&&$ r   Úrestore_registrationrE   >   s†   € ÷ 
ŽÜ Ó&ˆÜ˜ tÔ,ˆØ�:‰:�dÓ 7Ó*Ø÷	 
‰ð
 ÒØ�J‰J�t˜TÕ"à#�4‰LØÒ§VÜ×!Ñ! %¨Ô.÷ 
ñ ÷ 
Žñ ús   �/BÁ&BÁ/BÂB 	c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   úlist[DashboardAuthProvider]r   )r   s   "r   r   r   P   s   € ÷ -ñ -˜]ð -Ð6Qñ -r   c                ó    € \         ;_uu_ 4        \        \        V 4      P                  4       4      uuRRR4       #   + '       g   i     R# ; i)z0All registered providers, in registration order.N)r2   Úlistr   Úvalues)r   s   $r   Úlist_providersrK   P   s(   € ç	ŽÜ”G˜E“N×)Ñ)Ó+Ó,÷ 
��‹ús	   �"<¼A	c               ó   € V ^8„  d   QhRR/# ©r   r   rG   r   )r   s   "r   r   r   V   s   € ÷ Pñ PÐ9ñ Pr   c                 ój   € \        4        U u. uF  p \        V RR4      '       g   K  V NK  	  up # u up i )zåProviders with ``supports_token`` True, in registration order. The ``token_auth`` seam
consults only these, so OAuth/password-only providers are never asked to ``verify_token``;
empty => a token-authable route fails closed (401).Úsupports_tokenF©rK   Úgetattr©Úps    r   Úlist_token_providersrT   V   s/   € ô &Ô'ÓOÑ'�!¬7°1Ð6FÈ×+N�AˆAÑ'ÑOÐOùÒOó   �0§0c               ó   € V ^8„  d   QhRR/# rM   r   )r   s   "r   r   r   ]   s   € ÷ Qñ QÐ ;ñ Qr   c                 ój   € \        4        U u. uF  p \        V RR4      '       g   K  V NK  	  up # u up i )z—Providers with ``supports_session`` True (interactive cookie sessions); the login page,
/auth/login and the gate's verify/refresh loops use only these.Úsupports_sessionTrP   rR   s    r   Úlist_session_providersrY   ]   s/   € ô &Ô'ÓPÑ'�!¬7°1Ð6HÈ$×+O�AˆAÑ'ÑPÐPùÒPrU   c               ó    € V ^8„  d   QhRRRR/# )r   r&   r   r   r'   r   )r   s   "r   r   r   c   s   € ÷ 2ñ 2Ð'<ð 2Àñ 2r   c                óÀ   € \        \        V 4      4       \        ;_uu_ 4        V \        V P                  &   RRR4       \        RV 4       R#   + '       g   i     L; i)a  Register a host-owned provider in the process-global slot (upsert). The registry is shared
across every profile one dashboard process serves, so these outlive any per-home plugin
manager: always targets ``_providers`` (never a per-home overlay) and *replaces* a same-name
entry instead of raising, so a forced plugin re-discovery (e.g. after a password change)
rotates the provider in place. Pairs with ``unregister_global_provider``.

Pairs with ``unregister_global_provider`` for teardown of the exact object still current (#91701).
Nzglobal provider )r   r1   r2   r
   r+   r-   )r&   s   &r   Úregister_global_providerr\   c   s;   € ô œt H›~Ô.ß	ŽØ$,Œ
�8—=‘=Ñ!÷ 
äÐ&¨Ö1÷ 
�ús   £AÁA	c               ó$   € V ^8„  d   QhRRRRRR/# )r   r+   r%   r&   r   r   r   r   )r   s   "r   r   r   r   s"   € ÷ ñ  Sð Ð4Ið Èdñ r   c                óÒ   € \         ;_uu_ 4        \        P                  V 4      VJ d"   \        P                  V R4        RRR4       R#  RRR4       R#   + '       g   i     R# ; i)z�Remove a global registration if ``provider`` is still current (a stale handle whose
provider was already replaced never clears the live one).NTF)r2   r
   r   rD   )r+   r&   s   &&r   Úunregister_global_providerr_   r   sL   € ÷ 
ŽÜ�>‰>˜$Ó 8Ó+Ü�N‰N˜4 Ô&Ø÷ 
‰Ø+÷ 
ñ ÷	 
Žñ ús   �1AÁA&	c               ó   € V ^8„  d   QhRR/# )r   r   r'   r   )r   s   "r   r   r   |   s   € ÷ "ñ "˜ñ "r   c                 ó¬   € \         ;_uu_ 4        \        P                  4        \        P                  4        RRR4       R#   + '       g   i     R# ; i)z"Test-only: drop all registrations.N)r2   r
   Úclearr   r   r   r   Úclear_providersrc   |   s+   € ç	ŽÜ×ÑÔÜ×ÑÔ!÷ 
��Šús   �)AÁA	r   )$Ú__conditional_annotations__Ú__doc__Ú
__future__r   ÚloggingÚ	threadingÚtypingr   r   Úhermes_constantsr   r   Úhermes_cli.dashboard_auth.baser   r   Ú	getLoggerÚ__name__r)   ÚLockr2   r
   Ú__annotations__r   r   r"   r-   r6   r<   r?   rE   rK   rT   rY   r\   r_   rc   )rd   s   @r   Ú<module>rp      s¾   øðôEõ #ã Û ß !ç =ß \à×Ò˜Ó"€Ø�ŠÓ€Ø/1€
Ð,Ó 1ØACÐ Ð>Ó C÷õcõbð
+ÐQU÷ 
+ð(°d÷ (ð6Ø)-÷6ðà"÷ð$-¨T÷ -õPõQõ2õ÷"r   